mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
black the files
This commit is contained in:
@@ -1481,7 +1481,7 @@ class DuplicateSheet(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
def _execute(self, context):
|
||||
pass
|
||||
'''
|
||||
"""
|
||||
self.props = context.scene.DocProperties
|
||||
core.duplicate_sheet(
|
||||
tool.Ifc,
|
||||
@@ -1493,7 +1493,7 @@ class DuplicateSheet(bpy.types.Operator, tool.Ifc.Operator):
|
||||
core.sync_references(tool.Ifc, tool.Collector, tool.Sheet, drawing=sheet)
|
||||
except:
|
||||
pass
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
class OpenLayout(bpy.types.Operator, tool.Ifc.Operator):
|
||||
@@ -1502,7 +1502,7 @@ class OpenLayout(bpy.types.Operator, tool.Ifc.Operator):
|
||||
bl_description = (
|
||||
"Opens selected .svg layout with default system viewer\n"
|
||||
+ 'or using "layout_svg_command" from the Bonsai preferences\n'
|
||||
+ '(if provided)'
|
||||
+ "(if provided)"
|
||||
)
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
@@ -1543,13 +1543,14 @@ class SelectAllSheets(bpy.types.Operator):
|
||||
sheet.is_selected = self.select_all
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class OpenSheet(bpy.types.Operator, tool.Ifc.Operator):
|
||||
bl_idname = "bim.open_sheet"
|
||||
bl_label = "Open Sheet"
|
||||
bl_description = (
|
||||
"Opens selected sheet with default system viewer\n"
|
||||
+ 'or using "svg_command" or "pdf_command" from\n'
|
||||
+ 'the Bonsai preferences (if provided).\n\n'
|
||||
+ "the Bonsai preferences (if provided).\n\n"
|
||||
+ "SHIFT+CLICK to open all shown checked sheets"
|
||||
)
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
@@ -1574,12 +1575,10 @@ class OpenSheet(bpy.types.Operator, tool.Ifc.Operator):
|
||||
def execute(self, context):
|
||||
self.props = context.scene.DocProperties
|
||||
svg2pdf_command = tool.Blender.get_addon_preferences().svg2pdf_command
|
||||
|
||||
|
||||
if self.open_all:
|
||||
sheets = [
|
||||
tool.Ifc.get().by_id(s.ifc_definition_id)
|
||||
for s in self.props.sheets
|
||||
if s.is_sheet and s.is_selected
|
||||
tool.Ifc.get().by_id(s.ifc_definition_id) for s in self.props.sheets if s.is_sheet and s.is_selected
|
||||
]
|
||||
else:
|
||||
sheets = [tool.Ifc.get().by_id(self.props.sheets[self.props.active_sheet_index].ifc_definition_id)]
|
||||
@@ -1613,6 +1612,7 @@ class OpenSheet(bpy.types.Operator, tool.Ifc.Operator):
|
||||
tool.Drawing.open_with_user_command(tool.Blender.get_addon_preferences().svg_command, sheet_uri)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class AddDrawingToSheet(bpy.types.Operator, tool.Ifc.Operator):
|
||||
bl_idname = "bim.add_drawing_to_sheet"
|
||||
bl_label = "Add Selected Drawing To Sheet"
|
||||
@@ -1661,7 +1661,14 @@ class AddDrawingToSheet(bpy.types.Operator, tool.Ifc.Operator):
|
||||
attributes = tool.Drawing.generate_reference_attributes(
|
||||
reference,
|
||||
Identification=str(
|
||||
len([r for r in references if tool.Drawing.get_reference_description(r) in ("DRAWING", "SCHEDULE", "REFERENCE")]) + 1
|
||||
len(
|
||||
[
|
||||
r
|
||||
for r in references
|
||||
if tool.Drawing.get_reference_description(r) in ("DRAWING", "SCHEDULE", "REFERENCE")
|
||||
]
|
||||
)
|
||||
+ 1
|
||||
),
|
||||
Location=drawing_reference.Location,
|
||||
Description="DRAWING",
|
||||
@@ -1709,8 +1716,8 @@ class CreateSheets(bpy.types.Operator, tool.Ifc.Operator):
|
||||
bl_label = "Create Sheets"
|
||||
bl_description = (
|
||||
"Build and open selected sheet from the sheet layout and\n"
|
||||
+ 'optionally create .pdf and .dxf from commands in\n'
|
||||
+ 'the Bonsai preferences (if provided).\n\n'
|
||||
+ "optionally create .pdf and .dxf from commands in\n"
|
||||
+ "the Bonsai preferences (if provided).\n\n"
|
||||
+ "SHIFT+CLICK to create all shown checked sheets, but doesn't\n"
|
||||
+ "open them for viewing\n\n"
|
||||
+ "Add the CTRL modifier to optionally open sheets to view them as\n"
|
||||
@@ -1746,11 +1753,7 @@ class CreateSheets(bpy.types.Operator, tool.Ifc.Operator):
|
||||
svg2dxf_command = tool.Blender.get_addon_preferences().svg2dxf_command
|
||||
|
||||
if self.create_all:
|
||||
sheets = [
|
||||
tool.Ifc.get().by_id(s.ifc_definition_id)
|
||||
for s in props.sheets
|
||||
if s.is_sheet and s.is_selected
|
||||
]
|
||||
sheets = [tool.Ifc.get().by_id(s.ifc_definition_id) for s in props.sheets if s.is_sheet and s.is_selected]
|
||||
else:
|
||||
sheets = [tool.Ifc.get().by_id(props.sheets[props.active_sheet_index].ifc_definition_id)]
|
||||
|
||||
@@ -1889,9 +1892,7 @@ class OpenDrawing(bpy.types.Operator):
|
||||
self.props = context.scene.DocProperties
|
||||
if self.open_all:
|
||||
drawings = [
|
||||
tool.Ifc.get().by_id(d.ifc_definition_id)
|
||||
for d in self.props.drawings
|
||||
if d.is_drawing and d.is_selected
|
||||
tool.Ifc.get().by_id(d.ifc_definition_id) for d in self.props.drawings if d.is_drawing and d.is_selected
|
||||
]
|
||||
else:
|
||||
drawings = [tool.Ifc.get().by_id(self.props.drawings.get(self.view).ifc_definition_id)]
|
||||
@@ -1978,6 +1979,7 @@ class ActivateModel(bpy.types.Operator):
|
||||
bonsai.bim.handler.refresh_ui_data()
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class ActivateDrawingBase:
|
||||
def invoke(self, context, event):
|
||||
if event.type == "LEFTMOUSE" and event.alt:
|
||||
@@ -2025,7 +2027,8 @@ class ActivateDrawingBase:
|
||||
bpy.ops.bim.update_representation(obj=camera.name, ifc_representation_class="")
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
|
||||
class ActivateDrawing(bpy.types.Operator, ActivateDrawingBase):
|
||||
bl_idname = "bim.activate_drawing"
|
||||
bl_label = "Activate Drawing"
|
||||
@@ -2050,6 +2053,7 @@ class ActivateDrawing(bpy.types.Operator, ActivateDrawingBase):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class ActivateDrawingFromSheet(bpy.types.Operator, ActivateDrawingBase):
|
||||
bl_idname = "bim.activate_drawing_from_sheet"
|
||||
bl_label = "Activate Drawing"
|
||||
@@ -2074,6 +2078,7 @@ class ActivateDrawingFromSheet(bpy.types.Operator, ActivateDrawingBase):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class SelectDocIfcFile(bpy.types.Operator):
|
||||
bl_idname = "bim.select_doc_ifc_file"
|
||||
bl_label = "Select Documentation IFC File"
|
||||
@@ -2573,7 +2578,14 @@ class AddScheduleToSheet(bpy.types.Operator, tool.Ifc.Operator):
|
||||
attributes = tool.Drawing.generate_reference_attributes(
|
||||
reference,
|
||||
Identification=str(
|
||||
len([r for r in references if tool.Drawing.get_reference_description(r) in ("DRAWING", "SCHEDULE", "REFERENCE")]) + 1
|
||||
len(
|
||||
[
|
||||
r
|
||||
for r in references
|
||||
if tool.Drawing.get_reference_description(r) in ("DRAWING", "SCHEDULE", "REFERENCE")
|
||||
]
|
||||
)
|
||||
+ 1
|
||||
),
|
||||
Location=schedule_location,
|
||||
Description="SCHEDULE",
|
||||
@@ -2633,7 +2645,13 @@ class AddReferenceToSheet(bpy.types.Operator, tool.Ifc.Operator):
|
||||
attributes = tool.Drawing.generate_reference_attributes(
|
||||
reference,
|
||||
Identification=str(
|
||||
len([r for r in references if tool.Drawing.get_reference_description(r) in ("DRAWING", "SCHEDULE", "REFERENCE")])
|
||||
len(
|
||||
[
|
||||
r
|
||||
for r in references
|
||||
if tool.Drawing.get_reference_description(r) in ("DRAWING", "SCHEDULE", "REFERENCE")
|
||||
]
|
||||
)
|
||||
+ 1
|
||||
),
|
||||
Location=extref_location,
|
||||
|
||||
@@ -92,6 +92,7 @@ class BIM_PT_camera(Panel):
|
||||
row = self.layout.row()
|
||||
row.prop(props, "dpi")
|
||||
|
||||
|
||||
class BIM_PT_element_filters(Panel):
|
||||
bl_label = "Element Filters"
|
||||
bl_idname = "BIM_PT_element_filters"
|
||||
@@ -116,18 +117,18 @@ class BIM_PT_element_filters(Panel):
|
||||
self.layout, props.include_filter_groups, ElementFiltersData, "drawing_include"
|
||||
)
|
||||
row = self.layout.row(align=True)
|
||||
row.operator("bim.edit_element_filter", icon="CHECKMARK", text="Save Include Filter").filter_mode = (
|
||||
"INCLUDE"
|
||||
)
|
||||
row.operator(
|
||||
"bim.edit_element_filter", icon="CHECKMARK", text="Save Include Filter"
|
||||
).filter_mode = "INCLUDE"
|
||||
row.operator("bim.enable_editing_element_filter", icon="CANCEL", text="").filter_mode = "NONE"
|
||||
elif props.filter_mode == "EXCLUDE":
|
||||
bonsai.bim.helper.draw_filter(
|
||||
self.layout, props.exclude_filter_groups, ElementFiltersData, "drawing_exclude"
|
||||
)
|
||||
row = self.layout.row(align=True)
|
||||
row.operator("bim.edit_element_filter", icon="CHECKMARK", text="Save Exclude Filter").filter_mode = (
|
||||
"EXCLUDE"
|
||||
)
|
||||
row.operator(
|
||||
"bim.edit_element_filter", icon="CHECKMARK", text="Save Exclude Filter"
|
||||
).filter_mode = "EXCLUDE"
|
||||
row.operator("bim.enable_editing_element_filter", icon="CANCEL", text="").filter_mode = "NONE"
|
||||
else:
|
||||
row = self.layout.row(align=True)
|
||||
@@ -251,14 +252,16 @@ class BIM_PT_drawings(Panel):
|
||||
|
||||
row2.separator(factor=0.5, type="SPACE")
|
||||
|
||||
row2.operator("bim.duplicate_drawing", icon="DUPLICATE", text="").drawing = (
|
||||
active_drawing.ifc_definition_id
|
||||
)
|
||||
row2.operator(
|
||||
"bim.duplicate_drawing", icon="DUPLICATE", text=""
|
||||
).drawing = active_drawing.ifc_definition_id
|
||||
|
||||
row3 = row.row(align=True)
|
||||
row3.alignment = "RIGHT"
|
||||
|
||||
row3.operator("bim.activate_drawing", icon="OUTLINER_OB_CAMERA", text="").drawing = active_drawing.ifc_definition_id
|
||||
row3.operator(
|
||||
"bim.activate_drawing", icon="OUTLINER_OB_CAMERA", text=""
|
||||
).drawing = active_drawing.ifc_definition_id
|
||||
row3.operator("bim.activate_model", icon="VIEW3D", text="")
|
||||
|
||||
row3.separator(factor=0.5, type="SPACE")
|
||||
@@ -317,9 +320,9 @@ class BIM_PT_schedules(Panel):
|
||||
row = self.layout.row(align=True)
|
||||
row.alignment = "RIGHT"
|
||||
row.operator("bim.open_schedule", icon="URL", text="").schedule = active_schedule.ifc_definition_id
|
||||
row.operator("bim.build_schedule", icon="LINENUMBERS_ON", text="").schedule = (
|
||||
active_schedule.ifc_definition_id
|
||||
)
|
||||
row.operator(
|
||||
"bim.build_schedule", icon="LINENUMBERS_ON", text=""
|
||||
).schedule = active_schedule.ifc_definition_id
|
||||
row.operator("bim.remove_schedule", icon="X", text="").schedule = active_schedule.ifc_definition_id
|
||||
|
||||
self.layout.template_list(
|
||||
@@ -411,20 +414,20 @@ class BIM_PT_sheets(Panel):
|
||||
if active_sheet.is_sheet:
|
||||
row2.operator("bim.remove_sheet", icon="X", text="").sheet = active_sheet.ifc_definition_id
|
||||
else:
|
||||
row2.operator("bim.remove_drawing_from_sheet", icon="X", text="").reference = active_sheet.ifc_definition_id
|
||||
row2.operator(
|
||||
"bim.remove_drawing_from_sheet", icon="X", text=""
|
||||
).reference = active_sheet.ifc_definition_id
|
||||
|
||||
row2.separator(factor=0.5, type="SPACE")
|
||||
|
||||
row2.operator("bim.duplicate_sheet", icon="DUPLICATE", text="").drawing = (
|
||||
active_sheet.ifc_definition_id
|
||||
)
|
||||
row2.operator("bim.duplicate_sheet", icon="DUPLICATE", text="").drawing = active_sheet.ifc_definition_id
|
||||
row2.operator("bim.open_documentation_web_ui", icon="URL", text="")
|
||||
|
||||
row3 = row.row(align=True)
|
||||
row3.alignment = "RIGHT"
|
||||
|
||||
op = row3.operator("bim.activate_drawing_from_sheet", icon="OUTLINER_OB_CAMERA", text="")
|
||||
|
||||
|
||||
if active_sheet.reference_type == "DRAWING":
|
||||
drawingnamesvg = active_sheet.name
|
||||
drawingname = drawingnamesvg.split(".svg")[0]
|
||||
@@ -593,10 +596,12 @@ class BIM_UL_drawinglist(bpy.types.UIList):
|
||||
row.prop(item, "is_selected", text="", icon=selected_icon, emboss=False)
|
||||
row.prop(item, "name", text="", emboss=False)
|
||||
self.props = context.scene.DocProperties
|
||||
if self.props.drawings and \
|
||||
self.props.active_drawing_id and \
|
||||
item.ifc_definition_id == self.props.active_drawing_id:
|
||||
row.label(text="", icon="OUTLINER_OB_CAMERA")
|
||||
if (
|
||||
self.props.drawings
|
||||
and self.props.active_drawing_id
|
||||
and item.ifc_definition_id == self.props.active_drawing_id
|
||||
):
|
||||
row.label(text="", icon="OUTLINER_OB_CAMERA")
|
||||
else:
|
||||
if item.target_view == "PLAN_VIEW":
|
||||
icon = "UV_FACESEL"
|
||||
@@ -630,17 +635,17 @@ class BIM_UL_sheets(bpy.types.UIList):
|
||||
row = layout.row(align=True)
|
||||
if item.is_sheet:
|
||||
if item.is_expanded:
|
||||
row.operator("bim.contract_sheet", text="", emboss=False, icon="DISCLOSURE_TRI_DOWN").sheet = (
|
||||
item.ifc_definition_id
|
||||
)
|
||||
row.operator(
|
||||
"bim.contract_sheet", text="", emboss=False, icon="DISCLOSURE_TRI_DOWN"
|
||||
).sheet = item.ifc_definition_id
|
||||
else:
|
||||
row.operator("bim.expand_sheet", text="", emboss=False, icon="DISCLOSURE_TRI_RIGHT").sheet = (
|
||||
item.ifc_definition_id
|
||||
)
|
||||
row.operator(
|
||||
"bim.expand_sheet", text="", emboss=False, icon="DISCLOSURE_TRI_RIGHT"
|
||||
).sheet = item.ifc_definition_id
|
||||
|
||||
selected_icon = "CHECKBOX_HLT" if item.is_selected else "CHECKBOX_DEHLT"
|
||||
row.prop(item, "is_selected", text="", icon=selected_icon, emboss=False)
|
||||
|
||||
|
||||
row.label(text=f"{item.identification} - {item.name}")
|
||||
else:
|
||||
row.label(text="", icon="BLANK1")
|
||||
|
||||
@@ -774,9 +774,9 @@ class Drawing(bonsai.core.tool.Drawing):
|
||||
def import_drawings(cls) -> None:
|
||||
props = bpy.context.scene.DocProperties
|
||||
expanded_target_views = {d.target_view for d in props.drawings if d.is_expanded}
|
||||
if not hasattr(cls, 'drawing_selected_states'):
|
||||
cls.drawing_selected_states = {}
|
||||
cls.drawing_selected_states.update({d.ifc_definition_id:d.is_selected for d in props.drawings if d.is_drawing})
|
||||
if not hasattr(cls, "drawing_selected_states"):
|
||||
cls.drawing_selected_states = {}
|
||||
cls.drawing_selected_states.update({d.ifc_definition_id: d.is_selected for d in props.drawings if d.is_drawing})
|
||||
props.drawings.clear()
|
||||
drawings = [e for e in tool.Ifc.get().by_type("IfcAnnotation") if e.ObjectType == "DRAWING"]
|
||||
grouped_drawings = {
|
||||
@@ -830,9 +830,9 @@ class Drawing(bonsai.core.tool.Drawing):
|
||||
def import_sheets(cls) -> None:
|
||||
props = bpy.context.scene.DocProperties
|
||||
expanded_sheets = {s.ifc_definition_id for s in props.sheets if s.is_expanded}
|
||||
if not hasattr(cls, 'sheet_selected_states'):
|
||||
cls.sheet_selected_states = {}
|
||||
cls.sheet_selected_states.update({s.ifc_definition_id:s.is_selected for s in props.sheets if s.is_sheet})
|
||||
if not hasattr(cls, "sheet_selected_states"):
|
||||
cls.sheet_selected_states = {}
|
||||
cls.sheet_selected_states.update({s.ifc_definition_id: s.is_selected for s in props.sheets if s.is_sheet})
|
||||
props.sheets.clear()
|
||||
sheets = [d for d in tool.Ifc.get().by_type("IfcDocumentInformation") if d.Scope == "SHEET"]
|
||||
for sheet in sorted(sheets, key=lambda s: getattr(s, "Identification", getattr(s, "DocumentId", None))):
|
||||
|
||||
Reference in New Issue
Block a user