# 为什么cage被改变后，cage所控制的物件没有变形？

**URL:** <https://cn.discourse.mcneel.com/t/cage-cage/1160>\
**Category:** Rhino for Windows\
**Created:** [2017年六月21日 01:01 UTC](https://cn.discourse.mcneel.com/t/cage-cage/1160 "2017-06-21T01:01:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuyurada](https://sea3.discourse-cdn.com/mcneel/user_avatar/cn.discourse.mcneel.com/yuyurada/32/3266_2.png) [@yuyurada](https://cn.discourse.mcneel.com/u/yuyurada)\
**Post date:** [2017年六月21日 01:01 UTC](https://cn.discourse.mcneel.com/t/cage-cage/1160/1 "2017-06-21T01:01:27Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![KelvinC](https://sea3.discourse-cdn.com/mcneel/user_avatar/cn.discourse.mcneel.com/kelvinc/32/3391_2.png) [@KelvinC](https://cn.discourse.mcneel.com/u/KelvinC)\
**Post date:** [2017年六月21日 02:58 UTC](https://cn.discourse.mcneel.com/t/cage-cage/1160/2 "2017-06-21T02:58:14Z")

</div>

@Jorin，請看一下這個問題，謝謝。

---

<div class="post-metadata">

**Author:** ![yuyurada](https://sea3.discourse-cdn.com/mcneel/user_avatar/cn.discourse.mcneel.com/yuyurada/32/3266_2.png) [@yuyurada](https://cn.discourse.mcneel.com/u/yuyurada)\
**Post date:** [2017年六月21日 03:48 UTC](https://cn.discourse.mcneel.com/t/cage-cage/1160/3 "2017-06-21T03:48:20Z")

</div>

这个问题我自己已经解决，那么如果用vs在rhino中构建一个cage,我要用这个cage捕捉选定的objects,应该怎么做。

---

<div class="post-metadata">

**Author:** ![Jorin](https://sea3.discourse-cdn.com/mcneel/user_avatar/cn.discourse.mcneel.com/jorin/32/3292_2.png) [@Jorin](https://cn.discourse.mcneel.com/u/Jorin)\
**Post date:** [2017年六月23日 08:04 UTC](https://cn.discourse.mcneel.com/t/cage-cage/1160/4 "2017-06-23T08:04:13Z")

</div>

你好，在 RhinoCommon 中可以把 MorphControl 当作物件来操作，但具体它是控制哪个物件还是需要在 Rhino 中手工来完成，因为这部分工作都是在底层完成的， RhinoComm 中目前并没有相应的接口可以执行这个操作。如果有这方面的需求，可以参照下面的例子自己定义一个类似 cage 的功能，如果有能力的话，可以做到和 cage 的功能一样。  
[https://github.com/mcneel/rhino-developer-samples/blob/master/rhinocommon/cs/SampleCsCommands/SampleCsMoveGrips.cs](https://github.com/mcneel/rhino-developer-samples/blob/master/rhinocommon/cs/SampleCsCommands/SampleCsMoveGrips.cs)

---

<div class="post-metadata">

**Author:** ![yuyurada](https://sea3.discourse-cdn.com/mcneel/user_avatar/cn.discourse.mcneel.com/yuyurada/32/3266_2.png) [@yuyurada](https://cn.discourse.mcneel.com/u/yuyurada)\
**Post date:** [2017年六月23日 22:17 UTC](https://cn.discourse.mcneel.com/t/cage-cage/1160/5 "2017-06-23T22:17:44Z")

</div>

谢谢！
