-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathread_DWG.py
executable file
·35 lines (29 loc) · 1013 Bytes
/
read_DWG.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import sys
sys.path.append('/mnt/data01/Code/')
import numpy as np
import ezdxf
def read_DWG(dxf_file_name):
"""
% (C) Nick Holschuh - Amherst College - 2022 ([email protected])
% This function reads a DWG file
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The inputs are as follows:
%
% dxf_file_name -- The filename to read
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The outputs are as follows:
%
% outdict -- the data read from the file
% layers -- the set of all possible layers
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
"""
from NDH_Tools import get_DWG_layers
from NDH_Tools import read_DWG_layer
data = ezdxf.readfile(dxf_file_name)
layers = get_DWG_layers(data)
outdict = {}
for i in layers:
outdict[i] = read_DWG_layer(i,data)
return outdict, layers