API Overview

From neuromechanicwiki
Jump to: navigation, search
Python API Routines
Routine Description
file_isoutputfilenameset Query whether the output file name has been set
file_load Load a model file
file_modeltype Query the model type (0=no model, 1=body file, 2=output file)
file_saveas Save the model as ...
file_setoutputfilename Set the name of the output file to be created
file_setsystempath Set the current working directory of Neuromechanic
Graphical user interface
gui_grabwindowfocus Tell the engine which of the four opengl rendering windows has focus
gui_init Initialize the opengl rendering windows
gui_keydown Communicate keydown event to engine
gui_keyup Communicate keyup event to engine
gui_mouseclick Communicate mouse click to engine
gui_mousemotion Communicate mouse motion to engine
gui_mousewheel Communicate mouse wheel event to engine
gui_renderall Render all 4 opengl windows
gui_setpointaction Set the action of click and drag to move, pull or rotate
gui_setwindowsize Communicate the current size of the rendering window
gui_snapshot Create a bitmap (*.bmp) or encapsulated post-script (*.eps) file from the rendering window
gui_windowrender Render a single opengl window
math_quadprog Quadratic programming algorithm
model_calcdmomentumdt Calculate the time derivative of the generalized momentum matrix ([math]\mathbf{\dot{H}}[/math])
model_calcglobaltolocal Calculate local coordinates of a point
model_calcglobalvelocity Calculate the global velocity of a local point
model_calcinertiainverse Calculate the inertia matrix inverse
model_calcjacobian Calculate the endpoing Jacobian of a point
model_calclocaltoglobal Calculate global coordinates of a point
model_clear Unload/close a model
model_compresspolygons Generate a self-contained compressed version of <Polygon>
model_playbackloadstate Load a state from playback
model_playbackreload Reload an output file with current view and output parameters
model_refreshstatefromtree Refresh the dynamics from the states stored in the model tree
model_refreshtreefromstate Refresh the dynamics and model tree from the states stored in <Dynamic>
model_reloadpythonmodules Reload python modules associated with the current model and refresh dynamics
model_runalignpolygons Align polygons in local coordinates
model_runequilibrate Equilibrate the model
model_runfeasibleforces Calculate feasible force sets for the model
model_runmovejointcenter Move a joint center without affecting global coordinates of attached points
model_runsatisfyconstraints Ensure that constraints are satisfied
model_simcountcurrent Retrieve the current simulation steps count
model_simcounttotal Retrieve the total simulation steps count
model_simgetrecoverstate Recover the saved initial state
model_simgetstatus Query simulation status
model_simsetstatuspause Pause simulation
model_simsetstatusstop Stop simulation
model_simstep Step simulation
system_clearerror Clear current error
system_geterror Get current error
system_init Initialize Neuromechanic
system_log Log to file and log window
system_prefsmemorytofile Save the current preferences to nmprefs.xml
system_refreshpreferences Pull current preferences from memory to rendered window
system_runpycommand Run python command
system_savepolygonfiles Save polygon files
system_setcommandlineinput Store command line input for later engine use
system_takeimages Set whether to take images during simulation playback
Tree (for accessing Neuromechanic Trees)
tree_adoptnode Moves a node from it's current place in the tree to the specified place
tree_createnode Creates a node
tree_destroynode Destroys a node
tree_getchildbytag Returns the pointer to the first child of a tree node with a specified tag/attribute
tree_getchildi Returns the pointer nth child of a tree node
tree_getlength Get the number of children of a tree node, or the length of a list.
tree_getlistbytag Get a pointer to a list of tree nodes with the same tag
tree_getnodeenum1 Returns the first enumerator integer associated with a tree node
tree_getnodeexternalpointer Returns an external pointer defined in a tree node
tree_getnodetype Query the type of the tree node (e.g. Comment, Element, Attribute)
tree_getparent Get the parent tree node of a tree node
tree_getprintable Query whether a tree node is (un)printable
tree_gettag Get the tag of a tree node
tree_gettreebyname Get the pointer to a tree (Currently there are three trees: "Model", "Preferences", and "System". You can also create a new tree by using "New")
tree_getvalue Get the value of a tree node
tree_parsefile Read an xml from disk to tree format without loading as an nmcb file
tree_setprintable Set a tree node to (un)printable
tree_settag Sets the tag of a tree node
tree_setvalue Set the value of a tree node
tree_writenode Write the tree starting at this node to disk
tree_writenodechildren Write the tree starting at this node's children to disk
version Returns a character string indicating the current version of the Neuromechanic engine