One of the simplest and most useful applications of Dynamo is driving Shared Parameters with formulas. This allows you to have a Shared Parameter as a “Calculated Value,” which is something that you cannot do in Revit without access to the API. But to do this in Dynamo, you just need a few nodes.
With this type of script you can, for example, drive the calculated count of plantings within an Area. This is a great time saver for anyone who Tags their Areas with a count Tag.
This is how I did it:
For the Formula to drive the value, the Shared Parameter must be a Number, and not an Integer. It also must be added to the Project as a Project Parameter for Areas.
And it automatically pulls all of the correct counts (based on Spacing) into the Planting Tags.
For reference, here is the schedule.
“Count” is the original calculated value, and “Tag Count” is the driven Shared Parameter. If you look closely, you can see that one row does have a slight difference. I checked the math, and the Tag Count is actually correct (sometimes Revit calculated values have slight errors). I was kind of surprised by this, but the difference is within .02 feet.
To get the Tag Count to display as an integer, change the formatting to 0 decimals in both the schedule and the tag (or you can apply the rounding within the formula).
Do you have to ‘run’ the Dynamo script every time you edit the planting?
Anytime you edit the Area or Spacing, yes it would need to be re-run. You could keep it up and running automatically in the background, though I haven’t tried that much on larger projects (it could slow you down).
Pity about the need to re-run it to keep the data in the tags correct. People are doing lots of similar things with Dynamo, but they never seem to be very robust in terms of a workflow because of that. I’d be interested in knowing what happens if you leave if running as you suggest.
It works fine running automatically with this small test project. And since its such a simple script and formula it might be just fine in a large project.
Could this be applied to tags in a given area? I have created my own tags per plant family, but still have to manually enter plant counts? (ie, three black hills spruce, TAG: # BHS)
It’s a bit trickier to automate a count of individual plantings. There are various ways it can be done with the API, though I’m not sure if it can be done very efficiently using Dynamo.