Parameter Along¶
Parameter Along¶
1# This example creates a new 360 degree arc (a circle) with a radius of 50,
2# start angle of 270 and centre point at 0, 50 in the active block. A vector is
3# then created at the position 0, 200. This vector is then passed as an argument
4# to the IArc.parameter_along() method, the results of the method are displayed in
5# the output toolbox.
6
7# Create a local variable for the output toolbox
8ot = impact.gui.output_toolbox
9
10# Clear the output toolbox
11ot.clear()
12
13if not impact.active_drawing.isNone():
14
15 # Create a local variable for the active block
16 ab = impact.active_drawing.active_layer.active_block
17
18 # Move to the origin of the active block
19 ab.move_ad(0, 0)
20
21 # Create a vector
22 v = impact.creator.vector(0, 200)
23
24 # Create a local variable for the radius
25 radius = 50
26
27 # Create two local variables for the position for the offset
28 position_x = 0
29 position_y = 0
30
31 # Create a clockwise large arc
32 arc = ab.arc_ad(position_x, position_y, radius, 0, 0)
33
34 # Declare some variables to store the results
35 result = 0.0
36 height = None
37
38 # Call the method
39 result = arc.parameter_along(v, height)
40
41 # Display the results
42 ot.add(result)
43 ot.add(height)
44
45else:
46 ot.add("No Active Drawing")
47