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