Replace all ifcopenshell.api.run with ifcopenshell.api static functions.

This commit is contained in:
Dion Moult
2024-06-28 12:36:31 +10:00
parent b5d613989e
commit 07060fc769
432 changed files with 4633 additions and 4856 deletions
@@ -17,7 +17,8 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.unit
import ifcopenshell.api.root
import ifcopenshell.util.unit as subject
from math import pi
@@ -34,15 +35,15 @@ class TestConvert(test.bootstrap.IFC4):
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")
length = ifcopenshell.api.run("unit.add_conversion_based_unit", self.file, name="foot")
ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcProject")
length = ifcopenshell.api.unit.add_conversion_based_unit(self.file, name="foot")
length.ConversionFactor.UnitComponent.Prefix = "MILLI"
ifcopenshell.api.run("unit.assign_unit", self.file, units=[length])
ifcopenshell.api.unit.assign_unit(self.file, units=[length])
assert subject.calculate_unit_scale(self.file) == 0.3048 * 0.001
angle = ifcopenshell.api.run("unit.add_conversion_based_unit", self.file, name="degree")
angle = ifcopenshell.api.unit.add_conversion_based_unit(self.file, name="degree")
angle.ConversionFactor.UnitComponent.Prefix = "MILLI"
ifcopenshell.api.run("unit.assign_unit", self.file, units=[angle])
ifcopenshell.api.unit.assign_unit(self.file, units=[angle])
assert subject.calculate_unit_scale(self.file, "PLANEANGLEUNIT") == pi / 180 * 0.001