How to get the index of Control point of surface in python script

I have struggled many time to find out how get the index of control point of the surface in rs.ObjectGripLocation command.
Follow to the instruction on this web ObjectGripLocation that the index value must be int. I have tried many way such as use tuple and list but it doesn’t work. Can you guys help me, thank you so much !

Hi @Dat_Nguyen,

Here is a simple example:

import Rhino
import scriptcontext as sc

def test_get_grip_index():
    go = Rhino.Input.Custom.GetObject()
    go.SetCommandPrompt('Select grips to move')
    go.GeometryFilter = Rhino.DocObjects.ObjectType.Grip
    go.GetMultiple(1, 0)
    if go.CommandResult() != Rhino.Commands.Result.Success:
    for objref in go.Objects():
        obj = objref.Object()
        if isinstance(obj, Rhino.DocObjects.GripObject):
            print('Index = {0}, Location = {1}'.format(obj.Index, obj.OriginalLocation))


– Dale

1 Like

I have found out the solution, but thank you so much!