c#_Read through the .3dm file and get object (string/dimension) from the specific layout tab

Hi,
I am trying to extract information from several .3dm files. I am stuck at one point where I have to get the dimensions (as text) from the layout tab. it would be great help if anyone can guide me through it.

here is the partial code

    public string ReadViewPortNames(string filePath)
    {
        //List<string> name = new List<string>();
        File3dm thisFile = Rhino.FileIO.File3dm.Read(filePath);  // read file with given path
        var viewInfo = thisFile.Views; // get the information of views in the file           

        // Rhino.DocObjects.ViewInfo view thisFile.AllViews.FindName("EBENER_PLANKOPF_TEMPLATE");
        Rhino.DocObjects.ViewInfo view = viewInfo[4]; // this is the index of layout I need
        string viewName = view.Name;

        Rhino.DocObjects.ViewportInfo viewportInfo =  view.Viewport;
        Guid viewportID = viewportInfo.Id;
        
        // I want to go inside this viewport (layout) and select the object by its name
        // later I will parse it to string.
        
        return viewName;
    }

find attached images

Hi @obhagwat29,

Objects that are in layout space will have their ObjectAttributes.Space property return ActiveSpace.PageSpace.

From that you can get the page the object is on using ObjectAttributes.ViewportId.

– Dale

2 Likes