You can start with this:
# Copyright(c) René Castillo Picazo
# México 2017
# cadesigner.mex@gmail.com
import clr
clr.AddReference("RevitAPI")
clr.AddReference("RevitServices")
import Autodesk
import RevitServices
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
surfaces = IN[0]
material = UnwrapElement(IN[1])
def PaintFace(surf, mat):
elemRef = surf.Tags.LookupTag("RevitFaceReference")
elem = doc.GetElement(elemRef)
face = elem.GetGeometryObjectFromReference(elemRef)
if not (doc.IsPainted(elem.Id, face)):
return doc.Paint(elem.Id, face, mat.Id)
TransactionManager.Instance.EnsureInTransaction(doc)
if (isinstance(surfaces, list)):
[PaintFace(j, material) for i in surfaces for j in i]
else:
PaintFace(surfaces, material)
TransactionManager.Instance.TransactionTaskDone()