Skip to content

Commit 0c32361

Browse files
committed
Updates
1 parent b47dfd0 commit 0c32361

File tree

4 files changed

+63
-13
lines changed

4 files changed

+63
-13
lines changed

.github/workflows/build_win.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ jobs:
8383
-DUSE_BUILD_SCRIPT_OUTPUT=Off `
8484
-DBoost_USE_STATIC_LIBS=On `
8585
-DBoost_NO_BOOST_CMAKE=On `
86-
-DCMAKE_INSTALL_PREFIX=../install `
87-
-DIFC_INCLUDE_DIR=../IfcOpenShell/_installed-vs2019-x64/include `
88-
-DIFC_LIBRARY_DIR=../IfcOpenShell/_installed-vs2019-x64/ifcopenshell/lib `
89-
-DOCC_INCLUDE_DIR=../IfcOpenShell/_deps-vs2022-x64-installed/opencascade-7.8.1/inc `
90-
-DOCC_LIBRARY_DIR=../IfcOpenShell/_deps-vs2022-x64-installed/opencascade-7.8.1/win64/lib `
86+
-DCMAKE_INSTALL_PREFIX=$env:GITHUB_WORKSPACE\install `
87+
-DIFC_INCLUDE_DIR=$env:GITHUB_WORKSPACE\IfcOpenShell\_installed-vs2019-x64\include `
88+
-DIFC_LIBRARY_DIR=$env:GITHUB_WORKSPACE\IfcOpenShell\_installed-vs2019-x64\ifcopenshell\lib `
89+
-DOCC_INCLUDE_DIR=$env:GITHUB_WORKSPACE\IfcOpenShell\_deps-vs2019-x64-installed\opencascade-7.8.1\inc `
90+
-DOCC_LIBRARY_DIR=$env:GITHUB_WORKSPACE\IfcOpenShell\_deps-vs2019-x64-installed\opencascade-7.8.1\win64\lib `
9191
-DPython_EXECUTABLE=C:\Python\${{ matrix.python }}\python.exe `
92-
-DBOOST_ROOT=../IfcOpenShell/_deps/boost_1_86_0 `
93-
-DSWIG_DIR=../IfcOpenShell/_installed-vs2019-x64/swigwin
92+
-DBOOST_ROOT=$env:GITHUB_WORKSPACE\IfcOpenShell\_deps\boost_1_86_0 `
93+
-DSWIG_DIR=$env:GITHUB_WORKSPACE\IfcOpenShell\_installed-vs2019-x64\swigwin
9494
cmake --build . --target install --config Release
9595
9696
- name: Package .zip Archives

CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,15 @@ if (IFC_SUPPORT)
176176
list(APPEND SCHEMA_VERSIONS ${schema_name})
177177
endforeach()
178178

179-
if(${ifcopenshell_major_version} STREQUAL "0.7")
180-
add_definitions("-DIFCOPENSHELL_07")
179+
if(${ifcopenshell_major_version} STREQUAL "0.7" OR
180+
${ifcopenshell_major_version} STREQUAL "0.8")
181+
182+
if(${ifcopenshell_major_version} STREQUAL "0.8")
183+
add_definitions("-DIFCOPENSHELL_08")
184+
else()
185+
add_definitions("-DIFCOPENSHELL_07")
186+
endif()
187+
181188
set(SWIG_DEFINES ${SWIG_DEFINES} -DIFCOPENSHELL_07)
182189

183190
string(REPLACE ";" ")(" schema_version_seq "(${SCHEMA_VERSIONS})")

processor.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616

1717
#ifdef WITH_IFC
1818

19+
#ifdef IFCOPENSHELL_08
20+
#include <ifcgeom/IfcGeomElement.h>
21+
22+
typedef IfcGeom::BRepElement elem_t;
23+
#else
1924
#ifdef IFCOPENSHELL_07
2025
#include <ifcparse/IfcLogger.h> // @todo < commit in IfcopenShell
2126
#include <ifcgeom_schema_agnostic/IfcGeomElement.h>
@@ -29,6 +34,7 @@ typedef IfcGeom::BRepElement elem_t;
2934
typedef IfcGeom::BRepElement<double> elem_t;
3035
#endif
3136
#endif
37+
#endif
3238

3339
typedef TopoDS_Shape geometry_t;
3440
typedef std::vector<std::pair<std::pair<void*, int>, TopoDS_Compound > > geometry_collection_t;

voxec.h

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@
55
#ifdef IFCOPENSHELL_05
66
#include <ifcgeom/IfcGeomIterator.h>
77
#else
8+
#ifdef IFCOPENSHELL_08
9+
#include <ifcgeom/Iterator.h>
10+
#include <ifcgeom/kernels/opencascade/OpenCascadeConversionResult.h>
11+
#else
812
#include <ifcgeom_schema_agnostic/IfcGeomIterator.h>
913
#endif
14+
#endif
1015

1116
#include <ifcparse/IfcFile.h>
1217
#include <boost/filesystem.hpp>
@@ -293,15 +298,22 @@ class op_parse_ifc_file : public voxel_operation {
293298
std::vector<IfcUtil::IfcBaseClass*> projects_copy(projects->begin(), projects->end());
294299
if (projects->size() > 1) {
295300
for (auto it = projects_copy.begin() + 1; it != projects_copy.end(); ++it) {
301+
#ifdef IFCOPENSHELL_08
302+
auto inverses = f->getInverse((*it)->id(), nullptr, -1);
303+
#else
296304
auto inverses = f->getInverse((*it)->data().id(), nullptr, -1);
297-
305+
#endif
298306
f->removeEntity(*it);
299307

300308
for (auto& inv : *inverses) {
301309
if (inv->declaration().name() == "IFCRELAGGREGATES") {
310+
#ifdef IFCOPENSHELL_08
311+
inv->set_attribute_value(4, projects_copy[0]);
312+
#else
302313
auto attr = new IfcWrite::IfcWriteArgument;
303314
attr->set(projects_copy[0]);
304315
inv->data().setArgument(4, attr);
316+
#endif
305317
}
306318
}
307319
}
@@ -324,7 +336,7 @@ class op_parse_ifc_file : public voxel_operation {
324336
};
325337

326338
#ifdef WITH_IFC
327-
#ifdef IFCOPENSHELL_07
339+
#if defined(IFCOPENSHELL_07) || defined(IFCOPENSHELL_08)
328340
typedef IfcGeom::Iterator iterator_t;
329341
typedef aggregate_of_instance instance_list_t;
330342
#else
@@ -376,6 +388,11 @@ class op_create_geometry : public voxel_operation {
376388

377389
const filtered_files_t& ifc_files = scope.get_value<filtered_files_t>("input");
378390

391+
#ifdef IFCOPENSHELL_08
392+
ifcopenshell::geometry::Settings settings_surface;
393+
settings_surface.get<ifcopenshell::geometry::settings::UseElementHierarchy>().value = true;
394+
settings_surface.get<ifcopenshell::geometry::settings::IteratorOutput>().value = ifcopenshell::geometry::settings::NATIVE;
395+
#else
379396
IfcGeom::IteratorSettings settings_surface;
380397
settings_surface.set(IfcGeom::IteratorSettings::DISABLE_TRIANGULATION, true);
381398
// settings_surface.set(IfcGeom::IteratorSettings::USE_WORLD_COORDS, true);
@@ -384,6 +401,7 @@ class op_create_geometry : public voxel_operation {
384401
settings_surface.set(IfcGeom::IteratorSettings::ELEMENT_HIERARCHY, true);
385402
#else
386403
settings_surface.set(IfcGeom::IteratorSettings::SEARCH_FLOOR, true);
404+
#endif
387405
#endif
388406

389407
boost::optional<bool> include, roof_slabs;
@@ -454,13 +472,17 @@ class op_create_geometry : public voxel_operation {
454472

455473
#ifdef IFCOPENSHELL_05
456474
iterator.reset(iterator_t(settings_surface, ifc_file, filters_surface));
475+
#else
476+
#ifdef IFCOPENSHELL_08
477+
iterator.reset(new iterator_t("opencascade", settings_surface, ifc_file, filters_surface, threads.get_value_or(1)));
457478
#else
458479
if (threads) {
459480
iterator.reset(new iterator_t(settings_surface, ifc_file, filters_surface, *threads));
460481
} else {
461482
iterator.reset(new iterator_t(settings_surface, ifc_file, filters_surface));
462483
}
463484
#endif
485+
#endif
464486

465487

466488
// For debugging geometry creation from IfcOpenShell
@@ -503,7 +525,11 @@ class op_create_geometry : public voxel_operation {
503525
}
504526
if (roof_slabs && elem_product->declaration().is("IfcSlab")) {
505527
auto attr_value = elem_product->get("PredefinedType");
528+
#ifdef IFCOPENSHELL_08
529+
std::string pdt = attr_value.type() == IfcUtil::Argument_STRING ? (std::string)attr_value : std::string("");
530+
#else
506531
std::string pdt = attr_value->isNull() ? std::string("") : (std::string)(*attr_value);
532+
#endif
507533
process = process && (pdt == "ROOF") == *roof_slabs;
508534
}
509535
#endif
@@ -514,15 +540,26 @@ class op_create_geometry : public voxel_operation {
514540
} catch (...) {
515541
#ifdef IFCOPENSHELL_05
516542
throw std::runtime_error("Error evaluating filter on " + elem_product->toString());
543+
#else
544+
#ifdef IFCOPENSHELL_08
545+
std::ostringstream oss;
546+
elem_product->toString(oss);
547+
throw std::runtime_error("Error evaluating filter on " + oss.str());
517548
#else
518549
throw std::runtime_error("Error evaluating filter on " + elem_product->data().toString());
550+
#endif
519551
#endif
520552
}
521553
}
522554

523555
if (process) {
556+
#ifdef IFCOPENSHELL_08
557+
auto comp = elem->geometry().as_compound();
558+
TopoDS_Compound compound = TopoDS::Compound(((ifcopenshell::geometry::OpenCascadeShape*)comp)->shape());
559+
delete comp;
560+
#else
524561
TopoDS_Compound compound = elem->geometry().as_compound();
525-
562+
#endif
526563
bool filtered_non_empty = true;
527564
if (only_transparent || only_opaque) {
528565
filtered_non_empty = false;
@@ -532,7 +569,7 @@ class op_create_geometry : public voxel_operation {
532569

533570
auto it = elem->geometry().begin();
534571
for (TopoDS_Iterator jt(compound); jt.More(); ++it, jt.Next()) {
535-
bool is_transparent = it->hasStyle() && it->Style().Transparency().get_value_or(0.0) > 1.e-9;
572+
bool is_transparent = it->hasStyle() && it->Style().has_transparency() && it->Style().transparency > 1.e-9;
536573
if (only_transparent == is_transparent) {
537574
B.Add(filtered, jt.Value());
538575
filtered_non_empty = true;

0 commit comments

Comments
 (0)