Continue command/macro after "_Move"


#1

I’m trying to get this macro to work in one go rather then stopping after the move, now I have the thing split over two macro’s since I can’t get the script to continue after the manual input of the move command.

The thing to solve it would be:
A. Continue after manual input
B. Be able to choose the knot of the boundingbox by 'knot/vertex-number’
C. If B is true, be able to move it to '0"

!_Boundingbox
_Enter
_Move

– select the point on the bounding box where the object should be moved from.
– Preferably I would like to set this macro so that after the point to move from is clicked it moves to "0"
The script always stops after this move, and I would like it to continue after it, is this possible?

_Invert
_Delete
_Invert
_Zoom _All _Selected


Cheers,

Peter


#2

This is really a job for a script. The main problem is remembering the bounding box and the objects to be moved…

The following macro should work, but it’s positively painful:
! _Select _Pause _SetObjectName "tempObjectsToMove" _Boundingbox _Enter _Sellast _SetObjectName "tempBoundingBox" _-SelName "tempObjectsToMove" _Move _Pause _Pause 0 _SelNone _-SelName "tempBoundingBox" _Delete _-SelName "tempObjectsToMove" _SetObjectName ""

Better would be a small Python script (should also run on Mac):

import rhinoscriptsyntax as rs

def MoveByBoundingBox():
    objs=rs.GetObjects("Select objects to move by bounding box",preselect=True)
    if objs:
        bb=rs.BoundingBox(objs)
        if bb:
            box=rs.AddBox(bb)
            pt=rs.GetPointOnSurface(box,"Pick point on bounding box to move to 0")
            if pt:
                rs.EnableRedraw(False)
                rs.DeleteObject(box)
                rs.MoveObjects(objs,rs.coerce3dpoint([0,0,0])-pt)
MoveByBoundingBox()

Unfortunately ObjectDisplayMode hasn’t yet been implemented in Python, otherwise I could make the bounding box ghosted (can still with rs.command, but this is supposed to be a simple example).

–Mitch
`
Edit: note that with the script, you can also constrain the point pick to the bounding box object, something which you cannot easily do with a macro…


#3
_Move _Pause _Pause 0

Cool stuff Mitch! I’ll look more into the scrip later on, but what is the function of the “pause” exactly, is this what allows the user to input things and the macro to continue after those steps?

Remembering what object needs to be deleted is in this specific example not a problem since i’m creating block files with 1 object per block, so for now the macro is simple Invert to select what to delete. But as soon as I would want to use it in a different scene I can see the need to be able to determine what to move and what to delete. : )

I am trying to understand why the script stops in my case, and continues after selecting the point to move from in your case


#4

Yes, _Pause allows the macro to stop and allow user input - usually one or more screen picks. The problem is that with certain commands one pause is sufficient for any number of picks, whereas others need one pause per pick… That can make certain macros a giant headache…

I wrote a small guide to macro-ing (before I learned scripting), it’s old (like Rhino V3) but not much has really changed since…

–Mitch


#5

Sounds like scripting will be the way to go eventually? Thanks for the guide, very useful material! : )