After-merge clean-ups

This commit is contained in:
Thomas Krijnen
2026-07-09 13:30:48 +02:00
parent 7fc2d9a998
commit 561a23cfbc
164 changed files with 1373 additions and 1406 deletions
-14
View File
@@ -81,22 +81,8 @@ macro(build_schema_example exe_name schema)
endif()
endmacro()
if("4" IN_LIST SCHEMA_VERSIONS)
build_schema_example(arbitrary_open_profile_def 4)
build_schema_example(triangulated_faceset 4)
endif()
if("2x3" IN_LIST SCHEMA_VERSIONS)
build_schema_example(composite_profile_def 2x3)
build_schema_example(csg_primitive 2x3)
build_schema_example(ellipse_pies 2x3)
build_schema_example(faces 2x3)
build_schema_example(ifc_curve_rebar 2x3)
build_schema_example(profiles 2x3)
build_schema_example(IfcParseExamples 2x3 helpers)
if(WITH_OPENCASCADE)
build_schema_example(IfcOpenHouse 2x3 geometry_serializer)
build_schema_example(IfcAdvancedHouse 2x3 geometry_serializer)
endif()
endif()
+3 -4
View File
@@ -44,11 +44,10 @@
#define IfcSchema Ifc2x3
#endif
#include INCLUDE_SCHEMA(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA(ifcparse/schemas, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse/schemas, IfcSchema)
#include "ifcparse/IfcBaseClass.h"
#include "ifcparse/IfcHierarchyHelper.h"
#include "ifcparse/hierarchy_helper.h"
#include "../ifcgeom/Serialization/Serialization.h"
+3 -4
View File
@@ -41,11 +41,10 @@
#define IfcSchema Ifc2x3
#endif
#include INCLUDE_SCHEMA(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA(ifcparse/schemas, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse/schemas, IfcSchema)
#include "ifcparse/IfcBaseClass.h"
#include "ifcparse/IfcHierarchyHelper.h"
#include "ifcparse/hierarchy_helper.h"
#include "../ifcgeom/Serialization/Serialization.h"
+52 -99
View File
@@ -23,50 +23,16 @@
#define IfcSchema Ifc2x3
#endif
#include "ifcparse/IfcFile.h"
#include "ifcparse/IfcLogger.h"
#include "ifcparse/file.h"
#include "ifcparse/logger.h"
#include <boost/preprocessor/stringize.hpp>
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/seq/size.hpp>
#include <boost/preprocessor/seq/pop_back.hpp>
#include <boost/preprocessor/comparison/greater.hpp>
#include <boost/preprocessor/selection/min.hpp>
#include INCLUDE_SCHEMA(ifcparse/schemas, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse/schemas, IfcSchema)
#ifdef _MSC_VER
#define strcasecmp _stricmp
#endif
#ifndef SCHEMA_SEQ
static_assert(false, "A boost preprocessor sequence of schema identifiers is needed for this file to compile.");
#endif
// A macro cannot expand to an include directive, so unroll enough includes for
// the maximum number of schemas supported by the build configuration.
#define INCLUDE_SCHEMA_N(n) \
BOOST_PP_IIF(BOOST_PP_GREATER(BOOST_PP_SEQ_SIZE(SCHEMA_SEQ), n), \
BOOST_PP_STRINGIZE(ifcparse/BOOST_PP_CAT(Ifc, BOOST_PP_SEQ_ELEM(BOOST_PP_MIN(n, BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_POP_BACK(SCHEMA_SEQ))), SCHEMA_SEQ)).h), \
"ifcgeom/empty.h")
#include INCLUDE_SCHEMA_N(0)
#include INCLUDE_SCHEMA_N(1)
#include INCLUDE_SCHEMA_N(2)
#include INCLUDE_SCHEMA_N(3)
#include INCLUDE_SCHEMA_N(4)
#include INCLUDE_SCHEMA_N(5)
#include INCLUDE_SCHEMA_N(6)
#include INCLUDE_SCHEMA_N(7)
#include INCLUDE_SCHEMA_N(8)
#include INCLUDE_SCHEMA_N(9)
#include INCLUDE_SCHEMA_N(10)
#include INCLUDE_SCHEMA_N(11)
#include INCLUDE_SCHEMA_N(12)
#include INCLUDE_SCHEMA_N(13)
#include INCLUDE_SCHEMA_N(14)
#include INCLUDE_SCHEMA_N(15)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse/, IfcSchema)
#include <iomanip>
#if USE_VLD
@@ -121,117 +87,104 @@ std::string format_string(const AttributeValue& argument) {
}
template <typename Schema, typename T>
void process_pset(element_properties& props, const T* inst) {
void process_pset(element_properties& props, const T& inst) {
// Process an individual Property or Quantity set.
if (auto pset = inst->template as<typename Schema::IfcPropertySet>()) {
if (!pset->Name()) {
if (auto pset = inst.template as<typename Schema::IfcPropertySet>()) {
if (!pset.Name()) {
return;
}
auto ps = pset->HasProperties();
for (auto it = ps->begin(); it != ps->end(); ++it) {
auto& p = *it;
if (auto singleval = p->template as<typename Schema::IfcPropertySingleValue>()) {
auto ps = pset.HasProperties();
for (const auto& p : ps) {
if (auto singleval = p.template as<typename Schema::IfcPropertySingleValue>()) {
std::string propname, propvalue;
if constexpr (is_ifc4_or_higher<Schema>::value) {
if (!singleval->Name()) {
if (!singleval.Name()) {
continue;
}
propname = *singleval->Name();
propname = *singleval.Name();
}
if constexpr (!is_ifc4_or_higher<Schema>::value) {
propname = singleval->Name();
propname = *singleval.Name();
}
if (!singleval->NominalValue()) {
auto nominal_value = singleval.NominalValue();
if (!nominal_value) {
propvalue = "-";
} else {
props[*pset->Name()][propname] = format_string(singleval->NominalValue()->template as<IfcUtil::IfcBaseClass>()->get_attribute_value(0));
props[*pset.Name()][propname] = format_string(nominal_value.get_attribute_value(0));
}
}
}
}
if (auto qset = inst->template as<typename Schema::IfcElementQuantity>()) {
if (!qset->Name()) {
if (auto qset = inst.template as<typename Schema::IfcElementQuantity>()) {
if (!qset.Name()) {
return;
}
auto qs = qset->Quantities();
for (auto it = qs->begin(); it != qs->end(); ++it) {
auto& q = *it;
if (q->template as<typename Schema::IfcPhysicalSimpleQuantity>() && q->get_attribute_value(3).type() == IfcUtil::Argument_DOUBLE) {
double v = q->get_attribute_value(3);
props[*qset->Name()][q->Name()] = std::to_string(v);
auto qs = qset.Quantities();
for (const auto& q : qs) {
if (q.template as<typename Schema::IfcPhysicalSimpleQuantity>() && q.get_attribute_value(3).type() == IfcUtil::Argument_DOUBLE) {
double v = q.get_attribute_value(3);
props[*qset.Name()][q.Name()] = std::to_string(v);
}
}
}
if constexpr (is_ifc4_or_higher<Schema>::value) {
if (auto extprops = inst->template as<typename Schema::IfcExtendedProperties>()) {
if (auto extprops = inst.template as<typename Schema::IfcExtendedProperties>()) {
// @todo
}
}
}
template <typename Schema>
void get_psets_s(element_properties& props, const typename Schema::IfcObjectDefinition* inst) {
void get_psets_s(element_properties& props, const typename Schema::IfcObjectDefinition& inst) {
// Extracts the property definitions for an IFC instance.
if (auto tyob = inst->template as<typename Schema::IfcTypeObject>()) {
if (tyob->HasPropertySets()) {
auto defs = *tyob->HasPropertySets();
for (auto it = defs->begin(); it != defs->end(); ++it) {
auto& def = *it;
if (auto tyob = inst.template as<typename Schema::IfcTypeObject>()) {
if (tyob.HasPropertySets()) {
auto defs = *tyob.HasPropertySets();
for (const auto& def : defs) {
process_pset<Schema>(props, def);
}
}
}
if constexpr (is_ifc4_or_higher<Schema>::value) {
if (auto mdef = inst->template as<typename Schema::IfcMaterialDefinition>()) {
auto defs = mdef->HasProperties();
for (auto it = defs->begin(); it != defs->end(); ++it) {
auto& def = *it;
if (auto mdef = inst.template as<typename Schema::IfcMaterialDefinition>()) {
auto defs = mdef.HasProperties();
for (const auto& def : defs) {
process_pset<Schema>(props, def);
}
}
if (auto pdef = inst->template as<typename Schema::IfcProfileDef>()) {
auto defs = pdef->HasProperties();
for (auto it = defs->begin(); it != defs->end(); ++it) {
auto& def = *it;
if (auto pdef = inst.template as<typename Schema::IfcProfileDef>()) {
auto defs = pdef.HasProperties();
for (const auto& def : defs) {
process_pset<Schema>(props, def);
}
}
}
if (auto ob = inst->template as<typename Schema::IfcObject>()) {
if (auto ob = inst.template as<typename Schema::IfcObject>()) {
if constexpr (is_ifc4_or_higher<Schema>::value) {
auto rels = ob->IsTypedBy();
for (auto it = rels->begin(); it != rels->end(); ++it) {
auto& rel = *it;
get_psets_s<Schema>(props, rel->RelatingType());
auto rels = ob.IsTypedBy();
for (const auto& rel : rels) {
get_psets_s<Schema>(props, rel.RelatingType());
}
}
{
auto rels = ob->IsDefinedBy();
for (auto it = rels->begin(); it != rels->end(); ++it) {
auto& rel = *it;
if (auto bytype = rel->template as<typename Schema::IfcRelDefinesByType>()) {
get_psets_s<Schema>(props, bytype->RelatingType());
} else if (auto byprops = rel->template as<typename Schema::IfcRelDefinesByProperties>()) {
process_pset<Schema>(props, byprops->RelatingPropertyDefinition());
auto rels = ob.IsDefinedBy();
for (const auto& rel : rels) {
if (auto bytype = rel.template as<typename Schema::IfcRelDefinesByType>()) {
get_psets_s<Schema>(props, bytype.RelatingType());
} else if (auto byprops = rel.template as<typename Schema::IfcRelDefinesByProperties>()) {
process_pset<Schema>(props, byprops.RelatingPropertyDefinition());
}
}
}
}
}
// What follows is machinery to create a preprocessor-based dispatch mechanism to dispatch to the
// correct get_psets_s<Schema>() based on inst->declaration().schema()->name().
#define EXPAND_AND_CONCATENATE(elem) Ifc##elem
#define GENERATE_LITERAL_STRING(elem) "Ifc" # elem
#define TEST_AND_DISPATCH(r, data, elem) \
if (strcasecmp(schema_name, GENERATE_LITERAL_STRING(elem)) == 0) { get_psets_s<EXPAND_AND_CONCATENATE(elem)>(props, inst->as<EXPAND_AND_CONCATENATE(elem)::IfcObjectDefinition>()); }
void get_psets(element_properties& props, const IfcUtil::IfcBaseClass* inst) {
auto schema_name = inst->declaration().schema()->name().c_str();
BOOST_PP_SEQ_FOR_EACH(TEST_AND_DISPATCH, , SCHEMA_SEQ)
element_properties get_psets(const express::Base& inst) {
element_properties props;
if (auto object_definition = inst.as<IfcSchema::IfcObjectDefinition>()) {
get_psets_s<IfcSchema>(props, object_definition);
}
return props;
}
int main(int argc, char** argv) {
@@ -241,7 +194,7 @@ int main(int argc, char** argv) {
}
// Redirect the output (both progress and log) to stdout
Logger::Root().SetOutput(&std::cout, &std::cout);
::logger::root().set_output(&std::cout, &std::cout);
// Parse the IFC file provided in argv[1]
ifcopenshell::file file(argv[1]);
+3 -3
View File
@@ -34,10 +34,10 @@
#define IfcSchema Ifc4
#endif
#include INCLUDE_SCHEMA(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA(ifcparse/schemas, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse/schemas, IfcSchema)
#include "ifcparse/IfcHierarchyHelper.h"
#include "ifcparse/hierarchy_helper.h"
typedef std::string S;
typedef ifcopenshell::global_id guid;
+3 -3
View File
@@ -33,10 +33,10 @@
#define IfcSchema Ifc2x3
#endif
#include INCLUDE_SCHEMA(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA(ifcparse/schemas, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse/schemas, IfcSchema)
#include "ifcparse/IfcHierarchyHelper.h"
#include "ifcparse/hierarchy_helper.h"
typedef std::string S;
typedef ifcopenshell::global_id guid;
+3 -3
View File
@@ -33,10 +33,10 @@
#define IfcSchema Ifc2x3
#endif
#include INCLUDE_SCHEMA(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA(ifcparse/schemas, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse/schemas, IfcSchema)
#include "ifcparse/IfcHierarchyHelper.h"
#include "ifcparse/hierarchy_helper.h"
typedef std::string S;
typedef ifcopenshell::global_id guid;
+3 -3
View File
@@ -33,10 +33,10 @@
#define IfcSchema Ifc2x3
#endif
#include INCLUDE_SCHEMA(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA(ifcparse/schemas, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse/schemas, IfcSchema)
#include "ifcparse/IfcHierarchyHelper.h"
#include "ifcparse/hierarchy_helper.h"
typedef std::string S;
typedef ifcopenshell::global_id guid;
+3 -3
View File
@@ -29,10 +29,10 @@
#define IfcSchema Ifc2x3
#endif
#include INCLUDE_SCHEMA(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA(ifcparse/schemas, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse/schemas, IfcSchema)
#include "ifcparse/IfcHierarchyHelper.h"
#include "ifcparse/hierarchy_helper.h"
typedef std::string S;
typedef ifcopenshell::global_id guid;
+4 -4
View File
@@ -33,10 +33,10 @@
#define IfcSchema Ifc2x3
#endif
#include INCLUDE_SCHEMA(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA(ifcparse/schemas, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse/schemas, IfcSchema)
#include "ifcparse/IfcHierarchyHelper.h"
#include "ifcparse/hierarchy_helper.h"
#include <boost/math/constants/constants.hpp>
const static double PI = boost::math::constants::pi<double>();
@@ -57,7 +57,7 @@ typedef IfcSchema::IfcCompositeCurveSegment curve_segment_t;
#define IFC_REINFORCING_BAR_TYPE IfcSchema::IfcReinforcingBarRoleEnum::IfcReinforcingBarRole_LIGATURE
#endif
void create_curve_rebar(IfcHierarchyHelper<IfcSchema>& file)
void create_curve_rebar(hierarchy_helper<IfcSchema>& file)
{
int dia = 24;
int R = 3 * dia;
+3 -3
View File
@@ -33,10 +33,10 @@
#define IfcSchema Ifc2x3
#endif
#include INCLUDE_SCHEMA(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA(ifcparse/schemas, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse/schemas, IfcSchema)
#include "ifcparse/IfcHierarchyHelper.h"
#include "ifcparse/hierarchy_helper.h"
typedef std::string S;
typedef IfcWrite::IfcGuidHelper guid;
+3 -3
View File
@@ -33,10 +33,10 @@
#define IfcSchema Ifc4
#endif
#include INCLUDE_SCHEMA(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse, IfcSchema)
#include INCLUDE_SCHEMA(ifcparse/schemas, IfcSchema)
#include INCLUDE_SCHEMA_DEFINITIONS(ifcparse/schemas, IfcSchema)
#include "ifcparse/IfcHierarchyHelper.h"
#include "ifcparse/hierarchy_helper.h"
#include "suzanne_geometry.h"
+56 -56
View File
@@ -219,7 +219,7 @@ bool file_exists(const std::string& filename) {
static std::basic_stringstream<path_t::value_type> log_stream;
void write_log(bool);
void fix_quantities(ifcopenshell::file&, bool, bool, bool, Logger& logger = Logger::Root());
void fix_quantities(ifcopenshell::file&, bool, bool, bool, logger& logger = ::logger::root());
std::string format_duration(time_t start, time_t end);
/// @todo make the filters non-global
@@ -249,7 +249,7 @@ size_t read_filters_from_file(const std::string&, inclusion_filter&, inclusion_t
void parse_filter(geom_filter &, const std::vector<std::string>&);
std::vector<ifcopenshell::geometry::filter_t> setup_filters(const std::vector<geom_filter>&, const std::string&);
bool init_input_file(const std::string& filename, ifcopenshell::file*& ifc_file, bool no_progress, bool mmap, bool bypass_properties=false, Logger& logger = Logger::Root());
bool init_input_file(const std::string& filename, ifcopenshell::file*& ifc_file, bool no_progress, bool mmap, bool bypass_properties=false, logger& logger = ::logger::root());
// from https://stackoverflow.com/questions/31696328/boost-program-options-using-zero-parameter-options-multiple-times
struct verbosity_counter {
@@ -271,7 +271,7 @@ int main(int argc, char** argv) {
typedef po::command_line_parser command_line_parser;
typedef char char_t;
#endif
Logger logger;
logger logger;
inclusion_filter include_filter;
inclusion_traverse_filter include_traverse_filter;
@@ -464,15 +464,15 @@ int main(int argc, char** argv) {
if (num_threads <= 0) {
num_threads = std::thread::hardware_concurrency();
logger.Notice("SYS", 7, "Using " + std::to_string(num_threads) + " threads");
logger.notice("SYS", 7, "Using " + std::to_string(num_threads) + " threads");
}
if (vmap.count("log-format") == 1) {
boost::to_lower(log_format);
if (log_format == "plain") {
logger.OutputFormat(Logger::FMT_PLAIN);
logger.output_format(::logger::FMT_PLAIN);
} else if (log_format == "json") {
logger.OutputFormat(Logger::FMT_JSON);
logger.output_format(::logger::FMT_JSON);
} else {
cerr_ << "[error] --log-format should be either plain or json" << std::endl;
print_usage();
@@ -483,7 +483,7 @@ int main(int argc, char** argv) {
if (!filter_filename.empty()) {
size_t num_filters = read_filters_from_file(ifcopenshell::path::to_utf8(filter_filename), include_filter, include_traverse_filter, exclude_filter, exclude_traverse_filter);
if (num_filters) {
logger.Notice("SYS", 8, boost::lexical_cast<std::string>(num_filters) + " filters read from specifified file.");
logger.notice("SYS", 8, boost::lexical_cast<std::string>(num_filters) + " filters read from specifified file.");
} else {
cerr_ << "[error] No filters read from specifified file.\n";
return EXIT_FAILURE;
@@ -547,27 +547,27 @@ int main(int argc, char** argv) {
if (vmap.count("log-file")) {
log_fs.open(log_file.c_str(), std::ios::app);
logger.SetOutput(quiet ? nullptr : &cout_, &log_fs);
logger.set_output(quiet ? nullptr : &cout_, &log_fs);
} else {
logger.SetOutput(quiet ? nullptr : &cout_, vcounter.count > 1 ? &cout_ : &log_stream);
logger.set_output(quiet ? nullptr : &cout_, vcounter.count > 1 ? &cout_ : &log_stream);
}
switch (vcounter.count) {
case 0:
logger.Verbosity(Logger::LOG_ERROR);
logger.verbosity(::logger::LOG_ERROR);
break;
case 1:
logger.Verbosity(Logger::LOG_NOTICE);
logger.verbosity(::logger::LOG_NOTICE);
break;
case 2:
logger.Verbosity(Logger::LOG_DEBUG);
logger.verbosity(::logger::LOG_DEBUG);
break;
case 3:
logger.Verbosity(Logger::LOG_PERF);
logger.verbosity(::logger::LOG_PERF);
break;
case 4:
logger.Verbosity(Logger::LOG_PERF);
logger.PrintPerformanceStatsOnElement(true);
logger.verbosity(::logger::LOG_PERF);
logger.print_performance_stats_on_element(true);
break;
}
@@ -637,7 +637,7 @@ int main(int argc, char** argv) {
exit_code = EXIT_SUCCESS;
}
} catch (const std::exception& e) {
logger.Error("SYS", 9, e);
logger.error("SYS", 9, e);
}
write_log(!quiet);
return exit_code;
@@ -660,13 +660,13 @@ int main(int argc, char** argv) {
fs << *ifc_file;
exit_code = EXIT_SUCCESS;
} else {
logger.Error("SYS", 10, "Unable to open output file for writing");
logger.error("SYS", 10, "Unable to open output file for writing");
}
time(&end);
logger.Status("Done! Writing IFC took " + format_duration(start, end));
logger.status("Done! Writing IFC took " + format_duration(start, end));
}
} catch (const std::exception& e) {
logger.Error("SYS", 11, e);
logger.error("SYS", 11, e);
}
write_log(!quiet);
return exit_code;
@@ -699,9 +699,9 @@ int main(int argc, char** argv) {
return EXIT_FAILURE;
}
if (!entity_filter.entity_names.empty()) { entity_filter.update_description(); logger.Notice("SYS", 13, entity_filter.description); }
if (!layer_filter.values.empty()) { layer_filter.update_description(); logger.Notice("SYS", 14, layer_filter.description); }
if (!attribute_filter.attribute_name.empty()) { attribute_filter.update_description(); logger.Notice("SYS", 15, attribute_filter.description); }
if (!entity_filter.entity_names.empty()) { entity_filter.update_description(); logger.notice("SYS", 13, entity_filter.description); }
if (!layer_filter.values.empty()) { layer_filter.update_description(); logger.notice("SYS", 14, layer_filter.description); }
if (!attribute_filter.attribute_name.empty()) { attribute_filter.update_description(); logger.notice("SYS", 15, attribute_filter.description); }
if (geometry_serializer_info && geometry_serializer_info->requires_ascii_temp_file) {
// These serializers do not support opening unicode paths. Therefore
@@ -767,13 +767,13 @@ int main(int argc, char** argv) {
const bool is_tesselated = serializer->isTesselated(); // isTesselated() doesn't change at run-time
if (!is_tesselated) {
if (geometry_settings.get<ifcopenshell::geometry::settings::WeldVertices>().get()) {
logger.Notice("SYS", 16, "Weld vertices setting ignored when writing non-tesselated output");
logger.notice("SYS", 16, "Weld vertices setting ignored when writing non-tesselated output");
}
if (geometry_settings.get<ifcopenshell::geometry::settings::GenerateUvs>().get()) {
logger.Notice("SYS", 17, "Generate UVs setting ignored when writing non-tesselated output");
logger.notice("SYS", 17, "Generate UVs setting ignored when writing non-tesselated output");
}
if (center_model || center_model_geometry) {
logger.Notice("SYS", 18, "Centering/offsetting model setting ignored when writing non-tesselated output");
logger.notice("SYS", 18, "Centering/offsetting model setting ignored when writing non-tesselated output");
}
geometry_settings.get<ifcopenshell::geometry::settings::IteratorOutput>().value = ifcopenshell::geometry::settings::NATIVE;
@@ -799,9 +799,9 @@ int main(int argc, char** argv) {
}
if (vmap.count("log-file")) {
logger.SetOutput(quiet ? nullptr : &cout_, &log_fs);
logger.set_output(quiet ? nullptr : &cout_, &log_fs);
} else {
logger.SetOutput(quiet ? nullptr : &cout_, vcounter.count > 1 ? &cout_ : &log_stream);
logger.set_output(quiet ? nullptr : &cout_, vcounter.count > 1 ? &cout_ : &log_stream);
}
if (model_rotation) {
@@ -816,13 +816,13 @@ int main(int argc, char** argv) {
std::stringstream msg;
msg << "Using model rotation (" << rotation[0] << "," << rotation[1] << "," << rotation[2] << "," << rotation[3] << ")";
logger.Notice("SYS", 19, msg.str());
logger.notice("SYS", 19, msg.str());
geometry_settings.get<ifcopenshell::geometry::settings::ModelRotation>().value = rotation;
}
if (model_offset && (center_model || center_model_geometry)) {
logger.Notice("GEO", 22, "--model-offset ignored with --center-model or --center-model-geometry");
logger.notice("GEO", 22, "--model-offset ignored with --center-model or --center-model-geometry");
}
if (model_offset && !(center_model || center_model_geometry)) {
@@ -837,7 +837,7 @@ int main(int argc, char** argv) {
std::stringstream msg;
msg << std::setprecision(std::numeric_limits<double>::max_digits10) << "Using model offset (" << offset[0] << "," << offset[1] << "," << offset[2] << ")";
logger.Notice("SYS", 20, msg.str());
logger.notice("SYS", 20, msg.str());
geometry_settings.get<ifcopenshell::geometry::settings::ModelOffset>().value = offset;
}
@@ -845,17 +845,17 @@ int main(int argc, char** argv) {
if (is_tesselated && (center_model || center_model_geometry)) {
std::vector<double> offset(3);
IfcGeom::Iterator tmp_context_iterator(ifcopenshell::geometry::kernels::construct(ifc_file, geometry_kernel, geometry_settings, logger), geometry_settings, ifc_file, filter_funcs, num_threads, logger);
IfcGeom::Iterator tmp_context_iterator(ifcopenshell::geometry::kernels::construct(ifc_file, geometry_kernel, geometry_settings), geometry_settings, ifc_file, filter_funcs, num_threads, logger);
time_t start, end;
time(&start);
if (!quiet) logger.Status("Computing bounds...");
if (!quiet) logger.status("Computing bounds...");
if (center_model_geometry) {
if (!tmp_context_iterator.initialize()) {
/// @todo It would be nice to know and print separate error prints for a case where we found no entities
/// and for a case we found no entities that satisfy our filtering criteria.
logger.Notice("GEO", 23, "No geometrical elements found or none successfully converted");
logger.notice("GEO", 23, "No geometrical elements found or none successfully converted");
serializer.reset();
ifcopenshell::path::delete_file(ifcopenshell::path::to_utf8(output_temp_filename));
write_log(!quiet);
@@ -866,7 +866,7 @@ int main(int argc, char** argv) {
tmp_context_iterator.compute_bounds(center_model_geometry);
time(&end);
if (!quiet) logger.Status("Done ! Bounds computed in " + format_duration(start, end));
if (!quiet) logger.status("Done ! Bounds computed in " + format_duration(start, end));
auto center = (tmp_context_iterator.bounds_min().ccomponents() + tmp_context_iterator.bounds_max().ccomponents()) * 0.5;
offset[0] = -center(0);
@@ -875,7 +875,7 @@ int main(int argc, char** argv) {
std::stringstream msg;
msg << std::setprecision (std::numeric_limits<double>::max_digits10) << "Using model offset (" << offset[0] << "," << offset[1] << "," << offset[2] << ")";
logger.Notice("SYS", 21, msg.str());
logger.notice("SYS", 21, msg.str());
geometry_settings.get<ifcopenshell::geometry::settings::ModelOffset>().value = offset;
}
@@ -891,15 +891,15 @@ int main(int argc, char** argv) {
std::unique_ptr<IfcGeom::Iterator> context_iterator;
if (!elems_from_adaptor) {
context_iterator.reset(new IfcGeom::Iterator(ifcopenshell::geometry::kernels::construct(ifc_file, geometry_kernel, geometry_settings, logger), geometry_settings, ifc_file, filter_funcs, num_threads, logger));
context_iterator.reset(new IfcGeom::Iterator(ifcopenshell::geometry::kernels::construct(ifc_file, geometry_kernel, geometry_settings), geometry_settings, ifc_file, filter_funcs, num_threads, logger));
}
logger.message(logger::LOG_PERF, "file geometry conversion");
logger.message(::logger::LOG_PERF, "file geometry conversion");
if (context_iterator && !context_iterator->initialize()) {
/// @todo It would be nice to know and print separate error prints for a case where we found no entities
/// and for a case we found no entities that satisfy our filtering criteria.
logger.Notice("GEO", 25, "No geometrical elements found or none successfully converted");
logger.notice("GEO", 25, "No geometrical elements found or none successfully converted");
serializer.reset();
ifcopenshell::path::delete_file(ifcopenshell::path::to_utf8(output_temp_filename));
write_log(!quiet);
@@ -919,7 +919,7 @@ int main(int argc, char** argv) {
int old_progress = quiet ? 0 : -1;
if (!quiet) {
logger.Status("Creating geometry...");
logger.status("Creating geometry...");
}
// The functions IfcGeom::Iterator::get() and IfcGeom::Iterator::next()
@@ -964,10 +964,10 @@ int main(int argc, char** argv) {
if (stderr_progress)
cerr_ << std::flush;
} else if (vcounter.count == 2) {
logger.Message(Logger::LOG_DEBUG, "SYS", 23, "Progress " + boost::lexical_cast<std::string>(progress));
logger.message(::logger::LOG_DEBUG, "SYS", 23, "Progress " + boost::lexical_cast<std::string>(progress));
} else {
progress = progress / 2;
if (old_progress != progress) logger.ProgressBar(progress);
if (old_progress != progress) logger.progress_bar(progress);
old_progress = progress;
}
}
@@ -996,7 +996,7 @@ int main(int argc, char** argv) {
}
} else {
const std::string task = ((num_threads == 1) ? "creating" : "writing");
logger.Status("\rDone " + task + " geometry (" + boost::lexical_cast<std::string>(num_created) +
logger.status("\rDone " + task + " geometry (" + boost::lexical_cast<std::string>(num_created) +
" objects) ");
}
@@ -1004,7 +1004,7 @@ int main(int argc, char** argv) {
// Make sure the dtor is explicitly run here (e.g. output files are closed before renaming them).
serializer.reset();
logger.Message(Logger::LOG_PERF, "GEO", 26, "done file geometry conversion");
logger.message(::logger::LOG_PERF, "GEO", 26, "done file geometry conversion");
bool successful;
if (geometry_serializer_info->writes_final_output) {
@@ -1022,13 +1022,13 @@ int main(int argc, char** argv) {
output_temp_filename << "' for the conversion result.";
}
if (geometry_settings.get<ifcopenshell::geometry::settings::ValidateQuantities>().get() && logger.MaxSeverity() >= Logger::LOG_ERROR) {
logger.Error("SYS", 24, "Errors encountered during processing.");
if (geometry_settings.get<ifcopenshell::geometry::settings::ValidateQuantities>().get() && logger.max_severity() >= ::logger::LOG_ERROR) {
logger.error("SYS", 24, "Errors encountered during processing.");
successful = false;
}
if (logger.Verbosity() == Logger::LOG_PERF) {
logger.PrintPerformanceStats();
if (logger.verbosity() == ::logger::LOG_PERF) {
logger.print_performance_stats();
}
write_log(!quiet);
@@ -1036,7 +1036,7 @@ int main(int argc, char** argv) {
time(&end);
if (!quiet) {
logger.Status("\nConversion took " + format_duration(start, end));
logger.status("\nConversion took " + format_duration(start, end));
}
return successful ? EXIT_SUCCESS : EXIT_FAILURE;
@@ -1074,7 +1074,7 @@ void write_log(bool header) {
#include <boost/algorithm/string/predicate.hpp>
bool init_input_file(const std::string& filename, ifcopenshell::file*& ifc_file, bool no_progress, bool mmap, bool bypass_properties, Logger& logger) {
bool init_input_file(const std::string& filename, ifcopenshell::file*& ifc_file, bool no_progress, bool mmap, bool bypass_properties, logger& logger) {
time_t start, end;
// Prevent file::Init() prints by setting output to null temporarily
@@ -1111,13 +1111,13 @@ bool init_input_file(const std::string& filename, ifcopenshell::file*& ifc_file,
}
if (!ifc_file || !ifc_file->good()) {
logger.Error("SYN", 1, "Unable to parse input file '" + filename + "'");
logger.error("SYN", 1, "Unable to parse input file '" + filename + "'");
return false;
}
time(&end);
if (no_progress) { logger.SetOutput(&cout_, &log_stream); }
else { logger.Status("Parsing input file took " + format_duration(start, end)); }
if (no_progress) { logger.set_output(&cout_, &log_stream); }
else { logger.status("Parsing input file took " + format_duration(start, end)); }
return true;
@@ -1330,7 +1330,7 @@ namespace latebound_access {
}
}
void fix_quantities(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress, Logger& logger) {
void fix_quantities(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress, logger& logger) {
{
auto delete_reversed = [&f](const std::vector<express::Base>& insts) {
// Lists are traversed back to front as the list may be mutated when
@@ -1381,7 +1381,7 @@ void fix_quantities(ifcopenshell::file& f, bool no_progress, bool quiet, bool st
settings.get<ifcopenshell::geometry::settings::ConvertBackUnits>().value = true;
settings.get<ifcopenshell::geometry::settings::IteratorOutput>().value = ifcopenshell::geometry::settings::NATIVE;
IfcGeom::Iterator context_iterator(ifcopenshell::geometry::kernels::construct(&f, "opencascade", settings, logger), settings, &f, {}, 1, logger);
IfcGeom::Iterator context_iterator(ifcopenshell::geometry::kernels::construct(&f, "opencascade", settings), settings, &f, {}, 1, logger);
if (!context_iterator.initialize()) {
return;
@@ -1508,7 +1508,7 @@ void fix_quantities(ifcopenshell::file& f, bool no_progress, bool quiet, bool st
cerr_ << std::flush;
} else {
const int progress = context_iterator.progress() / 2;
if (old_progress != progress) logger.ProgressBar(progress);
if (old_progress != progress) logger.progress_bar(progress);
old_progress = progress;
}
}
@@ -1524,7 +1524,7 @@ void fix_quantities(ifcopenshell::file& f, bool no_progress, bool quiet, bool st
if (stderr_progress)
cerr_ << std::flush;
} else {
logger.Status("\rDone writing quantities for " + boost::lexical_cast<std::string>(num_created) +
logger.status("\rDone writing quantities for " + boost::lexical_cast<std::string>(num_created) +
" objects ");
}
+5 -5
View File
@@ -18,7 +18,7 @@ typedef CGAL::AABB_traits<Kernel_, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
typedef Tree::Point_and_primitive_id Point_and_primitive_id;
void fix_spaceboundaries(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress, Logger& logger = Logger::Root()) {
void fix_spaceboundaries(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress, logger& logger = ::logger::root()) {
intersection_validator v(f, { "IfcWall", "IfcSpace", "IfcSlab", "IfcCovering" }, 1.e-5, no_progress, quiet, stderr_progress, logger);
auto rels = f.instances_by_type("IfcRelSpaceBoundary");
@@ -54,7 +54,7 @@ void fix_spaceboundaries(ifcopenshell::file& f, bool no_progress, bool quiet, bo
settings.get<ifcopenshell::geometry::settings::IteratorOutput>().value = ifcopenshell::geometry::settings::NATIVE;
settings.get<ifcopenshell::geometry::settings::DisableOpeningSubtractions>().value = true;
ifcopenshell::geometry::Converter c(ifcopenshell::geometry::kernels::construct(&f2, "cgal", settings, logger), &f2, settings, logger);
ifcopenshell::geometry::Converter c(ifcopenshell::geometry::kernels::construct(&f2, "cgal", settings), &f2, settings, logger);
std::map<std::set<std::string>, std::vector<Kernel_::Point_3>> elem_to_space_boundary_coords;
@@ -128,7 +128,7 @@ void fix_spaceboundaries(ifcopenshell::file& f, bool no_progress, bool quiet, bo
auto itelem = elem_to_space_boundary_coords.find({ Aguid, Bguid });
if (itelem == elem_to_space_boundary_coords.end()) {
logger.Error("VAL", 1, "Missing space boundary relationship " + Aguid + " " + Bguid);
logger.error("VAL", 1, "Missing space boundary relationship " + Aguid + " " + Bguid);
return;
}
@@ -141,7 +141,7 @@ void fix_spaceboundaries(ifcopenshell::file& f, bool no_progress, bool quiet, bo
bool valid = *std::max_element(distances.begin(), distances.end()) < 0.4;
if (!valid) {
logger.Error("VAL", 2, "Wrong connection geometry " + Aguid + " " + Bguid);
logger.error("VAL", 2, "Wrong connection geometry " + Aguid + " " + Bguid);
}
/*{
@@ -178,7 +178,7 @@ void fix_spaceboundaries(ifcopenshell::file& f, bool no_progress, bool quiet, bo
auto g1 = n.substr(0, 22);
auto g2 = n.substr(23);
if (is_wall_space_or_slab(g1) && is_wall_space_or_slab(g2) && guid_pairs_visited.find({ g1, g2 }) == guid_pairs_visited.end()) {
logger.Error("VAL", 3, "Space boundary for non-bounding geometry " + g1 + " " + g2);
logger.error("VAL", 3, "Space boundary for non-bounding geometry " + g1 + " " + g2);
}
}
}
@@ -9,7 +9,7 @@
#include <algorithm>
void fix_storeycontainment(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress, Logger& logger = Logger::Root()) {
void fix_storeycontainment(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress, logger& logger = ::logger::root()) {
ifcopenshell::geometry::Settings settings;
settings.get<ifcopenshell::geometry::settings::UseWorldCoords>().value = false;
@@ -23,7 +23,7 @@ void fix_storeycontainment(ifcopenshell::file& f, bool no_progress, bool quiet,
IfcGeom::entity_filter(false, false, {"IfcOpeningElement", "IfcSpace"})
};
IfcGeom::Iterator context_iterator(ifcopenshell::geometry::kernels::construct(&f, "cgal", settings, logger), settings, &f, no_openings_and_spaces, 1, logger);
IfcGeom::Iterator context_iterator(ifcopenshell::geometry::kernels::construct(&f, "cgal", settings), settings, &f, no_openings_and_spaces, 1, logger);
auto get_elevation = [](const ifcopenshell::IfcBaseClass* a) {
return ((const ifcopenshell::IfcBaseEntity*)a)->get_value<double>("Elevation", 0.);
@@ -198,7 +198,7 @@ void fix_storeycontainment(ifcopenshell::file& f, bool no_progress, bool quiet,
auto s = geom_object->product()->get_value<std::string>("GlobalId");
auto s1 = ((IfcUtil::IfcBaseEntity*)storeys_sorted[calc_idx])->get_value<std::string>("GlobalId");
auto s2 = ((IfcUtil::IfcBaseEntity*)elem_to_storey[geom_object->product()])->get_value<std::string>("GlobalId");
logger.Error("VAL", 4, "Element " + s + " contained in " + s2 + " located on " + s1);
logger.error("VAL", 4, "Element " + s + " contained in " + s2 + " located on " + s1);
}
if (!no_progress) {
@@ -214,7 +214,7 @@ void fix_storeycontainment(ifcopenshell::file& f, bool no_progress, bool quiet,
std::cerr << std::flush;
} else {
const int progress = context_iterator.progress() / 2;
if (old_progress != progress) logger.ProgressBar(progress);
if (old_progress != progress) logger.progress_bar(progress);
old_progress = progress;
}
}
@@ -230,7 +230,7 @@ void fix_storeycontainment(ifcopenshell::file& f, bool no_progress, bool quiet,
if (stderr_progress)
std::cerr << std::flush;
} else {
logger.Status("\rDone fixing space boundaries for " + boost::lexical_cast<std::string>(num_created) +
logger.status("\rDone fixing space boundaries for " + boost::lexical_cast<std::string>(num_created) +
" objects ");
}
}
@@ -9,7 +9,7 @@
using namespace ifcopenshell::geometry;
void fix_wallconnectivity(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress, Logger& logger = Logger::Root()) {
void fix_wallconnectivity(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress, logger& logger = ::logger::root()) {
intersection_validator v(f, { "IfcWall" }, 1.e-3, no_progress, quiet, stderr_progress, logger);
ifcopenshell::geometry::Settings settings;
@@ -24,7 +24,7 @@ void fix_wallconnectivity(ifcopenshell::file& f, bool no_progress, bool quiet, b
settings.get<ifcopenshell::geometry::settings::IncludeCurves>().value = true;
settings.get<ifcopenshell::geometry::settings::IncludeSurfaces>().value = false;
ifcopenshell::geometry::Converter c(ifcopenshell::geometry::kernels::construct(&f, "cgal", settings, logger), &f, settings, logger);
ifcopenshell::geometry::Converter c(ifcopenshell::geometry::kernels::construct(&f, "cgal", settings), &f, settings, logger);
auto rels = f.instances_by_type("IfcRelConnectsPathElements");
std::map<std::set<const ifcopenshell::IfcBaseClass*>, const ifcopenshell::IfcBaseClass*> rel_by_elem;
@@ -169,11 +169,11 @@ void fix_wallconnectivity(ifcopenshell::file& f, bool no_progress, bool quiet, b
if (a_type != atype_computed || b_type != btype_computed) {
if (rel) {
logger.Error("VAL", 5, std::string("Connection type ") + atype_computed + " " + btype_computed + " for:", rel);
logger.error("VAL", 5, std::string("Connection type ") + atype_computed + " " + btype_computed + " for:", rel);
} else {
auto A_str = A->get_value<std::string>("GlobalId");
auto B_str = B->get_value<std::string>("GlobalId");
logger.Error("VAL", 6, "No connection for adjacent " + A_str + " " + B_str);
logger.error("VAL", 6, "No connection for adjacent " + A_str + " " + B_str);
}
}
});
@@ -183,7 +183,7 @@ void fix_wallconnectivity(ifcopenshell::file& f, bool no_progress, bool quiet, b
auto x = (ifcopenshell::IfcBaseEntity*)((ifcopenshell::IfcBaseEntity*)rel)->get_value<ifcopenshell::IfcBaseClass*>("RelatingElement");
auto y = (ifcopenshell::IfcBaseEntity*)((ifcopenshell::IfcBaseEntity*)rel)->get_value<ifcopenshell::IfcBaseClass*>("RelatedElement");
if (v.successfully_processed.find(x) != v.successfully_processed.end() && v.successfully_processed.find(y) != v.successfully_processed.end()) {
logger.Error("VAL", 7, "Connection for non-adjacent walls", rel);
logger.error("VAL", 7, "Connection for non-adjacent walls", rel);
}
}
});
+4 -4
View File
@@ -446,7 +446,7 @@ struct intersection_validator {
std::set<const ifcopenshell::IfcBaseEntity*> successfully_processed;
intersection_validator(ifcopenshell::file& f, std::initializer_list<std::string> entities, double eps, bool no_progress, bool quiet, bool stderr_progress, Logger& logger = Logger::Root()) {
intersection_validator(ifcopenshell::file& f, std::initializer_list<std::string> entities, double eps, bool no_progress, bool quiet, bool stderr_progress, logger& logger = ::logger::root()) {
ifcopenshell::geometry::Settings settings;
settings.get<ifcopenshell::geometry::settings::UseWorldCoords>().value = false;
@@ -460,7 +460,7 @@ struct intersection_validator {
IfcGeom::entity_filter(true, false, entities)
};
IfcGeom::Iterator context_iterator(ifcopenshell::geometry::kernels::construct(&f, "cgal", settings, logger), settings, &f, spaces_and_walls, 1, logger);
IfcGeom::Iterator context_iterator(ifcopenshell::geometry::kernels::construct(&f, "cgal", settings), settings, &f, spaces_and_walls, 1, logger);
if (!context_iterator.initialize()) {
return;
@@ -563,7 +563,7 @@ struct intersection_validator {
std::cerr << std::flush;
} else {
const int progress = context_iterator.progress() / 2;
if (old_progress != progress) logger.ProgressBar(progress);
if (old_progress != progress) logger.progress_bar(progress);
old_progress = progress;
}
}
@@ -579,7 +579,7 @@ struct intersection_validator {
if (stderr_progress)
std::cerr << std::flush;
} else {
logger.Status("\rDone fixing space boundaries for " + boost::lexical_cast<std::string>(num_created) +
logger.status("\rDone fixing space boundaries for " + boost::lexical_cast<std::string>(num_created) +
" objects ");
}
+3 -3
View File
@@ -20,8 +20,8 @@ bool ifcopenshell::geometry::kernels::AbstractKernel::convert(const taxonomy::pt
auto it = cache_.find(item);
if (it != cache_.end()) {
results = it->second;
logger_.Notice("SYS", 25, "Cache hit #" + std::to_string(item->instance->as<IfcUtil::IfcBaseEntity>()->id()) +
" -> #" + std::to_string(it->first->instance->as<IfcUtil::IfcBaseEntity>()->id()));
logger_.notice("SYS", 25, "Cache hit #" + std::to_string(item->instance.id()) +
" -> #" + std::to_string(it->first->instance.id()));
return true;
}
}
@@ -30,7 +30,7 @@ bool ifcopenshell::geometry::kernels::AbstractKernel::convert(const taxonomy::pt
try {
return fn();
} catch (std::exception& e) {
logger_.Error("GEO", 27, e, item->instance);
logger_.error("GEO", 27, e, item->instance);
return false;
} catch (...) {
// @todo we can't log OCCT exceptions here, can we do some reraising to solve this?
+10 -10
View File
@@ -66,12 +66,12 @@ namespace ifcopenshell {
protected:
std::string geometry_library_;
Settings settings_;
Logger& logger_;
::logger& logger_;
public:
bool propagate_exceptions = false;
bool partial_success_is_success = true;
AbstractKernel(const std::string& geometry_library, const Settings& settings, Logger& logger = Logger::Root())
AbstractKernel(const std::string& geometry_library, const Settings& settings, ::logger& logger = ::logger::root())
: geometry_library_(geometry_library)
, settings_(settings)
, logger_(logger) {}
@@ -89,7 +89,7 @@ namespace ifcopenshell {
virtual bool accepts(const IfcGeom::ConversionResultShape& shape) const {
return shape.backend_id() == backend_id();
}
Logger& logger() const { return logger_; }
::logger& logger() const { return logger_; }
virtual bool supports_boolean_operations() const = 0;
@@ -137,7 +137,7 @@ namespace ifcopenshell {
const IfcGeom::ConversionResults& entity_shapes, const ifcopenshell::geometry::taxonomy::matrix4& entity_trsf, IfcGeom::ConversionResults& cut_shapes) = 0;
virtual bool unify_shapes(const IfcGeom::ConversionResults&, IfcGeom::ConversionResults&) { throw not_implemented_error(); }
virtual AbstractKernel* clone(Logger& logger) const = 0;
virtual AbstractKernel* clone(::logger& logger) const = 0;
};
}
}
@@ -164,9 +164,9 @@ namespace {
if (kernel->partial_success_is_success) {
std::string created_from;
if (item->instance) {
created_from = " (created from " + item->instance->declaration().name() + ")";
created_from = " (created from " + item->instance.declaration().name() + ")";
}
kernel->logger().Error("UNS", 1, "No support for " + ifcopenshell::geometry::taxonomy::kind_to_string(item->kind()) + created_from + " in kernel " + kernel->geometry_library());
kernel->logger().error("UNS", 1, "No support for " + ifcopenshell::geometry::taxonomy::kind_to_string(item->kind()) + created_from + " in kernel " + kernel->geometry_library());
}
return false;
}
@@ -190,9 +190,9 @@ namespace {
if (kernel->partial_success_is_success) {
std::string created_from;
if (item->instance) {
created_from = " (created from " + item->instance->declaration().name() + ")";
created_from = " (created from " + item->instance.declaration().name() + ")";
}
kernel->logger().Error("UNS", 2, "No support (after considering item upgrade) for " + ifcopenshell::geometry::taxonomy::kind_to_string(item->kind()) + created_from + " in kernel " + kernel->geometry_library());
kernel->logger().error("UNS", 2, "No support (after considering item upgrade) for " + ifcopenshell::geometry::taxonomy::kind_to_string(item->kind()) + created_from + " in kernel " + kernel->geometry_library());
}
return false;
}
@@ -229,7 +229,7 @@ namespace {
template <typename T>
struct dispatch_curve_creation<T, ifcopenshell::geometry::taxonomy::curves::max> {
static bool dispatch(const ifcopenshell::geometry::taxonomy::ptr& item, T&) {
Logger::Root().Error("GEO", 28, "No conversion for " + std::to_string(item->kind()));
::logger::root().error("GEO", 28, "No conversion for " + std::to_string(item->kind()));
return false;
}
};
@@ -251,7 +251,7 @@ namespace {
template <typename T>
struct dispatch_surface_creation<T, ifcopenshell::geometry::taxonomy::surfaces::max> {
static bool dispatch(const ifcopenshell::geometry::taxonomy::ptr& item, T&) {
Logger::Root().Error("GEO", 29, "No conversion for " + std::to_string(item->kind()));
::logger::root().error("GEO", 29, "No conversion for " + std::to_string(item->kind()));
return false;
}
};
+1 -1
View File
@@ -1,7 +1,7 @@
#include "ConversionResult.h"
#include "IfcGeomRepresentation.h"
IfcGeom::Representation::Triangulation* IfcGeom::ConversionResultShape::Triangulate(const ifcopenshell::geometry::Settings& settings, Logger& logger) const
IfcGeom::Representation::Triangulation* IfcGeom::ConversionResultShape::Triangulate(const ifcopenshell::geometry::Settings& settings, ::logger& logger) const
{
auto t = IfcGeom::Representation::Triangulation::empty(settings);
static ifcopenshell::geometry::taxonomy::matrix4 iden;
+7 -24
View File
@@ -233,9 +233,6 @@ namespace IfcGeom {
template <typename T>
struct is_shared_ptr<std::shared_ptr<T>> : std::true_type {};
// @todo this can simply be a template class, to remove the need for the NumberEpeck in CGAL kernel.
#ifndef SWIG
class IFC_GEOM_API NumberNativeDouble : public OpaqueNumber {
private:
std::shared_ptr<const NumberConcept> data_;
@@ -352,23 +349,6 @@ namespace IfcGeom {
return negated();
}
};
#else
class IFC_GEOM_API NumberNativeDouble : public OpaqueNumber {
public:
NumberNativeDouble(double v);
virtual double to_double() const;
virtual std::string to_string() const;
virtual OpaqueNumber* operator+(OpaqueNumber* other) const;
virtual OpaqueNumber* operator-(OpaqueNumber* other) const;
virtual OpaqueNumber* operator*(OpaqueNumber* other) const;
virtual OpaqueNumber* operator/(OpaqueNumber* other) const;
virtual bool operator==(OpaqueNumber* other) const;
virtual bool operator<(OpaqueNumber* other) const;
virtual OpaqueNumber* operator-() const;
virtual OpaqueNumber* clone() const;
};
#endif
#ifndef SWIG
template <size_t N>
struct IFC_GEOM_API OpaqueCoordinate {
@@ -514,8 +494,11 @@ namespace IfcGeom {
OpaqueCoordinate(const OpaqueCoordinate& other);
OpaqueCoordinate& operator=(const OpaqueCoordinate& other);
~OpaqueCoordinate();
OpaqueNumber* get(size_t i) const;
void set(size_t i, OpaqueNumber* n);
std::size_t size() const;
OpaqueNumber get(size_t i) const;
double get_double(size_t i) const;
void set(size_t i, const OpaqueNumber& n);
std::vector<double> to_double() const;
};
#endif
@@ -526,8 +509,8 @@ namespace IfcGeom {
#else
virtual std::string_view backend_id() const = 0;
#endif
virtual void Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, Representation::Triangulation* t, int item_id, int surface_style_id) const = 0;
IfcGeom::Representation::Triangulation* Triangulate(const ifcopenshell::geometry::Settings& settings, Logger& logger = Logger::Root()) const;
virtual void Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, Representation::Triangulation* t, int item_id, int surface_style_id, ::logger& logger = ::logger::root()) const = 0;
IfcGeom::Representation::Triangulation* Triangulate(const ifcopenshell::geometry::Settings& settings, ::logger& logger = ::logger::root()) const;
virtual void Serialize(const ifcopenshell::geometry::taxonomy::matrix4& place, std::string&) const = 0;
virtual int surface_genus() const = 0;
+18 -18
View File
@@ -4,7 +4,7 @@
using namespace ifcopenshell::geometry;
ifcopenshell::geometry::Converter::Converter(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, ifcopenshell::file* file, ifcopenshell::geometry::Settings& s, Logger& logger)
ifcopenshell::geometry::Converter::Converter(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, ifcopenshell::file* file, ifcopenshell::geometry::Settings& s, ::logger& logger)
: kernel_(std::move(geometry_library))
, logger_(logger)
{
@@ -18,7 +18,7 @@ ifcopenshell::geometry::Converter::~Converter() {
}
namespace {
void substitute_with_box_based_on_density(Logger& logger, IfcGeom::ConversionResults& items, double& density) {
void substitute_with_box_based_on_density(::logger& logger, IfcGeom::ConversionResults& items, double& density) {
int nv = 0;
void* box = nullptr;
double volume = 0.;
@@ -30,7 +30,7 @@ namespace {
if (density > 1e5) {
items[0].Shape()->set_box(box);
items.erase(items.begin() + 1, items.end());
logger.Notice("GEO", 30, "Substituted element with " + boost::lexical_cast<std::string>(density) + " vertices / m3 with a bounding box");
logger.notice("GEO", 30, "Substituted element with " + boost::lexical_cast<std::string>(density) + " vertices / m3 with a bounding box");
}
}
}
@@ -102,7 +102,7 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
}
if (!success) {
logger::error("Failed processing layerset");
::logger::root().error("Failed processing layerset");
}
}
}
@@ -141,7 +141,7 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
}
}
if (some_items_without_style) {
logger_.Warning("GEO", 31, "No material and surface styles for:", product);
logger_.warning("GEO", 31, "No material and surface styles for:", product);
}
}
@@ -165,7 +165,7 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
parent_id = parent_object.id();
}
} catch (const std::exception& e) {
logger_.Error("GEO", 32, e);
logger_.error("GEO", 32, e);
}
const std::string name = product.get_value<std::string>("Name", "");
@@ -211,10 +211,10 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
kernel_->convert_openings(product, opening_items, shapes, *place, opened_shapes);
}
} catch (const std::exception& e) {
logger_.Message(Logger::LOG_ERROR, "GEO", 33, std::string("Error processing openings for: ") + e.what() + ":", product);
logger_.message(::logger::LOG_ERROR, "GEO", 33, std::string("Error processing openings for: ") + e.what() + ":", product);
caught_error = true;
} catch (...) {
logger_.Message(Logger::LOG_ERROR, "GEO", 34, "Error processing openings for:", product);
logger_.message(::logger::LOG_ERROR, "GEO", 34, "Error processing openings for:", product);
}
if (!(caught_error && opened_shapes.size() < shapes.size())) {
@@ -242,7 +242,7 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
std::swap(shapes, unified_shapes);
}
} catch (std::exception& e) {
logger_.Error("GEO", 35, e);
logger_.error("GEO", 35, e);
}
}
@@ -298,12 +298,12 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
if (elem->geometry().calculate_surface_area(a_calc)) {
double diff = std::abs(a_calc - a_file);
if (diff / std::sqrt(a_file) > getValue(GV_PRECISION)) {
logger::error("Validation of surface area failed for:", product);
::logger::root().error("Validation of surface area failed for:", product);
} else {
logger::notice("Validation of surface area succeeded for:", product);
::logger::root().notice("Validation of surface area succeeded for:", product);
}
} else {
logger::error("Validation of surface area failed for:", product);
::logger::root().error("Validation of surface area failed for:", product);
}
} else if (q->as<IfcSchema::IfcQuantityVolume>() && q->Name() == "Volume") {
double v_calc;
@@ -311,12 +311,12 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
if (elem->geometry().calculate_volume(v_calc)) {
double diff = std::abs(v_calc - v_file);
if (diff / std::sqrt(v_file) > getValue(GV_PRECISION)) {
logger::error("Validation of volume failed for:", product);
::logger::root().error("Validation of volume failed for:", product);
} else {
logger::notice("Validation of volume succeeded for:", product);
::logger::root().notice("Validation of volume succeeded for:", product);
}
} else {
logger::error("Validation of volume failed for:", product);
::logger::root().error("Validation of volume failed for:", product);
}
} else if (q->as<IfcSchema::IfcPhysicalComplexQuantity>() && q->Name() == "Shape Validation Properties") {
auto qs2 = q->as<IfcSchema::IfcPhysicalComplexQuantity>()->HasQuantities();
@@ -335,9 +335,9 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
}
}
if (!all_succeeded) {
logger::error("Validation of surface genus failed for:", product);
::logger::root().error("Validation of surface genus failed for:", product);
} else {
logger::notice("Validation of surface genus succeeded for:", product);
::logger::root().notice("Validation of surface genus succeeded for:", product);
}
}
}
@@ -361,7 +361,7 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_process
parent_id = parent_object.id();
}
} catch (const std::exception& e) {
logger_.Error("GEO", 36, e);
logger_.error("GEO", 36, e);
}
const std::string guid = product.get_value<std::string>("GlobalId");
+3 -3
View File
@@ -21,17 +21,17 @@ namespace ifcopenshell { namespace geometry {
std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel> kernel_;
ifcopenshell::geometry::Settings settings_;
std::map<ifcopenshell::geometry::taxonomy::ptr, brep_ptr, ifcopenshell::geometry::taxonomy::less_functor> cache_;
Logger& logger_;
::logger& logger_;
public:
ifcopenshell::geometry::kernels::AbstractKernel* kernel() { return &*kernel_; }
Converter(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, ifcopenshell::file* file, ifcopenshell::geometry::Settings& settings, Logger& logger = Logger::Root());
Converter(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, ifcopenshell::file* file, ifcopenshell::geometry::Settings& settings, ::logger& logger = ::logger::root());
~Converter();
ifcopenshell::geometry::abstract_mapping* mapping() const { return mapping_; }
Logger& logger() const { return logger_; }
::logger& logger() const { return logger_; }
/*
virtual NativeElement<double, double>* convert(
+2 -2
View File
@@ -346,7 +346,7 @@ class IFC_GEOM_API GeometrySerializer : public Serializer {
public:
enum read_type { READ_BREP, READ_TRIANGULATION };
GeometrySerializer(const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, Logger& logger = Logger::Root())
GeometrySerializer(const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, ::logger& logger = ::logger::root())
: Serializer(logger)
, geometry_settings_(geometry_settings)
, settings_(settings)
@@ -381,7 +381,7 @@ protected:
class IFC_GEOM_API WriteOnlyGeometrySerializer : public GeometrySerializer {
public:
WriteOnlyGeometrySerializer(const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, Logger& logger = Logger::Root()) : GeometrySerializer(geometry_settings, settings, logger) {}
WriteOnlyGeometrySerializer(const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, ::logger& logger = ::logger::root()) : GeometrySerializer(geometry_settings, settings, logger) {}
virtual IfcGeom::Element* read(ifcopenshell::file&, const std::string&, const std::string&, read_type = READ_BREP) {
throw std::runtime_error("Not supported");
+1 -1
View File
@@ -126,7 +126,7 @@ namespace IfcGeom {
oss << "product-" << ifcopenshell::global_id(guid).formatted();
} catch (const std::exception& e) {
oss << "product";
Logger::Root().Error("GEO", 39, e);
::logger::root().error("GEO", 39, e);
}
}
+39 -39
View File
@@ -31,7 +31,7 @@ bool IfcGeom::Iterator::initialize() {
try {
converter_->mapping()->get_representations(reps, filters_);
} catch (const std::exception& e) {
logger_.Error("GEO", 50, e);
logger_.error("GEO", 50, e);
}
time_points[1] = high_resolution_clock::now();
@@ -94,7 +94,7 @@ bool IfcGeom::Iterator::initialize() {
tasks_.back().item = p.first;
tasks_.back().products = p.second;
}
logger_.Notice("SYS", 26, "Merged " + std::to_string(old_size) + " tasks into " + std::to_string(tasks_.size()) + " tasks due to permissive shape reuse");
logger_.notice("SYS", 26, "Merged " + std::to_string(old_size) + " tasks into " + std::to_string(tasks_.size()) + " tasks due to permissive shape reuse");
}
}
@@ -139,11 +139,11 @@ bool IfcGeom::Iterator::initialize() {
}
*/
logger_.Notice("SYS", 27, "Created " + boost::lexical_cast<std::string>(tasks_.size()) + " tasks for " + boost::lexical_cast<std::string>(num_products) + " products");
logger_.notice("SYS", 27, "Created " + boost::lexical_cast<std::string>(tasks_.size()) + " tasks for " + boost::lexical_cast<std::string>(num_products) + " products");
if (tasks_.size() == 0) {
logger_.Warning("GEO", 51, "No representations encountered, aborting");
initialization_outcome_.reset(false);
logger_.warning("GEO", 51, "No representations encountered, aborting");
initialization_outcome_ = false;
} else if (!settings_.get<ifcopenshell::geometry::settings::DeferProcessingFirstElement>().get()) {
task_iterator_ = tasks_.begin();
@@ -169,7 +169,7 @@ bool IfcGeom::Iterator::initialize() {
void IfcGeom::Iterator::flush_worker_log(ifcopenshell::geometry::Converter* kernel) {
if (kernel && &kernel->logger() != &logger_) {
logger_.Append(kernel->logger());
logger_.append(kernel->logger());
}
}
@@ -203,13 +203,13 @@ void IfcGeom::Iterator::process_concurrently() {
kernel_pool.reserve(conc_threads);
worker_loggers_.reserve(conc_threads);
for (unsigned i = 0; i < conc_threads; ++i) {
worker_loggers_.emplace_back(std::make_unique<Logger>());
Logger& worker_logger = *worker_loggers_.back();
worker_logger.Verbosity(logger_.Verbosity());
worker_logger.OutputFormat(logger_.OutputFormat());
worker_logger.PrintPerformanceStatsOnElement(logger_.PrintPerformanceStatsOnElement());
if (worker_logger.OutputFormat() != Logger::FMT_INMEMORY) {
worker_logger.SetOutput(static_cast<std::ostream*>(nullptr), static_cast<std::ostream*>(nullptr));
worker_loggers_.emplace_back(std::make_unique<logger>());
::logger& worker_logger = *worker_loggers_.back();
worker_logger.verbosity(logger_.verbosity());
worker_logger.output_format(logger_.output_format());
worker_logger.print_performance_stats_on_element(logger_.print_performance_stats_on_element());
if (worker_logger.output_format() != ::logger::FMT_INMEMORY) {
worker_logger.set_output(static_cast<std::ostream*>(nullptr), static_cast<std::ostream*>(nullptr));
}
kernel_pool.push_back(new ifcopenshell::geometry::Converter(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>(converter_->kernel()->clone(worker_logger)), ifc_file, settings_, worker_logger));
}
@@ -249,14 +249,14 @@ void IfcGeom::Iterator::process_concurrently() {
try {
this->create_element_(kernel, settings, rep);
} catch (const std::exception& e) {
kernel->logger().Error("GEO", 52,
kernel->logger().error("GEO", 52,
std::string("Exception '") + e.what() +
std::string("' occurred while iterator was creating a shape: "),
rep->item->instance
);
had_error_processing_elements_ = true;
} catch (...) {
kernel->logger().Error("GEO", 53,
kernel->logger().error("GEO", 53,
"Unknown exception occurred while iteartor was creating a shape: ",
rep->item->instance
);
@@ -281,10 +281,10 @@ void IfcGeom::Iterator::process_concurrently() {
finished_ = true;
logger_.SetProduct(boost::none);
logger_.set_product(std::optional<express::Base>{});
if (!terminating_) {
logger_.Status("\rDone creating geometry (" + boost::lexical_cast<std::string>(all_processed_elements_.size()) +
logger_.status("\rDone creating geometry (" + boost::lexical_cast<std::string>(all_processed_elements_.size()) +
" objects) ");
}
}
@@ -362,7 +362,7 @@ express::Base IfcGeom::Iterator::create_shape_model_for_next_entity() {
void IfcGeom::Iterator::create_element_(ifcopenshell::geometry::Converter* kernel, ifcopenshell::geometry::Settings settings, geometry_conversion_result* rep)
{
Logger& kernel_logger = kernel->logger();
::logger& kernel_logger = kernel->logger();
if (!settings_.get<ifcopenshell::geometry::settings::NoParallelMapping>().get()) {
rep->item = kernel->mapping()->map(rep->representation);
@@ -380,20 +380,20 @@ void IfcGeom::Iterator::create_element_(ifcopenshell::geometry::Converter* kerne
const express::Base product = product_node.first;
const auto& place = product_node.second;
kernel_logger.SetProduct(product);
kernel_logger.set_product(product);
IfcGeom::BRepElement* brep = static_cast<IfcGeom::BRepElement*>(create_processed_element_([kernel, settings, product, place, rep]() {
return kernel->create_brep_for_representation_and_product(rep->item, product, place);
}));
if (!brep) {
kernel_logger.SetProduct(boost::none);
kernel_logger.set_product(std::optional<express::Base>{});
return;
}
auto elem = process_based_on_settings(settings, brep, kernel_logger);
if (!elem) {
kernel_logger.SetProduct(boost::none);
kernel_logger.set_product(std::optional<express::Base>{});
return;
}
@@ -405,9 +405,9 @@ void IfcGeom::Iterator::create_element_(ifcopenshell::geometry::Converter* kerne
const express::Base product2 = p.first;
const auto& place2 = p.second;
kernel_logger.SetProduct(product2);
kernel_logger.set_product(product2);
IfcGeom::BRepElement* brep2 = static_cast<IfcGeom::BRepElement*>(decorate_with_cache_(GeometrySerializer::READ_BREP, (std::string)product2->get("GlobalId"), std::to_string(rep->item->instance->as<IfcUtil::IfcBaseEntity>()->id()), [kernel, settings, product2, place2, brep]() {
IfcGeom::BRepElement* brep2 = static_cast<IfcGeom::BRepElement*>(create_processed_element_([kernel, settings, product2, place2, brep]() {
return kernel->create_brep_for_processed_representation(product2, place2, brep);
}));
if (brep2) {
@@ -419,20 +419,20 @@ void IfcGeom::Iterator::create_element_(ifcopenshell::geometry::Converter* kerne
}
}
kernel_logger.SetProduct(boost::none);
kernel_logger.set_product(std::optional<express::Base>{});
}
IfcGeom::Element* IfcGeom::Iterator::process_based_on_settings(ifcopenshell::geometry::Settings settings, IfcGeom::BRepElement* elem, Logger& logger, IfcGeom::TriangulationElement* previous)
IfcGeom::Element* IfcGeom::Iterator::process_based_on_settings(ifcopenshell::geometry::Settings settings, IfcGeom::BRepElement* elem, ::logger& logger, IfcGeom::TriangulationElement* previous)
{
if (settings.get<ifcopenshell::geometry::settings::IteratorOutput>().get() == ifcopenshell::geometry::settings::SERIALIZED) {
try {
return new IfcGeom::SerializedElement(*elem);
} catch (...) {
logger.message(logger::LOG_ERROR, "GEO", 54, "Getting a serialized element from model failed.");
logger.message(::logger::LOG_ERROR, "GEO", 54, "Getting a serialized element from model failed.");
return nullptr;
}
} else if (settings.get<ifcopenshell::geometry::settings::IteratorOutput>().get() == ifcopenshell::geometry::settings::TRIANGULATED) {
return create_processed_element_([elem, previous]() {
return create_processed_element_([elem, previous, &logger]() {
try {
if (!previous) {
return new TriangulationElement(*elem);
@@ -440,7 +440,7 @@ IfcGeom::Element* IfcGeom::Iterator::process_based_on_settings(ifcopenshell::geo
return new TriangulationElement(*elem, previous->geometry_pointer());
}
} catch (...) {
logger.Message(Logger::LOG_ERROR, "GEO", 55, "Getting a triangulation element from model failed.");
logger.message(::logger::LOG_ERROR, "GEO", 55, "Getting a triangulation element from model failed.");
}
return (TriangulationElement*)nullptr;
});
@@ -481,7 +481,7 @@ void IfcGeom::Iterator::log_timepoints() const {
for (auto it = time_points.begin() + 1; it != time_points.end(); ++it) {
auto jt = it - 1;
duration<double, std::milli> ms_double = (*it) - (*jt);
logger_.Notice("SYS", 28, labels[std::distance(time_points.begin(), jt)] + " took " + std::to_string(ms_double.count()) + "ms");
logger_.notice("SYS", 28, labels[std::distance(time_points.begin(), jt)] + " took " + std::to_string(ms_double.count()) + "ms");
}
}
@@ -516,7 +516,7 @@ express::Base IfcGeom::Iterator::next() {
if (num_threads_ != 1) {
if (!wait_for_element()) {
logger_.SetProduct(boost::none);
logger_.set_product(std::optional<express::Base>{});
time_points[3] = high_resolution_clock::now();
log_timepoints();
task_result_ptr_exhausted = true;
@@ -532,7 +532,7 @@ express::Base IfcGeom::Iterator::next() {
// shape representation
if (task_result_iterator_ == --all_processed_elements_.end()) {
if (!create()) {
logger_.SetProduct(boost::none);
logger_.set_product(std::optional<express::Base>{});
time_points[3] = high_resolution_clock::now();
log_timepoints();
task_result_ptr_exhausted = true;
@@ -569,7 +569,7 @@ IfcGeom::Element* IfcGeom::Iterator::get()
try {
parent_object = get_object(ret->parent_id());
} catch (const std::exception& e) {
logger_.Error("GEO", 56, e);
logger_.error("GEO", 56, e);
hasParent = false;
}
@@ -587,7 +587,7 @@ IfcGeom::Element* IfcGeom::Iterator::get()
try {
parent_object = get_object(pid);
} catch (const std::exception& e) {
logger_.Error("GEO", 57, e);
logger_.error("GEO", 57, e);
hasParent = false;
}
}
@@ -634,9 +634,9 @@ const IfcGeom::Element* IfcGeom::Iterator::get_object(int id) {
m4 = casted->matrix;
}
} catch (const std::exception& e) {
logger_.Error("GEO", 58, e);
logger_.error("GEO", 58, e);
} catch (...) {
logger_.Error("GEO", 59, "Unknown error returning product");
logger_.error("GEO", 59, "Unknown error returning product");
}
Element* ifc_object = new Element(settings_, id, parent_id, product_name, instance_type, product_guid, "", m4, ifc_product.as<express::Entity>());
@@ -648,10 +648,10 @@ express::Base IfcGeom::Iterator::create() {
try {
product = create_shape_model_for_next_entity();
} catch (const std::exception& e) {
logger_.Error("GEO", 60, e);
logger_.error("GEO", 60, e);
had_error_processing_elements_ = true;
} catch (...) {
logger_.Error("GEO", 61, "Unknown error creating geometry");
logger_.error("GEO", 61, "Unknown error creating geometry");
had_error_processing_elements_ = true;
}
return product;
@@ -823,8 +823,8 @@ ifcopenshell::geometry::taxonomy::direction3::ptr IfcGeom::Iterator::remove_offs
}
}
logger_.Notice("SYS", 29, "Removed large offsets within " + std::to_string(num_offset_applied) + " products");
logger_.Notice("SYS", 30, "Offset applied (" + std::to_string(vec(0)) + "," + std::to_string(vec(1)) + "," + std::to_string(vec(2)) + ")");
logger_.notice("SYS", 29, "Removed large offsets within " + std::to_string(num_offset_applied) + " products");
logger_.notice("SYS", 30, "Offset applied (" + std::to_string(vec(0)) + "," + std::to_string(vec(1)) + "," + std::to_string(vec(2)) + ")");
return make<direction3>(vec);
}
+7 -7
View File
@@ -128,14 +128,14 @@ namespace IfcGeom {
std::vector<ifcopenshell::geometry::filter_t> filters_;
int num_threads_;
std::string geometry_library_;
Logger& logger_;
::logger& logger_;
// When single-threaded
ifcopenshell::geometry::Converter* converter_;
// When multi-threaded
std::vector<ifcopenshell::geometry::Converter*> kernel_pool;
std::vector<std::unique_ptr<Logger>> worker_loggers_;
std::vector<std::unique_ptr<::logger>> worker_loggers_;
// The object is fetched beforehand to be sure that get() returns a valid element
TriangulationElement* current_triangulation;
@@ -170,7 +170,7 @@ namespace IfcGeom {
IfcGeom::Element* process_based_on_settings(
ifcopenshell::geometry::Settings settings,
IfcGeom::BRepElement* elem,
Logger& logger,
::logger& logger,
IfcGeom::TriangulationElement* previous = nullptr);
void flush_worker_log(ifcopenshell::geometry::Converter* kernel);
@@ -183,7 +183,7 @@ namespace IfcGeom {
ifcopenshell::geometry::taxonomy::direction3::ptr remove_offset_();
public:
Iterator(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, const ifcopenshell::geometry::Settings& settings, ifcopenshell::file* file, const std::vector<ifcopenshell::geometry::filter_t>& filters, int num_threads, Logger& logger = Logger::Root())
Iterator(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, const ifcopenshell::geometry::Settings& settings, ifcopenshell::file* file, const std::vector<ifcopenshell::geometry::filter_t>& filters, int num_threads, ::logger& logger = ::logger::root())
: settings_(settings)
, ifc_file(file)
, filters_(filters)
@@ -195,7 +195,7 @@ namespace IfcGeom {
{
}
Iterator(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, const ifcopenshell::geometry::Settings& settings, ifcopenshell::file* file, Logger& logger = Logger::Root())
Iterator(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, const ifcopenshell::geometry::Settings& settings, ifcopenshell::file* file, ::logger& logger = ::logger::root())
: settings_(settings)
, ifc_file(file)
, num_threads_(1)
@@ -205,7 +205,7 @@ namespace IfcGeom {
{
}
Iterator(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, const ifcopenshell::geometry::Settings& settings, ifcopenshell::file* file, int num_threads, Logger& logger = Logger::Root())
Iterator(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, const ifcopenshell::geometry::Settings& settings, ifcopenshell::file* file, int num_threads, ::logger& logger = ::logger::root())
: settings_(settings)
, ifc_file(file)
, num_threads_(num_threads)
@@ -276,7 +276,7 @@ namespace IfcGeom {
return progress_;
}
std::string getLog() const { return logger_.GetLog(); }
std::string getLog() const { return logger_.get_log(); }
ifcopenshell::file* file() const { return ifc_file; }
@@ -112,7 +112,7 @@ namespace {
#endif
template <>
int convert_to_ifc(ifcopenshell::file& f, const opencascade::handle<Geom_Curve>& c, IfcSchema::IfcCurve*& curve, bool advanced) {
int convert_to_ifc(ifcopenshell::file& f, const opencascade::handle<Geom_Curve>& c, IfcSchema::IfcCurve& curve, bool advanced) {
if (c->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) {
opencascade::handle<Geom_TrimmedCurve> trim = opencascade::handle<Geom_TrimmedCurve>::DownCast(c);
const opencascade::handle<Geom_Curve> basis = trim->BasisCurve();
@@ -155,7 +155,7 @@ int convert_to_ifc(ifcopenshell::file& f, const opencascade::handle<Geom_Curve>&
IfcSchema::IfcAxis2Placement3D ax;
opencascade::handle<Geom_Ellipse> ellipse = opencascade::handle<Geom_Ellipse>::DownCast(c);
convert_to_ifc(ellipse.Position(), ax, advanced);
convert_to_ifc(f, ellipse->Position(), ax, advanced);
auto el = f.create<IfcSchema::IfcEllipse>();
el.setPosition(ax);
@@ -208,6 +208,7 @@ int convert_to_ifc(ifcopenshell::file& f, const opencascade::handle<Geom_Curve>&
bspl.setKnots(knots);
bspl.setKnotSpec(knot_spec);
bspl.setWeightsData(weights);
curve = bspl;
return 1;
}
@@ -277,6 +278,7 @@ int convert_to_ifc(ifcopenshell::file& f, const opencascade::handle<Geom_Curve>&
bspl.setKnotMultiplicities(mults);
bspl.setKnots(knots);
bspl.setKnotSpec(knot_spec);
curve = bspl;
return 1;
}
+3 -3
View File
@@ -24,12 +24,12 @@
#include "../ifcparse/file.h"
class IFC_GEOM_API Serializer {
Logger& logger_;
::logger& logger_;
public:
explicit Serializer(Logger& logger = Logger::Root()) : logger_(logger) {}
explicit Serializer(::logger& logger = ::logger::root()) : logger_(logger) {}
virtual ~Serializer() {}
Logger& logger() const { return logger_; }
::logger& logger() const { return logger_; }
virtual bool ready() = 0;
virtual bool is_streaming() const { return false; }
+10 -18
View File
@@ -23,7 +23,7 @@ void ifcopenshell::geometry::impl::mapping_registry::bind(const std::string& sch
entry.module_ = module.meta().id.empty() ? plugin::module(mapping_plugin_metadata(schema_name)) : module;
}
ifcopenshell::geometry::abstract_mapping* ifcopenshell::geometry::impl::mapping_registry::construct(ifcopenshell::file* file, Settings& s) {
ifcopenshell::geometry::abstract_mapping* ifcopenshell::geometry::impl::mapping_registry::construct(ifcopenshell::file* file, Settings& s, ::logger& log) {
const std::string schema_name_lower = boost::to_lower_copy(file->schema()->name());
auto it = entries_.find(schema_name_lower);
if (it == entries_.end()) {
@@ -33,8 +33,13 @@ ifcopenshell::geometry::abstract_mapping* ifcopenshell::geometry::impl::mapping_
if (it == entries_.end()) {
throw ifcopenshell::exception("No geometry mapping registered for " + schema_name_lower);
}
auto new_mapping = it->second.fn_(file, s);
new_mapping->initialize_settings();
auto new_mapping = it->second.fn_(file, s, log);
try {
new_mapping->initialize_settings();
} catch (const std::exception& e) {
log.error("GEO", 400, e);
log.error("GEO", 401, "Unable to initialize conversion settings");
}
return new_mapping;
}
@@ -51,19 +56,6 @@ void ifcopenshell::geometry::impl::MappingFactoryImplementation::bind(const std:
mapping_registry_instance().bind(schema_name, fn, plugin::module(mapping_plugin_metadata(schema_name)));
}
ifcopenshell::geometry::abstract_mapping* ifcopenshell::geometry::impl::MappingFactoryImplementation::construct(ifcopenshell::file* file, Settings& s, Logger& logger) {
const std::string schema_name_lower = boost::to_lower_copy(file->schema()->name());
std::map<std::string, ifcopenshell::geometry::impl::mapping_fn>::const_iterator it;
it = this->find(schema_name_lower);
if (it == end()) {
throw IfcParse::IfcException("No geometry mapping registered for " + schema_name_lower);
}
auto new_mapping = it->second(file, s, logger);
try {
new_mapping->initialize_settings();
} catch (const std::exception& e) {
logger.Error("GEO", 400, e);
logger.Error("GEO", 401, "Unable to initialize conversion settings");
}
return new_mapping;
ifcopenshell::geometry::abstract_mapping* ifcopenshell::geometry::impl::MappingFactoryImplementation::construct(ifcopenshell::file* file, Settings& s, ::logger& log) {
return mapping_registry_instance().construct(file, s, log);
}
+6 -6
View File
@@ -49,12 +49,12 @@ namespace geometry {
class IFC_GEOM_API abstract_mapping {
protected:
Settings settings_;
Logger& logger_;
::logger& logger_;
bool use_caching_ = true;
public:
abstract_mapping(Settings& s, Logger& logger = Logger::Root()) : settings_(s), logger_(logger) {}
abstract_mapping(Settings& s, ::logger& logger = ::logger::root()) : settings_(s), logger_(logger) {}
virtual ~abstract_mapping() {}
virtual ifcopenshell::geometry::taxonomy::ptr map(const express::Base&) = 0;
@@ -73,19 +73,19 @@ namespace geometry {
const Settings& settings() const { return settings_; }
Settings& settings() { return settings_; }
Logger& logger() const { return logger_; }
::logger& logger() const { return logger_; }
bool use_caching() const { return use_caching_; }
bool& use_caching() { return use_caching_; }
};
namespace impl {
typedef boost::function3<abstract_mapping*, ifcopenshell::file*, Settings&, Logger&> mapping_fn;
typedef boost::function3<abstract_mapping*, ifcopenshell::file*, Settings&, ::logger&> mapping_fn;
class IFC_GEOM_API mapping_registry {
public:
void bind(const std::string& schema_name, mapping_fn fn, const ifcopenshell::plugin::module& module = ifcopenshell::plugin::module());
abstract_mapping* construct(ifcopenshell::file* file, Settings& settings);
abstract_mapping* construct(ifcopenshell::file* file, Settings& settings, ::logger& logger = ::logger::root());
private:
struct entry {
@@ -102,7 +102,7 @@ namespace geometry {
public:
MappingFactoryImplementation();
void bind(const std::string& schema_name, mapping_fn);
abstract_mapping* construct(ifcopenshell::file*, Settings&, Logger& logger = Logger::Root());
abstract_mapping* construct(ifcopenshell::file*, Settings&, ::logger& logger = ::logger::root());
};
IFC_GEOM_API MappingFactoryImplementation& mapping_implementations();
+3 -3
View File
@@ -76,7 +76,7 @@ struct piecewise_fn_evaluator : public fn_evaluator {
span_start += fn->length();
}
logger_.Error("GEO", 37, "piecewise span not found.");
logger_.error("GEO", 37, "piecewise span not found.");
return {0, 0, nullptr};
}
@@ -208,7 +208,7 @@ struct offset_fn_evaluator : public fn_evaluator {
function_item_evaluator::function_item_evaluator(const ifcopenshell::geometry::Settings& settings,taxonomy::function_item::const_ptr fn, Logger& logger) : logger_(logger) {
function_item_evaluator::function_item_evaluator(const ifcopenshell::geometry::Settings& settings,taxonomy::function_item::const_ptr fn, logger& logger) : logger_(logger) {
auto kind = fn ? fn->kind() : taxonomy::kinds::NODE;
if (kind == taxonomy::FUNCTOR_ITEM) {
fn_evaluator_ = new functor_fn_evaluator(std::dynamic_pointer_cast<const taxonomy::functor_item>(fn),settings);
@@ -221,7 +221,7 @@ function_item_evaluator::function_item_evaluator(const ifcopenshell::geometry::S
} else if (kind == taxonomy::OFFSET_FUNCTION) {
fn_evaluator_ = new offset_fn_evaluator(std::dynamic_pointer_cast<const taxonomy::offset_function>(fn), settings);
} else {
logger_.Error("GEO", 38, "Unexpected function type");
logger_.error("GEO", 38, "Unexpected function type");
}
}
+4 -4
View File
@@ -23,7 +23,7 @@ static taxonomy::function_item::ptr convert_loop_to_function_item(taxonomy::loop
/// @brief Abstract class for evaluating a function_item. This class is specialized for each of the function_item types.
struct IFC_GEOM_API fn_evaluator {
fn_evaluator(const ifcopenshell::geometry::Settings& settings, Logger& logger = Logger::Root()) : settings_(settings), logger_(logger) {
fn_evaluator(const ifcopenshell::geometry::Settings& settings, logger& logger = ::logger::root()) : settings_(settings), logger_(logger) {
}
fn_evaluator(const fn_evaluator& other) = default;
virtual ~fn_evaluator() = default;
@@ -38,13 +38,13 @@ struct IFC_GEOM_API fn_evaluator {
ifcopenshell::geometry::Settings settings_;
protected:
Logger& logger_;
logger& logger_;
};
/// @brief utility class to evaluate function_item objects.
class IFC_GEOM_API function_item_evaluator {
public:
function_item_evaluator(const ifcopenshell::geometry::Settings& settings, taxonomy::function_item::const_ptr fn, Logger& logger = Logger::Root());
function_item_evaluator(const ifcopenshell::geometry::Settings& settings, taxonomy::function_item::const_ptr fn, logger& logger = ::logger::root());
function_item_evaluator(const function_item_evaluator& other);
~function_item_evaluator();
@@ -80,7 +80,7 @@ class IFC_GEOM_API function_item_evaluator {
fn_evaluator* fn_evaluator_ = nullptr;
mutable std::optional<std::vector<double>> eval_points_; // cache evaluation points
Logger& logger_;
logger& logger_;
};
}}
+2 -2
View File
@@ -32,7 +32,7 @@ namespace ifcopenshell {
ifcopenshell::geometry::abstract_mapping* mapping_;
ifcopenshell::file* file_;
public:
HybridKernel(const std::string& name, ifcopenshell::file* file, Settings& settings, std::vector<std::unique_ptr<AbstractKernel>>&& kernels, Logger& logger = Logger::Root())
HybridKernel(const std::string& name, ifcopenshell::file* file, Settings& settings, std::vector<std::unique_ptr<AbstractKernel>>&& kernels, ::logger& logger = ::logger::root())
: AbstractKernel(name, settings, logger)
, kernels_(std::move(kernels))
, mapping_(ifcopenshell::geometry::impl::mapping_implementations().construct(file, settings, logger))
@@ -127,7 +127,7 @@ namespace ifcopenshell {
}
return false;
}
virtual AbstractKernel* clone(Logger& logger) const
virtual AbstractKernel* clone(::logger& logger) const
{
std::vector<std::unique_ptr<AbstractKernel>> ks;
for (auto& k : kernels_) {
+13 -13
View File
@@ -35,7 +35,7 @@ bool has_intersection(const std::set<T, Cmp>& A,
}
taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_, const express::Base inst, const taxonomy::function_item::ptr& fn, std::vector<cross_section>& cross_sections, Logger& logger)
taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_, const express::Base inst, const taxonomy::function_item::ptr& fn, std::vector<cross_section>& cross_sections, logger& logger)
{
std::sort(cross_sections.begin(), cross_sections.end());
@@ -51,7 +51,7 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
double end = std::min(fn->length(), cross_sections.back().dist_along);
if (end - start < 1.e-9) {
logger.Warning("GEO", 40, "Empty sweep domain with start at " + std::to_string(cross_sections.front().dist_along) + " end at " + std::to_string(cross_sections.back().dist_along) + " and curve domain length " + std::to_string(fn->length()), inst);
logger.warning("GEO", 40, "Empty sweep domain with start at " + std::to_string(cross_sections.front().dist_along) + " end at " + std::to_string(cross_sections.back().dist_along) + " and curve domain length " + std::to_string(fn->length()), inst);
return nullptr;
}
@@ -130,7 +130,7 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
auto profile_b_f = std::static_pointer_cast<taxonomy::face>(profile_b);
if (profile_a_f->children.size() != profile_b_f->children.size()) {
logger.Warning("GEO", 41, "Mismatching number of face boundaries: " +
logger.warning("GEO", 41, "Mismatching number of face boundaries: " +
std::to_string(profile_a_f->children.size()) + " vs " +
std::to_string(profile_b_f->children.size()),
inst
@@ -165,7 +165,7 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
// in which case we would need to lerp with the rotation component below in m4b.
interpolated_rotation = lerp(*rotation_a, *rotation_b, relative_dist_along);
} else if (rotation_a != rotation_b) {
logger.Error("GEO", 42, "Direction vectors on cross section placements only supported when used consistently");
logger.error("GEO", 42, "Direction vectors on cross section placements only supported when used consistently");
}
taxonomy::loop::ptr w1, w2;
@@ -176,12 +176,12 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
boost::tie(w1, w2) = tmp_;
if (w1->closed != w2->closed) {
logger.Warning("GEO", 43, "Mismatching closed property on loops", inst);
logger.warning("GEO", 43, "Mismatching closed property on loops", inst);
return nullptr;
}
if (w1->tags.is_initialized() != w2->tags.is_initialized()) {
logger.Warning("GEO", 44, "Mismatching availability tags on loops", inst);
if (w1->tags.has_value() != w2->tags.has_value()) {
logger.warning("GEO", 44, "Mismatching availability tags on loops", inst);
return nullptr;
}
@@ -190,7 +190,7 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
std::set<std::string> tags_seen;
for (const auto& t : *w1->tags) {
if (tags_seen.find(t) != tags_seen.end()) {
logger.Warning("GEO", 45, "Duplicate tag '" + t + "' on loft profile", inst);
logger.warning("GEO", 45, "Duplicate tag '" + t + "' on loft profile", inst);
return nullptr;
}
tags_seen.insert(t);
@@ -202,7 +202,7 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
std::set<std::string> tags_seen;
for (const auto& t : *w2->tags) {
if (tags_seen.find(t) != tags_seen.end()) {
logger.Warning("GEO", 46, "Duplicate tag '" + t + "' on loft profile", inst);
logger.warning("GEO", 46, "Duplicate tag '" + t + "' on loft profile", inst);
return nullptr;
}
tags_seen.insert(t);
@@ -303,20 +303,20 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
for (auto& p1_tags : w1_tags) {
if (!has_intersection(p1_tags, w2_tags_combined)) {
logger.Warning("GEO", 47, "No matching tags found on loft profiles: " + join_tags(p1_tags) + " not in " + join_tags(w2_tags_combined), inst);
logger.warning("GEO", 47, "No matching tags found on loft profiles: " + join_tags(p1_tags) + " not in " + join_tags(w2_tags_combined), inst);
return nullptr;
}
}
for (auto& p2_tags : w2_tags) {
if (!has_intersection(p2_tags, w1_tags_combined)) {
logger.Warning("GEO", 48, "No matching tags found on loft profiles: " + join_tags(p2_tags) + " not in " + join_tags(w1_tags_combined), inst);
logger.warning("GEO", 48, "No matching tags found on loft profiles: " + join_tags(p2_tags) + " not in " + join_tags(w1_tags_combined), inst);
return nullptr;
}
}
} else {
if (w1->children.size() != w2->children.size()) {
logger.Warning("GEO", 49, "Mismatching number of edges: " +
logger.warning("GEO", 49, "Mismatching number of edges: " +
std::to_string(w1->children.size()) + " vs " +
std::to_string(w2->children.size()),
inst);
@@ -396,7 +396,7 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
auto m4 = evaluator.evaluate(dist_along);
/* {
std::wcout << "#" << pwf->instance->data().id() << " " << dist_along << ": " << m4.col(3).row(2).value() << std::endl;
std::wcout << "#" << pwf->instance.data().id() << " " << dist_along << ": " << m4.col(3).row(2).value() << std::endl;
}*/
Eigen::Matrix4d m4b = Eigen::Matrix4d::Identity();
+1 -1
View File
@@ -21,7 +21,7 @@ namespace ifcopenshell {
}
};
IFC_GEOM_API taxonomy::loft::ptr make_loft(const Settings& settings_, const express::Base inst, const taxonomy::function_item::ptr& directrix, std::vector<cross_section>& cross_sections, Logger& logger = Logger::Root());
IFC_GEOM_API taxonomy::loft::ptr make_loft(const Settings& settings_, const express::Base inst, const taxonomy::function_item::ptr& directrix, std::vector<cross_section>& cross_sections, logger& logger = ::logger::root());
}
}
@@ -266,7 +266,7 @@ namespace {
}
}
ifcopenshell::geometry::CgalShape::CgalShape(const cgal_shape_t& shape, bool convex, Logger& logger) {
ifcopenshell::geometry::CgalShape::CgalShape(const cgal_shape_t& shape, bool convex, ::logger& logger) {
shape_ = shape;
convex_tag_ = convex;
auto& poly = std::get<cgal_shape_t>(*shape_);
@@ -280,7 +280,7 @@ ifcopenshell::geometry::CgalShape::CgalShape(const cgal_shape_t& shape, bool con
auto b2 = plane.base2();
if (V.squared_length() == 0) {
logger.Warning("GEO", 62, "Removed face due to self-intersections");
logger.warning("GEO", 62, "Removed face due to self-intersections");
faces_to_remove.insert(face);
continue;
}
@@ -301,7 +301,7 @@ ifcopenshell::geometry::CgalShape::CgalShape(const cgal_shape_t& shape, bool con
}
if (!CGAL::Polygon_2<Kernel_>(ps.begin(), ps.end()).is_simple()) {
logger.Warning("GEO", 63, "Removed face due to self-intersections");
logger.warning("GEO", 63, "Removed face due to self-intersections");
faces_to_remove.insert(face);
}
}
@@ -362,7 +362,7 @@ void ifcopenshell::geometry::CgalShape::to_nef() const {
}
#endif
void ifcopenshell::geometry::CgalShape::Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id, Logger& logger) const {
void ifcopenshell::geometry::CgalShape::Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id, ::logger& logger) const {
if (is_point() || is_wire()) {
return;
}
@@ -415,7 +415,7 @@ void ifcopenshell::geometry::CgalShape::Triangulate(ifcopenshell::geometry::Sett
if (!all_triangles) {
if (!shape_to_use->is_valid()) {
logger.Message(Logger::LOG_ERROR, "GEO", 64, "Invalid Polyhedron_3 in object (before triangulation)");
logger.message(::logger::LOG_ERROR, "GEO", 64, "Invalid Polyhedron_3 in object (before triangulation)");
return;
}
@@ -423,19 +423,19 @@ void ifcopenshell::geometry::CgalShape::Triangulate(ifcopenshell::geometry::Sett
try {
success = CGAL::Polygon_mesh_processing::triangulate_faces(*shape_to_use);
} catch (...) {
logger.Message(Logger::LOG_ERROR, "GEO", 65, "Triangulation crashed");
logger.message(::logger::LOG_ERROR, "GEO", 65, "Triangulation crashed");
return;
}
CGAL::Polygon_mesh_processing::remove_degenerate_faces(*shape_to_use);
if (!success) {
logger.Message(Logger::LOG_ERROR, "GEO", 66, "Triangulation failed");
logger.message(::logger::LOG_ERROR, "GEO", 66, "Triangulation failed");
return;
}
if (!shape_to_use->is_valid()) {
logger.Message(Logger::LOG_ERROR, "GEO", 67, "Invalid Polyhedron_3 in object (after triangulation)");
logger.message(::logger::LOG_ERROR, "GEO", 67, "Invalid Polyhedron_3 in object (after triangulation)");
return;
}
}
@@ -464,7 +464,7 @@ void ifcopenshell::geometry::CgalShape::Triangulate(ifcopenshell::geometry::Sett
try {
CGAL::Polygon_mesh_processing::compute_face_normals(*shape_to_use, face_normals_map);
} catch (...) {
logger.Message(Logger::LOG_ERROR, "GEO", 68, "Face normal calculation failed");
logger.message(::logger::LOG_ERROR, "GEO", 68, "Face normal calculation failed");
return;
}
@@ -1033,7 +1033,7 @@ bool ifcopenshell::geometry::CgalShape::surface_area_along_direction(double tol,
#ifndef IFOPSH_SIMPLE_KERNEL
void ifcopenshell::geometry::CgalShapeHalfSpaceDecomposition::Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id, Logger& logger) const {
void ifcopenshell::geometry::CgalShapeHalfSpaceDecomposition::Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id, ::logger& logger) const {
throw std::runtime_error("Not implemented");
}
@@ -187,13 +187,8 @@ namespace ifcopenshell { namespace geometry {
mutable std::optional<CGAL::Nef_polyhedron_3<Kernel_>> nef_;
#endif
public:
#ifdef IFOPSH_SIMPLE_KERNEL
std::string type() const override { return "CgalSimpleShape"; }
#else
std::string type() const override { return "CgalShape"; }
#endif
CgalShape(const cgal_shape_t& shape, bool convex = false, Logger& logger = Logger::Root());
CgalShape(const cgal_shape_t& shape, bool convex = false, ::logger& logger = ::logger::root());
CgalShape(const cgal_point_t& point, bool convex = false);
CgalShape(const cgal_wire_t& wire, bool convex = false);
@@ -231,7 +226,7 @@ namespace ifcopenshell { namespace geometry {
const cgal_point_t& point() const { return std::get<cgal_point_t>(*shape_); }
const cgal_wire_t& wire() const { return std::get<cgal_wire_t>(*shape_); }
virtual void Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id, Logger& logger = Logger::Root()) const;
virtual void Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id, ::logger& logger = ::logger::root()) const;
virtual void Serialize(const ifcopenshell::geometry::taxonomy::matrix4& place, std::string&) const;
virtual IfcGeom::ConversionResultShape* clone() const {
@@ -304,8 +299,6 @@ namespace ifcopenshell { namespace geometry {
std::list<CGAL::Plane_3<Kernel_>> planes_;
public:
std::string type() const override { return "CgalShapeHalfSpaceDecomposition"; }
CgalShapeHalfSpaceDecomposition(const CGAL::Nef_polyhedron_3<Kernel_>& shape, bool is_convex) {
if (is_convex) {
shape_ = std::move(build_halfspace_tree_is_decomposed(shape, planes_));
@@ -326,7 +319,7 @@ namespace ifcopenshell { namespace geometry {
#endif
}
virtual void Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id, Logger& logger = Logger::Root()) const;
virtual void Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id, ::logger& logger = ::logger::root()) const;
virtual void Serialize(const ifcopenshell::geometry::taxonomy::matrix4& place, std::string&) const;
virtual int surface_genus() const;
+55 -55
View File
@@ -46,15 +46,15 @@ namespace {
struct PolyhedronBuilder : public CGAL::Modifier_base<CGAL::Polyhedron_3<Kernel_>::HalfedgeDS> {
private:
std::list<cgal_face_t> *face_list;
Logger& logger_;
logger& logger_;
public:
std::optional<cgal_shape_t> from_soup;
PolyhedronBuilder(std::list<cgal_face_t> *face_list, Logger& logger = Logger::Root());
PolyhedronBuilder(std::list<cgal_face_t> *face_list, logger& logger = ::logger::root());
void operator()(CGAL::Polyhedron_3<Kernel_>::HalfedgeDS &hds);
};
}
CGAL::Polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_polyhedron(std::list<cgal_face_t> &face_list, bool stitch_borders, Logger& logger) {
CGAL::Polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_polyhedron(std::list<cgal_face_t> &face_list, bool stitch_borders, logger& logger) {
// Naive creation
CGAL::Polyhedron_3<Kernel_> polyhedron;
@@ -77,7 +77,7 @@ CGAL::Polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_polyhedron(std
polyhedron.normalize_border();
if (!polyhedron.is_valid(false, 1)) {
logger.Message(Logger::LOG_ERROR, "GEO", 69, "create_polyhedron: Polyhedron not valid!");
logger.message(::logger::LOG_ERROR, "GEO", 69, "create_polyhedron: Polyhedron not valid!");
// std::ofstream fresult;
// fresult.open("/Users/ken/Desktop/invalid.off");
// fresult << polyhedron << std::endl;
@@ -91,23 +91,23 @@ CGAL::Polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_polyhedron(std
}
#ifndef IFOPSH_SIMPLE_KERNEL
CGAL::Polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_polyhedron(const CGAL::Nef_polyhedron_3<Kernel_>& nef_polyhedron, Logger& logger) {
CGAL::Polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_polyhedron(const CGAL::Nef_polyhedron_3<Kernel_>& nef_polyhedron, logger& logger) {
if (nef_polyhedron.is_simple()) {
try {
CGAL::Polyhedron_3<Kernel_> polyhedron;
nef_polyhedron.convert_to_polyhedron(polyhedron);
return polyhedron;
} catch (...) {
logger.Message(Logger::LOG_ERROR, "GEO", 70, "Conversion from Nef to polyhedron failed!");
logger.message(::logger::LOG_ERROR, "GEO", 70, "Conversion from Nef to polyhedron failed!");
return CGAL::Polyhedron_3<Kernel_>();
}
} else {
logger.Message(Logger::LOG_ERROR, "GEO", 71, "Nef polyhedron not simple: cannot create polyhedron!");
logger.message(::logger::LOG_ERROR, "GEO", 71, "Nef polyhedron not simple: cannot create polyhedron!");
return CGAL::Polyhedron_3<Kernel_>();
}
}
CGAL::Nef_polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_nef_polyhedron(std::list<cgal_face_t> &face_list, Logger& logger) {
CGAL::Nef_polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_nef_polyhedron(std::list<cgal_face_t> &face_list, logger& logger) {
CGAL::Polyhedron_3<Kernel_> polyhedron = create_polyhedron(face_list, true, logger);
if (polyhedron.is_closed()) {
try {
@@ -115,7 +115,7 @@ CGAL::Nef_polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_nef_polyhe
CGAL::Polygon_mesh_processing::reverse_face_orientations(polyhedron);
}
} catch (CGAL::Failure_exception& e) {
logger.Message(Logger::LOG_ERROR, "GEO", 72, e);
logger.message(::logger::LOG_ERROR, "GEO", 72, e);
}
}
CGAL::Polygon_mesh_processing::triangulate_faces(polyhedron);
@@ -123,12 +123,12 @@ CGAL::Nef_polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_nef_polyhe
try {
nef_polyhedron = CGAL::Nef_polyhedron_3<Kernel_>(polyhedron);
} catch (...) {
logger.Message(Logger::LOG_ERROR, "GEO", 73, "Conversion to Nef polyhedron failed!");
logger.message(::logger::LOG_ERROR, "GEO", 73, "Conversion to Nef polyhedron failed!");
}
return nef_polyhedron;
}
CGAL::Nef_polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_nef_polyhedron(CGAL::Polyhedron_3<Kernel_> &polyhedron, Logger& logger) {
CGAL::Nef_polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_nef_polyhedron(CGAL::Polyhedron_3<Kernel_> &polyhedron, logger& logger) {
// @todo needed?
polyhedron.normalize_border();
@@ -138,7 +138,7 @@ CGAL::Nef_polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_nef_polyhe
CGAL::Polygon_mesh_processing::reverse_face_orientations(polyhedron);
}
} catch (CGAL::Failure_exception& e) {
logger.Message(Logger::LOG_ERROR, "GEO", 74, e);
logger.message(::logger::LOG_ERROR, "GEO", 74, e);
}
}
@@ -149,11 +149,11 @@ CGAL::Nef_polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_nef_polyhe
try {
nef_polyhedron = CGAL::Nef_polyhedron_3<Kernel_>(polyhedron);
} catch (...) {
logger.Message(Logger::LOG_ERROR, "GEO", 75, "Conversion to Nef polyhedron failed!");
logger.message(::logger::LOG_ERROR, "GEO", 75, "Conversion to Nef polyhedron failed!");
}
return nef_polyhedron;
} else {
logger.Message(Logger::LOG_ERROR, "GEO", 76, "Polyhedron not valid: cannot create Nef polyhedron!");
logger.message(::logger::LOG_ERROR, "GEO", 76, "Polyhedron not valid: cannot create Nef polyhedron!");
return CGAL::Nef_polyhedron_3<Kernel_>();
}
}
@@ -162,13 +162,13 @@ CGAL::Nef_polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_nef_polyhe
bool CgalKernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) {
for (auto& f : l->children) {
if (f->basis && f->basis->kind() != taxonomy::PLANE) {
logger().Error("UNS", 3, "CGAL Kernel: Non-planar faces not supported at the moment");
logger().error("UNS", 3, "CGAL Kernel: Non-planar faces not supported at the moment");
throw not_supported_error();
}
for (auto& w : f->children) {
for (auto& e : w->children) {
if (e->basis && e->basis->kind() == taxonomy::BSPLINE_CURVE) {
logger().Error("UNS", 4, "CGAL Kernel: B-spline edge curves not supported at the moment");
logger().error("UNS", 4, "CGAL Kernel: B-spline edge curves not supported at the moment");
throw not_supported_error();
}
}
@@ -197,9 +197,9 @@ bool CgalKernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) {
double volume = diag(0) * diag(1) * diag(2);
// @todo volume van be zero also..
double density = num_points / volume;
logger().Notice("GEO", 77, "Density " + boost::lexical_cast<std::string>(density), l->instance);
logger().notice("GEO", 77, "Density " + boost::lexical_cast<std::string>(density), l->instance);
if (density > 5000) {
logger().Notice("GEO", 78, "Substituted element with " + boost::lexical_cast<std::string>(density) + " vertices / m3 with a bounding box");
logger().notice("GEO", 78, "Substituted element with " + boost::lexical_cast<std::string>(density) + " vertices / m3 with a bounding box");
CGAL::Point_3<Kernel_> lower(minmax.first(0), minmax.first(1), minmax.first(2));
CGAL::Point_3<Kernel_> upper(minmax.second(0), minmax.second(1), minmax.second(2));
shape = utils::create_cube(lower, upper);
@@ -216,10 +216,10 @@ bool CgalKernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) {
if (!success) {
if (this->partial_success_is_success) {
logger().message(logger::LOG_WARNING, "Failed to convert face, skipping:", f->instance);
logger().message(::logger::LOG_WARNING, "Failed to convert face, skipping:", f->instance);
continue;
} else {
logger().message(logger::LOG_ERROR, "Failed to convert face:", f->instance);
logger().message(::logger::LOG_ERROR, "Failed to convert face:", f->instance);
return false;
}
}
@@ -242,7 +242,7 @@ bool CgalKernel::convert(const taxonomy::face::ptr face, std::list<cgal_face_t>&
}
if (face->children.size() > 1 && num_outer_bounds > 1 && face->children.size() != num_outer_bounds) {
logger().Message(Logger::LOG_ERROR, "GEO", 80, "Invalid configuration of boundaries for:", face->instance);
logger().message(::logger::LOG_ERROR, "GEO", 80, "Invalid configuration of boundaries for:", face->instance);
return false;
}
@@ -255,7 +255,7 @@ bool CgalKernel::convert(const taxonomy::face::ptr face, std::list<cgal_face_t>&
cgal_wire_t wire;
if (!convert(bound, wire)) {
logger().Message(Logger::LOG_ERROR, "GEO", 81, "Failed to process face boundary loop", bound->instance);
logger().message(::logger::LOG_ERROR, "GEO", 81, "Failed to process face boundary loop", bound->instance);
return false;
}
@@ -709,7 +709,7 @@ bool CgalKernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
if (d < 1.e-5) {
points.erase(points.end() - 1);
} else {
logger().Warning("GEO", 82, "Loop not closed", loop->instance);
logger().warning("GEO", 82, "Loop not closed", loop->instance);
}
}
@@ -723,7 +723,7 @@ bool CgalKernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
// A loop should consist of at least three vertices
std::size_t original_count = polygon.size();
if (original_count < 3) {
logger().Warning("GEO", 83, "Not enough edges for:", loop->instance);
logger().warning("GEO", 83, "Not enough edges for:", loop->instance);
return false;
}
@@ -734,14 +734,14 @@ bool CgalKernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
std::size_t count = polygon.size();
if (original_count - count != 0) {
std::stringstream ss; ss << (original_count - count) << " edges removed for:";
logger().Warning("GEO", 84, ss.str(), loop->instance);
logger().warning("GEO", 84, ss.str(), loop->instance);
}
{
std::set<cgal_point_t> visited_points;
for (auto& p : polygon) {
if (visited_points.find(p) != visited_points.end()) {
logger().Error("GEO", 85, "Skipping self-intersecting loop", loop->instance);
logger().error("GEO", 85, "Skipping self-intersecting loop", loop->instance);
// @todo signal somehow that occt kernel might be able to solve this
// @todo implement cycle detection using Arrangement_2, but that only works in exact kernel
return false;
@@ -763,7 +763,7 @@ bool CgalKernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
}
if (do_segments_intersect(segments)) {
logger().Message(Logger::LOG_WARNING, "GEO", 86, "Skipping self-intersecting loop", loop->instance);
logger().message(::logger::LOG_WARNING, "GEO", 86, "Skipping self-intersecting loop", loop->instance);
return false;
}
@@ -791,7 +791,7 @@ bool CgalKernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
*/
if (count < 3) {
logger().Message(Logger::LOG_ERROR, "GEO", 87, "Not enough edges for:", loop->instance);
logger().message(::logger::LOG_ERROR, "GEO", 87, "Not enough edges for:", loop->instance);
return false;
}
@@ -825,7 +825,7 @@ bool CgalKernel::convert_impl(const taxonomy::shell::ptr shell, ConversionResult
bool CgalKernel::convert_impl(const taxonomy::solid::ptr solid, ConversionResults& results) {
if (solid->children.size() > 1) {
logger().Error("UNS", 5, "Multiple shells in solid not supported at the moment");
logger().error("UNS", 5, "Multiple shells in solid not supported at the moment");
return false;
}
cgal_shape_t shape;
@@ -970,7 +970,7 @@ bool ifcopenshell::geometry::kernels::CgalKernel::convert_openings(const express
try {
a.convert_to_polyhedron(a_poly);
} catch (...) {
logger().Message(Logger::LOG_ERROR, "GEO", 88, "Could not convert from Nef:", entity);
logger().message(::logger::LOG_ERROR, "GEO", 88, "Could not convert from Nef:", entity);
return false;
}
@@ -1169,7 +1169,7 @@ bool CgalKernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::dir
try {
nef_shape -= utils::create_nef_polyhedron(face_list);
} catch (...) {
logger::message(logger::LOG_ERROR, "IfcExtrudedAreaSolid: cannot subtract opening for:");
::logger::root().message(::logger::LOG_ERROR, "IfcExtrudedAreaSolid: cannot subtract opening for:");
return false;
}
}
@@ -1186,7 +1186,7 @@ bool CgalKernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::dir
nef_shape.convert_to_polyhedron(shape);
return true;
} catch (...) {
logger::message(logger::LOG_ERROR, "IfcExtrudedAreaSolid: cannot convert Nef to polyhedron for:");
::logger::root().message(::logger::LOG_ERROR, "IfcExtrudedAreaSolid: cannot convert Nef to polyhedron for:");
return false;
}
*/
@@ -1195,7 +1195,7 @@ bool CgalKernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::dir
bool CgalKernel::convert(const taxonomy::extrusion::ptr extrusion, cgal_shape_t &shape) {
const double& height = extrusion->depth;
if (height < settings_.get<settings::Precision>().get()) {
logger().Message(Logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", extrusion->instance);
logger().message(::logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", extrusion->instance);
return false;
}
@@ -1331,13 +1331,13 @@ bool CgalKernel::preprocess_boolean_operand(const express::Base& log_reference,
cgal_shape_t shape = shape_const;
if (!shape.is_valid()) {
logger().Message(Logger::LOG_ERROR, "GEO", 90, "Conversion to Nef will fail. Invalid geometry:", log_reference);
logger().message(::logger::LOG_ERROR, "GEO", 90, "Conversion to Nef will fail. Invalid geometry:", log_reference);
return false;
}
if (!shape.is_closed()) {
// TODO: There can be substractions to remove parts of non-volumetric objects. Maybe iterate over all faces of an entity and put them in a Nef_polyhedron_3 through Boolean union? Highly inefficient but maybe desirable...
logger().Message(Logger::LOG_ERROR, "UNS", 6, "Subtraction of openings not supported for non-closed geometry:", log_reference);
logger().message(::logger::LOG_ERROR, "UNS", 6, "Subtraction of openings not supported for non-closed geometry:", log_reference);
return false;
}
@@ -1346,18 +1346,18 @@ bool CgalKernel::preprocess_boolean_operand(const express::Base& log_reference,
try {
success = CGAL::Polygon_mesh_processing::triangulate_faces(shape);
} catch (CGAL::Failure_exception& e) {
logger().Notice("GEO", 91, e);
logger().Message(Logger::LOG_ERROR, "GEO", 92, "Triangulation of geometry crashed:", log_reference);
logger().notice("GEO", 91, e);
logger().message(::logger::LOG_ERROR, "GEO", 92, "Triangulation of geometry crashed:", log_reference);
return false;
}
if (!success) {
logger().Message(Logger::LOG_ERROR, "GEO", 93, "Triangulation of geometry failed:", log_reference);
logger().message(::logger::LOG_ERROR, "GEO", 93, "Triangulation of geometry failed:", log_reference);
return false;
}
if (CGAL::Polygon_mesh_processing::does_self_intersect(shape)) {
logger().Message(Logger::LOG_ERROR, "GEO", 94, "Conversion to Nef will fail. Self-intersecting geometry:", log_reference);
logger().message(::logger::LOG_ERROR, "GEO", 94, "Conversion to Nef will fail. Self-intersecting geometry:", log_reference);
return false;
}
@@ -1429,8 +1429,8 @@ bool CgalKernel::preprocess_boolean_operand(const express::Base& log_reference,
try {
result = CGAL::Nef_polyhedron_3<Kernel_>(shape);
} catch (CGAL::Failure_exception& e) {
logger().Notice("GEO", 95, e);
logger().Message(Logger::LOG_ERROR, "GEO", 96, "Could not convert geometry to Nef:", log_reference);
logger().notice("GEO", 95, e);
logger().message(::logger::LOG_ERROR, "GEO", 96, "Could not convert geometry to Nef:", log_reference);
return false;
}
@@ -1502,8 +1502,8 @@ bool CgalKernel::preprocess_boolean_operand(const express::Base& log_reference,
// @todo don't dilate in 3 dimensions but only in the XY plane, orthogonal to wall axis.
result = CGAL::minkowski_sum_3(result, precision_cube_);
} catch (CGAL::Failure_exception& e) {
logger().Notice("GEO", 97, e);
logger().Message(Logger::LOG_ERROR, "GEO", 98, "Could not dilate boolean operand", log_reference);
logger().notice("GEO", 97, e);
logger().message(::logger::LOG_ERROR, "GEO", 98, "Could not dilate boolean operand", log_reference);
return false;
}
}
@@ -1528,8 +1528,8 @@ bool CgalKernel::preprocess_boolean_operand(const express::Base& log_reference,
cgal_shape_t convert_back;
result.convert_to_polyhedron(convert_back);
} catch (CGAL::Failure_exception& e) {
logger().Notice("GEO", 99, e);
logger().Message(Logger::LOG_WARNING, "GEO", 100, "Final conversion will likely fail. Could not convert geometry from Nef:", log_reference);
logger().notice("GEO", 99, e);
logger().message(::logger::LOG_WARNING, "GEO", 100, "Final conversion will likely fail. Could not convert geometry from Nef:", log_reference);
}
return true;
@@ -1851,7 +1851,7 @@ bool CgalKernel::convert_impl(const taxonomy::boolean_result::ptr br, Conversion
// even-odd fill rule will result in incorrect results.
// See for example the Duplex model roof.
logger().Notice("GEO", 101, "Holes are not disjoint");
logger().notice("GEO", 101, "Holes are not disjoint");
CGAL::Polygon_set_2<Kernel_> result;
auto it = loops.begin();
@@ -1904,7 +1904,7 @@ bool CgalKernel::convert_impl(const taxonomy::boolean_result::ptr br, Conversion
);
});
logger().Notice("GEO", 102, "Processed boolean operation as 2d arrangement");
logger().notice("GEO", 102, "Processed boolean operation as 2d arrangement");
return true;
@@ -1990,7 +1990,7 @@ bool CgalKernel::convert_impl(const taxonomy::boolean_result::ptr br, Conversion
ps.push_back({ p.x(), p.y() });
}
if (!ps.is_simple()) {
logger().Warning("GEO", 103, "Polygonal boundary not simple", face->children[0]->instance);
logger().warning("GEO", 103, "Polygonal boundary not simple", face->children[0]->instance);
continue;
}
@@ -2136,7 +2136,7 @@ bool CgalKernel::convert_impl(const taxonomy::boolean_result::ptr br, Conversion
try {
a.convert_to_polyhedron(a_poly);
} catch (...) {
logger().Message(Logger::LOG_ERROR, "GEO", 104, "Could not convert geometry with openings from Nef:", br->instance);
logger().message(::logger::LOG_ERROR, "GEO", 104, "Could not convert geometry with openings from Nef:", br->instance);
return false;
}
@@ -2151,7 +2151,7 @@ bool CgalKernel::convert_impl(const taxonomy::boolean_result::ptr br, Conversion
#endif
}
PolyhedronBuilder::PolyhedronBuilder(std::list<cgal_face_t>* face_list, Logger& logger) : face_list(face_list), logger_(logger) {
PolyhedronBuilder::PolyhedronBuilder(std::list<cgal_face_t>* face_list, logger& logger) : face_list(face_list), logger_(logger) {
}
#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>
@@ -2227,8 +2227,8 @@ void PolyhedronBuilder::operator()(CGAL::Polyhedron_3<Kernel_>::HalfedgeDS &hds)
// For now let's just skip over the triangle. We can also use
// the Aff_transformation_3 stored in place to convert the 2d
// coords back to 3d.
logger::warning("Ignoring triangulated facet with novel point likely due to self-intersections");
logger_.Warning("GEO", 105, "Ignoring triangulated facet with novel point likely due to self-intersections");
::logger::root().warning("Ignoring triangulated facet with novel point likely due to self-intersections");
logger_.warning("GEO", 105, "Ignoring triangulated facet with novel point likely due to self-intersections");
facet_vertices.erase(facet_vertices.end() - 1);
break;
}
@@ -2268,7 +2268,7 @@ void PolyhedronBuilder::operator()(CGAL::Polyhedron_3<Kernel_>::HalfedgeDS &hds)
if (!CGAL::Polygon_mesh_processing::is_polygon_soup_a_polygon_mesh(facet_vertices)) {
// @todo seems to return false now, almost always?
// logger::warning("Reoriented polygonal surface");
// ::logger::root().warning("Reoriented polygonal surface");
CGAL::Polygon_mesh_processing::orient_polygon_soup(unique_points_as_vector, facet_vertices);
}
CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(unique_points_as_vector, facet_vertices, *from_soup);
@@ -2288,12 +2288,12 @@ void PolyhedronBuilder::operator()(CGAL::Polyhedron_3<Kernel_>::HalfedgeDS &hds)
if (added_edges.find(p) != added_edges.end()) {
if (reoriented) {
facet_indices_to_delete.push_back(fi);
logger::notice("Removed facet");
::logger::root().notice("Removed facet");
valid = false;
break;
} else {
std::reverse(f.begin(), f.end());
logger::notice("Reversed facet");
::logger::root().notice("Reversed facet");
reoriented = true;
goto check_edge_existence;
}
+7 -7
View File
@@ -20,7 +20,7 @@
#ifndef CGAL_KERNEL_H
#define CGAL_KERNEL_H
#include "../../../ifcparse/IfcLogger.h"
#include "../../../ifcparse/logger.h"
/*
#ifdef NO_CACHE
@@ -60,12 +60,12 @@ namespace ifcopenshell {
namespace utils {
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<Kernel_> create_cube(double d);
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<Kernel_> create_cube(const Kernel_::Point_3& lower, const Kernel_::Point_3& upper);
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<Kernel_> create_polyhedron(std::list<cgal_face_t> &face_list, bool stitch_borders = false, Logger& logger = Logger::Root());
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<Kernel_> create_polyhedron(std::list<cgal_face_t> &face_list, bool stitch_borders = false, logger& logger = ::logger::root());
#ifndef IFOPSH_SIMPLE_KERNEL
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<Kernel_> create_polyhedron(const CGAL::Nef_polyhedron_3<Kernel_> &nef_polyhedron, Logger& logger = Logger::Root());
IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3<Kernel_> create_nef_polyhedron(std::list<cgal_face_t> &face_list, Logger& logger = Logger::Root());
IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3<Kernel_> create_nef_polyhedron(CGAL::Polyhedron_3<Kernel_> &polyhedron, Logger& logger = Logger::Root());
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<Kernel_> create_polyhedron(const CGAL::Nef_polyhedron_3<Kernel_> &nef_polyhedron, logger& logger = ::logger::root());
IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3<Kernel_> create_nef_polyhedron(std::list<cgal_face_t> &face_list, logger& logger = ::logger::root());
IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3<Kernel_> create_nef_polyhedron(CGAL::Polyhedron_3<Kernel_> &polyhedron, logger& logger = ::logger::root());
#endif
}
@@ -93,11 +93,11 @@ namespace ifcopenshell {
#endif
public:
CgalKernel(const Settings& settings, Logger& logger = Logger::Root())
CgalKernel(const Settings& settings, ::logger& logger = ::logger::root())
: AbstractKernel("cgal", settings, logger)
{}
virtual AbstractKernel* clone(Logger& logger) const {
virtual AbstractKernel* clone(::logger& logger) const {
return new CgalKernel(settings(), logger);
}
@@ -11,7 +11,6 @@
#include <unordered_map>
using IfcGeom::ConversionResultShape;
using IfcGeom::NumberNativeDouble;
using IfcGeom::OpaqueCoordinate;
using IfcGeom::OpaqueNumber;
@@ -216,7 +215,7 @@ std::optional<manifold::Manifold> ifcopenshell::geometry::ManifoldShape::as_mani
return manifold::Manifold::BatchBoolean(solids, manifold::OpType::Add);
}
void ifcopenshell::geometry::ManifoldShape::Triangulate(ifcopenshell::geometry::Settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id) const {
void ifcopenshell::geometry::ManifoldShape::Triangulate(ifcopenshell::geometry::Settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id, ::logger&) const {
for (const auto& part : parts_) {
auto mesh = transform_mesh(part.mesh, place);
std::vector<int> indices(mesh.NumVert());
@@ -346,13 +345,13 @@ std::pair<OpaqueCoordinate<3>, OpaqueCoordinate<3>> ifcopenshell::geometry::Mani
}
auto result = std::make_pair(
OpaqueCoordinate<3>(
new NumberNativeDouble(box->min[0]),
new NumberNativeDouble(box->min[1]),
new NumberNativeDouble(box->min[2])),
OpaqueNumber(box->min[0]),
OpaqueNumber(box->min[1]),
OpaqueNumber(box->min[2])),
OpaqueCoordinate<3>(
new NumberNativeDouble(box->max[0]),
new NumberNativeDouble(box->max[1]),
new NumberNativeDouble(box->max[2])));
OpaqueNumber(box->max[0]),
OpaqueNumber(box->max[1]),
OpaqueNumber(box->max[2])));
delete box;
return result;
}
@@ -365,28 +364,28 @@ void ifcopenshell::geometry::ManifoldShape::set_box(void* box_ptr) {
parts_ = { make_box_part(*box) };
}
OpaqueNumber* ifcopenshell::geometry::ManifoldShape::length() {
OpaqueNumber ifcopenshell::geometry::ManifoldShape::length() {
double total = 0.;
for (const auto& part : parts_) {
total += mesh_length(part.mesh);
}
return new NumberNativeDouble(total);
return OpaqueNumber(total);
}
OpaqueNumber* ifcopenshell::geometry::ManifoldShape::area() {
OpaqueNumber ifcopenshell::geometry::ManifoldShape::area() {
double total = 0.;
for (const auto& part : parts_) {
total += part.solid ? part.solid->SurfaceArea() : mesh_area(part.mesh);
}
return new NumberNativeDouble(total);
return OpaqueNumber(total);
}
OpaqueNumber* ifcopenshell::geometry::ManifoldShape::volume() {
OpaqueNumber ifcopenshell::geometry::ManifoldShape::volume() {
double total = 0.;
for (const auto& part : parts_) {
total += part.solid ? part.solid->Volume() : mesh_volume(part.mesh);
}
return new NumberNativeDouble(total);
return OpaqueNumber(total);
}
OpaqueCoordinate<3> ifcopenshell::geometry::ManifoldShape::position() {
@@ -494,11 +493,11 @@ ConversionResultShape* ifcopenshell::geometry::ManifoldShape::concat(ConversionR
return new ManifoldShape(std::move(parts));
}
void ifcopenshell::geometry::ManifoldShape::map(OpaqueCoordinate<4>&, OpaqueCoordinate<4>&) {
std::size_t ifcopenshell::geometry::ManifoldShape::map(OpaqueCoordinate<4>&, OpaqueCoordinate<4>&) {
throw std::runtime_error("Not implemented");
}
void ifcopenshell::geometry::ManifoldShape::map(const std::vector<OpaqueCoordinate<4>>&, const std::vector<OpaqueCoordinate<4>>&) {
std::size_t ifcopenshell::geometry::ManifoldShape::map(const std::vector<OpaqueCoordinate<4>>&, const std::vector<OpaqueCoordinate<4>>&) {
throw std::runtime_error("Not implemented");
}
@@ -40,7 +40,7 @@ public:
std::optional<manifold::Manifold> as_manifold() const;
virtual std::string_view backend_id() const { return "manifold"; }
virtual void Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id) const;
virtual void Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id, ::logger& logger = ::logger::root()) const;
virtual void Serialize(const ifcopenshell::geometry::taxonomy::matrix4& place, std::string&) const;
virtual int surface_genus() const;
@@ -54,9 +54,9 @@ public:
virtual std::pair<IfcGeom::OpaqueCoordinate<3>, IfcGeom::OpaqueCoordinate<3>> bounding_box() const;
virtual void set_box(void* b);
virtual IfcGeom::OpaqueNumber* length();
virtual IfcGeom::OpaqueNumber* area();
virtual IfcGeom::OpaqueNumber* volume();
virtual IfcGeom::OpaqueNumber length();
virtual IfcGeom::OpaqueNumber area();
virtual IfcGeom::OpaqueNumber volume();
virtual IfcGeom::OpaqueCoordinate<3> position();
virtual IfcGeom::OpaqueCoordinate<3> axis();
@@ -77,8 +77,8 @@ public:
virtual IfcGeom::ConversionResultShape* intersect(IfcGeom::ConversionResultShape*);
virtual IfcGeom::ConversionResultShape* concat(IfcGeom::ConversionResultShape*);
virtual void map(IfcGeom::OpaqueCoordinate<4>& from, IfcGeom::OpaqueCoordinate<4>& to);
virtual void map(const std::vector<IfcGeom::OpaqueCoordinate<4>>& from, const std::vector<IfcGeom::OpaqueCoordinate<4>>& to);
virtual std::size_t map(IfcGeom::OpaqueCoordinate<4>& from, IfcGeom::OpaqueCoordinate<4>& to);
virtual std::size_t map(const std::vector<IfcGeom::OpaqueCoordinate<4>>& from, const std::vector<IfcGeom::OpaqueCoordinate<4>>& to);
virtual IfcGeom::ConversionResultShape* moved(ifcopenshell::geometry::taxonomy::matrix4::ptr) const;
virtual bool surface_area_along_direction(double tol, const ifcopenshell::geometry::taxonomy::matrix4::ptr&, double& along_x, double& along_y, double& along_z) const;
+23 -23
View File
@@ -769,16 +769,16 @@ namespace {
const auto shell_info = diagnose_shell(shell);
const auto before = diagnose_mesh(before_part.mesh, precision);
const auto after = diagnose_mesh(after_mesh, precision);
logger::warning(
::logger::root().warning(
"Manifold kernel: solid shell manifold validation failed; before_transform=" +
std::string(before_part.solid ? "solid" : "mesh-only") +
" (" + manifold_error_string(before_status) + "), after_transform=(" + manifold_error_string(after_status) + ")",
shell->instance);
logger::warning("Manifold kernel: solid shell diagnosis: " + solid_shell_failure_diagnosis(before_part, before, after, before_status, after_status), shell->instance);
logger::warning("Manifold kernel: solid shell input: " + shell_diagnostics_string(shell_info), shell->instance);
logger::warning("Manifold kernel: solid shell mesh before transform: " + mesh_diagnostics_string(before), shell->instance);
logger::warning("Manifold kernel: solid shell transform: " + matrix_diagnostics_string(place), shell->instance);
logger::warning("Manifold kernel: solid shell mesh after transform: " + mesh_diagnostics_string(after), shell->instance);
::logger::root().warning("Manifold kernel: solid shell diagnosis: " + solid_shell_failure_diagnosis(before_part, before, after, before_status, after_status), shell->instance);
::logger::root().warning("Manifold kernel: solid shell input: " + shell_diagnostics_string(shell_info), shell->instance);
::logger::root().warning("Manifold kernel: solid shell mesh before transform: " + mesh_diagnostics_string(before), shell->instance);
::logger::root().warning("Manifold kernel: solid shell transform: " + matrix_diagnostics_string(place), shell->instance);
::logger::root().warning("Manifold kernel: solid shell mesh after transform: " + mesh_diagnostics_string(after), shell->instance);
}
double signed_area(const manifold::SimplePolygon& polygon) {
@@ -1492,7 +1492,7 @@ namespace {
bool ManifoldKernel::convert_impl(const taxonomy::extrusion::ptr extrusion, IfcGeom::ConversionResults& results) {
auto part = part_from_extrusion(extrusion, settings_.get<settings::Precision>().get(), dilation_hack, settings_.get<settings::CircleSegments>().get());
if (!part) {
logger::warning("Manifold kernel: failed to convert extrusion, requires planar bounds with line, circle or ellipse edges", extrusion->instance);
::logger::root().warning("Manifold kernel: failed to convert extrusion, requires planar bounds with line, circle or ellipse edges", extrusion->instance);
return false;
}
results.emplace_back(IfcGeom::ConversionResult(
@@ -1507,11 +1507,11 @@ bool ManifoldKernel::convert_impl(const taxonomy::shell::ptr shell, IfcGeom::Con
manifold::Manifold::Error status = manifold::Manifold::Error::NoError;
auto part = part_from_shell(shell, settings_.get<settings::Precision>().get(), dilation_hack, &status);
if (!part) {
logger::warning("Manifold kernel: failed to convert shell, requires planar polygonal faces with explicit vertices", shell->instance);
::logger::root().warning("Manifold kernel: failed to convert shell, requires planar polygonal faces with explicit vertices", shell->instance);
return false;
}
if (!part->solid) {
logger::notice("Manifold kernel: shell converted as mesh only (" + manifold_error_string(status) + ")", shell->instance);
::logger::root().notice("Manifold kernel: shell converted as mesh only (" + manifold_error_string(status) + ")", shell->instance);
}
results.emplace_back(IfcGeom::ConversionResult(
shell->instance.id(),
@@ -1528,7 +1528,7 @@ bool ManifoldKernel::convert_impl(const taxonomy::solid::ptr solid, IfcGeom::Con
manifold::Manifold::Error before_status = manifold::Manifold::Error::NoError;
auto part = part_from_shell(shell, precision, dilation_hack, &before_status);
if (!part) {
logger::warning("Manifold kernel: failed to convert solid shell, requires planar polygonal faces with explicit vertices", shell->instance);
::logger::root().warning("Manifold kernel: failed to convert solid shell, requires planar polygonal faces with explicit vertices", shell->instance);
return false;
}
auto place = shell->matrix ? shell->matrix : taxonomy::make<taxonomy::matrix4>();
@@ -1570,21 +1570,21 @@ bool ManifoldKernel::convert_impl(const taxonomy::boolean_result::ptr br, IfcGeo
dilation_hack = first ? 0. : precision * 10.;
if (!first && br->operation == taxonomy::boolean_result::SUBTRACTION && face) {
if (!first_bbox) {
logger::warning("Manifold kernel: cannot fit halfspace operand without a valid first operand bounds", child->instance);
::logger::root().warning("Manifold kernel: cannot fit halfspace operand without a valid first operand bounds", child->instance);
return false;
}
HalfspaceBuildState state;
auto part = part_from_halfspace_solid(state, solid, face, *first_bbox, precision, dilation_hack);
if (!part) {
if (state.unchanged && br->operation == taxonomy::boolean_result::SUBTRACTION) {
logger::warning("Manifold kernel: halfspace subtraction yields unchanged volume", child->instance);
::logger::root().warning("Manifold kernel: halfspace subtraction yields unchanged volume", child->instance);
continue;
}
logger::warning("Manifold kernel: failed to fit halfspace boolean operand to first operand bounds", child->instance);
::logger::root().warning("Manifold kernel: failed to fit halfspace boolean operand to first operand bounds", child->instance);
return false;
}
if (!part->solid) {
logger::warning("Manifold kernel: fitted halfspace operand is not a valid manifold solid", child->instance);
::logger::root().warning("Manifold kernel: fitted halfspace operand is not a valid manifold solid", child->instance);
return false;
}
operand = *part->solid;
@@ -1594,12 +1594,12 @@ bool ManifoldKernel::convert_impl(const taxonomy::boolean_result::ptr br, IfcGeo
} else {
IfcGeom::ConversionResults converted;
if (!AbstractKernel::convert(child, converted)) {
logger::warning("Manifold kernel: failed to convert boolean operand", child->instance);
::logger::root().warning("Manifold kernel: failed to convert boolean operand", child->instance);
return false;
}
operand = results_to_operand(converted);
if (!operand) {
logger::warning("Manifold kernel: boolean operand is not a valid manifold solid", child->instance);
::logger::root().warning("Manifold kernel: boolean operand is not a valid manifold solid", child->instance);
return false;
}
if (!style) {
@@ -1612,7 +1612,7 @@ bool ManifoldKernel::convert_impl(const taxonomy::boolean_result::ptr br, IfcGeo
if (first) {
auto bbox = operand->BoundingBox();
if (!bbox.IsFinite()) {
logger::warning("Manifold kernel: first boolean operand has no valid bounds", child->instance);
::logger::root().warning("Manifold kernel: first boolean operand has no valid bounds", child->instance);
return false;
}
first_bbox = bbox;
@@ -1623,7 +1623,7 @@ bool ManifoldKernel::convert_impl(const taxonomy::boolean_result::ptr br, IfcGeo
dilation_hack = 0.;
auto result = boolean_result_from_operands(operands, br->operation);
if (!result || result->IsEmpty()) {
logger::warning("Manifold kernel: boolean operation produced no result", br->instance);
::logger::root().warning("Manifold kernel: boolean operation produced no result", br->instance);
return false;
}
results.emplace_back(IfcGeom::ConversionResult(
@@ -1638,7 +1638,7 @@ bool ManifoldKernel::convert_openings(const express::Base&, const std::vector<st
std::vector<manifold::Manifold> opening_operands;
auto entity_bbox = results_bbox(entity_shapes);
if (!entity_bbox) {
logger::warning("Manifold kernel: host shape has no valid bounds for halfspace fitting");
::logger::root().warning("Manifold kernel: host shape has no valid bounds for halfspace fitting");
return false;
}
dilation_hack = settings_.get<settings::Precision>().get() * 10.;
@@ -1646,19 +1646,19 @@ bool ManifoldKernel::convert_openings(const express::Base&, const std::vector<st
const auto relative = taxonomy::make<taxonomy::matrix4>(entity_trsf.ccomponents().inverse() * opening.second.ccomponents());
IfcGeom::ConversionResults converted;
if (!AbstractKernel::convert(opening.first, converted)) {
logger::warning("Manifold kernel: failed to convert opening operand", opening.first->instance);
::logger::root().warning("Manifold kernel: failed to convert opening operand", opening.first->instance);
return false;
}
for (const auto& result : converted) {
auto moved = std::unique_ptr<IfcGeom::ConversionResultShape>(result.Shape()->moved(taxonomy::make<taxonomy::matrix4>(relative->ccomponents() * result.Placement()->ccomponents())));
auto* shape = dynamic_cast<ifcopenshell::geometry::ManifoldShape*>(moved.get());
if (!shape) {
logger::warning("Manifold kernel: opening result is not a manifold shape");
::logger::root().warning("Manifold kernel: opening result is not a manifold shape");
return false;
}
auto operand = shape->as_manifold();
if (!operand) {
logger::warning("Manifold kernel: opening result is not a valid manifold solid", opening.first->instance);
::logger::root().warning("Manifold kernel: opening result is not a valid manifold solid", opening.first->instance);
return false;
}
opening_operands.push_back(*operand);
@@ -1672,7 +1672,7 @@ bool ManifoldKernel::convert_openings(const express::Base&, const std::vector<st
for (const auto& entity_shape : entity_shapes) {
auto operand = result_to_manifold(entity_shape);
if (!operand) {
logger::warning("Manifold kernel: host shape is not a valid manifold solid");
::logger::root().warning("Manifold kernel: host shape is not a valid manifold solid");
return false;
}
auto result = *operand - opening_union;
@@ -13,11 +13,11 @@ namespace kernels {
class IFC_GEOMLIBRARY_API ManifoldKernel : public AbstractKernel {
public:
ManifoldKernel(const Settings& settings)
: AbstractKernel("manifold", settings) {}
ManifoldKernel(const Settings& settings, ::logger& logger = ::logger::root())
: AbstractKernel("manifold", settings, logger) {}
virtual AbstractKernel* clone() const {
return new ManifoldKernel(settings());
virtual AbstractKernel* clone(::logger& logger) const {
return new ManifoldKernel(settings(), logger);
}
virtual bool supports_openings() const { return true; }
@@ -68,7 +68,7 @@ IfcGeom::ConversionResultShape* ifcopenshell::geometry::OpenCascadeShape::clone(
return new OpenCascadeShape(shape_);
}
void ifcopenshell::geometry::OpenCascadeShape::Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id, Logger& logger) const {
void ifcopenshell::geometry::OpenCascadeShape::Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id, ::logger& logger) const {
// @todo remove duplication with OpenCascadeKernel::convert(const taxonomy::matrix4::ptr matrix, gp_GTrsf& trsf);
// above can be static?
@@ -108,7 +108,7 @@ void ifcopenshell::geometry::OpenCascadeShape::Triangulate(ifcopenshell::geometr
try {
BRepMesh_IncrementalMesh(shape_, settings.get<settings::MesherLinearDeflection>().get(), false, settings.get<settings::MesherAngularDeflection>().get());
} catch (...) {
Logger::Root().Message(Logger::LOG_ERROR, "GEO", 183, "Failed to triangulate shape");
::logger::root().message(::logger::LOG_ERROR, "GEO", 183, "Failed to triangulate shape");
return;
}
}
@@ -134,7 +134,7 @@ void ifcopenshell::geometry::OpenCascadeShape::Triangulate(ifcopenshell::geometr
opencascade::handle<Poly_Triangulation> tri = BRep_Tool::Triangulation(face, loc);
if (tri.IsNull()) {
Logger::Root().Message(Logger::LOG_ERROR, "GEO", 184, "Triangulation missing for face");
::logger::root().message(::logger::LOG_ERROR, "GEO", 184, "Triangulation missing for face");
} else {
// Keep track of the number of times an edge is used
// Manifold edges (i.e. edges used twice) are deemed invisible
@@ -195,7 +195,7 @@ void ifcopenshell::geometry::OpenCascadeShape::Triangulate(ifcopenshell::geometr
else triangles(i).Get(n1, n2, n3);
if (dict[n1] == dict[n2] || dict[n2] == dict[n3] || dict[n3] == dict[n1]) {
logger.Warning("GEO", 185, "Mesher generated a degenerate triangle, ignoring");
logger.warning("GEO", 185, "Mesher generated a degenerate triangle, ignoring");
continue;
}
@@ -640,7 +640,7 @@ namespace {
try {
BRepMesh_IncrementalMesh(s, tol);
} catch (...) {
Logger::Root().Message(Logger::LOG_ERROR, "GEO", 186, "Failed to triangulate shape");
::logger::root().message(::logger::LOG_ERROR, "GEO", 186, "Failed to triangulate shape");
return;
}
meshed = true;
@@ -42,18 +42,14 @@ namespace ifcopenshell {
class IFC_GEOMLIBRARY_API OpenCascadeShape : public IfcGeom::ConversionResultShape {
public:
std::string type() const override { return "OpenCascadeShape"; }
OpenCascadeShape(const TopoDS_Shape& shape)
: shape_(shape) {}
OpenCascadeShape(TopoDS_Shape&& shape)
: shape_(std::move(shape)) {}
OpenCascadeShape(const TopoDS_Shape& shape);
OpenCascadeShape(TopoDS_Shape&& shape);
const TopoDS_Shape& shape() const;
operator const TopoDS_Shape& ();
virtual std::string_view backend_id() const;
virtual void Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id, Logger& logger = Logger::Root()) const;
virtual void Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id, ::logger& logger = ::logger::root()) const;
virtual void Serialize(const ifcopenshell::geometry::taxonomy::matrix4& place, std::string&) const;
virtual IfcGeom::ConversionResultShape* clone() const;
@@ -120,7 +120,7 @@ bool IfcGeom::OpenCascadeKernel::convert_openings(const express::Base& entity, c
auto it3_shape = std::static_pointer_cast<OpenCascadeShape>(it3->Shape())->shape();
if (it3_shape.IsNull()) {
logger_.Error("GEO", 187, "Null operand");
logger_.error("GEO", 187, "Null operand");
continue;
}
@@ -145,7 +145,7 @@ bool IfcGeom::OpenCascadeKernel::convert_openings(const express::Base& entity, c
IfcGeom::util::create_solid_from_faces(list, entity_part, settings_.get<settings::Precision>().get(), true);
is_manifold = util::is_manifold(entity_part);
if (is_manifold) {
logger_.Warning("GEO", 188, "Successfully sewed non-manifold first operand");
logger_.warning("GEO", 188, "Successfully sewed non-manifold first operand");
}
}
@@ -163,17 +163,17 @@ bool IfcGeom::OpenCascadeKernel::convert_openings(const express::Base& entity, c
failure = "Empty result (no faces) for BOPAlgo_MakerVolume; original was " + std::to_string(IfcGeom::util::count(entity_part, TopAbs_FACE));
} else {
is_manifold = util::is_manifold(entity_part_2);
logger_.Warning("GEO", 189, std::string("Sucessfully detected exterior volume to non-manifold first operand; shape is now ") + (is_manifold ? std::string("manifold") : std::string("non-manifold")));
logger_.warning("GEO", 189, std::string("Sucessfully detected exterior volume to non-manifold first operand; shape is now ") + (is_manifold ? std::string("manifold") : std::string("non-manifold")));
entity_part = entity_part_2;
}
} catch (const Standard_Failure& e) {
failure.emplace(e.GetMessageString());
}
if (failure) {
logger_.Warning("GEO", 190, "MakeVolume failed: " + *failure, entity);
logger_.warning("GEO", 190, "MakeVolume failed: " + *failure, entity);
}
} else {
logger_.Warning("GEO", 191, "Non-manifold first operand, use --make-volume to try and make manifold");
logger_.warning("GEO", 191, "Non-manifold first operand, use --make-volume to try and make manifold");
}
}
@@ -189,7 +189,7 @@ bool IfcGeom::OpenCascadeKernel::convert_openings(const express::Base& entity, c
const auto& m = it3->Placement()->ccomponents();
// @todo
// if (entity_shape_gtrsf.Form() == gp_Other) {
// logger::message(logger::LOG_WARNING, "Applying non uniform transformation to:", entity);
// ::logger::root().message(::logger::LOG_WARNING, "Applying non uniform transformation to:", entity);
// }
gp_Trsf entity_shape_gtrsf;
entity_shape_gtrsf.SetValues(
@@ -216,7 +216,7 @@ bool IfcGeom::OpenCascadeKernel::convert_openings(const express::Base& entity, c
if (util::boolean_operation(bst, result, opening_list, BOPAlgo_CUT, intermediate_result)) {
result = intermediate_result;
} else {
logger_.Message(Logger::LOG_ERROR, "GEO", 192, "Opening subtraction failed for " + boost::lexical_cast<std::string>(std::distance(jt, it)) + " openings", entity);
logger_.message(::logger::LOG_ERROR, "GEO", 192, "Opening subtraction failed for " + boost::lexical_cast<std::string>(std::distance(jt, it)) + " openings", entity);
}
jt = it;
@@ -237,7 +237,7 @@ bool IfcGeom::OpenCascadeKernel::convert_openings(const express::Base& entity, c
// where we keep the first operand as is (a compound of faces probably,
// unless --orient-shells was activated in which case we're already lost).
if (!is_manifold) {
logger_.Warning("GEO", 193, "Retrying boolean operation on individual faces");
logger_.warning("GEO", 193, "Retrying boolean operation on individual faces");
}
continue;
}
@@ -416,7 +416,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// }
//
// if (!success) {
// logger::error("Failed processing layerset");
// ::logger::root().error("Failed processing layerset");
// }
// }
// }
@@ -444,7 +444,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// }
// }
// if (some_items_without_style) {
// logger::warning("No material and surface styles for:", product);
// ::logger::root().warning("No material and surface styles for:", product);
// }
// }
//
@@ -471,7 +471,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// parent_id = parent_object->data().id();
// }
// } catch (const std::exception& e) {
// logger::error(e);
// ::logger::root().error(e);
// }
//
// const std::string name = product->Name().value_or("");
@@ -483,9 +483,9 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// convert(product->ObjectPlacement(), trsf);
// }
// } catch (const std::exception& e) {
// logger::error(e);
// ::logger::root().error(e);
// } catch (...) {
// logger::error("Failed to construct placement");
// ::logger::root().error("Failed to construct placement");
// }
//
// // Does the IfcElement have any IfcOpenings?
@@ -506,10 +506,10 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// try {
// convert_openings(product, openings, shapes, trsf, opened_shapes);
// } catch (const std::exception& e) {
// logger::message(logger::LOG_ERROR, std::string("error processing openings for: ") + e.what() + ":", product);
// ::logger::root().message(::logger::LOG_ERROR, std::string("error processing openings for: ") + e.what() + ":", product);
// caught_error = true;
// } catch (...) {
// logger::message(logger::LOG_ERROR, "error processing openings for:", product);
// ::logger::root().message(::logger::LOG_ERROR, "error processing openings for:", product);
// }
//
// if (caught_error && opened_shapes.size() < shapes.size()) {
@@ -574,12 +574,12 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// if (elem->geometry().calculate_surface_area(a_calc)) {
// double diff = std::abs(a_calc - a_file);
// if (diff / std::sqrt(a_file) > getValue(GV_PRECISION)) {
// logger::error("Validation of surface area failed for:", product);
// ::logger::root().error("Validation of surface area failed for:", product);
// } else {
// logger::notice("Validation of surface area succeeded for:", product);
// ::logger::root().notice("Validation of surface area succeeded for:", product);
// }
// } else {
// logger::error("Validation of surface area failed for:", product);
// ::logger::root().error("Validation of surface area failed for:", product);
// }
// } else if (q->as<IfcSchema::IfcQuantityVolume>() && q->Name() == "Volume") {
// double v_calc;
@@ -587,12 +587,12 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// if (elem->geometry().calculate_volume(v_calc)) {
// double diff = std::abs(v_calc - v_file);
// if (diff / std::sqrt(v_file) > getValue(GV_PRECISION)) {
// logger::error("Validation of volume failed for:", product);
// ::logger::root().error("Validation of volume failed for:", product);
// } else {
// logger::notice("Validation of volume succeeded for:", product);
// ::logger::root().notice("Validation of volume succeeded for:", product);
// }
// } else {
// logger::error("Validation of volume failed for:", product);
// ::logger::root().error("Validation of volume failed for:", product);
// }
// } else if (q->as<IfcSchema::IfcPhysicalComplexQuantity>() && q->Name() == "Shape Validation Properties") {
// auto qs2 = q->as<IfcSchema::IfcPhysicalComplexQuantity>()->HasQuantities();
@@ -611,9 +611,9 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// }
// }
// if (!all_succeeded) {
// logger::error("Validation of surface genus failed for:", product);
// ::logger::root().error("Validation of surface genus failed for:", product);
// } else {
// logger::notice("Validation of surface genus succeeded for:", product);
// ::logger::root().notice("Validation of surface genus succeeded for:", product);
// }
// }
// }
@@ -645,7 +645,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// }
// }
// } catch (const ifcopenshell::exception& e) {
// logger::error(e);
// ::logger::root().error(e);
// // @todo reset representation_mapped_to to zero?
// }
// return representation_mapped_to;
@@ -669,15 +669,15 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// IfcSchema::IfcRepresentationMap::list::ptr maps = representation->RepresentationMap();
//
// if (products->size() && maps->size()) {
// logger::warning("Representation used by IfcRepresentationMap and IfcProductDefinitionShape", representation);
// ::logger::root().warning("Representation used by IfcRepresentationMap and IfcProductDefinitionShape", representation);
// }
//
// if (prodreps->size() > 1) {
// logger::warning("Multiple IfcProductDefinitionShapes for representation", representation);
// ::logger::root().warning("Multiple IfcProductDefinitionShapes for representation", representation);
// }
//
// if (maps->size() > 1) {
// logger::warning("Multiple IfcRepresentationMaps for representation", representation);
// ::logger::root().warning("Multiple IfcRepresentationMaps for representation", representation);
// }
//
// if (maps->size() == 1) {
@@ -720,7 +720,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// parent_id = parent_object->data().id();
// }
// } catch (const std::exception& e) {
// logger::error(e);
// ::logger::root().error(e);
// }
//
// const std::string name = product->Name().value_or("");
@@ -732,9 +732,9 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// convert(product->ObjectPlacement(), trsf);
// }
// } catch (const std::exception& e) {
// logger::error(e);
// ::logger::root().error(e);
// } catch (...) {
// logger::error("Failed to construct placement");
// ::logger::root().error("Failed to construct placement");
// }
//
// std::string context_string = "";
@@ -936,7 +936,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// // range. It's only a safeguard though, so can probably be approximated.
// const double axis_length = own_axis_start.Distance(own_axis_end);
// if (length_required > axis_length) {
// logger::warning("The wall axis is not long enough to accommodate the fold points");
// ::logger::root().warning("The wall axis is not long enough to accommodate the fold points");
// return false;
// }
//
@@ -956,7 +956,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// gp_Trsf other;
// if (other_wall->ObjectPlacement()) {
// if (!convert(other_wall->ObjectPlacement(), other)) {
// logger::error("Failed to convert placement", other_wall);
// ::logger::root().error("Failed to convert placement", other_wall);
// continue;
// }
// }
@@ -964,7 +964,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// IfcSchema::IfcRepresentation* axis_representation = find_representation(other_wall, "Axis");
//
// if (!axis_representation) {
// logger::warning("Joined wall has no axis representation", other_wall);
// ::logger::root().warning("Joined wall has no axis representation", other_wall);
// continue;
// }
//
@@ -1058,7 +1058,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// Vs1.Cross(Vs2);
//
// if (Vs1.IsNormal(Vc, 1.e-5)) {
// logger::warning("Connected walls are parallel");
// ::logger::root().warning("Connected walls are parallel");
// parallel = true;
// } else if (w < axis_u1 || w > axis_u2) {
// point_outside_param_range = p;
@@ -1287,7 +1287,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
//
// #define Kernel POSTFIX_SCHEMA(Kernel)
//
// std::shared_ptr<const IfcGeom::SurfaceStyle> IfcGeom::Kernel::internalize_surface_style(const std::pair<ifcopenshell::IfcBaseClass*, ifcopenshell::IfcBaseClass*>& shading_styles) {
// std::shared_ptr<const IfcGeom::SurfaceStyle> IfcGeom::Kernel::internalize_surface_style(const std::pair<express::Base, express::Base>& shading_styles) {
// if (shading_styles.second == 0) {
// return 0;
// }
@@ -1393,7 +1393,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// Handle_Geom_Circle axis_line = Handle_Geom_Circle::DownCast(axis_curve);
// reference_surface = new Geom_CylindricalSurface(axis_li->Position(), axis_line->Radius());
// } else {
// logger::message(logger::LOG_ERROR, "Unsupported underlying curve of Axis representation:", product);
// ::logger::root().message(::logger::LOG_ERROR, "Unsupported underlying curve of Axis representation:", product);
// return false;
// }
//
@@ -110,13 +110,13 @@ private:
double precision_;
public:
OpenCascadeKernel(const ifcopenshell::geometry::Settings& settings, Logger& logger = Logger::Root())
OpenCascadeKernel(const ifcopenshell::geometry::Settings& settings, ::logger& logger = ::logger::root())
: AbstractKernel("opencascade", settings, logger)
, faceset_helper_(nullptr)
, precision_(settings.get<ifcopenshell::geometry::settings::Precision>().get())
{}
virtual AbstractKernel* clone(Logger& logger) const {
virtual AbstractKernel* clone(::logger& logger) const {
return new OpenCascadeKernel(settings(), logger);
}
+13 -13
View File
@@ -714,12 +714,12 @@ bool IfcGeom::util::create_solid_from_faces(const NCollection_List<TopoDS_Shape>
valid_shell &= util::count(shape, TopAbs_SHELL) > 0;
} catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Root().Error("GEO", 106, e.GetMessageString());
::logger::root().error("GEO", 106, e.GetMessageString());
} else {
Logger::Root().Error("GEO", 107, "Unknown error sewing shell");
::logger::root().error("GEO", 107, "Unknown error sewing shell");
}
} catch (...) {
Logger::Root().Error("GEO", 108, "Unknown error sewing shell");
::logger::root().error("GEO", 108, "Unknown error sewing shell");
}
if (valid_shell) {
@@ -747,22 +747,22 @@ bool IfcGeom::util::create_solid_from_faces(const NCollection_List<TopoDS_Shape>
}
} catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Root().Error("GEO", 109, e.GetMessageString());
::logger::root().error("GEO", 109, e.GetMessageString());
} else {
Logger::Root().Error("GEO", 110, "Unknown error classifying solid");
::logger::root().error("GEO", 110, "Unknown error classifying solid");
}
} catch (...) {
Logger::Root().Error("GEO", 111, "Unknown error classifying solid");
::logger::root().error("GEO", 111, "Unknown error classifying solid");
}
}
} catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Root().Error("GEO", 112, e.GetMessageString());
::logger::root().error("GEO", 112, e.GetMessageString());
} else {
Logger::Root().Error("GEO", 113, "Unknown error creating solid");
::logger::root().error("GEO", 113, "Unknown error creating solid");
}
} catch (...) {
Logger::Root().Error("GEO", 114, "Unknown error creating solid");
::logger::root().error("GEO", 114, "Unknown error creating solid");
}
if (complete_shape.IsNull()) {
@@ -774,7 +774,7 @@ bool IfcGeom::util::create_solid_from_faces(const NCollection_List<TopoDS_Shape>
B.MakeCompound(C);
B.Add(C, complete_shape);
complete_shape = C;
Logger::Root().Warning("GEO", 115, "Multiple components in IfcConnectedFaceSet");
::logger::root().warning("GEO", 115, "Multiple components in IfcConnectedFaceSet");
}
B.Add(complete_shape, result_shape);
}
@@ -789,7 +789,7 @@ bool IfcGeom::util::create_solid_from_faces(const NCollection_List<TopoDS_Shape>
B.MakeCompound(C);
B.Add(C, complete_shape);
complete_shape = C;
Logger::Root().Warning("GEO", 116, "Loose faces in IfcConnectedFaceSet");
::logger::root().warning("GEO", 116, "Loose faces in IfcConnectedFaceSet");
}
B.Add(complete_shape, loose_faces.Current());
}
@@ -797,7 +797,7 @@ bool IfcGeom::util::create_solid_from_faces(const NCollection_List<TopoDS_Shape>
shape = complete_shape;
} else {
Logger::Root().Error("GEO", 117, "Failed to sew faceset");
::logger::root().error("GEO", 117, "Failed to sew faceset");
}
return valid_shell;
@@ -901,7 +901,7 @@ bool IfcGeom::util::validate_shape(const TopoDS_Shape& s) {
dump(s);
Logger::Root().Warning("GEO", 118, str.str());
::logger::root().warning("GEO", 118, str.str());
return false;
}
@@ -118,14 +118,14 @@ bool OpenCascadeKernel::convert_impl(const taxonomy::boolean_result::ptr br, Con
const double first_operand_volume = util::shape_volume(a);
if (first_operand_volume <= ALMOST_ZERO) {
Logger::Root().Message(Logger::LOG_WARNING, "GEO", 119, "Empty solid for:", c->instance);
::logger::root().message(::logger::LOG_WARNING, "GEO", 119, "Empty solid for:", c->instance);
}
} else {
for (auto& r : cr) {
auto S = std::static_pointer_cast<OpenCascadeShape>(r.Shape())->shape();
if (S.IsNull()) {
Logger::Root().Error("GEO", 120, "Null operand");
::logger::root().error("GEO", 120, "Null operand");
continue;
}
gp_GTrsf trsf;
@@ -140,7 +140,7 @@ bool OpenCascadeKernel::convert_impl(const taxonomy::boolean_result::ptr br, Con
// #2665 we also set a precision-independent threshold, because in the boolean op routine
// the working fuzziness might still be increased.
if (d < tol * 20. || d < 0.00002) {
Logger::Root().Message(Logger::LOG_WARNING, "GEO", 121, "Halfspace subtraction yields unchanged volume:", c->instance);
::logger::root().message(::logger::LOG_WARNING, "GEO", 121, "Halfspace subtraction yields unchanged volume:", c->instance);
continue;
} else {
S = result;
@@ -418,7 +418,7 @@ int IfcGeom::util::eliminate_narrow_operands(double prec, const NCollection_List
bool is_narrow = min_dimension < prec;
Logger::Root().Notice("GEO", 122, "Min OBB dimension of operand = " + std::to_string(min_dimension));
::logger::root().notice("GEO", 122, "Min OBB dimension of operand = " + std::to_string(min_dimension));
if (!is_narrow) {
c.Append(it.Value());
@@ -703,7 +703,7 @@ bool IfcGeom::util::boolean_subtraction_2d_using_builder(const TopoDS_Shape & a_
if (u11 < U1 && U1 < u12 && u21 < U2 && U2 < u22) {
// Edge curves belonging to different operands intersect, don't process
// using builder.
Logger::Root().Notice("GEO", 123, "Intersecting boundaries");
::logger::root().notice("GEO", 123, "Intersecting boundaries");
return false;
}
}
@@ -750,7 +750,7 @@ bool IfcGeom::util::boolean_subtraction_2d_using_builder(const TopoDS_Shape & a_
// any effect and marked as redundant. Feeding it to the builder algo
// will likely cause problems.
redundant[std::distance(wires.begin(), it)] = true;
Logger::Root().Notice("GEO", 124, "Subtraction operand outside of outer bound");
::logger::root().notice("GEO", 124, "Subtraction operand outside of outer bound");
}
}
@@ -790,7 +790,7 @@ bool IfcGeom::util::boolean_subtraction_2d_using_builder(const TopoDS_Shape & a_
if (wire_clss[wire_index]->Perform(p2d) == TopAbs_IN) {
// A wire is contained within another operand
redundant[other_index] = true;
Logger::Root().Notice("GEO", 125, "Subtraction operand contained in other");
::logger::root().notice("GEO", 125, "Subtraction operand contained in other");
}
}
}
@@ -848,7 +848,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
std::stringstream ss;
ss << "bool-" << std::this_thread::get_id() << "-" << (operation_counter_++);
debug_identifier = ss.str();
Logger::Root().Notice("GEO", 126, "Boolean debug identifier: " + debug_identifier);
::logger::root().notice("GEO", 126, "Boolean debug identifier: " + debug_identifier);
}
if (fuzziness < 0.) {
@@ -884,8 +884,8 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
a = unify(a_input, fuzziness * 1000.);
Logger::Root().Message(
Logger::LOG_DEBUG, "GEO", 127,
::logger::root().message(
::logger::LOG_DEBUG, "GEO", 127,
"Simplified operand A from "s +
std::to_string(count(a_input, TopAbs_FACE)) +
" to "s +
@@ -896,8 +896,8 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
NCollection_List<TopoDS_Shape>::Iterator it(b_input);
for (; it.More(); it.Next()) {
b.Append(unify(it.Value(), fuzziness));
Logger::Root().Message(
Logger::LOG_DEBUG, "GEO", 128,
::logger::root().message(
::logger::LOG_DEBUG, "GEO", 128,
"Simplified operand B from "s +
std::to_string(count(it.Value(), TopAbs_FACE)) +
" to "s +
@@ -924,7 +924,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
auto N = bounding_box_overlap(fuzziness, a, b, b_tmp);
if (N) {
Logger::Root().Notice("GEO", 129, "Eliminated " + std::to_string(N) + " disjoint operands");
::logger::root().notice("GEO", 129, "Eliminated " + std::to_string(N) + " disjoint operands");
std::swap(b, b_tmp);
}
}
@@ -935,7 +935,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
b_tmp.Clear();
auto N = eliminate_touching_operands(fuzziness, a, b, b_tmp);
if (N) {
Logger::Root().Notice("GEO", 130, "Eliminated " + std::to_string(N) + " touching operands");
::logger::root().notice("GEO", 130, "Eliminated " + std::to_string(N) + " touching operands");
std::swap(b, b_tmp);
}
}
@@ -946,7 +946,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
b_tmp.Clear();
auto N = eliminate_narrow_operands(fuzziness, b, b_tmp);
if (N) {
Logger::Root().Notice("GEO", 131, "Eliminated " + std::to_string(N) + " narrow operands");
::logger::root().notice("GEO", 131, "Eliminated " + std::to_string(N) + " narrow operands");
std::swap(b, b_tmp);
}
}
@@ -960,21 +960,21 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
}
if (b.Extent() == 0) {
Logger::Root().Warning("GEO", 132, "No other operands remaining, using first operand");
::logger::root().warning("GEO", 132, "No other operands remaining, using first operand");
result = a;
return true;
}
if (!is_2d && Logger::LOG_NOTICE >= Logger::Root().Verbosity()) {
if (!is_2d && ::logger::LOG_NOTICE >= ::logger::root().verbosity()) {
PERF("preliminary manifoldness check");
if (!a.IsNull()) {
Logger::Root().Notice("GEO", 133, "Operand A is " + (is_manifold(a) ? ""s : "non-"s) + "manifold");
::logger::root().notice("GEO", 133, "Operand A is " + (is_manifold(a) ? ""s : "non-"s) + "manifold");
}
NCollection_List<TopoDS_Shape>::Iterator it(b);
for (int i = 0; it.More(); it.Next(), ++i) {
Logger::Root().Notice("GEO", 134, "Operand B " + std::to_string(i) + " is " + (is_manifold(it.Value()) ? ""s : "non-"s) + "manifold");
::logger::root().notice("GEO", 134, "Operand B " + std::to_string(i) + " is " + (is_manifold(it.Value()) ? ""s : "non-"s) + "manifold");
}
}
@@ -1014,7 +1014,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
const double fuzz = (std::min)(min_length_orig / 3., fuzziness);
Logger::Root().Notice("GEO", 135, "Used fuzziness: " + std::to_string(fuzz));
::logger::root().notice("GEO", 135, "Used fuzziness: " + std::to_string(fuzz));
const double new_fuzziness = fuzziness * 10.;
const bool allow_retry = new_fuzziness - 1e-15 <= settings.precision * 10000. && new_fuzziness < min_length_orig;
@@ -1048,7 +1048,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
}
if (is_extrusion_a) {
Logger::Root().Notice("GEO", 136, "Operand A 1/1 is an extrusion");
::logger::root().notice("GEO", 136, "Operand A 1/1 is an extrusion");
NCollection_List<TopoDS_Shape>::Iterator it(b);
for (int nb = 1; it.More(); it.Next(), ++nb) {
@@ -1064,10 +1064,10 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
}
if (is_extrusion_b) {
Logger::Root().Notice("GEO", 137, "Operand B " + std::to_string(nb) + "/" + std::to_string(b.Extent()) + " is an extrusion");
::logger::root().notice("GEO", 137, "Operand B " + std::to_string(nb) + "/" + std::to_string(b.Extent()) + " is an extrusion");
if (b_interval.first < a_interval.first + (fuzz * 100.) && b_interval.second > a_interval.second - (fuzz * 100.)) {
Logger::Root().Notice("GEO", 138, "Operand B creates a through hole");
::logger::root().notice("GEO", 138, "Operand B creates a through hole");
// Align b with a operand
gp_Trsf trsf;
@@ -1107,23 +1107,23 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
BRepPrimAPI_MakePrism mp(face_result, gp_Vec(gp::DY()) * (a_interval.second - a_interval.first));
if (mp.IsDone()) {
if (b_remainder_3d.Extent()) {
Logger::Root().Notice("GEO", 139, std::to_string(b_remainder_3d.Extent()) + " operands remaining to process in 3D");
::logger::root().notice("GEO", 139, std::to_string(b_remainder_3d.Extent()) + " operands remaining to process in 3D");
b = b_remainder_3d;
s1s.Clear();
s1s.Append(mp.Shape());
} else {
Logger::Root().Notice("GEO", 140, "Processed fully in 2D");
::logger::root().notice("GEO", 140, "Processed fully in 2D");
result = mp.Shape();
return true;
}
} else {
Logger::Root().Notice("GEO", 141, "Failed to extrude 2D boolean result. Retrying in 3D.");
::logger::root().notice("GEO", 141, "Failed to extrude 2D boolean result. Retrying in 3D.");
}
} else {
Logger::Root().Notice("GEO", 142, "Failed to perform 2D boolean operation. Retrying in 3D.");
::logger::root().notice("GEO", 142, "Failed to perform 2D boolean operation. Retrying in 3D.");
}
} else {
Logger::Root().Notice("GEO", 143, "No second operands can be processed as 2D inner bounds. Retrying in 3D.");
::logger::root().notice("GEO", 143, "No second operands can be processed as 2D inner bounds. Retrying in 3D.");
}
}
}
@@ -1145,7 +1145,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
}
if (builder->IsDone()) {
if (false && builder->DSFiller()->HasWarning(STANDARD_TYPE(BOPAlgo_AlertAcquiredSelfIntersection))) {
Logger::Root().Notice("GEO", 144, "Builder reports self-intersection in output");
::logger::root().notice("GEO", 144, "Builder reports self-intersection in output");
success = false;
/*
@@ -1159,7 +1159,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
}
*/
} else if(builder->DSFiller()->HasWarning(STANDARD_TYPE(BOPAlgo_AlertBadPositioning)) && !TopoDS_Iterator(*builder).More()) {
Logger::Root().Notice("GEO", 145, "Builder reports bad positioning and result is empty");
::logger::root().notice("GEO", 145, "Builder reports bad positioning and result is empty");
success = false;
} else {
TopoDS_Shape r = *builder;
@@ -1173,7 +1173,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
fix.Perform();
r = fix.Shape();
} catch (...) {
Logger::Root().Error("GEO", 146, "Shape healing failed on boolean result");
::logger::root().error("GEO", 146, "Shape healing failed on boolean result");
}
}
@@ -1184,7 +1184,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
success = ana.IsValid() != 0;
if (!success) {
Logger::Root().Notice("GEO", 147, "Boolean operation yields invalid result");
::logger::root().notice("GEO", 147, "Boolean operation yields invalid result");
std::stringstream str;
bool any_emitted = false;
@@ -1214,7 +1214,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
dump(r);
Logger::Root().Notice("GEO", 148, str.str());
::logger::root().notice("GEO", 148, str.str());
}
}
@@ -1334,7 +1334,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
if (op == BOPAlgo_CUT && has_open_shells && all_faces_included_in_result && result_n_faces > first_op_n_faces) {
success = false;
Logger::Root().Notice("GEO", 149, "Boolean result discarded because subtractions results in only the addition of faces");
::logger::root().notice("GEO", 149, "Boolean result discarded because subtractions results in only the addition of faces");
} else {
// when there are edges or vertex-edge distances close to the used fuzziness, the
// output is not trusted and the operation is attempted with a higher fuzziness.
@@ -1380,7 +1380,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
static const char* const reason_strings[] = { "edge length", "vertex-edge", "face-face" };
std::stringstream str;
str << "Boolean operation result failing " << reason_strings[reason] << " interference check, with fuzziness " << fuzziness << " with length " << v;
Logger::Root().Notice("GEO", 150, str.str());
::logger::root().notice("GEO", 150, str.str());
}
}
@@ -1389,7 +1389,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
}
} else {
Logger::Root().Notice("GEO", 151, "Boolean operation yields non-manifold result");
::logger::root().notice("GEO", 151, "Boolean operation yields non-manifold result");
}
}
}
@@ -1399,7 +1399,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
#if OCC_VERSION_HEX >= 0x70200
if (builder->HasError(STANDARD_TYPE(BOPAlgo_AlertBOPNotAllowed))) {
Logger::Root().Error("GEO", 152, "Invalid operands. Using first operand");
::logger::root().error("GEO", 152, "Invalid operands. Using first operand");
result = a;
success = true;
}
@@ -1412,14 +1412,14 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
#endif
std::string str_str = str.str();
if (str_str.size()) {
Logger::Root().Notice("GEO", 153, str_str);
::logger::root().notice("GEO", 153, str_str);
}
}
if (!success) {
if (allow_retry) {
return boolean_operation(settings, a, b, op, result, new_fuzziness);
} else {
Logger::Root().Notice("GEO", 154, "No longer attempting boolean operation with higher fuzziness");
::logger::root().notice("GEO", 154, "No longer attempting boolean operation with higher fuzziness");
}
}
return success && !result.IsNull();
@@ -10,7 +10,7 @@ bool OpenCascadeKernel::convert(const taxonomy::extrusion::ptr extrusion, TopoDS
const double& height = extrusion->depth;
if (height < settings_.get<settings::Precision>().get()) {
Logger::Root().Error("GEO", 89, "Non-positive extrusion height encountered for:", extrusion->instance);
::logger::root().error("GEO", 89, "Non-positive extrusion height encountered for:", extrusion->instance);
return false;
}
@@ -24,7 +24,7 @@ bool OpenCascadeKernel::convert(const taxonomy::extrusion::ptr extrusion, TopoDS
// move the TopoDS_Shape, but obviously not both.
gp_GTrsf gtrsf;
if (!convert(&extrusion->matrix, gtrsf)) {
logger::error("Unable to move extrusion");
::logger::root().error("Unable to move extrusion");
}
auto trsf = gtrsf.Trsf();
*/
+15 -15
View File
@@ -174,8 +174,8 @@ namespace {
} else if (crv_or_wire.index() == 2) {
// @todo
const double precision_ = 1.e-5;
Logger::Root().Warning("GEO", 156, "Approximating BasisCurve due to possible discontinuities", i->instance);
const auto& w = boost::get<TopoDS_Wire>(crv_or_wire);
::logger::root().warning("GEO", 156, "Approximating BasisCurve due to possible discontinuities", i->instance);
const auto& w = std::get<TopoDS_Wire>(crv_or_wire);
#if OCC_VERSION_HEX < 0x70600
BRepAdaptor_CompCurve cc(w, true);
Handle(Adaptor3d_HCurve) hcc = Handle(Adaptor3d_HCurve)(new BRepAdaptor_HCompCurve(cc));
@@ -294,12 +294,12 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
// the face will still be processed as long as there are no holes. A compound of faces
// is returned in that case.
if (num_bounds > 1 && num_outer_bounds > 1 && num_bounds != num_outer_bounds) {
Logger::Root().Message(Logger::LOG_ERROR, "GEO", 157, "Invalid configuration of boundaries for:", face->instance);
::logger::root().message(::logger::LOG_ERROR, "GEO", 157, "Invalid configuration of boundaries for:", face->instance);
return false;
}
if (num_outer_bounds > 1) {
Logger::Root().Message(Logger::LOG_WARNING, "GEO", 158, "Multiple outer boundaries for:", face->instance);
::logger::root().message(::logger::LOG_WARNING, "GEO", 158, "Multiple outer boundaries for:", face->instance);
fd.all_outer() = true;
}
@@ -320,11 +320,11 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
TopoDS_Wire wire;
if (faceset_helper_ && bound->is_polyhedron()) {
if (!faceset_helper_->wire(bound, wire)) {
Logger::Root().Message(Logger::LOG_WARNING, "GEO", 159, "Face boundary loop not included", bound->instance);
::logger::root().message(::logger::LOG_WARNING, "GEO", 159, "Face boundary loop not included", bound->instance);
continue;
}
} else if (!convert(bound, wire)) {
Logger::Root().Message(Logger::LOG_ERROR, "GEO", 160, "Failed to process face boundary loop", bound->instance);
::logger::root().message(::logger::LOG_ERROR, "GEO", 160, "Failed to process face boundary loop", bound->instance);
return false;
}
@@ -341,7 +341,7 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
};
NCollection_List<TopoDS_Shape> results;
if (settings.use_wire_intersection_check && util::wire_intersections(wire, results, settings)) {
Logger::Root().Warning("GEO", 161, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
::logger::root().warning("GEO", 161, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
util::select_largest(results, wire);
}
@@ -352,7 +352,7 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
}
if (fd.wires().empty()) {
Logger::Root().Warning("GEO", 162, "Face with no boundaries", face->instance);
::logger::root().warning("GEO", 162, "Face with no boundaries", face->instance);
return false;
}
@@ -409,7 +409,7 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
if (fd.surface().IsNull()) {
// The set of wires is triangulated in case no surface can be found
Logger::Root().Message(Logger::LOG_WARNING, "GEO", 163, "Triangulating face boundaries for face", face->instance);
::logger::root().message(::logger::LOG_WARNING, "GEO", 163, "Triangulating face boundaries for face", face->instance);
if (fd.all_outer()) {
for (const auto& w : fd.wires()) {
@@ -462,7 +462,7 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
kt.Value().Original().ToUTF8CString(c);
std::string message = c;
delete[] c;
Logger::Root().Warning("GEO", 164, message, face->instance);
::logger::root().warning("GEO", 164, message, face->instance);
}
}
@@ -474,17 +474,17 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
if (it.Value().ShapeType() == TopAbs_FACE) {
face_list.Append(it.Value());
} else {
Logger::Root().Error("UNS", 7, "Unsupported output from face healing");
::logger::root().error("UNS", 7, "Unsupported output from face healing");
}
}
} else {
Logger::Root().Error("UNS", 8, "Unsupported output from face healing");
::logger::root().error("UNS", 8, "Unsupported output from face healing");
}
} else {
face_list.Append(f);
}
} else {
Logger::Root().Error("GEO", 165, "Internal error in face creation");
::logger::root().error("GEO", 165, "Internal error in face creation");
return false;
}
} else {
@@ -525,14 +525,14 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
delete[] c;
#if OCC_VERSION_MAJOR==7 && OCC_VERSION_MINOR >= 7
if (!reversed_surface && !fd.surface().IsNull() && fd.surface()->IsUPeriodic() && message == "Unknown message invoked with the keyword FixAdvFace.FixOrientation.MSG0") {
Logger::Root().Notice("GEO", 166, "Detected reversed wire, reattempting with reversed basis surface");
::logger::root().notice("GEO", 166, "Detected reversed wire, reattempting with reversed basis surface");
TopoDS_Face reversed_result;
convert(face, reversed_result, true);
result = reversed_result;
return true;
} else
#endif
Logger::Root().Warning("GEO", 167, message, face->instance);
::logger::root().warning("GEO", 167, message, face->instance);
}
}
}
@@ -149,7 +149,7 @@ IfcGeom::OpenCascadeKernel::faceset_helper::faceset_helper(
auto num_retained = std::count(retained.begin(), retained.end(), true);
if (unique.size() != num_retained) {
Logger::Root().Notice("GEO", 168, "Collapsed vertices from " + std::to_string(pnts.size()) + " (" + std::to_string(unique.size()) + " unique) to " + std::to_string(num_retained));
::logger::root().notice("GEO", 168, "Collapsed vertices from " + std::to_string(pnts.size()) + " (" + std::to_string(unique.size()) + " unique) to " + std::to_string(num_retained));
}
typedef std::array<int, 2> edge_t;
@@ -171,12 +171,13 @@ IfcGeom::OpenCascadeKernel::faceset_helper::faceset_helper(
segments.push_back(std::make_pair(C, D));
});
if (edge_sets.find({loop->external.get_value_or(false), segment_set}) != edge_sets.end()) {
const auto edge_set_key = std::make_pair(loop->external.value_or(false), segment_set);
if (edge_sets.find(edge_set_key) != edge_sets.end()) {
duplicate_faces++;
duplicates_.insert(loop->identity());
continue;
}
edge_sets.insert({loop->external.get_value_or(false), segment_set});
edge_sets.insert(edge_set_key);
if (segments.size() >= 3) {
for (auto& p : segments) {
@@ -204,8 +205,8 @@ IfcGeom::OpenCascadeKernel::faceset_helper::faceset_helper(
}
}
if (duplicates_.size() || loops_removed || (non_manifold && shell->closed.get_value_or(false))) {
Logger::Root().Warning("GEO", 169, boost::lexical_cast<std::string>(duplicate_faces) + " duplicate faces removed, " + boost::lexical_cast<std::string>(loops_removed) + " degenerate loops eliminated and " + boost::lexical_cast<std::string>(non_manifold) + " non-manifold edges");
if (duplicates_.size() || loops_removed || (non_manifold && shell->closed.value_or(false))) {
::logger::root().warning("GEO", 169, boost::lexical_cast<std::string>(duplicate_faces) + " duplicate faces removed, " + boost::lexical_cast<std::string>(loops_removed) + " degenerate loops eliminated and " + boost::lexical_cast<std::string>(non_manifold) + " non-manifold edges");
}
}
@@ -276,7 +277,7 @@ bool IfcGeom::OpenCascadeKernel::faceset_helper::wires(const ifcopenshell::geome
!kernel_->settings().get<ifcopenshell::geometry::settings::NoWireIntersectionTolerance>().get(), 0.,
kernel_->settings().get<ifcopenshell::geometry::settings::Precision>().get()}))
{
Logger::Root().Warning("GEO", 170, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
::logger::root().warning("GEO", 170, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
non_manifold_ = true;
wires = results;
} else {
+6 -6
View File
@@ -132,7 +132,7 @@ namespace {
}
}
Logger::Root().Error("GEO", 171, "Unable to map layer geometry to material index");
::logger::root().error("GEO", 171, "Unable to map layer geometry to material index");
return false;
}
}
@@ -237,7 +237,7 @@ bool IfcGeom::util::apply_folded_layerset(const ConversionResults& items, const
if (s.ShapeType() == TopAbs_SHELL) {
shells.Append(TopoDS::Shell(s));
} else {
Logger::Root().Error("GEO", 172, "Expected shell type in layerset processing");
::logger::root().error("GEO", 172, "Expected shell type in layerset processing");
return false;
}
}
@@ -436,12 +436,12 @@ bool IfcGeom::util::split_solid_by_shell(const TopoDS_Shape& input, const TopoDS
}
} catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Root().Error("GEO", 173, e.GetMessageString());
::logger::root().error("GEO", 173, e.GetMessageString());
} else {
Logger::Root().Error("GEO", 174, "Unknown error performing fixes");
::logger::root().error("GEO", 174, "Unknown error performing fixes");
}
} catch (...) {
Logger::Root().Error("GEO", 175, "Unknown error performing fixes");
::logger::root().error("GEO", 175, "Unknown error performing fixes");
}
BRepCheck_Analyzer analyser(shape);
bool is_valid = analyser.IsValid() != 0;
@@ -451,7 +451,7 @@ bool IfcGeom::util::split_solid_by_shell(const TopoDS_Shape& input, const TopoDS
}
if (is_null[0] || is_null[1]) {
Logger::Root().Message(Logger::LOG_ERROR, "GEO", 176, "Null result obtained from layerset slicing");
::logger::root().message(::logger::LOG_ERROR, "GEO", 176, "Null result obtained from layerset slicing");
if (is_null[0] && is_null[1]) {
return false;
}
+17 -10
View File
@@ -83,12 +83,13 @@ bool OpenCascadeKernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& re
if (non_polygonal) {
if (loft->children.size() < 2) {
Logger::Root().Error("GEO", 177, "Not enough sections to loft");
::logger::root().error("GEO", 177, "Not enough sections to loft");
return false;
}
TopoDS_Shape f0, f1;
std::vector<std::vector<TopoDS_Wire>> sections;
// Convert all children to vectors of wires
for (const auto& child : loft->children) {
@@ -122,13 +123,19 @@ bool OpenCascadeKernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& re
auto first_wire_count = sections.front().size();
for (auto& section : sections) {
if (section.size() != first_wire_count) {
Logger::Root().Error("GEO", 178, "Inconsistent number of wires in sections");
return false;
}
if (f0.ShapeType() != TopAbs_FACE || f1.ShapeType() != TopAbs_FACE) {
::logger::root().error("GEO", 178, "Inconsistent number of wires in sections");
return false;
}
}
if (f0.ShapeType() != TopAbs_FACE || f1.ShapeType() != TopAbs_FACE) {
return false;
}
if (sections.size() == 2) {
TopoDS_Shell comp;
BRep_Builder BB;
BB.MakeShell(comp);
TopExp_Explorer exp1(f0, TopAbs_WIRE);
TopExp_Explorer exp2(f1, TopAbs_WIRE);
for (; exp1.More() && exp2.More(); exp1.Next(), exp2.Next()) {
@@ -153,7 +160,7 @@ bool OpenCascadeKernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& re
return true;
} else {
logger::error("Lofting more than two sections is not supported");
::logger::root().error("Lofting more than two sections is not supported");
return false;
}
}
@@ -269,7 +276,7 @@ bool OpenCascadeKernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& re
*/
if (shps.size() < 2) {
Logger::Root().Error("GEO", 179, "Not enough sections to loft");
::logger::root().error("GEO", 179, "Not enough sections to loft");
return false;
}
@@ -309,11 +316,11 @@ bool OpenCascadeKernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& re
// When processing a sectioned *surface* there are no
// begin and end caps that need to be added.
if (it == shps.begin()) {
// faces.Append(shps[0]);
// faces.append(shps[0]);
BB.Add(comp, shps[0]);
}
if (jt == shps.end() - 1) {
// faces.Append(shps[1]);
// faces.append(shps[1]);
BB.Add(comp, shps[1]);
}
}
@@ -428,7 +435,7 @@ bool OpenCascadeKernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& re
fill.Add(e3, GeomAbs_C0);
fill.Add(e4, GeomAbs_C0);
fill.Build();
// faces.Append(fill.Face());
// faces.append(fill.Face());
BB.Add(comp, fill.Face());
*/
+4 -4
View File
@@ -130,8 +130,8 @@ namespace {
} else {
// @todo
const double precision_ = 1.e-5;
Logger::Root().Warning("GEO", 180, "Approximating BasisCurve due to possible discontinuities", e->instance);
const auto& w = boost::get<TopoDS_Wire>(crv_or_wire);
::logger::root().warning("GEO", 180, "Approximating BasisCurve due to possible discontinuities", e->instance);
const auto& w = std::get<TopoDS_Wire>(crv_or_wire);
#if OCC_VERSION_HEX < 0x70600
BRepAdaptor_CompCurve cc(w, true);
Handle(Adaptor3d_HCurve) hcc = Handle(Adaptor3d_HCurve)(new BRepAdaptor_HCompCurve(cc));
@@ -284,7 +284,7 @@ bool OpenCascadeKernel::convert(const taxonomy::loop::ptr loop, TopoDS_Wire& wir
}
if (converted_segments.Extent() == 0) {
Logger::Root().Message(Logger::LOG_ERROR, "GEO", 181, "No segment successfully converted:", loop->instance);
::logger::root().message(::logger::LOG_ERROR, "GEO", 181, "No segment successfully converted:", loop->instance);
return false;
}
@@ -349,7 +349,7 @@ bool OpenCascadeKernel::convert(const taxonomy::loop::ptr loop, TopoDS_Wire& wir
if (ang < 0.0314) {
edges_to_tesselate.Add(crv1->DynamicType() == STANDARD_TYPE(Geom_Circle) ? edges.First() : edges.Last());
Logger::Root().Notice("GEO", 182, "Sharp circular corner detecting, substituting with linear approximation");
::logger::root().notice("GEO", 182, "Sharp circular corner detecting, substituting with linear approximation");
}
}
}
+7 -7
View File
@@ -46,19 +46,19 @@ bool OpenCascadeKernel::convert(const taxonomy::shell::ptr l, TopoDS_Shape& shap
try {
success = convert(face, occ_face);
} catch (const std::exception& e) {
logger_.Error("GEO", 194, e);
logger_.error("GEO", 194, e);
} catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
logger_.Error("GEO", 195, e.GetMessageString());
logger_.error("GEO", 195, e.GetMessageString());
} else {
logger_.Error("GEO", 196, "Unknown error creating face");
logger_.error("GEO", 196, "Unknown error creating face");
}
} catch (...) {
logger_.Error("GEO", 197, "Unknown error creating face");
logger_.error("GEO", 197, "Unknown error creating face");
}
if (!success) {
logger_.Message(Logger::LOG_WARNING, "GEO", 198, "Failed to convert face:", face->instance);
logger_.message(::logger::LOG_WARNING, "GEO", 198, "Failed to convert face:", face->instance);
continue;
}
@@ -71,7 +71,7 @@ bool OpenCascadeKernel::convert(const taxonomy::shell::ptr l, TopoDS_Shape& shap
if (face_area(triangle) > min_face_area) {
face_list.Append(triangle);
} else {
logger_.Message(Logger::LOG_WARNING, "GEO", 199, "Degenerate face:", face->instance);
logger_.message(::logger::LOG_WARNING, "GEO", 199, "Degenerate face:", face->instance);
}
}
}
@@ -79,7 +79,7 @@ bool OpenCascadeKernel::convert(const taxonomy::shell::ptr l, TopoDS_Shape& shap
if (face_area(occ_face) > min_face_area) {
face_list.Append(occ_face);
} else {
logger_.Message(Logger::LOG_WARNING, "GEO", 200, "Degenerate face:", face->instance);
logger_.message(::logger::LOG_WARNING, "GEO", 200, "Degenerate face:", face->instance);
}
}
}
+1 -1
View File
@@ -92,7 +92,7 @@ bool OpenCascadeKernel::convert(const taxonomy::solid::ptr solid, TopoDS_Shape&
throw std::runtime_error("Unexpected configuration of subshapes");
}
} else {
logger_.Warning("GEO", 201, "Ignored shell", s->instance);
logger_.warning("GEO", 201, "Ignored shell", s->instance);
}
}
if (!S.IsNull()) {
@@ -129,8 +129,8 @@ bool OpenCascadeKernel::convert(const taxonomy::sweep_along_curve::ptr scs, Topo
}
auto w = convert_curve(scs->curve);
if (w.which() != 2) {
logger_.Error("UNS", 9, "Unsupported directrix");
if (w.index() != 2) {
logger_.error("UNS", 9, "Unsupported directrix");
return false;
}
TopoDS_Shape face_;
@@ -178,7 +178,7 @@ bool OpenCascadeKernel::convert(const taxonomy::sweep_along_curve::ptr scs, Topo
for (TopExp_Explorer exp(wire, TopAbs_VERTEX); exp.More(); exp.Next()) {
if (pln.Distance(BRep_Tool::Pnt(TopoDS::Vertex(exp.Current()))) > ALMOST_ZERO) {
directrix_on_plane = false;
logger_.Message(Logger::LOG_WARNING, "GEO", 202, "The Directrix does not lie on the ReferenceSurface", scs->instance);
logger_.message(::logger::LOG_WARNING, "GEO", 202, "The Directrix does not lie on the ReferenceSurface", scs->instance);
break;
}
}
@@ -97,7 +97,7 @@ bool IfcGeom::util::wire_to_ax(const TopoDS_Wire & wire, gp_Ax2 & directrix) {
Handle(Geom_Curve) crv = BRep_Tool::Curve(edge, u0, u1);
crv->D1(u0, directrix_origin, directrix_tangent);
} else {
Logger::Root().Error("GEO", 203, "Unable to locate first edge");
::logger::root().error("GEO", 203, "Unable to locate first edge");
return false;
}
@@ -187,7 +187,7 @@ void IfcGeom::util::sort_edges(const TopoDS_Wire & wire, std::vector<TopoDS_Edge
for (int i = 1; i <= map.Extent(); ++i) {
if (map.FindFromIndex(i).Extent() > 2) {
Logger::Root().Warning("GEO", 204, "Self-intersecting Directrix");
::logger::root().warning("GEO", 204, "Self-intersecting Directrix");
}
}
@@ -117,12 +117,12 @@ bool IfcGeom::util::create_edge_over_curve_with_log_messages(const opencascade::
}
}
if (dmin == std::numeric_limits<double>::infinity()) {
Logger::Root().Error("GEO", 205, "No extrema for point");
::logger::root().error("GEO", 205, "No extrema for point");
} else if (dmin > eps2) {
Logger::Root().Error("GEO", 206, "Distance of " + boost::lexical_cast<std::string>(std::sqrt(dmin)) + " exceeds tolerance");
::logger::root().error("GEO", 206, "Distance of " + boost::lexical_cast<std::string>(std::sqrt(dmin)) + " exceeds tolerance");
}
} else {
Logger::Root().Error("GEO", 207, "Failed to calculate extrema for point");
::logger::root().error("GEO", 207, "Failed to calculate extrema for point");
}
}
}
@@ -172,7 +172,7 @@ void IfcGeom::util::wire_builder::operator()(const TopoDS_Shape& a, const TopoDS
if (dist > 1000. * p_) {
mw_.Add(w1);
mw_.Add(BRepBuilderAPI_MakeEdge(p1, p2));
Logger::Root().Warning("GEO", 208, "Added additional segment to close gap with length " + boost::lexical_cast<std::string>(dist) + " to:", inst_);
::logger::root().warning("GEO", 208, "Added additional segment to close gap with length " + boost::lexical_cast<std::string>(dist) + " to:", inst_);
goto check;
}
@@ -200,28 +200,28 @@ void IfcGeom::util::wire_builder::operator()(const TopoDS_Shape& a, const TopoDS
// Preferably adjust the segment that is linear
if (is_line1 || (is_circle1 && !is_line2)) {
mw_.Add(adjust(w1, w12, p2));
Logger::Root().Notice("GEO", 209, "Adjusted edge end-point with distance " + boost::lexical_cast<std::string>(dist) + " on:", inst_);
::logger::root().notice("GEO", 209, "Adjusted edge end-point with distance " + boost::lexical_cast<std::string>(dist) + " on:", inst_);
} else if ((is_line2 || is_circle2) && !last) {
mw_.Add(w1);
override_next_ = true;
next_override_ = p1;
Logger::Root().Notice("GEO", 210, "Adjusted edge end-point with distance " + boost::lexical_cast<std::string>(dist) + " on:", inst_);
::logger::root().notice("GEO", 210, "Adjusted edge end-point with distance " + boost::lexical_cast<std::string>(dist) + " on:", inst_);
} else {
// In all other cases an edge is added
mw_.Add(w1);
mw_.Add(BRepBuilderAPI_MakeEdge(p1, p2));
Logger::Root().Warning("GEO", 211, "Added additional segment to close gap with length " + boost::lexical_cast<std::string>(dist) + " to:", inst_);
::logger::root().warning("GEO", 211, "Added additional segment to close gap with length " + boost::lexical_cast<std::string>(dist) + " to:", inst_);
}
} else {
Logger::Root().Error("GEO", 212, "Internal error, inconsistent wire segments", inst_);
::logger::root().error("GEO", 212, "Internal error, inconsistent wire segments", inst_);
mw_.Add(w1);
}
}
check:
if (mw_.Error() == BRepBuilderAPI_NonManifoldWire) {
Logger::Root().Error("GEO", 213, "Non-manifold curve segments:", inst_);
::logger::root().error("GEO", 213, "Non-manifold curve segments:", inst_);
} else if (mw_.Error() == BRepBuilderAPI_DisconnectedWire) {
Logger::Root().Error("GEO", 214, "Failed to join curve segments:", inst_);
::logger::root().error("GEO", 214, "Failed to join curve segments:", inst_);
}
}
+17 -17
View File
@@ -90,7 +90,7 @@ bool IfcGeom::util::approximate_plane_through_wire(const TopoDS_Wire& wire, gp_P
// obtaining a 2d points for the Delaunay, infinity is passed here, so this
// can't for assessing degenerativeness.
if (v.Magnitude() < 1.e-7) {
Logger::Root().Warning("GEO", 215, "Degenerate face boundary in normal estimation");
::logger::root().warning("GEO", 215, "Degenerate face boundary in normal estimation");
return false;
}
@@ -237,7 +237,7 @@ IfcGeom::util::triangulate_wire_result IfcGeom::util::triangulate_wire(const std
auto it = mapping.find(uvnodes[k]);
if (it == mapping.end()) {
Logger::Root().Error("GEO", 216, "Internal error: unable to unproject uv-mesh");
::logger::root().error("GEO", 216, "Internal error: unable to unproject uv-mesh");
return TRIANGULATE_WIRE_FAIL;
}
@@ -281,7 +281,7 @@ IfcGeom::util::triangulate_wire_result IfcGeom::util::triangulate_wire(const std
}
faces.Append(triangle_face);
} else {
Logger::Root().Error("GEO", 217, "Internal error: missing face");
::logger::root().error("GEO", 217, "Internal error: missing face");
return TRIANGULATE_WIRE_FAIL;
}
}
@@ -312,7 +312,7 @@ IfcGeom::util::triangulate_wire_result IfcGeom::util::triangulate_wire(const std
if (!contains) {
#endif
// All existing edges need to exist in the new faces
Logger::Root().Error("GEO", 218, "Internal error, missing edge from triangulation");
::logger::root().error("GEO", 218, "Internal error, missing edge from triangulation");
non_manifold = true;
}
}
@@ -323,7 +323,7 @@ IfcGeom::util::triangulate_wire_result IfcGeom::util::triangulate_wire(const std
// Existing edges are boundaries with use 1
// New edges are internal with use 2
if (n != (mape.Contains(v) ? 1 : 2)) {
Logger::Root().Error("GEO", 219, "Internal error, non-manifold result from triangulation");
::logger::root().error("GEO", 219, "Internal error, non-manifold result from triangulation");
non_manifold = true;
}
}
@@ -794,12 +794,12 @@ bool IfcGeom::util::fill_nonmanifold_wires_with_planar_faces(TopoDS_Shape& shape
shape = solid.SolidFromShell(TopoDS::Shell(shape));
} catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Root().Error("GEO", 220, e.GetMessageString());
::logger::root().error("GEO", 220, e.GetMessageString());
} else {
Logger::Root().Error("GEO", 221, "Unknown error creating solid");
::logger::root().error("GEO", 221, "Unknown error creating solid");
}
} catch (...) {
Logger::Root().Error("GEO", 222, "Unknown error creating solid");
::logger::root().error("GEO", 222, "Unknown error creating solid");
}
return true;
@@ -812,12 +812,12 @@ bool IfcGeom::util::convert_curve_to_wire(const opencascade::handle<Geom_Curve>&
return true;
} catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Root().Error("GEO", 223, e.GetMessageString());
::logger::root().error("GEO", 223, e.GetMessageString());
} else {
Logger::Root().Error("GEO", 224, "Unknown error converting curve to wire");
::logger::root().error("GEO", 224, "Unknown error converting curve to wire");
}
} catch (...) {
Logger::Root().Error("GEO", 225, "Unknown error converting curve to wire");
::logger::root().error("GEO", 225, "Unknown error converting curve to wire");
}
return false;
}
@@ -838,7 +838,7 @@ void IfcGeom::util::assert_closed_wire(TopoDS_Wire& wire, double tol) {
wire = mw.Wire();
}
Logger::Root().Warning("GEO", 226, "Wire not closed");
::logger::root().warning("GEO", 226, "Wire not closed");
}
}
@@ -848,7 +848,7 @@ bool IfcGeom::util::convert_wire_to_face(const TopoDS_Wire& w, TopoDS_Face& face
NCollection_List<TopoDS_Shape> results;
if (settings.use_wire_intersection_check && util::wire_intersections(wire, results, settings)) {
Logger::Root().Warning("GEO", 227, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
::logger::root().warning("GEO", 227, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
util::select_largest(results, wire);
}
@@ -879,7 +879,7 @@ bool IfcGeom::util::convert_wire_to_face(const TopoDS_Wire& w, TopoDS_Face& face
BRepBuilderAPI_FaceError er = mf.Error();
if (er != BRepBuilderAPI_FaceDone) {
Logger::Root().Error("GEO", 228, "Failed to create face.");
::logger::root().error("GEO", 228, "Failed to create face.");
return false;
}
face = mf.Face();
@@ -906,7 +906,7 @@ bool IfcGeom::util::convert_wire_to_faces(const TopoDS_Wire& w, TopoDS_Compound&
NCollection_List<TopoDS_Shape> results;
if (settings.use_wire_intersection_check && util::wire_intersections(w, results, settings)) {
Logger::Root().Warning("GEO", 229, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
::logger::root().warning("GEO", 229, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
} else {
results.Clear();
results.Append(w);
@@ -932,7 +932,7 @@ bool IfcGeom::util::convert_wire_to_faces(const TopoDS_Wire& w, TopoDS_Compound&
BRepBuilderAPI_FaceError er = mf.Error();
if (er != BRepBuilderAPI_FaceDone) {
Logger::Root().Error("GEO", 230, "Failed to create face.");
::logger::root().error("GEO", 230, "Failed to create face.");
continue;
}
@@ -949,7 +949,7 @@ bool IfcGeom::util::convert_wire_to_faces(const TopoDS_Wire& w, TopoDS_Compound&
if (p.first >= max_area / 10.) {
B.Add(faces, p.second);
} else {
Logger::Root().Warning("GEO", 231, "Ignoring self-intersection loop with area " + boost::lexical_cast<std::string>(p.first));
::logger::root().warning("GEO", 231, "Ignoring self-intersection loop with area " + boost::lexical_cast<std::string>(p.first));
}
}
@@ -286,7 +286,7 @@ ifcopenshell::geometry::PassthroughShape::PassthroughShape(const std::vector<Pas
ifcopenshell::geometry::PassthroughShape::PassthroughShape(std::vector<PassthroughPart>&& parts)
: parts_(normalize_parts(parts)) {}
void ifcopenshell::geometry::PassthroughShape::Triangulate(ifcopenshell::geometry::Settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id) const {
void ifcopenshell::geometry::PassthroughShape::Triangulate(ifcopenshell::geometry::Settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id, ::logger&) const {
auto mesh = build_mesh(parts_, &place);
std::vector<int> indices(mesh.vertices.size());
for (size_t i = 0; i < mesh.vertices.size(); ++i) {
@@ -356,13 +356,13 @@ std::pair<IfcGeom::OpaqueCoordinate<3>, IfcGeom::OpaqueCoordinate<3>> ifcopenshe
}
auto result = std::make_pair(
IfcGeom::OpaqueCoordinate<3>(
new IfcGeom::NumberNativeDouble(box->min(0)),
new IfcGeom::NumberNativeDouble(box->min(1)),
new IfcGeom::NumberNativeDouble(box->min(2))),
IfcGeom::OpaqueNumber(box->min(0)),
IfcGeom::OpaqueNumber(box->min(1)),
IfcGeom::OpaqueNumber(box->min(2))),
IfcGeom::OpaqueCoordinate<3>(
new IfcGeom::NumberNativeDouble(box->max(0)),
new IfcGeom::NumberNativeDouble(box->max(1)),
new IfcGeom::NumberNativeDouble(box->max(2))));
IfcGeom::OpaqueNumber(box->max(0)),
IfcGeom::OpaqueNumber(box->max(1)),
IfcGeom::OpaqueNumber(box->max(2))));
delete box;
return result;
}
@@ -375,16 +375,16 @@ void ifcopenshell::geometry::PassthroughShape::set_box(void* box_ptr) {
parts_ = { { make_box_shell(box->min, box->max), taxonomy::make<taxonomy::matrix4>(), true } };
}
IfcGeom::OpaqueNumber* ifcopenshell::geometry::PassthroughShape::length() {
return new IfcGeom::NumberNativeDouble(mesh_length(build_mesh(parts_)));
IfcGeom::OpaqueNumber ifcopenshell::geometry::PassthroughShape::length() {
return IfcGeom::OpaqueNumber(mesh_length(build_mesh(parts_)));
}
IfcGeom::OpaqueNumber* ifcopenshell::geometry::PassthroughShape::area() {
return new IfcGeom::NumberNativeDouble(mesh_area(build_mesh(parts_)));
IfcGeom::OpaqueNumber ifcopenshell::geometry::PassthroughShape::area() {
return IfcGeom::OpaqueNumber(mesh_area(build_mesh(parts_)));
}
IfcGeom::OpaqueNumber* ifcopenshell::geometry::PassthroughShape::volume() {
return new IfcGeom::NumberNativeDouble(is_manifold() ? mesh_volume(build_mesh(parts_)) : 0.);
IfcGeom::OpaqueNumber ifcopenshell::geometry::PassthroughShape::volume() {
return IfcGeom::OpaqueNumber(is_manifold() ? mesh_volume(build_mesh(parts_)) : 0.);
}
IfcGeom::OpaqueCoordinate<3> ifcopenshell::geometry::PassthroughShape::position() {
@@ -465,11 +465,11 @@ IfcGeom::ConversionResultShape* ifcopenshell::geometry::PassthroughShape::concat
return new PassthroughShape(std::move(parts));
}
void ifcopenshell::geometry::PassthroughShape::map(IfcGeom::OpaqueCoordinate<4>&, IfcGeom::OpaqueCoordinate<4>&) {
std::size_t ifcopenshell::geometry::PassthroughShape::map(IfcGeom::OpaqueCoordinate<4>&, IfcGeom::OpaqueCoordinate<4>&) {
throw std::runtime_error("Not implemented");
}
void ifcopenshell::geometry::PassthroughShape::map(const std::vector<IfcGeom::OpaqueCoordinate<4>>&, const std::vector<IfcGeom::OpaqueCoordinate<4>>&) {
std::size_t ifcopenshell::geometry::PassthroughShape::map(const std::vector<IfcGeom::OpaqueCoordinate<4>>&, const std::vector<IfcGeom::OpaqueCoordinate<4>>&) {
throw std::runtime_error("Not implemented");
}
@@ -24,7 +24,7 @@ public:
const std::vector<PassthroughPart>& parts() const { return parts_; }
virtual std::string_view backend_id() const { return "passthrough"; }
virtual void Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id) const;
virtual void Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int item_id, int surface_style_id, ::logger& logger = ::logger::root()) const;
virtual void Serialize(const ifcopenshell::geometry::taxonomy::matrix4& place, std::string&) const;
virtual int surface_genus() const;
@@ -38,9 +38,9 @@ public:
virtual std::pair<IfcGeom::OpaqueCoordinate<3>, IfcGeom::OpaqueCoordinate<3>> bounding_box() const;
virtual void set_box(void* b);
virtual IfcGeom::OpaqueNumber* length();
virtual IfcGeom::OpaqueNumber* area();
virtual IfcGeom::OpaqueNumber* volume();
virtual IfcGeom::OpaqueNumber length();
virtual IfcGeom::OpaqueNumber area();
virtual IfcGeom::OpaqueNumber volume();
virtual IfcGeom::OpaqueCoordinate<3> position();
virtual IfcGeom::OpaqueCoordinate<3> axis();
@@ -61,8 +61,8 @@ public:
virtual IfcGeom::ConversionResultShape* intersect(IfcGeom::ConversionResultShape*);
virtual IfcGeom::ConversionResultShape* concat(IfcGeom::ConversionResultShape*);
virtual void map(IfcGeom::OpaqueCoordinate<4>& from, IfcGeom::OpaqueCoordinate<4>& to);
virtual void map(const std::vector<IfcGeom::OpaqueCoordinate<4>>& from, const std::vector<IfcGeom::OpaqueCoordinate<4>>& to);
virtual std::size_t map(IfcGeom::OpaqueCoordinate<4>& from, IfcGeom::OpaqueCoordinate<4>& to);
virtual std::size_t map(const std::vector<IfcGeom::OpaqueCoordinate<4>>& from, const std::vector<IfcGeom::OpaqueCoordinate<4>>& to);
virtual IfcGeom::ConversionResultShape* moved(ifcopenshell::geometry::taxonomy::matrix4::ptr) const;
virtual bool surface_area_along_direction(double tol, const ifcopenshell::geometry::taxonomy::matrix4::ptr&, double& along_x, double& along_y, double& along_z) const;
@@ -11,11 +11,11 @@ namespace kernels {
class IFC_GEOMLIBRARY_API PassthroughKernel : public AbstractKernel {
public:
PassthroughKernel(const Settings& settings)
: AbstractKernel("passthrough", settings) {}
PassthroughKernel(const Settings& settings, ::logger& logger = ::logger::root())
: AbstractKernel("passthrough", settings, logger) {}
virtual AbstractKernel* clone() const {
return new PassthroughKernel(settings());
virtual AbstractKernel* clone(::logger& logger) const {
return new PassthroughKernel(settings(), logger);
}
virtual bool supports_boolean_operations() const { return false; }
+1 -1
View File
@@ -28,7 +28,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis1Placement& inst) {
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst.Location()));
P = *v->components_;
} catch (const std::exception&) {
logger_.Warning("GEO", 232, "Placement with invalid Location:", inst);
logger_.warning("GEO", 232, "Placement with invalid Location:", inst);
}
const bool hasAxis = inst.Axis();
if (hasAxis) {
+1 -1
View File
@@ -29,7 +29,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2Placement2D& inst) {
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst.Location()));
P = *v->components_;
} catch (const std::exception&) {
logger_.Warning("GEO", 233, "Placement with invalid Location:", inst);
logger_.warning("GEO", 233, "Placement with invalid Location:", inst);
}
const bool hasRef = !!inst.RefDirection();
if (hasRef) {
+2 -2
View File
@@ -29,13 +29,13 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2Placement3D& inst) {
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst.Location()));
o = *v->components_;
} catch (const std::exception&) {
logger_.Warning("GEO", 234, "Placement with invalid Location:", inst);
logger_.warning("GEO", 234, "Placement with invalid Location:", inst);
}
const bool hasAxis = !!inst.Axis();
const bool hasRef = !!inst.RefDirection();
if (hasAxis != hasRef) {
logger_.Warning("GEO", 235, "Axis and RefDirection should be specified together", inst);
logger_.warning("GEO", 235, "Axis and RefDirection should be specified together", inst);
}
if (hasAxis) {
@@ -26,7 +26,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2PlacementLinear& inst) {
if (!inst.Location().as<IfcSchema::IfcPointByDistanceExpression>()) {
logger_.Error("GEO", 236, std::runtime_error("Location must be IfcPointByDistanceExpression for IfcAxis2PlacementLinear"));
logger_.error("GEO", 236, std::runtime_error("Location must be IfcPointByDistanceExpression for IfcAxis2PlacementLinear"));
}
Eigen::Vector3d o, axis(0, 0, 1), refDirection;
@@ -45,7 +45,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2PlacementLinear& inst)
/*
if (hasAxis != hasRef) {
logger::warning("Axis and RefDirection should be specified together", inst);
::logger::root().warning("Axis and RefDirection should be specified together", inst);
}
*/
+1 -1
View File
@@ -43,7 +43,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCShapeProfileDef& inst) {
const double tol = settings_.get<settings::Precision>().get();
if ( x < tol || y < tol || d1 < tol || d2 < tol) {
logger_.Message(Logger::LOG_NOTICE, "GEO", 241, "Skipping zero sized profile:", inst);
logger_.message(::logger::LOG_NOTICE, "GEO", 241, "Skipping zero sized profile:", inst);
return nullptr;
}
+1 -1
View File
@@ -24,7 +24,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCircle& inst) {
const double r = inst.Radius() * length_unit_;
if (r < settings_.get<settings::Precision>().get()) {
logger_.Message(Logger::LOG_ERROR, "GEO", 237, "Radius not greater than zero for:", inst);
logger_.message(::logger::LOG_ERROR, "GEO", 237, "Radius not greater than zero for:", inst);
return nullptr;
}
+9 -9
View File
@@ -34,11 +34,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve& inst) {
for (auto& segment : segments) {
if (segment.as<IfcSchema::IfcCompositeCurveSegment>() && segment.as<IfcSchema::IfcCompositeCurveSegment>().ParentCurve().as<IfcSchema::IfcLine>()) {
logger_.Notice("GEO", 238, "Infinite IfcLine used as ParentCurve of segment, treating as a segment", segment);
logger_.notice("GEO", 238, "Infinite IfcLine used as ParentCurve of segment, treating as a segment", segment);
double u0 = 0.0;
double u1 = segment.as<IfcSchema::IfcCompositeCurveSegment>().ParentCurve().as<IfcSchema::IfcLine>().Dir().Magnitude() * length_unit_;
if (u1 < settings_.get<settings::Precision>().get()) {
logger_.Warning("GEO", 239, "Segment length below tolerance", segment);
logger_.warning("GEO", 239, "Segment length below tolerance", segment);
}
auto e = taxonomy::make<taxonomy::edge>();
@@ -70,7 +70,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve& inst) {
e->end = 2.0 * boost::math::constants::pi<double>();
loop->children.push_back(e);
} else {
logger_.Warning("GEO", 240, "Unexpected segment type", segment);
logger_.warning("GEO", 240, "Unexpected segment type", segment);
return nullptr;
}
}
@@ -128,7 +128,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
for (auto it = segments->begin(); it != segments->end(); ++it) {
if (!(*it)->declaration().is(IfcSchema::IfcCompositeCurveSegment::Class())) {
logger::error("Not implemented", *it);
::logger::root().error("Not implemented", *it);
return false;
}
@@ -141,13 +141,13 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
TopoDS_Wire segment;
if (curve->as<IfcSchema::IfcLine>()) {
logger::notice("Infinite IfcLine used as ParentCurve of segment, treating as a segment", *it);
::logger::root().notice("Infinite IfcLine used as ParentCurve of segment, treating as a segment", *it);
Handle_Geom_Curve handle;
convert_curve(curve, handle);
double u0 = 0.0;
double u1 = curve->as<IfcSchema::IfcLine>()->Dir()->Magnitude() * length_unit_;
if (u1 < getValue(GV_PRECISION)) {
logger::warning("Segment length below tolerance", *it);
::logger::root().warning("Segment length below tolerance", *it);
}
BRepBuilderAPI_MakeEdge me(handle, u0, u1);
if (me.IsDone()) {
@@ -157,7 +157,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
}
} else if (!convert_wire(curve, segment)) {
const bool failed_on_purpose = curve->as<IfcSchema::IfcPolyline>() && !segment.IsNull();
logger::message(failed_on_purpose ? logger::LOG_WARNING : logger::LOG_ERROR, "Failed to convert curve:", curve);
::logger::root().message(failed_on_purpose ? ::logger::LOG_WARNING : ::logger::LOG_ERROR, "Failed to convert curve:", curve);
continue;
}
@@ -168,12 +168,12 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
ShapeFix_ShapeTolerance FTol;
FTol.SetTolerance(segment, getValue(GV_PRECISION), TopAbs_WIRE);
converted_segments.Append(segment);
converted_segments.append(segment);
}
if (converted_segments.Extent() == 0) {
logger::message(logger::LOG_ERROR, "No segment successfully converted:", l);
::logger::root().message(::logger::LOG_ERROR, "No segment successfully converted:", l);
return false;
}
+19 -19
View File
@@ -216,7 +216,7 @@ struct cant_curve_segment_function {
class curve_segment_evaluator {
private:
mapping* mapping_ = nullptr;
Logger& logger_;
logger& logger_;
IfcSchema::IfcCurveSegment inst_; // this curve segment instance
double length_unit_;
double start_;
@@ -260,10 +260,10 @@ class curve_segment_evaluator {
emit_next = true;
}
} else {
mapping_->logger().Warning("GEO", 242, "IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the next segment.");
mapping_->logger().warning("GEO", 242, "IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the next segment.");
}
} else {
logger::warning("IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the next segment.");
::logger::root().warning("IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the next segment.");
}
bool is_horizontal = false;
@@ -283,7 +283,7 @@ class curve_segment_evaluator {
if ((is_horizontal + is_vertical + is_cant) != 1) {
// We have to choose the correct functor based on usage. We can't
// support multiple, because we don't know the caller at this point.
mapping_->logger().Error("UNS", 10, std::runtime_error("multiple uses of IfcSegmentCurve not supported"), inst_);
mapping_->logger().error("UNS", 10, std::runtime_error("multiple uses of IfcSegmentCurve not supported"), inst_);
}
segment_type_ = is_horizontal ? ST_HORIZONTAL : is_vertical ? ST_VERTICAL : is_cant ? ST_CANT : ST_HORIZONTAL;
@@ -321,7 +321,7 @@ class curve_segment_evaluator {
end_point = segmented_reference_curve.EndPoint();
}
} else {
mapping_->logger().Warning("GEO", 243, "IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the end point.");
mapping_->logger().warning("GEO", 243, "IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the end point.");
}
if (end_point) {
next_segment_placement_ = taxonomy::cast<taxonomy::matrix4>(mapping_->map(end_point))->ccomponents();
@@ -343,7 +343,7 @@ class curve_segment_evaluator {
taxonomy::ptr get_segment_curve_function() {
if (!parent_curve_fn_ || !parent_curve_start_point_) {
mapping_->logger().Error("UNS", 11, std::runtime_error(inst_->ParentCurve()->declaration().name() + " not implemented"), inst_);
mapping_->logger().error("UNS", 11, std::runtime_error(inst_->ParentCurve()->declaration().name() + " not implemented"), inst_);
}
auto length = fabs(this->length());
@@ -476,13 +476,13 @@ class curve_segment_evaluator {
projected_length_ = length_;
}
} else if (segment_type_ == ST_CANT) {
mapping_->logger().Error("GEO", 244, std::runtime_error("Unexpected segment type encountered - cant is handled in set_cant_spiral_function - should never get here"));
mapping_->logger().error("GEO", 244, std::runtime_error("Unexpected segment type encountered - cant is handled in set_cant_spiral_function - should never get here"));
parent_curve_fn_ = std::make_shared<parent_curve_function>(
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
);
} else {
mapping_->logger().Error("GEO", 245, "Unexpected segment type encountered");
mapping_->logger().error("GEO", 245, "Unexpected segment type encountered");
parent_curve_fn_ = std::make_shared<parent_curve_function>(
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
@@ -643,13 +643,13 @@ class curve_segment_evaluator {
set_cant_spiral_function(*super, *slope, cant);
} else if (segment_type_ == ST_VERTICAL) {
mapping_->logger().Error("GEO", 246, "IfcCosineSpiral cannot be used for vertical alignment");
mapping_->logger().error("GEO", 246, "IfcCosineSpiral cannot be used for vertical alignment");
parent_curve_fn_ = std::make_shared<parent_curve_function>(
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
);
} else {
mapping_->logger().Error("GEO", 247, "Unexpected segment type encountered");
mapping_->logger().error("GEO", 247, "Unexpected segment type encountered");
parent_curve_fn_ = std::make_shared<parent_curve_function>(
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
@@ -712,12 +712,12 @@ class curve_segment_evaluator {
set_cant_spiral_function(*super, *slope, cant);
} else if (segment_type_ == ST_VERTICAL) {
mapping_->logger().Error("GEO", 248, "IfcSineSpiral cannot be used for vertical alignment");
mapping_->logger().error("GEO", 248, "IfcSineSpiral cannot be used for vertical alignment");
parent_curve_fn_ = std::make_shared<parent_curve_function>(
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
} else {
mapping_->logger().Error("GEO", 249, "Unexpected segment type encountered");
mapping_->logger().error("GEO", 249, "Unexpected segment type encountered");
parent_curve_fn_ = std::make_shared<parent_curve_function>(
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
@@ -978,12 +978,12 @@ class curve_segment_evaluator {
}
} else if (segment_type_ == ST_CANT) {
mapping_->logger().Warning("UNS", 12, "Use of IfcCircle for cant is not supported");
mapping_->logger().warning("UNS", 12, "Use of IfcCircle for cant is not supported");
parent_curve_fn_ = std::make_shared<parent_curve_function>(
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
} else {
mapping_->logger().Error("GEO", 250, "Unexpected segment type encountered");
mapping_->logger().error("GEO", 250, "Unexpected segment type encountered");
parent_curve_fn_ = std::make_shared<parent_curve_function>(
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
@@ -1069,7 +1069,7 @@ class curve_segment_evaluator {
parent_curve_start_point_ = (*parent_curve_fn_)(start_);
} else {
mapping_->logger().Warning("GEO", 251, "Unexpected segment type encountered");
mapping_->logger().warning("GEO", 251, "Unexpected segment type encountered");
parent_curve_fn_ = std::make_shared<parent_curve_function>(
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
@@ -1083,7 +1083,7 @@ class curve_segment_evaluator {
auto coeffY = pc.CoefficientsY().value_or(std::vector<double>());
auto coeffZ = pc.CoefficientsZ().value_or(std::vector<double>());
if (!coeffZ.empty()) {
mapping_->logger().Warning("GEO", 252, "Expected IfcPolynomialCurve.CoefficientsZ to be undefined for alignment geometry. Coefficients ignored.", pc);
mapping_->logger().warning("GEO", 252, "Expected IfcPolynomialCurve.CoefficientsZ to be undefined for alignment geometry. Coefficients ignored.", pc);
}
if (segment_type_ == ST_HORIZONTAL || segment_type_ == ST_VERTICAL) {
@@ -1149,7 +1149,7 @@ class curve_segment_evaluator {
auto result = boost::math::tools::bracket_and_solve_root(f, x, 2.0, true, tol, max_iter);
x = result.first;
} catch (...) {
logger_.Warning("GEO", 253, "root solver failed");
logger_.warning("GEO", 253, "root solver failed");
}
return x;
};
@@ -1210,12 +1210,12 @@ class curve_segment_evaluator {
parent_curve_start_point_ = (*parent_curve_fn_)(0.0); // start is added to u in parent_curve_fn_, so use 0.0 here
} else if (segment_type_ == ST_CANT) {
mapping_->logger().Warning("UNS", 13, std::runtime_error("Use of IfcPolynomialCurve for cant is not supported"));
mapping_->logger().warning("UNS", 13, std::runtime_error("Use of IfcPolynomialCurve for cant is not supported"));
parent_curve_fn_ = std::make_shared<parent_curve_function>(
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
} else {
mapping_->logger().Error("GEO", 254, std::runtime_error("Unexpected segment type encountered"));
mapping_->logger().error("GEO", 254, std::runtime_error("Unexpected segment type encountered"));
parent_curve_fn_ = std::make_shared<parent_curve_function>(
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
+2 -2
View File
@@ -25,14 +25,14 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEdge& inst) {
auto v1 = inst.EdgeStart().as<IfcSchema::IfcVertexPoint>();
auto v2 = inst.EdgeEnd().as<IfcSchema::IfcVertexPoint>();
if (!v1 || !v2) {
logger_.Message(Logger::LOG_ERROR, "GEO", 255, "Only IfcVertexPoints are supported for EdgeStart and -End", inst);
logger_.message(::logger::LOG_ERROR, "GEO", 255, "Only IfcVertexPoints are supported for EdgeStart and -End", inst);
return nullptr;
}
auto pnt1 = v1.VertexGeometry();
auto pnt2 = v2.VertexGeometry();
if (!pnt1.declaration().is(IfcSchema::IfcCartesianPoint::Class()) || !pnt2.declaration().is(IfcSchema::IfcCartesianPoint::Class())) {
logger_.Message(Logger::LOG_ERROR, "GEO", 256, "Only IfcCartesianPoints are supported for VertexGeometry", inst);
logger_.message(::logger::LOG_ERROR, "GEO", 256, "Only IfcCartesianPoints are supported for VertexGeometry", inst);
return nullptr;
}
+1 -1
View File
@@ -26,7 +26,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEllipse& inst) {
double y = inst.SemiAxis2() * length_unit_;
const double tol = settings_.get<settings::Precision>().get();
if (x < tol || y < tol) {
logger_.Message(Logger::LOG_ERROR, "GEO", 257, "Radius not greater than zero for:", inst);
logger_.message(::logger::LOG_ERROR, "GEO", 257, "Radius not greater than zero for:", inst);
return nullptr;
}
+1 -1
View File
@@ -26,7 +26,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEllipseProfileDef& inst) {
double ry = inst.SemiAxis2() * length_unit_;
const double tol = settings_.get<settings::Precision>().get();
if (rx < tol || ry < tol) {
logger_.Message(Logger::LOG_ERROR, "GEO", 258, "Radius not greater than zero for:", inst);
logger_.message(::logger::LOG_ERROR, "GEO", 258, "Radius not greater than zero for:", inst);
return nullptr;
}
+1 -1
View File
@@ -27,7 +27,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcExtrudedAreaSolid& inst) {
const double height = inst.Depth() * length_unit_;
if (height < settings_.get<settings::Precision>().get()) {
logger_.Message(Logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", inst);
logger_.message(::logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", inst);
#ifndef PERMISSIVE_EXTRUSION
return nullptr;
#endif
@@ -27,7 +27,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcExtrudedAreaSolidTapered& inst) {
const double height = inst.Depth() * length_unit_;
if (height < settings_.get<settings::Precision>().get()) {
logger_.Message(Logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", inst);
logger_.message(::logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", inst);
return nullptr;
}
@@ -98,7 +98,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcFixedReferenceSweptAreaSolid
auto condition_number = svd.singularValues()(0)
/ svd.singularValues()(svd.singularValues().size() - 1);
if (condition_number > 1.e10) {
logger::error("Non-invertible matrix at " + std::to_string(distalong) + " conversion will likely fail.");
::logger::root().error("Non-invertible matrix at " + std::to_string(distalong) + " conversion will likely fail.");
}
*/
}
+4 -4
View File
@@ -26,7 +26,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcGradientCurve& inst) {
if (!inst.BaseCurve().as<IfcSchema::IfcCompositeCurve>())
logger_.Warning("GEO", 261, "Expected IfcGradientCurve.BaseCurve to be IfcCompositeCurve", inst); // CT 4.1.7.1.1.2
logger_.warning("GEO", 261, "Expected IfcGradientCurve.BaseCurve to be IfcCompositeCurve", inst); // CT 4.1.7.1.1.2
auto segments = inst.Segments();
@@ -41,11 +41,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcGradientCurve& inst) {
// for this reason, a dynamic cast is used and if crv is a function_item it is added to the span
spans.push_back(fi);
} else {
logger_.Error("UNS", 14, "Unsupported");
logger_.error("UNS", 14, "Unsupported");
return nullptr;
}
} else {
logger_.Error("UNS", 15, "Unsupported");
logger_.error("UNS", 15, "Unsupported");
return nullptr;
}
}
@@ -73,7 +73,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcGradientCurve& inst) {
// check to see if there is valid overlap of the horizontal and vertical domains
if (!(0 < gradient_function->length())) {
logger_.Error("GEO", 262, "IfcGradientCurve does not have a common domain with BaseCurve");
logger_.error("GEO", 262, "IfcGradientCurve does not have a common domain with BaseCurve");
gradient_function = nullptr; // not valid
}
+1 -1
View File
@@ -25,7 +25,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcHalfSpaceSolid& inst) {
auto surface = inst.BaseSurface();
auto plane = surface.as<IfcSchema::IfcPlane>();
if (!plane) {
logger_.Message(Logger::LOG_ERROR, "UNS", 16, "Unsupported BaseSurface:", surface);
logger_.message(::logger::LOG_ERROR, "UNS", 16, "Unsupported BaseSurface:", surface);
return nullptr;
}
auto p = taxonomy::make<taxonomy::plane>();
+1 -1
View File
@@ -80,7 +80,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIShapeProfileDef& inst) {
const double tol = settings_.get<settings::Precision>().get();
if (x1 < tol || x2 < tol || y < tol || d1 < tol || ft1 < tol || ft2 < tol) {
logger_.Message(Logger::LOG_NOTICE, "GEO", 264, "Skipping zero sized profile:", inst);
logger_.message(::logger::LOG_NOTICE, "GEO", 264, "Skipping zero sized profile:", inst);
return nullptr;
}
+1 -1
View File
@@ -87,7 +87,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve& inst) {
e->basis = circ;
loop->children.push_back(e);
} else {
logger_.Warning("GEO", 263, "Ignoring segment on", inst);
logger_.warning("GEO", 263, "Ignoring segment on", inst);
}
} else {
throw ifcopenshell::exception("Unexpected IfcIndexedPolyCurve segment of type " + segment.concrete().declaration().name());
+2 -2
View File
@@ -45,7 +45,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcLShapeProfileDef& inst) {
const double tol = settings_.get<settings::Precision>().get();
if ( x < tol || y < tol || d < tol) {
logger_.Message(Logger::LOG_NOTICE, "GEO", 265, "Skipping zero sized profile:", inst);
logger_.message(::logger::LOG_NOTICE, "GEO", 265, "Skipping zero sized profile:", inst);
return nullptr;
}
@@ -77,7 +77,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcLShapeProfileDef& inst) {
const double det = a1*b2 - a2*b1;
if (std::fabs(det) < 1.e-5) {
logger_.Message(Logger::LOG_NOTICE, "GEO", 266, "Legs do not intersect for:", inst);
logger_.message(::logger::LOG_NOTICE, "GEO", 266, "Legs do not intersect for:", inst);
return nullptr;
}
+5 -5
View File
@@ -47,13 +47,13 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement& inst) {
// element we're ignoring, but we don't want to traverse the entire model.
#ifdef SCHEMA_IfcObjectPlacement_HAS_ReferencedByPlacements
if (depth < 2) {
std::vector<IfcSchema::IfcObjectPlacement> refs = placement.ReferencedByPlacements();
auto refs = placement.ReferencedByPlacements();
for (auto& ref : refs) {
q.emplace_back(ref, depth + 1);
q.emplace_back(ref.template as<IfcSchema::IfcObjectPlacement>(), depth + 1);
}
}
#else
logger::warning("Using --site-local-placement or --building-local-placement on IFC4.2 might have issues");
::logger::root().warning("Using --site-local-placement or --building-local-placement on IFC4.2 might have issues");
#endif
}
}
@@ -126,7 +126,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement& inst) {
if (fallback) {
auto mapped_fallback = taxonomy::cast<taxonomy::matrix4>(map(fallback));
if (!result->ccomponents().isApprox(mapped_fallback->ccomponents())) {
logger::warning("Computed placement differs from fallback", inst);
::logger::root().warning("Computed placement differs from fallback", inst);
}
}
@@ -134,7 +134,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement& inst) {
auto abs_det = std::abs(result->ccomponents().determinant());
if (abs_det < 1.e-7) {
logger::warning("Ignoring singular matrix:", inst);
::logger::root().warning("Ignoring singular matrix:", inst);
return nullptr;
}
@@ -33,7 +33,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst) {
auto offset_values = inst.OffsetValues();
if (offset_values.empty()) {
logger_.Error("GEO", 270, "IfcOffsetCurveByDistances must have at least one offset value");
logger_.error("GEO", 270, "IfcOffsetCurveByDistances must have at least one offset value");
}
auto& first_offset_value = offset_values.front();
@@ -56,7 +56,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst
auto basis_curve_fn = taxonomy::dcast<taxonomy::function_item>(map(basis_curve));
if (!basis_curve_fn) {
// Only implement on alignment curves
logger_.Warning("GEO", 271, "IfcOffsetCurveByDistances is only implemented for BasisCurves curves based on taxonomy::function_item", inst);
logger_.warning("GEO", 271, "IfcOffsetCurveByDistances is only implemented for BasisCurves curves based on taxonomy::function_item", inst);
return nullptr;
}
@@ -73,7 +73,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst
first_distance *= length_unit_;
if (first_distance < 0.0) {
logger_.Warning("GEO", 272, "IfcOffsetCurveByDistance first offset value is before the start of the curve.");
logger_.warning("GEO", 272, "IfcOffsetCurveByDistance first offset value is before the start of the curve.");
}
if(0.0 < first_distance)
@@ -110,7 +110,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst
if (dn < dp) // next is before previous
{
logger_.Warning("GEO", 273, "IfcOffsetCurveByDistance offset value is out of bounds.");
logger_.warning("GEO", 273, "IfcOffsetCurveByDistance offset value is out of bounds.");
continue;
}
@@ -32,7 +32,7 @@ const double PI = boost::math::constants::pi<double>();
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOpenCrossProfileDef& inst) {
if (inst.ProfileType() != IfcSchema::IfcProfileTypeEnum::IfcProfileType_CURVE) {
logger_.Warning("GEO", 274, "Expected IfcOpenCrossProfileDef.ProfileType to be CURVE", inst);
logger_.warning("GEO", 274, "Expected IfcOpenCrossProfileDef.ProfileType to be CURVE", inst);
return nullptr;
}
@@ -56,7 +56,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOpenCrossProfileDef& inst) {
auto angles = inst.Slopes(); // these are actually angles, but the attribute is called Slopes
if (widths.size() != angles.size()) {
logger_.Warning("GEO", 275, "Expected Widths and Slopes to be equal length, but got " + std::to_string(widths.size()) + " and " + std::to_string(angles.size()) + " respectively", inst);
logger_.warning("GEO", 275, "Expected Widths and Slopes to be equal length, but got " + std::to_string(widths.size()) + " and " + std::to_string(angles.size()) + " respectively", inst);
return nullptr;
}
+4 -4
View File
@@ -36,7 +36,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolyLoop& inst) {
// A loop should consist of at least three vertices
int original_count = polygon.size();
if (original_count < 3) {
logger_.Message(Logger::LOG_WARNING, "GEO", 278, "Not enough edges for:", inst);
logger_.message(::logger::LOG_WARNING, "GEO", 278, "Not enough edges for:", inst);
return nullptr;
}
@@ -45,17 +45,17 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolyLoop& inst) {
auto previous_size = polygon.size();
remove_duplicate_points_from_loop(polygon, true, eps);
if (polygon.size() != previous_size) {
logger_.Warning("GEO", 279, "Removed " + std::to_string(previous_size - polygon.size()) + " (near) duplicate points from:", inst);
logger_.warning("GEO", 279, "Removed " + std::to_string(previous_size - polygon.size()) + " (near) duplicate points from:", inst);
}
int count = polygon.size();
if (original_count - count != 0) {
std::stringstream ss; ss << (original_count - count) << " edges removed for:";
logger_.Message(Logger::LOG_WARNING, "GEO", 280, ss.str(), inst);
logger_.message(::logger::LOG_WARNING, "GEO", 280, ss.str(), inst);
}
if (count < 3) {
logger_.Message(Logger::LOG_WARNING, "GEO", 281, "Not enough edges for:", inst);
logger_.message(::logger::LOG_WARNING, "GEO", 281, "Not enough edges for:", inst);
return nullptr;
}
+2 -2
View File
@@ -44,12 +44,12 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolyline& inst) {
auto previous_size = polygon.size();
remove_duplicate_points_from_loop(polygon, closed_by_proximity, eps);
if (polygon.size() != previous_size) {
logger_.Warning("GEO", 276, "Removed " + std::to_string(previous_size - polygon.size()) + " (near) duplicate points from:", inst);
logger_.warning("GEO", 276, "Removed " + std::to_string(previous_size - polygon.size()) + " (near) duplicate points from:", inst);
}
if (polygon.size() < 2) {
// We somehow need to signal we fail this curve on purpose not to trigger an error.
logger_.Warning("GEO", 277, "Invalid polyline with " + std::to_string(polygon.size()) + " points:", inst);
logger_.warning("GEO", 277, "Invalid polyline with " + std::to_string(polygon.size()) + " points:", inst);
return nullptr;
}
@@ -37,7 +37,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangleHollowProfileDef& i
const double tol = settings_.get<settings::Precision>().get();
if (x < tol || y < tol) {
logger_.Message(Logger::LOG_NOTICE, "GEO", 282, "Skipping zero sized profile:", inst);
logger_.message(::logger::LOG_NOTICE, "GEO", 282, "Skipping zero sized profile:", inst);
return nullptr;
}
@@ -30,7 +30,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangleProfileDef& inst) {
const double tol = settings_.get<settings::Precision>().get();
if (x < tol || y < tol) {
logger_.Message(Logger::LOG_NOTICE, "GEO", 283, "Skipping zero sized profile:", inst);
logger_.message(::logger::LOG_NOTICE, "GEO", 283, "Skipping zero sized profile:", inst);
return nullptr;
}
@@ -27,7 +27,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangularTrimmedSurface& i
/*
if (!inst.BasisSurface()->declaration().is(IfcSchema::IfcPlane::Class())) {
logger::message(logger::LOG_ERROR, "Unsupported BasisSurface:", inst.BasisSurface());
::logger::root().message(::logger::LOG_ERROR, "Unsupported BasisSurface:", inst.BasisSurface());
return false;
}
gp_Pln pln;
+1 -1
View File
@@ -86,7 +86,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRevolvedAreaSolid& inst) {
}
if (intersecting) {
logger::warning("Warning Axis and SweptArea intersecting", l);
::logger::root().warning("Warning Axis and SweptArea intersecting", l);
}
}
*/
@@ -31,7 +31,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRoundedRectangleProfileDef&
const double tol = settings_.get<settings::Precision>().get();
if (x < tol || y < tol) {
logger_.Message(Logger::LOG_NOTICE, "GEO", 284, "Skipping zero sized profile:", inst);
logger_.message(::logger::LOG_NOTICE, "GEO", 284, "Skipping zero sized profile:", inst);
return nullptr;
}
@@ -34,7 +34,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSolidHorizontal& in
auto fn = taxonomy::dcast<taxonomy::function_item>(dir);
if (!fn) {
// Only implement on alignment curves
logger_.Warning("GEO", 285, "IfcSectionedSolidHorizontal is only implemented for Directrix curves based on taxonomy::function_item", inst);
logger_.warning("GEO", 285, "IfcSectionedSolidHorizontal is only implemented for Directrix curves based on taxonomy::function_item", inst);
return nullptr;
}
@@ -91,11 +91,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSolidHorizontal& in
profile_rotations.push_back(rot);
}
if (faces.size() != profile_offsets.size()) {
logger_.Warning("GEO", 286, "Expected CrossSections and CrossSectionPositions to be equal length, but got " + std::to_string(faces.size()) + " and " + std::to_string(profile_offsets.size()) + " respectively", inst);
logger_.warning("GEO", 286, "Expected CrossSections and CrossSectionPositions to be equal length, but got " + std::to_string(faces.size()) + " and " + std::to_string(profile_offsets.size()) + " respectively", inst);
return nullptr;
}
if (faces.size() < 2) {
logger_.Warning("GEO", 287, "Expected at least two cross sections, but got " + std::to_string(faces.size()), inst);
logger_.warning("GEO", 287, "Expected at least two cross sections, but got " + std::to_string(faces.size()), inst);
return nullptr;
}
+3 -3
View File
@@ -34,7 +34,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSurface& inst) {
auto fn = taxonomy::dcast<taxonomy::function_item>(dir);
if (!fn) {
// Only implement on alignment curves
logger_.Warning("GEO", 288, "IfcSectionedSurface is only implemented for Directrix curves based on taxonomy::function_item", inst);
logger_.warning("GEO", 288, "IfcSectionedSurface is only implemented for Directrix curves based on taxonomy::function_item", inst);
return nullptr;
}
@@ -97,11 +97,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSurface& inst) {
return nullptr;
#endif
if (faces.size() != profile_offsets.size()) {
logger_.Warning("GEO", 289, "Expected CrossSections and CrossSectionPositions to be equal length, but got " + std::to_string(faces.size()) + " and " + std::to_string(profile_offsets.size()) + " respectively", inst);
logger_.warning("GEO", 289, "Expected CrossSections and CrossSectionPositions to be equal length, but got " + std::to_string(faces.size()) + " and " + std::to_string(profile_offsets.size()) + " respectively", inst);
return nullptr;
}
if (faces.size() < 2) {
logger_.Warning("GEO", 290, "Expected at least two cross sections, but got " + std::to_string(faces.size()), inst);
logger_.warning("GEO", 290, "Expected at least two cross sections, but got " + std::to_string(faces.size()), inst);
return nullptr;
}
@@ -27,7 +27,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve& inst) {
if (!inst.BaseCurve().as<IfcSchema::IfcGradientCurve>())
logger_.Warning("GEO", 291, "Expected IfcSegmentedReferenceCurve.BaseCurve to be IfcGradient", inst); // CT 4.1.7.1.1.3
logger_.warning("GEO", 291, "Expected IfcSegmentedReferenceCurve.BaseCurve to be IfcGradient", inst); // CT 4.1.7.1.1.3
auto segments = inst.Segments();
@@ -41,11 +41,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve& ins
// for this reason, a dynamic cast is used and if crv is a function_item it is added to the span
spans.push_back(fi);
} else {
logger_.Error("UNS", 17, "Unsupported");
logger_.error("UNS", 17, "Unsupported");
return nullptr;
}
} else {
logger_.Error("UNS", 18, "Unsupported");
logger_.error("UNS", 18, "Unsupported");
return nullptr;
}
}
@@ -67,7 +67,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve& ins
auto cant_function = taxonomy::make<taxonomy::cant_function>(gradient, cant, inst);
if (!(0 < cant_function->length())) {
logger_.Error("GEO", 292, "IfcSegmentedReferenceCurve does not have a common domain with BaseCurve");
logger_.error("GEO", 292, "IfcSegmentedReferenceCurve does not have a common domain with BaseCurve");
cant_function = nullptr;
}
return cant_function;
@@ -49,11 +49,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSurfaceCurveSweptAreaSolid&
if (!is_plane) {
TopoDS_Shape surface_shell;
if (!convert_shape(inst.ReferenceSurface(), surface_shell)) {
logger::error("Failed to convert reference surface", l);
::logger::root().error("Failed to convert reference surface", l);
return false;
}
if (util::count(surface_shell, TopAbs_FACE) != 1) {
logger::error("Non-continuous reference surface", l);
::logger::root().error("Non-continuous reference surface", l);
return false;
}
surface_face = TopoDS::Face(TopExp_Explorer(surface_shell, TopAbs_FACE).Current());
@@ -76,7 +76,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSurfaceCurveSweptAreaSolid&
for (TopExp_Explorer exp(wire, TopAbs_VERTEX); exp.More(); exp.Next()) {
if (pln.Distance(BRep_Tool::Pnt(TopoDS::Vertex(exp.Current()))) > ALMOST_ZERO) {
directrix_on_plane = false;
logger::message(logger::LOG_WARNING, "The Directrix does not lie on the ReferenceSurface", l);
::logger::root().message(::logger::LOG_WARNING, "The Directrix does not lie on the ReferenceSurface", l);
break;
}
}
+7 -7
View File
@@ -62,7 +62,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
sp = inst.StartParam();
ep = inst.EndParam();
} catch (const ifcopenshell::exception& e) {
logger_.Warning("GEO", 293, e);
logger_.warning("GEO", 293, e);
}
#endif
@@ -241,19 +241,19 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
i += 1;
j += 1;
} else {
logger::error("Unexpected amount of fillet edges generated");
::logger::root().error("Unexpected amount of fillet edges generated");
}
} else {
logger::error("Unable to build fillet, probably edge too short");
::logger::root().error("Unable to build fillet, probably edge too short");
}
} else {
logger::error("Colinear edges, not applying fillet");
::logger::root().error("Colinear edges, not applying fillet");
}
i++;
j++;
}
} else {
logger::error("Not enough edges for applying fillet");
::logger::root().error("Not enough edges for applying fillet");
}
TopoDS_Wire new_wire;
@@ -266,7 +266,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
wire = new_wire;
} else {
logger::error("Directrix is not polyhedral, ignoring FilletRadius");
::logger::root().error("Directrix is not polyhedral, ignoring FilletRadius");
}
}
@@ -317,7 +317,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
}
if (!is_valid) {
logger::message(logger::LOG_WARNING, "Failed to subtract inner radius void for:", l);
::logger::root().message(::logger::LOG_WARNING, "Failed to subtract inner radius void for:", l);
}
}

Some files were not shown because too many files have changed in this diff Show More