Ribbon Button Feedback like Esnaps

Can I create a button that provides feedback similar to enaps?

I imagine a lisp routine that locks/unlocks a specific layer and sets the USERI5 variable to 0 or 1. The ribbon button would show the active state like esnap settings.

Perhaps using the deisel expression like this ...
$(if,$(=,$(and,$(getvar,USERI5),1),0),,!.)

but I am lost ...

Comments

  • Just take the Diesel expression used for the endpoint snap and change 'OSMODE' to 'USERI5'.

    Keep in mind that the USERI5 setting is stored in the drawing and that layers can be locked without using your Lisp code. To keep everything in sync you would really need a reactor.

  • Thanks ... works as expected, and as you pointed out I'll need a reactor to sure it stays synced ... unfortunately reactors are new to me ... I'm having trouble getting started. This is the function I created to test the button feedback.

    (defun HASD:PointsToggleLayerLock ( / )
    (setq oLayers (vla-get-layers thisdrawing))
    (setq oPointsLayer (vla-item oLayers "V-PNTS"))
    (if (= (vla-get-lock oPointsLayer) :vlax-true)
    (progn
    (vla-put-lock oPointsLayer :vlax-false)
    (setvar "USERI5" 0)
    )
    (progn
    (vla-put-lock oPointsLayer :vlax-true)
    (setvar "USERI5" 1)
    )
    )
    )

    on to the reactor :o/

This discussion has been closed.