Notifications
                
            
                Clear all
    
            
        [Closed] multiple pivot centering
Oct 29, 2007 11:31 am
                      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                        
                    Oct 29, 2007 11:31 am
                       
for i in selection do ( 
i.pivot = i.center
 
resetXForm i
 
collapseStack i
 
)
                      Oct 29, 2007 11:31 am
                      thanks for your time, but still – no response.
had this error before, with my examples.
Oct 29, 2007 11:31 am
                      sorry, works ok here, and there’s nothing wrong with your original code. Maybe you are calling centerpivot() somewhere else in your macro?
Oct 29, 2007 11:31 am
                      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.
Oct 29, 2007 11:31 am
                      what happens if you say:
 
for i in selection do (i.pivot = ((i.max + i.min)/2))
                      Oct 29, 2007 11:31 am
                      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
 		)
 )