乐筑天下

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

[编程交流] Help-overlap problem

[复制链接]

12

主题

56

帖子

46

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
58
发表于 2022-7-5 22:05:13 | 显示全部楼层 |阅读模式
I know how to use "overlap" in Autocad & I already readed a theme
(Help - Select duplicate entities) but it still can't solve my problem.
Is any lisp that can select overlapping block & entities(line&pline&circle) and put all overlapping entities in other layer at the same time?
example-try to select red entities and put them in other layer at the same time.
example.dwg
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 22:17:10 | 显示全部楼层
 
i think your drawing objects not overlap in same position actually (there 2 different blocks)
maybe you can try command: qselect ?
then filter by layers, color etc..
回复

使用道具 举报

12

主题

56

帖子

46

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
58
发表于 2022-7-5 22:20:30 | 显示全部楼层
Dear hanhphuc-- Thanks for your reply, actually I have a design and need use many different blocks inside but how can I find overlapping different blocks?
(I just put 2 different blocks in my example actually I need to put over 10 different blocks in my design and it real very different find overlapping different blocks:oops:)
 
example1.dwg
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 22:25:04 | 显示全部楼层
did you try command: overkill ?
 
though you can try qselect filter by Name,
this is isolate method which by fitering block name, you still have to manually test due to i'm not sure which type block you want to keep or erase
 
command: test
;invoke program then
pick any reference block entity, it will hide the matched name blocks.
the leftover maybe the overlaps. *mark with red circle (optional).
 
  1. (defun c:test1 (/ e e1 i typ ss [color="gray"]vs[/color]) [color="gray"] (setq vs '(nil (/ (getvar 'viewsize) (cadr (getvar 'screensize)))))[/color] ; *optional (if (and (setq e (entsel "\nSelect reference block.. "))   (setq e    (car e)         typ (cdr (assoc 2 (entget e)))         ss   (ssget ":L" (list '(0 . "INSERT")));(cons 2 name)         ) ;_ end of setq   ) ;_ end of and   (repeat (setq i (sslength ss))     (setq e1 (ssname ss (setq i (1- i))))     (if (equal typ (cdr (assoc 2 (entget e1))) )(redraw e1 2)[color="red"](redraw e1 3)[/color]  ;comment this if entmake circle [color="gray"];;;        (entmake (list '(0 . "CIRCLE")  ;*optional;;;                       '(8 . "highlight");;;                        '(62 . 1);;;                       (cons 40 (* (vs) 5.));;;                       (cons 10 (cdr (assoc 10 (entget e1))));;;                       ) ;_ end of list;;;                 ) ;_ end of entmake[/color]) ;_ end of if     ) ;_ end of repeat   ) ;_ end of if (princ) ) ;_ end of defun
step by step , repeat to test the leftover...
 
command: regen ;to restore hidden blocks
HTH
回复

使用道具 举报

12

主题

56

帖子

46

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
58
发表于 2022-7-5 22:30:53 | 显示全部楼层
Dear hanhphuc,
Thanks, overkill can't use for block.
Pls have a review the example2. There are many blocks in my DWG.
I want all blocks but there are two blocks overlapping(just like pink area)
how can I find this overlapping in this drawing quickly?
Please advise me, thanks thanks thanks:cry:
 
example2.dwg
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-5 22:38:57 | 显示全部楼层
I hope that hanhphuc won't mind if I posted my attempt .
 
Be careful that this may delete the other block and not the required one and that's why I gave the user the chance to select blocks to see the changes clearly .
 
  1. (defun c:Test (/ s) ;;  Tharwat 28.11.2014    ;; (if (setq s (ssget "_:L" '((0 . "INSERT"))))   ((lambda (x / a b ss i _sn sn)      (while (setq _sn (ssname s (setq x (1+ x))))        (vla-getboundingbox (vlax-ename->vla-object _sn) 'a 'b)        (if (setq ss (ssget "_C"                            (vlax-safearray->list a)                            (vlax-safearray->list b)                            '((0 . "INSERT"))                     )            )          (repeat (setq i (sslength ss))            (if (not (eq (setq sn (ssname ss (setq i (1- i)))) _sn))              (entdel _sn)            )          )        )      )    )     -1   ) ) (princ))(vl-load-com)
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 22:45:46 | 显示全部楼层
 
Just a normal filter for insertion points then hide if not overlap,
ie: the rest visible blocks are considered "overlap" ,you decide yourself to erase manually.
 
command: ubi
  1. ;unique block insertion;hide if insertion points are unique(defun c:ubi ( / e ss lst l)(setq ss  (ssget ":L" (list '(0 . "INSERT"))))(setq lst (acet-ss-to-list ss) )(while lst(setq l (cons (setq e (car lst)) l) lst (cdr lst)lst (vl-remove-if ''((x)(equal (cdr(assoc 10 (entget e ))) (cdr(assoc 10 (entget x) )) 1e-3)) lst)) )(foreach x l (redraw x 2))  (princ))
use this as genaral filter,
then use Tharwat's finer tune or the previous post#4
回复

使用道具 举报

12

主题

56

帖子

46

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
58
发表于 2022-7-5 22:52:08 | 显示全部楼层
Dear Tharwat,
Thanks a lot!!
 
回复

使用道具 举报

12

主题

56

帖子

46

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
58
发表于 2022-7-5 22:53:21 | 显示全部楼层
Dear hanhphuc,
Thank you for your help!!
 
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-5 23:02:56 | 显示全部楼层
 
You're welcome .
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-11 06:11 , Processed in 0.831969 second(s), 72 queries .

© 2020-2025 乐筑天下

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