How to acces all view sheet sets in document

How to acces all view sheet sets in document

c_hanschen
Advocate Advocate
4,369 Views
2 Replies
Message 1 of 3

How to acces all view sheet sets in document

c_hanschen
Advocate
Advocate
I'm able to make New sheet set of access the active sheet set, but how can i access all view sheet sets in the active document?

Thanks

Chris Hanschen
The Netherlands
0 Likes
Accepted solutions (1)
4,370 Views
2 Replies
Replies (2)
Message 2 of 3

c_hanschen
Advocate
Advocate

My post was a little bit to short! sorry.

 

It says the topic has been ascalated, why?

 

more details:

I'm able to access the PrintManager.ViewSheetSetting.CurrentViewSheetSet to get al list of al views and/or sheets to print.

I can also make my own list and save it, no problem there.

 

But how can i acces the other ViewSheetLists that are saved in the document? 

 

i have tried: (vb.net)

Dim MyElementCollectorSheetsSets As FilteredElementCollector = New FilteredElementCollector(MyDoc)
MyElementCollectorSheetsSets.OfClass(GetType(IViewSheetSet))

 

message:

Autodesk.Revit.Exceptions.ArgumentException: Input type(Autodesk.Revit.DB.IViewSheetSet) is not a recognized Revit API type
Parameter name: type

 

any help will be appreciated!

 

Chris

The Netherlands 

 

0 Likes
Message 3 of 3

JimJia
Alumni
Alumni
Accepted solution
Dear Chris Hanschen,

Please try code below, hope it's helpful:

public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)

{

// find all viewsheet set within document

Document doc = commandData.Application.ActiveUIDocument.Document;

FilteredElementCollector coll = new FilteredElementCollector(doc);

var all = coll.OfClass(typeof(ViewSheetSet)).ToElements();

Console.WriteLine("Viewsheet set count: " + all.Count);

foreach (ViewSheetSet vss in all)

{

Console.WriteLine("Name: " + vss.Name);

}

return Result.Succeeded;

}

Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com