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

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
sabatierae
657 Views, 4 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 !

4 REPLIES 4
Message 2 of 5
Scott_Wilson
in reply to: sabatierae

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 5
sabatierae
in reply to: Scott_Wilson

wow you're fast ! 🙂

thanks

Message 4 of 5
niteshpanchal
in reply to: sabatierae

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

Message 5 of 5
AH_Yafim
in reply to: Scott_Wilson

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

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community