setting OSNAP with VBA
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
setting OSNAP with VBA

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
peterpeter



Joined: 29 Jul 2005
Posts: 7

Posted: Thu Feb 08, 2007 7:56 pm    Post subject: setting OSNAP with VBA Reply with quote

Hallo AutoCad Goeroes out there,

Does anyone know how to set the OSNAP system variabele via VBA?
At a given point i want to change the OSNAP Settings.
Let's say by example from "int, end, mid" to "Near".

When I look to the property's I can't find a property to control the OSNAP settings.

What exists is the OSNAPMODE, but this turns the snap mode on or off.

Thank you

Peter Van der Velden

Back to top
View user's profile Send private message Send e-mail
Fatty



Joined: 08 Jun 2006
Posts: 8
Location: Sankt-Petersburg, Russia

Posted: Sat Feb 10, 2007 10:22 pm    Post subject: Reply with quote

Hi Peter,
If I'd understand you correctly
Did you try to play with:
ThisDrawing.SetVariable "OSMODE", 512 ?

~'J'~
Back to top
View user's profile Send private message
peterpeter



Joined: 29 Jul 2005
Posts: 7

Posted: Mon Feb 12, 2007 9:30 am    Post subject: Reply with quote

Hallo Fatty,

Thank You Very much.
This works fine.

I have searched the AutoCad help file and found the explenation of the bit OSNAP bitcodes.

Type: Integer
Saved in: Registry
Initial value: 4133

Sets running Object Snap modes using the following bitcodes:

0 NONe

1 ENDpoint

2 MIDpoint

4 CENter

8 NODe

16 QUAdrant

32 INTersection

64 INSertion

128 PERpendicular

256 TANgent

512 NEArest

1024 QUIck

2048 APParent Intersection

4096 EXTension

8192 PARallel


To specify more than one object snap, enter the sum of their values. For example, entering 3 specifies the Endpoint (bitcode 1) and Midpoint (bitcode 2) object snaps. Entering 16383 specifies all object snaps.


When object snaps are switched off using the Osnap button on the status bar, a bitcode of 16384 (0x4000) is returned, in addition to the normal value of OSMODE. With this additional value, developers can write applications for AutoCAD, and distinguish this mode from Object Snap modes that have been turned off from within the Drafting Settings dialog box. Setting this bit toggles running object snaps off. Setting OSMODE to a value with this bit off toggles running object snaps on.

Thank You


PeterPeter

Back to top
View user's profile Send private message Send e-mail
Fatty



Joined: 08 Jun 2006
Posts: 8
Location: Sankt-Petersburg, Russia

Posted: Mon Feb 12, 2007 3:17 pm    Post subject: Reply with quote

Happy computing
Cheers Smile

~'J'~
Back to top
View user's profile Send private message
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB