algorithmic modeling for Rhino
This is VB.NET accessing the old Rhino SDK. These days Grasshopper uses the new Rhino SDK.Now this code would look like:
Dim obj_ref As New DocObjects.ObjRef(obj_id)
If (obj_ref.Object() Is Nothing) Then Return
A = obj_ref.Object().Attributes().Name
There are a lot of books on learning VB.NET, and a lot of web resources. There's not a lot of documentation on learning our SDK. We have documentation explaining what most classes and functions do, sometimes even with example code, but nothing didactic.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
I tried to replicate your script but I'm getting the following error:
1. Error (CS0246): Não foi possível localizar o nome do tipo ou do espaço de nomes 'MRhinoObjRef' (está a faltar uma directiva using ou uma referência à assemblagem?) (line 72)
(rough translation)
1. Error (CS0246): It wasn't possible to locate the name of the type or of the namespace 'MRhinoObjRef' (a directive using or a reference to the assemblage is missing?) (line 72)
What am I doing wrong?
This is very old code using a previous version of the Rhino .NET SDK. We're using RhinoCommon these days which requires a different approach.
Without testing, I guess the current code would look like:
private void RunScript(Guid id, ref object A)
{
ObjRef objRef = new ObjRef(id);
if (objRef.Object() != null)
A = objRef.Object().Attributes.Name;
else
A = "id does not refer to a loaded Rhino object";
}
Note that you'll have to set the type hint for the input to Guid from within the input context menu.
Thanks David! It worked perfectly!
Welcome to
Grasshopper
© 2025 Created by Scott Davidson.
Powered by