Learn NX-OPEN-MACROS with Real Code Examples
Updated Nov 27, 2025
Code Sample Descriptions
1
Hello World Journal VB.NET
Imports NXOpen
Module NXJournal
Sub Main()
Dim theSession As Session = Session.GetSession()
theSession.ListingWindow.Open()
theSession.ListingWindow.WriteLine("Hello World from NX Open!")
End Sub
End Module
A simple NX journal macro that prints 'Hello World' to the NX log file.
2
NX Open Python Example
import NXOpen
def main():
session = NXOpen.Session.GetSession()
workPart = session.Parts.Work
point1 = NXOpen.Point3d(0.0, 0.0, 0.0)
point2 = NXOpen.Point3d(100.0, 100.0, 0.0)
workPart.Curves.CreateLine(point1, point2)
if __name__ == "__main__":
main()
Python macro using NX Open API to create a simple line between two points.