Skip to content
Stable.step@modelscript/step 8 diagnostic rules
Parser WASM GLR
Diagnostics 8 rules
DAE Arena AST Only
Simulation Co-sim / Export
Projections Modelica, CSG
Live ExampleRoboticWristAssembly.step

ISO 10303-21 AP242 Robotic Wrist Assembly & PMI

STEP Part 21 assembly hierarchy defining rigid-body coordinate frames, a revolute kinematic pair, and AP242 flatness tolerances.

Playground
Source (25 lines)
1ISO-10303-21;
2HEADER;
3FILE_DESCRIPTION(('ModelScript AP242 Robotic Wrist Assembly'),'2;1');
4FILE_NAME('RoboticWristAssembly.step','2026-04-01T12:00:00',('ModelScript'),(''),'','','');
5FILE_SCHEMA(('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF'));
6ENDSEC;
7DATA;
8#10 = PRODUCT('BASE_FLANGE','Base Mounting Flange','',(#2));
9#11 = PRODUCT_DEFINITION_FORMATION('1','Rev A',#10);
10#12 = PRODUCT_DEFINITION('design','',#11,#3);
11#20 = PRODUCT('WRIST_YOKE','Articulated Wrist Yoke','',(#2));
12#21 = PRODUCT_DEFINITION_FORMATION('1','Rev A',#20);
13#22 = PRODUCT_DEFINITION('design','',#21,#3);
14#30 = PRODUCT('TOOL_ADAPTER','ISO 9409-1 Tool Adapter','',(#2));
15#31 = PRODUCT_DEFINITION_FORMATION('1','Rev A',#30);
16#32 = PRODUCT_DEFINITION('design','',#31,#3);
17#40 = CARTESIAN_POINT('Origin',(0.0,0.0,0.0));
18#41 = DIRECTION('Z_Axis',(0.0,0.0,1.0));
19#42 = DIRECTION('X_Axis',(1.0,0.0,0.0));
20#43 = AXIS2_PLACEMENT_3D('BaseFrame',#40,#41,#42);
21#50 = NEXT_ASSEMBLY_USAGE_OCCURRENCE('NAUO_1','Base to Yoke','Pitch Joint',#12,#22,$);
22#51 = NEXT_ASSEMBLY_USAGE_OCCURRENCE('NAUO_2','Yoke to Tool','Roll Joint',#22,#32,$);
23#60 = FLATNESS_TOLERANCE('FT_01','Mounting Face Flatness',#61,#12);
24ENDSEC;
25END-ISO-10303-21;
3D Isometric B-Rep & Assembly Kinematic Tree
ISO 10303-21 AP242 B-REP ISOMETRIC ω_pitch X Y Z ASSEMBLY TREE & GD&T PMI «PRODUCT_DEFINITION» #10 BASE_FLANGE ⏥ 0.02 mm FLATNESS #60 NAUO_1 (Pitch Joint) «PRODUCT_DEFINITION» #20 WRIST_YOKE NAUO_2 (Roll Joint) «PRODUCT_DEFINITION» #30 TOOL_ADAPTER
Drag to pan · Click % to reset

STEP (ISO 10303-21) ​

@modelscript/step (languages/step) provides a native WebAssembly GLR parser, assembly hierarchy extractor, AP242 Geometric Dimensioning & Tolerancing (GD&T / PMI) analyzer, and Modelica MultiBody kinematic synthesizer for ISO 10303-21 Clear Text Encoding of the Exchange Structure (.step, .stp, .p21).


Supported Extensions & Standards ​

ExtensionStandardScope
.step, .stp, .p21ISO 10303-21 (AP203, AP214, AP242)B-Rep solid geometry, product assembly trees (NEXT_ASSEMBLY_USAGE_OCCURRENCE), kinematic joints, and PMI/GD&T tolerances

Capabilities ​

  1. Zero-Dependency STEP Part 21 Parser: Parses HEADER; and DATA; sections, #id = ENTITY_NAME(...) instances, nested typed parameters, and enumeration tokens into linear memory.
  2. Assembly Hierarchy & Mass Properties (extractStepAssembly): Extracts PRODUCT_DEFINITION parts, NEXT_ASSEMBLY_USAGE_OCCURRENCE parent–child assembly trees, AXIS2_PLACEMENT_3D rigid-body frames, bounding boxes, and mass/inertia properties.
  3. AP242 PMI & GD&T Extraction (extractStepAssembly): Extracts datum features (DATUM, DATUM_FEATURE, DATUM_SYSTEM) and 10 geometric tolerance categories (StepGeometricTolerance in languages/step/src/extractor.ts) for 3D tolerance stack-up analysis (ToleranceStackOracle):
GD&T Tolerance KindSTEP AP242 Entity Name
flatnessFLATNESS_TOLERANCE
roundnessROUNDNESS_TOLERANCE / CIRCULARITY_TOLERANCE
cylindricityCYLINDRICITY_TOLERANCE
perpendicularityPERPENDICULARITY_TOLERANCE
parallelismPARALLELISM_TOLERANCE
positionPOSITION_TOLERANCE
surface_profileSURFACE_PROFILE_TOLERANCE
concentricityCONCENTRICITY_TOLERANCE / COAXIALITY_TOLERANCE
runoutCIRCULAR_RUNOUT_TOLERANCE / TOTAL_RUNOUT_TOLERANCE
generalGEOMETRIC_TOLERANCE (with TOLERANCE_VALUE / LENGTH_MEASURE_WITH_UNIT)
  1. Modelica MultiBody Kinematic Synthesis (mapStepToMultiBody): languages/step/src/multibody-mapper.ts translates STEP kinematic joints and AXIS2_PLACEMENT_3D transforms directly into Modelica.Mechanics.MultiBody components:
    • Kinematic Joints: Maps REVOLUTE_PAIR → Modelica.Mechanics.MultiBody.Joints.Revolute, PRISMATIC_PAIR → Joints.Prismatic, CYLINDRICAL_PAIR → Joints.Cylindrical, SPHERICAL_PAIR → Joints.Spherical, and PLANAR_PAIR → Joints.Planar with axis vectors n and connect(...) equations.
    • Static Frame Placements (MultiBodyFixedTranslation): Computes exact translation vectors r = {x, y, z} (converting MILLI to meters) and 3×3 orthonormal orientation matrices from AXIS2_PLACEMENT_3D axis (z^) and ref_direction (x^) vectors to emit Modelica.Mechanics.MultiBody.Parts.FixedTranslation and Parts.BodyBox / Parts.BodyCylinder components.

IDE & CAE Mesh Generation Actions ​

stepLanguage.actions (languages/step/src/language.ts) provides 6 built-in CAD/CAE workflows:

Action IDDescription
open_cad_viewerOpens the interactive 3D B-Rep & assembly viewer for the .step model
generate_multibodySynthesizes a Modelica.Mechanics.MultiBody .mo model from STEP assembly frames and joints
generate_fea_meshTessellates the STEP B-Rep solid into a 3D tetrahedral CalculiX .inp finite element mesh
generate_cfd_meshGenerates an unstructured .su2 surface/volume fluid mesh from the STEP geometry
create_fea_setupScaffolds a parametric .inpt CalculiX structural study linked to the STEP part
create_cfd_setupScaffolds a parametric .cfgt SU2 aerodynamic study linked to the STEP part

Dedicated step-mcp Server Tools ​

The @modelscript/step MCP server (languages/step/src/mcp/server.ts) exposes two specialized tools for AI engineering agents:

  • step_extract_entities: Parses a .step / .stp file and returns the structured assembly tree, AXIS2_PLACEMENT_3D coordinate frames, kinematic joints, and AP242 GD&T geometric tolerances.
  • step_to_multibody: Generates complete Modelica.Mechanics.MultiBody code (including World, Parts.Body, Parts.FixedTranslation, Joints.*, and connect(...) equations) from a STEP assembly.

Polyglot TGG Rules ​

@modelscript/step registers 5 bidirectional Triple Graph Grammar (TGG) rules in languages/step/src/language.ts:

Rule NameSource (step)Target LanguageTarget Construct
StepProductToSysML2PartDataEntity (PRODUCT)sysml2PartDef
StepPropertyToSysML2AttributeDataEntity (PROPERTY_DEFINITION)sysml2AttributeUsage
StepPlacementToSysML2PortDataEntity (AXIS2_PLACEMENT_3D)sysml2PortUsage
StepRevoluteJointToModelicaRevoluteDataEntity (REVOLUTE_PAIR)modelicaComponentClause (Modelica.Mechanics.MultiBody.Joints.Revolute)
StepPrismaticJointToModelicaPrismaticDataEntity (PRISMATIC_PAIR)modelicaComponentClause (Modelica.Mechanics.MultiBody.Joints.Prismatic)

CLI Usage ​

bash
# Parse and inspect the CST of an ISO 10303-21 STEP file
npx msx parse chassis.step

# Project a STEP assembly into a Modelica MultiBody model via TGG rules
npx msx polyglot project chassis.step --target modelica --out chassis.mo

# Verify cross-domain alignment between STEP CAD geometry and SysML v2 architecture
npx msx align chassis.step architecture.sysml

Diagnostic Rules ​

8 rules5 error3 warning Run with msx lint

CodeRuleSeverityMessage
M1001step-syntax-errorerrorSTEP file syntax error: <detail>.
M1002missing-header-sectionerrorSTEP exchange file is missing mandatory 'HEADER;' section.
M1003missing-schema-declarationwarningSTEP header lacks a recognized 'FILE_SCHEMA' declaration (e.g. AP203, AP214, AP242).
M1004missing-data-sectionerrorSTEP exchange file is missing mandatory 'DATA;' section.
M1005unresolved-entity-referenceerrorReferenced STEP entity '#<entityId>' is not defined in the DATA section.
M1006duplicate-entity-iderrorEntity ID '#<entityId>' is declared more than once in the DATA section.
M1007empty-data-sectionwarningSTEP DATA section contains no entity records.
M1008unsupported-ap-schemawarningApplication Protocol schema '<schema>' may not support complete PMI or B-Rep extraction.

Generated from languages/step/src/errors.ts. All languages →

Open-Core under the GNU AGPL v3 License; Enterprise Edition (ee/) under the ModelScript Enterprise License. • Trademark Policy