mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
Fix qto bug where cubic meter units are incorrectly converted.
This commit is contained in:
@@ -76,7 +76,7 @@ class SI2ProjectUnitConverter:
|
|||||||
"IfcLengthMeasure": "METRE",
|
"IfcLengthMeasure": "METRE",
|
||||||
"IfcMassMeasure": "GRAM",
|
"IfcMassMeasure": "GRAM",
|
||||||
"IfcTimeMeasure": "SECOND",
|
"IfcTimeMeasure": "SECOND",
|
||||||
"IfcVolumeMeasure": "CUBIE_METRE",
|
"IfcVolumeMeasure": "CUBIC_METRE",
|
||||||
}
|
}
|
||||||
|
|
||||||
def convert(self, value, measure):
|
def convert(self, value, measure):
|
||||||
|
|||||||
@@ -16,13 +16,22 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import pytest
|
|
||||||
import test.bootstrap
|
import test.bootstrap
|
||||||
import ifcopenshell.api
|
import ifcopenshell.api
|
||||||
import ifcopenshell.util.unit as subject
|
import ifcopenshell.util.unit as subject
|
||||||
from math import pi
|
from math import pi
|
||||||
|
|
||||||
|
|
||||||
|
class TestConvert(test.bootstrap.IFC4):
|
||||||
|
def test_run(self):
|
||||||
|
assert subject.convert(1, None, "METRE", None, "METRE") == 1
|
||||||
|
assert subject.convert(1, None, "METRE", "MILLI", "METRE") == 1000
|
||||||
|
assert subject.convert(1000, "MILLI", "METRE", None, "METRE") == 1
|
||||||
|
assert subject.convert(1, None, "SQUARE_METRE", None, "SQUARE_METRE") == 1
|
||||||
|
assert subject.convert(1, None, "SQUARE_METRE", "MILLI", "SQUARE_METRE") == 1000000
|
||||||
|
assert subject.convert(1, None, "CUBIC_METRE", "MILLI", "CUBIC_METRE") == 1000000000
|
||||||
|
|
||||||
|
|
||||||
class TestCalculateUnitScale(test.bootstrap.IFC4):
|
class TestCalculateUnitScale(test.bootstrap.IFC4):
|
||||||
def test_prefix_and_conversion_based_units_are_considered(self):
|
def test_prefix_and_conversion_based_units_are_considered(self):
|
||||||
ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
|
ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
|
||||||
|
|||||||
Reference in New Issue
Block a user