Data Management: Windchill Operations
Creo Parametric has the capability to be directly connected to Windchill solutions, including Windchill ProjectLink, Pro/INTRALINK and PDMLink servers. This access allows users to manage and control the product data seamlessly from within Creo Parametric.
This section lists Creo TOOLKIT APIs that support Windchill servers and server operations in a connected Creo Parametric session.
Introduction
The functions introduced in this section provide support for the basic Windchill server operations from within Creo Parametric. Refer to the compatibility matrix on PTC.com for information on the versions of Windchill compatible with Creo Parametric.
With these functions, operations such as registering a Windchill server, managing workspaces, and check in or check out of objects will be possible via Creo TOOLKIT.
The capabilities of the APIs described in this section are similar to the operations available from within the Creo Parametric client, with some restrictions. Some of the APIs specified in this section are supported in non-interactive mode, that is, batch mode application or asynchronous application.
Note
When Creo Parametric applications are running in asynchronous non-graphical mode, they require login credentials before execution. If you want to override the requirement of specifying login credentials for Creo Parametric applications, set the environment variable PROWT_AUTH_MODE to PROWT_AUTH_UNATTENDED.
For more information about batch mode refer to the section Using Creo Parametric TOOLKIT to Make a Batch Creo Parametric Session and for asynchronous mode refer to the section Core: Asynchronous Mode.
Accessing a Windchill Server from a Creo Parametric Session
Creo Parametric allows you to register Windchill servers as a connection between the Windchill database and Creo Parametric. Although the represented Windchill database can be from ProjectLink, Pro/INTRALINK or PDMLink, all types of databases are represented in the same way.
You can use the following identifiers when referring to Windchill servers in Creo TOOLKIT:
•  Codebase URL—This is the root portion of the URL that is used to connect to a Windchill server. For example, http://wcserver.company.com/Windchill.
•  Server Alias—A server alias is used to refer to the server after it has been registered. The alias is also used to construct paths to files in the server workspaces and commonspaces. The server alias is chosen by the user or application and it need not have any direct relationship to the codebase URL. An alias can be any normal name, such as my_alias.
Accessing Information Before Registering a Server
To start working with a Windchill server, you must establish a connection by registering the server in Creo Parametric. The functions described in this section enable you to connect to a Windchill server and access information related to the server.
Functions Introduced:
Use the function ProBrowserAuthenticate() to set the authentication context using a valid username and password. A successful call to this function allows the Creo Parametric session to register with any server accepting the username and password combination. A successful call to this function also ensures that an authentication dialog box does not appear during the registration process. You can call this function any number of times to set the authentication context for any number of Windchill servers, provided that you register the appropriate servers or servers immediately after setting the context.
The function ProServerClassGet() returns the class of the server. The values are:
•  Windchill—Denotes a WindchillPDMLink server.
•  ProjectLink—Denotes WindchillProjectLink type of servers.
This function accepts the server codebase URL as the input.
The function ProServerVersionGet() returns the version of Windchill that is configured on the server, for example, 9.0 or 10.0. This function accepts the server codebase URL as the input.
Note
ProServerVersionGet() works only for Windchill servers and returns the PRO_TK_UNSUPPORTED error, if the server is not a Windchill server.
The function ProServerContextsCollect() gives a list of all the available contexts for a specified server. A context is used to associate a workspace with a product, project, or library. This function accepts the server codebase URL as the input.
The function ProServerWorkspacesCollect() returns the list of available workspaces for the specified server. The workspace data returned contains the name of the workspace and its context. This function accepts the server codebase URL as the input.
Registering and Activating a Server
From Creo Parametric 2.0 onward, the Creo TOOLKIT APIs call the same underlying API as Creo Parametric to register and unregister servers. Hence, registering the servers using Creo TOOLKIT APIs is similar to registering the servers using the Creo Parametric user interface. Therefore, the servers registered by Creo TOOLKIT are available in the Creo Parametric Server Registry. The servers are also available in other locations in the Creo Parametric user interface such as, the Folder Navigator and the embedded browser.
Functions Introduced:
The function ProServerRegister() registers the specified server with the codebase URL. You can automate the registration of servers in interactive mode. To preregister the servers use the standard config.fld setup. If you do not want the servers to be preregistered in batch mode, set the environment variable PTC_WF_ROOT to an empty directory before starting Creo Parametric.
A successful call to ProBrowserAuthenticate() with a valid username and password is essential for ProServerRegister() to register the server without launching the authentication dialog box. Registration of the server establishes the server alias.
The function ProServerActivate() sets the specified server as the active server in the Creo Parametric session.
The function ProServerUnregister() unregisters the specified server. This is similar to Server Registry  Delete through the user interface.
Accessing Information From a Registered Server
Functions Introduced:
The function ProServerActiveGet() returns the primary server.
The function ProServerContextGet() returns the active context of the active server.
The function ProServerAliasGet() returns the alias of a server if you specify the codebase URL.
The function ProServersCollect() returns a list of the aliases of all the registered servers.
The function ProServerLocationGet() returns the codebase URL for the server if you specify the alias.
The function ProServerIsOnline() checks if the specified server is online or offline. It returns PRO_B_TRUE if the server is online.
Accessing the Workspace
For every workspace, a new distinct storage location is maintained in the user’s personal folder on the server (server-side workspace) and on the client (client-side workspace cache). Together, the server-side workspace and the client-side workspace cache make up the workspace.
Workspace Data
Functions Introduced:
The workspace data is an opaque handle that contains the name and context of the workspace. The function ProServerWorkspacesCollect() returns an array of workspace data. Workspace data is also required for the function ProServerWorkspaceCreate() to create a workspace with a given name and a specific context.
The function ProServerworkspacedataAlloc() creates a workspace data structure to describe a workspace. The workspace contains the name of the workspace and the context in which the workspace is stored.
The function ProServerworkspacedataNameGet() retrieves the name of the workspace from the workspace data.
The function ProServerworkspacedataContextGet() retrieves the context of the workspace from the workspace data.
Use the function ProServerworkspacedataFree() to free the workspace data structure from memory.
Use the function ProServerworkspacedataProarrayFree() to free the workspace data array from the memory.
Creating and Modifying the Workspace
Functions Introduced
The function ProServerWorkspaceCreate() creates and activates a new workspace.
The function ProServerWorkspaceGet() retrieves the name of the active workspace.
The function ProServerWorkspaceSet() sets a specified workspace as an active workspace.
The function ProServerWorkspaceDelete() deletes the specified workspace. The function deletes the workspace only if the following conditions are met:
•  The workspace is not the active workspace.
•  The workspace does not contain any checked out objects.
Use one of the following techniques to delete an active workspace:
•  Make the required workspace inactive using ProServerWorkspaceSet() with the name of some other workspace and then call ProServerWorkspaceDelete().
•  Unregister the server using ProServerUnregister() and delete the workspace using the codebase URL instead of the alias.
Workflow to Register a Server
To Register a Server with an Existing Workspace
Perform the following steps to register a Windchill server with an existing workspace:
1. Set the appropriate authentication context using the function ProBrowserAuthenticate() with a valid username and password.
2. Look up the list of workspaces using the function ProServerWorkspacesCollect(). If you already know the name of the workspace on the server, then ignore this step.
3. Register the workspace using the function ProServerRegister() with an existing workspace name on the server.
4. Activate the server using the function ProServerActivate().
To Register a Server with a New Workspace
Perform the following steps to register a Windchill server with a new workspace:
1. Perform steps 1 to 4 in the preceding section to register the Windchill server with an existing workspace.
2. Use the function ProServerContextsCollect() to choose the required context for the server.
3. Create a new workspace with the required context using the function ProServerWorkspaceCreate(). This function automatically makes the created workspace active.
Note
You can create a workspace only after the server is registered.
Aliased URL
An aliased URL serves as a handle to the server objects. You can access the server objects in the commonspace (shared folders) and the workspace using the aliased URL. An aliased URL is a unique identifier for the server object and the format is as follows:
•  Object in workspace has a prefix wtws
wtws://<server_alias>/<workspace_name>/<object_server_name>
where <object_server_name> includes <object_name>.<object_extension>
For example, wtws://my_server/my_workspace/abcd.prt, wtws://my_server/my_workspace/intf_file.igs
where
<server_alias> is my_server
<workspace_name> is my_workspace
•  Object in commonspace has a prefix wtpub
wtpub://<server_alias>/<folder_location>/<object_server_name>
For example, wtpub://my_server/path/to/cs_folder/abcd.prt
where
<server_alias> = my_server
<folder_location> = path/to/cs_folder
Note
  <object_server_name> must be in lowercase.
  The APIs are case-sensitive to the aliased URL.
  <object_extension> should not contain Creo Parametric versions, for example, .1 or .2, and so on.
Server Operations
After registering the Windchill server with Creo Parametric, you can start accessing the data on the Windchill servers. The Creo Parametric interaction with Windchill servers leverages the following locations:
•  Commonspace (Shared folders)
•  Workspace (Server-side workspace)
•  Workspace local cache (Client-side workspace)
•  Creo Parametric session
•  Local disk
The functions described in this section enable you to perform the basic server operations. The following diagram illustrates how data is transferred among these locations.
Image
Save
Functions Introduced:
The function ProMdlSave() stores the object from the session in the local workspace cache, when a server is active.
Upload
An upload transfers Creo Parametric files and any other dependencies from the local workspace cache to the server-side workspace.
Function Introduced:
The function ProServerObjectsUpload() uploads the specified object to the workspace. The object to be uploaded must be present in the current Creo Parametric session. Additionally, ensure that you save the object using the function ProMdlSave() before you upload it.
Note
To upload all the objects to the workspace without retrieving them in the current Creo Parametric session, use the function ProServerObjectsCheckin() with the checkin option upload_only set to PRO_B_TRUE.
CheckIn
After you have finished working on objects in your workspace, you can share the design changes with other users. The checkin operation copies the information and files associated with all changed objects from the workspace to the Windchill database.
Functions Introduced
The function ProServerObjectsCheckin() checks in or uploads an object to the database. The object to be checked in or uploaded must be present in the current Creo Parametric session. Changes made to the object are not included unless you save the object to the workspace using the function ProMdlSave() before it is checked in or uploaded.
Note
ProServerObjectsCheckin() checks in the target object by default. To only upload the object, set the checkin option upload_only to PRO_B_TRUE.
If you pass NULL as the value of the input argument options, the checkin operation is similar to the Auto Check In option in Creo Parametric. For more details on Auto Check In, refer to the online help for Creo Parametric.
By using an appropriately constructed options argument, you can control the checkin or upload operation. The APIs described in this section help in constructing the options argument.
The function ProServercheckinoptsAlloc() allocates a set of checkin or upload options for the object. These options are as follows:
•  Default location—Specifies the default folder_location on the server for the automatic checkin operation. Use the function ProServercheckinoptsDeflocationSet() to set this location.
•  Server location—Specifies the folder_location on the server in which an object will be checked in or uploaded. Use the function ProServercheckinoptsLocationAdd() to set this location.
•  Baseline—Specifies the baseline information for the objects upon checkin. This information does not apply to upload operations. Use the function ProServercheckinoptsBaselineSet() to create a new baseline. The baseline information for a checkin operation is as follows:
  baseline_name—Specifies the name of the baseline.
  baseline_number—Specifies the number of the baseline.
The default format for the baseline name and baseline number is Username + time (GMT) in milliseconds.
  baseline_location—Specifies the location of the baseline.
  baseline_lifecycle—Specifies the name of the lifecycle.
•  keep_checked_out—If this option is set to PRO_B_TRUE, then the contents of the selected object are checked in to the Windchill server and automatically checked out again for further modification. The default value is PRO_B_FALSE. This option does not apply to upload operations. Use the function ProServercheckinoptsKeepcheckedoutSet() to set the keep_checked_out flag.
•  autoresolve—Specifies the option used to automatically resolve objects that have not been completely checked in or uploaded to the database. The autoresolve options specified by the enumerated type ProServerAutoresolveOption are as follows:
  PRO_SERVER_DONT_AUTORESOLVE—Model references missing from the workspace are not automatically resolved. This may result in a conflict upon checkin. This option is used by default.
  PRO_SERVER_AUTORESOLVE_IGNORE—Missing references are automatically resolved by ignoring them.
  SERVER_AUTORESOLVE_UPDATE_IGNORE—Missing references are automatically resolved by updating them in the database and ignoring them if not found.
Use the function ProServercheckinoptsCommentSet() to set the history comment for checkin operations. These checkin comments are visible in the Windchill History tab.
Use the function ProServercheckinoptsAutoresolveSet() to assign the appropriate autoresolve option.
•  upload_only—Specifies the option to fully check in the target object or only upload the object to the server. Set this option to PRO_B_TRUE to only upload and not check in the target objects and to PRO_B_FALSE to upload and check in the objects. By default, this option is PRO_B_FALSE, if not explicitly set, to cause a checkin. Use the function ProServercheckinoptsUploadonlySet() to set the upload_only flag.
Use the function ProServercheckinoptsFree() to free the memory of the checkin options.
Notification Functions
A Creo TOOLKIT notification is called before you attempt to check in a model through the Creo Parametric user interface. The notification functions are established in a session using the function ProNotificationSet().
Function Introduced:
The notification function ProCheckinUIPreAction() is called when you select File>Auto Check In, File>Custom Check In, or the corresponding options on the Model Tree menu in the Creo Parametric user interface. It is called before any action is performed by the corresponding menu commands. This function is available by calling ProNotificationSet() with the value of the notify type as PRO_CHECKIN_UI_PRE.
Retrieval
Standard Creo TOOLKIT provides several functions that are capable of retrieving models. When using these functions with Windchill servers, remember that these functions do not check out the object to allow modifications.
Functions Introduced:
The function ProMdlnameRetrieve() loads an object into a session given its name and type. This function searches for the object in the active workspace, the local directory, and any other paths specified by the configuration option search_path.
The function ProMdlFiletypeLoad() loads an object into session given its path. The path can be a disk path, a workspace path, or a commonspace path. Refer to the section Aliased URL for examples of these types of paths.
Checkout and Download
To modify an object from the commonspace, you must check out the object. The process of checking out communicates your intention to modify a design to the Windchill server. The object in the database is locked, so that other users can obtain read-only copies of the object, and are prevented from modifying the object while you have it checked out.
Checkout is often accompanied by a download action, where the objects are brought from the server-side workspace to the local workspace cache. In Creo TOOLKIT, both operations are covered by the same set of functions.
Functions Introduced:
The function ProServerObjectsCheckout() checks out and optionally downloads the object to the workspace based on the configuration specifications of the workspace. It takes the following two potential identifiers for the model to checkout:
•  ProMdl handle—Specifies the object to be checked out. This is applicable if the model has already been retrieved without checking out.
•  Aliased URL—Specifies the commonspace path of the object.
Use the function ProServerMultiobjectsCheckout() to check out and download a ProArray of objects to the workspace based on the configuration specifications of the workspace.
Note
Creo TOOLKIT functions do not support the AS_STORED configuration.
If you specify the value of the input argument checkout as PRO_B_TRUE in the above functions, the selected object is checked out. Otherwise, the object is downloaded without being checked out. The download action enables you to bring read-only copies of objects into your workspace. This allows you to examine the object without placing a lock on it.
If you pass NULL as the value of the input argument options in the above functions, then the default Creo Parametric checkout rules apply.
The function ProServercheckoutoptsAlloc() allocates a set of checkout options for the object. These options are as follows:
•  dependency—Specifies the dependency rule used while checking out dependents of the object selected for checkout. The function ProServercheckoutoptsDependencySet() sets the dependency rule for checkout. The types of dependencies specified by the enumerated type ProServerDependency are as follows:
  PRO_SERVER_DEPENDENCY_ALL—All the objects that are dependent on the selected object are downloaded, that is, they are added to the workspace.
  PRO_SERVER_DEPENDENCY_REQUIRED—All the objects that are required to successfully retrieve the selected object in the CAD application are downloaded, that is, they are added to workspace.
  PRO_SERVER_DEPENDENCY_NONE—None of the dependent objects from the selected object are downloaded, that is, they are not added to workspace.
•  include_option—Specifies the rule for including instances from the family table during checkout. The function ProServercheckoutoptsIncludeinstancesSet() sets the flag to include instances during checkout. The type of instances specified by the enumerated type ProServerInclude are as follows:
  PRO_SERVER_INCLUDE_ALL—All the instances of the selected object are checked out.
  PRO_SERVER_INCLUDE_SELECTED—The application selects the instance members from the family table to be included during checkout.
  PRO_SERVER_INCLUDE_NONE—No additional instances from the family table are added to the object list.
•  version—Specifies the version of the object that is checked out or downloaded to the workspace. If version is not set, the object is checked out according to the current workspace configuration. The function ProServercheckoutoptsVersionSet() sets the version of the object.
•  download—Specifies the checkout type as download or link. The value download specifies that the object content is downloaded and checked out, while link specifies that only the metadata is downloaded and checked out. Use the function ProServercheckoutoptsDownloadSet() to set this option.
•  readonly—Downloads the file without checking out the file. To use this option you must set the checkout argument of the function ProServerObjectsCheckout() as PRO_B_FALSE. Use the function ProServercheckoutoptsReadonlySet() to set the readonly flag to PRO_B_TRUE.
Use the function ProServercheckoutoptsFree() to free the memory of the checkout options.
The following truth table explains the dependencies of the different control factors in ProServerObjectsCheckout() and the effect of different combinations on the end result.
Argument checkout in ProServerObjects
Checkout()
ProServer
checkoutopts
DownloadSet()
ProServer
checkoutopts
ReadonlySet()
Result
PRO_B_TRUE
PRO_B_TRUE
NA
Object is checked out and its content is downloaded.
PRO_B_TRUE
PRO_B_FALSE
NA
Object is checked out but content is not downloaded.
PRO_B_FALSE
NA
PRO_B_TRUE
Object is downloaded without checkout and as read-only.
PRO_B_FALSE
NA
PRO_B_FALSE
This combination is invalid and is not supported.
The function ProServercheckoutoptsReadonlySet() can be used to download objects without checking them out. To download objects, you must set the checkout argument of the function ProServerObjectsCheckout() as PRO_B_FALSE before using ProServercheckoutoptsReadonlySet().
The following table describes the different values that can be specified for the check out options for the functions ProServercheckoutoptsReadonlySet() and ProServerObjectsCheckout(). It also describes the actions that can be performed on the downloaded or checked out object from the Creo Parametric user interface or using the Creo TOOLKIT applications.
The following table explains the dependencies of the different control factors on ProServercheckoutoptsReadonlySet():
Argument readonly in ProServercheckoutoptsReadonlySet()
Argument checkout in ProServerObjectsCheckout()
State of Object Content
Options Available in the Creo Parametric User Interface
Actions that can be Performed Using Creo TOOLKIT Applications
PRO_B_TRUE
PRO_B_FALSE
Downloaded but not checked out
The Conflicts dialog box allows you to perform one of the following operations on the object: check out, revise and check out, continue with modifications, or make the object read only.
Refer to the Creo Parametric Help for more information on resolving conflicts.
Check out the object and modify it
PRO_B_FALSE
PRO_B_FALSE
Checked out
The object can be modified.
The object can be modified.
PRO_B_TRUE
PRO_B_TRUE
Checked out
The object can be modified.
The object can be modified.
No option set
PRO_B_FALSE
Downloaded but not checked out
The Conflicts dialog box allows you to perform one of the following operations on the object: check out, revise and check out, continue with modifications, or make the object read only.
Check out the object and modify it
Undo Checkout
Function Introduced:
Use the function ProServerObjectsUndocheckout() to undo a checkout of the specified object. When you undo a checkout, the changes that you have made to the content and metadata of the object are discarded and the content, as stored in the server, is downloaded to the workspace. This function is applicable only for the model in the active Creo Parametric session.
Import and Export
Creo TOOLKIT provides you with the capability of transferring specified objects to and from a workspace. Import and export operations must take place in a session with no models.
Functions Introduced:
The function ProCurrentWorkspaceImport() imports specified objects from disk to the current workspace in a linked session of Creo Parametric.
The function ProCurrentWorkspaceExport() exports the specified objects from the current workspace to a location on disk in a linked session of Creo Parametric.
Both ProCurrentWorkspaceImport() and ProCurrentWorkspaceExport() allow you to specify a dependency criterion to process the following items:
•  All external dependencies
•  Only required dependencies
•  No external dependencies
All warnings, conflicts, or errors generated during import or export operations are logged in the proimpex.errors file created in the Creo Parametric working directory. Alternatively, you can obtain this information using the function ProCurrentWorkspaceImpexMessagesGet(). This function returns a ProArray of messages generated by the last call to ProCurrentWorkspaceImport() or ProCurrentWorkspaceExport().
The function ProWsimpexmessageDataGet() extracts the contents of the message generated by ProCurrentWorkspaceImport() or ProCurrentWorkspaceExport(). The message contains the following items:
•  type—Specifies the severity of the message in the form of the enumerated type ProWSImpexMessageType. The severity is one of the following types:
  PRO_WSIMPEX_MSG_INFO—Specifies an informational type of message.
  PRO_WSIMPEX_MSG_WARNING—Specifies a low severity problem that can be resolved according to the configured rules.
  PRO_WSIMPEX_MSG_CONFLICT—Specifies a conflict that can be overridden.
  PRO_WSIMPEX_MSG_ERROR—Specifies a conflict that cannot be overridden or a serious problem that prevents processing of an object.
•  object—Specifies the object name or the name of the object path described in the message.
•  description—Specifies the description of the problem or the message information.
•  resolution—Specifies the resolution applied to resolve a conflict that can be overridden. This is applicable when the message is of the type PRO_WSIMPEX_MSG_CONFLICT.
•  succeeded—Determines whether the resolution succeeded or not. This is applicable when the message is of the type PRO_WSIMPEX_MSG_CONFLICT.
Use the function ProWsimpexmessageArrayFree() to free the memory allocated to the array of messages returned by ProCurrentWorkspaceImpexMessagesGet().
The function ProWsexportSecondarycontentoptionSet() sets the ProBoolean option that controls the export of secondary contents. If this option is set to PRO_B_TRUE, secondary contents are exported along with the primary Creo Parametric model files. By default, it is PRO_B_TRUE.
File Copy
Creo TOOLKIT provides you with the capability of copying a file from the workspace or target folder to a location on the disk and vice-versa.
Functions Introduced:
Use the function ProFileCopyToWS() to copy a file from disk to the workspace. The file can optionally be added as secondary content to a given workspace file. If the viewable file is added as secondary content, a dependency is created between the Creo Parametric model and the viewable file.
Use the function ProFileCopyFromWS() to copy a file from the workspace to a location on disk.
Note
When importing or exporting Creo Parametric models, PTC recommends that you use ProCurrentWorkspaceImport() and ProCurrentWorkspaceExport(), respectively, to perform the operation. Functions that copy individual files do not traverse Creo Parametric model dependencies, and therefore do not copy a fully retrievable set of models at the same time.
Additionally, only the functions ProCurrentWorkspaceImport() and ProCurrentWorkspaceExport() provide full metadata exchange and support. That means ProCurrentWorkspaceImport() can communicate all the Creo Parametric designated parameters, dependencies, and family table information to a PDM system while ProCurrentWorkspaceExport() can update exported Creo Parametric data with PDM system changes to designated and system parameters, dependencies, and family table information. Hence PTC recommends the use of ProFileCopyToWS() and ProFileCopyFromWS() to process only non-Creo Parametric files.
The function ProFileCopyFromWSDocument() copies a primary or secondary file from the workspace to the specified location on disk. The input arguments are:
•  source_file—Specifies the path to the primary or secondary file. The path must be specified as wtws://<path to the file>.
Use the functions such as, ProFileMdlnameOpen() and ProFileMdlfiletypeOpen(), to get the path to the files.
•  document_name—Specifies the name of the primary file, which is associated with the secondary file specified in the argument source_file. Use the function ProFileselectionDocNameGet() to get the name of the primary file for a secondary file.
In the argument source_file, if a primary file is specified, then pass the argument document_name as NULL.
•  target_directory—Specifies a path on the local disk where the file must be copied.
The function ProFileselectionDocNameGet() returns the name of the primary file for the selected secondary file. The secondary files are selected in the file open functions. The functions such as, ProFileMdlnameOpen(), ProFileMdlfiletypeOpen() and so on, are used to open the dialog box where you can browse and select a secondary file. The function ProFileselectionDocNameGet() returns the name of the primary file for the last selected secondary file in the file open functions. If you select a primary file in these file open functions, then the function ProFileselectionDocNameGet() returns the error PRO_TK_E_NOT_FOUND.
The function ProDocumentFileContentsRead() reads the contents of the specified file. The file can be located on the local disk or Windchill. The function returns a ProArray of characters. Declare the output variable as char* and typecast it as ProArray* when you pass it to the API. Use the function ProArrayFree() to free the ProArray.
Note
The function ProDocumentFileContentsRead() is not supported for CAD models.
Server Object Status
Function Introduced:
The function ProServerObjectIsModified() verifies the current status of the object in the workspace as well as in the local workspace cache. The status of the object is as follows:
•  checkout_status—Specifies whether the object is checked out for modification. The value PRO_B_TRUE indicates that the specified object is checked out to the active workspace.
The value PRO_B_FALSE indicates one of the following statuses:
  The specified object is not checked out
  The specified object is only uploaded to the workspace, but was never checked in
  The specified object is only saved to the local workspace cache, but was never uploaded
•  modifiedInWS—Specifies whether the object has been modified in the workspace since checkout. The value of this argument is PRO_B_FALSE if the newly created object has not been uploaded.
•  modifiedLocally—Specifies whether the object has been modified in the local workspace cache. The value of this argument is PRO_B_TRUE if the object has been saved in the local workspace cache. The argument returns PRO_B_FALSE if the object has not been saved after modifying it in the local workspace cache.
Note
The function ProServerObjectStatusGet() is deprecated. Use the function ProServerObjectIsModified() instead.
Delete Objects
Function Introduced:
The function ProServerObjectsRemove() deletes the array of objects from the workspace. When passed with the mode_names array as NULL, this function removes all the objects in the active workspace.
Conflicts During Server Operations
Functions Introduced:
Conflict objects are provided to capture the error condition while performing the following server operations using the specified APIs:
Operation
API
Error Object
Checkin an object or workspace
ProServerObjectsCheckin
()
ProServerCheckinConflicts
Checkout an object
ProServerObjects
Checkout()
ProServerCheckoutConflicts
Undo checkout of an object
ProServerObjects
Undocheckout()
ProServerUndoCheckoutConflicts
Upload object
ProServerObjectsUpload()
ProServerUploadConflicts
Download object
ProServerObjects
Checkout()
(with download as PRO_B_TRUE)
ProServerCheckoutConflicts
Delete workspace
ProServerWorkspaceDelete()
ProServerDeleteConflicts
Remove object
ProServerObjectsRemove()
ProServerRemoveConflicts
These APIs return a common status PRO_TK_CHECKOUT_CONFLICT and a conflict object ProServerConflicts. The conflict object is used to get more details about the error condition.
Use the function ProServerConflictsDescriptionGet() to extract details of the error condition. This description is similar to the description displayed by the Creo Parametric HTML User Interface in the conflict report.
The function ProServerconflictsFree() frees the memory of the conflict structure returned by the functions.
Utility APIs
The functions specified in this section enable you to obtain the handle to the server objects to access them. The handle may be the Aliased URL or the model name of the http URL. These utilities enable the conversion of one type of handle to the other type.
Functions Introduced:
The function ProServerModelNameToAliasedURL() enables you to search for a server object by its name. Specify the complete file name of the object as the input, for example, test_part.prt. The function returns the aliased URL for a model on the server. For more information regarding the aliased URL, refer to the section Aliased URL. During the search operation, the workspace takes precedence over the shared space.
You can also use this function to search for files that are not in the Creo Parametric format. For example, my_text.txt, prodev.dat, intf_file.stp, and so on.
The function ProServerAliasedURLToModelName() returns the name of the object from the given aliased URL on the server.
The function ProServerAliaseURLToURL() converts an aliased URL to a standard URL to the objects on the server.
For example, wtws://my_alias/Wildfire/abcd.prt is converted to an appropriate URL on the server as <server.mycompany.com>/Windchill.
Sample Batch Workflow
A typical workflow using the Windchill APIs for an asynchronous non-graphical application is as follows:
1. Start a Creo Parametric session using the function ProEngineerConnectionStart().
2. Authenticate the browser using the function ProBrowserAuthenticate().
3. Register the server with the new workspace using the function ProServerRegister().
4. Activate the server using the function ProServerActivate().
5. Check out and retrieve the model from the vault URL using the function ProServerObjectsCheckout() followed by ProMdlnameRetrieve().
6. Modify the model according to the application logic.
7. Save the model to the workspace using the function ProMdlSave().
8. Check in the modified model back to the server using the function ProServerObjectsCheckin().
9. After processing all models, unregister from the server using the function ProServerUnregister().
10. Delete the workspace using ProServerWorkspaceDelete().
11. Stop Creo Parametric using the function ProEngineerEnd().