mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
A bit more intuitive adding drawing/schedule to the sheet
Now it will detect currently active sheet even if you have sheet's drawing/titleblock/schedule selected.
This commit is contained in:
@@ -1034,7 +1034,7 @@ class AddDrawingToSheet(bpy.types.Operator, Operator):
|
|||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
props = context.scene.DocProperties
|
props = context.scene.DocProperties
|
||||||
active_drawing = props.drawings[props.active_drawing_index]
|
active_drawing = props.drawings[props.active_drawing_index]
|
||||||
active_sheet = props.sheets[props.active_sheet_index]
|
active_sheet = tool.Drawing.get_active_sheet(context)
|
||||||
drawing = tool.Ifc.get().by_id(active_drawing.ifc_definition_id)
|
drawing = tool.Ifc.get().by_id(active_drawing.ifc_definition_id)
|
||||||
drawing_reference = tool.Drawing.get_drawing_document(drawing)
|
drawing_reference = tool.Drawing.get_drawing_document(drawing)
|
||||||
|
|
||||||
@@ -1574,7 +1574,7 @@ class AddScheduleToSheet(bpy.types.Operator, Operator):
|
|||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
props = context.scene.DocProperties
|
props = context.scene.DocProperties
|
||||||
active_schedule = props.schedules[props.active_schedule_index]
|
active_schedule = props.schedules[props.active_schedule_index]
|
||||||
active_sheet = props.sheets[props.active_sheet_index]
|
active_sheet = tool.Drawing.get_active_sheet(context)
|
||||||
schedule = tool.Ifc.get().by_id(active_schedule.ifc_definition_id)
|
schedule = tool.Ifc.get().by_id(active_schedule.ifc_definition_id)
|
||||||
if tool.Ifc.get_schema() == "IFC2X3":
|
if tool.Ifc.get_schema() == "IFC2X3":
|
||||||
schedule_location = tool.Drawing.get_path_with_ext(schedule.DocumentReferences[0].Location, "svg")
|
schedule_location = tool.Drawing.get_path_with_ext(schedule.DocumentReferences[0].Location, "svg")
|
||||||
|
|||||||
@@ -671,6 +671,11 @@ class Drawing(blenderbim.core.tool.Drawing):
|
|||||||
new.name = os.path.basename(reference.Location)
|
new.name = os.path.basename(reference.Location)
|
||||||
new.reference_type = reference.Description
|
new.reference_type = reference.Description
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_active_sheet(cls, context):
|
||||||
|
props = context.scene.DocProperties
|
||||||
|
return next(s for s in props.sheets[: props.active_sheet_index + 1][::-1] if s.is_sheet)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def import_text_attributes(cls, obj):
|
def import_text_attributes(cls, obj):
|
||||||
props = obj.BIMTextProperties
|
props = obj.BIMTextProperties
|
||||||
|
|||||||
Reference in New Issue
Block a user