Migrate export_step / export_stl / export_brep off FreeCAD, onto build123d + OCP — Phase 3: Rewrite export_step to use STEPControl_Writer #43

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

Phase 3: Rewrite export_step to use STEPControl_Writer

Goal: Replace pc2cad.py:4991 export_step (FreeCAD + Part.export)
with an OCP STEPControl_Writer implementation.

Approach:

  • Build each primitive to TopoDS_Shape via _primitive_to_shape.
  • Fuse the per-primitive shapes into a single TopoDS_Compound via
    TopoDS_Builder.
  • Write via STEPControl_Writer: w = STEPControl_Writer();
    w.Transfer(compound, STEPControl_AsIs); w.Write(path).

Files: pc2cad.py:4991-5066 (rewrite export_step),
pc2cad.py:5063-5064 (replace Part.makeCompound + Part.export).

Acceptance:

  • python pc2cad_cli.py samples/sample_plane_cyl.ply --out /tmp/p3.step
    writes a STEP file >5 KB.
  • file /tmp/p3.step reports "ISO-10303 STEP data".
  • OCP.STEPControl_Reader reads it back without error.


Decomposed from pc2cad#23

## Phase 3: Rewrite `export_step` to use `STEPControl_Writer` **Goal:** Replace `pc2cad.py:4991 export_step` (FreeCAD + `Part.export`) with an OCP `STEPControl_Writer` implementation. **Approach:** - Build each primitive to `TopoDS_Shape` via `_primitive_to_shape`. - Fuse the per-primitive shapes into a single `TopoDS_Compound` via `TopoDS_Builder`. - Write via `STEPControl_Writer`: `w = STEPControl_Writer()`; `w.Transfer(compound, STEPControl_AsIs)`; `w.Write(path)`. **Files:** `pc2cad.py:4991-5066` (rewrite `export_step`), `pc2cad.py:5063-5064` (replace `Part.makeCompound` + `Part.export`). **Acceptance:** - `python pc2cad_cli.py samples/sample_plane_cyl.ply --out /tmp/p3.step` writes a STEP file >5 KB. - `file /tmp/p3.step` reports "ISO-10303 STEP data". - `OCP.STEPControl_Reader` reads it back without error. --- --- _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:10:20 +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#43
No description provided.