|
|
@ -31,8 +31,7 @@ def point_to_row(point, layer, dxf_type, dxf_id):
|
|
|
|
return row
|
|
|
|
return row
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def convert(dxf_name, layer_name):
|
|
|
|
def print_layers(dxf_name):
|
|
|
|
# Read dxf file
|
|
|
|
|
|
|
|
dxf = dxfgrabber.readfile(dxf_name)
|
|
|
|
dxf = dxfgrabber.readfile(dxf_name)
|
|
|
|
|
|
|
|
|
|
|
|
# Get data from DTM
|
|
|
|
# Get data from DTM
|
|
|
@ -41,6 +40,11 @@ def convert(dxf_name, layer_name):
|
|
|
|
for layer in layers:
|
|
|
|
for layer in layers:
|
|
|
|
print(layer)
|
|
|
|
print(layer)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def convert(dxf_name, layer_name):
|
|
|
|
|
|
|
|
# Read dxf file
|
|
|
|
|
|
|
|
dxf = dxfgrabber.readfile(dxf_name)
|
|
|
|
|
|
|
|
|
|
|
|
if layer_name:
|
|
|
|
if layer_name:
|
|
|
|
print("\nExtracting data from layer '{}'".format(layer_name))
|
|
|
|
print("\nExtracting data from layer '{}'".format(layer_name))
|
|
|
|
entities = [
|
|
|
|
entities = [
|
|
|
@ -86,12 +90,25 @@ def convert(dxf_name, layer_name):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
dxf_name = sys.argv[1]
|
|
|
|
# Set up command line arguments
|
|
|
|
try:
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
layer_name = sys.argv[2]
|
|
|
|
parser.add_argument('dxf_name', help='path to dxf file', default=None)
|
|
|
|
except IndexError:
|
|
|
|
parser.add_argument(
|
|
|
|
layer_name = None
|
|
|
|
'-n', metavar='LAYER_NAME', help='name of layer', default=None)
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
|
|
|
|
'-l', action='store_true', help='show list of layers', default=False)
|
|
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Parse arguments
|
|
|
|
|
|
|
|
dxf_name = args.dxf_name
|
|
|
|
|
|
|
|
layer_name = args.n
|
|
|
|
|
|
|
|
show_layers_only = args.l
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if show_layers_only:
|
|
|
|
|
|
|
|
# Print list of layers only
|
|
|
|
|
|
|
|
print_layers(dxf_name)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
# Convert to csv
|
|
|
|
convert(dxf_name, layer_name)
|
|
|
|
convert(dxf_name, layer_name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|