What command to abutt objects together on X axis to remove gaps between them?

bricks in a row, if I remove the mortar, as I have done so, how do I quickly abutt them end to end ?

as if sliding them along a channel they might be sitting in until they all touch.


This script might do it for you. Select the objects, run the script, select the X axis option in the command line and whether you want them to move in the positive or negative direction, then Enter. Option to move in any one of the 3 principal World axes.

StackObjectsAlongAxis.py (2.5 KB)

If I follow this post of yours,

and make a button, I can then use that.
Not sure how I make a command I could type.
AbuttObjects which would run that.

I have created a new button, I have the .py file sitting in afolder on my D drive, just what do I do next, googled this cant fathom it out at all. They dont say if one drag drops it into rhino, or if one selects it in the windoes folder and hit ok, and what one then gets hold of to paste into the bit in the tut that says paste script here.
Completely baffled.


Well, I was going to link you to a Wiki page that had some more detailed and better organized info on setting up scripts than the Discourse post you linked to above - only to find out that someone @ McNeel has actually deleted that page and replaced it with completely outdated info. I hope that was an accident and can be corrected, if not, well, that’s very bad.

For you the easiest way to set up the script - you said it was on your D drive somewhere - I suggest you set up a specific folder somewhere for all of your scripts. Then create a toolbar button, and in the button editor enter the following:

_NoEcho ! _-RunPythonScript "<full path to your script including extension>"

(Path example: "D:\Users\Steve\Documents\Myscripts\StackObjectsAlongAxis.py" )

Then click OK to close and accept the changes to the new button. When you click the button, the script will run.

If you want it to run like a typed command, you can make an alias with the same thing. Go to Options>Aliases and make a new alias, AbuttObjects as the name in the left hand space and paste the same full path as above for the toolbar in the right hand space. Then when you type AbuttObjects, the script will run.