# Creo¶

## Introduction¶

The Creo block enables integrating Creo models into your workflows. The block maps model properties to its input and output ports, so that they can be changed and read by pSeven. When the block runs, it receives values to input ports, changes model dimensions, rebuilds the model, recalculates mass properties, and sends resulting values to output ports.

The Creo block launches the PTC Creo application in the following cases:

• When you select a document file, in order to look for document references.
• When you open the selected document from the block configuration dialog.
• When you get information from the document (build the document tree).
• When actually rebuilding the model or running the study (when the workflow runs).

The block also allows exporting models from an assembly and exporting standard and named views as images. Note that the Creo block can run only on a Windows host, but it is possible to edit its configuration under Linux.

## Compatibility¶

To run, the Creo block requires PTC Creo installed. The block was tested with Creo 2.0 M240, Creo 3.0 M080, Creo 3.0 M130, Creo 4.0 M010, and Creo 4.0 M030; other versions are also compatible, but were not actively tested.

## Setup¶

The host to run the Creo block must have PTC Creo installed with Visual Basic API support. In PTC Creo setup, this component is found under API Toolkits. After PTC Creo is installed, you must register VB API COM server by running vb_api_register.bat.

• For PTC Creo 2.0, the path to the batch file is: creo_loadpoint\Parametric\bin\vb_api_register.bat,
• For PTC Creo 3.0 or newer, the location is: creo_loadpoint\datecode\Parametric\bin\vb_api_register.bat,

where creo_loadpoint is the PTC Creo installation directory, datecode is the release’s datecode, for example: C:\Program Files\PTC\Creo 3.0\M130\Parametric\bin\vb_api_register.bat.

The file must be executed using Run as administrator option. If you cannot find the file, it probably means that PTC Creo is installed without Visual Basic API support.

The block finds PTC Creo using the PRO_COMM_MSG_EXE environment variable which should be set to the absolute path to pro_comm_msg.exe.

• For PTC Creo 2.0, the path to the executable is: creo_loadpoint\Common Files\datecode\machine_type\obj\pro_comm_msg.exe,
• For PTC Creo 3.0 or newer, the location is: creo_loadpoint\datecode\Common Files\machine_type\obj\pro_comm_msg.exe,

where machine_type is “i486_nt” for 32-bit or “x86e_win64” for 64-bit Creo, for example: C:\Program Files\PTC\Creo 3.0\M130\Common Files\x86e_win64\obj\pro_comm_msg.exe.

Alternatively, you can configure the Creo process communication executable option which overrides PRO_COMM_MSG_EXE.

### Switching Creo Versions¶

If you have already registered the server for another PTC Creo version, you must first unregister it using vb_api_unregister.bat which resides in the same directory as vb_api_register.bat. You must execute the file as an administrator. Follow these steps to switch pSeven to another Creo version:

1. Unregister the server for the previous version you have used by running vb_api_unregister.bat.
2. Register the server for the version you want to use by running vb_api_register.bat.
3. Ensure that Creo process communication executable option (or PRO_COMM_MSG_EXE environment variable, if the option is not set) points to the pro_comm_msg.exe executable which belongs to the version you want to use.

Note that step one and two require administrator rights. These steps can be skipped only if you run pSeven itself as an administrator.

For example, you had used the block with PTC Creo 2.0 M240 and then installed PTC Creo 3.0 M130. For pSeven, to use the new Creo version, you need:

1. Run C:\Program Files\PTC\Creo 2.0\Parametric\bin\vb_api_unregister.bat as administrator,
2. Run C:\Program Files\PTC\Creo 3.0\M130\Parametric\bin\vb_api_register.bat as administrator,
3. Set Creo process communication executable option to C:\Program Files\PTC\Creo 3.0\M130\Common Files\x86e_win64\obj\pro_comm_msg.exe.

### Creo Simulate Extension¶

The Creo block does not support direct integration with the standalone version of Creo Simulate, but you can still run simulations if Creo Simulate is installed as an extension to Creo Parametric. However, this extension is known to cause certain issues with the block. If you use it, verify the following:

• The Visible option in block configuration is default (True) so the block launches Creo in a foreground window. See Creo Simulate Extension and Creo Visibility for details.

• The path to your temporary files directory contains only alphanumeric and underscore characters. To check the path:

• Open the Windows Explorer.
• Input %temp% in the address bar and hit Enter.
• See the path which is displayed in the address bar.

See Creo Simulate Extension and User Profile for details and workarounds.

## Files Configuration¶

Document and export files in the Creo block are configured using the common Configure file dialog. Refer to the File block documentation when you need specific details.

### Document File¶

To select a Creo document, click on the Document file pane. Note that some of the possible file configurations are invalid:

• The document cannot be a file of the project, port or sandbox origin with initial data.
• The document cannot be a file of the temporary origin.

The block supports Creo parts (.prt), assemblies (.asm) and ZIP archives (.zip). If the document references other files, use File -> Save as -> Save a copy -> Type: Zip File (.zip) in Creo Parametric to make an archive and select it as document.

### Export File¶

To select an export file, click on the Export file pane. Note that the export file cannot contain initial data.

The block supports export to the native PTC Creo formats (.prt, .asm), STEP (.stp), IGES (.igs), STL (.stl), ACIS (.sat), Parasolid (.x_t) and VDA (.vda) formats. The document file can also be saved as a ZIP archive which will contain all reference files that are included in your assembly. You can also export any model from assembly. Note that in this case the name of the export file should be the same as the model’s name.

## Document Tree¶

After you select a document, click in the Document tree pane to build the tree. The block will parse model structure in the document file and select features which can be changed or read in the workflow. The features which the block adds to its tree are:

• Model dimensions — for example, curves, protrusions, rounds, cuts.
• Parameters — for example, model description, model name, material info.
• Mass properties — such as the model mass, volume, surface area, and other.
• Model views — front, top, bottom, and other.

Collected features are grouped as shown in the tree in the Document tree pane. Note that the structure of this tree partially resembles the Creo model tree, but it can skip some nodes (usually nonparametric) which cannot be used in a workflow. For a full description of the tree structure created by the block, see section Structure.

In the tree, you can select certain nodes to map them to input and output ports. When you select a node, a new corresponding variable appears in the Variables list. The Ports column in this list shows which ports (input, output, or both) are created for the corresponding tree node.

The nodes in the views list are special. They allow exporting model standard and named views as images in .jpg format. When you map such a node, an output File port is created. If you set up monitoring for this port, the images will be saved in the project database during the workflow run, so you can display them with Page viewer on the Analyze screen.

Note

Views can be exported only if the Visible option value is True (see Visible option for details).

### Structure¶

The Creo block can work with dimensions, parameters, mass properties, and views of parts and assemblies (including contained subassemblies and parts). The document tree structure is as follows:

• Dimensions — lists all features and features’ dimensions.
• part or assembly name
• feature name
• dimension
• dimension
• Parameters — lists all user-defined parameters.
• part or assembly name
• parameter
• parameter
• Mass properties — lists all mass properties.
• part or assembly name
• mass
• volume
• area
• center of mass X
• center of mass Y
• center of mass Z
• moment of inertia XX
• moment of inertia XY
• moment of inertia YY
• moment of inertia YZ
• moment of inertia ZX
• moment of inertia ZZ
• Views — lists all standard and user-created model views.
• part or assembly name
• view name
• view name

### Node Properties¶

Hovering a document tree node shows a tooltip with node’s properties: type, value and read-only state.

Type

All dimensions and mass properties are of the RealScalar type. Parameters can be of the following type: StringScalar, IntScalar, BoolScalar, and RealScalar. Views are of the File type. When you select a node in the document tree, it is mapped to a port of this type.

Value

Dimensional values that Creo reads from and writes to ports are in SI units regardless of the document units.

If you select a read-only node in the document tree, it is always mapped to an output port. Writeable nodes are mapped to input ports by default.

• dimensions (if they belong to a read-only feature),
• mass properties,
• views.

Note that if you map a read-only node (for example, “mass”) to an input port, a validation warning will appear on the Issues pane:

"mass" is read-only but mapped to input port.


## Options¶

Creo process communication executable

Path to Creo process communication executable pro_comm_msg.exe. Overrides PRO_COMM_MSG_EXE environment variable.

Value: path string empty
Creo wait timeout

The time in seconds to wait for the PTC Creo application to become available in case it is currently used by another Creo block.

Value: non-negative integer 300

Several Creo blocks in a workflow can start simultaneously — this is typically the case when there is a Composite block (with parallel execution enabled) containing Creo blocks. In this case, only one of the Creo blocks can connect to the Creo application at a time (this is a PTC Creo limitation). Other blocks have to wait until PTC Creo becomes available, and will do so until the timeout is exceeded.

Exceeding the timeout raises an error which always stops the workflow. That is, the timeout error is never suppressed regardless of the Error handling behavior setting. The workflow is not terminated immediately: all blocks that are currently running continue their execution, and the workflow stops after they finish (soft stop). Note that setting the timeout to 0 will always trigger workflow stop, if a Creo block with zero timeout starts while there is another Creo block running. The running block will be allowed to finish execution in this case, and the workflow will be stopped by the timeout error from the second block.

Error handling behavior

The action to perform, if the block encounters an error.

Value: stop workflow, output defaults and signal, output signal only stop workflow

When set to stop workflow, the block simply reports an error and the workflow interrupts.

If set to output defaults and signal, the block suppresses the error. In this case, output ports send values assigned to them (the defaults), and the done port outputs a False value (the signal). Note that the block automatically assigns values to output ports that are created when you select document tree nodes. The values are:

The output signal only behavior means to output only the False value to done; nothing is output to other ports.

Max steps

The maximum number of block startups that can use the same Creo application instance.

Value: positive integer 50

New in version 6.10.

Normally, the PTC Creo application started by the block is not closed after the block finishes (that is, until the workflow stops). Subsequent startups of the block use the same application instance to save time. This option sets the number of block startups that are allowed to use the same running Creo instance. When the limit is reached, Creo is restarted.

Note that if a Creo document file is changed by an external application during the workflow run, we recommend you to set this option to 1. In this case, the block keeps PTC Creo opened only during the block startups and does not prevent other applications from changing the document file.

This option works only when Creo is started by the block. If the block connects to an instance of Creo that you have started manually, this instance is never restarted.

Trace Creo API calls

If enabled, the block will output all Creo API calls to the workflow run log on the “Debug” level (use the log level selector to switch the console output level from the default “Info” to “Debug”).

Value: True or False False

New in version 6.11.

Visible

Show the PTC Creo application window during run-time calculations.

Value: Boolean True (show the window)

If the value is False, Creo will be run in the background without showing a window. This option affects only the run-time. When you configure the block (build a document tree), Creo is always launched in the background without showing a window.

Attention

If you have Creo Parametric with the Creo Simulate extension installed, this option must be left default (Creo window must be visible). See Creo Simulate Extension and Creo Visibility for details.

## Troubleshooting¶

### Use SI units¶

If you received “Failed to regenerate the model” error and are sure that the model should regenerate without any failures with the given values of dimensions and parameters, check that dimensional values that you pass to the block use SI units: meters for lengths and radians for angles. To check this, look at the values in the document tree: the tooltip shows the value in SI with its units (or without units in case of dimensionless value).

### Terminate processes¶

If a message box saying that “An error occurred while opening Creo Parametric application”, “An error occurred while opening Creo document”, or similar appears when you configure a file, build a tree, open a document or run the workflow and the error persists after you repeat the action, you may need to close the Creo Parametric application and terminate all its auxiliary processes. We recommend you to end the following processes:

• parametric.exe (Creo Parametric main process),
• pfclscom.exe (VB API COM server),
• xtop.exe (for this and other processes description, refer to the PTC support portal),
• pro_comm_msg.exe,
• nmsd.exe,
• creoagent.exe,
• mcp_applet_async.exe,

using the Task manager, then proceed with the block. Do not forget to save all your unsaved work in Creo Parametric before terminating.

The same recipe may also help, if the action lasts for an unreasonable period of time, but take into account that some actions (for example, building the tree for a complex assembly) may require significant time (more than 10 minutes).

There are known problems with external programs interacting with Creo Parametric when PTC Mathcad is installed. You may face them even if you do not use PTC Mathcad. PTC Mathcad Express which is installed by default with some Creo Parametric versions may also cause problems, such as pSeven unresponsiveness, error messages, and performance degradation. In case of a freeze, try terminating mcp_applet_async.exe process from the Task manager. To avoid such issues:

• Rename mcp_applet_async.exe, which resides in the same directory as pro_comm_msg.exe (see Setup section), to any other name, or

### Set timeout¶

The environment variable RPC_TIMEOUT sets the maximum time limit for the Creo API call to execute. The variable sets the time in seconds. The default value is 2000 seconds. Exceeding the timeout raises “Communication error between the block and Creo Parametric”. This is an internal variable of Creo API and in most cases you are not required to set it manually. However, there are two situations, when you may consider tuning it:

• Creo Parametric allows running analysis from Creo Simulate together with the model regeneration. If regeneration takes a long time, increase the value of RPC_TIMEOUT.
• Due to the bugs in some Creo Parametric versions, VB API COM server may rarely hang up when the block tries to close a Creo document or application. As it happens in the end of the block’s step or when the workflow finishes, it does not affect the results. The block waits for the given time, restarts VB API COM server and proceeds with the work. If you have encountered such a problem, consider decreasing the value of RPC_TIMEOUT.

## Known Issues¶

This section describes known issues related to using the Creo block and their possible workarounds.

### Creo Simulate Extension and Creo Visibility¶

The Creo Simulate extension is known to cause a hard to identify issue where the block produces incorrect output because Creo does not update feature values properly. However this issue appears only if Creo runs in the background mode without showing a window. Due to this, if you use the Creo block with Creo Simulate, you should keep the Visible option default (True) to always show the Creo window.

Note that the block does not support direct integration with the standalone version of Creo Simulate. This issue is related only to the Creo Simulate extension.

### Creo Simulate Extension and User Profile¶

When you use the block to run simulations in Creo with the Creo Simulate extension installed, it sometimes fails to start the Creo application. Often this happens if your user name contains characters other than alphanumeric and underscore (for example, a dot . or a whitespace). The problem is caused by the Creo Simulate postprocessor: it works only with file paths and model names which are a combination of alphanumeric and underscore characters (see PTC Creo Help Center, About File Names in Creo Simulate). When the Creo block starts, it creates a temporary model file in its sandbox directory, then launches Creo with this file as input. pSeven places block sandboxes inside your directory for temporary files, which is %USERPROFILE%\AppData\Local\Temp by default. The USERPROFILE environment variable usually points to C:\Users\<your username>, although this is not guaranteed since your system administrator can change the location for user profiles. So, the path to the temporary model file becomes %USERPROFILE%\AppData\Local\Temp\<session id>\<sandbox id>\<model file>, and USERPROFILE contains a character not supported by Creo Simulate in paths, it causes an error.

Sandbox
More details on block sandboxes in pSeven.

The workaround is to relocate the block’s sandbox so its path does not contain characters which Creo Simulate cannot handle. There are a few possible solutions:

• Change the sandbox path in the Creo block configuration. This solution is recommended.
• Change the location of your temporary files directory. Note that the temporary files directory is a system directory which is also used by other programs. Resort to this solution only if you cannot use other workarounds for some reason.

Note that changing your user name does not solve the problem, because it does not change your user profile and temporary files directory paths (only the display name changes).

Change the sandbox path

To change the Creo block sandbox:

• Open the block’s configuration dialog and switch to the Sandbox tab.
• Input a path in the Sandbox field. Leave other settings on this tab default. The path can be absolute, which places the sandbox to the specified location on disk, or relative, which places the sandbox inside your project directory.
• If you choose an absolute path — for example, D:\Temp\creo_sandbox:
• Ensure that the path you input contains only alphanumeric (A to Z, 0 to 9) and underscore (_) characters.
• Ensure that your account has write access to the specified directory. For example, try creating this directory in Windows Explorer first.
• If you choose a relative path — for example, .\sandboxes\creo:
• Ensure that the path you input contains only alphanumeric (A to Z, 0 to 9) and underscore (_) characters.
• The sandbox will be placed inside your project directory, so you should also ensure that the path to your project contains only alphanumeric and underscore characters. Note that the default location for pSeven projects is your Documents directory, which is usually placed inside your user profile directory. So, if your user name contains characters which Creo Simulate does not support in paths, you also need to move your project to another location.

Changing the sandbox path is the recommended solution since it affects the Creo block only.

Change the temporary files directory

To change the location of your directory for temporary files, you will have to edit the TEMP and TMP environment variables.

• Using command line:
• Open the Windows Run dialog from the Start menu or using the Win R hotkey.
• Run rundll32 sysdm.cpl,EditEnvironmentVariables to open the Environment Variables dialog.
• Using the Control Panel:
• In Windows 7 Control Panel, select: User Accounts and Family Safety — User Accounts.
• In Windows 8 or later version, select: User Accounts — User Accounts.
• In the task list on the left click “Change my environment variables”.
• In the Environment Variables dialog, edit the values of the TEMP and TMP variables so they contain only alphanumeric (A to Z, 0 to 9) and underscore (_) characters. Note that the values should be the same (use the same path).
• Ensure that your account has write access to the directory you have specified. For example, try creating this directory in Windows Explorer first.
• Your changes will be applied to the next user session only. Log off from Windows and log back on so they take effect. Note that if you make changes on a remote Windows computer using Remote Desktop, you have to select the “Log off” option, not “Disconnect”. The latter only closes the Remote Desktop connection but does not exit your user session. If you select “Disconnect”, changes in environment variables will not be applied the next time you connect to the remote computer.