文档库 最新最全的文档下载
当前位置:文档库 › AutoLisp 源代码 实用程序4

AutoLisp 源代码 实用程序4

AutoLisp 源代码 实用程序4
AutoLisp 源代码 实用程序4

(defun c:4(/ unit os cl st ld ld_os ld_oe whinum ld_ns ld_ne p0 p01 p1 p2)

(setvar "osmode" 1279)

(setq unit (getvar "lunits"))

(setq os (getvar "osmode"))

(if (= unit 2) (setq ds 1.5) (setq ds 0.0625))

(SETQ cl (getvar "CLAYER"))

(setq st (getstring "\nLine,Tick or linelAyout: "))

;=====================

(if (or (= st "A") (= st "a"))

(progn

(setvar "CLAYER" "TXT")

(setq whinum 0)

(while (< whinum 200)

(princ "\nSelect the two point: ")

(command "line" pause pause "")

(setvar "osmode" 0)

(setq ld (entget (entlast)))

(setq ld_os (assoc 10 ld))

(setq p0 (cdr ld_os))

(setq ld_oe (assoc 11 ld))

(setq p1 (cdr ld_oe))

(setq ang (angle p0 p1))

(setq p0 (polar p0 ang ds))

(setq p1 (polar p1 (+ ang pi) ds))

(setq ld_ns (cons 10 p0))

(setq ld_ne (cons 11 p1))

(setq ld (subst ld_ns ld_os ld))

(setq ld (subst ld_ne ld_oe ld))

(entmod ld)

(setvar "osmode" os)

(setq st (getstring "\nDelete the last line or Closed the process: ")) (if (or (= st "c") (= st "C")) (setq whinum 200))

(if (or (= st "e") (= st "E")) (entdel (entlast)))

)

(setvar "osmode" 0)

)

);end o if

;=========================

(if (or (= st "t") (= st "T"))

(progn

(setvar "CLAYER" "TXT")

(setq whinum 0)

(while (< whinum 200)

(princ "\nSelect the three point: ")

(command "line" pause pause "")

(setvar "osmode" 0)

(setq p0 (cdr (assoc 10 (entget (entlast)))))

(setq p01 (cdr (assoc 11 (entget (entlast)))))

(setq ang (angle p0 p01))

(entdel (entlast))

(setq p1 (polar p0 ang ds))

(command "line" p01 pause "")

(setq p0 (cdr (assoc 10 (entget (entlast)))))

(setq p01 (cdr (assoc 11 (entget (entlast)))))

(setq ang (angle p0 p01))

(entdel (entlast))

(setq p2 (polar p1 ang (* ds 2)))

(command "line" p1 p2 "")

(setvar "osmode" os)

(setq st (getstring "\nDelete the last line or Closed the process: ")) (if (or (= st "c") (= st "C")) (setq whinum 200))

(if (or (= st "e") (= st "E")) (entdel (entlast)))

)

)

)

;=========================

(if (or (= st "l") (= st "L"))

(progn

(setvar "CLAYER" "Defpoints")

(command "line" pause pause "")

(setq p0 (cdr (assoc 11 (entget (entlast)))))

(entdel (entlast))

(command "line" p0 pause "")

)

)

;=========================

(setvar "CLAYER" cl)

(setvar "osmode" os)

(princ)

);end defun

相关文档