- ( defun c:ttt()
- ;;; ( defun c:ttt( /p1 p2 p3 p4 pz pzs string jl jlb pw)
- ;;;(setvar "orthomode" 1);开正交
- (if (= (getvar "orthomode") 0)
- (progn
- (setvar "orthomode" 1);开正交
- (princ "\n正交已打开")
- )
- )
- (setq p1 (getpoint "\n 起点:");起点
- p4 (getpoint p1 "\n 终点:");终点,有动态效果
- ;pz (list (+ (/ (- (car p4) (car p1)) 2) (car p1)) (cadr p4));中点
- pz (list (/ (+ (car p1) (car p4)) 2.0) (/ (+ (cadr p1) (cadr p4)) 2.0));中点
- ;jl字符串占用实际长度距离
- String "GSTY-24D1.3"
- Tbox (textbox (list (cons 1 String)))
- jl (distance (car Tbox) (cadr Tbox))
- ;文字的起点位置
- jlb (+ (/ jl 2) 0.5)
- ;左边直线末端
- p2 (list (- (car pz) jlb) (cadr pz) )
- ;将文字的起点下调1.5
- pw (list (car p2) (- (cadr p2) 1.5))
- ;右边直线的起点
- p3 (list (+ (car pz) jlb) (cadr pz) )
- ;二级分光箱的起点
- p5 (list (car p4) (-(cadr p4) 2))
- ;上方文字
- pzs (list (car pz)(+ (cadr p4) 4))
-
- )
- ;;;(print jlb)
- (VL-CMDF "text" "m" pz 2.5 0 string )
- (VL-CMDF "Pline" p1 "W" 0.5 0.5 p2 "")
- (VL-CMDF "Pline" p3 "W" 0.5 0.5 p4 "")
- ;;;(VL-CMDF "insert" "YYJIF" "x" p4 "y" p4 "r" 0 p4 "")
- ;;;(VL-CMDF "insert" "YYJIF" p5 1 1 0)
- (VL-CMDF "insert" "XLDDJ" p5 1 1 0)
- (VL-CMDF "text" "m" pzs 2.5 0 "钉50" )
- ;;; 以下两行语句测试中点
- ;;; (command "Pline" p1 p4 "W" 0.5 0.5 "")
- ;;; (command "circle" pz 5)
- (setvar "orthomode" 0);开正交
- (princ)
- )
瞎弄的不完美,请问大佬们还有没有更好的方法,最近开始学autolisp,好多概念不太明白。 |