Since the OCCT 8.0.1 update, some STEP files imported with cone faces missing. OCCT told the two seam pcurves of a cone apart with a 1e-7 threshold, which fails when the neighboring pcurves end slightly past the seam. The OCCT patch now picks the closer pcurve. The #16290 fix is kept.
Also stops admesh from merging unrelated edges of open meshes from STEP and SVG import on ARM64. A mesh built in memory reaches the nearby check with a tolerance of 0, and dividing by it was undefined. The check now returns early, which is what x86-64 already did.
* Keep original body names when importing STEP, AMF and 3MF geometry
STEP, AMF and 3MF bodies keep the names stored in the file. The three formats share one geometry import path with matching dialogs, per-format Preferences and cleanup of unsupported characters. AMF body groups load as one object, nested groups are flattened, and a CAD 3MF is imported as geometry.
* Use the app's widgets in the geometry import dialogs
Check boxes, radio buttons and the name replacement field in the STEP,
AMF/3MF and name cleanup dialogs now use the app's own controls instead
of the native ones; the name cleanup preview uses the dialogs' label font.
* Address review: AMF layout, Open Project cancel, part visibility
- AMF: the import dialog offers "Separate objects (as before)" first and
uses it by default, so files from PrusaSlicer and Slic3r, which keep a
whole plate in one constellation, load as separate objects again. The
assembly modes are opt-in.
- File > Open Project with a CAD 3MF replaces the project only after the
import dialogs were answered and the file was read with geometry to load.
A Cancel or an empty file keeps the current project, its unsaved state,
notifications and preview state; close_with_confirm() can hand back its
closing steps for this.
- The object list no longer changes the model while it checks whether a
single-object import hides its parts: ModelObject::hides_imported_parts()
is used by the list, Split to parts and its menu check, and the painting
gizmos' list update shows or hides the parts when painting changes.
Removing the part rows keeps the object a container for its instances.
- Progress: staged reading takes the first part of the bar and never goes
back within a file; the load loop takes the rest.
- A constellation id equal to an object id is logged as a warning.
- set_import_volume_order() is defined next to sort_objects().
* Address review: part rename on drag, Multi-part check for unplaced AMF
- Dragging a part of an imported object cancels a name editor that is
still open before the part rows are rebuilt. On GTK the editor opened by
pressing the selected row outlived the deleted row and wrote its name
into another part.
- The Multi-part check reads zero for objects the file does not place, as
min_z() did in Release builds, instead of their mesh height: the meshes
are already centered by then, so different heights asked the question
where main does not.
- Non-printable AMF groups skip the Multi-part question only in the
assembly modes; Separate objects asks as before.
- The first AMF load mode is "Load as separate objects".
---------
Co-authored-by: yw4z <ywsyildiz@gmail.com>
* Add CGAL-based mesh repair, drop Netfabb remnants
Add repair_mesh() in MeshRepair.cpp, a CGAL-based repair that replaces MeshBoolean::cgal::repair(). It welds cracks, cancels coincident triangles, fixes orientation, fills holes (including planar annular regions), removes local self-intersections, and unites crossing shells with libigl's exact boolean while following the nonzero winding rule used by slicing.
FixModelByCgal now repairs each volume in place without splitting it into parts, and reports whether the mesh was modified so unchanged meshes keep their painting and ids. The texture import repair prompt no longer depends on the Windows SDK, and the FIX_THROUGH_CGAL_ALWAYS conditionals are removed. The commented-out Netfabb/WIN10SDK build code is deleted.
libslic3r_cgal now builds with CGAL_LINKED_WITH_TBB and links TBB. Add docs/HLSD/mesh-repair.md and unit tests in test_mesh_repair.cpp.
* Parallelize repair while preserving separate shells
Repair connected mesh units and shells independently in parallel, keep crossing shells separate, and limit self-intersection remeshing to local defects. Update mesh-repair documentation and tests for the revised behavior.
* Make mesh repair deterministic and report its progress
Flags written from parallel loops were std::vector<bool>, whose neighbouring
bits share a word, so shells could be kept or dropped at random; they are now
std::vector<char>. Holes of up to 100 edges are filled with the search over all
triangles: the search restricted to a 3D Delaunay triangulation picks between
equally good fills differently from run to run.
Shells of fewer than four faces are dropped, as the volumes of two triangles
back to back need not cancel exactly, and a shell that self-intersection removal
changed is split again so the pieces it cut off are dropped too.
repair_mesh() takes a progress callback in place of the cancel callback, and
Fix Model reports each stage. The object's bounding box is now invalidated even
when a cancel or an error stops the repair after some volumes were replaced.
The edge-use sort, union-find and box-overlap code shared by several stages is
factored out, the topology analysed for welding is reused to build the work
units, the orientation pass checks only the edges it cut, and the output is
written from the shells without joining them first.
* Fix Split to parts crashing on flat pieces and staying offered after a repair
ModelVolume::split() added every piece to the object and then deleted the
pieces without a convex hull. When the first piece was flat, as often in a
triangle soup, that deleted the volume being split while split() and its
caller kept using it. A part made only of flat pieces lost all its volumes,
and a soup added thousands of pieces, saving a backup of the object for each
one it deleted. Pieces without a convex hull are now dropped before any joins
the object, the volume being split keeps the first remaining piece, and a part
with no solid piece is left whole. Other parts of the object without a convex
hull are no longer deleted as a side effect.
ModelVolume caches whether its mesh can be split, and set_mesh() kept the
cached value, so after Fix Model, Simplify or Emboss replaced a mesh, Split to
parts could still be offered for a single piece. set_mesh() and reset_mesh()
now clear the cache.
* Import STEP surface models with Split compound enabled
Splitting a compound kept only its solids, so a surface model, which OCCT
reads as a compound of loose faces, gave nothing to mesh and the import failed
with "Meshing of a model file failed or no valid shape". Each shell outside a
solid now becomes a part too, and loose faces stay together as one part, as
they do without splitting.
* Add Fix All for plates and re-enable --repair on the command line
ModelVolume::repair() applies repair_mesh() to a part and replaces the mesh
only when the repair changed it. Fix Model, the new Fix All and Fix All Plates
items of the plate context menu, and the command line's --repair option, which
had been commented out since the Win10 SDK repair was dropped, all use it.
With Keep painted feature after mesh change off, Fix Model cleared the painting
of every part of an object before repairing. Now only a part whose mesh changes
loses its painting, so fixing a whole project does not wipe it. The
notification counts the models that needed no repair instead of listing them as
repaired, and objects that did not change are not refreshed.
* Ignore Clipper, libpng, mcut and Boost.Polygon Internals in clang-tidy
Each only works through a wrapper or umbrella header: libslic3r/clipper.hpp or clipper_z.hpp configure Clipper before including it, png.h pulls in libpng's config headers, and Boost.Polygon's headers only compile through polygon.hpp or voronoi.hpp.
* Ignore minilzo's Config Headers in clang-tidy
lzoconf.h and lzodefs.h are internal to minilzo.h, which is what the code includes.
* Add Missing Includes Across the Remaining Sources and Tests
Covers src/slic3r/Utils, src/slic3r/plugin, src/slic3r/Config, src/libvgcode, src/dev-utils, src/OrcaSlicer.cpp and tests/, the directories left after src/slic3r/GUI and src/libslic3r. Generated with clang-tidy misc-include-cleaner. libvgcode's own headers are included by relative path as in the rest of that library, and Catch2 and pybind11 with angle brackets as elsewhere in the repo.
* Make the GUI and Test Headers Compile on Their Own
Each now includes, or forward-declares, what it uses instead of relying on what its includers happened to include first. Headers that only compile on one platform, or that nothing built includes, are left alone.
* Keep Windows and nanosvg Setup Ahead of the Added Includes
OrcaSlicer.cpp and several tests set _WIN32_WINNT, WIN32_LEAN_AND_MEAN or NOMINMAX before including Windows.h, and the profile validator defines NANOSVG_IMPLEMENTATION before any libslic3r header. The added includes had landed above those blocks, which broke the Windows build.
* Add the GUI Includes the First Pass Missed
Covers headers that only became editable once they compiled on their own, and wx symbols whose suggested header changed as the clang-tidy ignore list grew after the src/slic3r/GUI pass.
* Keep the Added Test Includes Below the NOMINMAX Guard
test_marchingsquares.cpp and test_texture_displacement.cpp had includes inside #ifndef NOMINMAX, which the tests inherit as defined on Windows from libslic3r, so those were skipped there. .clang-tidy also ignores the MSVC STL and UCRT internals, Boost.Multiprecision's fwd.hpp and CPython's Windows include directory, as in #16068.