Bezier Control 1

Bezier Control 1
 1# This example creates a bezier and modifies the first control point of
 2# the bezier.
 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    # display a message in the output toolbox
17    ot.add("Unable to continue: there is 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 some local variables for the control points of the bezier
28    x1 = 0
29    y1 = 0
30    x2 = 10
31    y2 = 20
32    x3 = 30
33    y3 = 20
34    x4 = 40
35    y4 = 0
36
37    # create the bezier
38    bezier = ab.bezier_ad(x1, y1, x2, y2, x3, y3, x4, y4)
39
40    # modify the first control point of the bezier
41    bezier.control1 = impact.creator.vector(0,50)