Categories in data shapes

Hello all,

I have been working on this for a couple of days now. I want to be able to have a Categories drop down menu in using data-shapes so coworkers will stop opening the script and changing things. I basically want to replace the Categories node with the datashape DropDown Data node but I cant figure out how to get my categories to show up in the drop down menu of the data-shapes node. I have attempted several python scripts that I have found on here and watched you tube videos with no positive results. Anyone have any ideas on how to resolve this. I am ok with dynamo but an infant in programming. Thank you

If you tried a bunch of solutions and they didn’t work, it’s worth posting them so we can see what the issue was and help you solve it. Otherwise it looks like you didn’t put in any real effort.

Yes sir, I will remember that in the future. I looked at your attached link and I did not come across that one that I can recall. I will attempt that one. thank you

I attempted to use the script you linked in the thread. it is giving me a string error on line 12. I have just started learning python this year. I know there is a syntax difference with python 3. Am I entering something wrong, is this a syntax , or am I not defining a variable correctly?



You need to load the Revit API in order to use it. In this case, you need Revit Services loaded in order to get the document. You also need to then define doc as your active document.

import clr
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

allCats = doc.Settings.Categories

thank you, i am still getting string errors
python error


The links I gave you were just examples on how to get categories. You still need to put in some effort trying to understand what the code does so you can make it work for your use case.

What categories do you want to be selectable? Do you need all categories? Just model categories? Just annotation categories? Specific categories only? Right now the code gets three different lists of categories but you aren’t returning any. (You have OUT = 0.)

It seems like the CategoryType is returning an integer value instead of the actual type. You’ll have to try comparing that instead.

I will eventually need dropdown boxes for all categories, view templates, rule type, and fill patterns. I am attaching screen shots of the org script and what I have completed so far with data shapes. I tried to export my workspace as an image but I am unable to locate where the image is going. Do you know of an online class that I can take that teaches python with a focus on dynamo and not just general python.


Hi @gtysonSNEFH,

Is this what you are looking for?

Yes that worked. thank you. I wouldn’t have thought that would have worked there since it is labeled model. thank you

1 Like