mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
Some variations of shell mapping in occt
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||||
#include <BRepPrimAPI_MakePrism.hxx>
|
#include <BRepPrimAPI_MakePrism.hxx>
|
||||||
#include <BRepAlgoAPI_Common.hxx>
|
#include <BRepAlgoAPI_Common.hxx>
|
||||||
|
#include <ShapeFix_Solid.hxx>
|
||||||
|
|
||||||
using namespace ifcopenshell::geometry;
|
using namespace ifcopenshell::geometry;
|
||||||
using namespace ifcopenshell::geometry::kernels;
|
using namespace ifcopenshell::geometry::kernels;
|
||||||
@@ -31,7 +32,7 @@ using namespace IfcGeom::util;
|
|||||||
|
|
||||||
bool OpenCascadeKernel::convert(const taxonomy::solid::ptr solid, TopoDS_Shape& result) {
|
bool OpenCascadeKernel::convert(const taxonomy::solid::ptr solid, TopoDS_Shape& result) {
|
||||||
BRep_Builder BB;
|
BRep_Builder BB;
|
||||||
TopoDS_Solid S;
|
TopoDS_Shape S;
|
||||||
|
|
||||||
if (solid->instance->declaration().is("IfcHalfSpaceSolid")) {
|
if (solid->instance->declaration().is("IfcHalfSpaceSolid")) {
|
||||||
// halfspace
|
// halfspace
|
||||||
@@ -67,12 +68,16 @@ bool OpenCascadeKernel::convert(const taxonomy::solid::ptr solid, TopoDS_Shape&
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto& s : solid->children) {
|
for (auto& s : solid->children) {
|
||||||
if (S.IsNull()) {
|
TopoDS_Shape shl;
|
||||||
BB.MakeSolid(S);
|
convert(s, shl);
|
||||||
|
if (shl.ShapeType() == TopAbs_SHELL) {
|
||||||
|
ShapeFix_Solid solid;
|
||||||
|
S = solid.SolidFromShell(TopoDS::Shell(shl));
|
||||||
|
} else if (solid->children.size() == 1) {
|
||||||
|
S = shl;
|
||||||
|
} else {
|
||||||
|
throw std::runtime_error("Unexpected configuration of subshapes");
|
||||||
}
|
}
|
||||||
TopoDS_Shell shl;
|
|
||||||
convert(((taxonomy::shell::ptr)s), shl);
|
|
||||||
BB.Add(S, shl);
|
|
||||||
}
|
}
|
||||||
if (!S.IsNull()) {
|
if (!S.IsNull()) {
|
||||||
result = S;
|
result = S;
|
||||||
|
|||||||
Reference in New Issue
Block a user