[英]AutoCAD plug-ins for labeling
我需要單獨標記許多塊。 在 AutoCAD 中是否有可能編寫一個代碼來找到每個單獨的塊並在上面寫一個標簽?
在 LISP 中你可以試試這個:
(vl-load-com)
(defun GetThisDrawing ( / )
(vla-get-activedocument (vlax-get-acad-object) )
)
(defun GetActivespace ( / space )
(setq space (if (zerop (vla-get-activespace (GetThisDrawing)))
(if (= (vla-get-mspace (GetThisDrawing)) :vlax-true)
(vla-get-modelspace (GetThisDrawing))
(vla-get-paperspace (GetThisDrawing)))
(vla-get-modelspace (GetThisDrawing))) )
)
(defun C:MarkBlock ( / BlockName filter blocks sl i % Position msg label )
(setq BlockName "name_of_your_block")
(setq filter (list (cons 0 "INSERT") (cons 2 BlockName) ))
(setq blocks (ssget "X" filter) )
(setq sl (sslength blocks))
(setq i 0)
(repeat sl
(setq % (vlax-ename->vla-object(ssname blocks i) ))
(vlax-get-property % 'InsertionPoint )
(setq Position (vlax-get-property % 'InsertionPoint ) )
(setq msg (vlax-get-property % 'Name ) )
(setq label (vlax-invoke-method (GetActivespace) 'AddMText Position 0 msg ) )
(setq i (1+ i ) )
)
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.