SY2索引2.LSP
资源名称:cadlisp1.rar [点击查看]
上传用户:sd555111
上传日期:2014-05-17
资源大小:31k
文件大小:3k
源码类别:
CAD
开发平台:
MathCAD
- ; =============================================
- ; | 索引标注软件 |
- ; | 版本: V1.0 作者: 尉迟俊岭 |
- ; =============================================
- (defun C:sy2( / lay scab scale pt1 pt2 pt3 pt4 pt5 pt6 high dx dy dx1 dy1
- txt1 txt2 txt3 be)
- (setvar "CMDECHO" 0)
- (setq lay (getvar "clayer"))
- (command "color" "bylayer")
- (command "layer" "m" "sy" "c" "g" "sy" "")
- (if (or (= nil (tblsearch "style" "xw"))
- (/= (cdr (assoc 40 (tblsearch "style" "xw"))) 0)
- )
- (command "STYLE" "xw" "txt" "0" ".8" "0" "n" "n" "n")
- )
- (if (= scab nil) (setq scab 100))
- (setq scale (getreal (strcat "n输入比例值 <" (rtos scab 2 0) ">:")))
- (if (= scale nil) (setq scale scab))
- (setq scab scale)
- (setq pt1 (getpoint "n第一点: "))
- (setq pt2 (getpoint pt1 "n第二点: "))
- (setq dy (car pt1))
- (setq dy1 (car pt2))
- (setq be T)
- (if (> dy1 dy) (setq be nil))
- (setq txt1 (strcase (getstring "n图集名称:") nil))
- (setq txt2 (getstring "n详图编号:"))
- (setq txt3 (getstring "n图集页次:"))
- (setq high (* scale 4))
- (setq dy (cadr pt2))
- (setq dx (car pt2))
- (if (= be nil)
- (setq dx1 (+ dx (* scale 5)))
- (setq dx1 (- dx (* scale 5)))
- )
- (setq dy1 (+ dy (* scale 1.15)))
- (setq pt3 (list dx1 dy1))
- (if (= be nil)
- (command "text" pt3 high "0" txt1)
- (command "text" "j" "r" pt3 high "0" txt1)
- )
- (if (= be nil)
- (progn
- (setq pt4 (polar pt2 0 (* scale (+ 5 (* 4 0.8 (strlen txt1)) 1.5 5))))
- (command "pline" pt1 "w" "0" "0" pt2 (polar pt4 0 (* 5 scale)) "")
- (command "circle" pt4 (* 5 scale))
- )
- (progn
- (setq pt4 (polar pt2 pi (* scale (+ 5 (* 4 0.8 (strlen txt1)) 1.5 5))))
- (command "pline" pt1 "w" "0" "0" pt2 (polar pt4 pi (* 5 scale)) "")
- (command "circle" pt4 (* 5 scale))
- )
- )
- (setq dy (cadr pt4))
- (setq dx (car pt4))
- (setq dx1 (- dx (* scale 1.2)))
- (setq dy1 (+ dy (* scale 0.9)))
- (setq pt5 (list dx1 dy1))
- (setq pt6 (polar pt5 0 (* scale 2.4)))
- (command "text" "j" "f" pt5 pt6 (* scale 3.3) txt2)
- (setq dx1 (- dx (* scale 1.2)))
- (setq dy1 (- dy (* scale 4.2)))
- (setq pt5 (list dx1 dy1))
- (setq pt6 (polar pt5 0 (* scale 2.4)))
- (command "text" "j" "f" pt5 pt6 (* scale 3.3) txt3)
- (setq pt1 (polar pt1 (* pi 0.5) (* 1 scale)))
- (setq pt2 (polar pt2 (* pi 0.5) (* 1 scale)))
- (command "pline" pt1 "w" (* 0.8 scale) "" pt2 "")
- (command "layer" "s" lay "")
- (princ)
- )