Make occt optional

This commit is contained in:
Thomas Krijnen
2023-03-22 11:17:14 +01:00
parent cb35378a73
commit 2b1b79bf1c
28 changed files with 187 additions and 134 deletions
+4 -2
View File
@@ -170,12 +170,14 @@ endif()
if (NOT MINIMAL_BUILD) if (NOT MINIMAL_BUILD)
if (WITH_CGAL) if (WITH_CGAL)
add_definitions(-DIFOPSH_WITH_CGAL) add_definitions(-DIFOPSH_WITH_CGAL)
set(SWIG_DEFINES ${SWIG_DEFINES} -DIFOPSH_WITH_CGAL)
list(APPEND GEOMETRY_KERNELS cgal) list(APPEND GEOMETRY_KERNELS cgal)
endif() endif()
endif() endif()
if (WITH_OPENCASCADE) if (WITH_OPENCASCADE)
add_definitions(-DIFOPSH_WITH_OPENCASCADE) add_definitions(-DIFOPSH_WITH_OPENCASCADE)
set(SWIG_DEFINES ${SWIG_DEFINES} -DIFOPSH_WITH_OPENCASCADE)
list(APPEND GEOMETRY_KERNELS opencascade) list(APPEND GEOMETRY_KERNELS opencascade)
endif() endif()
@@ -859,7 +861,7 @@ set_target_properties(Serializers PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS $
TARGET_LINK_LIBRARIES(Serializers ${SERIALIZER_SCHEMA_LIBRARIES} ${OPENCOLLADA_LIBRARIES}) TARGET_LINK_LIBRARIES(Serializers ${SERIALIZER_SCHEMA_LIBRARIES} ${OPENCOLLADA_LIBRARIES})
endif(BUILD_CONVERT or BUILD_IFCPYTHON) endif()
if (BUILD_CONVERT) if (BUILD_CONVERT)
@@ -888,7 +890,7 @@ INSTALL(TARGETS IfcConvert
endif(BUILD_CONVERT) endif(BUILD_CONVERT)
# IfcGeomServer # IfcGeomServer
if(NOT MINIMAL_BUILD AND BUILD_GEOMSERVER) if(NOT MINIMAL_BUILD AND BUILD_GEOMSERVER AND WITH_OPENCASCADE)
file(GLOB CPP_FILES ../src/ifcgeomserver/*.cpp) file(GLOB CPP_FILES ../src/ifcgeomserver/*.cpp)
file(GLOB H_FILES ../src/ifcgeomserver/*.h) file(GLOB H_FILES ../src/ifcgeomserver/*.h)
+5
View File
@@ -21,6 +21,8 @@ ADD_EXECUTABLE(IfcParseExamples IfcParseExamples.cpp)
TARGET_LINK_LIBRARIES(IfcParseExamples IfcParse) TARGET_LINK_LIBRARIES(IfcParseExamples IfcParse)
set_target_properties(IfcParseExamples PROPERTIES FOLDER Examples) set_target_properties(IfcParseExamples PROPERTIES FOLDER Examples)
if (WITH_OPENCASCADE)
ADD_EXECUTABLE(IfcOpenHouse IfcOpenHouse.cpp) ADD_EXECUTABLE(IfcOpenHouse IfcOpenHouse.cpp)
TARGET_LINK_LIBRARIES(IfcOpenHouse ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES}) TARGET_LINK_LIBRARIES(IfcOpenHouse ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES})
set_target_properties(IfcOpenHouse PROPERTIES FOLDER Examples) set_target_properties(IfcOpenHouse PROPERTIES FOLDER Examples)
@@ -28,3 +30,6 @@ set_target_properties(IfcOpenHouse PROPERTIES FOLDER Examples)
ADD_EXECUTABLE(IfcAdvancedHouse IfcAdvancedHouse.cpp) ADD_EXECUTABLE(IfcAdvancedHouse IfcAdvancedHouse.cpp)
TARGET_LINK_LIBRARIES(IfcAdvancedHouse ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES}) TARGET_LINK_LIBRARIES(IfcAdvancedHouse ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES})
set_target_properties(IfcAdvancedHouse PROPERTIES FOLDER Examples) set_target_properties(IfcAdvancedHouse PROPERTIES FOLDER Examples)
endif()
+21 -7
View File
@@ -41,12 +41,16 @@
#include "../ifcparse/utils.h" #include "../ifcparse/utils.h"
#ifdef IFOPSH_WITH_OPENCASCADE
#include <Standard_Version.hxx> #include <Standard_Version.hxx>
#if OCC_VERSION_HEX < 0x60900 #if OCC_VERSION_HEX < 0x60900
#include <IGESControl_Controller.hxx> #include <IGESControl_Controller.hxx>
#endif #endif
#endif
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
@@ -54,6 +58,7 @@
#include <sstream> #include <sstream>
#include <set> #include <set>
#include <time.h> #include <time.h>
#include <iomanip>
#if USE_VLD #if USE_VLD
#include <vld.h> #include <vld.h>
@@ -86,7 +91,11 @@ namespace po = boost::program_options;
void print_version() void print_version()
{ {
cout_ << "IfcOpenShell IfcConvert " << IFCOPENSHELL_VERSION << " (OCC " << OCC_VERSION_STRING_EXT << ")\n"; cout_ << "IfcOpenShell IfcConvert " << IFCOPENSHELL_VERSION;
#ifdef IFOPSH_WITH_OPENCASCADE
cout_ << " (OCC " << OCC_VERSION_STRING_EXT << ")";
#endif
cout_ << "\n";
} }
void print_usage(bool suggest_help = true) void print_usage(bool suggest_help = true)
@@ -383,7 +392,9 @@ int main(int argc, char** argv) {
std::string section_ref, elevation_ref, elevation_ref_guid; std::string section_ref, elevation_ref, elevation_ref_guid;
// "none", "full" or "left" // "none", "full" or "left"
std::string storey_height_display; std::string storey_height_display;
#ifdef IFOPSH_WITH_OPENCASCADE
SvgSerializer::storey_height_display_types svg_storey_height_display = SvgSerializer::SH_NONE; SvgSerializer::storey_height_display_types svg_storey_height_display = SvgSerializer::SH_NONE;
#endif
po::options_description serializer_options("Serialization options"); po::options_description serializer_options("Serialization options");
serializer_options.add_options() serializer_options.add_options()
@@ -549,6 +560,7 @@ int main(int argc, char** argv) {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
#ifdef IFOPSH_WITH_OPENCASCADE
if (vmap.count("draw-storey-heights")) { if (vmap.count("draw-storey-heights")) {
boost::to_lower(storey_height_display); boost::to_lower(storey_height_display);
@@ -564,6 +576,7 @@ int main(int argc, char** argv) {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
} }
#endif
if (vmap.count("log-format") == 1) { if (vmap.count("log-format") == 1) {
boost::to_lower(log_format); boost::to_lower(log_format);
@@ -861,6 +874,7 @@ int main(int argc, char** argv) {
} else if (output_extension == GLB) { } else if (output_extension == GLB) {
serializer = boost::make_shared<GltfSerializer>(IfcUtil::path::to_utf8(output_temp_filename), settings); serializer = boost::make_shared<GltfSerializer>(IfcUtil::path::to_utf8(output_temp_filename), settings);
#endif #endif
#ifdef IFOPSH_WITH_OPENCASCADE
} else if (output_extension == STP) { } else if (output_extension == STP) {
serializer = boost::make_shared<StepSerializer>(IfcUtil::path::to_utf8(output_temp_filename), settings); serializer = boost::make_shared<StepSerializer>(IfcUtil::path::to_utf8(output_temp_filename), settings);
} else if (output_extension == IGS) { } else if (output_extension == IGS) {
@@ -872,15 +886,13 @@ int main(int argc, char** argv) {
} else if (output_extension == SVG) { } else if (output_extension == SVG) {
settings.set(IfcGeom::IteratorSettings::DISABLE_TRIANGULATION, true); settings.set(IfcGeom::IteratorSettings::DISABLE_TRIANGULATION, true);
serializer = boost::make_shared<SvgSerializer>(IfcUtil::path::to_utf8(output_temp_filename), settings); serializer = boost::make_shared<SvgSerializer>(IfcUtil::path::to_utf8(output_temp_filename), settings);
}
#ifdef WITH_HDF5 #ifdef WITH_HDF5
else if (output_extension == HDF) { } else if (output_extension == HDF) {
settings.set(IfcGeom::IteratorSettings::DISABLE_TRIANGULATION, true); settings.set(IfcGeom::IteratorSettings::DISABLE_TRIANGULATION, true);
serializer = boost::make_shared<HdfSerializer>(IfcUtil::path::to_utf8(output_temp_filename), settings); serializer = boost::make_shared<HdfSerializer>(IfcUtil::path::to_utf8(output_temp_filename), settings);
}
#endif #endif
#endif
else { } else {
cerr_ << "[Error] Unknown output filename extension '" << output_extension << "'\n"; cerr_ << "[Error] Unknown output filename extension '" << output_extension << "'\n";
write_log(!quiet); write_log(!quiet);
print_usage(); print_usage();
@@ -1003,7 +1015,7 @@ int main(int argc, char** argv) {
IfcGeom::Iterator context_iterator(geometry_kernel, settings, ifc_file, filter_funcs, num_threads); IfcGeom::Iterator context_iterator(geometry_kernel, settings, ifc_file, filter_funcs, num_threads);
#ifdef WITH_HDF5 #if defined(WITH_HDF5) && defined(IFOPSH_WITH_OPENCASCADE)
std::unique_ptr<HdfSerializer> cache; std::unique_ptr<HdfSerializer> cache;
if (vmap.count("cache-file") || vmap.count("cache")) { if (vmap.count("cache-file") || vmap.count("cache")) {
if (!vmap.count("cache-file")) { if (!vmap.count("cache-file")) {
@@ -1028,6 +1040,7 @@ int main(int argc, char** argv) {
serializer->setFile(context_iterator.file()); serializer->setFile(context_iterator.file());
#ifdef IFOPSH_WITH_OPENCASCADE
if (output_extension == SVG) { if (output_extension == SVG) {
if (vmap.count("section-height-from-storeys") != 0) { if (vmap.count("section-height-from-storeys") != 0) {
if (vmap.count("section-height")) { if (vmap.count("section-height")) {
@@ -1099,6 +1112,7 @@ int main(int argc, char** argv) {
); );
} }
} }
#endif
if (convert_back_units) { if (convert_back_units) {
serializer->setUnitNameAndMagnitude(context_iterator.unit_name(), static_cast<float>(context_iterator.unit_magnitude())); serializer->setUnitNameAndMagnitude(context_iterator.unit_name(), static_cast<float>(context_iterator.unit_magnitude()));
+3
View File
@@ -1,6 +1,7 @@
#include "AbstractKernel.h" #include "AbstractKernel.h"
#include "../ifcgeom/IfcGeomElement.h" #include "../ifcgeom/IfcGeomElement.h"
#include "../ifcgeom/ConversionSettings.h"
#ifdef IFOPSH_WITH_OPENCASCADE #ifdef IFOPSH_WITH_OPENCASCADE
#include "../ifcgeom/kernels/opencascade/OpenCascadeKernel.h" #include "../ifcgeom/kernels/opencascade/OpenCascadeKernel.h"
@@ -11,6 +12,8 @@
#include "../ifcgeom/kernels/cgal/CgalKernel.h" #include "../ifcgeom/kernels/cgal/CgalKernel.h"
#endif #endif
using namespace ifcopenshell::geometry;
bool ifcopenshell::geometry::kernels::AbstractKernel::convert(const taxonomy::item* item, IfcGeom::ConversionResults& results) { bool ifcopenshell::geometry::kernels::AbstractKernel::convert(const taxonomy::item* item, IfcGeom::ConversionResults& results) {
// std::stringstream ss; // std::stringstream ss;
// item->print(ss); // item->print(ss);
-3
View File
@@ -24,9 +24,6 @@
#include "../ifcgeom/IteratorSettings.h" #include "../ifcgeom/IteratorSettings.h"
#include "../ifcgeom/taxonomy.h" #include "../ifcgeom/taxonomy.h"
#include <gp_GTrsf.hxx>
#include <TopoDS_Shape.hxx>
#include <vector> #include <vector>
namespace IfcGeom { namespace IfcGeom {
-2
View File
@@ -45,8 +45,6 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
} }
if (settings_.get(IfcGeom::IteratorSettings::APPLY_LAYERSETS)) { if (settings_.get(IfcGeom::IteratorSettings::APPLY_LAYERSETS)) {
TopoDS_Shape merge;
ifcopenshell::geometry::layerset_information layerinfo; ifcopenshell::geometry::layerset_information layerinfo;
std::vector<ifcopenshell::geometry::endpoint_connection> neighbours; std::vector<ifcopenshell::geometry::endpoint_connection> neighbours;
std::map<IfcUtil::IfcBaseEntity*, ifcopenshell::geometry::layerset_information> neigbour_layers; std::map<IfcUtil::IfcBaseEntity*, ifcopenshell::geometry::layerset_information> neigbour_layers;
+99 -78
View File
@@ -19,6 +19,11 @@
#include "IfcGeomRepresentation.h" #include "IfcGeomRepresentation.h"
#ifdef IFOPSH_WITH_OPENCASCADE
#include "../ifcparse/IfcLogger.h"
#include "../ifcgeom/kernels/opencascade/OpenCascadeConversionResult.h"
#include "../ifcgeom/kernels/opencascade/base_utils.h"
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <BRepTools.hxx> #include <BRepTools.hxx>
#include <BRep_Builder.hxx> #include <BRep_Builder.hxx>
@@ -28,49 +33,6 @@
#include <GProp_GProps.hxx> #include <GProp_GProps.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include "../ifcparse/IfcLogger.h"
#include "../ifcgeom/kernels/opencascade/OpenCascadeConversionResult.h"
#include "../ifcgeom/kernels/opencascade/base_utils.h"
IfcGeom::Representation::Serialization::Serialization(const BRep& brep)
: Representation(brep.settings())
, id_(brep.id())
{
ConversionResultShape* shape = brep.as_compound();
TopoDS_Compound compound = TopoDS::Compound(((ifcopenshell::geometry::OpenCascadeShape*)shape)->shape());
delete shape;
for (auto it = brep.begin(); it != brep.end(); ++it) {
int sid = -1;
if (it->hasStyle()) {
const auto& clr = it->Style().diffuse.ccomponents();
surface_styles_.push_back(clr(0));
surface_styles_.push_back(clr(1));
surface_styles_.push_back(clr(2));
sid = it->Style().instance ? it->Style().instance->data().id() : -1;
} else {
surface_styles_.push_back(-1.);
surface_styles_.push_back(-1.);
surface_styles_.push_back(-1.);
}
if (it->hasStyle() && it->Style().has_transparency()) {
surface_styles_.push_back(1. - it->Style().transparency);
} else {
surface_styles_.push_back(1.);
}
surface_style_ids_.push_back(sid);
}
std::stringstream sstream;
BRepTools::Write(compound,sstream);
brep_data_ = sstream.str();
}
// todo copied from kernel
#include <BRepBuilderAPI_Transform.hxx> #include <BRepBuilderAPI_Transform.hxx>
#include <BRepBuilderAPI_GTransform.hxx> #include <BRepBuilderAPI_GTransform.hxx>
@@ -95,41 +57,6 @@ TopoDS_Shape apply_transformation(const TopoDS_Shape& s, const gp_GTrsf& t) {
} }
} }
IfcGeom::ConversionResultShape* IfcGeom::Representation::BRep::as_compound(bool force_meters) const {
TopoDS_Compound compound;
BRep_Builder builder;
builder.MakeCompound(compound);
for (auto it = begin(); it != end(); ++it) {
const TopoDS_Shape& s = *(ifcopenshell::geometry::OpenCascadeShape*)it->Shape();
// @todo, check
gp_GTrsf trsf;
if (it->Placement().components_) {
gp_Trsf tr;
const auto& m = it->Placement().ccomponents();
tr.SetValues(
m(0, 0), m(0, 1), m(0, 2), m(0, 3),
m(1, 0), m(1, 1), m(1, 2), m(1, 3),
m(2, 0), m(2, 1), m(2, 2), m(2, 3)
);
trsf = tr;
}
if (!force_meters && settings().get(IteratorSettings::CONVERT_BACK_UNITS)) {
gp_Trsf scale;
scale.SetScaleFactor(1.0 / settings().unit_magnitude());
trsf.PreMultiply(scale);
}
const TopoDS_Shape moved_shape = apply_transformation(s, trsf);
builder.Add(compound, moved_shape);
}
return new ifcopenshell::geometry::OpenCascadeShape(compound);
}
namespace { namespace {
void accumulate(const gp_Ax3& ax, const gp_Dir& normal, double area, double& along_x, double& along_y, double& along_z) { void accumulate(const gp_Ax3& ax, const gp_Dir& normal, double area, double& along_x, double& along_y, double& along_z) {
along_x += area * fabs(ax.XDirection().Dot(normal)); along_x += area * fabs(ax.XDirection().Dot(normal));
@@ -212,8 +139,91 @@ namespace {
} }
} }
} }
#endif
IfcGeom::Representation::Serialization::Serialization(const BRep& brep)
: Representation(brep.settings())
, id_(brep.id())
{
#ifdef IFOPSH_WITH_OPENCASCADE
ConversionResultShape* shape = brep.as_compound();
TopoDS_Compound compound = TopoDS::Compound(((ifcopenshell::geometry::OpenCascadeShape*)shape)->shape());
delete shape;
for (auto it = brep.begin(); it != brep.end(); ++it) {
int sid = -1;
if (it->hasStyle()) {
const auto& clr = it->Style().diffuse.ccomponents();
surface_styles_.push_back(clr(0));
surface_styles_.push_back(clr(1));
surface_styles_.push_back(clr(2));
sid = it->Style().instance ? it->Style().instance->data().id() : -1;
} else {
surface_styles_.push_back(-1.);
surface_styles_.push_back(-1.);
surface_styles_.push_back(-1.);
}
if (it->hasStyle() && it->Style().has_transparency()) {
surface_styles_.push_back(1. - it->Style().transparency);
} else {
surface_styles_.push_back(1.);
}
surface_style_ids_.push_back(sid);
}
std::stringstream sstream;
BRepTools::Write(compound,sstream);
brep_data_ = sstream.str();
#else
throw std::runtime_error("Not available without Open Cascade");
#endif
}
IfcGeom::ConversionResultShape* IfcGeom::Representation::BRep::as_compound(bool force_meters) const {
#ifdef IFOPSH_WITH_OPENCASCADE
TopoDS_Compound compound;
BRep_Builder builder;
builder.MakeCompound(compound);
for (auto it = begin(); it != end(); ++it) {
const TopoDS_Shape& s = *(ifcopenshell::geometry::OpenCascadeShape*)it->Shape();
// @todo, check
gp_GTrsf trsf;
if (it->Placement().components_) {
gp_Trsf tr;
const auto& m = it->Placement().ccomponents();
tr.SetValues(
m(0, 0), m(0, 1), m(0, 2), m(0, 3),
m(1, 0), m(1, 1), m(1, 2), m(1, 3),
m(2, 0), m(2, 1), m(2, 2), m(2, 3)
);
trsf = tr;
}
if (!force_meters && settings().get(IteratorSettings::CONVERT_BACK_UNITS)) {
gp_Trsf scale;
scale.SetScaleFactor(1.0 / settings().unit_magnitude());
trsf.PreMultiply(scale);
}
const TopoDS_Shape moved_shape = apply_transformation(s, trsf);
builder.Add(compound, moved_shape);
}
return new ifcopenshell::geometry::OpenCascadeShape(compound);
#else
throw std::runtime_error("Not available without Open Cascade");
#endif
}
bool IfcGeom::Representation::BRep::calculate_surface_area(double& area) const { bool IfcGeom::Representation::BRep::calculate_surface_area(double& area) const {
#ifdef IFOPSH_WITH_OPENCASCADE
try { try {
area = 0.; area = 0.;
@@ -228,9 +238,13 @@ bool IfcGeom::Representation::BRep::calculate_surface_area(double& area) const {
Logger::Error("Error during calculation of surface area"); Logger::Error("Error during calculation of surface area");
return false; return false;
} }
#else
throw std::runtime_error("Not available without Open Cascade");
#endif
} }
bool IfcGeom::Representation::BRep::calculate_volume(double& volume) const { bool IfcGeom::Representation::BRep::calculate_volume(double& volume) const {
#ifdef IFOPSH_WITH_OPENCASCADE
try { try {
volume = 0.; volume = 0.;
@@ -249,9 +263,13 @@ bool IfcGeom::Representation::BRep::calculate_volume(double& volume) const {
Logger::Error("Error during calculation of volume"); Logger::Error("Error during calculation of volume");
return false; return false;
} }
#else
throw std::runtime_error("Not available without Open Cascade");
#endif
} }
bool IfcGeom::Representation::BRep::calculate_projected_surface_area(const ifcopenshell::geometry::taxonomy::matrix4& place, double & along_x, double & along_y, double & along_z) const { bool IfcGeom::Representation::BRep::calculate_projected_surface_area(const ifcopenshell::geometry::taxonomy::matrix4& place, double & along_x, double & along_y, double & along_z) const {
#ifdef IFOPSH_WITH_OPENCASCADE
try { try {
gp_GTrsf trsf; gp_GTrsf trsf;
@@ -291,6 +309,9 @@ bool IfcGeom::Representation::BRep::calculate_projected_surface_area(const ifcop
Logger::Error("Error during calculation of projected surface area"); Logger::Error("Error during calculation of projected surface area");
return false; return false;
} }
#else
throw std::runtime_error("Not available without Open Cascade");
#endif
} }
IfcGeom::Representation::Triangulation::Triangulation(const BRep& shape_model) IfcGeom::Representation::Triangulation::Triangulation(const BRep& shape_model)
+12 -4
View File
@@ -681,13 +681,17 @@ namespace IfcGeom {
m4 = ((taxonomy::geom_item*) converter_->mapping()->map(ifc_product))->matrix; m4 = ((taxonomy::geom_item*) converter_->mapping()->map(ifc_product))->matrix;
} catch (const std::exception& e) { } catch (const std::exception& e) {
Logger::Error(e); Logger::Error(e);
} catch (const Standard_Failure& e) { }
#ifdef IFOPSH_WITH_OPENCASCADE
catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) { if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString()); Logger::Error(e.GetMessageString());
} else { } else {
Logger::Error("Unknown error returning product"); Logger::Error("Unknown error returning product");
} }
} catch (...) { }
#endif
catch (...) {
Logger::Error("Unknown error returning product"); Logger::Error("Unknown error returning product");
} }
@@ -703,13 +707,17 @@ namespace IfcGeom {
product = create_shape_model_for_next_entity(); product = create_shape_model_for_next_entity();
} catch (const std::exception& e) { } catch (const std::exception& e) {
Logger::Error(e); Logger::Error(e);
} catch (const Standard_Failure& e) { }
#ifdef IFOPSH_WITH_OPENCASCADE
catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) { if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error(e.GetMessageString()); Logger::Error(e.GetMessageString());
} else { } else {
Logger::Error("Unknown error creating geometry"); Logger::Error("Unknown error creating geometry");
} }
} catch (...) { }
#endif
catch (...) {
Logger::Error("Unknown error creating geometry"); Logger::Error("Unknown error creating geometry");
} }
return product; return product;
@@ -17,10 +17,6 @@
* * * *
********************************************************************************/ ********************************************************************************/
#include <BRepBuilderAPI_MakeFace.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Face.hxx>
#include <ShapeFix_Shape.hxx>
#include "mapping.h" #include "mapping.h"
#define mapping POSTFIX_SCHEMA(mapping) #define mapping POSTFIX_SCHEMA(mapping)
@@ -17,8 +17,6 @@
* * * *
********************************************************************************/ ********************************************************************************/
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include "mapping.h" #include "mapping.h"
#define mapping POSTFIX_SCHEMA(mapping) #define mapping POSTFIX_SCHEMA(mapping)
@@ -17,12 +17,6 @@
* * * *
********************************************************************************/ ********************************************************************************/
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Dir2d.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_Ax2d.hxx>
#include "mapping.h" #include "mapping.h"
#define mapping POSTFIX_SCHEMA(mapping) #define mapping POSTFIX_SCHEMA(mapping)
@@ -17,11 +17,6 @@
* * * *
********************************************************************************/ ********************************************************************************/
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Dir.hxx>
#include <gp_Trsf.hxx>
#include <gp_Ax3.hxx>
#include "mapping.h" #include "mapping.h"
#define mapping POSTFIX_SCHEMA(mapping) #define mapping POSTFIX_SCHEMA(mapping)
-2
View File
@@ -17,8 +17,6 @@
* * * *
********************************************************************************/ ********************************************************************************/
#include <gp_Trsf.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include "mapping.h" #include "mapping.h"
#define mapping POSTFIX_SCHEMA(mapping) #define mapping POSTFIX_SCHEMA(mapping)
-2
View File
@@ -17,8 +17,6 @@
* * * *
********************************************************************************/ ********************************************************************************/
#include <TopoDS_Wire.hxx>
#include <Standard_Version.hxx>
#include "mapping.h" #include "mapping.h"
#define mapping POSTFIX_SCHEMA(mapping) #define mapping POSTFIX_SCHEMA(mapping)
-2
View File
@@ -17,8 +17,6 @@
* * * *
********************************************************************************/ ********************************************************************************/
#include <gp_Pnt.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include "mapping.h" #include "mapping.h"
#define mapping POSTFIX_SCHEMA(mapping) #define mapping POSTFIX_SCHEMA(mapping)
@@ -17,11 +17,6 @@
* * * *
********************************************************************************/ ********************************************************************************/
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <gp_Trsf.hxx>
#include <gp_Ax3.hxx>
#include "mapping.h" #include "mapping.h"
#define mapping POSTFIX_SCHEMA(mapping) #define mapping POSTFIX_SCHEMA(mapping)
using namespace ifcopenshell::geometry; using namespace ifcopenshell::geometry;
+8
View File
@@ -73,6 +73,8 @@
%include "../serializers/XmlSerializer.h" %include "../serializers/XmlSerializer.h"
%include "../serializers/GltfSerializer.h" %include "../serializers/GltfSerializer.h"
#ifdef IFOPSH_WITH_OPENCASCADE
%template(ray_intersection_results) std::vector<IfcGeom::ray_intersection_result>; %template(ray_intersection_results) std::vector<IfcGeom::ray_intersection_result>;
// A Template instantantation should be defined before it is used as a base class. // A Template instantantation should be defined before it is used as a base class.
@@ -138,6 +140,8 @@
} }
#endif
// A visitor // A visitor
%{ %{
struct ShapeRTTI : public boost::static_visitor<PyObject*> struct ShapeRTTI : public boost::static_visitor<PyObject*>
@@ -551,6 +555,8 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
} }
%} %}
#ifdef IFOPSH_WITH_OPENCASCADE
%inline %{ %inline %{
IfcUtil::IfcBaseClass* serialise(const std::string& schema_name, const std::string& shape_str, bool advanced=true) { IfcUtil::IfcBaseClass* serialise(const std::string& schema_name, const std::string& shape_str, bool advanced=true) {
std::stringstream stream(shape_str); std::stringstream stream(shape_str);
@@ -571,6 +577,8 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
} }
%} %}
#endif
%ignore svgfill::svg_to_line_segments; %ignore svgfill::svg_to_line_segments;
%ignore svgfill::line_segments_to_polygons; %ignore svgfill::line_segments_to_polygons;
+8 -4
View File
@@ -80,9 +80,13 @@
%{ %{
#include "../ifcgeom/Iterator.h" #include "../ifcgeom/Iterator.h"
#include "../ifcgeom/taxonomy.h" #include "../ifcgeom/taxonomy.h"
#ifdef IFOPSH_WITH_OPENCASCADE
#include "../ifcgeom/Serialization/Serialization.h" #include "../ifcgeom/Serialization/Serialization.h"
#include "../ifcgeom/kernels/opencascade/IfcGeomTree.h" #include "../ifcgeom/kernels/opencascade/IfcGeomTree.h"
#include <BRepTools_ShapeSet.hxx>
#endif
#include "../serializers/SvgSerializer.h" #include "../serializers/SvgSerializer.h"
#include "../serializers/WavefrontObjSerializer.h" #include "../serializers/WavefrontObjSerializer.h"
#include "../serializers/HdfSerializer.h" #include "../serializers/HdfSerializer.h"
@@ -121,8 +125,6 @@
#include "../ifcparse/utils.h" #include "../ifcparse/utils.h"
#include "../svgfill/src/svgfill.h" #include "../svgfill/src/svgfill.h"
#include <BRepTools_ShapeSet.hxx>
%} %}
// Create docstrings for generated python code. // Create docstrings for generated python code.
@@ -137,8 +139,12 @@
%module ifcopenshell_wrapper %{ %module ifcopenshell_wrapper %{
#include "../ifcgeom/Converter.h" #include "../ifcgeom/Converter.h"
#include "../ifcgeom/taxonomy.h" #include "../ifcgeom/taxonomy.h"
#ifdef IFOPSH_WITH_OPENCASCADE
#include "../ifcgeom/Serialization/Serialization.h" #include "../ifcgeom/Serialization/Serialization.h"
#include "../ifcgeom/kernels/opencascade/IfcGeomTree.h" #include "../ifcgeom/kernels/opencascade/IfcGeomTree.h"
#include <BRepTools_ShapeSet.hxx>
#endif
#include "../ifcgeom/Iterator.h" #include "../ifcgeom/Iterator.h"
#include "../serializers/SvgSerializer.h" #include "../serializers/SvgSerializer.h"
@@ -181,8 +187,6 @@
#include "../ifcparse/utils.h" #include "../ifcparse/utils.h"
#include "../svgfill/src/svgfill.h" #include "../svgfill/src/svgfill.h"
#include <BRepTools_ShapeSet.hxx>
%} %}
%include "IfcGeomWrapper.i" %include "IfcGeomWrapper.i"
+1 -1
View File
@@ -17,7 +17,7 @@
* * * *
********************************************************************************/ ********************************************************************************/
#ifdef WITH_HDF5 #if defined(WITH_HDF5) && defined(IFOPSH_WITH_OPENCASCADE)
#include "HdfSerializer.h" #include "HdfSerializer.h"
+1 -1
View File
@@ -20,7 +20,7 @@
#ifndef HDFSERIALIZER_H #ifndef HDFSERIALIZER_H
#define HDFSERIALIZER_H #define HDFSERIALIZER_H
#ifdef WITH_HDF5 #if defined(WITH_HDF5) && defined(IFOPSH_WITH_OPENCASCADE)
#include <set> #include <set>
#include <string> #include <string>
+3
View File
@@ -17,6 +17,8 @@
* * * *
********************************************************************************/ ********************************************************************************/
#ifdef IFOPSH_WITH_OPENCASCADE
#ifndef IGESSERIALIZER_H #ifndef IGESSERIALIZER_H
#define IGESSERIALIZER_H #define IGESSERIALIZER_H
@@ -62,3 +64,4 @@ public:
}; };
#endif #endif
#endif
@@ -17,6 +17,8 @@
* * * *
********************************************************************************/ ********************************************************************************/
#ifdef IFOPSH_WITH_OPENCASCADE
#include "OpenCascadeBasedSerializer.h" #include "OpenCascadeBasedSerializer.h"
#include "../ifcparse/utils.h" #include "../ifcparse/utils.h"
@@ -62,3 +64,6 @@ const char* OpenCascadeBasedSerializer::getSymbolForUnitMagnitude(float mag) {
return 0; return 0;
} }
} }
#endif
@@ -17,6 +17,8 @@
* * * *
********************************************************************************/ ********************************************************************************/
#ifdef IFOPSH_WITH_OPENCASCADE
#ifndef OPENCASCADEBASEDSERIALIZER_H #ifndef OPENCASCADEBASEDSERIALIZER_H
#define OPENCASCADEBASEDSERIALIZER_H #define OPENCASCADEBASEDSERIALIZER_H
@@ -47,3 +49,4 @@ public:
}; };
#endif #endif
#endif
+4 -1
View File
@@ -17,6 +17,8 @@
* * * *
********************************************************************************/ ********************************************************************************/
#ifdef IFOPSH_WITH_OPENCASCADE
#ifndef STEPSERIALIZER_H #ifndef STEPSERIALIZER_H
#define STEPSERIALIZER_H #define STEPSERIALIZER_H
@@ -58,4 +60,5 @@ public:
} }
}; };
#endif #endif
#endif
+5 -1
View File
@@ -19,6 +19,8 @@
* * * *
********************************************************************************/ ********************************************************************************/
#ifdef IFOPSH_WITH_OPENCASCADE
#include "../ifcgeom/abstract_mapping.h" #include "../ifcgeom/abstract_mapping.h"
#include <string> #include <string>
@@ -2436,4 +2438,6 @@ std::string SvgSerializer::writeMetadata(const drawing_meta& m) {
}}; }};
return namespace_prefix_ + "plane=\""+ array_to_string(m4) +"\" " + return namespace_prefix_ + "plane=\""+ array_to_string(m4) +"\" " +
namespace_prefix_ + "matrix3=\"" + array_to_string(m.matrix_3) + "\""; namespace_prefix_ + "matrix3=\"" + array_to_string(m.matrix_3) + "\"";
} }
#endif
+3
View File
@@ -19,6 +19,8 @@
* * * *
********************************************************************************/ ********************************************************************************/
#ifdef IFOPSH_WITH_OPENCASCADE
#ifndef SVGSERIALIZER_H #ifndef SVGSERIALIZER_H
#define SVGSERIALIZER_H #define SVGSERIALIZER_H
@@ -343,3 +345,4 @@ protected:
}; };
#endif #endif
#endif