Hi Steve
I want move one object dynamically but the below Python code don’t make it, where is my error?:
#-*- encoding: utf-8 -*-
# Rhino Common Dynamic move object
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def move_obj():
obj=rs.GetObject("select one object")
pt_start=rs.GetPoint("Reference point") # con metodo script
#************** funzione che disegna dinamicamente *********************
def GetPointDynamicDrawFunc( sender, args ):
vect=args.CurrentPoint-pt_start
translation = rs.coerce3dvector(vect, True)
translation=Rhino.Geometry.Transform.Translation(translation)
print translation
a=Rhino.DocObjects.RhinoObject.GetDynamicTransform(obj,translation)
print a
gp = Rhino.Input.Custom.GetPoint()#creo oggetto gp
gp.DynamicDraw += GetPointDynamicDrawFunc # chiamo in continuazione la funzione che mi mostra la linea dinamica
gp.Get() # qui ottengo i dati quando clicco
if( gp.CommandResult() == Rhino.Commands.Result.Success ):
pt = gp.Point()
print pt
move_obj()
I add a line args.Display.DrawObject(obj) but nothing works.
Can You Help me?
#-*- encoding: utf-8 -*-
# Rhino Common Dynamic move object
import System.Drawing.Color
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def move_obj():
obj=rs.GetObject("select one object")
obj_color=System.Drawing.Color.Black
pt_start=rs.GetPoint("Reference point") # con metodo script
#************** funzione che disegna dinamicamente *********************
def GetPointDynamicDrawFunc( sender, args ):
vect=args.CurrentPoint-pt_start
translation=Rhino.Geometry.Transform.Translation(translation)
Rhino.DocObjects.RhinoObject.GetDynamicTransform(obj,translation)
args.Display.DrawObject(obj) #What should I put in brackets?
#args.Display.DrawObject(obj,obj_color) #that does not work
gp = Rhino.Input.Custom.GetPoint()#creo oggetto gp
gp.DynamicDraw += GetPointDynamicDrawFunc # chiamo in continuazione la funzione che mi mostra la linea dinamica
gp.Get() # qui ottengo i dati quando clicco
if( gp.CommandResult() == Rhino.Commands.Result.Success ):
pt = gp.Point()
print pt
move_obj()