Notifications
Clear all

[Closed] Pivot Point

I am building my own custom toolbar to help me in my modeling process… Ive been able to generate most of the scripts that i needed with maxscript listener but it doesnt record anything when i do: afect pivot only/center of the object. And i really need that comand as an icon in my toolbar since i use it a lot.

I am a total noob in maxscript… so if someone can help me out i would be most grateful…

Thanks in foward!

13 Replies
 [color=lightblue]for x in selection do x.pivot = x.center[/color]
 

Would take evry pivot of the selection and center it to it’s center.

Hope it helps and that I didn’t make a fool of myself by doing a mistake

EricDLegare’s suggestion should work however this is shorter and potentially faster:

centerPivot selection
1 Reply
(@ericdlegare)
Joined: 1 year ago

Posts: 0

… So there is a CenterPivot function

Thanks people…

A few minutes of modeling saved

Are there any other functions that maxscript listener doesnt record?

1 Reply
(@artofsoulburn)
Joined: 1 year ago

Posts: 0

Thousands and thousands of functions The macrorecorder is a good place to start, then if it doesn’t help, the helpfile should be next, followed by interrogating the object itself like using functions like “show properties”, which will reveal functions that aren’t even in the help file.

  • Neil

Yes, like the “Align” tool dosen’t get recorded int he listener. The Rename objects too I think, I think it’s a matter of if the tool is a script itself

Thanks mate… i dont use these options very often so i can live them out of my toolbar

Sure is! It’s a mapped function too so its quite handy as you can imagine

Maybe even faster centerpivot $

1 Reply
(@gravey)
Joined: 1 year ago

Posts: 0

not quite true since $ can return 1 of 3 things:

  1. undefined when no objects are selected
  2. the current selected object when only 1 object is selected
  3. an array containing the current selection if 2 or more objects are selected

The problem is that if no objects are selected, and you use CenterPivot $, you will get an error since $ returns undefined and the CenterPivot function requres an object or array of objects to be passed as the argument.
Selection will always return an array of the currently selected object(s) or an empty array if none are selected. So, by using CenterPivot Selection, there will never be an error since it can never be undefined.
using $ is usually fine in the listener but I try not to use it in scripts without first checking that there is only 1 object selected eg. if selection.count == 1 then centerpivot $

not quite true since $ can return 1 of 3 things:

  1. undefined when no objects are selected
  2. the current selected object when only 1 object is selected
  3. an array containing the current selection if 2 or more objects are selected

Thank for the info that was much helpfull
so $ will return an array …can I record it for further acess like : myarray = #($) ?

Page 1 / 2