明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1499|回复: 3

[提问] 求块替换文字

[复制链接]
发表于 2015-5-2 00:39 | 显示全部楼层 |阅读模式
求块替换文字






本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2015-8-11 21:18 | 显示全部楼层
风流少年时 发表于 2015-8-11 20:43
要删除圆圈,得到钢筋线坐标算出长度,然后写字。看楼组的发帖数量感觉应该能完成啊。

你可以看他发的帖子,每一篇前面都有个求字.
回复 支持 1 反对 0

使用道具 举报

发表于 2015-8-11 20:43 | 显示全部楼层
要删除圆圈,得到钢筋线坐标算出长度,然后写字。看楼组的发帖数量感觉应该能完成啊。
发表于 2021-8-4 12:51 | 显示全部楼层
  1. ;;liviu_dova@yahoo.com
  2. ;;;https://forums.augi.com/showthre ... g-Text-With-A-Block
  3. ;;;2020-10-10, 06:59 PM
  4. ;;;LiDo
  5. (vl-load-com)
  6. (DEFUN C:tt1 (/ *error* $Name bName EgEnt ENT lsBlN)
  7.   (defun *error* (s)
  8.     (or (wcmatch (strcase s) "*BREAK,*CANCEL*,*EXIT*") (prompt (strcat "\nError: " s)))
  9.     (princ)
  10.   ) ;;*error*
  11. ;List of block names
  12.   (vlax-for
  13.      itm
  14.     (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
  15.     (if (and
  16.           (vlax-property-available-p itm "Name")
  17.           (/= (substr (setq $Name (vla-get-name itm)) 1 1) "*")
  18.         )
  19.       (setq lsBlN (cons $Name lsBlN))
  20.     )
  21.   )
  22.   (if lsBlN
  23.     (progn
  24.       (princ "\n选择替换的图块:")
  25.       (setq ent (entsel))
  26.       (setq vobj (Vlax-Ename->Vla-Object (car ent)))
  27.       (setq bname (vla-get-name vobj))
  28.       
  29. ;;Choose the block
  30. ;;;      (while (not bName)
  31. ;;;        (setq bName (getstring T "\nEnter block name or [?]: "))
  32. ;;;        (cond
  33. ;;;          ( (= bName "?")
  34. ;;;            (textscr)
  35. ;;;            (prompt "\nDefined blocks:")
  36. ;;;            (foreach el lsBlN (prompt (strcat "\n" el)))
  37. ;;;            (prompt "\nClick or Press any key to continue...")
  38. ;;;            (vl-catch-all-apply (function grread) (list nil 14 0))
  39. ;;;            (setq bName (graphscr))
  40. ;;;          )
  41. ;;;          ( (= bName "")
  42. ;;;            (setq bName nil)
  43. ;;;          )
  44. ;;;          ( (and bName  (not (vl-position (strcase bName) (mapcar (function strcase) lsBlN))))
  45. ;;;            (setq bName (prompt (strcat "\nCould not find block name \"" bName "\".")))
  46. ;;;          )
  47. ;;;          (T nil)
  48. ;;;        )
  49. ;;;      )
  50. ;;Choose the text and replace it with the choosed block.
  51.       (while  (and  (setq ENT (car (entsel "\nSelect the text to be replaced: ")))
  52.                     (= (cdr (assoc 0 (setq EgEnt (entget ENT)))) "TEXT")
  53.               )
  54.         (if (= (logand 4 (cdr (assoc 70 (entget (tblobjname "LAYER" (cdr (assoc 8 EgEnt))))))) 0) ;;Layer not locked
  55.           (progn
  56.             (entdel ENT)
  57.             (entmake
  58.               (list
  59.                 (quote (0 . "INSERT"))
  60.                 (quote (100 . "AcDbEntity"))
  61.                 (cons 67  (cdr (assoc 67  EgEnt)))
  62.                 (cons 410 (cdr (assoc 410 EgEnt)))
  63.                 (cons 8   (cdr (assoc 8   EgEnt)))
  64.                 (quote (100 . "AcDbBlockReference"))
  65.                 (cons 2 bName)
  66.                 (cons 10 (cdr (assoc 10 EgEnt)))
  67.                 (cons 50 (cdr (assoc 50 EgEnt)))
  68.               )
  69.             )
  70.           )
  71.           (prompt "\nText is on a locked layer.")
  72.         )
  73.       )
  74.     )
  75.     (prompt "\nNo block definitions in the drawing.")
  76.   )
  77.   (princ)
  78. ) ;;REP-TXBK

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

本版积分规则

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

GMT+8, 2024-4-25 23:35 , Processed in 0.566628 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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