<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Saving viewsheetsetting problem. InSession issue. in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/saving-viewsheetsetting-problem-insession-issue/m-p/5742059#M71320</link>
    <description>&lt;P&gt;Update* Apparently this does not determine weither the IViewSheetSet = InSession&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if (vsheetset.Equals(newviewSheetSetting.InSession))&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
    <pubDate>Mon, 27 Jul 2015 15:41:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-07-27T15:41:17Z</dc:date>
    <item>
      <title>Saving viewsheetsetting problem. InSession issue.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/saving-viewsheetsetting-problem-insession-issue/m-p/5742029#M71319</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a problem that i have spent days trying to get working... thinking it is working and then continuously finding bugs with it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a viewsheet that I want to print...&lt;/P&gt;&lt;P&gt;Setup my printmanager...&lt;/P&gt;&lt;P&gt;and selected the print range - print to view/sheets&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;... but I can't get it to save the viewsheetsetting correctly in all cases of weither the user has&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;In-Session&lt;/STRONG&gt; or &lt;STRONG&gt;a saved print set&lt;/STRONG&gt;&amp;nbsp;enabled.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code bellow gets me most of the way but, for some reason i need to &lt;STRONG&gt;manually&lt;/STRONG&gt; &lt;STRONG&gt;press "OK"&lt;/STRONG&gt; in the image bellow and then run the code to get it to work.&lt;/P&gt;&lt;P&gt;otherwise the viewsheetsettings are not saved when&amp;nbsp;&lt;STRONG&gt;In-Session&amp;nbsp;&lt;/STRONG&gt; is enabled and it returns an error, &lt;STRONG&gt;"No views/sheets selected for printing"&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/180490i7868C089AB5E35FF/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I have looked at the viewprinter sample and cant find anything to solve this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp; This has been a nightmare trying to solve so if there is anyone with a working sample of code or any suggestions i would greatly appreciate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;&lt;BR /&gt;FilteredElementCollector printSetFilter = new FilteredElementCollector(doc);
                printSetFilter.OfClass(typeof(View));&lt;BR /&gt;
                ViewSet vwSet = new ViewSet();// to be assigned to IViewSheetSet

                foreach (Element item in printSetFilter)
                {
                    if (item is ViewSheet)
                    {
                        ViewSheet vw = (ViewSheet)item;
                        if (vw.SheetNumber == &lt;EM&gt;newSheetNumber&lt;/EM&gt;)//         &lt;STRONG&gt;newSheetNumber is of the sheet i have created.&lt;/STRONG&gt;
                        {
                            vwSet.Insert(vw);                //         place our new viewsheet in set
                        }
                    }
                }
                ViewSheetSetting newviewSheetSetting = printManager2.ViewSheetSetting;
                IViewSheetSet vsheetset = newviewSheetSetting.CurrentViewSheetSet;
               
                
                if (vsheetset.Equals(newviewSheetSetting.InSession))//     checking to see if InSession is enabled
                {                                                   //     there is no boolean return for insession?
                    
                    vsheetset = newviewSheetSetting.InSession;
                    newviewSheetSetting.InSession.Views = vwSet;
                    try
                    {
                        newviewSheetSetting.Save();
                    }
                    catch { }
                    vsheetset.Views = vwSet;
                }
                else
                {
                    newviewSheetSetting.CurrentViewSheetSet.Views = vwSet;
                    try
                    {
                        newviewSheetSetting.Save();
                    }
                    catch { }
                    vsheetset.Views = vwSet;
                }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2015 15:18:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/saving-viewsheetsetting-problem-insession-issue/m-p/5742029#M71319</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-27T15:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: Saving viewsheetsetting problem. InSession issue.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/saving-viewsheetsetting-problem-insession-issue/m-p/5742059#M71320</link>
      <description>&lt;P&gt;Update* Apparently this does not determine weither the IViewSheetSet = InSession&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if (vsheetset.Equals(newviewSheetSetting.InSession))&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2015 15:41:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/saving-viewsheetsetting-problem-insession-issue/m-p/5742059#M71320</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-27T15:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: Saving viewsheetsetting problem. InSession issue.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/saving-viewsheetsetting-problem-insession-issue/m-p/5744682#M71321</link>
      <description>&lt;PRE&gt;                bool needToCreateNewSet = true;
                FilteredElementCollector filteredElementCollectorSets = new FilteredElementCollector(doc);
                filteredElementCollectorSets.OfClass(typeof(ViewSheetSet));
                foreach (Element e in filteredElementCollectorSets)
                {
                    if (e is ViewSheetSet)
                    {
                        ViewSheetSet vSet = (ViewSheetSet)e;
                        if (vSet.Name == "PASS1192 - Printing Set")
                        {
                            vSet.Views = vwSet;
                            newviewSheetSetting.CurrentViewSheetSet = vSet;
                         
                            vsheetset.Views = vSet.Views;
                            
                            try
                            {
                                newviewSheetSetting.Save();
                            }
                            catch { }
                            printManager2.Apply();
                            needToCreateNewSet = false;
                        }
                    }
                }
                if (needToCreateNewSet == true)
                {
                    newviewSheetSetting.CurrentViewSheetSet.Views = vwSet;
                    
                    vsheetset.Views = vwSet;
                    try
                    {
                        newviewSheetSetting.SaveAs("PASS1192 - Printing Set");
                    }
                    catch { }
                    printManager2.Apply();
                    needToCreateNewSet = false;                    
                }&lt;/PRE&gt;&lt;P&gt;Solved. I could not successfully save Inession viewsheetsettings without using saveas() so i was forced to create a set to use.&lt;BR /&gt;I tried deleting the set after use but had a database error.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2015 12:22:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/saving-viewsheetsetting-problem-insession-issue/m-p/5744682#M71321</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-28T12:22:14Z</dc:date>
    </item>
  </channel>
</rss>

