Why is the object controlled by the cage not changed when the GRIP is deformed?


#1
        Dim objRef As Rhino.DocObjects.ObjRef = Nothing
                   rc = Rhino.Input.RhinoGet.GetOneObject("Select a control for editing", False,  Rhino.DocObjects.ObjectType.MorphControl, objRef)
        If rc <> Rhino.Commands.Result.Success Then
            Return rc
        End If

        Dim obj As Rhino.DocObjects.RhinoObject = objRef.Object()
        If Nothing Is obj Then
            Return Rhino.Commands.Result.Failure
        End If

        obj.GripsOn = True
        doc.Views.Redraw()

        Dim grips() As Rhino.DocObjects.GripObject = obj.GetGrips()
        For i As Integer = 0 To grips.Length - 1
            Dim grip As Rhino.DocObjects.GripObject = grips(i)
            Dim dir As Rhino.Geometry.Vector3d = New Rhino.Geometry.Vector3d(0, 0, 1)
            dir.Unitize()
                ' Scale by our fixed distance
                dir *= 0.5
                ' Move the grip to a new location
                grip.Move(dir)
        Next i
        doc.Objects.GripUpdate(obj, False)
        doc.Views.Redraw()
        Return Rhino.Commands.Result.Success

(Dale Fugier) #2

Hi @yuyurada,

See if this code sample is helpful to you.

https://github.com/mcneel/rhino-developer-samples/blob/master/rhinocommon/cs/SampleCsCommands/SampleCsMoveGrips.cs

– Dale


#3

Thanks!