Select to view content in your preferred language

Extrude Between Tool in ModelBuilder

1107
7
12-19-2022 07:02 AM
KevinWiley13
Emerging Contributor

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

 

0 Kudos
7 Replies

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.

KevinWiley13
Emerging Contributor

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!

0 Kudos

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. 

0 Kudos
ShitijMehta
Esri Regular Contributor

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?

0 Kudos
ShitijMehta
Esri Regular Contributor
 
Kevin,
Sent you the solution directly. Pls can you check if that works before I post it here. Thanks!
0 Kudos
asmith1
New Contributor

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()

 

ShitijMehta
Esri Regular Contributor

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

ShitijMehta_3-1689661135051.png

 

 

0 Kudos