0% found this document useful (0 votes)
282 views

2 - Modeling API Introduction

The document discusses the Tekla Open API for modeling tools and plug-ins. It provides an overview of the model API and how it can be used to connect to a model, create/modify objects, interact with the user, and access catalogs. It also describes plug-ins, applications, and macros that can be built with the API to automate tasks or add new functionality to Tekla Structures. The API includes tools for geometric calculations, transformations, and interacting with solids and assemblies in the model.

Uploaded by

Hoang Le Ktbffh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
282 views

2 - Modeling API Introduction

The document discusses the Tekla Open API for modeling tools and plug-ins. It provides an overview of the model API and how it can be used to connect to a model, create/modify objects, interact with the user, and access catalogs. It also describes plug-ins, applications, and macros that can be built with the API to automate tasks or add new functionality to Tekla Structures. The API includes tools for geometric calculations, transformations, and interacting with solids and assemblies in the model.

Uploaded by

Hoang Le Ktbffh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

Tekla Open API: Modeling Tools & Plug-Ins

Model API
Tekla Open API - Model
Macro
API

§ Model API Model


API
Tekla
Structures
Drawing
API

– Connect to a running Tekla Structures model


– Create, modify, and delete model objects Plug-in
API
§ Read and write object attributes
§ Read and write user defined attributes
§ Get report properties for objects
– Interact with the user
§ Get currently selected objects
§ Prompt user to pick objects and locations
§ Select and highlight objects for the user
– Access catalogs (material, bolt, profile, etc.)
– Create and manipulate model views

2 10/9/2017
Structure of the Model API

3 Tekla Open API: Overview & Getting Started


Tekla.Structures.Geometry3D
§ Geometric calculations and tests
– Distance
§ Point to Point, Point to Line, Point to Plane
– Parallel
§ Line to Line, Line to Plane, Plane to Plane
§ Geometric constructions
– Intersection
§ Line to Line, Line to Plane
– Projection
§ Point to Line, Point to Plane, Line to Plane
§ Matrix
§ Transformations from one coordinate system to another
§ MatrixFactory for easy creation of matrixes

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

Input Objects Input Objects 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

Tekla Open API: Modeling Tools & Plug-Ins


11
Accessing Applications
§ Launch Macros
§ Direct Launch

Tekla Open API: Modeling Tools & Plug-Ins


12
Plugins, Custom Components, & Applications

Tekla Open API: Modeling Tools & Plug-Ins


13
Model API Tips
14 Tekla Open API: Modeling Tools & Plug-Ins
Things to Know
§ GetCurrentUser()
§ OBB Class

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.

19 Tekla Open API: Modeling Tools & Plug-Ins


ModelHistory Class
§ Works with Tekla Model Sharing
§ The following methods have been added:
– GetNotSharedObjects() - returns a list of objects created or modified since
the last Sharing WriteOut or multi-user save.
– TakeModifications() - returns the modifications since the previous call and
resets the modification stamp.
– GetModifications() - returns the modifications since the previous call of
– TakeModifications() without resetting the modification stamp.
§ The following methods are obsolete:
– GetModifiedObjects(), GetModifiedObjectsWithType(),
– GetDeletedObjects(), GetDeletedObjectsWithType(),
– GetCurrentModificationStamp()

20 Tekla Open API: Modeling Tools & Plug-Ins


AutoFetch Property
§ New static AutoFetch property in ModelObjectEnumerator
and DrawingObjectEnumerator which increases the
enumeration speed significantly.

21 Tekla Open API: Modeling Tools & Plug-Ins


Bolt Catalog Items

22 Tekla Open API: Modeling Tools & Plug-Ins


Profile Catalog Items

23 Tekla Open API: Modeling Tools & Plug-Ins


Component Catalog Items

24 Tekla Open API: Modeling Tools & Plug-Ins


Frequently Asked Questions
25 Tekla Open API: Modeling Tools & Plug-Ins
Construction Circle

26 Tekla Open API: Modeling Tools & Plug-Ins


Construction Point

27 Tekla Open API: Modeling Tools & Plug-Ins


28
Part Cut

Tekla Open API: Modeling Tools & Plug-Ins


29
Part Add

Tekla Open API: Modeling Tools & Plug-Ins


Unit Conversion
§ Tekla.Structures.Datatype.dll
§ Form control binding

30 Tekla Open API: Modeling Tools & Plug-Ins


Unit Conversion
§ Converting single strings to distance objects

31 Tekla Open API: Modeling Tools & Plug-Ins


32
Finding Connected objects

Tekla Open API: Modeling Tools & Plug-Ins


Creating Assemblies
§ Assembly / CastUnit

Tekla Open API: Modeling Tools & Plug-Ins


33
34
Traversing Assemblies

Tekla Open API: Modeling Tools & Plug-Ins


Rotating Objects
§ MatrixFactory.Rotate(double value, Vector direction)

Tekla Open API: Modeling Tools & Plug-Ins


35
Getting Desired Part Faces
§ Contour plate, local top face

Tekla Open API: Modeling Tools & Plug-Ins


36
Insert LayoutPoint plug-in
§ LayoutPoint is a plug-in that comes with Tekla Structures
installation.
§ You can insert new instances of any plug-in through API

37 Tekla Open API: Modeling Tools & Plug-Ins


Getting Component Children
§ You can get objects created by components in the model

38 Tekla Open API: Modeling Tools & Plug-Ins


Part Cut

39 Tekla Open API: Modeling Tools & Plug-Ins


Part Add

40 Tekla Open API: Modeling Tools & Plug-Ins


B-rep Parts Through API
§ Part Item
§ Insert or edit B-rep type parts
– Insert,
– Delete,
– Modify,
– SetPhase,

Tekla Open API: Modeling Tools & Plug-Ins


– SetUserProperty,
– normal base get
§ ShapeItem & ShapeItemEnumerator classes
§ Enumeration & exporting shape geometry definitions
§ Create B-rep objects utilizing shape definitions

41
B-rep Parts Through API

42 Tekla Open API: Modeling Tools & Plug-Ins


Picking Faces
43 Tekla Open API: Modeling Tools & Plug-Ins
Picker Class

44 Tekla Open API: Modeling Tools & Plug-Ins


Picker Input

45 Tekla Open API: Modeling Tools & Plug-Ins


Getting Face Input from User

46 Tekla Open API: Modeling Tools & Plug-Ins


Thank You
47 Tekla Open API: Modeling Tools & Plug-Ins

You might also like