mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
Merge branch 'master' into v0.6.0
# Conflicts: # src/ifcconvert/IfcConvert.cpp # src/ifcgeom/IfcGeom.h
This commit is contained in:
@@ -736,10 +736,10 @@ bool IfcGeom::Kernel::convert_curve_to_wire(const Handle(Geom_Curve)& curve, Top
|
||||
if (e.GetMessageString() && strlen(e.GetMessageString())) {
|
||||
Logger::Error(e.GetMessageString());
|
||||
} else {
|
||||
Logger::Error("Unknown error convering curve to wire");
|
||||
Logger::Error("Unknown error converting curve to wire");
|
||||
}
|
||||
} catch (...) {
|
||||
Logger::Error("Unknown error convering curve to wire");
|
||||
Logger::Error("Unknown error converting curve to wire");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1563,6 +1563,8 @@ std::pair<std::string, double> IfcGeom::Kernel::initializeUnits(IfcSchema::IfcUn
|
||||
std::string unit_name = "METER";
|
||||
double unit_magnitude = 1.;
|
||||
|
||||
bool length_unit_encountered = false, angle_unit_encountered = false;
|
||||
|
||||
try {
|
||||
IfcEntityList::ptr units = unit_assignment->Units();
|
||||
if (!units || !units->size()) {
|
||||
@@ -1592,8 +1594,10 @@ std::pair<std::string, double> IfcGeom::Kernel::initializeUnits(IfcSchema::IfcUn
|
||||
unit_name = current_unit_name;
|
||||
unit_magnitude = current_unit_magnitude;
|
||||
setValue(IfcGeom::Kernel::GV_LENGTH_UNIT, current_unit_magnitude);
|
||||
length_unit_encountered = true;
|
||||
} else {
|
||||
setValue(IfcGeom::Kernel::GV_PLANEANGLE_UNIT, current_unit_magnitude);
|
||||
angle_unit_encountered = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1606,6 +1610,14 @@ std::pair<std::string, double> IfcGeom::Kernel::initializeUnits(IfcSchema::IfcUn
|
||||
Logger::Message(Logger::LOG_ERROR, ss.str());
|
||||
}
|
||||
|
||||
if (!length_unit_encountered) {
|
||||
Logger::Error("No length unit encountered");
|
||||
}
|
||||
|
||||
if (!angle_unit_encountered) {
|
||||
Logger::Error("No plane angle unit encountered");
|
||||
}
|
||||
|
||||
return std::pair<std::string, double>(unit_name, unit_magnitude);
|
||||
}
|
||||
|
||||
@@ -2513,7 +2525,7 @@ bool IfcGeom::Kernel::project(const Handle_Geom_Surface& srf, const TopoDS_Shape
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add a little bit of resulution so that the median is shifted towards the mass
|
||||
// Add a little bit of resolution so that the median is shifted towards the mass
|
||||
// of the curve. This helps to find the parameter ordering for conic surfaces.
|
||||
for (TopExp_Explorer exp(shp, TopAbs_EDGE); exp.More(); exp.Next(), ++vertex_count) {
|
||||
const TopoDS_Edge& e = TopoDS::Edge(exp.Current());
|
||||
|
||||
@@ -148,6 +148,8 @@ namespace IfcGeom {
|
||||
std::pair<std::string, double> length_unit = kernel.initializeUnits(project->UnitsInContext());
|
||||
unit_name = length_unit.first;
|
||||
unit_magnitude = length_unit.second;
|
||||
} else {
|
||||
Logger::Error("A single IfcProject is expected (encountered " + boost::lexical_cast<std::string>(projects->size()) + "); unable to read unit information.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,7 +348,7 @@ namespace IfcGeom {
|
||||
// Move to the next IfcRepresentation
|
||||
void _nextShape() {
|
||||
// In order to conserve memory and reduce cache insertion times, the cache is
|
||||
// cleared after an arbitary number of processed representations. This has been
|
||||
// cleared after an arbitrary number of processed representations. This has been
|
||||
// benchmarked extensively: https://github.com/IfcOpenShell/IfcOpenShell/pull/47
|
||||
static const int clear_interval = 64;
|
||||
if (done % clear_interval == clear_interval - 1) {
|
||||
@@ -434,7 +436,7 @@ namespace IfcGeom {
|
||||
|
||||
IfcSchema::IfcRepresentation* representation_mapped_to = kernel.representation_mapped_to(representation);
|
||||
if (representation_mapped_to) {
|
||||
// Check if this represenation has (or will be) processed as part its mapped representation
|
||||
// Check if this representation has (or will be) processed as part its mapped representation
|
||||
representation_processed_as_mapped_item = ok_mapped_representations->contains(representation_mapped_to) ||
|
||||
reuse_ok_(kernel.products_represented_by(representation_mapped_to));
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wire
|
||||
use_radians = true;
|
||||
} else {
|
||||
// No heuristic left to prefer the one over the other,
|
||||
// apparently both variants are equally succesful.
|
||||
// apparently both variants are equally successful.
|
||||
// The curve might be composed of only straight segments.
|
||||
// Let's go with the wire created using radians as that
|
||||
// at least is a SI unit.
|
||||
|
||||
Reference in New Issue
Block a user