0% found this document useful (0 votes)
77 views12 pages

5 - Custom Properties

This document discusses custom property plugins in Tekla Structures' internal API. It explains that custom property plugins allow external calculation of template fields, are implemented as .NET class libraries, and execute synchronously. The document covers the basics of defining a custom property plugin, including required attributes and interfaces, as well as how to add input, execute the plugin, and debug it. An example plugin project is provided to create a custom property plugin that returns a modified part mark string.

Uploaded by

Văn Tiến BÙi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views12 pages

5 - Custom Properties

This document discusses custom property plugins in Tekla Structures' internal API. It explains that custom property plugins allow external calculation of template fields, are implemented as .NET class libraries, and execute synchronously. The document covers the basics of defining a custom property plugin, including required attributes and interfaces, as well as how to add input, execute the plugin, and debug it. An example plugin project is provided to create a custom property plugin that returns a modified part mark string.

Uploaded by

Văn Tiến BÙi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Tekla Internal API

Custom Property Plug-in Basics


Objective
§ Understand the basics of Custom
Property Plug-ins
– How to define
– How to add your Plug-in to Tekla Structures
– How to debug a Plug-in
– How to connect to Template
§ Understand Plug-in logical structure
– Value types
– Input
What are Custom Property plug-ins
§ Enables external calculation for template fields
– I.e. for custom areas, special product codes, custom marks in
drawings
§ Identification based on “CUSTOM.” in property name
§ Are implemented as .NET class libraries (dll) with specific
metadata
§ Currently internal API, not meant for public use
§ Execution is synchronous
– Asynchronous actions forbidden!
Data, input, and execution
§ Custom property value is needed Template field
for template
§ New Plug-in started Input object

– Constructor method runs internally


– Correct method based on value type
(int, double, string) is called
– Input object id based on context is Plug-in
passed to plug-in as argument in call
Input object
method
§ Custom property value is Property value
calculated and passed back to
template field
Basic requirements of Custom property
§ References to System.ComponentModel.Composition and
Tekla.Structures.CustomPropertyPlugin.dll
§ Class implements ICustomPropertyPlugin interface
– Interface is defined in Tekla.Structures.CustomPropertyPlugin.dll
§ Needed Custom Attributes
– Export attribute for MEF: [Export(typeof(ICustomPropertyPlugin))]
– Property type and name :
[ExportMetadata("CustomProperty","CUSTOM.TEST_PROPERTY")]
§ Unit conversions defined in template setting files
Example:

6 [Date]
Running and Debugging a Plug-in
§ Preparation
– Copy the project dll and pdb file to the Plug-ins folder
or a sub folder
– Run Tekla Structures
– Set breakpoints in the code
§ Debugging
– Debug > Attach to process
– Run or modify the Plug-in
– Debug > Stop debugging
§ Changes
– On the fly code changes are not possible
– A new dll requires a restart of Tekla Structures
Notes
§ Visual Studio
– Plug-in projects are a ‘Class Library’ (e.g. dll)
§ Plug-in dlls
– More than one Plug-in can be created in the same dll under the
same project
§ No message boxes and pop-up dialogs
– Any dialogs and message boxes will be shown again for each Plug-in
instance
§ Trouble shooting
– Information about problems loading Plug-ins or problems with
the dialog can be found from the session history log
Limitations and known problems
§ Performance issues
– Plug-ins load when first one is called
§ Error handling
– Information level in log file is basic
Exercise
Custom Property Plug-ins
Objective: Create a Custom property plug-in for
custom part mark
1. Create new class library project CustomPartMark
2. Add references to System.ComponentModel.Composition, Tekla.Structures.CustomPropertyPlugin.dll
3. Add needed custom attributes before class definition
[ExportMetadata("CustomProperty", "CUSTOM.PART_POS")]
4. Implement methods in ICustomPropertyPlugin
5. In GetStringProperty(int objectId) return new part mark string
§ Either based on given id or
§ Add reference to Tekla.Structures.Model.dll, select the model object using new Model().SelectModelObject(new
Identifier(id)), get report property (”PART_POS”) and return modified property to core
6. Modify a report (i.e. Part_List.rpt) and change GetValue(“PART_POS”) -> GetValue(“CUSTOM.PART_POS”)
in “PART_POS” field
7. Copy dll to subfolder of Plugins, start TS and run report

– Fetches UDAs of parts and


– Writes UDAs to Xml file
– Filename given as parameter for plug-in
– Inp used for dialog definition

10/9/2017
Thank You
12
[Date]

You might also like