Results 1 to 4 of 4

Thread: Draw line lisp

  1. #1
    Member
    Join Date
    2007-04
    Posts
    29
    0 Did you find this post helpful? Yes

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

  2. #2
    Member identity4's Avatar
    Join Date
    2010-08
    Location
    Seattle
    Posts
    14
    0 Did you find this post helpful? Yes

    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
    2010-10
    Posts
    511
    0 Did you find this post helpful? Yes

    Default Re: Draw line lisp

    Exclusively Vertical lines

    Code:
    (defun c:MakeU ( / farfrompoints pts ss e sp ep FptNpt)
    (defun farfrompoints  (ptlst / p B e pts)
          (foreach
                 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"))))
                (progn
    		(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:")
                )
          (princ)
          )
    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
    2010-10
    Posts
    511
    0 Did you find this post helpful? Yes

    Default Re: Draw line lisp

    and...... ?

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

Similar Threads

  1. LISP to draw cross
    By jodi_sherrell in forum AutoLISP
    Replies: 5
    Last Post: 2009-02-05, 04:00 PM
  2. 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
  3. draw a annotative hatch with lisp
    By wbreedveld in forum AutoLISP
    Replies: 15
    Last Post: 2007-10-06, 04:50 AM
  4. lisp to draw multiple polylines
    By stephen.coff in forum AutoLISP
    Replies: 8
    Last Post: 2007-08-01, 11:08 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
  •