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
#include "../ifcparse/macros.h"
#include "../ifcparse/Ifc2x3.h"
#include "../ifcparse/IfcHierarchyHelper.h"
#include "../ifcparse/hierarchy_helper.h"
#include "../ifcgeom/Serialization/Serialization.h"
@@ -56,9 +56,9 @@ void createGroundShape(TopoDS_Shape& shape);
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.
IfcHierarchyHelper<IfcSchema> file;
hierarchy_helper<IfcSchema> file;
file.header().file_name().setname("IfcAdvancedHouse.ifc");
auto building = file.addBuilding();
@@ -92,7 +92,7 @@ int main() {
// return `0` otherwise.
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();
rep->setContextOfItems(file.getRepresentationContext("model"));
@@ -116,7 +116,7 @@ int main() {
for (auto& rep : ground_reps) {
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);
/*
+20 -20
View File
@@ -31,7 +31,7 @@
#pragma warning(disable : 4018 4267 4250 4984 4985)
#include "../ifcparse/Ifc4x3_add2.h"
#include "../ifcparse/IfcHierarchyHelper.h"
#include "../ifcparse/hierarchy_helper.h"
#include <boost/math/constants/constants.hpp>
#include <fstream>
@@ -43,7 +43,7 @@ double to_radian(double deg) { return PI * deg / 180; }
// performs basic project setup including created the IfcProject object
// 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;
file_description.push_back("ViewDefinition[Alignment-basedReferenceView]");
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
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
auto parent_curve = file.create<Schema::IfcLine>();
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);
auto alignment_segment = file.create<Schema::IfcAlignmentSegment>();
alignment_segment.setGlobalId(IfcParse::IfcGlobalId());
alignment_segment.setGlobalId(ifcopenshell::global_id());
alignment_segment.setDesignParameters(design_parameters);
return {curve_segment, alignment_segment};
}
// 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
double sign = radius / fabs(radius);
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);
auto alignment_segment = file.create<Schema::IfcAlignmentSegment>();
alignment_segment.setGlobalId(IfcParse::IfcGlobalId());
alignment_segment.setGlobalId(ifcopenshell::global_id());
alignment_segment.setDesignParameters(design_parameters);
return {curve_segment, alignment_segment};
}
// 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
auto parent_curve = file.create<Schema::IfcLine>();
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);
auto alignment_segment = file.create<Schema::IfcAlignmentSegment>();
alignment_segment.setGlobalId(IfcParse::IfcGlobalId());
alignment_segment.setGlobalId(ifcopenshell::global_id());
alignment_segment.setDesignParameters(design_parameters);
return {curve_segment, alignment_segment};
}
// 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
double A = p.Coordinates()[1];
double B = start_slope;
@@ -246,7 +246,7 @@ std::pair<typename Schema::IfcCurveSegment, typename Schema::IfcAlignmentSegment
design_parameters.setPredefinedType(Schema::IfcAlignmentVerticalSegmentTypeEnum::IfcAlignmentVerticalSegmentType_PARABOLICARC);
auto alignment_segment = file.create<Schema::IfcAlignmentSegment>();
alignment_segment.setGlobalId(IfcParse::IfcGlobalId());
alignment_segment.setGlobalId(ifcopenshell::global_id());
alignment_segment.setDesignParameters(design_parameters);
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
// 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 s_iter = segments.begin();
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() {
IfcHierarchyHelper<Schema> file;
hierarchy_helper<Schema> file;
auto project = setup_project(file);
@@ -378,11 +378,11 @@ int main() {
// Create the horizontal alignment (IfcAlignmentHorizontal) and nest alignment segments
//
auto horizontal_alignment = file.create<Schema::IfcAlignmentHorizontal>();
horizontal_alignment.setGlobalId(IfcParse::IfcGlobalId());
horizontal_alignment.setGlobalId(ifcopenshell::global_id());
horizontal_alignment.setName("Example Alignment");
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.setRelatingObject(horizontal_alignment);
nests_horizontal_segments.setRelatedObjects(horizontal_segments);
@@ -483,11 +483,11 @@ int main() {
// Create the vertical alignment (IfcAlignmentVertical) and nest alignment segments
//
auto vertical_profile = file.create<Schema::IfcAlignmentVertical>();
vertical_profile.setGlobalId(IfcParse::IfcGlobalId());
vertical_profile.setGlobalId(ifcopenshell::global_id());
vertical_profile.setName("Example Vertical Profile");
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.setRelatingObject(vertical_profile);
nests_vertical_segments.setRelatedObjects(vertical_segments);
@@ -526,7 +526,7 @@ int main() {
// create the alignment
auto alignment = file.create<Schema::IfcAlignment>();
alignment.setGlobalId(IfcParse::IfcGlobalId());
alignment.setGlobalId(ifcopenshell::global_id());
alignment.setName("Example Alignment");
alignment.setObjectPlacement(global_placement);
alignment.setRepresentation(alignment_product);
@@ -535,7 +535,7 @@ int main() {
// 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
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.setRelatingObject(alignment);
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
// IfcProject <-> IfcRelAggregates <-> IfcAlignment
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.setRelatingObject(project);
aggregate_alignments_with_project.setRelatedObjects({alignment});
@@ -571,7 +571,7 @@ int main() {
description << "Alignments referenced into the spatial structure of Bridge Site " << i;
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.setRelatedElements(list_alignments_referenced_in_site);
rel_referenced_in_spatial_structure.setRelatingStructure(site);
+5 -5
View File
@@ -38,7 +38,7 @@
#define IfcSchema Ifc2x3
#include "../ifcparse/macros.h"
#include "../ifcparse/Ifc2x3.h"
#include "../ifcparse/IfcHierarchyHelper.h"
#include "../ifcparse/hierarchy_helper.h"
#include "../ifcgeom/Serialization/Serialization.h"
@@ -49,7 +49,7 @@
using namespace std::string_literals;
// Some convenience typedefs and definitions.
typedef IfcParse::IfcGlobalId guid;
typedef ifcopenshell::global_id guid;
typedef std::pair<double, double> XY;
boost::none_t const null = boost::none;
@@ -58,9 +58,9 @@ void createGroundShape(TopoDS_Shape& shape);
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.
IfcHierarchyHelper<IfcSchema> file;
hierarchy_helper<IfcSchema> file;
file.header().file_name().setname("IfcOpenHouse.ifc");
// Start by adding a wall to the file, initially leaving most attributes blank.
@@ -327,7 +327,7 @@ int main() {
for (auto& rep : ground_reps) {
rep.setContextOfItems(file.getRepresentationContext("Model"));
}
file.addEntity(ground_representation);
file.add_entity(ground_representation);
setSurfaceColour(file,ground_representation, 0.15, 0.25, 0.05);
// 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. *
* *
@@ -20,8 +20,8 @@
// TODO: Multiple schemas
#define IfcSchema Ifc2x3
#include "../ifcparse/IfcFile.h"
#include "../ifcparse/IfcLogger.h"
#include "../ifcparse/file.h"
#include "../ifcparse/logger.h"
#include "../ifcparse/Ifc2x3.h"
#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;
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,
// in this particular case we only care about flattening it to a string.
// @todo mostly duplicated from XmlSerializer.cpp
@@ -89,21 +89,21 @@ std::string format_string(const AttributeValue& argument) {
}
auto argument_type = argument.type();
switch (argument_type) {
case IfcUtil::Argument_BOOL: {
case ifcopenshell::Argument_BOOL: {
const bool b = argument;
return b ? "true" : "false";
}
case IfcUtil::Argument_DOUBLE: {
case ifcopenshell::Argument_DOUBLE: {
const double d = argument;
std::stringstream stream;
stream << std::setprecision(std::numeric_limits< double >::max_digits10) << d;
return stream.str();
break; }
case IfcUtil::Argument_STRING:
case IfcUtil::Argument_ENUMERATION: {
case ifcopenshell::Argument_STRING:
case ifcopenshell::Argument_ENUMERATION: {
return static_cast<std::string>(argument);
break; }
case IfcUtil::Argument_INT: {
case ifcopenshell::Argument_INT: {
const int v = argument;
std::stringstream stream;
stream << v;
@@ -147,7 +147,7 @@ void process_pset(element_properties& props, const T& inst) {
}
auto qs = qset.Quantities();
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);
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
Logger::SetOutput(&std::cout, &std::cout);
logger::set_output(&std::cout, &std::cout);
// Parse the IFC file provided in argv[1]
IfcParse::IfcFile file(argv[1]);
ifcopenshell::file file(argv[1]);
if (!file.good()) {
std::cout << "Unable to parse .ifc file" << std::endl;
return 1;
@@ -257,7 +257,7 @@ int main(int argc, char** argv) {
std::cout << "Found " << elements.size() << " elements in " << argv[1] << ":" << std::endl;
for (auto& element : elements) {
element.toString(std::cout);
element.to_string(std::cout);
std::cout << std::endl;
if (auto window = element.as<IfcSchema::IfcWindow>()) {
+5 -5
View File
@@ -31,7 +31,7 @@
#pragma warning(disable : 4018 4267 4250 4984 4985)
#include "../ifcparse/Ifc4x3_add2.h"
#include "../ifcparse/IfcAlignmentHelper.h"
#include "../ifcparse/alignment_helper.h"
#include <fstream>
@@ -39,7 +39,7 @@
// performs basic project setup including created the IfcProject object
// 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;
file_description.push_back("ViewDefinition[Alignment-basedReferenceView]");
file.header().file_description().setdescription(file_description);
@@ -91,7 +91,7 @@ Schema::IfcProject setup_project(IfcHierarchyHelper<Schema>& file) {
}
int main() {
IfcHierarchyHelper<Schema> file;
hierarchy_helper<Schema> 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
// IfcProject <-> IfcRelAggregates <-> IfcAlignment
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.setRelatingObject(project);
aggregate_alignments_with_project.setRelatedObjects({alignment});
@@ -165,7 +165,7 @@ int main() {
description << "Alignments referenced into the spatial structure of Bridge Site " << i;
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.setRelatedElements(std::vector<Schema::IfcSpatialReferenceSelect>{alignment});
rel_referenced_in_spatial_structure.setRelatingStructure(site);
+22 -22
View File
@@ -30,14 +30,14 @@
#include "../ifcparse/Ifc2x3.h"
#include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcHierarchyHelper.h"
#include "../ifcparse/hierarchy_helper.h"
typedef std::string S;
typedef IfcParse::IfcGlobalId guid;
typedef ifcopenshell::global_id guid;
boost::none_t const null = boost::none;
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(
guid(), 0, S("product"), null, null, 0, 0, null, null);
file.addBuildingProduct(product);
@@ -51,7 +51,7 @@ void create_product_from_item(IfcHierarchyHelper& file, IfcSchema::IfcRepresenta
if (s == "GeometricSet") {
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->push(set);
}
@@ -61,46 +61,46 @@ void create_product_from_item(IfcHierarchyHelper& file, IfcSchema::IfcRepresenta
reps->push(rep);
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(boost::none, boost::none, reps);
file.addEntity(rep);
file.addEntity(shape);
file.add_entity(rep);
file.add_entity(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.);
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::IfcSurfaceOfRevolution* revolution = new IfcSchema::IfcSurfaceOfRevolution(profile, file.addPlacement3d(), ax1);
file.addEntity(ax1);
file.addEntity(revolution);
file.add_entity(ax1);
file.add_entity(revolution);
create_product_from_item(file, extrusion, "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.);
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::IfcRevolvedAreaSolid* revolution1 = new IfcSchema::IfcRevolvedAreaSolid(profile, file.addPlacement3d(), ax1, 360.);
IfcSchema::IfcRevolvedAreaSolid* revolution2 = new IfcSchema::IfcRevolvedAreaSolid(profile, file.addPlacement3d(), ax1, 90.);
file.addEntity(ax1);
file.addEntity(revolution1);
file.addEntity(revolution2);
file.add_entity(ax1);
file.add_entity(revolution1);
file.add_entity(revolution2);
create_product_from_item(file, extrusion, "SweptSolid");
create_product_from_item(file, revolution1, "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::IfcCenterLineProfileDef* center_line = new IfcSchema::IfcCenterLineProfileDef(IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, null, curve, 10.);
file.addEntity(open);
file.addEntity(center_line);
file.add_entity(open);
file.add_entity(center_line);
create_surfaces_from_profile(file, open);
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) {
const char filename[] = "IfcArbitraryOpenProfileDef.ifc";
IfcHierarchyHelper file;
hierarchy_helper file;
file.header().file_name().name(filename);
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)));
file.addEntities(points->generalize());
IfcSchema::IfcPolyline* poly = new IfcSchema::IfcPolyline(points);
file.addEntity(poly);
file.add_entity(poly);
create_products_from_curve(file, poly);
IfcSchema::IfcEllipse* ellipse = new IfcSchema::IfcEllipse(file.addPlacement2d(), 50., 25.);
file.addEntity(ellipse);
file.add_entity(ellipse);
IfcEntityList::ptr trim1(new IfcEntityList);
IfcEntityList::ptr trim2(new IfcEntityList);
trim1->push(new IfcSchema::IfcParameterValue( 0.));
trim2->push(new IfcSchema::IfcParameterValue(180.));
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);
+11 -11
View File
@@ -29,15 +29,15 @@
#include "../ifcparse/Ifc2x3.h"
#include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcHierarchyHelper.h"
#include "../ifcparse/hierarchy_helper.h"
typedef std::string S;
typedef IfcParse::IfcGlobalId guid;
typedef ifcopenshell::global_id guid;
boost::none_t const null = boost::none;
int main(int argc, char** argv) {
const char filename[] = "IfcCompositeProfileDef.ifc";
IfcHierarchyHelper file;
hierarchy_helper file;
file.header().file_name().name(filename);
double coords1[] = {100.0, 0.0};
@@ -65,11 +65,11 @@ int main(int argc, char** argv) {
IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
null, file.addPlacement2d(80.), 50.0, 25.0, 5.0, 10.0, 2.0, null);
file.addEntity(p2);
file.addEntity(p3);
file.add_entity(p2);
file.add_entity(p3);
file.addEntity(transform1);
file.addEntity(transform2);
file.add_entity(transform1);
file.add_entity(transform2);
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);
@@ -95,8 +95,8 @@ int main(int argc, char** argv) {
IfcSchema::IfcExtrudedAreaSolid* solid = new IfcSchema::IfcExtrudedAreaSolid(composite,
file.addPlacement3d(), file.addTriplet<IfcSchema::IfcDirection>(0, 0, 1), 20.0);
file.addEntity(composite);
file.addEntity(solid);
file.add_entity(composite);
file.add_entity(solid);
IfcSchema::IfcRepresentation::list::ptr reps (new IfcSchema::IfcRepresentation::list());
IfcSchema::IfcRepresentationItem::list::ptr items (new IfcSchema::IfcRepresentationItem::list());
@@ -107,8 +107,8 @@ int main(int argc, char** argv) {
reps->push(rep);
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(boost::none, boost::none, reps);
file.addEntity(rep);
file.addEntity(shape);
file.add_entity(rep);
file.add_entity(shape);
product->setRepresentation(shape);
+7 -7
View File
@@ -29,10 +29,10 @@
#include "../ifcparse/Ifc2x3.h"
#include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcHierarchyHelper.h"
#include "../ifcparse/hierarchy_helper.h"
typedef std::string S;
typedef IfcParse::IfcGlobalId guid;
typedef ifcopenshell::global_id guid;
boost::none_t const null = boost::none;
class Node {
@@ -101,7 +101,7 @@ public:
return operate(OP_INTERSECT, p);
}
IfcSchema::IfcRepresentationItem* serialize(IfcHierarchyHelper& file) const {
IfcSchema::IfcRepresentationItem* serialize(hierarchy_helper& file) const {
IfcSchema::IfcRepresentationItem* my;
if (op == OP_TERMINAL) {
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));
}
file.addEntity(my);
file.add_entity(my);
return my;
}
};
int main(int argc, char** argv) {
const char filename[] = "IfcCsgPrimitive.ifc";
IfcHierarchyHelper file;
hierarchy_helper file;
file.header().file_name().name(filename);
IfcSchema::IfcRepresentationItem* csg1 = Node::Box(8000.,6000.,3000.).subtract(
@@ -181,8 +181,8 @@ int main(int argc, char** argv) {
reps->push(rep);
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(null, null, reps);
file.addEntity(rep);
file.addEntity(shape);
file.add_entity(rep);
file.add_entity(shape);
product->setRepresentation(shape);
+12 -12
View File
@@ -29,10 +29,10 @@
#include "../ifcparse/Ifc2x3.h"
#include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcHierarchyHelper.h"
#include "../ifcparse/hierarchy_helper.h"
typedef std::string S;
typedef IfcParse::IfcGlobalId guid;
typedef ifcopenshell::global_id guid;
boost::none_t const null = boost::none;
typedef struct {
@@ -44,7 +44,7 @@ typedef struct {
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;
double flt1[] = {0. , 0. };
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);
file.addEntity(ellipse);
file.add_entity(ellipse);
IfcEntityList::ptr trim1(new IfcEntityList);
IfcEntityList::ptr trim2(new IfcEntityList);
if (pref == Ifc2x3::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER) {
@@ -77,13 +77,13 @@ void create_testcase_for(IfcHierarchyHelper& file, const EllipsePie& pie, Ifc2x3
trim2->push(p3);
}
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* s2 = new Ifc2x3::IfcCompositeCurveSegment(Ifc2x3::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, trim);
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);
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::IfcArbitraryClosedProfileDef* profile = new Ifc2x3::IfcArbitraryClosedProfileDef(Ifc2x3::IfcProfileTypeEnum::IfcProfileType_AREA, null, ccurve);
file.addEntity(ccurve);
file.addEntity(profile);
file.add_entity(ccurve);
file.add_entity(profile);
IfcSchema::IfcBuildingElementProxy* product = new IfcSchema::IfcBuildingElementProxy(
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,
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::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);
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(boost::none, boost::none, reps);
file.addEntity(rep);
file.addEntity(shape);
file.add_entity(rep);
file.add_entity(shape);
product->setRepresentation(shape);
}
int main(int argc, char** argv) {
const std::string filename = "ellipse_pies.ifc";
IfcHierarchyHelper file;
hierarchy_helper file;
{ EllipsePie pie = {80., 50., 0., 150.};
create_testcase_for(file, pie, Ifc2x3::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER);
create_testcase_for(file, pie, Ifc2x3::IfcTrimmingPreference::IfcTrimmingPreference_CARTESIAN);}
+5 -5
View File
@@ -25,15 +25,15 @@
#include "../ifcparse/Ifc2x3.h"
#include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcHierarchyHelper.h"
#include "../ifcparse/hierarchy_helper.h"
typedef std::string S;
typedef IfcParse::IfcGlobalId guid;
typedef ifcopenshell::global_id guid;
boost::none_t const null = (static_cast<boost::none_t>(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);
faces->push(face);
IfcSchema::IfcOpenShell* shell = new IfcSchema::IfcOpenShell(faces);
@@ -58,13 +58,13 @@ void create_testcase(IfcHierarchyHelper& file, IfcSchema::IfcFace* face, const s
reps->push(rep);
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(0, 0, reps);
file.addEntity(shape);
file.add_entity(shape);
product->setRepresentation(shape);
}
int main(int argc, char** argv) {
IfcHierarchyHelper file;
hierarchy_helper file;
{
IfcSchema::IfcCartesianPoint::list::ptr points (new IfcSchema::IfcCartesianPoint::list);
points->push(file.addTriplet<IfcSchema::IfcCartesianPoint>(-400, -400, 0));
+14 -14
View File
@@ -29,14 +29,14 @@
#include "ifcparse\Ifc2x3.h"
#include "ifcparse\IfcUtil.h"
#include "ifcparse\IfcHierarchyHelper.h"
#include "ifcparse\hierarchy_helper.h"
#include "ifcgeom\IfcGeom.h"
typedef std::string S;
typedef IfcParse::IfcGlobalId guid;
typedef ifcopenshell::global_id guid;
boost::none_t const null = boost::none;
void create_curve_rebar(IfcHierarchyHelper& file)
void create_curve_rebar(hierarchy_helper& file)
{
int dia = 24;
int R = 3 * dia;
@@ -71,17 +71,17 @@ void create_curve_rebar(IfcHierarchyHelper& file)
points1->push(p2);
file.addEntities(points1->generalize());
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);
file.addEntity(segment1);
file.add_entity(segment1);
segments->push(segment1);
/*second segment - arc */
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);
file.addEntity(circle);
file.add_entity(circle);
IfcEntityList::ptr trim1(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(p4);
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);
file.addEntity(segment2);
file.add_entity(segment2);
segments->push(segment2);
/*third segment - line */
@@ -104,14 +104,14 @@ void create_curve_rebar(IfcHierarchyHelper& file)
points2->push(p5);
file.addEntities(points2->generalize());
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);
file.addEntity(segment3);
file.add_entity(segment3);
segments->push(segment3);
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);
@@ -123,7 +123,7 @@ void create_curve_rebar(IfcHierarchyHelper& file)
reps->push(rep);
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(null, null, reps);
file.addEntity(shape);
file.add_entity(shape);
rebar->setRepresentation(shape);
@@ -133,7 +133,7 @@ void create_curve_rebar(IfcHierarchyHelper& file)
int main()
{
IfcHierarchyHelper file;
hierarchy_helper file;
file.header().file_name().name("ifc_curve_rebar.ifc");
create_curve_rebar(file);
std::ofstream f("ifc_curve_rebar.ifc");
+6 -6
View File
@@ -29,7 +29,7 @@
#include "../ifcparse/Ifc2x3.h"
#include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcHierarchyHelper.h"
#include "../ifcparse/hierarchy_helper.h"
typedef std::string S;
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 filename = profile_type + ".ifc";
IfcHierarchyHelper file;
hierarchy_helper file;
file.filename(filename);
int i = 0;
@@ -61,8 +61,8 @@ void create_testcase_for(IfcSchema::IfcProfileDef::list::ptr profiles) {
IfcSchema::IfcExtrudedAreaSolid* solid = new IfcSchema::IfcExtrudedAreaSolid(profile,
file.addPlacement3d(), file.addTriplet<IfcSchema::IfcDirection>(0, 0, 1), 20.0);
file.addEntity(profile);
file.addEntity(solid);
file.add_entity(profile);
file.add_entity(solid);
IfcSchema::IfcRepresentation::list::ptr reps (new IfcSchema::IfcRepresentation::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);
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(0, 0, reps);
file.addEntity(rep);
file.addEntity(shape);
file.add_entity(rep);
file.add_entity(shape);
product->setRepresentation(shape);
}
+4 -4
View File
@@ -25,12 +25,12 @@
#include "../ifcparse/Ifc4.h"
#include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcHierarchyHelper.h"
#include "../ifcparse/hierarchy_helper.h"
#include "suzanne_geometry.h"
typedef std::string S;
typedef IfcParse::IfcGlobalId guid;
typedef ifcopenshell::global_id guid;
boost::none_t const null = (static_cast<boost::none_t>(0));
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) {
IfcHierarchyHelper file;
hierarchy_helper file;
IfcSchema::IfcBuildingElementProxy* product = new IfcSchema::IfcBuildingElementProxy(
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);
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(0, 0, reps);
file.addEntity(shape);
file.add_entity(shape);
product->setRepresentation(shape);
+156 -156
View File
@@ -1,4 +1,4 @@
/********************************************************************************
/********************************************************************************
* *
* 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"
<< " .ifc IFC-SPF Industry Foundation Classes\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) {
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) {
std::ifstream file(IfcUtil::path::from_utf8(filename).c_str());
std::ifstream file(ifcopenshell::path::from_utf8(filename).c_str());
return file.good();
}
static std::basic_stringstream<path_t::value_type> log_stream;
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);
/// @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>&);
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
struct verbosity_counter {
@@ -429,18 +429,18 @@ int main(int argc, char** argv) {
po::store(command_line_parser(argc, argv).
options(cmdline_options).positional(positional_options).run(), vmap);
} 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();
return EXIT_FAILURE;
} 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;
} catch (const std::exception& e) {
cerr_ << "[Error] " << e.what() << "\n\n";
cerr_ << "[error] " << e.what() << "\n\n";
print_usage();
return EXIT_FAILURE;
} catch (...) {
cerr_ << "[Error] Unknown error parsing command line options\n\n";
cerr_ << "[error] Unknown error parsing command line options\n\n";
print_usage();
return EXIT_FAILURE;
}
@@ -468,7 +468,7 @@ int main(int argc, char** argv) {
print_options(generic_options.add(geom_options).add(serializer_options));
return EXIT_SUCCESS;
} else if (!vmap.count("input-file")) {
cerr_ << "[Error] Input file not specified" << std::endl;
cerr_ << "[error] Input file not specified" << std::endl;
print_usage();
return EXIT_FAILURE;
}
@@ -484,7 +484,7 @@ int main(int argc, char** argv) {
} else if (storey_height_display == "left") {
svg_storey_height_display = SvgSerializer::SH_LEFT;
} 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();
return EXIT_FAILURE;
}
@@ -493,28 +493,28 @@ int main(int argc, char** argv) {
if (num_threads <= 0) {
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) {
boost::to_lower(log_format);
if (log_format == "plain") {
Logger::OutputFormat(Logger::FMT_PLAIN);
logger::output_format(logger::FMT_PLAIN);
} else if (log_format == "json") {
Logger::OutputFormat(Logger::FMT_JSON);
logger::output_format(logger::FMT_JSON);
} else {
cerr_ << "[Error] --log-format should be either plain or json" << std::endl;
cerr_ << "[error] --log-format should be either plain or json" << std::endl;
print_usage();
return EXIT_FAILURE;
}
}
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) {
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 {
cerr_ << "[Error] No filters read from specifified file.\n";
cerr_ << "[error] No filters read from specifified file.\n";
return EXIT_FAILURE;
}
}
@@ -522,11 +522,11 @@ int main(int argc, char** argv) {
#ifdef HAVE_ICU
if (!unicode_mode.empty()) {
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") {
IfcParse::RuntimeIfcCharacterDecoder::mode = IfcParse::RuntimeIfcCharacterDecoder::ESCAPE;
ifcopenshell::runtime_character_decoder::mode = ifcopenshell::runtime_character_decoder::ESCAPE;
} else {
cerr_ << "[Error] Invalid value for --unicode" << std::endl;
cerr_ << "[error] Invalid value for --unicode" << std::endl;
print_options(serializer_options);
return 1;
}
@@ -535,9 +535,9 @@ int main(int argc, char** argv) {
if (!default_material_filename.empty()) {
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) {
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;
return EXIT_FAILURE;
}
@@ -551,7 +551,7 @@ int main(int argc, char** argv) {
bounding_width = w;
bounding_height = h;
} else {
cerr_ << "[Error] Invalid use of --bounds" << std::endl;
cerr_ << "[error] Invalid use of --bounds" << std::endl;
print_options(serializer_options);
return EXIT_FAILURE;
}
@@ -563,7 +563,7 @@ int main(int argc, char** argv) {
relative_center_x = cx;
relative_center_y = cy;
} else {
cerr_ << "[Error] Invalid use of --bounds" << std::endl;
cerr_ << "[error] Invalid use of --bounds" << std::endl;
print_options(serializer_options);
return EXIT_FAILURE;
}
@@ -572,8 +572,8 @@ int main(int argc, char** argv) {
const path_t input_filename = vmap["input-file"].as<path_t>();
/*
// todo also allow rocksdb dir
if (!file_exists(IfcUtil::path::to_utf8(input_filename))) {
cerr_ << "[Error] Input file '" << input_filename << "' does not exist" << std::endl;
if (!file_exists(ifcopenshell::path::to_utf8(input_filename))) {
cerr_ << "[error] Input file '" << input_filename << "' does not exist" << std::endl;
return EXIT_FAILURE;
}*/
@@ -581,15 +581,15 @@ int main(int argc, char** argv) {
// to maintain backwards compatibility with the obsolete IfcObj executable.
const path_t output_filename = vmap.count("output-file") == 1
? 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) {
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();
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;
cout_ << "A file '" << output_filename << "' already exists. Overwrite the existing file? y/n" << std::endl;
std::cin >> answer;
@@ -602,31 +602,31 @@ int main(int argc, char** argv) {
if (vmap.count("log-file")) {
log_fs.open(log_file.c_str(), std::ios::app);
Logger::SetOutput(quiet ? nullptr : &cout_, &log_fs);
logger::set_output(quiet ? nullptr : &cout_, &log_fs);
} else {
Logger::SetOutput(quiet ? nullptr : &cout_, vcounter.count > 1 ? &cout_ : &log_stream);
logger::set_output(quiet ? nullptr : &cout_, vcounter.count > 1 ? &cout_ : &log_stream);
}
switch (vcounter.count) {
case 0:
Logger::Verbosity(Logger::LOG_ERROR);
logger::verbosity(logger::LOG_ERROR);
break;
case 1:
Logger::Verbosity(Logger::LOG_NOTICE);
logger::verbosity(logger::LOG_NOTICE);
break;
case 2:
Logger::Verbosity(Logger::LOG_DEBUG);
logger::verbosity(logger::LOG_DEBUG);
break;
case 3:
Logger::Verbosity(Logger::LOG_PERF);
logger::verbosity(logger::LOG_PERF);
break;
case 4:
Logger::Verbosity(Logger::LOG_PERF);
Logger::PrintPerformanceStatsOnElement(true);
logger::verbosity(logger::LOG_PERF);
logger::print_performance_stats_on_element(true);
break;
}
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;
split(tokens, output_filename, boost::is_any_of("."));
@@ -638,63 +638,63 @@ int main(int argc, char** argv) {
boost::to_lower(output_extension);
IfcParse::IfcFile* ifc_file = 0;
ifcopenshell::file* ifc_file = 0;
boost::optional<std::list<IfcGeom::Element*>> elems_from_adaptor;
const path_t OBJ = IfcUtil::path::from_utf8(".obj"),
MTL = IfcUtil::path::from_utf8(".mtl"),
DAE = IfcUtil::path::from_utf8(".dae"),
GLB = IfcUtil::path::from_utf8(".glb"),
STP = IfcUtil::path::from_utf8(".stp"),
IGS = IfcUtil::path::from_utf8(".igs"),
SVG = IfcUtil::path::from_utf8(".svg"),
CACHE = IfcUtil::path::from_utf8(".cache"),
HDF = IfcUtil::path::from_utf8(".h5"),
XML = IfcUtil::path::from_utf8(".xml"),
JSON = IfcUtil::path::from_utf8(".json"),
const path_t OBJ = ifcopenshell::path::from_utf8(".obj"),
MTL = ifcopenshell::path::from_utf8(".mtl"),
DAE = ifcopenshell::path::from_utf8(".dae"),
GLB = ifcopenshell::path::from_utf8(".glb"),
STP = ifcopenshell::path::from_utf8(".stp"),
IGS = ifcopenshell::path::from_utf8(".igs"),
SVG = ifcopenshell::path::from_utf8(".svg"),
CACHE = ifcopenshell::path::from_utf8(".cache"),
HDF = ifcopenshell::path::from_utf8(".h5"),
XML = ifcopenshell::path::from_utf8(".xml"),
JSON = ifcopenshell::path::from_utf8(".json"),
// @todo this is just temporary as it doesn't make sense to require an extension for a DB
RDB = IfcUtil::path::from_utf8(".rdb"),
IFC = IfcUtil::path::from_utf8(".ifc"),
USD = IfcUtil::path::from_utf8(".usd"),
USDA = IfcUtil::path::from_utf8(".usda"),
USDC = IfcUtil::path::from_utf8(".usdc"),
TTL = IfcUtil::path::from_utf8(".ttl");
RDB = ifcopenshell::path::from_utf8(".rdb"),
IFC = ifcopenshell::path::from_utf8(".ifc"),
USD = ifcopenshell::path::from_utf8(".usd"),
USDA = ifcopenshell::path::from_utf8(".usda"),
USDC = ifcopenshell::path::from_utf8(".usdc"),
TTL = ifcopenshell::path::from_utf8(".ttl");
// @todo clean up serializer selection
// @todo detect program options that conflict with the chosen serializer
if (output_extension == XML || output_extension == JSON) {
int exit_code = EXIT_FAILURE;
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(&start);
if (output_extension == XML) {
XmlSerializer s(ifc_file, IfcUtil::path::to_utf8(output_temp_filename));
Logger::Status("Writing XML output...");
XmlSerializer s(ifc_file, ifcopenshell::path::to_utf8(output_temp_filename));
logger::status("Writing XML output...");
s.finalize();
} else {
#ifdef WITH_GLTF
JsonSerializer s(ifc_file, IfcUtil::path::to_utf8(output_temp_filename), JsonSerializer::JSON_DIALECT_CREOOX);
Logger::Status("Writing JSON output...");
JsonSerializer s(ifc_file, ifcopenshell::path::to_utf8(output_temp_filename), JsonSerializer::JSON_DIALECT_CREOOX);
logger::status("Writing JSON output...");
s.finalize();
#endif
}
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;
}
} catch (const std::exception& e) {
Logger::Error(e);
logger::error(e);
}
write_log(!quiet);
return exit_code;
} else if (output_extension == IFC) {
int exit_code = EXIT_FAILURE;
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(&start);
std::ofstream fs(output_filename.c_str());
@@ -705,13 +705,13 @@ int main(int argc, char** argv) {
fs << *ifc_file;
exit_code = EXIT_SUCCESS;
} else {
Logger::Error("Unable to open output file for writing");
logger::error("Unable to open output file for writing");
}
time(&end);
Logger::Status("Done! Writing IFC took " + format_duration(start, end));
logger::status("Done! Writing IFC took " + format_duration(start, end));
}
} catch (const std::exception& e) {
Logger::Error(e);
logger::error(e);
}
write_log(!quiet);
return exit_code;
@@ -723,26 +723,26 @@ int main(int argc, char** argv) {
if (vmap.count("stream")) {
time_t start, end;
time(&start);
RocksDbSerializer s(IfcUtil::path::to_utf8(input_filename), IfcUtil::path::to_utf8(output_filename), true);
Logger::Status("Populating RocksDB Key-Value store...");
RocksDbSerializer s(ifcopenshell::path::to_utf8(input_filename), ifcopenshell::path::to_utf8(output_filename), true);
logger::status("Populating RocksDB Key-Value store...");
s.finalize();
time(&end);
Logger::Status("Done! Conversion took " + format_duration(start, end));
logger::status("Done! Conversion took " + format_duration(start, end));
exit_code = EXIT_SUCCESS;
} 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(&start);
RocksDbSerializer s(ifc_file, IfcUtil::path::to_utf8(output_filename));
Logger::Status("Populating RocksDB Key-Value store...");
RocksDbSerializer s(ifc_file, ifcopenshell::path::to_utf8(output_filename));
logger::status("Populating RocksDB Key-Value store...");
s.finalize();
time(&end);
Logger::Status("Done! Conversion took " + format_duration(start, end));
logger::status("Done! Conversion took " + format_duration(start, end));
exit_code = EXIT_SUCCESS;
}
}
} catch (const std::exception& e) {
Logger::Error(e);
logger::error(e);
}
write_log(!quiet);
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_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()) {
cerr_ << "[Error] Failed to set up geometry filters\n";
cerr_ << "[error] Failed to set up geometry filters\n";
return EXIT_FAILURE;
}
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 (!attribute_filter.attribute_name.empty()) { attribute_filter.update_description(); Logger::Notice(attribute_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 (!attribute_filter.attribute_name.empty()) { attribute_filter.update_description(); logger::notice(attribute_filter.description); }
#ifdef _MSC_VER
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) {
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.
write_log(!quiet);
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;
}
@@ -829,41 +829,41 @@ int main(int argc, char** argv) {
if (output_extension == OBJ) {
// Do not use temp file for MTL as it's such a small file.
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
} 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
#ifdef WITH_GLTF
} 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
#ifdef WITH_USD
} 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
#ifdef IFOPSH_WITH_OPENCASCADE
} 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) {
#if OCC_VERSION_HEX < 0x60900
// 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
#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) {
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
} else if (output_extension == HDF) {
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
} 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 {
cerr_ << "[Error] Unknown output filename extension '" << output_extension << "'\n";
cerr_ << "[error] Unknown output filename extension '" << output_extension << "'\n";
write_log(!quiet);
print_usage();
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
if (!is_tesselated) {
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()) {
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) {
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;
}
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);
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
// XML, RocksDB, IFC are already special-cased above
// 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);
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;
}
if (vmap.count("log-file")) {
Logger::SetOutput(quiet ? nullptr : &cout_, &log_fs);
logger::set_output(quiet ? nullptr : &cout_, &log_fs);
} else {
Logger::SetOutput(quiet ? nullptr : &cout_, vcounter.count > 1 ? &cout_ : &log_stream);
logger::set_output(quiet ? nullptr : &cout_, vcounter.count > 1 ? &cout_ : &log_stream);
}
if (model_rotation) {
std::vector<double> rotation(4);
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()) {
cerr_ << "[Error] Invalid use of --model-rotation\n";
IfcUtil::path::delete_file(IfcUtil::path::to_utf8(output_temp_filename));
cerr_ << "[error] Invalid use of --model-rotation\n";
ifcopenshell::path::delete_file(ifcopenshell::path::to_utf8(output_temp_filename));
print_options(serializer_options);
return EXIT_FAILURE;
}
std::stringstream msg;
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;
}
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)) {
std::vector<double> offset(3);
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()) {
cerr_ << "[Error] Invalid use of --model-offset\n";
IfcUtil::path::delete_file(IfcUtil::path::to_utf8(output_temp_filename));
cerr_ << "[error] Invalid use of --model-offset\n";
ifcopenshell::path::delete_file(ifcopenshell::path::to_utf8(output_temp_filename));
print_options(serializer_options);
return EXIT_FAILURE;
}
std::stringstream msg;
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;
}
@@ -954,15 +954,15 @@ int main(int argc, char** argv) {
time_t start, end;
time(&start);
if (!quiet) Logger::Status("Computing bounds...");
if (!quiet) logger::status("Computing bounds...");
if (center_model_geometry) {
if (!tmp_context_iterator.initialize()) {
/// @todo It would be nice to know and print separate error prints for a case where we found no entities
/// and for a case we found no entities that satisfy our filtering criteria.
Logger::Notice("No geometrical elements found or none successfully converted");
logger::notice("No geometrical elements found or none successfully converted");
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);
return EXIT_FAILURE;
}
@@ -971,7 +971,7 @@ int main(int argc, char** argv) {
tmp_context_iterator.compute_bounds(center_model_geometry);
time(&end);
if (!quiet) Logger::Status("Done ! Bounds computed in " + format_duration(start, end));
if (!quiet) logger::status("Done ! Bounds computed in " + format_duration(start, end));
auto center = (tmp_context_iterator.bounds_min().ccomponents() + tmp_context_iterator.bounds_max().ccomponents()) * 0.5;
offset[0] = -center(0);
@@ -980,7 +980,7 @@ int main(int argc, char** argv) {
std::stringstream msg;
msg << std::setprecision (std::numeric_limits<double>::max_digits10) << "Using model offset (" << offset[0] << "," << offset[1] << "," << offset[2] << ")";
Logger::Notice(msg.str());
logger::notice(msg.str());
geometry_settings.get<ifcopenshell::geometry::settings::ModelOffset>().value = offset;
}
@@ -1005,19 +1005,19 @@ int main(int argc, char** argv) {
if (!vmap.count("cache-file")) {
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());
}
#endif
Logger::Message(Logger::LOG_PERF, "file geometry conversion");
logger::message(logger::LOG_PERF, "file geometry conversion");
if (context_iterator && !context_iterator->initialize()) {
/// @todo It would be nice to know and print separate error prints for a case where we found no entities
/// and for a case we found no entities that satisfy our filtering criteria.
Logger::Notice("No geometrical elements found or none successfully converted");
logger::notice("No geometrical elements found or none successfully converted");
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);
return EXIT_FAILURE;
}
@@ -1034,7 +1034,7 @@ int main(int argc, char** argv) {
static_cast<SvgSerializer*>(serializer.get())->setSectionHeightsFromStoreys();
}
} 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);
}
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) {
static_cast<SvgSerializer*>(serializer.get())->setScale((double)s0 / s1);
} else {
cerr_ << "[Error] Invalid use of --scale" << std::endl;
cerr_ << "[error] Invalid use of --scale" << std::endl;
print_options(serializer_options);
return EXIT_FAILURE;
}
@@ -1112,7 +1112,7 @@ int main(int argc, char** argv) {
int old_progress = quiet ? 0 : -1;
if (!quiet) {
Logger::Status("Creating geometry...");
logger::status("Creating geometry...");
}
// The functions IfcGeom::Iterator::get() and IfcGeom::Iterator::next()
@@ -1157,10 +1157,10 @@ int main(int argc, char** argv) {
if (stderr_progress)
cerr_ << std::flush;
} 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 {
progress = progress / 2;
if (old_progress != progress) Logger::ProgressBar(progress);
if (old_progress != progress) logger::progress_bar(progress);
old_progress = progress;
}
}
@@ -1189,7 +1189,7 @@ int main(int argc, char** argv) {
}
} else {
const std::string task = ((num_threads == 1) ? "creating" : "writing");
Logger::Status("\rDone " + task + " geometry (" + boost::lexical_cast<std::string>(num_created) +
logger::status("\rDone " + task + " geometry (" + boost::lexical_cast<std::string>(num_created) +
" objects) ");
}
@@ -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).
serializer.reset();
Logger::Message(Logger::LOG_PERF, "done file geometry conversion");
logger::message(logger::LOG_PERF, "done file geometry conversion");
bool successful;
if(output_extension == USD || output_extension == USDC || output_extension == USDA) {
@@ -1207,7 +1207,7 @@ int main(int argc, char** argv) {
else {
// 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.
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) {
@@ -1215,13 +1215,13 @@ int main(int argc, char** argv) {
output_temp_filename << "' for the conversion result.";
}
if (geometry_settings.get<ifcopenshell::geometry::settings::ValidateQuantities>().get() && Logger::MaxSeverity() >= Logger::LOG_ERROR) {
Logger::Error("Errors encountered during processing.");
if (geometry_settings.get<ifcopenshell::geometry::settings::ValidateQuantities>().get() && logger::max_severity() >= logger::LOG_ERROR) {
logger::error("Errors encountered during processing.");
successful = false;
}
if (Logger::Verbosity() == Logger::LOG_PERF) {
Logger::PrintPerformanceStats();
if (logger::verbosity() == logger::LOG_PERF) {
logger::print_performance_stats();
}
write_log(!quiet);
@@ -1229,7 +1229,7 @@ int main(int argc, char** argv) {
time(&end);
if (!quiet) {
Logger::Status("\nConversion took " + format_duration(start, end));
logger::status("\nConversion took " + format_duration(start, end));
}
return successful ? EXIT_SUCCESS : EXIT_FAILURE;
@@ -1267,11 +1267,11 @@ void write_log(bool header) {
#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;
// Prevent IfcFile::Init() prints by setting output to null temporarily
if (no_progress) { Logger::SetOutput(NULL, &log_stream); }
// Prevent file::Init() prints by setting output to null temporarily
if (no_progress) { logger::set_output(NULL, &log_stream); }
time(&start);
@@ -1279,11 +1279,11 @@ bool init_input_file(const std::string& filename, IfcParse::IfcFile*& ifc_file,
#ifdef WITH_IFCXML
// if (boost::ends_with(boost::to_lower_copy(filename), ".ifcxml")) {
// ifc_file = IfcParse::parse_ifcxml(filename);
// ifc_file = ifcopenshell::parse_ifcxml(filename);
// } else
#endif
{
ifc_file = new IfcParse::IfcFile(IfcParse::uninitialized_tag{});
ifc_file = new ifcopenshell::file(ifcopenshell::uninitialized_tag{});
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()) {
Logger::Error("Unable to parse input file '" + filename + "'");
logger::error("Unable to parse input file '" + filename + "'");
return false;
}
time(&end);
if (no_progress) { Logger::SetOutput(&cout_, &log_stream); }
else { Logger::Status("Parsing input file took " + format_duration(start, end)); }
if (no_progress) { logger::set_output(&cout_, &log_stream); }
else { logger::status("Parsing input file took " + format_duration(start, end)); }
return true;
@@ -1327,7 +1327,7 @@ bool append_filter(const std::string& type, const std::vector<std::string>& valu
parse_filter(temp, values);
// 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)) {
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;
}
filter.type = temp.type;
@@ -1343,10 +1343,10 @@ size_t read_filters_from_file(
exclusion_filter& exclude_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()) {
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;
}
@@ -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_traverse_filter)) { ++num_filters; } }
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;
}
} 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;
}
}
@@ -1497,16 +1497,16 @@ namespace latebound_access {
void set(express::Base inst, const std::string& attr, T 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 <>
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(
enum_type->enumeration_items().begin(),
enum_type->enumeration_items().end(),
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>
@@ -1515,26 +1515,26 @@ namespace latebound_access {
auto i = decl->attribute_index(attr);
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);
} else {
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);
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) {
// Lists are traversed back to front as the list may be mutated when
// instances are removed from the grouping by type.
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");
for (auto it = quantities.end() - 1; it >= quantities.begin(); --it) {
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");
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) {
relationships.push_back(rel);
}
@@ -1568,7 +1568,7 @@ void fix_quantities(IfcParse::IfcFile& f, bool no_progress, bool quiet, bool std
// Delete relationship nodes
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;
} else {
const int progress = context_iterator.progress() / 2;
if (old_progress != progress) Logger::ProgressBar(progress);
if (old_progress != progress) logger::progress_bar(progress);
old_progress = progress;
}
}
@@ -1722,7 +1722,7 @@ void fix_quantities(IfcParse::IfcFile& f, bool no_progress, bool quiet, bool std
if (stderr_progress)
cerr_ << std::flush;
} else {
Logger::Status("\rDone writing quantities for " + boost::lexical_cast<std::string>(num_created) +
logger::status("\rDone writing quantities for " + boost::lexical_cast<std::string>(num_created) +
" objects ");
}
+15 -15
View File
@@ -18,29 +18,29 @@ typedef CGAL::AABB_traits<Kernel_, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
typedef Tree::Point_and_primitive_id Point_and_primitive_id;
void fix_spaceboundaries(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);
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) {
std::for_each(rels->begin(), rels->end(), [&rel_by_space_elem](const IfcUtil::IfcBaseClass* rel) {
auto x = ((IfcUtil::IfcBaseEntity*)rel)->get_value<IfcUtil::IfcBaseClass*>("RelatingSpace");
std::for_each(rels->begin(), rels->end(), [&rel_by_space_elem](const ifcopenshell::IfcBaseClass* rel) {
auto x = ((ifcopenshell::IfcBaseEntity*)rel)->get_value<ifcopenshell::IfcBaseClass*>("RelatingSpace");
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 });
} catch (IfcParse::IfcException&) {
} catch (ifcopenshell::exception&) {
// 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()) {
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;
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 g2 = n.substr(23);
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) {
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 A = a.handle()->first;
@@ -103,7 +103,7 @@ void fix_spaceboundaries(IfcParse::IfcFile& f, bool no_progress, bool quiet, boo
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;
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 });
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;
}
@@ -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;
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")) {
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 g2 = n.substr(23);
if (is_wall_space_or_slab(g1) && is_wall_space_or_slab(g2) && guid_pairs_visited.find({ g1, g2 }) == guid_pairs_visited.end()) {
Logger::Error("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>
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;
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);
auto get_elevation = [](const IfcUtil::IfcBaseClass* a) {
return ((const IfcUtil::IfcBaseEntity*)a)->get_value<double>("Elevation", 0.);
auto get_elevation = [](const ifcopenshell::IfcBaseClass* a) {
return ((const ifcopenshell::IfcBaseEntity*)a)->get_value<double>("Elevation", 0.);
};
// latebound inverse attribute lookup not working
auto rels = f.instances_by_type("IfcRelContainedInSpatialStructure");
std::map<const IfcUtil::IfcBaseClass*, const IfcUtil::IfcBaseClass*> elem_to_storey;
std::for_each(rels->begin(), rels->end(), [&elem_to_storey](IfcUtil::IfcBaseClass* r) {
auto elems = ((IfcUtil::IfcBaseEntity*)r)->get_value<aggregate_of_instance::ptr>("RelatedElements");
auto storey = ((IfcUtil::IfcBaseEntity*)r)->get_value<IfcUtil::IfcBaseClass*>("RelatingStructure");
std::map<const ifcopenshell::IfcBaseClass*, const ifcopenshell::IfcBaseClass*> elem_to_storey;
std::for_each(rels->begin(), rels->end(), [&elem_to_storey](ifcopenshell::IfcBaseClass* r) {
auto elems = ((ifcopenshell::IfcBaseEntity*)r)->get_value<aggregate_of_instance::ptr>("RelatedElements");
auto storey = ((ifcopenshell::IfcBaseEntity*)r)->get_value<ifcopenshell::IfcBaseClass*>("RelatingStructure");
if (storey->declaration().name() == "IfcBuildingStorey") {
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");
std::vector<const IfcUtil::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::vector<const ifcopenshell::IfcBaseClass*> storeys_sorted(storeys->begin(), storeys->end());
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);
});
/*
std::wcout << "Storeys ";
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 << std::endl;
@@ -121,7 +121,7 @@ void fix_storeycontainment(IfcParse::IfcFile& f, bool no_progress, bool quiet, b
/*
std::stringstream ss;
ss << geom_object->product()->data().toString();
ss << geom_object->product()->data().to_string();
auto sss = ss.str();
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];
if (calc_overlap > 0 && assigned_overlap < calc_overlap * 0.9) {
auto s = geom_object->product()->get_value<std::string>("GlobalId");
auto s1 = ((IfcUtil::IfcBaseEntity*)storeys_sorted[calc_idx])->get_value<std::string>("GlobalId");
auto s2 = ((IfcUtil::IfcBaseEntity*)elem_to_storey[geom_object->product()])->get_value<std::string>("GlobalId");
Logger::Error("Element " + s + " contained in " + s2 + " located on " + s1);
auto s1 = ((ifcopenshell::IfcBaseEntity*)storeys_sorted[calc_idx])->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);
}
if (!no_progress) {
@@ -214,7 +214,7 @@ void fix_storeycontainment(IfcParse::IfcFile& f, bool no_progress, bool quiet, b
std::cerr << std::flush;
} else {
const int progress = context_iterator.progress() / 2;
if (old_progress != progress) Logger::ProgressBar(progress);
if (old_progress != progress) logger::progress_bar(progress);
old_progress = progress;
}
}
@@ -230,7 +230,7 @@ void fix_storeycontainment(IfcParse::IfcFile& f, bool no_progress, bool quiet, b
if (stderr_progress)
std::cerr << std::flush;
} else {
Logger::Status("\rDone fixing space boundaries for " + boost::lexical_cast<std::string>(num_created) +
logger::status("\rDone fixing space boundaries for " + boost::lexical_cast<std::string>(num_created) +
" objects ");
}
}
+18 -18
View File
@@ -9,7 +9,7 @@
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);
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);
auto rels = f.instances_by_type("IfcRelConnectsPathElements");
std::map<std::set<const IfcUtil::IfcBaseClass*>, const IfcUtil::IfcBaseClass*> rel_by_elem;
std::for_each(rels->begin(), rels->end(), [&rel_by_elem](const IfcUtil::IfcBaseClass* rel) {
auto x = ((IfcUtil::IfcBaseEntity*)rel)->get_value<IfcUtil::IfcBaseClass*>("RelatingElement");
auto y = ((IfcUtil::IfcBaseEntity*)rel)->get_value<IfcUtil::IfcBaseClass*>("RelatedElement");
std::map<std::set<const ifcopenshell::IfcBaseClass*>, const ifcopenshell::IfcBaseClass*> rel_by_elem;
std::for_each(rels->begin(), rels->end(), [&rel_by_elem](const ifcopenshell::IfcBaseClass* rel) {
auto x = ((ifcopenshell::IfcBaseEntity*)rel)->get_value<ifcopenshell::IfcBaseClass*>("RelatingElement");
auto y = ((ifcopenshell::IfcBaseEntity*)rel)->get_value<ifcopenshell::IfcBaseClass*>("RelatedElement");
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 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 B = b.handle()->first;
const IfcUtil::IfcBaseClass* rel = nullptr;
const ifcopenshell::IfcBaseClass* rel = nullptr;
std::string a_type, b_type;
auto rit = rel_by_elem.find({ A, B });
if (rit != rel_by_elem.end()) {
rel = rit->second;
const bool a_is_relating = A == ((IfcUtil::IfcBaseEntity*)rel)->get_value<IfcUtil::IfcBaseClass*>("RelatingElement");
a_type = ((IfcUtil::IfcBaseEntity*)rel)->get_value<std::string>("RelatingConnectionType");
b_type = ((IfcUtil::IfcBaseEntity*)rel)->get_value<std::string>("RelatedConnectionType");
const bool a_is_relating = A == ((ifcopenshell::IfcBaseEntity*)rel)->get_value<ifcopenshell::IfcBaseClass*>("RelatingElement");
a_type = ((ifcopenshell::IfcBaseEntity*)rel)->get_value<std::string>("RelatingConnectionType");
b_type = ((ifcopenshell::IfcBaseEntity*)rel)->get_value<std::string>("RelatedConnectionType");
if (!a_is_relating) {
std::swap(a_type, b_type);
}
@@ -79,7 +79,7 @@ void fix_wallconnectivity(IfcParse::IfcFile& f, bool no_progress, bool quiet, bo
#endif
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();
auto x = a.handle()->second * b.handle()->second;
std::clock_t intersection_end = std::clock();
@@ -108,7 +108,7 @@ void fix_wallconnectivity(IfcParse::IfcFile& f, bool no_progress, bool quiet, bo
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 shaperep = taxonomy::cast<taxonomy::collection>(item)->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 (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 {
auto A_str = A->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()) {
auto x = (IfcUtil::IfcBaseEntity*)((IfcUtil::IfcBaseEntity*)rel)->get_value<IfcUtil::IfcBaseClass*>("RelatingElement");
auto y = (IfcUtil::IfcBaseEntity*)((IfcUtil::IfcBaseEntity*)rel)->get_value<IfcUtil::IfcBaseClass*>("RelatedElement");
auto x = (ifcopenshell::IfcBaseEntity*)((ifcopenshell::IfcBaseEntity*)rel)->get_value<ifcopenshell::IfcBaseClass*>("RelatingElement");
auto y = (ifcopenshell::IfcBaseEntity*)((ifcopenshell::IfcBaseEntity*)rel)->get_value<ifcopenshell::IfcBaseClass*>("RelatedElement");
if (v.successfully_processed.find(x) != v.successfully_processed.end() && v.successfully_processed.find(y) != v.successfully_processed.end()) {
Logger::Error("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 {
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;
std::vector<Box> boxes;
@@ -443,9 +443,9 @@ struct intersection_validator {
double total_minkowsky_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;
settings.get<ifcopenshell::geometry::settings::UseWorldCoords>().value = false;
@@ -485,7 +485,7 @@ struct intersection_validator {
}
std::stringstream ss;
geom_object->product()->toString(ss);
geom_object->product()->to_string(ss);
auto sss = ss.str();
std::wcout << sss.c_str() << std::endl;
@@ -543,7 +543,7 @@ struct intersection_validator {
/*
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();
std::wcout << sss.c_str();
*/
@@ -562,7 +562,7 @@ struct intersection_validator {
std::cerr << std::flush;
} else {
const int progress = context_iterator.progress() / 2;
if (old_progress != progress) Logger::ProgressBar(progress);
if (old_progress != progress) logger::progress_bar(progress);
old_progress = progress;
}
}
@@ -578,7 +578,7 @@ struct intersection_validator {
if (stderr_progress)
std::cerr << std::flush;
} else {
Logger::Status("\rDone fixing space boundaries for " + boost::lexical_cast<std::string>(num_created) +
logger::status("\rDone fixing space boundaries for " + boost::lexical_cast<std::string>(num_created) +
" objects ");
}
+2 -2
View File
@@ -20,7 +20,7 @@ bool ifcopenshell::geometry::kernels::AbstractKernel::convert(const taxonomy::pt
auto it = cache_.find(item);
if (it != cache_.end()) {
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()));
return true;
}
@@ -30,7 +30,7 @@ bool ifcopenshell::geometry::kernels::AbstractKernel::convert(const taxonomy::pt
try {
return fn();
} catch (std::exception& e) {
Logger::Error(e, item->instance);
logger::error(e, item->instance);
return false;
} catch (...) {
// @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
#include "../ifcparse/macros.h"
#include "../ifcparse/IfcLogger.h"
#include "../ifcparse/logger.h"
#include "../ifcgeom/ifc_geom_api.h"
#include "../ifcgeom/IfcGeomRepresentation.h"
#include "../ifcgeom/taxonomy.h"
@@ -150,7 +150,7 @@ namespace {
template <>
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&) {
Logger::Error("No conversion for " + std::to_string(item->kind()));
logger::error("No conversion for " + std::to_string(item->kind()));
return false;
}
};
@@ -170,7 +170,7 @@ namespace {
template <>
struct dispatch_with_upgrade<ifcopenshell::geometry::taxonomy::upgrades::max> {
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;
}
};
@@ -206,7 +206,7 @@ namespace {
template <typename T>
struct dispatch_curve_creation<T, ifcopenshell::geometry::taxonomy::curves::max> {
static bool dispatch(const ifcopenshell::geometry::taxonomy::ptr& item, T&) {
Logger::Error("No conversion for " + std::to_string(item->kind()));
logger::error("No conversion for " + std::to_string(item->kind()));
return false;
}
};
@@ -228,7 +228,7 @@ namespace {
template <typename T>
struct dispatch_surface_creation<T, ifcopenshell::geometry::taxonomy::surfaces::max> {
static bool dispatch(const ifcopenshell::geometry::taxonomy::ptr& item, T&) {
Logger::Error("No conversion for " + std::to_string(item->kind()));
logger::error("No conversion for " + std::to_string(item->kind()));
return false;
}
};
+17 -17
View File
@@ -4,7 +4,7 @@
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))
{
mapping_ = impl::mapping_implementations().construct(file, s);
@@ -32,7 +32,7 @@ namespace {
if (density > 1e5) {
items[0].Shape()->set_box(box);
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) {
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) {
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();
}
} catch (const std::exception& e) {
Logger::Error(e);
logger::error(e);
}
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);
}
} 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;
} 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())) {
@@ -244,7 +244,7 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
std::swap(shapes, unified_shapes);
}
} 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)) {
double diff = std::abs(a_calc - a_file);
if (diff / std::sqrt(a_file) > getValue(GV_PRECISION)) {
Logger::Error("Validation of surface area failed for:", product);
logger::error("Validation of surface area failed for:", product);
} else {
Logger::Notice("Validation of surface area succeeded for:", product);
logger::notice("Validation of surface area succeeded for:", product);
}
} 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") {
double v_calc;
@@ -313,12 +313,12 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
if (elem->geometry().calculate_volume(v_calc)) {
double diff = std::abs(v_calc - v_file);
if (diff / std::sqrt(v_file) > getValue(GV_PRECISION)) {
Logger::Error("Validation of volume failed for:", product);
logger::error("Validation of volume failed for:", product);
} else {
Logger::Notice("Validation of volume succeeded for:", product);
logger::notice("Validation of volume succeeded for:", product);
}
} 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") {
auto qs2 = q->as<IfcSchema::IfcPhysicalComplexQuantity>()->HasQuantities();
@@ -337,9 +337,9 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
}
}
if (!all_succeeded) {
Logger::Error("Validation of surface genus failed for:", product);
logger::error("Validation of surface genus failed for:", product);
} 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();
}
} catch (const std::exception& e) {
Logger::Error(e);
logger::error(e);
}
const std::string guid = product.get_value<std::string>("GlobalId");
+2 -2
View File
@@ -1,7 +1,7 @@
#ifndef ITERATOR_KERNEL_H
#define ITERATOR_KERNEL_H
#include "../ifcparse/IfcFile.h"
#include "../ifcparse/file.h"
#include "../ifcgeom/ConversionSettings.h"
#include "../ifcgeom/ConversionResult.h"
#include "../ifcgeom/abstract_mapping.h"
@@ -25,7 +25,7 @@ namespace ifcopenshell { namespace geometry {
public:
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();
+3 -3
View File
@@ -113,7 +113,7 @@ public:
std::ostream& stream;
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_)
{}
@@ -153,7 +153,7 @@ public:
virtual void write(const IfcGeom::TriangulationElement* o) = 0;
virtual void write(const IfcGeom::BRepElement* o) = 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_; }
ifcopenshell::geometry::SerializerSettings& settings() { return settings_; }
@@ -179,7 +179,7 @@ class WriteOnlyGeometrySerializer : public GeometrySerializer {
public:
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");
};
};
+6 -6
View File
@@ -23,10 +23,10 @@
#include <string>
#include <algorithm>
#include "../ifcparse/Argument.h"
#include "../ifcparse/IfcGlobalId.h"
#include "../ifcparse/IfcLogger.h"
#include "../ifcparse/InstanceData.h"
#include "../ifcparse/argument.h"
#include "../ifcparse/global_id.h"
#include "../ifcparse/logger.h"
#include "../ifcparse/instance_data.h"
#include "../ifcgeom/IfcGeomRepresentation.h"
#include "../ifcgeom/ifc_geom_api.h"
@@ -111,10 +111,10 @@ namespace IfcGeom {
oss << "project";
} else {
try {
oss << "product-" << IfcParse::IfcGlobalId(guid).formatted();
oss << "product-" << ifcopenshell::global_id(guid).formatted();
} catch (const std::exception& e) {
oss << "product";
Logger::Error(e);
logger::error(e);
}
}
+1 -1
View File
@@ -29,7 +29,7 @@
#endif
#include "../ifcgeom/AbstractKernel.h"
#include "../ifcparse/IfcFile.h"
#include "../ifcparse/file.h"
#include "../ifcgeom/abstract_mapping.h"
#include <boost/foreach.hpp>
+29 -29
View File
@@ -31,7 +31,7 @@ bool IfcGeom::Iterator::initialize() {
try {
converter_->mapping()->get_representations(reps, filters_);
} catch (const std::exception& e) {
Logger::Error(e);
logger::error(e);
}
time_points[1] = high_resolution_clock::now();
@@ -94,7 +94,7 @@ bool IfcGeom::Iterator::initialize() {
tasks_.back().item = p.first;
tasks_.back().products = p.second;
}
Logger::Notice("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) {
Logger::Warning("No representations encountered, aborting");
logger::warning("No representations encountered, aborting");
initialization_outcome_.emplace(false);
} else if (!settings_.get<ifcopenshell::geometry::settings::DeferProcessingFirstElement>().get()) {
@@ -231,14 +231,14 @@ void IfcGeom::Iterator::process_concurrently() {
try {
this->create_element_(kernel, settings, rep);
} catch (const std::exception& e) {
Logger::Error(
logger::error(
std::string("Exception '") + e.what() +
std::string("' occurred while iterator was creating a shape: "),
rep->item->instance
);
had_error_processing_elements_ = true;
} catch (...) {
Logger::Error(
logger::error(
"Unknown exception occurred while iteartor was creating a shape: ",
rep->item->instance
);
@@ -263,10 +263,10 @@ void IfcGeom::Iterator::process_concurrently() {
finished_ = true;
Logger::SetProduct(std::nullopt);
logger::set_product(std::nullopt);
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) ");
}
}
@@ -360,20 +360,20 @@ void IfcGeom::Iterator::create_element_(ifcopenshell::geometry::Converter* kerne
const express::Base product = product_node.first;
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]() {
return kernel->create_brep_for_representation_and_product(rep->item, product, place);
}));
if (!brep) {
Logger::SetProduct(std::nullopt);
logger::set_product(std::nullopt);
return;
}
auto elem = process_based_on_settings(settings, brep);
if (!elem) {
Logger::SetProduct(std::nullopt);
logger::set_product(std::nullopt);
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)
@@ -406,7 +406,7 @@ IfcGeom::Element* IfcGeom::Iterator::process_based_on_settings(ifcopenshell::geo
try {
return new IfcGeom::SerializedElement(*elem);
} 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;
}
} 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());
}
} 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;
});
@@ -466,7 +466,7 @@ void IfcGeom::Iterator::log_timepoints() const {
for (auto it = time_points.begin() + 1; it != time_points.end(); ++it) {
auto jt = it - 1;
duration<double, std::milli> ms_double = (*it) - (*jt);
Logger::Notice(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 (!wait_for_element()) {
Logger::SetProduct(std::nullopt);
logger::set_product(std::nullopt);
time_points[3] = high_resolution_clock::now();
log_timepoints();
task_result_ptr_exhausted = true;
@@ -517,7 +517,7 @@ express::Base IfcGeom::Iterator::next() {
// shape representation
if (task_result_iterator_ == --all_processed_elements_.end()) {
if (!create()) {
Logger::SetProduct(std::nullopt);
logger::set_product(std::nullopt);
time_points[3] = high_resolution_clock::now();
log_timepoints();
task_result_ptr_exhausted = true;
@@ -554,7 +554,7 @@ IfcGeom::Element* IfcGeom::Iterator::get()
try {
parent_object = get_object(ret->parent_id());
} catch (const std::exception& e) {
Logger::Error(e);
logger::error(e);
hasParent = false;
}
@@ -572,7 +572,7 @@ IfcGeom::Element* IfcGeom::Iterator::get()
try {
parent_object = get_object(pid);
} catch (const std::exception& e) {
Logger::Error(e);
logger::error(e);
hasParent = false;
}
}
@@ -619,19 +619,19 @@ const IfcGeom::Element* IfcGeom::Iterator::get_object(int id) {
m4 = casted->matrix;
}
} catch (const std::exception& e) {
Logger::Error(e);
logger::error(e);
}
#ifdef IFOPSH_WITH_OPENCASCADE
catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString());
logger::error(e.GetMessageString());
} else {
Logger::Error("Unknown error returning product");
logger::error("Unknown error returning product");
}
}
#endif
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>());
@@ -643,21 +643,21 @@ express::Base IfcGeom::Iterator::create() {
try {
product = create_shape_model_for_next_entity();
} catch (const std::exception& e) {
Logger::Error(e);
logger::error(e);
had_error_processing_elements_ = true;
}
#ifdef IFOPSH_WITH_OPENCASCADE
catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString());
logger::error(e.GetMessageString());
} else {
Logger::Error("Unknown error creating geometry");
logger::error("Unknown error creating geometry");
}
had_error_processing_elements_ = true;
}
#endif
catch (...) {
Logger::Error("Unknown error creating geometry");
logger::error("Unknown error creating geometry");
had_error_processing_elements_ = true;
}
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("Offset applied (" + std::to_string(vec(0)) + "," + std::to_string(vec(1)) + "," + std::to_string(vec(2)) + ")");
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)) + ")");
return make<direction3>(vec);
}
+7 -7
View File
@@ -58,7 +58,7 @@
#ifndef IFCGEOMITERATOR_H
#define IFCGEOMITERATOR_H
#include "../ifcparse/IfcFile.h"
#include "../ifcparse/file.h"
#include "../ifcgeom/IfcGeomElement.h"
#include "../ifcgeom/ConversionResult.h"
@@ -130,7 +130,7 @@ namespace IfcGeom {
size_t async_elements_returned_ = 0;
ifcopenshell::geometry::Settings settings_;
IfcParse::IfcFile* ifc_file;
ifcopenshell::file* ifc_file;
std::vector<ifcopenshell::geometry::filter_t> filters_;
int num_threads_;
std::string geometry_library_;
@@ -217,7 +217,7 @@ namespace IfcGeom {
ifcopenshell::geometry::taxonomy::direction3::ptr remove_offset_();
public:
Iterator(std::unique_ptr<ifcopenshell::geometry::kernels::AbstractKernel>&& geometry_library, const ifcopenshell::geometry::Settings& settings, 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)
, ifc_file(file)
, 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)
, ifc_file(file)
, 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)
, ifc_file(file)
, num_threads_(num_threads)
@@ -309,9 +309,9 @@ namespace IfcGeom {
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_; }
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/algorithm/string/case_conv.hpp>
#include "../../ifcparse/IfcFile.h"
#include "../../ifcparse/file.h"
#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) \
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) \
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
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();
// @todo an ugly hack to guarantee schemas are initialised.
// @todo is this still needed? parsing a file should have initialized the schemas already.
try {
IfcParse::schema_by_name("IFC2X3");
} catch (IfcParse::IfcException&) {}
ifcopenshell::schema_by_name("IFC2X3");
} catch (ifcopenshell::exception&) {}
const std::string schema_name_lower = boost::to_lower_copy(schema_name.substr(3));
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
#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();
// @todo an ugly hack to guarantee schemas are initialised.
try {
IfcParse::schema_by_name("IFC2X3");
} catch (IfcParse::IfcException&) {}
ifcopenshell::schema_by_name("IFC2X3");
} catch (ifcopenshell::exception&) {}
const std::string schema_name_lower = boost::to_lower_copy(schema_name.substr(3));
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>
namespace IfcGeom {
IFC_GEOMSERIALIZATION_API express::Base tesselate(IfcParse::IfcFile& 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 tesselate(ifcopenshell::file& f, const TopoDS_Shape& shape, double deflection);
IFC_GEOMSERIALIZATION_API express::Base serialise(ifcopenshell::file& f, const TopoDS_Shape& shape, bool advanced);
} // namespace IfcGeom
@@ -23,32 +23,32 @@
#include <BRepTools.hxx>
#include "../../../ifcparse/macros.h"
#include "../../../ifcparse/IfcParse.h"
#include "../../../ifcparse/IfcFile.h"
#include "../../../ifcparse/parse.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)
#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 <numeric>
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.set_attribute_value(0, std::vector<double>{t.X(), t.Y(), t.Z()});
return 1;
}
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);
return convert_to_ifc(f, pnt, p, advanced);
}
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;
if (convert_to_ifc(f, v, p, advanced)) {
vertex = f.create<IfcSchema::IfcVertexPoint>();
@@ -60,7 +60,7 @@ int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Vertex& v, IfcSchema::IfcV
}
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::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))) {
@@ -112,7 +112,7 @@ namespace {
#endif
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)) {
Handle_Geom_TrimmedCurve trim = Handle_Geom_TrimmedCurve::DownCast(c);
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 <>
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)) {
Handle_Geom_Plane plane = Handle_Geom_Plane::DownCast(s);
IfcSchema::IfcAxis2Placement3D place;
@@ -403,7 +403,7 @@ int convert_to_ifc(IfcParse::IfcFile& f, const Handle_Geom_Surface& s, IfcSchema
}
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;
IfcSchema::IfcCurve base;
@@ -433,7 +433,7 @@ int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Edge& e, IfcSchema::IfcCur
}
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;
TopExp_Explorer exp(e, TopAbs_VERTEX);
@@ -505,7 +505,7 @@ namespace {
}
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;
for (TopExp_Explorer exp(wire, TopAbs_EDGE); exp.More(); exp.Next()) {
double a, b;
@@ -540,7 +540,7 @@ int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Wire& wire, IfcSchema::Ifc
BRepTools_WireExplorer exp(wire);
for (; exp.More(); exp.Next()) {
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)) {
double a, b;
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 <>
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);
TopExp_Explorer exp(fa, TopAbs_WIRE);
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>
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;
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());
}
for (auto& c : created) {
f.removeEntity(c);
f.remove_entity(c);
}
return 0;
}
@@ -637,7 +637,7 @@ int convert_to_ifc(IfcParse::IfcFile& f, const TopoDS_Shape& s, U& item, bool ad
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
advanced = false;
@@ -788,7 +788,7 @@ express::Base POSTFIX_SCHEMA(serialise)(IfcParse::IfcFile& f, const TopoDS_Shape
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
BRepMesh_IncrementalMesh(shape, deflection);
+2 -2
View File
@@ -20,7 +20,7 @@
#ifndef SERIALIZER_H
#define SERIALIZER_H
#include "../ifcparse/IfcFile.h"
#include "../ifcparse/file.h"
class Serializer {
public:
@@ -29,7 +29,7 @@ public:
virtual bool ready() = 0;
virtual void writeHeader() = 0;
virtual void finalize() = 0;
virtual void setFile(IfcParse::IfcFile*) = 0;
virtual void setFile(ifcopenshell::file*) = 0;
};
#endif
+3 -3
View File
@@ -1,6 +1,6 @@
#include "abstract_mapping.h"
#include "../ifcparse/IfcFile.h"
#include "../ifcparse/file.h"
#include <boost/preprocessor/stringize.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));
}
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());
std::map<std::string, ifcopenshell::geometry::impl::mapping_fn>::const_iterator it;
it = this->find(schema_name_lower);
if (it == end()) {
throw IfcParse::IfcException("No geometry mapping registered for " + schema_name_lower);
throw ifcopenshell::exception("No geometry mapping registered for " + schema_name_lower);
}
auto new_mapping = it->second(file, s);
new_mapping->initialize_settings();
+2 -2
View File
@@ -77,13 +77,13 @@ namespace geometry {
};
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> {
public:
MappingFactoryImplementation();
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();
+2 -2
View File
@@ -76,7 +76,7 @@ struct piecewise_fn_evaluator : public fn_evaluator {
span_start += fn->length();
}
Logger::Error("piecewise span not found.");
logger::error("piecewise span not found.");
return {0, 0, nullptr};
}
@@ -235,7 +235,7 @@ function_item_evaluator::function_item_evaluator(const ifcopenshell::geometry::S
} else if (kind == taxonomy::OFFSET_FUNCTION) {
fn_evaluator_ = new offset_fn_evaluator(std::dynamic_pointer_cast<const taxonomy::offset_function>(fn), settings);
} else {
Logger::Error("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 {
std::vector<std::unique_ptr<AbstractKernel>> kernels_;
ifcopenshell::geometry::abstract_mapping* mapping_;
IfcParse::IfcFile* file_;
ifcopenshell::file* file_;
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)
, kernels_(std::move(kernels))
, 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);
#ifdef IFOPSH_WITH_OPENCASCADE
@@ -193,7 +193,7 @@ namespace ifcopenshell {
if (geometry_library_lower.find("-", 0) == 0) {
geometry_library_lower = geometry_library_lower.substr(strlen("-"));
} else {
throw IfcParse::IfcException("Invalid hybrid kernel " + geometry_library);
throw ifcopenshell::exception("Invalid hybrid kernel " + geometry_library);
}
auto n = kernels.size();
#ifdef IFOPSH_WITH_OPENCASCADE
@@ -215,7 +215,7 @@ namespace ifcopenshell {
}
#endif
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 "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);
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;
}
@@ -130,7 +130,7 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
auto profile_b_f = std::static_pointer_cast<taxonomy::face>(profile_b);
if (profile_a_f->children.size() != profile_b_f->children.size()) {
Logger::Warning("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_b_f->children.size()),
inst
@@ -165,7 +165,7 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
// in which case we would need to lerp with the rotation component below in m4b.
interpolated_rotation = lerp(*rotation_a, *rotation_b, relative_dist_along);
} else if (rotation_a != rotation_b) {
Logger::Error("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;
@@ -176,12 +176,12 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
boost::tie(w1, w2) = tmp_;
if (w1->closed != w2->closed) {
Logger::Warning("Mismatching closed property on loops", inst);
logger::warning("Mismatching closed property on loops", inst);
return nullptr;
}
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;
}
@@ -190,7 +190,7 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
std::set<std::string> tags_seen;
for (const auto& t : *w1->tags) {
if (tags_seen.find(t) != tags_seen.end()) {
Logger::Warning("Duplicate tag '" + t + "' on loft profile", inst);
logger::warning("Duplicate tag '" + t + "' on loft profile", inst);
return nullptr;
}
tags_seen.insert(t);
@@ -202,7 +202,7 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
std::set<std::string> tags_seen;
for (const auto& t : *w2->tags) {
if (tags_seen.find(t) != tags_seen.end()) {
Logger::Warning("Duplicate tag '" + t + "' on loft profile", inst);
logger::warning("Duplicate tag '" + t + "' on loft profile", inst);
return nullptr;
}
tags_seen.insert(t);
@@ -303,20 +303,20 @@ taxonomy::loft::ptr ifcopenshell::geometry::make_loft(const Settings& settings_,
for (auto& p1_tags : w1_tags) {
if (!has_intersection(p1_tags, w2_tags_combined)) {
Logger::Warning("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;
}
}
for (auto& p2_tags : w2_tags) {
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;
}
}
} else {
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(w2->children.size()),
inst);
@@ -6,7 +6,7 @@
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
#include <CGAL/Polygon_mesh_processing/polygon_mesh_to_polygon_soup.h>
#include "../../../ifcparse/IfcLogger.h"
#include "../../../ifcparse/logger.h"
#include "../../../ifcgeom/IfcGeomRepresentation.h"
using IfcGeom::OpaqueNumber;
@@ -112,7 +112,7 @@ ifcopenshell::geometry::CgalShape::CgalShape(const cgal_shape_t& shape, bool con
auto b2 = plane.base2();
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);
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()) {
Logger::Warning("Removed face due to self-intersections");
logger::warning("Removed face due to self-intersections");
faces_to_remove.insert(face);
}
}
@@ -233,7 +233,7 @@ void ifcopenshell::geometry::CgalShape::Triangulate(ifcopenshell::geometry::Sett
if (!all_triangles) {
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;
}
@@ -241,19 +241,19 @@ void ifcopenshell::geometry::CgalShape::Triangulate(ifcopenshell::geometry::Sett
try {
success = CGAL::Polygon_mesh_processing::triangulate_faces(*shape_to_use);
} catch (...) {
Logger::Message(Logger::LOG_ERROR, "Triangulation crashed");
logger::message(logger::LOG_ERROR, "Triangulation crashed");
return;
}
CGAL::Polygon_mesh_processing::remove_degenerate_faces(*shape_to_use);
if (!success) {
Logger::Message(Logger::LOG_ERROR, "Triangulation failed");
logger::message(logger::LOG_ERROR, "Triangulation failed");
return;
}
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;
}
}
@@ -282,7 +282,7 @@ void ifcopenshell::geometry::CgalShape::Triangulate(ifcopenshell::geometry::Sett
try {
CGAL::Polygon_mesh_processing::compute_face_normals(*shape_to_use, face_normals_map);
} catch (...) {
Logger::Message(Logger::LOG_ERROR, "Face normal calculation failed");
logger::message(logger::LOG_ERROR, "Face normal calculation failed");
return;
}
@@ -296,7 +296,7 @@ void ifcopenshell::geometry::CgalShape::Triangulate(ifcopenshell::geometry::Sett
int num_faces = 0, num_vertices = 0;
for (auto &face : faces(*shape_to_use)) {
if (!face->is_triangle()) {
std::cout << "Warning: non-triangular face!" << std::endl;
std::cout << "warning: non-triangular face!" << std::endl;
continue;
}
CGAL::Polyhedron_3<Kernel_>::Halfedge_around_facet_const_circulator current_halfedge = face->facet_begin();
@@ -1,4 +1,4 @@
/********************************************************************************
/********************************************************************************
* *
* This file is part of IfcOpenShell. *
* *
+48 -48
View File
@@ -1,4 +1,4 @@
/********************************************************************************
/********************************************************************************
* *
* This file is part of IfcOpenShell. *
* *
@@ -21,7 +21,7 @@
#include "CgalKernel.h"
#include "../../../ifcparse/IfcLogger.h"
#include "../../../ifcparse/logger.h"
#include "../../../ifcgeom/kernels/cgal/CgalConversionResult.h"
#ifdef IFOPSH_SIMPLE_KERNEL
@@ -76,7 +76,7 @@ CGAL::Polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_polyhedron(std
polyhedron.normalize_border();
if (!polyhedron.is_valid(false, 1)) {
Logger::Message(Logger::LOG_ERROR, "create_polyhedron: Polyhedron not valid!");
logger::message(logger::LOG_ERROR, "create_polyhedron: Polyhedron not valid!");
// std::ofstream fresult;
// fresult.open("/Users/ken/Desktop/invalid.off");
// fresult << polyhedron << std::endl;
@@ -97,11 +97,11 @@ CGAL::Polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_polyhedron(con
nef_polyhedron.convert_to_polyhedron(polyhedron);
return polyhedron;
} 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_>();
}
} 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_>();
}
}
@@ -114,7 +114,7 @@ CGAL::Nef_polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_nef_polyhe
CGAL::Polygon_mesh_processing::reverse_face_orientations(polyhedron);
}
} catch (CGAL::Failure_exception& e) {
Logger::Message(Logger::LOG_ERROR, e);
logger::message(logger::LOG_ERROR, e);
}
}
CGAL::Polygon_mesh_processing::triangulate_faces(polyhedron);
@@ -122,7 +122,7 @@ CGAL::Nef_polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_nef_polyhe
try {
nef_polyhedron = CGAL::Nef_polyhedron_3<Kernel_>(polyhedron);
} catch (...) {
Logger::Message(Logger::LOG_ERROR, "Conversion to Nef polyhedron failed!");
logger::message(logger::LOG_ERROR, "Conversion to Nef polyhedron failed!");
}
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);
}
} 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 {
nef_polyhedron = CGAL::Nef_polyhedron_3<Kernel_>(polyhedron);
} catch (...) {
Logger::Message(Logger::LOG_ERROR, "Conversion to Nef polyhedron failed!");
logger::message(logger::LOG_ERROR, "Conversion to Nef polyhedron failed!");
}
return nef_polyhedron;
} 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_>();
}
}
@@ -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) {
for (auto& f : l->children) {
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();
}
for (auto& w : f->children) {
for (auto& e : w->children) {
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();
}
}
@@ -196,9 +196,9 @@ bool CgalKernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) {
double volume = diag(0) * diag(1) * diag(2);
// @todo volume van be zero also..
double density = num_points / volume;
Logger::Notice("Density " + boost::lexical_cast<std::string>(density), l->instance);
logger::notice("Density " + boost::lexical_cast<std::string>(density), l->instance);
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_> upper(minmax.second(0), minmax.second(1), minmax.second(2));
shape = utils::create_cube(lower, upper);
@@ -214,7 +214,7 @@ bool CgalKernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) {
} catch (...) {}
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;
}
@@ -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) {
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;
}
@@ -249,7 +249,7 @@ bool CgalKernel::convert(const taxonomy::face::ptr face, std::list<cgal_face_t>&
cgal_wire_t wire;
if (!convert(bound, wire)) {
Logger::Message(Logger::LOG_ERROR, "Failed to process face boundary loop", bound->instance);
logger::message(logger::LOG_ERROR, "Failed to process face boundary loop", bound->instance);
return false;
}
@@ -703,7 +703,7 @@ bool CgalKernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
if (d < 1.e-5) {
points.erase(points.end() - 1);
} else {
Logger::Warning("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
std::size_t original_count = polygon.size();
if (original_count < 3) {
Logger::Warning("Not enough edges for:", loop->instance);
logger::warning("Not enough edges for:", loop->instance);
return false;
}
@@ -728,14 +728,14 @@ bool CgalKernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
std::size_t count = polygon.size();
if (original_count - count != 0) {
std::stringstream ss; ss << (original_count - count) << " edges removed for:";
Logger::Warning(ss.str(), loop->instance);
logger::warning(ss.str(), loop->instance);
}
{
std::set<cgal_point_t> visited_points;
for (auto& p : polygon) {
if (visited_points.find(p) != visited_points.end()) {
Logger::Error("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 implement cycle detection using Arrangement_2, but that only works in exact kernel
return false;
@@ -757,7 +757,7 @@ bool CgalKernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
}
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;
}
@@ -785,7 +785,7 @@ bool CgalKernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
*/
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;
}
@@ -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) {
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;
}
cgal_shape_t shape;
@@ -964,7 +964,7 @@ bool ifcopenshell::geometry::kernels::CgalKernel::convert_openings(const express
try {
a.convert_to_polyhedron(a_poly);
} 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;
}
@@ -1163,7 +1163,7 @@ bool CgalKernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::dir
try {
nef_shape -= utils::create_nef_polyhedron(face_list);
} catch (...) {
Logger::Message(Logger::LOG_ERROR, "IfcExtrudedAreaSolid: cannot subtract opening for:");
logger::message(logger::LOG_ERROR, "IfcExtrudedAreaSolid: cannot subtract opening for:");
return false;
}
}
@@ -1180,7 +1180,7 @@ bool CgalKernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::dir
nef_shape.convert_to_polyhedron(shape);
return true;
} catch (...) {
Logger::Message(Logger::LOG_ERROR, "IfcExtrudedAreaSolid: cannot convert Nef to polyhedron for:");
logger::message(logger::LOG_ERROR, "IfcExtrudedAreaSolid: cannot convert Nef to polyhedron for:");
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) {
const double& height = extrusion->depth;
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;
}
@@ -1325,13 +1325,13 @@ bool CgalKernel::preprocess_boolean_operand(const express::Base& log_reference,
cgal_shape_t shape = shape_const;
if (!shape.is_valid()) {
Logger::Message(Logger::LOG_ERROR, "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;
}
if (!shape.is_closed()) {
// TODO: There can be substractions to remove parts of non-volumetric objects. Maybe iterate over all faces of an entity and put them in a Nef_polyhedron_3 through Boolean union? Highly inefficient but maybe desirable...
Logger::Message(Logger::LOG_ERROR, "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;
}
@@ -1340,18 +1340,18 @@ bool CgalKernel::preprocess_boolean_operand(const express::Base& log_reference,
try {
success = CGAL::Polygon_mesh_processing::triangulate_faces(shape);
} catch (CGAL::Failure_exception& e) {
Logger::Notice(e);
Logger::Message(Logger::LOG_ERROR, "Triangulation of geometry crashed:", log_reference);
logger::notice(e);
logger::message(logger::LOG_ERROR, "Triangulation of geometry crashed:", log_reference);
return false;
}
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;
}
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;
}
@@ -1423,8 +1423,8 @@ bool CgalKernel::preprocess_boolean_operand(const express::Base& log_reference,
try {
result = CGAL::Nef_polyhedron_3<Kernel_>(shape);
} catch (CGAL::Failure_exception& e) {
Logger::Notice(e);
Logger::Message(Logger::LOG_ERROR, "Could not convert geometry to Nef:", log_reference);
logger::notice(e);
logger::message(logger::LOG_ERROR, "Could not convert geometry to Nef:", log_reference);
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.
result = CGAL::minkowski_sum_3(result, precision_cube_);
} catch (CGAL::Failure_exception& e) {
Logger::Notice(e);
Logger::Message(Logger::LOG_ERROR, "Could not dilate boolean operand", log_reference);
logger::notice(e);
logger::message(logger::LOG_ERROR, "Could not dilate boolean operand", log_reference);
return false;
}
}
@@ -1522,8 +1522,8 @@ bool CgalKernel::preprocess_boolean_operand(const express::Base& log_reference,
cgal_shape_t convert_back;
result.convert_to_polyhedron(convert_back);
} catch (CGAL::Failure_exception& e) {
Logger::Notice(e);
Logger::Message(Logger::LOG_WARNING, "Final conversion will likely fail. Could not convert geometry from Nef:", log_reference);
logger::notice(e);
logger::message(logger::LOG_WARNING, "Final conversion will likely fail. Could not convert geometry from Nef:", log_reference);
}
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.
// 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;
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;
@@ -1980,7 +1980,7 @@ bool CgalKernel::convert_impl(const taxonomy::boolean_result::ptr br, Conversion
ps.push_back({ p.x(), p.y() });
}
if (!ps.is_simple()) {
Logger::Warning("Polygonal boundary not simple", face->children[0]->instance);
logger::warning("Polygonal boundary not simple", face->children[0]->instance);
continue;
}
@@ -2126,7 +2126,7 @@ bool CgalKernel::convert_impl(const taxonomy::boolean_result::ptr br, Conversion
try {
a.convert_to_polyhedron(a_poly);
} catch (...) {
Logger::Message(Logger::LOG_ERROR, "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;
}
@@ -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
// the Aff_transformation_3 stored in place to convert the 2d
// coords back to 3d.
Logger::Warning("Ignoring triangulated facet with novel point likely due to self-intersections");
logger::warning("Ignoring triangulated facet with novel point likely due to self-intersections");
facet_vertices.erase(facet_vertices.end() - 1);
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)) {
// @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::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 (reoriented) {
facet_indices_to_delete.push_back(fi);
Logger::Notice("Removed facet");
logger::notice("Removed facet");
valid = false;
break;
} else {
std::reverse(f.begin(), f.end());
Logger::Notice("Reversed facet");
logger::notice("Reversed facet");
reoriented = true;
goto check_edge_existence;
}
+1 -1
View File
@@ -1,4 +1,4 @@
/********************************************************************************
/********************************************************************************
* *
* This file is part of IfcOpenShell. *
* *
@@ -20,7 +20,7 @@
#ifndef IFCGEOMTREE_H
#define IFCGEOMTREE_H
#include "../../../ifcparse/IfcFile.h"
#include "../../../ifcparse/file.h"
#include "../../../ifcgeom/IfcGeomElement.h"
#include "../../../ifcgeom/Iterator.h"
@@ -1486,11 +1486,11 @@ namespace IfcGeom {
tree() {};
tree(IfcParse::IfcFile& f) {
tree(ifcopenshell::file& f) {
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);
}
@@ -1498,7 +1498,7 @@ namespace IfcGeom {
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;
settings_.get<ifcopenshell::geometry::settings::IteratorOutput>().value = ifcopenshell::geometry::settings::NATIVE;
settings_.get<ifcopenshell::geometry::settings::UseWorldCoords>().value = true;
@@ -1,4 +1,4 @@
#include <map>
#include <map>
#include <TopoDS.hxx>
#include <TopExp.hxx>
@@ -12,7 +12,7 @@
#include "OpenCascadeConversionResult.h"
#include "../../../ifcparse/IfcLogger.h"
#include "../../../ifcparse/logger.h"
#include "../../../ifcgeom/IfcGeomRepresentation.h"
#include "base_utils.h"
#include "boolean_utils.h"
@@ -87,7 +87,7 @@ void ifcopenshell::geometry::OpenCascadeShape::Triangulate(ifcopenshell::geometr
try {
BRepMesh_IncrementalMesh(shape_, settings.get<settings::MesherLinearDeflection>().get(), false, settings.get<settings::MesherAngularDeflection>().get());
} catch (...) {
Logger::Message(Logger::LOG_ERROR, "Failed to triangulate shape");
logger::message(logger::LOG_ERROR, "Failed to triangulate shape");
return;
}
}
@@ -113,7 +113,7 @@ void ifcopenshell::geometry::OpenCascadeShape::Triangulate(ifcopenshell::geometr
Handle_Poly_Triangulation tri = BRep_Tool::Triangulation(face, loc);
if (tri.IsNull()) {
Logger::Message(Logger::LOG_ERROR, "Triangulation missing for face");
logger::message(logger::LOG_ERROR, "Triangulation missing for face");
} else {
// Keep track of the number of times an edge is used
// Manifold edges (i.e. edges used twice) are deemed invisible
@@ -174,7 +174,7 @@ void ifcopenshell::geometry::OpenCascadeShape::Triangulate(ifcopenshell::geometr
else triangles(i).Get(n1, n2, n3);
if (dict[n1] == dict[n2] || dict[n2] == dict[n3] || dict[n3] == dict[n1]) {
Logger::Warning("Mesher generated a degenerate triangle, ignoring");
logger::warning("Mesher generated a degenerate triangle, ignoring");
continue;
}
@@ -619,7 +619,7 @@ namespace {
try {
BRepMesh_IncrementalMesh(s, tol);
} catch (...) {
Logger::Message(Logger::LOG_ERROR, "Failed to triangulate shape");
logger::message(logger::LOG_ERROR, "Failed to triangulate shape");
return;
}
meshed = true;
@@ -1,4 +1,4 @@
/********************************************************************************
/********************************************************************************
* *
* 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();
if (it3_shape.IsNull()) {
Logger::Error("Null operand");
logger::error("Null operand");
continue;
}
@@ -136,7 +136,7 @@ bool IfcGeom::OpenCascadeKernel::convert_openings(const express::Base& entity, c
bool is_manifold = util::is_manifold(entity_part);
if (!is_manifold) {
Logger::Warning("Non-manifold first operand");
logger::warning("Non-manifold first operand");
}
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();
// @todo
// 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;
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)) {
result = intermediate_result;
} 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;
@@ -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,
// unless --orient-shells was activated in which case we're already lost).
if (!is_manifold) {
Logger::Warning("Retrying boolean operation on individual faces");
logger::warning("Retrying boolean operation on individual faces");
}
continue;
}
@@ -378,7 +378,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// }
//
// 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) {
// 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();
// }
// } catch (const std::exception& e) {
// Logger::Error(e);
// logger::error(e);
// }
//
// 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);
// }
// } catch (const std::exception& e) {
// Logger::Error(e);
// logger::error(e);
// } catch (...) {
// Logger::Error("Failed to construct placement");
// logger::error("Failed to construct placement");
// }
//
// // Does the IfcElement have any IfcOpenings?
@@ -468,10 +468,10 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// try {
// convert_openings(product, openings, shapes, trsf, opened_shapes);
// } catch (const std::exception& e) {
// Logger::Message(Logger::LOG_ERROR, std::string("Error processing openings for: ") + e.what() + ":", product);
// logger::message(logger::LOG_ERROR, std::string("error processing openings for: ") + e.what() + ":", product);
// caught_error = true;
// } catch (...) {
// Logger::Message(Logger::LOG_ERROR, "Error processing openings for:", product);
// logger::message(logger::LOG_ERROR, "error processing openings for:", product);
// }
//
// 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)) {
// double diff = std::abs(a_calc - a_file);
// if (diff / std::sqrt(a_file) > getValue(GV_PRECISION)) {
// Logger::Error("Validation of surface area failed for:", product);
// logger::error("Validation of surface area failed for:", product);
// } else {
// Logger::Notice("Validation of surface area succeeded for:", product);
// logger::notice("Validation of surface area succeeded for:", product);
// }
// } 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") {
// 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)) {
// double diff = std::abs(v_calc - v_file);
// if (diff / std::sqrt(v_file) > getValue(GV_PRECISION)) {
// Logger::Error("Validation of volume failed for:", product);
// logger::error("Validation of volume failed for:", product);
// } else {
// Logger::Notice("Validation of volume succeeded for:", product);
// logger::notice("Validation of volume succeeded for:", product);
// }
// } 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") {
// 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) {
// Logger::Error("Validation of surface genus failed for:", product);
// logger::error("Validation of surface genus failed for:", product);
// } 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) {
// Logger::Error(e);
// } catch (const ifcopenshell::exception& e) {
// logger::error(e);
// // @todo reset representation_mapped_to to zero?
// }
// 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
// // 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();
//
// 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) {
// Logger::Warning("Multiple IfcProductDefinitionShapes for representation", representation);
// logger::warning("Multiple IfcProductDefinitionShapes for representation", representation);
// }
//
// if (maps->size() > 1) {
// Logger::Warning("Multiple IfcRepresentationMaps for representation", representation);
// logger::warning("Multiple IfcRepresentationMaps for representation", representation);
// }
//
// if (maps->size() == 1) {
@@ -654,13 +654,13 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// 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) {
// IfcSchema::IfcRepresentation* rep = *jt;
// if (rep->Items()->size() != 1) continue;
// IfcSchema::IfcProductRepresentation::list::ptr prodreps_mapped = rep->OfProductRepresentation();
// 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);
// }
// }
@@ -682,7 +682,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// parent_id = parent_object->data().id();
// }
// } catch (const std::exception& e) {
// Logger::Error(e);
// logger::error(e);
// }
//
// 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);
// }
// } catch (const std::exception& e) {
// Logger::Error(e);
// logger::error(e);
// } catch (...) {
// Logger::Error("Failed to construct placement");
// logger::error("Failed to construct placement");
// }
//
// 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.
// const double axis_length = own_axis_start.Distance(own_axis_end);
// if (length_required > axis_length) {
// Logger::Warning("The wall axis is not long enough to accommodate the fold points");
// logger::warning("The wall axis is not long enough to accommodate the fold points");
// return false;
// }
//
@@ -918,7 +918,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// gp_Trsf other;
// if (other_wall->ObjectPlacement()) {
// if (!convert(other_wall->ObjectPlacement(), other)) {
// Logger::Error("Failed to convert placement", other_wall);
// logger::error("Failed to convert placement", other_wall);
// 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");
//
// if (!axis_representation) {
// Logger::Warning("Joined wall has no axis representation", other_wall);
// logger::warning("Joined wall has no axis representation", other_wall);
// continue;
// }
//
@@ -1020,7 +1020,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// Vs1.Cross(Vs2);
//
// if (Vs1.IsNormal(Vc, 1.e-5)) {
// Logger::Warning("Connected walls are parallel");
// logger::warning("Connected walls are parallel");
// parallel = true;
// } else if (w < axis_u1 || w > axis_u2) {
// point_outside_param_range = p;
@@ -1167,7 +1167,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// return item;
// }
//
// bool IfcGeom::Kernel::is_identity_transform(IfcUtil::IfcBaseInterface* l) {
// bool IfcGeom::Kernel::is_identity_transform(ifcopenshell::IfcBaseInterface* l) {
// IfcSchema::IfcAxis2Placement2D* ax2d;
// IfcSchema::IfcAxis2Placement3D* ax3d;
//
@@ -1201,11 +1201,11 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
// convert(ax3d, trsf);
// return trsf.Form() == gp_Identity;
// } 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;
// }
//
@@ -1249,7 +1249,7 @@ bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, If
//
// #define Kernel POSTFIX_SCHEMA(Kernel)
//
// std::shared_ptr<const IfcGeom::SurfaceStyle> IfcGeom::Kernel::internalize_surface_style(const std::pair<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) {
// 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);
// reference_surface = new Geom_CylindricalSurface(axis_li->Position(), axis_line->Radius());
// } else {
// Logger::Message(Logger::LOG_ERROR, "Unsupported underlying curve of Axis representation:", product);
// logger::message(logger::LOG_ERROR, "Unsupported underlying curve of Axis representation:", product);
// return false;
// }
//
+14 -14
View File
@@ -1,6 +1,6 @@
#include "base_utils.h"
#include "../../../ifcparse/IfcLogger.h"
#include "../../../ifcparse/logger.h"
#include "OpenCascadeConversionResult.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;
} catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString());
logger::error(e.GetMessageString());
} else {
Logger::Error("Unknown error sewing shell");
logger::error("Unknown error sewing shell");
}
} catch (...) {
Logger::Error("Unknown error sewing shell");
logger::error("Unknown error sewing 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) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString());
logger::error(e.GetMessageString());
} else {
Logger::Error("Unknown error classifying solid");
logger::error("Unknown error classifying solid");
}
} catch (...) {
Logger::Error("Unknown error classifying solid");
logger::error("Unknown error classifying solid");
}
}
} catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString());
logger::error(e.GetMessageString());
} else {
Logger::Error("Unknown error creating solid");
logger::error("Unknown error creating solid");
}
} catch (...) {
Logger::Error("Unknown error creating solid");
logger::error("Unknown error creating solid");
}
if (complete_shape.IsNull()) {
@@ -771,7 +771,7 @@ bool IfcGeom::util::create_solid_from_faces(const TopTools_ListOfShape& face_lis
B.MakeCompound(C);
B.Add(C, complete_shape);
complete_shape = C;
Logger::Warning("Multiple components in IfcConnectedFaceSet");
logger::warning("Multiple components in IfcConnectedFaceSet");
}
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.Add(C, complete_shape);
complete_shape = C;
Logger::Warning("Loose faces in IfcConnectedFaceSet");
logger::warning("Loose faces in IfcConnectedFaceSet");
}
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;
} else {
Logger::Error("Failed to sew faceset");
logger::error("Failed to sew faceset");
}
return valid_shell;
@@ -898,7 +898,7 @@ bool IfcGeom::util::validate_shape(const TopoDS_Shape& s) {
dump(s);
Logger::Warning(str.str());
logger::warning(str.str());
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);
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 {
for (auto& r : cr) {
auto S = std::static_pointer_cast<OpenCascadeShape>(r.Shape())->shape();
if (S.IsNull()) {
Logger::Error("Null operand");
logger::error("Null operand");
continue;
}
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
// the working fuzziness might still be increased.
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;
} else {
S = result;
@@ -419,7 +419,7 @@ int IfcGeom::util::eliminate_narrow_operands(double prec, const TopTools_ListOfS
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) {
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) {
// Edge curves belonging to different operands intersect, don't process
// using builder.
Logger::Notice("Intersecting boundaries");
logger::notice("Intersecting boundaries");
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
// will likely cause problems.
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) {
// A wire is contained within another operand
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;
ss << "bool-" << std::this_thread::get_id() << "-" << (operation_counter_++);
debug_identifier = ss.str();
Logger::Notice("Boolean debug identifier: " + debug_identifier);
logger::notice("Boolean debug identifier: " + debug_identifier);
}
if (fuzziness < 0.) {
@@ -885,8 +885,8 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
a = unify(a_input, fuzziness * 1000.);
Logger::Message(
Logger::LOG_DEBUG,
logger::message(
logger::LOG_DEBUG,
"Simplified operand A from "s +
std::to_string(count(a_input, TopAbs_FACE)) +
" to "s +
@@ -897,8 +897,8 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
TopTools_ListIteratorOfListOfShape it(b_input);
for (; it.More(); it.Next()) {
b.Append(unify(it.Value(), fuzziness));
Logger::Message(
Logger::LOG_DEBUG,
logger::message(
logger::LOG_DEBUG,
"Simplified operand B from "s +
std::to_string(count(it.Value(), TopAbs_FACE)) +
" 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);
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);
}
}
@@ -936,7 +936,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
b_tmp.Clear();
auto N = eliminate_touching_operands(fuzziness, a, b, b_tmp);
if (N) {
Logger::Notice("Eliminated " + std::to_string(N) + " touching operands");
logger::notice("Eliminated " + std::to_string(N) + " touching operands");
std::swap(b, b_tmp);
}
}
@@ -947,7 +947,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
b_tmp.Clear();
auto N = eliminate_narrow_operands(fuzziness, b, b_tmp);
if (N) {
Logger::Notice("Eliminated " + std::to_string(N) + " narrow operands");
logger::notice("Eliminated " + std::to_string(N) + " narrow operands");
std::swap(b, b_tmp);
}
}
@@ -961,21 +961,21 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
}
if (b.Extent() == 0) {
Logger::Warning("No other operands remaining, using first operand");
logger::warning("No other operands remaining, using first operand");
result = a;
return true;
}
if (!is_2d && Logger::LOG_NOTICE >= Logger::Verbosity()) {
if (!is_2d && logger::LOG_NOTICE >= logger::verbosity()) {
PERF("preliminary manifoldness check");
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);
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);
Logger::Notice("Used fuzziness: " + std::to_string(fuzz));
logger::notice("Used fuzziness: " + std::to_string(fuzz));
const double new_fuzziness = fuzziness * 10.;
const bool allow_retry = new_fuzziness - 1e-15 <= settings.precision * 10000. && new_fuzziness < min_length_orig;
@@ -1049,7 +1049,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
}
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);
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) {
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.)) {
Logger::Notice("Operand B creates a through hole");
logger::notice("Operand B creates a through hole");
// Align b with a operand
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));
if (mp.IsDone()) {
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;
s1s.Clear();
s1s.Append(mp.Shape());
} else {
Logger::Notice("Processed fully in 2D");
logger::notice("Processed fully in 2D");
result = mp.Shape();
return true;
}
} else {
Logger::Notice("Failed to extrude 2D boolean result. Retrying in 3D.");
logger::notice("Failed to extrude 2D boolean result. Retrying in 3D.");
}
} else {
Logger::Notice("Failed to perform 2D boolean operation. Retrying in 3D.");
logger::notice("Failed to perform 2D boolean operation. Retrying in 3D.");
}
} 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 (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;
/*
@@ -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()) {
Logger::Notice("Builder reports bad positioning and result is empty");
logger::notice("Builder reports bad positioning and result is empty");
success = false;
} else {
TopoDS_Shape r = *builder;
@@ -1172,7 +1172,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
fix.Perform();
r = fix.Shape();
} 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;
if (!success) {
Logger::Notice("Boolean operation yields invalid result");
logger::notice("Boolean operation yields invalid result");
std::stringstream str;
bool any_emitted = false;
@@ -1213,7 +1213,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
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) {
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 {
// 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.
@@ -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" };
std::stringstream str;
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 {
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 (builder->HasError(STANDARD_TYPE(BOPAlgo_AlertBOPNotAllowed))) {
Logger::Error("Invalid operands. Using first operand");
logger::error("Invalid operands. Using first operand");
result = a;
success = true;
}
@@ -1411,14 +1411,14 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
#endif
std::string str_str = str.str();
if (str_str.size()) {
Logger::Notice(str_str);
logger::notice(str_str);
}
}
if (!success) {
if (allow_retry) {
return boolean_operation(settings, a, b, op, result, new_fuzziness);
} 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();
@@ -10,7 +10,7 @@ bool OpenCascadeKernel::convert(const taxonomy::extrusion::ptr extrusion, TopoDS
const double& height = extrusion->depth;
if (height < settings_.get<settings::Precision>().get()) {
Logger::Error("Non-positive extrusion height encountered for:", extrusion->instance);
logger::error("Non-positive extrusion height encountered for:", extrusion->instance);
return false;
}
@@ -24,7 +24,7 @@ bool OpenCascadeKernel::convert(const taxonomy::extrusion::ptr extrusion, TopoDS
// move the TopoDS_Shape, but obviously not both.
gp_GTrsf gtrsf;
if (!convert(&extrusion->matrix, gtrsf)) {
Logger::Error("Unable to move extrusion");
logger::error("Unable to move extrusion");
}
auto trsf = gtrsf.Trsf();
*/
+14 -14
View File
@@ -169,7 +169,7 @@ namespace {
} else if (crv_or_wire.index() == 2) {
// @todo
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);
#if OCC_VERSION_HEX < 0x70600
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
// is returned in that case.
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;
}
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;
}
@@ -315,11 +315,11 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
TopoDS_Wire wire;
if (faceset_helper_ && bound->is_polyhedron()) {
if (!faceset_helper_->wire(bound, wire)) {
Logger::Message(Logger::LOG_WARNING, "Face boundary loop not included", bound->instance);
logger::message(logger::LOG_WARNING, "Face boundary loop not included", bound->instance);
continue;
}
} 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;
}
@@ -336,7 +336,7 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
};
TopTools_ListOfShape results;
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);
}
@@ -347,7 +347,7 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
}
if (fd.wires().empty()) {
Logger::Warning("Face with no boundaries", face->instance);
logger::warning("Face with no boundaries", face->instance);
return false;
}
@@ -404,7 +404,7 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
if (fd.surface().IsNull()) {
// The set of wires is triangulated in case no surface can be found
Logger::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()) {
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);
std::string message = 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) {
face_list.Append(it.Value());
} else {
Logger::Error("Unsupported output from face healing");
logger::error("Unsupported output from face healing");
}
}
} else {
Logger::Error("Unsupported output from face healing");
logger::error("Unsupported output from face healing");
}
} else {
face_list.Append(f);
}
} else {
Logger::Error("Internal error in face creation");
logger::error("Internal error in face creation");
return false;
}
} else {
@@ -520,14 +520,14 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
delete[] c;
#if OCC_VERSION_MAJOR==7 && OCC_VERSION_MINOR >= 7
if (!reversed_surface && !fd.surface().IsNull() && fd.surface()->IsUPeriodic() && message == "Unknown message invoked with the keyword FixAdvFace.FixOrientation.MSG0") {
Logger::Notice("Detected reversed wire, reattempting with reversed basis surface");
logger::notice("Detected reversed wire, reattempting with reversed basis surface");
TopoDS_Face reversed_result;
convert(face, reversed_result, true);
result = reversed_result;
return true;
} else
#endif
Logger::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);
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;
@@ -199,7 +199,7 @@ IfcGeom::OpenCascadeKernel::faceset_helper::faceset_helper(
}
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::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;
wires = results;
} else {
+7 -7
View File
@@ -4,7 +4,7 @@
#include "base_utils.h"
#include "boolean_utils.h"
#include "../../../ifcparse/IfcLogger.h"
#include "../../../ifcparse/logger.h"
#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;
}
}
@@ -234,7 +234,7 @@ bool IfcGeom::util::apply_folded_layerset(const ConversionResults& items, const
if (s.ShapeType() == TopAbs_SHELL) {
shells.Append(TopoDS::Shell(s));
} else {
Logger::Error("Expected shell type in layerset processing");
logger::error("Expected shell type in layerset processing");
return false;
}
}
@@ -433,12 +433,12 @@ bool IfcGeom::util::split_solid_by_shell(const TopoDS_Shape& input, const TopoDS
}
} catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString());
logger::error(e.GetMessageString());
} else {
Logger::Error("Unknown error performing fixes");
logger::error("Unknown error performing fixes");
}
} catch (...) {
Logger::Error("Unknown error performing fixes");
logger::error("Unknown error performing fixes");
}
BRepCheck_Analyzer analyser(shape);
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]) {
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]) {
return false;
}
+1 -1
View File
@@ -122,7 +122,7 @@ bool OpenCascadeKernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& re
return true;
} else {
Logger::Error("Lofting more than two sections is not supported");
logger::error("Lofting more than two sections is not supported");
return false;
}
}
+5 -5
View File
@@ -129,7 +129,7 @@ namespace {
} else {
// @todo
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);
#if OCC_VERSION_HEX < 0x70600
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) {
TopTools_ListOfShape converted_segments;
@@ -283,7 +283,7 @@ bool OpenCascadeKernel::convert(const taxonomy::loop::ptr loop, TopoDS_Wire& wir
}
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;
}
@@ -296,7 +296,7 @@ bool OpenCascadeKernel::convert(const taxonomy::loop::ptr loop, TopoDS_Wire& wir
if (loop->instance && loop->instance.as<express::Entity>()) {
auto inst = loop->instance.as<express::Entity>();
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;
}
@@ -348,7 +348,7 @@ bool OpenCascadeKernel::convert(const taxonomy::loop::ptr loop, TopoDS_Wire& wir
if (ang < 0.0314) {
edges_to_tesselate.Add(crv1->DynamicType() == STANDARD_TYPE(Geom_Circle) ? edges.First() : edges.Last());
Logger::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 {
success = convert(face, occ_face);
} catch (const std::exception& e) {
Logger::Error(e);
logger::error(e);
} catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString());
logger::error(e.GetMessageString());
} else {
Logger::Error("Unknown error creating face");
logger::error("Unknown error creating face");
}
} catch (...) {
Logger::Error("Unknown error creating face");
logger::error("Unknown error creating face");
}
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;
}
@@ -71,7 +71,7 @@ bool OpenCascadeKernel::convert(const taxonomy::shell::ptr l, TopoDS_Shape& shap
if (face_area(triangle) > min_face_area) {
face_list.Append(triangle);
} else {
Logger::Message(Logger::LOG_WARNING, "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) {
face_list.Append(occ_face);
} 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");
}
} else {
Logger::Warning("Ignored shell", s->instance);
logger::warning("Ignored shell", s->instance);
}
}
if (!S.IsNull()) {
@@ -130,7 +130,7 @@ bool OpenCascadeKernel::convert(const taxonomy::sweep_along_curve::ptr scs, Topo
auto w = convert_curve(scs->curve);
if (w.index() != 2) {
Logger::Error("Unsupported directrix");
logger::error("Unsupported directrix");
return false;
}
TopoDS_Shape face_;
@@ -178,7 +178,7 @@ bool OpenCascadeKernel::convert(const taxonomy::sweep_along_curve::ptr scs, Topo
for (TopExp_Explorer exp(wire, TopAbs_VERTEX); exp.More(); exp.Next()) {
if (pln.Distance(BRep_Tool::Pnt(TopoDS::Vertex(exp.Current()))) > ALMOST_ZERO) {
directrix_on_plane = false;
Logger::Message(Logger::LOG_WARNING, "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;
}
}
@@ -21,7 +21,7 @@
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepOffsetAPI_MakePipeShell.hxx>
#include "../../../ifcparse/IfcLogger.h"
#include "../../../ifcparse/logger.h"
#include "base_utils.h"
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);
crv->D1(u0, directrix_origin, directrix_tangent);
} else {
Logger::Error("Unable to locate first edge");
logger::error("Unable to locate first edge");
return false;
}
@@ -187,7 +187,7 @@ void IfcGeom::util::sort_edges(const TopoDS_Wire & wire, std::vector<TopoDS_Edge
for (int i = 1; i <= map.Extent(); ++i) {
if (map.FindFromIndex(i).Extent() > 2) {
Logger::Warning("Self-intersecting Directrix");
logger::warning("Self-intersecting Directrix");
}
}
@@ -1,6 +1,6 @@
#include "wire_builder.h"
#include "../../../ifcparse/IfcLogger.h"
#include "../../../ifcparse/logger.h"
#include "../../../ifcgeom/ConversionSettings.h"
#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()) {
Logger::Error("No extrema for point");
logger::error("No extrema for point");
} 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 {
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_) {
mw_.Add(w1);
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;
}
@@ -199,28 +199,28 @@ void IfcGeom::util::wire_builder::operator()(const TopoDS_Shape& a, const TopoDS
// Preferably adjust the segment that is linear
if (is_line1 || (is_circle1 && !is_line2)) {
mw_.Add(adjust(w1, w12, p2));
Logger::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) {
mw_.Add(w1);
override_next_ = true;
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 {
// In all other cases an edge is added
mw_.Add(w1);
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 {
Logger::Error("Internal error, inconsistent wire segments", inst_);
logger::error("Internal error, inconsistent wire segments", inst_);
mw_.Add(w1);
}
}
check:
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) {
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 "../../../ifcparse/IfcLogger.h"
#include "../../../ifcparse/logger.h"
#include "../../../ifcgeom/ConversionSettings.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
// can't for assessing degenerativeness.
if (v.Magnitude() < 1.e-7) {
Logger::Warning("Degenerate face boundary in normal estimation");
logger::warning("Degenerate face boundary in normal estimation");
return false;
}
@@ -233,7 +233,7 @@ IfcGeom::util::triangulate_wire_result IfcGeom::util::triangulate_wire(const std
auto it = mapping.find(uvnodes[k]);
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;
}
@@ -277,7 +277,7 @@ IfcGeom::util::triangulate_wire_result IfcGeom::util::triangulate_wire(const std
}
faces.Append(triangle_face);
} else {
Logger::Error("Internal error: missing face");
logger::error("Internal error: missing face");
return TRIANGULATE_WIRE_FAIL;
}
}
@@ -308,7 +308,7 @@ IfcGeom::util::triangulate_wire_result IfcGeom::util::triangulate_wire(const std
if (!contains) {
#endif
// All existing edges need to exist in the new faces
Logger::Error("Internal error, missing edge from triangulation");
logger::error("Internal error, missing edge from triangulation");
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
// New edges are internal with use 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;
}
}
@@ -790,12 +790,12 @@ bool IfcGeom::util::fill_nonmanifold_wires_with_planar_faces(TopoDS_Shape& shape
shape = solid.SolidFromShell(TopoDS::Shell(shape));
} catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString());
logger::error(e.GetMessageString());
} else {
Logger::Error("Unknown error creating solid");
logger::error("Unknown error creating solid");
}
} catch (...) {
Logger::Error("Unknown error creating solid");
logger::error("Unknown error creating solid");
}
return true;
@@ -808,12 +808,12 @@ bool IfcGeom::util::convert_curve_to_wire(const Handle(Geom_Curve)& curve, TopoD
return true;
} catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString());
logger::error(e.GetMessageString());
} else {
Logger::Error("Unknown error converting curve to wire");
logger::error("Unknown error converting curve to wire");
}
} catch (...) {
Logger::Error("Unknown error converting curve to wire");
logger::error("Unknown error converting curve to wire");
}
return false;
}
@@ -834,7 +834,7 @@ void IfcGeom::util::assert_closed_wire(TopoDS_Wire& wire, double tol) {
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;
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);
}
@@ -875,7 +875,7 @@ bool IfcGeom::util::convert_wire_to_face(const TopoDS_Wire& w, TopoDS_Face& face
BRepBuilderAPI_FaceError er = mf.Error();
if (er != BRepBuilderAPI_FaceDone) {
Logger::Error("Failed to create face.");
logger::error("Failed to create face.");
return false;
}
face = mf.Face();
@@ -902,7 +902,7 @@ bool IfcGeom::util::convert_wire_to_faces(const TopoDS_Wire& w, TopoDS_Compound&
TopTools_ListOfShape results;
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 {
results.Clear();
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();
if (er != BRepBuilderAPI_FaceDone) {
Logger::Error("Failed to create face.");
logger::error("Failed to create face.");
continue;
}
@@ -945,9 +945,9 @@ bool IfcGeom::util::convert_wire_to_faces(const TopoDS_Wire& w, TopoDS_Compound&
if (p.first >= max_area / 10.) {
B.Add(faces, p.second);
} else {
Logger::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;
}
}
+1 -1
View File
@@ -28,7 +28,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis1Placement& inst) {
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst.Location()));
P = *v->components_;
} catch (const std::exception&) {
Logger::Warning("Placement with invalid Location:", inst);
logger::warning("Placement with invalid Location:", inst);
}
const bool hasAxis = inst.Axis();
if (hasAxis) {
+1 -1
View File
@@ -29,7 +29,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2Placement2D& inst) {
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst.Location()));
P = *v->components_;
} catch (const std::exception&) {
Logger::Warning("Placement with invalid Location:", inst);
logger::warning("Placement with invalid Location:", inst);
}
const bool hasRef = !!inst.RefDirection();
if (hasRef) {
+2 -2
View File
@@ -29,13 +29,13 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2Placement3D& inst) {
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst.Location()));
o = *v->components_;
} catch (const std::exception&) {
Logger::Warning("Placement with invalid Location:", inst);
logger::warning("Placement with invalid Location:", inst);
}
const bool hasAxis = !!inst.Axis();
const bool hasRef = !!inst.RefDirection();
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) {
@@ -26,7 +26,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2PlacementLinear& inst) {
if (!inst.Location().as<IfcSchema::IfcPointByDistanceExpression>()) {
Logger::Error(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;
@@ -45,7 +45,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2PlacementLinear& inst)
/*
if (hasAxis != hasRef) {
Logger::Warning("Axis and RefDirection should be specified together", inst);
logger::warning("Axis and RefDirection should be specified together", inst);
}
*/
+1 -1
View File
@@ -43,7 +43,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCShapeProfileDef& inst) {
const double tol = settings_.get<settings::Precision>().get();
if ( x < tol || y < tol || d1 < tol || d2 < tol) {
Logger::Message(Logger::LOG_NOTICE," Skipping zero sized profile:", inst);
logger::message(logger::LOG_NOTICE," Skipping zero sized profile:", inst);
return nullptr;
}
+1 -1
View File
@@ -24,7 +24,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCircle& inst) {
const double r = inst.Radius() * length_unit_;
if (r < settings_.get<settings::Precision>().get()) {
Logger::Message(Logger::LOG_ERROR, "Radius not greater than zero for:", inst);
logger::message(logger::LOG_ERROR, "Radius not greater than zero for:", inst);
return nullptr;
}
+10 -10
View File
@@ -34,11 +34,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve& inst) {
for (auto& segment : segments) {
if (segment.as<IfcSchema::IfcCompositeCurveSegment>() && segment.as<IfcSchema::IfcCompositeCurveSegment>().ParentCurve().as<IfcSchema::IfcLine>()) {
Logger::Notice("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 u1 = segment.as<IfcSchema::IfcCompositeCurveSegment>().ParentCurve().as<IfcSchema::IfcLine>().Dir().Magnitude() * length_unit_;
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>();
@@ -70,7 +70,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve& inst) {
e->end = 2.0 * boost::math::constants::pi<double>();
loop->children.push_back(e);
} else {
Logger::Warning("Unexpected segment type", segment);
logger::warning("Unexpected segment type", segment);
return nullptr;
}
}
@@ -95,7 +95,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve& inst) {
}
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();
loop->closed = force_close;
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) {
if (!(*it)->declaration().is(IfcSchema::IfcCompositeCurveSegment::Class())) {
Logger::Error("Not implemented", *it);
logger::error("Not implemented", *it);
return false;
}
@@ -141,13 +141,13 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
TopoDS_Wire segment;
if (curve->as<IfcSchema::IfcLine>()) {
Logger::Notice("Infinite IfcLine used as ParentCurve of segment, treating as a segment", *it);
logger::notice("Infinite IfcLine used as ParentCurve of segment, treating as a segment", *it);
Handle_Geom_Curve handle;
convert_curve(curve, handle);
double u0 = 0.0;
double u1 = curve->as<IfcSchema::IfcLine>()->Dir()->Magnitude() * length_unit_;
if (u1 < getValue(GV_PRECISION)) {
Logger::Warning("Segment length below tolerance", *it);
logger::warning("Segment length below tolerance", *it);
}
BRepBuilderAPI_MakeEdge me(handle, u0, u1);
if (me.IsDone()) {
@@ -157,7 +157,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
}
} else if (!convert_wire(curve, segment)) {
const bool failed_on_purpose = curve->as<IfcSchema::IfcPolyline>() && !segment.IsNull();
Logger::Message(failed_on_purpose ? Logger::LOG_WARNING : Logger::LOG_ERROR, "Failed to convert curve:", curve);
logger::message(failed_on_purpose ? logger::LOG_WARNING : logger::LOG_ERROR, "Failed to convert curve:", curve);
continue;
}
@@ -173,7 +173,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
}
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;
}
@@ -182,7 +182,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi
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;
util::wire_builder bld(getValue(GV_PRECISION), l);
+17 -17
View File
@@ -224,7 +224,7 @@ class curve_segment_evaluator {
}
}
} 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;
@@ -244,7 +244,7 @@ class curve_segment_evaluator {
if ((is_horizontal + is_vertical + is_cant) != 1) {
// We have to choose the correct functor based on usage. We can't
// support multiple, because we don't know the caller at this point.
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;
@@ -282,7 +282,7 @@ class curve_segment_evaluator {
end_point = segmented_reference_curve.EndPoint();
}
} 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) {
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() {
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());
@@ -444,13 +444,13 @@ class curve_segment_evaluator {
projected_length_ = length_;
}
} 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>(
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
);
} 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>(
[](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);
} 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>(
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
);
} 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>(
[](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);
} 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>(
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
} 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>(
[](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) {
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>(
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
} 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>(
[](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_);
} 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>(
[](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 coeffZ = pc.CoefficientsZ().value_or(std::vector<double>());
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) {
@@ -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);
x = result.first;
} catch (...) {
Logger::Warning("root solver failed");
logger::warning("root solver failed");
}
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
} 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>(
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
} 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>(
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
+2 -2
View File
@@ -25,14 +25,14 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEdge& inst) {
auto v1 = inst.EdgeStart().as<IfcSchema::IfcVertexPoint>();
auto v2 = inst.EdgeStart().as<IfcSchema::IfcVertexPoint>();
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;
}
auto pnt1 = v1.VertexGeometry();
auto pnt2 = v2.VertexGeometry();
if (!pnt1.declaration().is(IfcSchema::IfcCartesianPoint::Class()) || !pnt2.declaration().is(IfcSchema::IfcCartesianPoint::Class())) {
Logger::Message(Logger::LOG_ERROR, "Only IfcCartesianPoints are supported for VertexGeometry", inst);
logger::message(logger::LOG_ERROR, "Only IfcCartesianPoints are supported for VertexGeometry", inst);
return nullptr;
}
+1 -1
View File
@@ -26,7 +26,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEllipse& inst) {
double y = inst.SemiAxis2() * length_unit_;
const double tol = settings_.get<settings::Precision>().get();
if (x < tol || y < tol) {
Logger::Message(Logger::LOG_ERROR, "Radius not greater than zero for:", inst);
logger::message(logger::LOG_ERROR, "Radius not greater than zero for:", inst);
return nullptr;
}
+1 -1
View File
@@ -26,7 +26,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEllipseProfileDef& inst) {
double ry = inst.SemiAxis2() * length_unit_;
const double tol = settings_.get<settings::Precision>().get();
if (rx < tol || ry < tol) {
Logger::Message(Logger::LOG_ERROR, "Radius not greater than zero for:", inst);
logger::message(logger::LOG_ERROR, "Radius not greater than zero for:", inst);
return nullptr;
}
+1 -1
View File
@@ -27,7 +27,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcExtrudedAreaSolid& inst) {
const double height = inst.Depth() * length_unit_;
if (height < settings_.get<settings::Precision>().get()) {
Logger::Message(Logger::LOG_ERROR, "Non-positive extrusion height encountered for:", inst);
logger::message(logger::LOG_ERROR, "Non-positive extrusion height encountered for:", inst);
#ifndef PERMISSIVE_EXTRUSION
return nullptr;
#endif
@@ -27,7 +27,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcExtrudedAreaSolidTapered& inst) {
const double height = inst.Depth() * length_unit_;
if (height < settings_.get<settings::Precision>().get()) {
Logger::Message(Logger::LOG_ERROR, "Non-positive extrusion height encountered for:", inst);
logger::message(logger::LOG_ERROR, "Non-positive extrusion height encountered for:", inst);
return nullptr;
}
@@ -98,7 +98,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcFixedReferenceSweptAreaSolid
auto condition_number = svd.singularValues()(0)
/ svd.singularValues()(svd.singularValues().size() - 1);
if (condition_number > 1.e10) {
Logger::Error("Non-invertible matrix at " + std::to_string(distalong) + " conversion will likely fail.");
logger::error("Non-invertible matrix at " + std::to_string(distalong) + " conversion will likely fail.");
}
*/
}
+4 -4
View File
@@ -26,7 +26,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcGradientCurve& inst) {
if (!inst.BaseCurve().as<IfcSchema::IfcCompositeCurve>())
Logger::Warning("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();
@@ -41,11 +41,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcGradientCurve& inst) {
// for this reason, a dynamic cast is used and if crv is a function_item it is added to the span
spans.push_back(fi);
} else {
Logger::Error("Unsupported");
logger::error("Unsupported");
return nullptr;
}
} else {
Logger::Error("Unsupported");
logger::error("Unsupported");
return nullptr;
}
}
@@ -73,7 +73,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcGradientCurve& inst) {
// check to see if there is valid overlap of the horizontal and vertical domains
if (!(0 < gradient_function->length())) {
Logger::Error("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
}
+1 -1
View File
@@ -25,7 +25,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcHalfSpaceSolid& inst) {
auto surface = inst.BaseSurface();
auto plane = surface.as<IfcSchema::IfcPlane>();
if (!plane) {
Logger::Message(Logger::LOG_ERROR, "Unsupported BaseSurface:", surface);
logger::message(logger::LOG_ERROR, "Unsupported BaseSurface:", surface);
return nullptr;
}
auto p = taxonomy::make<taxonomy::plane>();
+1 -1
View File
@@ -80,7 +80,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIShapeProfileDef& inst) {
const double tol = settings_.get<settings::Precision>().get();
if (x1 < tol || x2 < tol || y < tol || d1 < tol || ft1 < tol || ft2 < tol) {
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
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;
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());
@@ -58,7 +58,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve& inst) {
taxonomy::point3::ptr previous;
for (std::vector<int>::const_iterator jt = indices.begin(); jt != indices.end(); ++jt) {
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];
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>()) {
std::vector<int> indices = arc;
if (indices.size() != 3) {
throw IfcParse::IfcException("Invalid IfcArcIndex encountered");
throw ifcopenshell::exception("Invalid IfcArcIndex encountered");
}
for (int i = 0; i < 3; ++i) {
const int& idx = indices[i];
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];
@@ -87,10 +87,10 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve& inst) {
e->basis = circ;
loop->children.push_back(e);
} else {
Logger::Warning("Ignoring segment on", inst);
logger::warning("Ignoring segment on", inst);
}
} 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()) {
+2 -2
View File
@@ -45,7 +45,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcLShapeProfileDef& inst) {
const double tol = settings_.get<settings::Precision>().get();
if ( x < tol || y < tol || d < tol) {
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
return nullptr;
}
@@ -77,7 +77,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcLShapeProfileDef& inst) {
const double det = a1*b2 - a2*b1;
if (std::fabs(det) < 1.e-5) {
Logger::Message(Logger::LOG_NOTICE, "Legs do not intersect for:", inst);
logger::message(logger::LOG_NOTICE, "Legs do not intersect for:", inst);
return nullptr;
}
+8 -8
View File
@@ -90,7 +90,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement& inst) {
if (fallback) {
auto mapped_fallback = taxonomy::cast<taxonomy::matrix4>(map(fallback));
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());
if (abs_det < 1.e-7) {
Logger::Warning("Ignoring singular matrix:", inst);
logger::warning("Ignoring singular matrix:", inst);
return nullptr;
}
@@ -122,7 +122,7 @@ if (gridp = inst.as<IfcSchema::IfcGridPlacement>()) {
convert(l->PlacementRelTo(), grid_position);
#else
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()) {
grid = *grids->begin();
if (grid->ObjectPlacement()) {
@@ -136,11 +136,11 @@ if (gridp = inst.as<IfcSchema::IfcGridPlacement>()) {
auto offsets = x->OffsetDistances();
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;
}
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;
}
auto first = *axes->begin();
@@ -171,7 +171,7 @@ if (gridp = inst.as<IfcSchema::IfcGridPlacement>()) {
gp_Pnt pp1, pp2;
ecc->Points(1, pp1, pp2);
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;
}
P = pp1;
@@ -202,7 +202,7 @@ if (gridp = inst.as<IfcSchema::IfcGridPlacement>()) {
if (V.Magnitude() > 1.e-9) {
D = V;
} 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;
}
}
@@ -215,7 +215,7 @@ if (gridp = inst.as<IfcSchema::IfcGridPlacement>()) {
if (V.Magnitude() > 1.e-9) {
D = V;
} 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;
}
}
@@ -33,7 +33,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst) {
auto offset_values = inst.OffsetValues();
if (offset_values.empty()) {
Logger::Error("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();
@@ -56,7 +56,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst
auto basis_curve_fn = taxonomy::dcast<taxonomy::function_item>(map(basis_curve));
if (!basis_curve_fn) {
// Only implement on alignment curves
Logger::Warning("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;
}
@@ -73,7 +73,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst
first_distance *= length_unit_;
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)
@@ -110,7 +110,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst
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;
}
@@ -32,7 +32,7 @@ const double PI = boost::math::constants::pi<double>();
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOpenCrossProfileDef& inst) {
if (inst.ProfileType() != IfcSchema::IfcProfileTypeEnum::IfcProfileType_CURVE) {
Logger::Warning("Expected IfcOpenCrossProfileDef.ProfileType to be CURVE", inst);
logger::warning("Expected IfcOpenCrossProfileDef.ProfileType to be CURVE", inst);
return nullptr;
}
@@ -56,7 +56,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOpenCrossProfileDef& inst) {
auto angles = inst.Slopes(); // these are actually angles, but the attribute is called Slopes
if (widths.size() != angles.size()) {
Logger::Warning("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;
}
+4 -4
View File
@@ -36,7 +36,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolyLoop& inst) {
// A loop should consist of at least three vertices
int original_count = polygon.size();
if (original_count < 3) {
Logger::Message(Logger::LOG_WARNING, "Not enough edges for:", inst);
logger::message(logger::LOG_WARNING, "Not enough edges for:", inst);
return nullptr;
}
@@ -45,17 +45,17 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolyLoop& inst) {
auto previous_size = polygon.size();
remove_duplicate_points_from_loop(polygon, true, eps);
if (polygon.size() != previous_size) {
Logger::Warning("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();
if (original_count - count != 0) {
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) {
Logger::Message(Logger::LOG_WARNING, "Not enough edges for:", inst);
logger::message(logger::LOG_WARNING, "Not enough edges for:", inst);
return nullptr;
}
+2 -2
View File
@@ -53,7 +53,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolygonalFaceSet& inst) {
taxonomy::point3::ptr previous;
for (std::vector<int>::const_iterator jt = indices.begin(); jt != indices.end(); ++jt) {
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];
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) {
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];
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();
remove_duplicate_points_from_loop(polygon, closed_by_proximity, eps);
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) {
// 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;
}
@@ -37,7 +37,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangleHollowProfileDef& i
const double tol = settings_.get<settings::Precision>().get();
if (x < tol || y < tol) {
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
return nullptr;
}
@@ -30,7 +30,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangleProfileDef& inst) {
const double tol = settings_.get<settings::Precision>().get();
if (x < tol || y < tol) {
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
return nullptr;
}
@@ -27,7 +27,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangularTrimmedSurface& i
/*
if (!inst.BasisSurface()->declaration().is(IfcSchema::IfcPlane::Class())) {
Logger::Message(Logger::LOG_ERROR, "Unsupported BasisSurface:", inst.BasisSurface());
logger::message(logger::LOG_ERROR, "Unsupported BasisSurface:", inst.BasisSurface());
return false;
}
gp_Pln pln;
+1 -1
View File
@@ -86,7 +86,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRevolvedAreaSolid& inst) {
}
if (intersecting) {
Logger::Warning("Warning Axis and SweptArea intersecting", l);
logger::warning("Warning Axis and SweptArea intersecting", l);
}
}
*/
@@ -31,7 +31,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRoundedRectangleProfileDef&
const double tol = settings_.get<settings::Precision>().get();
if (x < tol || y < tol) {
Logger::Message(Logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
logger::message(logger::LOG_NOTICE, "Skipping zero sized profile:", inst);
return nullptr;
}
@@ -34,7 +34,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSolidHorizontal& in
auto fn = taxonomy::dcast<taxonomy::function_item>(dir);
if (!fn) {
// Only implement on alignment curves
Logger::Warning("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;
}
@@ -91,11 +91,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSolidHorizontal& in
profile_rotations.push_back(rot);
}
if (faces.size() != profile_offsets.size()) {
Logger::Warning("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;
}
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;
}
+3 -3
View File
@@ -34,7 +34,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSurface& inst) {
auto fn = taxonomy::dcast<taxonomy::function_item>(dir);
if (!fn) {
// Only implement on alignment curves
Logger::Warning("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;
}
@@ -97,11 +97,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSurface& inst) {
return nullptr;
#endif
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;
}
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;
}
@@ -27,7 +27,7 @@ using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve& inst) {
if (!inst.BaseCurve().as<IfcSchema::IfcGradientCurve>())
Logger::Warning("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();
@@ -41,11 +41,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve& ins
// for this reason, a dynamic cast is used and if crv is a function_item it is added to the span
spans.push_back(fi);
} else {
Logger::Error("Unsupported");
logger::error("Unsupported");
return nullptr;
}
} else {
Logger::Error("Unsupported");
logger::error("Unsupported");
return nullptr;
}
}
@@ -67,7 +67,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve& ins
auto cant_function = taxonomy::make<taxonomy::cant_function>(gradient, cant, inst);
if (!(0 < cant_function->length())) {
Logger::Error("IfcSegmentedReferenceCurve does not have a common domain with BaseCurve");
logger::error("IfcSegmentedReferenceCurve does not have a common domain with BaseCurve");
cant_function = nullptr;
}
return cant_function;
@@ -49,11 +49,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSurfaceCurveSweptAreaSolid&
if (!is_plane) {
TopoDS_Shape surface_shell;
if (!convert_shape(inst.ReferenceSurface(), surface_shell)) {
Logger::Error("Failed to convert reference surface", l);
logger::error("Failed to convert reference surface", l);
return false;
}
if (util::count(surface_shell, TopAbs_FACE) != 1) {
Logger::Error("Non-continuous reference surface", l);
logger::error("Non-continuous reference surface", l);
return false;
}
surface_face = TopoDS::Face(TopExp_Explorer(surface_shell, TopAbs_FACE).Current());
@@ -76,7 +76,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSurfaceCurveSweptAreaSolid&
for (TopExp_Explorer exp(wire, TopAbs_VERTEX); exp.More(); exp.Next()) {
if (pln.Distance(BRep_Tool::Pnt(TopoDS::Vertex(exp.Current()))) > ALMOST_ZERO) {
directrix_on_plane = false;
Logger::Message(Logger::LOG_WARNING, "The Directrix does not lie on the ReferenceSurface", l);
logger::message(logger::LOG_WARNING, "The Directrix does not lie on the ReferenceSurface", l);
break;
}
}
+9 -9
View File
@@ -1,4 +1,4 @@
/********************************************************************************
/********************************************************************************
* *
* This file is part of IfcOpenShell. *
* *
@@ -61,8 +61,8 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
try {
sp = inst.StartParam();
ep = inst.EndParam();
} catch (const IfcParse::IfcException& e) {
Logger::Warning(e);
} catch (const ifcopenshell::exception& e) {
logger::warning(e);
}
#endif
@@ -241,19 +241,19 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
i += 1;
j += 1;
} else {
Logger::Error("Unexpected amount of fillet edges generated");
logger::error("Unexpected amount of fillet edges generated");
}
} else {
Logger::Error("Unable to build fillet, probably edge too short");
logger::error("Unable to build fillet, probably edge too short");
}
} else {
Logger::Error("Colinear edges, not applying fillet");
logger::error("Colinear edges, not applying fillet");
}
i++;
j++;
}
} else {
Logger::Error("Not enough edges for applying fillet");
logger::error("Not enough edges for applying fillet");
}
TopoDS_Wire new_wire;
@@ -266,7 +266,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
wire = new_wire;
} else {
Logger::Error("Directrix is not polyhedral, ignoring FilletRadius");
logger::error("Directrix is not polyhedral, ignoring FilletRadius");
}
}
@@ -317,7 +317,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
}
if (!is_valid) {
Logger::Message(Logger::LOG_WARNING, "Failed to subtract inner radius void for:", l);
logger::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();
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;
}
@@ -88,7 +88,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTShapeProfileDef& inst) {
const double det = a1*b2 - a2*b1;
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;
}
@@ -36,7 +36,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrapeziumProfileDef& inst) {
const double tol = settings_.get<settings::Precision>().get();
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;
}
@@ -52,7 +52,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTriangulatedFaceSet& inst) {
taxonomy::point3::ptr first, previous;
for (std::vector<int>::const_iterator jt = indices.begin(); jt != indices.end(); ++jt) {
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];
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;
if (trim_cartesian) {
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;
}
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
// is the only one.
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) {
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) {
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;
TopExp::Vertices(e, v0, v1);
if (v0.IsSame(v1)) {
Logger::Warning("Skipping degenerate segment", l);
logger::warning("Skipping degenerate segment", l);
return false;
}
}
@@ -168,7 +168,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve& inst) {
TopoDS_Vertex v0, v1;
TopExp::Vertices(e, v0, v1);
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();
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;
}
+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();
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;
}

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