Jump to content

Recommended Posts

Posted

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")

)

Posted

should be no space between "c : d"

try this

(DEFUN C:D ()
 (COMMAND "DIST" "NEA" pause "PER")
) 

kruuger

Posted

try this

(defun c:d ()
 (setq oldsnap (getvar "osmode"))
 (setvar "osmode" 640)
 (command "dist" pause pause)
 (setvar "osmode" oldsnap)
 (princ)
 )

Posted

You can not name your routine with ( D ) because it is already given to the command DIMSTYLE .

Posted
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

Posted
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

Posted

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.

Posted

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

Posted
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 :)

Posted
should be no space between "c : d"

Thanks for the advice kruuger. I decided to separate it cause a smiley appears hehe like this :D

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

Posted

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!

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...