List.count for list level 2

Hi everyone
I am trying to create a mark beam list like image
Someone can help me

I’m not sure what you want to count here. The beams based on the Mark-parameter? :slight_smile:

Hi @CVest
I I have filtered beams of the same length and type and I want to Mark - parameter type it with the same name
Please see result like image

I think Count might be the wrong thing but what he wants is for Element.SetParameterByName to have all of the elements in each nested list to be set to the same value in the DS# list according to the index of the nested list. As in, all of the elements in the first nested list to be DS1, all of the elements in the second nested list to be DS2, etc.

As I don’t have access to your revit project, I can’t test this but you can try this script in a python node:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
#The inputs to this node will be stored as a list in the IN variables.
elements = IN[0]
paramName = IN[1]
values = IN[2]

for i in range(len(elements)):
	for j in elements:
		j.SetParameterByName(paramName,values[i])
#Assign your output to the OUT variable.
OUT = elements

Use this python script to replace the Element.SetParameterByName node, make sure you increase the inputs on the python node to 3 (up to IN[2]), and connect in the same order. Let me know if it works or if any errors pop up.

2 Likes

Thanks @kennyb6 i will try now!

Sorry, I mistyped one line. Replace for j in elements: to

    for j in elements[i]:

@kennyb6
i try your python but error line 14 4

What is the error? And is it possible to post your Revit and Dynamo files?

@kennyb6
Please help me
This is .dyn .rvt
Sorry I do not know much about python


V3.dyn (11.2 KB)

I am assuming you are using Revit 2018? I cannot open the file in my 2017, so I cannot fix the python node for you. Can you copy and paste what the error message is in the python node? More than just “on line 14”

I tried this on the sample structural plan that comes with Revit so no promises but I got this to work.
V4.dyn (12.5 KB)

1 Like

Hello there Bach.

Try doing these changes to your graph:

You can also solve it by using the RIE.IndexDuplicateStrings node:

If you don’t need to keep the list structure, you dont really need the chop node.

The results are perfect thanks so much @kennyb6

1 Like

No problem, glad it worked!

1 Like

Thanks @andre.abotnes for help
I will try adding your way without using python

1 Like