NX

Tag: Integration

This integration type block allows to apply optimization and other data mining techniques to models created in Siemens NX. The block maps model parameters to input and output ports, so they can be changed in run-time by receiving data from other blocks. On each change of input parameters, the block starts a new Siemens NX process to calculate characteristics which are then sent to block output ports.

Compatibility

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

Files Configuration

Document and export files configuration uses the generic file configuration component. Refer to the File block documentation when you need specific details.

../_images/page_blocks_NX_files.png

Document File

To select a 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 of the project or sandbox origin with initial data.
  • The document cannot be a file of the temporary origin.

The block supports Siemens NX part files (.prt) and ZIP archives (.zip). If the document references other files, use Send to compressed(zipped) folder in Windows Explorer context menu or any other archive tool to provide a .zip file with all dependencies of the model.

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 (.step), IGES (.igs), and Parasolid (.x_t) formats. The document file can also be saved as a ZIP archive.

Document Tree

After a document is selected, you can click b_build_tree on the Document Tree pane to build the parameter tree — get the list of dimensions, attributes, expressions and mass properties from the document.

Note that the NX block actually launches 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. It can be Millimeters or Inches. Units of expressions or attributes you can find out 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. Other, 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 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 (.step) 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 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:

NX 10: C:\Program Files\Siemens\NX 10.0\UGII

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.