Posts

Showing posts from May 12, 2019

Python Scripts in Art of Illusion

I took a break from the cloth simulator to look at adding Python as a scripting language for Art of Illusion. I had some success at pulling in the Jython library and was able to get the following Tool Script to add a Cube to the scene: undo = UndoRecord(window, True) obj = Cube(1.0, 1.0, 1.0) objInfo = ObjectInfo(obj, CoordinateSystem(), "Cube "+str(1)) window.addObject(objInfo, undo) window.updateImage() window.setUndoRecord(undo) In a video I demonstrated that a Groovy script could be used to add a Cube to the scene . The Groovy script was as follows: undo = new UndoRecord(window, true); obj = new Cube(1.0, 1.0, 1.0); objInfo = new ObjectInfo(obj, new CoordinateSystem(), "Cube "+1); window.addObject(objInfo, undo);                       window.updateImage(); window.setUndoRecord(undo); As you can tell, the code is essentially the same except Python doesn't use the new keyword, True is capitalized in Python, and Python won't conc