ScriptSpot home

universal Pivot to Selection Script

Downloads

3ds Max compatibility
Unknown
Report a problem
Community compatibilityNo compatibility reports yet

No reports yet for the available releases.

Community reviewsNo reviews yet.

Listing details

Version
1.2
Author’s update date
Legacy votes
11
Listing created
How compatibility works

Compatibility comes from the author’s supported range or requirements in the original listing. A tested version records what the author tried.

“2020 unconfirmed” in the catalog means support for 3ds Max 2020 is still unknown.

Community reports record successful tests on specific releases.

Posted by

ChrisRus

Christian Rüsseler

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)
Tahir Hasanzadeh

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

.

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
	)
)
Reply to miauu
Tahir Hasanzadeh

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

psychoman357

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.

Attachments
Barbiturat

THX

This is Beautiful!
Thank You!

Vipul

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

Reply to Vipul
Vipul

Silly me

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

wejm

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

wejm

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)

Reply to wejm
Christian Rüsseler

@wejm

Are you using editable poly or an edit poly modifier?

wejm

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

Reply to wejm
Christian Rüsseler

@wejm

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

thank you so much