 |
Interface Functions |
|
Contents
[back to top]
A.1 Introduction
This chapter provides a complete reference to all the functions and properties available in the COM interfaces provided by PS/Workshop.
As for all COM interfaces, the interfaces described in this chapter inherit the IUnknown interface. That is, they all have QueryInterface, AddRef, and Release methods to control the lifetimes of objects that expose the interface. See Section 3.4, "Managing the lifetime of COM objects", for more information.
[back to top]
A.2 IPSWApp
The IPSWApp interface represents the overall PS/Workshop application. There is exactly one IPSWApp interface for each instance of PS/Workshop. The IPSWApp interface is supplied to a module when the module is first loaded.
The IPSWApp interface contains functions for modifying the PS/Workshop user interface, opening documents and registering callback functions.
[back to top]
A.2.1 Summary
The following is a summary of the IPSWApp interface.
Properties
Functions
[back to top]
A.2.2 IPSWApp Properties
ActiveDocument
HRESULT get_ActiveDocument
(
--- returned arguments ---
IPSWDoc **ppDoc
)
|
Returns the IPSWDoc interface pointer associated with the currently active document. If there is no active document this returns S_FALSE.
|
Returned arguments
|
ppDoc
|
The Active document
|
When get_ActiveDocument returns S_FALSE or E_FAIL, the value of
ppDoc
is undefined.
HRESULT put_ActiveDocument
(
--- received arguments ---
IPSWDoc *pDoc
)
|
Attempts to activate the document associated with the
pDoc
interface.
|
Received arguments
|
pDoc
|
The document to activate
|
|
Specific Errors
|
|
|
E_INVALIDARG
|
There is no document associated with the given
pDoc
.
|
Documents
HRESULT get_Documents
(
--- returned arguments ---
IPSWDocs **pDocs
)
|
Returns the IPSWDocs interface (a collection of IPSWDoc interfaces) which can be used to interate over the documents in PS/Workshop.
|
Returned arguments
|
pDocs
|
The IPSWDocs interface
|
Note: The Documents property is intended for internal use. If you wish to examine the list of open documents in PS/Workshop, use the m_InterfaceVsDocMap member variable in the CAddonMain class.
|
StatusBarText
HRESULT get_StatusBarText
(
--- returned arguments ---
BSTR *pText
)
|
Returns the current text in the PS/Workshop status bar.
|
Returned arguments
|
pText
|
The current status bar text
|
Note: It is reponsibility of the module to free the
pText
resource.
|
Example
// allocated previously
CComPtr<IPSWApp> pApp;
CComBSTR bsStatusText;
HRESULT hr = pApp->get_StatusBarText(&bsStatusText);
if (SUCCEEDED( hr ) )
{
// convert the BSTR into a more usable CString
CString csStatusText = bsStatusText;
}
|
HRESULT put_StatusBarText
(
--- received arguments ---
BSTR Text
)
|
Sets the text in the PS/Workshop status bar.
|
Returned arguments
|
Text
|
The new status bar text
|
Example
// allocated previously
CComPtr<IPSWApp> pApp;
CComBSTR bstrStatusText( OLESTR("Set Status Text") );
// or alternatively
// Cstring csStatusText = _T("Set Status Text");
// bstrStatusText.AllocSysString( bstrStatusText );
if (SUCCEEDED( pApp->put_StatusBarText ) )
{
// convert the BSTR into a more usable CString
CString csStatusText = bsStatusText;
}
|
Version
HRESULT get_Version
(
--- returned arguments ---
double *pVersion
)
|
Returns the current version of PS/Workshop.
|
Returned arguments
|
|
pVersion
|
The version.
|
[back to top]
A.2.3 IPSWApp Functions
AddMenuItem
HRESULT AddMenuItem
(
--- received arguments ---
IPSWAddIn *pAddIn,
BSTR CommandName,
long CommandID,
PSW_Menu_Mode mode
)
|
Adds an item to a PS/Workshop menu. If the menu does not already exist then it is created first.
|
Received arguments
|
pAddIn
|
IPSWAddIn interface of module
|
CommandName
|
Menu/Menu Item to add
|
CommandID
|
The ID associated with the item
|
mode
|
How to add the item
|
CommandName
must be a NULL separated string.
-
The last part of the string contains the text of the menu item to add.
-
The first part of the string contains the text of the menu to add.
You can add a cascading menu to PS/Workshop by specifying a string that contains more than two parts, as follows:
Menu\nCommand\nSub-Command
You can use the
&
character in
CommandName
to specify keyboard mnemonics for your menu and menu item that the user can use to access the new command. The character immediately after any
&
character in
CommandName
is used as the keyboard mnemonic for that part of the string. For example, the string
&Menu\nC&ommand
would create a
Menu menu containing a
Command item. A PS/Workshop user could access the new
Command by typing Alt+M+O.
Note: You must take care to specify keyboard mnemonics that are unique and consistent. Specifying both
&Debug
and
D&ebug
in different calls to AddMenuItem results in two
Debug menus being added to PS/Workshop: one accessible using Alt+D and the other accessible using Alt+E. You must also take care not to specify mnemonics that have already been used at that level.
|
CommandID
contains the ID to be associated with the menu item. This is subsequently passed back to the module during the IPSWEvents::OnCommand event when the user chooses the menu item.
Note: The CommandID should be unique within a module.
|
The
mode
argument may have the following values:
|
Value
|
Description
|
|
PSW_Menu_App
|
Add the menu to the application level (such a menu is available before any document is open).
|
|
PSW_Menu_Doc
|
Add the menu at a document level (the menu is only available once a document is open).
|
See Chapter 7, "Adding a New Menu Item to PS/Workshop" for more information about adding menu items to PS/Workshop.
|
Specific Errors
|
|
|
E_INVALIDARG
|
One of the arguments is invalid
|
|
PSWERR_ITEMALREADYEXISTS
|
The item on the specified menu already exists
|
Example
The following example adds a
Debug menu to PS/Workshop that contains an
Analyse command. When the user chooses this command the OnCommand message on the module is called with the
CommandID
ID_ON_ANALYSE. The & characters specify that the user can press Alt+D+A on the keyboard to access the Analyse command.
HRESULT hr = E_FAIL;
CComBSTR bstrMenuItem( OLESTR("&Debug\n&Analyse") );
hr = m_pAppInterface->AddMenuItem( pApp, bstrMenuItem, ID_ON_ANALYSE, PSW_Menu_Doc);
if ( SUCCEED(hr) )
{
// ... do something
}
|
AddMenuItem2
HRESULT AddMenuItem
(
--- received arguments ---
IPSWAddIn *pAddIn,
BSTR CommandName,
long CommandID,
PSW_Menu_Mode mode
long menuPos,
long itemPos
)
|
Adds an item to a PS/Workshop menu, specifying the precise position of the menu and menu item. If the menu does not already exist then it is created first.
|
Received arguments
|
pAddIn
|
IPSWAddIn interface of module
|
CommandName
|
Menu/Menu Item to add
|
CommandID
|
The ID associated with the item
|
mode
|
How to add the item
|
menuPos
|
The position in the existing PS/Workshop menu to add the new menu
|
itemPos
|
The position in the menu to add the new menu item to
|
CommandName
must be a NULL separated string.
-
The last part of the string contains the text of the menu item to add.
-
The first part of the string contains the text of the menu to add.
You can add a cascading menu to PS/Workshop by specifying a string that contains more than two parts, as described in the documentation for See AddMenuItem..
You can use
&
to specify keyboard mnemonics for menus and menu items, as described in the documentation for AddMenuItem.
CommandID
contains the ID to be associated with the menu item. This is subsequently passed back to the module during the IPSWEvents::OnCommand event when the user chooses the menu item.
Note: The CommandID should be unique within a module.
|
The
mode
argument may have the following values:
|
Value
|
Description
|
|
PSW_Menu_App
|
Add the menu to the application level (such a menu is available before any document is open).
|
|
PSW_Menu_Doc
|
Add the menu at a document level (the menu is only available once a document is open).
|
See Chapter 7, "Adding a New Menu Item to PS/Workshop" for more information about adding menu items to PS/Workshop.
|
Specific Errors
|
|
|
E_INVALIDARG
|
One of the arguments is invalid
|
|
PSWERR_ITEMALREADYEXISTS
|
The item on the specified menu already exists
|
The
menuPos
argument lets you specify the position of the new menu in the PS/Workshop menu bar. Setting this to 0 makes the new menu the first one on the menu bar (at the left), setting it to 1 makes it the second menu, and so on. A value of -1 appends the new menu to the right hand end of the menu bar.
Note: Although you can place new menus anywhere in the PS/Workshop menu bar, you should ensure that you conform to GUI design guidelines when designing your module.
|
The
itemPos
argument lets you specify the position of the new menu item in the PS/Workshop menu. Setting this to 0 makes the new item the first one on the menu, setting it to 1 makes it the second item, and so on. A value of -1 appends the new item to the end of the specified menu.
Example
The following example adds a
Blend menu to PS/Workshop that contains a
Notch command. When the user chooses this command the OnCommand message on the module is called with the
CommandID
ID_ON_NOTCH. The
Blend menu is placed at position 5, which ensures that it appears between the
Window and
Help menus in PS/Workshop, and the
Notch command is placed at position 0, which ensures it is the first command in the
Blend menu, regardless of other commands that may have been added.
HRESULT hr = E_FAIL;
CComBSTR bstrMenuItem( OLESTR("Bl&end\nNotch") );
hr = m_pAppInterface->AddMenuItem2( pApp, bstrMenuItem, ID_ON_NOTCH, PSW_Menu_Doc, 5, 0);
if ( SUCCEEDED(hr) )
{
// ... do something
}
|
OpenDocument
HRESULT OpenDocument
(
--- received arguments ---
BSTR fileName,
--- returned arguments ---
IPSWDoc **ppDoc
)
|
Loads a new part from file and opens a corresponding module document.
|
Received arguments
|
fileName
|
The partfile to open
|
|
Returned arguments
|
ppDoc
|
Pointer to the newly opened document interface
|
Note: It is a module's responsibility to ensure that the
ppDoc
interface is correctly managed
|
Example
// Previously initialised pointer
CComPtr<IPSWApp> pApp;
// our variable to store the returned interface
CcomPtr<IPSWDoc> pDoc = NULL;
HRESULT hr = pApp->OpenDocument("c:\\TestDoc.x_b", &pDoc );
if ( SUCCEEDED(hr))
{
//... do something with the pDoc
}
|
OpenNewDocument
HRESULT OpenNewDocument
(
--- returned arguments ---
IPSWDoc **ppDoc
)
|
Opens a new document in PS/Workshop.
|
Returned arguments
|
ppDoc
|
Pointer to the newly opened document interface
|
Note: It is a module's responsibility to ensure that the
ppDoc
interface is correctly managed
|
Usage:
// Previously initialised pointer
CComPtr<IPSWApp> pApp;
// our variable to store the returned interface
CcomPtr<IPSWDoc> pDoc = NULL;
HRESULT hr = pApp->OpenNewDocument(&pDoc);
If ( SUCCEEDED(hr))
{
//... do something with the pDoc
}
|
CloseDocument
HRESULT CloseDocument
(
--- received arguments ---
IPSWDoc *pDoc
)
|
Closes the specified document.
|
Received arguments
|
pDoc
|
The interface of the document to close
|
|
Specific Errors
|
|
|
E_INVALID_ARG
|
The given
pDoc
could not be found
|
QueryPSWModuleInterface
HRESULT QueryPSWModuleInterface
(
--- received arguments ---
GUID *riid,
--- returned arguments ---
IUnknown **ppUnknown
)
|
Queries if a module currently loaded in PS/Workshop supports a particular interface.
|
Received arguments
|
riid
|
Reference identifier of the interface being requested
|
|
Returned arguments
|
ppUnknown
|
Address of pointer which is filled if the query is successful
|
This function behaves in a similar way to IUnknown::QueryInterface. It allows one module to communicate with another module, so that modules can provide functionality to one another.
Note: It is a module's responsibility to ensure that the
ppUnknown
interface is correctly released.
|
RegisterFileOpenFunction
HRESULT RegisterFileOpenFunction
(
--- received arguments ---
IPSWAddIn *pAddIn,
BSTR description,
long CommandID
)
|
Registers a function to act as a FileOpen handler, and adds an entry to the PS/Workshop File Open dialog to handle a particular file extension.
|
Received arguments
|
pAddIn
|
The IPSWAddIn interface of the module.
|
description
|
The type of files to associate with this function
|
CommandID
|
The ID associated with the function
|
If a registered filetype is subsequently opened from the PS/Workshop File Open dialog, the IPSWEvents::OnCommand function is called on the module with the
CommandID
of the registered function and a LPCSTR giving the full path name of the file to open.
The supplied
description
is a specially formatted string that contains information about the file types to associate with the registered function and the accompanying text that appears in the PS/Workshop File Open dialog.
The string must be formatted in the following way:
File Description to appear in the dialog |
File extensions to be associated with the function |
For example, Parasolid text XT files might have the following description:
"Parasolid Files (*.x_t;*.xmt_txt)|*.x_t;*.xmt_txt|"
Note: The CommandID argument should be unique within any given module.
|
For more information about registering handlers for filetypes, see Chapter 8, "Registering Handlers for Different Filetypes".
|
Specific Errors
|
|
|
PSW_ALREADY_REGISTERED
|
At least one of the given file types is already registered
|
RegisterFileSaveAsFunction
HRESULT RegisterFileSaveAsFunction
(
--- received arguments ---
IPSWAddIn *pAddIn,
BSTR description,
long CommandID
)
|
Registers a function to act as a FileSaveAs handler, and adds an entry to the PS/Workshop File Save As dialog to handle a particular file extension.
|
Received arguments
|
pAddIn
|
The IPSWAddIn interface of the module.
|
description
|
The type of files to associate with this function
|
CommandID
|
The ID associated with the function
|
If the PS/Workshop File Save As dialog is subsequently used to save a registered filetype, the IPSWEvents::OnCommand function is called on the module with the
CommandID
of the registered function and a LPCSTR giving the full path name of the file to save.
The supplied
description
is a specially formatted string that contains information about the file types to associate with the registered function and the accompanying text that appears in the PS/Workshop File Save As dialog.
The string must be formatted in the following way:
File Description to appear in the dialog |
File extensions to be associated with the function |
For example, JPEG files might have the following description:
"JPG Files (*.jpg;*.jpeg)|*.jpg;*.jpeg|"
Note: The CommandID argument should be unique within any given module.
|
For more information about registering handlers for filetypes, see Chapter 8, "Registering Handlers for Different Filetypes".
|
Specific Errors
|
|
|
PSW_ALREADY_REGISTERED
|
At least one of the given file types has already been registered
|
[back to top]
A.3 IPSWDoc
The IPSWDoc interface represents each of the PS/Workshop parts (documents) currently open. For each open document there exists a corresponding IPSWDoc interface pointer. Those functions called from IPSWDoc only affect the associated PS/Workshop document.
[back to top]
A.3.1 Summary
The following is a summary of the IPSWDoc interface.
Properties
Functions
|
Function
|
Description
|
SaveAsBMP
|
Saves the document as a Windows BMP
|
SaveAsXGL
|
Saves the document in RealityWave format
|
SaveAsWMF
|
Saves the document in Extended MetaFile Format
|
Update
|
Forces an update of the document in PS/Workshop
|
[back to top]
A.3.2 IPSWDoc Properties
Colour
HRESULT get_Colour
(
--- received arguments ---
PK_ENTITY_t pkEnt,
--- returned arguments ---
COLORREF *pColour
)
|
Returns the colour of the given
pkEnt
.
|
Received arguments
|
pkEnt
|
An entity
|
|
Returned arguments
|
pColour
|
The colour of the entity
|
This works on the following classes of Parasolid entity:
-
PK_CLASS_face, PK_CLASS_edge, PK_CLASS_vertex, PK_CLASS_body
-
PK_CLASS_geom and all subclasses, if the entities are in a draw list
Attempting to return the colour of a geometric entity not in the draw list returns E_FAIL.
Note: If the entity is in a draw list then the colour returned may not be same as the colour the entity is currently displayed in.
|
|
Specific Errors
|
|
|
PSWERR_NOTANENTITY
|
The given
pkEnt
is not a valid entity
|
|
PSWERR_INVALIDCLASS
|
The given
pkEnt
is not a valid class
|
HRESULT put_Colour
(
--- received arguments ---
PK_ENTITY_t pkEnt,
COLORREF pColour
)
|
Sets the colour of the given
pkEnt
.
|
Received arguments
|
pkEnt
|
An entity
|
|
Returned arguments
|
pColour
|
The colour of the entity
|
This works on the following classes of Parasolid entity:
-
PK_CLASS_face, PK_CLASS_edge, PK_CLASS_vertex, PK_CLASS_body
-
PK_CLASS_geom and all subclasses, if the entities are in a draw list
Attempting to set the colour of a geometric entity not in the draw list returns E_FAIL.
Note: The entity is only drawn in the specified colour if it is not contained in a draw list.
|
|
Specific Errors
|
|
|
PSWERR_NOTANENTITY
|
The given
pkEnt
is not a valid entity
|
DocumentTitle
HRESULT get_DocumentTitle
(
--- returned arguments ---
BSTR *pDocTitle
)
|
Returns the title of the current document.
|
Returned arguments
|
pDocTitle
|
The title of the document
|
The title of the document appears in the title bar of the PS/Workshop document window, and is also used in the list of currently open documents in the
Window menu, and the list of recently used files in the
File menu.
Note: It is a module's responsibility to ensure that the
pDocTitle
resource is correctly freed.
|
HRESULT put_DocumentTitle
(
--- received arguments ---
BSTR DocTitle
)
|
Sets the title of the current document.
|
Received arguments
|
DocTitle
|
The new title of the document
|
The title of the document appears in the title bar of the PS/Workshop document window, and is also used in the list of currently open documents in the
Window menu, and the list of recently used files in the
File menu.
DrawList
HRESULT get_DrawList
(
--- returned arguments ---
IPSWDrawList **ppDrawList
)
|
Returns the IPSWDrawList associated with the document.
|
Returned arguments
|
ppDrawList
|
The draw list associated with the document
|
Note: It is a module's responsibility to ensure that the lifetime of
ppDrawList
is correctly handled.
|
PartList
HRESULT get_PartList
(
--- returned arguments ---
IPSWParts **ppPartList
)
|
Returns the IPSWParts associated with the document.
|
Returned arguments
|
ppPartList
|
The part list associated with the document
|
Note: It is a module's responsibility to ensure that the lifetime of
ppPartList
is correctly handled.
|
Rollback
HRESULT get_Rollback
(
--- returned arguments ---
IPSWRollback **ppRollback
)
|
Returns the IPSWRollback interface associated with the document.
|
Returned arguments
|
ppRollback
|
The IPSWRollback associated with the document
|
Note: It is a module's responsibility to ensure that the lifetime of
ppRollback
is correctly handled.
|
SelectionList
HRESULT get_SelectionList
(
--- returned arguments ---
IPSWSelectionList **ppSelectionList
)
|
Returns the IPSWSelectionList associated with the document
|
Returned arguments
|
ppSelectionList
|
The selection list associated with the document
|
Note: It is a module's responsibility to ensure that the lifetime of
ppSelectionList
is correctly handled.
|
[back to top]
A.3.3 IPSWDoc Functions
SaveAsBMP
HRESULT SaveAsBMP
(
--- received arguments ---
LPCTSTR lpszPathName
)
|
Saves the current document in Windows bitmap format (
*.bmp
).
|
Received arguments
|
lpszPathName
|
Name to save the file to
|
SaveAsXGL
HRESULT SaveAsXGL
(
--- received arguments ---
LPCTSTR lpszPathName
)
|
Saves the parts in the document in RealityWave format (
*.xgl
).
|
Received arguments
|
|
lpszPathName
|
Name to save the file to
|
SaveAsWMF
HRESULT SaveAsWMF
(
--- received arguments ---
LPCTSTR lpszPathName
)
|
Saves the parts in the document in Enhanced Metafile format (
*.emf
).
|
Received arguments
|
lpszPathName
|
Name to save the file to
|
Update
HRESULT Update
(
--- received arguments ---
BOOL render
)
|
Tells PS/Workshop that the parts in the document have changed and forces an update.
|
Received arguments
|
render
|
Whether to force a redraw of the parts in the document
|
The
render
option controls whether the parts in the document should be completely redrawn, and is included for performance reasons. Setting
render
to FALSE allows you to improve the performance of an operation by ensuring that the document is not redrawn unnecessarily.
The final call in any sequence of calls to Update should pass
render
as TRUE to ensure that the display is correctly updated.
[back to top]
A.4 IPSWParts
This interface allows control over the number of Parasolid parts in a PS/Workshop document. You can use the functionality in this interface to add, remove, or interrogate parts in a document. It can be obtained from the IPSWDoc interface, and so only affects the associated document.
As an alternative to this interface, you can use direct calls to Parasolid. You might find it easier to use Parasolid functionality directly rather than use this interface. So long as parts have been created in a partition associated with a document, calling IPSWDoc::Update correctly handles the part list whenever necessary. For example, a part can be removed from the part list by calling PK_ENTITY_delete, and then calling Update.
[back to top]
A.4.1 Summary
The following is a summary of the IPSWParts interface.
Properties
|
Property
|
Type
|
Description
|
_NewEnum
|
IUnknown*
|
Returns the IPSWEnumParts interface
|
Count
|
int
|
The number of items in the part list
|
Item
|
PK_PART_t
|
An index into the part list
|
Functions
|
Function
|
Description
|
AddItems
|
Adds entities to the part list
|
IsEmpty
|
Tests for an empty part list condition
|
IsMember
|
Tests if an entity is a member of the list
|
RemoveAll
|
Removes all items from the list
|
RemoveItems
|
Removes a number of items from the list
|
ReplaceItems
|
Replace a number of items in the list
|
[back to top]
A.4.2 IPSWParts properties
_NewEnum
HRESULT get__NewEnum
(
--- returned arguments ---
IUnknown **ppunkEnum
)
|
Returns the IPSWEnumParts interface associated with the IPSWParts interface.
|
Returned arguments
|
|
ppunkEnum
|
The returned IPSWEnumParts
|
This differs from get_Item in that get__NewEnum can be used to return more than one item at a time, so using this property in preference to get_Item could improve performance in some situations.
Note: It is a module's responsibility to manage the lifetime of
ppunkEnum
.
|
You can use the IPSWEnumParts interface to enumerate the parts in the IPSWParts interface. For more information see the definition of IPSWEnumParts.
The returned interface only represents a snapshot of the part list. It is not updated if the part list changes.
Count
HRESULT get_Count
(
--- returned arguments ---
int *pCount
)
|
Returns the number of entities in the part list.
|
Returned arguments
|
pCount
|
The number of entities in the part list
|
Item
HRESULT get_Item
(
---received arguments ---
int index,
--- returned arguments ---
PK_PART_t *pEnt
)
|
Returns the
pEnt
at position
index
in the part list.
|
Received arguments
|
index
|
The index into the part list
|
|
Returned arguments
|
pEnt
|
The entity at
index
|
The part list is a zero based index system:
index
>= 0 and
index
<
n - 1 where
n is the number of entities in the list.
This can only be used to return a single item in the part list at a time. To return more than one item, use get__NewEnum.
|
Specific Errors
|
|
|
E_INVALIDARG
|
index
is not in range
|
[back to top]
A.4.3 IPSWParts functions
AddItems
HRESULT AddItems
(
--- received arguments ---
int nParts
PK_PART_t *pkParts
)
|
Adds a list of parts to the part list.
|
Received arguments
|
nParts
|
The number of parts
|
pkParts
|
The parts
|
IsEmpty
HRESULT IsEmpty
(
--- returned arguments ---
BOOL *Empty
)
|
Indicates whether the part list contains any elements.
|
Returned arguments
|
Empty
|
Whether the list is empty or not
|
Empty
is TRUE if the list is empty, FALSE otherwise.
IsMember
HRESULT IsMember
(
--- received arguments ---
PK_PART_t pkPart,
--- returned arguments ---
BOOL *member
)
|
Indicates whether
pkPart
is a member of the part list.
|
Received arguments
|
pkPart
|
The part to check
|
|
Returned arguments
|
member
|
Whether it is a member
|
Member
is TRUE if
pkPart
is a member of the list, FALSE otherwise.
RemoveAll
Removes all the parts in the part list.
RemoveItems
HRESULT RemoveItems
(
--- received arguments ---
int nParts
PK_PART_t *pkParts
)
|
Removes the specified parts from the part list.
|
Received arguments
|
nParts
|
The number of parts
|
pkParts
|
The parts
|
ReplaceItems
HRESULT ReplaceItems
(
--- received arguments ---
int nNewPartCount
PK_PART_t *nNewPartCount
)
|
Replaces all the parts in the list with the specified
pNewParts
.
|
Received arguments
|
nNewPartCount
|
The number of parts
|
nNewPartCount
|
The parts
|
[back to top]
A.5 IPSWSelectionList
This interface allows control over the selection of entities in a PS/Workshop document. It can be obtained from the IPSWDoc interface, and so only affects the associated document.
[back to top]
A.5.1 Summary
The following is a summary of the IPSWSelectionList interface.
Properties
|
Property
|
Type
|
Description
|
_NewEnum
|
IUnknown*
|
Returns the IPSWEnumSelectionList interface
|
Colour
|
COLORREF
|
The colour of an item
|
Count
|
int
|
The number of items in the list
|
Item
|
PK_ENTITY_t
|
An item in the list
|
Functions
[back to top]
A.5.2 IPSWSelectionList Properties
_NewEnum
HRESULT get__NewEnum
(
--- received arguments ---
PK_CLASS_t pkClass
--- returned arguments ---
IUnknown **ppunkEnum
)
|
Returns the IPSWEnumSelectionList interface associated with the IPSWSelectionList.
|
Received arguments
|
pkClass
|
The class of requested entities
|
|
Returned arguments
|
ppunkEnum
|
The returned IPSWEnumSelectionList
|
This differs from get_Item in that get__NewEnum can be used to return more than one item at a time, so using this property in preference to get_Item could improve performance in some situations.
Note: It is a module's responsibility to manage the lifetime of
ppunkEnum
.
|
The IPSWEnumSelectionList interface can be used to enumerate the entities in the IPSWSelectionList interface. For more information see the definition of IPSWEnumSelectionList.
The returned interface only represents a snapshot of the selection list. It is not updated if the selection list changes.
The
pkClass
argument determines the type of entities in the selection list to enumerate through. This can have the following values:
|
Value
|
Description
|
|
PK_CLASS_null
PK_CLASS_topol
|
Return all entities in the selection list.
|
|
PK_CLASS_body
PK_CLASS_face
PK_CLASS_edge
PK_CLASS_vertex
|
Enumerate only those entities of the given type.
|
|
Specific Errors
|
|
|
PSWERR_INVALIDCLASS
|
Invalid class type
|
Colour
HRESULT get_Colour
(
--- received arguments ---
PK_ENTITY_t pkEnt,
--- returned arguments ---
COLORREF *pColour
)
|
Returns the selection colour of the given
pkEnt
.
|
Received arguments
|
pkEnt
|
The entity
|
|
Returned arguments
|
pColour
|
The selection colour of
pkEnt
|
HRESULT put_Colour
(
--- received arguments ---
PK_ENTITY_t pkEnt, --- The entity
COLORREF Colour --- The new selection colour for pkEnt
)
|
Sets the selection colour of
pkEnt
.
|
Received arguments
|
|
|
|
|
Returned arguments
|
|
|
|
Count
HRESULT get_Count
(
--- received arguments ---
PK_CLASS_t pkClass
--- returned arguments ---
int *pCount
)
|
Returns the number of entities in the selection list.
|
Received arguments
|
pkClass
|
The class of entities
|
|
Returned arguments
|
pCount
|
The number of entities in the selection list
|
The
pkClass
argument determines the type of entities in the selection list to enumerate. This can have the following values:
|
Value
|
Description
|
|
PK_CLASS_null
PK_CLASS_topol
|
All entities in the list
|
|
PK_CLASS_body
PK_CLASS_face
PK_CLASS_edge
PK_CLASS_vertex
|
Only those entities of the given type
|
|
Specific Errors
|
|
|
PSWERR_INVALIDCLASS
|
Invalid class type
|
Item
HRESULT get_Item
(
---received arguments ---
PK_CLASS_t pkClass
int index,
--- returned arguments ---
PK_PART_t *pEnt
)
|
Returns the
pEnt
at position
index
in the selection list.
|
Received arguments
|
pkClass
|
Class of entity
|
index
|
The index into the selection list
|
|
Returned arguments
|
pEnt
|
The entity at
index
|
The selection list is a zero based index system:
index
>= 0 and
index
<
n - 1 where
n is the number of entities in the list.
This can only be used to return a single item in the selection list at a time. To return more than one item, use get__NewEnum.
|
Specific Errors
|
|
|
E_INVALIDAR
|
index
is not in range
|
|
PSWERR_INVALIDCLASS
|
pkClass
is not a valid class
|
[back to top]
A.5.3 IPSWSelectionList Functions
AddItems
HRESULT AddItems
(
--- received arguments ---
int nEnts
PK_ENTITY_t *pEnts
)
|
Adds a list of parts to the selection list.
|
Received arguments
|
nEnts
|
The number of entities
|
pEnts
|
The entities
|
The class of
pEnts
can be one of the following:
-
PK_CLASS_body
-
PK_CLASS_edge
-
PK_CLASS_vertex
-
PK_CLASS_face
|
Specific Errors
|
|
|
PSWERR_INVALIDCLASS
|
Class of one of the pEnts is invalid
|
|
PSWERR_NOTANENTITY
|
An item in pEnts is not an entity
|
IsEmpty
HRESULT IsEmpty
(
--- returned arguments ---
BOOL *Empty
)
|
Indicates whether the selection list contains any elements.
|
Returned arguments
|
Empty
|
Whether the list is empty or not
|
Empty
is TRUE if the list is empty, FALSE otherwise.
IsMember
HRESULT IsMember
(
--- received arguments ---
PK_ENTITY_t pkEnt,
--- returned arguments ---
BOOL *member
)
|
Indicates whether
pkPart
is a member of the selection list.
|
Received arguments
|
pkEnt
|
The entity to check
|
|
Returned arguments
|
|
member
|
Whether it is a member
|
Member
is TRUE if pkPart is a member of the list, FALSE otherwise.
|
Specific Errors
|
|
|
PSWERR_INVALIDCLASS
|
Class of pkEnt is invalid
|
|
PSWERR_NOTANENTITY
|
pkEnt is not an entity
|
RemoveAll
Removes all the entities in the selection list.
RemoveItems
HRESULT RemoveItems
(
--- received arguments ---
int nEnts
PK_ENTITY_t *pkEnts
)
|
Removes the specified entities from the selection list.
|
Received arguments
|
nEnts
|
The number of entities
|
|
Returned arguments
|
pkEnts
|
The entities
|
|
Specific Errors
|
|
|
PSWERR_INVALIDCLASS
|
Class of one of pkEnts is invalid
|
|
PSWERR_NOTANENTITY
|
One of pkEnts is not an entity
|
ResetColour
Resets the selection colour of all the entities in the document.
The default selection color is specified in the Default Colors tab of the Options dialog in PS/Workshop.
ResetColour2
HRESULT ResetColour2
(
--- received arguments ---
int nEnts,
PK_ENTITY_t *pkEnts
)
|
Resets the selection colour for the specified entities.
|
Received arguments
|
nEnts
|
The number of entities
|
pkEnts
|
The entities
|
The default selection color is specified in the Default Colors tab of the Options dialog in PS/Workshop.
SetColour
HRESULT SetColour
(
--- received arguments ---
COLORREF colour
)
|
Sets the selection colour for all entities in the selection list
|
Received arguments
|
colour
|
The new selection colour
|
SetColour2
HRESULT SetColour2
(
--- received arguments ---
int nEnts,
PK_ENTITY_t *pkEnts,
COLORREF colour
)
|
Sets the selection colour for the given
pkEnts
.
|
Received arguments
|
nEnts
|
The number of entities
|
pkEnts
|
The entities
|
colour
|
The new selection colour
|
[back to top]
A.6 IPSWDrawList
This interface allows control over custom drawing of entities in a PS/Workshop document. It can be obtained from the IPSWDoc interface, and so only affects the associated document.
[back to top]
A.6.1 Summary
The following is a summary of the IPSWDrawList interface.
Properties
Functions
|
Function
|
Description
|
AddItems
|
Adds entities to the list
|
AddItems2
|
Adds entities to the list
|
IsEmpty
|
Tests for an empty list condition
|
IsMember
|
Tests if an entity is a member of the list
|
ModifyItems
|
Changes the draw options
|
RemoveAll
|
Removes all items from the list
|
RemoveItems
|
Removes a number of items from the list
|
Update
|
Forces an update (re-render) for the given entities
|
[back to top]
A.6.2 IPSWDrawList properties
_NewEnum
HRESULT get__NewEnum
(
--- returned arguments ---
IUnknown **ppunkEnum
)
|
Returns the IPSWEnumDrawList interface associated with the IPSWDrawList interface.
|
Returned arguments
|
|
ppunkEnum
|
The returned IPSWEnumDrawList
|
This differs from get_Item in that get__NewEnum can be used to return more than one item at a time, so using this property in preference to get_Item could improve performance in some situations.
Note: It is a module's responsibility to manage the lifetime of
ppunkEnum
.
|
Count
HRESULT get_Count
(
--- returned arguments ---
int *pCount
)
|
Returns the number of entities in the draw list.
|
Returned arguments
|
pCount
|
The number of entities in the list
|
DrawOptions
HRESULT get__DrawOptions
(
--- received arguments ---
PK_ENTITY_t pkEnt,
--- returned arguments ---
IPSWDrawOpts **ppDrawOpts
)
|
Returns the IPSWDrawOpts interface associated with the IPSWDrawList interface
|
Received arguments
|
pkEnt
|
The entity to obtain the draw options
|
|
Returned arguments
|
ppDrawOpts
|
The returned IPSWDrawOpts interface
|
Note: It is a module's responsibility to manage the lifetime of
ppDrawOpts
.
|
Item
HRESULT get_Item
(
--- received arguments ---
int index,
--- returned arguments ---
PK_ENTITY_t *pEnt
)
|
Returns the
pEnt
at position
index
in the draw list.
|
Received arguments
|
index
|
The position in the draw list of the item you require
|
|
Returned arguments
|
pEnt
|
The returned item
|
The draw list is a zero based index system:
index
>= 0 and
index
<
n - 1 where
n is the number of entities in the list.
This can only be used to return a single item in the draw list at a time. To return more than one item, use get__NewEnum.
|
Specific Errors
|
|
|
E_INVALIDARG
|
index
is not in range
|
[back to top]
A.6.3 IPSWDrawList functions
AddItems
HRESULT AddItems
(
--- received arguments ---
int nEnts,
PK_ENTITY_t *pkEnts
)
|
Add entities to the draw list using the default draw options
|
Received arguments
|
nEnts
|
The number of entities
|
pkEnts
|
The entities to add to list
|
The following entity classes are allowed:
-
PK_CLASS_body
-
PK_CLASS_face
-
PK_CLASS_edge
-
PK_CLASS_vertex
-
PK_CLASS_curve, and all subclasses
-
PK_CLASS_surf, and all subclasses
-
PK_CLASS_point
Any given entity must appear once and only once in the draw list. Attempting to add an item for the second time produces the error PSWERR_ITEMALREADYEXISTS
|
Specific Errors
|
|
|
PSWERR_ITEMALREADYEXISTS
|
Item already exists in list
|
|
PSWERR_INVALIDCLASS
|
Class of one of
pkEnts
is invalid
|
|
PSWERR_NOTANENTITY
|
One of
pkEnts
is not a valid entity
|
AddItems2
Add Items to the draw list using the draw options specified by
pDrawOpts
.
|
Received arguments
|
nEnts
|
The number of entities
|
pkEnts
|
The entities to add to list
|
pDrawOpts
|
Draw Options to apply to
pkEnts
|
The following entity classes are allowed:
-
PK_CLASS_body
-
PK_CLASS_face
-
PK_CLASS_edge
-
PK_CLASS_vertex
-
PK_CLASS_curve, and all subclasses
-
PK_CLASS_surf, and all subclasses
-
PK_CLASS_point
Any given entity must appear once and only once in the draw list. Attempting to add an item for the second time produces the error PSWERR_ITEMALREADYEXISTS
|
Specific Errors
|
|
|
PSWERR_ITEMALREADYEXISTS
|
Item already exists in list
|
|
PSWERR_INVALIDCLASS
|
Class of one of
pkEnts
is invalid
|
|
PSWERR_NOTANENTITY
|
One of
pkEnts
is not a valid entity
|
IsEmpty
HRESULT IsEmpty
(
--- returned arguments ---
BOOL *Empty
)
|
Indicates whether the draw list contains any elements.
|
Returned arguments
|
Empty
|
Whether the list is empty or not
|
Empty
is TRUE if the list is empty, FALSE otherwise.
IsMember
HRESULT IsMember
(
--- received arguments ---
PK_ENTITY_t pkEnt,
--- returned arguments ---
BOOL *member
)
|
Indicates whether pkEnt is a member of the list.
|
Received arguments
|
pkEnt
|
The entity to check
|
|
Returned arguments
|
member
|
Whether it is a member
|
Member
is TRUE if pkPart is a member of the list, FALSE otherwise.
ModifyItems
Modifies the draw options for the specified
pkEnts
.
|
Received arguments
|
nEnts
|
The number of entities
|
pkEnts
|
The entities
|
pDrawOpts
|
The new draw options for the pkEnts
|
|
Specific Errors
|
|
|
PSWERR_NOTINLIST
|
At least one of pkEnts is not in the list
|
RemoveAll
Removes all the entities in the draw list.
RemoveItems
HRESULT RemoveItems
(
--- received arguments ---
int nEnts,
PK_ENTITY_t *pkEnts
)
|
Removes the given entities from the draw list.
|
Received arguments
|
nEnts
|
The number of entities
|
pkEnts
|
The entities
|
|
Specific Errors
|
|
|
PSWERR_NOTINLIST
|
At least one of pkEnts is not in the selection list
|
Update
HRESULT Update
(
--- received arguments ---
int nEnts,
PK_ENTITY_t *pkEnts
)
|
Forces an update (re-render) of the given entities in the draw list.
|
Received arguments
|
nEnts
|
The number of entities
|
pkEnts
|
The entities
|
|
Specific Errors
|
|
|
PSWERR_NOTINLIST
|
At least one of pkEnts is not in the draw list
|
[back to top]
A.7 IPSWDrawOpts
This interface can be obtained from IPSWDrawList (in which case it contains the current draw options). It provides control over how particular entities are displayed in the draw list.
IPSWDrawOpts is somewhat different from other interfaces, in that it can also be instantiated and passed to the IPSWDrawList interface (in which case it contains the new draw options). To instantiate this interface, you need to use the CoCreateInstance function, as described in Section 3.2, "Creating a COM object".
[back to top]
A.7.1 Summary
The following is a summary of the IPSWDrawOpts interface.
Properties
|
Property
|
Type
|
Description
|
Clip
|
BOOL
|
Clip entity to part box (FALSE)
|
Colour
|
COLORREF
|
Colour to draw entity (-1)
|
DrawSense
|
BOOL
|
Whether to display sense of entity (FALSE)
|
N_U
|
int
|
Number of U param hatch lines (0)
|
N_V
|
int
|
Number of V param hatch lines (0)
|
Tolerance
|
BOOL
|
Whether to display tolerance of entity (FALSE)
|
ToleranceColour
|
COLORREF
|
Colour to draw tolerance in (-1)
|
Functions
|
Function
|
Description
|
Init
|
Initialise draw options
|
Reset
|
Reset draw options to their default values
|
[back to top]
A.7.2 IPSWDrawOpts Properties
Clip
HRESULT get_Clip
(
--- returned arguments ---
BOOL *pVal
)
|
Returns the clip option for the entity.
|
Returned arguments
|
|
pVal
|
Clip status
|
This option is currently ignored.
HRESULT put_Clip
(
--- received arguments ---
BOOL newVal
)
|
Sets the clip option for the entity.
|
Received arguments
|
newVal
|
New clip status
|
This option is currently ignored.
Colour
HRESULT get_Colour
(
--- returned arguments ---
COLORREF *pColour
)
|
Returns the draw colour for the entity.
|
Returned arguments
|
pColour
|
The draw colour of entity
|
|
Specific Errors
|
|
|
S_FALSE
|
The draw colour has not been set, in which case
pColour
is set to -1
|
HRESULT put_Colour
(
--- received arguments ---
COLORREF Colour
)
|
Sets the draw colour for the entity.
|
Received arguments
|
Colour
|
The new draw colour for entity
|
Specifying
Colour
as -1 draws the entity in the default colour.
DrawSense
The DrawSense flag is only valid for entities of the following classes:
-
PK_CLASS_face
-
PK_CLASS_edge
-
PK_CLASS_curve
-
PK_CLASS_surf
If this flag is set for other class types it is ignored.
In the case of faces and surfaces, setting DrawSense to TRUE displays a face/surface normal in the same colour as the face/surface. For edges/curves an arrow is drawn depicting the direction going from the low to the high parameter.
HRESULT get_DrawSense
(
--- returned arguments ---
BOOL *pValue
)
|
Gets the draw sense option for the entity
|
Returned arguments
|
pValue
|
Whether to draw the sense of the entity
|
HRESULT put_DrawSense
(
--- received arguments ---
BOOL newVal
)
|
Sets the draw sense for the entity
|
Received arguments
|
|
newVal
|
The new draw sense for entity
|
N_U
The N_U flag is only valid for entities of class PK_CLASS_surf. It is ignored for all other entity classes.
HRESULT get_N_U
(
--- returned arguments ---
int *pVal
)
|
Returns the number of u parameter lines for the entity.
|
Returned arguments
|
pVal
|
The number of U parameter lines
|
HRESULT put_N_U
(
--- received arguments ---
int newVal
)
|
Sets the number of U parameter lines for the entity.
|
Received arguments
|
newVal
|
The new number of U parameter lines
|
|
Specific Errors
|
|
|
E_INVALIDARG
|
The pVal argument < 0
|
N_V
The N_V flag is only valid for entities of class PK_CLASS_surf. It is ignored for all other entity classes.
HRESULT get_N_V
(
--- returned arguments ---
int *pVal
)
|
Returns the number of v parameter lines for the entity.
|
Returned arguments
|
pVal
|
The number of V parameter lines
|
HRESULT put_N_V
(
--- received arguments ---
int newVal
)
|
Sets the number of V parameter lines for the entity.
|
Received arguments
|
newVal
|
The new number of V parameter lines
|
|
Specific Errors
|
|
|
E_INVALIDARG
|
The pVal argument < 0
|
Tolerance
This option is only valid for entities of class PK_CLASS_edge and class PK_CLASS_vertex. It is ignored for all other entity classes. In addition, this option only has a visible effect if the edge or vertex is tolerant.
-
For tolerant edges, a tube is displayed around the edge with the same radius as the edge tolerance.
-
For tolerant vertices, a sphere based on the point of the vertex is displayed with the same radius as the vertex tolerance.
HRESULT get_Tolerance
(
--- returned arguments ---
BOOL *pVal
---
)
|
Returns whether the tolerance of an entity should be displayed.
|
Returned arguments
|
pVal
|
Whether to display the tolerance of an entity
|
HRESULT put_Tolerance
(
--- received arguments ---
BOOL newVal
)
|
Sets whether the tolerance of an entity should be displayed
|
Received arguments
|
newVal
|
Whether to display the tolerance of an entity
|
ToleranceColour
This option is only used if the Tolerance option is set. As with Tolerance , this option is only valid for entities of class PK_CLASS_edge and PK_CLASS_vertex. It is ignored for all other entity classes.
If the ToleranceColour is not set then the tolerance is displayed in the same colour as the entity.
HRESULT get_ToleranceColour
(
--- returned arguments ---
COLORREF *pVal
)
|
Returns the colour in which to draw the tolerance of an entity.
|
Returned arguments
|
pVal
|
The colour
|
This function is currently not implemented and returns E_NOTIMPL.
HRESULT put_ToleranceColour
(
--- received arguments ---
COLORREF newVal
)
|
Sets the colour in which to draw the tolerance of an entity.
|
Received arguments
|
newVal
|
The colour
|
This function is currently not implemented and returns E_NOTIMPL.
[back to top]
A.7.3 IPSWDrawOpts Functions
Init
HRESULT Init
(
--- received arguments ---
int n_u,
int n_v,
COLORREF col,
BOOL clipToPartBox,
BOOL drawSense,
BOOL tolerance
)
|
Allows a number of draw options to be set in one function call.
|
Received arguments
|
n_u
|
N_U
|
n_v
|
N_V
|
col
|
Colour
|
clipToPartBox
|
Clip
|
drawSense
|
DrawSense
|
tolerance
|
Tolerance
|
|
Specific Errors
|
|
|
E_INVALIDARG
|
Either
n_u
or
n_v
is < 0
|
Reset
Resets the draw options to their default values.
[back to top]
A.8 IPSWRollback
This interface provides access to Parasolid partitioned rollback functionality. It can be obtained from the IPSWDoc interface, and so only affects the associated document.
Note: You should use these wrapper functions rather than calling Parasolid PK_PMARK functions directly.
|
[back to top]
A.8.1 Summary
The following is a summary of the IPSWRollback interface.
Functions
[back to top]
A.8.2 IPSWRollback functions
DeletePMark
HRESULT DeletePMark
(
--- received arguments ---
PK_PMARK_t pMark
)
|
Deletes an existing
pMark
.
|
Received arguments
|
pMark
|
The pMark
|
MakePMark
HRESULT MakePMark
(
--- returned arguments ---
PK_PMARK_t *pMark
)
|
Creates a new
pMark
.
|
Returned arguments
|
pMark
|
The new pMark
|
RollbackTo
HRESULT RollbackTo
(
--- received arguments ---
PK_PMARK_t *pMark,
BOOL del
)
|
Rollback the document to the specified
pMark
.
|
Received arguments
|
pMark
|
The pMark to roll to
|
del
|
Whether to delete
pMark
|
The
del
argument controls whether to delete
pMark
after rolling back to it. If
del
is TRUE then
pMark
is deleted, and also returned by the function as PK_ENTITY_null.
Note: This function can be used to either rollback or rollforward to a
pMark
.
|
[back to top]
A.9 IPSWEnumDrawList
Provides enumeration over the entities in the draw list
This interface can be obtained from the IPSWDrawList interface using the IPSWDrawList::_NewEnum property. Once obtained the interface can be used to enumerate over all the entities in the IPSWDrawList. Note that the _NewEnum property returns a snapshot of the IPSWDrawList and is not updated if the draw list is changed externally.
[back to top]
A.9.1 Summary
The following is a summary of the IPSWEnumDrawList interface.
Functions
|
Function
|
Description
|
Clone
|
Creates a copy of this enumeration
|
Next
|
Returns the next set of items in the enumeration
|
Reset
|
Resets the enumeration sequence to the beginning
|
Skip
|
Skips over the next specified number of elements in the enumeration
|
[back to top]
A.9.2 IPSWEnumDrawList functions
Clone
HRESULT Clone
(
--- returned arguments ---
IPSWEnumDrawList **ppenum
)
|
Creates another enumerator that contains the same enumeration state as the current one.
|
Returned arguments
|
ppenum
|
The returned IPSWEnumDrawList
|
Note: It is a module's responsibility to ensure that the lifetime of
ppenum
is correctly handled
|
If the function succeeds then
ppenum
is a pointer to a new IPSWEnumDrawList. If the function fails then the value of
ppenum
is undefined.
Next
HRESULT Next
(
--- received arguments ---
ULONG celt,
--- returned arguments ---
PK_ENTITY_t *rgelt,
ULONG *pceltFetched
)
|
Retrieves the next
celt
items in the enumeration sequence.
|
Received arguments
|
celt
|
The number of elements requested
|
|
Returned arguments
|
rgelt
|
Returned entities
|
pceltFetched
|
The number of entities actually returned (may be NULL)
|
If there are fewer than the requested items left in the sequence, this function retrieves the remaining elements. The number of elements actually retrieved is returned in the
pceltFetched
argument.
Reset
Resets the enumeration sequence to the beginning.
Skip
HRESULT Skip
(
--- received arguments ---
ULONG celt
)
|
Skips over the next specified number of elements in the enumeration sequence.
|
Received arguments
|
celt
|
The number of elements to skip
|
[back to top]
A.10 IPSWEnumParts
Provides enumeration over the entities in the part list
This interface can be obtained from the IPSWParts interface using the IPSWParts::_NewEnum property. Once obtained the interface can be used to enumerate over all the entities in the IPSWParts. Note that the _NewEnum property returns a snapshot of the IPSWParts and is not updated if the number of parts in the document are changed externally.
[back to top]
A.10.1 Summary
The following is a summary of the IPSWEnumParts interface.
Functions
|
Function
|
Description
|
Clone
|
Creates a copy of this enumeration
|
Next
|
Returns the next set of items in the enumeration
|
Reset
|
Resets the enumeration sequence to the beginning
|
Skip
|
Skips over the next specified number of elements in the enumeration
|
[back to top]
A.10.2 IPSWEnumParts functions
Clone
HRESULT Clone
(
--- returned arguments ---
IPSWEnumParts **ppenum
)
|
Creates another enumerator that contains the same enumeration state as the current one
|
Returned arguments
|
ppenum
|
The returned IPSWEnumParts
|
Note: It is a module's responsibility to ensure that the lifetime of
ppenum
is correctly handled.
|
If the function succeeds then
ppenum
is a pointer to a new IPSWEnumParts. If it fails then the value of
ppenum
is undefined.
Next
HRESULT Next
(
--- received arguments ---
ULONG celt,
--- returned arguments ---
PK_PART_t *rgelt,
ULONG *pceltFetched
)
|
Retrieves the next
celt
items in the enumeration sequence.
|
Received arguments
|
|
celt
|
The number of elements requested
|
|
Returned arguments
|
rgelt
|
Returned entities
|
pceltFetched
|
The number of entities actually returned (may be NULL)
|
If there are fewer than the requested items left in the sequence, this function retrieves the remaining elements. The number of elements actually retrieved is returned in the
pceltFetched
argument.
Reset
Resets the enumeration sequence to the beginning.
Skip
HRESULT Skip
(
--- received arguments ---
ULONG celt
)
|
Skips over the next specified number of elements in the enumeration sequence.
|
Received arguments
|
celt
|
The number of elements to skip
|
[back to top]
A.11 IPSWEnumSelectionList
Provides enumeration over the entities in the selection list.
This interface can be obtained from the IPSWSelectionList interface using the IPSWSelectionList::_NewEnum property. Once obtained the interface can be used to enumerate over all the entities in the IPSWSelectionList. It should be noted that the _NewEnum property returns a snapshot of the IPSWSelectionList and is not updated if the selection list is changed externally.
[back to top]
A.11.1 Summary
The following is a summary of the IPSWEnumSelectionList interface.
Functions
|
Function
|
Description
|
Clone
|
Creates a copy of this enumeration
|
Next
|
Returns the next set of items in the enumeration
|
Reset
|
Resets the enumeration sequence to the beginning
|
Skip
|
Skips over the next specified number of elements in the enumeration
|
[back to top]
A.11.2 IPSWEnumSelectionList functions
Clone
HRESULT Clone
(
--- returned arguments ---
IPSWEnumSelectionList **ppenum
)
|
Creates another enumerator that contains the same enumeration state as the current one.
|
Returned arguments
|
ppenum
|
The returned IPSWEnumSelectionList
|
Note: It is a module's responsibility to ensure that the lifetime of
ppenum
is correctly handled
|
If the function succeeds then
ppenum
is a pointer to a new IPSWEnumSelectionList. If it fails then the value of
ppenum
is undefined.
Next
HRESULT Next
(
--- received arguments ---
ULONG celt,
--- returned arguments ---
PK_ENTITY_t *rgelt,
ULONG *pceltFetched
)
|
Retrieves the next
celt
items in the enumeration sequence.
|
Received arguments
|
celt
|
The number of elements requested
|
|
Returned arguments
|
rgelt
|
Returned entities
|
pceltFetched
|
The number of entities actually returned (may be NULL)
|
If there are fewer than the requested items left in the sequence, this function retrieves the remaining elements. The number of elements actually retrieved is returned in the
pceltFetched
argument.
Reset
Resets the enumeration sequence to the beginning.
Skip
HRESULT Skip
(
--- received arguments ---
ULONG celt
)
|
Skips over the next specified number of elements in the enumeration sequence.
|
Received arguments
|
celt
|
The number of elements to skip
|
[back to top]
A.12 IPSWView
This interface is superseded by IPSWView2.
[back to top]
A.13 IPSWView2
Each document open in PS/Workshop has one or more views attached. Each IPSWView is associated with an IPSWDoc.
Note: In the current version of PS/Workshop there is only one IPSWView associated with each IPSWDoc.
|
[back to top]
A.13.1 Summary
The following is a summary of the IPSWView interface.
Properties
Functions
[back to top]
A.13.2 IPSWView2 properties
ViewMatrix
HRESULT get_ViewMatrix
(
--- returned arguments ---
PK_TRANSF_t *pVal
)
|
Returns the current view matrix.
|
Returned arguments
|
pVal
|
The view matrix
|
HRESULT put_ViewMatrix
(
--- received arguments ---
PK_TRANSF_t newVal
)
|
Sets the current view matrix.
|
Received arguments
|
newVal
|
The new view matrix
|
CurrentOperation
HRESULT get_CurrentOperation
(
--- returned arguments ---
pswCurrentOperation *pVal
)
|
Returns the current PS/Workshop operation.
|
Returned arguments
|
pVal
|
The current operation
|
pVal
may be one of the following values:
-
pswCurrentOperationIdle
-
pswCurrentOperationRotate
-
pswCurrentOperationZoom
-
pswCurrentOperationZoomWindow
-
pswCurrentOperationPan
HRESULT put_CurrentOperation
(
--- received arguments ---
pswCurrentOperation newVal
)
|
Sets the current PS/Workshop operation.
|
Received arguments
|
newVal
|
The new operation
|
newVal
may be one of the following values:
-
pswCurrentOperationIdle
-
pswCurrentOperationRotate
-
pswCurrentOperationZoom
-
pswCurrentOperationZoomWindow
-
pswCurrentOperationPan
ViewStyle
HRESULT get_ViewStyle
(
--- returned arguments ---
pswViewStyle *pVal
)
|
Returns the current view style.
|
Returned arguments
|
pVal
|
The view style
|
pVal
may be one of:
-
pswViewStyleShaded
-
pswViewStyleWireframe
-
pswViewStyleWireAndSils
-
pswViewStyleShadedWireAndSils
-
pswViewStyleHidden
-
pswViewStyleShadedWireframe
HRESULT put_ViewStyle
(
--- received arguments ---
pswViewStyle newVal
)
|
Sets the current view style.
|
Received arguments
|
|
newVal
|
The view style
|
newVal
may be one of:
-
pswViewStyleShaded
-
pswViewStyleWireframe
-
pswViewStyleWireAndSils
-
pswViewStyleShadedWireAndSils
-
pswViewStyleHidden
-
pswViewStyleShadedWireframe
SelectionFilter
HRESULT get_SelectionFilter
(
--- returned arguments ---
pswSelectionFilter *pVal
)
|
Returns the current selection filter.
|
Returned arguments
|
pVal
|
The selection filter
|
pVal
may be any combination of the following flags:
-
pswSelectionFilter_None
-
pswSelectionFilter_Edge
-
pswSelectionFilter_Face
-
pswSelectionFilter_Vertex
-
pswSelectionFilter_Body
-
pswSelectionFilter_All
HRESULT put_SelectionFilter
(
--- received arguments ---
pswSelectionFilter newVal
)
|
Sets the current selection filter.
|
Received arguments
|
newVal
|
The selection filter
|
newVal
may be any combination of the following flags:
-
pswSelectionFilter_None
-
pswSelectionFilter_Edge
-
pswSelectionFilter_Face
-
pswSelectionFilter_Vertex
-
pswSelectionFilter_Body
-
pswSelectionFilter_All
RenderFacetOpts
HRESULT get_RenderFacetOpts
(
--- returned arguments ---
void *pVal
)
|
Returns the current facetting options.
|
Returned arguments
|
pVal
|
The facetting options
|
HRESULT put_RenderFacetOpts
(
--- returned arguments ---
void *newVal
)
|
Sets the current facetting options.
|
Returned arguments
|
newVal
|
The facetting options
|
RenderLineOpts
HRESULT get_RenderLineOpts
(
--- returned arguments ---
void *pVal
)
|
Returns the current line rendering options.
|
Returned arguments
|
pVal
|
The line rendering options
|
HRESULT put_RenderLineOpts
(
--- returned arguments ---
void *newVal
)
|
Sets the current line rendering options.
|
Returned arguments
|
newVal
|
The line rendering options
|
ViewCentre
HRESULT get_ViewCentre
(
--- returned arguments ---
double pVal[3]
)
|
Returns the current view centre
|
Returned arguments
|
pVal
|
The view centre
|
pVal
is the current view centre where:
-
pVal[0]
represents the x component
-
pVal[1]
represents the y component
-
pVal[2]
represents the z component
HRESULT put_ViewCentre
(
--- received arguments ---
double newVal[3]
)
|
Sets the current view centre
|
Received arguments
|
newVal
|
The view centre
|
newVal
is the current view centre where:
-
newVal[0]
represents the x component
-
newVal[1]
represents the y component
-
newVal[2]
represents the z component
[back to top]
A.13.3 IPSWView2 functions
FitToScreen
Recalculates the view to fit all the parts in the document on the screen.
ResetRenderOptions
HRESULT ResetRenderOptions
(
)
|
Resets the render options to their default values.
This function returns full control of the rendering to PS/Workshop.
ScaleView
HRESULT ScaleView
(
--- received arguments ---
double factor
)
|
Scales the view by the given
factor
.
|
Received arguments
|
factor
|
Scale to apply to view
|
If
factor
< 1 then the view zooms out. If
factor
is > 1 then the view zooms in.
|
Specific Errors
|
|
|
E_INVALIDARG
|
factor must be > 0
|
ZoomToEntities
HRESULT ZoomToEntities
(
---received arguments ---
int nEnts,
PK_ENTITY_t *pkEnts
)
|
Zooms to the given entities.
|
Received arguments
|
nEnts
|
The number of entities
|
pkEnts
|
The entities to zoom to
|
The following classes of entities are supported:
-
PK_CLASS_assembly
-
PK_CLASS_body
-
PK_CLASS_face
-
PK_CLASS_edge
-
PK_CLASS_vertex
-
PK_CLASS_point
-
PK_CLASS_curve, and all subclasses
-
PK_CLASS_surf, and all subclasses
|
Specific Errors
|
|
|
PSWERR_INVALIDCLASS
|
At least one of pkEnts is of the wrong class
|
|
PSWERR_NOTANENTITY
|
At least one of pkEnts is not a valid entity
|
RotateView
HRESULT RotateView
(
--- received arguments ---
double angle,
double *axis
)
|
Rotates the view about the given
axis
.
|
Received arguments
|
angle
|
Angle to rotate view in radians
|
axis
|
Axis to rotate view about
|
-
axis[0]
represents the x component of axis
-
axis[1]
represents the y component of axis
-
axis[2]
represents the z component of axis
|
Specific Errors
|
|
|
E_INVALIDARG
|
axis is not a unit vector
|
Update
HRESULT Update
(
--- received arguments ---
int nEnts,
PK_ENTITY_t *pkEnts
)
|
Forces an update (re-render) of the given entities.
|
Received arguments
|
nEnts
|
The number of entities
|
pkEnts
|
The entities
|
This function updates the folllowing Parasolid entity classes:
-
PK_CLASS_body
-
PK_CLASS_assembly
-
PK_CLASS_face
-
PK_CLASS_edge
-
PK_CLASS_vertex
-
PK_CLASS_curve, and all subclasses (if in the draw list)
-
PK_CLASS_surf, and all subclasses (if in the draw list)
-
PK_CLASS_point (if in the draw list)
[back to top]
A.14 IPSWAddIn
Provides the connection/disconnection mechanism for a module. Every PS/Workshop module must support this interface.
[back to top]
A.14.1 Summary
The following is a summary of the IPSWAddIn interface.
Functions
[back to top]
A.14.2 IPSWAddIn functions
OnConnection
HRESULT OnConnection
(
--- received arguments ---
IDispatch *pIPSWApp,
IDispatch *pIPSWAddIn,
PswConnectMode eConnectMode
)
|
This function is called whenever a module is loaded.
|
Received arguments
|
pIPSWApp
|
The PS/Workshop IDispatch interface
|
pIPSWAddIn
|
The PS/Workshop IPSWAddIn interface
|
eConnectMode
|
How the module is loaded
|
The
eConnectMode
argument determines how the module was loaded. It can have one of the following values:
|
Value
|
Description
|
pswConnectAtStartUp
|
The module has been loaded at startup
|
pswConnectByUser
|
A user has requested this module to be loaded
|
pswConnectExternally
|
The module has been loaded from an external source
|
PS/Workshop calls this function on a module when it attempts to load it. If this returns an error code then PS/Workshop unloads the module. In the default implementation this calls CAddonMain:StartModule.
OnDisconnection
HRESULT OnDisconnection
(
--- received arguments ---
pswDisconnectMode DisconnectMode
)
|
This function is called when the module is disconnected.
|
Received arguments
|
DisconnectMode
|
How the module came to be unloaded
|
The
pswDisconnectMode
argument determines how the module came to be unloaded. It may have the following values:
|
Value
|
Description
|
pswDisconnectAtShutdown
|
The module is being disconnected as a result of PS/Workshop shutting down
|
pswDisconnectByUser
|
The module has been unloaded at the request of the user
|
pswDisconnectExternally
|
The module has been unloaded at the request of some external process
|
This function on a module is called immediately before the module is unloaded. It is suggested that during this function the module ensures that all references to PS/Workshop interfaces are released.
[back to top]
A.15 IPSWEvents
Provides notification of PS/Workshop events to a module
[back to top]
A.15.1 Summary
The following is a summary of the IPSWEvents interface.
Functions
|
Function
|
Descriptoin
|
OnCommand
|
Called whenever a menu item added by a module is selected
|
OnCommandHelp
|
Called to provide help on a menu item added by a module
|
OnCommandUpdateUI
|
Called to update the UI of a menu item added by a module
|
OnDocClose
|
Called whenever a PS/Workshop document is closed
|
OnDocOpen
|
Called whenever a PS/Workshop document is opened
|
OnPartChange
|
Called whenever the parts in a document have changed
|
OnSelectTopols
|
Called whenever a selection event occurs
|
OnViewClose
|
Called whenever a view is closed
|
OnViewOpen
|
Called whenever a view is opened
|
[back to top]
A.15.2 IPSWEvents functions
OnCommand
HRESULT OnCommand
(
--- received arguments ---
long CommandID,
void *lparam
)
|
Called whenever a menu item added by a module is selected, or a file of a registered filetype is chosen.
|
Received arguments
|
CommandID
|
The ID associated with the command
|
lparam
|
Extra information relating to the command
|
This event may occur in the following cases:
|
Case
|
Comments
|
|
The user chose a menu item previously added by the module.
|
In this case,
CommandID
is the ID previously passed to IPSWApp::AddMenuItem or AddMenuItem2. The
lparam
argument is NULL in this instance.
|
|
The user has selected a file of a registered filetype from either the File Open or File Save As dialog.
|
In this case,
CommandID
is the ID of the registered FileOpen or FileSaveAs handler. The
lparam
argument contains the filename to open or save, as a LPCSTR.
The module must have already registered a custom FileOpen or FileSaveAs handler using IPSWApp::RegisterFileOpenFunction or RegisterFileSaveAsFunction for this case to be handled.
|
OnCommandHelp
HRESULT OnCommandHelp
(
--- received arguments ---
long hFrameWnd,
long HelpCommandID,
long CommandID
)
|
Called whenever help is requested about a menu item added by a module.
This function is currently not implemented and returns E_NOTIMPL.
OnCommandUpdateUI
HRESULT OnCommandUpdateUI
(
--- received arguments ---
long CommandID,
--- returned arguments ---
long *CommandFlags,
BSTR *MenuItemText,
long *BitmapID
)
|
Called to update the user interface for a menu item added by a module.
|
Received arguments
|
CommandID
|
The ID associated with the command
|
|
Returned arguments
|
CommandFlags
|
Whether to enable/disable this command
|
MenuItemText
|
The text to associate with this menu entry
|
BitmapID
|
Not used
|
This function is called by the framework to update the status of user added menu items.
CommandID
is the ID previously passed to IPSWApp::AddMenuItem or AddMenuItem2 for a particular menu item.
You can use
CommandFlags
to change the status of a menu item. It can take any of the following values:
|
Value
|
Description
|
|
pswCmdUI_Enable
|
Enable the menu item if it is currently disabled.
|
|
pswCmdUI_Disable
|
Disable the menu item if it is currently enabled.
|
|
pswCmdUI_Checked
|
Place a tick mark next to the menu item.
|
|
pswCmdUI_Unchecked
|
Remove the tick mark next to the menu item.
|
|
pswCmdUI_ChangeText
|
Use the text specified in
MenuItemText
as the text for the menu item.
|
|
pswCmdUI_UseBmp
|
Use the bitmap specified in
BitmapID
as the bitmap associated with the
CommandID
.
|
The
MenuItemText
argument controls the text that is associated with the menu item, so that the text seen by the user can be changed on the fly, in conjunction with the value of
CommandFlags
.
Note: The BitmapID argument is currently ignored.
|
OnDocClose
HRESULT OnDocClose
(
--- received arguments ---
IPSWDoc* pDoc
)
|
Called whenever a PS/Workshop document is closed.
|
Received arguments
|
pDoc
|
The IPSWDoc interface associated with this document
|
This event only occurs after the associated OnViewClose event.
OnDocOpen
HRESULT OnDocOpen
(
--- received arguments ---
IPSWDoc* pDoc
)
|
Called whenever a PS/Workshop document is opened.
|
Received arguments
|
pDoc
|
The IPSWDoc interface associated with this document
|
This event occurs before the associated OnViewOpen event.
OnPartChange
Called whenever the parts in a document change.
This function is called whenever the number of parts in any document change, or the parts themselves change. It is not called if any sub-entities of the part are modified.
OnSelectTopols
HRESULT OnSelectTopols
(
)
|
Called whenever a selection event occurs inside PS/Workshop.
This function is called whenever an entity is selected or deselected in any document. The selected entities can then be found using the IPSWSelectionList interface.
OnViewClose
HRESULT OnViewClose
(
--- received arguments ---
IPSWDoc *pDoc,
IPSWView *pView
)
|
Called whenever the PS/Workshop view is closed.
|
Received arguments
|
pDoc
|
The IPSWDoc interface associated with this view
|
pView
|
The IPSWView interface associated with this view
|
This function is called before any subsequent call to OnDocClose.
As of PS/Workshop 2.1, pView can be query-interfaced to IPSWView.
OnViewOpen
HRESULT OnViewOpen
(
--- received arguments ---
IPSWDoc *pDoc,
IPSWView *pView
)
|
Called whenever the PS/Workshop view is opened.
|
Received arguments
|
pDoc
|
The IPSWDoc interface associated with this view
|
pView
|
The IPSWView interface associated with this view
|
This function is called after any call to OnDocOpen.
[back to top]