Select graphicsStyle by categoryId

Hi There,

In an attempt to efficiently select the invisible lines GraphicsStyle, I managed to do it with

from pyrevit import DB, revit

doc = revit.doc

id = DB.ElementId(DB.BuiltInCategory.OST_InvisibleLines)

coll = DB.FilteredElementCollector(doc).OfClass(DB.GraphicsStyle)
for i in coll:
    if i.GraphicsStyleCategory.Id==id:
        # print(i.GraphicsStyleCategory.Id)
        # print(i.GraphicsStyleCategory.Name)

the id of the category being the only constant I could find to filter down the list of GraphicsStyles

  • Do you know a way to use a filter in the collector that would be language independant and work…?
  • A better way to do it?
  • Same goes to select the Solid FillPattern in an language independant way?

Maybe this helps?

coll = DB.FilteredElementCollector(doc).OfClass(DB.GraphicsStyle)
for i in coll:
    if i.Name.Contains("Invisible"):
        print(i.GraphicsStyleCategory.Id, i.GraphicsStyleCategory.Name, i.Name)

@Tomasz thanks,
yes and no, it is language dependant. If I run revit in Czech, Vietnamese or German, it won’t work
and I still collect 1337 graphicsstyles and filter them out by name. I wonder if there is a more direct path