Morph Control Box, Access Points

Hi,

MorphControl has a Surface and Curve property, both set to degrees of zero presumably because the box form is the exception that isn’t described in this way.

Imagine the top slice in a 4x4x4 cage cube. On that top slice, i want to move the central 4 up in Z by a fixed amount. I can access the grips fine (index 20, 24, 36 and 40). But because there isn’t a location property which i can set .Z to be increased by 5, 10 or whatever, I’m stuck.

Given that I can get the selection already, I just have to transform with the gumball. But wondering if I can get the script to transform the points too.

xform_this.3dm (761.8 KB)


cages = rs.GetObjects( "select cages to manipulate" )
cage_objects = []

for cage in cages:
    cage_objects.append(rs.coercegeometry(cage))
"""
for cage_object in cage_objects:
    cage_object.
"""
rs.EnableRedraw(False)
for cage in cages:
    rs.EnableObjectGrips(cage)
    rs.SelectObjectGrip( cage, 20)
    rs.SelectObjectGrip( cage, 24)
    rs.SelectObjectGrip( cage, 36)
    rs.SelectObjectGrip( cage, 40)

rs.EnableRedraw(True)

@dale maybe?

Hi @Jonathan_Hutchinson,

Does this help?

import Rhino
import scriptcontext as sc

def test_move_grips():
    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:
        return
    
    object_list = Rhino.Collections.TransformObjectList()
    object_list.AddObjects(go, True)
    
    dir = Rhino.Geometry.Vector3d(5.0, 0.0, 0.0)
    xform = Rhino.Geometry.Transform.Translation(dir)
    
    for grip in object_list.GripArray():
        grip.Move(xform)
        
    for owner in object_list.GripOwnerArray():
        sc.doc.Objects.GripUpdate(owner, True)
        
    sc.doc.Views.Redraw()
    
if __name__=="__main__":
    test_move_grips()

– Dale

1 Like

Thanks Dale!

Will the point locations of a morph control box ever become exposed?

Hi @Jonathan_Hutchinson,

Given the locations of the points, what would you do with them?

Thanks,

– Dale

Transform them - but to also be able to know which ones were being transformed ahead of time. Currently, given a morph control cage, I can’t even determine how many points it is made up of. Hence my current solution was trial and error to be able to know which points I was moving: