Grasshopper

algorithmic modeling for Rhino

Hello !

Again, thanks for this great work...
Is there a way to store (collect) a mesh in buffer with an index and then recall it with this index ?
I guess I could do again another VB component...

Thanks very much !

Views: 549

Replies to This Discussion

Hi Olivier,

what buffer? Store where, recall where?

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Hello David,

I have a generative process (something like Lindenmayer), I use a timer component instead of a list. I want to store each step (geometry) from this generative process into a list or anything like this. I then want to have access to this buffer with an index.
I do this because the calculation of that process is heavy and I want to avoid redoing it every time I rebuild (redraw) the definition. The idea is to use the generative process only once and later have access to only the resulting geometries.

I feel I should manage to get a list of geometries rather using the timer component. Shouldn't I ?

My questions are :
- Should I build a list of the results inside my VB component with a toggle that triggers the heavy calculation only once ? If so, where can I find an example that shows where I can store a geometry inside a VB or C# component ?
- Is there a way to do it with a definition using trees ?
- Is there a way to store these resulting geometries to disk ? ;)

I know the questions can look strange to you. This is because I am SOOO used to MaxMSP with a scheduler and a realtime approach. I have many questions & propositions I will soon ask.

Thanks !
Hi Olivier,

there is no way to access data from previous solution in a current solution, not without some serious custom scripting anyway.

If you want a good long term storage, I suggest using the Windows File System to store intermediate results. Meshes are stored easily enough using some sort of custom algorithm (all you have to do is write vertices, faces and maybe normals). You could also try to use one of the Rhino importer/exporter flavours, but then you have to deal with the Rhino File and selection states and Lord knows what else. Writing your own mesh format is not that hard.



"I feel I should manage to get a list of geometries rather using the timer component. Shouldn't I?"
No, the timer will expire a single object and then recompute everything that has changed. It will not allow you to "build a link" to data in previous solutions.


"Should I build a list of the results inside my VB component with a toggle that triggers the heavy calculation only once?"
Yes, this can be done. You just need to store the data as a Shared variable, so it doesn't get nuked between solutions. However, it will get nuked between Grasshopper sessions and whenever you change the code inside the VB script.


"Is there a way to do it with a definition using trees?"
No, trees will get completely recomputed even if they partly expire.


"Is there a way to store these resulting geometries to disk?"
That would be my advice, unless you are happy to recalculate whenever you open the ghx file.


I can post an example of storing meshes in a Shared List using a VB component.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
I attached a Zip archive with a 3dm file and a gh file. You can of course use your own Mesh input if you want.

The GH file works as follows. Inside the VB component there's a mesh modifier that deforms the mesh. You can specify the size of the distortion unit (size parameter), as well as how many times you want to apply the deformation.

When you change the mesh or the Size input, the cached results will be cleared. If however you change the Steps input, the result will be stored in the cache, so the next time you want the same answer, it's already standing by.

This is still a pretty naive solution, but I think it highlights the methodology pretty well.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Attachments:
Thank you very much! I'm a now working on it and everything seem to work fine :)

again, thank you !

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service