Migrate export_step / export_stl / export_brep off FreeCAD, onto build123d + OCP — Phase 2: Migrate boolean ops to OCP (BRepAlgoAPI_*) #42

Closed
opened 2026-06-24 03:24:31 +00:00 by Mark · 1 comment
Owner

Phase 2: Migrate boolean ops to OCP (BRepAlgoAPI_*)

Goal: Replace shape.fuse / shape.cut / shape.common with OCP boolean
operations at every call site in pc2cad.py.

Approach: Use BRepAlgoAPI_Fuse / BRepAlgoAPI_Cut /
BRepAlgoAPI_Common. These are not method-chained like FreeCAD's — each
returns a BRepAlgoAPI_* object whose Shape() property gives the result.
Wrap in a small helper _fuse(shapes: List[TopoDS_Shape]) -> TopoDS_Shape
that handles the iterative fold.

Files: pc2cad.py:3809, 3831, 3843, 3851, 3860, 3869, 3925, 3944, 3971, 3978, 4040, 4183 — every .fuse / .cut / .common call site. Also the
boolean ops inside _cut_by_chamfers, _cut_by_fillet_tools,
_cut_by_slot_tools, _cut_by_hole_tools.

Acceptance:

  • git grep -nE "\.fuse\(|\.cut\(|\.common\(" pc2cad.py | grep -v _fuse_helper
    returns no hits.
  • python -m pytest tests/test_pipeline.py -v passes.
  • python pc2cad_cli.py samples/sample_plane_cyl.ply --out /tmp/p2.step
    produces a valid STEP (boolean ops no longer raise NotImplementedError).


Decomposed from pc2cad#23

## Phase 2: Migrate boolean ops to OCP (`BRepAlgoAPI_*`) **Goal:** Replace `shape.fuse / shape.cut / shape.common` with OCP boolean operations at every call site in `pc2cad.py`. **Approach:** Use `BRepAlgoAPI_Fuse` / `BRepAlgoAPI_Cut` / `BRepAlgoAPI_Common`. These are not method-chained like FreeCAD's — each returns a `BRepAlgoAPI_*` object whose `Shape()` property gives the result. Wrap in a small helper `_fuse(shapes: List[TopoDS_Shape]) -> TopoDS_Shape` that handles the iterative fold. **Files:** `pc2cad.py:3809, 3831, 3843, 3851, 3860, 3869, 3925, 3944, 3971, 3978, 4040, 4183` — every `.fuse / .cut / .common` call site. Also the boolean ops inside `_cut_by_chamfers`, `_cut_by_fillet_tools`, `_cut_by_slot_tools`, `_cut_by_hole_tools`. **Acceptance:** - `git grep -nE "\.fuse\(|\.cut\(|\.common\(" pc2cad.py | grep -v _fuse_helper` returns no hits. - `python -m pytest tests/test_pipeline.py -v` passes. - `python pc2cad_cli.py samples/sample_plane_cyl.ply --out /tmp/p2.step` produces a valid STEP (boolean ops no longer raise NotImplementedError). --- --- _Decomposed from [pc2cad#23](https://forgejo.tail018ac4.ts.net/Mark/pc2cad/issues/23)_
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Mark 2026-07-08 13:49:19 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/pc2cad#42
No description provided.