BezierAd example

BezierAd example
 1# this example creates a bezier in the active block
 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 some local variables for the control points of the bezier
18    x1 = 0
19    y1 = 0
20    x2 = 10
21    y2 = 20
22    x3 = 30
23    y3 = 20
24    x4 = 40
25    y4 = 0
26
27    # create the bezier
28    ab.bezier_ad(x1, y1, x2, y2, x3, y3, x4, y4)