Auto Tag Catagory by Parameter Value

Hi

I wrote a script and it should tag mark MEP FABRICATION DUCTWORK according to its system. For example if I have system 1, all the duct work in the system should be marked 1 to n. If i have system 2, all the duct work in the system should be marked 1 to n.

Please look below to see what i have so far. The script seems to not work.

If you want to number your elements in a system, you’ll have to group elements by system first, then count the number of elements in each system. Right now you’re only counting one element so you’re only writing to one element.

Is there a node package for this. May you show a sample pic if possible.

You only need a few standard nodes. Use GetParameterValueByName to get the system and GroupByKey to group them. Then use Count to get the number of elements in each group. Give it a try and see what you come up with.

I used list.count it seems to get the number of unique keys and not elements in each group. Thus it actually gives me the same results as initially.

Make sure you use Longest lacing to get the number of elements in each group.

Thank you Nick i see what i was doing wrong. They is an issue of the output not grouping by the unique item. When I attempt to do so it only counts one element in the uniqueitem list

Can you show an image of what you’re talking about, with previews or watch nodes?


Please observe the following:

  1. the levels in list.Groupbykey is @L4 but at the + operator is @L3.
    2.The setparameterbyname typically i link the element to the all elements at catagory node output. the value i link to the + operator node output. My intention is for the output for the setparameterbyname node to be the same as the output of the+ operator.

Please advise

It looks like your GroupByKey function isn’t using the elements. You need the list input to be the elements and the keys input to be their System Name. Then you’re elements will be grouped. Right now it looks like the System Names are being grouped instead.

Once your Elements are grouped you can use them as the input for SetParameterByName.

I think this is the droid you’re looking for. I struggled with

But then I connected List.GroupByKey output to Element.SetParameterByName input and now it works like a charm.