Selection Sets: To Filter Or Not To Filter...

Discussion in 'AutoCAD' started by Warren M, Jan 13, 2004.

  1. Warren M

    Warren M Guest

    Hello all.

    I'm just going through some of the handouts from AU, and came across an interesting statement in one of the handouts:

    CP32-4 - Things your mother never told you about VBA.

    In this handout, Mr Mario Guttman states on page 13, that Selectionsets should be avoided and he never uses them anymore because someone told him that "creating a selection set uses just as much time as looping through all of the entities in a drawing"...

    So now he iterates through ALL of the objects modelspace...

    Any comments?
    Can't say I've ever heard this before?

    Would like to hear what others have to say about this...

    Thanks
    Warren M
     
    Warren M, Jan 13, 2004
    #1
  2. A generalization so broad as to be useless.

    The right answer is it depends. Even so, filtered selection sets have so
    many built-in capabilities that it's almost not worth the effort to
    *not* use them.
    And what if the objects he wants reside in a inactive paper space block?
    Or on multiple layouts? That's a lot of hassle for non-generic code
    meant to apply to a commonplace operation. Unless you need every last
    millisecond and testing has shown the brute force method to be more
    efficient, I wouldn't bother.

    --
    There are 10 kinds of people. Those who understand binary and those who
    don't.

    http://code.acadx.com
    (Pull the pin to reply)
     
    Frank Oquendo, Jan 13, 2004
    #2
  3. I have tested this in my own programs and found for my situations using filtered selection sets is a lot faster. I also have created some functions for creating and populating selection sets that often makes using filtered selection sets easier.

    You can easily test the speed. (If the time passes midnight the calculation will be incorrect.)
     
    Nathan Taylor, Jan 13, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.