Create Primitive with altered pivot/position


Hi all,

How can I go about making a mel button for my shelf which will generate a new primitive (cube lets say) which already has it’s pivot set to the centre of the bottom face and which is then realigned to (0,0,0) once this is done?

I tried just echoing the script editor and copying this to my shelf but the cube just came in as normal - I assume because the pivot change involves the objects name. How do I get around this to make it a generic button I can use to make any number of cubes aligned this way?

Apolgogies if this has been asked way back when but there was nothing in the search.



$w = 1.0;
$h = 1.0;
$d = 1.0;

$cube = `polyCube -w $w -h $h -d $d`;
setAttr ($cube[0]+".rotatePivot") 0 (-$h/2) 0;
setAttr ($cube[0]+".scalePivot") 0 (-$h/2) 0;
setAttr ($cube[0]+".ty") ($h/2);


Sweet! Thats exactly what I’m looking for. Thanks a lot Robert.


This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.