Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SalomePy.cxx File Reference
#include <Python.h>
#include <vtkPythonUtil.h>
#include <vtkVersion.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <SALOME_Event.h>
#include <SUIT_Session.h>
#include <LightApp_Application.h>
#include <LightApp_Study.h>
#include <SVTK_ViewManager.h>
#include <SVTK_ViewWindow.h>

Classes

class  TGetRendererEvent
 
class  TGetRenderWindowEvent
 
class  TGetRenderWindowInteractorEvent
 

Macros

#define VTK_XVERSION   (VTK_MAJOR_VERSION*10000+VTK_MINOR_VERSION*100+VTK_BUILD_VERSION)
 
#define SALOMEPY_EXPORT
 Python wrappings for VTK viewer of the SALOME desktop. More...
 
#define PUBLISH_ENUM(i)
 

Enumerations

enum  {
  ViewFront, ViewBack, ViewTop, ViewBottom,
  ViewRight, ViewLeft
}
 View operation type. More...
 
enum  { __Find, __FindOrCreate, __Create }
 VTK window find/create mode. More...
 

Functions

static PyTypeObject * GetPyClass (const char *theClassName)
 Get Python class object by name. More...
 
static SVTK_ViewWindowGetVTKViewWindow (int toCreate=__FindOrCreate)
 Find or create VTK window. More...
 
PyObject * libSalomePy_getRenderer (PyObject *self, PyObject *args)
 
PyObject * libSalomePy_getRenderWindow (PyObject *self, PyObject *args)
 
PyObject * libSalomePy_getRenderWindowInteractor (PyObject *self, PyObject *args)
 
PyObject * libSalomePy_showTrihedron (PyObject *self, PyObject *args)
 
PyObject * libSalomePy_fitAll (PyObject *self, PyObject *args)
 
PyObject * libSalomePy_setView (PyObject *self, PyObject *args)
 
PyObject * libSalomePy_resetView (PyObject *self, PyObject *args)
 
void initlibSalomePy ()
 Python module initialization. More...
 

Variables

static PyMethodDef Module_Methods []
 

Macro Definition Documentation

#define PUBLISH_ENUM (   i)
Value:
{ \
PyObject *w; \
int rc; \
if ( ( w = PyInt_FromLong( i ) ) == NULL ) return; \
rc = PyDict_SetItemString( aModuleDict, #i, w ); \
Py_DECREF( w ); \
if ( rc < 0 ) return; \
}
#define SALOMEPY_EXPORT

All methods are implemented using Event mechanism. The module provides the following functions:

  • getRenderer()
  • getRenderWindow()
  • getRenderWindowInteractor()
  • showTrihedron()
  • fitAll()
  • setView()
  • resetView()

Usage in Python:

import SalomePy
renderer = SalomePy.getRenderer() # get VTK renderer
window = SalomePy.getRenderWindow() # get render window

The methods getRenderer(), getRenderWindow() and getRenderWindowInteractor() open new VTK viewer if there is no one opened. In case of any error these methods return None object to the Python.

#define VTK_XVERSION   (VTK_MAJOR_VERSION*10000+VTK_MINOR_VERSION*100+VTK_BUILD_VERSION)

Enumeration Type Documentation

anonymous enum
Enumerator
ViewFront 

front view

ViewBack 

back view

ViewTop 

top view

ViewBottom 

bottom view

ViewRight 

right view

ViewLeft 

left view

anonymous enum
Enumerator
__Find 
__FindOrCreate 
__Create 

Function Documentation

static PyTypeObject* GetPyClass ( const char *  theClassName)
static
Parameters
theClassNamePython class name
Returns
Python class object or None object if class is not found
void initlibSalomePy ( )
PyObject* libSalomePy_fitAll ( PyObject *  self,
PyObject *  args 
)
PyObject* libSalomePy_getRenderer ( PyObject *  self,
PyObject *  args 
)

References ProcessEvent().

PyObject* libSalomePy_getRenderWindow ( PyObject *  self,
PyObject *  args 
)

References ProcessEvent().

PyObject* libSalomePy_getRenderWindowInteractor ( PyObject *  self,
PyObject *  args 
)

References ProcessEvent().

PyObject* libSalomePy_resetView ( PyObject *  self,
PyObject *  args 
)
PyObject* libSalomePy_setView ( PyObject *  self,
PyObject *  args 
)
PyObject* libSalomePy_showTrihedron ( PyObject *  self,
PyObject *  args 
)

Variable Documentation

PyMethodDef Module_Methods[]
static
Initial value:
=
{
{ "getRenderer", libSalomePy_getRenderer, METH_VARARGS },
{ "getRenderWindow", libSalomePy_getRenderWindow, METH_VARARGS },
{ "getRenderWindowInteractor", libSalomePy_getRenderWindowInteractor, METH_VARARGS },
{ "showTrihedron", libSalomePy_showTrihedron, METH_VARARGS },
{ "fitAll", libSalomePy_fitAll, METH_NOARGS },
{ "setView", libSalomePy_setView, METH_VARARGS },
{ "resetView", libSalomePy_resetView, METH_NOARGS },
{ NULL, NULL }
}