- PRs target
develop, nevermain.mainis only for releases. - Tests:
pytest(all tests must pass). Coverage:pytest --cov. - Style:
ruff checkandruff format --check.
When building assemblies, follow this order:
- Ground a reference part — First instance is grounded by default. All positions are relative to this part.
- Get face IDs — Use
get_body_detailson the Part Studio. Face IDs are reusable across all instances of the same part. - Create mates in batches — Do 3-5 at a time, verify between batches with
get_assembly_features(all OK?) andget_assembly_positions(positions correct?). - Verify positions relative to the reference part — Always compute
instance_pos - reference_possince the reference may not be at origin. - Test motion mates — Create slider/revolute mates without limits first. Verify direction and animation before adding limits.
See knowledge_base/assembly_workflow_guide.md for the full guide and examples/cabinet_assembly.md for a worked example.
- Instance order = direction: For slider/revolute/cylindrical mates, the first instance moves relative to the second. Swap the order to reverse the direction.
- Limits can break the solver: API-set limits trigger a full re-solve that may flip parts. Create mates without limits first, add limits in the Onshape UI.
- Fixed instances can't be moved:
transform_instanceandset_instance_positionfail on grounded parts (API 400 error). - Absolute positions need reference offset: If the reference part is at (100, 200, 300), a part at relative (5, 10, 0) needs absolute (105, 210, 300).
- MC offsets are in local coords: Flipping the Z-axis changes all axes (right-hand rule), which changes how X/Y offsets map to world space.
onshape_mcp/server.py— MCP server with all tool definitionsonshape_mcp/builders/mate.py— MateConnectorBuilder, MateBuilderonshape_mcp/api/assemblies.py— Assembly API operationsknowledge_base/assembly_workflow_guide.md— Full assembly methodologyknowledge_base/cad/cad_best_practices.md— CAD design principlesexamples/cabinet_assembly.md— Complete cabinet assembly walkthrough