TheSwamp

Code Red => .NET => Topic started by: jgr on April 08, 2010, 09:18:20 PM

Title: Custom Osnap
Post by: jgr on April 08, 2010, 09:18:20 PM
With acad 2009 (or other)
How do I detect when activated or deactivated custom osnap's (CustomObjectSnapMode)?

For me, does not work with CustomObjectSnapMode, CommandWillStart, Command... events.

Thanks (sorry, i do not speak english).
Title: Re: Custom Osnap
Post by: gile on April 09, 2010, 03:37:41 AM
Hi,

CustomOsnaps work the same way as native osnaps.
You can managed the activation with a registered 'custom sysvar'.

You can get some inspiration from this thread (http://www.theswamp.org/index.php?topic=32031.0) (source code for a single solution for different target versions for AutoCAD here (http://www.theswamp.org/index.php?topic=32031.msg384321#msg384321)).
In the Commands class, a command (CUSTOSMODE) and 2 LISP functions (gc-GetCustOsmode and gc-SetCustOsmode) allows the user to activate/deactivate osnaps.
Title: Re: Custom Osnap
Post by: jgr on April 09, 2010, 12:49:08 PM
Thanks, I know your code. My (vb.net) code is a copy of yours,
In AutoCAD 2009 you can turn on/off the custom osnaps from a menu (right click on statusbar "osnap" button) and does not fire any event and i would like to know when they are activated or deactivated.


For if it helps someone:
I sent the vb.net code. Is your code (converted to vb.net) with some modifications.