rs.ObjectsByType(n,state=1) - behavoir changed for V6? (and not for the better)

@dale, @Alain

In V5, rs.ObjectsByType(n,state=1) got only visible, selectable objects. Objects that were locked, hidden or on locked or off layers were (correctly) ignored.

In V6, rs.ObjectsByType(n,state=1) is also getting “unselectable” objects that are not hidden or locked, but reside on off or locked layers.

I include here the definition of “normal objects”

Normal objects are visible, can be snapped to, and are independent of selection state

i.e. objects on off or locked layers are not to be considered “normal objects”

I noticed this because suddenly my scripted laser cutting time calculator started to give me some pretty wacky wrong numbers (much too high) - and after a bit of testing I understood why - it was counting everything on the off layers as well.

Please fix this soon… there’s a ton of scripts that will be invalidated by this change.

– as an emergency fix, I am now using
objs=[obj for obj in rs.ObjectsByType(n) if rs.IsObjectSelectable(obj)]
but again, there will be a lot of scripts (mine and others) that will need surgery.

Thanks, --Mitch

@Helvetosaur, I found the problem and I’m figuring out the best way to fix it.
Thanks for reporting

Helvetosaur, you saved me a lot of time. I ran into this last week and gave up, then started searching this afternoon and found your solution. Hurray!