Tekla Open API: Get/Set User Defined Attributes

This article explains how you can get/set user defined attributes using the tekla open api.

 


Step 1, Add Libraries:

Add reference to the Tekla.Structures.Model library located in the path “C:Program FilesTekla Structures20.0ntbinplugins” and manually open the tekla model. This has been covered in the article below:


Step 2, Get Reference to Object:

You will need to get reference to the object you wish to get/set its user defined attributes. Below are some of the options for achieving this:

1- Get reference to an existing part in the tekla model: VB.Net Get Reference to Object, Tekla Open API

2- Ask the user to select parts from the model: Tekla Open API: Ask User to Select Objects.


Set User Defined Attributes:

The following code will set the “User Field 1” property of the input part object to “New Value”:

Imports TSM = Tekla.Structures.Model

    Private Sub SetUserDefinedField(ByRef objBeam As TSM.Beam)
        objBeam.SetUserProperty("USER_FIELD_1", "New Value")
        objBeam.Modify()
    End Sub

Line 4 sets the user defined attribute for the input part object. The first parameter to the function is the name of the user defined attribute to modify (User field 1 in this example). The second parameter is the value to set it to (“New Value”).
Result:
Blog_Tekla_GetSetUserdefinedProperties_1


Get User Defined Attributes:

The following code will get the “User Field 1” property of the input part object:

Imports TSM = Tekla.Structures.Model

    Private Function GetserDefinedField(ByRef objBeam As TSM.Beam) As String
        Dim strOutput As String

        strOutput = ""
        objBeam.GetUserProperty("USER_FIELD_1", strOutput)
        Return strOutput

    End Function

User Defined Attributes:

You can find all the user defined attribute in the file “objects.inp” located in the path “C:ProgramDataTekla Structures20.0EnvironmentsCommoninp”. Where 20.0 is the version you are using.

Below I have compiled a list of user defined attribute from the file:

String ParameterUser Defined Attribute
IFC_ENTITYIFC entity
IFC_EXPORT_TYPEIFC export type
IFC_BUILDINGIFC building
IFC_BUILDING_STOREYIFC building storey
commentcomment
xs_shortenxs shorten
camberingcambering
PRELIM_MARKPRELIM MARK
PRELIM_ASSEM_MARKPreliminary assembly mark
OBJECT_LOCKEDLocked
fabricatorfabricator name
USER_FIELD_1user field 1
USER_FIELD_2user field 2
USER_FIELD_3user field 3
USER_FIELD_4user field 4
USER_PHASEUserPhase effects numbering
FixedMainViewFixedDrawingMainView
TOCOMANOBJECTTYPETocoman object type
PRODUCT_CODEProduct code
PRODUCT_DESCRProduct description
PRODUCT_WEBSITEProduct website
PRODUCT_WEIGHTProduct weight
PRODUCT_UNITProduct unit
initial_GUIDinitial GUID
EN1090_EXC_PARTExecution class
commentcomment
PRELIM_MARKPRELIM MARK
OBJECT_LOCKEDLocked
fabricatorfabricator name
USER_FIELD_1user field 1
USER_FIELD_2user field 2
USER_FIELD_3user field 3
USER_FIELD_4user field 4
USER_PHASEUserPhase effects numbering
FixedMainViewTopInFormFace
NUMBERING_ORDERNumbering Order
TOCOMANOBJECTTYPETocoman object type
ACNACN control number
ACN_STATUSACN control number status
PRODUCT_CODEProduct code
PRODUCT_DESCRProduct description
PRODUCT_WEBSITEProduct website
initial_GUIDinitial GUID
startAD start node
endAD end node
reactionsEnd reactions
shearShear Vy
momentMoment Mz
tensionTension Nt
compressionCompression Nc
shearZShear Vz
momentYMoment My
torsionTorsion Mx
UDL_CODEUDL code
releasesMomentConnection
CONN_CAPConnectionCapacity
utilityratio1Utility ratio1
conn_codeconn code
AD_saved_propAD saved prop
ADUtilityRatioUtility ratio
ADReinfAreaReinforcement area
__DisableOrientMain axis direction
DR_ASSIGNED_TOAssignedTo
DR_ASSIGNED_BYAssignedBy
DR_DRAWN_BYDrawnBy
DR_CHECKED_BYCheckedBy
DR_CHECKED_DATECheckedDate
DR_APPROVAL_SENTSentforApproval
DR_APPROVAL_DATEApprovalDate
DR_APPROVED_BYApprovedBy
commentcomment
DRAWING_USERFIELD_1user field 1
DRAWING_USERFIELD_2user field 2
DRAWING_USERFIELD_3user field 3
DRAWING_USERFIELD_4user field 4
DRAWING_USERFIELD_5user field 5
DRAWING_USERFIELD_6user field 6
DRAWING_USERFIELD_7user field 7
DRAWING_USERFIELD_8user field 8
commentcomment
USER_FIELD_1user field 1
USER_FIELD_2user field 2
USER_FIELD_3user field 3
USER_FIELD_4user field 4
USER_PHASEUserPhase effects numbering
REBAR_SEQ_NOrebar sequence number
PRODUCT_DESCRProduct description
UT_REBAR_TYPEunitechnik reinforcement type
commentcomment
USER_FIELD_1user field 1
USER_FIELD_2user field 2
USER_FIELD_3user field 3
USER_FIELD_4user field 4
WELD_COMMENTweld comment
WELD_USERFIELD_1weld ufield 1
WELD_USERFIELD_2weld ufield 2
WELD_USERFIELD_3weld ufield 3
WELD_USERFIELD_4weld ufield 4
WELD_USERFIELD_5weld ufield 5
WELD_USERFIELD_6weld ufield 6
WELD_USERFIELD_7weld ufield 7
WELD_USERFIELD_8weld ufield 8
OBJECT_LOCKEDLocked
BOLT_COMMENTbolt comment
BOLT_USERFIELD_1bolt ufield 1
BOLT_USERFIELD_2bolt ufield 2
BOLT_USERFIELD_3bolt ufield 3
BOLT_USERFIELD_4bolt ufield 4
BOLT_USERFIELD_5bolt ufield 5
BOLT_USERFIELD_6bolt ufield 6
BOLT_USERFIELD_7bolt ufield 7
BOLT_USERFIELD_8bolt ufield 8
OBJECT_LOCKEDLocked
PROJECT_COMMENTproj comment
PROJECT_USERFIELD_1user field 1
PROJECT_USERFIELD_2user field 2
PROJECT_USERFIELD_3user field 3
PROJECT_USERFIELD_4user field 4
PROJECT_USERFIELD_5user field 5
PROJECT_USERFIELD_6user field 6
PROJECT_USERFIELD_7user field 7
PROJECT_USERFIELD_8user field 8
EN1090_EXCExecution class
IFC_SITEIFC site
IFC_BUILDINGIFC building
IFC_BUILDING_STOREYIFC building storey
Longitude_gradLongitude grad
Longitude_minutesLongitude minutes
Longitude_secondsLongitude seconds
Longitude_millionthsLongitude millionths
Latitude_gradLatitude grad
Latitude_minutesLatitude minutes
Latitude_secondsLatitude seconds
Latitude_millionthsLatitude millionths
ElevationElevation
North_directionNorth direction angle
labelAssignedTo
labelAssignedBy
labelChecked by
labelCheck date
FACTORY_LOCATIONfactory location
commentcomment
example_stringample string
example_integerample integer
example_floatample float
ref_descriptionDescription
OBJECT_LOCKEDLocked
ref_info_stringInfotext
ref_logical_nameLogical name
subref_descriptionDescription
subref_info_stringInfotext
subref_logical_nameLogical name
OBJECT_LOCKEDLocked
commenta comment
USER_FIELD_1a user field 1
USER_FIELD_2a user field 2
USER_FIELD_3a user field 3
USER_FIELD_4a user field 4
PRELIM_ASSEM_MARKPreliminary assembly mark
ACNACN control number
EN1090_EXC_ASSEMBLYExecution class
IFC_ASSEMBLYIFC entity
commentcomment
USER_FIELD_1user field 1
USER_FIELD_2user field 2
USER_FIELD_3user field 3
USER_FIELD_4user field 4
ACNACN control number
commentcomment
USER_FIELD_1user field 1
USER_FIELD_2user field 2
USER_FIELD_3user field 3
USER_FIELD_4user field 4
ACNACN control number
OBJECT_LOCKEDLocked
OBJECT_LOCKEDLocked
SCENARIO_UDANAMEenario
TASKTYPE_UDANAMEsk Type
CONTRACTOR_UDANAMEntractor
POUR_NUMBERPour number
POUR_TYPEPour type
CONCRETE_MIXTUREPour concrete mixture
COMMENTcomment
USER_FIELD_1user field 1
USER_FIELD_2user field 2
USER_FIELD_3user field 3
USER_FIELD_4user field 4
COMMENTcomment
BREAK_TYPEPour break type

You can download the sample code and file for this article from the link below:

If you need assistance with your Tekla model, or you are looking for a Tekla Open API programmer to hire feel free to contact me. Also please visit my home page www.software-solutions-online.com

One thought on “Tekla Open API: Get/Set User Defined Attributes”

  1. Ismayil says:

    Hi, Can u show me this codes for C#?

Leave a Reply

Your email address will not be published. Required fields are marked *

privacy policy