ViewSheetSetting

ViewSheetSetting

stephen_harrison
Advocate Advocate
779 Views
1 Reply
Message 1 of 2

ViewSheetSetting

stephen_harrison
Advocate
Advocate

Hope someone can help?

Im working in Revit 2018 in c# and I am trying to create a ViewSheetSetting and I for what ever reason am missing what I am sure is the obvious.

 

My basic code is:

 

Document doc = m_printData.commandData.Application.ActiveUIDocument.Document;
ViewSet myViewSet = new ViewSet();
foreach (ViewSheet vs in new FilteredElementCollector(doc).OfClass(typeof(ViewSheet)))
{
myViewSet.Insert(vs);
}
PrintManager printMgr = doc.PrintManager;
printMgr.PrintRange = Autodesk.Revit.DB.PrintRange.Select;
ViewSheetSetting viewSheetSetting = printMgr.ViewSheetSetting;
viewSheetSetting.CurrentViewSheetSet.Views = myViewSet;
using (Transaction transaction = new Transaction(doc, "NewSheetSet"))
{
transaction.Start();
try
{
viewSheetSetting.SaveAs("Test");

}
catch (Exception ex)
{
transaction.RollBack();
}
transaction.Commit();
}

 

I hope someone can put me out of my misery and show me were I have gone wrong.

Thanks in advance.

0 Likes
Accepted solutions (1)
780 Views
1 Reply
Reply (1)
Message 2 of 2

stephen_harrison
Advocate
Advocate
Accepted solution

UPDATE

 

Having tested the code in a macro it became apparent that there was in fact nothing wrong with the code.

This at least allowed me to look else were and the problem then became very obvious.

It was all down to the closing of the Dialog Form, which due to the DialogResult was RollingBack the transaction.

0 Likes