Hi All,
I’m new with dynamo and i don’t understand why my script doesn’t work.
I have no errors but the walls are not renamed .
Can someone help ?
This node can only change instance Parameters!
you have to use a Type Edit Parameter… like in my pic (archilab f.e.)
@opetit09 , hi
your number of types has to be same of your input values…
if not sort your walls (types) in unique items…
KR
Andreas
To elaborate on Hamish’s post, here’s an example of how Python can change the element names. Often for tasks like this I’ll often also check if the name had to change and not try to change it if it doesn’t as well. More relevant for larger sets of objects.
Change wall type names.dyn (16.2 KB)
# Made by Gavin Crump
# Free for use
# BIM Guru, www.bimguru.com.au
# Boilerplate text
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
# Current doc/app/ui
doc = DocumentManager.Instance.CurrentDBDocument
# Define list/unwrap list functions
def tolist(input):
result = input if isinstance(input, list) else [input]
return result
def uwlist(input):
result = input if isinstance(input, list) else [input]
return UnwrapElement(result)
# Preparing input from dynamo to revit
wallTypes = uwlist(IN[0])
newNames = tolist(IN[1])
report = []
# Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
# For each wall type, try to change its name
for wt,nn in zip(wallTypes,newNames):
# Check if name hasn't changed
if Element.Name.GetValue(wt) == nn:
report.append("Name is the same. No change made.")
else:
try:
wt.Name = nn
report.append("Name changed successfully.")
except:
report.append("Could not change wall type name.")
TransactionManager.Instance.TransactionTaskDone()
# Preparing output to Dynamo
OUT = [wallTypes,report]
Thanks both of you, it works !
you can connect element.elementtype node which will retrieve your element types to set your type parameters.
Yes but then you only see the types with instances in the model placed, and would need to run it through a unique items node afterwards to avoid setting the same type parameters multiple times. Unless you want to assess placed types only, I’d always lean towards using element types.