Commit 5ea0ae47 authored by Jan Möbius's avatar Jan Möbius

Added two python scripting examples

parent 5cc32d37
......@@ -24,5 +24,49 @@
\subsection python_scripting_idlisttype IDList data type
The IdList type used in the C++ code is mapped from python. Details can be found here:
\subpage python_scripting_IDList_type
Here is a simple example of a python script using the holefiller:
\code
# Load an object from a specific path
id = fileoff.loadObject("OpenFlipper-Free/OpenFlipper/cube1.off")
# Prints the id of the new object
print("ID of new object is : " + str(id) )
# Selects a set of faces
meshobjectselection.selectFaces(id,[0,1,2,3,4,5,6,7,8,9,10])
# deletes the selected faces
meshobjectselection.deleteFaceSelection(id)
# And runs the hole filler to close the holes produced by the previous operation
holefiller.fillAllHoles(id)
\endcode
Another example produces an animation of a rotating object:
\code
# We need numpy for array and vectors
import numpy as np
# Generate a cube via the primitivesgenerator plugin
primitivesgenerator.addCube()
# Set our animation parameters
animation_axis = np.array([-1.0,1.0,0.0]);
rotation_center = np.array([0.0,0.0,0.0])
# Loop over 360 degrees
for angle in range(0,360,1):
# Apply rotation
viewcontrol.rotate(animation_axis,1,rotation_center,0)
# Update the current view
core.updateView()
# Update the ui
core.updateUI()
\endcode
*/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment