Grasshopper

algorithmic modeling for Rhino

Hi all!

Is there a way to retrieve a point from Rhino in a vbscript component?
I would like to use its name or its ID to do that. How can I do?
I tried to use the object iterator but I don't know how to convert MRhinoObjects to On3DPoints.

Thanks

Views: 465

Replies to This Discussion

The best thing to do is to use the LookUpObject method, then use an mRhinoObjRef to get to the point. If you happen to get the mRhinoObject from the object iterator, that's fine too. See below

Dim rhObj As MRhinoObject = doc.LookupObject _
(New guid("CA0BC96F-64F3-4411-8D6E-37C094CBD629")) 'replace with your guid
Dim rhObjRef As New MRhinoObjRef(rhObj)

If rhobjRef.m_geometry_type = IRhinoObject.GEOMETRY_TYPE.point_object Then
Dim my3dPt As On3dPoint = rhObjRef.Point.point
Print(my3dPt.x & "," & my3dPt.y & "," & my3dPt.z)
End If
Thanks Damien, it works !

I have another question, can I get UserData from the point?
One more ! Can I use the name of the point instead of the Id?

Many Thanks
When it rains it pours... I'm the last person you want to ask about user data. I'm battling that fight now, so if I make it out alive I'll see if I can help.

The name of the point itself is not likely to be truly reliable (since there could be multiple objects with that name), but if you like you can use it. The only way I know of retrieving the objects by name would be through the object iterator.
Thanks to you : http://www.grasshopper3d.com/video/first-attempt

I'm going to find a solution for the UserData...I'll let you know if I get one.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service