Setting AppearanceAsset Properties

Hi all,

I’ve been trying to read and set appearance asset properties for materials in R2018. So far, by following numerous code examples, I’ve been able to extract all the appearance asset properties. Basically I cobbled together code from within the Material.MaterialAssetElement node and buildingcoder blog (http://thebuildingcoder.typepad.com/blog/2017/10/material-texture-path.html) to get the following result…

Now I’m trying to set these properties (UIName, description and keyword, which is r_asset[47]) but I’m getting the following error.

Does this have anything to do with editscope?

Can someone please help me incorporate that example in a python script?

Thanks!

I think I might have figured out the issue with Name…
Changing the r_asset lines to the following lines gave the desired output. ModName is just a list that contains the modified names to apply.

app_asset = doc.GetElement(appId)
app_asset.Name = ModName[i]

However, I’m still struggling with description and keywords…

Could you copy and paste your Python script here as preformatted text (hit the </> button after pasting)? Will be easier to help without having to retype your code from the screenshot :slight_smile:

Sure, here’s the code for reading the properties -

appElem = UnwrapElement(IN[0])

id_List=[]
NameList=[]
DescriptionList=[]
KeywordList=[]

for a in appElem:
id_List.append(a.Id)
r_asset = a.GetRenderingAsset()
try:
NameList.append(r_asset[“UIName”].Value)
except:
NameList.append("!!!")
try:
DescriptionList.append(r_asset[“description”].Value)
except:
DescriptionList.append("!!!")
try:
KeywordList.append(r_asset[47].Value)
except:
KeywordList.append("!!!")

OUT = id_List, NameList, DescriptionList, KeywordList
indent preformatted text by 4 spaces

I deleted the second script so don’t have that to paste, sorry.

@abhishek : any progress on this? I’d be interested in setting appearance asset properties via Dynamo myself and haven’t found any existing solution yet. I’ve looked at the archi-lab.net c# implementation for setting some of the parameters in AppearanceAssets.cs. You might also find Konrad’s article on the subject helpful.