<?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: Macro to Print Linked Views in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/macro-to-print-linked-views/m-p/7369684#M56350</link>
    <description>&lt;P&gt;JimJia, when you say "&lt;SPAN&gt;Revit doesn't support printing views", are you referring to specific views &amp;amp; not actual sheets? I ask because there are times when I run this macro and sheets within a linked model do print in addition to the sheets within the "master" model while only having the "master" open.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also get the following error with the code posted:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error CS0119: 'Autodesk.Revit.DB.FilteredElementCollector.WhereElementIsNotElementType()' is a 'method', which is not valid in the given context&lt;/P&gt;</description>
    <pubDate>Mon, 11 Sep 2017 12:21:42 GMT</pubDate>
    <dc:creator>H4TSDESQ</dc:creator>
    <dc:date>2017-09-11T12:21:42Z</dc:date>
    <item>
      <title>Macro to Print Linked Views</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/macro-to-print-linked-views/m-p/7343114#M56347</link>
      <description>&lt;P&gt;I came across the post here:&amp;nbsp;&lt;A href="https://boostyourbim.wordpress.com/2013/07/13/print-sheets-from-host-linked-rvt-files/" target="_blank"&gt;Link&lt;/A&gt;&amp;nbsp;about how to create a macro to plot views from a linked model.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have modified it a little, mostly what printer and the base filename, but I'm only able to get a single page within the host file to print. I've changed the print range to include multiple views &amp;amp; still it only prints 1 sheet. Also note, the page that prints is the same all the time, even if it isn't open or set to be printed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When using a Print set &amp;amp; the &amp;lt;in-session&amp;gt; I get the following error after the first page:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="in session.PNG" style="width: 364px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/396349iB4CD3C87E269797D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="in session.PNG" alt="in session.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/*
 * Created by SharpDevelop.
 * User: H4TSDESQ
 * Date: 8/29/2017
 * Time: 11:13 AM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;
using Autodesk.Revit.DB.Events;
using Autodesk.Revit.UI.Events;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using Autodesk.Revit.ApplicationServices;

namespace printLinked
{
    [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
    [Autodesk.Revit.DB.Macros.AddInId("C86EF7BE-C396-4D36-9578-38595A99709C")]
	public partial class ThisApplication
	{
		private void Module_Startup(object sender, EventArgs e)
		{

		}

		private void Module_Shutdown(object sender, EventArgs e)
		{

		}

		#region Revit Macros generated code
		private void InternalStartup()
		{
			this.Startup += new System.EventHandler(Module_Startup);
			this.Shutdown += new System.EventHandler(Module_Shutdown);
		} 
		#endregion
		public void printLinked()
		{
			Application app = this.Application;
				
    foreach (Document doc in app.Documents)
    {
       PrintManager printManager = doc.PrintManager;
       printManager.PrintToFile = true;

       printManager.SelectNewPrintDriver("Adobe PDF");

        foreach (ViewSheet vs in new FilteredElementCollector(doc).OfClass(typeof(ViewSheet)).Cast&amp;lt;ViewSheet&amp;gt;())
        {
            printManager.PrintToFileName = @"C:\Temp\" + vs.SheetNumber + ".";
			printManager.SubmitPrint(vs);
		}

		}
		}}}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions for what might be causing this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Revit&amp;nbsp;build:&lt;/P&gt;&lt;P&gt;16.0.428.0&lt;BR /&gt;20150220_1215(x64)&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 18:31:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/macro-to-print-linked-views/m-p/7343114#M56347</guid>
      <dc:creator>H4TSDESQ</dc:creator>
      <dc:date>2017-08-31T18:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Print Linked Views</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/macro-to-print-linked-views/m-p/7343733#M56348</link>
      <description>&lt;P&gt;Some possible causes are as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) Some ViewSheets are placeholders and can't be printed. The ViewSheet class has a 'IsPlaceHolder' property so check this is false.&lt;/P&gt;&lt;P&gt;2) Some views are not ready to be printed due to application/view state the 'ViewSheet.CanBePrinted property should be checked for true.&lt;/P&gt;&lt;P&gt;3) I don't believe a ViewSheet can be a template but if you are printing views in general you should also check the View.IsTemplate = false.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Printing sheets from links doesn't sound ideal to me&amp;nbsp;but I've never tried so can't say it inherantly has problems.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure you need this many using statements considering the limited namespaces you are using.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I should also say that I've found the Adobe PDF writer impossible to set the printed&amp;nbsp;filename on dynamically. Usually you can set the print to file path but it will ignore it and just prompt you for a filename.&amp;nbsp;This is obviously annoying in a batch printing situation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;
using Autodesk.Revit.DB.Events;
using Autodesk.Revit.UI.Events;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using Autodesk.Revit.ApplicationServices;

namespace printLinked
{
	[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
	[Autodesk.Revit.DB.Macros.AddInId("C86EF7BE-C396-4D36-9578-38595A99709C")]
	public partial class ThisApplication
	{

		private void Module_Startup(object sender, EventArgs e)
		{
		}


		private void Module_Shutdown(object sender, EventArgs e)
		{
		}

		#region "Revit Macros generated code"
		private void InternalStartup()
		{
			this.Startup += new System.EventHandler(Module_Startup);
			this.Shutdown += new System.EventHandler(Module_Shutdown);
		}
		#endregion
		public void printLinked()
		{
			Application app = this.Application;

			foreach (Document doc in app.Documents) {
				PrintManager printManager = doc.PrintManager;
				printManager.PrintToFile = true;
				printManager.SelectNewPrintDriver("Adobe PDF");

				FilteredElementCollector FEC = new FilteredElementCollector(doc);
				ElementClassFilter ECF = new ElementClassFilter(typeof(ViewSheet));
				List&amp;lt;ElementId&amp;gt; VS_Ids = FEC.WherePasses(ECF).WhereElementIsNotElementType.ToElementIds;

				foreach (ElementId EID in VS_Ids) {
					ViewSheet VS = doc.GetElement(EID) as ViewSheet;
					if (VS == null)
						continue;
					if (VS.IsPlaceholder == true)
						continue;
					if (VS.CanBePrinted != true)
						continue;

					printManager.PrintToFileName = "C:\\Temp\\" + VS.SheetNumber + ".";
					printManager.SubmitPrint(VS);

				}
			}
		}
	}
}&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Aug 2017 22:11:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/macro-to-print-linked-views/m-p/7343733#M56348</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2017-08-31T22:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Print Linked Views</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/macro-to-print-linked-views/m-p/7360818#M56349</link>
      <description>&lt;P&gt;Thanks a lot for RPTHOMAS108's detailed sharing! I believe this code should work for desired views.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that Revit doesn't support printing views which are from linked&amp;nbsp;document, if you want to print them, you have to open the linked document and print viewsheet from there.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 08:53:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/macro-to-print-linked-views/m-p/7360818#M56349</guid>
      <dc:creator>JimJia</dc:creator>
      <dc:date>2017-09-07T08:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Print Linked Views</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/macro-to-print-linked-views/m-p/7369684#M56350</link>
      <description>&lt;P&gt;JimJia, when you say "&lt;SPAN&gt;Revit doesn't support printing views", are you referring to specific views &amp;amp; not actual sheets? I ask because there are times when I run this macro and sheets within a linked model do print in addition to the sheets within the "master" model while only having the "master" open.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also get the following error with the code posted:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error CS0119: 'Autodesk.Revit.DB.FilteredElementCollector.WhereElementIsNotElementType()' is a 'method', which is not valid in the given context&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 12:21:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/macro-to-print-linked-views/m-p/7369684#M56350</guid>
      <dc:creator>H4TSDESQ</dc:creator>
      <dc:date>2017-09-11T12:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Print Linked Views</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/macro-to-print-linked-views/m-p/7371320#M56351</link>
      <description>&lt;P&gt;Sorry this was a conversion error that crept in when I converted to C#&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;change the line:&lt;BR /&gt;&lt;EM&gt;List&amp;lt;ElementId&amp;gt; VS_Ids = FEC.WherePasses(ECF).WhereElementIsNotElementType.ToElementIds;&lt;/EM&gt;&lt;BR /&gt;to&lt;BR /&gt;&lt;EM&gt;ICollection&amp;lt;ElementId&amp;gt; VS_Ids = FEC.WherePasses(ECF).WhereElementIsNotElementType().ToElementIds();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the macro works for you and your expectations of it are at the right level&amp;nbsp;then that is all that really matters.&amp;nbsp;However even in a single model there are lots of printing&amp;nbsp;pitfalls (alliteration)&amp;nbsp;that a simple macro isn't going to handle&amp;nbsp;i.e. worksharing (views and print settings), so called non-pumping waits; where long running tasks make OS think Revit has become unresponsive.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've also found that some views are not ready to be printed, I'm not sure if there is a way to make such views print ready. In the past I&amp;nbsp;tried opening them before hand, not sure if that had a benefit in&amp;nbsp;forcing a regeneration of them?&amp;nbsp;Would be nice to have clarity on this&amp;nbsp;i.e. to know&amp;nbsp;if there is a way to make views print ready?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 20:55:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/macro-to-print-linked-views/m-p/7371320#M56351</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2017-09-11T20:55:25Z</dc:date>
    </item>
  </channel>
</rss>

