Auto-add the currently loaded IFC when creating a drawing for the first time

This commit is contained in:
Dion Moult
2020-12-03 21:51:14 +11:00
parent bdaf8cd0f3
commit 8bb157ce0a
@@ -2419,6 +2419,9 @@ class CutSection(bpy.types.Operator):
camera = bpy.context.scene.camera
if not (camera.type == "CAMERA" and camera.data.type == "ORTHO"):
return {"FINISHED"}
if not bpy.context.scene.DocProperties.ifc_files and bpy.context.scene.BIMProperties.ifc_file:
new = bpy.context.scene.DocProperties.ifc_files.add()
new.name = bpy.context.scene.BIMProperties.ifc_file
bpy.ops.bim.activate_view(
drawing_index=bpy.context.scene.DocProperties.drawings.find(camera.name.split("/")[1])
)