ArcAd example (Python)¶
ArcAd example (Python)¶
1# this example creates 4 arcs all with the same radius in the active block
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 local variable for the radius
18 radius = 50
19
20 # create two local variables for the position for the offset
21 positionX = 0
22 positionY = 0
23
24 # create a clockwise large arc
25 ab.arc_ad(positionX, positionY, radius, 0, 0)
26
27 # change the position
28 positionX = positionX + 100
29 positionY = positionY + 100
30
31 # create an anti-clockwise large arc
32 ab.arc_ad(positionX, positionY, radius, 1, 0)
33
34 # change the position
35 positionX = positionX + 100
36 positionY = positionY + 100
37
38 # create a clockwise small arc
39 ab.arc_ad(positionX, positionY, radius, 0, 1)
40
41 # change the position
42 positionX = positionX + 100
43 positionY = positionY + 100
44
45 # create an anti-clockwise small arc
46 ab.arc_ad(positionX, positionY, radius, 1, 1)