Results 1 to 4 of 4

Thread: Draw line lisp

  1. #1
    Join Date

    Default Draw line lisp

    I have some vertical lines (more that 2) and i would would like the code to pick the 2 outer lines and draw a line between them ignoring the lines in the middle. Imagine vertical lines and you want to connect the most outer lines with a horizontal line making a U.
    The code will seach the file for lines on the layer c-temp and then draw another line connecting the two outer horizontal lines.

  2. #2
    Member identity4's Avatar
    Join Date

    Default Re: Draw line lisp

    How are the lines being created? Are they existing in a drawing and you want to select them and perform this function on them? Or are they being drawn by your LISP routine?

  3. #3
    All AUGI, all the time pbejse's Avatar
    Join Date

    Default Re: Draw line lisp

    Exclusively Vertical lines

    (defun c:MakeU ( / farfrompoints pts ss e sp ep FptNpt)
    (defun farfrompoints  (ptlst / p B e pts)
                 pt  ptlst
                (setq pts ptlst)
                (while (setq p (car pts))
                      (if (> (setq B (distance pt p))
                             (caddr e))
                            (setq e (list p pt B)))
                      (setq pts (cdr pts)))
          (list (cadr e) (Car e))
        	(if (setq pts nil ss (ssget "_X" '((0 . "LINE")( 8 . "c-temp"))))
    		(while (setq  e (ssname ss 0))
                          	(setq sp (vlax-curve-getStartPoint e)
                          	      ep (vlax-curve-getEndPoint e)
                                  ang  (angle sp ep))
    			(if  (or (equal ang (/ pi 2.0))
                                     (equal ang (* pi 1.5)))
                                   (setq pts (cons
    					(car (vl-sort
    					           (list sp ep)
    					           '(lambda (a b)
    					                  (< (cadr a) (cadr b))))) pts)))
                          	(ssdel e ss))
                    (if pts
                    (entmakex (list (cons 0 "LINE")
                      (cons 10 (car (setq FptNpt (farfrompoints pts))))
                      (cons 11 (cadr FptNpt))
                      '(8 . "c-temp"))) (princ "\nNo Vetical Lines Found:")    
                (princ "\n0 objects selected:")
    EDITED: Confuse pBe
    Last edited by pbejse; 2012-06-17 at 06:18 AM.

  4. #4
    All AUGI, all the time pbejse's Avatar
    Join Date

    Default Re: Draw line lisp

    and...... ?

    Last edited by pbejse; 2012-06-23 at 03:30 PM.

Similar Threads

  1. Replies: 13
    Last Post: 2014-07-01, 02:23 PM
  2. Replies: 2
    Last Post: 2012-07-13, 09:04 PM
  3. LISP to draw cross
    By jodi_sherrell in forum AutoLISP
    Replies: 5
    Last Post: 2009-02-05, 05:00 PM
  4. draw a line in the point line style
    By rwbaker54 in forum VBA/COM Interop
    Replies: 1
    Last Post: 2008-04-25, 07:10 PM
  5. Replies: 3
    Last Post: 2007-05-23, 11:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts