From 7aab695f046db1a1271881c9605408ac25bb71f0 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Tue, 25 Aug 2020 11:26:06 +0200 Subject: [PATCH] csg2d - skip degenerated solids --- libsrc/geom2d/csg2d.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libsrc/geom2d/csg2d.cpp b/libsrc/geom2d/csg2d.cpp index 07364024..d1871166 100644 --- a/libsrc/geom2d/csg2d.cpp +++ b/libsrc/geom2d/csg2d.cpp @@ -1538,7 +1538,7 @@ shared_ptr CSG2d :: GenerateSplineGeometry() for(auto & s : solids) { dom++; - geo->SetMaterial(dom, s.name); + bool is_solid_degenerated = true; // Don't create new domain for degenerated solids for(auto & poly : s.polys) { for(auto v : poly.Vertices(ALL)) @@ -1588,9 +1588,15 @@ shared_ptr CSG2d :: GenerateSplineGeometry() ls.left = dom; else ls.right = dom; + + is_solid_degenerated = false; } } } + if(!is_solid_degenerated) + geo->SetMaterial(dom, s.name); + else + dom--; // degenerated solid, use same domain index again } for(auto & [name, bc] : bcmap)