@@ -580,8 +580,18 @@ class op_create_geometry : public voxel_operation {
580
580
}
581
581
582
582
if (filtered_non_empty) {
583
+ #ifdef IFCOPENSHELL_08
584
+ const auto & m = elem->transformation ().data ()->ccomponents ();
585
+ gp_Trsf tr;
586
+ tr.SetValues (
587
+ m (0 , 0 ), m (0 , 1 ), m (0 , 2 ), m (0 , 3 ),
588
+ m (1 , 0 ), m (1 , 1 ), m (1 , 2 ), m (1 , 3 ),
589
+ m (2 , 0 ), m (2 , 1 ), m (2 , 2 ), m (2 , 3 )
590
+ );
591
+ compound.Move (tr);
592
+ #else
583
593
compound.Move (elem->transformation ().data ());
584
-
594
+ # endif
585
595
BRepMesh_IncrementalMesh (compound, 0.001 );
586
596
geometries->push_back (std::make_pair (std::pair<void *, int >(ifc_file, elem->id ()), compound));
587
597
}
@@ -1288,7 +1298,11 @@ class op_export_elements : public voxel_operation {
1288
1298
}
1289
1299
}
1290
1300
if (include) {
1301
+ #ifdef IFCOPENSHELL_08
1302
+ std::string guid = (std::string)((IfcUtil::IfcBaseEntity*)((IfcParse::IfcFile*)iden.first )->instance_by_id (iden.second ))->get (" GlobalId" );
1303
+ #else
1291
1304
std::string guid = *((IfcUtil::IfcBaseEntity*)((IfcParse::IfcFile*)iden.first )->instance_by_id (iden.second ))->get (" GlobalId" );
1305
+ #endif
1292
1306
if (n++) {
1293
1307
json << " ,\n " ;
1294
1308
}
@@ -2077,17 +2091,30 @@ namespace {
2077
2091
if (idx == -1 ) {
2078
2092
throw std::runtime_error (inst->declaration ().name () + " has no attribute " + p.first );
2079
2093
}
2094
+ #ifdef IFCOPENSHELL_08
2095
+ auto attr = inst->as <IfcUtil::IfcBaseEntity>()->data ().get_attribute_value (idx);
2096
+ if (attr.isNull ()) {
2097
+ #else
2080
2098
auto attr = inst->data ().getArgument (idx);
2081
2099
if (!attr || attr->isNull ()) {
2100
+ #endif
2082
2101
return false ;
2083
2102
}
2084
- if (attr-> type () == IfcUtil::Argument_DOUBLE) {
2103
+ if (attr. type () == IfcUtil::Argument_DOUBLE) {
2085
2104
auto op = p.second .at (0 );
2086
2105
auto v = p.second .substr (1 );
2087
2106
auto attr_type = inst->declaration ().attribute_by_index (idx);
2107
+ #ifdef IFCOPENSHELL_08
2108
+ double d0 = attr;
2109
+ #else
2088
2110
double d0 = *attr;
2111
+ #endif
2089
2112
if (attr_type->type_of_attribute ()->is (" IfcLengthMeasure" )) {
2113
+ #ifdef IFCOPENSHELL_08
2114
+ d0 *= inst->file_ ->getUnit (" LENGTHUNIT" ).second ;
2115
+ #else
2090
2116
d0 *= inst->data ().file ->getUnit (" LENGTHUNIT" ).second ;
2117
+ #endif
2091
2118
}
2092
2119
auto d1 = boost::lexical_cast<double >(v);
2093
2120
if (op == ' <' ) {
@@ -2136,13 +2163,21 @@ namespace {
2136
2163
if (rels) {
2137
2164
for (auto & rel : *rels) {
2138
2165
if (rel->declaration ().is (" IfcRelDefinesByProperties" )) {
2166
+ #ifdef IFCOPENSHELL_08
2167
+ IfcUtil::IfcBaseClass* pset = ((IfcUtil::IfcBaseEntity*)rel)->get (" RelatingPropertyDefinition" );
2168
+ if (pset->declaration ().is (" IfcPropertySet" )) {
2169
+ instance_list_t ::ptr props = ((IfcUtil::IfcBaseEntity*)pset)->get (" HasProperties" );
2170
+ for (auto & prop : *props) {
2171
+ if (prop->declaration ().is (" IfcPropertySingleValue" )) {
2172
+ auto name = (std::string) ((IfcUtil::IfcBaseEntity*)prop)->get (" Name" );
2173
+ #else
2139
2174
IfcUtil::IfcBaseClass* pset = *((IfcUtil::IfcBaseEntity*)rel)->get (" RelatingPropertyDefinition" );
2140
2175
if (pset->declaration ().is (" IfcPropertySet" )) {
2141
2176
instance_list_t ::ptr props = *((IfcUtil::IfcBaseEntity*)pset)->get (" HasProperties" );
2142
2177
for (auto & prop : *props) {
2143
2178
if (prop->declaration ().is (" IfcPropertySingleValue" )) {
2144
2179
auto name = (std::string) *((IfcUtil::IfcBaseEntity*)prop)->get (" Name" );
2145
-
2180
+ #endif
2146
2181
/*
2147
2182
// In the voxelfile grammer we can also have keywords starting with an alpha character
2148
2183
// so for the string comparison we need to trim off any others.
@@ -2157,10 +2192,17 @@ namespace {
2157
2192
2158
2193
if (name == p.first ) {
2159
2194
has_match = true ;
2195
+ #ifdef IFCOPENSHELL_08
2196
+ IfcUtil::IfcBaseClass* val = ((IfcUtil::IfcBaseEntity*)prop)->get (" NominalValue" );
2197
+ auto val_attr = val->data ().get_attribute_value (0 );
2198
+ if (val_attr.type () == IfcUtil::Argument_BOOL) {
2199
+ auto v_ifc = (bool )val_attr;
2200
+ #else
2160
2201
IfcUtil::IfcBaseClass* val = *((IfcUtil::IfcBaseEntity*)prop)->get (" NominalValue" );
2161
2202
auto val_attr = val->data ().getArgument (0 );
2162
2203
if (val_attr->type () == IfcUtil::Argument_BOOL) {
2163
2204
auto v_ifc = (bool )*val_attr;
2205
+ #endif
2164
2206
int v_filter = 0 ;
2165
2207
try {
2166
2208
v_filter = boost::get<int >(p.second );
@@ -2171,8 +2213,13 @@ namespace {
2171
2213
if (!match) {
2172
2214
return false ;
2173
2215
}
2216
+ #ifdef IFCOPENSHELL_08
2217
+ } else if (val_attr.type () == IfcUtil::Argument_STRING) {
2218
+ auto v_ifc = (std::string)val_attr;
2219
+ #else
2174
2220
} else if (val_attr->type () == IfcUtil::Argument_STRING) {
2175
2221
auto v_ifc = (std::string)*val_attr;
2222
+ #endif
2176
2223
std::string v_filter;
2177
2224
try {
2178
2225
v_filter = boost::get<std::string>(p.second );
0 commit comments