乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 43|回复: 0

[编程交流] 将文本样式更改为注释性

[复制链接]

1

主题

1

帖子

0

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 16:09:38 | 显示全部楼层 |阅读模式
大家好,
 
我的公司希望更改以前非注释性文字样式的属性,使其具有注释性。样式更改将在所有新项目的公司模板中设置,但这显然不会影响任何现有文件。我正试图写一些代码,包括在我们的阿卡多克。lsp文件,因此它将对打开的任何文档进行此更改。
 
  1. ;;; change KARPL text style to annotative if it exists in a drawing
  2. ;; get style object if it exists
  3. (setq styleobj (tblsearch "STYLE" "KARPL"))
  4. (if (= styleobj nil)
  5. (prompt "\nKARPL does not exist.")
  6. )
  7. ;;if it does exist
  8. (if (/= styleobj nil)
  9. ;;get style entity name
  10. (setq stylename (tblobjname "STYLE" "KARPL"))
  11. ;;get xdata for entity
  12. (setq annotx (cadr (assoc -3 (entget stylename '("AcadAnnotative")))))
  13. ;;get value of second 1070 dxf code
  14. (setq bAnnotative (cdr (nth 4 annotx)))
  15. ;;if either there is no xdata or the second 1070 code is 0, the style is not annotative
  16. (if (OR (= annotx nil) (=bAnnotative 0))
  17.         ;;write correct xdata
  18.         (setq exdata '((-3 ("AcadAnnotative" (1000 . "AnnotativeData") (1002 . "{") (1070 . 1) (1070 . 1) (1002 . "}")))))
  19.         (setq styleobj (subst exdata (assoc -3 styleobj)))
  20.         ;;set text height to 1/16"
  21.         (setq styleobj (subst (cons 40 0.0625) (assoc 40 styleobj) styleobj))
  22.         ;;modify styleobject
  23.         (entmod styleobj)
  24. )
  25. (princ);_ end if
  26. )

 
我不知道如何将更正的扩展数据和新的文本高度写回样式实体。其他一切似乎都起作用了。
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-13 20:06 , Processed in 0.832219 second(s), 56 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表