明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 390|回复: 0

[提问] 快速建块(属性块)

[复制链接]
发表于 2024-4-30 11:07 | 显示全部楼层 |阅读模式
1明经币
请问怎么将选中的多个text快速建成一个属性块,即先将选中的text定义属性,然后合并成一个block。这是从别的帖子找到的可以将单个文本转为属性,怎么修改可以一次转多个文本然后将其合并成一个block。


;;; ;; 文本转属性txtatt Define the top-level function for the command "txtatt"
(defun c:tt1 (/ ent)
  (if (setq ent (entsel "\nSelect text entity: "))  ; Prompt user to select an entity
    (txt2att (car ent)) ; Call the core function with the selected entity
    (prompt "No entity was selected.")
  )
)
;;; Define the core function that converts a text entity to an attribute definition
(defun txt2att (ent / entdxf newdxf malst tem)
  (setq entdxf (entget ent)
        newdxf '((0 . "ATTDEF"))
        newdxf (append
                 newdxf
                 (list
                   (cons 1 (cdr (assoc 1 entdxf)))
                   (cons 2 (cdr (assoc 1 entdxf)))
                   (cons 3 (cdr (assoc 1 entdxf)))
                   (cons 70 0)
                 )
               )
        malst  (list 7 8 10 11 39 40 41 50 51 62 71 72 73)
  )
  (foreach mai malst
    (setq tem (assoc mai entdxf))
    (if (/= tem nil)
      (setq newdxf (append newdxf (list tem)))
    )
  )
  (entdel ent)
  (entmake newdxf)
)


您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-6-17 18:24 , Processed in 0.123644 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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