algorithmic modeling for Rhino
Hi,
I am strugling with something and I hope someone here can help. As a pretty seasoned grasshopper user I build a nice script generating glasses and Incorporated a UI with Human UI. I also, remarkably because I am a total noob, got Processing to take an Object (the glasses) and put them (somewhat) on my face in AR.
However this was from a baked and exported Obj. file. My ambition is to get a parametric version generated from grasshopper in my Processing file. If anyone has experience with this or could nudge me in the right direction I would be ever so grateful.
Tags:
Could I stream the mesh attributes (faces, vertices) to a txt file and rebuild it in Processing?
yes you can.
I would use for that the spreadsheet writer component from gHowl. There might be better solutions out there though.
Could you point me at an example or something to follow in Processing for building up the mesh again. I am pretty clueless when it comes to processing
This is not really a processing forum, but there are plenty of resources you can find to process the data the way you want.
To import:
https://processing.org/reference/loadStrings_.html
To draw:
https://processing.org/reference/beginShape_.html
I know, but because there are probably a million ways to do this in Processing I thought there might be a way best for interaction with Grasshopper. Thats why I posted it here in the coding part of the grashopper forum.
Anyway, Thanks a lot for your help. I am going to look into to your suggestions
thank man! great to hear the basics! Sorry If I am asking redundant questions but just to clarify. I stream the info (vertices, coordinates, faces) to a file (txt. or something) and I read that file in processing and build from there. And that will give me a dynamic solution, where processing will respond if grasshopper params change?
and I need to get all the syntax right, off course :D
AFAIK the gHowl component is dynamic. if that's the case you just need to figure out how to do the same for txt->processing. That should be possible but I don't know what the exact solution is.
Reading a txt file and reconstructing the data yourself would definitely be the way you want to go rather than just purely importing an .obj file exported from grasshopper (where in this case you might have to export/import/run manually for each instance)
That might be the path of least resistance, but can be slow depending on your use-case. You can export to an obj file (a text file format representing an vertex-face mesh) from a scripting component. This could be done either by writing your own exporter function that iterates the mesh vertices/faces and writes them line by line to a file using the obj formatting (should be pretty simple), or, by adding the mesh to Rhino document and then scripting the Rhino export command (remember to delete the mesh again). You can then import this obj file using the loadShape() function in Processing (if I recall correctly, otherwise I'm sure there are libraries for this, check the Processing forum to learn more on this).
Edit: Tom already answered a lot of this :)
this is a briliant idea, I have the loadShape function working at the moment. Great! Thanks to everyone for all the quick and insightful help!!!
I will let you know how it works out
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by