mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-13 06:53:36 +00:00
Fixes after settings rework
This commit is contained in:
@@ -22,8 +22,7 @@
|
|||||||
using namespace ifcopenshell::geometry;
|
using namespace ifcopenshell::geometry;
|
||||||
|
|
||||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRepresentation* inst) {
|
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRepresentation* inst) {
|
||||||
// @todo
|
const bool items_to_include = !this->settings_.get<settings::OutputDimensionality>().get();
|
||||||
const bool use_body = !this->settings_.get<settings::IncludeCurves>().get();
|
|
||||||
|
|
||||||
auto items = map_to_collection(this, inst->Items());
|
auto items = map_to_collection(this, inst->Items());
|
||||||
if (!items) {
|
if (!items) {
|
||||||
@@ -42,9 +41,15 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRepresentation* inst) {
|
|||||||
// @todo
|
// @todo
|
||||||
// if (s.ShapeType() == TopAbs_COMPOUND && TopoDS_Iterator(s).More() && TopoDS_Iterator(s).Value().ShapeType() == TopAbs_SOLID) {
|
// if (s.ShapeType() == TopAbs_COMPOUND && TopoDS_Iterator(s).More() && TopoDS_Iterator(s).Value().ShapeType() == TopAbs_SOLID) {
|
||||||
|
|
||||||
auto filtered = filter_in_place(items, [&use_body](taxonomy::ptr i) {
|
auto filtered = filter_in_place(items, [&items_to_include](taxonomy::ptr i) {
|
||||||
// @todo just filter loops for now.
|
auto is_curve = (i->kind() == taxonomy::EDGE || i->kind() == taxonomy::LOOP || i->kind() == taxonomy::PIECEWISE_FUNCTION);
|
||||||
return (i->kind() != taxonomy::LOOP && i->kind() != taxonomy::PIECEWISE_FUNCTION) == use_body;
|
if (is_curve && items_to_include == settings::SURFACES_AND_SOLIDS) {
|
||||||
|
return false;
|
||||||
|
} else if (!is_curve && items_to_include == settings::CURVES) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (filtered->children.empty()) {
|
if (filtered->children.empty()) {
|
||||||
|
|||||||
@@ -952,7 +952,7 @@ void mapping::addRepresentationsFromDefaultContexts(IfcSchema::IfcRepresentation
|
|||||||
allowed_context_types.insert("notdefined");
|
allowed_context_types.insert("notdefined");
|
||||||
|
|
||||||
std::set<std::string> context_types;
|
std::set<std::string> context_types;
|
||||||
if (settings_.get<settings::IncludeSurfaces>().get()) {
|
if (this->settings_.get<settings::OutputDimensionality>().get() != settings::CURVES) {
|
||||||
// Really this should only be 'Model', as per
|
// Really this should only be 'Model', as per
|
||||||
// the standard 'Design' is deprecated. So,
|
// the standard 'Design' is deprecated. So,
|
||||||
// just for backwards compatibility:
|
// just for backwards compatibility:
|
||||||
@@ -962,7 +962,7 @@ void mapping::addRepresentationsFromDefaultContexts(IfcSchema::IfcRepresentation
|
|||||||
context_types.insert("model view");
|
context_types.insert("model view");
|
||||||
context_types.insert("detail view");
|
context_types.insert("detail view");
|
||||||
}
|
}
|
||||||
if (settings_.get<settings::IncludeCurves>().get()) {
|
if (this->settings_.get<settings::OutputDimensionality>().get() != settings::SURFACES_AND_SOLIDS) {
|
||||||
context_types.insert("plan");
|
context_types.insert("plan");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1051,7 +1051,7 @@ IfcUtil::IfcBaseEntity* mapping::representation_of(const IfcUtil::IfcBaseEntity*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intersection->size() == 0 && settings_.get<settings::ContextIds>().has() && settings_.get<settings::IncludeCurves>().get() && !settings_.get<settings::IncludeSurfaces>().get()) {
|
if (intersection->size() == 0 && settings_.get<settings::ContextIds>().has() && this->settings_.get<settings::OutputDimensionality>().get() == settings::CURVES) {
|
||||||
for (auto& r : *of_product) {
|
for (auto& r : *of_product) {
|
||||||
if (r->RepresentationIdentifier() && *r->RepresentationIdentifier() == "Axis") {
|
if (r->RepresentationIdentifier() && *r->RepresentationIdentifier() == "Axis") {
|
||||||
intersection->push(r);
|
intersection->push(r);
|
||||||
|
|||||||
Reference in New Issue
Block a user