mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +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.root
|
||||
import blenderbim.tool as tool
|
||||
import blenderbim.bim.import_ifc as import_ifc
|
||||
import blenderbim.bim.module.qto.calculator as calculator
|
||||
from blenderbim.tool.qto import Qto as subject
|
||||
|
||||
@@ -53,9 +54,17 @@ class TestGetRoundedValue(test.bim.bootstrap.NewFile):
|
||||
|
||||
class TestGetCalculatedObjectQuantities(test.bim.bootstrap.NewFile):
|
||||
def setup_file(self):
|
||||
import logging
|
||||
|
||||
self.ifc = ifcopenshell.file()
|
||||
tool.Ifc.set(self.ifc)
|
||||
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):
|
||||
ifcopenshell.api.run("unit.assign_unit", self.ifc, **units)
|
||||
|
||||
@@ -230,16 +230,14 @@ class TestImportSystems(NewFile):
|
||||
|
||||
class TestLoadPorts(NewFile):
|
||||
def test_run(self):
|
||||
ifc = ifcopenshell.api.run("project.create_file")
|
||||
ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcProject")
|
||||
ifcopenshell.api.run("unit.assign_unit", ifc)
|
||||
tool.Ifc().set(ifc)
|
||||
bpy.ops.bim.create_project()
|
||||
ifc = tool.Ifc.get()
|
||||
|
||||
element = ifc.createIfcChiller()
|
||||
element = ifc.create_entity("IfcChiller")
|
||||
obj = bpy.data.objects.new("Object", None)
|
||||
tool.Ifc.link(element, obj)
|
||||
|
||||
port = ifc.createIfcDistributionPort()
|
||||
port = ifc.create_entity("IfcDistributionPort")
|
||||
subject.load_ports(element, [port])
|
||||
obj = tool.Ifc.get_object(port)
|
||||
assert obj
|
||||
|
||||
Reference in New Issue
Block a user