Files
FreeCADWasmDev/docs/current/PART_MESH_CONVERSION_PROGRESS.md

5.0 KiB

Part mesh-to-shape gap completion

Date: 2026-09-17 (Asia/Shanghai) Requirement: Part:desktop:Part_ShapeFromMesh

Implementation

Desktop reference: src/Mod/Part/Gui/ShapeFromMesh.cpp, CmdPartShapeFromMesh in CommandSimple.cpp, and TopoShapePy::makeShapeFromMesh.

The current-document route converts selected Mesh::Feature objects into independent Part::Feature shapes. It invokes the same native operations as desktop makeShapeFromMesh: TopoShape::setFaces, followed by sewShape when requested. Mesh vertices retain native placement. Repeated sources are deduplicated, generated names remain unique, and a batch commits as one reversible document transaction.

The sewing default remains false and the tolerance default remains 0.1 mm. The lower bound is read from the desktop unit precision rule, max(1e-6, 10^-decimals), with an upper bound of 10 mm. Invalid sources, unsupported subelement selections, empty meshes and invalid/degenerate conversion output are rejected before objects are created. Inputs cannot inject detached BREP geometry into this document workflow.

The document runtime now links the existing compiled Mesh library and registers the native Mesh Python module, allowing mesh objects to survive native FCStd restore in the same document as Part shapes. Mesh point/facet counts and display triangles are serialized for the task. The source mesh remains unchanged and visible, matching desktop behavior.

Mounted controls provide mesh selection, sewing, tolerance, read/cancel, undo/redo, native FCStd save/open, OPFS persistence and interactive geometry. Conversion settings and source-name provenance persist without adding parametric dependencies. Read/cancel preserve unrelated pending edits.

Files: PartMeshConversionDocument.h, DocumentProbe.cpp, probe CMakeLists.txt, part-document-facade.ts, part-desktop-adapter.ts, part-mesh-conversion-task.tsx, and workbench integration.

First Acceptance

Command: python3 tools/run_business_acceptance.py --module Part --ids Part:desktop:Part_ShapeFromMesh --reuse

Result: 1 requirement passed, 27 scenario records, 24.988 seconds.

Formal evidence

The suite loaded one document kernel for the native cases and one browser workflow. Existing native dependencies were reused; only DocumentProbe was rebuilt and linked. TypeScript checking, production Vite build and changed native-file whitespace checks passed. No previously passed requirement suite was run.

Verified behaviors:

  • A translated box mesh with 8 points and 12 facets converts to 12 faces of total area 52 mm2. Bounds remain [5,6,7,7,9,11].
  • Without sewing the result is a face compound with zero shells; with sewing it is one shell. Neither path is falsely counted as a solid.
  • An open square mesh converts to two faces of area 4 mm2; sewing produces an open shell, consistent with the native desktop reference.
  • Geometry, shell counts, validity, areas and bounds match a separate call to desktop Part.Shape.makeShapeFromMesh using the same source topology.
  • Batch conversion, unique names, one-step history, preserved source objects and isolated documents.
  • Invalid tolerances, flags, missing/foreign/nonmesh sources, empty and degenerate meshes, malformed selection and direct native validation preserve the document and history.
  • Source mesh replacement/deletion leaves the static output unchanged. Native FCStd restores both Mesh and Part objects and the conversion metadata.
  • Mounted browser controls, tolerance disablement, empty-mesh disablement, history, native file import, OPFS save, browser reload, reopening and further conversion.

Visual Inspection

Playwright covered desktop 1440x900 and mobile 390x844 viewports, nonblank canvas pixels, changed render after camera rotation, and task overflow. Desktop and mobile screenshots were also visually inspected.

Continuation

Snapshot: 201/1508 requirements declare executable coverage; 1307 remain uncovered. This is coverage, not the count of currently fresh full-project acceptances. All original requirements remain.

This does not certify arbitrary damaged-mesh repair, automatic conversion to solids, mesh file-format import, or cross-worker document transfer. The implemented command works on native meshes present in the current DocumentProbe document, including FCStd-restored meshes.

Keep missing functionality and uncovered requirements first. Do not rerun this or historical IFC requirements just to refresh fingerprints. The overall task remains unfinished. The scheduler was thawed and verified active/unfrozen; cycle 9290 started with a live child process (443798), selecting Primitives, Projection on Surface, Section Cut and Sweep. Preserve the existing deferred-validation policy.