• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

measure distance between two points

  • Thread starter Thread starter Papao
  • Start date Start date

Papao

Guest
I have an old date lisp that allows to measure the distance between two points of any entity (archies, circles, straight);
it always worked properly in old versions of autocad, but no longer with recent versions.
the command has been assigned to a customized button but at its pressure, despite the lisp it starts correctly, it remains waiting for a further pressure of the "insertion" button or "space bar" to then proceed correctly doing its work.

I attach the code lisp someone can help me?
Code:
'calculates the distance between two points

(defun clerr (s)
(if an error (such as ctrl-c) occurs
(princ (strcat "\nerror: "s) ; while this command is active. . .
)
(if (= (getvar "username") "xxxxx xxxxx, xxxxx srl") (setvar "osmode" 37) (setvar "osmode" 1))
(setq *error* olderr) ; restore old *error* handler
(princ)
)

(defun c:pdist(/ saveosnapmode dist1 miodist)
(setq olderr*error*)
*error* clerr)
(setq saveosnapmode)
(command "'_osnap" "_nea")
(setq dist1 (getpoint "touch the first point ") )
(command "'_osnap"
(setq miodist (getdist dist1 "touch the second point ") )
(setvar "osmode" saveosnapmode)
(princ "\n the distance is ")
(princ miodist)
(setq *error* olderr) ; restore old *error* handler
(princ)
)
 
replace the two rows of code with the barbed text with the following ones:
(command "'_osnap" "_nea")(setvar 'osmode 512)
(command "'_osnap" "_per")(setvar 'osmode 128)
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top