osnaps in lisp functions using INSERT

I have used this code from V11 to V24 to insert standard blocks. In those versions osnaps/esnaps work just like in INSERT or -INSERT called from the command line. In V25 and later when I run this code there are no osnap glyphs shown and there is no osnap attraction. This includes osnaps which were active when the command was called and osnap overrides from Ctrl-RMB. Existing osnaps show as turned on in both the toolbar buttons I have which show osnap status [using diesel function $(if,$(=,$(and,$(getvar,OSMODE),16385),1),!.,) for endpoint, etc.] and in the Ctrl-RMB pop-up, but they are not operative.

I don't find anything online mentioning this. Is it a known problem? Is there a solution?

[code]

(defun enco_insert (symbol / -error- ds)

(defun -error- ( msg )
(if (not (member msg '("Function cancelled" "quit / exit abort")))
(princ (strcat "\nError: " msg))
)
(setvar "cmdecho" 1)
(princ)
)

(setvar "cmdecho" 0)
(setpower)
(setq ds (getvar "dimscale"))
(prompt "\nSelect insertion point... ")
(command "_insert" symbol "S" ds pause pause)
(setvar "cmdecho" 1)
(princ)
)

[/code]

Note: -error- should have * in place of each dash, but the forum software apparently uses * to toggle italic mode.

Comments

  • Hello.

    I tested the script with a usual OSMODE value, 63 in my case, and it worked fine and the esnap was active.

    I am not sure about the whole workflow, but it might help to check how OSMODE = 16385 is used.
    This means (16384: Turn off all snaps) + (1: Endpoint).
    In this case, no esnap is active, because of 16384 - the bit 15 is ON, which disables all esnaps.

  • Virgil,

    Thank you for the response.

    When I manually call INSERT or -INSERT from the command line and type the arguments esnaps work in all versions of BricsCAD I have installed. To take my lisp functions out of the picture I tried pasting

    (command "_insert" "e_recduplex" "S" 1.0 pause pause)

    at the command line. In V24 and earlier esnaps work as expected. In V25 and V26 beta esnaps do not work at all, including temporary overrides from shift-right click. Nothing in that command call changes OSMODE. I see the same issue on my laptop and my desktop.

  • Hi,

    What happens if you remove the pauses?

    For example, try

    (command "_insert" "e_recduplex" "S" 1.0)

  • Craig_P,

    Thanks for the suggestion. Essentially nothing happens because the complete command has not been entered. The command line prompts for the command to be completed. The block is not shown. Clicks do not have any effect. Enter and RMB do nothing.

    Martin

  • This on its own pasted to the command line works for me, perhaps the problem is elsewhere.

  • Craig,

    I stand corrected. (command "_insert" "e_recduplex" "S" 1.0) does work in V25 and later, but not in V24 and earlier.

    After a bit of testing it appears the real issue with (command "_insert" symbol "S" ds pause pause) in V25 and later is the lack of a "." — "_insert" vs. "_.insert". From the documentation that implies that something is undefining the English INSERT command in the newer versions. I did a scan of my computer and i do not undefine INSERT in any of my code.

    Thanks for the help.

    Martin