明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 615|回复: 0

[提问] 各位大侠,如何把这个改编下,可以吧填充的文字面积标注到图纸上

[复制链接]
发表于 2020-8-28 09:30:14 | 显示全部楼层 |阅读模式
选择多个填充可以分别标注到每个填充的中心上去

(vl-load-com)
(defun c:tcx (/ thisdrawing modelspace cset hname area ll na)
  (setq        thisdrawing (vla-get-activedocument (vlax-get-acad-object))
        modelspace  (vla-get-modelspace thisdrawing)
  )
  (if (not (vl-catch-all-error-p
             (setq cset
                    (vl-catch-all-apply
                      'vla-item
                      (list
                        (vla-get-selectionsets
                          thisdrawing
                        )
                        "CURRENT"
                      )
                    )
             )
           )
      )
    (vla-delete cset)
  )
  (if (ssget '((0 . "hatch")))
    (progn
      (vlax-for        obj (vla-get-activeselectionset thisdrawing)
        (setq hname (vla-get-patternname obj)
              area  (/ (vl-catch-all-apply ' vla-get-area (list obj) ) 1000000)
        )
        (if (= (type area) 'REAL)
          (if ll
            (if        (setq na (assoc hname ll))
              (setq ll (subst (list hname (+ area (cadr na))) na ll))
              (setq ll (cons (list hname area) ll))
            )
            (setq ll (cons (list hname area) ll))
          )
          (progn
            (vla-put-color obj acred)
            (vla-highlight obj actrue)
          )
        )
      )
    )
  )
  (princ ll)
  (princ)
)

"觉得好,就打赏"
还没有人打赏,支持一下
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-17 20:38 , Processed in 0.159837 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表