gsc Posted November 19, 2020 Posted November 19, 2020 Hi, I have a sub function which executes a (vla-boolean A acIntersection B) command for 2 Regions. I only want to check with this function if the 2 Region are intersecting or not (something like T or Nil) And delete the regions afterwards (or can that be done by only checking?) How do I do that? (defun reg_intersect ( ss / reg_lst ent ) (setq num 0) (repeat (sslength ss) (setq ent (ssname ss num)) (if (= (cdr (assoc 0 (entget ent))) "REGION") (progn (setq reg_lst (cons (vlax-ename->vla-object ent) reg_lst)) ) ) (setq num (1+ num)) ) (vla-boolean (car reg_lst) acIntersection (cadr reg_lst)) ) ;;Note: there are always 2 Regions in my selection set Quote
marko_ribar Posted November 19, 2020 Posted November 19, 2020 (edited) All that crosses my mind is that you can check area of resulting region after boolean... If area of resulting region is smaller or equal than smaller (by area) reference region before boolean, then it's T otherwise it's nil... Edited November 19, 2020 by marko_ribar Quote
Roy_043 Posted November 19, 2020 Posted November 19, 2020 You might try using vla-intersectwith. Quote
marko_ribar Posted November 19, 2020 Posted November 19, 2020 23 minutes ago, Roy_043 said: You might try using vla-intersectwith. Although I think that this metod is available and for REGION entities, in my experience I think that it's not properly implemented for REGIONS... Still I may be misteking, further checking is needed... In BricsCAD I don't quite know for this, you may be right Roy... Quote
Tharwat Posted November 19, 2020 Posted November 19, 2020 Maybe the fastest way is to check for the last entity before invoking the method then check after all if the same entity still the same or changed. Quote
Lee Mac Posted November 19, 2020 Posted November 19, 2020 Perhaps something like this? (defun reginter-p ( rg1 rg2 / rtn tr1 tr2 ) (setq tr1 (vla-copy rg1) tr2 (vla-copy rg2) ) (vla-boolean tr1 acunion tr2) (setq rtn (< (vla-get-area tr1) (+ (vla-get-area rg1) (vla-get-area rg2)))) (vla-delete tr1) rtn ) 1 Quote
yjtdkj Posted June 23, 2021 Posted June 23, 2021 On 11/20/2020 at 6:02 AM, Lee Mac said: Perhaps something like this? (defun reginter-p ( rg1 rg2 / rtn tr1 tr2 ) (setq tr1 (vla-copy rg1) tr2 (vla-copy rg2) ) (vla-boolean tr1 acunion tr2) (setq rtn (< (vla-get-area tr1) (+ (vla-get-area rg1) (vla-get-area rg2)))) (vla-delete tr1) rtn ) thank , this is i whant code Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.