TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: flopo on November 27, 2009, 02:33:36 AM

Title: 3d polyline lisp
Post by: flopo on November 27, 2009, 02:33:36 AM
Hello everybody,
I'm working with 3d polylines and I need a lisp to do this: to draw lines from some points perpendiculat to a 3d polyline. There are a lot of points, 3d points - I mean points in space, with Z different from 0. From each point to draw a perpendicular on 3d polyline, but on that part of poly that is closer to my point. Is it possible? Thanks!
Title: Re: 3d polyline lisp
Post by: Kerry on November 27, 2009, 04:32:49 AM

Does your polyline have multiple Vertex Points ?

Do you want the program to select the pline Segment as well as the point. ?

Can you provide a sample drawing for testing.?
Title: Re: 3d polyline lisp
Post by: flopo on November 27, 2009, 04:56:08 AM
This is an example, but not the best one. Is about a pipe, but in this case is flatten, z=o for all vertices.This is a 2d polyline.I don't have now an example with 3d polyline. Anyhow, the difference on Z axis is not big.
Title: Re: 3d polyline lisp
Post by: Lee Mac on November 27, 2009, 10:50:12 AM
Perhap this?

Code: [Select]
(defun c:perp (/ i ss ent pt p1 p2)
  (vl-load-com)

  (princ "\n>> Select Points >>")
  (if (setq i -1 ss (ssget '((0 . "POINT"))))
   
    (if (and (setq ent (car (entsel "\nSelect Curve: ")))
             (wcmatch (cdr (assoc 0 (entget ent))) "*LINE,CIRCLE,ELLIPSE,ARC"))

        (while (setq pt (ssname ss (setq i (1+ i))))
          (setq p2 (vlax-curve-getClosestPointto ent (setq p1 (cdr (assoc 10 (entget pt))))))
          (entmake (list (cons 0 "LINE") (cons 10 p1) (cons 11 p2))))))
 
  (princ))

Title: Re: 3d polyline lisp
Post by: CAB on November 27, 2009, 09:22:06 PM
And for those who want to follow this thread in it's entirety:
http://discussion.autodesk.com/forums/thread.jspa?threadID=753908&tstart=0
http://cadtutor.net/forum/showthread.php?t=42442
Title: Re: 3d polyline lisp
Post by: flopo on November 30, 2009, 02:12:25 AM

Thanks Lee Mack, is perfect!
    
Title: Re: 3d polyline lisp
Post by: flopo on November 30, 2009, 02:34:14 AM
Hello everybody,
after drawing perpendicular lines from points to a 3dpoly, I have to measure the distance between consecutive  intersection 3dpoly - perpendicular line.  A lisp to do this will help me a lot... See the attachment - drawing. Thanks!
Title: Re: 3d polyline lisp
Post by: ahsattarian on October 02, 2016, 08:28:34 AM
Hello
I can help u if still needed !!!
Waiting for u
Amir