mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 10:51:13 +00:00
only convert length unit if units are present in both files
This commit is contained in:
@@ -1510,8 +1510,14 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity) {
|
|||||||
entity->getArgumentEntity(i) == IfcSchema::Type::IfcPositiveLengthMeasure)
|
entity->getArgumentEntity(i) == IfcSchema::Type::IfcPositiveLengthMeasure)
|
||||||
{
|
{
|
||||||
if (boost::math::isnan(conversion_factor)) {
|
if (boost::math::isnan(conversion_factor)) {
|
||||||
conversion_factor = other_file->getUnit(IfcSchema::IfcUnitEnum::IfcUnit_LENGTHUNIT).second /
|
const std::pair<IfcSchema::IfcNamedUnit*, double> this_file_unit = getUnit(IfcSchema::IfcUnitEnum::IfcUnit_LENGTHUNIT);
|
||||||
getUnit(IfcSchema::IfcUnitEnum::IfcUnit_LENGTHUNIT).second;
|
const std::pair<IfcSchema::IfcNamedUnit*, double> other_file_unit = other_file->getUnit(IfcSchema::IfcUnitEnum::IfcUnit_LENGTHUNIT);
|
||||||
|
std::cerr << other_file_unit.second << " " << this_file_unit.second << std::endl;
|
||||||
|
if (this_file_unit.first && other_file_unit.first) {
|
||||||
|
conversion_factor = other_file_unit.second / this_file_unit.second;
|
||||||
|
} else {
|
||||||
|
conversion_factor = 1.;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (attr_type == IfcUtil::Argument_DOUBLE) {
|
if (attr_type == IfcUtil::Argument_DOUBLE) {
|
||||||
double v = *attr;
|
double v = *attr;
|
||||||
|
|||||||
Reference in New Issue
Block a user