How to assign persistent materials to Direct Shape?

  1. 4 direct shapes (1.rvt)

  2. Assigning materials to 4 direct shapes through DY (1. Assign Materials.dyn)
    Concrete - Grey to QL_2B3Pmy2&3Pmy3_SB_YST_01
    Concrete - Purple to QL_2B3Pmy2&3Pmy3_SB_YST_02
    Concrete - Green to QL_2B3Pmy2&3Pmy3_SB_YST_03
    Concrete - Cyan to QL_2B3Pmy2&3Pmy3_SB_YST_04

  3. Delete origins and you will see colored direct shapes (DY will make a copy and assign the material to the copy, not to the origins)

  4. But if you open another 3d window in Revit, the color disappear.
    Or use Element.GetMaterials in DY, yu will get empty list.

Looks to me the material assigned to direct shapes are just color in view, so they are not persistent.

File link: https://drive.google.com/drive/folders/1htv2aFaQK_1Y4L1Jbe-60gBq_IjmTE6A?usp=sharing

@Xiaofei_Ying I have tried your script and it worked just fine,Not sure why your Having this issue.Though one of the issues in using Direct shapes is that you wont be able to change its material property in Revit.I would suggest using Spring.FamilyInstance.ByGeometry for a change.
Check this post.


Hi mustanachar,

Thanks forthe testing. You’re right, the material is persistent.
As for Springs.FamilyInstanceByGeometry, it says “you must provide a valid template path”, but I don’t know which path is to be provided?