mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
Ensure solid from tapered extrusions
This commit is contained in:
@@ -352,7 +352,8 @@ public:
|
|||||||
IfcSchema::IfcSurfaceStyleShading* get_surface_style(IfcSchema::IfcRepresentationItem* item);
|
IfcSchema::IfcSurfaceStyleShading* get_surface_style(IfcSchema::IfcRepresentationItem* item);
|
||||||
const IfcSchema::IfcRepresentationItem* find_item_carrying_style(const IfcSchema::IfcRepresentationItem* item);
|
const IfcSchema::IfcRepresentationItem* find_item_carrying_style(const IfcSchema::IfcRepresentationItem* item);
|
||||||
bool create_solid_from_compound(const TopoDS_Shape& compound, TopoDS_Shape& solid);
|
bool create_solid_from_compound(const TopoDS_Shape& compound, TopoDS_Shape& solid);
|
||||||
bool create_solid_from_faces(const TopTools_ListOfShape& face_list, TopoDS_Shape& solid);
|
bool shape_to_face_list(const TopoDS_Shape& s, TopTools_ListOfShape& li);
|
||||||
|
bool create_solid_from_faces(const TopTools_ListOfShape& face_list, TopoDS_Shape& solid, bool force_sewing=false);
|
||||||
bool is_compound(const TopoDS_Shape& shape);
|
bool is_compound(const TopoDS_Shape& shape);
|
||||||
bool is_convex(const TopoDS_Wire& wire);
|
bool is_convex(const TopoDS_Wire& wire);
|
||||||
TopoDS_Shape halfspace_from_plane(const gp_Pln& pln,const gp_Pnt& cent);
|
TopoDS_Shape halfspace_from_plane(const gp_Pln& pln,const gp_Pnt& cent);
|
||||||
|
|||||||
@@ -529,22 +529,25 @@ void IfcGeom::Kernel::set_rotation(const std::array<double, 4> &p_rotation) {
|
|||||||
offset_and_rotation = combine_offset_and_rotation(offset, rotation);
|
offset_and_rotation = combine_offset_and_rotation(offset, rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IfcGeom::Kernel::create_solid_from_compound(const TopoDS_Shape& compound, TopoDS_Shape& shape) {
|
bool IfcGeom::Kernel::shape_to_face_list(const TopoDS_Shape& s, TopTools_ListOfShape& li) {
|
||||||
TopTools_ListOfShape face_list;
|
TopExp_Explorer exp(s, TopAbs_FACE);
|
||||||
TopExp_Explorer exp(compound, TopAbs_FACE);
|
|
||||||
for (; exp.More(); exp.Next()) {
|
for (; exp.More(); exp.Next()) {
|
||||||
TopoDS_Face face = TopoDS::Face(exp.Current());
|
TopoDS_Face face = TopoDS::Face(exp.Current());
|
||||||
face_list.Append(face);
|
li.Append(face);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IfcGeom::Kernel::create_solid_from_compound(const TopoDS_Shape& compound, TopoDS_Shape& shape) {
|
||||||
|
TopTools_ListOfShape face_list;
|
||||||
|
shape_to_face_list(compound, face_list);
|
||||||
if (face_list.Extent() == 0) {
|
if (face_list.Extent() == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return create_solid_from_faces(face_list, shape);
|
return create_solid_from_faces(face_list, shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IfcGeom::Kernel::create_solid_from_faces(const TopTools_ListOfShape& face_list, TopoDS_Shape& shape) {
|
bool IfcGeom::Kernel::create_solid_from_faces(const TopTools_ListOfShape& face_list, TopoDS_Shape& shape, bool force_sewing) {
|
||||||
bool valid_shell = false;
|
bool valid_shell = false;
|
||||||
|
|
||||||
if (face_list.Extent() == 1) {
|
if (face_list.Extent() == 1) {
|
||||||
@@ -565,7 +568,7 @@ bool IfcGeom::Kernel::create_solid_from_faces(const TopTools_ListOfShape& face_l
|
|||||||
// found a case where this actually improves boolean ops later on.
|
// found a case where this actually improves boolean ops later on.
|
||||||
// if (!faceset_helper_ || !faceset_helper_->non_manifold()) {
|
// if (!faceset_helper_ || !faceset_helper_->non_manifold()) {
|
||||||
|
|
||||||
for (face_iterator.Initialize(face_list); face_iterator.More(); face_iterator.Next()) {
|
for (face_iterator.Initialize(face_list); !force_sewing && face_iterator.More(); face_iterator.Next()) {
|
||||||
// As soon as is detected one of the edges is shared, the assumption is made no
|
// As soon as is detected one of the edges is shared, the assumption is made no
|
||||||
// additional sewing is necessary.
|
// additional sewing is necessary.
|
||||||
if (!has_shared_edges) {
|
if (!has_shared_edges) {
|
||||||
|
|||||||
@@ -240,18 +240,12 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcExtrudedAreaSolidTapered* l, T
|
|||||||
|
|
||||||
TopoDS_Shape result = builder.Shape();
|
TopoDS_Shape result = builder.Shape();
|
||||||
|
|
||||||
BRepOffsetAPI_Sewing sewer;
|
TopTools_ListOfShape li;
|
||||||
sewer.SetTolerance(getValue(GV_PRECISION));
|
shape_to_face_list(result, li);
|
||||||
sewer.SetMaxTolerance(getValue(GV_PRECISION));
|
li.Append(BRepBuilderAPI_MakeFace(w1).Face().Reversed());
|
||||||
sewer.SetMinTolerance(getValue(GV_PRECISION));
|
li.Append(BRepBuilderAPI_MakeFace(w2).Face().Moved(end_profile));
|
||||||
|
|
||||||
sewer.Add(result);
|
create_solid_from_faces(li, result, true);
|
||||||
sewer.Add(BRepBuilderAPI_MakeFace(w1).Face());
|
|
||||||
sewer.Add(BRepBuilderAPI_MakeFace(w2).Face().Moved(end_profile));
|
|
||||||
|
|
||||||
sewer.Perform();
|
|
||||||
|
|
||||||
result = sewer.SewedShape();
|
|
||||||
|
|
||||||
// @todo ugly hack
|
// @todo ugly hack
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user