Using node “SharedParameters.Info” I have a list of items that indicates the shared parameters groups of shared parameters in a project. So I have a list of 435 items, namely 435 shared parameters. With node “List.UniqueItems” I found 16 unique shared parameters groups.
I would like to assign a number from 1 to 16 to each group and then list the 435 shared parameters with the corrisponding numer. So, for example, SP group named “PG_STRUCTURAL” corresponds to 1, “PG_IDENTITY_DATA” corresponds to 2, etc.
I really don’t know how to tackle this problem, as my knowledge of dynamo is pretty basic and I didn’t find anything on the forum to solve this.
The general goal of this script is to create the shared parameters file from a rvt file of which I don’t have the SP .txt file. In the SP file for each parameter is indicated the SP group, which is represented by a progressive number.
I have tried it but the two list have a different number of items, so it doesn’t work. Plus, if I am not wrong, this node would group the items by entry and I want to mantain the number of items in the original list of shared parameters, just with a number instead of the name.
first of all, thanks for your help. I’ve tried Get Shared Parameter from the Genius.Loci package, but it doesn’t work because this node gets the parameters from the shared parameter file, which I don’t have, I am trying to create it from this script. Then I tried the List.GroupbyKey as you can see in the image attached. Probably I didn’t get how it works, but if I try to associate a number to each item in the list i just get a list in which the numbers from 1 to 16 are listed in order and after the sixteenth entry it repeat 16 unitlll the end. Instead I would like that for each of the sixteen group name is associated a number.
I’ve attached also a couple of images to clarify what I’m trying to say. Thanks Again!
Partially yes, I want to assign A group ID (a number) to each parameter group. This because without a group ID the shared parameter file doesn’t work (see the attached file of a shared parameter txt file). I guess that i could just assign a unique group to all shared parameters, but it wont’ be ideal.
I have tried your solution and it almost works, but at the end it seems that the replacing values with the dictionary are not correct. As you can see in the image attached the values of the shared parameter don’t correspond to the values of the groups name. There is something that i’m missing?
I’ve tried your solution and it works, but not as I intended. It gives me the shared paramaters divided by parameter group, but in this way i lose the original index order
@samuele.fuda
Could you check the dictionary by scrolling down the result of the node, is there something weird here ?
Is there really a shared group named INVALID ?
Yes apparently there is a entry named INVALID. Unfortunately I can’t reach out to the people who originally made this project. This is also the reason why I don’t have the shared parameter file.
it made me doubting, but INVALID is a valid entry
i replicate the error with my graph, so i think the error doesn’t come from the inputs but something is wrong with my graph, i am checking…
I am sorry for the error…
I forgot to convert the keys (strings) to number, so when sorting it goes 0,1,10,2,3,… instead of 0,1,2,3,4…
As i worked with a generic sample with a list<10 i missed it…sorry again.