V27 and Lee Mac's GrSnap Lisp

Greetings,

I have several lisp routines that use Lee Mac's GrSnapV1-0.lsp. It is a terrific program that I have used with AutoCAD, in years past, and now with BricsCAD. https://www.lee-mac.com/grsnap.html

Coming from Autolisp to Bricslisp (?) I learned from a forum post that the line in LM:grsnap:displaysnap function that translates the mouse coordinates from UCS to DCS had to be deleted (setq pnt (trans pnt 1 2)). This is because BricsCAD does not use the DCS for grvecs. This very simple modification made Lee's program work flawlessly in BricsCAD V25 and V26.

Now after installing V27 the snap symbol is offset in both x and y directions. The offset amount varies as you zoom in and out. This makes sense since there is a scale factor in the grvecs transformation matrix. I have tried various adjustments to the code but have found no solution.

I assume BricsCAD programmers made some changes to the graphic engines that might be causing this problem. I would appreciate all comments and suggestions that might get this great program working again.

Comments

  • I want to add a note to my original post:

    In V25 and V26 the offset problem did show up when using a modeling visual style. The routine only worked in a wireframe visual style.

  • Problem solved.

    Using Lee Mac's matrix functions https://www.lee-mac.com/matrixtransformationfunctions.html
    I scaled then translated the symbol list of points BEFORE calling grvecs without the optional matrix. Lee's snap program now works in BricsCAD V27 in wireframe and modeling visual styles.

    A big thank you to Lee for is great routines. For those who care the modified code in his snap lisp is as follows:

    ;; Object Snap for grread: Display Snap - Lee Mac

    ;; pnt - [lst] UCS point at which to display the symbol
    ;; lst - [lst] grvecs vector list
    ;; col - [int] ACI color for displayed symbol
    ;; Returns nil

    (defun LM:grsnap:displaysnap (pnt lst col / scl)
    (setq scl (/ (getvar 'viewsize) (cadr (getvar 'screensize)))
    lst (LM:TranslateByMatrix lst '(0 0 0) pnt)
    lst (LM:ScaleByMatrix lst pnt scl)
    )
    (grvecs (cons col lst))

    )