Seath Posted January 25, 2008 Posted January 25, 2008 I use an addon called Hydratec with AutoCAD 2007. One of our commands presets the Osnaps. I want to make a button so after I finish with the Hydratec command I can restore my Osnap settings. I want to be able to use it in the middle of a command with out breaking the command if possable. Thanks for any help! Quote
Guest LElkins Posted January 25, 2008 Posted January 25, 2008 Off the top of my head, I can think it may be possible, but you would either (a) have to click a button before using the tool to 'mark' the snap settings, or (b) use a standard list of snaps, then activate any additional afterwards. would this be ok? Quote
lpseifert Posted January 25, 2008 Posted January 25, 2008 use this macro for a new command and make a toolbar button from it. (setvar "osmode" 1) the integer after "osmode" is the sum of the bitcodes for the snaps you want on. The above will turn endpoint on. See Help for the system variable Osmode for a listing of the bitcodes. Quote
Seath Posted January 25, 2008 Author Posted January 25, 2008 use this macro for a new command and make a toolbar button from it. (setvar "osmode" 1) the integer after "osmode" is the sum of the bitcodes for the snaps you want on. The above will turn endpoint on. See Help for the system variable Osmode for a listing of the bitcodes. That worked for creating a new button thanks! Is there a way to make the button not break my current command? ie. I am in the middle of a move command and need to reset my Osnaps I click the button and my command doesnt break. Currently while in a command it does break the command. Thanks for all the help so far! Quote
Guest LElkins Posted January 25, 2008 Posted January 25, 2008 If you are in the middle of a command, then just hold Shift + RightClick to select a temporary snap point. Then reset the snaps after. cheers Quote
lpseifert Posted January 25, 2008 Posted January 25, 2008 That worked for creating a new button thanks! Is there a way to make the button not break my current command? ie. I am in the middle of a move command and need to reset my Osnaps I click the button and my command doesnt break. Currently while in a command it does break the command. If you have ^C^C in your macro remove them. Quote
Seath Posted January 25, 2008 Author Posted January 25, 2008 If you have ^C^C in your macro remove them. I removed the ^C^C it is still breaking my command. I have tryed putting a ' infront of the command but all that seems to do is mess up the command all together. Any other suggestions? Quote
lpseifert Posted January 25, 2008 Posted January 25, 2008 Works for me, are you trying it in the the middle of an Autocad command or Hydratec command? Quote
Seath Posted January 25, 2008 Author Posted January 25, 2008 that is how I have entered it. it uses the 4159 as a distance to move the object i have selected. Quote
Seath Posted January 28, 2008 Author Posted January 28, 2008 try (setvar "osmode" 4159)(princ) Perfect! Thanks to everyone that helped me on this one! Quote
rshort9900 Posted September 29, 2008 Posted September 29, 2008 I found this to work for getting you preset osnap variables and restoring them back after the program is finished. Put this first inside the lisp program (setq osn (getvar "osmode")) Put this last inside the lisp program (command "osmode" osn) Quote
swestbrook60 Posted September 30, 2008 Posted September 30, 2008 I use an addon called Hydratec with AutoCAD 2007. One of our commands presets the Osnaps. I want to make a button so after I finish with the Hydratec command I can restore my Osnap settings. I want to be able to use it in the middle of a command with out breaking the command if possable. Thanks for any help! In writing various LISP routines I always want to turn the Osnaps off and then reset them to whatever the user had them set at previously. To capture the initial settings I use something like: (setq old_mode (getvar "osmode") ) (setvar "osmode" 0) This captures the current setting into the variable old_mode and then turns all of the Osnap settings off. To return to the initial Osnap state I would use: (setvar "osmode" old_mode) Quote
rshort9900 Posted September 30, 2008 Posted September 30, 2008 Yeah, I do too. I was just copying a piece of code as an option to the original question. Here's what I pasted from: (defun c:2at () (defun dtr (a) (* pi(/ a 180.0)) ) (command "layer" "S" "fan" "") (command "orthomode" "1") (setq osn (getvar "osmode")) (command "osnap" "center") (setq pick (getpoint "\Select isolator hole on base: ")) (setq rot1 (polar pick (dtr 0.0) 0.6)) (command "osmode" "0") (command "insert" "2a-isolatortop=" pick "" "" "") (command "insert" "2a-isoplatetop=" pick "" "" "") (command "rotate" "c" pick rot1 "l" "" pick pause) (command "osmode" osn) (command "layer" "S" "casing" "")) It's an isolator top view that places them on A/C fans. Quote
alanjt Posted October 1, 2008 Posted October 1, 2008 i use this: (defun c:AS ( / ) (setvar 'osmode 105) (princ "\nActive Osnaps: End, Insertion, Intersection, & Node") (princ) );defun i can run it real quick to set my desired snaps, or i can run it transparently (typing: 'as) Quote
rshort9900 Posted October 1, 2008 Posted October 1, 2008 Good idea for a stand alone machine. The only problem I can see with setting a specific snap, is in the case of sharing a server with AutoCAD & the programs. Each individual person, as you probably already know, have their own settings and style they prefer. The getvar osmode grabs each persons settings and holds on to it until it completes the function of the program, then resetting it back to each individual persons settings with the "osmode" re-call. Quote
yawdapaah Posted October 24, 2008 Posted October 24, 2008 Good idea for a stand alone machine. The only problem I can see with setting a specific snap, is in the case of sharing a server with AutoCAD & the programs. Each individual person, as you probably already know, have their own settings and style they prefer. The getvar osmode grabs each persons settings and holds on to it until it completes the function of the program, then resetting it back to each individual persons settings with the "osmode" re-call. That is my problem; we have a command (which i cannot edit) which sets my OSnap settings to Nearest. I edited my CUI file so that Shift + Button 3 will set my Osnap to 4263. The problem is that I want to do this whilst the "faulty" command is running, not after. Thanks. Hello everyone BTW Quote
GhostRider Posted October 24, 2008 Posted October 24, 2008 That is my problem; we have a command (which i cannot edit) which sets my OSnap settings to Nearest. I edited my CUI file so that Shift + Button 3 will set my Osnap to 4263. The problem is that I want to do this whilst the "faulty" command is running, not after. Thanks. yawdapaah, the string (setvar "osmode" 4263)(princ) will set the osnaps while in a command, you can make a tollbar button to reset the settings while in a command, or a keyboard shortcut Quote
rshort9900 Posted October 24, 2008 Posted October 24, 2008 yawdapaah, How is this command or program that your talking about, initiated? From a Toolbar button located in the CUI? Shortcut keys? Command prompt from your appload? Just curious.......... Quote
rshort9900 Posted October 24, 2008 Posted October 24, 2008 Also something to think about: What is the first command you use right after this program has ran it's course. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.