From what I can understand by your description you are actually not trying to snap to grid, but to an object?
Ill try to explain how you can do it, without it getting to messy, since there are quite some things involved.
A. Drag/Dropping boxes
Will start with the drag drop functionality as it will be needed later on. So as you start dragging a box you make it go to top of layer.
Object.Move to top (This is important or the returning of boxes might not work correctly)
The reason for this is because it makes it easier to make the boxes switch place later on.
You can use the drag&drop behaviour to handle the drag/dropping.
Also you add the pin behaviour.
For each of the boxes and the dotted areas that holds them in the bottom, you add a variable, could be the color if they are unique. This is so you know where each of them should go If they are replaced or dropped outside the dotted boxes.
So when you have to return them you just test on this variable.
Dotted boxes
These are the collision detectors. So each of the dotted markings should be a Sprite object with a collision mesh that fits there size or smaller depending on whether you want to use some snap functionality or not. As the user drags the boxes you need to check if its overlapping or not.
"This is a simple Box overlapping Dotted box or not on release."
For each of these boxes you add a variable called End which will keep track of which of the dotted boxes the user dropped the box in. So the left one could have a value of 1 and the right a value of 2.
Make the boxes go the right place
Since the dotted collision boxes are static you actually doesn't snap to these as it would make the animation of the scale weird. instead you add 1 imagepoint to each end of the scale. And use these as snapping points. (You will have to move the imagepoint for each of the boxes to the bottom so they will line up correctly).
So when the player releases a box over a dotted area you snap the box to the correct imagepoint on the scale.
Events needed
Event: Snap to scale
If Box is overlapping Dotted box
Dotted box.End = 1 (Left one)
DragDrop on released
Action:
Box move to position scale.imagepoint("Left")
Pin Box to scale ("Position and Angle")
And you add one for the other end as well of course.
(You might have to enable the pin behaviour, so it works correctly with the scale animation)
Event: Replace and return box
If Box is overlapping Dotted box
If Box is overlapping Another box
DragDrop on released
Pick bottom box (This is why you move the one you are dragging to the top, so its always the one already in the dotted box that gets returned)
Action:
Box disable pin to object behaviour. (This will make sure that the box that are returned doesn't follow the scale as it moves.
Sub event: Return the bottom box
Pick "Box holder" where color = box.color (This will pick the correct box holder in the bottom)
Action (Sub event):
Box set position to "Box holder" (This will move the box to the correct box holder, also you might have to correct the imagepoints if they don't match up)
That should do it I think, you might have to add a bit here and there depending on how you have made it. Then you just have to add the animation of the scale based on the weight of the boxes or something.
Hope it makes sense