Good morning. I was wondering, for a script i have to develop for my society if there is a possibility, while automatically creating a Schedule View in Dynamo, to filter out, in the SchedulableField list, only the ones deriving directly from the Shared Parameters. I was wondering this because in the latest versions in Revit, inside the menu of Schedule Properties, i have the possibility to filter out the various SchedulableFields considering only the ones that are Shared Parameters
(as in the screenshot), so i imagine that there is a way to obtain the same concept also in Dynamo. I have to automatize this procedure due to the fact that the number of schedules i have to create is way bigger than 100. Thank you if you can help me.
Basically i’m trying to filter, after the ScheduleView.SchedulableFields node only the Fields that are based on Shared Parameters. As you can see, i’m kinda obtaining something with the Clockwork nodes i placed in the end, but basically what i would like to obtain is a Node between ScheduleView.SchedulableFields and ScheduleView.AddFields that has as output the SchedulableFields that are based on Shared Parameters. (Acting just like the filter in Revit i’ve shown in the picture attached in the previous post.)
You’ll have to go through the API to do this. ScheduleFields are way more accessible but unfortunately don’t exist until they’ve been added to the schedule. However, you can get the ParameterId from a SchedulableField and then check whether the parameter is Shared or not from the ParameterElement.
Thank you, i’ve come to the same conclusion. In your opinion it would be better to act on the ScheduleFields (adding all the SchedulableFields and then with some operations erase the fields not related with SharedParameters) or to act on the SchedulableFields with the API? (considering that i never installed any kind of SDK package and don’t even know what to install/how to access the API).
Regarding the last sentence you wrote, what do you mean from the “ParameterElement”? It is a node already in Dynamo? It would be really helpful foe me even to obtain the IDs of the SchedulableField and then filter out the other ones.
You certainly could add all available fields, query, then remove. That’s a lot of unnecessary work though.
This could be a good opportunity for you to learn the Revit API and get some experience with Python. Most of this should be pretty straight forward once you get the basics setup, but it’s ultimately up to you.
The ParameterElement refers to the specific class and object type, but I actually misspoke. The Parameter class is the one that contains the IsShared property that you’re after. Conveniently, the ParameterId from the SchedulableFields actually gets you the specific class anyway, so it would return as a SharedParameterElement if that’s the case.
This should get you started. I highly suggest you look at the Python code and try to modify it to get exactly what you want, but you should be able to do everything with nodes if you get stuck. It returns a list of booleans for whether the associated parameter is shared or not as well as a list of all the parameter elements themselves.
Thank you a lot Nick, this is a perfect starting point both for the development of the script both for starting to get a little bit of knowledge in Pyhthon for Revit. Do you have any particular blog, book, resource or video that could help me to get introduced to it? (I never did pure coding in my life).
There are a lot of good resources here on the forum.
RevitAPIDocs is a great resource for the Revit API itself. It includes documentation and examples in a few languages, but you’ll have to “convert” it to Python.
The Python Nodes Basics thread is also a good introduction to Python in Dynamo.
Finally, the RevitLookup addin is also a great resource to view and learn the API in real time.
Thank you very much Nick. I don’t know if i can continue but i have one last question, because something tricky is happened during the whole script. Basically i obtained all the shared parameters isolated as i wanted, but in those parameters i have the following parameters:
-Door Level
-Door Level (don’t know even why it’s listed two times)
-A
-W
-URL
which are considered in Dynamo as Shared parameters as you can see; but i never created them, and of course they are not even in the Shared Parameters file i created as a test.
Do you have any hint? Right now i just deleted them from the schedule in the last part of the script, but it would be helpful knowing why they appeared from nowhere.
Check to make sure they aren’t added as a Project Parameter. They could also be coming from a loaded instance that contains those parameters. Keep in mind, schedulable parameters includes parameters from any category that can be added to your schedule, not just the schedule category. Project Information, Room, and Space parameters are schedulable for many categories.
Blanket scheduling all the available shared parameters for a given schedule may not be the most effective process for whatever it is you’re trying to accomplish.