Copying an opening now tracks it as a special objects in the scene

This commit is contained in:
Dion Moult
2022-10-05 20:04:19 +11:00
parent aeaef641bf
commit 49d3ee2f73
5 changed files with 11 additions and 39 deletions
+1 -1
View File
@@ -86,7 +86,7 @@ class TestCopyClass:
root.link_object_data("type_obj", "obj").should_be_called()
collector.assign("obj").should_be_called()
root.is_opening_element("element").should_be_called().will_return(True)
root.add_dynamic_opening_voids("element", "obj").should_be_called()
root.add_tracked_opening("obj").should_be_called()
subject.copy_class(ifc, collector, geometry, root, obj="obj")
+5 -23
View File
@@ -29,30 +29,12 @@ class TestImplementsTool(NewFile):
assert isinstance(subject(), blenderbim.core.tool.Root)
class TestAddDynamicOpeningVoids(NewFile):
class TestAddTrackedOpening(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
obj = bpy.data.objects.new("Object", bpy.data.meshes.new("Mesh"))
element = ifc.createIfcOpeningElement()
tool.Ifc.link(element, obj)
wall_obj = bpy.data.objects.new("Object", bpy.data.meshes.new("Mesh"))
wall_element = ifc.createIfcOpeningElement()
tool.Ifc.link(wall_element, wall_obj)
ifcopenshell.api.run("void.add_opening", ifc, opening=element, element=wall_element)
subject.add_dynamic_opening_voids(element, obj)
modifier = wall_obj.modifiers[0]
assert modifier.type == "BOOLEAN"
assert modifier.name == "IfcOpeningElement"
assert modifier.operation == "DIFFERENCE"
assert modifier.object == obj
assert modifier.solver == "EXACT"
assert modifier.use_self is True
obj = bpy.data.objects.new("Object", None)
subject.add_tracked_opening(obj)
props = bpy.context.scene.BIMModelProperties
assert props.openings[0].obj == obj
class TestDoesTypeHaveRepresentations(NewFile):