Sillouette Scripting make shape

The scripting guide is vague and pretty hard to navigate, can someone give me an example of how to make a shape with the scripting window?


is says you can in the scripting guide " Shapes can be created with Shape([type, label=None)"

But there is no detail or example how to implement this

I’ll pass this on to our resident scripting expert, but he is out of the office this coming week.

Thank you Marco :slight_smile:

Look in the Silhouette resources/scripts/gui folder. There are scripts in there that implement some shape editing operations for the Reshape tool that create new shapes.

yes I have looked at it, but it used a getShape method to duplicate and then add points to existing, not the createShape method.

I’m sorry I can’t be more specific at this time -I’m on vacation this week and don’t have the source in front of me.
But the process for creating new shapes is to create the shape and pass in the type. Then you create one or more ShapePath objects and set their ‘points’ attribute, then call setValue() on the shape’s ‘path’ property to set the keyframes.

I think I get it but I am still struggling, sorry I am new to scripting in silhouette.

is there a set amount of parameters that the shape needs to operate? I am having trouble getting this to work.

A scripting example would really help.

Katie Morris, who is a Silhouette power user has a scripting resource found here:

Here is how to create an X-spline shape with a key at the current frame:

from fx import *

s = Shape(Shape.Xspline)
p ="path")
path = s.createPath()
path.closed = True
path.points = [(Point3D(0.241183,-0.21378), 0.25), (Point3D(0.315301,-0.228309), 0.25), (Point3D(0.458229,-0.194391), 0.25), (Point3D(0.550311,-0.110752), 0.25), (Point3D(0.568583,-0.0257705), 0.25), (Point3D(0.55459,0.057137), 0.25), (Point3D(0.434833,0.0720153), 0.25), (Point3D(0.289837,0.0639271), 0.25), (Point3D(0.149813,0.00356161), 0.25), (Point3D(0.129617,-0.0910426), 0.25), (Point3D(0.158576,-0.180277), 0.25)]
p.setValue(path, player.frame)

beginUndo("Make Shape")

1 Like

Thanks Paul that seems to work, however I am little confused about the format the path points take, when I pass in my own points as a list it doesn’t like it, and when I pass in my own points as a tuple it doesn’t like it, also as a list of tuples it seems unhappy.

Am I missing something?

The point list description is documented here:

Yes, although that description is a little confusing because it is a little missleading as to how it is actually required.

But non the less, I keep getting a ValueError: point list tuple must contain 2 items (Point, float)

Not really sure how to reconcile this