Renaming Print Settings

Hi, I am trying to rename print settings with Element.SetName but it isn’t working. I assume the node will take lists of matching lengths (I’ve tried it trying to rename one print setting at a time as well and still no joy) Any ideas what I’m doing wrong? thanks Print Settings Rename.dyn (34.1 KB)

Hi @James_Hyde,

You have to use the Rename method.
http://www.revitapidocs.com/2018.1/ce2e12e0-8875-7238-26d4-3fd323142899.htm

Hi Alban,

Thank you, do I have to incorporate that into the Element.SetName node or create a new one? - I assume the relevant python script within the node is the one shown below. Also, what is the syntax in Python? sorry, no idea when it comes to programming! Thanks.

I can change the name of the active PrintSetting

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

newName=IN[0]

printManager = doc.PrintManager
printSetup = printManager.PrintSetup

TransactionManager.Instance.EnsureInTransaction(doc)
printSetup.Rename(newName)
TransactionManager.Instance.TransactionTaskDone()

OUT = printSetup

You can also find some informations here :

Hi Alban, many thanks will take a look through this

When I try to rename Printsetting Types, I have this error above the Python Script :
Exception: You can NOT set the name here, please set the name via PrintSetup::Rename method!

So I can’t go further.

It is written in the API :
“The PrintSetup manages the print settings of current document.
The Print Setup object can only get from PrintManager object.
Print Setup Rename = Rename the current print setting with the specified name.”