mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
Option to disable boolean results (sets result to first operand)
This commit is contained in:
@@ -229,6 +229,8 @@ private:
|
||||
const IfcParse::declaration* placement_rel_to;
|
||||
|
||||
faceset_helper* faceset_helper_;
|
||||
double disable_boolean_result;
|
||||
|
||||
gp_Vec offset = gp_Vec{0.0, 0.0, 0.0};
|
||||
gp_Quaternion rotation = gp_Quaternion{};
|
||||
gp_Trsf offset_and_rotation = gp_Trsf();
|
||||
@@ -252,6 +254,8 @@ public:
|
||||
, dimensionality(1.)
|
||||
, placement_rel_to(nullptr)
|
||||
, faceset_helper_(nullptr)
|
||||
, layerset_first(-1.)
|
||||
, disable_boolean_result(-1.)
|
||||
{}
|
||||
|
||||
MAKE_TYPE_NAME(Kernel)(const MAKE_TYPE_NAME(Kernel)& other)
|
||||
@@ -265,6 +269,9 @@ public:
|
||||
, placement_rel_to(other.placement_rel_to)
|
||||
// @nb faceset_helper_ always initialized to 0
|
||||
, faceset_helper_(nullptr)
|
||||
, layerset_first(other.layerset_first)
|
||||
, disable_boolean_result(other.disable_boolean_result)
|
||||
|
||||
, offset(other.offset)
|
||||
, rotation(other.rotation)
|
||||
, offset_and_rotation(other.offset_and_rotation)
|
||||
@@ -279,6 +286,9 @@ public:
|
||||
modelling_precision = other.modelling_precision;
|
||||
dimensionality = other.dimensionality;
|
||||
placement_rel_to = other.placement_rel_to;
|
||||
layerset_first = other.layerset_first;
|
||||
disable_boolean_result = other.disable_boolean_result;
|
||||
|
||||
offset = other.offset;
|
||||
rotation = other.rotation;
|
||||
offset_and_rotation = other.offset_and_rotation;
|
||||
|
||||
@@ -1412,6 +1412,9 @@ void IfcGeom::Kernel::setValue(GeomValue var, double value) {
|
||||
case GV_LAYERSET_FIRST:
|
||||
layerset_first = value;
|
||||
break;
|
||||
case GV_DISABLE_BOOLEAN_RESULT:
|
||||
disable_boolean_result = value;
|
||||
break;
|
||||
default:
|
||||
throw std::runtime_error("Invalid setting");
|
||||
}
|
||||
@@ -1439,6 +1442,8 @@ double IfcGeom::Kernel::getValue(GeomValue var) const {
|
||||
return max_faces_to_orient;
|
||||
case GV_LAYERSET_FIRST:
|
||||
return layerset_first;
|
||||
case GV_DISABLE_BOOLEAN_RESULT:
|
||||
return disable_boolean_result;
|
||||
}
|
||||
throw std::runtime_error("Invalid setting");
|
||||
}
|
||||
|
||||
@@ -1003,6 +1003,11 @@ namespace IfcGeom {
|
||||
? +1.0
|
||||
: -1.0
|
||||
);
|
||||
kernel.setValue(IfcGeom::Kernel::GV_DISABLE_BOOLEAN_RESULT,
|
||||
settings.get(IteratorSettings::DISABLE_BOOLEAN_RESULT)
|
||||
? +1.0
|
||||
: -1.0
|
||||
);
|
||||
|
||||
if (settings.get(IteratorSettings::BUILDING_LOCAL_PLACEMENT)) {
|
||||
if (settings.get(IteratorSettings::SITE_LOCAL_PLACEMENT)) {
|
||||
|
||||
@@ -92,8 +92,10 @@ namespace IfcGeom
|
||||
LAYERSET_FIRST = 1 << 18,
|
||||
/// Adds arrow heads to edge segments to signify edge direction
|
||||
EDGE_ARROWS = 1 << 19,
|
||||
/// Disables the evaluation of IfcBooleanResult and simply returns FirstOperand
|
||||
DISABLE_BOOLEAN_RESULT = 1 << 20,
|
||||
/// Number of different setting flags.
|
||||
NUM_SETTINGS = 19
|
||||
NUM_SETTINGS = 20
|
||||
};
|
||||
/// Used to store logical OR combination of setting flags.
|
||||
typedef unsigned SettingField;
|
||||
|
||||
@@ -604,6 +604,11 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcBooleanResult* l, TopoDS_Shape
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getValue(GV_DISABLE_BOOLEAN_RESULT) > 0.0) {
|
||||
shape = s1;
|
||||
return true;
|
||||
}
|
||||
|
||||
const double first_operand_volume = shape_volume(s1);
|
||||
if (first_operand_volume <= ALMOST_ZERO) {
|
||||
Logger::Message(Logger::LOG_WARNING, "Empty solid for:", l->FirstOperand());
|
||||
|
||||
Reference in New Issue
Block a user