Hi All,
I am trying to develop a tool in Model Builder that will extrude between pairs of TINs.
The tool takes three inputs: the two input TINs and a bounding input feature class.
The TINs are named TIN_1_1, TIN_1_2, TIN_1_3, TIN_2_1, TIN_2_2, TIN_2_3, etc. I need the extrusion to take place between each sequential pair within each group (between 1_1 and 1_2, between 1_2 and 1_3, between 2_1 and 2_2, etc.) but not between non-sequential pairs (1_1 and 1_3) and not between TINs in different groups (1_1 and 2_1). Also there is a corresponding input feature for each group: polygon 1, polygon 2, etc.
Any tips on iterating these three inputs would be most appreciated. I have over a thousand of these procedures to perform and would strongly prefer an automated solution. Am using ArcPro 3.0.0.
Thanks!
Kevin
for what you are doing my tip would be use python instead of model builder and simply iterate your tin names in loops with python.
Thanks Kyle. I now see a similar question was posed last year in the Python group. Am less familiar with working in python. Any thoughts on how to apply that script to my specific problem? Thanks!
Sure - If you have a working model builder export that to python or look at the geoprocessing history and copy the python commands to a notebook in pro. Take advantage of for loops with incrementation and use the looping to automate the input and output naming conventions, and change the input and output of the geoprocessed python commands to use the iterated string variables to meet your needs.
Are all these in same folder? TIN_1_1, TIN_1_2, TIN_1_3, TIN_2_1, TIN_2_2, TIN_2_3
Are the outputs going to a different workspace?
Which tool are you using?
Hi Kevin,
This is a very rough version, written in python. It does not include the .extrusion() call that you need, but it does have the combinations you wanted included, and doesn't have the ones you wanted excluded.
def get_extrusion(
geometry_a,
geometry_b
):
return '''
PUT EXTRUSION CODE HERE
'''
TIN_STRING = 'TIN_1_1, TIN_1_2, TIN_1_3, TIN_2_1, TIN_2_2, TIN_2_3'
TIN_LIST = TIN_STRING.split(', ')
def get_tin_combinations(
tin_list = TIN_LIST
) -> dict:
tin_list.sort()
out = []
for i in range(len(tin_list) - 1):
a, b = tin_list[i], tin_list[i + 1]
if a[4] == b[4]:
if int(a[-1]) - int(b[-1]):
out.append([a, b])
get_extrusion(
geometry_a=a,
geometry_b=b
)
print(out)
return out
get_tin_combinations()
If I got the combinations right - try this. I have not run, but this should work. Let me know if it works or I can try again.
a_1_1 | a_1_2 | polygon 1 |
a_1_2 | a_1_3 | polygon 1 |
a_2_1 | a_2_2 | polygon 2 |
a_2_2 | a_2_3 | polygon 2 |
a_3_1 | a_3_2 | polygon 3 |
a_3_2 | a_3_3 | polygon 3 |