I’m trying to set up fully automatic PDF Printing via dynamo and have come across the Arch-lab node set which makes this step 100x easier. However the problem I’m coming across is this extract of code around line 83.
# apply print setting try: printSetup = printManager.PrintSetup printSetup.CurrentPrintSetting = printSetting printManager.Apply() except: pass
There is a try clause around the printSetup code which takes in the Print Settings you feed in. When I remove the try clause the node no longer executes stating:
“TypeError: expected IPrintSetting, got UnknownElement”
Currently I’m feeding in either from the Archi-lab dropdown PrintSettings node or I’m feeding in ‘CurrentPrintSetting’ directly through a python node as seen below. (Output myIPS)
import clr clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import * # Import Element wrapper extension methods clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.Elements) # Import geometry conversion extension methods clr.ImportExtensions(Revit.GeometryConversion) # Import DocumentManager and TransactionManager clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager doc = DocumentManager.Instance.CurrentDBDocument uiapp = DocumentManager.Instance.CurrentUIApplication app = uiapp.Application PrintSetup = doc.PrintManager.PrintSetup IPrintSetting = PrintSetup.CurrentPrintSetting PrintParameters = IPrintSetting.PrintParameters myPS = doc.PrintManager.PrintSetup myIPS = myPS.CurrentPrintSetting myPP = myIPS.PrintParameters myPSize = myPP.PaperSize myPSource = myPP.PaperSource #Assign your output to the OUT variable. OUT = [myPS, myIPS, myPP, myPSize, myPSource]
I can’t in any way seem to find documentation or something to plug into this PDFing node which it will understand as an ‘IPrintSetting’. Which explains why the node always prints at the last used (i.e. current) print setting and will not take in a new one.