Adding a bridge to a line¶
Adding a bridge to a line¶
1# This example creates a new line, then gets its
2# midpoint and creates a bridge.
3
4# Create a local variable for the active drawing
5ad = impact.active_drawing
6
7# Check that there is an active drawing
8if not ad.isNone():
9
10 # Create a local variable for the active block
11 ab = ad.active_layer.active_block
12
13 # Move to the origin of the active block
14 ab.move_ad(0, 0)
15
16 # Create a new line
17 new_line = ab.line_ad(100, 0)
18
19 # Get the midpoint of the line
20 mid_point = new_line.get_along(0.5)
21
22 # Add a bridge to the line
23 new_line.add_bridge(mid_point, 10)
24
25else:
26
27 # Display a message in the output toolbox
28 impact.gui.output_toolbox.add("unable to continue: no active drawing")