找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 547|回复: 0

[LISP程序]:在cad里自动编号程序

[复制链接]
发表于 2005-9-10 19:35:48 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
*-*b

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;                DrC(DrawCode)LISP程序                              ;;
;;;                By 罗邦杰   二00五年九月                         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;       一个自动编写序号的程序,要求的参数为:                      ;;
;;;             1. 序号的高度                                         ;;
;;;             2. 序号的前缀                                         ;;
;;;             3. 序号的逐步等级(默认为"1")                         ;;
;;;             4. 序号的开始数字                                     ;;
;;;             5. 序号的最终结尾数字                                 ;;
;;;                                                                   ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(defun C:tt(/ p1 x1 y1 p2 x2 y2 pt t0 t1 t2 t3 e)
  (setq h  (getint "Enter Text Height:"))
  (setq t0 (getstring "Enter text Word:"))
  (setq t1 (getint "Enter Start Number:"))
  (setq t1 (itoa t1))
  (setq t2 (strcat t0 t1))
  (setq p1 (getpoint "Enter P1 Point:"))
  (setq x1 (car p1))
  (setq y1 (cadr p1))
  (setq p2 (getpoint "Enter p2 Point:"))
  (setq x2 (car p2))
  (setq y2 (cadr p2))
  (setq pt (list (/ (+ x1 x2) 2) (- (/ (+ y1 y2) 2) (/ h 2.0 ))))
  (command "osanp" "off" )
  (command "text" "j" "c" pt h "0" t2 )
  (command "osmode" 163 "")
  (setq p1 (getpoint "Enter P1 Point:"))
  (while ( /= p1 null)
    (progn
       (setq t1 (atoi t1))
       (setq t1 (+ t1 1))
       (setq t1 (itoa t1))
       (setq t2 (strcat t0 t1))
       (setq x1 (car p1))
       (setq y1 (cadr p1))
       (setq p2 (getpoint "Enter p2 Point:"))
       (setq x2 (car p2))
       (setq y2 (cadr p2))
       (setq pt (list (/ (+ x1 x2) 2) (- (/ (+ y1 y2) 2) (/ h 2.0 ))))
       (command "osnap" "off" )
       (command "text" "j" "c" pt h "0" t2 )
       (command "osmode" 163 "" )
       (setq p1 (getpoint "Enter P1 Point:"))
       (if (= p1 null)
         (exit)
         (princ)
       )
    )
  )
  (princ)
)
  ?
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-20 15:05 , Processed in 0.178989 second(s), 31 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表