2 - Modeling API Introduction
2 - Modeling API Introduction
Model API
Tekla Open API - Model
Macro
API
2 10/9/2017
Structure of the Model API
4
API Use Types
5
Types of API Projects
§ Macros
– Recorded scripts
– Version independent
§ Plug-ins
– Internal to Tekla Structures
– Update automatically to changes
§ Applications
– External to Tekla Structures
– Increased flexibility
6
Characteristics of Tekla plugins
§ A custom entity in the model (component)
§ Has a dialog of its own
§ Can create new model objects (even other plugins)
§ Can be a connection, detail or generic component
7
Accessing plugins
§ Component Catalog
§ Installed
§ Downloaded
8
Inserting new plugin into model
§ New Plugin is started
– Constructor method runs
– Input prompted from user
§ Applied values taken from dialog
§ Plugin Run() when input complete
– Both the StructuresData and the Input are stored to the Tekla model database
PLUGIN
User UI (Dialog) .
StructuresData
9
Plug-in dependency
§ Plug-ins cannot modify their inputs.
§ Plug-ins dependency can be set with the attribute
InputObjectDependency.
– Dependent: updated when input changes.
– Non-Dependent: doesn’t update when input changes.
– Geometrically-Dependent: Plug-in updates when the input part
geometry changes. This Plug-in cannot create any boolean objects to
the input part, since it would cause and endless loop.
– Non-Dependant-Modifiable: No dependency on input but the
instance is modifiable in the model. The created objects have a
relation to the plug-in. The plug-in dialog can be opened from the
created objects.
10
Plugins & Applications
Plugins Applications
§ Great alternative to custom § Great for doing work in the
components model
§ Live in model § One shot and done
15
Things to Know
§ Solid.IntersectAllFaces() allows use of high-accuracy solids.
– Part.GetSolid(),
– Solid.Intersect(LineSegment),
– Solid.Intersect(Point, Point).
§ Rebar geometries fetched in deformed form by default.
16
Things to Know: Catalogs
§ Rebar catalog: Item export and import methods
§ Mesh catalog: Item export and import methods
§ Shape catalog: Export() method in ShapeItem class
§ ImportShapes() method in CatalogHandler class
§ Import from folder for:
– LibraryProfileItems,
– ParametricProfileItems,
– MaterialItems,
– Custom components.
17
Getting profile item and user attributes
§ items = new CatalogHandler().GetLibraryProfileItems();
§ aProfileItemUserParameters give list of user attributes
§ aProfileItemParameters
§ aProfileItemAnalysisParameters
§ Type, name, Sketch & sketch info
§ Export
18
Solid Class
§ Contains GetAllIntersectionPoints method that gets all the
intersection points between the solid and a plane.
Compared to the IntersectAllFaces method, it does not
arrange the points into polygons, and is thus a lot faster.
§ Solid.SolidCreationTypeEnum.NORMAL_WITHOUT_WELDPR
EPS has been added to the part.GetSolid() method.
41
B-rep Parts Through API