universal Pivot to Selection Script

8 votes
Version: 
1.1
Date Updated: 
07/10/2016

This script sets the pivot position to your selection

Supports:
Editable Poly and Edit Poly Modifier with
Vertex, Edge, Border, Face and Element Selection

It also supports knot/vertex points of Editable Splines and lines
When an object is selected, it sets the pivot position to the objects center

Comments

Comment viewing options

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

Whatever it is. It does not

Whatever it is. It does not want to open in 3d max 2021 ... Is there any other way to dowload this script ?
Paying tons of money for tutorials then to find out that fkn script does not work in the middle of the tutorial ...

miauu's picture

.

Copy and save it as crAlignPivotToselection.mcr.

-- by Christian Rüsseler
-- www.cral.de
 
macroScript crAlignPivotToSelection
	category:"CR"
	buttonText:"align Pivot to selection"
	toolTip:"align Pivot to selection"
	Icon:#("SW_DynInt",1)
(
	if subobjectLevel == 0 or subobjectLevel == undefined then
		for i in selection do (i.pivot = ((i.max + i.min)/2))
	else
	(
		delta = [0,0,0]
 
 
		local theType = classOf (modPanel.getCurrentObject())
 
		if theType == Editable_Poly then
		(
			local A = Filters.GetModOrObj()
			local currentVSelection = A.GetSelection #Vertex
			A.ConvertSelection #CurrentLevel #Vertex	
 
			for verts in $.selectedVerts do
				delta += verts.pos
			delta /= $.selectedVerts.count
			A.SetSelection #Vertex currentVSelection
		)
 
		else if theType == Edit_Poly then
		(
			local currentVSelection = (modPanel.getCurrentObject()).GetSelection #Vertex
			(modPanel.getCurrentObject()).ConvertSelection #CurrentLevel #Vertex
 
			local newSelection = (modPanel.getCurrentObject()).getselection 1
 
			for verts in newSelection do
			(
				delta += (modPanel.getCurrentObject()).getvertex verts
			)
 
			delta /= (newSelection as Array).count
 
			(modPanel.getCurrentObject()).SetSelection #Vertex currentVSelection
		)
 
		else if theType == line or theType == SplineShape then
		(
			local spl = selection[1]
			local selectedKnots = 0
			for s = 1 to (numSplines spl) do
			(
				if (knots = getKnotSelection spl s).count != 0 do
				(
					selectedKnots += knots.count
					for k = 1 to knots.count do 
					(
						delta += getKnotPoint spl s ((getKnotSelection spl s)[k])
					)
				)
 
			)
			delta /= selectedKnots
		)
		$.pivot = delta
	)
)
Tahir2112's picture

How to download this ? when

How to download this ? when select link it just opens another empty page

psychoman357's picture

Universal Pivot Script Don't Work in 3ds Max 2017

I have download the Universal Pivot Script like my Instructor said and follow his instruction on how to place it in 3ds max but it don't show the letter that should be assign to the script and now I can't do nothing like rotate or pivot an object. Am open to any subjection on how to make it work.

Thank you.

P.S. That the script.

AttachmentSize
capture.png 294.05 KB
Barbiturat's picture

THX

This is Beautiful!
Thank You!

Vipul's picture

Silly me

I didn't know how to run macros.
works perfect
+1 given

Vipul's picture

Help

hi,
the script is not working for me or I don't know how to use it :(
Max 2017 sp3
I created a cylinder from the perspective (default pivot was on the grid)

1.(i selected 2 faces and then dragged the script onto max)
2.(i selected 2 faces and then run the script)
nothing happened on both actions.
please help

wejm's picture

it's the same

it's the same, i get the same results with both

ChrisRus's picture

@wejm

Are you using editable poly or an edit poly modifier?

wejm's picture

i mean that if i select a

i mean that if i select a edge of a box rotated of eg. 35 degrees and run your script, i get the pivot in the middle of the edge with correct local pivot, but if i select the edge of a sphere or a teapot, the egde dont get the correct local pivot.

and would be great for a universal Pivot to Selection Script get the correct local pivots.
thx (and sorry for my bad english)

Comment viewing options

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