(defun errlsp (ch)
(cond
((eq ch "Function cancelled") nil)
((eq ch "quit / exit abort") nil)
((eq ch "console break") nil)
(T (princ ch))
)
(setvar "cmdecho" v1)
(setvar "orthomode" v2)
(setvar "osmode" v3)
(setvar "blipmode" v4)
(setvar "snapang" v5)
(setq *error* olderr)
(princ)
)
(defun C:PNW ( / v1 v2 v3 v4 v5 d_pc p_o p_f dlt_x d olderr)
(setq v1 (getvar "cmdecho")
v2 (getvar "orthomode")
v3 (getvar "osmode")
v4 (getvar "blipmode")
v5 (getvar "snapang")
)
(setvar "cmdecho" 0)
(setvar "orthomode" 0)
(setvar "blipmode" 0)
(setq olderr *error* *error* errlsp)
(initget 1)
(setq d_pc (getreal "\nEntrer slope value in % : "))
(initget 8)
(setq p_o (getpoint "\nEnter first point : "))
(if (eq p_o ()) (setq p_o (getvar "lastpoint")))
(setvar "snapang" (atan (/ d_pc 100.0)))
(setvar "orthomode" 1)
(initget 41)
(setq p_f (getpoint p_o "\nEnter last point : "))
(setvar "osmode" (+ 16384 (rem (getvar "osmode") 16384)))
(setq dlt_x (- (car p_f) (car p_o)))
(setq d (/ dlt_x (cos (atan (/ d_pc 100.0)))))
(command "_.line" p_o (polar p_o (atan (/ d_pc 100.0)) d) "")
(setvar "cmdecho" v1)
(setvar "orthomode" v2)
(setvar "osmode" v3)
(setvar "blipmode" v4)
(setvar "snapang" v5)
(setq *error* olderr)
(prin1)
)

(c:pnw)

Advertisements