Copying filled openings is now possible.

This commit is contained in:
Dion Moult
2022-10-09 22:25:55 +11:00
parent 32f0911479
commit ab31fd7e48
7 changed files with 96 additions and 6 deletions
+7
View File
@@ -51,6 +51,13 @@ class TestCopyClass:
root.get_element_type("element").should_be_called().will_return("type")
root.does_type_have_representations("type").should_be_called().will_return(False)
root.copy_representation("original_element", "element").should_be_called()
root.get_representation_context("representation").should_be_called().will_return("context")
root.get_element_representation("element", "context").should_be_called().will_return("new_representation")
geometry.change_object_data("obj", "data", is_global=True).should_be_called()
geometry.get_representation_name("new_representation").should_be_called().will_return("name")
geometry.rename_object("data", "name").should_be_called()
geometry.link("new_representation", "data").should_be_called()
geometry.duplicate_object_data("obj").should_be_called().will_return("data")
collector.assign("obj").should_be_called()
root.is_opening_element("element").should_be_called().will_return(False)
subject.copy_class(ifc, collector, geometry, root, obj="obj")
+27
View File
@@ -64,6 +64,33 @@ class TestDoesTypeHaveRepresentations(NewFile):
assert subject.does_type_have_representations(element) is True
class TestGetDecompositionRelationships(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
element = ifc.createIfcWall()
opening = ifc.createIfcOpeningElement()
fill = ifc.createIfcWindow()
ifcopenshell.api.run("void.add_opening", ifc, opening=opening, element=element)
ifcopenshell.api.run("void.add_filling", ifc, opening=opening, element=fill)
obj = bpy.data.objects.new("Object", None)
tool.Ifc.link(fill, obj)
assert subject.get_decomposition_relationships([obj]) == {fill: {"type": "fill", "element": element}}
class TestGetElementRepresentation(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
context = ifc.createIfcGeometricRepresentationContext(ContextType="Model")
representation = ifc.createIfcShapeRepresentation(ContextOfItems=context)
wall = ifc.createIfcWall(Representation=ifc.createIfcProductDefinitionShape(Representations=[representation]))
assert subject.get_element_representation(wall, context) == representation
class TestGetElementType(NewFile):
def test_run(self):
bpy.ops.bim.create_project()