乐筑天下

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

用另一个具有属性的块替换块

[复制链接]

1

主题

3

帖子

1

银币

初来乍到

Rank: 1

铜币
7
发表于 2012-1-24 15:03:52 | 显示全部楼层 |阅读模式
你好!
有没有办法用另一个块替换一个块并传输新属性,而无需同步?我想保留现有属性的位置...同步会将属性放回原始方向......
提前谢谢...

本帖以下内容被隐藏保护;需要你回复后,才能看到!

游客,如果您要查看本帖隐藏内容请回复
回复

使用道具 举报

58

主题

3353

帖子

33

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1761
发表于 2012-1-24 16:58:09 | 显示全部楼层
新块是否具有与旧块相同的属性和标签?如果是这样,我认为您可以重新定义块。
回复

使用道具 举报

36

主题

621

帖子

2

银币

中流砥柱

Rank: 25

铜币
765
发表于 2012-1-24 19:42:30 | 显示全部楼层
回答得好。
回复

使用道具 举报

7

主题

131

帖子

5

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
157
发表于 2012-1-24 21:24:27 | 显示全部楼层
请从这里尝试这一项:
http://forums . Autodesk . com/t5/Visual-LISP-AutoLISP-and-General/imredoms/TD-p/806704/page/2

  1. REPLACE.LSP - (Block Replace) - (c) 1990 Richard D. Howard
  2. all rights reserved - no warranty, express or implied
  3. The included files may be used and copied for non-profit
  4. purposes only. If you wish to include any of the files in a
  5. commercial program, contact the author.
  6. ---------------
  7. REPLACE, replaces selected blocks with a specified block,
  8. retaining all of the original properties. REPLACE handles blocks
  9. with attribute data correctly, and can optionally allow entry of
  10. new attributes at runtime. This makes REPLACE ideal for updating
  11. blocks whose definition has changed (AutoCAD does not updates the
  12. attributes in such instances). When replacing attributes, REPLACE
  13. actually erases the old block and substitutes the new one
  14. retaining as much of the former data as possible. The two fields
  15. that are definately modified are "entity name", and "handle
  16. number" (because the block really is new). If you require these
  17. to remain the same, don't use REPLACE. If no attributes are
  18. present, REPLACE simply updates the name attached to the original
  19. block insert. This retains ALL the inserts data, including the
  20. entity name and handle.

回复

使用道具 举报

1

主题

3

帖子

1

银币

初来乍到

Rank: 1

铜币
7
发表于 2012-1-25 12:59:27 | 显示全部楼层
不,帖子中的lisp是由Richard D. Howard撰写的,如果名称相同,将保留属性
回复

使用道具 举报

7

主题

131

帖子

5

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
157
发表于 2012-1-25 13:13:17 | 显示全部楼层
好久不见了,魔咒!欢迎回来陌生人。
回复

使用道具 举报

194

主题

592

帖子

11

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1380
发表于 2012-1-25 13:15:25 | 显示全部楼层
今天早些时候我试着发帖,但没能到沼泽地…很高兴看到它又开始工作了
我可能没有正确理解,但express工具也做了同样的事情。如果新块具有额外属性,而我替换了旧块,则信息传输很好,但需要重新定义块以显示额外属性。这会导致块及其属性失去其位置…我必须重新定位所有东西,对我来说,超过1000个块,每个块有6个属性…啊!如果我能把它简化为只需移动一个属性,那将是非常棒的….
你好,马克!谢谢很高兴回来。你能把我原始账户的密码发给我吗verticalmojo@gmail? 似乎当我尝试重置时,它会将其发送到@Swarm。org电子邮件,我以前用过,我不确定它是否存在,如果存在,我也不知道如何进入它。不用急,只要你有机会…谢谢!
回复

使用道具 举报

1

主题

3

帖子

1

银币

初来乍到

Rank: 1

铜币
7
发表于 2012-1-25 18:21:29 | 显示全部楼层
不是最漂亮的东西,但试一试。请记住,这只会查看插入点,并尝试将它们放置在找到的原始位置。
玩得开心
  1. (defun c:attsync2 (/ _name _gettatts _lst atts e name ss)
  2.   (defun _lst (ss / e n out)
  3.     (setq n -1)
  4.     (if        (= (type ss) 'pickset)
  5.       (while (setq e (ssname ss (setq n (1+ n)))) (setq out (cons (vlax-ename->vla-object e) out)))
  6.     )
  7.   )
  8.   (defun _attpositions (block / att result)
  9.     (foreach att (vlax-invoke block 'getattributes)
  10.       (setq result (cons (list (vla-get-handle att)
  11.                                (vlax-get att 'insertionpoint)
  12.                                (vlax-get att 'textalignmentpoint)
  13.                          )
  14.                          result
  15.                    )
  16.       )
  17.     )
  18.   )
  19.   (defun _name (b)
  20.     (cond ((vlax-property-available-p b 'effectivename) (vla-get-effectivename b))
  21.           ((vlax-property-available-p b 'name) (vla-get-name b))
  22.     )
  23.   )
  24.   (if (and (setq e (car (entsel "\nSelect block to sync: ")))
  25.            (setq name (_name (vlax-ename->vla-object e)))
  26.            (setq ss (ssget "_x" (list (cons 0 "insert"))))
  27.       )
  28.     (progn (foreach x (_lst ss) (and (eq (_name x) name) (setq atts (cons (_attpositions x) atts))))
  29.            (command "._attsync" "_s" e "_yes")
  30.            (foreach x (apply 'append atts)
  31.              (if (and (setq e (handent (car x))) (setq e (vlax-ename->vla-object e)))
  32.                (progn (vl-catch-all-apply 'vlax-put (list e 'insertionpoint (cadr x)))
  33.                       (vl-catch-all-apply 'vlax-put (list e 'textalignmentpoint (caddr x)))
  34.                )
  35.              )
  36.            )
  37.     )
  38.   )
  39.   (princ)
  40. )

回复

使用道具 举报

58

主题

3353

帖子

33

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1761
发表于 2012-1-25 19:35:37 | 显示全部楼层

你是正确的,我的错误,我误解了你的要求。
回复

使用道具 举报

7

主题

131

帖子

5

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
157
发表于 2012-1-26 01:13:17 | 显示全部楼层

试试看。
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-12 01:07 , Processed in 0.631939 second(s), 72 queries .

© 2020-2025 乐筑天下

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