Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Code to move pivot?

Code to move pivot?

Anonymous
Not applicable
497 Views
4 Replies
Message 1 of 5

Code to move pivot?

Anonymous
Not applicable
I made code to make a brick wall, where it makes a short section of wall, arrays/unions it, copies it a few times, then rotates and copies in the y direction, etc.

The pivot needs to be changed though, and I don't want to change it every time I try the code (I'm building something else in it). The listener doesn't generate any code involving the pivot.

Could you tell me the commands to move a pivot point?
0 Likes
498 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Search for pivot in the maxscript help - the first one in the list deals with the pivot. Depending on how your making the section (grouping/attaching individual bricks) it might be as simple as $.pivot=...
0 Likes
Message 3 of 5

Anonymous
Not applicable
I figured it out after playing around with it for a few minutes. The help file is relatively useless...it didn't give any MAXScript code.

--move pivot and reposition
$Box02 .pivot =
$Box02 .position =

On a side note, can anyone tell me what this does:

this is after a wall of part of a wall of intersecting bricks has been made. What does arraying all the bricks in a scene do (I assume it means something other than the autocad definition)? And why is the array crated and then deleted? Why doesn't that delete everything?
I'm having a little trouble understanding exactly what this does.

--array to collect all bricks in scene
totBricks = $Box* as array


--Remove Block02 from totBricks
deleteItem totBricks 1


--Union
proBoolObj .createBooleanObjects $Box02 totBricks 0 2 1
--operation union, move--delete added object, retain material
0 Likes
Message 4 of 5

Anonymous
Not applicable
MAXScript being a programming language, array refers to a structure of items. Each item has its place. Like an array of numbers {1,5,3,7,6,6,3,1} Item 2 = 5

totBricks = $Box* as array -->This is simply saying "Take everything with a name that starts with Box, and assign it to totBricks" totBricks={Box01,Box02,Box03...}

deleteItem totBricks 1 -->This is saying delete the second item (the first item is item zero I believe) in the array (or list of bricks if that makes it easier) and delete it. totBricks={Box01,Box03...}

proBoolObj .createBooleanObjects $Box02 totBricks 0 2 1 -->Take all the bricks in the array and union them, delete originals

Hope this helps,
MP
0 Likes
Message 5 of 5

Anonymous
Not applicable

deleteItem totBricks 1 -->This is saying delete the second item (the first item is item zero I believe) in the array (or list of bricks if that makes it easier) and delete it. totBricks={Box01,Box03...}


In MAXScript, arrays are 1-based, so the deleteItem deletes the first brick. It is very possible that the other bricks were created out of the first one and the second one is coincident with the first, thus the deletion.
0 Likes