mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 10:11:46 +00:00
Store scale and view title in views on sheets, so it can be post-processed
This commit is contained in:
@@ -669,6 +669,7 @@ class External(svgwrite.container.Group):
|
|||||||
class SvgWriter():
|
class SvgWriter():
|
||||||
def __init__(self, ifc_cutter):
|
def __init__(self, ifc_cutter):
|
||||||
self.ifc_cutter = ifc_cutter
|
self.ifc_cutter = ifc_cutter
|
||||||
|
self.human_scale = 'NTS'
|
||||||
self.scale = 1 / 100 # 1:100
|
self.scale = 1 / 100 # 1:100
|
||||||
|
|
||||||
def write(self):
|
def write(self):
|
||||||
@@ -683,7 +684,8 @@ class SvgWriter():
|
|||||||
debug=False,
|
debug=False,
|
||||||
size=('{}mm'.format(self.width), '{}mm'.format(self.height)),
|
size=('{}mm'.format(self.width), '{}mm'.format(self.height)),
|
||||||
viewBox=('0 0 {} {}'.format(self.width, self.height)),
|
viewBox=('0 0 {} {}'.format(self.width, self.height)),
|
||||||
id='root'
|
id='root',
|
||||||
|
data_scale=self.human_scale
|
||||||
)
|
)
|
||||||
|
|
||||||
self.add_stylesheet()
|
self.add_stylesheet()
|
||||||
|
|||||||
@@ -1349,6 +1349,10 @@ class CutSection(bpy.types.Operator):
|
|||||||
ifc_cutter.should_recut = bpy.context.scene.DocProperties.should_recut
|
ifc_cutter.should_recut = bpy.context.scene.DocProperties.should_recut
|
||||||
svg_writer = cut_ifc.SvgWriter(ifc_cutter)
|
svg_writer = cut_ifc.SvgWriter(ifc_cutter)
|
||||||
numerator, denominator = camera.data.BIMCameraProperties.diagram_scale.split(':')
|
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)
|
svg_writer.scale = float(numerator) / float(denominator)
|
||||||
ifc_cutter.cut()
|
ifc_cutter.cut()
|
||||||
svg_writer.write()
|
svg_writer.write()
|
||||||
|
|||||||
@@ -350,6 +350,7 @@ def refreshSheets(self, context):
|
|||||||
sheets_enum.clear()
|
sheets_enum.clear()
|
||||||
getSheets(self, context)
|
getSheets(self, context)
|
||||||
|
|
||||||
|
|
||||||
def getSheets(self, context):
|
def getSheets(self, context):
|
||||||
global sheets_enum
|
global sheets_enum
|
||||||
if len(sheets_enum) < 1:
|
if len(sheets_enum) < 1:
|
||||||
@@ -376,6 +377,7 @@ class DocProperties(PropertyGroup):
|
|||||||
class BIMCameraProperties(PropertyGroup):
|
class BIMCameraProperties(PropertyGroup):
|
||||||
view_name: StringProperty(name="View Name")
|
view_name: StringProperty(name="View Name")
|
||||||
diagram_scale: EnumProperty(items=getDiagramScales, name='Diagram Scale')
|
diagram_scale: EnumProperty(items=getDiagramScales, name='Diagram Scale')
|
||||||
|
is_nts: BoolProperty(name='Is NTS')
|
||||||
|
|
||||||
|
|
||||||
class BcfTopic(PropertyGroup):
|
class BcfTopic(PropertyGroup):
|
||||||
|
|||||||
@@ -61,6 +61,11 @@ class SheetBuilder:
|
|||||||
foreground.attrib['width'] = view_root.attrib.get('width')
|
foreground.attrib['width'] = view_root.attrib.get('width')
|
||||||
foreground.attrib['height'] = view_root.attrib.get('height')
|
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)
|
sheet_tree.write(sheet_path)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
|
|||||||
@@ -350,6 +350,9 @@ class BIM_PT_camera(Panel):
|
|||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.prop(dprops, 'should_recut')
|
row.prop(dprops, 'should_recut')
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(props, 'is_nts')
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(props, 'diagram_scale', text='')
|
row.prop(props, 'diagram_scale', text='')
|
||||||
row.operator('bim.cut_section')
|
row.operator('bim.cut_section')
|
||||||
|
|||||||
Reference in New Issue
Block a user