CagePoint ID not the same


#1

Hi All,

If I create a cageEdit and get one point, Get the ID, Move it with translate and get the ID again. Now its changed. Why?
Without creating a new cage. Just keep the selecting point.

Dim t As DocObjects.ObjRef = Nothing
Rhino.Input.RhinoGet.GetOneObject("Sel Cage Point", False, DocObjects.ObjectType.AnyObject, t)
MsgBox(t.ObjectId.ToString)

(Dale Fugier) #2

Grip objects are created as needed (dynamically) and, thus, do not have static object ids.


#3

Oke thats clear. I thought maybe it was some kind of bug but this sound logic.
Then I just need to get the new created objects after I move the cagePoints :slight_smile:
Thanks.


(Menno Deij - van Rijswijk) #4

What you can do is to store the index of the grip object. That should stay the same.

Quoting from my own C# code that is part of a larger piece of code - I hope it makes sense. The idea is to store the selected grip indices in an int array called _movableGripIndices.

RhinoObject srfObj = _srfObject.Object();
srfObj.GripsOn = true;
srfObj.Document.Views.Redraw();

ObjRef[] gripRefs;
Result res = RhinoGet.GetMultipleObjects("Select movable grips [ENTER to move all]", true, ObjectType.Grip, out gripRefs);
if (res != Rhino.Commands.Result.Success)
{
    args.Result = res;
    args.Close = true;
    return;
}

if (null != gripRefs && gripRefs.Length > 0)
{
    _movableGripIndices = new int[gripRefs.Length];
    for (int i = 0; i < gripRefs.Length; ++i)
    {
        ObjRef g = gripRefs[i];
        RhinoObject obj = g.Object();
        if (null == obj)
        {
            return;
        }
        GripObject grip = obj as GripObject;
        if (null == grip)
        {
            return;
        }
        _movableGripIndices[i] = grip.Index;
    }
}
else
{
    _movableGripIndices = null; 
}