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.
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.
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.
Mark Green
Working on Civil 3D in Canada
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
Mark Green
Working on Civil 3D in Canada
No idea realy. I just copied that from the SYSDLG box.
Allen Jessup
Engineering Specialist / CAD Manager
Mark Green
Working on Civil 3D in Canada
Found it. Looks like it would only be used for a single pick from a lisp program
Allen Jessup
Engineering Specialist / CAD Manager
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
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.
Yeah. I knew it was an oldie. That's why I looked it up in my R12 manual.
Allen
Allen Jessup
Engineering Specialist / CAD Manager
Mark Green
Working on Civil 3D in Canada
Here's the help from 2013:
The setting is stored as a bitcode using the sum of the following values:
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
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.
@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
@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
Mark Green
Working on Civil 3D in Canada