Splitting an arc at its midpoint¶
Splitting an arc at its midpoint¶
1# This example selects all entities in the active block and deletes them.
2# An arc is created and its midpoint found. The arc is then split at its
3# midpoint. Finally the extents of the active window are shown.
4
5# Create a local variable for the active drawing
6ad = impact.active_drawing
7
8# Check that there is an active drawing
9if not ad.isNone():
10
11 # Create a local variable for the active block
12 ab = ad.active_layer.active_block
13
14 # Select all visible entities in the active block
15 ab.select_all()
16
17 # Delete the selected entities in the active block
18 ab.delete_selected()
19
20 # Move to the origin of the active block
21 ab.move_ad(0, 0)
22
23 # Create an arc
24 arc1 = ab.arc_ad(100, 100, 10, True, False)
25
26 # Get the midpoint of the arc
27 mid_point = arc1.get_along(0.5)
28
29 # Split the arc at the mid point
30 arc2 = arc1.split_at_point(mid_point)
31
32 # View the extents of the active window
33 impact.gui.active_window.view_extents()
34
35else:
36
37 # Display a message in the output toolbox
38 impact.gui.output_toolbox.add("unable to continue: no active drawing")
39