Switching the direction of selected entities¶
Switching the direction of selected entities¶
1# This example creates some lines in the active block
2# and switches their direction
3
4# Create a local variable for the output toolbox
5ot = impact.gui.output_toolbox
6
7# Clear the output toolbox
8ot.clear()
9
10# Create a local variable for the active drawing
11ad = impact.active_drawing
12
13# Check there is an active drawing
14if ad.isNone():
15
16 # Add an error message to the output toolbox
17 ot.add("unable to continue: no active drawing")
18
19else:
20
21 # Create a local variable for the active block
22 ab = ad.active_layer.active_block
23
24 # Move to the origin of the active block
25 ab.move_ad(0, 0)
26
27 # Create a line
28 ab.line_ad(100, 0)
29
30 # Move to postion 0, 100
31 ab.move_ad(0, 100)
32
33 # Create a line
34 ab.line_ad(100, 100)
35
36 # Select all visible entities in the active block
37 ab.select_all()
38
39 # Switch the direction of the selected entities
40 ab.switch_selected()
41