Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I came across the post here: Link about how to create a macro to plot views from a linked model.
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 & 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.
When using a Print set & the <in-session> I get the following error after the first page:
/* * 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<ViewSheet>()) { printManager.PrintToFileName = @"C:\Temp\" + vs.SheetNumber + "."; printManager.SubmitPrint(vs); } } }}}
Any suggestions for what might be causing this?
Revit build:
16.0.428.0
20150220_1215(x64)
Solved! Go to Solution.