View Full Version : Testing help.......confused noob

12 December 2010, 02:44 AM
I'm trying to test how many dummys I've selected and based on the number move them in y a set distance except for the first one but after lots of searching and tutorial dvd watching/reading am now thoroughly confused.
I've tried a number of things but the following code works but acts on the first one and I'd like it to only work on any number greater than 1

for i=1 to fCount.value do
fn() --named function
select(for o in helpers where classof o == dummy collect o)
for o in selection do move o [0.0, spnDis.value, 0.0]

12 December 2010, 10:04 AM
There´s no need to actually select a node in the scene, before you can manipulate it. Also you have not told what all values are like fCount and fn(), so here´s a generic piece of code

-- get the dummies from the current selection
dummies = for d in getCurrentSelection() where isKindOf d dummy collect d

-- move all but the first
yOffset = 2
for i = 2 to dummies.count do move dummies[i] [0.0, yOffset, 0.0]

Hope it´s what you´re looking for,


12 December 2010, 10:51 AM
Thanks Johan that's exactly what I needed (bows head in shame) It never even occurred to me to start the loop from 2.

The script is on my site link under sig it creates pistons based on a video tutorial, will update it soon

Thanks again :beer:

CGTalk Moderation
12 December 2010, 10:51 AM
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.