Skip to content
Snippets Groups Projects
Commit 97cd8499 authored by Sheela Raju Kurupathi's avatar Sheela Raju Kurupathi
Browse files

Upload New File

parent 55aab36d
No related branches found
No related tags found
No related merge requests found
# !/usr/bin/env python3
import sys
import matplotlib.pyplot as plt
import ezdxf
from ezdxf.addons.drawing import RenderContext, Frontend
from ezdxf.addons.drawing.matplotlib_backend import MatplotlibBackend
import os
in_folder = r"/home/kurupathi/PycharmProjects/BIMKIT/ENNet-main/dataset/original"
files = os.listdir(in_folder)
for file in files:
print(f"{file=}")
# Safe loading procedure (requires ezdxf v0.14):
try:
doc, auditor = recover.readfile(file)
except IOError:
print( f'Not a DXF file or a generic I/O error.' )
sys.exit( 1 )
except ezdxf.DXFStructureError:
print( f'Invalid or corrupted DXF file.' )
sys.exit( 2 )
# The auditor.errors attribute stores severe errors,
# which may raise exceptions when rendering.
if not auditor.has_errors:
fig = plt.figure()
ax = fig.add_axes( [0, 0, 1, 1] )
ctx = RenderContext( doc )
out = MatplotlibBackend( ax )
Frontend( ctx, out ).draw_layout( doc.modelspace(), finalize=True )
fig.savefig('your.svg')
'''
doc = ezdxf.readfile( file )
fig = plt.figure()
out = MatplotlibBackend( fig.add_axes( [0, 0, 1, 1] ) )
Frontend( RenderContext( doc ), out ).draw_layout( doc.modelspace(), finalize=True )
# fig.savefig(os.path.join(temp_output_dir, outputfilebase + ".png"), dpi=300)
fig.savefig( os.path.join( output, outputfilebase + ".svg" ) )
'''
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment