Is there a way to move a selection from it’s bounding box center to a fixed point which is not the world origin?
I have repetitive tasks whereby I import .dwg files which are often far from the rhino origin. I run this macro to select them and move them to World 0:
" _SelAll ZS _Move _Pause _Pause 0 ZS
"
Problem is I have to manually select the point from which to move the geometry and, once the macro is complete, I still have to move them to another point manually. Can this be achieved with a Macro or is it a job for a script?
OK, I misunderstood your initial request as wanting to move your objects from their combined bounding box center to a picked point, not world 0. Here is a simple script for moving to world 0.
There’s nothing to ‘fix’ as far as I can see - it works here.
Unless you are looking for each individual object to be moved from it’s bounding box center to World 0 rather than the combined bounding box of all of the objects. Again, your explanation is not clear. The script below will do that.
Your last script does indeed work, but, as expected, puts every single object at 0.
EDIT:
I believe there may be a block instance with a basepoint far in the distance. I cleared everything up and retried the script from earlier, getting this message:
A Pc reboot fixed the issue, weird. Anyhow, even if after having exploded all blocks and having reset the model basepoint manually to 0, the objects still do not move to W0. They behave exactly the same as shown in the pictures above. What may be the problem?
On your posted file above, the script works correctly here.
rs.NormalObjects() will take all selectable objects and the script will calculate the collective bounding box of those. What you maybe have is a selectable point at the origin? That gets included in the collective bounding box calculation. .
This is the danger of using a script that automatically selects all selectable objects - you might have something in there - maybe even far off in space somewhere - that you haven’t realized is there and gets selected too.