feat: Upgrade atomizer to Python 3.11 and enable full NXOpen integration

Upgraded atomizer environment from Python 3.10 to 3.11 to match NX2412's
Python version, enabling seamless NXOpen module import for development.

Changes:
- Upgraded atomizer conda environment to Python 3.11.14
- Added nxopen.pth to site-packages pointing to NX2412 Python modules
- Updated VSCode stub path from Simcenter3D to NX2412
- Verified NXOpen import works successfully in atomizer environment

Configuration:
- Python version: 3.11.14 (matches NX2412)
- NXOpen path: C:\Program Files\Siemens\NX2412\NXBIN\python
- Stub path: C:\Program Files\Siemens\NX2412\UGOPEN\pythonStubs

Benefits:
- NXOpen modules can now be imported directly in Python scripts
- No version conflicts between atomizer and NX
- Seamless development workflow for NXOpen code
- Full intellisense support with type hints and documentation

Documentation Updated:
- Added Python 3.11 requirement to NXOPEN_INTELLISENSE_SETUP.md
- Added Step 0: Python version check
- Added Step 1: NXOpen path setup with .pth file
- Updated all paths to use NX2412 instead of Simcenter3D_2412

Testing:
- Verified: import NXOpen successful
- Verified: NXOpen.__file__ points to correct location
- Ready for use in optimization workflows

This completes the NXOpen integration foundation for Atomizer.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-17 08:55:09 -05:00
parent 4e159d20de
commit a2ca28a247

View File

@@ -23,43 +23,79 @@ This dramatically improves development speed and reduces NXOpen API lookup time.
- **Siemens NX 2412** (or later) installed with Programming Tools
- **VSCode** with **Pylance extension** (usually installed with Python extension)
- **Python 3.10+** environment
- **Python 3.11** environment (required for NXOpen module compatibility)
---
## Setup Instructions
### Step 1: Verify Stub Files Exist
### Step 0: Ensure Python 3.11 Environment
NXOpen modules are compiled for Python 3.11. **You must use Python 3.11**:
```bash
# Check your Python version
python --version # Should show: Python 3.11.x
# If using conda, upgrade atomizer environment:
conda install -n atomizer python=3.11 -y
```
### Step 1: Add NXOpen to Python Path
Create a `.pth` file in your Python environment's site-packages to enable NXOpen imports:
```bash
# For atomizer environment:
# Create file: C:\Users\<username>\anaconda3\envs\atomizer\Lib\site-packages\nxopen.pth
# Contents:
C:\Program Files\Siemens\NX2412\NXBIN\python
```
This allows `import NXOpen` to work in your Python scripts!
### Step 2: Verify Stub Files Exist
Check that stub files are installed:
```bash
# Windows path:
dir "C:\Program Files\Siemens\Simcenter3D_2412\ugopen\pythonStubs\NXOpen"
dir "C:\Program Files\Siemens\NX2412\UGOPEN\pythonStubs\NXOpen"
# Should show: __init__.pyi and many module folders (CAE, Assemblies, etc.)
```
**If missing**: Reinstall NX 2412 and ensure "Programming Tools" is checked during installation.
### Step 2: Configure VSCode
### Step 3: Configure VSCode
Update `.vscode/settings.json` in your Atomizer project:
```json
{
"python.analysis.typeCheckingMode": "basic",
"python.analysis.stubPath": "C:\\Program Files\\Siemens\\Simcenter3D_2412\\ugopen\\pythonStubs"
"python.analysis.stubPath": "C:\\Program Files\\Siemens\\NX2412\\UGOPEN\\pythonStubs"
}
```
**Note**: Use double backslashes (`\\`) in Windows paths for JSON.
### Step 3: Restart VSCode
### Step 4: Restart VSCode
Close and reopen VSCode to load the new stub files.
### Step 4: Verify Intellisense Works
### Step 5: Verify NXOpen Import and Intellisense Works
First, test that NXOpen can be imported:
```python
python
>>> import NXOpen
>>> print("Success! NXOpen is available")
>>> exit()
```
Then test intellisense:
Open `tests/test_nxopen_intellisense.py` and verify: