Begin purging old dynamic void feature

This commit is contained in:
Dion Moult
2022-10-07 20:46:54 +11:00
parent 3b81c158f3
commit 1db5d3b06c
7 changed files with 9 additions and 57 deletions
+2 -12
View File
@@ -194,16 +194,12 @@ class TestSwitchRepresentation:
geometry.is_edited("obj").should_be_called().will_return(False)
geometry.resolve_mapped_representation("mapped_rep").should_be_called().will_return("representation")
geometry.get_representation_data("representation").should_be_called().will_return(None)
geometry.import_representation(
"obj", "representation", enable_dynamic_voids=True
).should_be_called().will_return("new_data")
geometry.import_representation("obj", "representation").should_be_called().will_return("new_data")
geometry.get_representation_name("representation").should_be_called().will_return("name")
geometry.rename_object("new_data", "name").should_be_called()
geometry.link("representation", "new_data").should_be_called()
geometry.change_object_data("obj", "new_data", is_global=True).should_be_called()
geometry.clear_modifiers("obj").should_be_called()
geometry.is_body_representation("representation").should_be_called().will_return(True)
geometry.create_dynamic_voids("obj").should_be_called()
subject.switch_representation(
geometry,
obj="obj",
@@ -218,17 +214,13 @@ class TestSwitchRepresentation:
geometry.is_edited("obj").should_be_called().will_return(False)
geometry.resolve_mapped_representation("mapped_rep").should_be_called().will_return("representation")
geometry.get_representation_data("representation").should_be_called().will_return("existing_data")
geometry.import_representation(
"obj", "representation", enable_dynamic_voids=True
).should_be_called().will_return("new_data")
geometry.import_representation("obj", "representation").should_be_called().will_return("new_data")
geometry.get_representation_name("representation").should_be_called().will_return("name")
geometry.rename_object("new_data", "name").should_be_called()
geometry.link("representation", "new_data").should_be_called()
geometry.change_object_data("obj", "new_data", is_global=True).should_be_called()
geometry.delete_data("existing_data").should_be_called()
geometry.clear_modifiers("obj").should_be_called()
geometry.is_body_representation("representation").should_be_called().will_return(True)
geometry.create_dynamic_voids("obj").should_be_called()
subject.switch_representation(
geometry,
obj="obj",
@@ -245,8 +237,6 @@ class TestSwitchRepresentation:
geometry.get_representation_data("representation").should_be_called().will_return("data")
geometry.change_object_data("obj", "data", is_global=True).should_be_called()
geometry.clear_modifiers("obj").should_be_called()
geometry.is_body_representation("representation").should_be_called().will_return(True)
geometry.create_dynamic_voids("obj").should_be_called()
subject.switch_representation(
geometry,
obj="obj",
+2 -23
View File
@@ -74,27 +74,6 @@ class TestClearScale(NewFile):
assert list(obj.scale) == [1, 1, 1]
class TestCreateDynamicVoids(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
wall = ifc.createIfcWall()
opening = ifc.createIfcOpeningElement()
ifcopenshell.api.run("void.add_opening", ifc, opening=opening, element=wall)
wall_obj = bpy.data.objects.new("Object", bpy.data.meshes.new("Mesh"))
opening_obj = bpy.data.objects.new("Object", bpy.data.meshes.new("Mesh"))
tool.Ifc.link(wall, wall_obj)
tool.Ifc.link(opening, opening_obj)
subject.create_dynamic_voids(wall_obj)
modifier = wall_obj.modifiers[0]
assert modifier.type == "BOOLEAN"
assert modifier.name == "IfcOpeningElement"
assert modifier.operation == "DIFFERENCE"
assert modifier.object == opening_obj
assert modifier.solver == "EXACT"
assert modifier.use_self is True
class TestDeleteData(NewFile):
def test_run(self):
data = bpy.data.meshes.new("Mesh")
@@ -263,7 +242,7 @@ class TestImportRepresentation(NewFile):
element = ifc.by_type("IfcWall")[0]
tool.Ifc.link(element, obj)
representation = element.Representation.Representations[0]
mesh = subject.import_representation(obj, representation, enable_dynamic_voids=False)
mesh = subject.import_representation(obj, representation)
assert len(mesh.polygons) == 12
assert mesh.materials[0] == material
@@ -274,7 +253,7 @@ class TestImportRepresentation(NewFile):
element = ifc.by_type("IfcWall")[0]
tool.Ifc.link(element, obj)
representation = element.Representation.Representations[0]
mesh = subject.import_representation(obj, representation, enable_dynamic_voids=False)
mesh = subject.import_representation(obj, representation)
assert len(mesh.polygons) == 0
assert len(mesh.edges) == 4