An NXOpen helper package to reuse code in scripts, in order to avoid having all the underlying code in the journals itself.
Project description
nxopentse (by theScriptingEngineer)
Learning NXOpen
I currently have 2 courses available for learning NXOpen. A beginner course in python to get you started by setting up your developer environment and teach some basic concepts:
Siemens NX beginner NXOpen course (Python)
An in depth course walking you through a complete structural analysis, step by step, towardw a fully automated analysis from load/bc application till postprocessing:
SimCenter 3D basic NXOpen course (C#)
Use the code NXOPEN_PYTHON_SEP24 or NXOPEN_CSHARP_SEP24 to get the current best price (replace SEP with the current 3 letter month eg. DEC if the current month is December)
If you’re using my scripts in your daily work, saving you a lot of work and time, buy me a coffe so I can continue developing awesome scripts. Buy me a coffe
nxopentse
This package contains functions which you can use in your own scripts, so you don't have to write everything from scratch.
pip install nxopentse
NOTE: You need to have configured NX/Simcenter to work with the external python interpreter.
Then in your script add
import nxopentse
Simple example:
import NXOpen
import nxopentse as tse
# Every NXOpen journal needs an NXOpen.Session object
the_session: NXOpen.Session = NXOpen.Session.GetSession()
def main():
tse.cad.nx_hello()
if __name__ == '__main__':
main()
nxopen.cad
CAD functionality
nxopan.cae
CAE functionality
nxopen.tools
General tools which can be used in different NX applications.
NX versions
SC2212:
SC2312:
Documentation
Documentation from source using Sphinx
sphinx-build -M html docs/source/ docs/build/
Using intelligent code completion (aka intellisense) for NXOpen in python
One of the advantages of python is that it is dynamically typed. The consequence is that the IDE (eg. PyCharm, VSCode) does not know the object type of the variable. While writing NXOpen code in python I found this a huge disadvantage, because during coding I rely heavily on code completion (aka intellisense) to know the available methods on the objects. Apart from an older document from siemens explaining how to get this to work with Eclipse and PyDev add-on, which only works partially, I'm not aware of any other resource to get code completion to work.
This is why I created my own stub files for the NXOpen libraries.
From NX2406 onwards, the stub files are provided by Siemens in the installation directory. Make sure to check the Programming tools during NX installation.
Visual Studio Code
Demo: Code completion in python (VSCode)
From this blog
In VSCode go to settings.json (ctrl + P -> settings.json) or locate settings.json under the folder .vscode an add the following entry: "python.analysis.typeCheckingMode": "basic"
In VSCode go to settings.json (ctrl + P -> settings.json) or locate settings.json under the folder .vscode an add the following entry:
"python.analysis.stubPath": "path_to_the_stub_files/Release2023/"
Please contact me for a copy of the stub files.
Successful configuration should give no errors after opening intellisense.py (might need to restart VSCode)
PyCharm
Demo: Code completion in python (PyCharm)
Add the location of the stub files to the interpreter path. Instructions on how to do this can be found here
Please contact me for a copy of the stub files.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nxopentse-0.0.1a24.tar.gz.
File metadata
- Download URL: nxopentse-0.0.1a24.tar.gz
- Upload date:
- Size: 76.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe4dd2dcc794d4b6f9321e138b9c99061424dc83ea553619951f13ef17fa29c2
|
|
| MD5 |
737b694f3988fe2b38e60838aa5e780a
|
|
| BLAKE2b-256 |
10fca5c52a5f42d09a1aab706cfa6219cfaaa19bda3bf10c4d4cf3a418bff197
|
Provenance
The following attestation bundles were made for nxopentse-0.0.1a24.tar.gz:
Publisher:
build_and_publish.yml on theScriptingEngineer/nxopentse
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nxopentse-0.0.1a24.tar.gz -
Subject digest:
fe4dd2dcc794d4b6f9321e138b9c99061424dc83ea553619951f13ef17fa29c2 - Sigstore transparency entry: 213496301
- Sigstore integration time:
-
Permalink:
theScriptingEngineer/nxopentse@aae86c584bd038713970400491be95e5dbd6d8e2 -
Branch / Tag:
refs/tags/v0.0.1a25 - Owner: https://github.com/theScriptingEngineer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_and_publish.yml@aae86c584bd038713970400491be95e5dbd6d8e2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nxopentse-0.0.1a24-py3-none-any.whl.
File metadata
- Download URL: nxopentse-0.0.1a24-py3-none-any.whl
- Upload date:
- Size: 80.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fe40cd6ec3df9e8e7acb656e4802e3a1b7e3801a79a8c1343270bedb711a8e9
|
|
| MD5 |
b6ef790d5814106270dd978092242859
|
|
| BLAKE2b-256 |
3d17cd966158e62911f234a7731142ce81c5c9c1c85c53e6f9d00a15de3e7797
|
Provenance
The following attestation bundles were made for nxopentse-0.0.1a24-py3-none-any.whl:
Publisher:
build_and_publish.yml on theScriptingEngineer/nxopentse
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nxopentse-0.0.1a24-py3-none-any.whl -
Subject digest:
9fe40cd6ec3df9e8e7acb656e4802e3a1b7e3801a79a8c1343270bedb711a8e9 - Sigstore transparency entry: 213496303
- Sigstore integration time:
-
Permalink:
theScriptingEngineer/nxopentse@aae86c584bd038713970400491be95e5dbd6d8e2 -
Branch / Tag:
refs/tags/v0.0.1a25 - Owner: https://github.com/theScriptingEngineer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_and_publish.yml@aae86c584bd038713970400491be95e5dbd6d8e2 -
Trigger Event:
push
-
Statement type: