mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 18:26:25 +00:00
Removing sheets now works in IFC. See #1153.
This commit is contained in:
@@ -1048,16 +1048,16 @@ class EditVectorStyle(bpy.types.Operator):
|
|||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class RemoveSheet(bpy.types.Operator):
|
class RemoveSheet(bpy.types.Operator, Operator):
|
||||||
bl_idname = "bim.remove_sheet"
|
bl_idname = "bim.remove_sheet"
|
||||||
bl_label = "Remove Sheet"
|
bl_label = "Remove Sheet"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
index: bpy.props.IntProperty()
|
index: bpy.props.IntProperty()
|
||||||
|
|
||||||
def execute(self, context):
|
def _execute(self, context):
|
||||||
props = context.scene.DocProperties
|
self.props = context.scene.DocProperties
|
||||||
props.sheets.remove(self.index)
|
sheet = tool.Ifc.get().by_id(self.props.sheets[self.props.active_sheet_index].ifc_definition_id)
|
||||||
return {"FINISHED"}
|
core.remove_sheet(tool.Ifc, tool.Drawing, sheet=sheet)
|
||||||
|
|
||||||
|
|
||||||
class AddSchedule(bpy.types.Operator):
|
class AddSchedule(bpy.types.Operator):
|
||||||
|
|||||||
@@ -375,7 +375,9 @@ class BIM_UL_sheets(bpy.types.UIList):
|
|||||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
||||||
if item:
|
if item:
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.label(text=item.identification or "X")
|
split1 = row.split(factor=0.2)
|
||||||
row.label(text=item.name or "Unnamed")
|
split1.label(text=item.identification or "X")
|
||||||
|
split2 = split1.split(factor=0.8)
|
||||||
|
split2.label(text=item.name or "Unnamed")
|
||||||
else:
|
else:
|
||||||
layout.label(text="", translate=False)
|
layout.label(text="", translate=False)
|
||||||
|
|||||||
@@ -82,3 +82,8 @@ def add_sheet(ifc, drawing, titleblock=None):
|
|||||||
|
|
||||||
def open_sheet(drawing, sheet=None):
|
def open_sheet(drawing, sheet=None):
|
||||||
drawing.open_svg(drawing.get_sheet_filename(sheet))
|
drawing.open_svg(drawing.get_sheet_filename(sheet))
|
||||||
|
|
||||||
|
|
||||||
|
def remove_sheet(ifc, drawing, sheet=None):
|
||||||
|
ifc.run("document.remove_document", document=sheet)
|
||||||
|
drawing.import_sheets()
|
||||||
|
|||||||
@@ -117,3 +117,10 @@ class TestOpenSheet:
|
|||||||
drawing.get_sheet_filename("sheet").should_be_called().will_return("filename")
|
drawing.get_sheet_filename("sheet").should_be_called().will_return("filename")
|
||||||
drawing.open_svg("filename").should_be_called()
|
drawing.open_svg("filename").should_be_called()
|
||||||
subject.open_sheet(drawing, sheet="sheet")
|
subject.open_sheet(drawing, sheet="sheet")
|
||||||
|
|
||||||
|
|
||||||
|
class TestRemoveSheet:
|
||||||
|
def test_run(self, ifc, drawing):
|
||||||
|
ifc.run("document.remove_document", document="sheet").should_be_called()
|
||||||
|
drawing.import_sheets().should_be_called()
|
||||||
|
subject.remove_sheet(ifc, drawing, sheet="sheet")
|
||||||
|
|||||||
Reference in New Issue
Block a user