How to Toggle Entity Snaps

I am trying to toggle entity snaps while in a command i.e. drawing a line .According to https://boa.bricsys.com/bricscad/docs/en_INTL/V20/Customizing-BricsCAD-V20.pdf page 185, Ctrl+F toggles entity snaps with the command "-Osnap T". In BricsCAD V22, Ctrl+F opens up find and replace. I've attempted to remap it to "-Osnap T" and "_'osnap;_t" but neither would work while in the command. I am aware that F3 works, but F3 is super far away for my short fingers.

This wouldn't be a problem if unchecking "PDF Entity Snap" actually worked. All my text/lines goes to the attached PDF's origin regardless of the checkbox :(

Comments

  • Anthony Apostolaros
    edited March 2022
    Very interesting. I never knew about that T=Toggle option. It's not listed among the options on the command line when I execute the -Osnap command, nor in the pop-up prompt menu, nor in the online command reference.

    But, as you say, it doesn't work while a command is active. Nor does -Osnap OFF, at least not in my old version of Bricscad.

    But most of the other osnap options do work while a command is active, including NON. I don't see that one on the command line or in the prompt menu, but I do see it in the online command reference. Maybe you could make one shortcut for NON, and another to turn on all the osnaps you normally use (for me that's INT,ENDP,MID,CEN,QUA,NEA). I.e., one to turn it off and one to turn it on, which might be better than a toggle.
  • You can create a keyboard shortcut for this via CUSTOMIZE.



    To allow the command to be run transparently from within another command, simply add an apostrophe to the start of the command call.
    ^P'._-OSNAP _T;^P

    For command shortcuts etc. it is best to create your own partial CUI to contain them. This avoids having to edit the BricsCAD default.cui, making it easier to maintain and re-use. Shortcuts created in the partical CUI will take precedence over any using the same keys in the default.


    Regards,
    Jason Bourhill
    BricsCAD V22 Ultimate
    CAD Concepts
  • Shift + Right button on mouse gives options

  • ^P'._-OSNAP _T;^P

    Jason, what do the ^P's do? And the blank space between OSNAP and _T? I don't see either of those in any of the shortcuts that came with my v17. The command seems to work as intended without the ^P's, but not without the blank space.

    Is there a reference of syntax for keyboard shortcut definitions? I can't find one.
  • Another way is for some commands use a transparent command to reset osnap

    eg Line '47 pick point '0 pick point

    Autoloaded
    (defun C:47 ()(setvar "osmode" 47))
    (defun C:0 ()(setvar "osmode" 0))
  • ^P'._-OSNAP _T;^P

    Jason, what do the ^P's do? And the blank space between OSNAP and _T? I don't see either of those in any of the shortcuts that came with my v17. The command seems to work as intended without the ^P's, but not without the blank space.

    Is there a reference of syntax for keyboard shortcut definitions? I can't find one.
    • ^P suppresses command line prompting, which can make some macros output a bit cleaner. Has no impact on the macro itself.
    • Blank space is the equivalent of a semi-colon. Generally, it's better to use a semi-colon as it gives a clearer visual indicator.
    See page 135 of Ralph Grabowski's Customizing BricsCAD V20 for more details on menu macros.
    https://boa.bricsys.com/bricscad/docs/en_INTL/V20/Customizing-BricsCAD-V20.pdf


    Regards,
    Jason Bourhill
    BricsCAD V22 Ultimate
    CAD Concepts
  • What about the F3 function key .... ?
    See also https://help.bricsys.com/document?title=_guides/BCAD_getting_started/GD_keyboardshortcuts.html&documentVersion=V22 for other default keyboard shortcuts.

    The OP stated that their fingers couldn't stretch that far! :)

    I've had feedback from left handers that also find some of the shortcut key placements are awkward.

    Regards,
    Jason Bourhill
    BricsCAD V22 Ultimate
    CAD Concepts
  • Here is some LISP code that will allow you to toggle object snaps on/off
    (defun OsnapsToggle ()
    	(cond 
    		((= 16384 (boole 1 (getvar 'OSMODE) 16384))
    		 (setvar 'OSMODE (- (getvar 'OSMODE) 16384))
    		 (princ "\n<Entity Snaps on>")
    		)
    		(T(setvar 'OSMODE (+ (getvar 'OSMODE) 16384))
    		(princ "\n<Entity Snaps off>")
    		)
    		
    	)
    	(prin1)
    )
    
    (defun C:OT () (OsnapsToggle)) ; Define Shortcut
    Regards,
    Jason Bourhill
    BricsCAD V22 Ultimate
    CAD Concepts
  • MrSmith
    edited March 2022
    Awesome, thanks for all the responses! Jason your solution fixed my problem and added to my understanding, thanks a lot! I was able to make a partial cui and add in the custom shortcut/command.

    The two solutions I had found in the book were so close to working. The first "_'osnap;_t" was missing the "-" and the second "-Osnap T" was missing the apostrophe.

    Thanks again everyone!
    (Not sure how to accept an answer to the question)
  • ALANH
    edited March 2022
    but F3 is super far away for my short fingers.

    You can make a osnap defun any name you want zzz, 000, 0000 etc just remember the apostrophe '00 '000 '0000