mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-07 08:21:42 +00:00
Fix #6082
This commit is contained in:
@@ -41,7 +41,6 @@ import bonsai.core.geometry
|
||||
import bonsai.core.drawing as core
|
||||
import bonsai.bim.module.drawing.svgwriter as svgwriter
|
||||
import bonsai.bim.module.drawing.annotation as annotation
|
||||
import bonsai.bim.module.drawing.sheeter as sheeter
|
||||
import bonsai.bim.export_ifc
|
||||
from bonsai.bim.module.drawing.decoration import CutDecorator
|
||||
from bonsai.bim.module.drawing.data import DecoratorData, DrawingsData
|
||||
@@ -1691,15 +1690,8 @@ class RemoveDrawingFromSheet(bpy.types.Operator, tool.Ifc.Operator):
|
||||
return True
|
||||
|
||||
def _execute(self, context):
|
||||
reference = tool.Ifc.get().by_id(self.reference)
|
||||
sheet = tool.Drawing.get_reference_document(reference)
|
||||
|
||||
sheet_builder = sheeter.SheetBuilder()
|
||||
sheet_builder.remove_drawing(reference, sheet)
|
||||
|
||||
tool.Ifc.run("document.remove_reference", reference=reference)
|
||||
|
||||
tool.Drawing.import_sheets()
|
||||
ifc_file = tool.Ifc.get()
|
||||
tool.Drawing.remove_drawing_from_sheet(ifc_file.by_id(self.reference))
|
||||
|
||||
|
||||
class CreateSheets(bpy.types.Operator, tool.Ifc.Operator):
|
||||
@@ -2133,7 +2125,7 @@ class RemoveDrawing(bpy.types.Operator, tool.Ifc.Operator):
|
||||
for drawing in drawings:
|
||||
sheet_references = tool.Drawing.get_sheet_references(drawing)
|
||||
for reference in sheet_references:
|
||||
bpy.ops.bim.remove_drawing_from_sheet(reference=reference.id())
|
||||
tool.Drawing.remove_drawing_from_sheet(reference)
|
||||
core.remove_drawing(tool.Ifc, tool.Drawing, drawing=drawing)
|
||||
|
||||
# In case we removed the active drawing.
|
||||
|
||||
@@ -36,6 +36,7 @@ import bonsai.core.tool
|
||||
import bonsai.core.geometry
|
||||
import bonsai.tool as tool
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.api.document
|
||||
import ifcopenshell.geom
|
||||
import ifcopenshell.util.representation
|
||||
import ifcopenshell.util.element
|
||||
@@ -2252,3 +2253,16 @@ class Drawing(bonsai.core.tool.Drawing):
|
||||
msp.add_line(*points)
|
||||
|
||||
finalize_dxf()
|
||||
|
||||
@classmethod
|
||||
def remove_drawing_from_sheet(cls, reference: ifcopenshell.entity_instance) -> None:
|
||||
import bonsai.bim.module.drawing.sheeter as sheeter
|
||||
|
||||
sheet = tool.Drawing.get_reference_document(reference)
|
||||
|
||||
sheet_builder = sheeter.SheetBuilder()
|
||||
sheet_builder.remove_drawing(reference, sheet)
|
||||
|
||||
ifcopenshell.api.document.remove_reference(tool.Ifc.get(), reference=reference)
|
||||
|
||||
tool.Drawing.import_sheets()
|
||||
|
||||
Reference in New Issue
Block a user