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
81 lines
2.8 KiB
XML
81 lines
2.8 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- Sample NX Simulation File for Testing -->
|
|
<!-- This is a simplified representation of an actual .sim file -->
|
|
<SimulationModel version="2412">
|
|
<Metadata>
|
|
<Name>test_bracket</Name>
|
|
<Description>Simple bracket structural analysis</Description>
|
|
<NXVersion>NX 2412</NXVersion>
|
|
<CreatedDate>2025-11-15</CreatedDate>
|
|
</Metadata>
|
|
|
|
<!-- Solution Definitions -->
|
|
<Solutions>
|
|
<Solution name="Structural Analysis 1" type="Static Structural" solver="NX Nastran">
|
|
<Description>Linear static analysis under load</Description>
|
|
<SolverSettings>
|
|
<SolverType>101</SolverType>
|
|
<LinearSolver>Direct</LinearSolver>
|
|
</SolverSettings>
|
|
</Solution>
|
|
</Solutions>
|
|
|
|
<!-- Expressions (Parametric Variables) -->
|
|
<Expressions>
|
|
<Expression name="wall_thickness" value="5.0" units="mm">
|
|
<Formula>5.0</Formula>
|
|
<Type>Dimension</Type>
|
|
</Expression>
|
|
<Expression name="hole_diameter" value="10.0" units="mm">
|
|
<Formula>10.0</Formula>
|
|
<Type>Dimension</Type>
|
|
</Expression>
|
|
<Expression name="rib_spacing" value="40.0" units="mm">
|
|
<Formula>40.0</Formula>
|
|
<Type>Dimension</Type>
|
|
</Expression>
|
|
<Expression name="material_density" value="2.7" units="g/cm^3">
|
|
<Formula>2.7</Formula>
|
|
<Type>Material Property</Type>
|
|
</Expression>
|
|
</Expressions>
|
|
|
|
<!-- FEM Model -->
|
|
<FEM>
|
|
<Mesh name="Bracket Mesh" element_size="2.5" node_count="8234" element_count="4521">
|
|
<ElementTypes>
|
|
<ElementType type="CQUAD4"/>
|
|
<ElementType type="CTRIA3"/>
|
|
</ElementTypes>
|
|
</Mesh>
|
|
|
|
<Materials>
|
|
<Material name="Aluminum 6061-T6" type="Isotropic">
|
|
<Property name="youngs_modulus" value="68.9e9" units="Pa"/>
|
|
<Property name="poissons_ratio" value="0.33" units=""/>
|
|
<Property name="density" value="2700" units="kg/m^3"/>
|
|
<Property name="yield_strength" value="276e6" units="Pa"/>
|
|
</Material>
|
|
</Materials>
|
|
|
|
<Loads>
|
|
<Load name="Applied Force" type="Force" magnitude="1000.0" units="N">
|
|
<Location>Top Face</Location>
|
|
<Direction>0 -1 0</Direction>
|
|
</Load>
|
|
</Loads>
|
|
|
|
<Constraints>
|
|
<Constraint name="Fixed Support" type="Fixed">
|
|
<Location>Bottom Holes</Location>
|
|
</Constraint>
|
|
</Constraints>
|
|
</FEM>
|
|
|
|
<!-- Linked Files -->
|
|
<LinkedFiles>
|
|
<PartFile>test_bracket.prt</PartFile>
|
|
<FemFile>test_bracket.fem</FemFile>
|
|
</LinkedFiles>
|
|
</SimulationModel>
|