Tập hợp một số hàm entmake object
Năm mới chúc các Bác nhiều sức khỏe và Diễn đàn ngày một phát triển hơn!
Nhờ các Bác xem giúp đoạn code sau, mục đích của đoạn code là tạo 1 attribute nhưng vẫn chưa chạy được?
;;;;;;;;MAIN;;;;;;;;;
(defun C:1att (/ p0 G00 G90 LL)
(setq G00 0.0
G90 (* pi 0.5))
(setq p0 (getpoint "\nChon dien chen Attribute: "))
(setq LL '("111" "222" "333"))
(Make_att LL "standard" "0" p0 3.0 G00 1)
(princ)
)
(Princ "\nStart command with <1att>")
;;;;; Ham con tao att
(defun Make_att (LIST_ATT STYLE LAYER POINT HEIGHT ANG COLOR); Ang: Radial
(entmake (list (cons 0 "ATTDEF")
(cons 100 "AcDbEntity")
(cons 7 (if STYLE STYLE (getvar "TextSTYLE")))
(cons 8 (if LAYER LAYER (getvar "CLAYER")))
(cons 100 "AcDbText")
(cons 100 "AcDbAttributeDefinition")
(cons 10 POINT)
(cons 11 POINT)
(cons 40 HEIGHT)
(if ANG (cons 50 ANG))
(cons 62 (if COLOR COLOR 256))
(cons 1 (nth 0 LIST_ATT)) ; Default value (string)
(cons 2 (nth 1 LIST_ATT)) ; Tag (string and can not contain spaces)
(cons 3 (nth 2 LIST_ATT)) ; Prompt (string)
);end list
);entmake
);end defun
Nhờ các Bác xem giúp đoạn code sau, mục đích của đoạn code là tạo 1 attribute nhưng vẫn chưa chạy được?
;;;;;;;;MAIN;;;;;;;;;
(defun C:1att (/ p0 G00 G90 LL)
(setq G00 0.0
G90 (* pi 0.5))
(setq p0 (getpoint "\nChon dien chen Attribute: "))
(setq LL '("111" "222" "333"))
(Make_att LL "standard" "0" p0 3.0 G00 1)
(princ)
)
(Princ "\nStart command with <1att>")
;;;;; Ham con tao att
(defun Make_att (LIST_ATT STYLE LAYER POINT HEIGHT ANG COLOR); Ang: Radial
(entmake (list (cons 0 "ATTDEF")
(cons 100 "AcDbEntity")
(cons 7 (if STYLE STYLE (getvar "TextSTYLE")))
(cons 8 (if LAYER LAYER (getvar "CLAYER")))
(cons 100 "AcDbText")
(cons 100 "AcDbAttributeDefinition")
(cons 10 POINT)
(cons 11 POINT)
(cons 40 HEIGHT)
(if ANG (cons 50 ANG))
(cons 62 (if COLOR COLOR 256))
(cons 1 (nth 0 LIST_ATT)) ; Default value (string)
(cons 2 (nth 1 LIST_ATT)) ; Tag (string and can not contain spaces)
(cons 3 (nth 2 LIST_ATT)) ; Prompt (string)
);end list
);entmake
);end defun
- Tải lisp
- 226626_1att.lsp
Cách dùng
- Tải tệp 226626_1att.lsp về máy.
- 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 1ATT để chạy lisp.
Mã nguồn 226626_1att.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/52258-th%C6%B0-vi%E1%BB%87n-t%E1%BA%ADp-h%E1%BB%A3p-m%E1%BB%99t-s%E1%BB%91-h%C3%A0m-entmake-object/?tab=comments#comment-164947
;;;;;;;;MAIN;;;;;;;;;
(defun C:1att (/ p0 G00 G90 LL)
(setq G00 0.0
G90 (* pi 0.5))
(setq p0 (getpoint "\nChon dien chen Attribute: "))
(setq LL '("111" "222" "333"))
(Make_att LL "standard" "0" p0 3.0 G00 1)
(princ)
)
(Princ "\nStart command with <1att>")
;;;;; Ham con tao att
(defun Make_att (LIST_ATT STYLE LAYER POINT HEIGHT ANG COLOR); Ang: Radial
(entmake (list (cons 0 "ATTDEF")
(cons 100 "AcDbEntity")
(cons 7 (if STYLE STYLE (getvar "TextSTYLE")))
(cons 8 (if LAYER LAYER (getvar "CLAYER")))
(cons 100 "AcDbText")
(cons 100 "AcDbAttributeDefinition")
(cons 10 POINT)
(cons 11 POINT)
(cons 40 HEIGHT)
(if ANG (cons 50 ANG))
(cons 62 (if COLOR COLOR 256))
(cons 1 (nth 0 LIST_ATT)) ; Default value (string)
(cons 2 (nth 1 LIST_ATT)) ; Tag (string and can not contain spaces)
(cons 3 (nth 2 LIST_ATT)) ; Prompt (string)
);end list
);entmake
);end defun
Thảo luận gốc
Lisp được chia sẻ trong chủ đề [Thư Viện] Tập hợp một số hàm entmake object. Xem đúng bài viết #226626 để đọc hướng dẫn và trao đổi thêm.