Parameter Along

Parameter Along
 1# This example creates a new line from coordinates 0,0 to 100, 0
 2# in the active block. A vector is then created at the position 150, 50. This
 3# vector is then passed as an argument to the ILine.parameter_along() method, the
 4# results of the method are displayed in the output toolbox.
 5
 6# Create a local variable for the output toolbox
 7ot = impact.gui.output_toolbox
 8
 9# Clear the output toolbox
10ot.clear()
11
12if not impact.active_drawing.isNone():
13
14    # Create a local variable for the active block
15    ab = impact.active_drawing.active_layer.active_block
16
17    # Move to the origin of the active block
18    ab.move_ad(0, 0)
19
20    # Create a vector
21    v = impact.creator.vector(150, 50)
22
23    # Create a line
24    line = ab.line_ad(100, 0)
25
26    # Declare some variables to store the results
27    result = 0.0
28    height = None
29
30    # Call the method
31    result = line.parameter_along(v, height)
32
33    # Display the results
34    ot.add(result)
35    ot.add(height)
36
37else:
38    ot.add("No Active Drawing")