-
Notifications
You must be signed in to change notification settings - Fork 0
/
DXF2SHP.py
58 lines (57 loc) · 2.4 KB
/
DXF2SHP.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# -*- coding: cp1254 -*-
# ---------------------------------------------------------------------------
# create_semih_archydro.py
#
# Coded by :
# Semih DALGIN
#
#
# Requires Arc10 and ArcHydro 2.0
#
#
# ---------------------------------------------------------------------------
# Import system modules
import arcpy, time, datetime, os, sys, string, csv, shutil
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
try:
# Script arguments
arcpy.AddMessage ("\nBaþlangýç Deðerleri Alýnýyor..." )
try:
# Make parameters array, and later write input parameter values to an output file
parameters = []
now = datetime.datetime.now()
parameters.append("Date and Time: "+ now.strftime("%Y-%m-%d %H:%M"))
# Folder where output files will be saved
workspace = arcpy.GetParameterAsText(0)
parameters.append("Workspace: " + workspace)
except:
arcpy.AddMessage("\nError in input arguments: " + arcpy.GetMessages(2))
raise Exception
# Check and create output folders
try:
for aa in range (0,28,1):
alfabe="abcçdefghýijklmnoöprsþtuüvyz"
aalfabe=alfabe[aa:aa+1]
for y in range (1,90,1):
for x in range (1,5,1):
for z in range (0,4,1):
harf="abcd"
xharf=harf[z:z+1]
name="%s" %aalfabe+"%s" %y+"%s" %xharf + "%d"%x+".dxf Polyline"
arcpy.AddMessage("\nÇalýþýlan Dosya: " + name)
if arcpy.Exists("%s" %name):
arcpy.SelectLayerByAttribute_management("%s" %name,"CLEAR_SELECTION","")
arcpy.SelectLayerByAttribute_management("%s" %name,"NEW_SELECTION","Layer = 'ANA_MUNHANI' OR Layer = 'ARA_MUNHANI' OR Layer = 'YRD_MUNHANI'")
exportname="%s" %aalfabe+"%s" %y+"%s" %xharf + "%d"%x+".shp"
arcpy.FeatureClassToFeatureClass_conversion("%s" %name,workspace,exportname,"","","")
arcpy.AddMessage("\nTamamlandý")
else:
arcpy.AddMessage("\nYok")
except:
arcpy.AddError("\nHata Hesaplamalarda" + arcpy.GetMessages(2))
raise Exception
except:
arcpy.AddError("\nError running script")
raise Exception