ScriptSpot

Script

universal Pivot to Selection Script

By ChrisRus · 2016-07-10

Version
1.2
Date updated
2021-07-11
Votes
11
Download
Download
Description

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 (13)

Tahir2112 · 2020-10-05

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

.

miauu · 2020-10-05

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 · 2020-10-06

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 ...

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

psychoman357 · 2019-09-08

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.

Attachments

THX

Barbiturat · 2017-10-25

This is Beautiful!
Thank You!

Help

Vipul · 2017-08-14

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

Silly me

Vipul · 2017-08-14

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

wejm · 2016-07-26

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

wejm · 2016-07-20

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)

@wejm

ChrisRus · 2016-07-25

Are you using editable poly or an edit poly modifier?

wejm · 2016-07-16

don't works good with several objects, like a teapot or a sphere, do not get the right normals

@wejm

ChrisRus · 2016-07-19

I'm not sure if I understand you correctly. The script is not using any normals.
When you select several objects, the script is setting the pivot position to the center of each object.

Would you prefer, that the pivot gets centered between all of the selected objects?

wejm · 2016-07-15

thank you so much