I have automated the Paint material creation process but now to apply the Paint i can get it to do it for a single floor. But i want Dynamo and python to loop for multiple elements and materials in list form?
Here is the Python script i got after searching so much on the forums. This script is working fine for one element. how do i make it work for multiple materials and multiple floors.
import clr
Here is the python script one is using
import clr
#Import the Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
#Import Document and transcation manager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
#referecing active document
doc = DocumentManager.Instance.CurrentDBDocument
elems = FilteredElementCollector(doc, doc.ActiveView.Id).ToElementIds()
elems = UnwrapElement(IN[0])
newMat = UnwrapElement(IN[1])
gOpts = Options()
TransactionManager.Instance.EnsureInTransaction(doc)
geom = elems.get_Geometry(gOpts)
for j in geom:
face = j.Faces
for f in face:
#if doc.IsPainted(i.Id, f):
#if f.MaterialElementId == oldMat.Id:
doc.Paint(elems.Id, f, newMat.Id)
TransactionManager.Instance.TransactionTaskDone()
OUT = elems