Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ENNet_Main
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Interative machine learning
ENNet_Main
Commits
97cd8499
Commit
97cd8499
authored
2 years ago
by
Sheela Raju Kurupathi
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
55aab36d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dxf2svg.py
+43
-0
43 additions, 0 deletions
dxf2svg.py
with
43 additions
and
0 deletions
dxf2svg.py
0 → 100644
+
43
−
0
View file @
97cd8499
# !/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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment