Grasshopper

algorithmic modeling for Rhino

How to get an object's guid in VB.Net ,just like how the Guid component work?

Thanks..(ps,Is there anyway to see the Guid component's code with Reflector?)

Views: 1232

Replies to This Discussion

You can't, as geometry data is automatically converted to pure geometry before it goes into the Script component. The only way to get the guid in is to use a Guid parameter.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

But I remember there is a ghx file named "findID" made by  Giulio Piacentino,only he use the old C# script component..

But if you just plug your geometry into a Guid parameter it will find the ID of any referenced object. You do not need any custom code for this.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hi Bluelotus,

Yes, that component is over 2 year old... Now if you have a Guid it should be as simple as:

if(id != Guid.Empty)

{

var obj = Rhino.RhinoDoc.ActiveDoc.Objects.Find(id);

if(obj != null)

A = obj.Geometry;

}

Written by heart and not tested, but should be more or less like this. Hope this helps,

- Giulio
_______________
giulio@mcneel.com

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service