Files
FreeCADWasmDev/docs/current/meshpart-flat-placeholder-removal-20260912.md
wangdequan 9a7c4f0335 Save FreeCAD Web workspace sources and user validation evidence
IFC native binding remains incomplete; preserve accurate test results.
2026-09-15 22:01:58 +08:00

4.2 KiB

MeshPart Unwrap Placeholder Removal

Policy: reuse provided sources and existing WASM; OCCT/FreeCAD owns geometry, Three.js displays native output, OPFS stores user-delivered files. No automated tests or browser/business acceptance were run. Build success is not user validation.

Removed False Implementation

Both CreateFlat commands previously created a parametric box, meshed it, counted facets/faces, closed its document, and returned exposed status and obsolete object handles. None of that unfolded the user's selected geometry. This block was removed.

Source Reuse

The actual implementation was already supplied in MeshPart/App: MeshFlattening.cpp, MeshFlatteningLscmRelax.cpp and MeshFlatteningNurbs.cpp. They now compile directly into the existing MeshPart runtime. No duplicate kernel, new Python shim, reimplemented unfolding solver or NumPy/pybind11 dependency was added. The existing Eigen and OCCT dependencies are reused.

  • CreateFlatMesh uses FaceUnwrapper.findFlatNodes and getFlatBoundaryNodes on the actual mesh. It returns flattened points, original triangle indices and OCCT boundary wires as BREP, matching the desktop command's wire output.
  • CreateFlatFace follows MeshFlatteningCommand.py's NURBS conversion, non-periodic surface, cubic C0 approximation, tessellation, relaxation and pole interpolation. It returns the actual flattened B-spline face and native display triangulation.
  • Native-document input resolves exactly one existing Mesh feature or Part face. Result features are added under a transaction; failures abort it. The input document is not closed and result handles refer to retained objects.
  • Geometry input can be supplied directly: selection=[] plus points/triangles for mesh, or selection=[] plus brep for a single face. No native document is invented in this mode. Obsolete box dimensions cannot substitute for input.
  • The existing Three.js viewport is reused for native result display. BREP download first stores actual returned bytes in OPFS/MeshPart with a unique filename. The adapter rejects old exposed/count-only responses that contain no real BREP.

Conditions and Remaining Scope

Default relaxation matches the supplied desktop commands: five steps, 0.95 for mesh and 0.99 for face. Optional steps are 1..100 and relaxation is strictly 0..1. Degenerate triangles, invalid indices, non-manifold boundaries, disconnected mesh components and unused vertices are rejected before entering the supplied solver. Closed meshes need a seam; automatic cutting is not claimed. Face conversion follows the desktop complete-face procedure, not arbitrary trim/hole preservation. Document selections must belong to the same native runtime. This batch does not implement cross-worker document transfer or claim all project placeholders are gone.

Build Accounting

Initial CMake regeneration took 28.426 seconds. Compilation exposed two old adapter integration errors: nonexistent FeatureMesh.h (actual name MeshFeature.h), then a recompute(nullptr,...) call against the current vector-based API. These were repaired; failed compile steps took 4.511 and 7.335 seconds. They are not business progress.

Final native receipt: meshpart-flat-implementation-pipeline.json.

Final Step Seconds
Module registry 0.100
Capability registry 7.473
Preflight 0.043
Native build 66.702
Artifact sync 3.609
Completion metadata, not runtime acceptance 0.917
Final native pipeline total 78.844

Build concurrency was limited to two jobs for Eigen-heavy sources. Existing Part, Mesh and OCCT libraries were reused; only the affected MeshPart target was built. Do not repeat optional Python extension discovery: these commands now call the provided C++ implementations directly. Source decisions and fingerprints are retained in native-semantic-decisions.json.

Frontend publication completed with FREECAD_WEB_FAST_LINK=ON, exit code 0, 8.439 seconds wall time including 6.356 seconds incremental public-asset sync. The source inventory reused 478 file scans and rescanned 12 changed files in 0.135 seconds. Its 615 locations are review candidates including normal error handling; unchanged candidate counts do not erase the two real placeholder removals.