Rename wall types using Excel and Dynamo

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 ?

1 Like

@opetit09 ,

you are setting a type Parameter…

I got an error this time: Type Name is read-only

1 Like

@opetit09 ,

This node can only change instance Parameters!

you have to use a Type Edit Parameter… like in my pic (archilab f.e.)

Oh sorry, i didn’t pay attention.

this time i used the right node and try “Type” and “Type Name” as parameter name but… nothing have change.

btw thx for helping !

1 Like

@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

Ok, so i tried to use a filter but this time i’ve got some trouble with the string contain’s node .

Almost all the element of the list are false except the first one coming from the Search for list.
I’ve try to use level but can’t find the good way to use it.

And i have an error in the last node…

Instead of getting all Wall elements, get all Wall Type elements. To name them, you’ll need to use something like the Element.SetName node from Clockwork. The type name isn’t a standard parameter so you can’t use the OOTB SetParameter or Archilab node to do this.

1 Like

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]
1 Like

Thanks both of you, it works !

1 Like

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.

1 Like