Lisp lệnh 00 trong chủ đề “Hỏi về Lisp (thuật toán, ý tưởng, coding,...)”
Chào các bác! Em đang viết DCL nhưng đang bị vướng bởi nút thắt này. Em muốn tích vào các toggle thì nó là Yes và không tích là No mà nó cứ sai hoài! Mong các bác chỉ dùm. Cảm ơn các bác nhiều!
(vl-load-com)
(defun C:00 (/ ANSDC ANSKCDC ANSKH ANSMSS CAOCHU_TD CAOCHU_TN DCH DCL DES KCDAUCO KC_COT KC_HANG MSS0 MSS_TD PATH_NTD SOCOTMC TLD1 TLD1_TN TLN1 TLN1_TN USEBUTTON WIDTHMD)
(defun *error* (msg)
(if (= 'file (type des))
(close des)
)
(if (and (= 'int (type dch)) (< 0 dch))
(unload_dialog dch)
)
(if (and (= 'str (type dcl)) (findfile dcl))
(vl-file-delete dcl)
)
(if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")))
(princ (strcat "\nError: " msg))
)
(princ)
)
(command "-style" "Times New Roman" "Times New Roman" 0 1 0 "" "")
(Create_dialog_VETD_VETN)
(setq dch (load_dialog dcl))
(end_list)
(setq Path_ntd "")
(action_tile
"InputFile"
(vl-prin1-to-string
(quote (if (setq Path_ntd (getfiled "Select Input File"
(getvar "dwgprefix")
"ntd;*"
16
)
)
(set_tile "box_Input" Path_ntd)
)
)
)
)
;;;;;;;;;;;;;;;;PHAN TRAC DOC;;;;;;;;;;;;;;;;;;;;;;;;;
(action_tile "box_TLD1" "(setq TLD1 (get_tile \"box_TLD1\"))")
(setq TLD1 (get_tile "box_TLD1"))
(action_tile "box_TLN1" "(setq TLN1 (get_tile \"box_TLN1\"))")
(setq TLN1 (get_tile "box_TLN1"))
(action_tile "box_CC1" "(setq Caochu_TD (get_tile \"box_CC1\"))")
(setq Caochu_TD (get_tile "box_CC1"))
(action_tile "box_MSS1" "(setq MSS_TD (get_tile \"box_MSS1\"))")
(setq MSS_TD (get_tile "box_MSS1"))
(action_tile
"VETRACDOC"
(strcat
"(done_dialog)(setq UseButton 1))"
)
)
;;;;;;;;;;;;;;;;PHAN TRAC NGANG;;;;;;;;;;;;;;;;;;;;;;;;;
(Check_Toggle)
(action_tile "box_TLD2" "(setq TLD1_TN (get_tile \"box_TLD2\"))")
(setq TLD1_TN (get_tile "box_TLD2"))
(action_tile "box_TLN2" "(setq TLN1_TN (get_tile \"box_TLN2\"))")
(setq TLN1_TN (get_tile "box_TLN2"))
(action_tile "box_CC2" "(setq Caochu_TN (get_tile \"box_CC2\"))")
(setq Caochu_TN (get_tile "box_CC2"))
(action_tile "box_SC" "(setq SocotMC (get_tile \"box_SC\"))")
(setq SocotMC (get_tile "box_SC"))
(action_tile "box_KCC" "(setq KC_COT (get_tile \"box_KCC\"))")
(setq KC_COT (get_tile "box_KCC"))
(action_tile "box_KCH" "(setq KC_HANG (get_tile \"box_KCH\"))")
(setq KC_HANG (get_tile "box_KCH"))
;;;TOGGLE
(action_tile "toggle_KCDC" "(Check_Toggle)(setq tog_KCDC $value)")
;;; (setq tog_KCDC (get_tile "toggle_KCDC"))
(action_tile "toggle_MSS" "(Check_Toggle)(setq tog_MSS_TN $value)")
;;; (setq tog_MSS_TN (get_tile "toggle_MSS"))
(action_tile "toggle_KH" "(Check_Toggle)(setq tog_KH $value)")
;;; (setq tog_KH (get_tile "toggle_KH"))
(action_tile "toggle_DC" "(Check_Toggle)(setq tog_DC $value)")
;;; (setq tog_DC (get_tile "toggle_DC"))
;;;;;;KHOANG CACH DAU CO TU DONG
(if (= tog_KCDC "1")
(progn
(setq ansKCDC "Yes")
(setq KCDauCo "0")
)
(progn
(setq ansKCDC "No")
(action_tile "box_KCDC" "(setq KCDauCo (get_tile \"box_KCDC\"))")
(setq KCDauCo (get_tile "box_KCDC"))
)
)
;;;;;;MUC SO SANH TU DONG
(if (= tog_MSS_TN "1")
(progn
(setq ansMSS "Yes")
(setq MSS0 "0")
)
(progn
(setq ansMSS "No")
(action_tile "box_MSS_TN" "(setq MSS0 (get_tile \"box_MSS_TN\"))")
(setq MSS0 (get_tile "box_MSS_TN"))
)
)
;;;;;;KY HIEU DIA VAT
(if (= tog_KH "1")
(setq ansKH "Yes")
(setq ansKH "No")
)
;;;;;MEP DUONG CU
(if (= tog_DC "1")
(progn
(setq ansDC "Yes")
;;; (action_tile "box_DC" "(setq WidthMD (get_tile \"box_DC\"))")
;;; (setq WidthMD (get_tile "box_DC"))
)
(progn
(setq ansDC "No")
(setq WidthMD "0")
)
)
(action_tile
"VETRACNGANG"
(strcat
"(done_dialog)(setq UseButton 2))"
)
)
(action_tile
"accept"
"(done_dialog)
(vl-file-delete dcl)"
)
(action_tile
"cancel"
"(done_dialog)
(vl-file-delete dcl)"
)
(start_dialog)
(unload_dialog dch)
(if (= UseButton 1)
(progn
(if (/= Path_ntd "")
(progn
(Func_VETD Path_ntd (atof TLD1) (atof TLN1) (atof Caochu_TD) (atof MSS_TD))
(done_dialog)
)
(Alert "B\U+1EA1n ch\U+01B0a ch\U+1ECDn file ntd!")
)
)
)
(if (= UseButton 2)
(progn
(if (/= Path_ntd "")
(progn
(prompt
(strcat
"\n"
"AnsKCDC: " ansKCDC
"\n"
"ansMSS : " ansMSS
"\n"
"AnsKH: " AnsKH
"\n"
"AnsDC : " AnsDC
"\n"
)
)
;;; (Func_VETN ansKH
;;; ansDC
;;; Path_ntd
;;; (atof WidthMD)
;;; ansMSS
;;; (atof MSS0)
;;; (atof TLD1_TN)
;;; (atof TLN1_TN)
;;; (atof Caochu_TN)
;;; (atof SocotMC)
;;; (atof KC_HANG)
;;; (atof KC_COT)
;;; ansKCDC
;;; (atof KCDauCo)
;;; )
(done_dialog)
)
(Alert "B\U+1EA1n ch\U+01B0a ch\U+1ECDn file ntd!")
)
)
)
(vl-file-delete dcl)
(princ)
)
(defun toggleSet ( k kL )
(foreach x kL (set_tile x "0")) (set_tile k "1") k
)
(defun Check_Toggle ()
(if (= (atoi (get_tile "toggle_MSS")) 1)
(progn
(mode_tile "box_MSS_TN" 2)
(mode_tile "Text_MSS" 1)
)
(progn
(mode_tile "box_MSS_TN" 0)
(mode_tile "Text_MSS" 0)
)
)
(if (= (atoi (get_tile "toggle_KCDC")) 1)
(progn
(mode_tile "box_KCDC" 2)
(mode_tile "Text_KCDC" 1)
)
(progn
(mode_tile "box_KCDC" 0)
(mode_tile "Text_KCDC" 0)
)
)
(if (= (atoi (get_tile "toggle_DC")) 1)
(progn
(mode_tile "box_DC" 0)
(mode_tile "Text_DC" 0)
)
(progn
(mode_tile "box_DC" 2)
(mode_tile "Text_DC" 1)
)
)
)
(defun Create_dialog_VETD_VETN ()
(setq dcl (vl-filename-mktemp nil nil ".dcl"))
(setq des (open dcl "w"))
(foreach x
'("temp : dialog"
"{"
"label = \"CH\U+01AF\U+01A0NG TRÌNH V\U+1EBC TR\U+1EAEC D\U+1ECCC - TR\U+1EAEC NGANG\";"
": text"
"{"
"label = \"Ng\U+01B0\U+1EDDi vi\U+1EBFt: Nguy\U+1EC5n Th\U+00E0nh Du\U+00E2n\";"
"alignment = centered;"
"}"
": text"
"{"
"label = \"Email: [email protected] - Mobile: 0972.0168.25\";"
"alignment = centered;"
"}"
"spacer;" "spacer;"
": boxed_column"
"{"
"label = \"Ch\U+1ECDn \U+0111\U+01B0\U+1EDDng d\U+1EABn\";"
"fixed_width = 10;"
"alignment = centered;"
"width = 20.0;"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"&File\";"
"fixed_width = true;"
"}"
": edit_box"
"{"
"key = \"box_Input\";"
"fixed_width = true;"
"width = 50.0;"
"}"
": button"
"{"
"label = \"Browse...\";"
"key = \"InputFile\";"
"is_default = false;"
"width = 15;" "fixed_width = true;"
"alignment = centered;"
"}"
"}"
"}"
": row"
"{"
": boxed_column"
"{"
"label = \" Tr\U+1EAFc D\U+1ECDc \";"
"fixed_width = 10;"
"alignment = centered;"
"width = 20.0;"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"T\U+1EF7 l\U+1EC7 \U+0111\U+1EE9ng 1 / \";"
"fixed_width = true;"
"}"
": edit_box"
"{"
"key = \"box_TLD1\";"
"fixed_width = true;"
"value = \"100\";"
"}"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"T\U+1EF7 l\U+1EC7 ngang 1 / \";"
"fixed_width = true;"
"}"
": edit_box"
"{"
"key = \"box_TLN1\";"
"fixed_width = true;"
"value = \"1000\";"
"}"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"Cao ch\U+1EEF \";"
"fixed_width = true;"
"}"
": edit_box"
"{"
"key = \"box_CC1\";"
"fixed_width = true;"
"value = \"2\";"
"}"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"M\U+1EE9c so s\U+00E1nh \";"
"fixed_width = true;"
"}"
": edit_box"
"{"
"key = \"box_MSS1\";"
"fixed_width = true;"
"value = \"0\";"
"}"
"}"
"spacer;" "spacer;" "spacer;" "spacer;"
": button"
"{"
"label = \" V\U+1EBD Tr\U+1EAFc D\U+1ECDc \";"
"key = \"VETRACDOC\";"
"is_default = false;"
"width = 15;" "fixed_width = true;"
"alignment = centered;"
"}"
"}"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
": row"
"{"
": boxed_column"
"{"
"label = \" Tr\U+1EAFc Ngang \";"
"fixed_width = 10;"
"width = 20.0;"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"T\U+1EF7 l\U+1EC7 \U+0111\U+1EE9ng 1 / \";"
"fixed_width = true;"
"alignment = left;"
"}"
": edit_box"
"{"
"key = \"box_TLD2\";"
"fixed_width = true;"
"value = \"200\";"
"}"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"T\U+1EF7 l\U+1EC7 ngang 1 / \";"
"fixed_width = true;"
"alignment = left;"
"}"
": edit_box"
"{"
"key = \"box_TLN2\";"
"fixed_width = true;"
"value = \"200\";"
"}"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"Cao ch\U+1EEF\";"
"fixed_width = true;"
"alignment = left;"
"}"
": edit_box"
"{"
"key = \"box_CC2\";"
"fixed_width = true;"
"value = \"0.4\";"
"}"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"S\U+1ED1 c\U+1ED9t\";"
"fixed_width = true;"
"alignment = left;"
"}"
": edit_box"
"{"
"key = \"box_SC\";"
"fixed_width = true;"
"value = \"10\";"
"}"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"Kho\U+1EA3ng c\U+00E1ch c\U+1ED9t\";"
"fixed_width = true;"
"alignment = left;"
"}"
": edit_box"
"{"
"key = \"box_KCC\";"
"fixed_width = true;"
"value = \"100\";"
"}"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"Kho\U+1EA3ng c\U+00E1ch h\U+00E0ng \";"
"fixed_width = true;"
"alignment = left;"
"}"
": edit_box"
"{"
"key = \"box_KCH\";"
"fixed_width = true;"
"value = \"100\";"
"}"
"}"
":toggle"
"{"
"alignment = centered ;"
"label = \"Auto kho\U+1EA3ng c\U+00E1ch \U+0111\U+1EA7u c\U+1EDD\" ;"
"key = \"toggle_KCDC\" ;"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"Kho\U+1EA3ng c\U+00E1ch \U+0111\U+1EA7u c\U+1EDD\";"
"fixed_width = true;"
"alignment = left;"
"key = \"Text_KCDC\";"
"}"
": edit_box"
"{"
"key = \"box_KCDC\";"
"value = \"20\";"
"fixed_width = true;"
"}"
"}"
":toggle"
"{"
"alignment = centered ;"
"label = \"So s\U+00E1nh t\U+1EF1 \U+0111\U+1ED9ng\" ;"
"key = \"toggle_MSS\" ;"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"Nh\U+1EADp m\U+1EE9c so s\U+00E1nh\";"
"fixed_width = true;"
"alignment = left;"
"key = \"Text_MSS\";"
"}"
": edit_box"
"{"
"key = \"box_MSS_TN\";"
"fixed_width = true;"
"value = \"0\";"
"}"
"}"
":toggle"
"{"
"alignment = centered ;"
"label = \"Ch\U+00E8n k\U+00FD hi\U+1EC7u l\U+00EAn Tr\U+1EAFc Ngang\" ;"
"key = \"toggle_KH\" ;"
"}"
":toggle"
"{"
"alignment = centered ;"
"label = \"V\U+1EBD l\U+1EDBp \U+0111\U+01B0\U+1EDDng c\U+0169\" ;"
"key = \"toggle_DC\" ;"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"Nh\U+1EADp \U+0111\U+1ED9 d\U+00E0y l\U+1EDBp \U+0111\U+01B0\U+1EDDng c\U+0169\";"
"fixed_width = true;"
"key = \"Text_DC\" ;"
"alignment = left;"
"}"
": edit_box"
"{"
"key = \"box_DC\";"
"fixed_width = true;"
"value = \"0.1\";"
"}"
"}"
"spacer;" "spacer;" "spacer;" "spacer;"
": button"
"{"
"label = \"V\U+1EBD Tr\U+1EAFc Ngang\";"
"key = \"VETRACNGANG\";"
"is_default = false;"
"width = 15;" "fixed_width = true;"
"alignment = centered;"
"}"
"}"
"}"
"}"
"spacer;" "spacer;" "spacer;"
"ok_cancel;"
"}"
)
(write-line x des)
)
(not (setq des (close des)))
(< 0 (setq dch (load_dialog dcl)))
(new_dialog "temp" dch)
)
Tệp .lsp gốc không còn trên máy chủ. Hãy chép mã nguồn bên dưới (lấy từ bài viết gốc) vào một tệp văn bản, lưu với đuôi .lsp.
Cách dùng
- Chép mã nguồn, lưu thành tệp 441984_00.lsp.
- Trong AutoCAD gõ lệnh APPLOAD, chọn tệp vừa tải rồi bấm Load. Cũng có thể kéo thả tệp .lsp vào cửa sổ bản vẽ.
- Gõ lệnh 00 để chạy lisp.
Mã nguồn 441984_00.lsp (trích từ bài viết gốc)
(vl-load-com)
(defun C:00 (/ ANSDC ANSKCDC ANSKH ANSMSS CAOCHU_TD CAOCHU_TN DCH DCL DES KCDAUCO KC_COT KC_HANG MSS0 MSS_TD PATH_NTD SOCOTMC TLD1 TLD1_TN TLN1 TLN1_TN USEBUTTON WIDTHMD)
(defun *error* (msg)
(if (= 'file (type des))
(close des)
)
(if (and (= 'int (type dch)) (< 0 dch))
(unload_dialog dch)
)
(if (and (= 'str (type dcl)) (findfile dcl))
(vl-file-delete dcl)
)
(if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")))
(princ (strcat "\nError: " msg))
)
(princ)
)
(command "-style" "Times New Roman" "Times New Roman" 0 1 0 "" "")
(Create_dialog_VETD_VETN)
(setq dch (load_dialog dcl))
(end_list)
(setq Path_ntd "")
(action_tile
"InputFile"
(vl-prin1-to-string
(quote (if (setq Path_ntd (getfiled "Select Input File"
(getvar "dwgprefix")
"ntd;*"
16
)
)
(set_tile "box_Input" Path_ntd)
)
)
)
)
;;;;;;;;;;;;;;;;PHAN TRAC DOC;;;;;;;;;;;;;;;;;;;;;;;;;
(action_tile "box_TLD1" "(setq TLD1 (get_tile \"box_TLD1\"))")
(setq TLD1 (get_tile "box_TLD1"))
(action_tile "box_TLN1" "(setq TLN1 (get_tile \"box_TLN1\"))")
(setq TLN1 (get_tile "box_TLN1"))
(action_tile "box_CC1" "(setq Caochu_TD (get_tile \"box_CC1\"))")
(setq Caochu_TD (get_tile "box_CC1"))
(action_tile "box_MSS1" "(setq MSS_TD (get_tile \"box_MSS1\"))")
(setq MSS_TD (get_tile "box_MSS1"))
(action_tile
"VETRACDOC"
(strcat
"(done_dialog)(setq UseButton 1))"
)
)
;;;;;;;;;;;;;;;;PHAN TRAC NGANG;;;;;;;;;;;;;;;;;;;;;;;;;
(Check_Toggle)
(action_tile "box_TLD2" "(setq TLD1_TN (get_tile \"box_TLD2\"))")
(setq TLD1_TN (get_tile "box_TLD2"))
(action_tile "box_TLN2" "(setq TLN1_TN (get_tile \"box_TLN2\"))")
(setq TLN1_TN (get_tile "box_TLN2"))
(action_tile "box_CC2" "(setq Caochu_TN (get_tile \"box_CC2\"))")
(setq Caochu_TN (get_tile "box_CC2"))
(action_tile "box_SC" "(setq SocotMC (get_tile \"box_SC\"))")
(setq SocotMC (get_tile "box_SC"))
(action_tile "box_KCC" "(setq KC_COT (get_tile \"box_KCC\"))")
(setq KC_COT (get_tile "box_KCC"))
(action_tile "box_KCH" "(setq KC_HANG (get_tile \"box_KCH\"))")
(setq KC_HANG (get_tile "box_KCH"))
;;;TOGGLE
(action_tile "toggle_KCDC" "(Check_Toggle)(setq tog_KCDC $value)")
;;; (setq tog_KCDC (get_tile "toggle_KCDC"))
(action_tile "toggle_MSS" "(Check_Toggle)(setq tog_MSS_TN $value)")
;;; (setq tog_MSS_TN (get_tile "toggle_MSS"))
(action_tile "toggle_KH" "(Check_Toggle)(setq tog_KH $value)")
;;; (setq tog_KH (get_tile "toggle_KH"))
(action_tile "toggle_DC" "(Check_Toggle)(setq tog_DC $value)")
;;; (setq tog_DC (get_tile "toggle_DC"))
;;;;;;KHOANG CACH DAU CO TU DONG
(if (= tog_KCDC "1")
(progn
(setq ansKCDC "Yes")
(setq KCDauCo "0")
)
(progn
(setq ansKCDC "No")
(action_tile "box_KCDC" "(setq KCDauCo (get_tile \"box_KCDC\"))")
(setq KCDauCo (get_tile "box_KCDC"))
)
)
;;;;;;MUC SO SANH TU DONG
(if (= tog_MSS_TN "1")
(progn
(setq ansMSS "Yes")
(setq MSS0 "0")
)
(progn
(setq ansMSS "No")
(action_tile "box_MSS_TN" "(setq MSS0 (get_tile \"box_MSS_TN\"))")
(setq MSS0 (get_tile "box_MSS_TN"))
)
)
;;;;;;KY HIEU DIA VAT
(if (= tog_KH "1")
(setq ansKH "Yes")
(setq ansKH "No")
)
;;;;;MEP DUONG CU
(if (= tog_DC "1")
(progn
(setq ansDC "Yes")
;;; (action_tile "box_DC" "(setq WidthMD (get_tile \"box_DC\"))")
;;; (setq WidthMD (get_tile "box_DC"))
)
(progn
(setq ansDC "No")
(setq WidthMD "0")
)
)
(action_tile
"VETRACNGANG"
(strcat
"(done_dialog)(setq UseButton 2))"
)
)
(action_tile
"accept"
"(done_dialog)
(vl-file-delete dcl)"
)
(action_tile
"cancel"
"(done_dialog)
(vl-file-delete dcl)"
)
(start_dialog)
(unload_dialog dch)
(if (= UseButton 1)
(progn
(if (/= Path_ntd "")
(progn
(Func_VETD Path_ntd (atof TLD1) (atof TLN1) (atof Caochu_TD) (atof MSS_TD))
(done_dialog)
)
(Alert "B\U+1EA1n ch\U+01B0a ch\U+1ECDn file ntd!")
)
)
)
(if (= UseButton 2)
(progn
(if (/= Path_ntd "")
(progn
(prompt
(strcat
"\n"
"AnsKCDC: " ansKCDC
"\n"
"ansMSS : " ansMSS
"\n"
"AnsKH: " AnsKH
"\n"
"AnsDC : " AnsDC
"\n"
)
)
;;; (Func_VETN ansKH
;;; ansDC
;;; Path_ntd
;;; (atof WidthMD)
;;; ansMSS
;;; (atof MSS0)
;;; (atof TLD1_TN)
;;; (atof TLN1_TN)
;;; (atof Caochu_TN)
;;; (atof SocotMC)
;;; (atof KC_HANG)
;;; (atof KC_COT)
;;; ansKCDC
;;; (atof KCDauCo)
;;; )
(done_dialog)
)
(Alert "B\U+1EA1n ch\U+01B0a ch\U+1ECDn file ntd!")
)
)
)
(vl-file-delete dcl)
(princ)
)
(defun toggleSet ( k kL )
(foreach x kL (set_tile x "0")) (set_tile k "1") k
)
(defun Check_Toggle ()
(if (= (atoi (get_tile "toggle_MSS")) 1)
(progn
(mode_tile "box_MSS_TN" 2)
(mode_tile "Text_MSS" 1)
)
(progn
(mode_tile "box_MSS_TN" 0)
(mode_tile "Text_MSS" 0)
)
)
(if (= (atoi (get_tile "toggle_KCDC")) 1)
(progn
(mode_tile "box_KCDC" 2)
(mode_tile "Text_KCDC" 1)
)
(progn
(mode_tile "box_KCDC" 0)
(mode_tile "Text_KCDC" 0)
)
)
(if (= (atoi (get_tile "toggle_DC")) 1)
(progn
(mode_tile "box_DC" 0)
(mode_tile "Text_DC" 0)
)
(progn
(mode_tile "box_DC" 2)
(mode_tile "Text_DC" 1)
)
)
)
(defun Create_dialog_VETD_VETN ()
(setq dcl (vl-filename-mktemp nil nil ".dcl"))
(setq des (open dcl "w"))
(foreach x
'("temp : dialog"
"{"
"label = \"CH\U+01AF\U+01A0NG TRÌNH V\U+1EBC TR\U+1EAEC D\U+1ECCC - TR\U+1EAEC NGANG\";"
": text"
"{"
"label = \"Ng\U+01B0\U+1EDDi vi\U+1EBFt: Nguy\U+1EC5n Th\U+00E0nh Du\U+00E2n\";"
"alignment = centered;"
"}"
": text"
"{"
"label = \"Email: [email protected] - Mobile: 0972.0168.25\";"
"alignment = centered;"
"}"
"spacer;" "spacer;"
": boxed_column"
"{"
"label = \"Ch\U+1ECDn \U+0111\U+01B0\U+1EDDng d\U+1EABn\";"
"fixed_width = 10;"
"alignment = centered;"
"width = 20.0;"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"&File\";"
"fixed_width = true;"
"}"
": edit_box"
"{"
"key = \"box_Input\";"
"fixed_width = true;"
"width = 50.0;"
"}"
": button"
"{"
"label = \"Browse...\";"
"key = \"InputFile\";"
"is_default = false;"
"width = 15;" "fixed_width = true;"
"alignment = centered;"
"}"
"}"
"}"
": row"
"{"
": boxed_column"
"{"
"label = \" Tr\U+1EAFc D\U+1ECDc \";"
"fixed_width = 10;"
"alignment = centered;"
"width = 20.0;"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"T\U+1EF7 l\U+1EC7 \U+0111\U+1EE9ng 1 / \";"
"fixed_width = true;"
"}"
": edit_box"
"{"
"key = \"box_TLD1\";"
"fixed_width = true;"
"value = \"100\";"
"}"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"T\U+1EF7 l\U+1EC7 ngang 1 / \";"
"fixed_width = true;"
"}"
": edit_box"
"{"
"key = \"box_TLN1\";"
"fixed_width = true;"
"value = \"1000\";"
"}"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"Cao ch\U+1EEF \";"
"fixed_width = true;"
"}"
": edit_box"
"{"
"key = \"box_CC1\";"
"fixed_width = true;"
"value = \"2\";"
"}"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"M\U+1EE9c so s\U+00E1nh \";"
"fixed_width = true;"
"}"
": edit_box"
"{"
"key = \"box_MSS1\";"
"fixed_width = true;"
"value = \"0\";"
"}"
"}"
"spacer;" "spacer;" "spacer;" "spacer;"
": button"
"{"
"label = \" V\U+1EBD Tr\U+1EAFc D\U+1ECDc \";"
"key = \"VETRACDOC\";"
"is_default = false;"
"width = 15;" "fixed_width = true;"
"alignment = centered;"
"}"
"}"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
": row"
"{"
": boxed_column"
"{"
"label = \" Tr\U+1EAFc Ngang \";"
"fixed_width = 10;"
"width = 20.0;"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"T\U+1EF7 l\U+1EC7 \U+0111\U+1EE9ng 1 / \";"
"fixed_width = true;"
"alignment = left;"
"}"
": edit_box"
"{"
"key = \"box_TLD2\";"
"fixed_width = true;"
"value = \"200\";"
"}"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"T\U+1EF7 l\U+1EC7 ngang 1 / \";"
"fixed_width = true;"
"alignment = left;"
"}"
": edit_box"
"{"
"key = \"box_TLN2\";"
"fixed_width = true;"
"value = \"200\";"
"}"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"Cao ch\U+1EEF\";"
"fixed_width = true;"
"alignment = left;"
"}"
": edit_box"
"{"
"key = \"box_CC2\";"
"fixed_width = true;"
"value = \"0.4\";"
"}"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"S\U+1ED1 c\U+1ED9t\";"
"fixed_width = true;"
"alignment = left;"
"}"
": edit_box"
"{"
"key = \"box_SC\";"
"fixed_width = true;"
"value = \"10\";"
"}"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"Kho\U+1EA3ng c\U+00E1ch c\U+1ED9t\";"
"fixed_width = true;"
"alignment = left;"
"}"
": edit_box"
"{"
"key = \"box_KCC\";"
"fixed_width = true;"
"value = \"100\";"
"}"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"Kho\U+1EA3ng c\U+00E1ch h\U+00E0ng \";"
"fixed_width = true;"
"alignment = left;"
"}"
": edit_box"
"{"
"key = \"box_KCH\";"
"fixed_width = true;"
"value = \"100\";"
"}"
"}"
":toggle"
"{"
"alignment = centered ;"
"label = \"Auto kho\U+1EA3ng c\U+00E1ch \U+0111\U+1EA7u c\U+1EDD\" ;"
"key = \"toggle_KCDC\" ;"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"Kho\U+1EA3ng c\U+00E1ch \U+0111\U+1EA7u c\U+1EDD\";"
"fixed_width = true;"
"alignment = left;"
"key = \"Text_KCDC\";"
"}"
": edit_box"
"{"
"key = \"box_KCDC\";"
"value = \"20\";"
"fixed_width = true;"
"}"
"}"
":toggle"
"{"
"alignment = centered ;"
"label = \"So s\U+00E1nh t\U+1EF1 \U+0111\U+1ED9ng\" ;"
"key = \"toggle_MSS\" ;"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"Nh\U+1EADp m\U+1EE9c so s\U+00E1nh\";"
"fixed_width = true;"
"alignment = left;"
"key = \"Text_MSS\";"
"}"
": edit_box"
"{"
"key = \"box_MSS_TN\";"
"fixed_width = true;"
"value = \"0\";"
"}"
"}"
":toggle"
"{"
"alignment = centered ;"
"label = \"Ch\U+00E8n k\U+00FD hi\U+1EC7u l\U+00EAn Tr\U+1EAFc Ngang\" ;"
"key = \"toggle_KH\" ;"
"}"
":toggle"
"{"
"alignment = centered ;"
"label = \"V\U+1EBD l\U+1EDBp \U+0111\U+01B0\U+1EDDng c\U+0169\" ;"
"key = \"toggle_DC\" ;"
"}"
": row"
"{"
"children_alignment = right;"
": text"
"{"
"label = \"Nh\U+1EADp \U+0111\U+1ED9 d\U+00E0y l\U+1EDBp \U+0111\U+01B0\U+1EDDng c\U+0169\";"
"fixed_width = true;"
"key = \"Text_DC\" ;"
"alignment = left;"
"}"
": edit_box"
"{"
"key = \"box_DC\";"
"fixed_width = true;"
"value = \"0.1\";"
"}"
"}"
"spacer;" "spacer;" "spacer;" "spacer;"
": button"
"{"
"label = \"V\U+1EBD Tr\U+1EAFc Ngang\";"
"key = \"VETRACNGANG\";"
"is_default = false;"
"width = 15;" "fixed_width = true;"
"alignment = centered;"
"}"
"}"
"}"
"}"
"spacer;" "spacer;" "spacer;"
"ok_cancel;"
"}"
)
(write-line x des)
)
(not (setq des (close des)))
(< 0 (setq dch (load_dialog dcl)))
(new_dialog "temp" dch)
)Thảo luận gốc
Lisp được chia sẻ trong chủ đề Hỏi về Lisp (thuật toán, ý tưởng, coding,...). Xem đúng bài viết #441984 để đọc hướng dẫn và trao đổi thêm.