Jump to content

Recommended Posts

Posted

Hi All,

 

Back again with new query. Please help or guide me through.

Any autolisp or visual lisp command which filters object closest to selected polyline.

Basically i have an xyz file, i want to filter points from file very close to selected polyline.

Please reply if need more explanation.

 

Thanks in advance.

Regards

Aaryan.

Posted

I can not write a whole routine since I don't know the format of the source file.

Try this

;p - a point (x y z)
;e - polyline ename
;d - control distance
(<= (distance p (vlax-curve-GetClosestPointTo e p)) d)

Posted

If your post is related to this, here is a quick modification:

(defun C:TEST ( / cross_prod ss1 ss2 e1 e2 p1 p2 i v tg d)
 (defun cross_prod (a b)
 (list (- (* (cadr a) (caddr b)) (* (caddr a) (cadr b)))
   (- (* (caddr a) (car b)) (* (car a) (caddr b)))
   (- (* (car a) (cadr b)) (* (cadr a) (car b)))
   )
 )
 (if
   (and
     (princ "\nSelect polyline: ")
     (setq ss1 (ssget ":E:S" '((0 . "LWPOLYLINE,SPLINE"))))
     (princ "\nSelect circles: ")
     (setq ss2 (ssget '((0 . "CIRCLE"))))
     (setq d (getdist "\nEnter gap distance: "))
     )
   (progn
     (setq e1 (ssname ss1 0))
     (repeat (setq i (sslength ss2))
       (setq e2 (ssname ss2 (setq i (1- i)))
             p2 (cdr (assoc 10 (entget e2)))
             p1 (vlax-curve-GetClosestPointTo e1 p2)
             v (mapcar '- p1 p2)
             tg (vlax-curve-GetFirstDeriv e1 (vlax-curve-GetParamAtPoint e1 p1))
             )
       (if (<= (distance p1 p2) d)
         (vla-put-Color (vlax-ename->vla-object e2) (if (minusp (caddr (cross_prod v tg))) acRed acYellow))
         )
       )
     )
   )
 (princ)
 )

Posted

Thank You So much Stefan..

This is what i was looking for.

One last question can i do it from XYZ file while importing 3d points.

 

But for now this should be enough for me to play around.

 

Thanks again

Regards

Aaryan.

Posted
Thank You So much Stefan..

This is what i was looking for.

You're welcome aaryan

One last question can i do it from XYZ file while importing 3d points.
Of course you can

;file - opened txt file
;e - polyline ename
;d - control distance
(while (setq str (read-line file))
 ;....
 ;setq p  str->x,y,z  acording to file format
 ;....
 (if (<= (distance p (vlax-curve-GetClosestPointTo e p)) d)
   (entmake (list '(0 . "POINT") (cons 10 p)))
 )
)

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