DimensionAngle example (Python)¶
DimensionAngle example (Python)¶
1# this example creates 2 lines and an angle dimension between them
2
3# check there is an active drawing
4if impact.active_drawing.isNone():
5
6 # display a message in the output toolbox
7 impact.gui.output_toolbox.add("Unable to continue: there is no active drawing")
8
9else:
10
11 # create a local variable for the active block
12 ab = impact.active_drawing.active_layer.active_block
13
14 # move to the origin of the active block
15 ab.move_ad(0, 0)
16
17 # create a line
18 line1 = ab.line_ad( 50, 0 )
19
20 # move to the origin of the active block
21 ab.move_ad(0, 0)
22
23 # create a line
24 line2 = ab.line_ad( 50, 50 )
25
26 # create a local variable for the quadrant point
27 quadrantPoint = None
28 try:
29 quadrantPoint = impact.creator.vector(50,25)
30 except Exception as exc:
31 pass
32 impact.gui.output_toolbox.add(f"Failed to create object via impact.creator.vector(): {exc}")
33
34 # create an angle dimension
35 ab.dimension_angle(line1, line2, quadrantPoint, ipDimensionTextMode.dtmInside)