Change colours of filled regions using the genius loci filledregion color change

Hi, I am trying to change the colours of filled regions - I am using the genius loci package - filled region color change custom node, but when i feed in the filled region and colour, the node returns null. I have tried using hex colour code and RGB neither seems to work, can’t figure out where it is going wrong.
Any help appreciated!

I do not have any experience with these nodes but you are feeding a color code (string) into a color input. Maybe try using a colorpalette node.

1 Like

tried the colour pallette - no luck either.
is there a was to check what input the node is expecting?

The problem is that you are using a custom node, maybe try asking the developer of this custom node why this node is not working properly. For each OOTB node check out the Dynamo Dictionary: Dynamo Dictionary

It seems like iteration problem. Can you add a List.Create after watch node and connect it?

hi Deniz
tried with the list.create - still getting null

I tried on my side with Colorby.ARGB node and it works. Can you also try that?

UPDATE:

It is because of wraped elements… if you can update the python code of node like that:
@Alban_de_Chasteigner will update, too. I guess.

#Alban de Chasteigner, 2018
#twitter : @geniusloci_bim
#geniusloci.bim@gmail.com

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

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

def tolist(obj1):
	if hasattr(obj1,"__iter__"): return obj1
	else: return [obj1]
	
def ConvertColor(e):
	return Autodesk.Revit.DB.Color(e.Red, e.Green, e.Blue)

filledRegions = tolist(UnwrapElement(IN[0]))
colors = tolist(UnwrapElement(IN[1]))
filledRegionTypes=[]

TransactionManager.Instance.EnsureInTransaction(doc)
for color,fillR in zip(colors,filledRegions) :
	if isinstance(fillR, Autodesk.Revit.DB.ElementType):
		filledRegionType=fillR
	else :
		filledRegionType = doc.GetElement(fillR.GetTypeId())
	filledRegionTypes.append(filledRegionType)
	filledRegionType.Color=ConvertColor(color)
TransactionManager.Instance.TransactionTaskDone()


OUT = filledRegionTypes

1 Like

hi deniz
replicated that - still get null. very strange

Please try with that new Python code, let’s see what happens…

updated python code -
still getting null?!
am i missing something?
sorry thanks for the help

hello
what is the version of Revit ?
the property Color of FilledRegionType Class is deprecated in Revit 2019
https://www.revitapidocs.com/2019/508c9ad5-cabd-b2e1-c598-742be57fb2f7.htm

You are right, when you try to do with FilledRegionType, Revit crashes…

i’m using revit 2020…
is it possible to adjust the python script further to deal with the new ```
‘ForegroundPatternColor’ in 2020?

I will have a go myself but am a python novice...

Can you try that one?

#Alban de Chasteigner, 2018
#twitter : @geniusloci_bim
#geniusloci.bim@gmail.com

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

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

def tolist(obj1):
	if hasattr(obj1,"__iter__"): return obj1
	else: return [obj1]
	
def ConvertColor(e):
	return Autodesk.Revit.DB.Color(e.Red, e.Green, e.Blue)

filledRegions = tolist(UnwrapElement(IN[0]))
colors = tolist(UnwrapElement(IN[1]))
filledRegionTypes=[]

TransactionManager.Instance.EnsureInTransaction(doc)
for color,fillR in zip(colors,filledRegions) :
	if isinstance(fillR, Autodesk.Revit.DB.ElementType):
		filledRegionType = fillR
		filledRegionType.ForegroundPatternColor = ConvertColor(color)
		filledRegionTypes.append(filledRegionType)
	else :
		filledRegionType = doc.GetElement(fillR.GetTypeId())
		filledRegionType.ForegroundPatternColor=ConvertColor(color)
		filledRegionTypes.append(filledRegionType)
	
TransactionManager.Instance.TransactionTaskDone()


OUT = filledRegionTypes
4 Likes

@alina

What is your goal?

To be sure; note the difference FilledRegionType and
FilledRegion(s) in the Element Types node.

Working!!
amazing thankyou

Thanks Deniz, I will update the node for Revit 2020.

2 Likes

Hello Alban, thank you for your efforts. The problem exists on 2019, too.

Hi @alina and @Deniz_Maral,

I updated the node. It now works with all versions of Revit.
I also added some optional inputs (pattern, masking and Line Weight)

2 Likes

Thank you very much Alban! Great work!

1 Like