Category.Id of OST_Viewers

Hello Dynamo Community,

I need to get the ID-object of BuiltinCategory.OST_Viewers but this category does not exist in doc.Settings.Categories. How to get it anyway? The ID is -2000278.

Kind regards!

for x in doc.Settings.Categories:
    print x.Name, x.Id


Part Tags



-2000270



Alignment Station Labels



-2001017



Piers



-2006131



MEP Fabrication Hangers



-2008203



Pipe Insulation Tags



-2008155



Model Groups



-2000095



Analytical Floors



-2009639



Mechanical Equipment Tags



-2005009



Ramps



-2000180



Cable Tray Fittings



-2008126



Foundation Span Direction Symbol



-2005111



Communication Device Tags



-2008082



Air Systems



-2001008



Analytical Wall Tags



-2009653



Temporary Structure Tags



-2001042



Structural Connections



-2009030



Planting



-2001360



Ceiling Tags



-2005002



Annotation Crop Boundary



-2000547



Analytical Wall Foundations



-2009642



Furniture Tags



-2005006



Mass



-2003400



Air Terminals



-2008013



Pipe Accessory Tags



-2008056



Security Device Tags



-2008080



Window Tags



-2000450



Stair Tread/Riser Numbers



-2000944



MEP Fabrication Ductwork Tags



-2008194



Communication Devices



-2008081



Piping Systems



-2008043



Bodenablauf ohne Estrich.dwg



7560941



Fire Protection Tags



-2001051



Panel Schedule Graphics



-2008151



Bodenablauf ohne Estrich in Erstbeton.dwg



6348167



Detail Item Tags



-2005028



Reference Lines



-2000083



295777-1-CKTS9P3-1-3-GA - Querschnitt Maschinenhallenkran.dwg (3)



4749878



MEP Fabrication Containment



-2008212



Analytical Spaces



-2008185



Plumbing Fixtures



-2001160



Structural Framing Tags



-2005015



System-Zones



-2001001



Ceilings



-2000038



00016.dwg



4007648



00014.dwg



4007395



00015.dwg



4007518



00012.dwg



4007152



00013.dwg



4007276



00010.dwg



4006987



00011.dwg



4007022



Section Boxes



-2000301



MEP Fabrication Ductwork



-2008193



Bolt Tags



-2009056



Bridge Framing



-2006241



Elevation Marks



-2006045



Data Device Tags



-2008084



Pipe Segments



-2008163



Detail Spritzbetonerdung MAK-2.dwg



4521569



Anchor Tags



-2009057



Crop Boundaries



-2000536



Conduit Fittings



-2008128



SK-B-TW2-KRA-0000-P-4-015-01_00 (RP VT1 2000).dwg (2)



4147324



Sprinklers



-2008099



Approach Slab Tags



-2006211



Doors



-2000023



Lighting Fixture Tags



-2005008



Lighting Devices



-2008087



Assembly Tags



-2000268



Duct Tags



-2008003



RVT Links



-2001352



TRK OG Löschanlage GR.dwg



3284501



Curtain Systems



-2000340



Mechanical Equipment Set Boundary Lines



-2000987



Structural Rebar Tags



-2009020



Parking



-2001180



Ducts



-2008000



Detail Auflager Absenköffnung.dwg



6479917



Door Tags



-2000460



System-Zone Tags



-2001007



Internal Area Load Tags



-2005255



Revision Clouds



-2006060



Bridge Cables



-2006133



MEP Fabrication Hanger Tags



-2008204



Imports in Families



-2000196



Conduits



-2008132



Multi-Category Tags



-2005022



Abutment Wall Tags



-2006210



Analytical Isolated Foundations



-2009641



Flex Pipes



-2008050



Property Line Segment Tags



-2001269



Curtain Panel Tags



-2005012



Analytical Links



-2009657



Structural Trusses



-2001336



HVAC Zones



-2008107



Pier Column Tags



-2006222



Schedules



-2000573



TM_Kranbalken-Detail-1.dwg



4008086



Mass Floor Tags



-2003410



Electrical Spare/Space Circuits



-2008152



Hole Tags



-2009063



Medical Equipment



-2001046



Detail Spritzbetonerdung MAK-1.dwg



4521459



Site



-2001260



Analytical Columns



-2009636



Duct Systems



-2008015



Zone Tags



-2008115



Fire Protection



-2001049



Abutments



-2006130



Duct Placeholders



-2008160



Bearing Tags



-2006178



Reference Planes



-2000530



Cable Tray Tags



-2008131



Multi-Rebar Annotations



-2000970



Matchline



-2000193



Specialty Equipment Tags



-2005014



Duct Accessories



-2008016



Duct Fitting Tags



-2008061



Furniture System Tags



-2005007



Callout Heads



-2000538



Furniture Systems



-2001100



2020-10-06_Verteilrohrleitung_R00.dwg



4008055



Stirnwand-1.dwg



6047822



Stirnwand-2.dwg



6047846



Telephone Devices



-2008075



Lines



-2000051



Wires



-2008039



Pipes



-2008044



Audio Visual Devices



-2001055



Profile Tags



-2009064



Structural Stiffener Tags



-2001355



Detail Spritzbetonerdung TRK-3.dwg (2)



4728206



Signage



-2001058



Topography



-2001340



Casework Tags



-2005001



Project Information



-2003101



00007.dwg



4007941



00004.dwg



4006804



00002.dwg



4007852



00003.dwg



4006754



00001.dwg



4007769



Wall Tags



-2005011



Cable Tray Fitting Tags



-2008127



Structural Internal Loads



-2005204



Electrical Circuits



-2008037



Detail Spritzbetonerdung MAK-3.dwg



4519061



Analysis Display Style



-2000304



Pipe Insulations



-2008122



Food Service Equipment Tags



-2001045



Flex Ducts



-2008020



Duct Insulation Tags



-2008153



Plate Tags



-2009055



Rebar Cover References



-2009015



Assemblies



-2000267



Structural Load Cases



-2005210



Stair Support Tags



-2000942



Structural Area Reinforcement



-2009003



Structural Truss Tags



-2005030



Analytical Slab Foundation Tags



-2009656



Plan Region



-2000191



Structural Framing



-2001320



Mechanical Equipment Set Tags



-2000986



Structural Tendon Tags



-2006276



Electrical Fixtures



-2001060



Zufahrtsstollen-Profil.dwg



6116074



Air Terminal Tags



-2008014



Detail Spritzbetonerdung TRK-2.dwg



4728076



Vibration Damper Tags



-2006264



Data Devices



-2008083



Structural Annotations



-2006090



Lighting Fixtures



-2001120



Duct Insulations



-2008123



Span Direction Symbol



-2005110



Section Line



-2000201



Cable Tray Runs



-2008150



Section Marks



-2000400



Pipe Color Fill



-2008059



Generic Models



-2000151



Lighting Device Tags



-2008088



Floor Tags



-2005026



Sprinkler Tags



-2008100



Analysis Results



-2000303



Scope Boxes



-2006000



Line Load Tags



-2005251



Render Regions



-2000302



Structural Path Reinforcement Symbols



-2009010



Electrical Equipment



-2001040



Stair Landing Tags



-2000941



MEP Fabrication Containment Tags



-2008213



Curtain Panels



-2000170



Fire Alarm Devices



-2008085



Analytical Braces



-2009633



Temporary Structures



-2001039



Displacement Path



-2000223



Roads



-2001220



Duct Lining Tags



-2008154



Floors



-2000032



Flex Duct Tags



-2008004



Point Clouds



-2010001



Analytical Wall Foundation Tags



-2009655



Analytical Foundation Slabs



-2009643



Windows



-2000014



Structural Area Reinforcement Tags



-2009021



295777-1-CKTS9P3-1-3-GA - Längsschnitt Maschinenhallenkran.dwg (2)



4844246



295777-1-CKTS9P3-1-3-GA - Längsschnitt Maschinenhallenkran.dwg (3)



4845017



TRK OG Löschanlage GR.dwg (3)



3284665



SK_Kranbalken-Detail Kranbahnschiene.dwg



3986600



Bodenablauf bei Estrich.dwg



7623560



Pier Foundation Tags



-2006176



SK-B-TW2-UWS-0000-P-4-005-01_00 (RP SG2 VZ).dwg



4151728



TM_Kranbalken-Detail-2.dwg



4008088



Structural Path Reinforcement



-2009009



Stair Run Tags



-2000940



Rebar Shape



-2009013



Parts



-2000269



Nurse Call Device Tags



-2008078



Columns



-2000100



Area Load Tags



-2005252



Routing Preferences



-2008125



Generic Annotations



-2000150



Bodenablauf bei Estrich.dwg (2)



5397087



Bridge Decks



-2006135



Area Tags



-2005020



Abutment Pile Tags



-2006209



Analytical Pipe Connections



-2000983



View Reference



-2000197



Vertical Circulation



-2001052



Filled region



-2000190



Analytical Column Tags



-2009651



Structural Fabric Reinforcement



-2009016



Audio Visual Device Tags



-2001057



Connection Symbols



-2006100



Conduit Fitting Tags



-2008129



Raster Images



-2000560



Structural Column Tags



-2005018



Vibration Management



-2006261



Abutment Foundation Tags



-2006208



Analytical Beam Tags



-2009649



Adaptive Points



-2000900



Grid Heads



-2006040



Sections



-2000200



Mechanical Equipment Sets



-2000985



Room Tags



-2000480



Curtain Wall Mullions



-2000171



Stair Tags



-2005023



Signage Tags



-2001061



Structural Loads



-2005200



Revision Cloud Tags



-2006080



Walls



-2000011



Conduit Runs



-2008149



Duct Accessory Tags



-2008017



Spot Slopes



-2000265



Keynote Tags



-2005029



Space Tags



-2000485



Alignments



-2001012



Bridge Cable Tags



-2006173



Rebar Set Toggle



-2009025



Pipe Color Fill Legends



-2008058



Pipe Fittings



-2008049



295777-1-CKTS9P3-1-3-GA - Querschnitt Maschinenhallenkran.dwg



3321024



Structural Columns



-2001330



Pipe Placeholders



-2008161



Guide Grid



-2000107



Grids



-2000220



Fire Alarm Device Tags



-2008086



Planting Tags



-2005021



Callouts



-2000537



Schedule Graphics



-2000570



Electrical Fixture Tags



-2005004



Telephone Device Tags



-2008076



Detail Injektionssperre_1.dwg



6843558



Structural Rebar Couplers



-2009060



Cable Trays



-2008130



Curtain System Tags



-2005025



Structural Stiffeners



-2001354



TRK OG Löschanlage GR.dwg (5)



3539376



Medical Equipment Tags



-2001048



Entourage



-2001370



MEP Fabrication Pipework



-2008208



Internal Line Load Tags



-2005254



Structural Fabric Reinforcement Symbols



-2009028



Bridge Deck Tags



-2006175



Mass Tags



-2003405



Zone Equipment



-2001010



Analytical Node Tags



-2000956



Expansion Joint Tags



-2006273



Property Tags



-2001267



Structural Path Reinforcement Tags



-2009011



Water Loops



-2001009



Callout Boundary



-2000539



Structural Area Reinforcement Symbols



-2009005



Contour Labels



-2000350



Nurse Call Devices



-2008077



295777-1-CKTS9P3-1-3-GA - Längsschnitt Maschinenhallenkran.dwg



3321493



Pier Wall Tags



-2006230



Areas



-2003200



Materials



-2000700



Roofs



-2000035



Structural Fabric Areas



-2009017



SK-B-TW2-KRA-0000-P-4-015-01_00 (RP VT1 2000).dwg (3)



4147384



Structural Rebar



-2009000



Reference Points



-2000710



Shaft Openings



-2000996



Vertical Circulation Tags



-2001054



Spot Elevation Symbols



-2005100



Curtain Wall Mullion Tags



-2005032



SK_Kranbalken-Detail Kranbahnschiene.dwg (2)



4408228



Internal Point Load Tags



-2005253



Analytical Isolated Foundation Tags



-2009654



TM_Kranbalken-Detail-3.dwg



4008090



Flex Pipe Tags



-2008048



Duct Fittings



-2008010



Cameras



-2000501



Elevations



-2000535



Specialty Equipment



-2001350



Analytical Floor Tags



-2009652



Pipe Accessories



-2008055



Detail Injektionen_2.dwg (3)



8752668



Structural Connection Tags



-2009040



Masking Region



-2000194



Expansion Joints



-2006271



Structural Rebar Coupler Tags



-2009061



Vibration Isolator Tags



-2006266



Structural Foundations



-2001300



Level Heads



-2006020



Road Tags



-2001221



Duct Color Fill Legends



-2007004



Analytical Beams



-2009630



Pier Tags



-2006171



Curtain Grids



-2000173



SK-B-TW2-KRA-0000-P-4-015-01_00 (RP VT1 2000).dwg



4147193



Path of Travel Tags



-2000834



Levels



-2000240



Brace in Plan View Symbols



-2006110



Railing Tags



-2000133



Structural Foundation Tags



-2005019



Wire Tags



-2008057



Security Devices



-2008079



Site Tags



-2005016



Food Service Equipment



-2001043



Pipe Tags



-2008047



Weld Tags



-2009059



Analytical Link Tags



-2000955



Spot Coordinates



-2000264



Bearings



-2006138



00020.dwg



4006858



SK-B-TW2-UWS-0000-P-4-003-01_00 (RP SG2 3800).dwg



4153607



Detail Spritzbetonerdung VBK.dwg



4449192



Railings



-2000126



Viewports



-2000510



Abutment Tags



-2006170



SK_Kranbalken-Detail-Ankerkopf C1.dwg (2)



4424417



SK_Kranbalken-Detail-Ankerkopf C2.dwg (2)



4424564



Title Blocks



-2000280



Shear Stud Tags



-2009058



Pier Pile Tags



-2006226



Plumbing Fixture Tags



-2005010



Pier Tower Tags



-2006172



TRK OG Löschanlage GR.dwg (2)



3284593



Pipe Fitting Tags



-2008060



Duct Color Fill



-2008005



Stair Paths



-2000938



MEP Fabrication Pipework Tags



-2008209



Multi Leader Tag



-2005033



Bridge Framing Tags



-2006243



Bodenablauf ohne Estrich in Erstbeton-1cm.dwg (3)



8206664



Duct Linings



-2008124



Structural Beam Systems



-2001327



Roof Tags



-2000266



Detail Spritzbetonerdung TRK-1.dwg (2)



4727855



Views



-2000279



Sheets



-2003100



Bodenablauf ohne Estrich in Erstbeton-1cm.dwg



8206296



Casework



-2001000



Conduit Tags



-2008133



Point Load Tags



-2005250



Analytical Surfaces



-2008186



Structural Fabric Reinforcement Tags



-2009022



Material Tags



-2005027



View Titles



-2000515



Mechanical Equipment



-2001140



Parking Tags



-2005017



Structural Beam System Tags



-2005130



Alignment Tags



-2001015



Analytical Brace Tags



-2009650



Alignment Station Label Sets



-2001016



Structural Tendons



-2006274



Electrical Equipment Tags



-2005003



Generic Model Tags



-2005013



Switch System



-2008101



Furniture



-2000080



Rooms



-2000160



Hardscape



-2001036



Coordination Model



-2000982



Analytical Walls



-2009640



SK_Kranbalken-Detail-Konsole Bauhilfskran.dwg (2)



4446669



Hardscape Tags



-2001038



Stairs



-2000120



Text Notes



-2000300



Detail Items



-2002000



Spot Elevations



-2000263



Analytical Nodes



-2009645



Detail Spritzbetonerdung UMK.dwg (2)



4521360



Boundary Conditions



-2005301



Color Fill Legends



-2000550



Spaces



-2003600



Pier Cap Tags



-2006220



Dimensions



-2000260



Regelprofil EWS_2021-04-07.dwg



2497401

It’s a bit confusing, but those are actually different object types. Settings.Categories returns DB.Category objects (which are elements) and not DB.BuiltInCategory objects (which are just enumerators). You can get the Category element from the BIC using Category.GetCategory(). However, in your case, OST_Viewers does not have an equivalent Category. It shares the OST_Views Category of Views.


2 Likes

Yes, confusing :smiley:

But also, I´m an idiot, i have this function in pretty much all of my scripts:

def FilterSectionlines():
	outlist = []
	for element in elements:
		string = element.ToString()
		if element.Category.Id == ElementId(BuiltInCategory.OST_Viewers) and string == "Autodesk.Revit.DB.Element":
			outlist.append(element)
	return outlist

And it does exactly what i want:

ElementId(BuiltInCategory.OST_Viewers)

1 Like