Python Resources

Updated on Feb 5 2022

Python Resources

Deborah R. Fowler



File creation to supplement Exercise 2 dailies - maple leaf data creation

Posted on April 23 2022



The node I used for the circle and maple leaf generation was the trace node. Given an image this will return geometry.



A resample node was used to reduce the number of points on the outline curve and evenly space those points.



An add node was used to delete everything except the points.



Since my goal was to create a file suitable for turtle I used a transform node to scale the leaf up by 300.

The next two nodes in the network were used to delete the last point which was causing the line (and ultimately the turtle) to draw across my pattern.(This was not necessary in the circle example.)



Finally, add the first point to the end so that the outline is closed. We use an add node and the reference the first point coming in from the node above. In hscript we can use the point function which requires 4 arguments, a path to the node being referenced, the point number used, the attribute (in this case "P") and the element (x,y,z corresponds to 0,1,2)
So for example the x position of the first point is point("../delete1",0,"P",0)



Another way to do this is with a pointwrangle (vex instead of hscript). The point function in vex is different. It returns a vector so the point arguments (geometry, string, pointnumber) are point(0,"P",0) and we then use the addpoint function.



This is now ready to write out using the python node.