Grasshopper

algorithmic modeling for Rhino

Hi,

Is it possible to somehow manage an object collection or set multiple geometries by VBscript? I would like to be able to set multiple geometries by their rhino object ID string, read from a txt-file that I create in a rhinoScript. And/or to manage their order so that the order corresponds to object info put in a txt-file, or to the object order of Rhino.

My second question is related to that... What order are the objects given, when 'set multiple geometries' is used? It seems as if the order is not the same as the object order in rhino.

Views: 1632

Replies to This Discussion

Short answer, yes.

For any component in Grasshopper, you can either select geometry or feed geometry from another component. You can write a script that reads a list of UUIDs, find and select objects by their UUIDs and add to a list of objects that you then output from your script component. You will then have an ordered list of objects that you can feed into any other component.

Second question... Order of input objects is related to selection order. If you window select or group select, then order might seem arbitrary.
Thanks! I'll have to try it out.
Ok. Seems it was a bit too hard for me. I manage to get a list of RMA.Rhino.MRhinoObjects as output of the VB component, but that doesn't help much obviously. I still do not understand how to go from the MRhinoObject to an object GH can understand (RMA.OpenNURBS??). Or maybe I'm completely off track?


p.s. Where is the concept of MRhinoObject vs IRhinoObject vs OpenNURBS types explained? And the concept of Uuid and Guid? I can only find fragmentary explanations in different discussions, but no collected information.
Ok, I'll put together a sample for you with comment to explain.
If you can post your files or what you have done so far, then I can use it as well.
Here are some essentials:

You can think of MRhinoObject as having 2 main parts:
- OnGeometry (could be OnMesh,OnBrep, OnNurbsCurve, On3dPoint, etc. and they all are openNURBS types). This is what Grasshopper can understand.
- Object attributes that defines other aspects of a typical Rhino object such object layer, name, etc.

A list of MRhinoObjects will not be understood by Grasshopper, you have to turn it into a list of some geometry type such as OnNurbsCurve, OnBrep, etc. to be able to use as input to other components.

Now, the difference between MRhinoObject and IRhinoObject is that the second (starting with "I") is a constant version of the class that you can use to reference existing instance of an object without fearing to change it by accident. To create and modify a new object, you will need to use MRhinoObject. More details are found:

http://en.wiki.mcneel.com/default.aspx/McNeel/DotNetPluginEssential...

I hope this helps.
Example will follow.
Here is an example to select curves objects in a Rhino document and extract their ids and their geometry, then feed the geometry into a GH component. Let me know if you need further help.
Attachments:
Hi
Thanks for your help. The link you sent was a great help!

/Simon
Thank you so much for your work Rajaa!

I am working on a similar task, and I've tried to simply edit your components to collect the ids of some polysurfaces instead of curves, but I can't get it to work. Can you see what I am doing wrong? Does it have something to do with conflating BReps with Polysurfaces?

Thank you thank you,

Ben
Attachments:
Benjamin and I figured out how to edit this to do what we wanted. So we edited your script in order to select objects by layer and then return the ids of those objects. see attached.
Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service