mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 22:12:32 +00:00
Reporting for wall connectivity
This commit is contained in:
@@ -29,21 +29,24 @@ void fix_wallconnectivity(IfcParse::IfcFile& f, bool no_progress, bool quiet, bo
|
|||||||
rel_by_elem.insert({{ x,y }, rel});
|
rel_by_elem.insert({{ x,y }, rel});
|
||||||
});
|
});
|
||||||
|
|
||||||
v([&c, &rel_by_elem](const intersection_validator::Box& a, const intersection_validator::Box& b) {
|
std::set<const IfcUtil::IfcBaseClass*> rels_encounted;
|
||||||
|
|
||||||
|
v([&c, &rel_by_elem, &rels_encounted](const intersection_validator::Box& a, const intersection_validator::Box& b) {
|
||||||
auto A = a.handle()->first;
|
auto A = a.handle()->first;
|
||||||
auto B = b.handle()->first;
|
auto B = b.handle()->first;
|
||||||
|
|
||||||
auto rit = rel_by_elem.find({ A, B });
|
const IfcUtil::IfcBaseClass* rel = nullptr;
|
||||||
if (rit == rel_by_elem.end()) {
|
std::string a_type, b_type;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto rel = rit->second;
|
auto rit = rel_by_elem.find({ A, B });
|
||||||
const bool a_is_relating = A == ((IfcUtil::IfcBaseEntity*)rel)->get_value<IfcUtil::IfcBaseClass*>("RelatingElement");
|
if (rit != rel_by_elem.end()) {
|
||||||
auto a_type = ((IfcUtil::IfcBaseEntity*)rel)->get_value<std::string>("RelatingConnectionType");
|
rel = rit->second;
|
||||||
auto b_type = ((IfcUtil::IfcBaseEntity*)rel)->get_value<std::string>("RelatedConnectionType");
|
const bool a_is_relating = A == ((IfcUtil::IfcBaseEntity*)rel)->get_value<IfcUtil::IfcBaseClass*>("RelatingElement");
|
||||||
if (!a_is_relating) {
|
a_type = ((IfcUtil::IfcBaseEntity*)rel)->get_value<std::string>("RelatingConnectionType");
|
||||||
std::swap(a_type, b_type);
|
b_type = ((IfcUtil::IfcBaseEntity*)rel)->get_value<std::string>("RelatedConnectionType");
|
||||||
|
if (!a_is_relating) {
|
||||||
|
std::swap(a_type, b_type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -104,8 +107,6 @@ void fix_wallconnectivity(IfcParse::IfcFile& f, bool no_progress, bool quiet, bo
|
|||||||
auto len = std::sqrt(CGAL::to_double(D.squared_length()));
|
auto len = std::sqrt(CGAL::to_double(D.squared_length()));
|
||||||
D /= len;
|
D /= len;
|
||||||
|
|
||||||
std::wcout << "xx " << len << std::endl;
|
|
||||||
|
|
||||||
std::vector<Kernel_::FT> parameters;
|
std::vector<Kernel_::FT> parameters;
|
||||||
|
|
||||||
std::transform(vertices(x_poly).begin(), vertices(x_poly).end(), std::back_inserter(parameters), [&P0, D](auto& v) {
|
std::transform(vertices(x_poly).begin(), vertices(x_poly).end(), std::back_inserter(parameters), [&P0, D](auto& v) {
|
||||||
@@ -113,17 +114,48 @@ void fix_wallconnectivity(IfcParse::IfcFile& f, bool no_progress, bool quiet, bo
|
|||||||
});
|
});
|
||||||
|
|
||||||
auto pit = std::minmax_element(parameters.begin(), parameters.end());
|
auto pit = std::minmax_element(parameters.begin(), parameters.end());
|
||||||
return std::make_pair(CGAL::to_double(*pit.first), CGAL::to_double(*pit.first));
|
return std::make_pair(len, std::make_pair(CGAL::to_double(*pit.first), CGAL::to_double(*pit.first)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return std::make_pair(std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN());
|
const auto& nan = std::numeric_limits<double>::quiet_NaN();
|
||||||
|
return std::make_pair(nan, std::make_pair(nan, nan));
|
||||||
};
|
};
|
||||||
|
|
||||||
auto u0u1 = get_axis_parameter_min_max(A);
|
auto qualify_connection_type = [](double l, const std::pair<double, double>& p) {
|
||||||
std::wcout << a_type.c_str() << " " << u0u1.first << " " << u0u1.second << std::endl;
|
if (p.first < 1.e-5) {
|
||||||
|
return "ATSTART";
|
||||||
|
} else if (p.second > l - 1.e-5) {
|
||||||
|
return "ATEND";
|
||||||
|
} else {
|
||||||
|
return "ATPATH";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
u0u1 = get_axis_parameter_min_max(B);
|
auto alu0u1 = get_axis_parameter_min_max(A);
|
||||||
std::wcout << b_type.c_str() << " " << u0u1.first << " " << u0u1.second << std::endl;
|
auto blu0u1 = get_axis_parameter_min_max(B);
|
||||||
|
|
||||||
|
auto atype_computed = qualify_connection_type(alu0u1.first, alu0u1.second);
|
||||||
|
auto btype_computed = qualify_connection_type(blu0u1.first, blu0u1.second);
|
||||||
|
|
||||||
|
rels_encounted.insert(rel);
|
||||||
|
|
||||||
|
if (a_type != atype_computed || b_type != btype_computed) {
|
||||||
|
if (rel) {
|
||||||
|
auto rel_str = rel->data().toString();
|
||||||
|
std::wcout << "ERROR: " << rel_str.c_str() << " " << atype_computed << " " << btype_computed << std::endl;
|
||||||
|
} else {
|
||||||
|
auto A_str = A->data().toString();
|
||||||
|
auto B_str = B->data().toString();
|
||||||
|
std::wcout << "ERROR: no rel " << A_str.c_str() << " x " << B_str.c_str() << " " << atype_computed << " " << btype_computed << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
std::for_each(rels->begin(), rels->end(), [&rels_encounted](const IfcUtil::IfcBaseClass* rel) {
|
||||||
|
if (rels_encounted.find(rel) == rels_encounted.end()) {
|
||||||
|
auto rel_str = rel->data().toString();
|
||||||
|
std::wcout << "ERROR: " << rel_str.c_str() << " not found" << std::endl;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user