Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

view3d collector

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Anonymous
831 Views, 5 Replies

view3d collector

Hi,

 

I'd like to create a collector that contains all the 3d views of my project.

I've tested this collector :

 

FilteredElementCollector viewCollector = new FilteredElementCollector(doc).OfClass(typeof(View3D));
                    viewCollector.OfClass(typeof(Autodesk.Revit.DB.View));

 but it contains 3d templates too..

 

How can I get rid of ?

 

Thanks for your help !

5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: Anonymous

Here you go.

 

FilteredElementCollector viewCollector = new FilteredElementCollector(doc).OfClass(typeof(View3D));
List<View3D> view3dList = viewCollector.ToElements().Cast<View3D>().Where(x => x.IsTemplate == false).ToList();

Message 3 of 6
Anonymous
in reply to: Anonymous

wow you're fast ! 🙂

thanks

Message 4 of 6
niteshpanchal
in reply to: Anonymous

How to add this coder in Revit and work with it?

Message 5 of 6
AH_Yafim
in reply to: Anonymous

Do you have an idea how to execute this in python?

I've tried:

collector = FilteredElementCollector(doc).OfClass(View3D)
view3D = collector.ToElements().Where(lambda x: x.IsTemplate == false).ToList()

 

but for some reason the collector doesn't recognize

.Where()

 

Thanks

Message 6 of 6
k.laszczych
in reply to: AH_Yafim

You should try:

view_3d_collector = FilteredElementCollector(doc).OfClass(View3D).ToElements()
view_3d = [view for view in view_3d_collector if view.IsTemplate == False]

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community