Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IRstuff on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NX Journal

graberic

Computer
Jun 4, 2025
6
Hello,
New to creating an NX Journal. Prob something dumb here but I cannot get past this. This should rotate all the step files in a folder by a matrix.
I get a dreaded C+ error.
Line 1 : A namespace cannot directly contain members such as fields or methods
 

Attachments

  • Rotate.txt
    7 KB · Views: 9
Replies continue below

Recommended for you

What version of NX are you using? Your code references some properties on the Step214Importer object that I don't think exist.
 
Your AI helper is hallucinating properties and methods that don't exist in the NXOpen API.
 
yea that makes sense. So much for ChatGPT.
I tried the lazy way out.
Thanks for the confirmation.
 
Yup, the NXOpen API is too "exotic" for AI for it to generate code reliably (not enough questions about it on Stack Overflow I guess). You can get a good structure, but the actual methods that do the stuff you want are just electric sheep.

Also, the code is in Basic, if you're getting a C# error from it, that looks like an AI prompt problem. ;-)
 
I'm actually ok with VB. The Journal editor wants to make it a .cs file, which it treats entirely different, like C# I guess.
I can rename the file to .vb and I get a host of different errors.
It looks like I am going to need find the NXOpen API documentation and actually read it.
Does anyone have a link to the API methods?
 
You can select the preferred Journal language in Customer Defaults (permanent) and also in user interface preferences (Ctrl+2 - tools - journal, temporarily).

NXOpen documentation is available on the Siemens Support Center site ( https://support.sw.siemens.com/en-US/ ) and needs an access token.

There used to be an NXOpen reference available offline when you install the "NX Programming tools" component, but nowadays it has wandered off to the "NX Help" module, afaik.

The "Programming tools" module does add the UGOPEN folder where you can find and check out sample applications in all supported programming languages.

You can also just record a Journal while doing something manually in NX, and it will spit out (mostly) working code you can then analyse and modify.
 
Thanks everyone.
I guess when all else fails you can read the instructions...
 
The overall structure isn't bad, it just needs some tweaks. I'd be glad to help get something running when I find some time...
 

Part and Inventory Search

Sponsor