Chop list by different values and set parameter


#1

Hello everyone,

I am trying to chop a list where different values appear. I have 114 different window marks which I want to set on top of the sublist, but I can’t manage to find a good solution.
I hope anyone can help me, thanks in advance :wink:


#2

Hi,

I’m not really sure to understand, can you explain a bit better what you want to achieve?
Also I don’t understand what’s happening in your graph, for example why do you use List.Map?
What is the final goal of your graph?


#3

Thank you for your reply.

I received an IFC from a local manufacturer. In this IFC there are 114 windows modeled. Each window is modeled as one Assembly.
When importing this IFC in Revit, the Assemblies explode and leaving the window behind in multiple pieces (pieces of Structural Framings). Each piece has his own IfcGUID. My IFC import options are fine, because other IFC projects do load whole Assemblies in Revit.

I managed to get all the Assembly marks in Excel.


My plan is to assign all the marks in Dolumn B to the Structural Framing IfcGUID’s in column D with Element.SetParameterByName. So all Structural Framing parts will get a mark. I was trying to make sub lists in Dynamo with the mark on the top of the list and the Structural Framing IFC GUID’s beneath it and after that try to assign the mark somehow to the Structural Framing IFC GUID’s.
I am kinda new to Dynamo, so I am not sure what the best workflow is. That’s also why I used List.Map.

I hope this explains my goal better.


Sort elements by same order as Excel list (un-alphabetical)
#4

Ok, now it’s better :wink:
Usually, the easiest way to work with dynamo is to have lists with the same structure and length. In your case, you need a list with the assembly number (column B) and the beams (column C). Your lists should be:

  • A1,A1,A1,A1,A2,A2,A2,A2,A2,A3,A3,A3,A3…
  • Beam 0, Beam 1, Beam 2, Beam 3…

In this case, it would be easy to apply the parameter with SetParameter.ByName

The problem is that your first list is:

  • A1,null,null,null,A2,null,null,null,null,null etc…

So you need to replace those nulls with the correct assembly code. I don’t know if there is a faster way, but with Python you can use a script like this:

element = IN[0]
list = []

n = 0
for x in element:
    if x != "null":
        list.append(x)
    else:
        list.append(list[n-1])
    n = n + 1

OUT = list


#5

Thanks, much appreciated! :grinning:
I will edit my script first thing in the morning tomorrow, no time at the moment. I will let you know if I have managed to complete it.


#6

Here’s an OotB node option just for fun:


#7

Thank you Nick_Boyts, nice node. Your OotB node was indead my first ask for help. After I recreated your node, I realised that lucamanzoni had a good point about the same structure and length of lists, so I can’t use my first idea anymore.
What I am trying to do now is to create 3 lists with the same length/amount.
1st list: Main list of IfcGUID names.
2nd list: List of structural framing elements in my project with the same sequence of the 1st list.
3rd list: List of all desired marks from Excel, minus its own cel (see image below).
With those lists I want to set the parameters to the Structural Framing elements.
Does anybody know why list 2 and 3 are not going the right way I wish to?

Test chop list.dyn (22.1 KB)


#8

Start a new topic for a new question.