Enhanced expression extraction to find ALL named expressions in .prt files,
not just specific format. Added pyNastran-based result extraction example.
Expression Extraction Improvements:
- Updated regex to handle all NX expression format variations:
* #(Type [units]) name: value;
* (Type [units]) name: value;
* *(Type [units]) name: value;
* ((Type [units]) name: value;
- Added Root:expression_name: pattern detection
- Finds expressions even when value is not immediately available
- Deduplication to avoid duplicates
- Filters out NX internal names
Test Results with Bracket.prt:
- Previously: 1 expression (tip_thickness only)
- Now: 5 expressions found:
* support_angle = 30.0 degrees
* tip_thickness = 20.0 mm
* p3 = 10.0 mm
* support_blend_radius = 10.0 mm
* p11 (reference found, value unknown)
OP2 Result Extraction (pyNastran):
- Created example extractor: op2_extractor_example.py
- Functions for common optimization metrics:
* extract_max_displacement() - max displacement magnitude on any node
* extract_max_stress() - von Mises or max principal stress
* extract_mass() - total mass and center of gravity
- Handles multiple element types (CQUAD4, CTRIA3, CTETRA, etc.)
- Returns structured JSON for optimization engine integration
- Command-line tool for testing with real OP2 files
Usage:
python optimization_engine/result_extractors/op2_extractor_example.py <file.op2>
Integration Ready:
- pyNastran already in requirements.txt
- Result extractor pattern established
- Can be used as template for custom metrics
Next Steps:
- Integrate result extractors into MCP tool framework
- Add safety factor calculations
- Support for thermal, modal results
Updated the parser to work with actual NX .sim/.prt files which are
binary format (not XML) in NX 12+.
Key Changes:
- Added dual-mode parser: XML for test files, binary for real NX files
- Implemented string extraction from binary .sim files
- Updated solution detection to recognize Nastran SOL types
- Fixed expression extraction with proper NX format pattern:
#(Type [units]) name: value;
- Added multiple .prt file naming pattern support
- Added .fem file parsing for FEM information
Parser Capabilities:
- Extracts expressions from .prt files (binary parsing)
- Detects solution types (Linear Statics, Modal, etc.)
- Finds element types from .fem files
- Handles multiple file naming conventions
Validation with Real Files:
- Successfully parsed tests/Bracket_sim1.sim (6.2 MB binary file)
- Extracted 1 expression: tip_thickness = 20.0 mm
- Detected 18 solution types (including Nastran SOL codes)
- Works with both XML test files and binary production files
Technical Details:
- Binary files: latin-1 decoding + regex pattern matching
- Expression pattern: #(\w+\s*\[([^\]]*)\])\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*:\s*([-+]?\d*\.?\d+)
- Multiple .prt file search: exact match → base name → _i suffix
- FEM parsing: extracts mesh, materials, element types from .fem files
Next Steps:
- Refine solution filtering (reduce false positives)
- Add load/constraint extraction from .fem files
- Test with more complex models
This commit implements the first phase of the MCP server as outlined
in PROJECT_SUMMARY.md Option A: Model Discovery.
New Features:
- Complete .sim file parser (XML-based)
- Expression extraction from .sim and .prt files
- Solution, FEM, materials, loads, constraints extraction
- Structured JSON output for LLM consumption
- Markdown formatting for human-readable output
Implementation Details:
- mcp_server/tools/model_discovery.py: Core parser and discovery logic
- SimFileParser class: Handles XML parsing of .sim files
- discover_fea_model(): Main MCP tool function
- format_discovery_result_for_llm(): Markdown formatter
- mcp_server/tools/__init__.py: Updated to export new functions
- mcp_server/tools/README.md: Complete documentation for MCP tools
Testing & Examples:
- examples/test_bracket.sim: Sample .sim file for testing
- tests/mcp_server/tools/test_model_discovery.py: Comprehensive unit tests
- Manual testing verified: Successfully extracts 4 expressions, solution
info, mesh data, materials, loads, and constraints
Validation:
- Command-line tool works: python mcp_server/tools/model_discovery.py examples/test_bracket.sim
- Output includes both Markdown and JSON formats
- Error handling for missing files and invalid formats
Next Steps (Phase 2):
- Port optimization engine from P04 Atomizer
- Implement build_optimization_config tool
- Create pluggable result extractor system
References:
- PROJECT_SUMMARY.md: Option A (lines 339-350)
- mcp_server/prompts/system_prompt.md: Model Discovery workflow
- Create comprehensive NXOpen resources documentation
- Document NXOpenTSE as reference (not dependency)
- Add MCP system prompt with NXOpen guidance
- Include best practices from The Scripting Engineer
- Update README with resource links
- Define LLM workflow for NXOpen code generation
Resources:
- Official Siemens NXOpen API docs
- NXOpenTSE documentation and examples
- Attribution and licensing guidelines
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Update project name in all documentation files
- Update GitHub repository references to Anto01/Atomizer
- Update Python package name to 'atomizer'
- Update conda environment name references
- Update all module docstrings with new branding
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Set up Python package structure with pyproject.toml
- Created MCP server, optimization engine, and NX journals modules
- Added configuration templates
- Implemented pluggable result extractor architecture
- Comprehensive README with architecture overview
- Project ready for GitHub push
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>