ScriptSpot

Forum topic · General Scripting

box uvw to each in selection

By antokhio · 2011-07-17

Description

Bueno!
My first own script actually, was working before i save it....
dunno what happend?? any help please!

mycount = selection.count
addmodifier selection (Uvwmap ())
(
for i =1 to mycount do
$[i].modifiers[#UVW_Mapping].maptype = 4;
)

Comments (6)

antokhio · 2011-07-18

well i'm silly small nOOb might you guys can just point me to some tutor or something, cause i tryed to check max script reference and can't understand a shit in there! Got some oldSchool book on max script for beginners, but there is too much beginner stuff...
The problems i have to solve mostly some mechanic actions with arrays of objects.

pls help nooobie!

antokhio · 2011-07-17

would love if someone could help me on this one too:

$.EditablePoly.SetSelection #Face #{$position}
$.EditablePoly.detachToElement #Face keepOriginal:off

just to detach selected object with one click

br0t · 2011-07-18

You should avoid using the "$" character when working on a selection of multiple objects, as it can reference subanimations instead of nodes. Better loop over your selection and use the loop index to reference the objects in the selection like so:


for i=1 to selection.count do
(
    selection[i].wirecolor = random black white
)--end for

About your problem:
If you see something like this in the help file:
< void >< EditablePoly >.SetSelection < enum >selectionLevel < bitArray >selection

It means that the command "SetSelection" will return nothing (void), will work on EditablePolygons only and you have to give it the selection level as a enum value (#Whatever) as well as a number of polygons/vertices or whatever to work on as a bitarray value (#{1,2,3,5..12}).
Example:


myEPoly = selection[1]
myEPoly.SetSelection #Face #{1..10} --will select the first ten polygons of that editable poly
myEPoly.detachToElement #Face keepOriginal:off --will detach the selected faces as an element

I guess what you want to do is to select some polygons and detach them without the dialog popping up? Then there would be no need to set a face selection, just use the detach command.

antokhio · 2011-07-19

thank you! thank you! thank you!
the problem that i had is array's of boxes like 400+
and i needed special order on that arrays so it goes from left top corner to bottom right, the only way achive that change hierarchy of the objects, what i don't know how to do in max directly, so i just detach them one-by-one in the order i need....

The problem with thouse books and tut's thay all have examples working with objects you created in max script, witch is ok if you have up to 3 objects, have't seen any tutor yet concerning current selection workflow...

thank you again! Going to study that stuff anyway!

antokhio · 2011-07-17

hmm seems don't work with groups :[