2.1 Methods
The ISTview interface is the interface that ST-Viewer exposes to allow user programs to control it. This interface has only methods and no properties. The following is the list of the ODL definitions for these methods.
BOOL LoadFile( BSTR strName );
Use this method to load a STEP Part 21 file with the specified name. This method returns TRUE if the file was successfully loaded, or FALSE if it was unable to load the file.
void SetWindowPosition( short nX, short nY, short nWidth, short nHeight, long nShow, short nSeparatorOffset );
This method changes the position and size of the STEP model window. The first four arguments set the position and size of the window. The nShow specifies the window sizing and positioning flags. The low-order word is the same as the uFlags argument to the SetWindowPos Win32 API function and can be a boolean OR combination of the following values.
SWP_DRAWFRAME- Draws a frame (defined in the window's class description) around the window.
SWP_FRAMECHANGED- Sends a WM_NCCALCSIZE message to the window, even if the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only when the window's size is being changed.
SWP_HIDEWINDOW- Hides the window.
SWP_NOACTIVATE- Does not activate the window. If this flag is not set, the window is activated and moved to the top of either the topmost group.
SWP_NOCOPYBITS- Discards the entire contents of the client area. If this flag is not specified, the valid contents of the client area are saved and copied back into the client area after the window is sized or repositioned.
SWP_NOMOVE- Retains the current position (ignores the nX and nY arguments).
SWP_NOOWNERZORDER- Does not change the owner window's position in the Z order.
SWP_NOREDRAW- Does not redraw changes. If this flag is set, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of the window being moved. When this flag is set, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.
SWP_NOREPOSITION- Same as the SWP_NOOWNERZORDER flag.
SWP_NOSENDCHANGING- Prevents the window from receiving the WM_WINDOWPOSCHANGING message.
SWP_NOSIZE- Retains the current size (ignores the nWidth and nHeight arguments).
SWP_NOZORDER- Retains the current Z order.
SWP_SHOWWINDOW- Displays the window.
The high-order word is the same as the nCmdShow argument to the ShowWindow Win32 API function and can be one of the following values.
SW_HIDE- Hides the window and activates another window.
SW_MAXIMIZE- Maximizes the specified window.
SW_MINIMIZE- Minimizes the specified window and activates the next top-level window in the Z order.
SW_RESTORE- Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when restoring a minimized window.
SW_SHOW- Activates the window and displays it in its current size and position.
SW_SHOWDEFAULT- Sets the show state based on the
SW_
flag specified in the
STARTUPINFO structure passed to the CreateProcess function by the program that started ST-Viewer.
SW_SHOWMAXIMIZED- Activates the window and displays it as a maximized window.
SW_SHOWMINIMIZED- Activates the window and displays it as a minimized window.
SW_SHOWMINNOACTIVE- Displays the window as a minimized window. The active window remains active.
SW_SHOWNA- Displays the window in its current state. The active window remains active.
SW_SHOWNOACTIVATE- Displays a window in its most recent size and position. The active window remains active.
SW_SHOWNORMAL- Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position.
The nSeparatorOffset sets the width of the identification pane within the document window.
If any of the dimensional arguments is -1, this window parameter remains unchanged. For example:
SetWindowPosition(
0, 0, -1, 456,
MAKELONG(SWP_SHOWWINDOW, SW_SHOWNORMAL), -1
);
will move the model window to the upper left corner of the ST-Viewer MDI client window, set its height to 456 pixels and leave the width of the model window and the identification pane unchanged.
void SetMainWindowPosition( short nX, short nY, short nWidth, short nHeight, long nShow );
This method is similar to the previous one, but it changes the size and position of the ST-Viewer main window.
void RotateThumbWheel( short nWheel, short nDegrees );
The method "rotates" the specified thumbwheel by a number of degrees. The thumbwheels perform different functions depending on the current scene viewer. The number of thumbwheels also vary, but only first three are supported at this time. The nWheel argument specifies the thumbwheel.
0- Left
1- Bottom
2- Right
3- Top left (not supported)
void Zoom( float fZoom );
Use this method to zoom the camera in and out. The fZoom value specifies the same value as the zoom scrollbar in the geometric view.
void MakeSelected( long nID, long nInstance, short bSelect );
This method selects an object in the model identified by its STEP entity ID (the nID argument) and the instance number ( nInstance ). A model can have several instances of the same STEP object, for example an assembly can have several parts that share the same geometry. The instances are counted starting from 1. Set bSelect to TRUE to select the object, set it to FALSE to cancel the selection.
void MakeAllSelected( long nID, short bSelect );
Use this method to select all instances of the object with the specified STEP ID. A model can have several instances of the same STEP object, for example an assembly can have several parts that share the same geometry. The nID argument specifies the STEP entity ID of the object from the original file, and the bSelect argument should be set to TRUE to select all instances or to FALSE to cancel selection.
void MakeVisible( long nID, long nInstance, short bVisible );
Use this method to display or hide an instance of an object in the model. The object is identified by its STEP entity ID (the nID argument) and the instance number ( nInstance ). To display the object set bVisible to TRUE , to hide the object set it to FALSE .
void MakeAllVisible( long nID, short bVisible );
Use this method to display or hide all instances of the object with the specified STEP ID. The nID argument specifies the STEP entity ID of the object from the original file, and the bVisible argument should be set to TRUE to display all instances or to FALSE to hide them.
void SetColor( long nID, long nInstance, double dRed, double dGreen, double dBlue);
Use this method to set the color of the specified object. The object is identified by its STEP entity ID (the nID argument) and the instance number ( nInstance ). The last three arguments are red, green, and blue components of the color, expressed as the values within the 0...1 range. For example, a default gray color will be expressed as (0.8, 0.8, 0.8).