Select to view content in your preferred language

ModelBuilder and displaying results in ToC

2989
10
12-28-2020 11:04 PM
Labels (1)
MarkFawkes
Occasional Contributor

Hi I am trying to develop a number of small tools to speed up/automate some basic and not so basic workflows for the ArcGIS users in my group, mainly using ModelBuilder to develop the tools. Users range from 'think I know a lot' to 'very basic/new user' so have to design the tool and usage to enable the most basic user to run a tool. The tools are going to be grouped in a number of toolboxes with the intent to run them from atoolbox. A number of the tools create datasets that I want to have displayed in the ToC after the tool is run.

I know that to achieve this with running a tool from a toolbox I need to make the dataset a parameter in ModelBuilder. However this then makes that parameter visible to (and AFAIK changeable by) the user, and I would prefer it be not visible, or at least setup so that the user cannot change the parameter. Probably not a big issue with most of the users I work with but I would like to make things foolproof (until the new improved fool comes along).

Is there a way that I can make the visible parameter/dataset not changeable for the user, or an alternative way to get the dataset added to the ToC without making it a parameter or visible when the tool is run. Perhaps a python script I could add to the tool to be able to add a specified dataset to the ToC without having to set the set the dataset as a parameter.

I am somewhat comfortable with playing around with Python, but do not have a great knowledge of Python to be able to figure this out from scratch (just enough knowledge to get me into trouble).   🙂

An approach to this issue may of interest to other Desktop (and Pro) users out there.

10 Replies
curtvprice
MVP Esteemed Contributor

Nice ModelBuilder workaround @NeelKumar !   I now remember hearing about this method from @ShitijMehta  at the Esri UC! 

@MarkFawkes : AS posted in my reply to Dan, I do have a workaround using insertLayer in arcpy.mapping which would seem to be something to get what I want - just need to delve a bit more into ArcPy to get this working. 

You could use arcpy.mapping insertLayer method within a python function using the Calculate Value tool ( avoiding the need to create and attach a Python script.)

Good thread - we have identified two approaches for ModelBuilder tool to add a layer without exposing a parameter!

 

0 Kudos