So after a bunch of searching on the forum for issues with the print pdf node I saw everyone end up at the same conclusion “the combined option is broken” and “the print settings don’t apply” and everyone seemed to kind of accept that as fact.
Well ladies and gents, after many many many hours last night I figured out the problem. The issue was how the code decided which print method to run based on whether you inserted a list of views and a list of print settings or any variation of such.
Lets begin with the print setting issue because it is simple. The usual error that would happen would be something along the lines of “cannot do something because element changed in revit database.” I double checked the api and the code seemed correct the issue however after some fiddling around with where I moved the code was that if it was put into its own transaction it would work perfectly. I also had to unwrap the print setting element.
So these are the line you want to delete/modify:
And this is what you want to insert instead.
TransactionManager.Instance.EnsureInTransaction(doc) printSetup = printManager.PrintSetup printSetup.CurrentPrintSetting = UnwrapElement(printSetting) printManager.Apply() TransactionManager.Instance.TransactionTaskDone()
Now to toggle the combined problem.
Here are the 3 print cases. First one being you inserted a list of views and a list of print settings. Second, you inserted a list of views and not a list of print settings. And last, you inserted not a list of views and not a list of print settings. Now no matter how hard you try and play around with the lacing and levels you will notice that when you select combined the pdfs will still print sheet by sheet. To figure out what was wrong I put in a message box for each print setting to see which choice was running and I noticed that when I fed a list of views and a single print setting (because I only need to use one) which would be case 2 the script cycles each sheet as you can see in the code where there is a for loop. If you go back up to the code and look at
you will see that it is trying to insert the list of views into the view set which it cant because the viewset insert only accepts views. So what ends up happening with the loop is that you are inserting each sheet one by one and therefore instead of making a combined file its printing each separately. To fix this adjust the code as such so the loop is for the insertion of views to make a true viewset with many views in it.
Now you need to edit the print option portion of the code ( the one with 3 cases). The fix is to essentially make option 3’s line of code run. So I deleted the 3 if statements and just made it run the code for option 3 as such.
Now you should be able to print view sets as combined with working print settings. In my case I feed in the list of view for the view set and just one print setting. I haven’t bothered with the other cases but I’m sure with some slight code changes you can get it to work.
Hope this helps everyone who tried to use the node and maybe the code can be changed and cleaned up to work for all cases and uploaded to the package