Jump to content

Tập hợp một số hàm entmake object

Trích dẫn help:

70

Attribute flags:

1 = Attribute is invisible (does not appear)

2 = This is a constant attribute

4 = Verification is required on input of this attribute

8 = Attribute is preset (no prompt during insertion)

Tôi test OK.

;;;;;;;;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 1)

 (princ)
)
(Princ "\nStart command with <1att>")
;;;;; Ham con tao att
(defun Make_att (LIST_ATT STYLE LAYER POINT HEIGHT ANG COLOR FLAG); 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 70 FLAG)

 	(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

Không biết sao nữa! Tôi test thử vẫn không hiện ra được attribute cần tạo!!??

Cách dùng

  1. Tải tệp 226657_1att.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 1ATT để chạy lisp.

Mã nguồn 226657_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 1)

 (princ)
)
(Princ "\nStart command with <1att>")
;;;;; Ham con tao att
(defun Make_att (LIST_ATT STYLE LAYER POINT HEIGHT ANG COLOR FLAG); 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 70 FLAG)

 	(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 #226657 để đọc hướng dẫn và trao đổi thêm.

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