Jump to content

DCL

Mình có cái Lisp như thế này:


Cho e hỏi làm sao để sau khi chọn nút Pick thì nó lại hiện lên bảng chọn tiếp!!!

Cách dùng

  1. Tải tệp 138858_test.lsp về máy.
  2. 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ẽ.
  3. Gõ lệnh TEST để chạy lisp.

Mã nguồn 138858_test.lsp

;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/38151-h%E1%BB%8Fidcl/
(defun c:test ()
(setq dcl_id (load_dialog "test1.dcl"))
 ;;;--- Load the dialog definition if it is not already loaded
 (if (not (new_dialog "TEST1" dcl_id ))
   (progn
	(alert "The TEST1.DCL file could not be loaded!")
     (exit)
   )
 )
	;;;--- If an action event occurs, do this function
 (action_tile "pick" "(setq ddiag 1)(done_dialog)")
 (action_tile "cancel" "(setq ddiag 2)(done_dialog)")
 (start_dialog)
 (unload_dialog dcl_id)
 ;;;--- If the user pressed the PICK button
 (if(= ddiag 1)
   (Pick)
 )
 ;;;--- If the user pressed the Cancel button
 (if(= ddiag 2)
   (princ "\nCancelled!")
 )
 (princ)
)
(defun Pick(); Pick chon blok
 (setq	maublk (car (entsel "\nChon Block khung ten: "))
 )
)

Thảo luận gốc

Lisp được chia sẻ trong chủ đề [Hỏi]DCL. Xem đúng bài viết #138858 để đọc hướng dẫn và trao đổi thêm.

Về Thư viện AutoLisp (trang 61)