Jump to content

Recommended Posts

Posted

Hello all,

 

i am looking for a way to detect undershoots and overshoots between all polylines in a drawing.

Now i found the intersection functions of @Lee Mac.

I made the code below, and works fine... but...

 

When polylines are FAR apart from eachother, there also detected and marked...

Is there a simple fix, so the 'intersection' is limited to max 0.50 m, so only small gaps are detected?

 

			(setq ss (ssget "_X" (list (cons 410 "Model") (cons 0 "LINE,LWPOLYLINE,ARC"))))
			(if ss
				(progn
					(setq i 0)
					(repeat (sslength ss)
						(setq ensel1 (ssname ss i))
						(setq ii 0)
						(repeat (sslength ss)
							(setq ensel2 (ssname ss ii))

							(foreach pnt (LM:intersections (vlax-ename->vla-object ensel1) (vlax-ename->vla-object ensel2) acextendotherentity)
								(entmakex (list (cons 0 "CIRCLE") 
									(cons 10 pnt) 
									(cons 40 1)  ; Circle size
									(cons 62 3))
								)
							)
							
							(setq ii (+ 1 ii))
						)

						(setq i (+ 1 i))
					)
				)
			)

;;--------------------------------------------;;
;;--------------------------------------------;;

(defun LM:intersections ( ob1 ob2 mod / lst rtn )
    (if (and (vlax-method-applicable-p ob1 'intersectwith)
             (vlax-method-applicable-p ob2 'intersectwith)
             (setq lst (vlax-invoke ob1 'intersectwith ob2 mod))
        )
        (repeat (/ (length lst) 3)
            (setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn)
                  lst (cdddr lst)
            )
        )
    )
    (reverse rtn)
)

 

Posted

You would need to iterate over the resulting intersections and exclude/ignore those which exceed your desired distance from the source entity.

Posted

Hi all,

 

Found the mising link:

 

(setq newPt (vlax-curve-getClosestPointTo obj pnt))

 

this allowed me to do the check between the point and the original entity. Thanks for the direction @Lee Mac

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...