- UID
- 202747
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2004-12-14
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
此程序在没有对话框的情况下,运行正常!但是加了对话框赋值后就出现了参数类型错误,我想可能是对话框赋值有问题,请版主帮我看看,如何修改?
(defun c:FL ()
(setvar "cmdecho" 0)
(dcl_fl) ;调用对话框子程序
(prin1)
)
(defun dcl_fl ()
(setq dcl_id (load_dialog "fl"))
(new_dialog "fl" dcl_id)
(sub_rb1)
(set_tile "th" "3")
(action_tile "px" "(sub_rb1)") ;调用子程序1
(action_tile "zx" "(sub_rb2)") ;调用子程序2
(action_tile "accept" "(ok_fl) (done_dialog 1)")
(setq dd (start_dialog))
(if (= dd 1)
(sub_chk_layer) ;调用绘图子程序
(t (alert "未完成任何动作!!!!"))
)
)
;子程序1
(defun sub_rb1 ()
; (setq ddtype 1)
(show_sld "img_ccr" "FL01")
)
;子程序2
(defun sub_rb2 ()
; (setq ddtype 1)
(show_sld "img_ccr" "FL11")
)
;点OK进行赋值
(defun ok_fl ()
(setq rad4 (atof (get_tile "p1")))
(setq rad2 (atof (get_tile "p2")))
(setq rad3 (atof (get_tile "p3")))
(setq rad (atof (get_tile "p4")))
(setq num (atof (get_tile "p5")))
(setq th (+ (* (atof (get_tile "th")) 30) 50))
)
;显示SLD幻灯片
(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 sub_chk_layer ()
(sub_chk_style)
(AA)
(BB)
(setq chklay (tblsearch "layer" "str"))
(if (= chklay nil)
(command "layer" "n" "str" "c" "4" "str" "LW" "0.3" "str" "")
)
(setq chklay (tblsearch "layer" "txt"))
(if (= chklay nil)
(command "layer" "n" "txt" "c" "3" "txt" "LW" "0.18" "txt" "")
)
(setq chklay (tblsearch "layer" "dim"))
(if (= chklay nil)
(command "layer" "n" "dim" "c" "5" "dim" "LW" "0.18" "dim" "")
)
(setq chklay (tblsearch "layer" "hat"))
(if (= chklay nil)
(command "layer" "n" "hat" "c" "6" "hat" "LW" "0.3" "hat" "")
)
(setq chklay (tblsearch "layer" "cen"))
(if (= chklay nil)
(command "layer" "n" "cen" "c" "2" "cen" "lt" "center" "cen" "LW"
"0.15" "cen" "")
)
(setq chklay (tblsearch "layer" "hid"))
(if (= chklay nil)
(command "layer" "n" "hid" "c" "2" "hid" "lt" "hidden" "hid" "LW"
"0.15" "hid" "")
)
(prompt "\n图层 STR,TXT,HAT,DIM,CEN.HID建立OK!")
)
;字体子程序
(defun sub_chk_style ()
(setq chksty (tblsearch "style" "china"))
(if (= chksty nil)
(command "style" "china" "txt,chineset" "" "" "" "" "" "")
)
(setq chksty (tblsearch "style" "kk"))
(if (= chksty nil)
(command "style" "kk" "标楷体" "" "" "" "" "")
)
(prompt "\n字型 CHINA & KK建立OK!")
)
(defun *error* (msg)
(princ "您的程序错误:")
(princ msg)
)
;赋值子程序
(defun AA ()
(setq baspt (getpoint "请求输入基准点: "))
;(setq rad2 (getdist baspt "\n请求输入中圆半径: "))
;(setq rad3 (getdist baspt "\n请求输入大圆半径: "))
;(setq rad4 (getdist baspt "\n请求输入小圆半径: "))
;(setq rad (getdist baspt "\n请求输入小圆半径: "))
;(setq num (getint "\n请求输入相切的小圆数量: "))
(setq ang2 (/ pi num))
(setq cenpt (polar baspt ang2 rad2))
(setq PP (polar cenpt 0 (* rad3 1.1)))
(setq P1 (polar cenpt 0 rad4))
(setq P2 (polar cenpt pi rad4))
(setq P3 (polar p2 (* pi 1.5) (* rad3 1.5)))
(setq p4 (polar cenpt 0 rad3))
(setq p5 (polar cenpt pi rad3))
(setq p6 (polar p3 (* pi 1.5) 400))
(setq p7 (polar cenpt 0 rad2))
(setq p8 (polar cenpt pi rad2))
(setq p9 (polar p6 (* pi 1.5) -200))
(prin1)
)
;以下依据 cenpt、num 配合环形array画出多圆相切
(defun BB ()
(setvar "clayer" "str")
(setvar "LTSCALE" 100)
(setvar "dimasz" 100)
(setvar "DIMEXO" 200)
(setvar "DIMEXE" 50)
(setvar "DIMGAP" 30)
(setvar "dimtxt" th)
(setvar "dimdec" 1)
(command "circle" baspt rad)
;;先画一个圆,才能array
(command "array" (entlast) "" "p" cenpt num 360 "Y")
(setvar "clayer" "cen")
(command "line" cenpt pp "")
(command "array" (entlast) "" "p" cenpt 4 360 "Y")
(command "circle" cenpt rad2)
(setvar "clayer" "str")
(command "polygon" "12" cenpt "C" rad4)
(command "circle" cenpt rad3)
(command "regenall")
(command "zoom" "e")
(setvar "clayer" "dim")
(command "_dimlinear" p1 p2 "H" p3 "")
(command "_dimlinear" p4 p5 "H" p6 "")
(command "_dimlinear" p7 p8 "H" p9 "")
(prin1)
(prompt "\n 法兰绘制")
(prin1)
)
fl:dialog{
label="绘制法兰加工图";
:row{
:image{ width=25; heiht=30; key="img_ccr"; color=-2;}
:boxed_column{ label="几何数据";
:radio_row {
:radio_button { label ="偏心"; key = "px";value=1;}
:radio_button { label ="正心"; key = "zx"; }
}
:edit_box{ label="内径 D1 "; width=8; key="p1"; }
:edit_box{ label="中径 D2"; width=8; key="p2";}
:edit_box{ label="外径 D3 ";width=6; key="p4"; }
:edit_box{ label="孔数 N ";width=6; key="p5"; }
:edit_box{ label="孔径 D ";width=6; key="p6"; }
:popup_list{ label="字高 h "; list=" 50\n 80\n 110\n 140\n 170\n 200\n 230\n 260"; width=8; key="th";}
}
}
ok_cancel;
} |
|