TwoSixSix Posted October 25, 2017 Posted October 25, 2017 Long time lurker, first time poster. I'm having trouble with a lisp. Below is an oversimplification of what I'm trying to do but the hangup is here. I'm trying to create a series of points while tracking from "pt1". It will work the first time but then ends the command. (DEFUN C:test () (while (setq pt1 (LIST 0 0)) (command "POINT" "_tt" pt1 pause) ) (princ) ) If I remove the { "_tt" pt1 }, which is what tells it to track, the command will run continuously, as wanted, but if I tell it to track it works once then stops. Help please? Quote
David Bethel Posted October 25, 2017 Posted October 25, 2017 If I understand correctly, maybe : (defun c:foo (/ bp pt1) (setq bp (list 0 0 0) (while (setq pt1 (getpoint bp "\nNext Point: ")) (command "_.POINT" "_non" pt1)) (prin1)) Not tested -David Quote
TwoSixSix Posted October 25, 2017 Author Posted October 25, 2017 Thanks David but I need it to track from within the "point" command not before the point is created as you have it. Quote
ronjonp Posted October 25, 2017 Posted October 25, 2017 David's code tracks from one point ( which you asked for ) .. perhaps you're looking to change p1 to the last point picked in a loop? Here's some old code from my library: (defun c:mdist (/ d p1 p2 v) (setq d 0) (while (and (or p1 (setq p1 (getpoint "\nSpecify start point: "))) (setq p2 (getpoint p1 "\nSpecify next point: ")) (setq d (+ d (distance p1 p2))) (setq v (append v (list p1 p2))) (setq p1 p2) ) (grvecs (append v '(1))) (princ (strcat "\nRunning total: " (rtos d))) ) (princ) ) Or this? (defun c:test (/ p1 p2) (while (and (or p1 (setq p1 (getpoint "\nSpecify start point: "))) (setq p2 (getpoint p1 "\nSpecify next point: ")) ) (entmakex (list '(0 . "point") (cons 10 p1) '(8 . "point"))) (setq p1 p2) ) (princ) ) Quote
David Bethel Posted October 25, 2017 Posted October 25, 2017 Do you understand that (command) always returns nil. (AFAIK) ? Quote
SLW210 Posted October 26, 2017 Posted October 26, 2017 Please read the Code Posting Guidelines and edit your Code to be included in Code Tags.[NOPARSE] Your Code Here[/NOPARSE] = Your Code Here Quote
Recommended Posts
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.