Need help building a simple model

435
1
10-24-2013 08:46 AM
WightmanAdmin
New Contributor III
I have a large amount of shapefiles that I need to do a few things to.  First I need to export them as individual Feature Classes into a Feature Dataset within a File Geodatabase.  Then I need to add 5 fields to them.

SHEET_NAME  text  50
ENGINEER  text  100
PROJECT_NO  text  50
SHEET_NO  text  50
DATE  text  50

Also, they can just be named what the shapefile is named. 

Any thoughts on this? 

As always thank you in advance.
0 Kudos
1 Reply
JakeSkinner
Esri Esteemed Contributor
Hi Ryan,

You could probably accomplish this easier with python.  Here is an example:

import arcpy
from arcpy import env

# set workspace where shapefiles are located
env.workspace = r"C:\data\temp\python"

# create empty list
list = []

# append each shapefile in workspace to list
for shapefile in arcpy.ListFeatureClasses("*.shp"):
    list.append(shapefile)

# import list of shapefiles into File Geodatabase feature dataset
arcpy.FeatureClassToGeodatabase_conversion(list, r"C:\Temp\Python\Redlands.gdb\Data")

# set workspace to File Geodatabase
env.workspace = r"C:\Temp\Python\Redlands.gdb"

# loop through each feature class in 'Data' feature dataset and add fields
for fc in arcpy.ListFeatureClasses("*", "", "Data"):
    arcpy.AddField_management(fc, "SHEET_NAME", "TEXT", "", "", "50")
    arcpy.AddField_management(fc, "ENGINEER", "TEXT", "", "", "100")
    arcpy.AddField_management(fc, "PROJECT_NO", "TEXT", "", "", "50")
    arcpy.AddField_management(fc, "SHEET_NO", "TEXT", "", "", "50")
    arcpy.AddField_management(fc, "DATE", "TEXT", "", "", "50")