明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1994|回复: 5

程式的问题好急呀!!!!!

[复制链接]
发表于 2004-7-31 09:56:00 | 显示全部楼层 |阅读模式
各位大侠请帮我看一下这个程式,画一个圆标注可以,但是画一个矩形倒一个圆角后标注会出一个错误提示,说我选择的图形不是圆或圆弧,也就是不能选择一个复线的圆或圆弧,不知怎么办才行呀!!程式如下所示: (defun c:dd (/ dcl_id sldkey_list sld_list dd)
(setq dcl_id (load_dialog "dd"))
(new_dialog "dd" dcl_id)

(set_tile "Text_h" (rtos (getvar "dimtxt")))
(set_tile "Arrow_s" (rtos (getvar "dimasz")))
(setq sldkey_list
'("d1" "d2" "d3" "d4" "d5" "d6" "d7" "d8" "d9" "d10" "d11"
"d12")
)
(setq sld_list '("dd1" "dd2" "dd3" "dd4" "dd5"
"dd6" "dd7" "dd8" "dd9" "dd10"
"dd11" "dd12"
)
)
(mapcar 'show_sld sldkey_list sld_list)
(mode_tile "Text_h" 2)
(action_tile "set" "(ok_set)")
(action_tile "d1" "(done_dialog 1)")
(action_tile "d2" "(done_dialog 2)")
(action_tile "d3" "(done_dialog 3)")
(action_tile "d4" "(done_dialog 4)")
(action_tile "d5" "(done_dialog 5)")
(action_tile "d6" "(done_dialog 6)")
(action_tile "d7" "(done_dialog 7)")
(action_tile "d8" "(done_dialog 8)")
(action_tile "d9" "(done_dialog 9)")
(action_tile "d10" "(done_dialog 10)")
(action_tile "d11" "(done_dialog 11)")
(action_tile "d12" "(done_dialog 12)")
(setq dd (start_dialog))
(cond ((= dd 1) (c:dd1))
((= dd 2) (c:dd2))
((= dd 3) (c:dd3))
((= dd 4) (c:dd4))
((= dd 5) (c:dd5))
((= dd 6) (c:dd6))
((= dd 7) (c:dd7))
((= dd 8) (c:dd8))
((= dd 9) (c:dd9))
((= dd 10) (c:dd10))
((= dd 11) (c:dd11))
((= dd 12) (c:dd12))
)
)
(defun show_sld (key sld) ;陪ボほ縊
(setq x (dimx_tile key))
(setq y (dimy_tile key))
(start_image key)
(fill_image 0 0 x y -2)
(slide_image 0 0 x y sld)
(end_image)
)
(defun c:dd1 ()
(get)
(setvar "dimtoh" 1)
(setvar "dimtad" 1)
(setvar "dimtofl" 0) (dim_d)
)
(defun c:dd2 ()
(get)
(setvar "dimtoh" 1)
(setvar "dimtofl" 1)
(setvar "dimtad" 1)
(setvar "dimatfit" 2)
(setvar "dimupt" 1)
(dim_d)
)
(defun c:dd3 ()
(get)
(setvar "dimtoh" 1)
(setvar "dimtad" 1)
(setvar "dimtofl" 1)
(setvar "dimatfit" 0)
(setvar "dimupt" 1)
(dim_d)
)
(defun c:dd4 ()
(get)
(setvar "dimtoh" 1)
(setvar "dimtofl" 0)
(setvar "dimtad" 0)
(dim_d)
)
(defun c:dd5 ()
(get)
(setvar "dimtoh" 1)
(setvar "dimtofl" 1)
(setvar "dimatfit" 2)
(setvar "dimupt" 1)
(setvar "dimtad" 0)
(dim_d)
)
(defun c:dd6 ()
(get)
(setvar "dimtoh" 1)
(setvar "dimtofl" 1)
(setvar "dimatfit" 0)
(setvar "dimupt" 1)
(setvar "dimtad" 0)
(dim_d)
)
(defun c:dd7 ()
(get)
(setvar "dimtoh" 0)
(setvar "dimtad" 1)
(setvar "dimtofl" 0)
(dim_d)
)
(defun c:dd8 ()
(get)
(setvar "dimtoh" 0)
(setvar "dimtad" 1)
(setvar "dimtofl" 1)
(setvar "dimatfit" 2)
(setvar "dimupt" 1)
(dim_d)
)
(defun c:dd9 ()
(get)
(setvar "dimtoh" 0)
(setvar "dimtad" 1)
(setvar "dimtofl" 1)
(setvar "dimatfit" 0)
(setvar "dimupt" 1)
(dim_d)
)
(defun c:dd10 ()
(get)
(setvar "dimtoh" 0)
(setvar "dimtad" 0)
(setvar "dimtofl" 0)
(dim_d)
)
(defun c:dd11 ()
(get)
(setvar "dimtoh" 0)
(setvar "dimtad" 0)
(setvar "dimtofl" 1)
(setvar "dimatfit" 2)
(setvar "dimupt" 1)
(dim_d)
)
(defun c:dd12 ()
(get)
(setvar "dimtoh" 0)
(setvar "dimtad" 0)
(setvar "dimtofl" 1)
(setvar "dimatfit" 0)
(setvar "dimupt" 1)
(dim_d)
)
(defun dim_d (/ en) ;夹猔瓜
(setvar "cmdecho" 0)
(lilin) ;(setvar "dimclrd" 5)
;(setvar "dimclre" 5)
(setvar "dimclrt"
5
(cond ((= data "0 ") (setq en (entsel "\n叫匡惠夹猔蛾:")))
((= data "1 ")(setq en (entsel "\n请选取需标注的圆:"))))
(while en
(command "_dim" "D" en "" pause "exit")
(cond ((= data "0 ") (setq en (entsel "\n叫匡蛾:")))
((= data "1 ") (setq en (entsel "\n请选取下一个圆:"))))
)
(if (null en)
(old)
)
(prin1)
)
(defun ok_set (/ arrow text) ;ゅ砞﹚
(setq arrow (atof (get_tile "Arrow_s")))
(setq text (atof (get_tile "Text_h")))
(setvar "dimasz" arrow)
(setvar "dimtxt" text)
)
(defun get (/ dimtoh dimtad dimtofl dimatfit dimupt) ;眔砞﹚戈
(setq dimtoh (getvar "dimtoh"))
(setq dimtad (getvar "dimtad"))
(setq dimtofl (getvar "dimtofl"))
(setq dimatfit (getvar "dimatfit"))
(setq dimupt (getvar "dimupt"))
(setq dimclrd (setvar "dimclrd" 5))
(setq dimclre (setvar "dimclre" 5))
(setq dimclrt (setvar "dimclrt" 5))
)
(defun old () ;临砞﹚
(setvar "dimtoh" dimtoh)
(setvar "dimtad" dimtad)
(setvar "dimtofl" dimtofl)
(setvar "dimatfit" dimatfit)
(setvar "dimupt" dimupt)
)
) (defun lilin()
(if (not (setq dat_file (findfile "Big5orGB.dat")))
(progn
(setq dat_file "Big50rGB.dat")
(setq ff (open dat_file "w"))
(write-line "0 " ff)
(setq data "0 ")
(close ff)
) 幻灯片档请见附件所示

本帖子中包含更多资源

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

x
发表于 2004-7-31 13:20:00 | 显示全部楼层
缺少dcl文件!
 楼主| 发表于 2004-7-31 14:32:00 | 显示全部楼层
不好意思忘记传了

本帖子中包含更多资源

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

x
发表于 2004-7-31 17:05:00 | 显示全部楼层
本帖最后由 作者 于 2004-8-8 11:11:29 编辑

参考: ★★★
;;;C:yhbz 圆弧标注
(defun c:yhbz (/ dcl_id sldkey_list sld_list dd)
(setq dcl_id (load_dialog "dd"))
(new_dialog "dd" dcl_id)
(set_tile "Text_h" (rtos (getvar "dimtxt")))
(set_tile "Arrow_s" (rtos (getvar "dimasz")))
(setq sldkey_list '("d1" "d2" "d3" "d4" "d5" "d6" "d7" "d8" "d9" "d10" "d11" "d12"))
(setq sld_list '("dd1" "dd2" "dd3" "dd4" "dd5" "dd6" "dd7" "dd8" "dd9" "dd10" "dd11" "dd12"))
(mapcar 'show_sld sldkey_list sld_list)
(mode_tile "Text_h" 2)
(action_tile "set" "(ok_set)")
(action_tile "d1" "(done_dialog 1)")
(action_tile "d2" "(done_dialog 2)")
(action_tile "d3" "(done_dialog 3)")
(action_tile "d4" "(done_dialog 4)")
(action_tile "d5" "(done_dialog 5)")
(action_tile "d6" "(done_dialog 6)")
(action_tile "d7" "(done_dialog 7)")
(action_tile "d8" "(done_dialog 8)")
(action_tile "d9" "(done_dialog 9)")
(action_tile "d10" "(done_dialog 10)")
(action_tile "d11" "(done_dialog 11)")
(action_tile "d12" "(done_dialog 12)")
(setq dd (start_dialog))
(cond ((= dd 1) (c:dd1))
((= dd 2) (c:dd2))
((= dd 3) (c:dd3))
((= dd 4) (c:dd4))
((= dd 5) (c:dd5))
((= dd 6) (c:dd6))
((= dd 7) (c:dd7))
((= dd 8) (c:dd8))
((= dd 9) (c:dd9))
((= dd 10) (c:dd10))
((= dd 11) (c:dd11))
((= dd 12) (c:dd12))
)
) (defun show_sld (key sld)
(setq x (dimx_tile key))
(setq y (dimy_tile key))
(start_image key)
(fill_image 0 0 x y -2)
(slide_image 0 0 x y sld)
(end_image)
) (defun c:dd1 ()
(get)
(setvar "dimtoh" 1)
(setvar "dimtad" 1)
(setvar "dimtofl" 0)
(arcdim1)
(old)
) (defun c:dd2 ()
(get)
(setvar "dimtoh" 1)
(setvar "dimtofl" 1)
(setvar "dimtad" 1)
(setvar "dimatfit" 2)
(setvar "dimupt" 1)
(arcdim1)
(old)
) (defun c:dd3 ()
(get)
(setvar "dimtoh" 1)
(setvar "dimtad" 1)
(setvar "dimtofl" 1)
(setvar "dimatfit" 0)
(setvar "dimupt" 1)
(arcdim1)
(old)
) (defun c:dd4 ()
(get)
(setvar "dimtoh" 1)
(setvar "dimtofl" 0)
(setvar "dimtad" 0)
(arcdim1)
(old)
) (defun c:dd5 ()
(get)
(setvar "dimtoh" 1)
(setvar "dimtofl" 1)
(setvar "dimatfit" 2)
(setvar "dimupt" 1)
(setvar "dimtad" 0)
(arcdim1)
(old)
) (defun c:dd6 ()
(get)
(setvar "dimtoh" 1)
(setvar "dimtofl" 1)
(setvar "dimatfit" 0)
(setvar "dimupt" 1)
(setvar "dimtad" 0)
(arcdim1)
(old)
) (defun c:dd7 ()
(get)
(setvar "dimtoh" 0)
(setvar "dimtad" 1)
(setvar "dimtofl" 0)
(arcdim1)
(old)
) (defun c:dd8 ()
(get)
(setvar "dimtoh" 0)
(setvar "dimtad" 1)
(setvar "dimtofl" 1)
(setvar "dimatfit" 2)
(setvar "dimupt" 1)
(arcdim1)
(old)
) (defun c:dd9 ()
(get)
(setvar "dimtoh" 0)
(setvar "dimtad" 1)
(setvar "dimtofl" 1)
(setvar "dimatfit" 0)
(setvar "dimupt" 1)
(arcdim1)
(old)
) (defun c:dd10 ()
(get)
(setvar "dimtoh" 0)
(setvar "dimtad" 0)
(setvar "dimtofl" 0)
(arcdim1)
(old)
) (defun c:dd11 ()
(get)
(setvar "dimtoh" 0)
(setvar "dimtad" 0)
(setvar "dimtofl" 1)
(setvar "dimatfit" 2)
(setvar "dimupt" 1)
(arcdim1)
(old)
) (defun c:dd12 ()
(get)
(setvar "dimtoh" 0)
(setvar "dimtad" 0)
(setvar "dimtofl" 1)
(setvar "dimatfit" 0)
(setvar "dimupt" 1)
;(dim_d)
(arcdim1)
(old)
) (defun c:dd13 ()
(get)
(setvar "dimtoh" 1)
(setvar "dimtad" 1)
(setvar "dimtofl" 0)
(arcdim2)
(old)
)
(defun dim_d (/ en)
(setvar "cmdecho" 0)

;(lilin);;;此句有何用?! (setq data "1")
;(setvar "dimclrd" 5)
;(setvar "dimclre" 5)
(setvar "dimclrt" 5)
(cond ((= data "0") (setq en (entsel "\n???:")))
((= data "1")(setq en (entsel "\n请选取需标注的圆:"))))
(while en
(command "_dim" "D" en "" pause "exit")
(cond ((= data "0") (setq en (entsel "\n???:")))
((= data "1") (setq en (entsel "\n请选取下一个圆:"))))
;(command "_dim" "Dia" en "" pause "exit")
;(command "_dim" "Dia" en "" "exit")
)
(if (null en)
(old)
)
(prin1)
) (defun ok_set (/ arrow text)
(setq arrow (atof (get_tile "Arrow_s")))
(setq text (atof (get_tile "Text_h")))
(setvar "dimasz" arrow)
(setvar "dimtxt" text)
) (defun get (/ dimtoh dimtad dimtofl dimatfit dimupt)
(setq dimtoh (getvar "dimtoh"))
(setq dimtad (getvar "dimtad"))
(setq dimtofl (getvar "dimtofl"))
(setq dimatfit (getvar "dimatfit"))
(setq dimupt (getvar "dimupt"))
(setq dimclrd (setvar "dimclrd" 5))
(setq dimclre (setvar "dimclre" 5))
(setq dimclrt (setvar "dimclrt" 5))
) (defun old ()
(setvar "dimtoh" dimtoh)
(setvar "dimtad" dimtad)
(setvar "dimtofl" dimtofl)
(setvar "dimatfit" dimatfit)
(setvar "dimupt" dimupt)
) (defun lilin()
(if (not (setq dat_file (findfile "Big50rGB.dat")))
(progn
(setq dat_file "Big50rGB.dat")
(setq ff (open dat_file "w"))

(write-line "0" ff)
(setq data "0")
(close ff)
)
)
)
;;---------------------------
;;标注直径
(defun arcdim1 ()
(MKLA "标注" 3)
(stdi)
(if (/= (getvar "dimblk") "ar")
(dimkar)
)
(prompt"\n\t选择圆 : ")
(while t
(command"dim1""dia" pause "" "")
)
)
;;标注半径
(defun arcdim2 ()
(MKLA "标注" 3)
(stdi)
(if (/= (getvar "dimblk") "ar")
(dimkar)
)
(prompt"\n\t选择圆弧 : ")
;(while t
;(command"dim1""dia" pause "" "")
;)
(while t
(command"dim1""Rad" pause "" "")
)
)
(defun stdi()
(if (not (tblsearch "block" "di")) (command "insert" "di" ^c))
(if (not (tblsearch "block" "di1")) (command "insert" "di1" ^c))
(if (not (tblsearch "block" "ar")) (command "insert" "ar" ^c))
) (defun dimkar ()
(command "dim1""dimblk""ar")
(command "dim1""dimblk1""ar")
(command "dim1""dimblk2""ar")
) ;;;
(Defun MKLA (a b)
(If (= (Tblsearch "layer" a) nil)
(Command "layer" "m" a "c" b a "")
(Command "layer" "t" a "s" a "c" b a "")
)
)
 楼主| 发表于 2004-8-3 15:32:00 | 显示全部楼层
楼上这位大哥里的面"ar" "Di1" "di"是不是箭头样式的图块


请各位版主帮忙看一下上面这个程式我试过了好像用是可以用但是标注出来的尺寸很难看呀!请帮忙改一下哟!!!多谢了!
发表于 2004-8-8 11:09:00 | 显示全部楼层
标注出来的尺寸很难看吗?那不是你自己的箭头样式图块吗?


换成PLMM不就好看啦!


呵呵……
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-18 21:41 , Processed in 0.216822 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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