Fillet example

Fillet example
 1# this example creates a rectangle and fillets the corners
 2
 3# check there is an active drawing
 4if impact.active_drawing.isNone():
 5
 6    # display a message in the output toolbox
 7    impact.gui.output_toolbox.add("Unable to continue: there is no active drawing")
 8
 9else:
10
11    # create a local variable for the active block
12    ab = impact.active_drawing.active_layer.active_block
13
14    # move to the origin of the active block
15    ab.move_ad(0, 0)
16
17    # create local variables for the size of rectangle and the fillet radius
18    rectangle_size = 100
19    fillet_radius = 10
20
21    # create a rectangle
22    line1 = ab.line_ad(rectangle_size, 0)
23    line2 = ab.line_ad(rectangle_size, rectangle_size)
24    line3 = ab.line_ad(0, rectangle_size)
25    line4 = ab.line_ad(0, 0)
26
27    # fillet the rectangle
28    arc1 = ab.fillet(line2, line1, line2.end, line1.start, fillet_radius)
29    arc2 = ab.fillet(line3, line2, line3.end, line2.start, fillet_radius)
30    arc3 = ab.fillet(line4, line3, line4.end, line3.start, fillet_radius)
31    arc4 = ab.fillet(line1, line4, line1.end, line4.start, fillet_radius)
32