Hi,
I’m trying to get 3 channels from Autodesk.Revit.DB,Color and I’m really stuck
Basically I’ve got lists: overrideGraphicSettings -> get for example CutLineColor -> get Red,Gree,Blue
Error:
Last script:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
colors = UnwrapElement(IN[0])
r,g,b = [],[],[]
OUT = []
for i in colors:
r = i.Red
g = i.Green
b = i.Blue
color1 = Autodesk.Revit.Creation.Application.NewColor(r,g,b) #First attempt
color2 = Autodesk.Revit.DB.Color(r,g,b) #Second attempt
OUT.append(color1)
OUT.append(color2)
Are you simply converting from revit color to dynamo? Clockwork has some nodes for this.
Hi, still no luck.
Attached rvt 2015, and dyn 1.0.0
COLOR_TEST.rvt (1.2 MB)
FILTERS_TEST.dyn (15.8 KB)
Hi @Tomasz_Puchala
Looks like the issue is coming from the color you’re feeding:
Yeah it looks like, do you know how to get color overrides from filters in view Template or just element? I always get invalid colors no matter what I do. There is sth like invalidColorValue that throws “-1” everytime.
Thanks
The reason why you are getting -1 is because the colours aren’t valid.
You could try this. It gets all the filters assigned to each view and then gets the filter overrides projection line colour and returns a Dynamo colour object if its valid:
#Copyright 2016. All rights reserved. Bimorph Consultancy LTD, 5 St Johns Lane, London EC1M 4BH www.bimorph.co.uk
#Written by Thomas Mahon @Thomas__Mahon info@bimorph.co.uk
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('DSCoreNodes')
import DSCore
from DSCore import Color
#Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
views = UnwrapElement(IN[0])
colList = []
for v in views:
filters = v.GetFilters() # Get all the filter ids
rgbList = []
for f in filters:
filterObject = v.GetFilterOverrides(f)
col = filterObject.ProjectionLineColor
if col.IsValid:
rgb = DSCore.Color.ByARGB(255, col.Red, col.Green, col.Blue)
else:
rgb = None
rgbList.Add( rgb )
colList.Add(rgbList)
OUT = colList
3 Likes