Fix #2520. You can now duplicate drawings with or without annotations.

This commit is contained in:
Dion Moult
2023-02-08 21:16:54 +11:00
parent f118c50d1d
commit 93d0ffd459
6 changed files with 44 additions and 16 deletions
+7 -2
View File
@@ -248,7 +248,7 @@ class TestDuplicateDrawing:
drawing.get_name("drawing").should_be_called().will_return("name")
drawing.ensure_unique_drawing_name("name").should_be_called().will_return("unique_name")
ifc.run("root.copy_class", product="drawing").should_be_called().will_return("new_drawing")
drawing.copy_drawing_representation("drawing", "new_drawing").should_be_called()
drawing.copy_representation("drawing", "new_drawing").should_be_called()
drawing.set_name("new_drawing", "unique_name").should_be_called()
drawing.get_drawing_group("new_drawing").should_be_called().will_return("group")
ifc.run("group.unassign_group", group="group", product="new_drawing").should_be_called()
@@ -257,8 +257,13 @@ class TestDuplicateDrawing:
"group.edit_group", group="new_group", attributes={"Name": "unique_name", "ObjectType": "DRAWING"}
).should_be_called()
ifc.run("group.assign_group", group="new_group", products=["new_drawing"]).should_be_called()
drawing.get_group_elements("group").should_be_called().will_return(["drawing", "annotation"])
ifc.run("root.copy_class", product="annotation").should_be_called().will_return("new_annotation")
drawing.copy_representation("annotation", "new_annotation").should_be_called()
ifc.run("group.unassign_group", group="group", product="new_annotation").should_be_called()
ifc.run("group.assign_group", group="new_group", products=["new_annotation"]).should_be_called()
drawing.import_drawings().should_be_called()
subject.duplicate_drawing(ifc, drawing, drawing="drawing")
subject.duplicate_drawing(ifc, drawing, drawing="drawing", should_duplicate_annotations=True)
class TestRemoveDrawing:
+2 -2
View File
@@ -32,13 +32,13 @@ class TestImplementsTool(NewFile):
assert isinstance(subject(), blenderbim.core.tool.Drawing)
class TestCopyDrawingRepresentation(NewFile):
class TestCopyRepresentation(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
source = ifc.createIfcAnnotation(Representation=ifc.createIfcProductDefinitionShape())
dest = ifc.createIfcAnnotation()
subject.copy_drawing_representation(source, dest)
subject.copy_representation(source, dest)
assert dest.Representation.is_a("IfcProductDefinitionShape")