I have been trying to develop a master script to go through a series of geoprocessing tools and executing them. I am trying to generate a TIN and contours from a raw xyz file. Below is a very simple script that integrates the various tools. I am having difficulty inserting the correct inputs and outputs for the TIN generation and Surface Difference calculation/generation. Let me know if i am missing an input/output specification or a simple default value. I tried doing this same workflow on Model Builder to then export its python script, however i was unable to execute a successful TIN Output since for some reason only allowed for a Raster Output.
Note: I decided not to insert variables, i went directly to its filename.
import arcpy, exceptions, sys, traceback
from arcpy import env
from datetime import datetime
start_time = datetime.now()
print "The program has began processing", start_time
try:
#Enables ArcGIS 3D Toolbox
arcpy.CheckOutExtension("3D")
#Set workspace
env.workspace = "C:Standalone"
#Set Spatial Reference using Well-Known ID NAD 27 State Plane Missouri East FIPS
sr = arcpy.SpatialReference(26796)
#XYZ Processing to Point Shapefile
arcpy.ddd.ASCII3DToFeatureClass("004d1214_3x3.xyz", "XYZ","004d1214_el.shp", "POINT", "1",sr,)
arcpy.AddMessage("Processing Complete")
#Add XY Coordinates
in_features = "004d1214_el.shp"
arcpy.AddXY_management(in_features)
#Create TIN surface out of the generated point shapefile
arcpy.ddd.CreateTin_3d("tin004d1214_el",sr,"C:Standalone04d1214_el.shp POINT_Z Mass_Points <None>","DELAUNAY")
#Delineate TIN Area. Verify that maximum edge length is greater than the point spacing.
arcpy.ddd.DelineateTinDataArea("tin004d1214_el", 10, "ALL")
arcpy.AddMessage("Complete")
#Trigger Surface Difference to yield new elevation, Insert optional directories for TIN output
inSurface = "tin004d1214_el"
inReference = "CLASSIFIED PATH DIRECTORY"
outTin = "tin004d1214_lrp"
outPoly = arcpy.CreateUniqueName("004d1214_lrp.shp")
arcpy.SurfaceDifference_3d(inSurface,inReference,"C:Standalone04d1214_lrp.shp",outTin) #Check for syntax
#Generate Surface Contours off the Reference Survey surface
arcpy.SurfaceContour_3d(outTin,"004d1214_contours.shp") #Check for contour field add
except arcpy.ExecuteError:
print arcpy.GetMessages()
except:
# Get the traceback object
tb = sys.exc_info()[2]
tbinfo = traceback.format_tb(tb)[0]
# Concatenate error information into message string
pymsg = 'PYTHON ERRORS:nTraceback info:n{0}nError Info:n{1}'
.format(tbinfo, str(sys.exc_info()[1]))
msgs = 'ArcPy ERRORS:n {0}n'.format(arcpy.GetMessages(2))
# Return python error messages for script tool or Python Window
arcpy.AddError(pymsg)
arcpy.AddError(msgs)
end_time = datetime.now()
print ('Duration: {}'.format(end_time - start_time))