ScriptSpot

Forum topic · General Scripting

Reset pivot point for selected objects

By dashlight · 2016-05-20

Description

Hi guys!

Some time ago I made a simple script to automate the workflow of resetting a pivot point of an object. Simple stuff. Now I wanted to alter the script in such a way that it does the same thing for each consecutive object in my selection. So let's call this script "reset pivot of selection".

The script:

(
activeSelection = selection as Array
for s in activeSelection do
(
macros.run "PolyTools" "CenterPivot"
macros.run "PolyTools" "ResetXForm"

)
)

Well, the script works fine for a couple objects, and executes really fast.
The problem arises when I try to apply the script to let's say more than 200 objects at a time. For some reason my PC just freezes and doesn't come back alive. You guys have any idea how I could improve the script to make it such that it doesn't crash at any larger number of objects.

Comments (2)

.

miauu · 2016-05-25

Both functions are mapped, so this have to work:


ResetPivot selection
ResetXForm selection

`

pixamoon · 2016-05-27

ha, good to know, thanks :)

I always used longer:

for o in selection do resetPivot o