New interface to show, select, and remove path connections

This commit is contained in:
Dion Moult
2022-09-20 16:25:52 +10:00
parent de2ada1141
commit e179070978
9 changed files with 164 additions and 4 deletions
+12
View File
@@ -382,3 +382,15 @@ class TestRemoveRepresentation:
).should_be_called()
ifc.run("geometry.remove_representation", representation="representation").should_be_called()
subject.remove_representation(ifc, geometry, obj="obj", representation="representation")
class TestSelectConnection:
def test_run(self, geometry):
geometry.select_connection("connection").should_be_called()
subject.select_connection(geometry, connection="connection")
class TestRemoveConnection:
def test_run(self, geometry):
geometry.remove_connection("connection").should_be_called()
subject.remove_connection(geometry, connection="connection")
+33
View File
@@ -379,6 +379,17 @@ class TestRecordObjectPosition(NewFile):
assert obj.BIMObjectProperties.rotation_checksum == repr(np.array(obj.matrix_world.to_3x3()).tobytes())
class TestRemoveConnection(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc().set(ifc)
element1 = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
element2 = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
rel = ifcopenshell.api.run("geometry.connect_path", ifc, relating_element=element1, related_element=element2)
subject.remove_connection(rel)
assert not tool.Ifc.get().by_type("IfcRelConnectsPathElements")
class TestRenameObject(NewFile):
def test_run(self):
obj = bpy.data.meshes.new("Mesh")
@@ -431,6 +442,28 @@ class TestRunStyleAddStyle(NewFile):
pass
class TestSelectConnection(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc().set(ifc)
element1 = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
obj1 = bpy.data.objects.new("Object", None)
bpy.context.scene.collection.objects.link(obj1)
tool.Ifc.link(element1, obj1)
element2 = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
obj2 = bpy.data.objects.new("Object", None)
bpy.context.scene.collection.objects.link(obj2)
tool.Ifc.link(element2, obj2)
rel = ifcopenshell.api.run("geometry.connect_path", ifc, relating_element=element1, related_element=element2)
subject.select_connection(rel)
assert obj1 in bpy.context.selected_objects
assert obj2 in bpy.context.selected_objects
class TestShouldForceFacetedBrep(NewFile):
def test_run(self):
result = bpy.context.scene.BIMGeometryProperties.should_force_faceted_brep