乐筑天下

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

[编程交流] Forced delete (embedded) block

[复制链接]

13

主题

46

帖子

33

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
65
发表于 2022-7-6 09:46:45 | 显示全部楼层 |阅读模式
HELLO,
 
i`AM LOOKING FOR A LISP TO FORCE DELETE A (EMBEDDED)BLOCK FROM A DRAWING. SOMETHING LIKE LAYER DELETE.
 
THANKS
 
JAAP
回复

使用道具 举报

10

主题

8258

帖子

8335

银币

初来乍到

Rank: 1

铜币
31
发表于 2022-7-6 09:50:23 | 显示全部楼层
Purge command with Block option?
 
Are the blocks named or anonymous?
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-6 09:53:55 | 显示全部楼层
Check this out .....
 
  1. (defun c:test (/ ss ss1 e Blks) ; Tharwat 17. 02. 2011 (if (and (setq ss (ssget "_+.:S" '((0 . "INSERT"))))        (setq ss1 (ssname ss 0))            (setq e (entget ss1))        )   (progn     (setq Blks (ssget "_x" (list '(0 . "INSERT")                      (cons 2 (cdr (assoc 2 e))))))          (command "_.Erase" Blks "")    )      (princ)   ) (princ) )
 
Tharwat
回复

使用道具 举报

13

主题

46

帖子

33

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
65
发表于 2022-7-6 09:56:27 | 显示全部楼层
NO, IS NOT WORKING. WHEN I GIVE THE COMMAND "TEST". IT ASKS TO SELECT.-->
NOTHING IS DONE. AUTOCAD COMES BACK WITH: Command: TEST Unknown command "TEST".  Press F1 for help.
 
 
 
WORKING WITH AUTOCAD ELECTRICAL 2010
 
JAAP
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-6 10:02:00 | 显示全部楼层
On the contrary , It does the job quickly .
 
But with your Electrical version of Cad which is I have no idea if would except Lisp or not though .
回复

使用道具 举报

14

主题

719

帖子

706

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
70
发表于 2022-7-6 10:05:03 | 显示全部楼层
 
Sounds like you haven't loaded the lisp correctly, see these instructions.
 
Also, please stop with the caps, being shout at is not fun.
回复

使用道具 举报

44

主题

3166

帖子

2803

银币

中流砥柱

Rank: 25

铜币
557
发表于 2022-7-6 10:08:10 | 显示全部楼层
You may want to reconsider this line:
 
 
 
For fun, here's another option:
 
  1. (defun c:FOO  (/ *acadDoc* eName ss blockItem) (vl-load-com) (vla-startundomark   (setq *acadDoc*          (vla-get-activedocument (vlax-get-acad-object)))) (if (and (setq eName (car (entsel "\nSelect the Block You Wish to Delete: ")))          (setq ss (ssget "_x" (list '(0 . "INSERT") (assoc 2 (entget eName))))))   (progn     (vlax-for x  (setq ss (vla-get-activeselectionset *acadDoc*))       (cond (blockItem)             ((setq blockItem (vla-item (vla-get-blocks *acadDoc*)                                        (vla-get-effectivename x)))))       (vla-delete x))     (vla-delete blockItem)     (vla-delete ss))) (vla-endundomark *acadDoc*) (princ))
 
Option #2 will also remove the block reference from the blocks collection.
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 10:09:52 | 显示全部楼层
Always cracks me up when I see that.
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-6 10:13:46 | 显示全部楼层
Hello Renderman .
 
I guess that the following two lines are the same according to the use of them .
 
  1. (cons 2 (cdr (assoc 2 e)))(assoc 2 e)
 
But for the situation of building the search filtering list , the cons might be better than  (assoc 2 e) What you think ?
回复

使用道具 举报

44

主题

3166

帖子

2803

银币

中流砥柱

Rank: 25

铜币
557
发表于 2022-7-6 10:16:22 | 显示全部楼层
 
You'll laugh, I always try to say it nicely... because I know there's one coming around the corner, pointed at me.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-7 00:38 , Processed in 0.452410 second(s), 72 queries .

© 2020-2025 乐筑天下

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