onzki Posted September 25, 2010 Posted September 25, 2010 Hi guys, I modified my distance command (shown below). However it doesn't show the snap highlights (nea, per) that I got used to seeing. Though it provides correct distance result, maybe it's just more on "aesthetic & feel" that I'm after.. what should I add in here? Thanks! ) (DEFUN C : D () (COMMAND "DIST" "NEA" pause "PER") ) Quote
Guest kruuger Posted September 25, 2010 Posted September 25, 2010 should be no space between "c : d" try this (DEFUN C:D () (COMMAND "DIST" "NEA" pause "PER") ) kruuger Quote
lpseifert Posted September 25, 2010 Posted September 25, 2010 try this (defun c:d () (setq oldsnap (getvar "osmode")) (setvar "osmode" 640) (command "dist" pause pause) (setvar "osmode" oldsnap) (princ) ) Quote
Tharwat Posted September 25, 2010 Posted September 25, 2010 You can not name your routine with ( D ) because it is already given to the command DIMSTYLE . Quote
Guest kruuger Posted September 25, 2010 Posted September 25, 2010 You can not name your routine with ( D ) because it is already given to the command DIMSTYLE . we can do this but we overwirte DIMSTYLE shortcut. everything depends on our pgp file. i also prefer D for distance:) kruuger Quote
Tharwat Posted September 25, 2010 Posted September 25, 2010 we can do this but we overwirte DIMSTYLE shortcut. everything depends on our pgp file.i also prefer D for distance:) kruuger That's what I wanted to indicate to . Good Luck kruuger Tharwat Quote
alanjt Posted September 25, 2010 Posted September 25, 2010 If you are unsure what your cmdecho will be set to, you could do something like this (I set mine to 0 in the startup): (defun c:D (/ *error* cmd) (defun *error* (msg) (and cmd (setvar 'cmdecho cmd)) (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,"))) (princ (strcat "\nError: " msg)) ) ) (setq cmd (getvar 'cmdecho)) (setvar 'cmdecho 0) (princ "\nSpecify first point: ") (command "_.dist" "_near" PAUSE) (setvar 'cmdecho 1) (while (eq 1 (logand 1 (getvar 'cmdactive))) (command "_per" PAUSE)) (*error* nil) (princ) ) If you know cmdecho will be set to 1, you could just use this: (defun c:D (/) (command "_.dist" "_near" PAUSE) (while (eq 1 (logand 1 (getvar 'cmdactive))) (command "_per" PAUSE)) (princ) ) BTW, Tharwat, there is no issue with defining LISP routines as a defined PGP shortcut, it's only a true command (eg. you would have trouble trying to call this "DIST"). I also prefer "D", but I abandoned the use of DIST long ago and wrote my own (much more robust) DistanceInquiry.LSP. Quote
alanjt Posted September 25, 2010 Posted September 25, 2010 Actually, the following works fine for me. It snaps properly and displays the Nearest and Perpendicular OSnap markers. (defun c:D (/) (command "_.dist" "_near" PAUSE "_per") (princ)) Quote
onzki Posted September 26, 2010 Author Posted September 26, 2010 try this (defun c:d () (setq oldsnap (getvar "osmode")) (setvar "osmode" 640) (command "dist" pause pause) (setvar "osmode" oldsnap) (princ) ) Hi lpseifert, thanks, it worked for me Quote
onzki Posted September 26, 2010 Author Posted September 26, 2010 should be no space between "c : d" Thanks for the advice kruuger. I decided to separate it cause a smiley appears hehe like this Quote
onzki Posted September 26, 2010 Author Posted September 26, 2010 You can not name your routine with ( D ) because it is already given to the command DIMSTYLE . Thanks Tharwat, I got your point. I guess the lisp in our office had been modified already that's why maybe some commands including dimstyle was not affected. I saw they assigned a DI alias to it. Quote
onzki Posted September 26, 2010 Author Posted September 26, 2010 Hi guys, thanks for all the reply and suggestions. I tried all, though lpseifert's worked fine with my system. Maybe it's a CAD version issue. Thanks again, you're great! Quote
digger Posted September 27, 2010 Posted September 27, 2010 If you need the distance command very often, try a free program named HowFar by Richard Sandgren. http://home.comcast.net/~medeziner/ I added a button to one of my toolbars for it. 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.