Restructure and rename

This commit is contained in:
Thomas Krijnen
2026-03-31 15:32:36 +02:00
parent 724cdb446e
commit a07f56db6f
237 changed files with 72532 additions and 72535 deletions
+5 -5
View File
@@ -41,7 +41,7 @@
#define IfcSchema Ifc2x3 #define IfcSchema Ifc2x3
#include "../ifcparse/macros.h" #include "../ifcparse/macros.h"
#include "../ifcparse/Ifc2x3.h" #include "../ifcparse/Ifc2x3.h"
#include "../ifcparse/IfcHierarchyHelper.h" #include "../ifcparse/hierarchy_helper.h"
#include "../ifcgeom/Serialization/Serialization.h" #include "../ifcgeom/Serialization/Serialization.h"
@@ -56,9 +56,9 @@ void createGroundShape(TopoDS_Shape& shape);
int main() { int main() {
// The IfcHierarchyHelper is a subclass of the regular IfcFile that provides several // The hierarchy_helper is a subclass of the regular file that provides several
// convenience functions for working with geometry in IFC files. // convenience functions for working with geometry in IFC files.
IfcHierarchyHelper<IfcSchema> file; hierarchy_helper<IfcSchema> file;
file.header().file_name().setname("IfcAdvancedHouse.ifc"); file.header().file_name().setname("IfcAdvancedHouse.ifc");
auto building = file.addBuilding(); auto building = file.addBuilding();
@@ -92,7 +92,7 @@ int main() {
// return `0` otherwise. // return `0` otherwise.
auto building_shape = IfcGeom::serialise(file, building_shell, false).as<IfcSchema::IfcProductDefinitionShape>(); auto building_shape = IfcGeom::serialise(file, building_shell, false).as<IfcSchema::IfcProductDefinitionShape>();
file.addEntity(building_shape); file.add_entity(building_shape);
auto rep = building_shape.Representations().begin(); auto rep = building_shape.Representations().begin();
rep->setContextOfItems(file.getRepresentationContext("model")); rep->setContextOfItems(file.getRepresentationContext("model"));
@@ -116,7 +116,7 @@ int main() {
for (auto& rep : ground_reps) { for (auto& rep : ground_reps) {
rep.setContextOfItems(file.getRepresentationContext("Model")); rep.setContextOfItems(file.getRepresentationContext("Model"));
} }
file.addEntity(ground_representation); file.add_entity(ground_representation);
setSurfaceColour(file, ground_representation.as<IfcSchema::IfcProductDefinitionShape>(), 0.15, 0.25, 0.05); setSurfaceColour(file, ground_representation.as<IfcSchema::IfcProductDefinitionShape>(), 0.15, 0.25, 0.05);
/* /*
+20 -20
View File
@@ -31,7 +31,7 @@
#pragma warning(disable : 4018 4267 4250 4984 4985) #pragma warning(disable : 4018 4267 4250 4984 4985)
#include "../ifcparse/Ifc4x3_add2.h" #include "../ifcparse/Ifc4x3_add2.h"
#include "../ifcparse/IfcHierarchyHelper.h" #include "../ifcparse/hierarchy_helper.h"
#include <boost/math/constants/constants.hpp> #include <boost/math/constants/constants.hpp>
#include <fstream> #include <fstream>
@@ -43,7 +43,7 @@ double to_radian(double deg) { return PI * deg / 180; }
// performs basic project setup including created the IfcProject object // performs basic project setup including created the IfcProject object
// and initializing the project units to FEET // and initializing the project units to FEET
Schema::IfcProject setup_project(IfcHierarchyHelper<Schema>& file) { Schema::IfcProject setup_project(hierarchy_helper<Schema>& file) {
std::vector<std::string> file_description; std::vector<std::string> file_description;
file_description.push_back("ViewDefinition[Alignment-basedReferenceView]"); file_description.push_back("ViewDefinition[Alignment-basedReferenceView]");
file.header().file_description().setdescription(file_description); file.header().file_description().setdescription(file_description);
@@ -95,7 +95,7 @@ Schema::IfcProject setup_project(IfcHierarchyHelper<Schema>& file) {
} }
// creates geometry and business logic segments for horizontal alignment tangent runs // creates geometry and business logic segments for horizontal alignment tangent runs
std::pair<typename Schema::IfcCurveSegment, typename Schema::IfcAlignmentSegment> create_tangent(IfcHierarchyHelper<Schema>& file, const typename Schema::IfcCartesianPoint& p, double dir, double length) { std::pair<typename Schema::IfcCurveSegment, typename Schema::IfcAlignmentSegment> create_tangent(hierarchy_helper<Schema>& file, const typename Schema::IfcCartesianPoint& p, double dir, double length) {
// geometry // geometry
auto parent_curve = file.create<Schema::IfcLine>(); auto parent_curve = file.create<Schema::IfcLine>();
parent_curve.setPnt(file.addDoublet<Schema::IfcCartesianPoint>(0.0, 0.0)); parent_curve.setPnt(file.addDoublet<Schema::IfcCartesianPoint>(0.0, 0.0));
@@ -125,14 +125,14 @@ std::pair<typename Schema::IfcCurveSegment, typename Schema::IfcAlignmentSegment
design_parameters.setPredefinedType(Schema::IfcAlignmentHorizontalSegmentTypeEnum::IfcAlignmentHorizontalSegmentType_LINE); design_parameters.setPredefinedType(Schema::IfcAlignmentHorizontalSegmentTypeEnum::IfcAlignmentHorizontalSegmentType_LINE);
auto alignment_segment = file.create<Schema::IfcAlignmentSegment>(); auto alignment_segment = file.create<Schema::IfcAlignmentSegment>();
alignment_segment.setGlobalId(IfcParse::IfcGlobalId()); alignment_segment.setGlobalId(ifcopenshell::global_id());
alignment_segment.setDesignParameters(design_parameters); alignment_segment.setDesignParameters(design_parameters);
return {curve_segment, alignment_segment}; return {curve_segment, alignment_segment};
} }
// creates geometry and business logic segments for horizontal alignment horizonal curves // creates geometry and business logic segments for horizontal alignment horizonal curves
std::pair<typename Schema::IfcCurveSegment, typename Schema::IfcAlignmentSegment> create_hcurve(IfcHierarchyHelper<Schema>& file, const typename Schema::IfcCartesianPoint& pc, double dir, double radius, double lc) { std::pair<typename Schema::IfcCurveSegment, typename Schema::IfcAlignmentSegment> create_hcurve(hierarchy_helper<Schema>& file, const typename Schema::IfcCartesianPoint& pc, double dir, double radius, double lc) {
// geometry // geometry
double sign = radius / fabs(radius); double sign = radius / fabs(radius);
auto place = file.create<Schema::IfcAxis2Placement2D>(); auto place = file.create<Schema::IfcAxis2Placement2D>();
@@ -163,14 +163,14 @@ std::pair<typename Schema::IfcCurveSegment, typename Schema::IfcAlignmentSegment
design_parameters.setPredefinedType(Schema::IfcAlignmentHorizontalSegmentTypeEnum::IfcAlignmentHorizontalSegmentType_CIRCULARARC); design_parameters.setPredefinedType(Schema::IfcAlignmentHorizontalSegmentTypeEnum::IfcAlignmentHorizontalSegmentType_CIRCULARARC);
auto alignment_segment = file.create<Schema::IfcAlignmentSegment>(); auto alignment_segment = file.create<Schema::IfcAlignmentSegment>();
alignment_segment.setGlobalId(IfcParse::IfcGlobalId()); alignment_segment.setGlobalId(ifcopenshell::global_id());
alignment_segment.setDesignParameters(design_parameters); alignment_segment.setDesignParameters(design_parameters);
return {curve_segment, alignment_segment}; return {curve_segment, alignment_segment};
} }
// creates geometry and business logic segments for vertical profile gradient runs // creates geometry and business logic segments for vertical profile gradient runs
std::pair<typename Schema::IfcCurveSegment, typename Schema::IfcAlignmentSegment> create_gradient(IfcHierarchyHelper<Schema>& file, const typename Schema::IfcCartesianPoint& p, double slope, double length) { std::pair<typename Schema::IfcCurveSegment, typename Schema::IfcAlignmentSegment> create_gradient(hierarchy_helper<Schema>& file, const typename Schema::IfcCartesianPoint& p, double slope, double length) {
// geometry // geometry
auto parent_curve = file.create<Schema::IfcLine>(); auto parent_curve = file.create<Schema::IfcLine>();
parent_curve.setPnt(file.addDoublet<Schema::IfcCartesianPoint>(0.0, 0.0)); parent_curve.setPnt(file.addDoublet<Schema::IfcCartesianPoint>(0.0, 0.0));
@@ -200,14 +200,14 @@ std::pair<typename Schema::IfcCurveSegment, typename Schema::IfcAlignmentSegment
design_parameters.setPredefinedType(Schema::IfcAlignmentVerticalSegmentTypeEnum::IfcAlignmentVerticalSegmentType_CONSTANTGRADIENT); design_parameters.setPredefinedType(Schema::IfcAlignmentVerticalSegmentTypeEnum::IfcAlignmentVerticalSegmentType_CONSTANTGRADIENT);
auto alignment_segment = file.create<Schema::IfcAlignmentSegment>(); auto alignment_segment = file.create<Schema::IfcAlignmentSegment>();
alignment_segment.setGlobalId(IfcParse::IfcGlobalId()); alignment_segment.setGlobalId(ifcopenshell::global_id());
alignment_segment.setDesignParameters(design_parameters); alignment_segment.setDesignParameters(design_parameters);
return {curve_segment, alignment_segment}; return {curve_segment, alignment_segment};
} }
// creates geometry and business logic segments for vertical profile parabolic vertical curves // creates geometry and business logic segments for vertical profile parabolic vertical curves
std::pair<typename Schema::IfcCurveSegment, typename Schema::IfcAlignmentSegment> create_vcurve(IfcHierarchyHelper<Schema>& file, const typename Schema::IfcCartesianPoint& p, double start_slope, double end_slope, double length) { std::pair<typename Schema::IfcCurveSegment, typename Schema::IfcAlignmentSegment> create_vcurve(hierarchy_helper<Schema>& file, const typename Schema::IfcCartesianPoint& p, double start_slope, double end_slope, double length) {
// geometry // geometry
double A = p.Coordinates()[1]; double A = p.Coordinates()[1];
double B = start_slope; double B = start_slope;
@@ -246,7 +246,7 @@ std::pair<typename Schema::IfcCurveSegment, typename Schema::IfcAlignmentSegment
design_parameters.setPredefinedType(Schema::IfcAlignmentVerticalSegmentTypeEnum::IfcAlignmentVerticalSegmentType_PARABOLICARC); design_parameters.setPredefinedType(Schema::IfcAlignmentVerticalSegmentTypeEnum::IfcAlignmentVerticalSegmentType_PARABOLICARC);
auto alignment_segment = file.create<Schema::IfcAlignmentSegment>(); auto alignment_segment = file.create<Schema::IfcAlignmentSegment>();
alignment_segment.setGlobalId(IfcParse::IfcGlobalId()); alignment_segment.setGlobalId(ifcopenshell::global_id());
alignment_segment.setDesignParameters(design_parameters); alignment_segment.setDesignParameters(design_parameters);
return {curve_segment, alignment_segment}; return {curve_segment, alignment_segment};
@@ -254,7 +254,7 @@ std::pair<typename Schema::IfcCurveSegment, typename Schema::IfcAlignmentSegment
// creates representations for each IfcAlignmentSegment per CT 4.1.7.1.1.4 // creates representations for each IfcAlignmentSegment per CT 4.1.7.1.1.4
// https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/concepts/Product_Shape/Product_Geometric_Representation/Alignment_Geometry/Alignment_Geometry_-_Segments/content.html // https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/concepts/Product_Shape/Product_Geometric_Representation/Alignment_Geometry/Alignment_Geometry_-_Segments/content.html
void create_segment_representations(IfcHierarchyHelper<Schema>& file, const Schema::IfcLocalPlacement& global_placement, const Schema::IfcGeometricRepresentationSubContext& segment_axis_subcontext, std::vector<Schema::IfcSegment>& curve_segments, std::vector<Schema::IfcObjectDefinition>& segments) { void create_segment_representations(hierarchy_helper<Schema>& file, const Schema::IfcLocalPlacement& global_placement, const Schema::IfcGeometricRepresentationSubContext& segment_axis_subcontext, std::vector<Schema::IfcSegment>& curve_segments, std::vector<Schema::IfcObjectDefinition>& segments) {
auto cs_iter = curve_segments.begin(); auto cs_iter = curve_segments.begin();
auto s_iter = segments.begin(); auto s_iter = segments.begin();
for (; cs_iter != curve_segments.end(); cs_iter++, s_iter++) { for (; cs_iter != curve_segments.end(); cs_iter++, s_iter++) {
@@ -276,7 +276,7 @@ void create_segment_representations(IfcHierarchyHelper<Schema>& file, const Sche
} }
int main() { int main() {
IfcHierarchyHelper<Schema> file; hierarchy_helper<Schema> file;
auto project = setup_project(file); auto project = setup_project(file);
@@ -378,11 +378,11 @@ int main() {
// Create the horizontal alignment (IfcAlignmentHorizontal) and nest alignment segments // Create the horizontal alignment (IfcAlignmentHorizontal) and nest alignment segments
// //
auto horizontal_alignment = file.create<Schema::IfcAlignmentHorizontal>(); auto horizontal_alignment = file.create<Schema::IfcAlignmentHorizontal>();
horizontal_alignment.setGlobalId(IfcParse::IfcGlobalId()); horizontal_alignment.setGlobalId(ifcopenshell::global_id());
horizontal_alignment.setName("Example Alignment"); horizontal_alignment.setName("Example Alignment");
auto nests_horizontal_segments = file.create<Schema::IfcRelNests>(); auto nests_horizontal_segments = file.create<Schema::IfcRelNests>();
nests_horizontal_segments.setGlobalId(IfcParse::IfcGlobalId()); nests_horizontal_segments.setGlobalId(ifcopenshell::global_id());
nests_horizontal_segments.setName("Nests horizontal alignment segments with horizontal alignment"); nests_horizontal_segments.setName("Nests horizontal alignment segments with horizontal alignment");
nests_horizontal_segments.setRelatingObject(horizontal_alignment); nests_horizontal_segments.setRelatingObject(horizontal_alignment);
nests_horizontal_segments.setRelatedObjects(horizontal_segments); nests_horizontal_segments.setRelatedObjects(horizontal_segments);
@@ -483,11 +483,11 @@ int main() {
// Create the vertical alignment (IfcAlignmentVertical) and nest alignment segments // Create the vertical alignment (IfcAlignmentVertical) and nest alignment segments
// //
auto vertical_profile = file.create<Schema::IfcAlignmentVertical>(); auto vertical_profile = file.create<Schema::IfcAlignmentVertical>();
vertical_profile.setGlobalId(IfcParse::IfcGlobalId()); vertical_profile.setGlobalId(ifcopenshell::global_id());
vertical_profile.setName("Example Vertical Profile"); vertical_profile.setName("Example Vertical Profile");
auto nests_vertical_segments = file.create<Schema::IfcRelNests>(); auto nests_vertical_segments = file.create<Schema::IfcRelNests>();
nests_vertical_segments.setGlobalId(IfcParse::IfcGlobalId()); nests_vertical_segments.setGlobalId(ifcopenshell::global_id());
nests_vertical_segments.setName("Nests vertical alignment segments with vertical profile"); nests_vertical_segments.setName("Nests vertical alignment segments with vertical profile");
nests_vertical_segments.setRelatingObject(vertical_profile); nests_vertical_segments.setRelatingObject(vertical_profile);
nests_vertical_segments.setRelatedObjects(vertical_segments); nests_vertical_segments.setRelatedObjects(vertical_segments);
@@ -526,7 +526,7 @@ int main() {
// create the alignment // create the alignment
auto alignment = file.create<Schema::IfcAlignment>(); auto alignment = file.create<Schema::IfcAlignment>();
alignment.setGlobalId(IfcParse::IfcGlobalId()); alignment.setGlobalId(ifcopenshell::global_id());
alignment.setName("Example Alignment"); alignment.setName("Example Alignment");
alignment.setObjectPlacement(global_placement); alignment.setObjectPlacement(global_placement);
alignment.setRepresentation(alignment_product); alignment.setRepresentation(alignment_product);
@@ -535,7 +535,7 @@ int main() {
// 4.1.4.4.1 Alignments nest horizontal and vertical layouts // 4.1.4.4.1 Alignments nest horizontal and vertical layouts
// https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/concepts/Object_Composition/Nesting/Alignment_Layouts/content.html // https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/concepts/Object_Composition/Nesting/Alignment_Layouts/content.html
auto nests_alignment_layouts = file.create<Schema::IfcRelNests>(); auto nests_alignment_layouts = file.create<Schema::IfcRelNests>();
nests_alignment_layouts.setGlobalId(IfcParse::IfcGlobalId()); nests_alignment_layouts.setGlobalId(ifcopenshell::global_id());
nests_alignment_layouts.setName("Nest horizontal and vertical alignment layouts with the alignment"); nests_alignment_layouts.setName("Nest horizontal and vertical alignment layouts with the alignment");
nests_alignment_layouts.setRelatingObject(alignment); nests_alignment_layouts.setRelatingObject(alignment);
nests_alignment_layouts.setRelatedObjects({horizontal_alignment, vertical_profile}); nests_alignment_layouts.setRelatedObjects({horizontal_alignment, vertical_profile});
@@ -546,7 +546,7 @@ int main() {
// https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/concepts/Object_Composition/Aggregation/Alignment_Aggregation_To_Project/content.html // https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/concepts/Object_Composition/Aggregation/Alignment_Aggregation_To_Project/content.html
// IfcProject <-> IfcRelAggregates <-> IfcAlignment // IfcProject <-> IfcRelAggregates <-> IfcAlignment
auto aggregate_alignments_with_project = file.create<Schema::IfcRelAggregates>(); auto aggregate_alignments_with_project = file.create<Schema::IfcRelAggregates>();
aggregate_alignments_with_project.setGlobalId(IfcParse::IfcGlobalId()); aggregate_alignments_with_project.setGlobalId(ifcopenshell::global_id());
aggregate_alignments_with_project.setName("Alignments in project"); aggregate_alignments_with_project.setName("Alignments in project");
aggregate_alignments_with_project.setRelatingObject(project); aggregate_alignments_with_project.setRelatingObject(project);
aggregate_alignments_with_project.setRelatedObjects({alignment}); aggregate_alignments_with_project.setRelatedObjects({alignment});
@@ -571,7 +571,7 @@ int main() {
description << "Alignments referenced into the spatial structure of Bridge Site " << i; description << "Alignments referenced into the spatial structure of Bridge Site " << i;
auto rel_referenced_in_spatial_structure = file.create<Schema::IfcRelReferencedInSpatialStructure>(); auto rel_referenced_in_spatial_structure = file.create<Schema::IfcRelReferencedInSpatialStructure>();
rel_referenced_in_spatial_structure.setGlobalId(IfcParse::IfcGlobalId()); rel_referenced_in_spatial_structure.setGlobalId(ifcopenshell::global_id());
rel_referenced_in_spatial_structure.setDescription(description.str()); rel_referenced_in_spatial_structure.setDescription(description.str());
rel_referenced_in_spatial_structure.setRelatedElements(list_alignments_referenced_in_site); rel_referenced_in_spatial_structure.setRelatedElements(list_alignments_referenced_in_site);
rel_referenced_in_spatial_structure.setRelatingStructure(site); rel_referenced_in_spatial_structure.setRelatingStructure(site);
+5 -5
View File
@@ -38,7 +38,7 @@
#define IfcSchema Ifc2x3 #define IfcSchema Ifc2x3
#include "../ifcparse/macros.h" #include "../ifcparse/macros.h"
#include "../ifcparse/Ifc2x3.h" #include "../ifcparse/Ifc2x3.h"
#include "../ifcparse/IfcHierarchyHelper.h" #include "../ifcparse/hierarchy_helper.h"
#include "../ifcgeom/Serialization/Serialization.h" #include "../ifcgeom/Serialization/Serialization.h"
@@ -49,7 +49,7 @@
using namespace std::string_literals; using namespace std::string_literals;
// Some convenience typedefs and definitions. // Some convenience typedefs and definitions.
typedef IfcParse::IfcGlobalId guid; typedef ifcopenshell::global_id guid;
typedef std::pair<double, double> XY; typedef std::pair<double, double> XY;
boost::none_t const null = boost::none; boost::none_t const null = boost::none;
@@ -58,9 +58,9 @@ void createGroundShape(TopoDS_Shape& shape);
int main() { int main() {
// The IfcHierarchyHelper is a subclass of the regular IfcFile that provides several // The hierarchy_helper is a subclass of the regular file that provides several
// convenience functions for working with geometry in IFC files. // convenience functions for working with geometry in IFC files.
IfcHierarchyHelper<IfcSchema> file; hierarchy_helper<IfcSchema> file;
file.header().file_name().setname("IfcOpenHouse.ifc"); file.header().file_name().setname("IfcOpenHouse.ifc");
// Start by adding a wall to the file, initially leaving most attributes blank. // Start by adding a wall to the file, initially leaving most attributes blank.
@@ -327,7 +327,7 @@ int main() {
for (auto& rep : ground_reps) { for (auto& rep : ground_reps) {
rep.setContextOfItems(file.getRepresentationContext("Model")); rep.setContextOfItems(file.getRepresentationContext("Model"));
} }
file.addEntity(ground_representation); file.add_entity(ground_representation);
setSurfaceColour(file,ground_representation, 0.15, 0.25, 0.05); setSurfaceColour(file,ground_representation, 0.15, 0.25, 0.05);
// According to the Ifc2x3 schema an IfcWallStandardCase needs to have an IfcMaterialLayerSet // According to the Ifc2x3 schema an IfcWallStandardCase needs to have an IfcMaterialLayerSet
+13 -13
View File
@@ -1,4 +1,4 @@
/******************************************************************************** /********************************************************************************
* * * *
* This file is part of IfcOpenShell. * * This file is part of IfcOpenShell. *
* * * *
@@ -20,8 +20,8 @@
// TODO: Multiple schemas // TODO: Multiple schemas
#define IfcSchema Ifc2x3 #define IfcSchema Ifc2x3
#include "../ifcparse/IfcFile.h" #include "../ifcparse/file.h"
#include "../ifcparse/IfcLogger.h" #include "../ifcparse/logger.h"
#include "../ifcparse/Ifc2x3.h" #include "../ifcparse/Ifc2x3.h"
#include <boost/preprocessor/stringize.hpp> #include <boost/preprocessor/stringize.hpp>
@@ -80,7 +80,7 @@ struct is_ifc4_or_higher<T, std::void_t<decltype(T::IfcMaterialDefinition)>> : s
typedef std::map<std::string, std::map<std::string, std::string>> element_properties; typedef std::map<std::string, std::map<std::string, std::string>> element_properties;
std::string format_string(const AttributeValue& argument) { std::string format_string(const attribute_value& argument) {
// Argument is a runtime tagged variant for the various data types in a IFC model, // Argument is a runtime tagged variant for the various data types in a IFC model,
// in this particular case we only care about flattening it to a string. // in this particular case we only care about flattening it to a string.
// @todo mostly duplicated from XmlSerializer.cpp // @todo mostly duplicated from XmlSerializer.cpp
@@ -89,21 +89,21 @@ std::string format_string(const AttributeValue& argument) {
} }
auto argument_type = argument.type(); auto argument_type = argument.type();
switch (argument_type) { switch (argument_type) {
case IfcUtil::Argument_BOOL: { case ifcopenshell::Argument_BOOL: {
const bool b = argument; const bool b = argument;
return b ? "true" : "false"; return b ? "true" : "false";
} }
case IfcUtil::Argument_DOUBLE: { case ifcopenshell::Argument_DOUBLE: {
const double d = argument; const double d = argument;
std::stringstream stream; std::stringstream stream;
stream << std::setprecision(std::numeric_limits< double >::max_digits10) << d; stream << std::setprecision(std::numeric_limits< double >::max_digits10) << d;
return stream.str(); return stream.str();
break; } break; }
case IfcUtil::Argument_STRING: case ifcopenshell::Argument_STRING:
case IfcUtil::Argument_ENUMERATION: { case ifcopenshell::Argument_ENUMERATION: {
return static_cast<std::string>(argument); return static_cast<std::string>(argument);
break; } break; }
case IfcUtil::Argument_INT: { case ifcopenshell::Argument_INT: {
const int v = argument; const int v = argument;
std::stringstream stream; std::stringstream stream;
stream << v; stream << v;
@@ -147,7 +147,7 @@ void process_pset(element_properties& props, const T& inst) {
} }
auto qs = qset.Quantities(); auto qs = qset.Quantities();
for (auto& q : qs) { for (auto& q : qs) {
if (q.template as<typename Schema::IfcPhysicalSimpleQuantity>() && q.get_attribute_value(3).type() == IfcUtil::Argument_DOUBLE) { if (q.template as<typename Schema::IfcPhysicalSimpleQuantity>() && q.get_attribute_value(3).type() == ifcopenshell::Argument_DOUBLE) {
double v = q.get_attribute_value(3); double v = q.get_attribute_value(3);
props[*qset.Name()][q.Name()] = std::to_string(v); props[*qset.Name()][q.Name()] = std::to_string(v);
} }
@@ -227,10 +227,10 @@ int main(int argc, char** argv) {
} }
// Redirect the output (both progress and log) to stdout // Redirect the output (both progress and log) to stdout
Logger::SetOutput(&std::cout, &std::cout); logger::set_output(&std::cout, &std::cout);
// Parse the IFC file provided in argv[1] // Parse the IFC file provided in argv[1]
IfcParse::IfcFile file(argv[1]); ifcopenshell::file file(argv[1]);
if (!file.good()) { if (!file.good()) {
std::cout << "Unable to parse .ifc file" << std::endl; std::cout << "Unable to parse .ifc file" << std::endl;
return 1; return 1;
@@ -257,7 +257,7 @@ int main(int argc, char** argv) {
std::cout << "Found " << elements.size() << " elements in " << argv[1] << ":" << std::endl; std::cout << "Found " << elements.size() << " elements in " << argv[1] << ":" << std::endl;
for (auto& element : elements) { for (auto& element : elements) {
element.toString(std::cout); element.to_string(std::cout);
std::cout << std::endl; std::cout << std::endl;
if (auto window = element.as<IfcSchema::IfcWindow>()) { if (auto window = element.as<IfcSchema::IfcWindow>()) {
+5 -5
View File
@@ -31,7 +31,7 @@
#pragma warning(disable : 4018 4267 4250 4984 4985) #pragma warning(disable : 4018 4267 4250 4984 4985)
#include "../ifcparse/Ifc4x3_add2.h" #include "../ifcparse/Ifc4x3_add2.h"
#include "../ifcparse/IfcAlignmentHelper.h" #include "../ifcparse/alignment_helper.h"
#include <fstream> #include <fstream>
@@ -39,7 +39,7 @@
// performs basic project setup including created the IfcProject object // performs basic project setup including created the IfcProject object
// and initializing the project units to FEET // and initializing the project units to FEET
Schema::IfcProject setup_project(IfcHierarchyHelper<Schema>& file) { Schema::IfcProject setup_project(hierarchy_helper<Schema>& file) {
std::vector<std::string> file_description; std::vector<std::string> file_description;
file_description.push_back("ViewDefinition[Alignment-basedReferenceView]"); file_description.push_back("ViewDefinition[Alignment-basedReferenceView]");
file.header().file_description().setdescription(file_description); file.header().file_description().setdescription(file_description);
@@ -91,7 +91,7 @@ Schema::IfcProject setup_project(IfcHierarchyHelper<Schema>& file) {
} }
int main() { int main() {
IfcHierarchyHelper<Schema> file; hierarchy_helper<Schema> file;
auto project = setup_project(file); auto project = setup_project(file);
@@ -142,7 +142,7 @@ int main() {
// https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/concepts/Object_Composition/Aggregation/Alignment_Aggregation_To_Project/content.html // https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/concepts/Object_Composition/Aggregation/Alignment_Aggregation_To_Project/content.html
// IfcProject <-> IfcRelAggregates <-> IfcAlignment // IfcProject <-> IfcRelAggregates <-> IfcAlignment
auto aggregate_alignments_with_project = file.create<Schema::IfcRelAggregates>(); auto aggregate_alignments_with_project = file.create<Schema::IfcRelAggregates>();
aggregate_alignments_with_project.setGlobalId(IfcParse::IfcGlobalId()); aggregate_alignments_with_project.setGlobalId(ifcopenshell::global_id());
aggregate_alignments_with_project.setName("Alignments in project"); aggregate_alignments_with_project.setName("Alignments in project");
aggregate_alignments_with_project.setRelatingObject(project); aggregate_alignments_with_project.setRelatingObject(project);
aggregate_alignments_with_project.setRelatedObjects({alignment}); aggregate_alignments_with_project.setRelatedObjects({alignment});
@@ -165,7 +165,7 @@ int main() {
description << "Alignments referenced into the spatial structure of Bridge Site " << i; description << "Alignments referenced into the spatial structure of Bridge Site " << i;
auto rel_referenced_in_spatial_structure = file.create<Schema::IfcRelReferencedInSpatialStructure>(); auto rel_referenced_in_spatial_structure = file.create<Schema::IfcRelReferencedInSpatialStructure>();
rel_referenced_in_spatial_structure.setGlobalId(IfcParse::IfcGlobalId()); rel_referenced_in_spatial_structure.setGlobalId(ifcopenshell::global_id());
rel_referenced_in_spatial_structure.setDescription(description.str()); rel_referenced_in_spatial_structure.setDescription(description.str());
rel_referenced_in_spatial_structure.setRelatedElements(std::vector<Schema::IfcSpatialReferenceSelect>{alignment}); rel_referenced_in_spatial_structure.setRelatedElements(std::vector<Schema::IfcSpatialReferenceSelect>{alignment});
rel_referenced_in_spatial_structure.setRelatingStructure(site); rel_referenced_in_spatial_structure.setRelatingStructure(site);
+22 -22
View File
@@ -30,14 +30,14 @@
#include "../ifcparse/Ifc2x3.h" #include "../ifcparse/Ifc2x3.h"
#include "../ifcparse/IfcUtil.h" #include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcHierarchyHelper.h" #include "../ifcparse/hierarchy_helper.h"
typedef std::string S; typedef std::string S;
typedef IfcParse::IfcGlobalId guid; typedef ifcopenshell::global_id guid;
boost::none_t const null = boost::none; boost::none_t const null = boost::none;
static int i = 0; static int i = 0;
void create_product_from_item(IfcHierarchyHelper& file, IfcSchema::IfcRepresentationItem* item, const std::string& s) { void create_product_from_item(hierarchy_helper& file, IfcSchema::IfcRepresentationItem* item, const std::string& s) {
IfcSchema::IfcBuildingElementProxy* product = new IfcSchema::IfcBuildingElementProxy( IfcSchema::IfcBuildingElementProxy* product = new IfcSchema::IfcBuildingElementProxy(
guid(), 0, S("product"), null, null, 0, 0, null, null); guid(), 0, S("product"), null, null, 0, 0, null, null);
file.addBuildingProduct(product); file.addBuildingProduct(product);
@@ -51,7 +51,7 @@ void create_product_from_item(IfcHierarchyHelper& file, IfcSchema::IfcRepresenta
if (s == "GeometricSet") { if (s == "GeometricSet") {
IfcSchema::IfcGeometricSet* set = new IfcSchema::IfcGeometricSet(items->generalize()); IfcSchema::IfcGeometricSet* set = new IfcSchema::IfcGeometricSet(items->generalize());
file.addEntity(set); file.add_entity(set);
items = IfcSchema::IfcRepresentationItem::list::ptr(new IfcSchema::IfcRepresentationItem::list()); items = IfcSchema::IfcRepresentationItem::list::ptr(new IfcSchema::IfcRepresentationItem::list());
items->push(set); items->push(set);
} }
@@ -61,46 +61,46 @@ void create_product_from_item(IfcHierarchyHelper& file, IfcSchema::IfcRepresenta
reps->push(rep); reps->push(rep);
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(boost::none, boost::none, reps); IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(boost::none, boost::none, reps);
file.addEntity(rep); file.add_entity(rep);
file.addEntity(shape); file.add_entity(shape);
product->setRepresentation(shape); product->setRepresentation(shape);
} }
void create_surfaces_from_profile(IfcHierarchyHelper& file, IfcSchema::IfcProfileDef* profile) { void create_surfaces_from_profile(hierarchy_helper& file, IfcSchema::IfcProfileDef* profile) {
IfcSchema::IfcSurfaceOfLinearExtrusion* extrusion = new IfcSchema::IfcSurfaceOfLinearExtrusion(profile, file.addPlacement3d(), file.addTriplet<IfcSchema::IfcDirection>(0, 0, 1), 100.); IfcSchema::IfcSurfaceOfLinearExtrusion* extrusion = new IfcSchema::IfcSurfaceOfLinearExtrusion(profile, file.addPlacement3d(), file.addTriplet<IfcSchema::IfcDirection>(0, 0, 1), 100.);
file.addEntity(extrusion); file.add_entity(extrusion);
IfcSchema::IfcAxis1Placement* ax1 = new IfcSchema::IfcAxis1Placement(file.addTriplet<IfcSchema::IfcCartesianPoint>(0,100,0), file.addTriplet<IfcSchema::IfcDirection>(1,0,0)); IfcSchema::IfcAxis1Placement* ax1 = new IfcSchema::IfcAxis1Placement(file.addTriplet<IfcSchema::IfcCartesianPoint>(0,100,0), file.addTriplet<IfcSchema::IfcDirection>(1,0,0));
IfcSchema::IfcSurfaceOfRevolution* revolution = new IfcSchema::IfcSurfaceOfRevolution(profile, file.addPlacement3d(), ax1); IfcSchema::IfcSurfaceOfRevolution* revolution = new IfcSchema::IfcSurfaceOfRevolution(profile, file.addPlacement3d(), ax1);
file.addEntity(ax1); file.add_entity(ax1);
file.addEntity(revolution); file.add_entity(revolution);
create_product_from_item(file, extrusion, "GeometricSet"); create_product_from_item(file, extrusion, "GeometricSet");
create_product_from_item(file, revolution, "GeometricSet"); create_product_from_item(file, revolution, "GeometricSet");
} }
void create_solids_from_profile(IfcHierarchyHelper& file, IfcSchema::IfcProfileDef* profile) { void create_solids_from_profile(hierarchy_helper& file, IfcSchema::IfcProfileDef* profile) {
IfcSchema::IfcExtrudedAreaSolid* extrusion = new IfcSchema::IfcExtrudedAreaSolid(profile, file.addPlacement3d(), file.addTriplet<IfcSchema::IfcDirection>(0, 0, 1), 100.); IfcSchema::IfcExtrudedAreaSolid* extrusion = new IfcSchema::IfcExtrudedAreaSolid(profile, file.addPlacement3d(), file.addTriplet<IfcSchema::IfcDirection>(0, 0, 1), 100.);
file.addEntity(extrusion); file.add_entity(extrusion);
IfcSchema::IfcAxis1Placement* ax1 = new IfcSchema::IfcAxis1Placement(file.addTriplet<IfcSchema::IfcCartesianPoint>(0,100,0), file.addTriplet<IfcSchema::IfcDirection>(1,0,0)); IfcSchema::IfcAxis1Placement* ax1 = new IfcSchema::IfcAxis1Placement(file.addTriplet<IfcSchema::IfcCartesianPoint>(0,100,0), file.addTriplet<IfcSchema::IfcDirection>(1,0,0));
IfcSchema::IfcRevolvedAreaSolid* revolution1 = new IfcSchema::IfcRevolvedAreaSolid(profile, file.addPlacement3d(), ax1, 360.); IfcSchema::IfcRevolvedAreaSolid* revolution1 = new IfcSchema::IfcRevolvedAreaSolid(profile, file.addPlacement3d(), ax1, 360.);
IfcSchema::IfcRevolvedAreaSolid* revolution2 = new IfcSchema::IfcRevolvedAreaSolid(profile, file.addPlacement3d(), ax1, 90.); IfcSchema::IfcRevolvedAreaSolid* revolution2 = new IfcSchema::IfcRevolvedAreaSolid(profile, file.addPlacement3d(), ax1, 90.);
file.addEntity(ax1); file.add_entity(ax1);
file.addEntity(revolution1); file.add_entity(revolution1);
file.addEntity(revolution2); file.add_entity(revolution2);
create_product_from_item(file, extrusion, "SweptSolid"); create_product_from_item(file, extrusion, "SweptSolid");
create_product_from_item(file, revolution1, "SweptSolid"); create_product_from_item(file, revolution1, "SweptSolid");
create_product_from_item(file, revolution2, "SweptSolid"); create_product_from_item(file, revolution2, "SweptSolid");
} }
void create_products_from_curve(IfcHierarchyHelper& file, IfcSchema::IfcBoundedCurve* curve) { void create_products_from_curve(hierarchy_helper& file, IfcSchema::IfcBoundedCurve* curve) {
IfcSchema::IfcArbitraryOpenProfileDef* open = new IfcSchema::IfcArbitraryOpenProfileDef(IfcSchema::IfcProfileTypeEnum::IfcProfileType_CURVE, null, curve); IfcSchema::IfcArbitraryOpenProfileDef* open = new IfcSchema::IfcArbitraryOpenProfileDef(IfcSchema::IfcProfileTypeEnum::IfcProfileType_CURVE, null, curve);
IfcSchema::IfcCenterLineProfileDef* center_line = new IfcSchema::IfcCenterLineProfileDef(IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, null, curve, 10.); IfcSchema::IfcCenterLineProfileDef* center_line = new IfcSchema::IfcCenterLineProfileDef(IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, null, curve, 10.);
file.addEntity(open); file.add_entity(open);
file.addEntity(center_line); file.add_entity(center_line);
create_surfaces_from_profile(file, open); create_surfaces_from_profile(file, open);
create_solids_from_profile(file, center_line); create_solids_from_profile(file, center_line);
@@ -108,7 +108,7 @@ void create_products_from_curve(IfcHierarchyHelper& file, IfcSchema::IfcBoundedC
int main(int argc, char** argv) { int main(int argc, char** argv) {
const char filename[] = "IfcArbitraryOpenProfileDef.ifc"; const char filename[] = "IfcArbitraryOpenProfileDef.ifc";
IfcHierarchyHelper file; hierarchy_helper file;
file.header().file_name().name(filename); file.header().file_name().name(filename);
double coords1[] = {-50.0, 0.0}; double coords1[] = {-50.0, 0.0};
@@ -118,18 +118,18 @@ int main(int argc, char** argv) {
points->push(new IfcSchema::IfcCartesianPoint(std::vector<double>(coords2, coords2+2))); points->push(new IfcSchema::IfcCartesianPoint(std::vector<double>(coords2, coords2+2)));
file.addEntities(points->generalize()); file.addEntities(points->generalize());
IfcSchema::IfcPolyline* poly = new IfcSchema::IfcPolyline(points); IfcSchema::IfcPolyline* poly = new IfcSchema::IfcPolyline(points);
file.addEntity(poly); file.add_entity(poly);
create_products_from_curve(file, poly); create_products_from_curve(file, poly);
IfcSchema::IfcEllipse* ellipse = new IfcSchema::IfcEllipse(file.addPlacement2d(), 50., 25.); IfcSchema::IfcEllipse* ellipse = new IfcSchema::IfcEllipse(file.addPlacement2d(), 50., 25.);
file.addEntity(ellipse); file.add_entity(ellipse);
IfcEntityList::ptr trim1(new IfcEntityList); IfcEntityList::ptr trim1(new IfcEntityList);
IfcEntityList::ptr trim2(new IfcEntityList); IfcEntityList::ptr trim2(new IfcEntityList);
trim1->push(new IfcSchema::IfcParameterValue( 0.)); trim1->push(new IfcSchema::IfcParameterValue( 0.));
trim2->push(new IfcSchema::IfcParameterValue(180.)); trim2->push(new IfcSchema::IfcParameterValue(180.));
IfcSchema::IfcTrimmedCurve* trim = new IfcSchema::IfcTrimmedCurve(ellipse, trim1, trim2, true, IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER); IfcSchema::IfcTrimmedCurve* trim = new IfcSchema::IfcTrimmedCurve(ellipse, trim1, trim2, true, IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER);
file.addEntity(trim); file.add_entity(trim);
create_products_from_curve(file, trim); create_products_from_curve(file, trim);
+11 -11
View File
@@ -29,15 +29,15 @@
#include "../ifcparse/Ifc2x3.h" #include "../ifcparse/Ifc2x3.h"
#include "../ifcparse/IfcUtil.h" #include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcHierarchyHelper.h" #include "../ifcparse/hierarchy_helper.h"
typedef std::string S; typedef std::string S;
typedef IfcParse::IfcGlobalId guid; typedef ifcopenshell::global_id guid;
boost::none_t const null = boost::none; boost::none_t const null = boost::none;
int main(int argc, char** argv) { int main(int argc, char** argv) {
const char filename[] = "IfcCompositeProfileDef.ifc"; const char filename[] = "IfcCompositeProfileDef.ifc";
IfcHierarchyHelper file; hierarchy_helper file;
file.header().file_name().name(filename); file.header().file_name().name(filename);
double coords1[] = {100.0, 0.0}; double coords1[] = {100.0, 0.0};
@@ -65,11 +65,11 @@ int main(int argc, char** argv) {
IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
null, file.addPlacement2d(80.), 50.0, 25.0, 5.0, 10.0, 2.0, null); null, file.addPlacement2d(80.), 50.0, 25.0, 5.0, 10.0, 2.0, null);
file.addEntity(p2); file.add_entity(p2);
file.addEntity(p3); file.add_entity(p3);
file.addEntity(transform1); file.add_entity(transform1);
file.addEntity(transform2); file.add_entity(transform2);
IfcSchema::IfcDerivedProfileDef* p5 = new IfcSchema::IfcDerivedProfileDef(IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, null, p2, transform1, null); IfcSchema::IfcDerivedProfileDef* p5 = new IfcSchema::IfcDerivedProfileDef(IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, null, p2, transform1, null);
IfcSchema::IfcDerivedProfileDef* p6 = new IfcSchema::IfcDerivedProfileDef(IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, null, p3, transform2, null); IfcSchema::IfcDerivedProfileDef* p6 = new IfcSchema::IfcDerivedProfileDef(IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, null, p3, transform2, null);
@@ -95,8 +95,8 @@ int main(int argc, char** argv) {
IfcSchema::IfcExtrudedAreaSolid* solid = new IfcSchema::IfcExtrudedAreaSolid(composite, IfcSchema::IfcExtrudedAreaSolid* solid = new IfcSchema::IfcExtrudedAreaSolid(composite,
file.addPlacement3d(), file.addTriplet<IfcSchema::IfcDirection>(0, 0, 1), 20.0); file.addPlacement3d(), file.addTriplet<IfcSchema::IfcDirection>(0, 0, 1), 20.0);
file.addEntity(composite); file.add_entity(composite);
file.addEntity(solid); file.add_entity(solid);
IfcSchema::IfcRepresentation::list::ptr reps (new IfcSchema::IfcRepresentation::list()); IfcSchema::IfcRepresentation::list::ptr reps (new IfcSchema::IfcRepresentation::list());
IfcSchema::IfcRepresentationItem::list::ptr items (new IfcSchema::IfcRepresentationItem::list()); IfcSchema::IfcRepresentationItem::list::ptr items (new IfcSchema::IfcRepresentationItem::list());
@@ -107,8 +107,8 @@ int main(int argc, char** argv) {
reps->push(rep); reps->push(rep);
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(boost::none, boost::none, reps); IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(boost::none, boost::none, reps);
file.addEntity(rep); file.add_entity(rep);
file.addEntity(shape); file.add_entity(shape);
product->setRepresentation(shape); product->setRepresentation(shape);
+7 -7
View File
@@ -29,10 +29,10 @@
#include "../ifcparse/Ifc2x3.h" #include "../ifcparse/Ifc2x3.h"
#include "../ifcparse/IfcUtil.h" #include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcHierarchyHelper.h" #include "../ifcparse/hierarchy_helper.h"
typedef std::string S; typedef std::string S;
typedef IfcParse::IfcGlobalId guid; typedef ifcopenshell::global_id guid;
boost::none_t const null = boost::none; boost::none_t const null = boost::none;
class Node { class Node {
@@ -101,7 +101,7 @@ public:
return operate(OP_INTERSECT, p); return operate(OP_INTERSECT, p);
} }
IfcSchema::IfcRepresentationItem* serialize(IfcHierarchyHelper& file) const { IfcSchema::IfcRepresentationItem* serialize(hierarchy_helper& file) const {
IfcSchema::IfcRepresentationItem* my; IfcSchema::IfcRepresentationItem* my;
if (op == OP_TERMINAL) { if (op == OP_TERMINAL) {
IfcSchema::IfcAxis2Placement3D* place = file.addPlacement3d(x,y,z,zx,zy,zz,xx,xy,xz); IfcSchema::IfcAxis2Placement3D* place = file.addPlacement3d(x,y,z,zx,zy,zz,xx,xy,xz);
@@ -127,14 +127,14 @@ public:
} }
my = new IfcSchema::IfcBooleanResult(o, left->serialize(file), right->serialize(file)); my = new IfcSchema::IfcBooleanResult(o, left->serialize(file), right->serialize(file));
} }
file.addEntity(my); file.add_entity(my);
return my; return my;
} }
}; };
int main(int argc, char** argv) { int main(int argc, char** argv) {
const char filename[] = "IfcCsgPrimitive.ifc"; const char filename[] = "IfcCsgPrimitive.ifc";
IfcHierarchyHelper file; hierarchy_helper file;
file.header().file_name().name(filename); file.header().file_name().name(filename);
IfcSchema::IfcRepresentationItem* csg1 = Node::Box(8000.,6000.,3000.).subtract( IfcSchema::IfcRepresentationItem* csg1 = Node::Box(8000.,6000.,3000.).subtract(
@@ -181,8 +181,8 @@ int main(int argc, char** argv) {
reps->push(rep); reps->push(rep);
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(null, null, reps); IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(null, null, reps);
file.addEntity(rep); file.add_entity(rep);
file.addEntity(shape); file.add_entity(shape);
product->setRepresentation(shape); product->setRepresentation(shape);
+12 -12
View File
@@ -29,10 +29,10 @@
#include "../ifcparse/Ifc2x3.h" #include "../ifcparse/Ifc2x3.h"
#include "../ifcparse/IfcUtil.h" #include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcHierarchyHelper.h" #include "../ifcparse/hierarchy_helper.h"
typedef std::string S; typedef std::string S;
typedef IfcParse::IfcGlobalId guid; typedef ifcopenshell::global_id guid;
boost::none_t const null = boost::none; boost::none_t const null = boost::none;
typedef struct { typedef struct {
@@ -44,7 +44,7 @@ typedef struct {
static int i = 0; static int i = 0;
void create_testcase_for(IfcHierarchyHelper& file, const EllipsePie& pie, Ifc2x3::IfcTrimmingPreference::IfcTrimmingPreference pref) { void create_testcase_for(hierarchy_helper& file, const EllipsePie& pie, Ifc2x3::IfcTrimmingPreference::IfcTrimmingPreference pref) {
const double deg = 1. / 180. * 3.141592653; const double deg = 1. / 180. * 3.141592653;
double flt1[] = {0. , 0. }; double flt1[] = {0. , 0. };
double flt2[] = {pie.r1 * cos(pie.t1*deg), pie.r2 * sin(pie.t1*deg)}; double flt2[] = {pie.r1 * cos(pie.t1*deg), pie.r2 * sin(pie.t1*deg)};
@@ -66,7 +66,7 @@ void create_testcase_for(IfcHierarchyHelper& file, const EllipsePie& pie, Ifc2x3
Ifc2x3::IfcEllipse* ellipse = new Ifc2x3::IfcEllipse(file.addPlacement2d(), pie.r1, pie.r2); Ifc2x3::IfcEllipse* ellipse = new Ifc2x3::IfcEllipse(file.addPlacement2d(), pie.r1, pie.r2);
file.addEntity(ellipse); file.add_entity(ellipse);
IfcEntityList::ptr trim1(new IfcEntityList); IfcEntityList::ptr trim1(new IfcEntityList);
IfcEntityList::ptr trim2(new IfcEntityList); IfcEntityList::ptr trim2(new IfcEntityList);
if (pref == Ifc2x3::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER) { if (pref == Ifc2x3::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER) {
@@ -77,13 +77,13 @@ void create_testcase_for(IfcHierarchyHelper& file, const EllipsePie& pie, Ifc2x3
trim2->push(p3); trim2->push(p3);
} }
Ifc2x3::IfcTrimmedCurve* trim = new Ifc2x3::IfcTrimmedCurve(ellipse, trim1, trim2, true, pref); Ifc2x3::IfcTrimmedCurve* trim = new Ifc2x3::IfcTrimmedCurve(ellipse, trim1, trim2, true, pref);
file.addEntity(trim); file.add_entity(trim);
Ifc2x3::IfcCompositeCurveSegment::list::ptr segments(new Ifc2x3::IfcCompositeCurveSegment::list()); Ifc2x3::IfcCompositeCurveSegment::list::ptr segments(new Ifc2x3::IfcCompositeCurveSegment::list());
Ifc2x3::IfcCompositeCurveSegment* s2 = new Ifc2x3::IfcCompositeCurveSegment(Ifc2x3::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, trim); Ifc2x3::IfcCompositeCurveSegment* s2 = new Ifc2x3::IfcCompositeCurveSegment(Ifc2x3::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, trim);
Ifc2x3::IfcPolyline* poly = new Ifc2x3::IfcPolyline(points); Ifc2x3::IfcPolyline* poly = new Ifc2x3::IfcPolyline(points);
file.addEntity(poly); file.add_entity(poly);
Ifc2x3::IfcCompositeCurveSegment* s1 = new Ifc2x3::IfcCompositeCurveSegment(Ifc2x3::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, poly); Ifc2x3::IfcCompositeCurveSegment* s1 = new Ifc2x3::IfcCompositeCurveSegment(Ifc2x3::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, poly);
segments->push(s1); segments->push(s1);
@@ -92,8 +92,8 @@ void create_testcase_for(IfcHierarchyHelper& file, const EllipsePie& pie, Ifc2x3
Ifc2x3::IfcCompositeCurve* ccurve = new Ifc2x3::IfcCompositeCurve(segments, false); Ifc2x3::IfcCompositeCurve* ccurve = new Ifc2x3::IfcCompositeCurve(segments, false);
Ifc2x3::IfcArbitraryClosedProfileDef* profile = new Ifc2x3::IfcArbitraryClosedProfileDef(Ifc2x3::IfcProfileTypeEnum::IfcProfileType_AREA, null, ccurve); Ifc2x3::IfcArbitraryClosedProfileDef* profile = new Ifc2x3::IfcArbitraryClosedProfileDef(Ifc2x3::IfcProfileTypeEnum::IfcProfileType_AREA, null, ccurve);
file.addEntity(ccurve); file.add_entity(ccurve);
file.addEntity(profile); file.add_entity(profile);
IfcSchema::IfcBuildingElementProxy* product = new IfcSchema::IfcBuildingElementProxy( IfcSchema::IfcBuildingElementProxy* product = new IfcSchema::IfcBuildingElementProxy(
guid(), 0, S("profile"), null, null, 0, 0, null, null); guid(), 0, S("profile"), null, null, 0, 0, null, null);
@@ -105,7 +105,7 @@ void create_testcase_for(IfcHierarchyHelper& file, const EllipsePie& pie, Ifc2x3
IfcSchema::IfcExtrudedAreaSolid* solid = new IfcSchema::IfcExtrudedAreaSolid(profile, IfcSchema::IfcExtrudedAreaSolid* solid = new IfcSchema::IfcExtrudedAreaSolid(profile,
file.addPlacement3d(), file.addTriplet<IfcSchema::IfcDirection>(0, 0, 1), 20.0); file.addPlacement3d(), file.addTriplet<IfcSchema::IfcDirection>(0, 0, 1), 20.0);
file.addEntity(solid); file.add_entity(solid);
IfcSchema::IfcRepresentation::list::ptr reps (new IfcSchema::IfcRepresentation::list()); IfcSchema::IfcRepresentation::list::ptr reps (new IfcSchema::IfcRepresentation::list());
IfcSchema::IfcRepresentationItem::list::ptr items (new IfcSchema::IfcRepresentationItem::list()); IfcSchema::IfcRepresentationItem::list::ptr items (new IfcSchema::IfcRepresentationItem::list());
@@ -116,15 +116,15 @@ void create_testcase_for(IfcHierarchyHelper& file, const EllipsePie& pie, Ifc2x3
reps->push(rep); reps->push(rep);
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(boost::none, boost::none, reps); IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(boost::none, boost::none, reps);
file.addEntity(rep); file.add_entity(rep);
file.addEntity(shape); file.add_entity(shape);
product->setRepresentation(shape); product->setRepresentation(shape);
} }
int main(int argc, char** argv) { int main(int argc, char** argv) {
const std::string filename = "ellipse_pies.ifc"; const std::string filename = "ellipse_pies.ifc";
IfcHierarchyHelper file; hierarchy_helper file;
{ EllipsePie pie = {80., 50., 0., 150.}; { EllipsePie pie = {80., 50., 0., 150.};
create_testcase_for(file, pie, Ifc2x3::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER); create_testcase_for(file, pie, Ifc2x3::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER);
create_testcase_for(file, pie, Ifc2x3::IfcTrimmingPreference::IfcTrimmingPreference_CARTESIAN);} create_testcase_for(file, pie, Ifc2x3::IfcTrimmingPreference::IfcTrimmingPreference_CARTESIAN);}
+5 -5
View File
@@ -25,15 +25,15 @@
#include "../ifcparse/Ifc2x3.h" #include "../ifcparse/Ifc2x3.h"
#include "../ifcparse/IfcUtil.h" #include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcHierarchyHelper.h" #include "../ifcparse/hierarchy_helper.h"
typedef std::string S; typedef std::string S;
typedef IfcParse::IfcGlobalId guid; typedef ifcopenshell::global_id guid;
boost::none_t const null = (static_cast<boost::none_t>(0)); boost::none_t const null = (static_cast<boost::none_t>(0));
static int x = 0; static int x = 0;
void create_testcase(IfcHierarchyHelper& file, IfcSchema::IfcFace* face, const std::string& name) { void create_testcase(hierarchy_helper& file, IfcSchema::IfcFace* face, const std::string& name) {
IfcSchema::IfcFace::list::ptr faces(new IfcSchema::IfcFace::list); IfcSchema::IfcFace::list::ptr faces(new IfcSchema::IfcFace::list);
faces->push(face); faces->push(face);
IfcSchema::IfcOpenShell* shell = new IfcSchema::IfcOpenShell(faces); IfcSchema::IfcOpenShell* shell = new IfcSchema::IfcOpenShell(faces);
@@ -58,13 +58,13 @@ void create_testcase(IfcHierarchyHelper& file, IfcSchema::IfcFace* face, const s
reps->push(rep); reps->push(rep);
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(0, 0, reps); IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(0, 0, reps);
file.addEntity(shape); file.add_entity(shape);
product->setRepresentation(shape); product->setRepresentation(shape);
} }
int main(int argc, char** argv) { int main(int argc, char** argv) {
IfcHierarchyHelper file; hierarchy_helper file;
{ {
IfcSchema::IfcCartesianPoint::list::ptr points (new IfcSchema::IfcCartesianPoint::list); IfcSchema::IfcCartesianPoint::list::ptr points (new IfcSchema::IfcCartesianPoint::list);
points->push(file.addTriplet<IfcSchema::IfcCartesianPoint>(-400, -400, 0)); points->push(file.addTriplet<IfcSchema::IfcCartesianPoint>(-400, -400, 0));
+14 -14
View File
@@ -29,14 +29,14 @@
#include "ifcparse\Ifc2x3.h" #include "ifcparse\Ifc2x3.h"
#include "ifcparse\IfcUtil.h" #include "ifcparse\IfcUtil.h"
#include "ifcparse\IfcHierarchyHelper.h" #include "ifcparse\hierarchy_helper.h"
#include "ifcgeom\IfcGeom.h" #include "ifcgeom\IfcGeom.h"
typedef std::string S; typedef std::string S;
typedef IfcParse::IfcGlobalId guid; typedef ifcopenshell::global_id guid;
boost::none_t const null = boost::none; boost::none_t const null = boost::none;
void create_curve_rebar(IfcHierarchyHelper& file) void create_curve_rebar(hierarchy_helper& file)
{ {
int dia = 24; int dia = 24;
int R = 3 * dia; int R = 3 * dia;
@@ -71,17 +71,17 @@ void create_curve_rebar(IfcHierarchyHelper& file)
points1->push(p2); points1->push(p2);
file.addEntities(points1->generalize()); file.addEntities(points1->generalize());
IfcSchema::IfcPolyline* poly1 = new IfcSchema::IfcPolyline(points1); IfcSchema::IfcPolyline* poly1 = new IfcSchema::IfcPolyline(points1);
file.addEntity(poly1); file.add_entity(poly1);
IfcSchema::IfcCompositeCurveSegment* segment1 = new IfcSchema::IfcCompositeCurveSegment(IfcSchema::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, poly1); IfcSchema::IfcCompositeCurveSegment* segment1 = new IfcSchema::IfcCompositeCurveSegment(IfcSchema::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, poly1);
file.addEntity(segment1); file.add_entity(segment1);
segments->push(segment1); segments->push(segment1);
/*second segment - arc */ /*second segment - arc */
IfcSchema::IfcAxis2Placement3D* axis1 = new IfcSchema::IfcAxis2Placement3D(p3, file.addTriplet<IfcSchema::IfcDirection>(1, 0, 0), file.addTriplet<IfcSchema::IfcDirection>(0, 1, 0)); IfcSchema::IfcAxis2Placement3D* axis1 = new IfcSchema::IfcAxis2Placement3D(p3, file.addTriplet<IfcSchema::IfcDirection>(1, 0, 0), file.addTriplet<IfcSchema::IfcDirection>(0, 1, 0));
file.addEntity(axis1); file.add_entity(axis1);
IfcSchema::IfcCircle* circle = new IfcSchema::IfcCircle(axis1, R); IfcSchema::IfcCircle* circle = new IfcSchema::IfcCircle(axis1, R);
file.addEntity(circle); file.add_entity(circle);
IfcEntityList::ptr trim1(new IfcEntityList); IfcEntityList::ptr trim1(new IfcEntityList);
IfcEntityList::ptr trim2(new IfcEntityList); IfcEntityList::ptr trim2(new IfcEntityList);
@@ -92,10 +92,10 @@ void create_curve_rebar(IfcHierarchyHelper& file)
trim2->push(new IfcSchema::IfcParameterValue(270)); trim2->push(new IfcSchema::IfcParameterValue(270));
trim2->push(p4); trim2->push(p4);
IfcSchema::IfcTrimmedCurve* trimmed_curve = new IfcSchema::IfcTrimmedCurve(circle, trim1, trim2, false, IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER); IfcSchema::IfcTrimmedCurve* trimmed_curve = new IfcSchema::IfcTrimmedCurve(circle, trim1, trim2, false, IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER);
file.addEntity(trimmed_curve); file.add_entity(trimmed_curve);
IfcSchema::IfcCompositeCurveSegment* segment2 = new IfcSchema::IfcCompositeCurveSegment(IfcSchema::IfcTransitionCode::IfcTransitionCode_CONTSAMEGRADIENT, false, trimmed_curve); IfcSchema::IfcCompositeCurveSegment* segment2 = new IfcSchema::IfcCompositeCurveSegment(IfcSchema::IfcTransitionCode::IfcTransitionCode_CONTSAMEGRADIENT, false, trimmed_curve);
file.addEntity(segment2); file.add_entity(segment2);
segments->push(segment2); segments->push(segment2);
/*third segment - line */ /*third segment - line */
@@ -104,14 +104,14 @@ void create_curve_rebar(IfcHierarchyHelper& file)
points2->push(p5); points2->push(p5);
file.addEntities(points2->generalize()); file.addEntities(points2->generalize());
IfcSchema::IfcPolyline* poly2 = new IfcSchema::IfcPolyline(points2); IfcSchema::IfcPolyline* poly2 = new IfcSchema::IfcPolyline(points2);
file.addEntity(poly2); file.add_entity(poly2);
IfcSchema::IfcCompositeCurveSegment* segment3 = new IfcSchema::IfcCompositeCurveSegment(IfcSchema::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, poly2); IfcSchema::IfcCompositeCurveSegment* segment3 = new IfcSchema::IfcCompositeCurveSegment(IfcSchema::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, poly2);
file.addEntity(segment3); file.add_entity(segment3);
segments->push(segment3); segments->push(segment3);
IfcSchema::IfcCompositeCurve* curve = new IfcSchema::IfcCompositeCurve(segments, false); IfcSchema::IfcCompositeCurve* curve = new IfcSchema::IfcCompositeCurve(segments, false);
file.addEntity(curve); file.add_entity(curve);
IfcSchema::IfcSweptDiskSolid* solid = new IfcSchema::IfcSweptDiskSolid(curve, dia / 2, null, 0, 1); IfcSchema::IfcSweptDiskSolid* solid = new IfcSchema::IfcSweptDiskSolid(curve, dia / 2, null, 0, 1);
@@ -123,7 +123,7 @@ void create_curve_rebar(IfcHierarchyHelper& file)
reps->push(rep); reps->push(rep);
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(null, null, reps); IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(null, null, reps);
file.addEntity(shape); file.add_entity(shape);
rebar->setRepresentation(shape); rebar->setRepresentation(shape);
@@ -133,7 +133,7 @@ void create_curve_rebar(IfcHierarchyHelper& file)
int main() int main()
{ {
IfcHierarchyHelper file; hierarchy_helper file;
file.header().file_name().name("ifc_curve_rebar.ifc"); file.header().file_name().name("ifc_curve_rebar.ifc");
create_curve_rebar(file); create_curve_rebar(file);
std::ofstream f("ifc_curve_rebar.ifc"); std::ofstream f("ifc_curve_rebar.ifc");
+6 -6
View File
@@ -29,7 +29,7 @@
#include "../ifcparse/Ifc2x3.h" #include "../ifcparse/Ifc2x3.h"
#include "../ifcparse/IfcUtil.h" #include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcHierarchyHelper.h" #include "../ifcparse/hierarchy_helper.h"
typedef std::string S; typedef std::string S;
typedef IfcWrite::IfcGuidHelper guid; typedef IfcWrite::IfcGuidHelper guid;
@@ -40,7 +40,7 @@ void create_testcase_for(IfcSchema::IfcProfileDef::list::ptr profiles) {
const std::string profile_type = IfcSchema::Type::ToString(profile->type()); const std::string profile_type = IfcSchema::Type::ToString(profile->type());
const std::string filename = profile_type + ".ifc"; const std::string filename = profile_type + ".ifc";
IfcHierarchyHelper file; hierarchy_helper file;
file.filename(filename); file.filename(filename);
int i = 0; int i = 0;
@@ -61,8 +61,8 @@ void create_testcase_for(IfcSchema::IfcProfileDef::list::ptr profiles) {
IfcSchema::IfcExtrudedAreaSolid* solid = new IfcSchema::IfcExtrudedAreaSolid(profile, IfcSchema::IfcExtrudedAreaSolid* solid = new IfcSchema::IfcExtrudedAreaSolid(profile,
file.addPlacement3d(), file.addTriplet<IfcSchema::IfcDirection>(0, 0, 1), 20.0); file.addPlacement3d(), file.addTriplet<IfcSchema::IfcDirection>(0, 0, 1), 20.0);
file.addEntity(profile); file.add_entity(profile);
file.addEntity(solid); file.add_entity(solid);
IfcSchema::IfcRepresentation::list::ptr reps (new IfcSchema::IfcRepresentation::list); IfcSchema::IfcRepresentation::list::ptr reps (new IfcSchema::IfcRepresentation::list);
IfcSchema::IfcRepresentationItem::list::ptr items (new IfcSchema::IfcRepresentationItem::list); IfcSchema::IfcRepresentationItem::list::ptr items (new IfcSchema::IfcRepresentationItem::list);
@@ -73,8 +73,8 @@ void create_testcase_for(IfcSchema::IfcProfileDef::list::ptr profiles) {
reps->push(rep); reps->push(rep);
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(0, 0, reps); IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(0, 0, reps);
file.addEntity(rep); file.add_entity(rep);
file.addEntity(shape); file.add_entity(shape);
product->setRepresentation(shape); product->setRepresentation(shape);
} }
+4 -4
View File
@@ -25,12 +25,12 @@
#include "../ifcparse/Ifc4.h" #include "../ifcparse/Ifc4.h"
#include "../ifcparse/IfcUtil.h" #include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcHierarchyHelper.h" #include "../ifcparse/hierarchy_helper.h"
#include "suzanne_geometry.h" #include "suzanne_geometry.h"
typedef std::string S; typedef std::string S;
typedef IfcParse::IfcGlobalId guid; typedef ifcopenshell::global_id guid;
boost::none_t const null = (static_cast<boost::none_t>(0)); boost::none_t const null = (static_cast<boost::none_t>(0));
template <typename T> template <typename T>
@@ -50,7 +50,7 @@ std::vector< std::vector<T> > create_vector_from_array(const T* arr, unsigned si
} }
int main(int argc, char** argv) { int main(int argc, char** argv) {
IfcHierarchyHelper file; hierarchy_helper file;
IfcSchema::IfcBuildingElementProxy* product = new IfcSchema::IfcBuildingElementProxy( IfcSchema::IfcBuildingElementProxy* product = new IfcSchema::IfcBuildingElementProxy(
guid(), 0, S("Blender's Suzanne"), null, null, 0, 0, null, null); guid(), 0, S("Blender's Suzanne"), null, null, 0, 0, null, null);
@@ -74,7 +74,7 @@ int main(int argc, char** argv) {
reps->push(rep); reps->push(rep);
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(0, 0, reps); IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(0, 0, reps);
file.addEntity(shape); file.add_entity(shape);
product->setRepresentation(shape); product->setRepresentation(shape);
+156 -156
View File
@@ -1,4 +1,4 @@
/******************************************************************************** /********************************************************************************
* * * *
* This file is part of IfcOpenShell. * * This file is part of IfcOpenShell. *
* * * *
@@ -137,7 +137,7 @@ void print_usage(bool suggest_help = true)
<< " .ttl TTL/WKT RDF Turtle with Well-Known-Text geometry\n" << " .ttl TTL/WKT RDF Turtle with Well-Known-Text geometry\n"
<< " .ifc IFC-SPF Industry Foundation Classes\n" << " .ifc IFC-SPF Industry Foundation Classes\n"
<< "\n" << "\n"
<< "If no output filename given, <input>" << IfcUtil::path::from_utf8(DEFAULT_EXTENSION) << " will be used as the output file.\n"; << "If no output filename given, <input>" << ifcopenshell::path::from_utf8(DEFAULT_EXTENSION) << " will be used as the output file.\n";
if (suggest_help) { if (suggest_help) {
cout_ << "\nRun 'IfcConvert --help' for more information."; cout_ << "\nRun 'IfcConvert --help' for more information.";
} }
@@ -169,13 +169,13 @@ T change_extension(const T& fn, const T& ext) {
} }
bool file_exists(const std::string& filename) { bool file_exists(const std::string& filename) {
std::ifstream file(IfcUtil::path::from_utf8(filename).c_str()); std::ifstream file(ifcopenshell::path::from_utf8(filename).c_str());
return file.good(); return file.good();
} }
static std::basic_stringstream<path_t::value_type> log_stream; static std::basic_stringstream<path_t::value_type> log_stream;
void write_log(bool); void write_log(bool);
void fix_quantities(IfcParse::IfcFile&, bool, bool, bool); void fix_quantities(ifcopenshell::file&, bool, bool, bool);
std::string format_duration(time_t start, time_t end); std::string format_duration(time_t start, time_t end);
/// @todo make the filters non-global /// @todo make the filters non-global
@@ -205,7 +205,7 @@ size_t read_filters_from_file(const std::string&, inclusion_filter&, inclusion_t
void parse_filter(geom_filter &, const std::vector<std::string>&); 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&); std::vector<ifcopenshell::geometry::filter_t> setup_filters(const std::vector<geom_filter>&, const std::string&);
bool init_input_file(const std::string& filename, IfcParse::IfcFile*& ifc_file, bool no_progress, bool mmap, bool bypass_properties=false); bool init_input_file(const std::string& filename, ifcopenshell::file*& ifc_file, bool no_progress, bool mmap, bool bypass_properties=false);
// from https://stackoverflow.com/questions/31696328/boost-program-options-using-zero-parameter-options-multiple-times // from https://stackoverflow.com/questions/31696328/boost-program-options-using-zero-parameter-options-multiple-times
struct verbosity_counter { struct verbosity_counter {
@@ -429,18 +429,18 @@ int main(int argc, char** argv) {
po::store(command_line_parser(argc, argv). po::store(command_line_parser(argc, argv).
options(cmdline_options).positional(positional_options).run(), vmap); options(cmdline_options).positional(positional_options).run(), vmap);
} catch (const po::unknown_option& e) { } catch (const po::unknown_option& e) {
cerr_ << "[Error] Unknown option '" << e.get_option_name().c_str() << "'\n\n"; cerr_ << "[error] Unknown option '" << e.get_option_name().c_str() << "'\n\n";
print_usage(); print_usage();
return EXIT_FAILURE; return EXIT_FAILURE;
} catch (const po::error_with_option_name& e) { } catch (const po::error_with_option_name& e) {
cerr_ << "[Error] Invalid usage of '" << e.get_option_name().c_str() << "': " << e.what() << "\n\n"; cerr_ << "[error] Invalid usage of '" << e.get_option_name().c_str() << "': " << e.what() << "\n\n";
return EXIT_FAILURE; return EXIT_FAILURE;
} catch (const std::exception& e) { } catch (const std::exception& e) {
cerr_ << "[Error] " << e.what() << "\n\n"; cerr_ << "[error] " << e.what() << "\n\n";
print_usage(); print_usage();
return EXIT_FAILURE; return EXIT_FAILURE;
} catch (...) { } catch (...) {
cerr_ << "[Error] Unknown error parsing command line options\n\n"; cerr_ << "[error] Unknown error parsing command line options\n\n";
print_usage(); print_usage();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@@ -468,7 +468,7 @@ int main(int argc, char** argv) {
print_options(generic_options.add(geom_options).add(serializer_options)); print_options(generic_options.add(geom_options).add(serializer_options));
return EXIT_SUCCESS; return EXIT_SUCCESS;
} else if (!vmap.count("input-file")) { } else if (!vmap.count("input-file")) {
cerr_ << "[Error] Input file not specified" << std::endl; cerr_ << "[error] Input file not specified" << std::endl;
print_usage(); print_usage();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@@ -484,7 +484,7 @@ int main(int argc, char** argv) {
} else if (storey_height_display == "left") { } else if (storey_height_display == "left") {
svg_storey_height_display = SvgSerializer::SH_LEFT; svg_storey_height_display = SvgSerializer::SH_LEFT;
} else { } else {
cerr_ << "[Error] --draw-storey-heights should be none|full|left" << std::endl; cerr_ << "[error] --draw-storey-heights should be none|full|left" << std::endl;
print_usage(); print_usage();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@@ -493,28 +493,28 @@ int main(int argc, char** argv) {
if (num_threads <= 0) { if (num_threads <= 0) {
num_threads = std::thread::hardware_concurrency(); num_threads = std::thread::hardware_concurrency();
Logger::Notice("Using " + std::to_string(num_threads) + " threads"); logger::notice("Using " + std::to_string(num_threads) + " threads");
} }
if (vmap.count("log-format") == 1) { if (vmap.count("log-format") == 1) {
boost::to_lower(log_format); boost::to_lower(log_format);
if (log_format == "plain") { if (log_format == "plain") {
Logger::OutputFormat(Logger::FMT_PLAIN); logger::output_format(logger::FMT_PLAIN);
} else if (log_format == "json") { } else if (log_format == "json") {
Logger::OutputFormat(Logger::FMT_JSON); logger::output_format(logger::FMT_JSON);
} else { } else {
cerr_ << "[Error] --log-format should be either plain or json" << std::endl; cerr_ << "[error] --log-format should be either plain or json" << std::endl;
print_usage(); print_usage();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
} }
if (!filter_filename.empty()) { if (!filter_filename.empty()) {
size_t num_filters = read_filters_from_file(IfcUtil::path::to_utf8(filter_filename), include_filter, include_traverse_filter, exclude_filter, exclude_traverse_filter); 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) { if (num_filters) {
Logger::Notice(boost::lexical_cast<std::string>(num_filters) + " filters read from specifified file."); logger::notice(boost::lexical_cast<std::string>(num_filters) + " filters read from specifified file.");
} else { } else {
cerr_ << "[Error] No filters read from specifified file.\n"; cerr_ << "[error] No filters read from specifified file.\n";
return EXIT_FAILURE; return EXIT_FAILURE;
} }
} }
@@ -522,11 +522,11 @@ int main(int argc, char** argv) {
#ifdef HAVE_ICU #ifdef HAVE_ICU
if (!unicode_mode.empty()) { if (!unicode_mode.empty()) {
if (unicode_mode == "utf8") { if (unicode_mode == "utf8") {
IfcParse::RuntimeIfcCharacterDecoder::mode = IfcParse::RuntimeIfcCharacterDecoder::UTF8; ifcopenshell::runtime_character_decoder::mode = ifcopenshell::runtime_character_decoder::UTF8;
} else if (unicode_mode == "escape") { } else if (unicode_mode == "escape") {
IfcParse::RuntimeIfcCharacterDecoder::mode = IfcParse::RuntimeIfcCharacterDecoder::ESCAPE; ifcopenshell::runtime_character_decoder::mode = ifcopenshell::runtime_character_decoder::ESCAPE;
} else { } else {
cerr_ << "[Error] Invalid value for --unicode" << std::endl; cerr_ << "[error] Invalid value for --unicode" << std::endl;
print_options(serializer_options); print_options(serializer_options);
return 1; return 1;
} }
@@ -535,9 +535,9 @@ int main(int argc, char** argv) {
if (!default_material_filename.empty()) { if (!default_material_filename.empty()) {
try { try {
IfcGeom::set_default_style_file(IfcUtil::path::to_utf8(default_material_filename)); IfcGeom::set_default_style_file(ifcopenshell::path::to_utf8(default_material_filename));
} catch (const std::exception& e) { } catch (const std::exception& e) {
cerr_ << "[Error] Could not read default material file:" << std::endl; cerr_ << "[error] Could not read default material file:" << std::endl;
cerr_ << e.what() << std::endl; cerr_ << e.what() << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@@ -551,7 +551,7 @@ int main(int argc, char** argv) {
bounding_width = w; bounding_width = w;
bounding_height = h; bounding_height = h;
} else { } else {
cerr_ << "[Error] Invalid use of --bounds" << std::endl; cerr_ << "[error] Invalid use of --bounds" << std::endl;
print_options(serializer_options); print_options(serializer_options);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@@ -563,7 +563,7 @@ int main(int argc, char** argv) {
relative_center_x = cx; relative_center_x = cx;
relative_center_y = cy; relative_center_y = cy;
} else { } else {
cerr_ << "[Error] Invalid use of --bounds" << std::endl; cerr_ << "[error] Invalid use of --bounds" << std::endl;
print_options(serializer_options); print_options(serializer_options);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@@ -572,8 +572,8 @@ int main(int argc, char** argv) {
const path_t input_filename = vmap["input-file"].as<path_t>(); const path_t input_filename = vmap["input-file"].as<path_t>();
/* /*
// todo also allow rocksdb dir // todo also allow rocksdb dir
if (!file_exists(IfcUtil::path::to_utf8(input_filename))) { if (!file_exists(ifcopenshell::path::to_utf8(input_filename))) {
cerr_ << "[Error] Input file '" << input_filename << "' does not exist" << std::endl; cerr_ << "[error] Input file '" << input_filename << "' does not exist" << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
}*/ }*/
@@ -581,15 +581,15 @@ int main(int argc, char** argv) {
// to maintain backwards compatibility with the obsolete IfcObj executable. // to maintain backwards compatibility with the obsolete IfcObj executable.
const path_t output_filename = vmap.count("output-file") == 1 const path_t output_filename = vmap.count("output-file") == 1
? vmap["output-file"].as<path_t>() ? vmap["output-file"].as<path_t>()
: change_extension(input_filename, IfcUtil::path::from_utf8(DEFAULT_EXTENSION)); : change_extension(input_filename, ifcopenshell::path::from_utf8(DEFAULT_EXTENSION));
if (output_filename.size() < 5) { if (output_filename.size() < 5) {
cerr_ << "[Error] Invalid or unsupported output file '" << output_filename << "' given" << std::endl; cerr_ << "[error] Invalid or unsupported output file '" << output_filename << "' given" << std::endl;
print_usage(); print_usage();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
if (file_exists(IfcUtil::path::to_utf8(output_filename)) && !vmap.count("yes")) { if (file_exists(ifcopenshell::path::to_utf8(output_filename)) && !vmap.count("yes")) {
std::string answer; std::string answer;
cout_ << "A file '" << output_filename << "' already exists. Overwrite the existing file? y/n" << std::endl; cout_ << "A file '" << output_filename << "' already exists. Overwrite the existing file? y/n" << std::endl;
std::cin >> answer; std::cin >> answer;
@@ -602,31 +602,31 @@ int main(int argc, char** argv) {
if (vmap.count("log-file")) { if (vmap.count("log-file")) {
log_fs.open(log_file.c_str(), std::ios::app); 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 { } 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) { switch (vcounter.count) {
case 0: case 0:
Logger::Verbosity(Logger::LOG_ERROR); logger::verbosity(logger::LOG_ERROR);
break; break;
case 1: case 1:
Logger::Verbosity(Logger::LOG_NOTICE); logger::verbosity(logger::LOG_NOTICE);
break; break;
case 2: case 2:
Logger::Verbosity(Logger::LOG_DEBUG); logger::verbosity(logger::LOG_DEBUG);
break; break;
case 3: case 3:
Logger::Verbosity(Logger::LOG_PERF); logger::verbosity(logger::LOG_PERF);
break; break;
case 4: case 4:
Logger::Verbosity(Logger::LOG_PERF); logger::verbosity(logger::LOG_PERF);
Logger::PrintPerformanceStatsOnElement(true); logger::print_performance_stats_on_element(true);
break; break;
} }
path_t output_temp_filename = output_filename + IfcUtil::path::from_utf8(TEMP_FILE_EXTENSION); path_t output_temp_filename = output_filename + ifcopenshell::path::from_utf8(TEMP_FILE_EXTENSION);
std::vector<path_t> tokens; std::vector<path_t> tokens;
split(tokens, output_filename, boost::is_any_of(".")); split(tokens, output_filename, boost::is_any_of("."));
@@ -638,63 +638,63 @@ int main(int argc, char** argv) {
boost::to_lower(output_extension); boost::to_lower(output_extension);
IfcParse::IfcFile* ifc_file = 0; ifcopenshell::file* ifc_file = 0;
boost::optional<std::list<IfcGeom::Element*>> elems_from_adaptor; boost::optional<std::list<IfcGeom::Element*>> elems_from_adaptor;
const path_t OBJ = IfcUtil::path::from_utf8(".obj"), const path_t OBJ = ifcopenshell::path::from_utf8(".obj"),
MTL = IfcUtil::path::from_utf8(".mtl"), MTL = ifcopenshell::path::from_utf8(".mtl"),
DAE = IfcUtil::path::from_utf8(".dae"), DAE = ifcopenshell::path::from_utf8(".dae"),
GLB = IfcUtil::path::from_utf8(".glb"), GLB = ifcopenshell::path::from_utf8(".glb"),
STP = IfcUtil::path::from_utf8(".stp"), STP = ifcopenshell::path::from_utf8(".stp"),
IGS = IfcUtil::path::from_utf8(".igs"), IGS = ifcopenshell::path::from_utf8(".igs"),
SVG = IfcUtil::path::from_utf8(".svg"), SVG = ifcopenshell::path::from_utf8(".svg"),
CACHE = IfcUtil::path::from_utf8(".cache"), CACHE = ifcopenshell::path::from_utf8(".cache"),
HDF = IfcUtil::path::from_utf8(".h5"), HDF = ifcopenshell::path::from_utf8(".h5"),
XML = IfcUtil::path::from_utf8(".xml"), XML = ifcopenshell::path::from_utf8(".xml"),
JSON = IfcUtil::path::from_utf8(".json"), JSON = ifcopenshell::path::from_utf8(".json"),
// @todo this is just temporary as it doesn't make sense to require an extension for a DB // @todo this is just temporary as it doesn't make sense to require an extension for a DB
RDB = IfcUtil::path::from_utf8(".rdb"), RDB = ifcopenshell::path::from_utf8(".rdb"),
IFC = IfcUtil::path::from_utf8(".ifc"), IFC = ifcopenshell::path::from_utf8(".ifc"),
USD = IfcUtil::path::from_utf8(".usd"), USD = ifcopenshell::path::from_utf8(".usd"),
USDA = IfcUtil::path::from_utf8(".usda"), USDA = ifcopenshell::path::from_utf8(".usda"),
USDC = IfcUtil::path::from_utf8(".usdc"), USDC = ifcopenshell::path::from_utf8(".usdc"),
TTL = IfcUtil::path::from_utf8(".ttl"); TTL = ifcopenshell::path::from_utf8(".ttl");
// @todo clean up serializer selection // @todo clean up serializer selection
// @todo detect program options that conflict with the chosen serializer // @todo detect program options that conflict with the chosen serializer
if (output_extension == XML || output_extension == JSON) { if (output_extension == XML || output_extension == JSON) {
int exit_code = EXIT_FAILURE; int exit_code = EXIT_FAILURE;
try { try {
if (init_input_file(IfcUtil::path::to_utf8(input_filename), ifc_file, no_progress || quiet, mmap)) { if (init_input_file(ifcopenshell::path::to_utf8(input_filename), ifc_file, no_progress || quiet, mmap)) {
time_t start, end; time_t start, end;
time(&start); time(&start);
if (output_extension == XML) { if (output_extension == XML) {
XmlSerializer s(ifc_file, IfcUtil::path::to_utf8(output_temp_filename)); XmlSerializer s(ifc_file, ifcopenshell::path::to_utf8(output_temp_filename));
Logger::Status("Writing XML output..."); logger::status("Writing XML output...");
s.finalize(); s.finalize();
} else { } else {
#ifdef WITH_GLTF #ifdef WITH_GLTF
JsonSerializer s(ifc_file, IfcUtil::path::to_utf8(output_temp_filename), JsonSerializer::JSON_DIALECT_CREOOX); JsonSerializer s(ifc_file, ifcopenshell::path::to_utf8(output_temp_filename), JsonSerializer::JSON_DIALECT_CREOOX);
Logger::Status("Writing JSON output..."); logger::status("Writing JSON output...");
s.finalize(); s.finalize();
#endif #endif
} }
time(&end); time(&end);
Logger::Status("Done! Conversion took " + format_duration(start, end)); logger::status("Done! Conversion took " + format_duration(start, end));
IfcUtil::path::rename_file(IfcUtil::path::to_utf8(output_temp_filename), IfcUtil::path::to_utf8(output_filename)); ifcopenshell::path::rename_file(ifcopenshell::path::to_utf8(output_temp_filename), ifcopenshell::path::to_utf8(output_filename));
exit_code = EXIT_SUCCESS; exit_code = EXIT_SUCCESS;
} }
} catch (const std::exception& e) { } catch (const std::exception& e) {
Logger::Error(e); logger::error(e);
} }
write_log(!quiet); write_log(!quiet);
return exit_code; return exit_code;
} else if (output_extension == IFC) { } else if (output_extension == IFC) {
int exit_code = EXIT_FAILURE; int exit_code = EXIT_FAILURE;
try { try {
if (init_input_file(IfcUtil::path::to_utf8(input_filename), ifc_file, no_progress || quiet, mmap)) { if (init_input_file(ifcopenshell::path::to_utf8(input_filename), ifc_file, no_progress || quiet, mmap)) {
time_t start, end; time_t start, end;
time(&start); time(&start);
std::ofstream fs(output_filename.c_str()); std::ofstream fs(output_filename.c_str());
@@ -705,13 +705,13 @@ int main(int argc, char** argv) {
fs << *ifc_file; fs << *ifc_file;
exit_code = EXIT_SUCCESS; exit_code = EXIT_SUCCESS;
} else { } else {
Logger::Error("Unable to open output file for writing"); logger::error("Unable to open output file for writing");
} }
time(&end); 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) { } catch (const std::exception& e) {
Logger::Error(e); logger::error(e);
} }
write_log(!quiet); write_log(!quiet);
return exit_code; return exit_code;
@@ -723,26 +723,26 @@ int main(int argc, char** argv) {
if (vmap.count("stream")) { if (vmap.count("stream")) {
time_t start, end; time_t start, end;
time(&start); time(&start);
RocksDbSerializer s(IfcUtil::path::to_utf8(input_filename), IfcUtil::path::to_utf8(output_filename), true); RocksDbSerializer s(ifcopenshell::path::to_utf8(input_filename), ifcopenshell::path::to_utf8(output_filename), true);
Logger::Status("Populating RocksDB Key-Value store..."); logger::status("Populating RocksDB Key-Value store...");
s.finalize(); s.finalize();
time(&end); time(&end);
Logger::Status("Done! Conversion took " + format_duration(start, end)); logger::status("Done! Conversion took " + format_duration(start, end));
exit_code = EXIT_SUCCESS; exit_code = EXIT_SUCCESS;
} else { } else {
if (init_input_file(IfcUtil::path::to_utf8(input_filename), ifc_file, no_progress || quiet, mmap)) { if (init_input_file(ifcopenshell::path::to_utf8(input_filename), ifc_file, no_progress || quiet, mmap)) {
time_t start, end; time_t start, end;
time(&start); time(&start);
RocksDbSerializer s(ifc_file, IfcUtil::path::to_utf8(output_filename)); RocksDbSerializer s(ifc_file, ifcopenshell::path::to_utf8(output_filename));
Logger::Status("Populating RocksDB Key-Value store..."); logger::status("Populating RocksDB Key-Value store...");
s.finalize(); s.finalize();
time(&end); time(&end);
Logger::Status("Done! Conversion took " + format_duration(start, end)); logger::status("Done! Conversion took " + format_duration(start, end));
exit_code = EXIT_SUCCESS; exit_code = EXIT_SUCCESS;
} }
} }
} catch (const std::exception& e) { } catch (const std::exception& e) {
Logger::Error(e); logger::error(e);
} }
write_log(!quiet); write_log(!quiet);
return exit_code; return exit_code;
@@ -756,15 +756,15 @@ int main(int argc, char** argv) {
if (exclude_filter.type != geom_filter::UNUSED) { used_filters.push_back(exclude_filter); } if (exclude_filter.type != geom_filter::UNUSED) { used_filters.push_back(exclude_filter); }
if (exclude_traverse_filter.type != geom_filter::UNUSED) { used_filters.push_back(exclude_traverse_filter); } if (exclude_traverse_filter.type != geom_filter::UNUSED) { used_filters.push_back(exclude_traverse_filter); }
std::vector<ifcopenshell::geometry::filter_t> filter_funcs = setup_filters(used_filters, IfcUtil::path::to_utf8(output_extension)); std::vector<ifcopenshell::geometry::filter_t> filter_funcs = setup_filters(used_filters, ifcopenshell::path::to_utf8(output_extension));
if (filter_funcs.empty()) { if (filter_funcs.empty()) {
cerr_ << "[Error] Failed to set up geometry filters\n"; cerr_ << "[error] Failed to set up geometry filters\n";
return EXIT_FAILURE; return EXIT_FAILURE;
} }
if (!entity_filter.entity_names.empty()) { entity_filter.update_description(); Logger::Notice(entity_filter.description); } if (!entity_filter.entity_names.empty()) { entity_filter.update_description(); logger::notice(entity_filter.description); }
if (!layer_filter.values.empty()) { layer_filter.update_description(); Logger::Notice(layer_filter.description); } if (!layer_filter.values.empty()) { layer_filter.update_description(); logger::notice(layer_filter.description); }
if (!attribute_filter.attribute_name.empty()) { attribute_filter.update_description(); Logger::Notice(attribute_filter.description); } if (!attribute_filter.attribute_name.empty()) { attribute_filter.update_description(); logger::notice(attribute_filter.description); }
#ifdef _MSC_VER #ifdef _MSC_VER
if (output_extension == DAE || output_extension == STP || output_extension == IGS) { if (output_extension == DAE || output_extension == STP || output_extension == IGS) {
@@ -796,11 +796,11 @@ int main(int argc, char** argv) {
} }
if (geometry_settings.get<ifcopenshell::geometry::settings::UseElementHierarchy>().get() && output_extension != DAE && output_extension != USD && output_extension != USDA && output_extension != USDC && output_extension != GLB) { if (geometry_settings.get<ifcopenshell::geometry::settings::UseElementHierarchy>().get() && output_extension != DAE && output_extension != USD && output_extension != USDA && output_extension != USDC && output_extension != GLB) {
cerr_ << "[Error] --use-element-hierarchy can be used only with .dae or .usd or .glb output.\n"; cerr_ << "[error] --use-element-hierarchy can be used only with .dae or .usd or .glb output.\n";
/// @todo Lots of duplicate error-and-exit code. /// @todo Lots of duplicate error-and-exit code.
write_log(!quiet); write_log(!quiet);
print_usage(); print_usage();
IfcUtil::path::delete_file(IfcUtil::path::to_utf8(output_temp_filename)); ifcopenshell::path::delete_file(ifcopenshell::path::to_utf8(output_temp_filename));
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@@ -829,41 +829,41 @@ int main(int argc, char** argv) {
if (output_extension == OBJ) { if (output_extension == OBJ) {
// Do not use temp file for MTL as it's such a small file. // Do not use temp file for MTL as it's such a small file.
const path_t mtl_filename = change_extension(output_filename, MTL); const path_t mtl_filename = change_extension(output_filename, MTL);
serializer = boost::make_shared<WaveFrontOBJSerializer>(IfcUtil::path::to_utf8(output_temp_filename), IfcUtil::path::to_utf8(mtl_filename), geometry_settings, serializer_settings); serializer = boost::make_shared<WaveFrontOBJSerializer>(ifcopenshell::path::to_utf8(output_temp_filename), ifcopenshell::path::to_utf8(mtl_filename), geometry_settings, serializer_settings);
#ifdef WITH_OPENCOLLADA #ifdef WITH_OPENCOLLADA
} else if (output_extension == DAE) { } else if (output_extension == DAE) {
serializer = boost::make_shared<ColladaSerializer>(IfcUtil::path::to_utf8(output_temp_filename), geometry_settings, serializer_settings); serializer = boost::make_shared<ColladaSerializer>(ifcopenshell::path::to_utf8(output_temp_filename), geometry_settings, serializer_settings);
#endif #endif
#ifdef WITH_GLTF #ifdef WITH_GLTF
} else if (output_extension == GLB) { } else if (output_extension == GLB) {
serializer = boost::make_shared<GltfSerializer>(IfcUtil::path::to_utf8(output_temp_filename), geometry_settings, serializer_settings); serializer = boost::make_shared<GltfSerializer>(ifcopenshell::path::to_utf8(output_temp_filename), geometry_settings, serializer_settings);
#endif #endif
#ifdef WITH_USD #ifdef WITH_USD
} else if (output_extension == USD || output_extension == USDA || output_extension == USDC) { } else if (output_extension == USD || output_extension == USDA || output_extension == USDC) {
serializer = boost::make_shared<USDSerializer>(IfcUtil::path::to_utf8(output_filename), geometry_settings, serializer_settings); serializer = boost::make_shared<USDSerializer>(ifcopenshell::path::to_utf8(output_filename), geometry_settings, serializer_settings);
#endif #endif
#ifdef IFOPSH_WITH_OPENCASCADE #ifdef IFOPSH_WITH_OPENCASCADE
} else if (output_extension == STP) { } else if (output_extension == STP) {
serializer = boost::make_shared<StepSerializer>(IfcUtil::path::to_utf8(output_temp_filename), geometry_settings, serializer_settings); serializer = boost::make_shared<StepSerializer>(ifcopenshell::path::to_utf8(output_temp_filename), geometry_settings, serializer_settings);
} else if (output_extension == IGS) { } else if (output_extension == IGS) {
#if OCC_VERSION_HEX < 0x60900 #if OCC_VERSION_HEX < 0x60900
// According to https://tracker.dev.opencascade.org/view.php?id=25689 something has been fixed in 6.9.0 // According to https://tracker.dev.opencascade.org/view.php?id=25689 something has been fixed in 6.9.0
IGESControl_Controller::Init(); // work around Open Cascade bug IGESControl_Controller::Init(); // work around Open Cascade bug
#endif #endif
serializer = boost::make_shared<IgesSerializer>(IfcUtil::path::to_utf8(output_temp_filename), geometry_settings, serializer_settings); serializer = boost::make_shared<IgesSerializer>(ifcopenshell::path::to_utf8(output_temp_filename), geometry_settings, serializer_settings);
} else if (output_extension == SVG) { } else if (output_extension == SVG) {
geometry_settings.get<ifcopenshell::geometry::settings::IteratorOutput>().value = ifcopenshell::geometry::settings::NATIVE; geometry_settings.get<ifcopenshell::geometry::settings::IteratorOutput>().value = ifcopenshell::geometry::settings::NATIVE;
serializer = boost::make_shared<SvgSerializer>(IfcUtil::path::to_utf8(output_temp_filename), geometry_settings, serializer_settings); serializer = boost::make_shared<SvgSerializer>(ifcopenshell::path::to_utf8(output_temp_filename), geometry_settings, serializer_settings);
#ifdef WITH_HDF5 #ifdef WITH_HDF5
} else if (output_extension == HDF) { } else if (output_extension == HDF) {
geometry_settings.get<ifcopenshell::geometry::settings::IteratorOutput>().value = ifcopenshell::geometry::settings::NATIVE; geometry_settings.get<ifcopenshell::geometry::settings::IteratorOutput>().value = ifcopenshell::geometry::settings::NATIVE;
serializer = boost::make_shared<HdfSerializer>(IfcUtil::path::to_utf8(output_temp_filename), geometry_settings, serializer_settings); serializer = boost::make_shared<HdfSerializer>(ifcopenshell::path::to_utf8(output_temp_filename), geometry_settings, serializer_settings);
#endif #endif
#endif #endif
} else if (output_extension == TTL) { } else if (output_extension == TTL) {
serializer = boost::make_shared<TtlWktSerializer>(IfcUtil::path::to_utf8(output_temp_filename), geometry_settings, serializer_settings); serializer = boost::make_shared<TtlWktSerializer>(ifcopenshell::path::to_utf8(output_temp_filename), geometry_settings, serializer_settings);
} else { } else {
cerr_ << "[Error] Unknown output filename extension '" << output_extension << "'\n"; cerr_ << "[error] Unknown output filename extension '" << output_extension << "'\n";
write_log(!quiet); write_log(!quiet);
print_usage(); print_usage();
return EXIT_FAILURE; return EXIT_FAILURE;
@@ -872,20 +872,20 @@ int main(int argc, char** argv) {
const bool is_tesselated = serializer->isTesselated(); // isTesselated() doesn't change at run-time const bool is_tesselated = serializer->isTesselated(); // isTesselated() doesn't change at run-time
if (!is_tesselated) { if (!is_tesselated) {
if (geometry_settings.get<ifcopenshell::geometry::settings::WeldVertices>().get()) { if (geometry_settings.get<ifcopenshell::geometry::settings::WeldVertices>().get()) {
Logger::Notice("Weld vertices setting ignored when writing non-tesselated output"); logger::notice("Weld vertices setting ignored when writing non-tesselated output");
} }
if (geometry_settings.get<ifcopenshell::geometry::settings::GenerateUvs>().get()) { if (geometry_settings.get<ifcopenshell::geometry::settings::GenerateUvs>().get()) {
Logger::Notice("Generate UVs setting ignored when writing non-tesselated output"); logger::notice("Generate UVs setting ignored when writing non-tesselated output");
} }
if (center_model || center_model_geometry) { if (center_model || center_model_geometry) {
Logger::Notice("Centering/offsetting model setting ignored when writing non-tesselated output"); logger::notice("Centering/offsetting model setting ignored when writing non-tesselated output");
} }
geometry_settings.get<ifcopenshell::geometry::settings::IteratorOutput>().value = ifcopenshell::geometry::settings::NATIVE; geometry_settings.get<ifcopenshell::geometry::settings::IteratorOutput>().value = ifcopenshell::geometry::settings::NATIVE;
} }
if (!serializer->ready()) { if (!serializer->ready()) {
IfcUtil::path::delete_file(IfcUtil::path::to_utf8(output_temp_filename)); ifcopenshell::path::delete_file(ifcopenshell::path::to_utf8(output_temp_filename));
write_log(!quiet); write_log(!quiet);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@@ -896,53 +896,53 @@ int main(int argc, char** argv) {
// @nb last argument true -> bypass_properties which are not read by any of the geometry serializers // @nb last argument true -> bypass_properties which are not read by any of the geometry serializers
// XML, RocksDB, IFC are already special-cased above // XML, RocksDB, IFC are already special-cased above
// SVG requires properties for IfcAnnotation/DRAWING properties // SVG requires properties for IfcAnnotation/DRAWING properties
if (!init_input_file(IfcUtil::path::to_utf8(input_filename), ifc_file, no_progress || quiet, mmap, output_extension != SVG)) { if (!init_input_file(ifcopenshell::path::to_utf8(input_filename), ifc_file, no_progress || quiet, mmap, output_extension != SVG)) {
write_log(!quiet); write_log(!quiet);
serializer.reset(); serializer.reset();
IfcUtil::path::delete_file(IfcUtil::path::to_utf8(output_temp_filename)); /**< @todo Windows Unicode support */ ifcopenshell::path::delete_file(ifcopenshell::path::to_utf8(output_temp_filename)); /**< @todo Windows Unicode support */
return EXIT_FAILURE; return EXIT_FAILURE;
} }
if (vmap.count("log-file")) { if (vmap.count("log-file")) {
Logger::SetOutput(quiet ? nullptr : &cout_, &log_fs); logger::set_output(quiet ? nullptr : &cout_, &log_fs);
} else { } 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) { if (model_rotation) {
std::vector<double> rotation(4); std::vector<double> rotation(4);
int n = 0; int n = 0;
if (sscanf(rotation_str.c_str(), "%lf;%lf;%lf;%lf %n", &rotation[0], &rotation[1], &rotation[2], &rotation[3], &n) != 4 || n != rotation_str.size()) { if (sscanf(rotation_str.c_str(), "%lf;%lf;%lf;%lf %n", &rotation[0], &rotation[1], &rotation[2], &rotation[3], &n) != 4 || n != rotation_str.size()) {
cerr_ << "[Error] Invalid use of --model-rotation\n"; cerr_ << "[error] Invalid use of --model-rotation\n";
IfcUtil::path::delete_file(IfcUtil::path::to_utf8(output_temp_filename)); ifcopenshell::path::delete_file(ifcopenshell::path::to_utf8(output_temp_filename));
print_options(serializer_options); print_options(serializer_options);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
std::stringstream msg; std::stringstream msg;
msg << "Using model rotation (" << rotation[0] << "," << rotation[1] << "," << rotation[2] << "," << rotation[3] << ")"; msg << "Using model rotation (" << rotation[0] << "," << rotation[1] << "," << rotation[2] << "," << rotation[3] << ")";
Logger::Notice(msg.str()); logger::notice(msg.str());
geometry_settings.get<ifcopenshell::geometry::settings::ModelRotation>().value = rotation; geometry_settings.get<ifcopenshell::geometry::settings::ModelRotation>().value = rotation;
} }
if (model_offset && (center_model || center_model_geometry)) { if (model_offset && (center_model || center_model_geometry)) {
Logger::Notice("--model-offset ignored with --center-model or --center-model-geometry"); logger::notice("--model-offset ignored with --center-model or --center-model-geometry");
} }
if (model_offset && !(center_model || center_model_geometry)) { if (model_offset && !(center_model || center_model_geometry)) {
std::vector<double> offset(3); std::vector<double> offset(3);
int n = 0; int n = 0;
if (sscanf(offset_str.c_str(), "%lf;%lf;%lf %n", &offset[0], &offset[1], &offset[2], &n) != 3 || n != offset_str.size()) { if (sscanf(offset_str.c_str(), "%lf;%lf;%lf %n", &offset[0], &offset[1], &offset[2], &n) != 3 || n != offset_str.size()) {
cerr_ << "[Error] Invalid use of --model-offset\n"; cerr_ << "[error] Invalid use of --model-offset\n";
IfcUtil::path::delete_file(IfcUtil::path::to_utf8(output_temp_filename)); ifcopenshell::path::delete_file(ifcopenshell::path::to_utf8(output_temp_filename));
print_options(serializer_options); print_options(serializer_options);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
std::stringstream msg; std::stringstream msg;
msg << std::setprecision(std::numeric_limits<double>::max_digits10) << "Using model offset (" << offset[0] << "," << offset[1] << "," << offset[2] << ")"; msg << std::setprecision(std::numeric_limits<double>::max_digits10) << "Using model offset (" << offset[0] << "," << offset[1] << "," << offset[2] << ")";
Logger::Notice(msg.str()); logger::notice(msg.str());
geometry_settings.get<ifcopenshell::geometry::settings::ModelOffset>().value = offset; geometry_settings.get<ifcopenshell::geometry::settings::ModelOffset>().value = offset;
} }
@@ -954,15 +954,15 @@ int main(int argc, char** argv) {
time_t start, end; time_t start, end;
time(&start); time(&start);
if (!quiet) Logger::Status("Computing bounds..."); if (!quiet) logger::status("Computing bounds...");
if (center_model_geometry) { if (center_model_geometry) {
if (!tmp_context_iterator.initialize()) { 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 /// @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. /// and for a case we found no entities that satisfy our filtering criteria.
Logger::Notice("No geometrical elements found or none successfully converted"); logger::notice("No geometrical elements found or none successfully converted");
serializer.reset(); serializer.reset();
IfcUtil::path::delete_file(IfcUtil::path::to_utf8(output_temp_filename)); ifcopenshell::path::delete_file(ifcopenshell::path::to_utf8(output_temp_filename));
write_log(!quiet); write_log(!quiet);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@@ -971,7 +971,7 @@ int main(int argc, char** argv) {
tmp_context_iterator.compute_bounds(center_model_geometry); tmp_context_iterator.compute_bounds(center_model_geometry);
time(&end); 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; auto center = (tmp_context_iterator.bounds_min().ccomponents() + tmp_context_iterator.bounds_max().ccomponents()) * 0.5;
offset[0] = -center(0); offset[0] = -center(0);
@@ -980,7 +980,7 @@ int main(int argc, char** argv) {
std::stringstream msg; std::stringstream msg;
msg << std::setprecision (std::numeric_limits<double>::max_digits10) << "Using model offset (" << offset[0] << "," << offset[1] << "," << offset[2] << ")"; msg << std::setprecision (std::numeric_limits<double>::max_digits10) << "Using model offset (" << offset[0] << "," << offset[1] << "," << offset[2] << ")";
Logger::Notice(msg.str()); logger::notice(msg.str());
geometry_settings.get<ifcopenshell::geometry::settings::ModelOffset>().value = offset; geometry_settings.get<ifcopenshell::geometry::settings::ModelOffset>().value = offset;
} }
@@ -1005,19 +1005,19 @@ int main(int argc, char** argv) {
if (!vmap.count("cache-file")) { if (!vmap.count("cache-file")) {
cache_file = input_filename + CACHE + HDF; cache_file = input_filename + CACHE + HDF;
} }
cache.reset(new HdfSerializer(IfcUtil::path::to_utf8(cache_file), geometry_settings, serializer_settings)); cache.reset(new HdfSerializer(ifcopenshell::path::to_utf8(cache_file), geometry_settings, serializer_settings));
context_iterator->set_cache(cache.get()); context_iterator->set_cache(cache.get());
} }
#endif #endif
Logger::Message(Logger::LOG_PERF, "file geometry conversion"); logger::message(logger::LOG_PERF, "file geometry conversion");
if (context_iterator && !context_iterator->initialize()) { 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 /// @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. /// and for a case we found no entities that satisfy our filtering criteria.
Logger::Notice("No geometrical elements found or none successfully converted"); logger::notice("No geometrical elements found or none successfully converted");
serializer.reset(); serializer.reset();
IfcUtil::path::delete_file(IfcUtil::path::to_utf8(output_temp_filename)); ifcopenshell::path::delete_file(ifcopenshell::path::to_utf8(output_temp_filename));
write_log(!quiet); write_log(!quiet);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@@ -1034,7 +1034,7 @@ int main(int argc, char** argv) {
static_cast<SvgSerializer*>(serializer.get())->setSectionHeightsFromStoreys(); static_cast<SvgSerializer*>(serializer.get())->setSectionHeightsFromStoreys();
} }
} else if (vmap.count("section-height") != 0) { } else if (vmap.count("section-height") != 0) {
Logger::Notice("Overriding section height"); logger::notice("Overriding section height");
static_cast<SvgSerializer*>(serializer.get())->setSectionHeight(section_height); static_cast<SvgSerializer*>(serializer.get())->setSectionHeight(section_height);
} }
if (vmap.count("print-space-names") != 0) { if (vmap.count("print-space-names") != 0) {
@@ -1057,7 +1057,7 @@ int main(int argc, char** argv) {
if (sscanf(svg_scale.c_str(), "%u:%u", &s0, &s1) == 2 && s0 > 0 && s1 > 0) { if (sscanf(svg_scale.c_str(), "%u:%u", &s0, &s1) == 2 && s0 > 0 && s1 > 0) {
static_cast<SvgSerializer*>(serializer.get())->setScale((double)s0 / s1); static_cast<SvgSerializer*>(serializer.get())->setScale((double)s0 / s1);
} else { } else {
cerr_ << "[Error] Invalid use of --scale" << std::endl; cerr_ << "[error] Invalid use of --scale" << std::endl;
print_options(serializer_options); print_options(serializer_options);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@@ -1112,7 +1112,7 @@ int main(int argc, char** argv) {
int old_progress = quiet ? 0 : -1; int old_progress = quiet ? 0 : -1;
if (!quiet) { if (!quiet) {
Logger::Status("Creating geometry..."); logger::status("Creating geometry...");
} }
// The functions IfcGeom::Iterator::get() and IfcGeom::Iterator::next() // The functions IfcGeom::Iterator::get() and IfcGeom::Iterator::next()
@@ -1157,10 +1157,10 @@ int main(int argc, char** argv) {
if (stderr_progress) if (stderr_progress)
cerr_ << std::flush; cerr_ << std::flush;
} else if (vcounter.count == 2) { } else if (vcounter.count == 2) {
Logger::Message(Logger::LOG_DEBUG, "Progress " + boost::lexical_cast<std::string>(progress)); logger::message(logger::LOG_DEBUG, "Progress " + boost::lexical_cast<std::string>(progress));
} else { } else {
progress = progress / 2; progress = progress / 2;
if (old_progress != progress) Logger::ProgressBar(progress); if (old_progress != progress) logger::progress_bar(progress);
old_progress = progress; old_progress = progress;
} }
} }
@@ -1189,7 +1189,7 @@ int main(int argc, char** argv) {
} }
} else { } else {
const std::string task = ((num_threads == 1) ? "creating" : "writing"); 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) "); " objects) ");
} }
@@ -1197,7 +1197,7 @@ int main(int argc, char** argv) {
// Make sure the dtor is explicitly run here (e.g. output files are closed before renaming them). // Make sure the dtor is explicitly run here (e.g. output files are closed before renaming them).
serializer.reset(); serializer.reset();
Logger::Message(Logger::LOG_PERF, "done file geometry conversion"); logger::message(logger::LOG_PERF, "done file geometry conversion");
bool successful; bool successful;
if(output_extension == USD || output_extension == USDC || output_extension == USDA) { if(output_extension == USD || output_extension == USDC || output_extension == USDA) {
@@ -1207,7 +1207,7 @@ int main(int argc, char** argv) {
else { else {
// Renaming might fail (e.g. maybe the existing file was open in a viewer application) // Renaming might fail (e.g. maybe the existing file was open in a viewer application)
// Do not remove the temp file as user can salvage the conversion result from it. // Do not remove the temp file as user can salvage the conversion result from it.
successful = IfcUtil::path::rename_file(IfcUtil::path::to_utf8(output_temp_filename), IfcUtil::path::to_utf8(output_filename)); successful = ifcopenshell::path::rename_file(ifcopenshell::path::to_utf8(output_temp_filename), ifcopenshell::path::to_utf8(output_filename));
} }
if (!successful) { if (!successful) {
@@ -1215,13 +1215,13 @@ int main(int argc, char** argv) {
output_temp_filename << "' for the conversion result."; output_temp_filename << "' for the conversion result.";
} }
if (geometry_settings.get<ifcopenshell::geometry::settings::ValidateQuantities>().get() && Logger::MaxSeverity() >= Logger::LOG_ERROR) { if (geometry_settings.get<ifcopenshell::geometry::settings::ValidateQuantities>().get() && logger::max_severity() >= logger::LOG_ERROR) {
Logger::Error("Errors encountered during processing."); logger::error("Errors encountered during processing.");
successful = false; successful = false;
} }
if (Logger::Verbosity() == Logger::LOG_PERF) { if (logger::verbosity() == logger::LOG_PERF) {
Logger::PrintPerformanceStats(); logger::print_performance_stats();
} }
write_log(!quiet); write_log(!quiet);
@@ -1229,7 +1229,7 @@ int main(int argc, char** argv) {
time(&end); time(&end);
if (!quiet) { if (!quiet) {
Logger::Status("\nConversion took " + format_duration(start, end)); logger::status("\nConversion took " + format_duration(start, end));
} }
return successful ? EXIT_SUCCESS : EXIT_FAILURE; return successful ? EXIT_SUCCESS : EXIT_FAILURE;
@@ -1267,11 +1267,11 @@ void write_log(bool header) {
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
bool init_input_file(const std::string& filename, IfcParse::IfcFile*& ifc_file, bool no_progress, bool mmap, bool bypass_properties) { bool init_input_file(const std::string& filename, ifcopenshell::file*& ifc_file, bool no_progress, bool mmap, bool bypass_properties) {
time_t start, end; time_t start, end;
// Prevent IfcFile::Init() prints by setting output to null temporarily // Prevent file::Init() prints by setting output to null temporarily
if (no_progress) { Logger::SetOutput(NULL, &log_stream); } if (no_progress) { logger::set_output(NULL, &log_stream); }
time(&start); time(&start);
@@ -1279,11 +1279,11 @@ bool init_input_file(const std::string& filename, IfcParse::IfcFile*& ifc_file,
#ifdef WITH_IFCXML #ifdef WITH_IFCXML
// if (boost::ends_with(boost::to_lower_copy(filename), ".ifcxml")) { // if (boost::ends_with(boost::to_lower_copy(filename), ".ifcxml")) {
// ifc_file = IfcParse::parse_ifcxml(filename); // ifc_file = ifcopenshell::parse_ifcxml(filename);
// } else // } else
#endif #endif
{ {
ifc_file = new IfcParse::IfcFile(IfcParse::uninitialized_tag{}); ifc_file = new ifcopenshell::file(ifcopenshell::uninitialized_tag{});
requires_init = true; requires_init = true;
} }
@@ -1309,13 +1309,13 @@ bool init_input_file(const std::string& filename, IfcParse::IfcFile*& ifc_file,
} }
if (!ifc_file || !ifc_file->good()) { if (!ifc_file || !ifc_file->good()) {
Logger::Error("Unable to parse input file '" + filename + "'"); logger::error("Unable to parse input file '" + filename + "'");
return false; return false;
} }
time(&end); time(&end);
if (no_progress) { Logger::SetOutput(&cout_, &log_stream); } if (no_progress) { logger::set_output(&cout_, &log_stream); }
else { Logger::Status("Parsing input file took " + format_duration(start, end)); } else { logger::status("Parsing input file took " + format_duration(start, end)); }
return true; return true;
@@ -1327,7 +1327,7 @@ bool append_filter(const std::string& type, const std::vector<std::string>& valu
parse_filter(temp, values); parse_filter(temp, values);
// Merge values only if type and arg match. // Merge values only if type and arg match.
if ((filter.type != geom_filter::UNUSED && filter.type != temp.type) || (!filter.arg.empty() && filter.arg != temp.arg)) { if ((filter.type != geom_filter::UNUSED && filter.type != temp.type) || (!filter.arg.empty() && filter.arg != temp.arg)) {
cerr_ << "[Error] Multiple '" << type.c_str() << "' filters specified with different criteria\n"; cerr_ << "[error] Multiple '" << type.c_str() << "' filters specified with different criteria\n";
return false; return false;
} }
filter.type = temp.type; filter.type = temp.type;
@@ -1343,10 +1343,10 @@ size_t read_filters_from_file(
exclusion_filter& exclude_filter, exclusion_filter& exclude_filter,
exclusion_traverse_filter& exclude_traverse_filter) exclusion_traverse_filter& exclude_traverse_filter)
{ {
std::ifstream filter_file(IfcUtil::path::from_utf8(filename).c_str()); std::ifstream filter_file(ifcopenshell::path::from_utf8(filename).c_str());
if (!filter_file.is_open()) { if (!filter_file.is_open()) {
cerr_ << "[Error] Unable to open filter file '" << IfcUtil::path::from_utf8(filename) << "' or the file does not exist.\n"; cerr_ << "[error] Unable to open filter file '" << ifcopenshell::path::from_utf8(filename) << "' or the file does not exist.\n";
return 0; return 0;
} }
@@ -1381,11 +1381,11 @@ size_t read_filters_from_file(
else if (type == "exclude") { if (append_filter("exclude", values, exclude_filter)) { ++num_filters; } } else if (type == "exclude") { if (append_filter("exclude", values, exclude_filter)) { ++num_filters; } }
else if (type == "exclude+") { if (append_filter("exclude+", values, exclude_traverse_filter)) { ++num_filters; } } else if (type == "exclude+") { if (append_filter("exclude+", values, exclude_traverse_filter)) { ++num_filters; } }
else { else {
cerr_ << "[Error] Invalid filtering type at line " << boost::lexical_cast<path_t>(line_number) << "\n"; cerr_ << "[error] Invalid filtering type at line " << boost::lexical_cast<path_t>(line_number) << "\n";
return 0; return 0;
} }
} catch(...) { } catch(...) {
cerr_ << "[Error] Unable to parse filter at line " << boost::lexical_cast<path_t>(line_number) << ".\n"; cerr_ << "[error] Unable to parse filter at line " << boost::lexical_cast<path_t>(line_number) << ".\n";
return 0; return 0;
} }
} }
@@ -1497,16 +1497,16 @@ namespace latebound_access {
void set(express::Base inst, const std::string& attr, T t); void set(express::Base inst, const std::string& attr, T t);
template <typename T> template <typename T>
void set_enumeration(express::Base, const std::string&, const IfcParse::enumeration_type*, T) {} void set_enumeration(express::Base, const std::string&, const ifcopenshell::enumeration_type*, T) {}
template <> template <>
void set_enumeration(express::Base inst, const std::string& attr, const IfcParse::enumeration_type* enum_type, std::string t) { void set_enumeration(express::Base inst, const std::string& attr, const ifcopenshell::enumeration_type* enum_type, std::string t) {
std::vector<std::string>::const_iterator it = std::find( std::vector<std::string>::const_iterator it = std::find(
enum_type->enumeration_items().begin(), enum_type->enumeration_items().begin(),
enum_type->enumeration_items().end(), enum_type->enumeration_items().end(),
t); t);
return set(inst, attr, EnumerationReference(enum_type, it - enum_type->enumeration_items().begin())); return set(inst, attr, enumeration_reference(enum_type, it - enum_type->enumeration_items().begin()));
} }
template <typename T> template <typename T>
@@ -1515,26 +1515,26 @@ namespace latebound_access {
auto i = decl->attribute_index(attr); auto i = decl->attribute_index(attr);
auto attr_type = decl->attribute_by_index(i)->type_of_attribute(); auto attr_type = decl->attribute_by_index(i)->type_of_attribute();
if (attr_type->as_named_type() && attr_type->as_named_type()->declared_type()->as_enumeration_type() && !std::is_same<T, EnumerationReference>::value) { if (attr_type->as_named_type() && attr_type->as_named_type()->declared_type()->as_enumeration_type() && !std::is_same<T, enumeration_reference>::value) {
set_enumeration(inst, attr, attr_type->as_named_type()->declared_type()->as_enumeration_type(), t); set_enumeration(inst, attr, attr_type->as_named_type()->declared_type()->as_enumeration_type(), t);
} else { } else {
inst.set_attribute_value(i, t); inst.set_attribute_value(i, t);
} }
} }
express::Base create(IfcParse::IfcFile& f, const std::string& entity) { express::Base create(ifcopenshell::file& f, const std::string& entity) {
auto decl = f.schema()->declaration_by_name(entity); auto decl = f.schema()->declaration_by_name(entity);
return f.create(decl); return f.create(decl);
} }
} }
void fix_quantities(IfcParse::IfcFile& f, bool no_progress, bool quiet, bool stderr_progress) { void fix_quantities(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress) {
{ {
auto delete_reversed = [&f](const std::vector<express::Base>& insts) { auto delete_reversed = [&f](const std::vector<express::Base>& insts) {
// Lists are traversed back to front as the list may be mutated when // Lists are traversed back to front as the list may be mutated when
// instances are removed from the grouping by type. // instances are removed from the grouping by type.
for (auto it = insts.end() - 1; it >= insts.begin(); --it) { for (auto it = insts.end() - 1; it >= insts.begin(); --it) {
f.removeEntity(*it); f.remove_entity(*it);
} }
}; };
@@ -1542,7 +1542,7 @@ void fix_quantities(IfcParse::IfcFile& f, bool no_progress, bool quiet, bool std
auto quantities = f.instances_by_type("IfcPhysicalQuantity"); auto quantities = f.instances_by_type("IfcPhysicalQuantity");
for (auto it = quantities.end() - 1; it >= quantities.begin(); --it) { for (auto it = quantities.end() - 1; it >= quantities.begin(); --it) {
if (!it->declaration().is("IfcPhysicalComplexQuantity")) { if (!it->declaration().is("IfcPhysicalComplexQuantity")) {
f.removeEntity(*it); f.remove_entity(*it);
} }
} }
@@ -1556,7 +1556,7 @@ void fix_quantities(IfcParse::IfcFile& f, bool no_progress, bool quiet, bool std
auto IfcRelDefinesByProperties = f.schema()->declaration_by_name("IfcRelDefinesByProperties"); auto IfcRelDefinesByProperties = f.schema()->declaration_by_name("IfcRelDefinesByProperties");
for (auto& eq : element_quantities) { for (auto& eq : element_quantities) {
auto rels = eq.file()->getInverse(eq.id(), IfcRelDefinesByProperties, -1); auto rels = eq.file()->get_inverse(eq.id(), IfcRelDefinesByProperties, -1);
for (auto& rel : rels) { for (auto& rel : rels) {
relationships.push_back(rel); relationships.push_back(rel);
} }
@@ -1568,7 +1568,7 @@ void fix_quantities(IfcParse::IfcFile& f, bool no_progress, bool quiet, bool std
// Delete relationship nodes // Delete relationship nodes
for (auto& rel : relationships) { for (auto& rel : relationships) {
f.removeEntity(rel); f.remove_entity(rel);
} }
} }
@@ -1706,7 +1706,7 @@ void fix_quantities(IfcParse::IfcFile& f, bool no_progress, bool quiet, bool std
cerr_ << std::flush; cerr_ << std::flush;
} else { } else {
const int progress = context_iterator.progress() / 2; 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; old_progress = progress;
} }
} }
@@ -1722,7 +1722,7 @@ void fix_quantities(IfcParse::IfcFile& f, bool no_progress, bool quiet, bool std
if (stderr_progress) if (stderr_progress)
cerr_ << std::flush; cerr_ << std::flush;
} else { } 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 "); " objects ");
} }
+15 -15
View File
@@ -18,29 +18,29 @@ typedef CGAL::AABB_traits<Kernel_, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree; typedef CGAL::AABB_tree<Traits> Tree;
typedef Tree::Point_and_primitive_id Point_and_primitive_id; typedef Tree::Point_and_primitive_id Point_and_primitive_id;
void fix_spaceboundaries(IfcParse::IfcFile& f, bool no_progress, bool quiet, bool stderr_progress) { void fix_spaceboundaries(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress) {
intersection_validator v(f, { "IfcWall", "IfcSpace", "IfcSlab", "IfcCovering" }, 1.e-5, no_progress, quiet, stderr_progress); intersection_validator v(f, { "IfcWall", "IfcSpace", "IfcSlab", "IfcCovering" }, 1.e-5, no_progress, quiet, stderr_progress);
auto rels = f.instances_by_type("IfcRelSpaceBoundary"); auto rels = f.instances_by_type("IfcRelSpaceBoundary");
std::map<std::pair<const IfcUtil::IfcBaseClass*, const IfcUtil::IfcBaseClass*>, const IfcUtil::IfcBaseClass*> rel_by_space_elem; std::map<std::pair<const ifcopenshell::IfcBaseClass*, const ifcopenshell::IfcBaseClass*>, const ifcopenshell::IfcBaseClass*> rel_by_space_elem;
if (rels) { if (rels) {
std::for_each(rels->begin(), rels->end(), [&rel_by_space_elem](const IfcUtil::IfcBaseClass* rel) { std::for_each(rels->begin(), rels->end(), [&rel_by_space_elem](const ifcopenshell::IfcBaseClass* rel) {
auto x = ((IfcUtil::IfcBaseEntity*)rel)->get_value<IfcUtil::IfcBaseClass*>("RelatingSpace"); auto x = ((ifcopenshell::IfcBaseEntity*)rel)->get_value<ifcopenshell::IfcBaseClass*>("RelatingSpace");
try { try {
auto y = ((IfcUtil::IfcBaseEntity*)rel)->get_value<IfcUtil::IfcBaseClass*>("RelatedBuildingElement"); auto y = ((ifcopenshell::IfcBaseEntity*)rel)->get_value<ifcopenshell::IfcBaseClass*>("RelatedBuildingElement");
rel_by_space_elem.insert({ { x,y }, rel }); rel_by_space_elem.insert({ { x,y }, rel });
} catch (IfcParse::IfcException&) { } catch (ifcopenshell::exception&) {
// RelatedBuildingElement can be NULL // RelatedBuildingElement can be NULL
} }
}); });
} }
std::set<const IfcUtil::IfcBaseClass*> rels_encounted; std::set<const ifcopenshell::IfcBaseClass*> rels_encounted;
IfcParse::IfcFile f2("boundaries-triangulated.ifc"); ifcopenshell::file f2("boundaries-triangulated.ifc");
if (!f2.good()) { if (!f2.good()) {
return; return;
} }
@@ -59,7 +59,7 @@ void fix_spaceboundaries(IfcParse::IfcFile& f, bool no_progress, bool quiet, boo
std::map<std::set<std::string>, std::vector<Kernel_::Point_3>> elem_to_space_boundary_coords; std::map<std::set<std::string>, std::vector<Kernel_::Point_3>> elem_to_space_boundary_coords;
for (auto& i : *f2.instances_by_type("IfcProduct")) { for (auto& i : *f2.instances_by_type("IfcProduct")) {
auto n = ((IfcUtil::IfcBaseEntity*)i)->get_value<std::string>("Name"); auto n = ((ifcopenshell::IfcBaseEntity*)i)->get_value<std::string>("Name");
auto g1 = n.substr(0, 22); auto g1 = n.substr(0, 22);
auto g2 = n.substr(23); auto g2 = n.substr(23);
auto item = c.mapping()->map(i); auto item = c.mapping()->map(i);
@@ -83,7 +83,7 @@ void fix_spaceboundaries(IfcParse::IfcFile& f, bool no_progress, bool quiet, boo
v([&rel_by_space_elem, &elem_to_space_boundary_coords, &guid_pairs_visited](const intersection_validator::Box& a, const intersection_validator::Box& b) { v([&rel_by_space_elem, &elem_to_space_boundary_coords, &guid_pairs_visited](const intersection_validator::Box& a, const intersection_validator::Box& b) {
std::ostringstream ss; std::ostringstream ss;
// ss << id_map[a.id()]->first->data().toString() << "x" << id_map[b.id()]->first->data().toString() << std::endl; // ss << id_map[a.id()]->first->data().to_string() << "x" << id_map[b.id()]->first->data().to_string() << std::endl;
// auto x = id_map[a.id()]->second * id_map[b.id()]->second; // auto x = id_map[a.id()]->second * id_map[b.id()]->second;
auto A = a.handle()->first; auto A = a.handle()->first;
@@ -103,7 +103,7 @@ void fix_spaceboundaries(IfcParse::IfcFile& f, bool no_progress, bool quiet, boo
return; return;
} }
ss << a.handle()->first->data().toString() << "x" << a.handle()->first->data().toString() << std::endl; ss << a.handle()->first->data().to_string() << "x" << a.handle()->first->data().to_string() << std::endl;
auto x = a.handle()->second * b.handle()->second; auto x = a.handle()->second * b.handle()->second;
if (x.is_empty()) { if (x.is_empty()) {
@@ -128,7 +128,7 @@ void fix_spaceboundaries(IfcParse::IfcFile& f, bool no_progress, bool quiet, boo
auto itelem = elem_to_space_boundary_coords.find({ Aguid, Bguid }); auto itelem = elem_to_space_boundary_coords.find({ Aguid, Bguid });
if (itelem == elem_to_space_boundary_coords.end()) { if (itelem == elem_to_space_boundary_coords.end()) {
Logger::Error("Missing space boundary relationship " + Aguid + " " + Bguid); logger::error("Missing space boundary relationship " + Aguid + " " + Bguid);
return; return;
} }
@@ -141,7 +141,7 @@ void fix_spaceboundaries(IfcParse::IfcFile& f, bool no_progress, bool quiet, boo
bool valid = *std::max_element(distances.begin(), distances.end()) < 0.4; bool valid = *std::max_element(distances.begin(), distances.end()) < 0.4;
if (!valid) { if (!valid) {
Logger::Error("Wrong connection geometry " + Aguid + " " + Bguid); logger::error("Wrong connection geometry " + Aguid + " " + Bguid);
} }
/*{ /*{
@@ -174,11 +174,11 @@ void fix_spaceboundaries(IfcParse::IfcFile& f, bool no_progress, bool quiet, boo
}; };
for (auto& i : *f2.instances_by_type("IfcProduct")) { for (auto& i : *f2.instances_by_type("IfcProduct")) {
auto n = ((IfcUtil::IfcBaseEntity*)i)->get_value<std::string>("Name"); auto n = ((ifcopenshell::IfcBaseEntity*)i)->get_value<std::string>("Name");
auto g1 = n.substr(0, 22); auto g1 = n.substr(0, 22);
auto g2 = n.substr(23); 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()) { 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("Space boundary for non-bounding geometry " + g1 + " " + g2); logger::error("Space boundary for non-bounding geometry " + g1 + " " + g2);
} }
} }
} }
+16 -16
View File
@@ -9,7 +9,7 @@
#include <algorithm> #include <algorithm>
void fix_storeycontainment(IfcParse::IfcFile& f, bool no_progress, bool quiet, bool stderr_progress) { void fix_storeycontainment(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress) {
ifcopenshell::geometry::Settings settings; ifcopenshell::geometry::Settings settings;
settings.get<ifcopenshell::geometry::settings::UseWorldCoords>().value = false; settings.get<ifcopenshell::geometry::settings::UseWorldCoords>().value = false;
@@ -25,16 +25,16 @@ void fix_storeycontainment(IfcParse::IfcFile& f, bool no_progress, bool quiet, b
IfcGeom::Iterator context_iterator("cgal", settings, &f, no_openings_and_spaces, 1); IfcGeom::Iterator context_iterator("cgal", settings, &f, no_openings_and_spaces, 1);
auto get_elevation = [](const IfcUtil::IfcBaseClass* a) { auto get_elevation = [](const ifcopenshell::IfcBaseClass* a) {
return ((const IfcUtil::IfcBaseEntity*)a)->get_value<double>("Elevation", 0.); return ((const ifcopenshell::IfcBaseEntity*)a)->get_value<double>("Elevation", 0.);
}; };
// latebound inverse attribute lookup not working // latebound inverse attribute lookup not working
auto rels = f.instances_by_type("IfcRelContainedInSpatialStructure"); auto rels = f.instances_by_type("IfcRelContainedInSpatialStructure");
std::map<const IfcUtil::IfcBaseClass*, const IfcUtil::IfcBaseClass*> elem_to_storey; std::map<const ifcopenshell::IfcBaseClass*, const ifcopenshell::IfcBaseClass*> elem_to_storey;
std::for_each(rels->begin(), rels->end(), [&elem_to_storey](IfcUtil::IfcBaseClass* r) { std::for_each(rels->begin(), rels->end(), [&elem_to_storey](ifcopenshell::IfcBaseClass* r) {
auto elems = ((IfcUtil::IfcBaseEntity*)r)->get_value<aggregate_of_instance::ptr>("RelatedElements"); auto elems = ((ifcopenshell::IfcBaseEntity*)r)->get_value<aggregate_of_instance::ptr>("RelatedElements");
auto storey = ((IfcUtil::IfcBaseEntity*)r)->get_value<IfcUtil::IfcBaseClass*>("RelatingStructure"); auto storey = ((ifcopenshell::IfcBaseEntity*)r)->get_value<ifcopenshell::IfcBaseClass*>("RelatingStructure");
if (storey->declaration().name() == "IfcBuildingStorey") { if (storey->declaration().name() == "IfcBuildingStorey") {
for (auto it = elems->begin(); it != elems->end(); ++it) { for (auto it = elems->begin(); it != elems->end(); ++it) {
@@ -44,15 +44,15 @@ void fix_storeycontainment(IfcParse::IfcFile& f, bool no_progress, bool quiet, b
}); });
auto storeys = f.instances_by_type("IfcBuildingStorey"); auto storeys = f.instances_by_type("IfcBuildingStorey");
std::vector<const IfcUtil::IfcBaseClass*> storeys_sorted(storeys->begin(), storeys->end()); std::vector<const ifcopenshell::IfcBaseClass*> storeys_sorted(storeys->begin(), storeys->end());
std::sort(storeys_sorted.begin(), storeys_sorted.end(), [&get_elevation](const IfcUtil::IfcBaseClass* a, const IfcUtil::IfcBaseClass* b) { std::sort(storeys_sorted.begin(), storeys_sorted.end(), [&get_elevation](const ifcopenshell::IfcBaseClass* a, const ifcopenshell::IfcBaseClass* b) {
return get_elevation(a) < get_elevation(b); return get_elevation(a) < get_elevation(b);
}); });
/* /*
std::wcout << "Storeys "; std::wcout << "Storeys ";
for (auto& s : storeys_sorted) { for (auto& s : storeys_sorted) {
auto n = ((IfcUtil::IfcBaseEntity*)s)->get_value<std::string>("Name"); auto n = ((ifcopenshell::IfcBaseEntity*)s)->get_value<std::string>("Name");
std::wcout << n.c_str() << " "; std::wcout << n.c_str() << " ";
} }
std::wcout << std::endl; std::wcout << std::endl;
@@ -121,7 +121,7 @@ void fix_storeycontainment(IfcParse::IfcFile& f, bool no_progress, bool quiet, b
/* /*
std::stringstream ss; std::stringstream ss;
ss << geom_object->product()->data().toString(); ss << geom_object->product()->data().to_string();
auto sss = ss.str(); auto sss = ss.str();
std::wcout << sss.c_str() << std::endl; std::wcout << sss.c_str() << std::endl;
*/ */
@@ -196,9 +196,9 @@ void fix_storeycontainment(IfcParse::IfcFile& f, bool no_progress, bool quiet, b
auto assigned_overlap = intersection_volumes[assigned_idx]; auto assigned_overlap = intersection_volumes[assigned_idx];
if (calc_overlap > 0 && assigned_overlap < calc_overlap * 0.9) { if (calc_overlap > 0 && assigned_overlap < calc_overlap * 0.9) {
auto s = geom_object->product()->get_value<std::string>("GlobalId"); auto s = geom_object->product()->get_value<std::string>("GlobalId");
auto s1 = ((IfcUtil::IfcBaseEntity*)storeys_sorted[calc_idx])->get_value<std::string>("GlobalId"); auto s1 = ((ifcopenshell::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"); auto s2 = ((ifcopenshell::IfcBaseEntity*)elem_to_storey[geom_object->product()])->get_value<std::string>("GlobalId");
Logger::Error("Element " + s + " contained in " + s2 + " located on " + s1); logger::error("Element " + s + " contained in " + s2 + " located on " + s1);
} }
if (!no_progress) { if (!no_progress) {
@@ -214,7 +214,7 @@ void fix_storeycontainment(IfcParse::IfcFile& f, bool no_progress, bool quiet, b
std::cerr << std::flush; std::cerr << std::flush;
} else { } else {
const int progress = context_iterator.progress() / 2; 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; old_progress = progress;
} }
} }
@@ -230,7 +230,7 @@ void fix_storeycontainment(IfcParse::IfcFile& f, bool no_progress, bool quiet, b
if (stderr_progress) if (stderr_progress)
std::cerr << std::flush; std::cerr << std::flush;
} else { } 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 "); " objects ");
} }
} }
+18 -18
View File
@@ -9,7 +9,7 @@
using namespace ifcopenshell::geometry; using namespace ifcopenshell::geometry;
void fix_wallconnectivity(IfcParse::IfcFile& f, bool no_progress, bool quiet, bool stderr_progress) { void fix_wallconnectivity(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress) {
intersection_validator v(f, { "IfcWall" }, 1.e-3, no_progress, quiet, stderr_progress); intersection_validator v(f, { "IfcWall" }, 1.e-3, no_progress, quiet, stderr_progress);
ifcopenshell::geometry::Settings settings; ifcopenshell::geometry::Settings settings;
@@ -27,14 +27,14 @@ void fix_wallconnectivity(IfcParse::IfcFile& f, bool no_progress, bool quiet, bo
ifcopenshell::geometry::Converter c("cgal", &f, settings); ifcopenshell::geometry::Converter c("cgal", &f, settings);
auto rels = f.instances_by_type("IfcRelConnectsPathElements"); auto rels = f.instances_by_type("IfcRelConnectsPathElements");
std::map<std::set<const IfcUtil::IfcBaseClass*>, const IfcUtil::IfcBaseClass*> rel_by_elem; std::map<std::set<const ifcopenshell::IfcBaseClass*>, const ifcopenshell::IfcBaseClass*> rel_by_elem;
std::for_each(rels->begin(), rels->end(), [&rel_by_elem](const IfcUtil::IfcBaseClass* rel) { std::for_each(rels->begin(), rels->end(), [&rel_by_elem](const ifcopenshell::IfcBaseClass* rel) {
auto x = ((IfcUtil::IfcBaseEntity*)rel)->get_value<IfcUtil::IfcBaseClass*>("RelatingElement"); auto x = ((ifcopenshell::IfcBaseEntity*)rel)->get_value<ifcopenshell::IfcBaseClass*>("RelatingElement");
auto y = ((IfcUtil::IfcBaseEntity*)rel)->get_value<IfcUtil::IfcBaseClass*>("RelatedElement"); auto y = ((ifcopenshell::IfcBaseEntity*)rel)->get_value<ifcopenshell::IfcBaseClass*>("RelatedElement");
rel_by_elem.insert({{ x,y }, rel}); rel_by_elem.insert({{ x,y }, rel});
}); });
std::set<const IfcUtil::IfcBaseClass*> rels_encounted; std::set<const ifcopenshell::IfcBaseClass*> rels_encounted;
double total_nef_intersection_time = 0.; double total_nef_intersection_time = 0.;
double conversion_to_poly = 0.; double conversion_to_poly = 0.;
@@ -43,15 +43,15 @@ void fix_wallconnectivity(IfcParse::IfcFile& f, bool no_progress, bool quiet, bo
auto A = a.handle()->first; auto A = a.handle()->first;
auto B = b.handle()->first; auto B = b.handle()->first;
const IfcUtil::IfcBaseClass* rel = nullptr; const ifcopenshell::IfcBaseClass* rel = nullptr;
std::string a_type, b_type; std::string a_type, b_type;
auto rit = rel_by_elem.find({ A, B }); auto rit = rel_by_elem.find({ A, B });
if (rit != rel_by_elem.end()) { if (rit != rel_by_elem.end()) {
rel = rit->second; rel = rit->second;
const bool a_is_relating = A == ((IfcUtil::IfcBaseEntity*)rel)->get_value<IfcUtil::IfcBaseClass*>("RelatingElement"); const bool a_is_relating = A == ((ifcopenshell::IfcBaseEntity*)rel)->get_value<ifcopenshell::IfcBaseClass*>("RelatingElement");
a_type = ((IfcUtil::IfcBaseEntity*)rel)->get_value<std::string>("RelatingConnectionType"); a_type = ((ifcopenshell::IfcBaseEntity*)rel)->get_value<std::string>("RelatingConnectionType");
b_type = ((IfcUtil::IfcBaseEntity*)rel)->get_value<std::string>("RelatedConnectionType"); b_type = ((ifcopenshell::IfcBaseEntity*)rel)->get_value<std::string>("RelatedConnectionType");
if (!a_is_relating) { if (!a_is_relating) {
std::swap(a_type, b_type); std::swap(a_type, b_type);
} }
@@ -79,7 +79,7 @@ void fix_wallconnectivity(IfcParse::IfcFile& f, bool no_progress, bool quiet, bo
#endif #endif
std::ostringstream ss; std::ostringstream ss;
ss << A->data().toString() << "x" << B->data().toString() << std::endl; ss << A->data().to_string() << "x" << B->data().to_string() << std::endl;
std::clock_t intersection_begin = std::clock(); std::clock_t intersection_begin = std::clock();
auto x = a.handle()->second * b.handle()->second; auto x = a.handle()->second * b.handle()->second;
std::clock_t intersection_end = std::clock(); std::clock_t intersection_end = std::clock();
@@ -108,7 +108,7 @@ void fix_wallconnectivity(IfcParse::IfcFile& f, bool no_progress, bool quiet, bo
return; return;
} }
auto get_axis_parameter_min_max = [&c, &x_poly](const IfcUtil::IfcBaseEntity* inst) { auto get_axis_parameter_min_max = [&c, &x_poly](const ifcopenshell::IfcBaseEntity* inst) {
auto item = c.mapping()->map(inst); auto item = c.mapping()->map(inst);
auto shaperep = taxonomy::cast<taxonomy::collection>(item)->children[0]; auto shaperep = taxonomy::cast<taxonomy::collection>(item)->children[0];
auto loop = taxonomy::dcast<taxonomy::loop>(taxonomy::cast<taxonomy::collection>(shaperep)->children[0]); auto loop = taxonomy::dcast<taxonomy::loop>(taxonomy::cast<taxonomy::collection>(shaperep)->children[0]);
@@ -169,21 +169,21 @@ void fix_wallconnectivity(IfcParse::IfcFile& f, bool no_progress, bool quiet, bo
if (a_type != atype_computed || b_type != btype_computed) { if (a_type != atype_computed || b_type != btype_computed) {
if (rel) { if (rel) {
Logger::Error(std::string("Connection type ") + atype_computed + " " + btype_computed + " for:", rel); logger::error(std::string("Connection type ") + atype_computed + " " + btype_computed + " for:", rel);
} else { } else {
auto A_str = A->get_value<std::string>("GlobalId"); auto A_str = A->get_value<std::string>("GlobalId");
auto B_str = B->get_value<std::string>("GlobalId"); auto B_str = B->get_value<std::string>("GlobalId");
Logger::Error("No connection for adjacent " + A_str + " " + B_str); logger::error("No connection for adjacent " + A_str + " " + B_str);
} }
} }
}); });
std::for_each(rels->begin(), rels->end(), [&rels_encounted, &v](const IfcUtil::IfcBaseClass* rel) { std::for_each(rels->begin(), rels->end(), [&rels_encounted, &v](const ifcopenshell::IfcBaseClass* rel) {
if (rels_encounted.find(rel) == rels_encounted.end()) { if (rels_encounted.find(rel) == rels_encounted.end()) {
auto x = (IfcUtil::IfcBaseEntity*)((IfcUtil::IfcBaseEntity*)rel)->get_value<IfcUtil::IfcBaseClass*>("RelatingElement"); auto x = (ifcopenshell::IfcBaseEntity*)((ifcopenshell::IfcBaseEntity*)rel)->get_value<ifcopenshell::IfcBaseClass*>("RelatingElement");
auto y = (IfcUtil::IfcBaseEntity*)((IfcUtil::IfcBaseEntity*)rel)->get_value<IfcUtil::IfcBaseClass*>("RelatedElement"); 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()) { if (v.successfully_processed.find(x) != v.successfully_processed.end() && v.successfully_processed.find(y) != v.successfully_processed.end()) {
Logger::Error("Connection for non-adjacent walls", rel); logger::error("Connection for non-adjacent walls", rel);
} }
} }
}); });
+7 -7
View File
@@ -431,7 +431,7 @@ struct remove_thickness {
struct intersection_validator { struct intersection_validator {
typedef std::list<std::pair<const IfcUtil::IfcBaseEntity*, CGAL::Nef_polyhedron_3<Kernel_>> > nefs_t; typedef std::list<std::pair<const ifcopenshell::IfcBaseEntity*, CGAL::Nef_polyhedron_3<Kernel_>> > nefs_t;
typedef CGAL::Box_intersection_d::Box_with_handle_d<double, 3, nefs_t::value_type*> Box; typedef CGAL::Box_intersection_d::Box_with_handle_d<double, 3, nefs_t::value_type*> Box;
std::vector<Box> boxes; std::vector<Box> boxes;
@@ -443,9 +443,9 @@ struct intersection_validator {
double total_minkowsky_time = 0.; double total_minkowsky_time = 0.;
double total_box_time = 0.; double total_box_time = 0.;
std::set<const IfcUtil::IfcBaseEntity*> successfully_processed; std::set<const ifcopenshell::IfcBaseEntity*> successfully_processed;
intersection_validator(IfcParse::IfcFile& f, std::initializer_list<std::string> entities, double eps, bool no_progress, bool quiet, bool stderr_progress) { intersection_validator(ifcopenshell::file& f, std::initializer_list<std::string> entities, double eps, bool no_progress, bool quiet, bool stderr_progress) {
ifcopenshell::geometry::Settings settings; ifcopenshell::geometry::Settings settings;
settings.get<ifcopenshell::geometry::settings::UseWorldCoords>().value = false; settings.get<ifcopenshell::geometry::settings::UseWorldCoords>().value = false;
@@ -485,7 +485,7 @@ struct intersection_validator {
} }
std::stringstream ss; std::stringstream ss;
geom_object->product()->toString(ss); geom_object->product()->to_string(ss);
auto sss = ss.str(); auto sss = ss.str();
std::wcout << sss.c_str() << std::endl; std::wcout << sss.c_str() << std::endl;
@@ -543,7 +543,7 @@ struct intersection_validator {
/* /*
std::ostringstream ss; std::ostringstream ss;
ss << geom_object->product()->data().toString() << std::endl << b.min_coord(0) << " - " << b.max_coord(0) << std::endl; ss << geom_object->product()->data().to_string() << std::endl << b.min_coord(0) << " - " << b.max_coord(0) << std::endl;
auto sss = ss.str(); auto sss = ss.str();
std::wcout << sss.c_str(); std::wcout << sss.c_str();
*/ */
@@ -562,7 +562,7 @@ struct intersection_validator {
std::cerr << std::flush; std::cerr << std::flush;
} else { } else {
const int progress = context_iterator.progress() / 2; 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; old_progress = progress;
} }
} }
@@ -578,7 +578,7 @@ struct intersection_validator {
if (stderr_progress) if (stderr_progress)
std::cerr << std::flush; std::cerr << std::flush;
} else { } 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 "); " objects ");
} }
+2 -2
View File
@@ -20,7 +20,7 @@ bool ifcopenshell::geometry::kernels::AbstractKernel::convert(const taxonomy::pt
auto it = cache_.find(item); auto it = cache_.find(item);
if (it != cache_.end()) { if (it != cache_.end()) {
results = it->second; results = it->second;
Logger::Notice("Cache hit #" + std::to_string(item->instance.id()) + logger::notice("Cache hit #" + std::to_string(item->instance.id()) +
" -> #" + std::to_string(it->first->instance.id())); " -> #" + std::to_string(it->first->instance.id()));
return true; return true;
} }
@@ -30,7 +30,7 @@ bool ifcopenshell::geometry::kernels::AbstractKernel::convert(const taxonomy::pt
try { try {
return fn(); return fn();
} catch (std::exception& e) { } catch (std::exception& e) {
Logger::Error(e, item->instance); logger::error(e, item->instance);
return false; return false;
} catch (...) { } catch (...) {
// @todo we can't log OCCT exceptions here, can we do some reraising to solve this? // @todo we can't log OCCT exceptions here, can we do some reraising to solve this?
+5 -5
View File
@@ -21,7 +21,7 @@
#define ABSTRACT_KERNEL_H #define ABSTRACT_KERNEL_H
#include "../ifcparse/macros.h" #include "../ifcparse/macros.h"
#include "../ifcparse/IfcLogger.h" #include "../ifcparse/logger.h"
#include "../ifcgeom/ifc_geom_api.h" #include "../ifcgeom/ifc_geom_api.h"
#include "../ifcgeom/IfcGeomRepresentation.h" #include "../ifcgeom/IfcGeomRepresentation.h"
#include "../ifcgeom/taxonomy.h" #include "../ifcgeom/taxonomy.h"
@@ -150,7 +150,7 @@ namespace {
template <> template <>
struct dispatch_conversion<ifcopenshell::geometry::taxonomy::type_by_kind::max> { struct dispatch_conversion<ifcopenshell::geometry::taxonomy::type_by_kind::max> {
static bool dispatch(ifcopenshell::geometry::kernels::AbstractKernel*, ifcopenshell::geometry::taxonomy::kinds, const ifcopenshell::geometry::taxonomy::ptr& item, IfcGeom::ConversionResults&) { static bool dispatch(ifcopenshell::geometry::kernels::AbstractKernel*, ifcopenshell::geometry::taxonomy::kinds, const ifcopenshell::geometry::taxonomy::ptr& item, IfcGeom::ConversionResults&) {
Logger::Error("No conversion for " + std::to_string(item->kind())); logger::error("No conversion for " + std::to_string(item->kind()));
return false; return false;
} }
}; };
@@ -170,7 +170,7 @@ namespace {
template <> template <>
struct dispatch_with_upgrade<ifcopenshell::geometry::taxonomy::upgrades::max> { struct dispatch_with_upgrade<ifcopenshell::geometry::taxonomy::upgrades::max> {
static bool dispatch(ifcopenshell::geometry::kernels::AbstractKernel*, const ifcopenshell::geometry::taxonomy::ptr& item, IfcGeom::ConversionResults&) { static bool dispatch(ifcopenshell::geometry::kernels::AbstractKernel*, const ifcopenshell::geometry::taxonomy::ptr& item, IfcGeom::ConversionResults&) {
Logger::Error("No conversion with upgrade for " + std::to_string(item->kind())); logger::error("No conversion with upgrade for " + std::to_string(item->kind()));
return false; return false;
} }
}; };
@@ -206,7 +206,7 @@ namespace {
template <typename T> template <typename T>
struct dispatch_curve_creation<T, ifcopenshell::geometry::taxonomy::curves::max> { struct dispatch_curve_creation<T, ifcopenshell::geometry::taxonomy::curves::max> {
static bool dispatch(const ifcopenshell::geometry::taxonomy::ptr& item, T&) { static bool dispatch(const ifcopenshell::geometry::taxonomy::ptr& item, T&) {
Logger::Error("No conversion for " + std::to_string(item->kind())); logger::error("No conversion for " + std::to_string(item->kind()));
return false; return false;
} }
}; };
@@ -228,7 +228,7 @@ namespace {
template <typename T> template <typename T>
struct dispatch_surface_creation<T, ifcopenshell::geometry::taxonomy::surfaces::max> { struct dispatch_surface_creation<T, ifcopenshell::geometry::taxonomy::surfaces::max> {
static bool dispatch(const ifcopenshell::geometry::taxonomy::ptr& item, T&) { static bool dispatch(const ifcopenshell::geometry::taxonomy::ptr& item, T&) {
Logger::Error("No conversion for " + std::to_string(item->kind())); logger::error("No conversion for " + std::to_string(item->kind()));
return false; return false;
} }
}; };
+17 -17
View File
@@ -4,7 +4,7 @@
using namespace ifcopenshell::geometry; using namespace ifcopenshell::geometry;
ifcopenshell::geometry::Converter::Converter(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, IfcParse::IfcFile* file, ifcopenshell::geometry::Settings& s) ifcopenshell::geometry::Converter::Converter(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, ifcopenshell::file* file, ifcopenshell::geometry::Settings& s)
: kernel_(std::move(geometry_library)) : kernel_(std::move(geometry_library))
{ {
mapping_ = impl::mapping_implementations().construct(file, s); mapping_ = impl::mapping_implementations().construct(file, s);
@@ -32,7 +32,7 @@ namespace {
if (density > 1e5) { if (density > 1e5) {
items[0].Shape()->set_box(box); items[0].Shape()->set_box(box);
items.erase(items.begin() + 1, items.end()); items.erase(items.begin() + 1, items.end());
Logger::Notice("Substituted element with " + boost::lexical_cast<std::string>(density) + " vertices / m3 with a bounding box"); logger::notice("Substituted element with " + boost::lexical_cast<std::string>(density) + " vertices / m3 with a bounding box");
} }
} }
} }
@@ -104,7 +104,7 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
} }
if (!success) { if (!success) {
Logger::Error("Failed processing layerset"); logger::error("Failed processing layerset");
} }
} }
} }
@@ -143,7 +143,7 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
} }
} }
if (some_items_without_style) { if (some_items_without_style) {
Logger::Warning("No material and surface styles for:", product); logger::warning("No material and surface styles for:", product);
} }
} }
@@ -167,7 +167,7 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
parent_id = parent_object.id(); parent_id = parent_object.id();
} }
} catch (const std::exception& e) { } catch (const std::exception& e) {
Logger::Error(e); logger::error(e);
} }
const std::string name = product.get_value<std::string>("Name", ""); const std::string name = product.get_value<std::string>("Name", "");
@@ -213,10 +213,10 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
kernel_->convert_openings(product, opening_items, shapes, *place, opened_shapes); kernel_->convert_openings(product, opening_items, shapes, *place, opened_shapes);
} }
} catch (const std::exception& e) { } catch (const std::exception& e) {
Logger::Message(Logger::LOG_ERROR, std::string("Error processing openings for: ") + e.what() + ":", product); logger::message(logger::LOG_ERROR, std::string("error processing openings for: ") + e.what() + ":", product);
caught_error = true; caught_error = true;
} catch (...) { } catch (...) {
Logger::Message(Logger::LOG_ERROR, "Error processing openings for:", product); logger::message(logger::LOG_ERROR, "error processing openings for:", product);
} }
if (!(caught_error && opened_shapes.size() < shapes.size())) { if (!(caught_error && opened_shapes.size() < shapes.size())) {
@@ -244,7 +244,7 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
std::swap(shapes, unified_shapes); std::swap(shapes, unified_shapes);
} }
} catch (std::exception& e) { } catch (std::exception& e) {
Logger::Error(e); logger::error(e);
} }
} }
@@ -300,12 +300,12 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
if (elem->geometry().calculate_surface_area(a_calc)) { if (elem->geometry().calculate_surface_area(a_calc)) {
double diff = std::abs(a_calc - a_file); double diff = std::abs(a_calc - a_file);
if (diff / std::sqrt(a_file) > getValue(GV_PRECISION)) { if (diff / std::sqrt(a_file) > getValue(GV_PRECISION)) {
Logger::Error("Validation of surface area failed for:", product); logger::error("Validation of surface area failed for:", product);
} else { } else {
Logger::Notice("Validation of surface area succeeded for:", product); logger::notice("Validation of surface area succeeded for:", product);
} }
} else { } else {
Logger::Error("Validation of surface area failed for:", product); logger::error("Validation of surface area failed for:", product);
} }
} else if (q->as<IfcSchema::IfcQuantityVolume>() && q->Name() == "Volume") { } else if (q->as<IfcSchema::IfcQuantityVolume>() && q->Name() == "Volume") {
double v_calc; double v_calc;
@@ -313,12 +313,12 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
if (elem->geometry().calculate_volume(v_calc)) { if (elem->geometry().calculate_volume(v_calc)) {
double diff = std::abs(v_calc - v_file); double diff = std::abs(v_calc - v_file);
if (diff / std::sqrt(v_file) > getValue(GV_PRECISION)) { if (diff / std::sqrt(v_file) > getValue(GV_PRECISION)) {
Logger::Error("Validation of volume failed for:", product); logger::error("Validation of volume failed for:", product);
} else { } else {
Logger::Notice("Validation of volume succeeded for:", product); logger::notice("Validation of volume succeeded for:", product);
} }
} else { } else {
Logger::Error("Validation of volume failed for:", product); logger::error("Validation of volume failed for:", product);
} }
} else if (q->as<IfcSchema::IfcPhysicalComplexQuantity>() && q->Name() == "Shape Validation Properties") { } else if (q->as<IfcSchema::IfcPhysicalComplexQuantity>() && q->Name() == "Shape Validation Properties") {
auto qs2 = q->as<IfcSchema::IfcPhysicalComplexQuantity>()->HasQuantities(); auto qs2 = q->as<IfcSchema::IfcPhysicalComplexQuantity>()->HasQuantities();
@@ -337,9 +337,9 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
} }
} }
if (!all_succeeded) { if (!all_succeeded) {
Logger::Error("Validation of surface genus failed for:", product); logger::error("Validation of surface genus failed for:", product);
} else { } else {
Logger::Notice("Validation of surface genus succeeded for:", product); logger::notice("Validation of surface genus succeeded for:", product);
} }
} }
} }
@@ -363,7 +363,7 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_process
parent_id = parent_object.id(); parent_id = parent_object.id();
} }
} catch (const std::exception& e) { } catch (const std::exception& e) {
Logger::Error(e); logger::error(e);
} }
const std::string guid = product.get_value<std::string>("GlobalId"); const std::string guid = product.get_value<std::string>("GlobalId");
+2 -2
View File
@@ -1,7 +1,7 @@
#ifndef ITERATOR_KERNEL_H #ifndef ITERATOR_KERNEL_H
#define ITERATOR_KERNEL_H #define ITERATOR_KERNEL_H
#include "../ifcparse/IfcFile.h" #include "../ifcparse/file.h"
#include "../ifcgeom/ConversionSettings.h" #include "../ifcgeom/ConversionSettings.h"
#include "../ifcgeom/ConversionResult.h" #include "../ifcgeom/ConversionResult.h"
#include "../ifcgeom/abstract_mapping.h" #include "../ifcgeom/abstract_mapping.h"
@@ -25,7 +25,7 @@ namespace ifcopenshell { namespace geometry {
public: public:
ifcopenshell::geometry::kernels::AbstractKernel* kernel() { return &*kernel_; } ifcopenshell::geometry::kernels::AbstractKernel* kernel() { return &*kernel_; }
Converter(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, IfcParse::IfcFile* file, ifcopenshell::geometry::Settings& settings); Converter(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, ifcopenshell::file* file, ifcopenshell::geometry::Settings& settings);
~Converter(); ~Converter();
+3 -3
View File
@@ -113,7 +113,7 @@ public:
std::ostream& stream; std::ostream& stream;
stream_or_filename(const std::string& fn) stream_or_filename(const std::string& fn)
: ofs_(new std::ofstream(IfcUtil::path::from_utf8(fn).c_str())) : ofs_(new std::ofstream(ifcopenshell::path::from_utf8(fn).c_str()))
, stream(*ofs_) , stream(*ofs_)
{} {}
@@ -153,7 +153,7 @@ public:
virtual void write(const IfcGeom::TriangulationElement* o) = 0; virtual void write(const IfcGeom::TriangulationElement* o) = 0;
virtual void write(const IfcGeom::BRepElement* o) = 0; virtual void write(const IfcGeom::BRepElement* o) = 0;
virtual void setUnitNameAndMagnitude(const std::string& name, float magnitude) = 0; virtual void setUnitNameAndMagnitude(const std::string& name, float magnitude) = 0;
virtual IfcGeom::Element* read(IfcParse::IfcFile& f, const std::string& guid, const std::string& representation_id, read_type rt = READ_BREP) = 0; virtual IfcGeom::Element* read(ifcopenshell::file& f, const std::string& guid, const std::string& representation_id, read_type rt = READ_BREP) = 0;
const ifcopenshell::geometry::SerializerSettings& settings() const { return settings_; } const ifcopenshell::geometry::SerializerSettings& settings() const { return settings_; }
ifcopenshell::geometry::SerializerSettings& settings() { return settings_; } ifcopenshell::geometry::SerializerSettings& settings() { return settings_; }
@@ -179,7 +179,7 @@ class WriteOnlyGeometrySerializer : public GeometrySerializer {
public: public:
WriteOnlyGeometrySerializer(const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings) : GeometrySerializer(geometry_settings, settings) {} WriteOnlyGeometrySerializer(const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings) : GeometrySerializer(geometry_settings, settings) {}
virtual IfcGeom::Element* read(IfcParse::IfcFile&, const std::string&, const std::string&, read_type = READ_BREP) { virtual IfcGeom::Element* read(ifcopenshell::file&, const std::string&, const std::string&, read_type = READ_BREP) {
throw std::runtime_error("Not supported"); throw std::runtime_error("Not supported");
}; };
}; };
+6 -6
View File
@@ -23,10 +23,10 @@
#include <string> #include <string>
#include <algorithm> #include <algorithm>
#include "../ifcparse/Argument.h" #include "../ifcparse/argument.h"
#include "../ifcparse/IfcGlobalId.h" #include "../ifcparse/global_id.h"
#include "../ifcparse/IfcLogger.h" #include "../ifcparse/logger.h"
#include "../ifcparse/InstanceData.h" #include "../ifcparse/instance_data.h"
#include "../ifcgeom/IfcGeomRepresentation.h" #include "../ifcgeom/IfcGeomRepresentation.h"
#include "../ifcgeom/ifc_geom_api.h" #include "../ifcgeom/ifc_geom_api.h"
@@ -111,10 +111,10 @@ namespace IfcGeom {
oss << "project"; oss << "project";
} else { } else {
try { try {
oss << "product-" << IfcParse::IfcGlobalId(guid).formatted(); oss << "product-" << ifcopenshell::global_id(guid).formatted();
} catch (const std::exception& e) { } catch (const std::exception& e) {
oss << "product"; oss << "product";
Logger::Error(e); logger::error(e);
} }
} }
+1 -1
View File
@@ -29,7 +29,7 @@
#endif #endif
#include "../ifcgeom/AbstractKernel.h" #include "../ifcgeom/AbstractKernel.h"
#include "../ifcparse/IfcFile.h" #include "../ifcparse/file.h"
#include "../ifcgeom/abstract_mapping.h" #include "../ifcgeom/abstract_mapping.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
+29 -29
View File
@@ -31,7 +31,7 @@ bool IfcGeom::Iterator::initialize() {
try { try {
converter_->mapping()->get_representations(reps, filters_); converter_->mapping()->get_representations(reps, filters_);
} catch (const std::exception& e) { } catch (const std::exception& e) {
Logger::Error(e); logger::error(e);
} }
time_points[1] = high_resolution_clock::now(); time_points[1] = high_resolution_clock::now();
@@ -94,7 +94,7 @@ bool IfcGeom::Iterator::initialize() {
tasks_.back().item = p.first; tasks_.back().item = p.first;
tasks_.back().products = p.second; tasks_.back().products = p.second;
} }
Logger::Notice("Merged " + std::to_string(old_size) + " tasks into " + std::to_string(tasks_.size()) + " tasks due to permissive shape reuse"); logger::notice("Merged " + std::to_string(old_size) + " tasks into " + std::to_string(tasks_.size()) + " tasks due to permissive shape reuse");
} }
} }
@@ -139,10 +139,10 @@ bool IfcGeom::Iterator::initialize() {
} }
*/ */
Logger::Notice("Created " + boost::lexical_cast<std::string>(tasks_.size()) + " tasks for " + boost::lexical_cast<std::string>(num_products) + " products"); logger::notice("Created " + boost::lexical_cast<std::string>(tasks_.size()) + " tasks for " + boost::lexical_cast<std::string>(num_products) + " products");
if (tasks_.size() == 0) { if (tasks_.size() == 0) {
Logger::Warning("No representations encountered, aborting"); logger::warning("No representations encountered, aborting");
initialization_outcome_.emplace(false); initialization_outcome_.emplace(false);
} else if (!settings_.get<ifcopenshell::geometry::settings::DeferProcessingFirstElement>().get()) { } else if (!settings_.get<ifcopenshell::geometry::settings::DeferProcessingFirstElement>().get()) {
@@ -231,14 +231,14 @@ void IfcGeom::Iterator::process_concurrently() {
try { try {
this->create_element_(kernel, settings, rep); this->create_element_(kernel, settings, rep);
} catch (const std::exception& e) { } catch (const std::exception& e) {
Logger::Error( logger::error(
std::string("Exception '") + e.what() + std::string("Exception '") + e.what() +
std::string("' occurred while iterator was creating a shape: "), std::string("' occurred while iterator was creating a shape: "),
rep->item->instance rep->item->instance
); );
had_error_processing_elements_ = true; had_error_processing_elements_ = true;
} catch (...) { } catch (...) {
Logger::Error( logger::error(
"Unknown exception occurred while iteartor was creating a shape: ", "Unknown exception occurred while iteartor was creating a shape: ",
rep->item->instance rep->item->instance
); );
@@ -263,10 +263,10 @@ void IfcGeom::Iterator::process_concurrently() {
finished_ = true; finished_ = true;
Logger::SetProduct(std::nullopt); logger::set_product(std::nullopt);
if (!terminating_) { 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) "); " objects) ");
} }
} }
@@ -360,20 +360,20 @@ void IfcGeom::Iterator::create_element_(ifcopenshell::geometry::Converter* kerne
const express::Base product = product_node.first; const express::Base product = product_node.first;
const auto& place = product_node.second; const auto& place = product_node.second;
Logger::SetProduct(product); logger::set_product(product);
IfcGeom::BRepElement* brep = static_cast<IfcGeom::BRepElement*>(decorate_with_cache_(GeometrySerializer::READ_BREP, (std::string)product.as<express::Entity>().get("GlobalId"), std::to_string(rep->item->instance.id()), [kernel, settings, product, place, rep]() { IfcGeom::BRepElement* brep = static_cast<IfcGeom::BRepElement*>(decorate_with_cache_(GeometrySerializer::READ_BREP, (std::string)product.as<express::Entity>().get("GlobalId"), std::to_string(rep->item->instance.id()), [kernel, settings, product, place, rep]() {
return kernel->create_brep_for_representation_and_product(rep->item, product, place); return kernel->create_brep_for_representation_and_product(rep->item, product, place);
})); }));
if (!brep) { if (!brep) {
Logger::SetProduct(std::nullopt); logger::set_product(std::nullopt);
return; return;
} }
auto elem = process_based_on_settings(settings, brep); auto elem = process_based_on_settings(settings, brep);
if (!elem) { if (!elem) {
Logger::SetProduct(std::nullopt); logger::set_product(std::nullopt);
return; return;
} }
@@ -397,7 +397,7 @@ void IfcGeom::Iterator::create_element_(ifcopenshell::geometry::Converter* kerne
} }
} }
Logger::SetProduct(std::nullopt); logger::set_product(std::nullopt);
} }
IfcGeom::Element* IfcGeom::Iterator::process_based_on_settings(ifcopenshell::geometry::Settings settings, IfcGeom::BRepElement* elem, IfcGeom::TriangulationElement* previous) IfcGeom::Element* IfcGeom::Iterator::process_based_on_settings(ifcopenshell::geometry::Settings settings, IfcGeom::BRepElement* elem, IfcGeom::TriangulationElement* previous)
@@ -406,7 +406,7 @@ IfcGeom::Element* IfcGeom::Iterator::process_based_on_settings(ifcopenshell::geo
try { try {
return new IfcGeom::SerializedElement(*elem); return new IfcGeom::SerializedElement(*elem);
} catch (...) { } catch (...) {
Logger::Message(Logger::LOG_ERROR, "Getting a serialized element from model failed."); logger::message(logger::LOG_ERROR, "Getting a serialized element from model failed.");
return nullptr; return nullptr;
} }
} else if (settings.get<ifcopenshell::geometry::settings::IteratorOutput>().get() == ifcopenshell::geometry::settings::TRIANGULATED) { } else if (settings.get<ifcopenshell::geometry::settings::IteratorOutput>().get() == ifcopenshell::geometry::settings::TRIANGULATED) {
@@ -425,7 +425,7 @@ IfcGeom::Element* IfcGeom::Iterator::process_based_on_settings(ifcopenshell::geo
return new TriangulationElement(*elem, previous->geometry_pointer()); return new TriangulationElement(*elem, previous->geometry_pointer());
} }
} catch (...) { } catch (...) {
Logger::Message(Logger::LOG_ERROR, "Getting a triangulation element from model failed."); logger::message(logger::LOG_ERROR, "Getting a triangulation element from model failed.");
} }
return (TriangulationElement*)nullptr; return (TriangulationElement*)nullptr;
}); });
@@ -466,7 +466,7 @@ void IfcGeom::Iterator::log_timepoints() const {
for (auto it = time_points.begin() + 1; it != time_points.end(); ++it) { for (auto it = time_points.begin() + 1; it != time_points.end(); ++it) {
auto jt = it - 1; auto jt = it - 1;
duration<double, std::milli> ms_double = (*it) - (*jt); duration<double, std::milli> ms_double = (*it) - (*jt);
Logger::Notice(labels[std::distance(time_points.begin(), jt)] + " took " + std::to_string(ms_double.count()) + "ms"); logger::notice(labels[std::distance(time_points.begin(), jt)] + " took " + std::to_string(ms_double.count()) + "ms");
} }
} }
@@ -501,7 +501,7 @@ express::Base IfcGeom::Iterator::next() {
if (num_threads_ != 1) { if (num_threads_ != 1) {
if (!wait_for_element()) { if (!wait_for_element()) {
Logger::SetProduct(std::nullopt); logger::set_product(std::nullopt);
time_points[3] = high_resolution_clock::now(); time_points[3] = high_resolution_clock::now();
log_timepoints(); log_timepoints();
task_result_ptr_exhausted = true; task_result_ptr_exhausted = true;
@@ -517,7 +517,7 @@ express::Base IfcGeom::Iterator::next() {
// shape representation // shape representation
if (task_result_iterator_ == --all_processed_elements_.end()) { if (task_result_iterator_ == --all_processed_elements_.end()) {
if (!create()) { if (!create()) {
Logger::SetProduct(std::nullopt); logger::set_product(std::nullopt);
time_points[3] = high_resolution_clock::now(); time_points[3] = high_resolution_clock::now();
log_timepoints(); log_timepoints();
task_result_ptr_exhausted = true; task_result_ptr_exhausted = true;
@@ -554,7 +554,7 @@ IfcGeom::Element* IfcGeom::Iterator::get()
try { try {
parent_object = get_object(ret->parent_id()); parent_object = get_object(ret->parent_id());
} catch (const std::exception& e) { } catch (const std::exception& e) {
Logger::Error(e); logger::error(e);
hasParent = false; hasParent = false;
} }
@@ -572,7 +572,7 @@ IfcGeom::Element* IfcGeom::Iterator::get()
try { try {
parent_object = get_object(pid); parent_object = get_object(pid);
} catch (const std::exception& e) { } catch (const std::exception& e) {
Logger::Error(e); logger::error(e);
hasParent = false; hasParent = false;
} }
} }
@@ -619,19 +619,19 @@ const IfcGeom::Element* IfcGeom::Iterator::get_object(int id) {
m4 = casted->matrix; m4 = casted->matrix;
} }
} catch (const std::exception& e) { } catch (const std::exception& e) {
Logger::Error(e); logger::error(e);
} }
#ifdef IFOPSH_WITH_OPENCASCADE #ifdef IFOPSH_WITH_OPENCASCADE
catch (const Standard_Failure& e) { catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) { if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString()); logger::error(e.GetMessageString());
} else { } else {
Logger::Error("Unknown error returning product"); logger::error("Unknown error returning product");
} }
} }
#endif #endif
catch (...) { catch (...) {
Logger::Error("Unknown error returning product"); logger::error("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>()); Element* ifc_object = new Element(settings_, id, parent_id, product_name, instance_type, product_guid, "", m4, ifc_product.as<express::Entity>());
@@ -643,21 +643,21 @@ express::Base IfcGeom::Iterator::create() {
try { try {
product = create_shape_model_for_next_entity(); product = create_shape_model_for_next_entity();
} catch (const std::exception& e) { } catch (const std::exception& e) {
Logger::Error(e); logger::error(e);
had_error_processing_elements_ = true; had_error_processing_elements_ = true;
} }
#ifdef IFOPSH_WITH_OPENCASCADE #ifdef IFOPSH_WITH_OPENCASCADE
catch (const Standard_Failure& e) { catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) { if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString()); logger::error(e.GetMessageString());
} else { } else {
Logger::Error("Unknown error creating geometry"); logger::error("Unknown error creating geometry");
} }
had_error_processing_elements_ = true; had_error_processing_elements_ = true;
} }
#endif #endif
catch (...) { catch (...) {
Logger::Error("Unknown error creating geometry"); logger::error("Unknown error creating geometry");
had_error_processing_elements_ = true; had_error_processing_elements_ = true;
} }
return product; return product;
@@ -829,8 +829,8 @@ ifcopenshell::geometry::taxonomy::direction3::ptr IfcGeom::Iterator::remove_offs
} }
} }
Logger::Notice("Removed large offsets within " + std::to_string(num_offset_applied) + " products"); logger::notice("Removed large offsets within " + std::to_string(num_offset_applied) + " products");
Logger::Notice("Offset applied (" + std::to_string(vec(0)) + "," + std::to_string(vec(1)) + "," + std::to_string(vec(2)) + ")"); logger::notice("Offset applied (" + std::to_string(vec(0)) + "," + std::to_string(vec(1)) + "," + std::to_string(vec(2)) + ")");
return make<direction3>(vec); return make<direction3>(vec);
} }
+7 -7
View File
@@ -58,7 +58,7 @@
#ifndef IFCGEOMITERATOR_H #ifndef IFCGEOMITERATOR_H
#define IFCGEOMITERATOR_H #define IFCGEOMITERATOR_H
#include "../ifcparse/IfcFile.h" #include "../ifcparse/file.h"
#include "../ifcgeom/IfcGeomElement.h" #include "../ifcgeom/IfcGeomElement.h"
#include "../ifcgeom/ConversionResult.h" #include "../ifcgeom/ConversionResult.h"
@@ -130,7 +130,7 @@ namespace IfcGeom {
size_t async_elements_returned_ = 0; size_t async_elements_returned_ = 0;
ifcopenshell::geometry::Settings settings_; ifcopenshell::geometry::Settings settings_;
IfcParse::IfcFile* ifc_file; ifcopenshell::file* ifc_file;
std::vector<ifcopenshell::geometry::filter_t> filters_; std::vector<ifcopenshell::geometry::filter_t> filters_;
int num_threads_; int num_threads_;
std::string geometry_library_; std::string geometry_library_;
@@ -217,7 +217,7 @@ namespace IfcGeom {
ifcopenshell::geometry::taxonomy::direction3::ptr remove_offset_(); ifcopenshell::geometry::taxonomy::direction3::ptr remove_offset_();
public: public:
Iterator(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, const ifcopenshell::geometry::Settings& settings, IfcParse::IfcFile* file, const std::vector<ifcopenshell::geometry::filter_t>& filters, int num_threads) 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)
: settings_(settings) : settings_(settings)
, ifc_file(file) , ifc_file(file)
, filters_(filters) , filters_(filters)
@@ -228,7 +228,7 @@ namespace IfcGeom {
{ {
} }
Iterator(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, const ifcopenshell::geometry::Settings& settings, IfcParse::IfcFile* file) Iterator(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, const ifcopenshell::geometry::Settings& settings, ifcopenshell::file* file)
: settings_(settings) : settings_(settings)
, ifc_file(file) , ifc_file(file)
, num_threads_(1) , num_threads_(1)
@@ -237,7 +237,7 @@ namespace IfcGeom {
{ {
} }
Iterator(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, const ifcopenshell::geometry::Settings& settings, IfcParse::IfcFile* file, int num_threads) Iterator(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, const ifcopenshell::geometry::Settings& settings, ifcopenshell::file* file, int num_threads)
: settings_(settings) : settings_(settings)
, ifc_file(file) , ifc_file(file)
, num_threads_(num_threads) , num_threads_(num_threads)
@@ -309,9 +309,9 @@ namespace IfcGeom {
return progress_; return progress_;
} }
std::string getLog() const { return Logger::GetLog(); } std::string getLog() const { return logger::get_log(); }
IfcParse::IfcFile* file() const { return ifc_file; } ifcopenshell::file* file() const { return ifc_file; }
const std::vector<ifcopenshell::geometry::filter_t>& filters() const { return filters_; } const std::vector<ifcopenshell::geometry::filter_t>& filters() const { return filters_; }
std::vector<ifcopenshell::geometry::filter_t>& filters() { return filters_; } std::vector<ifcopenshell::geometry::filter_t>& filters() { return filters_; }
+11 -11
View File
@@ -6,13 +6,13 @@
#include <boost/preprocessor/seq/for_each.hpp> #include <boost/preprocessor/seq/for_each.hpp>
#include <boost/algorithm/string/case_conv.hpp> #include <boost/algorithm/string/case_conv.hpp>
#include "../../ifcparse/IfcFile.h" #include "../../ifcparse/file.h"
#define EXTERNAL_DEFS_1(r, data, elem) \ #define EXTERNAL_DEFS_1(r, data, elem) \
express::Base BOOST_PP_CAT(tesselate_Ifc, elem)(IfcParse::IfcFile&, const TopoDS_Shape& shape, double deflection); express::Base BOOST_PP_CAT(tesselate_Ifc, elem)(ifcopenshell::file&, const TopoDS_Shape& shape, double deflection);
#define EXTERNAL_DEFS_2(r, data, elem) \ #define EXTERNAL_DEFS_2(r, data, elem) \
express::Base BOOST_PP_CAT(serialise_Ifc, elem)(IfcParse::IfcFile&, const TopoDS_Shape& shape, bool advanced); express::Base BOOST_PP_CAT(serialise_Ifc, elem)(ifcopenshell::file&, const TopoDS_Shape& shape, bool advanced);
#define CONDITIONAL_CALL(r, data, elem) \ #define CONDITIONAL_CALL(r, data, elem) \
if (schema_name_lower == BOOST_PP_STRINGIZE(BOOST_PP_CAT(elem,))) { \ if (schema_name_lower == BOOST_PP_STRINGIZE(BOOST_PP_CAT(elem,))) { \
@@ -24,36 +24,36 @@ BOOST_PP_SEQ_FOR_EACH(EXTERNAL_DEFS_2, , SCHEMA_SEQ);
#define METHOD_NAME tesselate_Ifc #define METHOD_NAME tesselate_Ifc
express::Base IfcGeom::tesselate(IfcParse::IfcFile& f, const TopoDS_Shape& shape, double arg_2) { express::Base IfcGeom::tesselate(ifcopenshell::file& f, const TopoDS_Shape& shape, double arg_2) {
auto schema_name = f.schema()->name(); auto schema_name = f.schema()->name();
// @todo an ugly hack to guarantee schemas are initialised. // @todo an ugly hack to guarantee schemas are initialised.
// @todo is this still needed? parsing a file should have initialized the schemas already. // @todo is this still needed? parsing a file should have initialized the schemas already.
try { try {
IfcParse::schema_by_name("IFC2X3"); ifcopenshell::schema_by_name("IFC2X3");
} catch (IfcParse::IfcException&) {} } catch (ifcopenshell::exception&) {}
const std::string schema_name_lower = boost::to_lower_copy(schema_name.substr(3)); const std::string schema_name_lower = boost::to_lower_copy(schema_name.substr(3));
BOOST_PP_SEQ_FOR_EACH(CONDITIONAL_CALL, , SCHEMA_SEQ); BOOST_PP_SEQ_FOR_EACH(CONDITIONAL_CALL, , SCHEMA_SEQ);
throw IfcParse::IfcException("No geometry serialization available for " + schema_name); throw ifcopenshell::exception("No geometry serialization available for " + schema_name);
} }
#undef METHOD_NAME #undef METHOD_NAME
#define METHOD_NAME serialise_Ifc #define METHOD_NAME serialise_Ifc
express::Base IfcGeom::serialise(IfcParse::IfcFile& f, const TopoDS_Shape& shape, bool arg_2) { express::Base IfcGeom::serialise(ifcopenshell::file& f, const TopoDS_Shape& shape, bool arg_2) {
auto schema_name = f.schema()->name(); auto schema_name = f.schema()->name();
// @todo an ugly hack to guarantee schemas are initialised. // @todo an ugly hack to guarantee schemas are initialised.
try { try {
IfcParse::schema_by_name("IFC2X3"); ifcopenshell::schema_by_name("IFC2X3");
} catch (IfcParse::IfcException&) {} } catch (ifcopenshell::exception&) {}
const std::string schema_name_lower = boost::to_lower_copy(schema_name.substr(3)); const std::string schema_name_lower = boost::to_lower_copy(schema_name.substr(3));
BOOST_PP_SEQ_FOR_EACH(CONDITIONAL_CALL, , SCHEMA_SEQ); BOOST_PP_SEQ_FOR_EACH(CONDITIONAL_CALL, , SCHEMA_SEQ);
throw IfcParse::IfcException("No geometry serialization available for " + schema_name); throw ifcopenshell::exception("No geometry serialization available for " + schema_name);
} }
+2 -2
View File
@@ -7,6 +7,6 @@
#include <string> #include <string>
namespace IfcGeom { namespace IfcGeom {
IFC_GEOMSERIALIZATION_API express::Base tesselate(IfcParse::IfcFile& f, const TopoDS_Shape& shape, double deflection); IFC_GEOMSERIALIZATION_API express::Base tesselate(ifcopenshell::file& f, const TopoDS_Shape& shape, double deflection);
IFC_GEOMSERIALIZATION_API express::Base serialise(IfcParse::IfcFile& f, const TopoDS_Shape& shape, bool advanced); IFC_GEOMSERIALIZATION_API express::Base serialise(ifcopenshell::file& f, const TopoDS_Shape& shape, bool advanced);
} // namespace IfcGeom } // namespace IfcGeom
@@ -23,32 +23,32 @@
#include <BRepTools.hxx> #include <BRepTools.hxx>
#include "../../../ifcparse/macros.h" #include "../../../ifcparse/macros.h"
#include "../../../ifcparse/IfcParse.h" #include "../../../ifcparse/parse.h"
#include "../../../ifcparse/IfcFile.h" #include "../../../ifcparse/file.h"
#define INCLUDE_PARENT_PARENT_DIR(x) STRINGIFY(../../../ifcparse/x.h) #define INCLUDE_PARENT_PARENT_DIR(x) STRINGIFY(../../../ifcparse/schemas/x.h)
#include INCLUDE_PARENT_PARENT_DIR(IfcSchema) #include INCLUDE_PARENT_PARENT_DIR(IfcSchema)
#undef INCLUDE_PARENT_PARENT_DIR #undef INCLUDE_PARENT_PARENT_DIR
#define INCLUDE_PARENT_PARENT_DIR(x) STRINGIFY(../../../ifcparse/x-definitions.h) #define INCLUDE_PARENT_PARENT_DIR(x) STRINGIFY(../../../ifcparse/schemas/x-definitions.h)
#include INCLUDE_PARENT_PARENT_DIR(IfcSchema) #include INCLUDE_PARENT_PARENT_DIR(IfcSchema)
#include <numeric> #include <numeric>
template <typename T, typename U> template <typename T, typename U>
int convert_to_ifc(IfcParse::IfcFile& f, const T& t, U& u, bool /*advanced*/) { int convert_to_ifc(ifcopenshell::file& f, const T& t, U& u, bool /*advanced*/) {
u = f.create<U>(); u = f.create<U>();
u.set_attribute_value(0, std::vector<double>{t.X(), t.Y(), t.Z()}); u.set_attribute_value(0, std::vector<double>{t.X(), t.Y(), t.Z()});
return 1; return 1;
} }
template <> template <>
int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Vertex& v, IfcSchema::IfcCartesianPoint& p, bool advanced) { int convert_to_ifc(ifcopenshell::file& f, const TopoDS_Vertex& v, IfcSchema::IfcCartesianPoint& p, bool advanced) {
gp_Pnt pnt = BRep_Tool::Pnt(v); gp_Pnt pnt = BRep_Tool::Pnt(v);
return convert_to_ifc(f, pnt, p, advanced); return convert_to_ifc(f, pnt, p, advanced);
} }
template <> template <>
int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Vertex& v, IfcSchema::IfcVertexPoint& vertex, bool advanced) { int convert_to_ifc(ifcopenshell::file& f, const TopoDS_Vertex& v, IfcSchema::IfcVertexPoint& vertex, bool advanced) {
IfcSchema::IfcCartesianPoint p; IfcSchema::IfcCartesianPoint p;
if (convert_to_ifc(f, v, p, advanced)) { if (convert_to_ifc(f, v, p, advanced)) {
vertex = f.create<IfcSchema::IfcVertexPoint>(); vertex = f.create<IfcSchema::IfcVertexPoint>();
@@ -60,7 +60,7 @@ int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Vertex& v, IfcSchema::IfcV
} }
template <> template <>
int convert_to_ifc(IfcParse::IfcFile& f, const gp_Ax2& a, IfcSchema::IfcAxis2Placement3D& ax, bool advanced) { int convert_to_ifc(ifcopenshell::file& f, const gp_Ax2& a, IfcSchema::IfcAxis2Placement3D& ax, bool advanced) {
IfcSchema::IfcCartesianPoint p; IfcSchema::IfcCartesianPoint p;
IfcSchema::IfcDirection x, z; IfcSchema::IfcDirection x, z;
if (!(convert_to_ifc(f, a.Location(), p, advanced) && convert_to_ifc(f, a.Direction(), z, advanced) && convert_to_ifc(f, a.XDirection(), x, advanced))) { if (!(convert_to_ifc(f, a.Location(), p, advanced) && convert_to_ifc(f, a.Direction(), z, advanced) && convert_to_ifc(f, a.XDirection(), x, advanced))) {
@@ -112,7 +112,7 @@ namespace {
#endif #endif
template <> template <>
int convert_to_ifc(IfcParse::IfcFile& f, const Handle_Geom_Curve& c, IfcSchema::IfcCurve& curve, bool advanced) { int convert_to_ifc(ifcopenshell::file& f, const Handle_Geom_Curve& c, IfcSchema::IfcCurve& curve, bool advanced) {
if (c->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) { if (c->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) {
Handle_Geom_TrimmedCurve trim = Handle_Geom_TrimmedCurve::DownCast(c); Handle_Geom_TrimmedCurve trim = Handle_Geom_TrimmedCurve::DownCast(c);
const Handle_Geom_Curve basis = trim->BasisCurve(); const Handle_Geom_Curve basis = trim->BasisCurve();
@@ -284,7 +284,7 @@ int convert_to_ifc(IfcParse::IfcFile& f, const Handle_Geom_Curve& c, IfcSchema::
} }
template <> template <>
int convert_to_ifc(IfcParse::IfcFile& f, const Handle_Geom_Surface& s, IfcSchema::IfcSurface& surface, bool advanced) { int convert_to_ifc(ifcopenshell::file& f, const Handle_Geom_Surface& s, IfcSchema::IfcSurface& surface, bool advanced) {
if (s->DynamicType() == STANDARD_TYPE(Geom_Plane)) { if (s->DynamicType() == STANDARD_TYPE(Geom_Plane)) {
Handle_Geom_Plane plane = Handle_Geom_Plane::DownCast(s); Handle_Geom_Plane plane = Handle_Geom_Plane::DownCast(s);
IfcSchema::IfcAxis2Placement3D place; IfcSchema::IfcAxis2Placement3D place;
@@ -403,7 +403,7 @@ int convert_to_ifc(IfcParse::IfcFile& f, const Handle_Geom_Surface& s, IfcSchema
} }
template <> template <>
int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Edge& e, IfcSchema::IfcCurve& c, bool advanced) { int convert_to_ifc(ifcopenshell::file& f, const TopoDS_Edge& e, IfcSchema::IfcCurve& c, bool advanced) {
double a, b; double a, b;
IfcSchema::IfcCurve base; IfcSchema::IfcCurve base;
@@ -433,7 +433,7 @@ int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Edge& e, IfcSchema::IfcCur
} }
template <> template <>
int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Edge& e, IfcSchema::IfcEdge& edge, bool advanced) { int convert_to_ifc(ifcopenshell::file& f, const TopoDS_Edge& e, IfcSchema::IfcEdge& edge, bool advanced) {
double a, b; double a, b;
TopExp_Explorer exp(e, TopAbs_VERTEX); TopExp_Explorer exp(e, TopAbs_VERTEX);
@@ -505,7 +505,7 @@ namespace {
} }
template <> template <>
int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Wire& wire, IfcSchema::IfcLoop& loop, bool advanced) { int convert_to_ifc(ifcopenshell::file& f, const TopoDS_Wire& wire, IfcSchema::IfcLoop& loop, bool advanced) {
bool polygonal = true; bool polygonal = true;
for (TopExp_Explorer exp(wire, TopAbs_EDGE); exp.More(); exp.Next()) { for (TopExp_Explorer exp(wire, TopAbs_EDGE); exp.More(); exp.Next()) {
double a, b; double a, b;
@@ -540,7 +540,7 @@ int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Wire& wire, IfcSchema::Ifc
BRepTools_WireExplorer exp(wire); BRepTools_WireExplorer exp(wire);
for (; exp.More(); exp.Next()) { for (; exp.More(); exp.Next()) {
IfcSchema::IfcEdge edge; IfcSchema::IfcEdge edge;
// With advanced set to true convert_to_ifc(IfcParse::IfcFile& f, TopoDS_Edge&) will always create an IfcOrientedEdge // With advanced set to true convert_to_ifc(ifcopenshell::file& f, TopoDS_Edge&) will always create an IfcOrientedEdge
if (!convert_to_ifc(f, exp.Current(), edge, true)) { if (!convert_to_ifc(f, exp.Current(), edge, true)) {
double a, b; double a, b;
if (BRep_Tool::Curve(TopoDS::Edge(exp.Current()), a, b).IsNull()) { if (BRep_Tool::Curve(TopoDS::Edge(exp.Current()), a, b).IsNull()) {
@@ -559,7 +559,7 @@ int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Wire& wire, IfcSchema::Ifc
} }
template <> template <>
int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Face& fa, IfcSchema::IfcFace& face, bool advanced) { int convert_to_ifc(ifcopenshell::file& f, const TopoDS_Face& fa, IfcSchema::IfcFace& face, bool advanced) {
Handle_Geom_Surface surf = BRep_Tool::Surface(fa); Handle_Geom_Surface surf = BRep_Tool::Surface(fa);
TopExp_Explorer exp(fa, TopAbs_WIRE); TopExp_Explorer exp(fa, TopAbs_WIRE);
std::vector<IfcSchema::IfcFaceBound> bounds; std::vector<IfcSchema::IfcFaceBound> bounds;
@@ -611,7 +611,7 @@ int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Face& fa, IfcSchema::IfcFa
} }
template <typename U> template <typename U>
int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Shape& s, U& item, bool advanced) { int convert_to_ifc(ifcopenshell::file& f, const TopoDS_Shape& s, U& item, bool advanced) {
std::vector<IfcSchema::IfcFace> faces; std::vector<IfcSchema::IfcFace> faces;
IfcSchema::IfcFace fa; IfcSchema::IfcFace fa;
@@ -625,7 +625,7 @@ int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Shape& s, U& item, bool ad
created.insert(resources.begin(), resources.end()); created.insert(resources.begin(), resources.end());
} }
for (auto& c : created) { for (auto& c : created) {
f.removeEntity(c); f.remove_entity(c);
} }
return 0; return 0;
} }
@@ -637,7 +637,7 @@ int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Shape& s, U& item, bool ad
return faces.size(); return faces.size();
} }
express::Base POSTFIX_SCHEMA(serialise)(IfcParse::IfcFile& f, const TopoDS_Shape& shape, bool advanced) { express::Base POSTFIX_SCHEMA(serialise)(ifcopenshell::file& f, const TopoDS_Shape& shape, bool advanced) {
#ifndef SCHEMA_HAS_IfcAdvancedBrep #ifndef SCHEMA_HAS_IfcAdvancedBrep
advanced = false; advanced = false;
@@ -788,7 +788,7 @@ express::Base POSTFIX_SCHEMA(serialise)(IfcParse::IfcFile& f, const TopoDS_Shape
return pds; return pds;
} }
express::Base POSTFIX_SCHEMA(tesselate)(IfcParse::IfcFile& f, const TopoDS_Shape& shape, double deflection) { express::Base POSTFIX_SCHEMA(tesselate)(ifcopenshell::file& f, const TopoDS_Shape& shape, double deflection) {
// @todo use triangulated face set in ifc4+ schema // @todo use triangulated face set in ifc4+ schema
BRepMesh_IncrementalMesh(shape, deflection); BRepMesh_IncrementalMesh(shape, deflection);
+2 -2
View File
@@ -20,7 +20,7 @@
#ifndef SERIALIZER_H #ifndef SERIALIZER_H
#define SERIALIZER_H #define SERIALIZER_H
#include "../ifcparse/IfcFile.h" #include "../ifcparse/file.h"
class Serializer { class Serializer {
public: public:
@@ -29,7 +29,7 @@ public:
virtual bool ready() = 0; virtual bool ready() = 0;
virtual void writeHeader() = 0; virtual void writeHeader() = 0;
virtual void finalize() = 0; virtual void finalize() = 0;
virtual void setFile(IfcParse::IfcFile*) = 0; virtual void setFile(ifcopenshell::file*) = 0;
}; };
#endif #endif
+3 -3
View File
@@ -1,6 +1,6 @@
#include "abstract_mapping.h" #include "abstract_mapping.h"
#include "../ifcparse/IfcFile.h" #include "../ifcparse/file.h"
#include <boost/preprocessor/stringize.hpp> #include <boost/preprocessor/stringize.hpp>
#include <boost/preprocessor/seq/for_each.hpp> #include <boost/preprocessor/seq/for_each.hpp>
@@ -37,12 +37,12 @@ void ifcopenshell::geometry::impl::MappingFactoryImplementation::bind(const std:
this->insert(std::make_pair(schema_name_lower, fn)); this->insert(std::make_pair(schema_name_lower, fn));
} }
ifcopenshell::geometry::abstract_mapping* ifcopenshell::geometry::impl::MappingFactoryImplementation::construct(IfcParse::IfcFile* file, Settings& s) { ifcopenshell::geometry::abstract_mapping* ifcopenshell::geometry::impl::MappingFactoryImplementation::construct(ifcopenshell::file* file, Settings& s) {
const std::string schema_name_lower = boost::to_lower_copy(file->schema()->name()); 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; std::map<std::string, ifcopenshell::geometry::impl::mapping_fn>::const_iterator it;
it = this->find(schema_name_lower); it = this->find(schema_name_lower);
if (it == end()) { if (it == end()) {
throw IfcParse::IfcException("No geometry mapping registered for " + schema_name_lower); throw ifcopenshell::exception("No geometry mapping registered for " + schema_name_lower);
} }
auto new_mapping = it->second(file, s); auto new_mapping = it->second(file, s);
new_mapping->initialize_settings(); new_mapping->initialize_settings();
+2 -2
View File
@@ -77,13 +77,13 @@ namespace geometry {
}; };
namespace impl { namespace impl {
typedef boost::function2<abstract_mapping*, IfcParse::IfcFile*, Settings&> mapping_fn; typedef boost::function2<abstract_mapping*, ifcopenshell::file*, Settings&> mapping_fn;
class IFC_GEOM_API MappingFactoryImplementation : public std::map<std::string, mapping_fn> { class IFC_GEOM_API MappingFactoryImplementation : public std::map<std::string, mapping_fn> {
public: public:
MappingFactoryImplementation(); MappingFactoryImplementation();
void bind(const std::string& schema_name, mapping_fn); void bind(const std::string& schema_name, mapping_fn);
abstract_mapping* construct(IfcParse::IfcFile*, Settings&); abstract_mapping* construct(ifcopenshell::file*, Settings&);
}; };
IFC_GEOM_API MappingFactoryImplementation& mapping_implementations(); IFC_GEOM_API MappingFactoryImplementation& mapping_implementations();
+2 -2
View File
@@ -76,7 +76,7 @@ struct piecewise_fn_evaluator : public fn_evaluator {
span_start += fn->length(); span_start += fn->length();
} }
Logger::Error("piecewise span not found."); logger::error("piecewise span not found.");
return {0, 0, nullptr}; return {0, 0, nullptr};
} }
@@ -235,7 +235,7 @@ function_item_evaluator::function_item_evaluator(const ifcopenshell::geometry::S
} else if (kind == taxonomy::OFFSET_FUNCTION) { } else if (kind == taxonomy::OFFSET_FUNCTION) {
fn_evaluator_ = new offset_fn_evaluator(std::dynamic_pointer_cast<const taxonomy::offset_function>(fn), settings); fn_evaluator_ = new offset_fn_evaluator(std::dynamic_pointer_cast<const taxonomy::offset_function>(fn), settings);
} else { } else {
Logger::Error("Unexpected function type"); logger::error("Unexpected function type");
} }
} }
+6 -6
View File
@@ -62,9 +62,9 @@ namespace ifcopenshell {
class HybridKernel : public ifcopenshell::geometry::kernels::AbstractKernel { class HybridKernel : public ifcopenshell::geometry::kernels::AbstractKernel {
std::vector<std::unique_ptr<AbstractKernel>> kernels_; std::vector<std::unique_ptr<AbstractKernel>> kernels_;
ifcopenshell::geometry::abstract_mapping* mapping_; ifcopenshell::geometry::abstract_mapping* mapping_;
IfcParse::IfcFile* file_; ifcopenshell::file* file_;
public: public:
HybridKernel(const std::string& name, IfcParse::IfcFile* file, Settings& settings, std::vector<std::unique_ptr<AbstractKernel>>&& kernels) HybridKernel(const std::string& name, ifcopenshell::file* file, Settings& settings, std::vector<std::unique_ptr<AbstractKernel>>&& kernels)
: AbstractKernel(name, settings) : AbstractKernel(name, settings)
, kernels_(std::move(kernels)) , kernels_(std::move(kernels))
, mapping_(ifcopenshell::geometry::impl::mapping_implementations().construct(file, settings)) , mapping_(ifcopenshell::geometry::impl::mapping_implementations().construct(file, settings))
@@ -167,7 +167,7 @@ namespace ifcopenshell {
} }
}; };
inline std::unique_ptr<AbstractKernel> construct(IfcParse::IfcFile* file, const std::string& geometry_library, Settings& conv_settings) { inline std::unique_ptr<AbstractKernel> construct(ifcopenshell::file* file, const std::string& geometry_library, Settings& conv_settings) {
std::string geometry_library_lower = boost::to_lower_copy(geometry_library); std::string geometry_library_lower = boost::to_lower_copy(geometry_library);
#ifdef IFOPSH_WITH_OPENCASCADE #ifdef IFOPSH_WITH_OPENCASCADE
@@ -193,7 +193,7 @@ namespace ifcopenshell {
if (geometry_library_lower.find("-", 0) == 0) { if (geometry_library_lower.find("-", 0) == 0) {
geometry_library_lower = geometry_library_lower.substr(strlen("-")); geometry_library_lower = geometry_library_lower.substr(strlen("-"));
} else { } else {
throw IfcParse::IfcException("Invalid hybrid kernel " + geometry_library); throw ifcopenshell::exception("Invalid hybrid kernel " + geometry_library);
} }
auto n = kernels.size(); auto n = kernels.size();
#ifdef IFOPSH_WITH_OPENCASCADE #ifdef IFOPSH_WITH_OPENCASCADE
@@ -215,7 +215,7 @@ namespace ifcopenshell {
} }
#endif #endif
if (kernels.size() != n + 1) { if (kernels.size() != n + 1) {
throw IfcParse::IfcException("Invalid hybrid kernel " + geometry_library); throw ifcopenshell::exception("Invalid hybrid kernel " + geometry_library);
} }
} }
@@ -229,7 +229,7 @@ namespace ifcopenshell {
} }
} }
throw IfcParse::IfcException("No geometry kernel registered for " + geometry_library); throw ifcopenshell::exception("No geometry kernel registered for " + geometry_library);
} }
} }
+11 -11
View File
@@ -1,4 +1,4 @@
#include "profile_helper.h" #include "profile_helper.h"
#include "infra_sweep_helper.h" #include "infra_sweep_helper.h"
#include "function_item_evaluator.h" #include "function_item_evaluator.h"
@@ -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); double end = std::min(fn->length(), cross_sections.back().dist_along);
if (end - start < 1.e-9) { if (end - start < 1.e-9) {
Logger::Warning("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("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; 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); auto profile_b_f = std::static_pointer_cast<taxonomy::face>(profile_b);
if (profile_a_f->children.size() != profile_b_f->children.size()) { if (profile_a_f->children.size() != profile_b_f->children.size()) {
Logger::Warning("Mismatching number of face boundaries: " + logger::warning("Mismatching number of face boundaries: " +
std::to_string(profile_a_f->children.size()) + " vs " + std::to_string(profile_a_f->children.size()) + " vs " +
std::to_string(profile_b_f->children.size()), std::to_string(profile_b_f->children.size()),
inst 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. // 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); interpolated_rotation = lerp(*rotation_a, *rotation_b, relative_dist_along);
} else if (rotation_a != rotation_b) { } else if (rotation_a != rotation_b) {
Logger::Error("Direction vectors on cross section placements only supported when used consistently"); logger::error("Direction vectors on cross section placements only supported when used consistently");
} }
taxonomy::loop::ptr w1, w2; taxonomy::loop::ptr w1, w2;
@@ -176,12 +176,12 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
boost::tie(w1, w2) = tmp_; boost::tie(w1, w2) = tmp_;
if (w1->closed != w2->closed) { if (w1->closed != w2->closed) {
Logger::Warning("Mismatching closed property on loops", inst); logger::warning("Mismatching closed property on loops", inst);
return nullptr; return nullptr;
} }
if (w1->tags.has_value() != w2->tags.has_value()) { if (w1->tags.has_value() != w2->tags.has_value()) {
Logger::Warning("Mismatching availability tags on loops", inst); logger::warning("Mismatching availability tags on loops", inst);
return nullptr; return nullptr;
} }
@@ -190,7 +190,7 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
std::set<std::string> tags_seen; std::set<std::string> tags_seen;
for (const auto& t : *w1->tags) { for (const auto& t : *w1->tags) {
if (tags_seen.find(t) != tags_seen.end()) { if (tags_seen.find(t) != tags_seen.end()) {
Logger::Warning("Duplicate tag '" + t + "' on loft profile", inst); logger::warning("Duplicate tag '" + t + "' on loft profile", inst);
return nullptr; return nullptr;
} }
tags_seen.insert(t); tags_seen.insert(t);
@@ -202,7 +202,7 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
std::set<std::string> tags_seen; std::set<std::string> tags_seen;
for (const auto& t : *w2->tags) { for (const auto& t : *w2->tags) {
if (tags_seen.find(t) != tags_seen.end()) { if (tags_seen.find(t) != tags_seen.end()) {
Logger::Warning("Duplicate tag '" + t + "' on loft profile", inst); logger::warning("Duplicate tag '" + t + "' on loft profile", inst);
return nullptr; return nullptr;
} }
tags_seen.insert(t); tags_seen.insert(t);
@@ -303,20 +303,20 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
for (auto& p1_tags : w1_tags) { for (auto& p1_tags : w1_tags) {
if (!has_intersection(p1_tags, w2_tags_combined)) { if (!has_intersection(p1_tags, w2_tags_combined)) {
Logger::Warning("No matching tags found on loft profiles: " + join_tags(p1_tags) + " not in " + join_tags(w2_tags_combined), inst); logger::warning("No matching tags found on loft profiles: " + join_tags(p1_tags) + " not in " + join_tags(w2_tags_combined), inst);
return nullptr; return nullptr;
} }
} }
for (auto& p2_tags : w2_tags) { for (auto& p2_tags : w2_tags) {
if (!has_intersection(p2_tags, w1_tags_combined)) { if (!has_intersection(p2_tags, w1_tags_combined)) {
Logger::Warning("No matching tags found on loft profiles: " + join_tags(p2_tags) + " not in " + join_tags(w1_tags_combined), inst); logger::warning("No matching tags found on loft profiles: " + join_tags(p2_tags) + " not in " + join_tags(w1_tags_combined), inst);
return nullptr; return nullptr;
} }
} }
} else { } else {
if (w1->children.size() != w2->children.size()) { if (w1->children.size() != w2->children.size()) {
Logger::Warning("Mismatching number of edges: " + logger::warning("Mismatching number of edges: " +
std::to_string(w1->children.size()) + " vs " + std::to_string(w1->children.size()) + " vs " +
std::to_string(w2->children.size()), std::to_string(w2->children.size()),
inst); inst);
@@ -6,7 +6,7 @@
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h> #include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
#include <CGAL/Polygon_mesh_processing/polygon_mesh_to_polygon_soup.h> #include <CGAL/Polygon_mesh_processing/polygon_mesh_to_polygon_soup.h>
#include "../../../ifcparse/IfcLogger.h" #include "../../../ifcparse/logger.h"
#include "../../../ifcgeom/IfcGeomRepresentation.h" #include "../../../ifcgeom/IfcGeomRepresentation.h"
using IfcGeom::OpaqueNumber; using IfcGeom::OpaqueNumber;
@@ -112,7 +112,7 @@ ifcopenshell::geometry::CgalShape::CgalShape(const cgal_shape_t& shape, bool con
auto b2 = plane.base2(); auto b2 = plane.base2();
if (V.squared_length() == 0) { if (V.squared_length() == 0) {
Logger::Warning("Removed face due to self-intersections"); logger::warning("Removed face due to self-intersections");
faces_to_remove.insert(face); faces_to_remove.insert(face);
continue; continue;
} }
@@ -133,7 +133,7 @@ ifcopenshell::geometry::CgalShape::CgalShape(const cgal_shape_t& shape, bool con
} }
if (!CGAL::Polygon_2<Kernel_>(ps.begin(), ps.end()).is_simple()) { if (!CGAL::Polygon_2<Kernel_>(ps.begin(), ps.end()).is_simple()) {
Logger::Warning("Removed face due to self-intersections"); logger::warning("Removed face due to self-intersections");
faces_to_remove.insert(face); faces_to_remove.insert(face);
} }
} }
@@ -233,7 +233,7 @@ void ifcopenshell::geometry::CgalShape::Triangulate(ifcopenshell::geometry::Sett
if (!all_triangles) { if (!all_triangles) {
if (!shape_to_use->is_valid()) { if (!shape_to_use->is_valid()) {
Logger::Message(Logger::LOG_ERROR, "Invalid Polyhedron_3 in object (before triangulation)"); logger::message(logger::LOG_ERROR, "Invalid Polyhedron_3 in object (before triangulation)");
return; return;
} }
@@ -241,19 +241,19 @@ void ifcopenshell::geometry::CgalShape::Triangulate(ifcopenshell::geometry::Sett
try { try {
success = CGAL::Polygon_mesh_processing::triangulate_faces(*shape_to_use); success = CGAL::Polygon_mesh_processing::triangulate_faces(*shape_to_use);
} catch (...) { } catch (...) {
Logger::Message(Logger::LOG_ERROR, "Triangulation crashed"); logger::message(logger::LOG_ERROR, "Triangulation crashed");
return; return;
} }
CGAL::Polygon_mesh_processing::remove_degenerate_faces(*shape_to_use); CGAL::Polygon_mesh_processing::remove_degenerate_faces(*shape_to_use);
if (!success) { if (!success) {
Logger::Message(Logger::LOG_ERROR, "Triangulation failed"); logger::message(logger::LOG_ERROR, "Triangulation failed");
return; return;
} }
if (!shape_to_use->is_valid()) { if (!shape_to_use->is_valid()) {
Logger::Message(Logger::LOG_ERROR, "Invalid Polyhedron_3 in object (after triangulation)"); logger::message(logger::LOG_ERROR, "Invalid Polyhedron_3 in object (after triangulation)");
return; return;
} }
} }
@@ -282,7 +282,7 @@ void ifcopenshell::geometry::CgalShape::Triangulate(ifcopenshell::geometry::Sett
try { try {
CGAL::Polygon_mesh_processing::compute_face_normals(*shape_to_use, face_normals_map); CGAL::Polygon_mesh_processing::compute_face_normals(*shape_to_use, face_normals_map);
} catch (...) { } catch (...) {
Logger::Message(Logger::LOG_ERROR, "Face normal calculation failed"); logger::message(logger::LOG_ERROR, "Face normal calculation failed");
return; return;
} }
@@ -296,7 +296,7 @@ void ifcopenshell::geometry::CgalShape::Triangulate(ifcopenshell::geometry::Sett
int num_faces = 0, num_vertices = 0; int num_faces = 0, num_vertices = 0;
for (auto &face : faces(*shape_to_use)) { for (auto &face : faces(*shape_to_use)) {
if (!face->is_triangle()) { if (!face->is_triangle()) {
std::cout << "Warning: non-triangular face!" << std::endl; std::cout << "warning: non-triangular face!" << std::endl;
continue; continue;
} }
CGAL::Polyhedron_3<Kernel_>::Halfedge_around_facet_const_circulator current_halfedge = face->facet_begin(); CGAL::Polyhedron_3<Kernel_>::Halfedge_around_facet_const_circulator current_halfedge = face->facet_begin();
@@ -1,4 +1,4 @@
/******************************************************************************** /********************************************************************************
* * * *
* This file is part of IfcOpenShell. * * This file is part of IfcOpenShell. *
* * * *
+48 -48
View File
@@ -1,4 +1,4 @@
/******************************************************************************** /********************************************************************************
* * * *
* This file is part of IfcOpenShell. * * This file is part of IfcOpenShell. *
* * * *
@@ -21,7 +21,7 @@
#include "CgalKernel.h" #include "CgalKernel.h"
#include "../../../ifcparse/IfcLogger.h" #include "../../../ifcparse/logger.h"
#include "../../../ifcgeom/kernels/cgal/CgalConversionResult.h" #include "../../../ifcgeom/kernels/cgal/CgalConversionResult.h"
#ifdef IFOPSH_SIMPLE_KERNEL #ifdef IFOPSH_SIMPLE_KERNEL
@@ -76,7 +76,7 @@ CGAL::Polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_polyhedron(std
polyhedron.normalize_border(); polyhedron.normalize_border();
if (!polyhedron.is_valid(false, 1)) { if (!polyhedron.is_valid(false, 1)) {
Logger::Message(Logger::LOG_ERROR, "create_polyhedron: Polyhedron not valid!"); logger::message(logger::LOG_ERROR, "create_polyhedron: Polyhedron not valid!");
// std::ofstream fresult; // std::ofstream fresult;
// fresult.open("/Users/ken/Desktop/invalid.off"); // fresult.open("/Users/ken/Desktop/invalid.off");
// fresult << polyhedron << std::endl; // fresult << polyhedron << std::endl;
@@ -97,11 +97,11 @@ CGAL::Polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_polyhedron(con
nef_polyhedron.convert_to_polyhedron(polyhedron); nef_polyhedron.convert_to_polyhedron(polyhedron);
return polyhedron; return polyhedron;
} catch (...) { } catch (...) {
Logger::Message(Logger::LOG_ERROR, "Conversion from Nef to polyhedron failed!"); logger::message(logger::LOG_ERROR, "Conversion from Nef to polyhedron failed!");
return CGAL::Polyhedron_3<Kernel_>(); return CGAL::Polyhedron_3<Kernel_>();
} }
} else { } else {
Logger::Message(Logger::LOG_ERROR, "Nef polyhedron not simple: cannot create polyhedron!"); logger::message(logger::LOG_ERROR, "Nef polyhedron not simple: cannot create polyhedron!");
return CGAL::Polyhedron_3<Kernel_>(); return CGAL::Polyhedron_3<Kernel_>();
} }
} }
@@ -114,7 +114,7 @@ CGAL::Nef_polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_nef_polyhe
CGAL::Polygon_mesh_processing::reverse_face_orientations(polyhedron); CGAL::Polygon_mesh_processing::reverse_face_orientations(polyhedron);
} }
} catch (CGAL::Failure_exception& e) { } catch (CGAL::Failure_exception& e) {
Logger::Message(Logger::LOG_ERROR, e); logger::message(logger::LOG_ERROR, e);
} }
} }
CGAL::Polygon_mesh_processing::triangulate_faces(polyhedron); CGAL::Polygon_mesh_processing::triangulate_faces(polyhedron);
@@ -122,7 +122,7 @@ CGAL::Nef_polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_nef_polyhe
try { try {
nef_polyhedron = CGAL::Nef_polyhedron_3<Kernel_>(polyhedron); nef_polyhedron = CGAL::Nef_polyhedron_3<Kernel_>(polyhedron);
} catch (...) { } catch (...) {
Logger::Message(Logger::LOG_ERROR, "Conversion to Nef polyhedron failed!"); logger::message(logger::LOG_ERROR, "Conversion to Nef polyhedron failed!");
} }
return nef_polyhedron; return nef_polyhedron;
} }
@@ -137,7 +137,7 @@ CGAL::Nef_polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_nef_polyhe
CGAL::Polygon_mesh_processing::reverse_face_orientations(polyhedron); CGAL::Polygon_mesh_processing::reverse_face_orientations(polyhedron);
} }
} catch (CGAL::Failure_exception& e) { } catch (CGAL::Failure_exception& e) {
Logger::Message(Logger::LOG_ERROR, e); logger::message(logger::LOG_ERROR, e);
} }
} }
@@ -148,11 +148,11 @@ CGAL::Nef_polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_nef_polyhe
try { try {
nef_polyhedron = CGAL::Nef_polyhedron_3<Kernel_>(polyhedron); nef_polyhedron = CGAL::Nef_polyhedron_3<Kernel_>(polyhedron);
} catch (...) { } catch (...) {
Logger::Message(Logger::LOG_ERROR, "Conversion to Nef polyhedron failed!"); logger::message(logger::LOG_ERROR, "Conversion to Nef polyhedron failed!");
} }
return nef_polyhedron; return nef_polyhedron;
} else { } else {
Logger::Message(Logger::LOG_ERROR, "Polyhedron not valid: cannot create Nef polyhedron!"); logger::message(logger::LOG_ERROR, "Polyhedron not valid: cannot create Nef polyhedron!");
return CGAL::Nef_polyhedron_3<Kernel_>(); return CGAL::Nef_polyhedron_3<Kernel_>();
} }
} }
@@ -161,13 +161,13 @@ CGAL::Nef_polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_nef_polyhe
bool CgalKernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) { bool CgalKernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) {
for (auto& f : l->children) { for (auto& f : l->children) {
if (f->basis && f->basis->kind() != taxonomy::PLANE) { if (f->basis && f->basis->kind() != taxonomy::PLANE) {
Logger::Error("CGAL Kernel: Non-planar faces not supported at the moment"); logger::error("CGAL Kernel: Non-planar faces not supported at the moment");
throw not_supported_error(); throw not_supported_error();
} }
for (auto& w : f->children) { for (auto& w : f->children) {
for (auto& e : w->children) { for (auto& e : w->children) {
if (e->basis && e->basis->kind() == taxonomy::BSPLINE_CURVE) { if (e->basis && e->basis->kind() == taxonomy::BSPLINE_CURVE) {
Logger::Error("CGAL Kernel: B-spline edge curves not supported at the moment"); logger::error("CGAL Kernel: B-spline edge curves not supported at the moment");
throw not_supported_error(); throw not_supported_error();
} }
} }
@@ -196,9 +196,9 @@ bool CgalKernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) {
double volume = diag(0) * diag(1) * diag(2); double volume = diag(0) * diag(1) * diag(2);
// @todo volume van be zero also.. // @todo volume van be zero also..
double density = num_points / volume; double density = num_points / volume;
Logger::Notice("Density " + boost::lexical_cast<std::string>(density), l->instance); logger::notice("Density " + boost::lexical_cast<std::string>(density), l->instance);
if (density > 5000) { if (density > 5000) {
Logger::Notice("Substituted element with " + boost::lexical_cast<std::string>(density) + " vertices / m3 with a bounding box"); logger::notice("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_> lower(minmax.first(0), minmax.first(1), minmax.first(2));
CGAL::Point_3<Kernel_> upper(minmax.second(0), minmax.second(1), minmax.second(2)); CGAL::Point_3<Kernel_> upper(minmax.second(0), minmax.second(1), minmax.second(2));
shape = utils::create_cube(lower, upper); shape = utils::create_cube(lower, upper);
@@ -214,7 +214,7 @@ bool CgalKernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) {
} catch (...) {} } catch (...) {}
if (!success) { if (!success) {
Logger::Message(Logger::LOG_WARNING, "Failed to convert face:", f->instance); logger::message(logger::LOG_WARNING, "Failed to convert face:", f->instance);
continue; continue;
} }
@@ -236,7 +236,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) { if (face->children.size() > 1 && num_outer_bounds > 1 && face->children.size() != num_outer_bounds) {
Logger::Message(Logger::LOG_ERROR, "Invalid configuration of boundaries for:", face->instance); logger::message(logger::LOG_ERROR, "Invalid configuration of boundaries for:", face->instance);
return false; return false;
} }
@@ -249,7 +249,7 @@ bool CgalKernel::convert(const taxonomy::face::ptr face, std::list<cgal_face_t>&
cgal_wire_t wire; cgal_wire_t wire;
if (!convert(bound, wire)) { if (!convert(bound, wire)) {
Logger::Message(Logger::LOG_ERROR, "Failed to process face boundary loop", bound->instance); logger::message(logger::LOG_ERROR, "Failed to process face boundary loop", bound->instance);
return false; return false;
} }
@@ -703,7 +703,7 @@ bool CgalKernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
if (d < 1.e-5) { if (d < 1.e-5) {
points.erase(points.end() - 1); points.erase(points.end() - 1);
} else { } else {
Logger::Warning("Loop not closed", loop->instance); logger::warning("Loop not closed", loop->instance);
} }
} }
@@ -717,7 +717,7 @@ bool CgalKernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
// A loop should consist of at least three vertices // A loop should consist of at least three vertices
std::size_t original_count = polygon.size(); std::size_t original_count = polygon.size();
if (original_count < 3) { if (original_count < 3) {
Logger::Warning("Not enough edges for:", loop->instance); logger::warning("Not enough edges for:", loop->instance);
return false; return false;
} }
@@ -728,14 +728,14 @@ bool CgalKernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
std::size_t count = polygon.size(); std::size_t count = polygon.size();
if (original_count - count != 0) { if (original_count - count != 0) {
std::stringstream ss; ss << (original_count - count) << " edges removed for:"; std::stringstream ss; ss << (original_count - count) << " edges removed for:";
Logger::Warning(ss.str(), loop->instance); logger::warning(ss.str(), loop->instance);
} }
{ {
std::set<cgal_point_t> visited_points; std::set<cgal_point_t> visited_points;
for (auto& p : polygon) { for (auto& p : polygon) {
if (visited_points.find(p) != visited_points.end()) { if (visited_points.find(p) != visited_points.end()) {
Logger::Error("Skipping self-intersecting loop", loop->instance); logger::error("Skipping self-intersecting loop", loop->instance);
// @todo signal somehow that occt kernel might be able to solve this // @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 // @todo implement cycle detection using Arrangement_2, but that only works in exact kernel
return false; return false;
@@ -757,7 +757,7 @@ bool CgalKernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
} }
if (do_segments_intersect(segments)) { if (do_segments_intersect(segments)) {
Logger::Message(Logger::LOG_WARNING, "Skipping self-intersecting loop", loop->instance); logger::message(logger::LOG_WARNING, "Skipping self-intersecting loop", loop->instance);
return false; return false;
} }
@@ -785,7 +785,7 @@ bool CgalKernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
*/ */
if (count < 3) { if (count < 3) {
Logger::Message(Logger::LOG_ERROR, "Not enough edges for:", loop->instance); logger::message(logger::LOG_ERROR, "Not enough edges for:", loop->instance);
return false; return false;
} }
@@ -819,7 +819,7 @@ bool CgalKernel::convert_impl(const taxonomy::shell::ptr shell, ConversionResult
bool CgalKernel::convert_impl(const taxonomy::solid::ptr solid, ConversionResults& results) { bool CgalKernel::convert_impl(const taxonomy::solid::ptr solid, ConversionResults& results) {
if (solid->children.size() > 1) { if (solid->children.size() > 1) {
Logger::Error("Multiple shells in solid not supported at the moment"); logger::error("Multiple shells in solid not supported at the moment");
return false; return false;
} }
cgal_shape_t shape; cgal_shape_t shape;
@@ -964,7 +964,7 @@ bool ifcopenshell::geometry::kernels::CgalKernel::convert_openings(const express
try { try {
a.convert_to_polyhedron(a_poly); a.convert_to_polyhedron(a_poly);
} catch (...) { } catch (...) {
Logger::Message(Logger::LOG_ERROR, "Could not convert from Nef:", entity); logger::message(logger::LOG_ERROR, "Could not convert from Nef:", entity);
return false; return false;
} }
@@ -1163,7 +1163,7 @@ bool CgalKernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::dir
try { try {
nef_shape -= utils::create_nef_polyhedron(face_list); nef_shape -= utils::create_nef_polyhedron(face_list);
} catch (...) { } catch (...) {
Logger::Message(Logger::LOG_ERROR, "IfcExtrudedAreaSolid: cannot subtract opening for:"); logger::message(logger::LOG_ERROR, "IfcExtrudedAreaSolid: cannot subtract opening for:");
return false; return false;
} }
} }
@@ -1180,7 +1180,7 @@ bool CgalKernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::dir
nef_shape.convert_to_polyhedron(shape); nef_shape.convert_to_polyhedron(shape);
return true; return true;
} catch (...) { } catch (...) {
Logger::Message(Logger::LOG_ERROR, "IfcExtrudedAreaSolid: cannot convert Nef to polyhedron for:"); logger::message(logger::LOG_ERROR, "IfcExtrudedAreaSolid: cannot convert Nef to polyhedron for:");
return false; return false;
} }
*/ */
@@ -1189,7 +1189,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) { bool CgalKernel::convert(const taxonomy::extrusion::ptr extrusion, cgal_shape_t &shape) {
const double& height = extrusion->depth; const double& height = extrusion->depth;
if (height < settings_.get<settings::Precision>().get()) { if (height < settings_.get<settings::Precision>().get()) {
Logger::Message(Logger::LOG_ERROR, "Non-positive extrusion height encountered for:", extrusion->instance); logger::message(logger::LOG_ERROR, "Non-positive extrusion height encountered for:", extrusion->instance);
return false; return false;
} }
@@ -1325,13 +1325,13 @@ bool CgalKernel::preprocess_boolean_operand(const express::Base& log_reference,
cgal_shape_t shape = shape_const; cgal_shape_t shape = shape_const;
if (!shape.is_valid()) { if (!shape.is_valid()) {
Logger::Message(Logger::LOG_ERROR, "Conversion to Nef will fail. Invalid geometry:", log_reference); logger::message(logger::LOG_ERROR, "Conversion to Nef will fail. Invalid geometry:", log_reference);
return false; return false;
} }
if (!shape.is_closed()) { 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... // 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, "Subtraction of openings not supported for non-closed geometry:", log_reference); logger::message(logger::LOG_ERROR, "Subtraction of openings not supported for non-closed geometry:", log_reference);
return false; return false;
} }
@@ -1340,18 +1340,18 @@ bool CgalKernel::preprocess_boolean_operand(const express::Base& log_reference,
try { try {
success = CGAL::Polygon_mesh_processing::triangulate_faces(shape); success = CGAL::Polygon_mesh_processing::triangulate_faces(shape);
} catch (CGAL::Failure_exception& e) { } catch (CGAL::Failure_exception& e) {
Logger::Notice(e); logger::notice(e);
Logger::Message(Logger::LOG_ERROR, "Triangulation of geometry crashed:", log_reference); logger::message(logger::LOG_ERROR, "Triangulation of geometry crashed:", log_reference);
return false; return false;
} }
if (!success) { if (!success) {
Logger::Message(Logger::LOG_ERROR, "Triangulation of geometry failed:", log_reference); logger::message(logger::LOG_ERROR, "Triangulation of geometry failed:", log_reference);
return false; return false;
} }
if (CGAL::Polygon_mesh_processing::does_self_intersect(shape)) { if (CGAL::Polygon_mesh_processing::does_self_intersect(shape)) {
Logger::Message(Logger::LOG_ERROR, "Conversion to Nef will fail. Self-intersecting geometry:", log_reference); logger::message(logger::LOG_ERROR, "Conversion to Nef will fail. Self-intersecting geometry:", log_reference);
return false; return false;
} }
@@ -1423,8 +1423,8 @@ bool CgalKernel::preprocess_boolean_operand(const express::Base& log_reference,
try { try {
result = CGAL::Nef_polyhedron_3<Kernel_>(shape); result = CGAL::Nef_polyhedron_3<Kernel_>(shape);
} catch (CGAL::Failure_exception& e) { } catch (CGAL::Failure_exception& e) {
Logger::Notice(e); logger::notice(e);
Logger::Message(Logger::LOG_ERROR, "Could not convert geometry to Nef:", log_reference); logger::message(logger::LOG_ERROR, "Could not convert geometry to Nef:", log_reference);
return false; return false;
} }
@@ -1496,8 +1496,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. // @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_); result = CGAL::minkowski_sum_3(result, precision_cube_);
} catch (CGAL::Failure_exception& e) { } catch (CGAL::Failure_exception& e) {
Logger::Notice(e); logger::notice(e);
Logger::Message(Logger::LOG_ERROR, "Could not dilate boolean operand", log_reference); logger::message(logger::LOG_ERROR, "Could not dilate boolean operand", log_reference);
return false; return false;
} }
} }
@@ -1522,8 +1522,8 @@ bool CgalKernel::preprocess_boolean_operand(const express::Base& log_reference,
cgal_shape_t convert_back; cgal_shape_t convert_back;
result.convert_to_polyhedron(convert_back); result.convert_to_polyhedron(convert_back);
} catch (CGAL::Failure_exception& e) { } catch (CGAL::Failure_exception& e) {
Logger::Notice(e); logger::notice(e);
Logger::Message(Logger::LOG_WARNING, "Final conversion will likely fail. Could not convert geometry from Nef:", log_reference); logger::message(logger::LOG_WARNING, "Final conversion will likely fail. Could not convert geometry from Nef:", log_reference);
} }
return true; return true;
@@ -1842,7 +1842,7 @@ bool CgalKernel::convert_impl(const taxonomy::boolean_result::ptr br, Conversion
// even-odd fill rule will result in incorrect results. // even-odd fill rule will result in incorrect results.
// See for example the Duplex model roof. // See for example the Duplex model roof.
Logger::Notice("Holes are not disjoint"); logger::notice("Holes are not disjoint");
CGAL::Polygon_set_2<Kernel_> result; CGAL::Polygon_set_2<Kernel_> result;
auto it = loops.begin(); auto it = loops.begin();
@@ -1894,7 +1894,7 @@ bool CgalKernel::convert_impl(const taxonomy::boolean_result::ptr br, Conversion
); );
}); });
Logger::Notice("Processed boolean operation as 2d arrangement"); logger::notice("Processed boolean operation as 2d arrangement");
return true; return true;
@@ -1980,7 +1980,7 @@ bool CgalKernel::convert_impl(const taxonomy::boolean_result::ptr br, Conversion
ps.push_back({ p.x(), p.y() }); ps.push_back({ p.x(), p.y() });
} }
if (!ps.is_simple()) { if (!ps.is_simple()) {
Logger::Warning("Polygonal boundary not simple", face->children[0]->instance); logger::warning("Polygonal boundary not simple", face->children[0]->instance);
continue; continue;
} }
@@ -2126,7 +2126,7 @@ bool CgalKernel::convert_impl(const taxonomy::boolean_result::ptr br, Conversion
try { try {
a.convert_to_polyhedron(a_poly); a.convert_to_polyhedron(a_poly);
} catch (...) { } catch (...) {
Logger::Message(Logger::LOG_ERROR, "Could not convert geometry with openings from Nef:", br->instance); logger::message(logger::LOG_ERROR, "Could not convert geometry with openings from Nef:", br->instance);
return false; return false;
} }
@@ -2218,7 +2218,7 @@ void PolyhedronBuilder::operator()(CGAL::Polyhedron_3<Kernel_>::HalfedgeDS &hds)
// For now let's just skip over the triangle. We can also use // For now let's just skip over the triangle. We can also use
// the Aff_transformation_3 stored in place to convert the 2d // the Aff_transformation_3 stored in place to convert the 2d
// coords back to 3d. // coords back to 3d.
Logger::Warning("Ignoring triangulated facet with novel point likely due to self-intersections"); logger::warning("Ignoring triangulated facet with novel point likely due to self-intersections");
facet_vertices.erase(facet_vertices.end() - 1); facet_vertices.erase(facet_vertices.end() - 1);
break; break;
} }
@@ -2258,7 +2258,7 @@ void PolyhedronBuilder::operator()(CGAL::Polyhedron_3<Kernel_>::HalfedgeDS &hds)
if (!CGAL::Polygon_mesh_processing::is_polygon_soup_a_polygon_mesh(facet_vertices)) { if (!CGAL::Polygon_mesh_processing::is_polygon_soup_a_polygon_mesh(facet_vertices)) {
// @todo seems to return false now, almost always? // @todo seems to return false now, almost always?
// Logger::Warning("Reoriented polygonal surface"); // logger::warning("Reoriented polygonal surface");
CGAL::Polygon_mesh_processing::orient_polygon_soup(unique_points_as_vector, facet_vertices); 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); CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(unique_points_as_vector, facet_vertices, *from_soup);
@@ -2278,12 +2278,12 @@ void PolyhedronBuilder::operator()(CGAL::Polyhedron_3<Kernel_>::HalfedgeDS &hds)
if (added_edges.find(p) != added_edges.end()) { if (added_edges.find(p) != added_edges.end()) {
if (reoriented) { if (reoriented) {
facet_indices_to_delete.push_back(fi); facet_indices_to_delete.push_back(fi);
Logger::Notice("Removed facet"); logger::notice("Removed facet");
valid = false; valid = false;
break; break;
} else { } else {
std::reverse(f.begin(), f.end()); std::reverse(f.begin(), f.end());
Logger::Notice("Reversed facet"); logger::notice("Reversed facet");
reoriented = true; reoriented = true;
goto check_edge_existence; goto check_edge_existence;
} }
+1 -1
View File
@@ -1,4 +1,4 @@
/******************************************************************************** /********************************************************************************
* * * *
* This file is part of IfcOpenShell. * * This file is part of IfcOpenShell. *
* * * *
@@ -20,7 +20,7 @@
#ifndef IFCGEOMTREE_H #ifndef IFCGEOMTREE_H
#define IFCGEOMTREE_H #define IFCGEOMTREE_H
#include "../../../ifcparse/IfcFile.h" #include "../../../ifcparse/file.h"
#include "../../../ifcgeom/IfcGeomElement.h" #include "../../../ifcgeom/IfcGeomElement.h"
#include "../../../ifcgeom/Iterator.h" #include "../../../ifcgeom/Iterator.h"
@@ -1486,11 +1486,11 @@ namespace IfcGeom {
tree() {}; tree() {};
tree(IfcParse::IfcFile& f) { tree(ifcopenshell::file& f) {
add_file(f, ifcopenshell::geometry::Settings{}); add_file(f, ifcopenshell::geometry::Settings{});
} }
tree(IfcParse::IfcFile& f, ifcopenshell::geometry::Settings settings) { tree(ifcopenshell::file& f, ifcopenshell::geometry::Settings settings) {
add_file(f, settings); add_file(f, settings);
} }
@@ -1498,7 +1498,7 @@ namespace IfcGeom {
add_file(it); add_file(it);
} }
void add_file(IfcParse::IfcFile& f, ifcopenshell::geometry::Settings settings) { void add_file(ifcopenshell::file& f, ifcopenshell::geometry::Settings settings) {
ifcopenshell::geometry::Settings settings_ = settings; ifcopenshell::geometry::Settings settings_ = settings;
settings_.get<ifcopenshell::geometry::settings::IteratorOutput>().value = ifcopenshell::geometry::settings::NATIVE; settings_.get<ifcopenshell::geometry::settings::IteratorOutput>().value = ifcopenshell::geometry::settings::NATIVE;
settings_.get<ifcopenshell::geometry::settings::UseWorldCoords>().value = true; settings_.get<ifcopenshell::geometry::settings::UseWorldCoords>().value = true;
@@ -1,4 +1,4 @@
#include <map> #include <map>
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <TopExp.hxx> #include <TopExp.hxx>
@@ -12,7 +12,7 @@
#include "OpenCascadeConversionResult.h" #include "OpenCascadeConversionResult.h"
#include "../../../ifcparse/IfcLogger.h" #include "../../../ifcparse/logger.h"
#include "../../../ifcgeom/IfcGeomRepresentation.h" #include "../../../ifcgeom/IfcGeomRepresentation.h"
#include "base_utils.h" #include "base_utils.h"
#include "boolean_utils.h" #include "boolean_utils.h"
@@ -87,7 +87,7 @@ void ifcopenshell::geometry::OpenCascadeShape::Triangulate(ifcopenshell::geometr
try { try {
BRepMesh_IncrementalMesh(shape_, settings.get<settings::MesherLinearDeflection>().get(), false, settings.get<settings::MesherAngularDeflection>().get()); BRepMesh_IncrementalMesh(shape_, settings.get<settings::MesherLinearDeflection>().get(), false, settings.get<settings::MesherAngularDeflection>().get());
} catch (...) { } catch (...) {
Logger::Message(Logger::LOG_ERROR, "Failed to triangulate shape"); logger::message(logger::LOG_ERROR, "Failed to triangulate shape");
return; return;
} }
} }
@@ -113,7 +113,7 @@ void ifcopenshell::geometry::OpenCascadeShape::Triangulate(ifcopenshell::geometr
Handle_Poly_Triangulation tri = BRep_Tool::Triangulation(face, loc); Handle_Poly_Triangulation tri = BRep_Tool::Triangulation(face, loc);
if (tri.IsNull()) { if (tri.IsNull()) {
Logger::Message(Logger::LOG_ERROR, "Triangulation missing for face"); logger::message(logger::LOG_ERROR, "Triangulation missing for face");
} else { } else {
// Keep track of the number of times an edge is used // Keep track of the number of times an edge is used
// Manifold edges (i.e. edges used twice) are deemed invisible // Manifold edges (i.e. edges used twice) are deemed invisible
@@ -174,7 +174,7 @@ void ifcopenshell::geometry::OpenCascadeShape::Triangulate(ifcopenshell::geometr
else triangles(i).Get(n1, n2, n3); else triangles(i).Get(n1, n2, n3);
if (dict[n1] == dict[n2] || dict[n2] == dict[n3] || dict[n3] == dict[n1]) { if (dict[n1] == dict[n2] || dict[n2] == dict[n3] || dict[n3] == dict[n1]) {
Logger::Warning("Mesher generated a degenerate triangle, ignoring"); logger::warning("Mesher generated a degenerate triangle, ignoring");
continue; continue;
} }
@@ -619,7 +619,7 @@ namespace {
try { try {
BRepMesh_IncrementalMesh(s, tol); BRepMesh_IncrementalMesh(s, tol);
} catch (...) { } catch (...) {
Logger::Message(Logger::LOG_ERROR, "Failed to triangulate shape"); logger::message(logger::LOG_ERROR, "Failed to triangulate shape");
return; return;
} }
meshed = true; meshed = true;
@@ -1,4 +1,4 @@
/******************************************************************************** /********************************************************************************
* * * *
* This file is part of IfcOpenShell. * * This file is part of IfcOpenShell. *
* * * *
@@ -117,7 +117,7 @@ bool IfcGeom::OpenCascadeKernel::convert_openings(const express::Base& entity, c
auto it3_shape = std::static_pointer_cast<OpenCascadeShape>(it3->Shape())->shape(); auto it3_shape = std::static_pointer_cast<OpenCascadeShape>(it3->Shape())->shape();
if (it3_shape.IsNull()) { if (it3_shape.IsNull()) {
Logger::Error("Null operand"); logger::error("Null operand");
continue; continue;
} }
@@ -136,7 +136,7 @@ bool IfcGeom::OpenCascadeKernel::convert_openings(const express::Base& entity, c
bool is_manifold = util::is_manifold(entity_part); bool is_manifold = util::is_manifold(entity_part);
if (!is_manifold) { if (!is_manifold) {
Logger::Warning("Non-manifold first operand"); logger::warning("Non-manifold first operand");
} }
TopoDS_Shape entity_part_result; TopoDS_Shape entity_part_result;
@@ -151,7 +151,7 @@ bool IfcGeom::OpenCascadeKernel::convert_openings(const express::Base& entity, c
const auto& m = it3->Placement()->ccomponents(); const auto& m = it3->Placement()->ccomponents();
// @todo // @todo
// if (entity_shape_gtrsf.Form() == gp_Other) { // if (entity_shape_gtrsf.Form() == gp_Other) {
// Logger::Message(Logger::LOG_WARNING, "Applying non uniform transformation to:", entity); // logger::message(logger::LOG_WARNING, "Applying non uniform transformation to:", entity);
// } // }
gp_Trsf entity_shape_gtrsf; gp_Trsf entity_shape_gtrsf;
entity_shape_gtrsf.SetValues( entity_shape_gtrsf.SetValues(
@@ -178,7 +178,7 @@ bool IfcGeom::OpenCascadeKernel::convert_openings(const express::Base& entity, c
if (util::boolean_operation(bst, result, opening_list, BOPAlgo_CUT, intermediate_result)) { if (util::boolean_operation(bst, result, opening_list, BOPAlgo_CUT, intermediate_result)) {
result = intermediate_result; result = intermediate_result;
} else { } else {
Logger::Message(Logger::LOG_ERROR, "Opening subtraction failed for " + boost::lexical_cast<std::string>(std::distance(jt, it)) + " openings", entity); logger::message(logger::LOG_ERROR, "Opening subtraction failed for " + boost::lexical_cast<std::string>(std::distance(jt, it)) + " openings", entity);
} }
jt = it; jt = it;
@@ -199,7 +199,7 @@ bool IfcGeom::OpenCascadeKernel::convert_openings(const express::Base& entity, c
// where we keep the first operand as is (a compound of faces probably, // 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). // unless --orient-shells was activated in which case we're already lost).
if (!is_manifold) { if (!is_manifold) {
Logger::Warning("Retrying boolean operation on individual faces"); logger::warning("Retrying boolean operation on individual faces");
} }
continue; continue;
} }
@@ -378,7 +378,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// } // }
// //
// if (!success) { // if (!success) {
// Logger::Error("Failed processing layerset"); // logger::error("Failed processing layerset");
// } // }
// } // }
// } // }
@@ -406,7 +406,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// } // }
// } // }
// if (some_items_without_style) { // if (some_items_without_style) {
// Logger::Warning("No material and surface styles for:", product); // logger::warning("No material and surface styles for:", product);
// } // }
// } // }
// //
@@ -433,7 +433,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// parent_id = parent_object->data().id(); // parent_id = parent_object->data().id();
// } // }
// } catch (const std::exception& e) { // } catch (const std::exception& e) {
// Logger::Error(e); // logger::error(e);
// } // }
// //
// const std::string name = product->Name().value_or(""); // const std::string name = product->Name().value_or("");
@@ -445,9 +445,9 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// convert(product->ObjectPlacement(), trsf); // convert(product->ObjectPlacement(), trsf);
// } // }
// } catch (const std::exception& e) { // } catch (const std::exception& e) {
// Logger::Error(e); // logger::error(e);
// } catch (...) { // } catch (...) {
// Logger::Error("Failed to construct placement"); // logger::error("Failed to construct placement");
// } // }
// //
// // Does the IfcElement have any IfcOpenings? // // Does the IfcElement have any IfcOpenings?
@@ -468,10 +468,10 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// try { // try {
// convert_openings(product, openings, shapes, trsf, opened_shapes); // convert_openings(product, openings, shapes, trsf, opened_shapes);
// } catch (const std::exception& e) { // } catch (const std::exception& e) {
// Logger::Message(Logger::LOG_ERROR, std::string("Error processing openings for: ") + e.what() + ":", product); // logger::message(logger::LOG_ERROR, std::string("error processing openings for: ") + e.what() + ":", product);
// caught_error = true; // caught_error = true;
// } catch (...) { // } catch (...) {
// Logger::Message(Logger::LOG_ERROR, "Error processing openings for:", product); // logger::message(logger::LOG_ERROR, "error processing openings for:", product);
// } // }
// //
// if (caught_error && opened_shapes.size() < shapes.size()) { // if (caught_error && opened_shapes.size() < shapes.size()) {
@@ -536,12 +536,12 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// if (elem->geometry().calculate_surface_area(a_calc)) { // if (elem->geometry().calculate_surface_area(a_calc)) {
// double diff = std::abs(a_calc - a_file); // double diff = std::abs(a_calc - a_file);
// if (diff / std::sqrt(a_file) > getValue(GV_PRECISION)) { // if (diff / std::sqrt(a_file) > getValue(GV_PRECISION)) {
// Logger::Error("Validation of surface area failed for:", product); // logger::error("Validation of surface area failed for:", product);
// } else { // } else {
// Logger::Notice("Validation of surface area succeeded for:", product); // logger::notice("Validation of surface area succeeded for:", product);
// } // }
// } else { // } else {
// Logger::Error("Validation of surface area failed for:", product); // logger::error("Validation of surface area failed for:", product);
// } // }
// } else if (q->as<IfcSchema::IfcQuantityVolume>() && q->Name() == "Volume") { // } else if (q->as<IfcSchema::IfcQuantityVolume>() && q->Name() == "Volume") {
// double v_calc; // double v_calc;
@@ -549,12 +549,12 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// if (elem->geometry().calculate_volume(v_calc)) { // if (elem->geometry().calculate_volume(v_calc)) {
// double diff = std::abs(v_calc - v_file); // double diff = std::abs(v_calc - v_file);
// if (diff / std::sqrt(v_file) > getValue(GV_PRECISION)) { // if (diff / std::sqrt(v_file) > getValue(GV_PRECISION)) {
// Logger::Error("Validation of volume failed for:", product); // logger::error("Validation of volume failed for:", product);
// } else { // } else {
// Logger::Notice("Validation of volume succeeded for:", product); // logger::notice("Validation of volume succeeded for:", product);
// } // }
// } else { // } else {
// Logger::Error("Validation of volume failed for:", product); // logger::error("Validation of volume failed for:", product);
// } // }
// } else if (q->as<IfcSchema::IfcPhysicalComplexQuantity>() && q->Name() == "Shape Validation Properties") { // } else if (q->as<IfcSchema::IfcPhysicalComplexQuantity>() && q->Name() == "Shape Validation Properties") {
// auto qs2 = q->as<IfcSchema::IfcPhysicalComplexQuantity>()->HasQuantities(); // auto qs2 = q->as<IfcSchema::IfcPhysicalComplexQuantity>()->HasQuantities();
@@ -573,9 +573,9 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// } // }
// } // }
// if (!all_succeeded) { // if (!all_succeeded) {
// Logger::Error("Validation of surface genus failed for:", product); // logger::error("Validation of surface genus failed for:", product);
// } else { // } else {
// Logger::Notice("Validation of surface genus succeeded for:", product); // logger::notice("Validation of surface genus succeeded for:", product);
// } // }
// } // }
// } // }
@@ -606,8 +606,8 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// } // }
// } // }
// } // }
// } catch (const IfcParse::IfcException& e) { // } catch (const ifcopenshell::exception& e) {
// Logger::Error(e); // logger::error(e);
// // @todo reset representation_mapped_to to zero? // // @todo reset representation_mapped_to to zero?
// } // }
// return representation_mapped_to; // return representation_mapped_to;
@@ -625,21 +625,21 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// //
// // IfcProductRepresentation also lacks the INVERSE relation to IfcProduct // // IfcProductRepresentation also lacks the INVERSE relation to IfcProduct
// // Let's find the IfcProducts that reference the IfcProductRepresentation anyway // // Let's find the IfcProducts that reference the IfcProductRepresentation anyway
// products->push((*it)->data().getInverse((&IfcSchema::IfcProduct::Class()), -1)->as<IfcSchema::IfcProduct>()); // products->push((*it)->data().get_inverse((&IfcSchema::IfcProduct::Class()), -1)->as<IfcSchema::IfcProduct>());
// } // }
// //
// IfcSchema::IfcRepresentationMap::list::ptr maps = representation->RepresentationMap(); // IfcSchema::IfcRepresentationMap::list::ptr maps = representation->RepresentationMap();
// //
// if (products->size() && maps->size()) { // if (products->size() && maps->size()) {
// Logger::Warning("Representation used by IfcRepresentationMap and IfcProductDefinitionShape", representation); // logger::warning("Representation used by IfcRepresentationMap and IfcProductDefinitionShape", representation);
// } // }
// //
// if (prodreps->size() > 1) { // if (prodreps->size() > 1) {
// Logger::Warning("Multiple IfcProductDefinitionShapes for representation", representation); // logger::warning("Multiple IfcProductDefinitionShapes for representation", representation);
// } // }
// //
// if (maps->size() > 1) { // if (maps->size() > 1) {
// Logger::Warning("Multiple IfcRepresentationMaps for representation", representation); // logger::warning("Multiple IfcRepresentationMaps for representation", representation);
// } // }
// //
// if (maps->size() == 1) { // if (maps->size() == 1) {
@@ -654,13 +654,13 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// continue; // continue;
// } // }
// //
// IfcSchema::IfcRepresentation::list::ptr reps = item->data().getInverse((&IfcSchema::IfcRepresentation::Class()), -1)->as<IfcSchema::IfcRepresentation>(); // IfcSchema::IfcRepresentation::list::ptr reps = item->data().get_inverse((&IfcSchema::IfcRepresentation::Class()), -1)->as<IfcSchema::IfcRepresentation>();
// for (IfcSchema::IfcRepresentation::list::it jt = reps->begin(); jt != reps->end(); ++jt) { // for (IfcSchema::IfcRepresentation::list::it jt = reps->begin(); jt != reps->end(); ++jt) {
// IfcSchema::IfcRepresentation* rep = *jt; // IfcSchema::IfcRepresentation* rep = *jt;
// if (rep->Items()->size() != 1) continue; // if (rep->Items()->size() != 1) continue;
// IfcSchema::IfcProductRepresentation::list::ptr prodreps_mapped = rep->OfProductRepresentation(); // IfcSchema::IfcProductRepresentation::list::ptr prodreps_mapped = rep->OfProductRepresentation();
// for (IfcSchema::IfcProductRepresentation::list::it kt = prodreps_mapped->begin(); kt != prodreps_mapped->end(); ++kt) { // for (IfcSchema::IfcProductRepresentation::list::it kt = prodreps_mapped->begin(); kt != prodreps_mapped->end(); ++kt) {
// IfcSchema::IfcProduct::list::ptr ps = (*kt)->data().getInverse((&IfcSchema::IfcProduct::Class()), -1)->as<IfcSchema::IfcProduct>(); // IfcSchema::IfcProduct::list::ptr ps = (*kt)->data().get_inverse((&IfcSchema::IfcProduct::Class()), -1)->as<IfcSchema::IfcProduct>();
// products->push(ps); // products->push(ps);
// } // }
// } // }
@@ -682,7 +682,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// parent_id = parent_object->data().id(); // parent_id = parent_object->data().id();
// } // }
// } catch (const std::exception& e) { // } catch (const std::exception& e) {
// Logger::Error(e); // logger::error(e);
// } // }
// //
// const std::string name = product->Name().value_or(""); // const std::string name = product->Name().value_or("");
@@ -694,9 +694,9 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// convert(product->ObjectPlacement(), trsf); // convert(product->ObjectPlacement(), trsf);
// } // }
// } catch (const std::exception& e) { // } catch (const std::exception& e) {
// Logger::Error(e); // logger::error(e);
// } catch (...) { // } catch (...) {
// Logger::Error("Failed to construct placement"); // logger::error("Failed to construct placement");
// } // }
// //
// std::string context_string = ""; // std::string context_string = "";
@@ -898,7 +898,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// // range. It's only a safeguard though, so can probably be approximated. // // range. It's only a safeguard though, so can probably be approximated.
// const double axis_length = own_axis_start.Distance(own_axis_end); // const double axis_length = own_axis_start.Distance(own_axis_end);
// if (length_required > axis_length) { // if (length_required > axis_length) {
// Logger::Warning("The wall axis is not long enough to accommodate the fold points"); // logger::warning("The wall axis is not long enough to accommodate the fold points");
// return false; // return false;
// } // }
// //
@@ -918,7 +918,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// gp_Trsf other; // gp_Trsf other;
// if (other_wall->ObjectPlacement()) { // if (other_wall->ObjectPlacement()) {
// if (!convert(other_wall->ObjectPlacement(), other)) { // if (!convert(other_wall->ObjectPlacement(), other)) {
// Logger::Error("Failed to convert placement", other_wall); // logger::error("Failed to convert placement", other_wall);
// continue; // continue;
// } // }
// } // }
@@ -926,7 +926,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// IfcSchema::IfcRepresentation* axis_representation = find_representation(other_wall, "Axis"); // IfcSchema::IfcRepresentation* axis_representation = find_representation(other_wall, "Axis");
// //
// if (!axis_representation) { // if (!axis_representation) {
// Logger::Warning("Joined wall has no axis representation", other_wall); // logger::warning("Joined wall has no axis representation", other_wall);
// continue; // continue;
// } // }
// //
@@ -1020,7 +1020,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// Vs1.Cross(Vs2); // Vs1.Cross(Vs2);
// //
// if (Vs1.IsNormal(Vc, 1.e-5)) { // if (Vs1.IsNormal(Vc, 1.e-5)) {
// Logger::Warning("Connected walls are parallel"); // logger::warning("Connected walls are parallel");
// parallel = true; // parallel = true;
// } else if (w < axis_u1 || w > axis_u2) { // } else if (w < axis_u1 || w > axis_u2) {
// point_outside_param_range = p; // point_outside_param_range = p;
@@ -1167,7 +1167,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// return item; // return item;
// } // }
// //
// bool IfcGeom::Kernel::is_identity_transform(IfcUtil::IfcBaseInterface* l) { // bool IfcGeom::Kernel::is_identity_transform(ifcopenshell::IfcBaseInterface* l) {
// IfcSchema::IfcAxis2Placement2D* ax2d; // IfcSchema::IfcAxis2Placement2D* ax2d;
// IfcSchema::IfcAxis2Placement3D* ax3d; // IfcSchema::IfcAxis2Placement3D* ax3d;
// //
@@ -1201,11 +1201,11 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// convert(ax3d, trsf); // convert(ax3d, trsf);
// return trsf.Form() == gp_Identity; // return trsf.Form() == gp_Identity;
// } else { // } else {
// throw IfcParse::IfcException("Invalid valuation for IfcAxis2Placement / IfcCartesianTransformationOperator"); // throw ifcopenshell::exception("Invalid valuation for IfcAxis2Placement / IfcCartesianTransformationOperator");
// } // }
// } // }
// //
// void IfcGeom::Kernel::set_conversion_placement_rel_to_type(const IfcParse::declaration* type) { // void IfcGeom::Kernel::set_conversion_placement_rel_to_type(const ifcopenshell::declaration* type) {
// placement_rel_to_type_ = type; // placement_rel_to_type_ = type;
// } // }
// //
@@ -1249,7 +1249,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// //
// #define Kernel POSTFIX_SCHEMA(Kernel) // #define Kernel POSTFIX_SCHEMA(Kernel)
// //
// std::shared_ptr<const IfcGeom::SurfaceStyle> IfcGeom::Kernel::internalize_surface_style(const std::pair<IfcUtil::IfcBaseClass*, IfcUtil::IfcBaseClass*>& shading_styles) { // std::shared_ptr<const IfcGeom::SurfaceStyle> IfcGeom::Kernel::internalize_surface_style(const std::pair<ifcopenshell::IfcBaseClass*, ifcopenshell::IfcBaseClass*>& shading_styles) {
// if (shading_styles.second == 0) { // if (shading_styles.second == 0) {
// return 0; // return 0;
// } // }
@@ -1355,7 +1355,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// Handle_Geom_Circle axis_line = Handle_Geom_Circle::DownCast(axis_curve); // Handle_Geom_Circle axis_line = Handle_Geom_Circle::DownCast(axis_curve);
// reference_surface = new Geom_CylindricalSurface(axis_li->Position(), axis_line->Radius()); // reference_surface = new Geom_CylindricalSurface(axis_li->Position(), axis_line->Radius());
// } else { // } else {
// Logger::Message(Logger::LOG_ERROR, "Unsupported underlying curve of Axis representation:", product); // logger::message(logger::LOG_ERROR, "Unsupported underlying curve of Axis representation:", product);
// return false; // return false;
// } // }
// //
+14 -14
View File
@@ -1,6 +1,6 @@
#include "base_utils.h" #include "base_utils.h"
#include "../../../ifcparse/IfcLogger.h" #include "../../../ifcparse/logger.h"
#include "OpenCascadeConversionResult.h" #include "OpenCascadeConversionResult.h"
#include "boolean_utils.h" #include "boolean_utils.h"
@@ -711,12 +711,12 @@ bool IfcGeom::util::create_solid_from_faces(const TopTools_ListOfShape& face_lis
valid_shell &= util::count(shape, TopAbs_SHELL) > 0; valid_shell &= util::count(shape, TopAbs_SHELL) > 0;
} catch (const Standard_Failure& e) { } catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) { if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString()); logger::error(e.GetMessageString());
} else { } else {
Logger::Error("Unknown error sewing shell"); logger::error("Unknown error sewing shell");
} }
} catch (...) { } catch (...) {
Logger::Error("Unknown error sewing shell"); logger::error("Unknown error sewing shell");
} }
if (valid_shell) { if (valid_shell) {
@@ -744,22 +744,22 @@ bool IfcGeom::util::create_solid_from_faces(const TopTools_ListOfShape& face_lis
} }
} catch (const Standard_Failure& e) { } catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) { if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString()); logger::error(e.GetMessageString());
} else { } else {
Logger::Error("Unknown error classifying solid"); logger::error("Unknown error classifying solid");
} }
} catch (...) { } catch (...) {
Logger::Error("Unknown error classifying solid"); logger::error("Unknown error classifying solid");
} }
} }
} catch (const Standard_Failure& e) { } catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) { if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString()); logger::error(e.GetMessageString());
} else { } else {
Logger::Error("Unknown error creating solid"); logger::error("Unknown error creating solid");
} }
} catch (...) { } catch (...) {
Logger::Error("Unknown error creating solid"); logger::error("Unknown error creating solid");
} }
if (complete_shape.IsNull()) { if (complete_shape.IsNull()) {
@@ -771,7 +771,7 @@ bool IfcGeom::util::create_solid_from_faces(const TopTools_ListOfShape& face_lis
B.MakeCompound(C); B.MakeCompound(C);
B.Add(C, complete_shape); B.Add(C, complete_shape);
complete_shape = C; complete_shape = C;
Logger::Warning("Multiple components in IfcConnectedFaceSet"); logger::warning("Multiple components in IfcConnectedFaceSet");
} }
B.Add(complete_shape, result_shape); B.Add(complete_shape, result_shape);
} }
@@ -786,7 +786,7 @@ bool IfcGeom::util::create_solid_from_faces(const TopTools_ListOfShape& face_lis
B.MakeCompound(C); B.MakeCompound(C);
B.Add(C, complete_shape); B.Add(C, complete_shape);
complete_shape = C; complete_shape = C;
Logger::Warning("Loose faces in IfcConnectedFaceSet"); logger::warning("Loose faces in IfcConnectedFaceSet");
} }
B.Add(complete_shape, loose_faces.Current()); B.Add(complete_shape, loose_faces.Current());
} }
@@ -794,7 +794,7 @@ bool IfcGeom::util::create_solid_from_faces(const TopTools_ListOfShape& face_lis
shape = complete_shape; shape = complete_shape;
} else { } else {
Logger::Error("Failed to sew faceset"); logger::error("Failed to sew faceset");
} }
return valid_shell; return valid_shell;
@@ -898,7 +898,7 @@ bool IfcGeom::util::validate_shape(const TopoDS_Shape& s) {
dump(s); dump(s);
Logger::Warning(str.str()); logger::warning(str.str());
return false; return false;
} }
@@ -117,14 +117,14 @@ bool OpenCascadeKernel::convert_impl(const taxonomy::boolean_result::ptr br, Con
const double first_operand_volume = util::shape_volume(a); const double first_operand_volume = util::shape_volume(a);
if (first_operand_volume <= ALMOST_ZERO) { if (first_operand_volume <= ALMOST_ZERO) {
Logger::Message(Logger::LOG_WARNING, "Empty solid for:", c->instance); logger::message(logger::LOG_WARNING, "Empty solid for:", c->instance);
} }
} else { } else {
for (auto& r : cr) { for (auto& r : cr) {
auto S = std::static_pointer_cast<OpenCascadeShape>(r.Shape())->shape(); auto S = std::static_pointer_cast<OpenCascadeShape>(r.Shape())->shape();
if (S.IsNull()) { if (S.IsNull()) {
Logger::Error("Null operand"); logger::error("Null operand");
continue; continue;
} }
gp_GTrsf trsf; gp_GTrsf trsf;
@@ -139,7 +139,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 // #2665 we also set a precision-independent threshold, because in the boolean op routine
// the working fuzziness might still be increased. // the working fuzziness might still be increased.
if (d < tol * 20. || d < 0.00002) { if (d < tol * 20. || d < 0.00002) {
Logger::Message(Logger::LOG_WARNING, "Halfspace subtraction yields unchanged volume:", c->instance); logger::message(logger::LOG_WARNING, "Halfspace subtraction yields unchanged volume:", c->instance);
continue; continue;
} else { } else {
S = result; S = result;
@@ -419,7 +419,7 @@ int IfcGeom::util::eliminate_narrow_operands(double prec, const TopTools_ListOfS
bool is_narrow = min_dimension < prec; bool is_narrow = min_dimension < prec;
Logger::Notice("Min OBB dimension of operand = " + std::to_string(min_dimension)); logger::notice("Min OBB dimension of operand = " + std::to_string(min_dimension));
if (!is_narrow) { if (!is_narrow) {
c.Append(it.Value()); c.Append(it.Value());
@@ -704,7 +704,7 @@ bool IfcGeom::util::boolean_subtraction_2d_using_builder(const TopoDS_Shape & a_
if (u11 < U1 && U1 < u12 && u21 < U2 && U2 < u22) { if (u11 < U1 && U1 < u12 && u21 < U2 && U2 < u22) {
// Edge curves belonging to different operands intersect, don't process // Edge curves belonging to different operands intersect, don't process
// using builder. // using builder.
Logger::Notice("Intersecting boundaries"); logger::notice("Intersecting boundaries");
return false; return false;
} }
} }
@@ -751,7 +751,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 // any effect and marked as redundant. Feeding it to the builder algo
// will likely cause problems. // will likely cause problems.
redundant[std::distance(wires.begin(), it)] = true; redundant[std::distance(wires.begin(), it)] = true;
Logger::Notice("Subtraction operand outside of outer bound"); logger::notice("Subtraction operand outside of outer bound");
} }
} }
@@ -791,7 +791,7 @@ bool IfcGeom::util::boolean_subtraction_2d_using_builder(const TopoDS_Shape & a_
if (wire_clss[wire_index].Perform(p2d) == TopAbs_IN) { if (wire_clss[wire_index].Perform(p2d) == TopAbs_IN) {
// A wire is contained within another operand // A wire is contained within another operand
redundant[other_index] = true; redundant[other_index] = true;
Logger::Notice("Subtraction operand contained in other"); logger::notice("Subtraction operand contained in other");
} }
} }
} }
@@ -849,7 +849,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
std::stringstream ss; std::stringstream ss;
ss << "bool-" << std::this_thread::get_id() << "-" << (operation_counter_++); ss << "bool-" << std::this_thread::get_id() << "-" << (operation_counter_++);
debug_identifier = ss.str(); debug_identifier = ss.str();
Logger::Notice("Boolean debug identifier: " + debug_identifier); logger::notice("Boolean debug identifier: " + debug_identifier);
} }
if (fuzziness < 0.) { if (fuzziness < 0.) {
@@ -885,8 +885,8 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
a = unify(a_input, fuzziness * 1000.); a = unify(a_input, fuzziness * 1000.);
Logger::Message( logger::message(
Logger::LOG_DEBUG, logger::LOG_DEBUG,
"Simplified operand A from "s + "Simplified operand A from "s +
std::to_string(count(a_input, TopAbs_FACE)) + std::to_string(count(a_input, TopAbs_FACE)) +
" to "s + " to "s +
@@ -897,8 +897,8 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
TopTools_ListIteratorOfListOfShape it(b_input); TopTools_ListIteratorOfListOfShape it(b_input);
for (; it.More(); it.Next()) { for (; it.More(); it.Next()) {
b.Append(unify(it.Value(), fuzziness)); b.Append(unify(it.Value(), fuzziness));
Logger::Message( logger::message(
Logger::LOG_DEBUG, logger::LOG_DEBUG,
"Simplified operand B from "s + "Simplified operand B from "s +
std::to_string(count(it.Value(), TopAbs_FACE)) + std::to_string(count(it.Value(), TopAbs_FACE)) +
" to "s + " to "s +
@@ -925,7 +925,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
auto N = bounding_box_overlap(fuzziness, a, b, b_tmp); auto N = bounding_box_overlap(fuzziness, a, b, b_tmp);
if (N) { if (N) {
Logger::Notice("Eliminated " + std::to_string(N) + " disjoint operands"); logger::notice("Eliminated " + std::to_string(N) + " disjoint operands");
std::swap(b, b_tmp); std::swap(b, b_tmp);
} }
} }
@@ -936,7 +936,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
b_tmp.Clear(); b_tmp.Clear();
auto N = eliminate_touching_operands(fuzziness, a, b, b_tmp); auto N = eliminate_touching_operands(fuzziness, a, b, b_tmp);
if (N) { if (N) {
Logger::Notice("Eliminated " + std::to_string(N) + " touching operands"); logger::notice("Eliminated " + std::to_string(N) + " touching operands");
std::swap(b, b_tmp); std::swap(b, b_tmp);
} }
} }
@@ -947,7 +947,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
b_tmp.Clear(); b_tmp.Clear();
auto N = eliminate_narrow_operands(fuzziness, b, b_tmp); auto N = eliminate_narrow_operands(fuzziness, b, b_tmp);
if (N) { if (N) {
Logger::Notice("Eliminated " + std::to_string(N) + " narrow operands"); logger::notice("Eliminated " + std::to_string(N) + " narrow operands");
std::swap(b, b_tmp); std::swap(b, b_tmp);
} }
} }
@@ -961,21 +961,21 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
} }
if (b.Extent() == 0) { if (b.Extent() == 0) {
Logger::Warning("No other operands remaining, using first operand"); logger::warning("No other operands remaining, using first operand");
result = a; result = a;
return true; return true;
} }
if (!is_2d && Logger::LOG_NOTICE >= Logger::Verbosity()) { if (!is_2d && logger::LOG_NOTICE >= logger::verbosity()) {
PERF("preliminary manifoldness check"); PERF("preliminary manifoldness check");
if (!a.IsNull()) { if (!a.IsNull()) {
Logger::Notice("Operand A is " + (is_manifold(a) ? ""s : "non-"s) + "manifold"); logger::notice("Operand A is " + (is_manifold(a) ? ""s : "non-"s) + "manifold");
} }
TopTools_ListIteratorOfListOfShape it(b); TopTools_ListIteratorOfListOfShape it(b);
for (int i = 0; it.More(); it.Next(), ++i) { for (int i = 0; it.More(); it.Next(), ++i) {
Logger::Notice("Operand B " + std::to_string(i) + " is " + (is_manifold(it.Value()) ? ""s : "non-"s) + "manifold"); logger::notice("Operand B " + std::to_string(i) + " is " + (is_manifold(it.Value()) ? ""s : "non-"s) + "manifold");
} }
} }
@@ -1015,7 +1015,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
const double fuzz = (std::min)(min_length_orig / 3., fuzziness); const double fuzz = (std::min)(min_length_orig / 3., fuzziness);
Logger::Notice("Used fuzziness: " + std::to_string(fuzz)); logger::notice("Used fuzziness: " + std::to_string(fuzz));
const double new_fuzziness = fuzziness * 10.; const double new_fuzziness = fuzziness * 10.;
const bool allow_retry = new_fuzziness - 1e-15 <= settings.precision * 10000. && new_fuzziness < min_length_orig; const bool allow_retry = new_fuzziness - 1e-15 <= settings.precision * 10000. && new_fuzziness < min_length_orig;
@@ -1049,7 +1049,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
} }
if (is_extrusion_a) { if (is_extrusion_a) {
Logger::Notice("Operand A 1/1 is an extrusion"); logger::notice("Operand A 1/1 is an extrusion");
TopTools_ListIteratorOfListOfShape it(b); TopTools_ListIteratorOfListOfShape it(b);
for (int nb = 1; it.More(); it.Next(), ++nb) { for (int nb = 1; it.More(); it.Next(), ++nb) {
@@ -1065,10 +1065,10 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
} }
if (is_extrusion_b) { if (is_extrusion_b) {
Logger::Notice("Operand B " + std::to_string(nb) + "/" + std::to_string(b.Extent()) + " is an extrusion"); logger::notice("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.)) { if (b_interval.first < a_interval.first + (fuzz * 100.) && b_interval.second > a_interval.second - (fuzz * 100.)) {
Logger::Notice("Operand B creates a through hole"); logger::notice("Operand B creates a through hole");
// Align b with a operand // Align b with a operand
gp_Trsf trsf; gp_Trsf trsf;
@@ -1108,23 +1108,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)); BRepPrimAPI_MakePrism mp(face_result, gp_Vec(gp::DY()) * (a_interval.second - a_interval.first));
if (mp.IsDone()) { if (mp.IsDone()) {
if (b_remainder_3d.Extent()) { if (b_remainder_3d.Extent()) {
Logger::Notice(std::to_string(b_remainder_3d.Extent()) + " operands remaining to process in 3D"); logger::notice(std::to_string(b_remainder_3d.Extent()) + " operands remaining to process in 3D");
b = b_remainder_3d; b = b_remainder_3d;
s1s.Clear(); s1s.Clear();
s1s.Append(mp.Shape()); s1s.Append(mp.Shape());
} else { } else {
Logger::Notice("Processed fully in 2D"); logger::notice("Processed fully in 2D");
result = mp.Shape(); result = mp.Shape();
return true; return true;
} }
} else { } else {
Logger::Notice("Failed to extrude 2D boolean result. Retrying in 3D."); logger::notice("Failed to extrude 2D boolean result. Retrying in 3D.");
} }
} else { } else {
Logger::Notice("Failed to perform 2D boolean operation. Retrying in 3D."); logger::notice("Failed to perform 2D boolean operation. Retrying in 3D.");
} }
} else { } else {
Logger::Notice("No second operands can be processed as 2D inner bounds. Retrying in 3D."); logger::notice("No second operands can be processed as 2D inner bounds. Retrying in 3D.");
} }
} }
} }
@@ -1144,7 +1144,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
} }
if (builder->IsDone()) { if (builder->IsDone()) {
if (false && builder->DSFiller()->HasWarning(STANDARD_TYPE(BOPAlgo_AlertAcquiredSelfIntersection))) { if (false && builder->DSFiller()->HasWarning(STANDARD_TYPE(BOPAlgo_AlertAcquiredSelfIntersection))) {
Logger::Notice("Builder reports self-intersection in output"); logger::notice("Builder reports self-intersection in output");
success = false; success = false;
/* /*
@@ -1158,7 +1158,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()) { } else if(builder->DSFiller()->HasWarning(STANDARD_TYPE(BOPAlgo_AlertBadPositioning)) && !TopoDS_Iterator(*builder).More()) {
Logger::Notice("Builder reports bad positioning and result is empty"); logger::notice("Builder reports bad positioning and result is empty");
success = false; success = false;
} else { } else {
TopoDS_Shape r = *builder; TopoDS_Shape r = *builder;
@@ -1172,7 +1172,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
fix.Perform(); fix.Perform();
r = fix.Shape(); r = fix.Shape();
} catch (...) { } catch (...) {
Logger::Error("Shape healing failed on boolean result"); logger::error("Shape healing failed on boolean result");
} }
} }
@@ -1183,7 +1183,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
success = ana.IsValid() != 0; success = ana.IsValid() != 0;
if (!success) { if (!success) {
Logger::Notice("Boolean operation yields invalid result"); logger::notice("Boolean operation yields invalid result");
std::stringstream str; std::stringstream str;
bool any_emitted = false; bool any_emitted = false;
@@ -1213,7 +1213,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
dump(r); dump(r);
Logger::Notice(str.str()); logger::notice(str.str());
} }
} }
@@ -1333,7 +1333,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) { if (op == BOPAlgo_CUT && has_open_shells && all_faces_included_in_result && result_n_faces > first_op_n_faces) {
success = false; success = false;
Logger::Notice("Boolean result discarded because subtractions results in only the addition of faces"); logger::notice("Boolean result discarded because subtractions results in only the addition of faces");
} else { } else {
// when there are edges or vertex-edge distances close to the used fuzziness, the // 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. // output is not trusted and the operation is attempted with a higher fuzziness.
@@ -1379,7 +1379,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
static const char* const reason_strings[] = { "edge length", "vertex-edge", "face-face" }; static const char* const reason_strings[] = { "edge length", "vertex-edge", "face-face" };
std::stringstream str; std::stringstream str;
str << "Boolean operation result failing " << reason_strings[reason] << " interference check, with fuzziness " << fuzziness << " with length " << v; str << "Boolean operation result failing " << reason_strings[reason] << " interference check, with fuzziness " << fuzziness << " with length " << v;
Logger::Notice(str.str()); logger::notice(str.str());
} }
} }
@@ -1388,7 +1388,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
} }
} else { } else {
Logger::Notice("Boolean operation yields non-manifold result"); logger::notice("Boolean operation yields non-manifold result");
} }
} }
} }
@@ -1398,7 +1398,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
#if OCC_VERSION_HEX >= 0x70200 #if OCC_VERSION_HEX >= 0x70200
if (builder->HasError(STANDARD_TYPE(BOPAlgo_AlertBOPNotAllowed))) { if (builder->HasError(STANDARD_TYPE(BOPAlgo_AlertBOPNotAllowed))) {
Logger::Error("Invalid operands. Using first operand"); logger::error("Invalid operands. Using first operand");
result = a; result = a;
success = true; success = true;
} }
@@ -1411,14 +1411,14 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
#endif #endif
std::string str_str = str.str(); std::string str_str = str.str();
if (str_str.size()) { if (str_str.size()) {
Logger::Notice(str_str); logger::notice(str_str);
} }
} }
if (!success) { if (!success) {
if (allow_retry) { if (allow_retry) {
return boolean_operation(settings, a, b, op, result, new_fuzziness); return boolean_operation(settings, a, b, op, result, new_fuzziness);
} else { } else {
Logger::Notice("No longer attempting boolean operation with higher fuzziness"); logger::notice("No longer attempting boolean operation with higher fuzziness");
} }
} }
return success && !result.IsNull(); return success && !result.IsNull();
@@ -10,7 +10,7 @@ bool OpenCascadeKernel::convert(const taxonomy::extrusion::ptr extrusion, TopoDS
const double& height = extrusion->depth; const double& height = extrusion->depth;
if (height < settings_.get<settings::Precision>().get()) { if (height < settings_.get<settings::Precision>().get()) {
Logger::Error("Non-positive extrusion height encountered for:", extrusion->instance); logger::error("Non-positive extrusion height encountered for:", extrusion->instance);
return false; return false;
} }
@@ -24,7 +24,7 @@ bool OpenCascadeKernel::convert(const taxonomy::extrusion::ptr extrusion, TopoDS
// move the TopoDS_Shape, but obviously not both. // move the TopoDS_Shape, but obviously not both.
gp_GTrsf gtrsf; gp_GTrsf gtrsf;
if (!convert(&extrusion->matrix, gtrsf)) { if (!convert(&extrusion->matrix, gtrsf)) {
Logger::Error("Unable to move extrusion"); logger::error("Unable to move extrusion");
} }
auto trsf = gtrsf.Trsf(); auto trsf = gtrsf.Trsf();
*/ */
+14 -14
View File
@@ -169,7 +169,7 @@ namespace {
} else if (crv_or_wire.index() == 2) { } else if (crv_or_wire.index() == 2) {
// @todo // @todo
const double precision_ = 1.e-5; const double precision_ = 1.e-5;
Logger::Warning("Approximating BasisCurve due to possible discontinuities", i->instance); logger::warning("Approximating BasisCurve due to possible discontinuities", i->instance);
const auto& w = std::get<TopoDS_Wire>(crv_or_wire); const auto& w = std::get<TopoDS_Wire>(crv_or_wire);
#if OCC_VERSION_HEX < 0x70600 #if OCC_VERSION_HEX < 0x70600
BRepAdaptor_CompCurve cc(w, true); BRepAdaptor_CompCurve cc(w, true);
@@ -289,12 +289,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 // the face will still be processed as long as there are no holes. A compound of faces
// is returned in that case. // is returned in that case.
if (num_bounds > 1 && num_outer_bounds > 1 && num_bounds != num_outer_bounds) { if (num_bounds > 1 && num_outer_bounds > 1 && num_bounds != num_outer_bounds) {
Logger::Message(Logger::LOG_ERROR, "Invalid configuration of boundaries for:", face->instance); logger::message(logger::LOG_ERROR, "Invalid configuration of boundaries for:", face->instance);
return false; return false;
} }
if (num_outer_bounds > 1) { if (num_outer_bounds > 1) {
Logger::Message(Logger::LOG_WARNING, "Multiple outer boundaries for:", face->instance); logger::message(logger::LOG_WARNING, "Multiple outer boundaries for:", face->instance);
fd.all_outer() = true; fd.all_outer() = true;
} }
@@ -315,11 +315,11 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
TopoDS_Wire wire; TopoDS_Wire wire;
if (faceset_helper_ && bound->is_polyhedron()) { if (faceset_helper_ && bound->is_polyhedron()) {
if (!faceset_helper_->wire(bound, wire)) { if (!faceset_helper_->wire(bound, wire)) {
Logger::Message(Logger::LOG_WARNING, "Face boundary loop not included", bound->instance); logger::message(logger::LOG_WARNING, "Face boundary loop not included", bound->instance);
continue; continue;
} }
} else if (!convert(bound, wire)) { } else if (!convert(bound, wire)) {
Logger::Message(Logger::LOG_ERROR, "Failed to process face boundary loop", bound->instance); logger::message(logger::LOG_ERROR, "Failed to process face boundary loop", bound->instance);
return false; return false;
} }
@@ -336,7 +336,7 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
}; };
TopTools_ListOfShape results; TopTools_ListOfShape results;
if (settings.use_wire_intersection_check && util::wire_intersections(wire, results, settings)) { if (settings.use_wire_intersection_check && util::wire_intersections(wire, results, settings)) {
Logger::Warning("Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected"); logger::warning("Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
util::select_largest(results, wire); util::select_largest(results, wire);
} }
@@ -347,7 +347,7 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
} }
if (fd.wires().empty()) { if (fd.wires().empty()) {
Logger::Warning("Face with no boundaries", face->instance); logger::warning("Face with no boundaries", face->instance);
return false; return false;
} }
@@ -404,7 +404,7 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
if (fd.surface().IsNull()) { if (fd.surface().IsNull()) {
// The set of wires is triangulated in case no surface can be found // The set of wires is triangulated in case no surface can be found
Logger::Message(Logger::LOG_WARNING, "Triangulating face boundaries for face", face->instance); logger::message(logger::LOG_WARNING, "Triangulating face boundaries for face", face->instance);
if (fd.all_outer()) { if (fd.all_outer()) {
for (const auto& w : fd.wires()) { for (const auto& w : fd.wires()) {
@@ -457,7 +457,7 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
kt.Value().Original().ToUTF8CString(c); kt.Value().Original().ToUTF8CString(c);
std::string message = c; std::string message = c;
delete[] c; delete[] c;
Logger::Warning(message, face->instance); logger::warning(message, face->instance);
} }
} }
@@ -469,17 +469,17 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
if (it.Value().ShapeType() == TopAbs_FACE) { if (it.Value().ShapeType() == TopAbs_FACE) {
face_list.Append(it.Value()); face_list.Append(it.Value());
} else { } else {
Logger::Error("Unsupported output from face healing"); logger::error("Unsupported output from face healing");
} }
} }
} else { } else {
Logger::Error("Unsupported output from face healing"); logger::error("Unsupported output from face healing");
} }
} else { } else {
face_list.Append(f); face_list.Append(f);
} }
} else { } else {
Logger::Error("Internal error in face creation"); logger::error("Internal error in face creation");
return false; return false;
} }
} else { } else {
@@ -520,14 +520,14 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
delete[] c; delete[] c;
#if OCC_VERSION_MAJOR==7 && OCC_VERSION_MINOR >= 7 #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") { if (!reversed_surface && !fd.surface().IsNull() && fd.surface()->IsUPeriodic() && message == "Unknown message invoked with the keyword FixAdvFace.FixOrientation.MSG0") {
Logger::Notice("Detected reversed wire, reattempting with reversed basis surface"); logger::notice("Detected reversed wire, reattempting with reversed basis surface");
TopoDS_Face reversed_result; TopoDS_Face reversed_result;
convert(face, reversed_result, true); convert(face, reversed_result, true);
result = reversed_result; result = reversed_result;
return true; return true;
} else } else
#endif #endif
Logger::Warning(message, face->instance); logger::warning(message, face->instance);
} }
} }
} }
@@ -149,7 +149,7 @@ IfcGeom::OpenCascadeKernel::faceset_helper::faceset_helper(
auto num_retained = std::count(retained.begin(), retained.end(), true); auto num_retained = std::count(retained.begin(), retained.end(), true);
if (unique.size() != num_retained) { if (unique.size() != num_retained) {
Logger::Notice("Collapsed vertices from " + std::to_string(pnts.size()) + " (" + std::to_string(unique.size()) + " unique) to " + std::to_string(num_retained)); logger::notice("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; typedef std::array<int, 2> edge_t;
@@ -199,7 +199,7 @@ IfcGeom::OpenCascadeKernel::faceset_helper::faceset_helper(
} }
if (duplicates_.size() || loops_removed || (non_manifold && shell->closed.value_or(false))) { if (duplicates_.size() || loops_removed || (non_manifold && shell->closed.value_or(false))) {
Logger::Warning(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"); logger::warning(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");
} }
} }
@@ -270,7 +270,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::NoWireIntersectionTolerance>().get(), 0.,
kernel_->settings().get<ifcopenshell::geometry::settings::Precision>().get()})) kernel_->settings().get<ifcopenshell::geometry::settings::Precision>().get()}))
{ {
Logger::Warning("Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected"); logger::warning("Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
non_manifold_ = true; non_manifold_ = true;
wires = results; wires = results;
} else { } else {
+7 -7
View File
@@ -4,7 +4,7 @@
#include "base_utils.h" #include "base_utils.h"
#include "boolean_utils.h" #include "boolean_utils.h"
#include "../../../ifcparse/IfcLogger.h" #include "../../../ifcparse/logger.h"
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
@@ -129,7 +129,7 @@ namespace {
} }
} }
Logger::Error("Unable to map layer geometry to material index"); logger::error("Unable to map layer geometry to material index");
return false; return false;
} }
} }
@@ -234,7 +234,7 @@ bool IfcGeom::util::apply_folded_layerset(const ConversionResults& items, const
if (s.ShapeType() == TopAbs_SHELL) { if (s.ShapeType() == TopAbs_SHELL) {
shells.Append(TopoDS::Shell(s)); shells.Append(TopoDS::Shell(s));
} else { } else {
Logger::Error("Expected shell type in layerset processing"); logger::error("Expected shell type in layerset processing");
return false; return false;
} }
} }
@@ -433,12 +433,12 @@ bool IfcGeom::util::split_solid_by_shell(const TopoDS_Shape& input, const TopoDS
} }
} catch (const Standard_Failure& e) { } catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) { if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString()); logger::error(e.GetMessageString());
} else { } else {
Logger::Error("Unknown error performing fixes"); logger::error("Unknown error performing fixes");
} }
} catch (...) { } catch (...) {
Logger::Error("Unknown error performing fixes"); logger::error("Unknown error performing fixes");
} }
BRepCheck_Analyzer analyser(shape); BRepCheck_Analyzer analyser(shape);
bool is_valid = analyser.IsValid() != 0; bool is_valid = analyser.IsValid() != 0;
@@ -448,7 +448,7 @@ bool IfcGeom::util::split_solid_by_shell(const TopoDS_Shape& input, const TopoDS
} }
if (is_null[0] || is_null[1]) { if (is_null[0] || is_null[1]) {
Logger::Message(Logger::LOG_ERROR, "Null result obtained from layerset slicing"); logger::message(logger::LOG_ERROR, "Null result obtained from layerset slicing");
if (is_null[0] && is_null[1]) { if (is_null[0] && is_null[1]) {
return false; return false;
} }
+1 -1
View File
@@ -122,7 +122,7 @@ bool OpenCascadeKernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& re
return true; return true;
} else { } else {
Logger::Error("Lofting more than two sections is not supported"); logger::error("Lofting more than two sections is not supported");
return false; return false;
} }
} }
+5 -5
View File
@@ -129,7 +129,7 @@ namespace {
} else { } else {
// @todo // @todo
const double precision_ = 1.e-5; const double precision_ = 1.e-5;
Logger::Warning("Approximating BasisCurve due to possible discontinuities", e->instance); logger::warning("Approximating BasisCurve due to possible discontinuities", e->instance);
const auto& w = std::get<TopoDS_Wire>(crv_or_wire); const auto& w = std::get<TopoDS_Wire>(crv_or_wire);
#if OCC_VERSION_HEX < 0x70600 #if OCC_VERSION_HEX < 0x70600
BRepAdaptor_CompCurve cc(w, true); BRepAdaptor_CompCurve cc(w, true);
@@ -230,7 +230,7 @@ OpenCascadeKernel::curve_creation_visitor_result_type OpenCascadeKernel::convert
} }
} }
#include "../../../ifcparse/IfcFile.h" #include "../../../ifcparse/file.h"
bool OpenCascadeKernel::convert(const taxonomy::loop::ptr loop, TopoDS_Wire& wire) { bool OpenCascadeKernel::convert(const taxonomy::loop::ptr loop, TopoDS_Wire& wire) {
TopTools_ListOfShape converted_segments; TopTools_ListOfShape converted_segments;
@@ -283,7 +283,7 @@ bool OpenCascadeKernel::convert(const taxonomy::loop::ptr loop, TopoDS_Wire& wir
} }
if (converted_segments.Extent() == 0) { if (converted_segments.Extent() == 0) {
Logger::Message(Logger::LOG_ERROR, "No segment successfully converted:", loop->instance); logger::message(logger::LOG_ERROR, "No segment successfully converted:", loop->instance);
return false; return false;
} }
@@ -296,7 +296,7 @@ bool OpenCascadeKernel::convert(const taxonomy::loop::ptr loop, TopoDS_Wire& wir
if (loop->instance && loop->instance.as<express::Entity>()) { if (loop->instance && loop->instance.as<express::Entity>()) {
auto inst = loop->instance.as<express::Entity>(); auto inst = loop->instance.as<express::Entity>();
auto file = loop->instance.as<express::Entity>().file(); auto file = loop->instance.as<express::Entity>().file();
auto profile = file->getInverse(inst.id(), file->schema()->declaration_by_name("IfcProfileDef"), -1); auto profile = file->get_inverse(inst.id(), file->schema()->declaration_by_name("IfcProfileDef"), -1);
force_close = profile.size() > 0; force_close = profile.size() > 0;
} }
@@ -348,7 +348,7 @@ bool OpenCascadeKernel::convert(const taxonomy::loop::ptr loop, TopoDS_Wire& wir
if (ang < 0.0314) { if (ang < 0.0314) {
edges_to_tesselate.Add(crv1->DynamicType() == STANDARD_TYPE(Geom_Circle) ? edges.First() : edges.Last()); edges_to_tesselate.Add(crv1->DynamicType() == STANDARD_TYPE(Geom_Circle) ? edges.First() : edges.Last());
Logger::Notice("Sharp circular corner detecting, substituting with linear approximation"); logger::notice("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 { try {
success = convert(face, occ_face); success = convert(face, occ_face);
} catch (const std::exception& e) { } catch (const std::exception& e) {
Logger::Error(e); logger::error(e);
} catch (const Standard_Failure& e) { } catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) { if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString()); logger::error(e.GetMessageString());
} else { } else {
Logger::Error("Unknown error creating face"); logger::error("Unknown error creating face");
} }
} catch (...) { } catch (...) {
Logger::Error("Unknown error creating face"); logger::error("Unknown error creating face");
} }
if (!success) { if (!success) {
Logger::Message(Logger::LOG_WARNING, "Failed to convert face:", face->instance); logger::message(logger::LOG_WARNING, "Failed to convert face:", face->instance);
continue; continue;
} }
@@ -71,7 +71,7 @@ bool OpenCascadeKernel::convert(const taxonomy::shell::ptr l, TopoDS_Shape& shap
if (face_area(triangle) > min_face_area) { if (face_area(triangle) > min_face_area) {
face_list.Append(triangle); face_list.Append(triangle);
} else { } else {
Logger::Message(Logger::LOG_WARNING, "Degenerate face:", face->instance); logger::message(logger::LOG_WARNING, "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) { if (face_area(occ_face) > min_face_area) {
face_list.Append(occ_face); face_list.Append(occ_face);
} else { } else {
Logger::Message(Logger::LOG_WARNING, "Degenerate face:", face->instance); logger::message(logger::LOG_WARNING, "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"); throw std::runtime_error("Unexpected configuration of subshapes");
} }
} else { } else {
Logger::Warning("Ignored shell", s->instance); logger::warning("Ignored shell", s->instance);
} }
} }
if (!S.IsNull()) { if (!S.IsNull()) {
@@ -130,7 +130,7 @@ bool OpenCascadeKernel::convert(const taxonomy::sweep_along_curve::ptr scs, Topo
auto w = convert_curve(scs->curve); auto w = convert_curve(scs->curve);
if (w.index() != 2) { if (w.index() != 2) {
Logger::Error("Unsupported directrix"); logger::error("Unsupported directrix");
return false; return false;
} }
TopoDS_Shape face_; 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()) { for (TopExp_Explorer exp(wire, TopAbs_VERTEX); exp.More(); exp.Next()) {
if (pln.Distance(BRep_Tool::Pnt(TopoDS::Vertex(exp.Current()))) > ALMOST_ZERO) { if (pln.Distance(BRep_Tool::Pnt(TopoDS::Vertex(exp.Current()))) > ALMOST_ZERO) {
directrix_on_plane = false; directrix_on_plane = false;
Logger::Message(Logger::LOG_WARNING, "The Directrix does not lie on the ReferenceSurface", scs->instance); logger::message(logger::LOG_WARNING, "The Directrix does not lie on the ReferenceSurface", scs->instance);
break; break;
} }
} }
@@ -21,7 +21,7 @@
#include <BRepBuilderAPI_MakeFace.hxx> #include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepOffsetAPI_MakePipeShell.hxx> #include <BRepOffsetAPI_MakePipeShell.hxx>
#include "../../../ifcparse/IfcLogger.h" #include "../../../ifcparse/logger.h"
#include "base_utils.h" #include "base_utils.h"
bool IfcGeom::util::wire_is_c1_continuous(const TopoDS_Wire & w, double tol) { bool IfcGeom::util::wire_is_c1_continuous(const TopoDS_Wire & w, double tol) {
@@ -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); Handle(Geom_Curve) crv = BRep_Tool::Curve(edge, u0, u1);
crv->D1(u0, directrix_origin, directrix_tangent); crv->D1(u0, directrix_origin, directrix_tangent);
} else { } else {
Logger::Error("Unable to locate first edge"); logger::error("Unable to locate first edge");
return false; 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) { for (int i = 1; i <= map.Extent(); ++i) {
if (map.FindFromIndex(i).Extent() > 2) { if (map.FindFromIndex(i).Extent() > 2) {
Logger::Warning("Self-intersecting Directrix"); logger::warning("Self-intersecting Directrix");
} }
} }
@@ -1,6 +1,6 @@
#include "wire_builder.h" #include "wire_builder.h"
#include "../../../ifcparse/IfcLogger.h" #include "../../../ifcparse/logger.h"
#include "../../../ifcgeom/ConversionSettings.h" #include "../../../ifcgeom/ConversionSettings.h"
#include <TopExp.hxx> #include <TopExp.hxx>
@@ -116,12 +116,12 @@ bool IfcGeom::util::create_edge_over_curve_with_log_messages(const Handle_Geom_C
} }
} }
if (dmin == std::numeric_limits<double>::infinity()) { if (dmin == std::numeric_limits<double>::infinity()) {
Logger::Error("No extrema for point"); logger::error("No extrema for point");
} else if (dmin > eps2) { } else if (dmin > eps2) {
Logger::Error("Distance of " + boost::lexical_cast<std::string>(std::sqrt(dmin)) + " exceeds tolerance"); logger::error("Distance of " + boost::lexical_cast<std::string>(std::sqrt(dmin)) + " exceeds tolerance");
} }
} else { } else {
Logger::Error("Failed to calculate extrema for point"); logger::error("Failed to calculate extrema for point");
} }
} }
} }
@@ -171,7 +171,7 @@ void IfcGeom::util::wire_builder::operator()(const TopoDS_Shape& a, const TopoDS
if (dist > 1000. * p_) { if (dist > 1000. * p_) {
mw_.Add(w1); mw_.Add(w1);
mw_.Add(BRepBuilderAPI_MakeEdge(p1, p2)); mw_.Add(BRepBuilderAPI_MakeEdge(p1, p2));
Logger::Warning("Added additional segment to close gap with length " + boost::lexical_cast<std::string>(dist) + " to:", inst_); logger::warning("Added additional segment to close gap with length " + boost::lexical_cast<std::string>(dist) + " to:", inst_);
goto check; goto check;
} }
@@ -199,28 +199,28 @@ void IfcGeom::util::wire_builder::operator()(const TopoDS_Shape& a, const TopoDS
// Preferably adjust the segment that is linear // Preferably adjust the segment that is linear
if (is_line1 || (is_circle1 && !is_line2)) { if (is_line1 || (is_circle1 && !is_line2)) {
mw_.Add(adjust(w1, w12, p2)); mw_.Add(adjust(w1, w12, p2));
Logger::Notice("Adjusted edge end-point with distance " + boost::lexical_cast<std::string>(dist) + " on:", inst_); logger::notice("Adjusted edge end-point with distance " + boost::lexical_cast<std::string>(dist) + " on:", inst_);
} else if ((is_line2 || is_circle2) && !last) { } else if ((is_line2 || is_circle2) && !last) {
mw_.Add(w1); mw_.Add(w1);
override_next_ = true; override_next_ = true;
next_override_ = p1; next_override_ = p1;
Logger::Notice("Adjusted edge end-point with distance " + boost::lexical_cast<std::string>(dist) + " on:", inst_); logger::notice("Adjusted edge end-point with distance " + boost::lexical_cast<std::string>(dist) + " on:", inst_);
} else { } else {
// In all other cases an edge is added // In all other cases an edge is added
mw_.Add(w1); mw_.Add(w1);
mw_.Add(BRepBuilderAPI_MakeEdge(p1, p2)); mw_.Add(BRepBuilderAPI_MakeEdge(p1, p2));
Logger::Warning("Added additional segment to close gap with length " + boost::lexical_cast<std::string>(dist) + " to:", inst_); logger::warning("Added additional segment to close gap with length " + boost::lexical_cast<std::string>(dist) + " to:", inst_);
} }
} else { } else {
Logger::Error("Internal error, inconsistent wire segments", inst_); logger::error("Internal error, inconsistent wire segments", inst_);
mw_.Add(w1); mw_.Add(w1);
} }
} }
check: check:
if (mw_.Error() == BRepBuilderAPI_NonManifoldWire) { if (mw_.Error() == BRepBuilderAPI_NonManifoldWire) {
Logger::Error("Non-manifold curve segments:", inst_); logger::error("Non-manifold curve segments:", inst_);
} else if (mw_.Error() == BRepBuilderAPI_DisconnectedWire) { } else if (mw_.Error() == BRepBuilderAPI_DisconnectedWire) {
Logger::Error("Failed to join curve segments:", inst_); logger::error("Failed to join curve segments:", inst_);
} }
} }
+19 -19
View File
@@ -1,6 +1,6 @@
#include "wire_utils.h" #include "wire_utils.h"
#include "../../../ifcparse/IfcLogger.h" #include "../../../ifcparse/logger.h"
#include "../../../ifcgeom/ConversionSettings.h" #include "../../../ifcgeom/ConversionSettings.h"
#include "base_utils.h" #include "base_utils.h"
@@ -86,7 +86,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 // obtaining a 2d points for the Delaunay, infinity is passed here, so this
// can't for assessing degenerativeness. // can't for assessing degenerativeness.
if (v.Magnitude() < 1.e-7) { if (v.Magnitude() < 1.e-7) {
Logger::Warning("Degenerate face boundary in normal estimation"); logger::warning("Degenerate face boundary in normal estimation");
return false; return false;
} }
@@ -233,7 +233,7 @@ IfcGeom::util::triangulate_wire_result IfcGeom::util::triangulate_wire(const std
auto it = mapping.find(uvnodes[k]); auto it = mapping.find(uvnodes[k]);
if (it == mapping.end()) { if (it == mapping.end()) {
Logger::Error("Internal error: unable to unproject uv-mesh"); logger::error("Internal error: unable to unproject uv-mesh");
return TRIANGULATE_WIRE_FAIL; return TRIANGULATE_WIRE_FAIL;
} }
@@ -277,7 +277,7 @@ IfcGeom::util::triangulate_wire_result IfcGeom::util::triangulate_wire(const std
} }
faces.Append(triangle_face); faces.Append(triangle_face);
} else { } else {
Logger::Error("Internal error: missing face"); logger::error("Internal error: missing face");
return TRIANGULATE_WIRE_FAIL; return TRIANGULATE_WIRE_FAIL;
} }
} }
@@ -308,7 +308,7 @@ IfcGeom::util::triangulate_wire_result IfcGeom::util::triangulate_wire(const std
if (!contains) { if (!contains) {
#endif #endif
// All existing edges need to exist in the new faces // All existing edges need to exist in the new faces
Logger::Error("Internal error, missing edge from triangulation"); logger::error("Internal error, missing edge from triangulation");
non_manifold = true; non_manifold = true;
} }
} }
@@ -319,7 +319,7 @@ IfcGeom::util::triangulate_wire_result IfcGeom::util::triangulate_wire(const std
// Existing edges are boundaries with use 1 // Existing edges are boundaries with use 1
// New edges are internal with use 2 // New edges are internal with use 2
if (n != (mape.Contains(v) ? 1 : 2)) { if (n != (mape.Contains(v) ? 1 : 2)) {
Logger::Error("Internal error, non-manifold result from triangulation"); logger::error("Internal error, non-manifold result from triangulation");
non_manifold = true; non_manifold = true;
} }
} }
@@ -790,12 +790,12 @@ bool IfcGeom::util::fill_nonmanifold_wires_with_planar_faces(TopoDS_Shape& shape
shape = solid.SolidFromShell(TopoDS::Shell(shape)); shape = solid.SolidFromShell(TopoDS::Shell(shape));
} catch (const Standard_Failure& e) { } catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) { if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString()); logger::error(e.GetMessageString());
} else { } else {
Logger::Error("Unknown error creating solid"); logger::error("Unknown error creating solid");
} }
} catch (...) { } catch (...) {
Logger::Error("Unknown error creating solid"); logger::error("Unknown error creating solid");
} }
return true; return true;
@@ -808,12 +808,12 @@ bool IfcGeom::util::convert_curve_to_wire(const Handle(Geom_Curve)& curve, TopoD
return true; return true;
} catch (const Standard_Failure& e) { } catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) { if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString()); logger::error(e.GetMessageString());
} else { } else {
Logger::Error("Unknown error converting curve to wire"); logger::error("Unknown error converting curve to wire");
} }
} catch (...) { } catch (...) {
Logger::Error("Unknown error converting curve to wire"); logger::error("Unknown error converting curve to wire");
} }
return false; return false;
} }
@@ -834,7 +834,7 @@ void IfcGeom::util::assert_closed_wire(TopoDS_Wire& wire, double tol) {
wire = mw.Wire(); wire = mw.Wire();
} }
Logger::Warning("Wire not closed"); logger::warning("Wire not closed");
} }
} }
@@ -844,7 +844,7 @@ bool IfcGeom::util::convert_wire_to_face(const TopoDS_Wire& w, TopoDS_Face& face
TopTools_ListOfShape results; TopTools_ListOfShape results;
if (settings.use_wire_intersection_check && util::wire_intersections(wire, results, settings)) { if (settings.use_wire_intersection_check && util::wire_intersections(wire, results, settings)) {
Logger::Warning("Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected"); logger::warning("Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
util::select_largest(results, wire); util::select_largest(results, wire);
} }
@@ -875,7 +875,7 @@ bool IfcGeom::util::convert_wire_to_face(const TopoDS_Wire& w, TopoDS_Face& face
BRepBuilderAPI_FaceError er = mf.Error(); BRepBuilderAPI_FaceError er = mf.Error();
if (er != BRepBuilderAPI_FaceDone) { if (er != BRepBuilderAPI_FaceDone) {
Logger::Error("Failed to create face."); logger::error("Failed to create face.");
return false; return false;
} }
face = mf.Face(); face = mf.Face();
@@ -902,7 +902,7 @@ bool IfcGeom::util::convert_wire_to_faces(const TopoDS_Wire& w, TopoDS_Compound&
TopTools_ListOfShape results; TopTools_ListOfShape results;
if (settings.use_wire_intersection_check && util::wire_intersections(w, results, settings)) { if (settings.use_wire_intersection_check && util::wire_intersections(w, results, settings)) {
Logger::Warning("Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected"); logger::warning("Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
} else { } else {
results.Clear(); results.Clear();
results.Append(w); results.Append(w);
@@ -928,7 +928,7 @@ bool IfcGeom::util::convert_wire_to_faces(const TopoDS_Wire& w, TopoDS_Compound&
BRepBuilderAPI_FaceError er = mf.Error(); BRepBuilderAPI_FaceError er = mf.Error();
if (er != BRepBuilderAPI_FaceDone) { if (er != BRepBuilderAPI_FaceDone) {
Logger::Error("Failed to create face."); logger::error("Failed to create face.");
continue; continue;
} }
@@ -945,9 +945,9 @@ bool IfcGeom::util::convert_wire_to_faces(const TopoDS_Wire& w, TopoDS_Compound&
if (p.first >= max_area / 10.) { if (p.first >= max_area / 10.) {
B.Add(faces, p.second); B.Add(faces, p.second);
} else { } else {
Logger::Warning("Ignoring self-intersection loop with area " + boost::lexical_cast<std::string>(p.first)); logger::warning("Ignoring self-intersection loop with area " + boost::lexical_cast<std::string>(p.first));
} }
} }
return true; return true;
} }
+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())); taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst.Location()));
P = *v->components_; P = *v->components_;
} catch (const std::exception&) { } catch (const std::exception&) {
Logger::Warning("Placement with invalid Location:", inst); logger::warning("Placement with invalid Location:", inst);
} }
const bool hasAxis = inst.Axis(); const bool hasAxis = inst.Axis();
if (hasAxis) { 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())); taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst.Location()));
P = *v->components_; P = *v->components_;
} catch (const std::exception&) { } catch (const std::exception&) {
Logger::Warning("Placement with invalid Location:", inst); logger::warning("Placement with invalid Location:", inst);
} }
const bool hasRef = !!inst.RefDirection(); const bool hasRef = !!inst.RefDirection();
if (hasRef) { 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())); taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst.Location()));
o = *v->components_; o = *v->components_;
} catch (const std::exception&) { } catch (const std::exception&) {
Logger::Warning("Placement with invalid Location:", inst); logger::warning("Placement with invalid Location:", inst);
} }
const bool hasAxis = !!inst.Axis(); const bool hasAxis = !!inst.Axis();
const bool hasRef = !!inst.RefDirection(); const bool hasRef = !!inst.RefDirection();
if (hasAxis != hasRef) { if (hasAxis != hasRef) {
Logger::Warning("Axis and RefDirection should be specified together", inst); logger::warning("Axis and RefDirection should be specified together", inst);
} }
if (hasAxis) { if (hasAxis) {
@@ -26,7 +26,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2PlacementLinear& inst) { taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2PlacementLinear& inst) {
if (!inst.Location().as<IfcSchema::IfcPointByDistanceExpression>()) { if (!inst.Location().as<IfcSchema::IfcPointByDistanceExpression>()) {
Logger::Error(std::runtime_error("Location must be IfcPointByDistanceExpression for IfcAxis2PlacementLinear")); logger::error(std::runtime_error("Location must be IfcPointByDistanceExpression for IfcAxis2PlacementLinear"));
} }
Eigen::Vector3d o, axis(0, 0, 1), refDirection; Eigen::Vector3d o, axis(0, 0, 1), refDirection;
@@ -45,7 +45,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2PlacementLinear& inst)
/* /*
if (hasAxis != hasRef) { if (hasAxis != hasRef) {
Logger::Warning("Axis and RefDirection should be specified together", inst); logger::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(); const double tol = settings_.get<settings::Precision>().get();
if ( x < tol || y < tol || d1 < tol || d2 < tol) { if ( x < tol || y < tol || d1 < tol || d2 < tol) {
Logger::Message(Logger::LOG_NOTICE," Skipping zero sized profile:", inst); logger::message(logger::LOG_NOTICE," Skipping zero sized profile:", inst);
return nullptr; return nullptr;
} }
+1 -1
View File
@@ -24,7 +24,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCircle& inst) { taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCircle& inst) {
const double r = inst.Radius() * length_unit_; const double r = inst.Radius() * length_unit_;
if (r < settings_.get<settings::Precision>().get()) { if (r < settings_.get<settings::Precision>().get()) {
Logger::Message(Logger::LOG_ERROR, "Radius not greater than zero for:", inst); logger::message(logger::LOG_ERROR, "Radius not greater than zero for:", inst);
return nullptr; return nullptr;
} }
+10 -10
View File
@@ -34,11 +34,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve& inst) {
for (auto& segment : segments) { for (auto& segment : segments) {
if (segment.as<IfcSchema::IfcCompositeCurveSegment>() && segment.as<IfcSchema::IfcCompositeCurveSegment>().ParentCurve().as<IfcSchema::IfcLine>()) { if (segment.as<IfcSchema::IfcCompositeCurveSegment>() && segment.as<IfcSchema::IfcCompositeCurveSegment>().ParentCurve().as<IfcSchema::IfcLine>()) {
Logger::Notice("Infinite IfcLine used as ParentCurve of segment, treating as a segment", segment); logger::notice("Infinite IfcLine used as ParentCurve of segment, treating as a segment", segment);
double u0 = 0.0; double u0 = 0.0;
double u1 = segment.as<IfcSchema::IfcCompositeCurveSegment>().ParentCurve().as<IfcSchema::IfcLine>().Dir().Magnitude() * length_unit_; double u1 = segment.as<IfcSchema::IfcCompositeCurveSegment>().ParentCurve().as<IfcSchema::IfcLine>().Dir().Magnitude() * length_unit_;
if (u1 < settings_.get<settings::Precision>().get()) { if (u1 < settings_.get<settings::Precision>().get()) {
Logger::Warning("Segment length below tolerance", segment); logger::warning("Segment length below tolerance", segment);
} }
auto e = taxonomy::make<taxonomy::edge>(); 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>(); e->end = 2.0 * boost::math::constants::pi<double>();
loop->children.push_back(e); loop->children.push_back(e);
} else { } else {
Logger::Warning("Unexpected segment type", segment); logger::warning("Unexpected segment type", segment);
return nullptr; return nullptr;
} }
} }
@@ -95,7 +95,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve& inst) {
} }
if (spans.empty()) { if (spans.empty()) {
std::vector<express::Entity> profile = inst.file()->getInverse(inst.id(), &IfcSchema::IfcProfileDef::Class(), -1); std::vector<express::Entity> profile = inst.file()->get_inverse(inst.id(), &IfcSchema::IfcProfileDef::Class(), -1);
const bool force_close = !profile.empty(); const bool force_close = !profile.empty();
loop->closed = force_close; loop->closed = force_close;
loop->instance = inst; loop->instance = inst;
@@ -128,7 +128,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
for (auto it = segments->begin(); it != segments->end(); ++it) { for (auto it = segments->begin(); it != segments->end(); ++it) {
if (!(*it)->declaration().is(IfcSchema::IfcCompositeCurveSegment::Class())) { if (!(*it)->declaration().is(IfcSchema::IfcCompositeCurveSegment::Class())) {
Logger::Error("Not implemented", *it); logger::error("Not implemented", *it);
return false; return false;
} }
@@ -141,13 +141,13 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
TopoDS_Wire segment; TopoDS_Wire segment;
if (curve->as<IfcSchema::IfcLine>()) { if (curve->as<IfcSchema::IfcLine>()) {
Logger::Notice("Infinite IfcLine used as ParentCurve of segment, treating as a segment", *it); logger::notice("Infinite IfcLine used as ParentCurve of segment, treating as a segment", *it);
Handle_Geom_Curve handle; Handle_Geom_Curve handle;
convert_curve(curve, handle); convert_curve(curve, handle);
double u0 = 0.0; double u0 = 0.0;
double u1 = curve->as<IfcSchema::IfcLine>()->Dir()->Magnitude() * length_unit_; double u1 = curve->as<IfcSchema::IfcLine>()->Dir()->Magnitude() * length_unit_;
if (u1 < getValue(GV_PRECISION)) { if (u1 < getValue(GV_PRECISION)) {
Logger::Warning("Segment length below tolerance", *it); logger::warning("Segment length below tolerance", *it);
} }
BRepBuilderAPI_MakeEdge me(handle, u0, u1); BRepBuilderAPI_MakeEdge me(handle, u0, u1);
if (me.IsDone()) { if (me.IsDone()) {
@@ -157,7 +157,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
} }
} else if (!convert_wire(curve, segment)) { } else if (!convert_wire(curve, segment)) {
const bool failed_on_purpose = curve->as<IfcSchema::IfcPolyline>() && !segment.IsNull(); 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::message(failed_on_purpose ? logger::LOG_WARNING : logger::LOG_ERROR, "Failed to convert curve:", curve);
continue; continue;
} }
@@ -173,7 +173,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
} }
if (converted_segments.Extent() == 0) { if (converted_segments.Extent() == 0) {
Logger::Message(Logger::LOG_ERROR, "No segment successfully converted:", l); logger::message(logger::LOG_ERROR, "No segment successfully converted:", l);
return false; return false;
} }
@@ -182,7 +182,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
TopTools_ListIteratorOfListOfShape it(converted_segments); TopTools_ListIteratorOfListOfShape it(converted_segments);
std::vector<express::Base> profile = inst.data().getInverse(&IfcSchema::IfcProfileDef::Class(), -1); std::vector<express::Base> profile = inst.data().get_inverse(&IfcSchema::IfcProfileDef::Class(), -1);
const bool force_close = profile && profile->size() > 0; const bool force_close = profile && profile->size() > 0;
util::wire_builder bld(getValue(GV_PRECISION), l); util::wire_builder bld(getValue(GV_PRECISION), l);
+17 -17
View File
@@ -224,7 +224,7 @@ class curve_segment_evaluator {
} }
} }
} else { } else {
Logger::Warning("IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the next segment."); logger::warning("IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the next segment.");
} }
bool is_horizontal = false; bool is_horizontal = false;
@@ -244,7 +244,7 @@ class curve_segment_evaluator {
if ((is_horizontal + is_vertical + is_cant) != 1) { if ((is_horizontal + is_vertical + is_cant) != 1) {
// We have to choose the correct functor based on usage. We can't // 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. // support multiple, because we don't know the caller at this point.
Logger::Error(std::runtime_error("multiple uses of IfcSegmentCurve not supported"), inst_); logger::error(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; segment_type_ = is_horizontal ? ST_HORIZONTAL : is_vertical ? ST_VERTICAL : is_cant ? ST_CANT : ST_HORIZONTAL;
@@ -282,7 +282,7 @@ class curve_segment_evaluator {
end_point = segmented_reference_curve.EndPoint(); end_point = segmented_reference_curve.EndPoint();
} }
} else { } else {
Logger::Warning("IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the end point."); logger::warning("IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the end point.");
} }
if (end_point) { if (end_point) {
next_segment_placement_ = taxonomy::cast<taxonomy::matrix4>(mapping_->map(end_point))->ccomponents(); next_segment_placement_ = taxonomy::cast<taxonomy::matrix4>(mapping_->map(end_point))->ccomponents();
@@ -304,7 +304,7 @@ class curve_segment_evaluator {
taxonomy::ptr get_segment_curve_function() { taxonomy::ptr get_segment_curve_function() {
if (!parent_curve_fn_ || !parent_curve_start_point_) { if (!parent_curve_fn_ || !parent_curve_start_point_) {
Logger::Error(std::runtime_error(inst_.ParentCurve().declaration().name() + " not implemented"), inst_); logger::error(std::runtime_error(inst_.ParentCurve().declaration().name() + " not implemented"), inst_);
} }
auto length = fabs(this->length()); auto length = fabs(this->length());
@@ -444,13 +444,13 @@ class curve_segment_evaluator {
projected_length_ = length_; projected_length_ = length_;
} }
} else if (segment_type_ == ST_CANT) { } else if (segment_type_ == ST_CANT) {
Logger::Error(std::runtime_error("Unexpected segment type encountered - cant is handled in set_cant_spiral_function - should never get here")); logger::error(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>( 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(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); } [](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
); );
} else { } else {
Logger::Error(std::runtime_error("Unexpected segment type encountered")); logger::error(std::runtime_error("Unexpected segment type encountered"));
parent_curve_fn_ = std::make_shared<parent_curve_function>( 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(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); } [](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
@@ -612,13 +612,13 @@ class curve_segment_evaluator {
set_cant_spiral_function(*super, *slope, cant); set_cant_spiral_function(*super, *slope, cant);
} else if (segment_type_ == ST_VERTICAL) { } else if (segment_type_ == ST_VERTICAL) {
Logger::Error(std::runtime_error("IfcCosineSpiral cannot be used for vertical alignment")); logger::error(std::runtime_error("IfcCosineSpiral cannot be used for vertical alignment"));
parent_curve_fn_ = std::make_shared<parent_curve_function>( 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(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); } [](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
); );
} else { } else {
Logger::Error(std::runtime_error("Unexpected segment type encountered")); logger::error(std::runtime_error("Unexpected segment type encountered"));
parent_curve_fn_ = std::make_shared<parent_curve_function>( 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(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); } [](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
@@ -681,12 +681,12 @@ class curve_segment_evaluator {
set_cant_spiral_function(*super, *slope, cant); set_cant_spiral_function(*super, *slope, cant);
} else if (segment_type_ == ST_VERTICAL) { } else if (segment_type_ == ST_VERTICAL) {
Logger::Error(std::runtime_error("IfcSineSpiral cannot be used for vertical alignment")); logger::error(std::runtime_error("IfcSineSpiral cannot be used for vertical alignment"));
parent_curve_fn_ = std::make_shared<parent_curve_function>( 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(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }); [](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
} else { } else {
Logger::Error(std::runtime_error("Unexpected segment type encountered")); logger::error(std::runtime_error("Unexpected segment type encountered"));
parent_curve_fn_ = std::make_shared<parent_curve_function>( 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(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }); [](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
@@ -949,12 +949,12 @@ class curve_segment_evaluator {
} }
} else if (segment_type_ == ST_CANT) { } else if (segment_type_ == ST_CANT) {
Logger::Warning(std::runtime_error("Use of IfcCircle for cant is not supported")); logger::warning(std::runtime_error("Use of IfcCircle for cant is not supported"));
parent_curve_fn_ = std::make_shared<parent_curve_function>( 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(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }); [](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
} else { } else {
Logger::Error(std::runtime_error("Unexpected segment type encountered")); logger::error(std::runtime_error("Unexpected segment type encountered"));
parent_curve_fn_ = std::make_shared<parent_curve_function>( 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(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }); [](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
@@ -1027,7 +1027,7 @@ class curve_segment_evaluator {
parent_curve_start_point_ = (*parent_curve_fn_)(start_); parent_curve_start_point_ = (*parent_curve_fn_)(start_);
} else { } else {
Logger::Warning(std::runtime_error("Unexpected segment type encountered")); logger::warning(std::runtime_error("Unexpected segment type encountered"));
parent_curve_fn_ = std::make_shared<parent_curve_function>( 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(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }); [](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
@@ -1041,7 +1041,7 @@ class curve_segment_evaluator {
auto coeffY = pc.CoefficientsY().value_or(std::vector<double>()); auto coeffY = pc.CoefficientsY().value_or(std::vector<double>());
auto coeffZ = pc.CoefficientsZ().value_or(std::vector<double>()); auto coeffZ = pc.CoefficientsZ().value_or(std::vector<double>());
if (!coeffZ.empty()) { if (!coeffZ.empty()) {
Logger::Warning("Expected IfcPolynomialCurve.CoefficientsZ to be undefined for alignment geometry. Coefficients ignored.", pc); logger::warning("Expected IfcPolynomialCurve.CoefficientsZ to be undefined for alignment geometry. Coefficients ignored.", pc);
} }
if (segment_type_ == ST_HORIZONTAL || segment_type_ == ST_VERTICAL) { if (segment_type_ == ST_HORIZONTAL || segment_type_ == ST_VERTICAL) {
@@ -1107,7 +1107,7 @@ class curve_segment_evaluator {
auto result = boost::math::tools::bracket_and_solve_root(f, x, 2.0, true, tol, max_iter); auto result = boost::math::tools::bracket_and_solve_root(f, x, 2.0, true, tol, max_iter);
x = result.first; x = result.first;
} catch (...) { } catch (...) {
Logger::Warning("root solver failed"); logger::warning("root solver failed");
} }
return x; return x;
}; };
@@ -1168,12 +1168,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 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) { } else if (segment_type_ == ST_CANT) {
Logger::Warning(std::runtime_error("Use of IfcPolynomialCurve for cant is not supported")); logger::warning(std::runtime_error("Use of IfcPolynomialCurve for cant is not supported"));
parent_curve_fn_ = std::make_shared<parent_curve_function>( 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(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }); [](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
} else { } else {
Logger::Error(std::runtime_error("Unexpected segment type encountered")); logger::error(std::runtime_error("Unexpected segment type encountered"));
parent_curve_fn_ = std::make_shared<parent_curve_function>( 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(); },
[](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 v1 = inst.EdgeStart().as<IfcSchema::IfcVertexPoint>();
auto v2 = inst.EdgeStart().as<IfcSchema::IfcVertexPoint>(); auto v2 = inst.EdgeStart().as<IfcSchema::IfcVertexPoint>();
if (!v1 || !v2) { if (!v1 || !v2) {
Logger::Message(Logger::LOG_ERROR, "Only IfcVertexPoints are supported for EdgeStart and -End", inst); logger::message(logger::LOG_ERROR, "Only IfcVertexPoints are supported for EdgeStart and -End", inst);
return nullptr; return nullptr;
} }
auto pnt1 = v1.VertexGeometry(); auto pnt1 = v1.VertexGeometry();
auto pnt2 = v2.VertexGeometry(); auto pnt2 = v2.VertexGeometry();
if (!pnt1.declaration().is(IfcSchema::IfcCartesianPoint::Class()) || !pnt2.declaration().is(IfcSchema::IfcCartesianPoint::Class())) { if (!pnt1.declaration().is(IfcSchema::IfcCartesianPoint::Class()) || !pnt2.declaration().is(IfcSchema::IfcCartesianPoint::Class())) {
Logger::Message(Logger::LOG_ERROR, "Only IfcCartesianPoints are supported for VertexGeometry", inst); logger::message(logger::LOG_ERROR, "Only IfcCartesianPoints are supported for VertexGeometry", inst);
return nullptr; 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_; double y = inst.SemiAxis2() * length_unit_;
const double tol = settings_.get<settings::Precision>().get(); const double tol = settings_.get<settings::Precision>().get();
if (x < tol || y < tol) { if (x < tol || y < tol) {
Logger::Message(Logger::LOG_ERROR, "Radius not greater than zero for:", inst); logger::message(logger::LOG_ERROR, "Radius not greater than zero for:", inst);
return nullptr; 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_; double ry = inst.SemiAxis2() * length_unit_;
const double tol = settings_.get<settings::Precision>().get(); const double tol = settings_.get<settings::Precision>().get();
if (rx < tol || ry < tol) { if (rx < tol || ry < tol) {
Logger::Message(Logger::LOG_ERROR, "Radius not greater than zero for:", inst); logger::message(logger::LOG_ERROR, "Radius not greater than zero for:", inst);
return nullptr; return nullptr;
} }
+1 -1
View File
@@ -27,7 +27,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcExtrudedAreaSolid& inst) { taxonomy::ptr mapping::map_impl(const IfcSchema::IfcExtrudedAreaSolid& inst) {
const double height = inst.Depth() * length_unit_; const double height = inst.Depth() * length_unit_;
if (height < settings_.get<settings::Precision>().get()) { if (height < settings_.get<settings::Precision>().get()) {
Logger::Message(Logger::LOG_ERROR, "Non-positive extrusion height encountered for:", inst); logger::message(logger::LOG_ERROR, "Non-positive extrusion height encountered for:", inst);
#ifndef PERMISSIVE_EXTRUSION #ifndef PERMISSIVE_EXTRUSION
return nullptr; return nullptr;
#endif #endif
@@ -27,7 +27,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcExtrudedAreaSolidTapered& inst) { taxonomy::ptr mapping::map_impl(const IfcSchema::IfcExtrudedAreaSolidTapered& inst) {
const double height = inst.Depth() * length_unit_; const double height = inst.Depth() * length_unit_;
if (height < settings_.get<settings::Precision>().get()) { if (height < settings_.get<settings::Precision>().get()) {
Logger::Message(Logger::LOG_ERROR, "Non-positive extrusion height encountered for:", inst); logger::message(logger::LOG_ERROR, "Non-positive extrusion height encountered for:", inst);
return nullptr; return nullptr;
} }
@@ -98,7 +98,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcFixedReferenceSweptAreaSolid
auto condition_number = svd.singularValues()(0) auto condition_number = svd.singularValues()(0)
/ svd.singularValues()(svd.singularValues().size() - 1); / svd.singularValues()(svd.singularValues().size() - 1);
if (condition_number > 1.e10) { if (condition_number > 1.e10) {
Logger::Error("Non-invertible matrix at " + std::to_string(distalong) + " conversion will likely fail."); logger::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) { taxonomy::ptr mapping::map_impl(const IfcSchema::IfcGradientCurve& inst) {
if (!inst.BaseCurve().as<IfcSchema::IfcCompositeCurve>()) if (!inst.BaseCurve().as<IfcSchema::IfcCompositeCurve>())
Logger::Warning("Expected IfcGradientCurve.BaseCurve to be IfcCompositeCurve", inst); // CT 4.1.7.1.1.2 logger::warning("Expected IfcGradientCurve.BaseCurve to be IfcCompositeCurve", inst); // CT 4.1.7.1.1.2
auto segments = inst.Segments(); 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 // 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); spans.push_back(fi);
} else { } else {
Logger::Error("Unsupported"); logger::error("Unsupported");
return nullptr; return nullptr;
} }
} else { } else {
Logger::Error("Unsupported"); logger::error("Unsupported");
return nullptr; 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 // check to see if there is valid overlap of the horizontal and vertical domains
if (!(0 < gradient_function->length())) { if (!(0 < gradient_function->length())) {
Logger::Error("IfcGradientCurve does not have a common domain with BaseCurve"); logger::error("IfcGradientCurve does not have a common domain with BaseCurve");
gradient_function = nullptr; // not valid 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 surface = inst.BaseSurface();
auto plane = surface.as<IfcSchema::IfcPlane>(); auto plane = surface.as<IfcSchema::IfcPlane>();
if (!plane) { if (!plane) {
Logger::Message(Logger::LOG_ERROR, "Unsupported BaseSurface:", surface); logger::message(logger::LOG_ERROR, "Unsupported BaseSurface:", surface);
return nullptr; return nullptr;
} }
auto p = taxonomy::make<taxonomy::plane>(); 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(); const double tol = settings_.get<settings::Precision>().get();
if (x1 < tol || x2 < tol || y < tol || d1 < tol || ft1 < tol || ft2 < tol) { if (x1 < tol || x2 < tol || y < tol || d1 < tol || ft1 < tol || ft2 < tol) {
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst); logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
return nullptr; return nullptr;
} }
+6 -6
View File
@@ -35,7 +35,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve& inst) {
std::vector<taxonomy::point3::ptr> points; std::vector<taxonomy::point3::ptr> points;
if (coordinates.size() < 2) { if (coordinates.size() < 2) {
throw IfcParse::IfcException("IfcIndexedPolyCurve has less than 2 points."); throw ifcopenshell::exception("IfcIndexedPolyCurve has less than 2 points.");
} }
points.reserve(coordinates.size()); points.reserve(coordinates.size());
@@ -58,7 +58,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve& inst) {
taxonomy::point3::ptr previous; taxonomy::point3::ptr previous;
for (std::vector<int>::const_iterator jt = indices.begin(); jt != indices.end(); ++jt) { for (std::vector<int>::const_iterator jt = indices.begin(); jt != indices.end(); ++jt) {
if (*jt < 1 || *jt > max_index) { if (*jt < 1 || *jt > max_index) {
throw IfcParse::IfcException("IfcIndexedPolyCurve index out of bounds for index " + boost::lexical_cast<std::string>(*jt)); throw ifcopenshell::exception("IfcIndexedPolyCurve index out of bounds for index " + boost::lexical_cast<std::string>(*jt));
} }
auto current = points[*jt - 1]; auto current = points[*jt - 1];
if (jt != indices.begin()) { if (jt != indices.begin()) {
@@ -69,12 +69,12 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve& inst) {
} else if (auto arc = segment.as<IfcSchema::IfcArcIndex>()) { } else if (auto arc = segment.as<IfcSchema::IfcArcIndex>()) {
std::vector<int> indices = arc; std::vector<int> indices = arc;
if (indices.size() != 3) { if (indices.size() != 3) {
throw IfcParse::IfcException("Invalid IfcArcIndex encountered"); throw ifcopenshell::exception("Invalid IfcArcIndex encountered");
} }
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
const int& idx = indices[i]; const int& idx = indices[i];
if (idx < 1 || idx > max_index) { if (idx < 1 || idx > max_index) {
throw IfcParse::IfcException("IfcIndexedPolyCurve index out of bounds for index " + boost::lexical_cast<std::string>(idx)); throw ifcopenshell::exception("IfcIndexedPolyCurve index out of bounds for index " + boost::lexical_cast<std::string>(idx));
} }
} }
const auto& a = points[indices[0] - 1]; const auto& a = points[indices[0] - 1];
@@ -87,10 +87,10 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve& inst) {
e->basis = circ; e->basis = circ;
loop->children.push_back(e); loop->children.push_back(e);
} else { } else {
Logger::Warning("Ignoring segment on", inst); logger::warning("Ignoring segment on", inst);
} }
} else { } else {
throw IfcParse::IfcException("Unexpected IfcIndexedPolyCurve segment of type " + segment.concrete().declaration().name()); throw ifcopenshell::exception("Unexpected IfcIndexedPolyCurve segment of type " + segment.concrete().declaration().name());
} }
} }
} else if (points.begin() < points.end()) { } else if (points.begin() < points.end()) {
+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(); const double tol = settings_.get<settings::Precision>().get();
if ( x < tol || y < tol || d < tol) { if ( x < tol || y < tol || d < tol) {
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst); logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
return nullptr; return nullptr;
} }
@@ -77,7 +77,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcLShapeProfileDef& inst) {
const double det = a1*b2 - a2*b1; const double det = a1*b2 - a2*b1;
if (std::fabs(det) < 1.e-5) { if (std::fabs(det) < 1.e-5) {
Logger::Message(Logger::LOG_NOTICE, "Legs do not intersect for:", inst); logger::message(logger::LOG_NOTICE, "Legs do not intersect for:", inst);
return nullptr; return nullptr;
} }
+8 -8
View File
@@ -90,7 +90,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement& inst) {
if (fallback) { if (fallback) {
auto mapped_fallback = taxonomy::cast<taxonomy::matrix4>(map(fallback)); auto mapped_fallback = taxonomy::cast<taxonomy::matrix4>(map(fallback));
if (mapped_fallback != result) { if (mapped_fallback != result) {
Logger::Warning("Computed placement differs from fallback", inst); logger::warning("Computed placement differs from fallback", inst);
} }
} }
@@ -98,7 +98,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement& inst) {
auto abs_det = std::abs(result->ccomponents().determinant()); auto abs_det = std::abs(result->ccomponents().determinant());
if (abs_det < 1.e-7) { if (abs_det < 1.e-7) {
Logger::Warning("Ignoring singular matrix:", inst); logger::warning("Ignoring singular matrix:", inst);
return nullptr; return nullptr;
} }
@@ -122,7 +122,7 @@ if (gridp = inst.as<IfcSchema::IfcGridPlacement>()) {
convert(l->PlacementRelTo(), grid_position); convert(l->PlacementRelTo(), grid_position);
#else #else
IfcSchema::IfcGrid* grid = nullptr; IfcSchema::IfcGrid* grid = nullptr;
auto grids = (*axes->begin())->data().file->getInverse<IfcSchema::IfcGrid>((*axes->begin())->data().id(), -1); auto grids = (*axes->begin())->data().file->get_inverse<IfcSchema::IfcGrid>((*axes->begin())->data().id(), -1);
if (grids && grids->size()) { if (grids && grids->size()) {
grid = *grids->begin(); grid = *grids->begin();
if (grid->ObjectPlacement()) { if (grid->ObjectPlacement()) {
@@ -136,11 +136,11 @@ if (gridp = inst.as<IfcSchema::IfcGridPlacement>()) {
auto offsets = x->OffsetDistances(); auto offsets = x->OffsetDistances();
if (axes->size() != 2) { if (axes->size() != 2) {
Logger::Message(Logger::LOG_WARNING, "Unexpected grid axes count:" + std::to_string(axes->size()), x); logger::message(logger::LOG_WARNING, "Unexpected grid axes count:" + std::to_string(axes->size()), x);
return false; return false;
} }
if (offsets.size() != 3) { if (offsets.size() != 3) {
Logger::Message(Logger::LOG_WARNING, "Unexpected offset count:" + std::to_string(offsets.size()), x); logger::message(logger::LOG_WARNING, "Unexpected offset count:" + std::to_string(offsets.size()), x);
return false; return false;
} }
auto first = *axes->begin(); auto first = *axes->begin();
@@ -171,7 +171,7 @@ if (gridp = inst.as<IfcSchema::IfcGridPlacement>()) {
gp_Pnt pp1, pp2; gp_Pnt pp1, pp2;
ecc->Points(1, pp1, pp2); ecc->Points(1, pp1, pp2);
if (pp1.Distance(pp2) > getValue(GV_PRECISION)) { if (pp1.Distance(pp2) > getValue(GV_PRECISION)) {
Logger::Message(Logger::LOG_WARNING, "No axis intersection:", x); logger::message(logger::LOG_WARNING, "No axis intersection:", x);
return false; return false;
} }
P = pp1; P = pp1;
@@ -202,7 +202,7 @@ if (gridp = inst.as<IfcSchema::IfcGridPlacement>()) {
if (V.Magnitude() > 1.e-9) { if (V.Magnitude() > 1.e-9) {
D = V; D = V;
} else { } else {
Logger::Message(Logger::LOG_ERROR, "Unable to obtain ref direction:", l); logger::message(logger::LOG_ERROR, "Unable to obtain ref direction:", l);
return false; return false;
} }
} }
@@ -215,7 +215,7 @@ if (gridp = inst.as<IfcSchema::IfcGridPlacement>()) {
if (V.Magnitude() > 1.e-9) { if (V.Magnitude() > 1.e-9) {
D = V; D = V;
} else { } else {
Logger::Message(Logger::LOG_ERROR, "Unable to obtain ref direction:", l); logger::message(logger::LOG_ERROR, "Unable to obtain ref direction:", l);
return false; return false;
} }
} }
@@ -33,7 +33,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst) { taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst) {
auto offset_values = inst.OffsetValues(); auto offset_values = inst.OffsetValues();
if (offset_values.empty()) { if (offset_values.empty()) {
Logger::Error("IfcOffsetCurveByDistances must have at least one offset value"); logger::error("IfcOffsetCurveByDistances must have at least one offset value");
} }
auto& first_offset_value = offset_values.front(); 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)); auto basis_curve_fn = taxonomy::dcast<taxonomy::function_item>(map(basis_curve));
if (!basis_curve_fn) { if (!basis_curve_fn) {
// Only implement on alignment curves // Only implement on alignment curves
Logger::Warning("IfcOffsetCurveByDistances is only implemented for BasisCurves curves based on taxonomy::function_item", inst); logger::warning("IfcOffsetCurveByDistances is only implemented for BasisCurves curves based on taxonomy::function_item", inst);
return nullptr; return nullptr;
} }
@@ -73,7 +73,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst
first_distance *= length_unit_; first_distance *= length_unit_;
if (first_distance < 0.0) { if (first_distance < 0.0) {
Logger::Warning("IfcOffsetCurveByDistance first offset value is before the start of the curve."); logger::warning("IfcOffsetCurveByDistance first offset value is before the start of the curve.");
} }
if(0.0 < first_distance) 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 if (dn < dp) // next is before previous
{ {
Logger::Warning("IfcOffsetCurveByDistance offset value is out of bounds."); logger::warning("IfcOffsetCurveByDistance offset value is out of bounds.");
continue; continue;
} }
@@ -32,7 +32,7 @@ const double PI = boost::math::constants::pi<double>();
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOpenCrossProfileDef& inst) { taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOpenCrossProfileDef& inst) {
if (inst.ProfileType() != IfcSchema::IfcProfileTypeEnum::IfcProfileType_CURVE) { if (inst.ProfileType() != IfcSchema::IfcProfileTypeEnum::IfcProfileType_CURVE) {
Logger::Warning("Expected IfcOpenCrossProfileDef.ProfileType to be CURVE", inst); logger::warning("Expected IfcOpenCrossProfileDef.ProfileType to be CURVE", inst);
return nullptr; 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 auto angles = inst.Slopes(); // these are actually angles, but the attribute is called Slopes
if (widths.size() != angles.size()) { if (widths.size() != angles.size()) {
Logger::Warning("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("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; 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 // A loop should consist of at least three vertices
int original_count = polygon.size(); int original_count = polygon.size();
if (original_count < 3) { if (original_count < 3) {
Logger::Message(Logger::LOG_WARNING, "Not enough edges for:", inst); logger::message(logger::LOG_WARNING, "Not enough edges for:", inst);
return nullptr; return nullptr;
} }
@@ -45,17 +45,17 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolyLoop& inst) {
auto previous_size = polygon.size(); auto previous_size = polygon.size();
remove_duplicate_points_from_loop(polygon, true, eps); remove_duplicate_points_from_loop(polygon, true, eps);
if (polygon.size() != previous_size) { if (polygon.size() != previous_size) {
Logger::Warning("Removed " + std::to_string(previous_size - polygon.size()) + " (near) duplicate points from:", inst); logger::warning("Removed " + std::to_string(previous_size - polygon.size()) + " (near) duplicate points from:", inst);
} }
int count = polygon.size(); int count = polygon.size();
if (original_count - count != 0) { if (original_count - count != 0) {
std::stringstream ss; ss << (original_count - count) << " edges removed for:"; std::stringstream ss; ss << (original_count - count) << " edges removed for:";
Logger::Message(Logger::LOG_WARNING, ss.str(), inst); logger::message(logger::LOG_WARNING, ss.str(), inst);
} }
if (count < 3) { if (count < 3) {
Logger::Message(Logger::LOG_WARNING, "Not enough edges for:", inst); logger::message(logger::LOG_WARNING, "Not enough edges for:", inst);
return nullptr; return nullptr;
} }
+2 -2
View File
@@ -53,7 +53,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolygonalFaceSet& inst) {
taxonomy::point3::ptr previous; taxonomy::point3::ptr previous;
for (std::vector<int>::const_iterator jt = indices.begin(); jt != indices.end(); ++jt) { for (std::vector<int>::const_iterator jt = indices.begin(); jt != indices.end(); ++jt) {
if (*jt < 1 || *jt > max_index) { if (*jt < 1 || *jt > max_index) {
throw IfcParse::IfcException("IfcPolygonalFaceSet index out of bounds for index " + boost::lexical_cast<std::string>(*jt)); throw ifcopenshell::exception("IfcPolygonalFaceSet index out of bounds for index " + boost::lexical_cast<std::string>(*jt));
} }
auto current = points[(*jt) - 1]; auto current = points[(*jt) - 1];
if (jt != indices.begin()) { if (jt != indices.begin()) {
@@ -78,7 +78,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolygonalFaceSet& inst) {
for (std::vector<int>::const_iterator jt = li.begin(); jt != li.end(); ++jt) { for (std::vector<int>::const_iterator jt = li.begin(); jt != li.end(); ++jt) {
if (*jt < 1 || *jt > max_index) { if (*jt < 1 || *jt > max_index) {
throw IfcParse::IfcException("IfcPolygonalFaceSet index out of bounds for index " + boost::lexical_cast<std::string>(*jt)); throw ifcopenshell::exception("IfcPolygonalFaceSet index out of bounds for index " + boost::lexical_cast<std::string>(*jt));
} }
auto current = points[(*jt) - 1]; auto current = points[(*jt) - 1];
if (jt != li.begin()) { if (jt != li.begin()) {
+2 -2
View File
@@ -44,12 +44,12 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolyline& inst) {
auto previous_size = polygon.size(); auto previous_size = polygon.size();
remove_duplicate_points_from_loop(polygon, closed_by_proximity, eps); remove_duplicate_points_from_loop(polygon, closed_by_proximity, eps);
if (polygon.size() != previous_size) { if (polygon.size() != previous_size) {
Logger::Warning("Removed " + std::to_string(previous_size - polygon.size()) + " (near) duplicate points from:", inst); logger::warning("Removed " + std::to_string(previous_size - polygon.size()) + " (near) duplicate points from:", inst);
} }
if (polygon.size() < 2) { if (polygon.size() < 2) {
// We somehow need to signal we fail this curve on purpose not to trigger an error. // We somehow need to signal we fail this curve on purpose not to trigger an error.
Logger::Warning("Invalid polyline with " + std::to_string(polygon.size()) + " points:", inst); logger::warning("Invalid polyline with " + std::to_string(polygon.size()) + " points:", inst);
return nullptr; return nullptr;
} }
@@ -37,7 +37,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangleHollowProfileDef& i
const double tol = settings_.get<settings::Precision>().get(); const double tol = settings_.get<settings::Precision>().get();
if (x < tol || y < tol) { if (x < tol || y < tol) {
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst); logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
return nullptr; return nullptr;
} }
@@ -30,7 +30,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangleProfileDef& inst) {
const double tol = settings_.get<settings::Precision>().get(); const double tol = settings_.get<settings::Precision>().get();
if (x < tol || y < tol) { if (x < tol || y < tol) {
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst); logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
return nullptr; return nullptr;
} }
@@ -27,7 +27,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangularTrimmedSurface& i
/* /*
if (!inst.BasisSurface()->declaration().is(IfcSchema::IfcPlane::Class())) { if (!inst.BasisSurface()->declaration().is(IfcSchema::IfcPlane::Class())) {
Logger::Message(Logger::LOG_ERROR, "Unsupported BasisSurface:", inst.BasisSurface()); logger::message(logger::LOG_ERROR, "Unsupported BasisSurface:", inst.BasisSurface());
return false; return false;
} }
gp_Pln pln; gp_Pln pln;
+1 -1
View File
@@ -86,7 +86,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRevolvedAreaSolid& inst) {
} }
if (intersecting) { if (intersecting) {
Logger::Warning("Warning Axis and SweptArea intersecting", l); logger::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(); const double tol = settings_.get<settings::Precision>().get();
if (x < tol || y < tol) { if (x < tol || y < tol) {
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst); logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
return nullptr; return nullptr;
} }
@@ -34,7 +34,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSolidHorizontal& in
auto fn = taxonomy::dcast<taxonomy::function_item>(dir); auto fn = taxonomy::dcast<taxonomy::function_item>(dir);
if (!fn) { if (!fn) {
// Only implement on alignment curves // Only implement on alignment curves
Logger::Warning("IfcSectionedSolidHorizontal is only implemented for Directrix curves based on taxonomy::function_item", inst); logger::warning("IfcSectionedSolidHorizontal is only implemented for Directrix curves based on taxonomy::function_item", inst);
return nullptr; return nullptr;
} }
@@ -91,11 +91,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSolidHorizontal& in
profile_rotations.push_back(rot); profile_rotations.push_back(rot);
} }
if (faces.size() != profile_offsets.size()) { if (faces.size() != profile_offsets.size()) {
Logger::Warning("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("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; return nullptr;
} }
if (faces.size() < 2) { if (faces.size() < 2) {
Logger::Warning("Expected at least two cross sections, but got " + std::to_string(faces.size()), inst); logger::warning("Expected at least two cross sections, but got " + std::to_string(faces.size()), inst);
return nullptr; 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); auto fn = taxonomy::dcast<taxonomy::function_item>(dir);
if (!fn) { if (!fn) {
// Only implement on alignment curves // Only implement on alignment curves
Logger::Warning("IfcSectionedSurface is only implemented for Directrix curves based on taxonomy::function_item", inst); logger::warning("IfcSectionedSurface is only implemented for Directrix curves based on taxonomy::function_item", inst);
return nullptr; return nullptr;
} }
@@ -97,11 +97,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSurface& inst) {
return nullptr; return nullptr;
#endif #endif
if (faces.size() != profile_offsets.size()) { if (faces.size() != profile_offsets.size()) {
Logger::Warning("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("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; return nullptr;
} }
if (faces.size() < 2) { if (faces.size() < 2) {
Logger::Warning("Expected at least two cross sections, but got " + std::to_string(faces.size()), inst); logger::warning("Expected at least two cross sections, but got " + std::to_string(faces.size()), inst);
return nullptr; return nullptr;
} }
@@ -27,7 +27,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve& inst) { taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve& inst) {
if (!inst.BaseCurve().as<IfcSchema::IfcGradientCurve>()) if (!inst.BaseCurve().as<IfcSchema::IfcGradientCurve>())
Logger::Warning("Expected IfcSegmentedReferenceCurve.BaseCurve to be IfcGradient", inst); // CT 4.1.7.1.1.3 logger::warning("Expected IfcSegmentedReferenceCurve.BaseCurve to be IfcGradient", inst); // CT 4.1.7.1.1.3
auto segments = inst.Segments(); 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 // 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); spans.push_back(fi);
} else { } else {
Logger::Error("Unsupported"); logger::error("Unsupported");
return nullptr; return nullptr;
} }
} else { } else {
Logger::Error("Unsupported"); logger::error("Unsupported");
return nullptr; 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); auto cant_function = taxonomy::make<taxonomy::cant_function>(gradient, cant, inst);
if (!(0 < cant_function->length())) { if (!(0 < cant_function->length())) {
Logger::Error("IfcSegmentedReferenceCurve does not have a common domain with BaseCurve"); logger::error("IfcSegmentedReferenceCurve does not have a common domain with BaseCurve");
cant_function = nullptr; cant_function = nullptr;
} }
return cant_function; return cant_function;
@@ -49,11 +49,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSurfaceCurveSweptAreaSolid&
if (!is_plane) { if (!is_plane) {
TopoDS_Shape surface_shell; TopoDS_Shape surface_shell;
if (!convert_shape(inst.ReferenceSurface(), surface_shell)) { if (!convert_shape(inst.ReferenceSurface(), surface_shell)) {
Logger::Error("Failed to convert reference surface", l); logger::error("Failed to convert reference surface", l);
return false; return false;
} }
if (util::count(surface_shell, TopAbs_FACE) != 1) { if (util::count(surface_shell, TopAbs_FACE) != 1) {
Logger::Error("Non-continuous reference surface", l); logger::error("Non-continuous reference surface", l);
return false; return false;
} }
surface_face = TopoDS::Face(TopExp_Explorer(surface_shell, TopAbs_FACE).Current()); 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()) { for (TopExp_Explorer exp(wire, TopAbs_VERTEX); exp.More(); exp.Next()) {
if (pln.Distance(BRep_Tool::Pnt(TopoDS::Vertex(exp.Current()))) > ALMOST_ZERO) { if (pln.Distance(BRep_Tool::Pnt(TopoDS::Vertex(exp.Current()))) > ALMOST_ZERO) {
directrix_on_plane = false; directrix_on_plane = false;
Logger::Message(Logger::LOG_WARNING, "The Directrix does not lie on the ReferenceSurface", l); logger::message(logger::LOG_WARNING, "The Directrix does not lie on the ReferenceSurface", l);
break; break;
} }
} }
+9 -9
View File
@@ -1,4 +1,4 @@
/******************************************************************************** /********************************************************************************
* * * *
* This file is part of IfcOpenShell. * * This file is part of IfcOpenShell. *
* * * *
@@ -61,8 +61,8 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
try { try {
sp = inst.StartParam(); sp = inst.StartParam();
ep = inst.EndParam(); ep = inst.EndParam();
} catch (const IfcParse::IfcException& e) { } catch (const ifcopenshell::exception& e) {
Logger::Warning(e); logger::warning(e);
} }
#endif #endif
@@ -241,19 +241,19 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
i += 1; i += 1;
j += 1; j += 1;
} else { } else {
Logger::Error("Unexpected amount of fillet edges generated"); logger::error("Unexpected amount of fillet edges generated");
} }
} else { } else {
Logger::Error("Unable to build fillet, probably edge too short"); logger::error("Unable to build fillet, probably edge too short");
} }
} else { } else {
Logger::Error("Colinear edges, not applying fillet"); logger::error("Colinear edges, not applying fillet");
} }
i++; i++;
j++; j++;
} }
} else { } else {
Logger::Error("Not enough edges for applying fillet"); logger::error("Not enough edges for applying fillet");
} }
TopoDS_Wire new_wire; TopoDS_Wire new_wire;
@@ -266,7 +266,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
wire = new_wire; wire = new_wire;
} else { } else {
Logger::Error("Directrix is not polyhedral, ignoring FilletRadius"); logger::error("Directrix is not polyhedral, ignoring FilletRadius");
} }
} }
@@ -317,7 +317,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
} }
if (!is_valid) { if (!is_valid) {
Logger::Message(Logger::LOG_WARNING, "Failed to subtract inner radius void for:", l); logger::message(logger::LOG_WARNING, "Failed to subtract inner radius void for:", l);
} }
} }
+2 -2
View File
@@ -40,7 +40,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTShapeProfileDef& inst) {
const double tol = settings_.get<settings::Precision>().get(); const double tol = settings_.get<settings::Precision>().get();
if (x < tol || y < tol || d1 < tol || d2 < tol) { if (x < tol || y < tol || d1 < tol || d2 < tol) {
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst); logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
return nullptr; return nullptr;
} }
@@ -88,7 +88,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTShapeProfileDef& inst) {
const double det = a1*b2 - a2*b1; const double det = a1*b2 - a2*b1;
if (std::fabs(det) < 1.e-5) { if (std::fabs(det) < 1.e-5) {
Logger::Message(Logger::LOG_NOTICE, "Web and flange do not intersect for:", inst); logger::message(logger::LOG_NOTICE, "Web and flange do not intersect for:", inst);
return nullptr; return nullptr;
} }
@@ -36,7 +36,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrapeziumProfileDef& inst) {
const double tol = settings_.get<settings::Precision>().get(); const double tol = settings_.get<settings::Precision>().get();
if (x1 < tol || w < tol || y < tol) { if (x1 < tol || w < tol || y < tol) {
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst); logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
return nullptr; return nullptr;
} }
@@ -52,7 +52,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTriangulatedFaceSet& inst) {
taxonomy::point3::ptr first, previous; taxonomy::point3::ptr first, previous;
for (std::vector<int>::const_iterator jt = indices.begin(); jt != indices.end(); ++jt) { for (std::vector<int>::const_iterator jt = indices.begin(); jt != indices.end(); ++jt) {
if (*jt < 1 || *jt > max_index) { if (*jt < 1 || *jt > max_index) {
throw IfcParse::IfcException("IfcTriangulatedFaceSet index out of bounds for index " + boost::lexical_cast<std::string>(*jt)); throw ifcopenshell::exception("IfcTriangulatedFaceSet index out of bounds for index " + boost::lexical_cast<std::string>(*jt));
} }
const taxonomy::point3::ptr& current = points[(*jt) - 1]; const taxonomy::point3::ptr& current = points[(*jt) - 1];
if (jt == indices.begin()) { if (jt == indices.begin()) {
+5 -5
View File
@@ -76,7 +76,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve& inst) {
bool trim_cartesian_failed = !trim_cartesian; bool trim_cartesian_failed = !trim_cartesian;
if (trim_cartesian) { if (trim_cartesian) {
if ((pnts[0]->ccomponents() - pnts[1]->ccomponents()).norm() < (2 * tol)) { if ((pnts[0]->ccomponents() - pnts[1]->ccomponents()).norm() < (2 * tol)) {
Logger::Message(Logger::LOG_WARNING, "Skipping segment with length below tolerance level:", inst); logger::message(logger::LOG_WARNING, "Skipping segment with length below tolerance level:", inst);
return nullptr; return nullptr;
} }
tc->start = pnts[0]; tc->start = pnts[0];
@@ -115,9 +115,9 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve& inst) {
// or trimmed segment would be whether there are other curve segments or this // or trimmed segment would be whether there are other curve segments or this
// is the only one. // is the only one.
std::optional<size_t> num_segments; std::optional<size_t> num_segments;
auto segment = inst.file()->getInverse(inst.id(), & IfcSchema::IfcCompositeCurveSegment::Class(), -1); auto segment = inst.file()->get_inverse(inst.id(), & IfcSchema::IfcCompositeCurveSegment::Class(), -1);
if (segment.size() == 1) { if (segment.size() == 1) {
auto comp = segment.front().file()->getInverse(segment.front().id(), &IfcSchema::IfcCompositeCurve::Class(), -1); auto comp = segment.front().file()->get_inverse(segment.front().id(), &IfcSchema::IfcCompositeCurve::Class(), -1);
if (comp.size() == 1) { if (comp.size() == 1) {
num_segments = comp.front().as<IfcSchema::IfcCompositeCurve>().Segments().size(); num_segments = comp.front().as<IfcSchema::IfcCompositeCurve>().Segments().size();
} }
@@ -140,7 +140,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve& inst) {
TopoDS_Vertex v0, v1; TopoDS_Vertex v0, v1;
TopExp::Vertices(e, v0, v1); TopExp::Vertices(e, v0, v1);
if (v0.IsSame(v1)) { if (v0.IsSame(v1)) {
Logger::Warning("Skipping degenerate segment", l); logger::warning("Skipping degenerate segment", l);
return false; return false;
} }
} }
@@ -168,7 +168,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve& inst) {
TopoDS_Vertex v0, v1; TopoDS_Vertex v0, v1;
TopExp::Vertices(e, v0, v1); TopExp::Vertices(e, v0, v1);
e = TopoDS::Edge(BRepBuilderAPI_MakeEdge(v0, v1).Edge().Oriented(e.Orientation())); e = TopoDS::Edge(BRepBuilderAPI_MakeEdge(v0, v1).Edge().Oriented(e.Orientation()));
Logger::Warning("Substituted edge with linear approximation", l); logger::warning("Substituted edge with linear approximation", l);
} }
} }
+1 -1
View File
@@ -54,7 +54,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcUShapeProfileDef& inst) {
const double tol = settings_.get<settings::Precision>().get(); const double tol = settings_.get<settings::Precision>().get();
if (x < tol || y < tol || d1 < tol || d2 < tol) { if (x < tol || y < tol || d1 < tol || d2 < tol) {
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst); logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
return nullptr; return nullptr;
} }
+1 -1
View File
@@ -45,7 +45,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcZShapeProfileDef& inst) {
const double tol = settings_.get<settings::Precision>().get(); const double tol = settings_.get<settings::Precision>().get();
if (x < tol || y < tol || dx < tol || dy < tol) { if (x < tol || y < tol || dx < tol || dy < tol) {
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst); logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
return nullptr; return nullptr;
} }

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