mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
fix system/qto tool tests after e6ac012
This commit is contained in:
@@ -24,6 +24,7 @@ import test.bim.bootstrap
|
|||||||
import blenderbim.core.tool
|
import blenderbim.core.tool
|
||||||
import blenderbim.core.root
|
import blenderbim.core.root
|
||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
|
import blenderbim.bim.import_ifc as import_ifc
|
||||||
import blenderbim.bim.module.qto.calculator as calculator
|
import blenderbim.bim.module.qto.calculator as calculator
|
||||||
from blenderbim.tool.qto import Qto as subject
|
from blenderbim.tool.qto import Qto as subject
|
||||||
|
|
||||||
@@ -53,9 +54,17 @@ class TestGetRoundedValue(test.bim.bootstrap.NewFile):
|
|||||||
|
|
||||||
class TestGetCalculatedObjectQuantities(test.bim.bootstrap.NewFile):
|
class TestGetCalculatedObjectQuantities(test.bim.bootstrap.NewFile):
|
||||||
def setup_file(self):
|
def setup_file(self):
|
||||||
|
import logging
|
||||||
|
|
||||||
self.ifc = ifcopenshell.file()
|
self.ifc = ifcopenshell.file()
|
||||||
tool.Ifc.set(self.ifc)
|
tool.Ifc.set(self.ifc)
|
||||||
ifcopenshell.api.run("root.create_entity", self.ifc, ifc_class="IfcProject", name="My Project")
|
ifcopenshell.api.run("root.create_entity", self.ifc, ifc_class="IfcProject", name="My Project")
|
||||||
|
ifc_import_settings = import_ifc.IfcImportSettings.factory(
|
||||||
|
bpy.context, tool.Ifc.get_path(), logging.getLogger("ImportIFC")
|
||||||
|
)
|
||||||
|
ifc_importer = import_ifc.IfcImporter(ifc_import_settings)
|
||||||
|
ifc_importer.file = self.ifc
|
||||||
|
ifc_importer.create_project()
|
||||||
|
|
||||||
def setup_units(self, units):
|
def setup_units(self, units):
|
||||||
ifcopenshell.api.run("unit.assign_unit", self.ifc, **units)
|
ifcopenshell.api.run("unit.assign_unit", self.ifc, **units)
|
||||||
|
|||||||
@@ -230,16 +230,14 @@ class TestImportSystems(NewFile):
|
|||||||
|
|
||||||
class TestLoadPorts(NewFile):
|
class TestLoadPorts(NewFile):
|
||||||
def test_run(self):
|
def test_run(self):
|
||||||
ifc = ifcopenshell.api.run("project.create_file")
|
bpy.ops.bim.create_project()
|
||||||
ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcProject")
|
ifc = tool.Ifc.get()
|
||||||
ifcopenshell.api.run("unit.assign_unit", ifc)
|
|
||||||
tool.Ifc().set(ifc)
|
|
||||||
|
|
||||||
element = ifc.createIfcChiller()
|
element = ifc.create_entity("IfcChiller")
|
||||||
obj = bpy.data.objects.new("Object", None)
|
obj = bpy.data.objects.new("Object", None)
|
||||||
tool.Ifc.link(element, obj)
|
tool.Ifc.link(element, obj)
|
||||||
|
|
||||||
port = ifc.createIfcDistributionPort()
|
port = ifc.create_entity("IfcDistributionPort")
|
||||||
subject.load_ports(element, [port])
|
subject.load_ports(element, [port])
|
||||||
obj = tool.Ifc.get_object(port)
|
obj = tool.Ifc.get_object(port)
|
||||||
assert obj
|
assert obj
|
||||||
|
|||||||
Reference in New Issue
Block a user