Access To Material Texture Path

https://github.com/erfajo/OrchidForDynamo/issues/34

I presume it will be implemented soon.
At the moment I have a solution with Python.

#Copyright Alberto Tono alberto.tono@hok.com

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

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

for mat in mats:
	appearanceAssetId = mat.AppearanceAssetId
	assetElem = doc.GetElement(appearanceAssetId)
	getRenderingAsset = assetElem.GetRenderingAsset()
	genericDiffuseProperty = getRenderingAsset.FindByName("generic_diffuse")
	connectedAsset = genericDiffuseProperty.GetSingleConnectedAsset()
	bitmapProperty = connectedAsset["unifiedbitmap_Bitmap"]
	path = bitmapProperty.Value

OUT = path

5 Likes