加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

LISP 坐标标注程序,能自定义字体大小,能自动调整括符大小,可以互换xy的位置

(2009-08-28 17:48:36)
标签:

杂谈

分类: 开发

(defun  c:dc()
      (COMMAND "-OSNAP" "END")
      (IF TH ()  (PROGN 
                       (setq Th 15) 
                       (SETQ ds (/ th 10))
                 )
      )
      (if chxy  () (setq xsurfix "X=" ysurfix "Y=" chxy nil))
      (INITGET "Height Xytoyx")
      (setq   (getpoint "\n改变字高(H)/XY互换位置(X)/<指定待标注点>:"))
      (cond ((eq "Height") (progn (prompt (strcat  "\n当前标注文字高度:" (rtos th 2)))                                    
                                    (princ)
                                    (setq Th (getint "\n请输入新的标注文字高度:"))
                                    (SETQ ds (/ th 10))
                                    (setq  (getpoint "\n指定待标注点:"))
                             )
            )
            ((eq "Xytoyx") (progn (if chxy (setq xsurfix "X=" ysurfix "Y=" chxy nil) (setq xsurfix "Y=" ysurfix "X=" chxy 1)) (setq  (getpoint "\n指定待标注点:"))     ))
            
      )

      (COMMAND "POINT" )
      (setq (rtos (+ ds (car p)) 3) )
      (setq (rtos (+ ds (cadr p)) 3) )
      (COMMAND "-OSNAP" "")
      (command "-layer" "n" "坐标标注" "c" "3" "坐标标注" "s" "坐标标注" "")
      (command "-style" "坐标标注" "宋体" "0" "1" "0" "n" "n" )
      (setq pname (getstring "\n请输入点名:"))
      (setq pname (strcat pname "("))
      (command "text" (strcat "," y)  th "0" pname )
      ;标注X
      (setq delt (car (last (textbox (entget (entlast))))))
      (setq (rtos (+ (car p) delt ds) 3))
      (command "text" (strcat "," (rtos (+ (/ th 2.0) (atof y)) 3)) (/ th 2.0) "0" (strcat xsurfix x))
      ;标注Y
      (setq delt1 (+ delt (car (last (textbox (entget (entlast)))))))
      (command "text" (strcat "," y) (/ th 2.0) "0" (strcat ysurfix y))
      (setq delt2 (+ delt (car (last (textbox (entget (entlast)))))))   
      (IF (> DELT1 DELT2) (SETQ DELT DELT1) (SETQ DELT DELT2))   
      (setq (rtos (+ (car p) delt ds) 3))
      (command "text" (strcat "," y) th "0" ")")      
      (COMMAND "-OSNAP" "END")
      (PRINC)

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有