1

I am trying to create an ArcGIS map tool that includes creating TINS and uses parameters. This tool works fine when taking the data from shapefiles, but when I use map layers, which is what I want it stops working at CreateTin tool with the error: Failed to execute (CreateTin).

Here is the TIN creation code that I am using:

# Import arcpy module
import arcpy, sys, string
from arcpy import env
from sys import exit

# Check out any necessary licenses
arcpy.CheckOutExtension("3D")

# Coordinate System
prjfile = r'C:\Data\project.prj'
Coordinate_System = arcpy.SpatialReference(prjfile)


#Set parameters
Points1 = arcpy.GetParameterAsText(0)
Points2 = arcpy.GetParameterAsText(1)
Polygon = arcpy.GetParameterAsText(2)

# Parameters using elevation points for Create TIN tool
TIN1 = "test1"
TIN2= "test2" 
Params1 = Points1 + " elev Mass_Points <None>"
Params2 = Points2 + " elev Mass_Points <None>" 

# Create TIN models
arcpy.CreateTin_3d(TIN1, Coordinate_System, Params1, "DELAUNAY")  
arcpy.CreateTin_3d(TIN2, Coordinate_System, Params2, "DELAUNAY")

instead of using a workspace I want to do everything in the current map but I am not sure how to use the arcpy.mapping module to read the layers into the map. I was thinking this might be an issue.

Still new to this but I need to learn.

1 Answer 1

1

when it come to creating a new dataset (like with createTIN), you need to store it somewhere on the disk. Layer and maps are used to display the data.

So if you wan your TIN to be visible on the map, you can use a layer as input (it points to some data), create an output in a scratchworkspace, then add your new dataset as a layer using arcpy.mapping

6
  • I tried that and now I get the message - ERROR 000800: The value is not a member of <None>. Failed to execute (CreateTin). for " elev Mass_Points <None>"
    – marion
    Apr 14, 2014 at 18:35
  • looking at your error message, it seems that Points1 is an empty string.
    – radouxju
    Apr 14, 2014 at 18:55
  • also I don't think that the <None> is necessary
    – radouxju
    Apr 14, 2014 at 18:55
  • How would I make Points1 not empty using a map layer? I tried GetParameterAsText(1) making (0) a workspace but now I get my original error message.
    – marion
    Apr 14, 2014 at 19:41
  • I got it to work, there was a conflict with one of my parameters.
    – marion
    Apr 15, 2014 at 11:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.