Move normal


#1

Hi

Would it be possible to move objects(polysurface) to normal direction? Gumball has this function using align to object but wondering if I could do it without using the gumball.


#2

Hi junkin
Try the below Python script
Ciao Vittorio


import Rhino
#import scriptcontext
import rhinoscriptsyntax as rs
def moveNormal():
    stringa="pik Point"
    rc,surfaceref=Rhino.Input.RhinoGet.GetOneObject(stringa,False, Rhino.DocObjects.ObjectType.Surface  )
    if rc!=Rhino.Commands.Result.Success: return     
    sup = surfaceref.Face() # superficie selezionata     
    obj=surfaceref.Object() # oggetto di partenza 
    point=surfaceref.SelectionPoint()    
    brep=sup.DuplicateFace(True)
    param=rs.SurfaceClosestPoint(sup,point)
    normal=rs.SurfaceNormal(sup,param)    
    p2=point+normal    
    rs.SelectObject(obj)    
    rs.Command("_Move  w"+str(point)+" _AlongLine  W"+str(point)+" W"+str(p2),False)
    rs.UnselectAllObjects()
moveNormal()

#3

cool thanks Ciao Vittorio
thats what I want.I was wondering if I want to make it in a button how would the script change? I dont know Python script how it works for buttons…


#4

In the button editor, in the macro box, just type this:

! _NoEcho _-RunPythonScript (

paste the entire script in here

)

–Mitch


#5

Thanks Mitch.