\hypertarget{python_scripting_python_scripting_batch_mode}{}\section{Open\+Flipper Batch mode with python}\label{python_scripting_python_scripting_batch_mode}
Open\+Flipper can be started in batch mode without a graphical user interface by providing \char`\"{}-\/b\char`\"{} as a command line option. Furthermore you have to provide an Open\+Flipper python script (extension is .ofp), which will get executed. To get output to the command line, you also have to provide the command line switch \char`\"{}-\/c\char`\"{}. Only plugins which support batch mode ( They implement an nogui() function ), will be loaded. For example, no renderers, postprocessors or other plugins providing only user interface or graphical functionality will be loaded. You can see on the command line (when \char`\"{}-\/c\char`\"{} is given), which plugins are activated and which are skipped in batch mode.\hypertarget{python_scripting_python_scripting_datattypes}{}\section{Data\+Types}\label{python_scripting_python_scripting_datattypes}
\hypertarget{python_scripting_python_scripting_matrixtype}{}\subsection{Matrix4x4 data type}\label{python_scripting_python_scripting_matrixtype}
The Matrix4x4T type used in the C++ code is mapped from python. Details can be found here\+: \hyperlink{python_scripting_matrix4x4_type}{Matrix4x4 data type used for python scripting}\hypertarget{python_scripting_python_scripting_vectortype}{}\subsection{3 Dimensional vector type}\label{python_scripting_python_scripting_vectortype}
The Vector type used in the C++ code is mapped from python. Details can be found here\+: \hyperlink{python_scripting_vector_type}{Vector data type used for python scripting}\hypertarget{python_scripting_python_scripting_idlisttype}{}\subsection{I\+D\+List data type}\label{python_scripting_python_scripting_idlisttype}
The Id\+List type used in the C++ code is mapped from python. Details can be found here\+: \hyperlink{python_scripting_IDList_type}{I\+D\+List data type used for python scripting}\hypertarget{python_scripting_python_scripting_examples}{}\section{Examples}\label{python_scripting_python_scripting_examples}
Here is a simple example of a python script using the holefiller\+: 
\begin{DoxyCode}
\textcolor{preprocessor}{# Load an object from a specific path}
\textcolor{keywordtype}{id} = fileoff.loadObject(\textcolor{stringliteral}{"OpenFlipper-Free/OpenFlipper/cube1.off"})

\textcolor{preprocessor}{# Prints the id of the new object}
print(\textcolor{stringliteral}{"ID of new object is : "} + str(\textcolor{keywordtype}{id}) )

\textcolor{preprocessor}{# Selects a set of faces}
meshobjectselection.selectFaces(\textcolor{keywordtype}{id},[0,1,2,3,4,5,6,7,8,9,10])

\textcolor{preprocessor}{# deletes the selected faces}
meshobjectselection.deleteFaceSelection(\textcolor{keywordtype}{id})

\textcolor{preprocessor}{# And runs the hole filler to close the holes produced by the previous operation}
\textcolor{preprocessor}{holefiller.fillAllHoles(id)}
\end{DoxyCode}


Another example produces an animation of a rotating object\+: 
\begin{DoxyCode}
\textcolor{preprocessor}{# We need numpy for array and vectors}
\textcolor{keyword}{import} numpy as np

\textcolor{preprocessor}{# Generate a cube via the primitivesgenerator plugin}
primitivesgenerator.addCube()

\textcolor{preprocessor}{# Set our animation parameters}
animation\_axis = np.array([-1.0,1.0,0.0]);
rotation\_center = np.array([0.0,0.0,0.0])

\textcolor{preprocessor}{# Loop over 360 degrees}
\textcolor{keywordflow}{for} \hyperlink{namespaceOpenMesh_a39010bd91c5088f5c36a3ef2b1e6e697}{angle} in range(0,360,1):
  # Apply rotation
  viewcontrol.\hyperlink{namespacePluginFunctions_a772833a79fff199451a1aad6f18bf63f}{rotate}(animation\_axis,1,rotation\_center,0)

  # Update the current view
  core.updateView()

  # Update the ui
  core.updateUI()
\end{DoxyCode}
 \hypertarget{python_scripting_matrix4x4_type}{}\section{Matrix4x4 data type used for python scripting}\label{python_scripting_matrix4x4_type}
The matrix type Matrix4x4 is mapped to python to handle matrix operations.

The integrated conversion can map the C++ Matrix4x4 type to and from a tuple, a list or a numpy array. The preferred choice is the numpy array. Tuple and list have to contain 16 elements. A numpy array has to have a dimension of 2, with 4x4 elements. All data is assumed to be given column major. Therefore the first for elements define the first column and so on.

Creating a matrix in python is the done like in the following example\+: 
\begin{DoxyCode}
\textcolor{keyword}{import} numpy as np

matr = np.array( [[1.0,0.0,0.0,0.0],[0.0,1.0,0.0,0.0],[0.0,0.0,1.0,0.0],[0.0,0.0,0.0,1.0]])
\end{DoxyCode}


The conversion from C++ to python will always create a numpy array on the python side. \hypertarget{python_scripting_vector_type}{}\section{Vector data type used for python scripting}\label{python_scripting_vector_type}
The matrix type Vector is mapped to python to handle Vector operations.

The integrated conversion can map the C++ Vector type to and from a tuple, a list or a numpy array. The preferred choice is the numpy array. Tuple and list have to contain 3 elements. A numpy array has to have a dimension of 1, with 3 elements.

Creating a matrix in python is the done like in the following example\+: 
\begin{DoxyCode}
\textcolor{keyword}{import} numpy as np

vector = np.array([1.0,0.0,0.0]);
\end{DoxyCode}


The conversion from C++ to python will always create a numpy array on the python side. \hypertarget{python_scripting_IDList_type}{}\section{I\+D\+List data type used for python scripting}\label{python_scripting_IDList_type}
The list type Id\+List is mapped to python.

The integrated conversion can map the C++ Id\+List type to and from a tuple, a list or a numpy array. The preferred choice is the numpy array.

Creating a list in python is the done like in the following example\+: 
\begin{DoxyCode}
\textcolor{keyword}{import} numpy as np

list = np.array( [3,16,18])
\end{DoxyCode}


The conversion from C++ to python will always create a numpy array on the python side. 