The goal of the graph on which I was working when I needed to know how to add Shared Parameters to the Other Parameter Group was to allow a user to easily add additional shared parameters that we use to track issued Sheets in our Drawing List Schedule. Our template files have the first ten of these in them, and for some projects, that is enough. Others have many more than ten issuances, particularly those that track issuances during the design phases. We have twenty additional Shared Parameters in our Shared Parameter file; adding more than one of them is tedious, at best.
Using the Parameter.AddSharedParameter node from Erik Falck Jørgensen's Orchid package makes it easy to bulk-add Shared Parameters in a Dynamo graph. For this particular task, however, I wanted to be able to offer the end user the choice of adding the second group of ten parameters, the third group of ten parameters or both the second and third groups of ten parameters, without creating separate graphs for each group of ten additional parameters, and without the user having to go into the graph and make adjustments.
My solution was to use a Python Script node to handle the user options. Two separate lists of the Shared Parameter names are created, and two Boolean nodes with Is Inupt set allow the user to choose to include one or both of those lists when the graph is run. The Python Script node has four inputs; two for the lists (IN[0] and IN[2]) and two for the Boolean nodes (IN[1] and IN[3]). The image below shows the simple Python code that gathers the input values and then tests the Boolean values, adding the associated list of Shared Parameter names to the output list if the Boolean is set to True.
In Dynamo Player, when the user finds the graph file and selects the Edit Inputs tool, this is what she or he sees:
Both Booleans are intially set to False. Should the user run the graph with both set to False, the Parameter List result will display the string to which the listOut variable is set if the list is empty: "Select at least one set of Parameters to add. " The user only needs to click on the "switch" displayed for each "Add Issues" Boolean to toggle it to True.
The switch turns green when set to True. Once the desired list(s) are set to True, selecting the Play tool will run the graph and the selected Shared Parameters will be added to the active project. The Parameter List result will display a list of the names of the Shared Parameters that were added.
As always, you can select an image to see it full size.
No comments:
Post a Comment