Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Keyboard callback or mouse callback

$
0
0

@suc_kiet wrote:

Hi all,
I move object with function:

import System.Drawing.Color
import Rhino
import rhinoscriptsyntax as rs

def move():
    rc, objref = Rhino.Input.RhinoGet.GetOneObject("object", False, Rhino.DocObjects.ObjectType.AnyObject)
    obj = objref.Object()
    objs = rs.coercebrep(objref)
    pt_start = Rhino.Geometry.VolumeMassProperties.Compute(objs).Centroid
    def GetPointDynamicDrawFunc(sender, args): 
        vect=args.CurrentPoint - pt_start        
        translation=Rhino.Geometry.Transform.Translation(vect)
        args.Display.DrawObject(obj,translation) 
    gp = Rhino.Input.Custom.GetPoint()
    gp.DynamicDraw += GetPointDynamicDrawFunc
    gp.Get()   
    pt = gp.Point() 
    ve = pt - pt_start
    rs.MoveObject(objref,ve)

if( __name__ == "__main__" ):
    move()

And I want to scale or rotate object by keyboard during move object.
Cant any one give some ideas to me ?

Sorry for my English skill.

Thinks all.

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles