Arc Centre¶
Arc Centre¶
1# This example creates an arc and displays the centre point in the
2# output toolbox. The centre is modified and displayed again in the
3# output toolbox.
4
5# Create a local variable for the output toolbox
6ot = impact.gui.output_toolbox
7
8# Clear the output toolbox
9ot.clear()
10
11# Create a local variable for the active drawing
12ad = impact.active_drawing
13
14# check there is an active drawing
15if ad.isNone():
16
17 # display a message in the output toolbox
18 ot.add("Unable to continue: there is no active drawing")
19
20else:
21
22 # create a local variable for the active block
23 ab = ad.active_layer.active_block
24
25 # move to the origin of the active block
26 ab.move_ad(0, 0)
27
28 # create a local variable for the radius
29 radius = 50
30
31 # create a vector for the offset
32 offset = impact.creator.vector(radius,radius)
33
34 # create a clockwise large arc
35 arc1 = ab.arc(offset, radius, 0, 0)
36
37 # display the centre point in the output toolbox
38 ot.add(arc1.centre.to_string())
39
40 # modify the centre point of the arc
41 arc1.centre.x = arc1.centre.x + 100
42
43 # display the centre point in the output toolbox
44 ot.add(arc1.centre.to_string())