DrawingHandler Class |
The DrawingHandler class initializes the interface from a .NET application to Tekla Structures. This object
must be created before any actions can be performed on Tekla Structures drawings.
When this object is created, it is possible to ask the current active
drawing in Tekla Structures, get a list of drawings or create a new drawing.
Inheritance Hierarchy
Namespace: Tekla.Structures.Drawing
Assembly: Tekla.Structures.Drawing (in Tekla.Structures.Drawing.dll) Version: 2023.0.3
Syntax
The DrawingHandler type exposes the following members.
Constructors
Name | Description | |
---|---|---|
DrawingHandler |
Creates a new drawing handler instance, a "handle" to Tekla.Structures.Drawing.
When a drawing handler object is created, it is possible to ask the current active drawing
in Tekla Structures, get a list of drawings or create a new drawing.
|
Methods
Name | Description | |
---|---|---|
CloseActiveDrawing |
Closes the drawing editor.
| |
CloseActiveDrawing(Boolean) |
Closes the drawing editor.
| |
GetActiveDrawing |
Returns an instance of the active drawing that is currently open in Tekla Structures.
| |
GetConnectionStatus |
Returns true if a proper connection to the Tekla Structures process has been established. A proper connection
to Tekla Stuctures in the drawing API needs Tekla Structures up and running and a model open.
Currently, there's no way to re-establish the connection.
| |
GetDrawingObjectSelector |
Gets a drawing object selector.
With a drawing object selector drawing objects can be selected and highlighted in the drawing editor.
A drawing object selector also provides a list of currently selected drawing objects.
| |
GetDrawings |
Gets all the drawings from the database.
| |
GetDrawingSelector |
Gets a drawing selector.
With a drawing selector the list of selected drawings can be gotten.
| |
GetMessageExecutionStatus | Obsolete.
Gets the current message execution mode for the application.
| |
GetModelObjectIdentifiers |
Gets model object identifiers of the drawing.
| |
GetPicker |
Gets a picker for picking points and objects in a drawing.
| |
IssueDrawing |
Issues the drawing if the drawing is not issued or was previously issued but has been modified since.
This is the same as pressing Issue on the drawing list for a selected drawing.
| |
PrintDrawing(Drawing, DPMPrinterAttributes) |
Prints the drawing using the given printer attributes.
| |
PrintDrawing(Drawing, PrintAttributes) |
Prints the drawing using the given printer instance.
NOTE! The drawing cannot be active, otherwise printing fails.
| |
PrintDrawing(Drawing, DPMPrinterAttributes, String) |
Prints the drawing to file using the given printer attributes and name of the output file.
The given output file overrides the printer attributes file settings.
| |
PrintDrawing(Drawing, PrintAttributes, String) |
Prints the drawing to file using the given printer instance.
NOTE! The drawing cannot be active, otherwise printing fails.
| |
PrintDrawings |
Prints the list of drawings using the given printer attributes.
| |
SaveActiveDrawing |
Saves the currently open drawing.
| |
SetActiveDrawing(Drawing) |
Sets the active drawing that is currently open in Tekla Structures.
| |
SetActiveDrawing(Drawing, Boolean) |
Sets the active drawing that is currently open in Tekla Structures.
| |
SetActiveDrawing(Drawing, Boolean, Boolean) |
Sets the active drawing that is currently open in Tekla Structures.
| |
SetMessageExecutionStatus | Obsolete.
Sets the message execution mode for the application.
| |
UnissueDrawing |
Unissues the drawing.
This is the same as pressing Unissue on the drawing list for a selected drawing.
| |
UpdateDrawing |
Updates the drawing.
This is the same as pressing Update on the drawing list for a selected drawing.
NOTE! The drawing cannot be active, otherwise the operation fails.
NOTE! Numbering must be executed before this operation.
|
Fields
Examples
using Tekla.Structures.Drawing; public class Example { public void Example1() { // Open the interface, get the current drawing and loop through all the views in the drawing. DrawingHandler DrawingHandler = new DrawingHandler(); if(DrawingHandler.GetConnectionStatus()) { Drawing CurrentDrawing = DrawingHandler.GetActiveDrawing(); if(CurrentDrawing != null) { DrawingObjectEnumerator Enum = CurrentDrawing.GetSheet().GetViews(); while(Enum.MoveNext()) { Tekla.Structures.Drawing.View View = Enum.Current as Tekla.Structures.Drawing.View; // Perform actions for the view here. } } } } }
using Tekla.Structures.Drawing; using Tekla.Structures.Geometry3d; public class Example { public void Example1() { // Add some views. DrawingHandler DrawingHandler = new DrawingHandler(); Drawing MyDrawing = DrawingHandler.GetActiveDrawing(); if(MyDrawing == null) // If the drawing editor is not open, create a new drawing with standard settings. { MyDrawing = new GADrawing(); MyDrawing.Insert(); } DrawingHandler.SetActiveDrawing(MyDrawing, false); if(MyDrawing != null) { Tekla.Structures.Drawing.View MyView = new Tekla.Structures.Drawing.View(MyDrawing.GetSheet(), new CoordinateSystem(), new CoordinateSystem(), new AABB(new Point(), new Point(10000, 10000, 10000))); MyView.Insert(); MyView = new Tekla.Structures.Drawing.View(MyDrawing.GetSheet(), new CoordinateSystem(), new CoordinateSystem(), new AABB(new Point(), new Point(30000, 30000, 10000))); MyView.Insert(); } DrawingHandler.SaveActiveDrawing(); // Save is needed if the drawing is opened to the editor with SetActiveDrawing. } }
See Also