mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
You can now export to DXF automatically when creating sheets
This commit is contained in:
@@ -2280,18 +2280,38 @@ class CreateSheets(bpy.types.Operator):
|
|||||||
sheet_builder = sheeter.SheetBuilder()
|
sheet_builder = sheeter.SheetBuilder()
|
||||||
sheet_builder.data_dir = bpy.context.scene.BIMProperties.data_dir
|
sheet_builder.data_dir = bpy.context.scene.BIMProperties.data_dir
|
||||||
sheet_builder.build(name)
|
sheet_builder.build(name)
|
||||||
|
|
||||||
svg2pdf_command = bpy.context.preferences.addons['blenderbim'].preferences.svg2pdf_command
|
svg2pdf_command = bpy.context.preferences.addons['blenderbim'].preferences.svg2pdf_command
|
||||||
if not svg2pdf_command:
|
if svg2pdf_command:
|
||||||
|
import subprocess
|
||||||
|
path = os.path.join(bpy.context.scene.BIMProperties.data_dir, 'build', name)
|
||||||
|
svg = os.path.join(path, name + '.svg')
|
||||||
|
pdf = os.path.join(path, name + '.pdf')
|
||||||
|
# With great power comes great responsibility. Example:
|
||||||
|
# [['inkscape', svg, '-o', pdf]]
|
||||||
|
commands = eval(svg2pdf_command)
|
||||||
|
for command in commands:
|
||||||
|
subprocess.run(command)
|
||||||
|
|
||||||
|
svg2dxf_command = bpy.context.preferences.addons['blenderbim'].preferences.svg2dxf_command
|
||||||
|
if svg2dxf_command:
|
||||||
|
import subprocess
|
||||||
|
path = os.path.join(bpy.context.scene.BIMProperties.data_dir, 'build', name)
|
||||||
|
svg = os.path.join(path, name + '.svg')
|
||||||
|
eps = os.path.join(path, name + '.eps')
|
||||||
|
dxf = os.path.join(path, name + '.dxf')
|
||||||
|
base = os.path.join(path, name)
|
||||||
|
# With great power comes great responsibility. Example:
|
||||||
|
# [['inkscape', svg, '-o', eps], ['pstoedit', '-dt', '-f', 'dxf:-polyaslines -mm', eps, dxf, '-psarg', '-dNOSAFER']]
|
||||||
|
commands = eval(svg2dxf_command)
|
||||||
|
for command in commands:
|
||||||
|
subprocess.run(command)
|
||||||
|
|
||||||
|
|
||||||
|
if svg2pdf_command:
|
||||||
|
webbrowser.open('file://' + os.path.join(pdf))
|
||||||
|
else:
|
||||||
webbrowser.open('file://' + os.path.join(bpy.context.scene.BIMProperties.data_dir, 'build', name, name + '.svg'))
|
webbrowser.open('file://' + os.path.join(bpy.context.scene.BIMProperties.data_dir, 'build', name, name + '.svg'))
|
||||||
return {'FINISHED'}
|
|
||||||
import subprocess
|
|
||||||
path = os.path.join(bpy.context.scene.BIMProperties.data_dir, 'build', name)
|
|
||||||
svg = os.path.join(path, name + '.svg')
|
|
||||||
pdf = os.path.join(path, name + '.pdf')
|
|
||||||
# With great power comes great responsibility. Example:
|
|
||||||
# ['inkscape', svg, '-o', pdf]
|
|
||||||
subprocess.run(eval(svg2pdf_command))
|
|
||||||
webbrowser.open('file://' + os.path.join(pdf))
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1799,6 +1799,7 @@ class BIM_UL_representation_items(bpy.types.UIList):
|
|||||||
class BIM_ADDON_preferences(bpy.types.AddonPreferences):
|
class BIM_ADDON_preferences(bpy.types.AddonPreferences):
|
||||||
bl_idname = 'blenderbim'
|
bl_idname = 'blenderbim'
|
||||||
svg2pdf_command: StringProperty(name="SVG to PDF Command")
|
svg2pdf_command: StringProperty(name="SVG to PDF Command")
|
||||||
|
svg2dxf_command: StringProperty(name="SVG to DXF Command")
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
@@ -1810,6 +1811,8 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
|
|||||||
row.operator('bim.open_upstream', text='Visit Community').page = 'community'
|
row.operator('bim.open_upstream', text='Visit Community').page = 'community'
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.prop(self, 'svg2pdf_command')
|
row.prop(self, 'svg2pdf_command')
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(self, 'svg2dxf_command')
|
||||||
|
|
||||||
|
|
||||||
class BIM_PT_ifcclash(Panel):
|
class BIM_PT_ifcclash(Panel):
|
||||||
|
|||||||
Reference in New Issue
Block a user