REVIT 2019 Dynamo 2.03
Hello,
I am trying to ovveride color elements.
After working on warnings and skim through elements and working on the list I was able to match
the exact number of elements retrieved with a color to be assigned.
So I am coming to graph with 2 lists, elements and colors
Than I worked on Archilab solutions as a base but I do not know why
it does not accept.
Here the script:
-
IN[0] is an element,
-
IN[1] is a color from the Color
-
import clr
-
clr.AddReference(“RevitNodes”)
-
import Revit
-
clr.ImportExtensions(Revit.Elements)
-
clr.AddReference(“RevitServices”)
-
import RevitServices
-
from RevitServices.Persistence import DocumentManager
-
from RevitServices.Transactions import TransactionManager
-
doc = DocumentManager.Instance.CurrentDBDocument
-
clr.AddReference(“RevitAPI”)
-
import Autodesk
-
from Autodesk.Revit.DB import *
-
import sys
-
pyt_path = r’C:\Program Files (x86)\IronPython 2.7\Lib’
-
sys.path.append(pyt_path)
-
def OverrideColorPattern(e, c):
-
gSettings = OverrideGraphicSettings()
-
gSettings.SetSurfaceForegroundPatternColor(c)
-
gSettings.SetProjectionLineColor(c)
-
gSettings.SetSurfaceBackgroundPatternColor(c)
-
UnwrapElement(view).SetElementOverrides(UnwrapElement(e).Id, gSettings)
-
return e
-
ele = UnwrapElement(IN[0])
-
col = UnwrapElement(IN[1])
-
try:
-
errorReport = None
-
output = []
-
i=0
-
while i < len(ele) :
-
C=col[i]
-
E=ele[i]
-
TransactionManager.Instance.EnsureInTransaction(doc)
-
output.append(OverrideColorPattern(E,C));
-
TransactionManager.Instance.TransactionTaskDone()
-
i=i+1
-
except:
-
import traceback
-
errorReport = traceback.format_exc()
-
if errorReport == None:
-
OUT = output
-
else:
-
OUT = errorReport
I got this error
Secondary I would love to be able to use the ovveride element color node, but
also that one I am not able to fill it properly, maybe I just awake dumb today.
Cheers.