I am trying to get view types with python-
This is the code I am using:
#Filtered Element Creator________________________________
doc = DocumentManager.Instance.CurrentDBDocument
#all_view_types = filter_by_cat_types(doc, BuitInCategory.OST_Views)
all_views = FilteredElementCollector(doc)\
.OfCategory(BuiltInCategory\
.OST_Views)\
.WhereElementIsNotElementType()\
.ToElements()
view_types = [v.GetType for v in all_views]
OUT = all_views, view_types
I am really not good with wrapping and unwrapping elements. getting this:
Thanks in advance for the help!
Kibar
September 1, 2023, 6:19pm
2
you’re missing the “()” after GetType()
you could also try to change the “whereelementisnotelementtype()” to “whereelementiselementtype()” and see if you get to your goal that way instead.
2 Likes
Hey thanks! unfortunately this does not return the kind of types I need- it returns plantype, rcptype, etc
Kibar
September 1, 2023, 7:10pm
4
you’re getting the type of the type there.
try to send all_views to OUT
Yeah I am sending them both to out, but all views gives me actual views, not View Types from families and types.
Kibar
September 1, 2023, 7:27pm
6
sry i overlooked that.
i’m not at a computer atm but i think this would help you further:
viewfamily_types = FilteredElementCollector(doc).OfClass(ViewFamilyType)
it’s from this answer on the revit api forum
1 Like