Community
Civil 3D Forum
Welcome to Autodesk’s Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SNAP MODE SETTINGS

37 REPLIES 37
Reply
Message 1 of 38
wbrustle
1818 Views, 37 Replies

SNAP MODE SETTINGS

Does anyone know how to keep the snap mode settings from disappering after certain commands. For example everytime I use a lisp routine I have to go and reset my settings because they are no longer the way I had them set before I performed the lisp command.

37 REPLIES 37
Message 2 of 38
john.mckenzie
in reply to: wbrustle

good lisp will reset any settings that it changes after it executes and before it exits/ends. Unless you bomb out of the lisp routine.

 

Contact whomever wrote it for you, or short of that, find someone with lisp experience and have them tweak the program to cause no harm. That is how it should have been written in the first place.

 

that is what I would do.

 

 

Message 3 of 38

It has been a long time since I have done any lisp programming. But I think you can query and store a value before you change it. but I could be all wet. IF I am someone will gladly tell me so, I hope.

Message 4 of 38
troma
in reply to: wbrustle

You could ask over in the Lisp forum. Or just search it, the question has probably been addressed before.

http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/bd-p/130

Mark Green

Working on Civil 3D in Canada

Message 5 of 38
AllenJessup
in reply to: john.mckenzie

IIRC

 

(setq OSM (getvar" OSMODE"))

(setvar "OSMODE" OSM")

 

Use the first line near the beginning of the lisp to set the variable OSM to current OSnapMode.

Use the second line near the end of the lisp to restore OSnapMode to it's original value [OSM]

 

(setvar "OSMODE" 0) will cancel all osnaps.

 

OSNAP MODES:

 

 

Set running object snaps.

 

The setting is stored as a bitcode using the sum of the following values:

 

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 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.

 

 

 

Allen Jessup



Allen Jessup
Engineering Specialist / CAD Manager

Message 6 of 38
troma
in reply to: AllenJessup

What is quick? It doesn't show up as an option on my installation of C3D 2013.

Mark Green

Working on Civil 3D in Canada

Message 7 of 38
AllenJessup
in reply to: troma

No idea realy. I just copied that from the SYSDLG box.

 

sdb.png



Allen Jessup
Engineering Specialist / CAD Manager

Message 8 of 38
troma
in reply to: AllenJessup

Doesn't even work at the commandline. I often type MID or PER or END etc, but QUI gives "Invalid point."

Mark Green

Working on Civil 3D in Canada

Message 9 of 38
AllenJessup
in reply to: troma

Found it. Looks like it would only be used for a single pick from a lisp program

 

Quick_.png



Allen Jessup
Engineering Specialist / CAD Manager

Message 10 of 38
AllenJessup
in reply to: troma

You can set it from the command line by typeing OSMODE and then the bitcode. But it doesn't do anything.

 

I did manage to enter it as an osnap option. But I don't see anything different in the behavior from End.

 

LINE Specify first point: qui,end
of

 

 

 

Allen



Allen Jessup
Engineering Specialist / CAD Manager

Message 11 of 38
Jeff_M
in reply to: troma

I believe that the Quick option was introduced as a Band-Aid to help speed up Osnap operations back when AutoCAD required a Math Coprocessor. There were times I would literally wait minutes whilst snapping to objects....our computers today are just a tad quicker than that so you likely would not notice any difference if the Quick option were to be used.

Jeff_M, also a frequent Swamper
EESignature
Message 12 of 38
AllenJessup
in reply to: Jeff_M

Yeah. I knew it was an oldie. That's why I looked it up in my R12 manual. Smiley Happy

 

Allen



Allen Jessup
Engineering Specialist / CAD Manager

Message 13 of 38
troma
in reply to: AllenJessup

Always said I'm a newbie around here. My very first CAD experience was on 2000.
Thanks for the history lesson you two!

Mark Green

Working on Civil 3D in Canada

Message 14 of 38
troma
in reply to: AllenJessup

Here's the help from 2013:

 

The setting is stored as a bitcode using the sum of the following values:

0

NONe

1

ENDpoint

2

MIDpoint

4

CENter

8

NODe

16

QUAdrant

32

INTersection

64

INSertion

128

PERpendicular

256

TANgent

512

NEArest

1024

Clears all object snaps

2048

APParent Intersection

4096

EXTension

8192

PARallel

 

 

I see it says that 1024 "Clears all object snaps", without any explaination of how that's different from a value of 0 or 16384.


Mark Green

Working on Civil 3D in Canada

Message 15 of 38
wbrustle
in reply to: troma

thanks to everyone for their input, but I don't really get the whole writing lisp routines and I happened to stumble across one that enables you to rotate text to a line and that is the command I have been using that removes the osnap settings and I have no idea how to edit the lisp routine, but I align my text with lines all the time when I am drafting.....is there a way for Civil 3d to do that yet and then I would not have to use that lisp routine anymore.

Message 16 of 38
doni49
in reply to: wbrustle


@wbrustle wrote:

thanks to everyone for their input, but I don't really get the whole writing lisp routines and I happened to stumble across one that enables you to rotate text to a line and that is the command I have been using that removes the osnap settings and I have no idea how to edit the lisp routine, but I align my text with lines all the time when I am drafting.....is there a way for Civil 3d to do that yet and then I would not have to use that lisp routine anymore.



I have no idea about having C3D do it for you.  But to the original question, put the following at the top of your lsp file:

(defun saveosmode()(old_osmode(getvar "osmode"))

(defun restoreosmode()(setvar "osmode" old_osmode))

 

In your lsp file, you should see something like (defun c:command().  Defun tells autocad to treat the following as a function.  The c-colon -- c: --  in front of the command tells autocad to allow you to enter command without the parenthesis.  So:

 

(defun mycommand()(princ "This is my command."));  To run this, you'd have to load the lsp file and then type (mycommand) -- including the parenthesis.

 

(defun c:mycommand()(princ "This is my command."));  To run this, you'd have to load the lsp file and then type mycommand -- notice the parenthesis are gone.

 

Now open your lsp file:  do you see a line that says defun c:command where command is the "command" that you're using?  Immediately after that defun line, add the following line:  (saveosmode).  Okay -- now scroll down and find the last closing parenthesis either in the file or before another defun statement.  That closing parenthesis represents the end of your function.  Place the following right before that last parenthesis.

 

(restoreosmode); this will cause the function to restore the setting when it's done.

 

EDIT:  Just to be safe, make a copy of the file before you make any edits.



Don Ireland
Engineering Design Technician




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

Message 17 of 38
AllenJessup
in reply to: wbrustle


@wbrustle wrote:

is there a way for Civil 3d to do that yet and then I would not have to use that lisp routine anymore.


If you use Civil 3D labels and Orient to Object. That would work. I'm doing that for some things. But still use MText a lot too.
 

If when you create the MText you use the (R)otation option and select the angle. You don't have to worry I also use a Lisp that automatically set the MText rotation based on the ViewTwist.

 

Allen



Allen Jessup
Engineering Specialist / CAD Manager

Message 18 of 38
wbrustle
in reply to: AllenJessup

OK....thanks i will spend some time experimenting:)

Message 19 of 38
troma
in reply to: wbrustle

TORIENT

Doesn't select a line, but lets you pick the angle on screen.


Mark Green

Working on Civil 3D in Canada

Message 20 of 38
troma
in reply to: AllenJessup

Would you be willing to share your lisp Allen?
Does it also work for multileaders?

Mark Green

Working on Civil 3D in Canada

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report