mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
Wrap more classes into ifcopenshell:: namespace
This commit is contained in:
@@ -68,7 +68,7 @@ ifcopenshell::geom::conversion_result_shape* ifcopenshell::geom::open_cascade_sh
|
||||
return new open_cascade_shape(shape_);
|
||||
}
|
||||
|
||||
void ifcopenshell::geom::open_cascade_shape::Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ::logger& logger) const {
|
||||
void ifcopenshell::geom::open_cascade_shape::Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger) const {
|
||||
|
||||
// @todo remove duplication with open_cascade_kernel::convert(const taxonomy::matrix4::ptr matrix, gp_GTrsf& trsf);
|
||||
// above can be static?
|
||||
@@ -108,7 +108,7 @@ void ifcopenshell::geom::open_cascade_shape::Triangulate(ifcopenshell::geom::set
|
||||
try {
|
||||
BRepMesh_IncrementalMesh(shape_, settings.get<settings::MesherLinearDeflection>().get(), false, settings.get<settings::MesherAngularDeflection>().get());
|
||||
} catch (...) {
|
||||
::logger::root().message(::logger::LOG_ERROR, "GEO", 183, "Failed to triangulate shape");
|
||||
ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "GEO", 183, "Failed to triangulate shape");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ void ifcopenshell::geom::open_cascade_shape::Triangulate(ifcopenshell::geom::set
|
||||
opencascade::handle<Poly_Triangulation> tri = BRep_Tool::Triangulation(face, loc);
|
||||
|
||||
if (tri.IsNull()) {
|
||||
::logger::root().message(::logger::LOG_ERROR, "GEO", 184, "Triangulation missing for face");
|
||||
ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "GEO", 184, "Triangulation missing for face");
|
||||
} else {
|
||||
// Keep track of the number of times an edge is used
|
||||
// Manifold edges (i.e. edges used twice) are deemed invisible
|
||||
@@ -640,7 +640,7 @@ namespace {
|
||||
try {
|
||||
BRepMesh_IncrementalMesh(s, tol);
|
||||
} catch (...) {
|
||||
::logger::root().message(::logger::LOG_ERROR, "GEO", 186, "Failed to triangulate shape");
|
||||
ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "GEO", 186, "Failed to triangulate shape");
|
||||
return;
|
||||
}
|
||||
meshed = true;
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace ifcopenshell {
|
||||
operator const TopoDS_Shape& ();
|
||||
virtual std::string_view backend_id() const;
|
||||
|
||||
virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ::logger& logger = ::logger::root()) const;
|
||||
virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const;
|
||||
virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const;
|
||||
|
||||
virtual ifcopenshell::geom::conversion_result_shape* clone() const;
|
||||
|
||||
@@ -190,7 +190,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_openings(const express::ba
|
||||
const auto& m = it3->Placement()->ccomponents();
|
||||
// @todo
|
||||
// if (entity_shape_gtrsf.Form() == gp_Other) {
|
||||
// ::logger::root().message(::logger::LOG_WARNING, "Applying non uniform transformation to:", entity);
|
||||
// ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_WARNING, "Applying non uniform transformation to:", entity);
|
||||
// }
|
||||
gp_Trsf entity_shape_gtrsf;
|
||||
entity_shape_gtrsf.SetValues(
|
||||
@@ -217,7 +217,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_openings(const express::ba
|
||||
if (util::boolean_operation(bst, result, opening_list, BOPAlgo_CUT, intermediate_result)) {
|
||||
result = intermediate_result;
|
||||
} else {
|
||||
logger_.message(::logger::LOG_ERROR, "GEO", 192, "Opening subtraction failed for " + boost::lexical_cast<std::string>(std::distance(jt, it)) + " openings", entity);
|
||||
logger_.message(ifcopenshell::logger::LOG_ERROR, "GEO", 192, "Opening subtraction failed for " + boost::lexical_cast<std::string>(std::distance(jt, it)) + " openings", entity);
|
||||
}
|
||||
|
||||
jt = it;
|
||||
@@ -417,7 +417,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// }
|
||||
//
|
||||
// if (!success) {
|
||||
// ::logger::root().error("Failed processing layerset");
|
||||
// ifcopenshell::logger::root().error("Failed processing layerset");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -445,7 +445,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// }
|
||||
// }
|
||||
// if (some_items_without_style) {
|
||||
// ::logger::root().warning("No material and surface styles for:", product);
|
||||
// ifcopenshell::logger::root().warning("No material and surface styles for:", product);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
@@ -472,7 +472,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// parent_id = parent_object->data().id();
|
||||
// }
|
||||
// } catch (const std::exception& e) {
|
||||
// ::logger::root().error(e);
|
||||
// ifcopenshell::logger::root().error(e);
|
||||
// }
|
||||
//
|
||||
// const std::string name = product->Name().value_or("");
|
||||
@@ -484,9 +484,9 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// convert(product->ObjectPlacement(), trsf);
|
||||
// }
|
||||
// } catch (const std::exception& e) {
|
||||
// ::logger::root().error(e);
|
||||
// ifcopenshell::logger::root().error(e);
|
||||
// } catch (...) {
|
||||
// ::logger::root().error("Failed to construct placement");
|
||||
// ifcopenshell::logger::root().error("Failed to construct placement");
|
||||
// }
|
||||
//
|
||||
// // Does the IfcElement have any IfcOpenings?
|
||||
@@ -507,10 +507,10 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// try {
|
||||
// convert_openings(product, openings, shapes, trsf, opened_shapes);
|
||||
// } catch (const std::exception& e) {
|
||||
// ::logger::root().message(::logger::LOG_ERROR, std::string("error processing openings for: ") + e.what() + ":", product);
|
||||
// ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, std::string("error processing openings for: ") + e.what() + ":", product);
|
||||
// caught_error = true;
|
||||
// } catch (...) {
|
||||
// ::logger::root().message(::logger::LOG_ERROR, "error processing openings for:", product);
|
||||
// ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "error processing openings for:", product);
|
||||
// }
|
||||
//
|
||||
// if (caught_error && opened_shapes.size() < shapes.size()) {
|
||||
@@ -575,12 +575,12 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// if (elem->geometry().calculate_surface_area(a_calc)) {
|
||||
// double diff = std::abs(a_calc - a_file);
|
||||
// if (diff / std::sqrt(a_file) > getValue(GV_PRECISION)) {
|
||||
// ::logger::root().error("Validation of surface area failed for:", product);
|
||||
// ifcopenshell::logger::root().error("Validation of surface area failed for:", product);
|
||||
// } else {
|
||||
// ::logger::root().notice("Validation of surface area succeeded for:", product);
|
||||
// ifcopenshell::logger::root().notice("Validation of surface area succeeded for:", product);
|
||||
// }
|
||||
// } else {
|
||||
// ::logger::root().error("Validation of surface area failed for:", product);
|
||||
// ifcopenshell::logger::root().error("Validation of surface area failed for:", product);
|
||||
// }
|
||||
// } else if (q->as<IfcSchema::IfcQuantityVolume>() && q->Name() == "Volume") {
|
||||
// double v_calc;
|
||||
@@ -588,12 +588,12 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// if (elem->geometry().calculate_volume(v_calc)) {
|
||||
// double diff = std::abs(v_calc - v_file);
|
||||
// if (diff / std::sqrt(v_file) > getValue(GV_PRECISION)) {
|
||||
// ::logger::root().error("Validation of volume failed for:", product);
|
||||
// ifcopenshell::logger::root().error("Validation of volume failed for:", product);
|
||||
// } else {
|
||||
// ::logger::root().notice("Validation of volume succeeded for:", product);
|
||||
// ifcopenshell::logger::root().notice("Validation of volume succeeded for:", product);
|
||||
// }
|
||||
// } else {
|
||||
// ::logger::root().error("Validation of volume failed for:", product);
|
||||
// ifcopenshell::logger::root().error("Validation of volume failed for:", product);
|
||||
// }
|
||||
// } else if (q->as<IfcSchema::IfcPhysicalComplexQuantity>() && q->Name() == "Shape Validation Properties") {
|
||||
// auto qs2 = q->as<IfcSchema::IfcPhysicalComplexQuantity>()->HasQuantities();
|
||||
@@ -612,9 +612,9 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// }
|
||||
// }
|
||||
// if (!all_succeeded) {
|
||||
// ::logger::root().error("Validation of surface genus failed for:", product);
|
||||
// ifcopenshell::logger::root().error("Validation of surface genus failed for:", product);
|
||||
// } else {
|
||||
// ::logger::root().notice("Validation of surface genus succeeded for:", product);
|
||||
// ifcopenshell::logger::root().notice("Validation of surface genus succeeded for:", product);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -646,7 +646,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// }
|
||||
// }
|
||||
// } catch (const ifcopenshell::exception& e) {
|
||||
// ::logger::root().error(e);
|
||||
// ifcopenshell::logger::root().error(e);
|
||||
// // @todo reset representation_mapped_to to zero?
|
||||
// }
|
||||
// return representation_mapped_to;
|
||||
@@ -670,15 +670,15 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// IfcSchema::IfcRepresentationMap::list::ptr maps = representation->RepresentationMap();
|
||||
//
|
||||
// if (products->size() && maps->size()) {
|
||||
// ::logger::root().warning("Representation used by IfcRepresentationMap and IfcProductDefinitionShape", representation);
|
||||
// ifcopenshell::logger::root().warning("Representation used by IfcRepresentationMap and IfcProductDefinitionShape", representation);
|
||||
// }
|
||||
//
|
||||
// if (prodreps->size() > 1) {
|
||||
// ::logger::root().warning("Multiple IfcProductDefinitionShapes for representation", representation);
|
||||
// ifcopenshell::logger::root().warning("Multiple IfcProductDefinitionShapes for representation", representation);
|
||||
// }
|
||||
//
|
||||
// if (maps->size() > 1) {
|
||||
// ::logger::root().warning("Multiple IfcRepresentationMaps for representation", representation);
|
||||
// ifcopenshell::logger::root().warning("Multiple IfcRepresentationMaps for representation", representation);
|
||||
// }
|
||||
//
|
||||
// if (maps->size() == 1) {
|
||||
@@ -721,7 +721,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// parent_id = parent_object->data().id();
|
||||
// }
|
||||
// } catch (const std::exception& e) {
|
||||
// ::logger::root().error(e);
|
||||
// ifcopenshell::logger::root().error(e);
|
||||
// }
|
||||
//
|
||||
// const std::string name = product->Name().value_or("");
|
||||
@@ -733,9 +733,9 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// convert(product->ObjectPlacement(), trsf);
|
||||
// }
|
||||
// } catch (const std::exception& e) {
|
||||
// ::logger::root().error(e);
|
||||
// ifcopenshell::logger::root().error(e);
|
||||
// } catch (...) {
|
||||
// ::logger::root().error("Failed to construct placement");
|
||||
// ifcopenshell::logger::root().error("Failed to construct placement");
|
||||
// }
|
||||
//
|
||||
// std::string context_string = "";
|
||||
@@ -937,7 +937,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// // range. It's only a safeguard though, so can probably be approximated.
|
||||
// const double axis_length = own_axis_start.Distance(own_axis_end);
|
||||
// if (length_required > axis_length) {
|
||||
// ::logger::root().warning("The wall axis is not long enough to accommodate the fold points");
|
||||
// ifcopenshell::logger::root().warning("The wall axis is not long enough to accommodate the fold points");
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
@@ -957,7 +957,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// gp_Trsf other;
|
||||
// if (other_wall->ObjectPlacement()) {
|
||||
// if (!convert(other_wall->ObjectPlacement(), other)) {
|
||||
// ::logger::root().error("Failed to convert placement", other_wall);
|
||||
// ifcopenshell::logger::root().error("Failed to convert placement", other_wall);
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
@@ -965,7 +965,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// IfcSchema::IfcRepresentation* axis_representation = find_representation(other_wall, "Axis");
|
||||
//
|
||||
// if (!axis_representation) {
|
||||
// ::logger::root().warning("Joined wall has no axis representation", other_wall);
|
||||
// ifcopenshell::logger::root().warning("Joined wall has no axis representation", other_wall);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
@@ -1059,7 +1059,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// Vs1.Cross(Vs2);
|
||||
//
|
||||
// if (Vs1.IsNormal(Vc, 1.e-5)) {
|
||||
// ::logger::root().warning("Connected walls are parallel");
|
||||
// ifcopenshell::logger::root().warning("Connected walls are parallel");
|
||||
// parallel = true;
|
||||
// } else if (w < axis_u1 || w > axis_u2) {
|
||||
// point_outside_param_range = p;
|
||||
@@ -1394,7 +1394,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// Handle_Geom_Circle axis_line = Handle_Geom_Circle::DownCast(axis_curve);
|
||||
// reference_surface = new Geom_CylindricalSurface(axis_li->Position(), axis_line->Radius());
|
||||
// } else {
|
||||
// ::logger::root().message(::logger::LOG_ERROR, "Unsupported underlying curve of Axis representation:", product);
|
||||
// ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "Unsupported underlying curve of Axis representation:", product);
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
|
||||
@@ -110,13 +110,13 @@ private:
|
||||
|
||||
double precision_;
|
||||
public:
|
||||
open_cascade_kernel(const ifcopenshell::geom::settings& settings, ::logger& logger = ::logger::root())
|
||||
open_cascade_kernel(const ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root())
|
||||
: abstract_kernel("opencascade", settings, logger)
|
||||
, faceset_helper_(nullptr)
|
||||
, precision_(settings.get<ifcopenshell::geom::settings::Precision>().get())
|
||||
{}
|
||||
|
||||
virtual abstract_kernel* clone(::logger& logger) const {
|
||||
virtual abstract_kernel* clone(ifcopenshell::logger& logger) const {
|
||||
return new open_cascade_kernel(settings(), logger);
|
||||
}
|
||||
|
||||
|
||||
@@ -714,12 +714,12 @@ bool ifcopenshell::geom::util::create_solid_from_faces(const NCollection_List<To
|
||||
valid_shell &= util::count(shape, TopAbs_SHELL) > 0;
|
||||
} catch (const Standard_Failure& e) {
|
||||
if (e.GetMessageString() && strlen(e.GetMessageString())) {
|
||||
::logger::root().error("GEO", 106, e.GetMessageString());
|
||||
ifcopenshell::logger::root().error("GEO", 106, e.GetMessageString());
|
||||
} else {
|
||||
::logger::root().error("GEO", 107, "Unknown error sewing shell");
|
||||
ifcopenshell::logger::root().error("GEO", 107, "Unknown error sewing shell");
|
||||
}
|
||||
} catch (...) {
|
||||
::logger::root().error("GEO", 108, "Unknown error sewing shell");
|
||||
ifcopenshell::logger::root().error("GEO", 108, "Unknown error sewing shell");
|
||||
}
|
||||
|
||||
if (valid_shell) {
|
||||
@@ -747,22 +747,22 @@ bool ifcopenshell::geom::util::create_solid_from_faces(const NCollection_List<To
|
||||
}
|
||||
} catch (const Standard_Failure& e) {
|
||||
if (e.GetMessageString() && strlen(e.GetMessageString())) {
|
||||
::logger::root().error("GEO", 109, e.GetMessageString());
|
||||
ifcopenshell::logger::root().error("GEO", 109, e.GetMessageString());
|
||||
} else {
|
||||
::logger::root().error("GEO", 110, "Unknown error classifying solid");
|
||||
ifcopenshell::logger::root().error("GEO", 110, "Unknown error classifying solid");
|
||||
}
|
||||
} catch (...) {
|
||||
::logger::root().error("GEO", 111, "Unknown error classifying solid");
|
||||
ifcopenshell::logger::root().error("GEO", 111, "Unknown error classifying solid");
|
||||
}
|
||||
}
|
||||
} catch (const Standard_Failure& e) {
|
||||
if (e.GetMessageString() && strlen(e.GetMessageString())) {
|
||||
::logger::root().error("GEO", 112, e.GetMessageString());
|
||||
ifcopenshell::logger::root().error("GEO", 112, e.GetMessageString());
|
||||
} else {
|
||||
::logger::root().error("GEO", 113, "Unknown error creating solid");
|
||||
ifcopenshell::logger::root().error("GEO", 113, "Unknown error creating solid");
|
||||
}
|
||||
} catch (...) {
|
||||
::logger::root().error("GEO", 114, "Unknown error creating solid");
|
||||
ifcopenshell::logger::root().error("GEO", 114, "Unknown error creating solid");
|
||||
}
|
||||
|
||||
if (complete_shape.IsNull()) {
|
||||
@@ -774,7 +774,7 @@ bool ifcopenshell::geom::util::create_solid_from_faces(const NCollection_List<To
|
||||
B.MakeCompound(C);
|
||||
B.Add(C, complete_shape);
|
||||
complete_shape = C;
|
||||
::logger::root().warning("GEO", 115, "Multiple components in IfcConnectedFaceSet");
|
||||
ifcopenshell::logger::root().warning("GEO", 115, "Multiple components in IfcConnectedFaceSet");
|
||||
}
|
||||
B.Add(complete_shape, result_shape);
|
||||
}
|
||||
@@ -789,7 +789,7 @@ bool ifcopenshell::geom::util::create_solid_from_faces(const NCollection_List<To
|
||||
B.MakeCompound(C);
|
||||
B.Add(C, complete_shape);
|
||||
complete_shape = C;
|
||||
::logger::root().warning("GEO", 116, "Loose faces in IfcConnectedFaceSet");
|
||||
ifcopenshell::logger::root().warning("GEO", 116, "Loose faces in IfcConnectedFaceSet");
|
||||
}
|
||||
B.Add(complete_shape, loose_faces.Current());
|
||||
}
|
||||
@@ -797,7 +797,7 @@ bool ifcopenshell::geom::util::create_solid_from_faces(const NCollection_List<To
|
||||
shape = complete_shape;
|
||||
|
||||
} else {
|
||||
::logger::root().error("GEO", 117, "Failed to sew faceset");
|
||||
ifcopenshell::logger::root().error("GEO", 117, "Failed to sew faceset");
|
||||
}
|
||||
|
||||
return valid_shell;
|
||||
@@ -901,7 +901,7 @@ bool ifcopenshell::geom::util::validate_shape(const TopoDS_Shape& s) {
|
||||
|
||||
dump(s);
|
||||
|
||||
::logger::root().warning("GEO", 118, str.str());
|
||||
ifcopenshell::logger::root().warning("GEO", 118, str.str());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ bool open_cascade_kernel::convert_impl(const taxonomy::boolean_result::ptr br, c
|
||||
|
||||
const double first_operand_volume = util::shape_volume(a);
|
||||
if (first_operand_volume <= ALMOST_ZERO) {
|
||||
logger_.message(::logger::LOG_WARNING, "GEO", 119, "Empty solid for:", c->instance);
|
||||
logger_.message(ifcopenshell::logger::LOG_WARNING, "GEO", 119, "Empty solid for:", c->instance);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -139,7 +139,7 @@ bool open_cascade_kernel::convert_impl(const taxonomy::boolean_result::ptr br, c
|
||||
// #2665 we also set a precision-independent threshold, because in the boolean op routine
|
||||
// the working fuzziness might still be increased.
|
||||
if (d < tol * 20. || d < 0.00002) {
|
||||
logger_.message(::logger::LOG_WARNING, "GEO", 121, "Halfspace subtraction yields unchanged volume:", c->instance);
|
||||
logger_.message(ifcopenshell::logger::LOG_WARNING, "GEO", 121, "Halfspace subtraction yields unchanged volume:", c->instance);
|
||||
continue;
|
||||
} else {
|
||||
S = result;
|
||||
|
||||
@@ -405,7 +405,7 @@ bool ifcopenshell::geom::util::is_extrusion(const gp_Vec & v, const TopoDS_Shape
|
||||
return true;
|
||||
}
|
||||
|
||||
int ifcopenshell::geom::util::eliminate_narrow_operands(double prec, const NCollection_List<TopoDS_Shape>& bs, NCollection_List<TopoDS_Shape> & c, ::logger& logger) {
|
||||
int ifcopenshell::geom::util::eliminate_narrow_operands(double prec, const NCollection_List<TopoDS_Shape>& bs, NCollection_List<TopoDS_Shape> & c, ifcopenshell::logger& logger) {
|
||||
int N = 0;
|
||||
NCollection_List<TopoDS_Shape>::Iterator it(bs);
|
||||
for (; it.More(); it.Next()) {
|
||||
@@ -573,7 +573,7 @@ int ifcopenshell::geom::util::eliminate_touching_operands(double prec, const Top
|
||||
return N;
|
||||
}
|
||||
|
||||
bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS_Shape & a_input, const NCollection_List<TopoDS_Shape> & b_input, TopoDS_Shape & result, double eps, ::logger& logger) {
|
||||
bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS_Shape & a_input, const NCollection_List<TopoDS_Shape> & b_input, TopoDS_Shape & result, double eps, ifcopenshell::logger& logger) {
|
||||
ifcopenshell::geom::impl::tree<int> edge_tree;
|
||||
|
||||
NCollection_List<TopoDS_Shape> ab_input = b_input;
|
||||
@@ -885,7 +885,7 @@ bool ifcopenshell::geom::util::boolean_operation(const boolean_settings& setting
|
||||
a = unify(a_input, fuzziness * 1000.);
|
||||
|
||||
settings.log().message(
|
||||
::logger::LOG_DEBUG, "GEO", 127,
|
||||
ifcopenshell::logger::LOG_DEBUG, "GEO", 127,
|
||||
"Simplified operand A from "s +
|
||||
std::to_string(count(a_input, TopAbs_FACE)) +
|
||||
" to "s +
|
||||
@@ -897,7 +897,7 @@ bool ifcopenshell::geom::util::boolean_operation(const boolean_settings& setting
|
||||
for (; it.More(); it.Next()) {
|
||||
b.Append(unify(it.Value(), fuzziness));
|
||||
settings.log().message(
|
||||
::logger::LOG_DEBUG, "GEO", 128,
|
||||
ifcopenshell::logger::LOG_DEBUG, "GEO", 128,
|
||||
"Simplified operand B from "s +
|
||||
std::to_string(count(it.Value(), TopAbs_FACE)) +
|
||||
" to "s +
|
||||
@@ -965,7 +965,7 @@ bool ifcopenshell::geom::util::boolean_operation(const boolean_settings& setting
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!is_2d && ::logger::LOG_NOTICE >= settings.log().verbosity()) {
|
||||
if (!is_2d && ifcopenshell::logger::LOG_NOTICE >= settings.log().verbosity()) {
|
||||
PERF("preliminary manifoldness check");
|
||||
|
||||
if (!a.IsNull()) {
|
||||
|
||||
@@ -89,17 +89,17 @@ namespace ifcopenshell::geom {
|
||||
|
||||
IFC_GEOMLIBRARY_API int eliminate_touching_operands(double prec, const TopoDS_Shape& a, const NCollection_List<TopoDS_Shape>& bs, NCollection_List<TopoDS_Shape>& c);
|
||||
|
||||
IFC_GEOMLIBRARY_API int eliminate_narrow_operands(double prec, const NCollection_List<TopoDS_Shape>& bs, NCollection_List<TopoDS_Shape> & c, ::logger& logger = ::logger::root());
|
||||
IFC_GEOMLIBRARY_API int eliminate_narrow_operands(double prec, const NCollection_List<TopoDS_Shape>& bs, NCollection_List<TopoDS_Shape> & c, ifcopenshell::logger& logger = ifcopenshell::logger::root());
|
||||
|
||||
IFC_GEOMLIBRARY_API bool boolean_subtraction_2d_using_builder(const TopoDS_Shape& a_input, const NCollection_List<TopoDS_Shape>& b_input, TopoDS_Shape& result, double eps, ::logger& logger = ::logger::root());
|
||||
IFC_GEOMLIBRARY_API bool boolean_subtraction_2d_using_builder(const TopoDS_Shape& a_input, const NCollection_List<TopoDS_Shape>& b_input, TopoDS_Shape& result, double eps, ifcopenshell::logger& logger = ifcopenshell::logger::root());
|
||||
|
||||
struct boolean_settings {
|
||||
bool debug, attempt_2d;
|
||||
double precision;
|
||||
// Set by callers that carry a per-conversion logger (e.g. kernels deriving
|
||||
// from abstract_kernel). Falls back to the global ::logger::root() singleton.
|
||||
::logger* logger = nullptr;
|
||||
::logger& log() const { return logger ? *logger : ::logger::root(); }
|
||||
// from abstract_kernel). Falls back to the global ifcopenshell::logger::root() singleton.
|
||||
ifcopenshell::logger* logger = nullptr;
|
||||
ifcopenshell::logger& log() const { return logger ? *logger : ifcopenshell::logger::root(); }
|
||||
};
|
||||
|
||||
IFC_GEOMLIBRARY_API bool boolean_operation(const boolean_settings& settings, const TopoDS_Shape&, const NCollection_List<TopoDS_Shape>&, BOPAlgo_Operation, TopoDS_Shape&, double fuzziness = -1.);
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#define GU_CULLING_EPSILON_RAY_TRIANGLE FLT_EPSILON*FLT_EPSILON
|
||||
#define PX_MAX_F32 3.4028234663852885981170418348452e+38F
|
||||
|
||||
namespace ifcopenshell::geom {
|
||||
|
||||
typedef uint32_t px_u32;
|
||||
|
||||
// Why can't I use std::clamp?
|
||||
@@ -588,3 +590,5 @@ bool trianglesIntersect(const gp_Vec& a1, const gp_Vec& b1, const gp_Vec& c1, co
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ifcopenshell::geom
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "../ifc_geomlibrary_api.h"
|
||||
|
||||
namespace ifcopenshell::geom {
|
||||
|
||||
struct IFC_GEOMLIBRARY_API ray {
|
||||
float origin[3];
|
||||
float dir[3];
|
||||
@@ -29,3 +31,5 @@ IFC_GEOMLIBRARY_API void edgeEdgeDist(gp_Vec& x, gp_Vec& y, // closest points
|
||||
IFC_GEOMLIBRARY_API double distanceTriangleTriangleSquared(gp_Vec& cp, gp_Vec& cq, const std::array<gp_Vec, 3> p, const std::array<gp_Vec, 3> q);
|
||||
|
||||
IFC_GEOMLIBRARY_API bool trianglesIntersect(const gp_Vec& a1, const gp_Vec& b1, const gp_Vec& c1, const gp_Vec& a2, const gp_Vec& b2, const gp_Vec& c2/*, Segment* intersection*/, gp_Vec& int1, gp_Vec& int2, bool ignoreCoplanar);
|
||||
|
||||
} // namespace ifcopenshell::geom
|
||||
|
||||
@@ -9,7 +9,7 @@ bool open_cascade_kernel::convert(const taxonomy::extrusion::ptr extrusion, Topo
|
||||
const double& height = extrusion->depth;
|
||||
|
||||
if (height < settings_.get<settings::Precision>().get()) {
|
||||
::logger::root().error("GEO", 89, "Non-positive extrusion height encountered for:", extrusion->instance);
|
||||
ifcopenshell::logger::root().error("GEO", 89, "Non-positive extrusion height encountered for:", extrusion->instance);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ bool open_cascade_kernel::convert(const taxonomy::extrusion::ptr extrusion, Topo
|
||||
// move the TopoDS_Shape, but obviously not both.
|
||||
gp_GTrsf gtrsf;
|
||||
if (!convert(&extrusion->matrix, gtrsf)) {
|
||||
::logger::root().error("Unable to move extrusion");
|
||||
ifcopenshell::logger::root().error("Unable to move extrusion");
|
||||
}
|
||||
auto trsf = gtrsf.Trsf();
|
||||
*/
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace {
|
||||
} else if (crv_or_wire.index() == 2) {
|
||||
// @todo
|
||||
const double precision_ = 1.e-5;
|
||||
::logger::root().warning("GEO", 156, "Approximating BasisCurve due to possible discontinuities", i->instance);
|
||||
ifcopenshell::logger::root().warning("GEO", 156, "Approximating BasisCurve due to possible discontinuities", i->instance);
|
||||
const auto& w = std::get<TopoDS_Wire>(crv_or_wire);
|
||||
#if OCC_VERSION_HEX < 0x70600
|
||||
BRepAdaptor_CompCurve cc(w, true);
|
||||
@@ -294,12 +294,12 @@ bool open_cascade_kernel::convert(const taxonomy::face::ptr face, TopoDS_Shape&
|
||||
// the face will still be processed as long as there are no holes. A compound of faces
|
||||
// is returned in that case.
|
||||
if (num_bounds > 1 && num_outer_bounds > 1 && num_bounds != num_outer_bounds) {
|
||||
::logger::root().message(::logger::LOG_ERROR, "GEO", 157, "Invalid configuration of boundaries for:", face->instance);
|
||||
ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "GEO", 157, "Invalid configuration of boundaries for:", face->instance);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (num_outer_bounds > 1) {
|
||||
::logger::root().message(::logger::LOG_WARNING, "GEO", 158, "Multiple outer boundaries for:", face->instance);
|
||||
ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_WARNING, "GEO", 158, "Multiple outer boundaries for:", face->instance);
|
||||
fd.all_outer() = true;
|
||||
}
|
||||
|
||||
@@ -320,11 +320,11 @@ bool open_cascade_kernel::convert(const taxonomy::face::ptr face, TopoDS_Shape&
|
||||
TopoDS_Wire wire;
|
||||
if (faceset_helper_ && bound->is_polyhedron()) {
|
||||
if (!faceset_helper_->wire(bound, wire)) {
|
||||
::logger::root().message(::logger::LOG_WARNING, "GEO", 159, "Face boundary loop not included", bound->instance);
|
||||
ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_WARNING, "GEO", 159, "Face boundary loop not included", bound->instance);
|
||||
continue;
|
||||
}
|
||||
} else if (!convert(bound, wire)) {
|
||||
::logger::root().message(::logger::LOG_ERROR, "GEO", 160, "Failed to process face boundary loop", bound->instance);
|
||||
ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "GEO", 160, "Failed to process face boundary loop", bound->instance);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ bool open_cascade_kernel::convert(const taxonomy::face::ptr face, TopoDS_Shape&
|
||||
};
|
||||
NCollection_List<TopoDS_Shape> results;
|
||||
if (settings.use_wire_intersection_check && util::wire_intersections(wire, results, settings)) {
|
||||
::logger::root().warning("GEO", 161, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
|
||||
ifcopenshell::logger::root().warning("GEO", 161, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
|
||||
util::select_largest(results, wire);
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ bool open_cascade_kernel::convert(const taxonomy::face::ptr face, TopoDS_Shape&
|
||||
}
|
||||
|
||||
if (fd.wires().empty()) {
|
||||
::logger::root().warning("GEO", 162, "Face with no boundaries", face->instance);
|
||||
ifcopenshell::logger::root().warning("GEO", 162, "Face with no boundaries", face->instance);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ bool open_cascade_kernel::convert(const taxonomy::face::ptr face, TopoDS_Shape&
|
||||
|
||||
if (fd.surface().IsNull()) {
|
||||
// The set of wires is triangulated in case no surface can be found
|
||||
::logger::root().message(::logger::LOG_WARNING, "GEO", 163, "Triangulating face boundaries for face", face->instance);
|
||||
ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_WARNING, "GEO", 163, "Triangulating face boundaries for face", face->instance);
|
||||
|
||||
if (fd.all_outer()) {
|
||||
for (const auto& w : fd.wires()) {
|
||||
@@ -483,7 +483,7 @@ bool open_cascade_kernel::convert(const taxonomy::face::ptr face, TopoDS_Shape&
|
||||
kt.Value().Original().ToUTF8CString(c);
|
||||
std::string message = c;
|
||||
delete[] c;
|
||||
::logger::root().warning("GEO", 164, message, face->instance);
|
||||
ifcopenshell::logger::root().warning("GEO", 164, message, face->instance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,17 +495,17 @@ bool open_cascade_kernel::convert(const taxonomy::face::ptr face, TopoDS_Shape&
|
||||
if (it.Value().ShapeType() == TopAbs_FACE) {
|
||||
face_list.Append(it.Value());
|
||||
} else {
|
||||
::logger::root().error("UNS", 7, "Unsupported output from face healing");
|
||||
ifcopenshell::logger::root().error("UNS", 7, "Unsupported output from face healing");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
::logger::root().error("UNS", 8, "Unsupported output from face healing");
|
||||
ifcopenshell::logger::root().error("UNS", 8, "Unsupported output from face healing");
|
||||
}
|
||||
} else {
|
||||
face_list.Append(f);
|
||||
}
|
||||
} else {
|
||||
::logger::root().error("GEO", 165, "Internal error in face creation");
|
||||
ifcopenshell::logger::root().error("GEO", 165, "Internal error in face creation");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -546,14 +546,14 @@ bool open_cascade_kernel::convert(const taxonomy::face::ptr face, TopoDS_Shape&
|
||||
delete[] c;
|
||||
#if OCC_VERSION_MAJOR==7 && OCC_VERSION_MINOR >= 7
|
||||
if (!reversed_surface && !fd.surface().IsNull() && fd.surface()->IsUPeriodic() && message == "Unknown message invoked with the keyword FixAdvFace.FixOrientation.MSG0") {
|
||||
::logger::root().notice("GEO", 166, "Detected reversed wire, reattempting with reversed basis surface");
|
||||
ifcopenshell::logger::root().notice("GEO", 166, "Detected reversed wire, reattempting with reversed basis surface");
|
||||
TopoDS_Face reversed_result;
|
||||
convert(face, reversed_result, true);
|
||||
result = reversed_result;
|
||||
return true;
|
||||
} else
|
||||
#endif
|
||||
::logger::root().warning("GEO", 167, message, face->instance);
|
||||
ifcopenshell::logger::root().warning("GEO", 167, message, face->instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ ifcopenshell::geom::open_cascade_kernel::faceset_helper::faceset_helper(
|
||||
auto num_retained = std::count(retained.begin(), retained.end(), true);
|
||||
|
||||
if (unique.size() != num_retained) {
|
||||
::logger::root().notice("GEO", 168, "Collapsed vertices from " + std::to_string(pnts.size()) + " (" + std::to_string(unique.size()) + " unique) to " + std::to_string(num_retained));
|
||||
ifcopenshell::logger::root().notice("GEO", 168, "Collapsed vertices from " + std::to_string(pnts.size()) + " (" + std::to_string(unique.size()) + " unique) to " + std::to_string(num_retained));
|
||||
}
|
||||
|
||||
typedef std::array<int, 2> edge_t;
|
||||
@@ -206,7 +206,7 @@ ifcopenshell::geom::open_cascade_kernel::faceset_helper::faceset_helper(
|
||||
}
|
||||
|
||||
if (duplicates_.size() || loops_removed || (non_manifold && shell->closed.value_or(false))) {
|
||||
::logger::root().warning("GEO", 169, boost::lexical_cast<std::string>(duplicate_faces) + " duplicate faces removed, " + boost::lexical_cast<std::string>(loops_removed) + " degenerate loops eliminated and " + boost::lexical_cast<std::string>(non_manifold) + " non-manifold edges");
|
||||
ifcopenshell::logger::root().warning("GEO", 169, boost::lexical_cast<std::string>(duplicate_faces) + " duplicate faces removed, " + boost::lexical_cast<std::string>(loops_removed) + " degenerate loops eliminated and " + boost::lexical_cast<std::string>(non_manifold) + " non-manifold edges");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ bool ifcopenshell::geom::open_cascade_kernel::faceset_helper::wires(const ifcope
|
||||
!kernel_->settings().get<ifcopenshell::geom::settings::NoWireIntersectionTolerance>().get(), 0.,
|
||||
kernel_->settings().get<ifcopenshell::geom::settings::Precision>().get()}))
|
||||
{
|
||||
::logger::root().warning("GEO", 170, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
|
||||
ifcopenshell::logger::root().warning("GEO", 170, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
|
||||
non_manifold_ = true;
|
||||
wires = results;
|
||||
} else {
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
::logger::root().error("GEO", 171, "Unable to map layer geometry to material index");
|
||||
ifcopenshell::logger::root().error("GEO", 171, "Unable to map layer geometry to material index");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -237,7 +237,7 @@ bool ifcopenshell::geom::util::apply_folded_layerset(const conversion_results& i
|
||||
if (s.ShapeType() == TopAbs_SHELL) {
|
||||
shells.Append(TopoDS::Shell(s));
|
||||
} else {
|
||||
::logger::root().error("GEO", 172, "Expected shell type in layerset processing");
|
||||
ifcopenshell::logger::root().error("GEO", 172, "Expected shell type in layerset processing");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -436,12 +436,12 @@ bool ifcopenshell::geom::util::split_solid_by_shell(const TopoDS_Shape& input, c
|
||||
}
|
||||
} catch (const Standard_Failure& e) {
|
||||
if (e.GetMessageString() && strlen(e.GetMessageString())) {
|
||||
::logger::root().error("GEO", 173, e.GetMessageString());
|
||||
ifcopenshell::logger::root().error("GEO", 173, e.GetMessageString());
|
||||
} else {
|
||||
::logger::root().error("GEO", 174, "Unknown error performing fixes");
|
||||
ifcopenshell::logger::root().error("GEO", 174, "Unknown error performing fixes");
|
||||
}
|
||||
} catch (...) {
|
||||
::logger::root().error("GEO", 175, "Unknown error performing fixes");
|
||||
ifcopenshell::logger::root().error("GEO", 175, "Unknown error performing fixes");
|
||||
}
|
||||
BRepCheck_Analyzer analyser(shape);
|
||||
bool is_valid = analyser.IsValid() != 0;
|
||||
@@ -451,7 +451,7 @@ bool ifcopenshell::geom::util::split_solid_by_shell(const TopoDS_Shape& input, c
|
||||
}
|
||||
|
||||
if (is_null[0] || is_null[1]) {
|
||||
::logger::root().message(::logger::LOG_ERROR, "GEO", 176, "Null result obtained from layerset slicing");
|
||||
ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "GEO", 176, "Null result obtained from layerset slicing");
|
||||
if (is_null[0] && is_null[1]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ bool open_cascade_kernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape&
|
||||
|
||||
if (non_polygonal) {
|
||||
if (loft->children.size() < 2) {
|
||||
::logger::root().error("GEO", 177, "Not enough sections to loft");
|
||||
ifcopenshell::logger::root().error("GEO", 177, "Not enough sections to loft");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ bool open_cascade_kernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape&
|
||||
auto first_wire_count = sections.front().size();
|
||||
for (auto& section : sections) {
|
||||
if (section.size() != first_wire_count) {
|
||||
::logger::root().error("GEO", 178, "Inconsistent number of wires in sections");
|
||||
ifcopenshell::logger::root().error("GEO", 178, "Inconsistent number of wires in sections");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -159,7 +159,7 @@ bool open_cascade_kernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape&
|
||||
|
||||
return true;
|
||||
} else {
|
||||
::logger::root().error("Lofting more than two sections is not supported");
|
||||
ifcopenshell::logger::root().error("Lofting more than two sections is not supported");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -275,7 +275,7 @@ bool open_cascade_kernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape&
|
||||
*/
|
||||
|
||||
if (shps.size() < 2) {
|
||||
::logger::root().error("GEO", 179, "Not enough sections to loft");
|
||||
ifcopenshell::logger::root().error("GEO", 179, "Not enough sections to loft");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace {
|
||||
} else {
|
||||
// @todo
|
||||
const double precision_ = 1.e-5;
|
||||
::logger::root().warning("GEO", 180, "Approximating BasisCurve due to possible discontinuities", e->instance);
|
||||
ifcopenshell::logger::root().warning("GEO", 180, "Approximating BasisCurve due to possible discontinuities", e->instance);
|
||||
const auto& w = std::get<TopoDS_Wire>(crv_or_wire);
|
||||
#if OCC_VERSION_HEX < 0x70600
|
||||
BRepAdaptor_CompCurve cc(w, true);
|
||||
@@ -283,7 +283,7 @@ bool open_cascade_kernel::convert(const taxonomy::loop::ptr loop, TopoDS_Wire& w
|
||||
}
|
||||
|
||||
if (converted_segments.Extent() == 0) {
|
||||
::logger::root().message(::logger::LOG_ERROR, "GEO", 181, "No segment successfully converted:", loop->instance);
|
||||
ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "GEO", 181, "No segment successfully converted:", loop->instance);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ bool open_cascade_kernel::convert(const taxonomy::loop::ptr loop, TopoDS_Wire& w
|
||||
|
||||
if (ang < 0.0314) {
|
||||
edges_to_tesselate.Add(crv1->DynamicType() == STANDARD_TYPE(Geom_Circle) ? edges.First() : edges.Last());
|
||||
::logger::root().notice("GEO", 182, "Sharp circular corner detecting, substituting with linear approximation");
|
||||
ifcopenshell::logger::root().notice("GEO", 182, "Sharp circular corner detecting, substituting with linear approximation");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ bool open_cascade_kernel::convert(const taxonomy::shell::ptr l, TopoDS_Shape& sh
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
logger_.message(::logger::LOG_WARNING, "GEO", 198, "Failed to convert face:", face->instance);
|
||||
logger_.message(ifcopenshell::logger::LOG_WARNING, "GEO", 198, "Failed to convert face:", face->instance);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ bool open_cascade_kernel::convert(const taxonomy::shell::ptr l, TopoDS_Shape& sh
|
||||
if (face_area(triangle) > min_face_area) {
|
||||
face_list.Append(triangle);
|
||||
} else {
|
||||
logger_.message(::logger::LOG_WARNING, "GEO", 199, "Degenerate face:", face->instance);
|
||||
logger_.message(ifcopenshell::logger::LOG_WARNING, "GEO", 199, "Degenerate face:", face->instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ bool open_cascade_kernel::convert(const taxonomy::shell::ptr l, TopoDS_Shape& sh
|
||||
if (face_area(occ_face) > min_face_area) {
|
||||
face_list.Append(occ_face);
|
||||
} else {
|
||||
logger_.message(::logger::LOG_WARNING, "GEO", 200, "Degenerate face:", face->instance);
|
||||
logger_.message(ifcopenshell::logger::LOG_WARNING, "GEO", 200, "Degenerate face:", face->instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ bool open_cascade_kernel::convert(const taxonomy::sweep_along_curve::ptr scs, To
|
||||
for (TopExp_Explorer exp(wire, TopAbs_VERTEX); exp.More(); exp.Next()) {
|
||||
if (pln.Distance(BRep_Tool::Pnt(TopoDS::Vertex(exp.Current()))) > ALMOST_ZERO) {
|
||||
directrix_on_plane = false;
|
||||
logger_.message(::logger::LOG_WARNING, "GEO", 202, "The Directrix does not lie on the ReferenceSurface", scs->instance);
|
||||
logger_.message(ifcopenshell::logger::LOG_WARNING, "GEO", 202, "The Directrix does not lie on the ReferenceSurface", scs->instance);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ bool ifcopenshell::geom::util::wire_to_ax(const TopoDS_Wire & wire, gp_Ax2 & dir
|
||||
Handle(Geom_Curve) crv = BRep_Tool::Curve(edge, u0, u1);
|
||||
crv->D1(u0, directrix_origin, directrix_tangent);
|
||||
} else {
|
||||
::logger::root().error("GEO", 203, "Unable to locate first edge");
|
||||
ifcopenshell::logger::root().error("GEO", 203, "Unable to locate first edge");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ void ifcopenshell::geom::util::sort_edges(const TopoDS_Wire & wire, std::vector<
|
||||
|
||||
for (int i = 1; i <= map.Extent(); ++i) {
|
||||
if (map.FindFromIndex(i).Extent() > 2) {
|
||||
::logger::root().warning("GEO", 204, "Self-intersecting Directrix");
|
||||
ifcopenshell::logger::root().warning("GEO", 204, "Self-intersecting Directrix");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,12 +117,12 @@ bool ifcopenshell::geom::util::create_edge_over_curve_with_log_messages(const op
|
||||
}
|
||||
}
|
||||
if (dmin == std::numeric_limits<double>::infinity()) {
|
||||
::logger::root().error("GEO", 205, "No extrema for point");
|
||||
ifcopenshell::logger::root().error("GEO", 205, "No extrema for point");
|
||||
} else if (dmin > eps2) {
|
||||
::logger::root().error("GEO", 206, "Distance of " + boost::lexical_cast<std::string>(std::sqrt(dmin)) + " exceeds tolerance");
|
||||
ifcopenshell::logger::root().error("GEO", 206, "Distance of " + boost::lexical_cast<std::string>(std::sqrt(dmin)) + " exceeds tolerance");
|
||||
}
|
||||
} else {
|
||||
::logger::root().error("GEO", 207, "Failed to calculate extrema for point");
|
||||
ifcopenshell::logger::root().error("GEO", 207, "Failed to calculate extrema for point");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,7 +172,7 @@ void ifcopenshell::geom::util::wire_builder::operator()(const TopoDS_Shape& a, c
|
||||
if (dist > 1000. * p_) {
|
||||
mw_.Add(w1);
|
||||
mw_.Add(BRepBuilderAPI_MakeEdge(p1, p2));
|
||||
::logger::root().warning("GEO", 208, "Added additional segment to close gap with length " + boost::lexical_cast<std::string>(dist) + " to:", inst_);
|
||||
ifcopenshell::logger::root().warning("GEO", 208, "Added additional segment to close gap with length " + boost::lexical_cast<std::string>(dist) + " to:", inst_);
|
||||
goto check;
|
||||
}
|
||||
|
||||
@@ -200,28 +200,28 @@ void ifcopenshell::geom::util::wire_builder::operator()(const TopoDS_Shape& a, c
|
||||
// Preferably adjust the segment that is linear
|
||||
if (is_line1 || (is_circle1 && !is_line2)) {
|
||||
mw_.Add(adjust(w1, w12, p2));
|
||||
::logger::root().notice("GEO", 209, "Adjusted edge end-point with distance " + boost::lexical_cast<std::string>(dist) + " on:", inst_);
|
||||
ifcopenshell::logger::root().notice("GEO", 209, "Adjusted edge end-point with distance " + boost::lexical_cast<std::string>(dist) + " on:", inst_);
|
||||
} else if ((is_line2 || is_circle2) && !last) {
|
||||
mw_.Add(w1);
|
||||
override_next_ = true;
|
||||
next_override_ = p1;
|
||||
::logger::root().notice("GEO", 210, "Adjusted edge end-point with distance " + boost::lexical_cast<std::string>(dist) + " on:", inst_);
|
||||
ifcopenshell::logger::root().notice("GEO", 210, "Adjusted edge end-point with distance " + boost::lexical_cast<std::string>(dist) + " on:", inst_);
|
||||
} else {
|
||||
// In all other cases an edge is added
|
||||
mw_.Add(w1);
|
||||
mw_.Add(BRepBuilderAPI_MakeEdge(p1, p2));
|
||||
::logger::root().warning("GEO", 211, "Added additional segment to close gap with length " + boost::lexical_cast<std::string>(dist) + " to:", inst_);
|
||||
ifcopenshell::logger::root().warning("GEO", 211, "Added additional segment to close gap with length " + boost::lexical_cast<std::string>(dist) + " to:", inst_);
|
||||
}
|
||||
} else {
|
||||
::logger::root().error("GEO", 212, "Internal error, inconsistent wire segments", inst_);
|
||||
ifcopenshell::logger::root().error("GEO", 212, "Internal error, inconsistent wire segments", inst_);
|
||||
mw_.Add(w1);
|
||||
}
|
||||
}
|
||||
|
||||
check:
|
||||
if (mw_.Error() == BRepBuilderAPI_NonManifoldWire) {
|
||||
::logger::root().error("GEO", 213, "Non-manifold curve segments:", inst_);
|
||||
ifcopenshell::logger::root().error("GEO", 213, "Non-manifold curve segments:", inst_);
|
||||
} else if (mw_.Error() == BRepBuilderAPI_DisconnectedWire) {
|
||||
::logger::root().error("GEO", 214, "Failed to join curve segments:", inst_);
|
||||
ifcopenshell::logger::root().error("GEO", 214, "Failed to join curve segments:", inst_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ bool ifcopenshell::geom::util::approximate_plane_through_wire(const TopoDS_Wire&
|
||||
// obtaining a 2d points for the Delaunay, infinity is passed here, so this
|
||||
// can't for assessing degenerativeness.
|
||||
if (v.Magnitude() < 1.e-7) {
|
||||
::logger::root().warning("GEO", 215, "Degenerate face boundary in normal estimation");
|
||||
ifcopenshell::logger::root().warning("GEO", 215, "Degenerate face boundary in normal estimation");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ ifcopenshell::geom::util::triangulate_wire_result ifcopenshell::geom::util::tria
|
||||
|
||||
auto it = mapping.find(uvnodes[k]);
|
||||
if (it == mapping.end()) {
|
||||
::logger::root().error("GEO", 216, "Internal error: unable to unproject uv-mesh");
|
||||
ifcopenshell::logger::root().error("GEO", 216, "Internal error: unable to unproject uv-mesh");
|
||||
return TRIANGULATE_WIRE_FAIL;
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ ifcopenshell::geom::util::triangulate_wire_result ifcopenshell::geom::util::tria
|
||||
}
|
||||
faces.Append(triangle_face);
|
||||
} else {
|
||||
::logger::root().error("GEO", 217, "Internal error: missing face");
|
||||
ifcopenshell::logger::root().error("GEO", 217, "Internal error: missing face");
|
||||
return TRIANGULATE_WIRE_FAIL;
|
||||
}
|
||||
}
|
||||
@@ -312,7 +312,7 @@ ifcopenshell::geom::util::triangulate_wire_result ifcopenshell::geom::util::tria
|
||||
if (!contains) {
|
||||
#endif
|
||||
// All existing edges need to exist in the new faces
|
||||
::logger::root().error("GEO", 218, "Internal error, missing edge from triangulation");
|
||||
ifcopenshell::logger::root().error("GEO", 218, "Internal error, missing edge from triangulation");
|
||||
non_manifold = true;
|
||||
}
|
||||
}
|
||||
@@ -323,7 +323,7 @@ ifcopenshell::geom::util::triangulate_wire_result ifcopenshell::geom::util::tria
|
||||
// Existing edges are boundaries with use 1
|
||||
// New edges are internal with use 2
|
||||
if (n != (mape.Contains(v) ? 1 : 2)) {
|
||||
::logger::root().error("GEO", 219, "Internal error, non-manifold result from triangulation");
|
||||
ifcopenshell::logger::root().error("GEO", 219, "Internal error, non-manifold result from triangulation");
|
||||
non_manifold = true;
|
||||
}
|
||||
}
|
||||
@@ -794,12 +794,12 @@ bool ifcopenshell::geom::util::fill_nonmanifold_wires_with_planar_faces(TopoDS_S
|
||||
shape = solid.SolidFromShell(TopoDS::Shell(shape));
|
||||
} catch (const Standard_Failure& e) {
|
||||
if (e.GetMessageString() && strlen(e.GetMessageString())) {
|
||||
::logger::root().error("GEO", 220, e.GetMessageString());
|
||||
ifcopenshell::logger::root().error("GEO", 220, e.GetMessageString());
|
||||
} else {
|
||||
::logger::root().error("GEO", 221, "Unknown error creating solid");
|
||||
ifcopenshell::logger::root().error("GEO", 221, "Unknown error creating solid");
|
||||
}
|
||||
} catch (...) {
|
||||
::logger::root().error("GEO", 222, "Unknown error creating solid");
|
||||
ifcopenshell::logger::root().error("GEO", 222, "Unknown error creating solid");
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -812,12 +812,12 @@ bool ifcopenshell::geom::util::convert_curve_to_wire(const opencascade::handle<G
|
||||
return true;
|
||||
} catch (const Standard_Failure& e) {
|
||||
if (e.GetMessageString() && strlen(e.GetMessageString())) {
|
||||
::logger::root().error("GEO", 223, e.GetMessageString());
|
||||
ifcopenshell::logger::root().error("GEO", 223, e.GetMessageString());
|
||||
} else {
|
||||
::logger::root().error("GEO", 224, "Unknown error converting curve to wire");
|
||||
ifcopenshell::logger::root().error("GEO", 224, "Unknown error converting curve to wire");
|
||||
}
|
||||
} catch (...) {
|
||||
::logger::root().error("GEO", 225, "Unknown error converting curve to wire");
|
||||
ifcopenshell::logger::root().error("GEO", 225, "Unknown error converting curve to wire");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -838,7 +838,7 @@ void ifcopenshell::geom::util::assert_closed_wire(TopoDS_Wire& wire, double tol)
|
||||
wire = mw.Wire();
|
||||
}
|
||||
|
||||
::logger::root().warning("GEO", 226, "Wire not closed");
|
||||
ifcopenshell::logger::root().warning("GEO", 226, "Wire not closed");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -848,7 +848,7 @@ bool ifcopenshell::geom::util::convert_wire_to_face(const TopoDS_Wire& w, TopoDS
|
||||
NCollection_List<TopoDS_Shape> results;
|
||||
|
||||
if (settings.use_wire_intersection_check && util::wire_intersections(wire, results, settings)) {
|
||||
::logger::root().warning("GEO", 227, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
|
||||
ifcopenshell::logger::root().warning("GEO", 227, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
|
||||
util::select_largest(results, wire);
|
||||
}
|
||||
|
||||
@@ -879,7 +879,7 @@ bool ifcopenshell::geom::util::convert_wire_to_face(const TopoDS_Wire& w, TopoDS
|
||||
BRepBuilderAPI_FaceError er = mf.Error();
|
||||
|
||||
if (er != BRepBuilderAPI_FaceDone) {
|
||||
::logger::root().error("GEO", 228, "Failed to create face.");
|
||||
ifcopenshell::logger::root().error("GEO", 228, "Failed to create face.");
|
||||
return false;
|
||||
}
|
||||
face = mf.Face();
|
||||
@@ -906,7 +906,7 @@ bool ifcopenshell::geom::util::convert_wire_to_faces(const TopoDS_Wire& w, TopoD
|
||||
|
||||
NCollection_List<TopoDS_Shape> results;
|
||||
if (settings.use_wire_intersection_check && util::wire_intersections(w, results, settings)) {
|
||||
::logger::root().warning("GEO", 229, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
|
||||
ifcopenshell::logger::root().warning("GEO", 229, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
|
||||
} else {
|
||||
results.Clear();
|
||||
results.Append(w);
|
||||
@@ -932,7 +932,7 @@ bool ifcopenshell::geom::util::convert_wire_to_faces(const TopoDS_Wire& w, TopoD
|
||||
BRepBuilderAPI_FaceError er = mf.Error();
|
||||
|
||||
if (er != BRepBuilderAPI_FaceDone) {
|
||||
::logger::root().error("GEO", 230, "Failed to create face.");
|
||||
ifcopenshell::logger::root().error("GEO", 230, "Failed to create face.");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -949,7 +949,7 @@ bool ifcopenshell::geom::util::convert_wire_to_faces(const TopoDS_Wire& w, TopoD
|
||||
if (p.first >= max_area / 10.) {
|
||||
B.Add(faces, p.second);
|
||||
} else {
|
||||
::logger::root().warning("GEO", 231, "Ignoring self-intersection loop with area " + boost::lexical_cast<std::string>(p.first));
|
||||
ifcopenshell::logger::root().warning("GEO", 231, "Ignoring self-intersection loop with area " + boost::lexical_cast<std::string>(p.first));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user