mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +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",
|
||||
"IfcMassMeasure": "GRAM",
|
||||
"IfcTimeMeasure": "SECOND",
|
||||
"IfcVolumeMeasure": "CUBIE_METRE",
|
||||
"IfcVolumeMeasure": "CUBIC_METRE",
|
||||
}
|
||||
|
||||
def convert(self, value, measure):
|
||||
|
||||
@@ -16,13 +16,22 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import pytest
|
||||
import test.bootstrap
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.util.unit as subject
|
||||
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):
|
||||
def test_prefix_and_conversion_based_units_are_considered(self):
|
||||
ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
|
||||
|
||||
Reference in New Issue
Block a user