Hello
I am struggling with the script editor which is okay, I have no experience with scripting so for me it is a learning process. By reading other people’s issues in this forum I’ve come a long way. Now I have an issue for which I would like to have some advice.
I want like to know:
how to implement macros,
and the use of the RMB for buttons,
in the RUI which I create in a project file in the ScriptEditor?
Adding some info.
I’ve made some helpful macro’s for myself because 1)Due to my lack of knowledge on scripting and 2) sometimes a macro is the right choice because it is simple and powerful.
When I want to make a plugin, i want to implement some grasshopper scripts(I’m on a mediate level), some scripts(which I created by cut/copy/paste) and some toolbar buttons with macro’s.
Here is a macro for left and right mouse button which I want to implement in my Plug In:
! _Move _Enter
r-25,0
_EnterEnd
&
! _Move _Enter
r25,0
_EnterEnd
If somebody could give me a script or other solution for this I would be very thankful.
#! python 3
import rhinoscriptsyntax as rs
import Rhino
def MoveDist(dX,dY,dZ):
obj_ids=rs.GetObjects("Select objects to move",preselect=True)
if obj_ids:
rs.MoveObjects(obj_ids,Rhino.Geometry.Vector3d(dX,dY,dZ))
MoveDist(25,0,0)
All you have to do is change the x,y,z values in the parentheses in the last line and you can move selected objects relatively in any direction and any distance.