Library | Module

Class pfcSession



Description

The Creo Parametric session.

To each application, Creo assigns a unique session, which contains the application licensing information, its pfcCreoCompatibility and other data. The application can obtain this session by calling MpfcSession.GetCurrentSession(). However, when assigning the session, Creo sets its compatibility (in associated pfcAppInfo) to CompatibilityUndefined. This makes setting the compatibility be the responsibility of the application. To do this, when obtaining the assigned session the first time, the application must call MpfcSession.GetCurrentSessionWithCompatibility() and pass a specific Creo compatibility to it. Otherwise, calls to MpfcSession.GetCurrentSession() will be throwing pfcXCompatibilityNotSet. Setting the comatiblity can be done only once during the runtime, although doing this always is a save approach to avoid the exception. For instance, if a Java toolkit application has more than one starting method, each such method must set the compatibility when obtaining the assigned session the first time.

Another function to obtain the assigned session is <reference 4 to unknown entity pfcGlobal::GetProESession> . It does not throw exceptions, but if it is used as the first call to obtain the session, then it sets the compatibility to C3Compatible. This is done to provide the forward compatibility for applications based on earlier versions of Creo. This behavior can be changed by calling first MpfcSession.GetCurrentSessionWithCompatibility() with compatibility passed as desired. Then all subsequent calls to <reference 4 to unknown entity pfcGlobal::GetProESession> will return the session with same compatibility. Such behavior facilitates the migration of pre-Creo4 applications: it is enough to replace only the first call to <reference 4 to unknown entity pfcGlobal::GetProESession> with MpfcSession.GetCurrentSessionWithCompatibility()(C4Compatible), while leaving all subsequent calls to <reference 4 to unknown entity pfcGlobal::GetProESession> without a change.

Please note that using <reference 4 to unknown entity pfcGlobal::GetProESession> is deprecated. In subsequent releases it will result in an exception.
Direct Parent Classes:
pfcBaseSession



Property Summary

/* readonly */ pfcSelectionBufferCurrentSelectionBuffer
The current selection buffer object.



Method Summary

pfcAppInfoGetAppInfo ()
Returns the application information from the applicatoin session.
booleanModelDescrContainsOrigin (pfcModelDescriptor Descr)
 
voidNavigatorPaneBrowserAdd (string PaneName, /* optional */ string IconFileName, string URL)
Adds a new Navigator Pane.
voidNavigatorPaneBrowserIconSet (string PaneName, string IconFileName)
Set the icon for a Navigator Pane.
voidNavigatorPaneBrowserURLSet (string PaneName, string URL)
Set the url for a Navigator Pane.
voidRibbonDefinitionfileLoad (string FileName)
Loads ribbon definition file from a default path.
voidSetAppInfo (pfcAppInfo Info)
Sends the application information for the application session.
voidUIClearMessage ()
Scrolls the text in the message area up one line after a call to pfcSession.UIDisplayMessage() . This command produces only one carriage return; if called multiple times, the command is ignored.
voidUIDisplayFeatureParams (pfcSelection Selection, pfcParamType Type)
Displays parameters of a selected feature.
voidUIDisplayLocalizedMessage (string MsgFile, string Format, /* optional */ stringseq Messages)
Prints a text message to the message area in Creo Parametric.
voidUIDisplayMessage (string MsgFile, string Format, /* optional */ stringseq Messages)
Prints a text message to the message area in Creo Parametric.
/* optional */ pfcUICommandUIGetCommand (string Name)
Finds the identifier of the specified action or option.
pfcMouseStatusUIGetCurrentMouseStatus (boolean SnapToGrid)
Returns the status of mouse at this particular moment. This method returns whenever the mouse is moved or a button is pressed.
pfcMouseStatusUIGetNextMousePick ( /* optional */ pfcMouseButton ExpectedButton)
Returns the mouse status at the time that the user makes a mouse pick.
stringUIOpenFile (pfcFileOpenOptions Options)
Prompts the standard file browser interface of Creo Parametric.
pfcOutline3DUIPickMouseBox ( /* optional */ pfcPoint3D FirstCorner)
Prompt the user to select a rectangle using the mouse.
/* optional */ numberUIReadIntMessage (number LowerLimit, number UpperLimit)
Reads an integer from the keyboard.
/* optional */ numberUIReadRealMessage (number LowerLimit, number UpperLimit)
Reads a double-precision float from the keyboard.
/* optional */ stringUIReadStringMessage ( /* optional */ boolean HideInput)
Reads a line of keyboard input and returns the contents as a wide string.
stringUISaveFile (pfcFileSaveOptions Options)
Prompts the standard file browser interface of Creo Parametric, set up for the purpose of allowing the user to save a file.
stringUISelectDirectory (pfcDirectorySelectionOptions Options)
Prompts the standard file browser interface of Creo Parametric, set up for the purpose of allowing the user to select a directory.
pfcMessageButtonUIShowMessageDialog (string Message, /* optional */ pfcMessageDialogOptions Options)
Displays the UI Message Dialog.



Property Detail


/* readonly */ pfcSelectionBufferCurrentSelectionBuffer

The current selection buffer object.

It is necessary to have a model active in the session before calling the Get method for the above attribute.





Method Detail


pfcAppInfoGetAppInfo ()

Returns the application information from the applicatoin session.
Returns:



booleanModelDescrContainsOrigin (pfcModelDescriptor Descr)

 
Parameters:
Descr
 
Returns:
 



voidNavigatorPaneBrowserAdd (string PaneName, /* optional */ string IconFileName, string URL)

Adds a new Navigator Pane.
Parameters:
PaneName
The name of the new navigator pane
IconFileName
The name of the icon file
URL
URL of the pane



voidNavigatorPaneBrowserIconSet (string PaneName, string IconFileName)

Set the icon for a Navigator Pane.
Parameters:
PaneName
The name of the new navigator pane
IconFileName
The name of the icon file



voidNavigatorPaneBrowserURLSet (string PaneName, string URL)

Set the url for a Navigator Pane.
Parameters:
PaneName
The name of the new navigator pane
URL
URL to set in the pane



voidRibbonDefinitionfileLoad (string FileName)

Loads ribbon definition file from a default path.

Exceptions thrown (but not limited to):

pfcXToolkitNotFound - The ribbon definition file was not found.

pfcXToolkitInvalidFile - The file specified was not a ribbon definition file.


Parameters:
FileName
Name of ribbon definition file including extension name. The default search paths for finding the ribbon definition file are:
  • Current directory
  • Creo Parametric Loadpoint/text/ribbon
  • Application text dir/ribbon
  • Application text dir/(language)/ribbon



voidSetAppInfo (pfcAppInfo Info)

Sends the application information for the application session.
Parameters:
Info



voidUIClearMessage ()

Scrolls the text in the message area up one line after a call to pfcSession.UIDisplayMessage() . This command produces only one carriage return; if called multiple times, the command is ignored.

You could use this function to remove a message once the user has responded to it, so it is clear that the system received the response.



voidUIDisplayFeatureParams (pfcSelection Selection, pfcParamType Type)

Displays parameters of a selected feature.

Exceptions thrown (but not limited to):

pfcXToolkitNotFound - The model is not the top-level model in the window.


Parameters:
Selection
A selection object in which the selected model item is a feature.
Type
Specifies the type of parameter to display. The options are:
  • DIM_PARAM
  • PATTERN_PARAM
  • REFDIM_PARAM
  • ALL_PARAMS
  • GTOL_PARAM
  • SURFFIN_PARAM



voidUIDisplayLocalizedMessage (string MsgFile, string Format, /* optional */ stringseq Messages)

Prints a text message to the message area in Creo Parametric.

This method supports non-ASCII character strings as messages. Remember that Web.Link applications, as unregistered web pages, do not currently support setting of the PTC Creo Parametric text directory. All the resource files for messages must be located at $PRO_DIRECTORY/text folder.

Exceptions thrown (but not limited to):

pfcXToolkitNotFound - The specified message file was not found.

pfcXToolkitCantOpen - The system could not read the message file.

pfcXToolkitMsgNotFound - The specified message was not found in the message file.

pfcXToolkitMsgNoTrans - The message text (in the current language of the user interface) was not found.

pfcXToolkitMsgFmtError - There was a format error in the message text.

pfcXToolkitMsgTooLong - The message was longer than 259 characters and has been truncated to fit.

pfcXToolkitFound - The message file had been read in before this call and the message was not in it.


Parameters:
MsgFile
The name of the message file containing the format
Format
The format of the message: the first line of the section of the message file that uniquely identifies the message
Messages
A sequence of strings which will replace any occurrences of %#w in the message file, where '#' is the numerical identifier of the replacement. This method does not support formats using %#s.



voidUIDisplayMessage (string MsgFile, string Format, /* optional */ stringseq Messages)

Prints a text message to the message area in Creo Parametric.

This method supports only ASCII character strings as messages. Remember that Web.Link applications, as unregistered web pages, do not currently support setting of the PTC Creo Parametric text directory. All the resource files for messages must be located at $PRO_DIRECTORY/text folder.

Exceptions thrown (but not limited to):

pfcXToolkitNotFound - The specified message file was not found.

pfcXToolkitCantOpen - The system could not read the message file.

pfcXToolkitMsgNotFound - The specified message was not found in the message file.

pfcXToolkitMsgNoTrans - The message text (in the current language of the user interface) was not found.

pfcXToolkitMsgFmtError - There was a format error in the message text.

pfcXToolkitMsgTooLong - The message was longer than 80 characters and has been truncated to fit.

pfcXToolkitFound - The message file had been read in before this call and the message was not in it.


Parameters:
MsgFile
The name of the message file containing the format
Format
The format of the message: the first line of the section of the message file that uniquely identifies the message
Messages
A sequence of strings which will replace any occurrences of %#s in the message format, where '#' is the numerical identifier of the replacement. This method does not support formats using %#w.



/* optional */ pfcUICommandUIGetCommand (string Name)

Finds the identifier of the specified action or option.
Parameters:
Name
The name of the action or option.
Returns:
A pointer to the command.



pfcMouseStatusUIGetCurrentMouseStatus (boolean SnapToGrid)

Returns the status of mouse at this particular moment. This method returns whenever the mouse is moved or a button is pressed.

Exceptions thrown (but not limited to):

pfcXToolkitAbort - The user aborted input.


Parameters:
SnapToGrid
Boolean specifying whether or not the mouse positions should be indicated as the closest gridpoint.
Returns:
Data object with the current mouse position and button status.



pfcMouseStatusUIGetNextMousePick ( /* optional */ pfcMouseButton ExpectedButton)

Returns the mouse status at the time that the user makes a mouse pick.
Parameters:
ExpectedButton
The button that the user should press, or null, which means any button will cause the function to return.
Returns:
Data object containing the current mouse position and button status.



stringUIOpenFile (pfcFileOpenOptions Options)

Prompts the standard file browser interface of Creo Parametric.

This method cannot be used for NX models in the current release.

Exceptions thrown (but not limited to):

pfcXToolkitUserAbort - The user aborted from the user interface.


Parameters:
Options
The various options for file open dialog.
Returns:
The selected file.



pfcOutline3DUIPickMouseBox ( /* optional */ pfcPoint3D FirstCorner)

Prompt the user to select a rectangle using the mouse.
Parameters:
FirstCorner
The location of the first corner of the rectangle, or null, in which case the user willbe able to select both corners.
Returns:
The two boundary points, in screen coordinates.



/* optional */ numberUIReadIntMessage (number LowerLimit, number UpperLimit)

Reads an integer from the keyboard.

If the user types a value outside the specified range of values, the functions prompts the user to enter the value again.

Exceptions thrown (but not limited to):

pfcXToolkitMsgUserQuit - The user canceled input by typing ESC.


Parameters:
LowerLimit
The lower limit of the range of valid values
UpperLimit
The upper limit of the range of valid values
Returns:
A pointer to the value entered



/* optional */ numberUIReadRealMessage (number LowerLimit, number UpperLimit)

Reads a double-precision float from the keyboard.

If the user types a value outside the specified range of values, the function prompts the user to enter the value again.

Exceptions thrown (but not limited to):

pfcXToolkitMsgUserQuit - The user canceled input by typing ESC.


Parameters:
LowerLimit
The lower limit of the range of valid values
UpperLimit
The upper limit of the range of valid values
Returns:
A pointer to the value entered



/* optional */ stringUIReadStringMessage ( /* optional */ boolean HideInput)

Reads a line of keyboard input and returns the contents as a wide string.

Leading and trailing blanks are stripped from the string.

Default values are displayed in the text box as input. Note that this value will not be returned if the user hits a carriage return; instead, the function will return constant string "use_default_string" and the application must interpret that the user intends to use the default.

Exceptions thrown (but not limited to):

pfcXToolkitMsgUserQuit - The user canceled input by typing <ESC>.


Parameters:
HideInput
A Boolean flag that specifies whether the input should be hidden, such as when you type in a password
Returns:
The string entered



stringUISaveFile (pfcFileSaveOptions Options)

Prompts the standard file browser interface of Creo Parametric, set up for the purpose of allowing the user to save a file.

For Multi-CAD objects, this method does not support local disk saving location in a Windchill connected session.

Exceptions thrown (but not limited to):

pfcXToolkitUserAbort - The user aborted from the user interface.


Parameters:
Options
The various options for save file dialog.
Returns:
The saved file.



stringUISelectDirectory (pfcDirectorySelectionOptions Options)

Prompts the standard file browser interface of Creo Parametric, set up for the purpose of allowing the user to select a directory.

Exceptions thrown (but not limited to):

pfcXToolkitUserAbort - The user aborted from the user interface.


Parameters:
Options
The various options for directory selection dialog.
Returns:
The selected directory path.



pfcMessageButtonUIShowMessageDialog (string Message, /* optional */ pfcMessageDialogOptions Options)

Displays the UI Message Dialog.
Parameters:
Message
The message text to be displayed in the dialog.
Options
The various options for message dialog. If null, a default message dialog is displayed, with only an OK button and an Info icon and title.
Returns:
The identifier of the button that the user pressed to dismiss the dialog.