明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1730|回复: 2

自动绘制图框的代码出现问题,求助

[复制链接]
发表于 2012-6-25 17:29:25 | 显示全部楼层 |阅读模式
找了个绘制图框的代码,可是出现“  quit /exit abort”,请高人指点

;;应用程序采用模块化结构,下面是应用程序的源程序。
;;----选用图纸幅面,绘制图框和有效边框
(defun c:sztf (/ th bj xl yb xbzp ybzp zbj tfx gdbl tkx pbase)
(command "style" "standard" "宋体" 0 0.75 0 "" "")
(command "erase" "all" "")
(gettf)
(setq pbase (list 0 0))
(cond
  ((=th 0)(setq xl 1189 yb 841))
  ((=th 1)(setq xl 841 yb 594))
  ((=th 2)(setq xl 594 yb 420))
  ((=th 3)(setq xl 420 yb 297))
  ((=th 4)(setq xl 297 yb 210))
  ((=th 5)(setq xl 210 yb 148))
)
(setq zbj 25)
(if (> th 2)(setq bj 5)(setq bj 10))
(if (< th 0)(setq zbj 20 bj 20))
(if (= tkx "bzd")
  (if (> th 1)
   (setq zbj 10 bj zbj)
   (setq bj 20 bj bj)
  )
)
(if (=tfx "ver")(setq gdbl xl xl yb yb gdbl))
(if (= btl 1)
  (setq btll 180)
  (setq btll 120)
)
(if (< (- xl bj tbll zbj) 0) (bye "不能画标题栏!"))
(setq lay "0")
(command "pline" (list 0 0) "w" 0 0
                  (list 0 yb)
                  (list xl yb)
                  (list xl 0) "c")
(command "pline" (list zbj bj) "w" 0.15 0.15
                 (list zbj (- yb bj))
                 (list (- xl bj) (- yb bj))
                 (list (- xl bj) bj) "c")
(dobtl htbl)
(command "zoom" "e")
(setq tzfmh th)
)
;----选择绘图比例
(defun gettf (/ scale bili)
(setq bili (list "1:1000" "1:500" "1:250" "1:200" "1:150" "1:100" "1:50" "1:25" "1:20"
                  "1:15" "1:10" "1:5" "1:4" "1:3" "1:2" "1:1")
       ss 0 th nil xl nil yb nil htbl nil tfx "hor" tkx "zdb" btl 1)
(setq aa (load_dialog "hthj.dcl"))
(if (not (new_dialog "tufu" aa)) (exit))
(while (/= ss 1)
  (start_list "scale")
  (mapcar 'add_list bili)
  (end_list)
;  (shaft_vslide "btl1" "ktxt(btl1)" 0)
;  (shaft_vslide "btl2" "ktxt(btl2)" 0)
  (set_tile "scale" "5")
  (action_tile "btl1" "(setq btl 1)")
  (action_tile "btl2" "(setq btl 2)")
  (action_tile "tfx" "(setq tfx $value)")
  (action_tile "tkx" "(setq tfx $value)")
  (action_tile "othersize" "(dosize)")
  (action_tile "otherscale" "(dosize)")
  (action_tile "accept" "(savez)(done_dialog 1)")
  (action_tile "cancel" "(done_dialog 1)(exit)")
  (setq ss (start_dialog))
)
(if (not htbl) (setq htbl (atoi (substr (nth scale bili) 3))))
)
;----初始化自定义图幅对话框
(defun dosize ()
(set_tile "size" "a8")
(if (not (new_dialog "paper" aa)) (exit))
(action_tile "accept" "(getpaper)")
(start_dialog)
)
;----获取当前年、月的数据
(defun zz()
(setq tdate (get_tile "yue"))
)
;----初始化自定义绘图比例对话框
(defun doscale ()
  (set_tile "scale" "-1")
  (if (not (new_dialog "scale" aa)) (exit))
  (action_tile "accept" "(getscale)")
  (start_dialog)
)
;----获得自定义的图纸幅面的参数
(defun getpaper ()
(setq x1 (atoi (get_tile "width"))
       yb (atoi (get_tile "height")))
(done_dialog)
)
;----转换保存绘图比例
(defun savez ()
(if (not htbl) (setq scale (atoi (get_tile "scale"))))
(if (not xl)
  (setq th (atoi (substr (get_tile "size"2))))
  (setq th (-0 1))
)
)
;----容错处理模块
(defun vfy_z (tile value v1 v2 / num valid zv1 zv2);v2>v1
(setq valid nil errmsg "数值无效 !" k1 0 k2 0)
(if (not value)(setq errmsg"数值无效,从新输入!"))
(if (= (type v1) 'INT)
  (setq num (atoi value) zv1 (itoa v1) zv2 (itoa v2))
  (setq num (atof value) zv1 (rtos v1 2 2) zv2 (rtos v2 2 2))
)
(if (not v2)
  (setq k2 1)
  (if (>num v2)
   (setq errmsg (strcat "数值必须小等于"zv2))
   (setq k2 1)
  )
)
(if (not v1)
  (setq k1 1)
  (if (<num v1)
   (setq errmsg (strcat "数值必须大等于"zv1))
   (setq k1 1)
  )
)
(if (> (* k1 k2) 0) (setq valid value))
(if valid (progn
  (set_tile "error" "")
  (set_tile tile valid)
) (progn
  (mode_tile tile2)
  (set_tile "error" errmsg)
))
)

本帖子中包含更多资源

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

x
发表于 2012-6-25 22:37:45 | 显示全部楼层
没对话框就出这样的信息。
 楼主| 发表于 2012-6-26 08:43:51 | 显示全部楼层
ZZXXQQ 发表于 2012-6-25 22:37
没对话框就出这样的信息。

意思要搭配对话框文件是吧

点评

对。找不到对话框就出这样的信息。  发表于 2012-6-26 21:26
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-7-22 03:52 , Processed in 0.168033 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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