PDA

View Full Version : function help...


lontra
11-21-2006, 02:00 PM
Hi there!...

I'm having some trouble figuring out a FUNCTION to filter geometry with a kind of modifier (ie. turbosmooth) for a pickbutton with selectByName...

I've seen this code um a post:

for i in geometry where (for f in i.modifiers where classOf f == TurboSmooth collect 0).count == 0 collect i

but I just canīt get the darn function to filter the content...

Here is what I have so far, and it just doesnt work:

on bt1 pressed do
(
TsPicked = SelectByName title:"Objectos com TurboSmooth" filter:TsFn showHidden:true
TsObj = TsPicked
)


Any ideas??? Thanks...

HalfVector
11-21-2006, 02:17 PM
Hi.

Try this one:

fn fnFilter obj = (
for i = 1 to obj.modifiers.count do
if classOf obj.modifiers[i] == TurboSmooth do
return true
false
)

selectByName title:"Objects with TurboSmooth" filter:fnFilter showHidden:true

Bobo
11-21-2006, 02:19 PM
That function (which looks suspiciously like something I would have written ;o) ) COLLECTS all objects that have a turbosmooth.

The FILTER: function is applied to each object individually (internally) by MAXScript and is expected to return TRUE if the object has to be shown or FALSE of it does not pass the filter. It should have one argument - the object to be checked:


fn theFilter obj = (
(for f in obj.modifiers where classOf f == TurboSmooth collect 0).count > 0)
selectByName filter:theFilter --show only objects that have at least one Turbosmooth mod.

lontra
11-21-2006, 02:47 PM
Has always, you guys rock!!!

Thanks a lot!!! Its all working as expected...

BakerCo
11-21-2006, 08:34 PM
That function (which looks suspiciously like something I would have written ;o) )

hehe I was gonna say the same been watchin your vids for the last couple of days and i have to say without them I would still be lost.

CGTalk Moderation
11-21-2006, 08:34 PM
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.

CGTalk Moderation
11-21-2006, 08:34 PM
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.