土木在线论坛 \ 建筑设计 \ CAD下载及教程 \ 求助!画表格的Lisp小程序,不知哪里有错。好人帮我看看啊。

求助!画表格的Lisp小程序,不知哪里有错。好人帮我看看啊。

发布于:2010-11-22 20:33:22 来自:建筑设计/CAD下载及教程 [复制转发]
求助!画表格的Lisp小程序,不知哪里有错。
好人帮我看看啊。
(defun C:drbg() ;; Draw Biao Ge
(setvar "cmdecho" 0)
(setq os (getvar"osmode"))
(setvar "osmode" 0)
(setq pt1 (GetPoint"\n first point for bg: "))
(setq pt3 (GetCorner pt1 "\n second point for bg: "))
(command "rectang" "w" 1 pt1 pt3)
(setq wnn (+ 1 (getint"\nLie shu ||| <5>: ")))
(if (null wnn) (setq wnn 5))
(setq hnn (+ 1 (getint"\nHang shu --- <5>: ")))
(if (null hnn) (setq hnn 5))
(setq pt2 (list (car pt3) (cadr pt1)))
(setq pt4 (list (car pt1) (cadr pt3)))
(setq ang (angle pt1 pt3))

;;判断所選角度方向、重新調整四個角数値
(cond (and (> ang 0) (< ang (/ pi 2))) (setq pp1 pt1 pp2 pt2 pp3 pt3 pp4 pt4))
((and (> ang (/ pi 2)) (< ang pi)) (setq pp1 pt2 pp2 pt1 pp3 pt4 pp4 pt3))
((and (> ang pi) (< ang (* pi 1.5))) (setq pp1 pt3 pp2 pt4 pp3 pt1 pp4 pt2))
((and (> ang (* pi 1.5)) (< ang (* pi 2))) (setq pp1 pt4 pp2 pt3 pp3 pt2 pp4 pt1))
)

(setq num 1 txt 65)
(setq ww (distance pp1 pp2))
(setq hh (distance pp1 pp4))
(setq pt1 pp4 ppbas pp4 key 1)
(repeat hnn ;;draw hang
(setq pt1 (polar pt1 (* pi 1.5) (/ hh hnn)))
(setq pt2 (polar pt1 0 ww))
(command "line" pt1 pt2 "")
(if (> key 1)
(progn
(setq txtins (inters ppbas (polar pt1 0 (/ ww wnn)) pt1 (polar ppbas 0 (/ ww wnn))))
(command "text" "m" txtins (/ hh hnn 2) 0 (itoa num))
(setq num (+ 1 num))
)
)

(setq ppbas pt1 key (+ 1 key))
)

(setq pt1 pp4 ppbas pp4 key 1)
(repeat wnn ; ;draw lie
(setq pt1(polar pt1 0(/ ww wnn)))
(setq pt2(polar pt1 (* pi 1.5) hh))
(command "line" pt1 pt2 "")
(if (> key 1))
(progn
(setq txtins (inters ppbas (polar pt1 (* pi 1.5) (/ hh hnn)) pt1 (polar ppbas (* pi 1.5) (/ hh hnn))))
(command "text" "m" txtins (/ hh hnn 2) 0 (chr txt))
(setq txt (+ 1 txt))
)
)
(setq ppbas pt1 key (+ 1 key))
)
(princ)
)

全部回复(6 )

只看楼主 我来说两句
  • 郭小城zweibo
    支持下楼主
    2014-11-14 09:00:14

    回复 举报
    赞同0
  • panba
    panba 板凳
    谢谢zml兄 ,
    大恩大德,实在无以为报,
    很荣幸留下你的大名在我的工具箱了。
    2010-11-26 12:59:26

    回复 举报
    赞同0
加载更多
这个家伙什么也没有留下。。。

CAD下载及教程

返回版块

52.08 万条内容 · 665 人订阅

猜你喜欢

阅读下一篇

AUTO CAD2004迷你版

软件简介: 这个是最经典的版本,是最常用的迷你版。 附件名:201011221290423954385.rar 文件大小:19531K (升级VIP 如何赚取土木币)

回帖成功

经验值 +10