NX

The NX block enables integrating Siemens NX models into pSeven workflows. The block maps model parameters 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, rebuilds the model, recalculates mass properties and sends resulting values to output ports. When the NX block executes, it connects to Siemens NX and consumes its license, so the block can run only on a host where NX is installed.

The NX block connects to the Siemens NX application in the following cases:

  • When you select a document file, in order to look for dependencies.
  • 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 during a workflow run.

Note

Sometimes the NX application fails to launch without manually specifying the path to NX libraries. By default, the block searches for such libraries automatically using the path from respective environment variables. Setting the path via Path to NX libraries option may help in cases when the block cannot find the path automatically or when there are multiple NX versions installed on the computer which runs pSeven and only one version is intended to be used.

The block supports Siemens NX part files (.prt) and assemblies. See section Working with Assemblies for more details.

Compatibility

To run, the NX block requires Siemens NX installed. The block was tested with NX 11.0 on Windows 7, Windows Server 2012, and Linux (CentOS 7), as well as with NX 12, NX 1847, and NX 1851 on Windows. Other versions of Siemens NX are also compatible, but were not actively tested.

Files Configuration

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

../_images/page_blocks_NX_files.png

Document File

To select an NX document, click b_browse in the Document file pane. Note that some of the possible file configurations are invalid:

  • The document cannot be a file with initial data.
  • The document cannot be a file of the temporary origin.

The block supports Siemens NX part files (.prt) and assemblies. See Working with Assemblies for details on working with documents that reference other files.

Export File

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

The block supports export to the native Siemens NX format (.prt), STEP (.stp), IGES (.igs), and Parasolid (.x_t) formats. The document file can be also saved as a ZIP assembly (.zip) — see Working with Assemblies for details.

Working with Assemblies

An Siemens NX assembly is a model which contains a number of components. Each component is stored in a separate .prt file. The assembly consists of these component .prt files and one main .prt file (the main assembly file). The main assembly file does not contain model geometry but references all other .prt files which are used in the assembly.

Working with assemblies requires the main assembly file and all the .prt files it references. To load an assembly to the NX block, you have to pack the main file with all its dependencies to a single ZIP archive (prepare a ZIP assembly). All files should be stored in the archive root, there must be no subfolders.

Since Siemens NX does not provide a native function to export an assembly as an archive, you will have to create the ZIP assembly using one of the methods suggested below.

Collect the assembly files manually

If you know the location of all part files on disk, you can simply copy them to a temporary location, then select all copied files and pack them into a ZIP archive.

Open the assembly in NX and re-save all files

If you prefer to collect the assembly files using NX, you can open the assembly in NX and re-save all its components to a temporary location, and then pack these files.

Select File ‣ Save ‣ Save As from the NX menu (Ctrl Shift A) and save a copy of the file to the location of your choice. Do this for every .prt file in the assembly. Once all files are collected to the same location, pack them into a ZIP archive.

Note that when you copy the files, there is no need to update references between them. When you load the ZIP assembly into the block, it will resolve all references automatically.

Clone the assembly

If you are working with large assemblies containing many part files, you can try to collect the assembly files by cloning the assembly.

  • In the Siemens NX menu, select Menu ‣ Assemblies ‣ Cloning ‣ Create Clone Assembly… to bring up the Clone Assembly dialog.
  • Click Add Assembly on the Main tab of the Clone Assembly dialog. In the file selection dialog, navigate to the main assembly file and click “OK”. The selected file will be shown in the table on the Main tab of the Clone Assembly dialog.
  • Switch to the Naming tab and specify the default output directory. This would be a temporary directory to store the cloned part files before they are compressed to the ZIP assembly. For convenience, it is recommended to create a new empty directory and use it as the default output directory for cloning. Note that this directory is not used by the NX block — it needs only the ZIP archive you are going to create.
  • The Clone Naming selector on the Naming tab has two modes: “User name” (default) and “Name rule”. When “User Name” is selected, NX will request a name for every part file when re-saving it to the default output directory. To avoid typing a name for each file, you can define a naming rule:
    • Switch to the “Name Rule” mode on the Naming tab.
    • Click the “Define Naming Rule” button to bring up the Naming Rule dialog. In this dialog you can define any rule which keeps original file names. For example, select the “Add Suffix” naming rule type and input an underscore _ in the Add/Replace/Rename String field. When NX clones the files, it will add the _ character to the end of each original filename (old NX versions allowed an empty suffix, but this is prohibited since NX 11.0).
  • After adding the assembly, specifying the output directory and naming rules, switch to the Main tab again and click “Execute” at the bottom of the Clone Assembly dialog. NX will copy the part files to the output directory and bring up the Information window with the assembly cloning log. Check the log for errors; if there are no error messages, close the Information window and the Clone Assembly dialog. If the log contains errors, verify that your settings done in the previous steps are correct.
  • Open the default output directory, which now contains copies of all assembly files. Verify that the files are named according to the naming rule you have specified earlier. Pack all files to a ZIP archive and move the .zip file to your working directory (for example, your pSeven project). Now you can remove the output directory which you created to store the cloned part files: the NX block will not use this directory when loading the assembly.

To use a ZIP assembly as a document file, click b_browse in the Document file pane. Specify the project file origin and set the path to the .zip file. After selecting the assembly, click b_build_tree in the Document tree pane to build the parameter tree (see Document Tree for details on model structure). The block will find dependencies between all part files in the assembly and collect the parameters to build the model tree.

You can also export any model to a ZIP assembly: click b_browse in the Export file pane and select the ZIP assembly (.zip) export format. A ZIP assembly exported from the block will contain 1 additional file named top_model. It is a simple text file, which specifies the name of the main assembly file.

If a ZIP assembly contains the top_model file which points directly to the main assembly file, the NX block builds the model tree slightly faster, because it does not need to collect information about model dependencies from all .prt files. When you create a ZIP assembly, you can manually add a top_model file to the archive for convenience:

  • After collecting all assembly files, create a new text file named top_model (without extension) in the same directory where you have placed the .prt files.
  • Open this new file in a text editor. Copy the name of the main assembly file and paste it to the top_model file. The file should contain only one line.
  • Save the top_model file and pack it with the .prt files.

Document Tree

After you select a document, click b_build_tree in the Document tree pane to build the parameter 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:

  • Dimensions — for example, extrude, revolve, blend.
  • Expressions — such as width, length, height and other arithmetic or conditional formulas that define some characteristic of feature.
  • Attributes — for example, material assignments, tolerance, and so on.
  • Mass properties — such as the model mass, volume, surface area, and other.

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

Note that the NX block actually connects to Siemens NX when you build the tree, so this configuration step requires Siemens NX installed.

../_images/page_blocks_NX_document_tree.png

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 there shows which ports (input, output or both) are created for the corresponding tree node.

Structure

The NX block allows to extract dimensions from parts and assemblies (including contained subassemblies and parts), mass properties of any component in different configurations, expressions and part attributes. The document tree structure is as follows:

  • dimensions
    • part or assembly name
      • feature name
        • dimension name
      • … more features
    • … more parts and assemblies
  • expressions
    • part or assembly name
      • expression name
    • … more parts and assemblies
  • attributes
    • part or assembly name
      • attribute name
    • … more parts and assemblies
  • 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
    • … more parts and assemblies

Node Properties

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

Type

The majority of dimensions and mass properties are of the RealScalar type, but some dimensions are IntScalar. Expressions and attributes can be of the following type: RealScalar, IntScalar, StringScalar, BoolScalar. When you select a node in the document tree, it is mapped to a port of this type.

Value

Dimensional values that NX reads from and writes to ports are in units of the document units properties. They can be millimeters or inches. You can find out the units of expressions or attributes by opening the model in Siemens NX.

Read-only

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.

Read-only nodes are:

  • mass properties,
  • all in read-only files

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

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

The block can also raise this error at the workflow run-time.

Options

Error handling behavior

The action to perform if the block encounters an error.

Value:stop workflow, output defaults and signal,``output signal only``
Default: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 False (the failure signal). Note that the block automatically assigns values to output ports that are created when you select document tree nodes. These values are:

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

Export/STEP

STEP version number for exported documents.

Value:203 or 214
Default:203

Specifies the STEP version to use when exporting files to the STEP (.stp) format.

NX operation timeout

Maximum time that the block can wait for a response from NX process.

Value:non-negative integer
Default:300

The block launches NX process at each step during the workflow run as well as when you select the document file or build the document tree. Zero value means no limit. If another value is set, the block raises an error when the timeout is exceeded. This error is handled according to the Error handling behavior setting.

NX wait timeout

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

Value:non-negative integer
Default:300

Several NX blocks in a workflow can start simultaneously — this is typically the case when there is a parallelized Composite block containing an NX block. In this case, only one of the NX blocks can connect to the NX application at a time (this is a NX limitation). Other blocks have to wait until NX 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 an NX block with zero timeout starts while there is another NX 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.

Path to NX libraries

Absolute path to Siemens NX libraries.

Value:string
Default:empty

The path to the directory which contains libufun.dll on Windows or libufun.so on Linux. If this option is set to empty value, the NX block searches for NX libraries using the path from environment variable UGII_BASE_DIR on Windows and LD_LIBRARY_PATH on Linux.

If Siemens NX is installed to the default folder on Windows, the path is:

  • For Siemens NX 10: C:\Program Files\Siemens\NX 10.0\UGII.
  • For Siemens NX 11: C:\Program Files\Siemens\NX 11.0\NXBIN.

Trace NX API calls

If enabled, the block will output all NX API calls to the debug log.

Value:True or False
Default:False

Known Issues

This section describes certain issues related to using the NX block.

General

  • Sometimes error messages from the NX block contain truncated text. This text is in fact an error message received by pSeven from the NX application. In some cases Siemens NX limits the length of message text to 132 characters and discards the rest, so unfortunately the truncated text cannot be recovered. In such cases, it is recommended to look up the error in the NX documentation by searching for the available part of the message.

Windows

  • Using non-English names of document parameters is not recommended.

    The support for non-English parameter names in Siemens NX for Windows is known to depend on the format selected in regional settings. Siemens NX assumes that the document language follows the selected format; if they do not match, the NX block may be unable to build the document tree because some parameter names are incorrectly interpreted by Siemens NX. This case can be identified by an error message like this:

    An error occurred while inspecting parameter '#####'. The specified
    expression variable does not exist.
    

    If this error appears, run control intl.cpl to open the Windows Control Panel applet for regional settings. Verify that the format selected on the Formats tab matches the language of parameter names in the document. If the document contains both English and non-English parameter names, set the format to match the latter. Note that if the document uses two or more languages besides English, correct configuration is generally impossible.

Linux

  • Non-English characters in parameter names are not supported.

    Parameter names containing non-ANSI characters are not supported in the Linux version of Siemens NX. Due to this it is not recommended to use non-English characters in parameter names in the document that is loaded by the NX block under Linux. NX will be unable to build the document tree, resulting in an error message like this:

    An error occurred while building document tree. UTF8 data detected when
    locale data was expected.
    

    If this error appears, you will have to rename parameters using only English characters in order to load the document correctly with the NX block.