Set wall compound layers from a list


I’m struggling to import back wall compound layers name into Revit. I worked on few options based on different topics I found on the forum and it seems i’m not too far from a result I want.
Here are the options I worked on and my issues :

Option 1 : With FamilyType.SetCompoundLayerMaterial by Clockwork
I think it’s the more advanced option, It works partially when lacing longest so think my issue comes from the string “layer index” and his structure, could be replication guides the solution ?

Option 2 : With Element.SetParameterByName
I simply tried this option, trying with parameter name that I found in python code from clockwork but it doesn’t work and I have a error message. I think it’s much more complicated with this kind of element.

Option 3 : Material.SetMaterialAssetByAssetId by Clockwork
I have no error message but it doesn’t work really, element ID might be not the good node to use, I tried with element name with the same result.

Here attached a screenshot and the script.
Any suggestions would be much appreciated.


Structure_Layers_Import.dyn (29.3 KB)

Thanks for the reply and the link, but I still have the same issue, I think my problem comes from the layer index.

To be more precise, my main goal is to be able to change few walls type and few materials type inside my wall library in order to update it.

To do that and to avoid mistakes, I made sure to have :
- 2 Lists (old and new names) with the same lenght. Materials are a sublist of each walls type.
- All name materials are already created

So far it works well with one wall but I need to do that for hundreds of them and at different layer index everytime. So with more walls type I struggle to set up the node layer index to match up with the structure of my lists. I attached a screenshot of the result, with lacing as longest each wall type is read by the script but when I use a indice layer higher than 0, the script reads into excel only the material on the first position of each wall.

I tried few thing without sucess, I read things about replication guides and I don’t know if it worth the shot in that case.