本帖最后由 lee50310 于 2023-1-7 00:54 编辑
範例:2 < 點選 幻燈片 畫不同顏色的圓 >
- ;;-------------------------------------------------------------------
- ;;展示幻燈片於影像框上
- (defun show_sld(key sld x y)
- (setq xa(dimx_tile key))
- (setq ya(dimy_tile key))
- (start_image key)
- (fill_image x y xa ya -2)
- (slide_image x y xa ya sld)
- (end_image)
- )
- ;;-------------------------------------------------------------------
- (defun c:tt2(/ Dcl_File file str)
- (setq path "E:\\temp_chs\\sld\")
- (setq Dcl_File (vl-filename-mktemp nil nil ".Dcl"))
- (setq file (open Dcl_File "w"))
- (foreach str '(
- "dq:dialog{"
- " label="物體對齊";"
- " :row{"
- " :image_button{key="豎直";color=-2;width=16;height=8;allow_accept=true;}"
- " :image_button{key="上";color=-2;width=16;height=8;allow_accept=true;}"
- " :image_button{key="水平";color=-2;width=16;height=8;allow_accept=true;}"
- " }"
- " :row{"
- " :image_button{key="左";color=-2;width=16;height=8;allow_accept=true;}"
- " :image_button{key="下";color=-2;width=16;height=8;allow_accept=true;}"
- " :image_button{key="右";color=-2;width=16;height=8;allow_accept=true;}"
- " }"
- " :image_button{key="雙向居中";color=-2;width=50;height=8;is_cancel=true;allow_accept=true;}"
- "}"
- )
- (write-line str file)
- )
- (close file)
- (not (setq file (close file)))
- (< 0 (setq dch (load_dialog Dcl_File)))
- (new_dialog "dq" dch)
-
- (show_sld "豎直" (strcat path "II.sld") -10 -24)
- (show_sld "上" (strcat path "up.sld" ) -3 -16)
- (show_sld "水平" (strcat path "I2.sld") 0 -16)
- (show_sld "左" (strcat path "L.sld" ) 0 -10)
- (show_sld "下" (strcat path "D.sld") 0 -10)
- (show_sld "右" (strcat path "R.sld") 0 -10)
- (show_sld "雙向居中" (strcat path "TT.sld") 0 -5)
-
- (action_tile "豎直" "(alert \" 按了:【豎直】\")(done_dialog 1)")
- (action_tile "上" "(alert \" 按了:【上】\")(done_dialog 2)")
- (action_tile "水平" "(alert \" 按了:【水平】\")(done_dialog 3)")
- (action_tile "左" "(alert \" 按了:【左】\")(done_dialog 4)")
- (action_tile "下" "(alert \" 按了:【下】\")(done_dialog 5)")
- (action_tile "右" "(alert \" 按了:【右】\")(done_dialog 6)")
-
- (setq dd(start_dialog))
- (cond
- ((= dd 0)(alert " 按了:【雙向居中】")(draw 50 1)) ;畫紅色圓 半徑50
- ((= dd 1) (draw 50 2)) ;;畫黃色圓 半徑50
- ((= dd 2) (draw 50 3))
- ((= dd 3) (draw 50 4))
- ((= dd 4) (draw 50 5))
- ((= dd 5) (draw 50 6))
- ((= dd 6) (draw 50 7)) ;;畫白色圓 半徑50
- )
- )
- ;;-------------------------------------------------------------------
- (defun draw( r1 col)
- (setq p1(getpoint "\n輸入插入點"))
- (ah:Circle p1 r1 col)
- )
- ;;--------------------------------------------------------------------
- ;;創建圓
- (defun ah:Circle (cen rad col)
- (entmakex (list (cons 0 "CIRCLE")
- (cons 10 cen)
- (cons 40 rad)
- (cons 62 col)))
- )
- ;;-------------------------------------------------------------------
|