Get the list of all sheets which contains views from active Revit file and exporting the dwg

ashwin_kumarDHZGS
Autodesk

Get the list of all sheets which contains views from active Revit file and exporting the dwg

ashwin_kumarDHZGS
Autodesk
Autodesk

can you please me with this 

0 Likes
Reply
Accepted solutions (1)
394 Views
3 Replies
Replies (3)

architect.bim
Collaborator
Collaborator

Hi! To get help here, it's better to try writing the code first and figure out what exactly is not working.

 

If I were you, I would start by selecting ViewSheet objects via FilteredElementCollector. Next, each ViewSheet instance has a GetAllPlacedViews method. Check if it returns any view objects. If so, then there are views on the sheet. Finally, you need to create a DWGExportOptions object. Configure its properties. And pass it to Export method of Revit document.

 

Generally speaking, that's all it takes.


Maxim Stepannikov | Architect, BIM Manager, Instructor
0 Likes

architect.bim
Collaborator
Collaborator
Accepted solution

Here are some basic Python and C# basic samples:

sheets_ids = [
    sheet.Id for sheet in FEC(doc).OfClass(DB.ViewSheet)
    if sheet.GetAllPlacedViews()
]

export_options = DB.DWGExportOptions()
export_options.FileVersion = DB.ACADVersion.R2013
export_options.HideScopeBox = True
export_options.HideReferencePlane = True
export_options.MergedViews = True

output_path = "D:\dwg"

doc.Export(
    output_path,
    'test_',
    List[DB.ElementId](sheets_ids),
    export_options
)
List<ElementId> sheetIds = new List<ElementId>();
FilteredElementCollector collector = new FilteredElementCollector(doc).OfClass(typeof(ViewSheet));
foreach (ViewSheet sheet in collector)
{
    if (sheet.GetAllPlacedViews().Count > 0)
    {
        sheetIds.Add(sheet.Id);
    }
}

DWGExportOptions exportOptions = new DWGExportOptions();
exportOptions.FileVersion = ACADVersion.R2013;
exportOptions.HideScopeBox = true;
exportOptions.HideReferencePlane = true;
exportOptions.MergedViews = true;

string outputPath = @"D:\dwg";

doc.Export(
    outputPath,
    "test_",
    new List<ElementId>(sheetIds),
    exportOptions
);

 


Maxim Stepannikov | Architect, BIM Manager, Instructor

ashwin_kumarDHZGS
Autodesk
Autodesk

thank you so much for your help @architect.bim 
Can you give me any idea regarding  process for pdf export of that sheets
1.it should select the sheet size automatically 
2.all sheets are should be saved as pdf with one click once i fired the API