Compatible with WizoScript versions: 1.70
Shows how to prompt the user for information and then use that information to manipulate a part that the user is already working on. Requires Geomagic Design V16 hotfix 1 (188.8.131.5290) or later.
# creates a mobius strip with a configurable number of rotations
print "Create a new part with a 2D sketch on the XY plane"
print "Enter name of part: "
PartName = Read()
Mobius = Part(PartName, False)
print "Enter name of sketch on XY plane: "
SketchName = Read()
print "Enter rotation point along X axis: "
Diameter = float(Read())
print "Enter number of rotations: "
Rotations = int(Read())
print "Enter number of steps: "
Steps = int(Read())
# calculate how far we rotate through 360 degrees for each step
RotationPerStep = Rotations / float(Steps) * 360.0
DegreesPerStep = 360.0 / Steps
# get the base sketch
S0Plane = Mobius.GetPlane("XY-Plane")
S0 = Mobius.GetSketch(SketchName)
Sketches = [S0]
# generate sketches
for Step in range (1, Steps):
Plane = Mobius.AddPlane("S" + str(Step), S0Plane, Mobius.GetAxis("Y-Axis"), DegreesPerStep * Step)
Sketch = Mobius.AddSketch("S" + str(Step), Plane)
Sketch.CopyFrom(S0, RotationPerStep * Step, Diameter, 0, 0, 0, 0, 0, 100.0)
# the last sketch is the same as the first to form a complete loop
# create loft
Mobius.AddLoftBoss("Strip", Sketches, False, False, False, False)
Compatible with WizoScript versions: 1.40
The following script shows how to import a set of 2D points from a CSV file, rotate them about a arbitrary point and then add them to a 2D sketch.
# imports a set of 2D points from a csv file, rotates them and then
# adds them to a 2D sketch with lines connecting the points
# specify which libraries we are going to use
angle = 30.5
rotationpoint = [5.0, 5.0]
csvfile = r"C:\Users\Andy\Example.csv"
# rotates a point around another point
# passed is the angle, the point to rotate and the origin of the rotation
# copied from http://ubuntuforums.org/showthread.php?t=975315&p=8618044#post8618044
x = point - origin
yorz = point - origin
newx = (x*math.cos(math.radians(degrees))) - (yorz*math.sin(math.radians(degrees)))
newyorz = (x*math.sin(math.radians(degrees))) + (yorz*math.cos(math.radians(degrees)))
newx += origin
newyorz += origin
# list of points, empty for now
# points will be stored as [x1,y1, x2,y2, ... ,xn,yn]
points = 
# open csv file
f = open(csvfile)
# create csv reader and read in lines
reader = csv.reader(f)
for row in reader:
# column 0 contains x, column 1 contains y
x = float(row)
y = float(row)
# rotate point and add to list of points
points.extend(rotate2d(angle, [x, y], rotationpoint))
# finished with csv file
# show number of points found
print "Found %d points" % (len(points) / 2)
# create part
MyPart = Part("My Part")
# add sketch on XY plane
PointSketch = MyPart.AddSketch("Point Sketch", MyPart.GetPlane("XY-Plane"))
# add points with lines connecting them