Pretty Poly Editor Documentation
I. PPE Manual - 9. Personalizing, Macros and Scripts - c Scripts
Under construction!
This page does not reflect the current state of PPE or vice versa :-),
so read at your own risk!
For me (Wolfram Kuss), the word script means, beside
PPE-commands I also use statements or expressions from the
python language. Here, I cant and wont give a complete
introduction into python. For that, please go to
http://www.python.org
Especially the tutorial (which is part of the "python package")
is very good and available in different languages.
Instead I will explain a sample-script to give you an idea what
you can achieve with scripts and how to use them inside PPE.
To call the script via file/load macro,
choose the file examples/scripts/circle.py.
You will see that it simply draws a circle around the origin.
When you look at the script in a text editor, it will look like this:
# This script creates a circular line-loop around 0,0,0
# in the z=0-plane.
import math
# You may change these parameters:
noVertices=12
Radius=1
i=0
ppe.build()
ppe.buildMode("Lineloops")
# The builder was created for the interactive mode.
# Therefore, its useage is not very intuitive in a
# script:
# The first vertex has to be set via TrackVertex, the others
# via AddVertex. Also, you have to set an additional vertex
# at the end, since the last vertex is ignored by PPE
while i <= noVertices:
Angle=2*math.pi*i/noVertices
x=Radius*math.sin(Angle)
y=Radius*math.cos(Angle)
z=0
if i==0:
ppe.builderTrackVertex(x, y, z)
else:
ppe.builderAddVertex(x, y, z)
i = i+1
ppe.select("Vertices")