Center pivot with round number

Hi!

I would like to ask for help to alter a script that I use to center pivot and move it to the bottom of the object.

if selection.count != 0 then 
selection.pivot = [selection.center.x, selection.center.y, selection.min.z]
else messagebox "Pick at least one object!" title:"Warning" beep:false

Before going further, I would like to address a flaw in this script - It won't work on multiple selected items, so if someone can fix that, I would be very thankful.

Now, to the request, if I may :)
I would like to do the pivot-align, but with a clean and rounded value, to the closest 1mm, 1cm, 1 dm or 1m.

Thanks!

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jahman's picture

.

for s in selection do s.pivot =  [ int (s.center.x + 0.5), int (s.center.y + 0.5), int (s.min.z + 0.5) ]

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.