How to rename the Appearance Information Names in the Material Brower

I’m really a beginner. There are bunch of Information Names have to be renamed in the Material Brower. What I need is to change the names in red lines from “Poche” to “Redfab”. How could I change them in dynamo? Thank you so much!!
question
I got one dyn file from the Internet to rename the Material names but I don’t know how to rename the Appearance Information Names. :frowning:

Python Script:

import clr
from System.Collections.Generic import *

clr.AddReference(‘RevitNodes’)
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
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
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

name=IN[0]
newName=IN[1]
TransactionManager.Instance.EnsureInTransaction(doc)
materialCategoryfilter = ElementCategoryFilter(BuiltInCategory.OST_Materials)
collector = FilteredElementCollector(doc)
materials = collector.WherePasses(materialCategoryfilter)
TransactionManager.Instance.TransactionTaskDone()

out=
for i in materials:
maName=i.Name
if name in maName:
i.Name=maName.replace(name,newName)
out.append(i.Name)

OUT = out

try this
Package from genius Loci and Clockwork

2 Likes

Thanks myrwen.junterealSJC7
Maybe I did not explain clearly or did something wrong. I tried your suggestion but changed one “Information Name” only. How could I change them all in one time? As the image below.
question
Thanks again!

There are much more tasks I just found. Is it possible to reassign the path with the new texture file names in Dynamo? Anyway, thanks a lot!
question+++

Use the Material Change Texture Path node for this task.
Material Change Texture Path

Thanks Alban_de_Chasteigner. I’m really a beginner. Could you please give me more tips? What I could do is just stopping there. As the picture:


Thanks again!

I got it! Thanks Alban_de_Chasteigne and myrwen.junterealSJC7, thank you so much!!!

Hi. Could you share the solution for this please? I would appreciate it a lot¡

Thank you¡

Hi. Could you share the solution for this please? I am not getting it done¡ I would appreciate it a lot¡

Thank you¡

@Alban_de_Chasteigner
Is there also a way to change the values in Description and Keywords?

Hi,

Something like that to change the keyword.
To be improved if it is necessary to define several values.

def toList(obj):
    if hasattr(obj, '__iter__'): return obj
    else: return [obj]
    
mats = toList(UnwrapElement(IN[0]))
value = toList(IN[1])[0]

for mat in mats :
	appearanceAssetId = mat.AppearanceAssetId
	assetElem = doc.GetElement(appearanceAssetId)
	TransactionManager.Instance.EnsureInTransaction(doc)
	with Visual.AppearanceAssetEditScope(assetElem.Document) as editScope:
		editableAsset = editScope.Start(assetElem.Id)
		key = editableAsset.FindByName("keyword")
		if key.IsValidValue(value):
			key.Value = value
		editScope.Commit(True)
	TransactionManager.Instance.TransactionTaskDone()

What do you mean by this?

I was thinking of writing several keywords for one apareance but after checking you can already do it with a single string containing commas.

So i can feed something like this into IN1 "keyword1, keyword2, keyword3"?

Changing ‘keyword’ into ‘description’ would that work for changing Description values?
Or is that thought to simple? :exploding_head: :upside_down_face:

Man, i wish changing Material (Asset) Parameters would be as simple as Family (Element) Paramters. :roll_eyes:. I really need to start learning Python, that is certain now…

Edit
I guess it is that simple for Materials

…, but not (Appearance)Assets.

Edit 2

How do i use this? Is this for Python Script from String? Or do i need to replace something in one of your custom nodes?