Trapping an Event When No Command has been Issued

Discussion in 'AutoCAD' started by matt_1ca, Feb 12, 2005.

  1. matt_1ca

    matt_1ca Guest

    I am wondering if someone knows what event is triggered when the user simply selects something on the screen without issuing a command? I know there is an event triggered somewhere otherwise how could those grips be triggered to appear when users select on the screen without issuing any command.

    To issue a command then trap the event so that you can make a function control how the entities behave is a simple thing to do. But to trap the event I am describing -- has me stumped right now --

    All suggestions welcome and thanks in advance.

    Matt
     
    matt_1ca, Feb 12, 2005
    #1
  2. matt_1ca

    matt_1ca Guest

    The background information is this I want to be able to stretch entities and attach an event to them, that populates an external database.

    I am finished writing the code for the stretching which works perfect -- but I do not like the user to be always typing s or stretch in the command line everytime they want to run the program.

    I want them to be able to just crossing select an entity or entities which in turn will trigger the event -- akin to grips.
     
    matt_1ca, Feb 12, 2005
    #2
  3. matt_1ca

    Jeff Mishler Guest

    The only one I can think of is the SelectionChanged Event........
     
    Jeff Mishler, Feb 12, 2005
    #3
  4. matt_1ca

    matt_1ca Guest

    Hello Jeff,

    Thanks for the suggestion -- I was just skimming through all AutoCAD events and that event seems to be the closest I can find as well at this point in time.

    I will continue digging for additional information as well to completely understand other possible options out there.

    Matt
     
    matt_1ca, Feb 12, 2005
    #4
  5. matt_1ca

    matt_1ca Guest

    I do not exactly feel comfortable working with programs that I did not write myself -- but in this special case if someone knows of even a third party program -- I can keep an open mind on that.

    I have a solution I am playing with in my mind right now -- but it is awkward and clunky -- I'd rather build a car than reinvent the wheel.

    Matt
     
    matt_1ca, Feb 13, 2005
    #5
  6. matt_1ca

    matt_1ca Guest

    How about if I use Lisp to do it -- for those who know both VB/VBA and Lisp/Vlisp -- do you think it is easier if I used VLisp instead -- or would I still be facing the same or similar situation?

    Matt
     
    matt_1ca, Feb 14, 2005
    #6
  7. matt_1ca

    Jeff Mishler Guest

    VBA is far easier at impementing Event code. Lisp uses the same events, as
    all come from the ActiveX interface.
     
    Jeff Mishler, Feb 14, 2005
    #7
  8. matt_1ca

    Danny P. Guest

    Matt,

    You really need to check the object after it's been modified. Merely
    selecting an object shouldn't cause you to need to update an external
    database. In that case, use the Object_Modified event. Put some xdata
    on your object to tell your event handler that it needs to do something.
    Then, in the Object_Modified event check for the existence of the
    xdata on the object, then you'll know that you need to update your
    external database based on the object modified. Other objects that
    don't have your xdata are ignored.

    One note of caution: be efficient. This event runs every time every
    object is modified and sometimes multiple times for a single change.
    Inefficient code could slow down your AutoCAD. Only load your code when
    you need to check your external database (which could be all the time,
    just wanted to point that out).

    Hope that helps,
    Danny Polkinhorn
    WATG
    Honolulu
     
    Danny P., Feb 14, 2005
    #8
  9. matt_1ca

    matt_1ca Guest

    Thanks Danny,

    I fully agree with you that the object has to be modified first before the database is modified otherwise there is no point in modifying the database if nothing in the entity has changed -- I have been doing such kind of process with success -- in fact the code I have right now can do that exact thing -- which can make me reasonably satisfied but, I would be happier if people did not have to call a command like stretch just to trigger the subroutine I have already perfected.

    Matt
     
    matt_1ca, Feb 14, 2005
    #9
  10. matt_1ca

    matt_1ca Guest

    Hello Jeff,

    Thanks, for this piece of info -- it can definitely make my direction more defined.

    Matt
     
    matt_1ca, Feb 14, 2005
    #10
  11. matt_1ca

    Danny P. Guest

    Then write a short macro or toolbar/palette button that'll update your
    database. Otherwise your code will never know when to run.

    Sorry, I'm still not understanding why you need to update information
    about something that hasn't changed. If you just need to verify that
    your database is synced with the drawing, run the sync code when you
    open the drawing, then sync again when your objects are modified.

    -Danny
     
    Danny P., Feb 15, 2005
    #11
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.