What Is NX Open? (Explained with examples)


I have been working with Siemens NX for over ten years, and only recently, I discovered the power of Siemens NX Open.

Siemens NX Open can feel very intimidating at first. However, if you are a programmer, or would like to take advantage of an easier workflow within NX by using programming, then Siemens NX Open is the solution for you. 

In a nutshell, NX Open is an API (Application Programming Interface) that allows you to write your custom programs within NX, which can help to speed up your workflow or help you to complete repetitive tasks quickly. 

I am a CAD expert with enough programming knowledge to help me to complete basic tasks. I want to share the basics of NX Open so you can start exploring this fantastic and underused area of NX.

In this article, I will cover:

  • What is NX Open?
  • What is NX Open used for?
  • What programming languages can be used in NX Open?
  • How do I get started with NX Open?
  • How can I create a basic program in NX Open? 
  • Is NX Open free?

What Is NX Open?

NX Open is an open programming application from Siemens that allows developers to customise and extend the capabilities of NX by creating custom applications to run within NX. [source]

It is a robust set of C and C++ APIs, including the NX Journaling API and NX Open UI API, that enable users to create custom applications that can be integrated directly with NX.

For regular everyday CAD users who can programme, this opens up the possibility of improving your workflow by:

  • Automating repetitive tasks.
  • Integrating 3rd party applications for ease of use
  • Customising the NX interface. 

NX Open provides a wide range of features and benefits that are valuable to developers, including:

  • Easy integration with existing CAD/CAM systems. It allows developers to quickly add custom functionality beyond what’s available in the standard NX UI.
  • Reduced development time and cost for complex applications. Developers can quickly use existing NX components and features to create robust applications.
  • Improved end-user experience. Developers can enable users to access custom functionality within the standard NX UI, improving user efficiency and satisfaction.

What Is NX Open Used For?

NX Open is used for developing custom applications that enhance and extend the abilities of NX.

With its C and C++ APIs, such as the NX Journaling API and NX Open UI API, developers can quickly add specific features unavailable in the standard NX UI. This makes it easier to create powerful, user-friendly applications that can be integrated with NX.

NX Open is used for various purposes, including creating custom GUI components and macros, automating repetitive tasks, integrating legacy data into NX, and adding more advanced features such as simulation or validation capabilities. 

The possibilities are endless when working with NX Open. (Assuming you are a talented programmer)

What Programming Languages Can Be Used In NX Open?

NX Open is designed to be used with a variety of programming languages. It supports the following programming languages: [source]

  • C++, 
  • C#
  • Java
  • Python
  • Visual Basic

To choose your specific language, navigate to the User Interface Preferences. This is under

  1. Menu > Preferences > User Preferences
  2. Under “Tools” on the left side of the screen, select “Journal” 
  3. On the right, you can then select your journal language. 

With these languages shown, users can create custom applications integrated directly with NX. 

By leveraging the power of NX Open, developers can create effective applications that maximise user efficiency and satisfaction. 

How Can I Create A Basic Programme In NX Open? 

When starting with all programming languages, it helps to create a simple “Hello World” program.

The following example is written in Visual Basic and is taken from the NX tutorials.

1 – To start, ensure you tell NX that you are writing in Visual Basic. To do this, go to:

  • >Menu >Preferences >User Interface >Tools Journal 
  • Under “Tools” on the left-hand side, you will be given the option to select your programming language.
  • For this example, select “Visual Basic”.

2 – Next, you need to open the NX Journal.

This is the text editor into which code is written. To do this, ensure that the Developer tool is visible on the tab of NX. If not, right-click on the top tab of the screen and select Developer.

3 – To open a new “journal”, which is the text editor into which you write your code, select “Edit” under the Developer tools. 

The Journal editor will open, into which you can copy and paste the following code:

Imports System
Imports NXOpen

Module NXOpensample

   Sub Main ()
    Dim theSession = Session.GetSession ()
    Guide.InfoWriteLine("Hello, World!")
   End Sub

End Module

4 – Next, select “PLAY” from the top menu of the journal editor to run your code.

This will result in your programming running, and for this example, an information window pops up with the words, “Hello World!”

NX Open Python Tutorial

Of course, you can get as advanced as you need to with various languages in Siemens NX.

One of the most common requests for CAD users is to create geometry, simple shapes that can be controlled from a programme.

The following is an NXOpen Python Tutorial. Full credit goes to Foad S. Farimani on GitHub for sharing this code. Please visit him on GiHUB for more tutorials here. 

1 – To start, we must set our programming language to Python.

  • Go to> File, Preferences, User Interface > Tools > Journal. 
  • You can then select Python as your Journal language. 

2 – Next, you need to open the Journal editor and paste the following code: [source]

# ex0003.py

import NXOpen

import NXOpen.Features

def cylinder_builder(session=NXOpen.Session.GetSession(), work_part=NXOpen.Session.GetSession().Parts.Work, height=100, diameter=50):

    mark_id = session.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Cylinder")

    cylinder = work_part.Features.CreateCylinderBuilder(NXOpen.Features.Feature.Null)

    cylinder.Diameter.SetFormula(str(diameter))

    cylinder.Height.SetFormula(str(height))

    nx_object = cylinder.Commit()

    return nx_object, mark_id

def main(): 

    cylinder_builder(height=40, diameter=100)

if __name__ == '__main__':

    main()

3 – To run the code, hit “Play”.

Now a cylinder will be created that you can edit. 

You can manually edit this cylinder as usual by editing the dimensions from the model history, or you can update the code. 

This is a straightforward part, but imagine if you have repetitive tasks you must do daily in your CAD job. Using programming to automate your workflow has great potential to speed up your work or remove the boredom from completing repetitive tasks.

Is NX Open Free?

NX Open is not a free application but is available as part of the Siemens NX suite. 

To check if you have NXOpen as part of your default application, open the Developer tab from your top ribbon bar and try to edit the journal and create a program.

With most features in NX, once you start using them, you will get a warning message if you do not have the license.

If you get a license error, you will need to upgrade your license. The cost of this will vary; therefore, you must speak to your local Siemens NX sales representative for more information.

Final Thoughts

Siemens NX is a compelling CAD package, and the extra feature to programme within the CAD/CAM package is very powerful.

The downside is that you need to be a proficient programmer to achieve good results, so NX Open is not great for beginners. However, you can automate repetitive tasks and improve your workflow with some practice and the right skills.

Like all things programming related, you are limited by how well you can programme, so if you are a proficient programmer, it is worth checking NX Open to see what cool features you can implement. 

Engineer Your Sound

We love all things audio, from speaker design, acoustics to digital signal processing. If it makes noise, we are passionate about it.

Recent Posts