Skip to content

Add Align cylinders tool for shaft-into-hole placement #239

Description

@trailcode

Summary

Add a one-shot Align cylinders tool so a shaft can be placed into a hole (or the reverse) by picking two cylindrical faces, coaxially aligning them, then dragging insert depth along the shared axis before baking the transform.

This is not a persistent assembly mate. Placement bakes into BREP like Move / Rotate (SetLocalTransformation preview -> bake_transform_into_geometry + Shape_geom_delta).

Problem

  • Users can Move / Rotate solids freely, but there is no way to snap a rod into a hole by cylindrical axes.
  • Hole and shaft geometry already exist as OCCT cylindrical faces; the app did not extract axis/radius or offer an insert-align workflow.

Implemented scope

Behavior:

  • Mode Shape_cyl_align, default hotkey J (mode.cyl_align, remappable).
  • Pick moving cylindrical face, then fixed cylindrical face on a different solid.
  • Coaxial align; drag axial depth (or Tab for exact depth); LMB / Enter finalize; Esc cancel.
  • Options Flip direction reverses axis sense.
  • Radius mismatch logs a warning but still places.
  • Face selection mode while picking; dynamic AIS highlight off during depth drag.

Code:

  • cylinder_from_face / cyl_align_trsf in utl_geom
  • Shp_cyl_align operation
  • Mode / hotkey / toolbar / Options / Occt_view wiring

Documentation:

  • docs/usage.md (Align cylinders section + hotkeys)
  • src/doc/shape.md, src/doc/gui.md
  • CHANGELOG.md [Unreleased]

Acceptance criteria

  • Enter tool via J or toolbar; Face selection active for picks
  • Two-face pick: first moves, second fixed; reject non-cylinder / same-shape second pick
  • Coaxial preview then axial depth drag; Tab depth; Flip direction; bake + undo
  • Docs + CHANGELOG + remappable hotkey defaults
  • Manual smoke on rod + hole solids (desktop Release)

Out of scope (v1)

  • Persistent mates / assembly constraints
  • Auto flush to planar end faces
  • Script bindings
  • Fit / interference checking beyond radius warning

Related

  • Branch: Trailcode/shp-cyl-align

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions