<?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: Delete PrintSetup and ViewSheetSettings in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/delete-printsetup-and-viewsheetsettings/m-p/6208675#M67254</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Sure!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Arif, I'm very glad it helped! This issue (and similar) has been arround for a while it seems. The&amp;nbsp;PrintManager&amp;nbsp;is in genral rather unintuitive.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Matt, rolling back a transaction would indeed undo/remove saved PrintSettings and SheetSets made in the&amp;nbsp;&lt;EM&gt;current&lt;/EM&gt; transaction, but it is not given that the scope of the event is within the same transaction throughout the event. Nor is it&amp;nbsp;given that one want to undo/remove all changes made to the document during the transaction. One might event want to run a separate function which sole purpose is to&amp;nbsp;remove certain PrintSetups, SheetSets, etc. However, use of sub-transactions might nullify the need for this CleanUp-method. Thank you for your comment.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Eirik&lt;BR /&gt;&lt;BR /&gt;Edit: Typo&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Mar 2016 14:20:22 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-03-10T14:20:22Z</dc:date>
    <item>
      <title>Delete PrintSetup and ViewSheetSettings</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/delete-printsetup-and-viewsheetsettings/m-p/6063313#M67247</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TL;DR&lt;/P&gt;&lt;P&gt;Is there a way of deleting a specific PrintSetup and ViewSheetSetting programatically if i know its name?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Long version:&lt;/P&gt;&lt;P&gt;I'm writing a function that can print a large set of sheets in various paper sizes to separate/combined PDFs. To&amp;nbsp;be able to apply the PrintSetup,&amp;nbsp;it&amp;nbsp;needs to be set in an "in-session" state and saved using SaveAs() (to my knowledge). But after saving an "in-session"-PrintSetup&amp;nbsp;to a new PrintSetup, I cannot find a way of deleting said new PrintSetup. After the PrintManager has printed the sheets, I'm stuck with lots of temporary PrintSetups. The same goes for ViewSheetSettings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;            try
            {
                pMgr.PrintSetup.Delete();
                pMgr.ViewSheetSetting.Delete();
            }
            catch (Exception ex)
            {
                //Shows 'The &amp;lt;in-session&amp;gt; print setup cannot be deleted'
                TaskDialog.Show("REVIT", ex.Message);
            }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the problem is: I'm not able to apply the PrintSetup and ViewSheetSettings unless i'm&amp;nbsp;using them "in-session" and saving them using SaveAs, and i'm not able to delete the PrintSetup and ViewSheetSettings afterwards.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has&amp;nbsp;anyone experiences similar issues, or found a way to solve it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Eirik Aasved Holst&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2016 10:35:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/delete-printsetup-and-viewsheetsettings/m-p/6063313#M67247</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-01T10:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: Delete PrintSetup and ViewSheetSettings</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/delete-printsetup-and-viewsheetsettings/m-p/6063372#M67248</link>
      <description>&lt;P&gt;Dear Eirik,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This discussion makes one brief mention of deleting a print setting, afaik can tell:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/14946217/setting-viewsheetsetting-insession-views-property" target="_blank"&gt;http://stackoverflow.com/questions/14946217/setting-viewsheetsetting-insession-views-property&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This discussion appears&amp;nbsp;to suggest&amp;nbsp;a similar approach:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://forums.autodesk.com/t5/revit-api/printermanager-printsetup-do-not-apply-settings/td-p/3676618" target="_blank"&gt;http://forums.autodesk.com/t5/revit-api/printermanager-printsetup-do-not-apply-settings/td-p/3676618&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2016 11:15:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/delete-printsetup-and-viewsheetsettings/m-p/6063372#M67248</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-03-01T11:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Delete PrintSetup and ViewSheetSettings</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/delete-printsetup-and-viewsheetsettings/m-p/6063391#M67249</link>
      <description>&lt;P&gt;Jeremy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the links. Unfortunatley they do not help much. It would be nice if it was possible to loop&amp;nbsp;through the saved PrintSetup's, or at least get a PrintSetup if you knew it's name, so that you can delete it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the thread&amp;nbsp;&lt;A title="PrinterManager PrintSetup do not apply settings " href="https://forums.autodesk.com/t5/revit-api/printermanager-printsetup-do-not-apply-settings/td-p/3676618" target="_blank"&gt;PrinterManager PrintSetup do not apply settings&lt;/A&gt;, the user aricke mentions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Note that once you have done the saveas, you can then delete the newly saved printsetup.&lt;/PRE&gt;&lt;P&gt;I cannot seem to get that to work. even the following code will raise an exception&lt;/P&gt;&lt;PRE&gt;pSetup.SaveAs("tmp");
pSetup.Delete();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate any suggestions as to how to overcome/bypass this issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Eirik Aasved Holst&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2016 11:28:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/delete-printsetup-and-viewsheetsettings/m-p/6063391#M67249</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-01T11:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Delete PrintSetup and ViewSheetSettings</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/delete-printsetup-and-viewsheetsettings/m-p/6063449#M67250</link>
      <description>&lt;P&gt;No worries, i finally managed to create a CleanUp-method that works. If others are interested, here it goes&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        private void CleanUp(Document doc)
        {
            var pMgr = doc.PrintManager;
            using (var trans = new Transaction(doc))
            {
                trans.Start("CleanUp");
                CleanUpTemporaryViewSheets(doc, pMgr);
                CleanUpTemporaryPrintSettings(doc, pMgr);
                trans.Commit();
            }
        }

        private void CleanUpTemporaryPrintSettings(Document doc, PrintManager pMgr)
        {
            var printSetup = pMgr.PrintSetup;
            foreach (var printSettingsToDelete in (from element in new FilteredElementCollector(doc).OfClass(typeof(PrintSetting)).ToElements()
                                                   where element.Name.Contains(_tmpName) &amp;amp;&amp;amp; element.IsValidObject
                                                   select element as PrintSetting).ToList().Distinct(new EqualElementId()))
            {
                printSetup.CurrentPrintSetting = pMgr.PrintSetup.InSession;
                printSetup.CurrentPrintSetting = printSettingsToDelete as PrintSetting;
                pMgr.PrintSetup.Delete();
            }
        }

        private void CleanUpTemporaryViewSheets(Document doc, PrintManager pMgr)
        {
            var viewSheetSettings = pMgr.ViewSheetSetting;
            foreach (var viewSheetSetToDelete in (from element in new FilteredElementCollector(doc).OfClass(typeof(ViewSheetSet)).ToElements()
                                                  where element.Name.Contains(_tmpName) &amp;amp;&amp;amp; element.IsValidObject
                                                  select element as ViewSheetSet).ToList().Distinct(new EqualElementId()))
            {
                viewSheetSettings.CurrentViewSheetSet = pMgr.ViewSheetSetting.InSession;
                viewSheetSettings.CurrentViewSheetSet = viewSheetSetToDelete as ViewSheetSet;
                pMgr.ViewSheetSetting.Delete();
            }
        }&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Mar 2016 12:15:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/delete-printsetup-and-viewsheetsettings/m-p/6063449#M67250</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-01T12:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: Delete PrintSetup and ViewSheetSettings</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/delete-printsetup-and-viewsheetsettings/m-p/6063472#M67251</link>
      <description>&lt;P&gt;Dear Eirik,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Congratulations on solving this!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for sharing!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have my kudo.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2016 12:27:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/delete-printsetup-and-viewsheetsettings/m-p/6063472#M67251</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-03-01T12:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: Delete PrintSetup and ViewSheetSettings</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/delete-printsetup-and-viewsheetsettings/m-p/6065393#M67252</link>
      <description>&lt;P&gt;Dear Eirik,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you again for sharing this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I published an edited version of this thread&amp;nbsp;now:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2016/03/index-reloading-curves-distance-and-deleting-printsetup.html#6" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2016/03/index-reloading-curves-distance-and-deleting-printsetup.html#6&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2016 11:36:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/delete-printsetup-and-viewsheetsettings/m-p/6065393#M67252</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-03-02T11:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: Delete PrintSetup and ViewSheetSettings</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/delete-printsetup-and-viewsheetsettings/m-p/6208537#M67253</link>
      <description>&lt;P&gt;Dear Eirik,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Two comments on this from The Building Coder, by Arif and Matt:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;by Arif Hanif: This is awesome, I was working on a solution that involved a similar workflow for print setup but was running into issues. This helped solve my issue of creating and print panel schedules from the MEP model.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL start="2"&gt;
&lt;LI&gt;by Matt Taylor: Rolling back the transaction would nullify the need for this, wouldn't it?&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would you care to respond?&lt;/P&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;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;DIV class="post-body-inner"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 10 Mar 2016 13:13:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/delete-printsetup-and-viewsheetsettings/m-p/6208537#M67253</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-03-10T13:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Delete PrintSetup and ViewSheetSettings</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/delete-printsetup-and-viewsheetsettings/m-p/6208675#M67254</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Sure!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Arif, I'm very glad it helped! This issue (and similar) has been arround for a while it seems. The&amp;nbsp;PrintManager&amp;nbsp;is in genral rather unintuitive.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Matt, rolling back a transaction would indeed undo/remove saved PrintSettings and SheetSets made in the&amp;nbsp;&lt;EM&gt;current&lt;/EM&gt; transaction, but it is not given that the scope of the event is within the same transaction throughout the event. Nor is it&amp;nbsp;given that one want to undo/remove all changes made to the document during the transaction. One might event want to run a separate function which sole purpose is to&amp;nbsp;remove certain PrintSetups, SheetSets, etc. However, use of sub-transactions might nullify the need for this CleanUp-method. Thank you for your comment.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Eirik&lt;BR /&gt;&lt;BR /&gt;Edit: Typo&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2016 14:20:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/delete-printsetup-and-viewsheetsettings/m-p/6208675#M67254</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-10T14:20:22Z</dc:date>
    </item>
  </channel>
</rss>

