Notifications
Clear all

[Closed] Looping through geometry to evaluate modifiers?

I guess you did not read what I wrote in my initial post.

The portion of the code

(for m in o.modifiers where classof m == XPlaneObj8Cockpit collect m).count > 0

returns TRUE if AT LEAST ONE modifier (not matter which number) is the desired modifier and FALSE if none of the modifiers is the one you are looking for.

So you can generalize this code into a single function you can call to see if an object contains any modifier class:

fn hasModifier theObj theModClass =
(
(for m in theObj.modifiers where classof m == theModClass collect m).count > 0 
)

Now you can use an IF like

for o in selection do
(
  if hasModifier o XPlaneObj8Cockpit do ...
  if hasModifier o someOtherClass do ...
)--end o loop

ohhhh!!! I thought that was for ALL objects, not all modifiers…duhhh…sorry Bobo, and thanks again!

Page 2 / 2