Entmod đối với điểm chèn của đối tượng Text
Hì hì. Tại em biết ít hàm vl- quá nên phải làm thủ công bác ạ.
Bác có thể cho em xin 1 ít kiến thức về Vl- Vlax...ko ạ?
Em thích nó lắm nhưng mò mẫm hơi lâu.
ví dụ dùng vl :
(defun c:TVG(/ Obj ss );;;;TEXT VUONG GOC
(if (and (setq obj (vlax-ename->vla-object (car (entsel "\nChon Line hoac Polyline:"))))
(not(prompt "\nChon text:"))
(setq ss (ssget '((0 . "TEXT")))) )
(vlax-for e (vla-get-activeSelectionSet (vla-get-ActiveDocument(vlax-get-acad-object)))
(if (equal (vlax-safearray->list (variant-value (vla-get-TextAlignmentPoint e))) '(0.0 0.0 0.0) 0.001)
(vla-put-InsertionPoint e (vlax-3d-point (vlax-curve-getClosestPointTo obj
(vlax-safearray->list (variant-value (vla-get-InsertionPoint e))) T)))
(vla-put-TextAlignmentPoint e (vlax-3d-point (vlax-curve-getClosestPointTo obj
(vlax-safearray->list (variant-value (vla-get-TextAlignmentPoint e))) T))) ) )))
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 309133_tvg.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 TVG để chạy lisp.
Mã nguồn 309133_tvg.lsp (trích từ bài viết gốc)
(defun c:TVG(/ Obj ss );;;;TEXT VUONG GOC
(if (and (setq obj (vlax-ename->vla-object (car (entsel "\nChon Line hoac Polyline:"))))
(not(prompt "\nChon text:"))
(setq ss (ssget '((0 . "TEXT")))) )
(vlax-for e (vla-get-activeSelectionSet (vla-get-ActiveDocument(vlax-get-acad-object)))
(if (equal (vlax-safearray->list (variant-value (vla-get-TextAlignmentPoint e))) '(0.0 0.0 0.0) 0.001)
(vla-put-InsertionPoint e (vlax-3d-point (vlax-curve-getClosestPointTo obj
(vlax-safearray->list (variant-value (vla-get-InsertionPoint e))) T)))
(vla-put-TextAlignmentPoint e (vlax-3d-point (vlax-curve-getClosestPointTo obj
(vlax-safearray->list (variant-value (vla-get-TextAlignmentPoint e))) T))) ) )))Thảo luận gốc
Lisp được chia sẻ trong chủ đề [Tư vấn] Entmod đối với điểm chèn của đối tượng Text. Xem đúng bài viết #309133 để đọc hướng dẫn và trao đổi thêm.