乐筑天下

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

[编程交流] 动态块和脚本

[复制链接]

18

主题

78

帖子

61

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
90
发表于 2022-7-6 06:57:37 | 显示全部楼层 |阅读模式
嗨,我试图创建一个脚本,将删除所有类型的动态块。我可以使用快速选择和按名称筛选来完成本手册。
但是我不能用我在脚本中使用的ssx命令来实现这一点
 
所以我想我有两个问题:
[列表=1]
  • 您可以在脚本中使用quickselect吗?
  • quickselect如何按名称确定这些块?
    [/列表]
  • 回复

    使用道具 举报

    YZ

    27

    主题

    232

    帖子

    205

    银币

    初露锋芒

    Rank: 3Rank: 3Rank: 3

    铜币
    135
    发表于 2022-7-6 07:10:40 | 显示全部楼层
    您可以在脚本中使用QSELECT命令,但它会弹出一个对话框。
     
    由于某些原因,该命令没有-QSELECT替代选项来将其抑制到命令行。因此,很难为其自动生成脚本。
     
    这个论坛上有人之前建议我尝试使用过滤器,但我还没有时间验证它是否有效。
    回复

    使用道具 举报

    18

    主题

    78

    帖子

    61

    银币

    初露锋芒

    Rank: 3Rank: 3Rank: 3

    铜币
    90
    发表于 2022-7-6 07:19:07 | 显示全部楼层
    嗨YZ
    我已经找到了解决问题的方法,但遗憾的是,没有办法自动进行QSELECT或筛选。
    为了删除所有的实际动态块,我混合使用了lisp和script。
     
    Lisp DDSS(动态块选择集)
    1. ;SORCED [url]http://forums.augi.com/archive/index.php/t-31578.html[/url]
    2. ;17/11/2011
    3. ;posted by irneb ;at 2007-12-07, 01:11 PM ;on [url]http://forums.augi.com/archive/index.php/t-31578.html[/url]
    4. ;modified RCondon 17/11/2011
    5. (defun c:DBSS (/ name ss namelist n en ed eo sslist)
    6. ;; Ask user for block's effective name
    7. (if (not (setq name (getstring "Enter the block's effective name: ")))
    8. (quit)
    9. ) ;_ end of if
    10. ;; Search through blocks for anonymous referring to this effective name
    11. (setq namelist (list name) ;Initialize names list with normal block's name
    12. ss (ssget "x" '((0 . "INSERT") (2 . "`**"))) ;Get all anonymous blocks in drawing
    13. n 0 ;Initialize counter
    14. ) ;_ end of setq
    15. ;; Step through selection set
    16. (while (< n (sslength ss))
    17. ;; Get nth entity in selection set + it's data
    18. (setq en (ssname ss n)
    19. ed (entget en)
    20. ) ;_ end of setq
    21. ;; Check if it isn't an unchanged dynamic block & that it hasn't been added to the list already
    22. (if (and
    23. (/= name (cdr (assoc 2 ed)))
    24. (not (member (strcat "`" (cdr (assoc 2 ed))) namelist))
    25. ) ;_ end of and
    26. (progn
    27. ;; Get the entity's object handle
    28. (setq eo (vlax-ename->vla-object en))
    29. ;; Check if effective name is the same
    30. (if (= name (vlax-get-property eo 'EffectiveName))
    31. ;; Add the anonymous block's name with reverse appostrophe prefix
    32. (setq namelist (cons (strcat "`" (cdr (assoc 2 ed))) namelist))
    33. ) ;_ end of if
    34. ) ;_ end of progn
    35. ) ;_ end of if
    36. (setq n (1+ n))
    37. ) ;_ end of while
    38. ;; Clear selection set & clear memory
    39. (setq ss nil)
    40. (gc)
    41. ;; Construct the selection filter list in reverse order
    42. (setq sslist '((-4 . "<OR") (0 . "INSERT"))
    43. n 0
    44. ) ;_ end of setq
    45. ;; Step through the list of names
    46. (while (< n (length namelist))
    47. ;; Add the name to the filter list
    48. (setq sslist (cons (vl-list* 2 (nth n namelist)) sslist))
    49. (setq n (1+ n))
    50. ) ;_ end of while
    51. ;; End the filter list's OR section
    52. (setq sslist (cons '(-4 . "OR>") sslist))
    53. ;; Reverse the list to get it in the correct order
    54. (setq sslist (reverse sslist))
    55. ) ;_ end of defun

    运行lisp所需的脚本
    1. (load "DBSS.lsp")
    2. DBSS
    3. TAG_PAV
    4. _.erase P
    回复

    使用道具 举报

    18

    主题

    78

    帖子

    61

    银币

    初露锋芒

    Rank: 3Rank: 3Rank: 3

    铜币
    90
    发表于 2022-7-6 07:31:49 | 显示全部楼层
    我最近升级到2012年,这个lisp不起作用
    它选择所有块,而不是过滤,而是名称。
     
    有人能帮我修改吗
    回复

    使用道具 举报

    YZ

    27

    主题

    232

    帖子

    205

    银币

    初露锋芒

    Rank: 3Rank: 3Rank: 3

    铜币
    135
    发表于 2022-7-6 07:36:27 | 显示全部楼层
    既然您使用的是lisp而不是脚本,那么在lisp论坛中可能会更好。
    回复

    使用道具 举报

    18

    主题

    78

    帖子

    61

    银币

    初露锋芒

    Rank: 3Rank: 3Rank: 3

    铜币
    90
    发表于 2022-7-6 07:42:10 | 显示全部楼层
    有没有办法移动这个帖子,或者我需要发布一个新的帖子
    回复

    使用道具 举报

    YZ

    27

    主题

    232

    帖子

    205

    银币

    初露锋芒

    Rank: 3Rank: 3Rank: 3

    铜币
    135
    发表于 2022-7-6 07:56:49 | 显示全部楼层
    我不知道如何移动它。我经常看到主持人代表我们这样做。但如果你没有收到任何消息,那么我会说复制并粘贴到该论坛的新帖子中。
    回复

    使用道具 举报

    4

    主题

    2143

    帖子

    2197

    银币

    限制会员

    铜币
    -24
    发表于 2022-7-6 07:58:19 | 显示全部楼层
    将您的线程重新定位到AutoLISP、Visual LISP和DCL论坛。
    回复

    使用道具 举报

    发表回复

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

    本版积分规则

    • 微信公众平台

    • 扫描访问手机版

    • 点击图片下载手机App

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

    GMT+8, 2025-3-10 10:09 , Processed in 1.177553 second(s), 68 queries .

    © 2020-2025 乐筑天下

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