mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 14:33:28 +00:00
Restructure and rename
This commit is contained in:
@@ -28,7 +28,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis1Placement& inst) {
|
||||
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst.Location()));
|
||||
P = *v->components_;
|
||||
} catch (const std::exception&) {
|
||||
Logger::Warning("Placement with invalid Location:", inst);
|
||||
logger::warning("Placement with invalid Location:", inst);
|
||||
}
|
||||
const bool hasAxis = inst.Axis();
|
||||
if (hasAxis) {
|
||||
|
||||
@@ -29,7 +29,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2Placement2D& inst) {
|
||||
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst.Location()));
|
||||
P = *v->components_;
|
||||
} catch (const std::exception&) {
|
||||
Logger::Warning("Placement with invalid Location:", inst);
|
||||
logger::warning("Placement with invalid Location:", inst);
|
||||
}
|
||||
const bool hasRef = !!inst.RefDirection();
|
||||
if (hasRef) {
|
||||
|
||||
@@ -29,13 +29,13 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2Placement3D& inst) {
|
||||
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst.Location()));
|
||||
o = *v->components_;
|
||||
} catch (const std::exception&) {
|
||||
Logger::Warning("Placement with invalid Location:", inst);
|
||||
logger::warning("Placement with invalid Location:", inst);
|
||||
}
|
||||
const bool hasAxis = !!inst.Axis();
|
||||
const bool hasRef = !!inst.RefDirection();
|
||||
|
||||
if (hasAxis != hasRef) {
|
||||
Logger::Warning("Axis and RefDirection should be specified together", inst);
|
||||
logger::warning("Axis and RefDirection should be specified together", inst);
|
||||
}
|
||||
|
||||
if (hasAxis) {
|
||||
|
||||
@@ -26,7 +26,7 @@ using namespace ifcopenshell::geometry;
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2PlacementLinear& inst) {
|
||||
|
||||
if (!inst.Location().as<IfcSchema::IfcPointByDistanceExpression>()) {
|
||||
Logger::Error(std::runtime_error("Location must be IfcPointByDistanceExpression for IfcAxis2PlacementLinear"));
|
||||
logger::error(std::runtime_error("Location must be IfcPointByDistanceExpression for IfcAxis2PlacementLinear"));
|
||||
}
|
||||
|
||||
Eigen::Vector3d o, axis(0, 0, 1), refDirection;
|
||||
@@ -45,7 +45,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2PlacementLinear& inst)
|
||||
|
||||
/*
|
||||
if (hasAxis != hasRef) {
|
||||
Logger::Warning("Axis and RefDirection should be specified together", inst);
|
||||
logger::warning("Axis and RefDirection should be specified together", inst);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCShapeProfileDef& inst) {
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if ( x < tol || y < tol || d1 < tol || d2 < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE," Skipping zero sized profile:", inst);
|
||||
logger::message(logger::LOG_NOTICE," Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ using namespace ifcopenshell::geometry;
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCircle& inst) {
|
||||
const double r = inst.Radius() * length_unit_;
|
||||
if (r < settings_.get<settings::Precision>().get()) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Radius not greater than zero for:", inst);
|
||||
logger::message(logger::LOG_ERROR, "Radius not greater than zero for:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve& inst) {
|
||||
|
||||
for (auto& segment : segments) {
|
||||
if (segment.as<IfcSchema::IfcCompositeCurveSegment>() && segment.as<IfcSchema::IfcCompositeCurveSegment>().ParentCurve().as<IfcSchema::IfcLine>()) {
|
||||
Logger::Notice("Infinite IfcLine used as ParentCurve of segment, treating as a segment", segment);
|
||||
logger::notice("Infinite IfcLine used as ParentCurve of segment, treating as a segment", segment);
|
||||
double u0 = 0.0;
|
||||
double u1 = segment.as<IfcSchema::IfcCompositeCurveSegment>().ParentCurve().as<IfcSchema::IfcLine>().Dir().Magnitude() * length_unit_;
|
||||
if (u1 < settings_.get<settings::Precision>().get()) {
|
||||
Logger::Warning("Segment length below tolerance", segment);
|
||||
logger::warning("Segment length below tolerance", segment);
|
||||
}
|
||||
|
||||
auto e = taxonomy::make<taxonomy::edge>();
|
||||
@@ -70,7 +70,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve& inst) {
|
||||
e->end = 2.0 * boost::math::constants::pi<double>();
|
||||
loop->children.push_back(e);
|
||||
} else {
|
||||
Logger::Warning("Unexpected segment type", segment);
|
||||
logger::warning("Unexpected segment type", segment);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve& inst) {
|
||||
}
|
||||
|
||||
if (spans.empty()) {
|
||||
std::vector<express::Entity> profile = inst.file()->getInverse(inst.id(), &IfcSchema::IfcProfileDef::Class(), -1);
|
||||
std::vector<express::Entity> profile = inst.file()->get_inverse(inst.id(), &IfcSchema::IfcProfileDef::Class(), -1);
|
||||
const bool force_close = !profile.empty();
|
||||
loop->closed = force_close;
|
||||
loop->instance = inst;
|
||||
@@ -128,7 +128,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
|
||||
for (auto it = segments->begin(); it != segments->end(); ++it) {
|
||||
|
||||
if (!(*it)->declaration().is(IfcSchema::IfcCompositeCurveSegment::Class())) {
|
||||
Logger::Error("Not implemented", *it);
|
||||
logger::error("Not implemented", *it);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -141,13 +141,13 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
|
||||
TopoDS_Wire segment;
|
||||
|
||||
if (curve->as<IfcSchema::IfcLine>()) {
|
||||
Logger::Notice("Infinite IfcLine used as ParentCurve of segment, treating as a segment", *it);
|
||||
logger::notice("Infinite IfcLine used as ParentCurve of segment, treating as a segment", *it);
|
||||
Handle_Geom_Curve handle;
|
||||
convert_curve(curve, handle);
|
||||
double u0 = 0.0;
|
||||
double u1 = curve->as<IfcSchema::IfcLine>()->Dir()->Magnitude() * length_unit_;
|
||||
if (u1 < getValue(GV_PRECISION)) {
|
||||
Logger::Warning("Segment length below tolerance", *it);
|
||||
logger::warning("Segment length below tolerance", *it);
|
||||
}
|
||||
BRepBuilderAPI_MakeEdge me(handle, u0, u1);
|
||||
if (me.IsDone()) {
|
||||
@@ -157,7 +157,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
|
||||
}
|
||||
} else if (!convert_wire(curve, segment)) {
|
||||
const bool failed_on_purpose = curve->as<IfcSchema::IfcPolyline>() && !segment.IsNull();
|
||||
Logger::Message(failed_on_purpose ? Logger::LOG_WARNING : Logger::LOG_ERROR, "Failed to convert curve:", curve);
|
||||
logger::message(failed_on_purpose ? logger::LOG_WARNING : logger::LOG_ERROR, "Failed to convert curve:", curve);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
|
||||
}
|
||||
|
||||
if (converted_segments.Extent() == 0) {
|
||||
Logger::Message(Logger::LOG_ERROR, "No segment successfully converted:", l);
|
||||
logger::message(logger::LOG_ERROR, "No segment successfully converted:", l);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
|
||||
|
||||
TopTools_ListIteratorOfListOfShape it(converted_segments);
|
||||
|
||||
std::vector<express::Base> profile = inst.data().getInverse(&IfcSchema::IfcProfileDef::Class(), -1);
|
||||
std::vector<express::Base> profile = inst.data().get_inverse(&IfcSchema::IfcProfileDef::Class(), -1);
|
||||
const bool force_close = profile && profile->size() > 0;
|
||||
|
||||
util::wire_builder bld(getValue(GV_PRECISION), l);
|
||||
|
||||
@@ -224,7 +224,7 @@ class curve_segment_evaluator {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Logger::Warning("IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the next segment.");
|
||||
logger::warning("IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the next segment.");
|
||||
}
|
||||
|
||||
bool is_horizontal = false;
|
||||
@@ -244,7 +244,7 @@ class curve_segment_evaluator {
|
||||
if ((is_horizontal + is_vertical + is_cant) != 1) {
|
||||
// We have to choose the correct functor based on usage. We can't
|
||||
// support multiple, because we don't know the caller at this point.
|
||||
Logger::Error(std::runtime_error("multiple uses of IfcSegmentCurve not supported"), inst_);
|
||||
logger::error(std::runtime_error("multiple uses of IfcSegmentCurve not supported"), inst_);
|
||||
}
|
||||
|
||||
segment_type_ = is_horizontal ? ST_HORIZONTAL : is_vertical ? ST_VERTICAL : is_cant ? ST_CANT : ST_HORIZONTAL;
|
||||
@@ -282,7 +282,7 @@ class curve_segment_evaluator {
|
||||
end_point = segmented_reference_curve.EndPoint();
|
||||
}
|
||||
} else {
|
||||
Logger::Warning("IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the end point.");
|
||||
logger::warning("IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the end point.");
|
||||
}
|
||||
if (end_point) {
|
||||
next_segment_placement_ = taxonomy::cast<taxonomy::matrix4>(mapping_->map(end_point))->ccomponents();
|
||||
@@ -304,7 +304,7 @@ class curve_segment_evaluator {
|
||||
|
||||
taxonomy::ptr get_segment_curve_function() {
|
||||
if (!parent_curve_fn_ || !parent_curve_start_point_) {
|
||||
Logger::Error(std::runtime_error(inst_.ParentCurve().declaration().name() + " not implemented"), inst_);
|
||||
logger::error(std::runtime_error(inst_.ParentCurve().declaration().name() + " not implemented"), inst_);
|
||||
}
|
||||
|
||||
auto length = fabs(this->length());
|
||||
@@ -444,13 +444,13 @@ class curve_segment_evaluator {
|
||||
projected_length_ = length_;
|
||||
}
|
||||
} else if (segment_type_ == ST_CANT) {
|
||||
Logger::Error(std::runtime_error("Unexpected segment type encountered - cant is handled in set_cant_spiral_function - should never get here"));
|
||||
logger::error(std::runtime_error("Unexpected segment type encountered - cant is handled in set_cant_spiral_function - should never get here"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
|
||||
);
|
||||
} else {
|
||||
Logger::Error(std::runtime_error("Unexpected segment type encountered"));
|
||||
logger::error(std::runtime_error("Unexpected segment type encountered"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
|
||||
@@ -612,13 +612,13 @@ class curve_segment_evaluator {
|
||||
|
||||
set_cant_spiral_function(*super, *slope, cant);
|
||||
} else if (segment_type_ == ST_VERTICAL) {
|
||||
Logger::Error(std::runtime_error("IfcCosineSpiral cannot be used for vertical alignment"));
|
||||
logger::error(std::runtime_error("IfcCosineSpiral cannot be used for vertical alignment"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
|
||||
);
|
||||
} else {
|
||||
Logger::Error(std::runtime_error("Unexpected segment type encountered"));
|
||||
logger::error(std::runtime_error("Unexpected segment type encountered"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
|
||||
@@ -681,12 +681,12 @@ class curve_segment_evaluator {
|
||||
|
||||
set_cant_spiral_function(*super, *slope, cant);
|
||||
} else if (segment_type_ == ST_VERTICAL) {
|
||||
Logger::Error(std::runtime_error("IfcSineSpiral cannot be used for vertical alignment"));
|
||||
logger::error(std::runtime_error("IfcSineSpiral cannot be used for vertical alignment"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
|
||||
} else {
|
||||
Logger::Error(std::runtime_error("Unexpected segment type encountered"));
|
||||
logger::error(std::runtime_error("Unexpected segment type encountered"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
|
||||
@@ -949,12 +949,12 @@ class curve_segment_evaluator {
|
||||
}
|
||||
|
||||
} else if (segment_type_ == ST_CANT) {
|
||||
Logger::Warning(std::runtime_error("Use of IfcCircle for cant is not supported"));
|
||||
logger::warning(std::runtime_error("Use of IfcCircle for cant is not supported"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
|
||||
} else {
|
||||
Logger::Error(std::runtime_error("Unexpected segment type encountered"));
|
||||
logger::error(std::runtime_error("Unexpected segment type encountered"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
|
||||
@@ -1027,7 +1027,7 @@ class curve_segment_evaluator {
|
||||
|
||||
parent_curve_start_point_ = (*parent_curve_fn_)(start_);
|
||||
} else {
|
||||
Logger::Warning(std::runtime_error("Unexpected segment type encountered"));
|
||||
logger::warning(std::runtime_error("Unexpected segment type encountered"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
|
||||
@@ -1041,7 +1041,7 @@ class curve_segment_evaluator {
|
||||
auto coeffY = pc.CoefficientsY().value_or(std::vector<double>());
|
||||
auto coeffZ = pc.CoefficientsZ().value_or(std::vector<double>());
|
||||
if (!coeffZ.empty()) {
|
||||
Logger::Warning("Expected IfcPolynomialCurve.CoefficientsZ to be undefined for alignment geometry. Coefficients ignored.", pc);
|
||||
logger::warning("Expected IfcPolynomialCurve.CoefficientsZ to be undefined for alignment geometry. Coefficients ignored.", pc);
|
||||
}
|
||||
|
||||
if (segment_type_ == ST_HORIZONTAL || segment_type_ == ST_VERTICAL) {
|
||||
@@ -1107,7 +1107,7 @@ class curve_segment_evaluator {
|
||||
auto result = boost::math::tools::bracket_and_solve_root(f, x, 2.0, true, tol, max_iter);
|
||||
x = result.first;
|
||||
} catch (...) {
|
||||
Logger::Warning("root solver failed");
|
||||
logger::warning("root solver failed");
|
||||
}
|
||||
return x;
|
||||
};
|
||||
@@ -1168,12 +1168,12 @@ class curve_segment_evaluator {
|
||||
|
||||
parent_curve_start_point_ = (*parent_curve_fn_)(0.0); // start is added to u in parent_curve_fn_, so use 0.0 here
|
||||
} else if (segment_type_ == ST_CANT) {
|
||||
Logger::Warning(std::runtime_error("Use of IfcPolynomialCurve for cant is not supported"));
|
||||
logger::warning(std::runtime_error("Use of IfcPolynomialCurve for cant is not supported"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
|
||||
} else {
|
||||
Logger::Error(std::runtime_error("Unexpected segment type encountered"));
|
||||
logger::error(std::runtime_error("Unexpected segment type encountered"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
|
||||
|
||||
@@ -25,14 +25,14 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEdge& inst) {
|
||||
auto v1 = inst.EdgeStart().as<IfcSchema::IfcVertexPoint>();
|
||||
auto v2 = inst.EdgeStart().as<IfcSchema::IfcVertexPoint>();
|
||||
if (!v1 || !v2) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Only IfcVertexPoints are supported for EdgeStart and -End", inst);
|
||||
logger::message(logger::LOG_ERROR, "Only IfcVertexPoints are supported for EdgeStart and -End", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto pnt1 = v1.VertexGeometry();
|
||||
auto pnt2 = v2.VertexGeometry();
|
||||
if (!pnt1.declaration().is(IfcSchema::IfcCartesianPoint::Class()) || !pnt2.declaration().is(IfcSchema::IfcCartesianPoint::Class())) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Only IfcCartesianPoints are supported for VertexGeometry", inst);
|
||||
logger::message(logger::LOG_ERROR, "Only IfcCartesianPoints are supported for VertexGeometry", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEllipse& inst) {
|
||||
double y = inst.SemiAxis2() * length_unit_;
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
if (x < tol || y < tol) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Radius not greater than zero for:", inst);
|
||||
logger::message(logger::LOG_ERROR, "Radius not greater than zero for:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEllipseProfileDef& inst) {
|
||||
double ry = inst.SemiAxis2() * length_unit_;
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
if (rx < tol || ry < tol) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Radius not greater than zero for:", inst);
|
||||
logger::message(logger::LOG_ERROR, "Radius not greater than zero for:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ using namespace ifcopenshell::geometry;
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcExtrudedAreaSolid& inst) {
|
||||
const double height = inst.Depth() * length_unit_;
|
||||
if (height < settings_.get<settings::Precision>().get()) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Non-positive extrusion height encountered for:", inst);
|
||||
logger::message(logger::LOG_ERROR, "Non-positive extrusion height encountered for:", inst);
|
||||
#ifndef PERMISSIVE_EXTRUSION
|
||||
return nullptr;
|
||||
#endif
|
||||
|
||||
@@ -27,7 +27,7 @@ using namespace ifcopenshell::geometry;
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcExtrudedAreaSolidTapered& inst) {
|
||||
const double height = inst.Depth() * length_unit_;
|
||||
if (height < settings_.get<settings::Precision>().get()) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Non-positive extrusion height encountered for:", inst);
|
||||
logger::message(logger::LOG_ERROR, "Non-positive extrusion height encountered for:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcFixedReferenceSweptAreaSolid
|
||||
auto condition_number = svd.singularValues()(0)
|
||||
/ svd.singularValues()(svd.singularValues().size() - 1);
|
||||
if (condition_number > 1.e10) {
|
||||
Logger::Error("Non-invertible matrix at " + std::to_string(distalong) + " conversion will likely fail.");
|
||||
logger::error("Non-invertible matrix at " + std::to_string(distalong) + " conversion will likely fail.");
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ using namespace ifcopenshell::geometry;
|
||||
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcGradientCurve& inst) {
|
||||
if (!inst.BaseCurve().as<IfcSchema::IfcCompositeCurve>())
|
||||
Logger::Warning("Expected IfcGradientCurve.BaseCurve to be IfcCompositeCurve", inst); // CT 4.1.7.1.1.2
|
||||
logger::warning("Expected IfcGradientCurve.BaseCurve to be IfcCompositeCurve", inst); // CT 4.1.7.1.1.2
|
||||
|
||||
auto segments = inst.Segments();
|
||||
|
||||
@@ -41,11 +41,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcGradientCurve& inst) {
|
||||
// for this reason, a dynamic cast is used and if crv is a function_item it is added to the span
|
||||
spans.push_back(fi);
|
||||
} else {
|
||||
Logger::Error("Unsupported");
|
||||
logger::error("Unsupported");
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
Logger::Error("Unsupported");
|
||||
logger::error("Unsupported");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcGradientCurve& inst) {
|
||||
|
||||
// check to see if there is valid overlap of the horizontal and vertical domains
|
||||
if (!(0 < gradient_function->length())) {
|
||||
Logger::Error("IfcGradientCurve does not have a common domain with BaseCurve");
|
||||
logger::error("IfcGradientCurve does not have a common domain with BaseCurve");
|
||||
gradient_function = nullptr; // not valid
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcHalfSpaceSolid& inst) {
|
||||
auto surface = inst.BaseSurface();
|
||||
auto plane = surface.as<IfcSchema::IfcPlane>();
|
||||
if (!plane) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Unsupported BaseSurface:", surface);
|
||||
logger::message(logger::LOG_ERROR, "Unsupported BaseSurface:", surface);
|
||||
return nullptr;
|
||||
}
|
||||
auto p = taxonomy::make<taxonomy::plane>();
|
||||
|
||||
@@ -80,7 +80,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIShapeProfileDef& inst) {
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if (x1 < tol || x2 < tol || y < tol || d1 < tol || ft1 < tol || ft2 < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve& inst) {
|
||||
|
||||
std::vector<taxonomy::point3::ptr> points;
|
||||
if (coordinates.size() < 2) {
|
||||
throw IfcParse::IfcException("IfcIndexedPolyCurve has less than 2 points.");
|
||||
throw ifcopenshell::exception("IfcIndexedPolyCurve has less than 2 points.");
|
||||
}
|
||||
|
||||
points.reserve(coordinates.size());
|
||||
@@ -58,7 +58,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve& inst) {
|
||||
taxonomy::point3::ptr previous;
|
||||
for (std::vector<int>::const_iterator jt = indices.begin(); jt != indices.end(); ++jt) {
|
||||
if (*jt < 1 || *jt > max_index) {
|
||||
throw IfcParse::IfcException("IfcIndexedPolyCurve index out of bounds for index " + boost::lexical_cast<std::string>(*jt));
|
||||
throw ifcopenshell::exception("IfcIndexedPolyCurve index out of bounds for index " + boost::lexical_cast<std::string>(*jt));
|
||||
}
|
||||
auto current = points[*jt - 1];
|
||||
if (jt != indices.begin()) {
|
||||
@@ -69,12 +69,12 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve& inst) {
|
||||
} else if (auto arc = segment.as<IfcSchema::IfcArcIndex>()) {
|
||||
std::vector<int> indices = arc;
|
||||
if (indices.size() != 3) {
|
||||
throw IfcParse::IfcException("Invalid IfcArcIndex encountered");
|
||||
throw ifcopenshell::exception("Invalid IfcArcIndex encountered");
|
||||
}
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
const int& idx = indices[i];
|
||||
if (idx < 1 || idx > max_index) {
|
||||
throw IfcParse::IfcException("IfcIndexedPolyCurve index out of bounds for index " + boost::lexical_cast<std::string>(idx));
|
||||
throw ifcopenshell::exception("IfcIndexedPolyCurve index out of bounds for index " + boost::lexical_cast<std::string>(idx));
|
||||
}
|
||||
}
|
||||
const auto& a = points[indices[0] - 1];
|
||||
@@ -87,10 +87,10 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve& inst) {
|
||||
e->basis = circ;
|
||||
loop->children.push_back(e);
|
||||
} else {
|
||||
Logger::Warning("Ignoring segment on", inst);
|
||||
logger::warning("Ignoring segment on", inst);
|
||||
}
|
||||
} else {
|
||||
throw IfcParse::IfcException("Unexpected IfcIndexedPolyCurve segment of type " + segment.concrete().declaration().name());
|
||||
throw ifcopenshell::exception("Unexpected IfcIndexedPolyCurve segment of type " + segment.concrete().declaration().name());
|
||||
}
|
||||
}
|
||||
} else if (points.begin() < points.end()) {
|
||||
|
||||
@@ -45,7 +45,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcLShapeProfileDef& inst) {
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if ( x < tol || y < tol || d < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcLShapeProfileDef& inst) {
|
||||
const double det = a1*b2 - a2*b1;
|
||||
|
||||
if (std::fabs(det) < 1.e-5) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "Legs do not intersect for:", inst);
|
||||
logger::message(logger::LOG_NOTICE, "Legs do not intersect for:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement& inst) {
|
||||
if (fallback) {
|
||||
auto mapped_fallback = taxonomy::cast<taxonomy::matrix4>(map(fallback));
|
||||
if (mapped_fallback != result) {
|
||||
Logger::Warning("Computed placement differs from fallback", inst);
|
||||
logger::warning("Computed placement differs from fallback", inst);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement& inst) {
|
||||
|
||||
auto abs_det = std::abs(result->ccomponents().determinant());
|
||||
if (abs_det < 1.e-7) {
|
||||
Logger::Warning("Ignoring singular matrix:", inst);
|
||||
logger::warning("Ignoring singular matrix:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ if (gridp = inst.as<IfcSchema::IfcGridPlacement>()) {
|
||||
convert(l->PlacementRelTo(), grid_position);
|
||||
#else
|
||||
IfcSchema::IfcGrid* grid = nullptr;
|
||||
auto grids = (*axes->begin())->data().file->getInverse<IfcSchema::IfcGrid>((*axes->begin())->data().id(), -1);
|
||||
auto grids = (*axes->begin())->data().file->get_inverse<IfcSchema::IfcGrid>((*axes->begin())->data().id(), -1);
|
||||
if (grids && grids->size()) {
|
||||
grid = *grids->begin();
|
||||
if (grid->ObjectPlacement()) {
|
||||
@@ -136,11 +136,11 @@ if (gridp = inst.as<IfcSchema::IfcGridPlacement>()) {
|
||||
auto offsets = x->OffsetDistances();
|
||||
|
||||
if (axes->size() != 2) {
|
||||
Logger::Message(Logger::LOG_WARNING, "Unexpected grid axes count:" + std::to_string(axes->size()), x);
|
||||
logger::message(logger::LOG_WARNING, "Unexpected grid axes count:" + std::to_string(axes->size()), x);
|
||||
return false;
|
||||
}
|
||||
if (offsets.size() != 3) {
|
||||
Logger::Message(Logger::LOG_WARNING, "Unexpected offset count:" + std::to_string(offsets.size()), x);
|
||||
logger::message(logger::LOG_WARNING, "Unexpected offset count:" + std::to_string(offsets.size()), x);
|
||||
return false;
|
||||
}
|
||||
auto first = *axes->begin();
|
||||
@@ -171,7 +171,7 @@ if (gridp = inst.as<IfcSchema::IfcGridPlacement>()) {
|
||||
gp_Pnt pp1, pp2;
|
||||
ecc->Points(1, pp1, pp2);
|
||||
if (pp1.Distance(pp2) > getValue(GV_PRECISION)) {
|
||||
Logger::Message(Logger::LOG_WARNING, "No axis intersection:", x);
|
||||
logger::message(logger::LOG_WARNING, "No axis intersection:", x);
|
||||
return false;
|
||||
}
|
||||
P = pp1;
|
||||
@@ -202,7 +202,7 @@ if (gridp = inst.as<IfcSchema::IfcGridPlacement>()) {
|
||||
if (V.Magnitude() > 1.e-9) {
|
||||
D = V;
|
||||
} else {
|
||||
Logger::Message(Logger::LOG_ERROR, "Unable to obtain ref direction:", l);
|
||||
logger::message(logger::LOG_ERROR, "Unable to obtain ref direction:", l);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -215,7 +215,7 @@ if (gridp = inst.as<IfcSchema::IfcGridPlacement>()) {
|
||||
if (V.Magnitude() > 1.e-9) {
|
||||
D = V;
|
||||
} else {
|
||||
Logger::Message(Logger::LOG_ERROR, "Unable to obtain ref direction:", l);
|
||||
logger::message(logger::LOG_ERROR, "Unable to obtain ref direction:", l);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ using namespace ifcopenshell::geometry;
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst) {
|
||||
auto offset_values = inst.OffsetValues();
|
||||
if (offset_values.empty()) {
|
||||
Logger::Error("IfcOffsetCurveByDistances must have at least one offset value");
|
||||
logger::error("IfcOffsetCurveByDistances must have at least one offset value");
|
||||
}
|
||||
|
||||
auto& first_offset_value = offset_values.front();
|
||||
@@ -56,7 +56,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst
|
||||
auto basis_curve_fn = taxonomy::dcast<taxonomy::function_item>(map(basis_curve));
|
||||
if (!basis_curve_fn) {
|
||||
// Only implement on alignment curves
|
||||
Logger::Warning("IfcOffsetCurveByDistances is only implemented for BasisCurves curves based on taxonomy::function_item", inst);
|
||||
logger::warning("IfcOffsetCurveByDistances is only implemented for BasisCurves curves based on taxonomy::function_item", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst
|
||||
first_distance *= length_unit_;
|
||||
|
||||
if (first_distance < 0.0) {
|
||||
Logger::Warning("IfcOffsetCurveByDistance first offset value is before the start of the curve.");
|
||||
logger::warning("IfcOffsetCurveByDistance first offset value is before the start of the curve.");
|
||||
}
|
||||
|
||||
if(0.0 < first_distance)
|
||||
@@ -110,7 +110,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst
|
||||
|
||||
if (dn < dp) // next is before previous
|
||||
{
|
||||
Logger::Warning("IfcOffsetCurveByDistance offset value is out of bounds.");
|
||||
logger::warning("IfcOffsetCurveByDistance offset value is out of bounds.");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ const double PI = boost::math::constants::pi<double>();
|
||||
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOpenCrossProfileDef& inst) {
|
||||
if (inst.ProfileType() != IfcSchema::IfcProfileTypeEnum::IfcProfileType_CURVE) {
|
||||
Logger::Warning("Expected IfcOpenCrossProfileDef.ProfileType to be CURVE", inst);
|
||||
logger::warning("Expected IfcOpenCrossProfileDef.ProfileType to be CURVE", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOpenCrossProfileDef& inst) {
|
||||
auto angles = inst.Slopes(); // these are actually angles, but the attribute is called Slopes
|
||||
|
||||
if (widths.size() != angles.size()) {
|
||||
Logger::Warning("Expected Widths and Slopes to be equal length, but got " + std::to_string(widths.size()) + " and " + std::to_string(angles.size()) + " respectively", inst);
|
||||
logger::warning("Expected Widths and Slopes to be equal length, but got " + std::to_string(widths.size()) + " and " + std::to_string(angles.size()) + " respectively", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolyLoop& inst) {
|
||||
// A loop should consist of at least three vertices
|
||||
int original_count = polygon.size();
|
||||
if (original_count < 3) {
|
||||
Logger::Message(Logger::LOG_WARNING, "Not enough edges for:", inst);
|
||||
logger::message(logger::LOG_WARNING, "Not enough edges for:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -45,17 +45,17 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolyLoop& inst) {
|
||||
auto previous_size = polygon.size();
|
||||
remove_duplicate_points_from_loop(polygon, true, eps);
|
||||
if (polygon.size() != previous_size) {
|
||||
Logger::Warning("Removed " + std::to_string(previous_size - polygon.size()) + " (near) duplicate points from:", inst);
|
||||
logger::warning("Removed " + std::to_string(previous_size - polygon.size()) + " (near) duplicate points from:", inst);
|
||||
}
|
||||
|
||||
int count = polygon.size();
|
||||
if (original_count - count != 0) {
|
||||
std::stringstream ss; ss << (original_count - count) << " edges removed for:";
|
||||
Logger::Message(Logger::LOG_WARNING, ss.str(), inst);
|
||||
logger::message(logger::LOG_WARNING, ss.str(), inst);
|
||||
}
|
||||
|
||||
if (count < 3) {
|
||||
Logger::Message(Logger::LOG_WARNING, "Not enough edges for:", inst);
|
||||
logger::message(logger::LOG_WARNING, "Not enough edges for:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolygonalFaceSet& inst) {
|
||||
taxonomy::point3::ptr previous;
|
||||
for (std::vector<int>::const_iterator jt = indices.begin(); jt != indices.end(); ++jt) {
|
||||
if (*jt < 1 || *jt > max_index) {
|
||||
throw IfcParse::IfcException("IfcPolygonalFaceSet index out of bounds for index " + boost::lexical_cast<std::string>(*jt));
|
||||
throw ifcopenshell::exception("IfcPolygonalFaceSet index out of bounds for index " + boost::lexical_cast<std::string>(*jt));
|
||||
}
|
||||
auto current = points[(*jt) - 1];
|
||||
if (jt != indices.begin()) {
|
||||
@@ -78,7 +78,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolygonalFaceSet& inst) {
|
||||
|
||||
for (std::vector<int>::const_iterator jt = li.begin(); jt != li.end(); ++jt) {
|
||||
if (*jt < 1 || *jt > max_index) {
|
||||
throw IfcParse::IfcException("IfcPolygonalFaceSet index out of bounds for index " + boost::lexical_cast<std::string>(*jt));
|
||||
throw ifcopenshell::exception("IfcPolygonalFaceSet index out of bounds for index " + boost::lexical_cast<std::string>(*jt));
|
||||
}
|
||||
auto current = points[(*jt) - 1];
|
||||
if (jt != li.begin()) {
|
||||
|
||||
@@ -44,12 +44,12 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolyline& inst) {
|
||||
auto previous_size = polygon.size();
|
||||
remove_duplicate_points_from_loop(polygon, closed_by_proximity, eps);
|
||||
if (polygon.size() != previous_size) {
|
||||
Logger::Warning("Removed " + std::to_string(previous_size - polygon.size()) + " (near) duplicate points from:", inst);
|
||||
logger::warning("Removed " + std::to_string(previous_size - polygon.size()) + " (near) duplicate points from:", inst);
|
||||
}
|
||||
|
||||
if (polygon.size() < 2) {
|
||||
// We somehow need to signal we fail this curve on purpose not to trigger an error.
|
||||
Logger::Warning("Invalid polyline with " + std::to_string(polygon.size()) + " points:", inst);
|
||||
logger::warning("Invalid polyline with " + std::to_string(polygon.size()) + " points:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangleHollowProfileDef& i
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if (x < tol || y < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangleProfileDef& inst) {
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if (x < tol || y < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangularTrimmedSurface& i
|
||||
|
||||
/*
|
||||
if (!inst.BasisSurface()->declaration().is(IfcSchema::IfcPlane::Class())) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Unsupported BasisSurface:", inst.BasisSurface());
|
||||
logger::message(logger::LOG_ERROR, "Unsupported BasisSurface:", inst.BasisSurface());
|
||||
return false;
|
||||
}
|
||||
gp_Pln pln;
|
||||
|
||||
@@ -86,7 +86,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRevolvedAreaSolid& inst) {
|
||||
}
|
||||
|
||||
if (intersecting) {
|
||||
Logger::Warning("Warning Axis and SweptArea intersecting", l);
|
||||
logger::warning("Warning Axis and SweptArea intersecting", l);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRoundedRectangleProfileDef&
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if (x < tol || y < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSolidHorizontal& in
|
||||
auto fn = taxonomy::dcast<taxonomy::function_item>(dir);
|
||||
if (!fn) {
|
||||
// Only implement on alignment curves
|
||||
Logger::Warning("IfcSectionedSolidHorizontal is only implemented for Directrix curves based on taxonomy::function_item", inst);
|
||||
logger::warning("IfcSectionedSolidHorizontal is only implemented for Directrix curves based on taxonomy::function_item", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -91,11 +91,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSolidHorizontal& in
|
||||
profile_rotations.push_back(rot);
|
||||
}
|
||||
if (faces.size() != profile_offsets.size()) {
|
||||
Logger::Warning("Expected CrossSections and CrossSectionPositions to be equal length, but got " + std::to_string(faces.size()) + " and " + std::to_string(profile_offsets.size()) + " respectively", inst);
|
||||
logger::warning("Expected CrossSections and CrossSectionPositions to be equal length, but got " + std::to_string(faces.size()) + " and " + std::to_string(profile_offsets.size()) + " respectively", inst);
|
||||
return nullptr;
|
||||
}
|
||||
if (faces.size() < 2) {
|
||||
Logger::Warning("Expected at least two cross sections, but got " + std::to_string(faces.size()), inst);
|
||||
logger::warning("Expected at least two cross sections, but got " + std::to_string(faces.size()), inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSurface& inst) {
|
||||
auto fn = taxonomy::dcast<taxonomy::function_item>(dir);
|
||||
if (!fn) {
|
||||
// Only implement on alignment curves
|
||||
Logger::Warning("IfcSectionedSurface is only implemented for Directrix curves based on taxonomy::function_item", inst);
|
||||
logger::warning("IfcSectionedSurface is only implemented for Directrix curves based on taxonomy::function_item", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -97,11 +97,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSurface& inst) {
|
||||
return nullptr;
|
||||
#endif
|
||||
if (faces.size() != profile_offsets.size()) {
|
||||
Logger::Warning("Expected CrossSections and CrossSectionPositions to be equal length, but got " + std::to_string(faces.size()) + " and " + std::to_string(profile_offsets.size()) + " respectively", inst);
|
||||
logger::warning("Expected CrossSections and CrossSectionPositions to be equal length, but got " + std::to_string(faces.size()) + " and " + std::to_string(profile_offsets.size()) + " respectively", inst);
|
||||
return nullptr;
|
||||
}
|
||||
if (faces.size() < 2) {
|
||||
Logger::Warning("Expected at least two cross sections, but got " + std::to_string(faces.size()), inst);
|
||||
logger::warning("Expected at least two cross sections, but got " + std::to_string(faces.size()), inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ using namespace ifcopenshell::geometry;
|
||||
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve& inst) {
|
||||
if (!inst.BaseCurve().as<IfcSchema::IfcGradientCurve>())
|
||||
Logger::Warning("Expected IfcSegmentedReferenceCurve.BaseCurve to be IfcGradient", inst); // CT 4.1.7.1.1.3
|
||||
logger::warning("Expected IfcSegmentedReferenceCurve.BaseCurve to be IfcGradient", inst); // CT 4.1.7.1.1.3
|
||||
|
||||
auto segments = inst.Segments();
|
||||
|
||||
@@ -41,11 +41,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve& ins
|
||||
// for this reason, a dynamic cast is used and if crv is a function_item it is added to the span
|
||||
spans.push_back(fi);
|
||||
} else {
|
||||
Logger::Error("Unsupported");
|
||||
logger::error("Unsupported");
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
Logger::Error("Unsupported");
|
||||
logger::error("Unsupported");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve& ins
|
||||
|
||||
auto cant_function = taxonomy::make<taxonomy::cant_function>(gradient, cant, inst);
|
||||
if (!(0 < cant_function->length())) {
|
||||
Logger::Error("IfcSegmentedReferenceCurve does not have a common domain with BaseCurve");
|
||||
logger::error("IfcSegmentedReferenceCurve does not have a common domain with BaseCurve");
|
||||
cant_function = nullptr;
|
||||
}
|
||||
return cant_function;
|
||||
|
||||
@@ -49,11 +49,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSurfaceCurveSweptAreaSolid&
|
||||
if (!is_plane) {
|
||||
TopoDS_Shape surface_shell;
|
||||
if (!convert_shape(inst.ReferenceSurface(), surface_shell)) {
|
||||
Logger::Error("Failed to convert reference surface", l);
|
||||
logger::error("Failed to convert reference surface", l);
|
||||
return false;
|
||||
}
|
||||
if (util::count(surface_shell, TopAbs_FACE) != 1) {
|
||||
Logger::Error("Non-continuous reference surface", l);
|
||||
logger::error("Non-continuous reference surface", l);
|
||||
return false;
|
||||
}
|
||||
surface_face = TopoDS::Face(TopExp_Explorer(surface_shell, TopAbs_FACE).Current());
|
||||
@@ -76,7 +76,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSurfaceCurveSweptAreaSolid&
|
||||
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, "The Directrix does not lie on the ReferenceSurface", l);
|
||||
logger::message(logger::LOG_WARNING, "The Directrix does not lie on the ReferenceSurface", l);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/********************************************************************************
|
||||
/********************************************************************************
|
||||
* *
|
||||
* This file is part of IfcOpenShell. *
|
||||
* *
|
||||
@@ -61,8 +61,8 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
|
||||
try {
|
||||
sp = inst.StartParam();
|
||||
ep = inst.EndParam();
|
||||
} catch (const IfcParse::IfcException& e) {
|
||||
Logger::Warning(e);
|
||||
} catch (const ifcopenshell::exception& e) {
|
||||
logger::warning(e);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -241,19 +241,19 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
|
||||
i += 1;
|
||||
j += 1;
|
||||
} else {
|
||||
Logger::Error("Unexpected amount of fillet edges generated");
|
||||
logger::error("Unexpected amount of fillet edges generated");
|
||||
}
|
||||
} else {
|
||||
Logger::Error("Unable to build fillet, probably edge too short");
|
||||
logger::error("Unable to build fillet, probably edge too short");
|
||||
}
|
||||
} else {
|
||||
Logger::Error("Colinear edges, not applying fillet");
|
||||
logger::error("Colinear edges, not applying fillet");
|
||||
}
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
} else {
|
||||
Logger::Error("Not enough edges for applying fillet");
|
||||
logger::error("Not enough edges for applying fillet");
|
||||
}
|
||||
|
||||
TopoDS_Wire new_wire;
|
||||
@@ -266,7 +266,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
|
||||
|
||||
wire = new_wire;
|
||||
} else {
|
||||
Logger::Error("Directrix is not polyhedral, ignoring FilletRadius");
|
||||
logger::error("Directrix is not polyhedral, ignoring FilletRadius");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
|
||||
}
|
||||
|
||||
if (!is_valid) {
|
||||
Logger::Message(Logger::LOG_WARNING, "Failed to subtract inner radius void for:", l);
|
||||
logger::message(logger::LOG_WARNING, "Failed to subtract inner radius void for:", l);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTShapeProfileDef& inst) {
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if (x < tol || y < tol || d1 < tol || d2 < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTShapeProfileDef& inst) {
|
||||
const double det = a1*b2 - a2*b1;
|
||||
|
||||
if (std::fabs(det) < 1.e-5) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "Web and flange do not intersect for:", inst);
|
||||
logger::message(logger::LOG_NOTICE, "Web and flange do not intersect for:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrapeziumProfileDef& inst) {
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if (x1 < tol || w < tol || y < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTriangulatedFaceSet& inst) {
|
||||
taxonomy::point3::ptr first, previous;
|
||||
for (std::vector<int>::const_iterator jt = indices.begin(); jt != indices.end(); ++jt) {
|
||||
if (*jt < 1 || *jt > max_index) {
|
||||
throw IfcParse::IfcException("IfcTriangulatedFaceSet index out of bounds for index " + boost::lexical_cast<std::string>(*jt));
|
||||
throw ifcopenshell::exception("IfcTriangulatedFaceSet index out of bounds for index " + boost::lexical_cast<std::string>(*jt));
|
||||
}
|
||||
const taxonomy::point3::ptr& current = points[(*jt) - 1];
|
||||
if (jt == indices.begin()) {
|
||||
|
||||
@@ -76,7 +76,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve& inst) {
|
||||
bool trim_cartesian_failed = !trim_cartesian;
|
||||
if (trim_cartesian) {
|
||||
if ((pnts[0]->ccomponents() - pnts[1]->ccomponents()).norm() < (2 * tol)) {
|
||||
Logger::Message(Logger::LOG_WARNING, "Skipping segment with length below tolerance level:", inst);
|
||||
logger::message(logger::LOG_WARNING, "Skipping segment with length below tolerance level:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
tc->start = pnts[0];
|
||||
@@ -115,9 +115,9 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve& inst) {
|
||||
// or trimmed segment would be whether there are other curve segments or this
|
||||
// is the only one.
|
||||
std::optional<size_t> num_segments;
|
||||
auto segment = inst.file()->getInverse(inst.id(), & IfcSchema::IfcCompositeCurveSegment::Class(), -1);
|
||||
auto segment = inst.file()->get_inverse(inst.id(), & IfcSchema::IfcCompositeCurveSegment::Class(), -1);
|
||||
if (segment.size() == 1) {
|
||||
auto comp = segment.front().file()->getInverse(segment.front().id(), &IfcSchema::IfcCompositeCurve::Class(), -1);
|
||||
auto comp = segment.front().file()->get_inverse(segment.front().id(), &IfcSchema::IfcCompositeCurve::Class(), -1);
|
||||
if (comp.size() == 1) {
|
||||
num_segments = comp.front().as<IfcSchema::IfcCompositeCurve>().Segments().size();
|
||||
}
|
||||
@@ -140,7 +140,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve& inst) {
|
||||
TopoDS_Vertex v0, v1;
|
||||
TopExp::Vertices(e, v0, v1);
|
||||
if (v0.IsSame(v1)) {
|
||||
Logger::Warning("Skipping degenerate segment", l);
|
||||
logger::warning("Skipping degenerate segment", l);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -168,7 +168,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve& inst) {
|
||||
TopoDS_Vertex v0, v1;
|
||||
TopExp::Vertices(e, v0, v1);
|
||||
e = TopoDS::Edge(BRepBuilderAPI_MakeEdge(v0, v1).Edge().Oriented(e.Orientation()));
|
||||
Logger::Warning("Substituted edge with linear approximation", l);
|
||||
logger::warning("Substituted edge with linear approximation", l);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcUShapeProfileDef& inst) {
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if (x < tol || y < tol || d1 < tol || d2 < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcZShapeProfileDef& inst) {
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if (x < tol || y < tol || dx < tol || dy < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/********************************************************************************
|
||||
/********************************************************************************
|
||||
* *
|
||||
* This file is part of IfcOpenShell. *
|
||||
* *
|
||||
@@ -22,17 +22,17 @@
|
||||
|
||||
#include "mapping.h"
|
||||
|
||||
#include "../../ifcparse/IfcLogger.h"
|
||||
#include "../../ifcparse/IfcFile.h"
|
||||
#include "../../ifcparse/IfcSIPrefix.h"
|
||||
#include "../../ifcparse/logger.h"
|
||||
#include "../../ifcparse/file.h"
|
||||
#include "../../ifcparse/si_prefix.h"
|
||||
|
||||
using namespace IfcUtil;
|
||||
using namespace ifcopenshell;
|
||||
using namespace ifcopenshell::geometry;
|
||||
using namespace IfcGeom;
|
||||
|
||||
namespace {
|
||||
struct POSTFIX_SCHEMA(factory_t) {
|
||||
abstract_mapping* operator()(IfcParse::IfcFile* file, Settings& settings) const {
|
||||
abstract_mapping* operator()(ifcopenshell::file* file, Settings& settings) const {
|
||||
ifcopenshell::geometry::POSTFIX_SCHEMA(mapping)* m = new ifcopenshell::geometry::POSTFIX_SCHEMA(mapping)(file, settings);
|
||||
return m;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ std::vector<IfcSchema::IfcProduct> mapping::products_represented_by(const IfcSch
|
||||
|
||||
// IfcProductRepresentation also lacks the INVERSE relation to IfcProduct
|
||||
// Let's find the IfcProducts that reference the IfcProductRepresentation anyway
|
||||
auto invs = prodrep.file()->getInverse(prodrep.id(), &IfcSchema::IfcProduct::Class(), -1);
|
||||
auto invs = prodrep.file()->get_inverse(prodrep.id(), &IfcSchema::IfcProduct::Class(), -1);
|
||||
for (auto& inv : invs) {
|
||||
products.push_back(inv.as<IfcSchema::IfcProduct>());
|
||||
}
|
||||
@@ -84,19 +84,19 @@ std::vector<IfcSchema::IfcProduct> mapping::products_represented_by(const IfcSch
|
||||
try {
|
||||
target = taxonomy::cast<taxonomy::matrix4>(map(item.MappingTarget()));
|
||||
} catch (const std::exception& e) {
|
||||
Logger::Error(e);
|
||||
logger::error(e);
|
||||
continue;
|
||||
}
|
||||
if (!target->is_identity()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto reps = item.file()->getInverse(item.id(), (&IfcSchema::IfcRepresentation::Class()), -1);
|
||||
auto reps = item.file()->get_inverse(item.id(), (&IfcSchema::IfcRepresentation::Class()), -1);
|
||||
for (auto& rep : reps) {
|
||||
if (rep.as<IfcSchema::IfcRepresentation>().Items().size() != 1) continue;
|
||||
std::vector<IfcSchema::IfcProductRepresentation> prodreps_mapped = rep.as<IfcSchema::IfcRepresentation>().OfProductRepresentation();
|
||||
for (auto& prm : prodreps_mapped) {
|
||||
auto ps = prm.file()->getInverse(prm.id(), (&IfcSchema::IfcProduct::Class()), -1);
|
||||
auto ps = prm.file()->get_inverse(prm.id(), (&IfcSchema::IfcProduct::Class()), -1);
|
||||
for (auto& p : ps) {
|
||||
products.push_back(p.as<IfcSchema::IfcProduct>());
|
||||
}
|
||||
@@ -329,8 +329,8 @@ const express::Base mapping::get_single_material_association(const express::Base
|
||||
|
||||
try {
|
||||
associated_material = associated_materials.front().RelatingMaterial().concrete();
|
||||
} catch(IfcParse::IfcException& e) {
|
||||
Logger::Error(e.what());
|
||||
} catch(ifcopenshell::exception& e) {
|
||||
logger::error(e.what());
|
||||
}
|
||||
|
||||
if (associated_material) {
|
||||
@@ -343,7 +343,7 @@ const express::Base mapping::get_single_material_association(const express::Base
|
||||
IfcSchema::IfcMaterialLayerSet layerset;
|
||||
if (auto m = associated_material.as<IfcSchema::IfcMaterialLayerSetUsage>()) {
|
||||
if (m.get("ForLayerSet").isNull()) {
|
||||
Logger::Warning("Missing ForLayerSet for:", m);
|
||||
logger::warning("Missing ForLayerSet for:", m);
|
||||
return express::Base{};
|
||||
}
|
||||
layerset = m.ForLayerSet();
|
||||
@@ -363,7 +363,7 @@ const express::Base mapping::get_single_material_association(const express::Base
|
||||
IfcSchema::IfcMaterialProfileSet profileset;
|
||||
if (auto m = associated_material.as<IfcSchema::IfcMaterialProfileSetUsage>()) {
|
||||
if (m.get("ForProfileSet").isNull()) {
|
||||
Logger::Warning("Missing ForProfileSet for:", m);
|
||||
logger::warning("Missing ForProfileSet for:", m);
|
||||
return express::Base{};
|
||||
}
|
||||
profileset = m.ForProfileSet();
|
||||
@@ -408,7 +408,7 @@ IfcSchema::IfcRepresentation mapping::representation_mapped_to(const IfcSchema::
|
||||
try {
|
||||
target = taxonomy::cast<taxonomy::matrix4>(map(mapped_item.MappingTarget()));
|
||||
} catch (const std::exception& e) {
|
||||
Logger::Error(e);
|
||||
logger::error(e);
|
||||
}
|
||||
if (target && target->is_identity()) {
|
||||
IfcSchema::IfcRepresentationMap rmap = mapped_item.MappingSource();
|
||||
@@ -575,7 +575,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcMaterial& material) {
|
||||
if (failed_on_purpose_.find(styled_item) == failed_on_purpose_.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
Logger::Warning("Skipping unsupported material style for material: ", material);
|
||||
logger::warning("Skipping unsupported material style for material: ", material);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,7 +607,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcStyledItem& inst) {
|
||||
|
||||
if (!style) {
|
||||
// E.g. IfcCurveStyle is skipped as unsupported.
|
||||
Logger::Warning("Only IfcSurfaceStyle is supported, couldn't find it in IfcStyledItem: ", inst);
|
||||
logger::warning("Only IfcSurfaceStyle is supported, couldn't find it in IfcStyledItem: ", inst);
|
||||
failed_on_purpose_.insert(inst);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -725,7 +725,7 @@ taxonomy::ptr mapping::map(const express::Base& inst) {
|
||||
cache_.insert({iden, item});
|
||||
}
|
||||
} else if (!matched) {
|
||||
Logger::Message(Logger::LOG_ERROR, "No operation defined for:", inst);
|
||||
logger::message(logger::LOG_ERROR, "No operation defined for:", inst);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
@@ -783,8 +783,8 @@ express::Base mapping::get_decomposing_entity(const express::Base& inst, bool in
|
||||
|
||||
/* Parent decompositions to the RelatingObject */
|
||||
if (!parent) {
|
||||
std::vector<express::Entity> parents = product.file()->getInverse(product.id(), (&IfcSchema::IfcRelAggregates::Class()), -1);
|
||||
auto nests = product.file()->getInverse(product.id(), (&IfcSchema::IfcRelNests::Class()), -1);
|
||||
std::vector<express::Entity> parents = product.file()->get_inverse(product.id(), (&IfcSchema::IfcRelAggregates::Class()), -1);
|
||||
auto nests = product.file()->get_inverse(product.id(), (&IfcSchema::IfcRelNests::Class()), -1);
|
||||
parents.insert(parents.end(), nests.begin(), nests.end());
|
||||
for (auto it = parents.begin(); it != parents.end(); ++it) {
|
||||
IfcSchema::IfcRelDecomposes decompose = (*it).as<IfcSchema::IfcRelDecomposes>();
|
||||
@@ -803,7 +803,7 @@ std::map<std::string, express::Base> mapping::get_layers(const express::Base& in
|
||||
auto prod = inst.as<IfcSchema::IfcProduct>();
|
||||
std::map<std::string, express::Base> layers;
|
||||
if (prod.Representation()) {
|
||||
std::vector<express::Base> representations = IfcParse::traverse(prod.Representation());
|
||||
std::vector<express::Base> representations = ifcopenshell::traverse(prod.Representation());
|
||||
for (auto& inst : representations) {
|
||||
if (auto repr = inst.as<IfcSchema::IfcRepresentation>()) {
|
||||
std::vector<IfcSchema::IfcPresentationLayerAssignment> a = repr.LayerAssignments();
|
||||
@@ -833,10 +833,10 @@ void mapping::initialize_units_() {
|
||||
auto& project = projects.front();
|
||||
unit_assignment = project.UnitsInContext();
|
||||
} else {
|
||||
Logger::Warning("Not a single project or context in file");
|
||||
logger::warning("Not a single project or context in file");
|
||||
}
|
||||
if (!unit_assignment) {
|
||||
Logger::Warning("Unable to detect unit information");
|
||||
logger::warning("Unable to detect unit information");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -845,14 +845,14 @@ void mapping::initialize_units_() {
|
||||
try {
|
||||
auto units = unit_assignment.Units();
|
||||
if (units.empty()) {
|
||||
Logger::Warning("No unit information found");
|
||||
logger::warning("No unit information found");
|
||||
} else {
|
||||
for (auto& base : units) {
|
||||
if (auto named_unit = base.as<IfcSchema::IfcNamedUnit>()) {
|
||||
if (named_unit.UnitType() == IfcSchema::IfcUnitEnum::IfcUnit_LENGTHUNIT ||
|
||||
named_unit.UnitType() == IfcSchema::IfcUnitEnum::IfcUnit_PLANEANGLEUNIT) {
|
||||
std::string current_unit_name;
|
||||
const double current_unit_magnitude = IfcParse::get_SI_equivalent<IfcSchema>(named_unit);
|
||||
const double current_unit_magnitude = ifcopenshell::get_SI_equivalent<IfcSchema>(named_unit);
|
||||
if (current_unit_magnitude != 0.) {
|
||||
if (auto u = named_unit.as<IfcSchema::IfcConversionBasedUnit>()) {
|
||||
current_unit_name = u.Name();
|
||||
@@ -875,18 +875,18 @@ void mapping::initialize_units_() {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (const IfcParse::IfcException& ex) {
|
||||
} catch (const ifcopenshell::exception& ex) {
|
||||
std::stringstream ss;
|
||||
ss << "Failed to determine unit information '" << ex.what() << "'";
|
||||
Logger::Message(Logger::LOG_ERROR, ss.str());
|
||||
logger::message(logger::LOG_ERROR, ss.str());
|
||||
}
|
||||
|
||||
if (!length_unit_encountered) {
|
||||
Logger::Warning("No length unit encountered");
|
||||
logger::warning("No length unit encountered");
|
||||
}
|
||||
|
||||
if (!angle_unit_encountered) {
|
||||
Logger::Warning("No plane angle unit encountered");
|
||||
logger::warning("No plane angle unit encountered");
|
||||
}
|
||||
|
||||
// @todo move to a more descriptive function
|
||||
@@ -903,7 +903,7 @@ void mapping::initialize_units_() {
|
||||
if (vs.size() == 3) {
|
||||
offset_and_rotation_ *= Eigen::Affine3d(Eigen::Translation3d(vs[0], vs[1], vs[2])).matrix();
|
||||
} else {
|
||||
Logger::Error("Expected 3 values for model-offset setting");
|
||||
logger::error("Expected 3 values for model-offset setting");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -916,7 +916,7 @@ void mapping::initialize_units_() {
|
||||
m4 << m3;
|
||||
offset_and_rotation_ *= m4;
|
||||
} else {
|
||||
Logger::Error("Expected 4 values for model-rotation setting");
|
||||
logger::error("Expected 4 values for model-rotation setting");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -963,7 +963,7 @@ void mapping::initialize_settings() {
|
||||
|
||||
if (any_precision_encountered) {
|
||||
if (lowest_precision_encountered < 1.e-7) {
|
||||
Logger::Message(Logger::LOG_WARNING, "Precision lower than 0.0000001 meter not enforced");
|
||||
logger::message(logger::LOG_WARNING, "Precision lower than 0.0000001 meter not enforced");
|
||||
precision_to_set = 1.e-7;
|
||||
} else {
|
||||
precision_to_set = lowest_precision_encountered;
|
||||
@@ -1000,7 +1000,7 @@ bool mapping::get_layerset_information(const express::Base& p, layerset_informat
|
||||
IfcSchema::IfcRepresentation body_representation = find_representation(product, "Body");
|
||||
|
||||
if (!body_representation) {
|
||||
Logger::Warning("No body representation for product", product);
|
||||
logger::warning("No body representation for product", product);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1014,7 +1014,7 @@ bool mapping::get_layerset_information(const express::Base& p, layerset_informat
|
||||
IfcSchema::IfcRepresentation axis_representation = find_representation(product, "Axis");
|
||||
|
||||
if (!axis_representation) {
|
||||
Logger::Message(Logger::LOG_WARNING, "No axis representation for:", product);
|
||||
logger::message(logger::LOG_WARNING, "No axis representation for:", product);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1080,7 +1080,7 @@ bool mapping::get_layerset_information(const express::Base& p, layerset_informat
|
||||
std::reverse(info.layers.begin(), info.layers.end());
|
||||
}
|
||||
} else {
|
||||
auto resources = IfcParse::traverse(body_representation);
|
||||
auto resources = ifcopenshell::traverse(body_representation);
|
||||
std::vector<IfcSchema::IfcExtrudedAreaSolid> extrusions;
|
||||
for (auto& r : resources) {
|
||||
if (auto ex = r.as<IfcSchema::IfcExtrudedAreaSolid>()) {
|
||||
@@ -1089,7 +1089,7 @@ bool mapping::get_layerset_information(const express::Base& p, layerset_informat
|
||||
}
|
||||
|
||||
if (extrusions.size() != 1) {
|
||||
Logger::Message(Logger::LOG_WARNING, "No single extrusion found in body representation for:", product);
|
||||
logger::message(logger::LOG_WARNING, "No single extrusion found in body representation for:", product);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1104,7 +1104,7 @@ bool mapping::get_layerset_information(const express::Base& p, layerset_informat
|
||||
if (has_position) {
|
||||
auto m4 = taxonomy::cast<taxonomy::matrix4>(map(extrusion.Position()));
|
||||
if (!m4) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Failed to convert placement for extrusion of:", product);
|
||||
logger::message(logger::LOG_ERROR, "Failed to convert placement for extrusion of:", product);
|
||||
return false;
|
||||
} else {
|
||||
extrusion_position = m4;
|
||||
@@ -1114,7 +1114,7 @@ bool mapping::get_layerset_information(const express::Base& p, layerset_informat
|
||||
taxonomy::direction3::ptr extrusion_direction = taxonomy::cast<taxonomy::direction3>(map(extrusion.ExtrudedDirection()));
|
||||
|
||||
if (!extrusion_direction) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Failed to convert direction for extrusion of:", product);
|
||||
logger::message(logger::LOG_ERROR, "Failed to convert direction for extrusion of:", product);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1186,13 +1186,13 @@ void mapping::addRepresentationsFromContextIds(std::vector<IfcSchema::IfcReprese
|
||||
IfcSchema::IfcGeometricRepresentationContext context;
|
||||
try {
|
||||
context = file_->instance_by_id(context_id).as<IfcSchema::IfcGeometricRepresentationContext>();
|
||||
} catch (IfcParse::IfcException& e) {
|
||||
Logger::Error(e);
|
||||
} catch (ifcopenshell::exception& e) {
|
||||
logger::error(e);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!context) {
|
||||
Logger::Error("Failed to process context ID " + std::to_string(context_id));
|
||||
logger::error("Failed to process context ID " + std::to_string(context_id));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1241,14 +1241,14 @@ void mapping::addRepresentationsFromDefaultContexts(std::vector<IfcSchema::IfcRe
|
||||
boost::to_lower(context_type);
|
||||
|
||||
if (allowed_context_types.find(context_type) == allowed_context_types.end()) {
|
||||
Logger::Warning(std::string("ContextType '") + *context.ContextType() + "' not allowed:", context);
|
||||
logger::warning(std::string("ContextType '") + *context.ContextType() + "' not allowed:", context);
|
||||
}
|
||||
if (context_types.find(context_type) != context_types.end()) {
|
||||
filtered_contexts.push_back(context);
|
||||
}
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
Logger::Error(e);
|
||||
logger::error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1277,7 +1277,7 @@ void mapping::addRepresentationsFromDefaultContexts(std::vector<IfcSchema::IfcRe
|
||||
}
|
||||
|
||||
if (representations.empty()) {
|
||||
Logger::Warning("No representations encountered in relevant contexts, using all");
|
||||
logger::warning("No representations encountered in relevant contexts, using all");
|
||||
auto all_reps = file_->instances_by_type<IfcSchema::IfcRepresentation>();
|
||||
representations = all_reps;
|
||||
}
|
||||
@@ -1318,7 +1318,7 @@ express::Base mapping::representation_of(const express::Base& product) {
|
||||
return express::Base{};
|
||||
} else {
|
||||
for (auto& r : intersection) {
|
||||
auto resources = IfcParse::traverse(r);
|
||||
auto resources = ifcopenshell::traverse(r);
|
||||
auto is_bounding_box = std::any_of(resources.begin(), resources.end(), [](const auto& res) { return res.declaration().is(IfcSchema::IfcBoundingBox::Class()); });
|
||||
if (is_bounding_box) {
|
||||
continue;
|
||||
@@ -1326,7 +1326,7 @@ express::Base mapping::representation_of(const express::Base& product) {
|
||||
intersection_no_box.push_back(r);
|
||||
}
|
||||
if (intersection_no_box.size() > 1) {
|
||||
Logger::Warning("Multiple applicable representations found for element, selecting arbitrary");
|
||||
logger::warning("Multiple applicable representations found for element, selecting arbitrary");
|
||||
}
|
||||
if (intersection_no_box.size()) {
|
||||
return intersection_no_box.front();
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
#include "../abstract_mapping.h"
|
||||
#include "../../ifcparse/macros.h"
|
||||
#include "../../ifcparse/IfcFile.h"
|
||||
#include "../../ifcparse/IfcLogger.h"
|
||||
#include "../../ifcparse/file.h"
|
||||
#include "../../ifcparse/logger.h"
|
||||
|
||||
#include <mutex>
|
||||
|
||||
@@ -21,14 +21,14 @@ namespace geometry {
|
||||
|
||||
class POSTFIX_SCHEMA(mapping) : public abstract_mapping {
|
||||
private:
|
||||
IfcParse::IfcFile* file_;
|
||||
ifcopenshell::file* file_;
|
||||
double length_unit_, angle_unit_;
|
||||
std::string length_unit_name_;
|
||||
|
||||
std::map<uint32_t, ifcopenshell::geometry::taxonomy::ptr> cache_;
|
||||
std::mutex cache_guard_; // provides mutually exclusive access to cache_
|
||||
|
||||
const IfcParse::declaration* placement_rel_to_type_;
|
||||
const ifcopenshell::declaration* placement_rel_to_type_;
|
||||
const express::Base placement_rel_to_instance_;
|
||||
|
||||
Eigen::Matrix4d offset_and_rotation_ = Eigen::Matrix4d::Identity();
|
||||
@@ -66,19 +66,19 @@ namespace geometry {
|
||||
}
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
Logger::Message(Logger::LOG_ERROR, std::string(e.what()) + "\nFailed to convert:", inst);
|
||||
logger::message(logger::LOG_ERROR, std::string(e.what()) + "\nFailed to convert:", inst);
|
||||
}
|
||||
} else if (failed_on_purpose_.find(inst) == failed_on_purpose_.end()) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Failed to convert:", inst);
|
||||
logger::message(logger::LOG_ERROR, "Failed to convert:", inst);
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
Logger::Message(Logger::LOG_ERROR, std::string(e.what()) + "\nFailed to convert:", inst);
|
||||
logger::message(logger::LOG_ERROR, std::string(e.what()) + "\nFailed to convert:", inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
IfcSchema::IfcStyledItem find_style(const IfcSchema::IfcRepresentationItem&);
|
||||
public:
|
||||
POSTFIX_SCHEMA(mapping)(IfcParse::IfcFile* file, Settings& settings) : abstract_mapping(settings), file_(file), placement_rel_to_type_(nullptr) {
|
||||
POSTFIX_SCHEMA(mapping)(ifcopenshell::file* file, Settings& settings) : abstract_mapping(settings), file_(file), placement_rel_to_type_(nullptr) {
|
||||
initialize_units_();
|
||||
}
|
||||
virtual ifcopenshell::geometry::taxonomy::ptr map(const express::Base&);
|
||||
|
||||
Reference in New Issue
Block a user