;========================================================================<BR>(defun c:TK(/ bp k a do_accept) ;画图框程序<BR> (COMMAND "osnap" "None")
(defun do_accept()<BR> (setq k (atoi(get_tile "edit1")))<BR> (setq a (atoi(get_tile "edit2")))<BR> (done_dialog 1)<BR> )<BR> (setq dcl_id (load_dialog "图框"))<BR> (new_dialog "first1" dcl_id)<BR> (action_tile "accept" "(do_accept)")<BR> (setq status(start_dialog))<BR>(cond<BR>((= status 1) <BR>(IF (NOT k) (setq k 20))<BR>(setq loop T)<BR>(command "-style" "dim-font" "gbxwxt,gbhzfz" "0" "0.8"<BR> "0" "N" "N" "N")<BR>(COMMAND "LTSCALE" (/ K 4))<BR>(command "layer" "make" "lay_dashed" "" ) <BR>(command "layer" "color" "red" "lay_dashed" "") <BR>(command "layer" "ltype" "ACAD_ISO02W100" "lay_dashed" "")
(command "layer" "make" "long_short" "" ) <BR>(command "layer" "color" "cyan" "long_short" "")<BR>(command "layer" "ltype" "ACAD_ISO08W100" "long_short" "") <BR>(command "layer" "make" "lay3" "" ) <BR>(command "layer" "color" "blue" "lay3" "") <BR>(command "layer" "make" "lay4" "" ) <BR>(command "layer" "color" "yellow" "lay4" "") <BR>(command "layer" "make" "lay5" "" ) <BR>(command "layer" "color" "magenta" "lay5" "") <BR>(command "layer" "make" "tf" "" ) <BR>(command "layer" "color" "green" "tf" "") <BR>(while loop
(IF (NOT a) (setq a 2))
(cond<BR> ((= 3.0 a)<BR> (setq loop nil)<BR> (setq bp (getpoint "\n用鼠标给图框左下角图面位置point:"))<BR> (command "pline"<BR> bp "w" "0" "0"<BR> (setq s1 (polar bp 0.0 (* k 420)))<BR> (setq s2 (polar s1 (/ pi 2.0) (* k 297)))<BR> (setq s3 (polar s2 ( - pi) (* k 420)))<BR> "close")<BR> (command "pline"<BR> <BR> (setq s4 (polar s1 (* pi 0.75) (* k 7.0710)))<BR> "w" (/ k 2) (/ k 2)<BR> (setq s5 (polar s4 (/ pi 2.0) (* k 287)))<BR> (setq s6 (polar s5 ( - pi) (* k 390)))<BR> (setq s7 (polar s6 (/ pi 2.0) (* k -287)))<BR> "close"<BR> )<BR> (command "insert" "c:\\cuo" s4 (+ k 0) (+ k 0) "0" "")<BR> (command "insert" "c:\\tq" s6 (+ k 0) (+ k 0) "0" "")<BR> <BR> )<BR> ((= 2.0 a)
(setq loop nil)<BR> (setq bp (getpoint "\n用鼠标给图框左下角图面位置point:"))<BR> (command "pline"<BR> bp "w" "0" "0"<BR> (setq s1 (polar bp 0.0 (* k 594)))<BR> (setq s2 (polar s1 (/ pi 2.0) (* k 420)))<BR> (setq s3 (polar s2 ( - pi) (* k 594)))<BR> "close")<BR> (command "pline"<BR> <BR> (setq s4 (polar s1 (* pi 0.75) (* k 14.1421)))<BR> "w" (/ k 2) (/ k 2)<BR> (setq s5 (polar s4 (/ pi 2.0) (* k 400)))<BR> (setq s6 (polar s5 ( - pi) (* k 559)))<BR> (setq s7 (polar s6 (/ pi 2.0) (* k -400)))<BR> "close"<BR> )<BR> (command "insert" "c:\\cuo" s4 (+ k 0) (+ k 0) "0" "")<BR> (command "insert" "c:\\tq" s6 (+ k 0) (+ k 0) "0" "")<BR> )<BR> ((= 1.0 a)
(setq loop nil)<BR> (setq bp (getpoint "\n用鼠标给图框左下角图面位置point:"))<BR> (command "pline"<BR> bp "w" "0" "0"<BR> (setq s1 (polar bp 0.0 (* k 841)))<BR> (setq s2 (polar s1 (/ pi 2.0) (* k 594)))<BR> (setq s3 (polar s2 ( - pi) (* k 841)))<BR> "close") <BR> (command "pline"<BR> <BR> (setq s4 (polar s1 (* pi 0.75) (* k 14.1421)))<BR> "w" (/ k 2) (/ k 2)<BR> (setq s5 (polar s4 (/ pi 2.0) (* k 574)))<BR> (setq s6 (polar s5 ( - pi) (* k 806)))<BR> (setq s7 (polar s6 (/ pi 2.0) (* k -574)))<BR> "close"<BR> )<BR> (command "insert" "c:\\cuo" s4 (+ k 0) (+ k 0) "0" "")<BR> (command "insert" "c:\\tq" s6 (+ k 0) (+ k 0) "0" "")<BR> )<BR> ((= 0 a)
(setq loop nil)<BR> (setq bp (getpoint "\n用鼠标给图框左下角图面位置point:"))<BR> (command "pline"<BR> <BR> bp "w" "0" "0"<BR> (setq s1 (polar bp 0.0 (* k 1189)))<BR> (setq s2 (polar s1 (/ pi 2.0) (* k 841)))<BR> (setq s3 (polar s2 ( - pi) (* k 1189)))<BR> "close")<BR> (command "pline"<BR> (setq s4 (polar s1 (* pi 0.75) (* k 14.1421)))<BR> "w" (/ k 2) (/ k 2)<BR> (setq s5 (polar s4 (/ pi 2.0) (* k 821)))<BR> (setq s6 (polar s5 ( - pi) (* k 1154)))<BR> (setq s7 (polar s6 (/ pi 2.0) (* k -821)))<BR> "close"<BR> )<BR> (command "insert" "c:\\cuo" s4 (+ k 0) (+ k 0) "0" "")<BR> (command "insert" "c:\\tq" s6 (+ k 0) (+ k 0) "0" "")<BR> )<BR> )<BR>)<BR> (command "zoom" "e")<BR>(command "LUNITS" "2" "LUPREC" "0")<BR>(command "blipmode" "off")<BR>(command "splinetype" "5")<BR>(command "savetime" "10")<BR>(command "dim" "dimexe" (* 2 k) "dimtsz" (* k 1)<BR> "dimtxt" (* 5 k) "dimdle" (* k 2)<BR> "dimtad" "1" "dimtih" "0" "DIMEXO" (* k 3)<BR> "Gap" (* 2 k) "fit" "5" "dimunit" "2"<BR> "dimdec" "0" "dimtih" "off" "dimtoh" "off"<BR> "style" "dim-font" "exit" )<BR>(command "blipmode" "0")
(command "dimtxsty" "dim-font")<BR>(command "layer" "set" "0" "" ) <BR>(command "savetime" "5" )
<BR> ) ((/= status 1)( )) )
)
<BR>;=======================================================================
<BR>;标注变量设置函数程序<BR>(defun c:dimw(/ bp k a do_accept)<BR> (defun do_accept()<BR> (setq k (atoi(get_tile "edit1")))<BR> (setq a(atoi(get_tile "edit2")))<BR> (done_dialog 1)<BR> )<BR> (setq dcl_id (load_dialog "图框"))<BR> (new_dialog "first1" dcl_id)<BR> (action_tile "accept" "(do_accept)")<BR> (setq status(start_dialog))<BR>(command "LUNITS" "2" "LUPREC" "0")<BR>(COMMAND "LTSCALE" (/ K 4))<BR>(command "dim" "dimexe" (* 2 k) "dimtsz" (* k 1)<BR> "dimtxt" (* 5 k) "dimdle" (* k 2)<BR> "dimtad" "1" "dimtih" "0" "DIMEXO" (* k 3)<BR> "Gap" (* 1 k) "fit" "5" "dimunit" "2"<BR> "dimdec" "0" "dimtih" "off" "dimtoh" "off"<BR>"exit" )<BR>)<BR>
first1:dialog{<BR> label="图框对话框";<BR> :edit_box{<BR> label="出图比例K:";<BR> key="edit1";<BR> edit_width=6;<BR> edit_limit=4;<BR> value="20";<BR> <BR> }<BR> :edit_box{<BR> label="出图图号:";<BR> key="edit2";<BR> edit_width=6;<BR> edit_limit=1;<BR> value="2";<BR> <BR> }<BR>
:row{<BR> :button{<BR> label="OK";<BR> key="accept";<BR> width=18;<BR> is_default=true;<BR> }<BR> <BR> :button{<BR> label="Cancel";<BR> key="cancel";<BR> width=18;<BR> is_cancel=false;<BR> }<BR> }<BR>}<BR>
<BR> |