Tags

, , ,

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 Files\Tekla Structures\20.0\nt\bin\plugins” 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:\ProgramData\Tekla Structures\20.0\Environments\Common\inp”. Where 20.0 is the version you are using.

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

String Parameter User Defined Attribute
IFC_ENTITY IFC entity
IFC_EXPORT_TYPE IFC export type
IFC_BUILDING IFC building
IFC_BUILDING_STOREY IFC building storey
comment comment
xs_shorten xs shorten
cambering cambering
PRELIM_MARK PRELIM MARK
PRELIM_ASSEM_MARK Preliminary assembly mark
OBJECT_LOCKED Locked
fabricator fabricator name
USER_FIELD_1 user field 1
USER_FIELD_2 user field 2
USER_FIELD_3 user field 3
USER_FIELD_4 user field 4
USER_PHASE UserPhase effects numbering
FixedMainView FixedDrawingMainView
TOCOMANOBJECTTYPE Tocoman object type
PRODUCT_CODE Product code
PRODUCT_DESCR Product description
PRODUCT_WEBSITE Product website
PRODUCT_WEIGHT Product weight
PRODUCT_UNIT Product unit
initial_GUID initial GUID
EN1090_EXC_PART Execution class
comment comment
PRELIM_MARK PRELIM MARK
OBJECT_LOCKED Locked
fabricator fabricator name
USER_FIELD_1 user field 1
USER_FIELD_2 user field 2
USER_FIELD_3 user field 3
USER_FIELD_4 user field 4
USER_PHASE UserPhase effects numbering
FixedMainView TopInFormFace
NUMBERING_ORDER Numbering Order
TOCOMANOBJECTTYPE Tocoman object type
ACN ACN control number
ACN_STATUS ACN control number status
PRODUCT_CODE Product code
PRODUCT_DESCR Product description
PRODUCT_WEBSITE Product website
initial_GUID initial GUID
start AD start node
end AD end node
reactions End reactions
shear Shear Vy
moment Moment Mz
tension Tension Nt
compression Compression Nc
shearZ Shear Vz
momentY Moment My
torsion Torsion Mx
UDL_CODE UDL code
releases MomentConnection
CONN_CAP ConnectionCapacity
utilityratio1 Utility ratio1
conn_code conn code
AD_saved_prop AD saved prop
ADUtilityRatio Utility ratio
ADReinfArea Reinforcement area
__DisableOrient Main axis direction
DR_ASSIGNED_TO AssignedTo
DR_ASSIGNED_BY AssignedBy
DR_DRAWN_BY DrawnBy
DR_CHECKED_BY CheckedBy
DR_CHECKED_DATE CheckedDate
DR_APPROVAL_SENT SentforApproval
DR_APPROVAL_DATE ApprovalDate
DR_APPROVED_BY ApprovedBy
comment comment
DRAWING_USERFIELD_1 user field 1
DRAWING_USERFIELD_2 user field 2
DRAWING_USERFIELD_3 user field 3
DRAWING_USERFIELD_4 user field 4
DRAWING_USERFIELD_5 user field 5
DRAWING_USERFIELD_6 user field 6
DRAWING_USERFIELD_7 user field 7
DRAWING_USERFIELD_8 user field 8
comment comment
USER_FIELD_1 user field 1
USER_FIELD_2 user field 2
USER_FIELD_3 user field 3
USER_FIELD_4 user field 4
USER_PHASE UserPhase effects numbering
REBAR_SEQ_NO rebar sequence number
PRODUCT_DESCR Product description
UT_REBAR_TYPE unitechnik reinforcement type
comment comment
USER_FIELD_1 user field 1
USER_FIELD_2 user field 2
USER_FIELD_3 user field 3
USER_FIELD_4 user field 4
WELD_COMMENT weld comment
WELD_USERFIELD_1 weld ufield 1
WELD_USERFIELD_2 weld ufield 2
WELD_USERFIELD_3 weld ufield 3
WELD_USERFIELD_4 weld ufield 4
WELD_USERFIELD_5 weld ufield 5
WELD_USERFIELD_6 weld ufield 6
WELD_USERFIELD_7 weld ufield 7
WELD_USERFIELD_8 weld ufield 8
OBJECT_LOCKED Locked
BOLT_COMMENT bolt comment
BOLT_USERFIELD_1 bolt ufield 1
BOLT_USERFIELD_2 bolt ufield 2
BOLT_USERFIELD_3 bolt ufield 3
BOLT_USERFIELD_4 bolt ufield 4
BOLT_USERFIELD_5 bolt ufield 5
BOLT_USERFIELD_6 bolt ufield 6
BOLT_USERFIELD_7 bolt ufield 7
BOLT_USERFIELD_8 bolt ufield 8
OBJECT_LOCKED Locked
PROJECT_COMMENT proj comment
PROJECT_USERFIELD_1 user field 1
PROJECT_USERFIELD_2 user field 2
PROJECT_USERFIELD_3 user field 3
PROJECT_USERFIELD_4 user field 4
PROJECT_USERFIELD_5 user field 5
PROJECT_USERFIELD_6 user field 6
PROJECT_USERFIELD_7 user field 7
PROJECT_USERFIELD_8 user field 8
EN1090_EXC Execution class
IFC_SITE IFC site
IFC_BUILDING IFC building
IFC_BUILDING_STOREY IFC building storey
Longitude_grad Longitude grad
Longitude_minutes Longitude minutes
Longitude_seconds Longitude seconds
Longitude_millionths Longitude millionths
Latitude_grad Latitude grad
Latitude_minutes Latitude minutes
Latitude_seconds Latitude seconds
Latitude_millionths Latitude millionths
Elevation Elevation
North_direction North direction angle
label AssignedTo
label AssignedBy
label Checked by
label Check date
FACTORY_LOCATION factory location
comment comment
example_string ample string
example_integer ample integer
example_float ample float
ref_description Description
OBJECT_LOCKED Locked
ref_info_string Infotext
ref_logical_name Logical name
subref_description Description
subref_info_string Infotext
subref_logical_name Logical name
OBJECT_LOCKED Locked
comment a comment
USER_FIELD_1 a user field 1
USER_FIELD_2 a user field 2
USER_FIELD_3 a user field 3
USER_FIELD_4 a user field 4
PRELIM_ASSEM_MARK Preliminary assembly mark
ACN ACN control number
EN1090_EXC_ASSEMBLY Execution class
IFC_ASSEMBLY IFC entity
comment comment
USER_FIELD_1 user field 1
USER_FIELD_2 user field 2
USER_FIELD_3 user field 3
USER_FIELD_4 user field 4
ACN ACN control number
comment comment
USER_FIELD_1 user field 1
USER_FIELD_2 user field 2
USER_FIELD_3 user field 3
USER_FIELD_4 user field 4
ACN ACN control number
OBJECT_LOCKED Locked
OBJECT_LOCKED Locked
SCENARIO_UDANAME enario
TASKTYPE_UDANAME sk Type
CONTRACTOR_UDANAME ntractor
POUR_NUMBER Pour number
POUR_TYPE Pour type
CONCRETE_MIXTURE Pour concrete mixture
COMMENT comment
USER_FIELD_1 user field 1
USER_FIELD_2 user field 2
USER_FIELD_3 user field 3
USER_FIELD_4 user field 4
COMMENT comment
BREAK_TYPE Pour 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