You can now pick the vector style for each drawing style

This commit is contained in:
Dion Moult
2020-08-13 20:38:50 +10:00
parent 3254bc3c14
commit 43186e4e59
6 changed files with 26 additions and 4 deletions
@@ -156,6 +156,7 @@ class IfcCutter:
self.template_variables = {}
self.metadata = {}
self.data_dir = ''
self.vector_style = ''
self.ifc_filenames = []
self.ifc_files = {}
self.resolved_pixels = set()
@@ -2,11 +2,11 @@
.background { fill: white; stroke: black; stroke-linecap: 'round'; stroke-width: 0.25; }
.annotation { fill: none; stroke: black; stroke-linecap: 'round'; stroke-width: 0.25; }
.hidden { stroke-dasharray: 3, 2; }
.solid {}
.leader { marker-end: url(#leader-marker); }
.stair { marker-start: url(#stair-marker-start); marker-end: url(#stair-marker-end); }
.break { fill: white; }
.breakline { fill: none; stroke: black; stroke-linecap: 'round'; stroke-width: 0.25; marker-mid: url(#breakline-marker); }
.solid {}
.material-blank { fill: white; }
.material-diagonal1 { fill: url(#diagonal1); }
.material-diagonal2 { fill: url(#diagonal2); }
@@ -21,4 +21,4 @@
.material-grass { fill: url(#grass); }
.material-honeycomb { fill: url(#honeycomb); }
.material-sand { fill: url(#sand); }
.material-concrete { fill: url(#concrete); }
.material-concrete { fill: url(#concrete); stroke-width: 0.5; }
@@ -0,0 +1,9 @@
.cut { fill: white; stroke: black; stroke-linecap: 'round'; stroke-width: 0.35; }
.background { fill: white; stroke: black; stroke-linecap: 'round'; stroke-width: 0.25; }
.annotation { fill: none; stroke: black; stroke-linecap: 'round'; stroke-width: 0.25; }
.hidden { stroke-dasharray: 3, 2; }
.solid {}
.leader { marker-end: url(#leader-marker); }
.stair { marker-start: url(#stair-marker-start); marker-end: url(#stair-marker-end); }
.break { fill: white; }
.breakline { fill: none; stroke: black; stroke-linecap: 'round'; stroke-width: 0.25; marker-mid: url(#breakline-marker); }
@@ -2066,6 +2066,7 @@ class CutSection(bpy.types.Operator):
import ifccsv
ifc_cutter.ifc_filenames = [i.name for i in bpy.context.scene.DocProperties.ifc_files]
ifc_cutter.data_dir = bpy.context.scene.BIMProperties.data_dir
ifc_cutter.vector_style = bpy.context.scene.DocProperties.drawing_styles[camera.data.BIMCameraProperties.active_drawing_style_index].vector_style
ifc_cutter.diagram_name = self.diagram_name
ifc_cutter.background_image = bpy.context.scene.render.filepath
if camera.data.BIMCameraProperties.cut_objects == 'CUSTOM':
+12 -1
View File
@@ -49,6 +49,7 @@ target_views_enum = []
persons_enum = []
organisations_enum = []
sheets_enum = []
vector_styles_enum = []
bcfviewpoints_enum = []
@persistent
@@ -416,6 +417,16 @@ def getSheets(self, context):
return sheets_enum
def getVectorStyles(self, context):
global vector_styles_enum
if len(vector_styles_enum) < 1:
sheets_enum.clear()
for filename in Path(os.path.join(context.scene.BIMProperties.data_dir, 'styles')).glob('*.css'):
f = str(filename.stem)
vector_styles_enum.append((f, f, ''))
return vector_styles_enum
def refreshFontSize(self, context):
annotation.Annotator.resize_text(context.active_object)
@@ -443,7 +454,7 @@ class Drawing(PropertyGroup):
class DrawingStyle(PropertyGroup):
name: StringProperty(name='Name')
raster_style: StringProperty(name='Raster Style')
vector_style: StringProperty(name='Vector Style')
vector_style: EnumProperty(items=getVectorStyles, name='Vector Style')
include_query: StringProperty(name='Include Query')
exclude_query: StringProperty(name='Exclude Query')
@@ -70,7 +70,7 @@ class SvgWriter():
self.height = self.raw_height * self.scale
def add_stylesheet(self):
with open('{}styles/default.css'.format(self.ifc_cutter.data_dir), 'r') as stylesheet:
with open('{}styles/{}.css'.format(self.ifc_cutter.data_dir, self.ifc_cutter.vector_style), 'r') as stylesheet:
self.svg.defs.add(self.svg.style(stylesheet.read()))
def add_markers(self):