Notifications
Clear all

[Closed] multiple pivot centering

i want to set the pivot to the center of the object, and reset its xform afterwards, and i want it to work on multiple object simultaneously. and i can’t figure out why its not working out here:


     macroScript CenterXPivot category:"reseting" 
     (
              for a in selection do a.pivot = a.center
              resetXForm selection
              collapseStack selection
     )
       

 and here:

     macroScript ResetXPivot category:"reseting" 
     (
          on isEnabled return selection.count > 0
          on execute do 
          (
              centerPivot selection
              resetXForm selection
              collapseStack selection
     
          )
     )
     

any ideas?

7 Replies
 
for i in selection do ( 
i.pivot = i.center
 
resetXForm i
 
collapseStack i
 
)

thanks for your time, but still – no response.
had this error before, with my examples.

sorry, works ok here, and there’s nothing wrong with your original code. Maybe you are calling centerpivot() somewhere else in your macro?

no, the thing you see here is all the script i have. and yeah, my previous scripts should work fine, but they have the same dredded popup.

what happens if you say:

 
for i in selection do (i.pivot = ((i.max + i.min)/2))

decon! you’re the man! it works! thanks a million!

and so the final working macro is…


 macroScript CenterXPivot category:"reseting" 
 (
 	for i in selection do (
 		i.pivot = ((i.max + i.min)/2)
 		resetXForm i
 		 collapseStack i
 		)
 )
 

Great !