Load list of 3d Views from Revit

Load list of 3d Views from Revit

Anonymous
不适用
593 次查看
1 条回复
1 条消息(共 2 条)

Load list of 3d Views from Revit

Anonymous
不适用

How I can load list of 3d views from Revit instead my hand written data 

new CameraViewModel ("View1"){ Width = 100, Height = 100 } and etc.

This is my code with hand written data 

public class CamerasCollectionModel
    {
        public ObservableCollection<CameraViewModel> Cameras
        {
            get
            {
                return cameras;
            }
            private set
            {
                cameras = value;
            }
        }
        public void Load() => Cameras = new ObservableCollection<CameraViewModel>
        {
            new CameraViewModel ("View1"){ Width = 100, Height = 100 },
            new CameraViewModel ("View2"){  Width = 200, Height = 200 },
            new CameraViewModel ("View3"){ Width = 300, Height = 300 }
        };
        private ObservableCollection<CameraViewModel> cameras;
}
0 个赞
594 次查看
1 条回复
回复 (1)
2 条消息(共 2 条)

jeremytammik
Autodesk
Autodesk

The standard approach to retrieve all Revit database elements is by using a filtered element collector:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.9

  

For instance, to get all views, you can use:

 

 

FilteredElementCollector views
  = new FilteredElementCollector( doc )
    .OfClass( typeof( View ) );

 

 

You may just want View3D elements, and you may want to add many other filtering criteria to limit the selection.

 

You can find many similar questions and answers here in similar previous threads.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 个赞