mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 10:11:46 +00:00
Don't convert to Nef if there are no voids
This commit is contained in:
@@ -66,10 +66,9 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcShellBasedSurfaceModel* l,
|
|||||||
bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcManifoldSolidBrep* l, ConversionResults& shape) {
|
bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcManifoldSolidBrep* l, ConversionResults& shape) {
|
||||||
cgal_shape_t s;
|
cgal_shape_t s;
|
||||||
const SurfaceStyle* collective_style = get_style(l);
|
const SurfaceStyle* collective_style = get_style(l);
|
||||||
if (convert_shape(l->Outer(),s) ) {
|
const SurfaceStyle* indiv_style = get_style(l->Outer());
|
||||||
CGAL::Nef_polyhedron_3<Kernel_> nef_s = create_nef_polyhedron(s);
|
|
||||||
const SurfaceStyle* indiv_style = get_style(l->Outer());
|
|
||||||
|
|
||||||
|
if (convert_shape(l->Outer(),s) ) {
|
||||||
IfcSchema::IfcClosedShell::list::ptr voids(new IfcSchema::IfcClosedShell::list);
|
IfcSchema::IfcClosedShell::list::ptr voids(new IfcSchema::IfcClosedShell::list);
|
||||||
if (l->as<IfcSchema::IfcFacetedBrepWithVoids>()) {
|
if (l->as<IfcSchema::IfcFacetedBrepWithVoids>()) {
|
||||||
voids = l->as<IfcSchema::IfcFacetedBrepWithVoids>()->Voids();
|
voids = l->as<IfcSchema::IfcFacetedBrepWithVoids>()->Voids();
|
||||||
@@ -80,14 +79,19 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcManifoldSolidBrep* l, Conv
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (IfcSchema::IfcClosedShell::list::it it = voids->begin(); it != voids->end(); ++it) {
|
if (voids->size()) {
|
||||||
cgal_shape_t s2;
|
CGAL::Nef_polyhedron_3<Kernel_> nef_s = create_nef_polyhedron(s);
|
||||||
if (convert_shape(*it, s2)) {
|
|
||||||
nef_s -= CGAL::Nef_polyhedron_3<Kernel_>(s2);
|
for (IfcSchema::IfcClosedShell::list::it it = voids->begin(); it != voids->end(); ++it) {
|
||||||
|
cgal_shape_t s2;
|
||||||
|
if (convert_shape(*it, s2)) {
|
||||||
|
nef_s -= CGAL::Nef_polyhedron_3<Kernel_>(s2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s = create_polyhedron(nef_s);
|
||||||
}
|
}
|
||||||
|
|
||||||
s = create_polyhedron(nef_s);
|
|
||||||
shape.push_back(ConversionResult(l->data().id(), new CgalShape(s), indiv_style ? indiv_style : collective_style));
|
shape.push_back(ConversionResult(l->data().id(), new CgalShape(s), indiv_style ? indiv_style : collective_style));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user