The evu module

The evu module contains functions for creating an erection view (evu. AddErectionView ), determining the number erection views allocated (evu. AllocatedErectionViews ). deleting an erection view (evu. DeleteErectionView ), reading the erection views in your current Job (evu. GetErectionViews ), and opening an erection view (evu. OpenErectionView ).

Example script :

# A parametric that uses the evu module.
import evu
import exceptions
import param
import Point3D
                    

def test_evu_api():     try:         evu.AddErectionView(             'python_evu', #view name             Point3D.Point3D(), #eye             Point3D.Point3D( 0., 0., 1. ), #up             Point3D.Point3D( 0., 1., 0. ), #look_at             evu.ViewType.Primary,             12.0, #scene width             1200.0, #scene height             0., #depth near/in             24., #depth far/out             )         last_view = evu.GetErectionViews()[ -1 ]         #now delete it and try to add it a different way         evu.DeleteErectionView( last_view[ 1 ] )         evu.AddErectionView( *last_view[ 1: ] )         evu.OpenErectionView( 'python_evu' )     except exceptions.ValueError, msg:         print(msg)

if __name__ == '__main__':     try:         if 'python_evu' in [ v[ 1 ] for v in evu.GetErectionViews() ]:             if evu.DeleteErectionView( 'python_evu' ):                 test_evu_api();             else:                 print("Can't delete python_evu")         else:             test_evu_api();     except param.StationError, msg:         print(msg)

To get help on the evu module , use the built-in Python functions dir() and help() while at the SDS2 Python Prompt in Modeling :

SDS2 Python Prompt

SDS2 Interactive Python Prompt
>>> import evu
>>> dir(evu)
['AddErectionView', 'AllocatedErectionViews', 'DeleteErectionView', 'EyeUpLookAt', 'GetCurrentErectionViewName', 'GetCurrentView', 'GetErectionViews', 'GlobalToCameraMatrix', 'OpenErectionView', 'SetCurrentView', 'ViewType', '__doc__', '__name__', '__package__']


SDS2 Python Prompt

>>> help(evu.AddErectionView)
Help on built-in function AddErectionView:

AddErectionView(...)
Add a new erection view and return the index number of the new view. A return value less than 1 indicates the view could not be added. A value of -1 indicates the view name already exists.
C++ signature:
AddErectionView(std::string name, Point3D eye=Point3D(0, 0, 0), Point3D up=Point3D(0, 1, 0), Point3D look_at=Point3D(0, 0, -1), SDS2::evu::Type type=evu.ViewType.Primary, double screen_width=480000.0, double screen_height=480000.0, double depth_near=36.0, double depth_far=36.0) -> int

SDS2 Python Prompt

>>> help(evu.AllocatedErectionViews)
Help on built-in function AllocatedErectionViews:

AllocatedErectionViews(...)
Return the number of erection view entries allocated in the job.
C++ signature:
AllocatedErectionViews(void) -> unsigned int

SDS2 Python Prompt

>>> help(evu.DeleteErectionView)
Help on built-in function DeleteErectionView:

DeleteErectionView(...)
Delete the specificed erection view. Return True if the view is deleted.
C++ signature:
DeleteErectionView(std::string name) -> bool


SDS2 Python Prompt

>>> help(evu.GetErectionViews)
Help on built-in function GetErectionViews:

GetErectionViews(...)
Return a list of erection views where each view is a tuple. The first element is the index number of the view and the rest of the tuple is the same format as the parameters for AddErectionView. The following code will delete the first erection view and then add the same view.
v = GetErectionViews()[ 0 ][ 1: ]
DeleteErectionView( v[ 0 ] )
AddErectionView( *v )
C++ signature:
GetErectionViews(void) -> boost::python::list


SDS2 Python Prompt

>>> help(evu.OpenErectionView)
Help on built-in function OpenErectionView:

OpenErectionView(...)
Change the view to the specified erection view. Return True if the view is opened.
C++ signature:
OpenErectionView(std::string name) -> bool