Select to view content in your preferred language

Tool Validator Value as Create TIN Height Input

935
3
07-26-2018 06:28 AM
Kevin_Smith
Occasional Contributor

For some reason, the Create TIN tool is not taking the value captured by the tool validator as a valid height field. Any thoughts on why this might be the case? I have tired passing the contents of the value as numerous variable types to no luck. The tool did work about six months ago, on the same machine but for some reason has stopped working.

0 Kudos
3 Replies
curtvprice
MVP Esteemed Contributor

Validation within models can be a real challenge, especially with complex parameters like this.

I suggest trying using the Calculate Value tool to compose a string representation of the value table, setting the output type to Value Table, and pass that to the Create Tin tool.

0 Kudos
Kevin_Smith
Occasional Contributor

Curtis,

I added a Calculate Value tool and calculated a value, with no luck (the value did not validation). I tried setting the data type to variant, table and table view without any luck as well. I did not see a data type of value table, so I was unable to test that. When the output of the calculate value tool was set to a data type of table or table view, the output was not included in the options for Height Field.

0 Kudos
curtvprice
MVP Esteemed Contributor

I took a closer look at this, and because of the complex validation involved, I think the best solution (in Model Builder) is to embed the tool run inside the Calculate Value tool to embed the parameter into the tool call. I got the value table syntax figured out by running the tool and looking at the messages (and Copy As Python Snippet) in the Results window.

# Expression
create_tin(r"%XSCutlines%", "%SE2%")
# Code Block
def create_tin(in_lines, fld):
  out_tin = arcpy.CreateScratchName("xtin", "", "tin", arcpy.env.scratchFolder)
  arcpy.CreateTin_3d(
    out_tin,
    arcpy.spatialReference(2277),
    "{} {} Hard_Line <None>".format(in_feat, fld))
  return out_tin
# Data Type: TIN
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍