Author Topic: Creating a sublist in Dynamo  (Read 779 times)

0 Members and 1 Guest are viewing this topic.

Offline bitterfitterTopic starter

  • Senior Member
  • ****
  • Posts: 395
  • Country: us
  • Gender: Male
Creating a sublist in Dynamo
« on: Feb 09, 2022, 19:39:44 PM »
Hoping this is an easy one.  I have a list of unique items in Dynamo.  I am looking to group them by similar items into sublists.  My hope is to then use that sublist to be able to count the number of items in each list to get a total for my BOM schedule.
Example: I have a list of items A,B,C,D,E,B,C,D,F,D
Get a list like: A
                     B,B
                     C,C
                     D,D,D
                     E
                     F

Then get quantity: A=1  B=2  C=2  D=3  E=1  F=1
"If you think education is expensive, you should see what ignorance costs you"

Offline Axl

  • Full Member
  • ***
  • Posts: 95
  • Country: us
  • Gender: Male
Re: Creating a sublist in Dynamo
« Reply #1 on: Feb 09, 2022, 20:12:46 PM »
There is a few way to achieve that,

first easy one is using a simple code block,  X == A , the result is a boolean can can be counted with List.CountTrue node

you can use python code and other nodes but I think this is the easiest way to do it
CADmep DB Manager
Content Manager
Scripting

Offline bitterfitterTopic starter

  • Senior Member
  • ****
  • Posts: 395
  • Country: us
  • Gender: Male
Re: Creating a sublist in Dynamo
« Reply #2 on: Feb 10, 2022, 12:41:37 PM »
Thanks Axl for the suggestion.  I am not sure if this would give me the results I need.  I think I should have been clearer in what I am trying to achieve.  I have my Ancillaries as an output per support element.  Some are repeating, some are unique.  My thought was to place them all into one list and then group the similar items together in the list.  I am hoping then from here to get each unique ancillary and its quantity. 

The hardest part for me is after years of doing this in reports in CADmep, I now have to retrain my brain to do this a totally different way.
My objective with all this is to output all the ancillaries for my hangers from a project and then create a schedule that shows them and their quantities required.
"If you think education is expensive, you should see what ignorance costs you"

Offline bitterfitterTopic starter

  • Senior Member
  • ****
  • Posts: 395
  • Country: us
  • Gender: Male
Re: Creating a sublist in Dynamo
« Reply #3 on: Feb 14, 2022, 16:35:45 PM »
So I might be on the wrong track here but I feel like I am in the home stretch.  I am reporting my ancillaries now, but they only get listed once no matter how many there are.  The quantity is a separate field so I can list that also.  Now in order to use this in my BOM, I think I need to find a way to have the item in the fist list show up the number of times it is called out in the second list.  As the index numbers match, this again doesn't seem like it should be super difficult.  Just finding the correct node as I am still learning all that are out there and what they can do.  I feel like I have the correct ancillary listed the correct number of times, then I can maybe dump into a parameter, bring it into a column in a schedule and group/count  it there.  I sure do miss my CADmep reports about now  :(
"If you think education is expensive, you should see what ignorance costs you"

Offline Axl

  • Full Member
  • ***
  • Posts: 95
  • Country: us
  • Gender: Male
Re: Creating a sublist in Dynamo
« Reply #4 on: Feb 14, 2022, 19:22:02 PM »
There is a node you can use to multiply the item by the number you found,
CADmep DB Manager
Content Manager
Scripting

Offline bitterfitterTopic starter

  • Senior Member
  • ****
  • Posts: 395
  • Country: us
  • Gender: Male
Re: Creating a sublist in Dynamo
« Reply #5 on: Feb 14, 2022, 20:20:10 PM »
Axl -Brilliant!!  Is this what you were thinking?
"If you think education is expensive, you should see what ignorance costs you"

Offline Axl

  • Full Member
  • ***
  • Posts: 95
  • Country: us
  • Gender: Male
Re: Creating a sublist in Dynamo
« Reply #6 on: Feb 14, 2022, 21:35:06 PM »
Sorry but I can't see what the blocks are, the image is too blurry, if you want a good quality image, In Dynamo go to File > Export Workspace as and Image, save the file and you can post that one here
CADmep DB Manager
Content Manager
Scripting

Offline bitterfitterTopic starter

  • Senior Member
  • ****
  • Posts: 395
  • Country: us
  • Gender: Male
Re: Creating a sublist in Dynamo
« Reply #7 on: Feb 15, 2022, 12:45:45 PM »
That's a great tip to know.  thanks  I didn't preview the image as it was the very end of the day and I was running out the door.  Hopefully this is better.
« Last Edit: Feb 15, 2022, 12:48:11 PM by bitterfitter »
"If you think education is expensive, you should see what ignorance costs you"

Offline Axl

  • Full Member
  • ***
  • Posts: 95
  • Country: us
  • Gender: Male
Re: Creating a sublist in Dynamo
« Reply #8 on: Feb 15, 2022, 13:44:56 PM »
looking good so far, I don't know how you plan to create an schedule with the list, but I usually export as CSV that you can then open in Excel (In my case I open with Python and do more stuff), there is a node to export to CSV you can use for that, you only need to plug it and define the destination directory and name of the file.

You can also plug the list to a Watch, then rename the watch (this step is required) to whatever you like, then right click the watch and check "Is Output", this will show the result in the Dynamo Player when you run it.
CADmep DB Manager
Content Manager
Scripting