Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Drawing API Introduction

Download as pdf or txt
Download as pdf or txt
You are on page 1of 74

Drawing API

1
Introduction

What is the Drawing API


2
Drawing API
§ Toolkit you need to connect to Tekla drawings
– Extend existing functionality
– Automate tasks
– Create new functionality
– Create new drawing type objects
– Personalize the presentation of model graphics
§ Benefits
– Automate tedious and unpleasant tasks
– Change the look and control over parts and annotations
– Ultimately save considerable time and money

3
Common Use Cases
§ Drawing API
– Access the drawing list.
– Create, modify and delete.
§ GA drawings and views in any drawing.
§ Dimensions, text and other basic objects.
– Interact with the user.
§ Get currently selected drawing objects.
§ Prompt user to pick objects and locations.
§ Select and highlight objects for the user.
– Access model objects from the drawing.
§ Select the parts found in a drawing in the model.

4
Implementation Categories
Recorded scripts calling commands in the Tekla
Structures interface for Model and Drawings. (C#,
(*.cs) API Library can be used here)

Create, Modify, Delete,


Extract Information, Set (*.exe)
User Attributes,
Navigate, Call Macros. Tools that connect and interact with Tekla Structures

(*.dll)

Parametric, run inside Tekla Structures, fast.

5
Drawing API
§ Toolkit you need to connect to Tekla drawings
– Extend existing functionality
– Automate tasks
– Create new functionality
– Create new drawing type objects
– Personalize the presentation of model graphics
§ Benefits
– Automate tedious and unpleasant tasks
– Change the look and control over parts and annotations
– Ultimately save considerable time and money

6
Drawing Match Line
§ Creates thick, custom
polyline that is very
easy to see on
drawings
§ Illustrates where
drawings get isolated
§ Multiple lines offset
together, but
grouped with its own
user interface

7
Macros : What are they
§ Scripts recorded from Tekla directly, can automate some
things easily
§ Can run directly un-compiled c# code
§ Independent of versions
§ Easy to create
§ Low maintenance
§ Not good for User Interfaces, but great for smaller tools that
do not need dialogs
§ Freeze Tekla Structures until finished running
§ Sample template you can now download under UM 2012

8
Examples of Macros
§ Remove Change Clouds*
§ Re-Open drawing, forces templates to update*
§ Start Point-Checker, Creates symbols at the physical start
end of a model beam into the drawing*
§ Top in Form Symbol - Creates symbols on the face that is set
to the ‘up in form’ side of the column or other type concrete
part
§ Simple, modular dimensioning tools
– Dimension strand or rebar
– Dimension bolt group

9
Bolt Dimension Tool

10
Sample Code In Macro – Reopen drawing

11
Drawing Applications
12
Drawing Applications : What are they
§ Executable programs that run outside Tekla
Structures and communicate back and forth
between the model and drawings.
§ Slower than plugins, run asynchronously with Tekla
§ Ideal for larger and more complex applications that
need real user interfaces
§ Unlimited in use cases and possibilities
§ Can call ‘helper’ plugins to extract data from the
drawing or do smaller tasks

13
Anchor Rod Tools
§ Connection Code

14
Beam Mark

15
Detail Drawing Manager
§ Originated from the
request for standard
details need.
§ Similar to blocks, but
this tool adds real
native Tekla lines,
hatching, and other
2d objects on top of
model graphics
§ Intelligence to model
objects is retained

16
Key Concepts
17
Drawing Architecture (Typical GA Drawing)

Y Y

X X
Y

18
View Architecture

Main defining Geometry


§ View Coordinate System
§ Display Coordinate System
§ Origin
§ Restriction Box (How much of the model you see)

19
Examples

20
Dimension Architecture

Dimension
Points

21
Dimension Direction Vectors
§ Sets the up position relative to the direction that is to
be dimensioned, always *90 from dimension line
– Horizontal, Vertical, Skew dimension
– Sets the direction to where dimension is placed
§ Left, Right, Up, Down from object it is dimensioning
– Set using a Vector (x value, y value, z value)
§ Relative to DisplayCoordinateSystem

22
Drawing objects
§ Are not the same as model objects
– Presentation object that represents the model object in the drawing
interface. E.g. Color, accuracy, symbol
§ Can be many different types of objects including text, lines,
marks
§ Can get model object identifier for the model part that the
drawing part represents
– You can not change the Model object when a drawing is open, but
you can get information from it

23
Model API versus the Drawings
§ Drawings are just presentations of the model objects
§ Drawing part settings
§ Model object

24
Get model object from drawing object
§ Drawing Parts have a method to get the model object
identifier
§ Make sure custom line types are NOT used

25
Transforming Points to View Local

26
Show from coordinate system to local
Global System Local System
§ Origin § Origin
– (640540.24,554707.56, – (0,0,0)
5687.32)

[Date]

27
Drawing Handler
new DrawingHandler();
§ Check if a drawing is currently open
– GetActiveDrawing() check if null or
Drawing
§ Gets Picker for getting input from user
§ Closes, Saves, and Opens drawings
– Can open drawing hidden in background
– SetActiveDrawing(myDrawing, false);
§ Get drawings from drawing list

28
Drawing API Tips
29
Things to Know
§ The UpdateDrawing command is in the DrawingHandler
class. This command allows the non-up-to-date drawings in
the drawing list to be updated as if used from the user
interface.
§ ExcludePartsAccordingToFilter
– You can set the filter to be used for StraightDimensionSet tags.
– If an invalid ExcludePartsFilter is given, it will become None.
– StraightDimensionSet.GetAllExcludePartsAccordingToFilter() queries
the available ExcludePartsAccordingToFilters.

30
Things to Know
§ AssemblyDrawing, CastUnitDrawing (both by id and by
position) and SinglePartDrawing can be created and
inserted. Insert always inserts the drawing using the view
creation rules. Views are added as defined by the rules.
§ The GetDrawing method in the DrawingObject, lets all
objects now know to which drawing they belong.
§ The GetOriginalDrawing method in the ViewBase class lets
views now know if they are linked to another drawing or
not.

31
Things to Know
§ The following drawing objects can be hidden:
– ModelObject (all objects inherited from the ModelObject class)
– WeldMark (the drawing weld mark)
– Text
– Symbol
– MarkBase (all marks)
– GraphicObject (all graphical objects)
– DimensionBase (all single dimensions)
– DimensionSetBase (all dimension sets)

32
Things to Know
§ Create preset views on Assembly type Drawings

33
Things to Know
§ LoadAttributes sets the FixedViewPlacing property.
§ LoadAttributes also loads the layout of a drawing just as if
done from the Tekla Structures user interface.
§ When modifying a view, the drawing plug-ins inside the view
are also updated.

34
Hideable Feature
§ The Hideable member has the following information:
– bool IsHidden, which gives the information if the object is hidden or
visible.
– HideFromDrawingView() function hides the object in the current
view it exists in.
– HideFromDrawing() function hides the object in all the views it exists
in.
– ShowInDrawingView() function shows the object in the current view
it exists in.
– ShowInDrawing() function shows the object in all the views it exists
in.

35
Create New Assembly Drawing
§ Create assembly drawings through the API with views and
settings for part objects

36
Frequently Asked Questions
37
Create New GA Drawing

38
Create View

39
Drawing.UI Picker
How to get a drawing object from the user

40
Example: Open a drawing in background
§ It is possible to open drawing hidden to user in order to add
views or change objects in the views if needed.

41
Example: Check if a drawing is open

42
Example: Get certain drawing
§ The DrawingHandler is also useful for getting drawings

43
Get model object from drawing object
§ Drawing Parts have a method to get the model object
identifier

44
StraightDimensionSetHandler
new StraightDimensionSetHandler();
§ Easiest way to create dimension ‘set’
§ Set is multiple dimensions grouped together
§ CreateDimensionSet(View, Points, Direction, Offset);

45
Example: Create dimension to bolts

46
Inserting Text into Drawing

47
Inserting Symbols into Drawing

48
Create new Blank GA drawing

49
Marks
§ Generic mark base
§ 3 Types of placement
§ Associative Note UI shown to user

§ Getting existing marks


§ Getting drawing part from mark

50
Insert Mark into Drawing

51
Get Information from Selected

52
Insert Drawing Plug-in

53
Auto Drawings from File

54
Detail View
§ New static method on View class

55
Section View
§ New static method on View class

56
Curved Section View
§ New static method on View class

57
Detail Mark Symbol

58
Section Mark Symbol

59
Get Marks from Drawing Part
§ GetRelatedObjects()

60
Drawing Non-Dependent Plugins
§ Part of drawing plugin
framework
§ Plugin Definition Class
Setting
§ The plug-in is never updated
§ The Created objects do not
have any relation to the
plug-in anymore
§ The plug-in dialog cannot be
opened from the created
objects.
61
Plan Level Mark Example
62
Plan Level Mark Example
§ Drawing plug-in
§ Dependent, updates with drawing
§ Creates ‘Mark’ objects
§ Merges content with associative note settings

63
Main Definition

64
Define Input

65
Run method

66
Plug-in Data

67
Main Logic

68
Getting Elevation Point on Solid

69
Getting Elevation Point on Solid

70
Getting Mark Existing Content

71
Get Elevation in Right Units, Text Replace

72
User Interface

73
Thank You
74

You might also like