michele71 11 February 2009 05:42 PM
Hi to everything! I hope in a response....
I do not understand how to select an object indoors of a group.
Assume to have 10 Box that form Group01 and 10 Box that form Group02.
I use this array after create and selecting the first 10 box
Array seli_array = $box* as --- take all the present box in the scene
gr_seli_array = group seli_array prefix:GroupBox_” --- assemble the box in GroupBox
I do the same thing with the second group of the box
Now, if I use
a = for the in $Box* collect i.name—array to create a knot taking the name of the box
sel_a = getnodebyname to [1] --- I create the knot from the name and take the first elements of the array
select sel_a--- selects the first element
The my problem: The second group is not calculated by the array and Box01 is always selected.
How to do in the take Box01 from the group 1 and Box11 from the group 2 (the first elements of the array of two groups) or similar ?
Ciao
Michele71
I just had to deal with this myself, what I did was a multi step thing, first I created an array of all objects, simple enough.
Then I created another array just containing the groups themselves:
fn GroupsOnlyArray messy_array =
(
GroupArray = #() -- as always clean it out, just in case
for obj in messy_array do
(
if ( isGroupHead obj ) == true do
(
append GroupArray obj
)
)
if GroupArray.count > 0 then
(
return GroupArray
)
else messagebox "There are NO GROUPS in this scene"
)
Then I made another array that contains the contents of groups only
fn clearedArray population criminals =
(
clearedList = #()
loc_isThug
for ppl in population do
(
loc_isThug = false
for thug = 1 to criminals.count do
(
if ppl == criminals[thug] do
(
loc_isThug = true
)
)
if loc_isThug == false do
(
if clearedList.count > 0 then
(
loc_itshere = false -- reinitialize found boolean
for dupes in clearedList do -- check for dupes and set boolean to true if identical entry is found
(
if ppl == dupes do
(
loc_itshere = true
)
)
)
else
(
append clearedList ppl -- append clear list for the very first time
)
if loc_itshere == false do
(
append clearedList ppl -- append clearlist if entry is not a dupe
)
) -- appending operations IF ppl is not thug
)
return clearedList
)
Then I iterated thru the groups-only-array, opened each group, iterated thru the objects-only-array and searched for
isOpenGroupMember
and voila! you get the index entries for all objects contained by that one group, close the group, repeat for next group.
Hope this helps you.
MB
|