Store scale and view title in views on sheets, so it can be post-processed

This commit is contained in:
Dion Moult
2020-03-26 21:44:54 +11:00
parent f37e5e5d83
commit 03a23958a3
5 changed files with 17 additions and 1 deletions
+3 -1
View File
@@ -669,6 +669,7 @@ class External(svgwrite.container.Group):
class SvgWriter():
def __init__(self, ifc_cutter):
self.ifc_cutter = ifc_cutter
self.human_scale = 'NTS'
self.scale = 1 / 100 # 1:100
def write(self):
@@ -683,7 +684,8 @@ class SvgWriter():
debug=False,
size=('{}mm'.format(self.width), '{}mm'.format(self.height)),
viewBox=('0 0 {} {}'.format(self.width, self.height)),
id='root'
id='root',
data_scale=self.human_scale
)
self.add_stylesheet()
@@ -1349,6 +1349,10 @@ class CutSection(bpy.types.Operator):
ifc_cutter.should_recut = bpy.context.scene.DocProperties.should_recut
svg_writer = cut_ifc.SvgWriter(ifc_cutter)
numerator, denominator = camera.data.BIMCameraProperties.diagram_scale.split(':')
if camera.data.BIMCameraProperties.is_nts:
svg_writer.human_scale = 'NTS'
else:
svg_writer.human_scale = camera.data.BIMCameraProperties.diagram_scale
svg_writer.scale = float(numerator) / float(denominator)
ifc_cutter.cut()
svg_writer.write()
+2
View File
@@ -350,6 +350,7 @@ def refreshSheets(self, context):
sheets_enum.clear()
getSheets(self, context)
def getSheets(self, context):
global sheets_enum
if len(sheets_enum) < 1:
@@ -376,6 +377,7 @@ class DocProperties(PropertyGroup):
class BIMCameraProperties(PropertyGroup):
view_name: StringProperty(name="View Name")
diagram_scale: EnumProperty(items=getDiagramScales, name='Diagram Scale')
is_nts: BoolProperty(name='Is NTS')
class BcfTopic(PropertyGroup):
@@ -61,6 +61,11 @@ class SheetBuilder:
foreground.attrib['width'] = view_root.attrib.get('width')
foreground.attrib['height'] = view_root.attrib.get('height')
title = ET.SubElement(view, 'image')
title.attrib['xlink:href'] = '../templates/view-title.svg'
title.attrib['x'] = '0'
title.attrib['y'] = view_root.attrib.get('height')
sheet_tree.write(sheet_path)
def build(self):
+3
View File
@@ -350,6 +350,9 @@ class BIM_PT_camera(Panel):
row = layout.row()
row.prop(dprops, 'should_recut')
row = layout.row()
row.prop(props, 'is_nts')
row = layout.row(align=True)
row.prop(props, 'diagram_scale', text='')
row.operator('bim.cut_section')