Jump to content

Connect points being selected while in a Lisp Program


Recommended Posts

Posted

Is there a way to have a line connect the last point selected with the current location of the mouse when you're picking points while in a lisp routine?

 

Kinda like when you're drawing a line there's a line (I think I've seen this called a "Rubberband") between the last selected point and where the mouse is currently located.

Posted

Something like?

 

(setq p1 (getpoint "\nPt: ")
     p2 (getpoint "\nPt: " p1))

Posted

Can this be taken further?

 

If there are 4 points being selected, and have a line connecting point 1 to 2, 2 to 3, and 3 to 4?

Posted
Can this be taken further?

 

If there are 4 points being selected, and have a line connecting point 1 to 2, 2 to 3, and 3 to 4?

 

Try this:

(defun C:DL (/ PT01 PT02)
 (setq PT01 (getpoint "\nSpecify line starting point: "))
 (while
   (/= nil (setq PT02 (getpoint PT01 "\nSpecify line ending point: ")))
   (command "._line" PT01 PT02 "")
   (setq PT01 PT02))
 (princ))

Posted

Another Example:

(defun c:test (/ GetPoints LWPoly lst)

 (defun GetPoints (str1 str2 / pts pt)
   ;; Lee Mac  ~  17.02.10
   
   (if (car (setq pts (list (getpoint str1))))
     (while (setq pt (getpoint str2 (car pts)))
       (mapcar
         (function
           (lambda (from to) (grdraw from to 3 0)))
         
         (reverse (cdr (setq pts (cons pt pts))))
         (cdr (reverse pts)))))
   
   (redraw) (reverse pts))


 (defun LWPoly (lst cls)
 (entmakex (append (list (cons 0 "LWPOLYLINE")
                         (cons 100 "AcDbEntity")
                         (cons 100 "AcDbPolyline")
                         (cons 90 (length lst))
                         (cons 70 cls))
                   (mapcar (function (lambda (p) (cons 10 p))) lst))))
 

 (and (setq lst (GetPoints "\nSelect First Point: " "\nNext Point: "))
      (LWPoly lst 0))

 (princ))

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