Skip to content

Add filleted rectangle cutouts#54

Merged
jasonmadigan merged 4 commits into
tracefinity:mainfrom
noobydp:codex/cylinder-cutouts-tools
Jun 14, 2026
Merged

Add filleted rectangle cutouts#54
jasonmadigan merged 4 commits into
tracefinity:mainfrom
noobydp:codex/cylinder-cutouts-tools

Conversation

@noobydp

@noobydp noobydp commented May 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add filleted_rectangle as a supported cutout shape across backend schema, frontend types, and the tool editor cutout menu.
  • Generate a full-depth rounded-bottom rectangle cutter in STL output, with fillet radius clamped to min(width / 3, cutout_depth / 2).
  • Treat filleted rectangles like rectangles for placement, resizing, rotation, selection labels, and bin/editor visualization.
  • Render filleted rectangle overlays as a single matching-outline shape instead of a separate blue indicator line.
  • Document the STL generation behavior and add focused backend coverage for radius clamping, full-depth reach, and chamfer cutter creation.

Testing

  • python -m py_compile backend\app\services\stl_generator_manifold.py backend\tests\test_cylinder_shape.py
  • PYTHONPATH="$env:TEMP\codex-manifold3d-inspect;D:\Development\tracefinity-cylinder-cutouts\backend" python -m pytest backend\tests\test_cylinder_shape.py -q
  • npx tsc --noEmit
  • npm run build
  • Browser smoke reload at http://localhost:4002/ with no build-error overlay or console errors.

Disclaimer

Code and PR drafted with Codex

@noobydp noobydp marked this pull request as ready for review May 31, 2026 16:03
@noobydp

noobydp commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Update after conflict-reduction pass:

  • Added Move cutout type declaration (0e8c93d).
  • Moved the CutoutShape type declaration in frontend/src/types/index.ts away from the top-of-file area used by the photo-station PR.
  • No behavior changes: FingerHole.shape?: CutoutShape and all filleted rectangle behavior remain unchanged.

Validation for this follow-up:

  • frontend\node_modules\.bin\tsc.cmd -p frontend\tsconfig.json --noEmit

Pairwise merge status after this update:

@jasonmadigan jasonmadigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes requested

blockers

SVG/STL fillet radius mismatch -- CutoutOverlay.tsx computes filletR = Math.min(w/3, h/2) where h is rectangle height. Backend _filleted_rect_radius computes min(width/3, pocket_depth/2) where the second term is pocket depth (Z-axis). The preview won't match the printed shape whenever pocket_depth != height.

profile winding direction unverified -- _rounded_bottom_rect_profile_pts docstring says "CCW x/z profile" but the point order appears clockwise. manifold3d CrossSection requires CCW. Tests pass (manifold3d may auto-correct), but should use _ensure_ccw() like elsewhere in the file rather than relying on implicit behaviour.

should fix

z_margin bleed in Y -- _make_filleted_rectangle_cutter applies z_margin to the Y-dimension length (length = h + z_margin * 2). The cutter overshoots 0.005mm per side in Y. Fix: length = h.

test coverage gaps -- zero fillet radius, fillet = half width, negative dimensions, rotation, and the profile point positions are all untested.

nits

  • cutoutShapeLabel switch could be a Record<CutoutShape, string> for exhaustiveness checking
  • duplicated ternary chains for isCutoutMode/cutoutModeIcon/cutoutModeLabel in ToolEditor (existing tech debt made slightly worse)

overall solid contribution -- the schema change is backward compatible, the CutoutShape type extraction is clean, and the chamfer grouping is correct. The preview mismatch is the main concern.

@noobydp

noobydp commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Updated PR #54 to address the requested changes.

Changes made:

  • Aligned the SVG preview fillet radius with STL generation by clamping against cutout depth instead of rectangle height.
  • In bin preview, resolved cutout depth the same way as backend generation: hole override, then tool override, then bin default.
  • Explicitly normalized the rounded-bottom profile to CCW before passing it to CrossSection.
  • Removed the small Y-axis length overshoot from the filleted rectangle cutter.
  • Expanded backend coverage for zero fillets, half-width fillets, negative dimensions, profile key points, rotation, exact Y extent, and winding.
  • Switched cutoutShapeLabel to an exhaustive Record<CutoutShape, string>.

Validation:

  • py_compile passed
  • backend/tests/test_cylinder_shape.py -q: 13 passed
  • npx tsc --noEmit passed
  • npm run build passed
  • git diff --check clean except local CRLF notices

That covers the blockers, should-fix items, and the cutoutShapeLabel nit. I left the duplicated ToolEditor ternary chain alone because it is existing UI tech debt and refactoring it is not needed for this correctness fix.

…uts-tools

# Conflicts:
#	frontend/src/components/BinEditorToolbar.tsx
@jasonmadigan

Copy link
Copy Markdown
Collaborator

thanks @noobydp!

@jasonmadigan jasonmadigan merged commit d9cd90f into tracefinity:main Jun 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants