TrimIntersect example¶
TrimIntersect example¶
1# This example creates two lines that intersect each other and
2# trims the first entity at the the intersection
3
4# Create a local variable for the active drawing
5ad = impact.active_drawing
6
7if ad.isNone():
8 impact.gui.output_toolbox.add("unable to continue: no active drawing")
9else:
10 ab = ad.active_layer.active_block
11
12 # Move to the origin of the active block
13 ab.move_ad(0, 0)
14
15 # Create a line
16 line1 = ab.line_ad(110, 0)
17
18 # Move to posistion 100, -10
19 ab.move_ad(100, -10)
20
21 # Create another line that intersects the first
22 line2 = ab.line_ad(100, 100)
23
24 # Create some local variables for the mid points of the lines just created
25 mid_point1 = line1.get_along(0.5)
26 mid_point2 = line2.get_along(0.5)
27
28 # Trim the intersection
29 ab.trim_intersect(line1, line2, mid_point1, mid_point2)