Drawing plug-in dialog design with Windows Forms
Tekla Structures drawing plug-in is defined by an attribute which is written prior to the plug-in class. The attribute sets also a name for the plug-in, for example:
[Plugin(“MarkPlugin”)]
[PluginUserInterface("MarkPlugin.MarkPluginForm")]
User interface definition is not mandatory but if user interface is needed it is done with Windows Forms.
StructuresData
StructuresData works as a gateway to the interface. The attribute name of the control in the interface should match the name in the plug-in code. Supported data types are string, double and integer.
Constructor
Every plug-in needs a constructor. The constructor sets the StructuresData from the interface to be in use of the plug-in.
public SlotPlugin(SlotPluginData data)
{
Data = data;
}
DefineInput()
DefineInput is a public method that defines the inputs of the plug-in. Drawing plug-ins support more than one input. Also plugins with zero inputs work. The inputs are passed to the Run method as a List of InputDefinitions.
Use InputDefinitionFactory to create and retrieve input objects. Points and certain drawing objects (bolts and parts) are supported. The method is executed when the drawing plug-in icon is pressed from Tekla Structures.
Inputs can be for example user based picked points or objects found by enumerating objects from views.
Run(List<InputDefinition>inputs)
Run is a public method and it is the main method of the plug-in. This is where the plug-in uses the inputs to affect Tekla Structures. StructuresData provides the information from the dialog of the plug-in and the list of inputs given as an argument provides the inputs from Tekla Structures.