mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
Option to disable boolean results (sets result to first operand)
This commit is contained in:
@@ -289,6 +289,9 @@ int main(int argc, char** argv) {
|
||||
("disable-opening-subtractions",
|
||||
"Specifies whether to disable the boolean subtraction of "
|
||||
"IfcOpeningElement Representations from their RelatingElements.")
|
||||
("disable-boolean-results",
|
||||
"Specifies whether to disable the boolean operation within representations "
|
||||
"such as clippings by means of IfcBooleanResult and subtypes")
|
||||
("enable-layerset-slicing",
|
||||
"Specifies whether to enable the slicing of products according "
|
||||
"to their associated IfcMaterialLayerSet.")
|
||||
@@ -445,6 +448,7 @@ int main(int argc, char** argv) {
|
||||
const bool merge_boolean_operands = vmap.count("merge-boolean-operands") != 0;
|
||||
#endif
|
||||
const bool disable_opening_subtractions = vmap.count("disable-opening-subtractions") != 0;
|
||||
const bool disable_boolean_results = vmap.count("disable-boolean-results") != 0;
|
||||
const bool include_plan = vmap.count("plan") != 0;
|
||||
const bool include_model = vmap.count("model") != 0 || (!include_plan);
|
||||
const bool enable_layerset_slicing = vmap.count("enable-layerset-slicing") != 0;
|
||||
@@ -713,6 +717,7 @@ int main(int argc, char** argv) {
|
||||
settings.set(IfcGeom::IteratorSettings::FASTER_BOOLEANS, merge_boolean_operands);
|
||||
#endif
|
||||
settings.set(IfcGeom::IteratorSettings::DISABLE_OPENING_SUBTRACTIONS, disable_opening_subtractions);
|
||||
settings.set(IfcGeom::IteratorSettings::DISABLE_BOOLEAN_RESULT, disable_boolean_results);
|
||||
settings.set(IfcGeom::IteratorSettings::INCLUDE_CURVES, include_plan);
|
||||
settings.set(IfcGeom::IteratorSettings::EXCLUDE_SOLIDS_AND_SURFACES, !include_model);
|
||||
settings.set(IfcGeom::IteratorSettings::APPLY_LAYERSETS, enable_layerset_slicing);
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -53,7 +53,8 @@ namespace IfcGeom {
|
||||
GV_PRECISION,
|
||||
// Whether to process shapes of type Face or higher (1) Wire or lower (-1) or all (0)
|
||||
GV_DIMENSIONALITY,
|
||||
GV_LAYERSET_FIRST
|
||||
GV_LAYERSET_FIRST,
|
||||
GV_DISABLE_BOOLEAN_RESULT
|
||||
};
|
||||
|
||||
Kernel(IfcParse::IfcFile* file_ = 0);
|
||||
|
||||
Reference in New Issue
Block a user