[Closed] Select objects and Editable_Poly
Hi,
I have a simple problem, i want to select all the objects in my list,then for each
obj that is starting with the name “aaa_” (like “aaa_1”) select it and transform to
editable_poly mode.
I tried to use this code for doing that, but it failed and i don’t no how to select all
the object at first:
- I’m selecting manualy all the objects in the list – need a script function for that.
for i = 1 to selection.count do
(
obj = selection[i]
ss = substring obj.name 1 4
if( ss == “aaa_”) do
(
select obj – It stuck here:-(
convertToPoly(obj)
… do something not important
)
)
So what should I do in order to fix my script, and to be able to choose each
iteration new obj?
Thanks a lot.
I may be misunderstanding you, if you have a large selection of object, then you can always store them in an array.
selectarray = #()
selectarray = for obj in selection collect obj
print selectarray
as far as converting to editablepoly, you are trying to select the object, which is unecessary since it is all ready referenced as obj, therefore the following code will convert objects begginning with “aaa_ ” into editable polys
for i = 1 to selection.count do
(
obj = selection[i]
ss = substring obj.name 1 4
if ss as string == “aaa_” do
(
–select obj – no need for this line
convertToPoly(obj)
–… do something not important
)
)
However, if you really wanted to select the objects that are beginning with “aaa_” then you can store them off into a separate array – in this case array “selectarray”
selectarray = #()
for i = 1 to selection.count do
(
obj = selection[i]
ss = substring obj.name 1 4
if ss as string == “aaa_” do
(
–select obj
convertToPoly(obj)
append selectarray obj
–… do something not important
)
)
select selectarray
This will leave the opertation with all the objects begginning with “aaa_” selected, after they have been converted to editable polys. Dont forget you can cycle through the array “selectarray” , to carry out individual operations, instead of just selecting it all in one go.
i.e
for obj in selectarray do
(
–funky operations on each object
)
I apologise now if this is useless, I am not very clever, and am rarely of help to anyone, but I try…god damn I try
Take care m8, and good luck with it
EverZen
Hi,
try this:
for obj in selection where ((substring obj.name 1 4)==“aaa”) do
(
convertToPoly obj
)
or this:
[color=white]for i = 1 to (selection as array).count do
(
obj = selection[i]
ss = substring obj.name 1 4
if( ss == “aaa_”) do
(
select obj – It stuck here:-(
convertToPoly(obj)
– do something not important
)[/color]
[color=white])[/color]