Jump to content

Lisp to detect clashes between polylines and circles


Recommended Posts

Posted

Hello everyone,

 

i am asking if there is a lisp that could detect any clashes between blue polylines and magenta polylines and circles. If there is a clash blue polylines can change color to yellow for example just to be highlighted. You can fined the following screenshots as a reference and also dwg file attached.

 

Thanks in advancenew block.dwg

 

image.thumb.png.d0a30bfed9180e46ee20ca4d5dae3e22.png

Posted

Are blue LINE(s) or POLYLINE(s)?

If LINE(s), it's simple, but if not, then also account that magenta rectangles would change to yellow...

Posted
1 minute ago, marko_ribar said:

Are blue LINE(s) or POLYLINE(s)?

If LINE(s), it's simple, but if not, then also account that magenta rectangles would change to yellow...

the blue are actually polylines, anyway if the magenta would change to yellow no problem, but the magenta rectangles or circles should change to yellow

Posted
(defun c:foo ( / ss i el e1x e2x )

  (vl-load-com)

  (if (setq ss (ssget "_A" (list (cons 0 "*POLYLINE,CIRCLE"))))
    (repeat (setq i (sslength ss))
      (setq el (cons (ssname ss (setq i (1- i))) el))
    )
  )
  (foreach e1 el
    (setq el (vl-remove e1 el))
    (foreach e2 el
      (if (vlax-invoke (vlax-ename->vla-object e1) (quote intersectwith) (vlax-ename->vla-object e2) acextendnone)
        (progn
          (entupd (cdr (assoc -1 (entmod (subst (cons 2 62) (assoc 62 (setq e1x (entget e1))) e1x)))))
          (entupd (cdr (assoc -1 (entmod (subst (cons 2 62) (assoc 62 (setq e2x (entget e2))) e2x)))))
        )
      )
    )
  )
  (princ)
)

 

Untested, though, but should work...

HTH.

M.R.

Posted
2 minutes ago, marko_ribar said:
(defun c:foo ( / ss i el e1x e2x )

  (vl-load-com)

  (if (setq ss (ssget "_A" (list (cons 0 "*POLYLINE,CIRCLE"))))
    (repeat (setq i (sslength ss))
      (setq el (cons (ssname ss (setq i (1- i))) el))
    )
  )
  (foreach e1 el
    (setq el (vl-remove e1 el))
    (foreach e2 el
      (if (vlax-invoke (vlax-ename->vla-object e1) (quote intersectwith) (vlax-ename->vla-object e2) acextendnone)
        (progn
          (entupd (cdr (assoc -1 (entmod (subst (cons 2 62) (assoc 62 (setq e1x (entget e1))) e1x)))))
          (entupd (cdr (assoc -1 (entmod (subst (cons 2 62) (assoc 62 (setq e2x (entget e2))) e2x)))))
        )
      )
    )
  )
  (princ)
)

 

Untested, though, but should work...

HTH.

M.R.

Thank you for your work, but i tried it and it does nothing at all

Posted

Maybe objects don't touch, for ex. - different elevations, but from TOP view they clash...

Posted
5 minutes ago, marko_ribar said:

Maybe objects don't touch, for ex. - different elevations, but from TOP view they clash...

i made flatten to all objects, still nothing happens

Posted
1 minute ago, noyajr said:

i made flatten to all objects, still nothing happens

 

I have no further conclusions... I strongly believe that the code is good, but in your comments I see that it's not what's expected...

So long from me...

M.R.

Posted
4 hours ago, marko_ribar said:

 

I have no further conclusions... I strongly believe that the code is good, but in your comments I see that it's not what's expected...

So long from me...

M.R.

No worries, thanks for your help

Posted

An alternative is to use (ssget "F" points where the points are the polyline points it will find any object that touches say the blue pline, only gotcha is must check for the blue pline in the selection set returned and disregard. Will try to find something.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...