SetParameterByName using Custom Graphic Style not yet used in the family?

Worked though all the version of answer people have posted for Element.SetParameterByName using graphic styles but these only seem to work if you have already drawn something in the Revit and set a graphic style to this so you can then search for it.

My Object Style (Graphic Style) is already created in the Revit Family but i am yet to find a way to find this information as a graphic style that i can feed into my Element.SetParameterByName as the value.

Using the Categories Node I can find Generic Model - Hidden Lines but can’t find the Setout one below it or how to do anything with this data.


Note: Code Block for "graphic Style is placeholder i know it won’t take a string in the Value input

I have also tried with various python scripts and nodes but no of these return the Line style/graphic style either.


Any tips, help appreciated.

Have you tried using the Element Types node set to GraphicsStyle with an All Elements of Type?

That’s a great start, Thanks.

Would be great if i could find away to only look at the graphic styles in the Subcategory than the thousands that are in the document as this seems to be slowing down the code rather alot it seems as i search the list for the one i am looking for.

As considering I am just in a Metric Generic Family i have all these graphic styles that do not show up when i look at the object styles in the family as in my first image from before…

Filter by category first. :slight_smile:

Would you be able to post an example as I am yet to find either the category first and then how i would access the graphic style from it or if i find it such as Generic Models its returning an empty list and non of the subcategory’s and the subcategory i created is not showing up in the list yet either.

When I get to these points of ‘how do I filter a massive list’ my process is to pull the first item from the list (a[0]; in a code block), and then see how much info I can get from it. Try an Element.Parameters node and see what comes from that. I’ll have a look late tonight if you post a few examples of what worked and what didn’t. :slight_smile:

I know have some idea how to filter the long list using Index’s / String searches etc. its more if there was away to just search the graphic styles locally in a family and not the whole database. As this feels like it is slowing down the code.