Files
FreeCADWasmDev/docs/current/PART_BUILDER_DOCUMENT_PROGRESS.md

86 lines
4.7 KiB
Markdown

# Part Builder Document Workflow
Subsequent completion: `PART_CHAMFER_DOCUMENT_PROGRESS.md` records the now
accepted native Chamfer workflow. Its pending status below is historical;
BoxSelection remains separate work.
2026-09-16. `Part:desktop:Part_Builder` now has passing executable native and
browser business evidence. This adds one previously missing workflow; it is
not another IFC regression or a metadata-only routing receipt.
## Implementation
`PartBuilderDocument.h` uses the Part constructors from the supplied desktop
`src/Mod/Part/Gui/TaskShapeBuilder.cpp`: edge from vertices, wire from edges,
face from vertices, face from edges, shell from faces and solid from shell.
Planar/filled-face, selected/all-faces and refine options are supported. For
filled faces from existing edges, constructing a native wire first normalizes
edge orientation; feeding those wire edges to the existing filling API avoids
an invalid unorientable surface. Validity checks remain mandatory.
All topology references resolve against the current DocumentProbe document.
Each Create adds a real Part::Feature under one transaction, with unique names,
recompute, undo/redo and FCStd persistence. Invalid/cross-document selections,
wrong topology, out-of-range subelements, overwrite attempts and active native
transactions reject without partially changing the document. Closing the task
does not create or discard previously committed shapes. Created shapes retain
desktop independent-shape behavior after subsequent source edits.
The mounted React panel provides all six modes, object/subelement selection,
native geometry metrics, undo/redo, task close/reopen, OPFS saving and local
FCStd opening. It reuses the existing Three.js view for actual native meshes
and OCCT-discretized edge curves. No frontend geometry algorithm or additional
WASM runtime was introduced. File selection does not overwrite an open native
document; opening into a new document name preserves the existing one.
## Native Recovery Defect
An out-of-range `Shape.getElement` call previously threw a C++ exception through
CPython, after which the next request trapped in `PyEval_GetBuiltins`. The
relevant Part Python binding units lacked Emscripten exception-catching compile
flags despite containing Python exception translation handlers. Enabled
`-fexceptions` for the six binding units used by the builder. This was an
incremental Part-library rebuild and DocumentProbe relink; OCCT was reused.
Other existing module binaries were not rebuilt merely to refresh fingerprints.
The case explicitly calls the binding with Vertex999, catches IndexError and
then creates another native line. Additional malformed geometry and selection
cases exercise recovery without destroying the interpreter or undo history.
An imported object legitimately clears the redo branch when it is added; the
pending-import test compares against that native transaction state, then aborts
the import and checks original objects and undo history are preserved.
## Validation
Final evidence:
`business-evidence/5b7b9a3f77245805e36fd975-20260916T042630336518.json`.
Builder has 24 passing scenarios including six modes, filled-face variants,
selected-face shells, invalid inputs, transaction recovery, native FCStd and
mounted browser operations. The same run also passed existing Part_Box,
Part_Compound and Part save/reopen workflows, and closed the attributable
Builder issue `runtime:e885d331cbe01e94b1dd` through the acceptance runner.
Screenshots and geometry-pixel checks are attached by hash in the evidence.
The desktop viewport is 1440x900 and mobile layout 390x844. Native geometry is
nonblank in both, and orbiting changes the rendered image. Node cases share
one DocumentProbe, while browser cases exercise actual Worker loading and a
page reload for persistence. The complete four-requirement run took 58.194
seconds. Repeating Builder with `--reuse` took 0.146 seconds, read one report,
executed zero cases and retained its original evidence timestamp.
TypeScript, geometry ownership check, production Vite build, 47 business
automation tests and 12 scheduler-context tests passed. Incremental public
asset sync took 4.197 seconds during the 29.23-second Vite build.
Diagnostic history remains in `part-builder-business/`,
`part-builder-filling-diagnostic.json` and
`part-builder-recovery-diagnostic.json`. Intermediate failed evidence remains
in `business-evidence/`; final acceptance supersedes the observed defects.
## Continue
Continue remaining uncovered requirements; do not repeat unchanged Builder or
IFC workflows. BoxSelection and Chamfer remain separate incomplete workflows.
Rectangle viewport picking belongs to BoxSelection; this Builder panel selects
explicit native object/subelement references. The scope remains 1508 total.