GetObject: How to get objects that are not assets of Rhino

Hello,

Let’s say we have created a routine that takes a curve and cuts it in 3 equal segments and assigns to those segments a name, i.e Segment1, Segment2, Segment3.

Now I want to use the Rhino GetObject class in order to be able to select one of those segments. Any ideas?

Hi @Theofanis,

Here is an example of how to split a curve at a point.

https://github.com/mcneel/rhino-developer-samples/blob/5/rhinocommon/cs/SampleCsCommands/SampleCsSplitCurve.cs

Perhaps this is a good starting point?

– Dale

Yes Dale thanks for the reply. I’ve been working on this lately.

The real question though is how can I treat assets that do not belong to the GetBaseClass, getObject Classes etc.

Example: If I have drawn curves, or points, or other entities/assets which are Rhino objects, the above mentioned classes can be applied on them, e.g.:

public static Result GetUUID(RhinoDoc doc)
  {
    ObjRef obj_ref;
    var rc = RhinoGet.GetOneObject("Select object", false, **ObjectType**.AnyObject, out obj_ref);
    if (rc != Result.Success)
      return rc;
    if (obj_ref == null)
      return Result.Nothing;

    var uuid = obj_ref.ObjectId;
    RhinoApp.WriteLine("The object's unique id is {0}", uuid.ToString());
    return Result.Success;
  }

But what if someone has created Classes which construct objects that do not belong to Rhino, i.e., which don’t listen to the ObjectType Class? Is there a way to make these objects to be treated as Rhino Objects, and be able to use all the Get Methods on/with them?

It is not possible to add objects to the Rhino document that do not inherit from RhinoObject.

Is there some problem you are trying to solve that you have not explained to us?

– Dale

Not a specific problem. I was trying to figure out if it is possible to create new objects/classes and make them inherit from RhinoObject. You know, to see if one can interfere with Rhino classes and the way they inherit one from another.

Hi @Theofanis,

You can make custom objects. But they must inherit from Rhino objects.

Why do you want to make custom objects?

– Dale

There is not any significant reason for the moment being, but there might be plenty of reasons on the way.

Thank you for your help. Appreciated a lot.