11. Edit Box Á¦¾î
¸ðµç ´ëÈ »óÀÚ¸¦ ȸ鿡 ³ªÅ¸³ª°Ô ÇÏ·Á¸é ´ÙÀ½°ú °°Àº
AutoLISP ÇÁ·Î±×·¥À» ÀÛ¼ºÇÏ¸é µË´Ï´Ù.
¾Õ Edit Box¿¡¼ ÀÛ¼ºÇÑ sedit02.dcl ÆÄÀÏÀ» ¿¹·Î µé°Ú½À´Ï´Ù.
;; sedit02.lsp
(defun c:sedit()
(setq dcl_flag (load_dialog "sedit02.dcl"))
(new_dialog "sample02" dcl_flag)
;;
»ç¿ëÀÚ ÀÔ·ÂÀ» À§ÇÑ Å¸ÀÏÀÇ À̺¥Æ® ¼³Á¤
(setq rtnDLG (start_dialog))
(done_dialog)
(unload_dialog dcl_flag)
(if
(=
rtnDLG
1)
(EVENT_OK)
;;
OK À̺¥Æ® ¼³Á¤
(EVENT_Cancel)
;;
Cancel À̺¥Æ® ¼³Á¤
)
)
±×¸².10-01
|
// sedit02.dcl
sample02:dialog
{
label
= " Edit Box Sample Dialog";
spacer;
: edit_box
{
label
=
"Edit Box Sample";
key
=
"db";
value
=
"Edit
Box";
edit_width
=
20;
edit_limit
=
26;
}
spacer;
ok_cancel;
}
|
À§ÀÇ LISPÆÄÀÏ°ú DCLÆÄÀÏÀ» AutoCAD¿¡¼ ½ÇÇà½ÃÄѵµ ´ÜÁö [±×¸².10-01]°ú °°Àº ´ëÈ
»óÀÚ¸¸ ³ªÅ¸³¯ »Ó ¾Æ¹«·± ±â´ÉÀ»
°¡ÁöÁö ¾Ê½À´Ï´Ù.
´ëÈ »óÀڷμ ¿ÏÀüÇÑ ±â´ÉÀ» °¡Áö·Á¸é LISP ÆÄÀÏ ¾È¿¡¼
´ëÈ »óÀÚ ÄÁÆ®·Ñ °ü·Ã LISP ÇÔ¼öµéÀ»
»ç¿ëÇÏ¿©
°¢°¢ÀÇ Å¸ÀÏ¿¡ ¸Â´Â Á¶°ÇÀ̳ª À̺¥Æ®µéÀ» ¼³Á¤ÇØ ÁÖ¾î¾ßÇÕ´Ï´Ù.
Edit Box¸¦ Á¦¾îÇϱâÀ§Çؼ »ç¿ëÇÏ´Â LISP ÇÔ¼ö´Â ´ÙÀ½°ú °°½À´Ï´Ù.
** ´ëÈ »óÀÚ Á¦¾î-2 ÂüÁ¶
action_tile |
mode_tile |
set_tile |
|
¿ì¼± Edit Box¸¦ Á¦¾îÇϱâ ÀÌÀü¿¡ Edit BoxÀÇ ¿ëµµ¸¦ Á¤ÇØ¾ß ÇÕ´Ï´Ù.
¼ýÀÚ¸¦ ÀÔ·Â ¹ÞÀ» °ÍÀΰ¡? ¾Æ´Ï¸é ¹®ÀÚ¸¦ ÀÔ·Â ¹ÞÀ» °ÍÀΰ¡?¸¦ Á¤ÇØ¾ß ÇÕ´Ï´Ù.
¿Ö³ÄÇÏ¸é ´ëÈ »óÀÚ´Â ¼ýÀÚ¿Í ¹®ÀÚ¸¦ ±¸º°ÇÏÁö ¾Ê°í ¹«Á¶°Ç ¹®ÀÚ·Î ¸ðµç °ÍÀ»
¹Þ¾ÆµéÀ̱⠶§¹®ÀÔ´Ï´Ù.
µû¶ó¼, ¼ýÀÚ¸¦ ÀԷ¹ޱâ À§ÇÑ Edit Box¿Í ¹®ÀÚ¸¦ ÀԷ¹ޱâ À§ÇÑ Edit Box·Î ±¸ºÐÇؼ
¼³Á¤ÇØÁÖ¾î¾ß ÇÕ´Ï´Ù.
±âº»ÀûÀÎ ¼³Á¤Àº µÎ°¡Áö °æ¿ì ºñ½ÁÇϳª ¼ýÀÚ¸¦ ÀÔ·Â ¹Þ´Â °æ¿ì´Â AutoLISPÀÇ º¯È¯
ÇÔ¼ö´Â ÀÌ¿ëÇØ¾ß ÇÑ´Ù´Â °Í¸¸ ´Ù¸¨´Ï´Ù.
1. Edit Box¸¦ Á¦¾îÇÏ´Â LISP ÇÁ·Î±×·¥ ÀÛ¼º
¼ø¼
defun ÇÔ¼ö Á¤ÀÇ
"load_dialog"¸¦
ÀÌ¿ëÇÑ DCL ÆÄÀÏ È£Ãâ
"new_dialog"¸¦
ÀÌ¿ëÇÑ ´ëÈ »óÀÚ È£Ãâ
"set_tile"¿Í
"mode_tile"¸¦ ÀÌ¿ëÇÑ Å¸ÀÏ ÃʱâÈ
"action_tile"¸¦
ÀÌ¿ëÇÑ ÀԷ°ª ó¸®
"start_dialog"¸¦
ÀÌ¿ëÇÑ ´ëÈ »óÀÚ Á¾·á ¸®ÅÏ°ª ¹Ýȯ
Á¾·á À̺¥Æ®
¼³Á¤
"done_dialog"¸¦
ÀÌ¿ëÇÑ ´ëÈ »óÀÚ Á¾·á
"unload_dialog"¸¦
ÀÌ¿ëÇÑ ´ëÈ »óÀÚ ¸Þ¸ð¸® Á¾·á
2. "set_tile"¸¦ ÀÌ¿ëÇÑ Å¸ÀÏ ÃʱâÈ
Edit Box¿¡ ÃʱⰪÀ» Ç¥½ÃÇϱâ À§Çؼ´Â DCLÀÇ "value"¸¦ »ç¿ëÇؾß
ÇÏÁö¸¸, LISPÀÇ "set_tile" ÇÔ¼ö¸¦ ÀÌ¿ëÇؼ ÇÒ ¼öµµ ÀÖ½À´Ï´Ù.
"set_tile"¸¦ ÀÌ¿ëÇؼ ÃʱâÈÇÒ ¶§ Á÷Á¢ ÃʱâÈÇÏÁö ¾Ê°í º¯¼ö¸¦
ÀÌ¿ëÇÏ¿© ÃʱâÈÇÕ´Ï´Ù.
À§ÀÇ ¿¹Á¦ ÇÁ·Î±×·¥ "sedit02.dcl"ÀÇ edit_box¿¡ ÃʱⰪÀ» "set_tile"¸¦
»ç¿ëÇؼ Ç¥½ÃÇϱâ À§Çؼ´Â ´ÙÀ½°ú °°ÀÌ ÇØ¾ß ÇÕ´Ï´Ù.
edit_boxÀÇ key-nameÀÌ "db"ÀÔ´Ï´Ù.
set_tileÀ» edit_box¿¡ ÁöÁ¤ÇÑ ¿¹
(set_tile "db"
"Expression") |
Edit Box¿¡ ÃʱⰪÀ» º¯¼ö·Î ÁöÁ¤ÇÑ ¿¹
ÃʱⰪÀ» »ç¿ëÀÚ°¡ ÁöÁ¤ÇÑ º¯¼ö(dbvalue)¿¡ ÁöÁ¤ÇÑ ¿¹
´ÙÀ½ ¿¹Á¦´Â ¾Æ¹«·± ±â´ÉÀ» °¡ÁöÁö ¾Ê½À´Ï´Ù.
´Ü¼øÇÏ°Ô "set_tile"¸¦ ÀÌ¿ëÇؼ ŸÀÏÀ» ÃʱâÈÇÏ´Â ¹æ¹ýÀ» ¼³¸íÇÑ
°ÍÀÔ´Ï´Ù.
¿¹Á¦ ÇÁ·Î±×·¥)
; SEDIT.LSP
(defun c:sedit()
(prompt "\n Loaded.......")
(setq dcl_sample (load_dialog "c:/sedit02.dcl"))
(new_dialog "sample" dcl_sample)
(setq dbvalue "100")
; ÃʱⰪ ¼³Á¤
(set_tile "db" dbvalue)
; ŸÀÏ ÃʱâÈ
(setq sample (start_dialog))
(done_dialog)
(unload_dialog dcl_sample)
(prompt "\n By D.M.Z")
(princ)
) |
// SEDIT02.DCL
sample : dialog {
|
** Âü°í
value¸¦ ÀÌ¿ëÇؼ Edit_box¸¦ ÃʱâÈÇÏ´Â ¹æ¹ýº¸´Ù´Â set_tile¸¦ ÀÌ¿ëÇؼ
ÃʱâÈÇÏ´Â °ÍÀÌ ÇÁ·Î±×·¥À» ÇÏ´Ùº¸¸é ´õ Æí¸®ÇÕ´Ï´Ù.
ƯÈ÷, key°ª°ú ÀԷµǴ °ªÀÌ ÀúÀåµÇ´Â º¯¼ö¸íÀÌ ´Ù¸¦ °æ¿ì, ÇÁ·Î±×·¥À» ¹Ýº¹Çؼ
½ÇÇà½ÃÅ°¸é Àü´ÞµÇ´Â °ªÀÌ ¼·Î Ʋ¸± ¼öµµ ÀÖ½À´Ï´Ù.
¿¹¸¦ µé¾î ¼ýÀÚ¸¦ ÀԷ¹޴ Edit Box°¡ ÀÖÀ» ¶§, ½ÇÇàÇÒ ¶§¸¶´Ù LISPÀÇ º¯È¯
ÇÔ¼ö¸¦ ÀÌ¿ëÇؼ º¯È¯À» ÇÕ´Ï´Ù.
º¯È¯ÇÑ ÈÄ °è»ê, µµ¸é ÀÛ¼º¿¡ ÀÌ¿ëÇÏ°Ô µÇ´Âµ¥ ÇÁ·Î±×·¥ÀÌ Á¾·áµÉ ¶§ ¸Þ¸ð¸®¿¡¼
»èÁ¦µÇÁö ¾ÊÀ¸¸é LISP ÇÁ·Î±×·¥Àº °è¼ÓÇؼ º¯È¯ÇÏ·Á ÇÕ´Ï´Ù.
±×·¯³ª, µ¥ÀÌÅÍ Å¸ÀÔÀÌ ÀÏÄ¡ÇÏÁö ¾Ê±â ¶§¹®¿¡ ¿¡·¯°¡ ¹ß»ýÇÕ´Ï´Ù.
½±°Ô ¸»Çϸé, ÇÁ·Î±×·¥À» Çѹø ½ÇÇà½ÃÅ°¸é ¼ýÀÚ·Î ÀÌ·ç¾îÁø ¹®ÀÚ¿À» ¼ýÀÚ·Î
º¯È¯À» ÇÏ°Ô µË´Ï´Ù.
µÎ¹ø ÇÁ·Î±×·¥À» ½ÇÇà½ÃÅ°¸é, ù ¹ø°¿¡¼ ÀÌ¹Ì º¯È¯µÈ µ¥ÀÌÅ͸¦ ´Ù½Ã º¯È¯À»
½ÃÅ°·ÁÇϱ⠶§¹®¿¡ ¿¡·¯°¡ ¹ß»ýÇÏ°Ô µÇ´Â °ÍÀÔ´Ï´Ù.
µû¶ó¼, ÀÌ·¯ÇÑ ¿¡·¯ ¹ß»ýÀ» ÇÇÇÏ·Á¸é "value"¸¦ ÀÌ¿ëÇؼ ÃʱâÈÇÏ´Â
°Íº¸´Ù´Â "set_tile"¸¦ ÀÌ¿ëÇؼ ŸÀÏÀ» ÃʱâÈÇÏ´Â °ÍÀÌ È¿°úÀûÀÔ´Ï´Ù.
3. Mode_tile ¼³Á¤
; SEDIT.LSP
(defun c:sedit()
(prompt "\n Loaded.......")
(setq dcl_sample (load_dialog "c:/sedit02.dcl"))
(new_dialog "sample" dcl_sample)
(setq dbvalue "100") ;
ÃʱⰪ ¼³Á¤
(set_tile "db" dbvalue) ;
ŸÀÏ ÃʱâÈ
(mode_tile "db" 2)
(setq sample (start_dialog))
(done_dialog)
(unload_dialog dcl_sample)
(prompt "\n By D.M.Z")
(princ)
) |
// SEDIT02.DCL
sample : dialog {
|
4. Edit Box¿¡ ÀԷµǴ °ªÀ» ÀνÄ
Edit Box¿¡ ÀԷµǴ °ªÀ» ÀνÄ, ÀúÀåÇϱâ À§Çؼ´Â "action_tile"
ÇÔ¼ö¸¦ ÀÌ¿ëÇØ¾ß ÇÕ´Ï´Ù.
ÀÌ ÇÔ¼öÀÇ ±â´ÉÀº ŸÀÏÀ» ¼±ÅÃÇßÀ» ¶§ ±× ŸÀÏÀÇ ±â´ÉÀ» Á¤ÀÇÇÏ´Â °ÍÀÔ´Ï´Ù.
ÀÚ¼¼ÇÑ °ÍÀº "´ëÈ »óÀÚ Á¦¾î-2"¸¦ ÂüÁ¶Çϼ¼¿ä.
À§ÀÇ ¿¹Á¦ ÇÁ·Î±×·¥ "sedit02.dcl"ÀÇ edit_box¿¡ ÀԷµǴ °ªÀ»
ÀνÄ, ÀúÀåÇϱâ À§Çؼ´Â ´ÙÀ½°ú °°ÀÌ ÇØ¾ß ÇÕ´Ï´Ù.
edit_boxÀÇ key-nameÀÌ "db"ÀÔ´Ï´Ù.
action_tileÀ» edit_box¿¡ ÁöÁ¤ÇÑ ¿¹
(action_tile "db"
"(Expression)") |
Edit Box¿¡ ÀԷµǴ °ªÀ» º¯¼ö¿¡ ÀúÀåÇÏ´Â ¿¹
(action_tile "db"
"(setq Variable $value)") |
ÀԷµǴ °ªÀ» »ç¿ëÀÚ°¡ ÁöÁ¤ÇÑ º¯¼ö(dbvalue)¿¡ ÀúÀåÇÏ´Â
¿¹
(action_tile "db"
"(setq dbvalue $value)") |
¿¹Á¦ ÇÁ·Î±×·¥)
; SEDIT.LSP
(defun c:sedit()
(prompt "\n Loaded.......")
(setq dcl_sample (load_dialog "c:/sedit02.dcl"))
(new_dialog "sample" dcl_sample)
(setq dbvalue "100")
(set_tile "db" dbvalue)
(mode_tile "db" 2)
(action_tile "db" "(setq
dbvalue $value)")
(setq sample (start_dialog))
(done_dialog)
(unload_dialog dcl_sample)
(prompt "\n By D.M.Z")
(princ)
) |
// SEDIT02.DCL
sample : dialog {
|
5. ¹®ÀÚ¸¦ ÀÔ·Â ¹Þ´Â °æ¿ì
6. ¼ýÀÚ¸¦ ÀÔ·Â ¹Þ´Â °æ¿ì
´ÙÀ½ ¿¹Á¦´Â ¼ýÀÚ¸¦ ÀԷ¹޾Ƽ ȸ鿡 Ãâ·ÂÇÏ°í, ÀÔ·ÂÇÑ ¼ýÀÚÀÇ Áö¸§À»
°®´Â ¿øÀ» ±×¸®´Â ¿¹Á¦ÀÔ´Ï´Ù.
; SEDIT.LSP
(defun c:sedit()
(prompt "\n Loaded.......")
(setq dcl_sample (load_dialog "c:/sedit02.dcl"))
(new_dialog "sample" dcl_sample)
(setq dbvalue "100") ;
ÃʱⰪ ¼³Á¤
(set_tile "db" dbvalue) ;
ŸÀÏ ÃʱâÈ
(mode_tile "db" 2)
; ŸÀÏ ¼±Åýà À̺¥Æ®
(action_tile "db" "(setq
dbvalue $value)")
(setq sample (start_dialog))
; OK ¶Ç´Â Cancel À̺¥Æ® ¼³Á¤
(if (= sample 1)
; OK ¼±Åýà À̺¥Æ®
(progn
)
; Calcel ¼±Åýà À̺¥Æ®
(prompt "\n CancelÀ» ¼±ÅÃÇß½À´Ï´Ù.")
)
(done_dialog)
(unload_dialog dcl_sample)
(prompt "\n By D.M.Z")
(princ)
)
(defun ok_sample_func()
(setq dbvalue (atoi dbvalue))
; Á¤¼ö¸¦ ÀÔ·Â ¹Þ´Â °æ¿ì
; (setq dbvalue (atof value))
; ½Ç¼ö¸¦ ÀԷ¹ÞÀ» °æ¿ì
; ÀԷ¹ÞÀº ¼ýÀÚ¸¦ ÀÌ¿ëÇؼ °è»ê ¶Ç´Â ÁÂÇ¥¸¦
¼³Á¤
; Çϱâ À§Çؼ´Â AutoLISPÀÇ º¯È ÇÔ¼ö¸¦ ÀÌ¿ëÇؾß
; ÇÕ´Ï´Ù. ** º¯È¯ ÇÔ¼ö ÂüÁ¶
(setq rvalue (/ dbvalue 2))
(setq point00 (list 100 100))
(command "circle" point00 rvalue)
) |
// SEDIT02.DCL
sample : dialog {
|
Command: (load "c:/sp")
OK_SAMPLE_FUNC
Command: sedit
Loaded.......circle 3P/2P/TTR/<Center
point>
: Diameter/<Radius> <100.0000>: 150
Command:
ÀÔ·ÂÇÑ ¼ýÀÚ´Â300ÀÔ´Ï´Ù.
By D.M.Z
Command: sedit
Loaded.......
CancelÀ» ¼±ÅÃÇß½À´Ï´Ù.
By D.M.Z
|
7. ¼ýÀÚ, ¹®ÀÚ¸¦ ±¸º°Çؼ ¹Þ´Â °æ¿ì
|
(defun c:candn()
(prompt "\n Loaded.......")
(setq dcl_id (load_dialog "c:/candn.dcl"))
(new_dialog "candn" dcl_id)
(setq cn "¼ýÀÚ ¶Ç´Â ¹®ÀÚ¿À» ÀÔ·ÂÇϼ¼¿ä.")
(set_tile "cn" cn)
(mode_tile "cn" 2)
(action_tile "cn" "(setq cn
$value)")
(setq candn (start_dialog))
(if (= candn 1) (ok_func) (prompt "\n
Ãë¼ÒÇß½À´Ï´Ù."))
(done_dialog)
(unload_dialog dcl_id)
(prompt "\n By D.M.Z")
(princ)
)
(defun ok_func(/ b a cnl cnc point out)
(setq b 0)
(setq a 1)
(setq cnl (strlen cn))
(while (<= a cnl)
)
(if (= b 1) (setq out "Character")(setq
out "Number"))
(setq point (list 100 100))
(setvar "textsize" 10)
(command "erase" "all"
"")
(command "text" point ""
"" out)
)
|
8. Æ÷Ä¿½º À̵¿
9. ÆÄÀÏÀ» ÀÌ¿ëÇÑ ÃʱâÈ
10. Edit Box¿¡ ÀԷµǴ °ªÀ» Text·Î Ç¥½Ã
ÃÖÃÊ ÀÛ¼ºÀÏ 2000.01.08 |
ÃÖÁ¾ ¼öÁ¤ÀÏ 2006.06.28 |
|