Filter items by entered value of the parameter on the 3D Views and the calculation of the amount

Good afternoon. To optimize the work of our Department, based on the work of this forum, I created my own script, I would like to share it and ask a few questions.
The task was to check for filling in the values of the parameters, but in the process it was extended to the calculation of “Volumes” by the value of the parameter and display a list of ID to facilitate the search for elements.
For the script to work, you need to open the prepared 3D view, specify the desired Parameter and its value. If the value is not filled, values with a space will be presented. The script works in the environment “Dynamo” 1.3 and above.
The results of the script will be presented in 3D, where the red elements will be highlighted with the specified value of the parameter. In the “Dynamo” in the group of ‘result’ will indicate the Amount of items and the list ID (selected ID).
My question:
Node “Wath” (ID selected) allows you to quickly find items by clicking on an ID, however I would like to highlight them by clicking the mouse. Is there a solution to this problem?
Now, as a temporary solution, I use a third-party Node and bring the parameter to it in the form of a list index, but this is extremely inconvenient.
What can I use to output the group “result” in Revit and does it make sense to do it?
I thank everyone involved for their invaluable help in solving the problems and especially Mostafa_El_Ayoubi, Dimitar_Venkov , Konrad_K_Sobon, and kennyb6 whose achievements I used in my work.

Перевести вGoogleBingI would be grateful for comments on my script.I would be grateful for comments on my script.

Filter_Parametr_Value.dyn (10.1 KB)

Script_Python_Rezult

# Andbary Shtrabag Moscow 
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

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

clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc=DocumentManager.Instance.CurrentDBDocument

clr.AddReference("DSCoreNodes")
from DSCore import *

sss=IN[0]
sss1=IN[1]
sss2="Volume" #Считаем Объем
red=255 #Красный
grey=150 #Серый
Visible1=IN[2]#Скрыть или оставить не имеющие значение параметра
Visible2=IN[3]#Уровень прозрачности

as1 = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Floors).WhereElementIsNotElementType().ToElements(), FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType().ToElements(), FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_GenericModel).WhereElementIsNotElementType().ToElements(), FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StructuralFoundation).WhereElementIsNotElementType().ToElements(), FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_EdgeSlab).WhereElementIsNotElementType().ToElements(), FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StructuralColumns).WhereElementIsNotElementType().ToElements(), FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StructuralFraming).WhereElementIsNotElementType().ToElements(), FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Stairs).WhereElementIsNotElementType().ToElements() 
as2 = List.Flatten(as1,2)

lk = []
lk1 = []
for k in as2:
    r = k.LookupParameter(sss).AsString()
    if sss1=="" or sss1=='' or sss1==" " or sss1==None:
    	if r==None or r=="" or r=='':
    		lk.append(k)
    	else:
        	lk1.append(k)    
    else:    
    	if r==sss1:	
    		lk.append(k)
    	else:
        	lk1.append(k)
        
lk3=[]
for o in lk:
	try:
		r = o.LookupParameter(sss2).AsDouble()/35.31466672
	except:
		r = 0
	lk3.append(r)
color = Autodesk.Revit.DB.Color(red,0,0)
color0 = Autodesk.Revit.DB.Color(grey,grey,grey)

output = []

ogs = OverrideGraphicSettings()
ogs.SetProjectionLineColor(color)
ogs.SetProjectionFillColor(color)

ogs1 = OverrideGraphicSettings()
ogs1.SetProjectionFillColor(color0)
ogs1.SetCutFillColor(color0)
ogs1.SetProjectionLineColor(color0)
ogs1.SetCutFillColor(color0)
ogs1.SetSurfaceTransparency(Visible2)
ogs1.SetProjectionFillPatternVisible(Visible1)

TransactionManager.Instance.EnsureInTransaction(doc)
	
for i in lk:
	output.append(doc.ActiveView.SetElementOverrides(i.Id, ogs))

for j in lk1:
	output.append(doc.ActiveView.SetElementOverrides(j.Id, ogs1))

TransactionManager.Instance.TransactionTaskDone()

OUT = lk,  sum((lk3))








#1

I am guessing you are using @Mostafa_El_Ayoubi UI.ListView UI.Listview Data - Data|Shapes node to display/highlight in your view. I am not sure I get what is so inconvenient about it?

1 Like

Thanks. No, I’ve never seen this UI.ListView before. I’m very beginner. Unfortunately, while I can not say whether it will be convenient for me, the performance has fallen very much and is not quite understood in this connection.

Give it a try! The documentation is extensive on that, you would get your way. This will be useful for you.

1 Like

Once again, thank You very Much. Very, very useful script to learn how Revit and Dynamo work. But while I do not have enough skills to make the required changes to it, for example, it does not complete the work of the main unit before closing and (or) does not have the required performance for me. I will study.

Life does not stand still …
Since the creation time, I had to add the following functionality:

  1. Ability to select ID to the clipboard.
  2. Filtering by the first characters of the parameter.
    It is often necessary to filter out a complex parameter by nesting, such as: W - Group, W1 - Level, etc

I imagine created, suddenly come in handy.
Many thanks to all whose achievements I used._1_5dRU_Str_Comment.dyn (24.9 KB)