引线标注
(defun c:tb1(/ k pt1 pt2pt3 pt4 pt5 pt6 pt7 pt8 t1 t2 t3 P4 pt1_mid chklay wordstr dd dcl_id word_list vvs l_ast l_ast1)(HJSZ)
(setvar "cmdecho" 0)
(setq word_list'("TB2012-1" "TS2012-2""15J401" "02J331"))
(chk_style)
(dcl_tb)
(HFHJSZ)
(prin1)
)
(defun dcl_tb(/ dd dcl_id)
(if (not jd1) (setq jd1 "0"))
(if (not jd2) (setq jd2 "0"))
(setq dcl_id (load_dialog "tb"))
(new_dialog "tb" dcl_id)
(start_list "klist")
(mapcar 'add_list word_list)
(end_list)
(set_tile "klist" "0")
(sub_klist "0")
;;(if (= jd1 "1" )(setq jd2 "0"))
;;(if (= jd2 "1" )(setq jd1 "0"))
(set_tile "rb1" jd1)
(set_tile "rb2" jd2)
;(setq th1 (get_attr rb1 "label"))
;(setq th2 (get_attr rb2 "label"))
;(if(= th1 "加圆圈") (mode_tile "rb1" 0)(mode_tile"rb2" 1))
;(if(= th2 "加点") (mode_tile "rb2" 0)(mode_tile"rb1" 1))
(action_tile "klist" "(sub_klist $value)")
(action_tile "accept" "(ok_tb)(done_dialog 1)")
(setq dd(start_dialog))
(if (= dd 1)
(progn
(setvar "cmdecho" 0)
(setvar "osmode" 0)
(setq pt1 (getpoint "\n索引区域中心点位置:"))
(if( = jd1 "1")
(progn
(command "circle" pt1 pause )
(setq l_ast (entlast))
)
)
(if( = jd2 "1")
(command "Donut" "0" "80" pt1 "")
)
(setq pt2 (getpoint pt1 "\n索引线转折点:"))
(command "line" "non" pt1 pt2 "")
(setq l_ast1 (entlast))
(if( = jd1 "1")
(command "trim" l_ast "" (list l_ast1 pt1) "")
)
(setVar "OrthoMode" 1)
(setq pt5 (getpoint pt2 "\n索引符号方位:"))
(setq k (angle pt2 pt5))
(setq pt3 (polar pt2 k 2200))
(setq pt4 (polar pt3 k 1000))
(setq pt6 (mid_pt pt3 pt4))
(setq pt7 (polar pt6 (* pi 0.5) 200)) ;索引号定位点
(setq pt8 (polar pt6 (* pi -0.5) 210));图集页码号定位点
(command "line" "non" pt2 pt4 "")
(command "circle""2p" "non" pt3"non" pt4)
(setq pt1_mid (mid_pt pt2 pt3)
p4 (polar pt1_mid (* 0.5 pi) 100) ;;文字起点
)
(command "-text" "j" "c" p4 350 0 wordstr )
(command "-text" "j" "m" pt7 350 0 t1)
(command "-text" "j" "m" pt8 350 0 t2)
)
)
)
(defun sub_klist(vvs)
(set_tile "wordstr" (nth (atoi vvs) word_list))
)
(defun ok_tb()
(setq wordstr(get_tile "wordstr"))
(setq t1(get_tile "syh"))
(setq t2(get_tile "tyh"))
(setq jd1 (get_tile "rb1"))
(setq jd2 (get_tile "rb2"))
)
(defun chk_style();检查字型
(setq chklay(tblsearch "layer" "文字"))
(if (null chklay)
(command "layer" "m" "文字" "c" "3" "" "lt" "CONTINUOUS" "" "");文字图层
;(command "_layer" "m" "文字" "c" "3" "文字" "")
)
(setvar "clayer" "文字")
)
tb:dialog{
label="图集大样选用";
:list_box{
label="常用图集编号";
key="klist";
width=30;
height=10;
fixed_width_font=true;
}
:edit_box{label="图集编号";key="wordstr";}
:row{
fixed_width=true;
alignment=centered;
:edit_box{label="索引代号";key="syh";edit_width=4;}
:edit_box{label="图集页码";key="tyh";edit_width=4;}
}
:row{
:toggle{label="加圆圈";alignment=centered; key="rb1";}
:toggle{label="加点";alignment=centered; key="rb2";}
}
spacer_1; //空开一列
ok_cancel;
}
(defun c:tb1(/ k pt1 pt2pt3 pt4 pt5 pt6 pt7 pt8 t1 t2 t3 P4 pt1_mid chklay wordstr dd dcl_id word_list vvs l_ast l_ast1)
(HJSZ)
(setvar "cmdecho" 0)
(setq word_list'("TB2012-1" "TS2012-2""15J401" "02J331"))
(chk_style)
(dcl_tb)
(HFHJSZ)
(prin1)
)
(defun dcl_tb(/ dd dcl_id)
(if (not jd1) (setq jd1 "0"))
(if (not jd2) (setq jd2 "0"))
(setq dcl_id (load_dialog "tb"))
(new_dialog "tb" dcl_id)
(start_list "klist")
(mapcar 'add_list word_list)
(end_list)
(set_tile "klist" "0")
(sub_klist "0")
;;(if (= jd1 "1" )(setq jd2 "0"))
;;(if (= jd2 "1" )(setq jd1 "0"))
(set_tile "rb1" jd1)
(set_tile "rb2" jd2)
;(setq th1 (get_attr rb1 "label"))
;(setq th2 (get_attr rb2 "label"))
;(if(= th1 "加圆圈") (mode_tile "rb1" 0)(mode_tile"rb2" 1))
;(if(= th2 "加点") (mode_tile "rb2" 0)(mode_tile"rb1" 1))
(action_tile "klist" "(sub_klist $value)")
(action_tile "accept" "(ok_tb)(done_dialog 1)")
(setq dd(start_dialog))
(if (= dd 1)
(progn
(setvar "cmdecho" 0)
(setvar "osmode" 0)
(setq pt1 (getpoint "\n索引区域中心点位置:"))
(if( = jd1 "1")
(progn
(command "circle" pt1 pause )
(setq l_ast (entlast))
)
)
(if( = jd2 "1")
(command "Donut" "0" "80" pt1 "")
)
(setq pt2 (getpoint pt1 "\n索引线转折点:"))
(command "line" "non" pt1 pt2 "")
(setq l_ast1 (entlast))
(if( = jd1 "1")
(command "trim" l_ast "" (list l_ast1 pt1) "")
)
(setVar "OrthoMode" 1)
(setq pt5 (getpoint pt2 "\n索引符号方位:"))
(setq k (angle pt2 pt5))
(setq pt3 (polar pt2 k 2200))
(setq pt4 (polar pt3 k 1000))
(setq pt6 (mid_pt pt3 pt4))
(setq pt7 (polar pt6 (* pi 0.5) 200)) ;索引号定位点
(setq pt8 (polar pt6 (* pi -0.5) 210));图集页码号定位点
(command "line" "non" pt2 pt4 "")
(command "circle""2p" "non" pt3"non" pt4)
(setq pt1_mid (mid_pt pt2 pt3)
p4 (polar pt1_mid (* 0.5 pi) 100) ;;文字起点
)
(command "-text" "j" "c" p4 350 0 wordstr )
(command "-text" "j" "m" pt7 350 0 t1)
(command "-text" "j" "m" pt8 350 0 t2)
)
)
)
(defun sub_klist(vvs)
(set_tile "wordstr" (nth (atoi vvs) word_list))
)
(defun ok_tb()
(setq wordstr(get_tile "wordstr"))
(setq t1(get_tile "syh"))
(setq t2(get_tile "tyh"))
(setq jd1 (get_tile "rb1"))
(setq jd2 (get_tile "rb2"))
)
(defun chk_style();检查字型
(setq chklay(tblsearch "layer" "文字"))
(if (null chklay)
(command "layer" "m" "文字" "c" "3" "" "lt" "CONTINUOUS" "" "");文字图层
;(command "_layer" "m" "文字" "c" "3" "文字" "")
)
(setvar "clayer" "文字")
)
这个程序的加圆圈和加点怎么设置成互换的样式,点了加点就不能点加圆圈,反之亦然
就是这里的选项只能选一个,相互制约 用radio_button替换toggle kozmosovia 发表于 2023-8-10 09:43
用radio_button替换toggle
radio_button应该是必选一个吧,这里大部分是两个都不选 szx025 发表于 2023-8-10 09:58
radio_button应该是必选一个吧,这里大部分是两个都不选
三个button,加个无不就是了 感谢分享。 缺少子程序呢 HJSZ 和 HFHJSZ
页:
[1]
2