mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
Replace direct access to IfcStore with tool.Ifc
This commit is contained in:
@@ -174,14 +174,14 @@ def the_object_name_exists(name):
|
||||
|
||||
|
||||
def an_ifc_file_exists():
|
||||
ifc = IfcStore.get_file()
|
||||
ifc = tool.Ifc.get()
|
||||
if not ifc:
|
||||
assert False, "No IFC file is available"
|
||||
return ifc
|
||||
|
||||
|
||||
def an_ifc_file_does_not_exist():
|
||||
ifc = IfcStore.get_file()
|
||||
ifc = tool.Ifc.get()
|
||||
if ifc:
|
||||
assert False, "An IFC is available"
|
||||
|
||||
@@ -283,7 +283,7 @@ def the_object_name1_has_no_boolean_difference_by_name2(name1, name2):
|
||||
|
||||
|
||||
def the_object_name_is_voided_by_void(name, void):
|
||||
ifc = IfcStore.get_file()
|
||||
ifc = tool.Ifc.get()
|
||||
element = ifc.by_id(the_object_name_exists(name).BIMObjectProperties.ifc_definition_id)
|
||||
for rel in element.HasOpenings:
|
||||
if rel.RelatedOpeningElement.Name == void:
|
||||
@@ -292,7 +292,7 @@ def the_object_name_is_voided_by_void(name, void):
|
||||
|
||||
|
||||
def the_object_name_is_not_voided_by_void(name, void):
|
||||
ifc = IfcStore.get_file()
|
||||
ifc = tool.Ifc.get()
|
||||
element = ifc.by_id(the_object_name_exists(name).BIMObjectProperties.ifc_definition_id)
|
||||
for rel in element.HasOpenings:
|
||||
if rel.RelatedOpeningElement.Name == void:
|
||||
@@ -300,21 +300,21 @@ def the_object_name_is_not_voided_by_void(name, void):
|
||||
|
||||
|
||||
def the_object_name_is_not_voided(name):
|
||||
ifc = IfcStore.get_file()
|
||||
ifc = tool.Ifc.get()
|
||||
element = ifc.by_id(the_object_name_exists(name).BIMObjectProperties.ifc_definition_id)
|
||||
if any(element.HasOpenings):
|
||||
assert False, "An opening was found"
|
||||
|
||||
|
||||
def the_object_name_is_not_a_void(name):
|
||||
ifc = IfcStore.get_file()
|
||||
ifc = tool.Ifc.get()
|
||||
element = ifc.by_id(the_object_name_exists(name).BIMObjectProperties.ifc_definition_id)
|
||||
if any(element.VoidsElements):
|
||||
assert False, "A void was found"
|
||||
|
||||
|
||||
def the_void_name_is_filled_by_filling(name, filling):
|
||||
ifc = IfcStore.get_file()
|
||||
ifc = tool.Ifc.get()
|
||||
element = ifc.by_id(the_object_name_exists(name).BIMObjectProperties.ifc_definition_id)
|
||||
if any(rel.RelatedBuildingElement.Name == filling for rel in element.HasFillings):
|
||||
return True
|
||||
@@ -322,14 +322,14 @@ def the_void_name_is_filled_by_filling(name, filling):
|
||||
|
||||
|
||||
def the_void_name_is_not_filled_by_filling(name, filling):
|
||||
ifc = IfcStore.get_file()
|
||||
ifc = tool.Ifc.get()
|
||||
element = ifc.by_id(the_object_name_exists(name).BIMObjectProperties.ifc_definition_id)
|
||||
if any(rel.RelatedBuildingElement.Name == filling for rel in element.HasFillings):
|
||||
assert False, "A filling was found"
|
||||
|
||||
|
||||
def the_object_name_is_not_a_filling(name):
|
||||
ifc = IfcStore.get_file()
|
||||
ifc = tool.Ifc.get()
|
||||
element = ifc.by_id(the_object_name_exists(name).BIMObjectProperties.ifc_definition_id)
|
||||
if any(element.FillsVoids):
|
||||
assert False, "A filling was found"
|
||||
|
||||
@@ -786,14 +786,14 @@ def the_ifc_material_name_does_not_exist(name):
|
||||
|
||||
@then("an IFC file does not exist")
|
||||
def an_ifc_file_does_not_exist():
|
||||
ifc = IfcStore.get_file()
|
||||
ifc = tool.Ifc.get()
|
||||
if ifc:
|
||||
assert False, "An IFC is available"
|
||||
|
||||
|
||||
@then("an IFC file exists")
|
||||
def an_ifc_file_exists():
|
||||
ifc = IfcStore.get_file()
|
||||
ifc = tool.Ifc.get()
|
||||
if not ifc:
|
||||
assert False, "No IFC file is available"
|
||||
return ifc
|
||||
@@ -807,7 +807,7 @@ def the_object_name_should_display_as_mode(name, mode):
|
||||
|
||||
@then(parsers.parse('the object "{name}" is voided by "{void}"'))
|
||||
def the_object_name_is_voided_by_void(name, void):
|
||||
ifc = IfcStore.get_file()
|
||||
ifc = tool.Ifc.get()
|
||||
element = ifc.by_id(the_object_name_exists(name).BIMObjectProperties.ifc_definition_id)
|
||||
assert any((rel for rel in element.HasOpenings if rel.RelatedOpeningElement.Name == void)), "No void found"
|
||||
|
||||
@@ -823,14 +823,14 @@ def the_object_name_is_not_voided_by_void(name, void):
|
||||
|
||||
@then(parsers.parse('the object "{name}" is not voided'))
|
||||
def the_object_name_is_not_voided(name):
|
||||
ifc = IfcStore.get_file()
|
||||
ifc = tool.Ifc.get()
|
||||
element = ifc.by_id(the_object_name_exists(name).BIMObjectProperties.ifc_definition_id)
|
||||
assert not element.HasOpenings, "A void was found"
|
||||
|
||||
|
||||
@then(parsers.parse('the object "{name}" is a void'))
|
||||
def the_object_name_is_a_void(name):
|
||||
ifc = IfcStore.get_file()
|
||||
ifc = tool.Ifc.get()
|
||||
obj = the_object_name_exists(name)
|
||||
element = ifc.by_id(obj.BIMObjectProperties.ifc_definition_id)
|
||||
assert any((element.VoidsElements)), "No void was found"
|
||||
@@ -936,7 +936,7 @@ def the_object_name_has_number_vertices(name, number):
|
||||
|
||||
@then(parsers.parse('the void "{name}" is filled by "{filling}"'))
|
||||
def the_void_name_is_filled_by_filling(name, filling):
|
||||
ifc = IfcStore.get_file()
|
||||
ifc = tool.Ifc.get()
|
||||
element = ifc.by_id(the_object_name_exists(name).BIMObjectProperties.ifc_definition_id)
|
||||
assert any((rel.RelatedBuildingElement.Name == filling for rel in element.HasFillings)), "No filling found"
|
||||
|
||||
@@ -953,7 +953,7 @@ def the_void_name_is_not_filled_by_filling(name, filling):
|
||||
@when(parsers.parse('the object "{name}" is not a filling'))
|
||||
@then(parsers.parse('the object "{name}" is not a filling'))
|
||||
def the_object_name_is_not_a_filling(name):
|
||||
ifc = IfcStore.get_file()
|
||||
ifc = tool.Ifc.get()
|
||||
element = ifc.by_id(the_object_name_exists(name).BIMObjectProperties.ifc_definition_id)
|
||||
assert not any(element.FillsVoids), "A filling was found"
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import bonsai.core.tool
|
||||
import bonsai.tool as tool
|
||||
from test.bim.bootstrap import NewFile
|
||||
from bonsai.tool.drawing import Drawing as subject
|
||||
from bonsai.bim.ifc import IfcStore
|
||||
from bonsai.bim.module.drawing.data import DecoratorData
|
||||
from mathutils import Vector
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import test.bim.bootstrap
|
||||
import bonsai.core.tool
|
||||
import bonsai.tool as tool
|
||||
from bonsai.tool.misc import Misc as subject
|
||||
from bonsai.bim.ifc import IfcStore
|
||||
|
||||
|
||||
class TestImplementsTool(test.bim.bootstrap.NewFile):
|
||||
|
||||
Reference in New Issue
Block a user