------------------------------------------------------------------------------------------------
| 310 | |
| 311 | // ------------------------------------------------------------------------------------------------ |
| 312 | void ConvertUnit(const Schema_2x3::IfcNamedUnit &unit, ConversionData &conv) { |
| 313 | if (const Schema_2x3::IfcSIUnit *const si = unit.ToPtr<Schema_2x3::IfcSIUnit>()) { |
| 314 | if (si->UnitType == "LENGTHUNIT") { |
| 315 | conv.len_scale = si->Prefix ? ConvertSIPrefix(si->Prefix) : 1.f; |
| 316 | IFCImporter::LogDebug("got units used for lengths"); |
| 317 | } |
| 318 | if (si->UnitType == "PLANEANGLEUNIT") { |
| 319 | if (si->Name != "RADIAN") { |
| 320 | IFCImporter::LogWarn("expected base unit for angles to be radian"); |
| 321 | } |
| 322 | } |
| 323 | } else if (const Schema_2x3::IfcConversionBasedUnit *const convu = unit.ToPtr<Schema_2x3::IfcConversionBasedUnit>()) { |
| 324 | if (convu->UnitType == "PLANEANGLEUNIT") { |
| 325 | try { |
| 326 | conv.angle_scale = convu->ConversionFactor->ValueComponent->To<::Assimp::STEP::EXPRESS::REAL>(); |
| 327 | ConvertUnit(*convu->ConversionFactor->UnitComponent, conv); |
| 328 | IFCImporter::LogDebug("got units used for angles"); |
| 329 | } catch (std::bad_cast &) { |
| 330 | IFCImporter::LogError("skipping unknown IfcConversionBasedUnit.ValueComponent entry - expected REAL"); |
| 331 | } |
| 332 | } |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | // ------------------------------------------------------------------------------------------------ |
| 337 | void ConvertUnit(const ::Assimp::STEP::EXPRESS::DataType &dt, ConversionData &conv) { |
no test coverage detected