3

I want get list of 3DViews in comboBox from revit. I create plugin. And I have to get height and width selected 3DViews.

When I start my plugin I get list of 3DViews, but I don't know how get height and width selected 3DViews. What methods or else I should use? Please, help me

    public Document doc;
    public CameraView(Document doc)
    {
        this.doc = doc;
        InitializeComponent();
    }

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        FilteredElementCollector fec = new FilteredElementCollector(doc).OfClass(typeof(View3D));

        foreach (Element elem in fec.ToElements())
        {
            View3D view3D = elem as View3D;
            if (!view3D.IsTemplate)
                List3DView.Items.Add(view3D.Name);                
        }           
    }
Spike
  • 43
  • 7
  • I believe that using a [bounding box](https://www.revitapidocs.com/2016/def2f9f2-b23a-bcea-43a3-e6de41b014c8.htm) of each view will help... Then you can get at the min/max, take a difference of x(width)/y(height) and have your solution. – Rick Riggs Aug 12 '19 at 14:40
  • Here's a link to the [BoundingBoxXYZ](https://www.revitapidocs.com/2020/d7e07baa-ee85-a6cd-3545-ff78502b221a.htm) class documentation that gets returned - It will help you get the Min/Max properties you are looking for... – Rick Riggs Aug 12 '19 at 14:43
  • [BoundingBoxXYZ](https://www.revitapidocs.com/2015/3c452286-57b1-40e2-2795-c90bff1fcec2.htm#exampleToggle) I find this example, and how I can count height and width? – Spike Aug 12 '19 at 15:17
  • var width = max.X - min.X; var height = max.Y - min.Y; – Rick Riggs Aug 12 '19 at 15:43

0 Answers0