5
5
#ifdef IFCOPENSHELL_05
6
6
#include < ifcgeom/IfcGeomIterator.h>
7
7
#else
8
+ #ifdef IFCOPENSHELL_08
9
+ #include < ifcgeom/Iterator.h>
10
+ #include < ifcgeom/kernels/opencascade/OpenCascadeConversionResult.h>
11
+ #else
8
12
#include < ifcgeom_schema_agnostic/IfcGeomIterator.h>
9
13
#endif
14
+ #endif
10
15
11
16
#include < ifcparse/IfcFile.h>
12
17
#include < boost/filesystem.hpp>
@@ -293,15 +298,22 @@ class op_parse_ifc_file : public voxel_operation {
293
298
std::vector<IfcUtil::IfcBaseClass*> projects_copy (projects->begin (), projects->end ());
294
299
if (projects->size () > 1 ) {
295
300
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
296
304
auto inverses = f->getInverse ((*it)->data ().id (), nullptr , -1 );
297
-
305
+ # endif
298
306
f->removeEntity (*it);
299
307
300
308
for (auto & inv : *inverses) {
301
309
if (inv->declaration ().name () == " IFCRELAGGREGATES" ) {
310
+ #ifdef IFCOPENSHELL_08
311
+ inv->set_attribute_value (4 , projects_copy[0 ]);
312
+ #else
302
313
auto attr = new IfcWrite::IfcWriteArgument;
303
314
attr->set (projects_copy[0 ]);
304
315
inv->data ().setArgument (4 , attr);
316
+ #endif
305
317
}
306
318
}
307
319
}
@@ -324,7 +336,7 @@ class op_parse_ifc_file : public voxel_operation {
324
336
};
325
337
326
338
#ifdef WITH_IFC
327
- #ifdef IFCOPENSHELL_07
339
+ #if defined( IFCOPENSHELL_07) || defined(IFCOPENSHELL_08)
328
340
typedef IfcGeom::Iterator iterator_t ;
329
341
typedef aggregate_of_instance instance_list_t ;
330
342
#else
@@ -376,6 +388,11 @@ class op_create_geometry : public voxel_operation {
376
388
377
389
const filtered_files_t & ifc_files = scope.get_value <filtered_files_t >(" input" );
378
390
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
379
396
IfcGeom::IteratorSettings settings_surface;
380
397
settings_surface.set (IfcGeom::IteratorSettings::DISABLE_TRIANGULATION, true );
381
398
// settings_surface.set(IfcGeom::IteratorSettings::USE_WORLD_COORDS, true);
@@ -384,6 +401,7 @@ class op_create_geometry : public voxel_operation {
384
401
settings_surface.set (IfcGeom::IteratorSettings::ELEMENT_HIERARCHY, true );
385
402
#else
386
403
settings_surface.set (IfcGeom::IteratorSettings::SEARCH_FLOOR, true );
404
+ #endif
387
405
#endif
388
406
389
407
boost::optional<bool > include, roof_slabs;
@@ -454,13 +472,17 @@ class op_create_geometry : public voxel_operation {
454
472
455
473
#ifdef IFCOPENSHELL_05
456
474
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 )));
457
478
#else
458
479
if (threads) {
459
480
iterator.reset (new iterator_t (settings_surface, ifc_file, filters_surface, *threads));
460
481
} else {
461
482
iterator.reset (new iterator_t (settings_surface, ifc_file, filters_surface));
462
483
}
463
484
#endif
485
+ #endif
464
486
465
487
466
488
// For debugging geometry creation from IfcOpenShell
@@ -503,7 +525,11 @@ class op_create_geometry : public voxel_operation {
503
525
}
504
526
if (roof_slabs && elem_product->declaration ().is (" IfcSlab" )) {
505
527
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
506
531
std::string pdt = attr_value->isNull () ? std::string (" " ) : (std::string)(*attr_value);
532
+ #endif
507
533
process = process && (pdt == " ROOF" ) == *roof_slabs;
508
534
}
509
535
#endif
@@ -514,15 +540,26 @@ class op_create_geometry : public voxel_operation {
514
540
} catch (...) {
515
541
#ifdef IFCOPENSHELL_05
516
542
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 ());
517
548
#else
518
549
throw std::runtime_error (" Error evaluating filter on " + elem_product->data ().toString ());
550
+ #endif
519
551
#endif
520
552
}
521
553
}
522
554
523
555
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
524
561
TopoDS_Compound compound = elem->geometry ().as_compound ();
525
-
562
+ # endif
526
563
bool filtered_non_empty = true ;
527
564
if (only_transparent || only_opaque) {
528
565
filtered_non_empty = false ;
@@ -532,7 +569,7 @@ class op_create_geometry : public voxel_operation {
532
569
533
570
auto it = elem->geometry ().begin ();
534
571
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 ;
536
573
if (only_transparent == is_transparent) {
537
574
B.Add (filtered, jt.Value ());
538
575
filtered_non_empty = true ;
0 commit comments