Retrieve CAD layers and layouts

GroupDocs.Viewer provides additional information about CAD drawings such as list of layouts and layers when calling GetViewInfo method. To retrieve view information for CAD drawing call GetViewInfo method and cast output result to CadViewInfo type.

Following example demonstrates how to retrieve view information for CAD drawing.

using (Viewer viewer = new Viewer("sample.dwg"))
{
    ViewInfoOptions viewInfoOptions = ViewInfoOptions.ForHtmlView();
    CadViewInfo viewInfo = viewer.GetViewInfo(viewInfoOptions) as CadViewInfo;

    Console.WriteLine("File type: " + viewInfo.FileType);
    Console.WriteLine("Pages count: " + viewInfo.Pages.Count);

    foreach (Layout layout in viewInfo.Layouts)
        Console.WriteLine(layout);

    foreach (Layer layer in viewInfo.Layers)
        Console.WriteLine(layer);
}

© Aspose Pty Ltd 2001-2022. All Rights Reserved.