mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 14:31:39 +00:00
Ground work for processing opening placement up to parent wall
This commit is contained in:
+10
-5
@@ -275,7 +275,8 @@ private:
|
|||||||
double precision_factor;
|
double precision_factor;
|
||||||
|
|
||||||
// For stopping PlacementRelTo recursion in convert(const IfcSchema::IfcObjectPlacement* l, gp_Trsf& trsf)
|
// For stopping PlacementRelTo recursion in convert(const IfcSchema::IfcObjectPlacement* l, gp_Trsf& trsf)
|
||||||
const IfcParse::declaration* placement_rel_to;
|
const IfcParse::declaration* placement_rel_to_type_;
|
||||||
|
const IfcUtil::IfcBaseEntity* placement_rel_to_instance_;
|
||||||
|
|
||||||
faceset_helper<>* faceset_helper_;
|
faceset_helper<>* faceset_helper_;
|
||||||
double disable_boolean_result;
|
double disable_boolean_result;
|
||||||
@@ -305,7 +306,8 @@ public:
|
|||||||
, no_wire_intersection_check(-1)
|
, no_wire_intersection_check(-1)
|
||||||
, no_wire_intersection_tolerance(-1)
|
, no_wire_intersection_tolerance(-1)
|
||||||
, precision_factor(10.)
|
, precision_factor(10.)
|
||||||
, placement_rel_to(nullptr)
|
, placement_rel_to_type_(nullptr)
|
||||||
|
, placement_rel_to_instance_(nullptr)
|
||||||
, faceset_helper_(nullptr)
|
, faceset_helper_(nullptr)
|
||||||
, disable_boolean_result(-1.)
|
, disable_boolean_result(-1.)
|
||||||
{}
|
{}
|
||||||
@@ -320,7 +322,8 @@ public:
|
|||||||
, dimensionality(other.dimensionality)
|
, dimensionality(other.dimensionality)
|
||||||
// @nb faceset_helper_ always initialized to 0
|
// @nb faceset_helper_ always initialized to 0
|
||||||
, layerset_first(other.layerset_first)
|
, layerset_first(other.layerset_first)
|
||||||
, placement_rel_to(other.placement_rel_to)
|
, placement_rel_to_type_(other.placement_rel_to_type_)
|
||||||
|
, placement_rel_to_instance_(other.placement_rel_to_instance_)
|
||||||
, faceset_helper_(nullptr)
|
, faceset_helper_(nullptr)
|
||||||
, disable_boolean_result(other.disable_boolean_result)
|
, disable_boolean_result(other.disable_boolean_result)
|
||||||
|
|
||||||
@@ -337,7 +340,8 @@ public:
|
|||||||
ifc_planeangle_unit = other.ifc_planeangle_unit;
|
ifc_planeangle_unit = other.ifc_planeangle_unit;
|
||||||
modelling_precision = other.modelling_precision;
|
modelling_precision = other.modelling_precision;
|
||||||
dimensionality = other.dimensionality;
|
dimensionality = other.dimensionality;
|
||||||
placement_rel_to = other.placement_rel_to;
|
placement_rel_to_type_ = other.placement_rel_to_type_;
|
||||||
|
placement_rel_to_instance_ = other.placement_rel_to_instance_;
|
||||||
layerset_first = other.layerset_first;
|
layerset_first = other.layerset_first;
|
||||||
disable_boolean_result = other.disable_boolean_result;
|
disable_boolean_result = other.disable_boolean_result;
|
||||||
|
|
||||||
@@ -534,7 +538,8 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_conversion_placement_rel_to(const IfcParse::declaration* type);
|
void set_conversion_placement_rel_to_type(const IfcParse::declaration* type);
|
||||||
|
void set_conversion_placement_rel_to_instance(const IfcUtil::IfcBaseEntity* instance);
|
||||||
|
|
||||||
#include "mapping_kernel_header.i"
|
#include "mapping_kernel_header.i"
|
||||||
|
|
||||||
|
|||||||
@@ -1020,6 +1020,23 @@ bool IfcGeom::Kernel::convert_openings_fast(const IfcSchema::IfcProduct* entity,
|
|||||||
if (fes->declaration().is(IfcSchema::IfcOpeningElement::Class())) {
|
if (fes->declaration().is(IfcSchema::IfcOpeningElement::Class())) {
|
||||||
if (!fes->Representation()) continue;
|
if (!fes->Representation()) continue;
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Not yet implemented and tested, process opening placement up to parent wall
|
||||||
|
// placement so that the matrix inverse can be eliminated.
|
||||||
|
// @todo property check and handle the decomposition into parts (where element
|
||||||
|
// carying geom and opening are in different branches).
|
||||||
|
// @todo properly check whether opening correctly references wall placement
|
||||||
|
// and fallback to matrix inverse when not the case.
|
||||||
|
auto relative = entity;
|
||||||
|
{
|
||||||
|
auto ds = relative->Decomposes();
|
||||||
|
if (ds->size() == 1) {
|
||||||
|
relative = (*ds->begin())->RelatingObject()->as<IfcSchema::IfcProduct>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set_conversion_placement_rel_to_instance(relative);
|
||||||
|
*/
|
||||||
|
|
||||||
// Convert the IfcRepresentation of the IfcOpeningElement
|
// Convert the IfcRepresentation of the IfcOpeningElement
|
||||||
gp_Trsf opening_trsf;
|
gp_Trsf opening_trsf;
|
||||||
if (fes->ObjectPlacement()) {
|
if (fes->ObjectPlacement()) {
|
||||||
@@ -1032,6 +1049,8 @@ bool IfcGeom::Kernel::convert_openings_fast(const IfcSchema::IfcProduct* entity,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set_conversion_placement_rel_to_instance(nullptr);
|
||||||
|
|
||||||
// Move the opening into the coordinate system of the IfcProduct
|
// Move the opening into the coordinate system of the IfcProduct
|
||||||
opening_trsf.PreMultiply(entity_trsf.Inverted());
|
opening_trsf.PreMultiply(entity_trsf.Inverted());
|
||||||
|
|
||||||
@@ -1102,8 +1121,7 @@ bool IfcGeom::Kernel::convert_openings_fast(const IfcSchema::IfcProduct* entity,
|
|||||||
TopoDS_Shape intermediate_result;
|
TopoDS_Shape intermediate_result;
|
||||||
if (boolean_operation(result, opening_list, BOPAlgo_CUT, intermediate_result)) {
|
if (boolean_operation(result, opening_list, BOPAlgo_CUT, intermediate_result)) {
|
||||||
result = intermediate_result;
|
result = intermediate_result;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Logger::Message(Logger::LOG_ERROR, "Opening subtraction failed for " + boost::lexical_cast<std::string>(std::distance(jt, it)) + " openings", entity);
|
Logger::Message(Logger::LOG_ERROR, "Opening subtraction failed for " + boost::lexical_cast<std::string>(std::distance(jt, it)) + " openings", entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -415,8 +415,12 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcAxis2Placement2D* l, gp_Trsf2d
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IfcGeom::Kernel::set_conversion_placement_rel_to(const IfcParse::declaration* type) {
|
void IfcGeom::Kernel::set_conversion_placement_rel_to_type(const IfcParse::declaration* type) {
|
||||||
placement_rel_to = type;
|
placement_rel_to_type_ = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IfcGeom::Kernel::set_conversion_placement_rel_to_instance(const IfcUtil::IfcBaseEntity* instance) {
|
||||||
|
placement_rel_to_instance_ = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IfcGeom::Kernel::convert(const IfcSchema::IfcObjectPlacement* l, gp_Trsf& trsf) {
|
bool IfcGeom::Kernel::convert(const IfcSchema::IfcObjectPlacement* l, gp_Trsf& trsf) {
|
||||||
@@ -427,26 +431,42 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcObjectPlacement* l, gp_Trsf& t
|
|||||||
}
|
}
|
||||||
IfcSchema::IfcLocalPlacement* current = (IfcSchema::IfcLocalPlacement*)l;
|
IfcSchema::IfcLocalPlacement* current = (IfcSchema::IfcLocalPlacement*)l;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
||||||
gp_Trsf trsf2;
|
gp_Trsf trsf2;
|
||||||
IfcSchema::IfcAxis2Placement* relplacement = current->RelativePlacement();
|
IfcSchema::IfcAxis2Placement* relplacement = current->RelativePlacement();
|
||||||
if (relplacement->as<IfcSchema::IfcAxis2Placement3D>()) {
|
if (relplacement->as<IfcSchema::IfcAxis2Placement3D>()) {
|
||||||
IfcGeom::Kernel::convert(relplacement->as<IfcSchema::IfcAxis2Placement3D>(),trsf2);
|
IfcGeom::Kernel::convert(relplacement->as<IfcSchema::IfcAxis2Placement3D>(),trsf2);
|
||||||
trsf.PreMultiply(trsf2);
|
trsf.PreMultiply(trsf2);
|
||||||
}
|
}
|
||||||
if ( current->PlacementRelTo() ) {
|
|
||||||
|
if (current->PlacementRelTo()) {
|
||||||
IfcSchema::IfcObjectPlacement* parent = current->PlacementRelTo();
|
IfcSchema::IfcObjectPlacement* parent = current->PlacementRelTo();
|
||||||
IfcSchema::IfcProduct::list::ptr parentPlaces = parent->PlacesObject();
|
|
||||||
bool parentPlacesType = false;
|
bool parent_placement_ignored = false;
|
||||||
for ( IfcSchema::IfcProduct::list::it iter = parentPlaces->begin();
|
if (placement_rel_to_type_ || placement_rel_to_instance_) {
|
||||||
iter != parentPlaces->end(); ++iter) {
|
IfcSchema::IfcProduct::list::ptr parent_places = parent->PlacesObject();
|
||||||
if ( (*iter)->declaration().is(*placement_rel_to) ) parentPlacesType = true;
|
for (auto iter = parent_places->begin(); iter != parent_places->end(); ++iter) {
|
||||||
|
if ((placement_rel_to_type_ && (*iter)->declaration().is(*placement_rel_to_type_)) ||
|
||||||
|
(placement_rel_to_instance_ && (*iter)->as<IfcUtil::IfcBaseEntity>() == placement_rel_to_instance_)) {
|
||||||
|
parent_placement_ignored = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( parentPlacesType ) break;
|
if (parent_placement_ignored) {
|
||||||
else if ( parent->declaration().is(IfcSchema::IfcLocalPlacement::Class()) )
|
// The parent placement of the current is a placement for a type that is
|
||||||
|
// being ignored (Site or Building) or it is the host element of an opening.
|
||||||
|
break;
|
||||||
|
} else if (parent->declaration().is(IfcSchema::IfcLocalPlacement::Class())) {
|
||||||
|
// Keep processing parent placements
|
||||||
current = current->PlacementRelTo()->as<IfcSchema::IfcLocalPlacement>();
|
current = current->PlacementRelTo()->as<IfcSchema::IfcLocalPlacement>();
|
||||||
else break;
|
} else {
|
||||||
} else break;
|
// This is the root placement (typically Site).
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trsf.PreMultiply(offset_and_rotation);
|
trsf.PreMultiply(offset_and_rotation);
|
||||||
|
|||||||
@@ -1171,9 +1171,9 @@ namespace IfcGeom {
|
|||||||
if (settings.get(IteratorSettings::SITE_LOCAL_PLACEMENT)) {
|
if (settings.get(IteratorSettings::SITE_LOCAL_PLACEMENT)) {
|
||||||
Logger::Message(Logger::LOG_WARNING, "building-local-placement takes precedence over site-local-placement");
|
Logger::Message(Logger::LOG_WARNING, "building-local-placement takes precedence over site-local-placement");
|
||||||
}
|
}
|
||||||
kernel.set_conversion_placement_rel_to(&IfcSchema::IfcBuilding::Class());
|
kernel.set_conversion_placement_rel_to_type(&IfcSchema::IfcBuilding::Class());
|
||||||
} else if (settings.get(IteratorSettings::SITE_LOCAL_PLACEMENT)) {
|
} else if (settings.get(IteratorSettings::SITE_LOCAL_PLACEMENT)) {
|
||||||
kernel.set_conversion_placement_rel_to(&IfcSchema::IfcSite::Class());
|
kernel.set_conversion_placement_rel_to_type(&IfcSchema::IfcSite::Class());
|
||||||
}
|
}
|
||||||
kernel.set_offset(settings.offset);
|
kernel.set_offset(settings.offset);
|
||||||
kernel.set_rotation(settings.rotation);
|
kernel.set_rotation(settings.rotation);
|
||||||
|
|||||||
Reference in New Issue
Block a user