diff --git a/src/blenderbim/blenderbim/bim/data/pset/Psets_BBIM_Annotation.ifc b/src/blenderbim/blenderbim/bim/data/pset/Psets_BBIM_Annotation.ifc index ae43708961..a466449dcc 100644 --- a/src/blenderbim/blenderbim/bim/data/pset/Psets_BBIM_Annotation.ifc +++ b/src/blenderbim/blenderbim/bim/data/pset/Psets_BBIM_Annotation.ifc @@ -18,5 +18,14 @@ DATA; #11=IFCSIMPLEPROPERTYTEMPLATE('1DtsPn5a9FG8$zXHDDMavY',$,'ShowEndArrow','Display end arrow.',.P_SINGLEVALUE.,'IfcBoolean',$,$,$,$,$,.READWRITE.); #12=IFCSIMPLEPROPERTYTEMPLATE('2$6U0mLI9AiPRWeBabdY3u',$,'EndArrowSymbol','Custom symbol for the end of the section marker arrow. Need to make sure it''s present in "symbols.svg".',.P_SINGLEVALUE.,'IfcLabel',$,$,$,$,$,.READWRITE.); #13=IFCSIMPLEPROPERTYTEMPLATE('1naFqntIL7igCY7hCaE7kq',$,'HasConnectedSectionLine','Connect or disconnect section markers with line (by default = True).',.P_SINGLEVALUE.,'IfcBoolean',$,$,$,$,$,.READWRITE.); +#14=IFCPROPERTYSETTEMPLATE('3V8oZ8YRD3_O7uR5vcUleS',$,'BBIM_Documentation','',.PSET_OCCURRENCEDRIVEN.,'IfcProject',(#15,#16,#17,#18,#19,#20,#21,#22)); +#15=IFCSIMPLEPROPERTYTEMPLATE('0ulAhgk3v9qfGlDILauR6J',$,'SheetsDir','Default sheets directory',.P_SINGLEVALUE.,'IfcURIReference',$,$,$,$,$,.READWRITE.); +#16=IFCSIMPLEPROPERTYTEMPLATE('2yvlVKiQXASucfH40deCvu',$,'LayoutsDir','Default layouts directory',.P_SINGLEVALUE.,'IfcURIReference',$,$,$,$,$,.READWRITE.); +#17=IFCSIMPLEPROPERTYTEMPLATE('2kXZqXicL3jRwsOnLM_0ho',$,'TitleblocksDir','Default titleblocks directory',.P_SINGLEVALUE.,'IfcURIReference',$,$,$,$,$,.READWRITE.); +#18=IFCSIMPLEPROPERTYTEMPLATE('1lmOfo9Bf9beMBJkCZKf5Y',$,'DrawingsDir','Default drawings directory',.P_SINGLEVALUE.,'IfcURIReference',$,$,$,$,$,.READWRITE.); +#19=IFCSIMPLEPROPERTYTEMPLATE('30cOKpb4D9CADKM04$N9X3',$,'StylesheetPath','Default stylesheet CSS',.P_SINGLEVALUE.,'IfcURIReference',$,$,$,$,$,.READWRITE.); +#20=IFCSIMPLEPROPERTYTEMPLATE('23tejOrxj859R_eCRp1AFP',$,'MarkersPath','Default markers SVG',.P_SINGLEVALUE.,'IfcURIReference',$,$,$,$,$,.READWRITE.); +#21=IFCSIMPLEPROPERTYTEMPLATE('1UDakJ5_f7kBhggNSW4$h5',$,'SymbolsPath','Default symbols SVG',.P_SINGLEVALUE.,'IfcURIReference',$,$,$,$,$,.READWRITE.); +#22=IFCSIMPLEPROPERTYTEMPLATE('0d53LEtgLDQxnv__NfgH7i',$,'PatternsPath','Default patterns SVG',.P_SINGLEVALUE.,'IfcURIReference',$,$,$,$,$,.READWRITE.); ENDSEC; END-ISO-10303-21; diff --git a/src/blenderbim/blenderbim/tool/drawing.py b/src/blenderbim/blenderbim/tool/drawing.py index 2aa7263683..d9405e730d 100644 --- a/src/blenderbim/blenderbim/tool/drawing.py +++ b/src/blenderbim/blenderbim/tool/drawing.py @@ -753,23 +753,39 @@ class Drawing(blenderbim.core.tool.Drawing): @classmethod def get_default_layout_path(cls, identification, name): - return os.path.join( - bpy.context.scene.DocProperties.layouts_dir, cls.sanitise_filename(f"{identification} - {name}.svg") + project = tool.Ifc.get().by_type("IfcProject")[0] + layouts_dir = ( + ifcopenshell.util.element.get_pset(project, "BBIM_Documentation", "LayoutsDir") + or bpy.context.scene.DocProperties.layouts_dir ) + return os.path.join(layouts_dir, cls.sanitise_filename(f"{identification} - {name}.svg")) @classmethod def get_default_sheet_path(cls, identification, name): - return os.path.join( - bpy.context.scene.DocProperties.sheets_dir, cls.sanitise_filename(f"{identification} - {name}.svg") + project = tool.Ifc.get().by_type("IfcProject")[0] + sheets_dir = ( + ifcopenshell.util.element.get_pset(project, "BBIM_Documentation", "SheetsDir") + or bpy.context.scene.DocProperties.sheets_dir ) + return os.path.join(sheets_dir, cls.sanitise_filename(f"{identification} - {name}.svg")) @classmethod def get_default_titleblock_path(cls, name): - return os.path.join(bpy.context.scene.DocProperties.titleblocks_dir, cls.sanitise_filename(f"{name}.svg")) + project = tool.Ifc.get().by_type("IfcProject")[0] + titleblocks_dir = ( + ifcopenshell.util.element.get_pset(project, "BBIM_Documentation", "TitleblocksDir") + or bpy.context.scene.DocProperties.titleblocks_dir + ) + return os.path.join(titleblocks_dir, cls.sanitise_filename(f"{name}.svg")) @classmethod def get_default_drawing_path(cls, name): - return os.path.join(bpy.context.scene.DocProperties.drawings_dir, cls.sanitise_filename(f"{name}.svg")) + project = tool.Ifc.get().by_type("IfcProject")[0] + drawings_dir = ( + ifcopenshell.util.element.get_pset(project, "BBIM_Documentation", "DrawingsDir") + or bpy.context.scene.DocProperties.drawings_dir + ) + return os.path.join(drawings_dir, cls.sanitise_filename(f"{name}.svg")) @classmethod def sanitise_filename(cls, name): @@ -777,7 +793,11 @@ class Drawing(blenderbim.core.tool.Drawing): @classmethod def get_default_drawing_resource_path(cls, resource): - return getattr(bpy.context.scene.DocProperties, f"{resource.lower()}_path") or None + project = tool.Ifc.get().by_type("IfcProject")[0] + return ( + ifcopenshell.util.element.get_pset(project, "BBIM_Documentation", f"{resource}Path") + or getattr(bpy.context.scene.DocProperties, f"{resource.lower()}_path") + ) or None @classmethod def get_potential_reference_elements(cls, drawing):