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
SystemObject
  Tekla.Structures.DrawingDrawingHandler

Namespace:  Tekla.Structures.Drawing
Assembly:  Tekla.Structures.Drawing (in Tekla.Structures.Drawing.dll) Version: 2023.0.3
Syntax
[SerializableAttribute]
public sealed class DrawingHandler

The DrawingHandler type exposes the following members.

Constructors
  NameDescription
Public methodDrawingHandler
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.
Top
Methods
  NameDescription
Public methodCloseActiveDrawing
Closes the drawing editor.
Public methodCloseActiveDrawing(Boolean)
Closes the drawing editor.
Public methodGetActiveDrawing
Returns an instance of the active drawing that is currently open in Tekla Structures.
Public methodGetConnectionStatus
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.
Public methodGetDrawingObjectSelector
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.
Public methodGetDrawings
Gets all the drawings from the database.
Public methodGetDrawingSelector
Gets a drawing selector. With a drawing selector the list of selected drawings can be gotten.
Public methodStatic memberGetMessageExecutionStatus Obsolete.
Gets the current message execution mode for the application.
Public methodGetModelObjectIdentifiers
Gets model object identifiers of the drawing.
Public methodGetPicker
Gets a picker for picking points and objects in a drawing.
Public methodIssueDrawing
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.
Public methodPrintDrawing(Drawing, DPMPrinterAttributes)
Prints the drawing using the given printer attributes.
Public methodPrintDrawing(Drawing, PrintAttributes)
Prints the drawing using the given printer instance. NOTE! The drawing cannot be active, otherwise printing fails.
Public methodPrintDrawing(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.
Public methodPrintDrawing(Drawing, PrintAttributes, String)
Prints the drawing to file using the given printer instance. NOTE! The drawing cannot be active, otherwise printing fails.
Public methodPrintDrawings
Prints the list of drawings using the given printer attributes.
Public methodSaveActiveDrawing
Saves the currently open drawing.
Public methodSetActiveDrawing(Drawing)
Sets the active drawing that is currently open in Tekla Structures.
Public methodSetActiveDrawing(Drawing, Boolean)
Sets the active drawing that is currently open in Tekla Structures.
Public methodSetActiveDrawing(Drawing, Boolean, Boolean)
Sets the active drawing that is currently open in Tekla Structures.
Public methodStatic memberSetMessageExecutionStatus Obsolete.
Sets the message execution mode for the application.
Public methodUnissueDrawing
Unissues the drawing. This is the same as pressing Unissue on the drawing list for a selected drawing.
Public methodUpdateDrawing
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.
Top
Fields
  NameDescription
Public fieldStatic memberInstance
The instance.
Top
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
Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.
Previous
Next