mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 14:02:27 +00:00
See #2978. Fix crash upon drawing deletion.
This commit is contained in:
@@ -261,11 +261,6 @@ def remove_drawing(ifc, drawing_tool, drawing=None):
|
|||||||
if collection:
|
if collection:
|
||||||
drawing_tool.delete_collection(collection)
|
drawing_tool.delete_collection(collection)
|
||||||
|
|
||||||
group = drawing_tool.get_drawing_group(drawing)
|
|
||||||
if group:
|
|
||||||
drawing_tool.delete_drawing_elements(drawing_tool.get_group_elements(group))
|
|
||||||
ifc.run("group.remove_group", group=group)
|
|
||||||
|
|
||||||
for reference in drawing_tool.get_drawing_references(drawing):
|
for reference in drawing_tool.get_drawing_references(drawing):
|
||||||
reference_obj = ifc.get_object(reference)
|
reference_obj = ifc.get_object(reference)
|
||||||
if reference_obj:
|
if reference_obj:
|
||||||
@@ -277,7 +272,12 @@ def remove_drawing(ifc, drawing_tool, drawing=None):
|
|||||||
if drawing_tool.does_file_exist(uri):
|
if drawing_tool.does_file_exist(uri):
|
||||||
drawing_tool.delete_file(uri)
|
drawing_tool.delete_file(uri)
|
||||||
ifc.run("document.remove_information", information=information)
|
ifc.run("document.remove_information", information=information)
|
||||||
ifc.run("root.remove_product", product=drawing)
|
|
||||||
|
group = drawing_tool.get_drawing_group(drawing)
|
||||||
|
if group:
|
||||||
|
drawing_tool.delete_drawing_elements(drawing_tool.get_group_elements(group))
|
||||||
|
ifc.run("group.remove_group", group=group)
|
||||||
|
|
||||||
drawing_tool.import_drawings()
|
drawing_tool.import_drawings()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -356,7 +356,6 @@ class TestRemoveDrawing:
|
|||||||
drawing.does_file_exist("absolute_uri").should_be_called().will_return(True)
|
drawing.does_file_exist("absolute_uri").should_be_called().will_return(True)
|
||||||
drawing.delete_file("absolute_uri").should_be_called()
|
drawing.delete_file("absolute_uri").should_be_called()
|
||||||
ifc.run("document.remove_information", information="information").should_be_called()
|
ifc.run("document.remove_information", information="information").should_be_called()
|
||||||
ifc.run("root.remove_product", product="drawing").should_be_called()
|
|
||||||
drawing.import_drawings().should_be_called()
|
drawing.import_drawings().should_be_called()
|
||||||
subject.remove_drawing(ifc, drawing, drawing="drawing")
|
subject.remove_drawing(ifc, drawing, drawing="drawing")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user