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+ 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+ models, PTC recommends that you use ProCurrentWorkspaceImport() and ProCurrentWorkspaceExport(), respectively, to perform the operation. Functions that copy individual files do not traverse Creo+ model dependencies, and therefore do not copy a fully retrievable set of models at the same time.
|
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>.
• 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.