Macro PickfirstSelectionSet / ActiveSelectionSet

Discussion in 'AutoCAD' started by scottbaldy, Feb 15, 2004.

  1. scottbaldy

    scottbaldy Guest

    I have been fighting this all day... (2K)
    When calling a vba macro from lsp with vl-vbrun the PickfirstSelectionSet is not set correctly but the ActiveSelectionSet is set correctly (if something is selected on screen). Conversely if calling a vba macro using vla-RunMacro, then the PickfirstSelectionSet is set correctly and the ActiveSelectionSet is not.

    After perusing the board I was led to a workaround for this BUG, setting the USERS1 as a flag in lsp, which can later be read in vba. The code is below. But this too is not working correctly. I am not well versed in lsp. If anyone could provide any assistance or insight it would be greatly appreciated.

    ; Set Current Selection
    (defun C:CurrentSelection ()
    (if (setq ss (ssget "_i"))
    ((setvar "USERS1" 0)
    (vl-vbarun "C:\\LayoutTools_db.dvb!Module2.Current_Selection"))
    ((setvar "USERS1" 1)
    (vla-RunMacro (vlax-get-acad-object) "C:\\LayoutTools_db.dvb!Module2.Current_Selection"))
    )
    (princ)
    )
     
    scottbaldy, Feb 15, 2004
    #1
  2. scottbaldy

    dean_bourke Guest

    Have a look at SSGETFIRST and SSSETFIRST.

    I haven't used them much, but it may help.

    Dean
     
    dean_bourke, Feb 15, 2004
    #2
  3. scottbaldy

    tsigwing Guest

    Try using the useri1 variable to store an integer. Users1 is used to store a string.
     
    tsigwing, Feb 16, 2004
    #3
  4. scottbaldy

    scottbaldy Guest

    Thanks guys. I switched to using USERI1 instead of USERS1. Everything works fine now. Thanks again.
     
    scottbaldy, Feb 19, 2004
    #4
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.