Grasshopper

algorithmic modeling for Rhino

How to break a large data chunk (string format) into smaller pieces and send one by one?

Hello everyone,

I am currently trying to work on creating a way (using ghPython script component) to break down a big chunk of incoming string data (each line contains information about vertice coordinates of the given object, cylinder in the case of my uploaded file) into smaller groups and send these smaller pieces one at a time to the UDP sender. Currently I was able to create Python Script (using my knowledge about Python lists) component that essentially does what "Partition" component does but one problem is that it creates an extra layer of complexity in the data tree (which I do not understand why it is doing that). More importantly, once I break the pieces down in smaller chunks, I want these string data chunks to be sent one at a time to the UDP sender by some form of methodology, and I am currently thinking of using a timer (for example, sending one chunk out of x amount of chunks every 1 second, etc), but I am struggling on how to execute my idea since I am new to GH. I want to learn if what I just mentioned is achievable to begin with. The primary reason why I want to break this down and send as opposed to sending one big chunk entirely all at once is because the the size of the data information from a big mesh cannot fit into the limited buffer of the UDP sender.

I understand that there is the "Explode Tree" component in GH, but this does not completely achieve what I want because:

1) If I change my size of the string data input or the component/bin size, I have to manually press "Match Output," and I am trying to make it work dynamically.

2) Once these "smaller chunks" and output ports associated to each smaller chunks are created within the "Explode Tree" component are created, I would have to manually link every single one of these output ports to the UDP sender, which is definitely not a good idea.

Because of these reasons/factors, I am trying to create an alternative way to achieve breaking and packaging of large data input into smaller pieces and sending one by one to UDP sender using Python Script component (if this is achievable and is considered a good idea).

I have attached my file on this post, so that you can take a look at my Python Script and overall workflow as well. Thank you!

Views: 369

Attachments:

Replies to This Discussion

Try this, we made it a while back to iterate through days of the year. Set the start and end values, then set the run to true, then enable the timer. It will count up one value each time the timer clicks.

Once the value hits the maximum value, it disables the timer, so the solution stops recalculating.

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service