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.
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.
<SPAN class="comment token"># Expression</SPAN> create_tin<SPAN class="punctuation token">(</SPAN>r<SPAN class="string token">"%XSCutlines%"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"%SE2%"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Code Block</SPAN> <SPAN class="keyword token">def</SPAN> <SPAN class="token function">create_tin</SPAN><SPAN class="punctuation token">(</SPAN>in_lines<SPAN class="punctuation token">,</SPAN> fld<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> out_tin <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>CreateScratchName<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"xtin"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"tin"</SPAN><SPAN class="punctuation token">,</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>scratchFolder<SPAN class="punctuation token">)</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>CreateTin_3d<SPAN class="punctuation token">(</SPAN> out_tin<SPAN class="punctuation token">,</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>spatialReference<SPAN class="punctuation token">(</SPAN><SPAN class="number token">2277</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"{} {} Hard_Line <None>"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>in_feat<SPAN class="punctuation token">,</SPAN> fld<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">return</SPAN> out_tin <SPAN class="comment token"># Data Type: TIN</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
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.
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.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.