sadhu Posted September 26, 2012 Share Posted September 26, 2012 I'm using the code below to measure and trace a path and it works. I normally use it to measure points along paths that has the same starting point. When I measure the the successive paths , the starting point and most of the initial points are identical. The paths differ only in the the last tracts. So I need to modify it to do this : 1. When I relaunch the lisp (C: res) it should start measuring along the same path starting from the second last point (of the previous measurment). 2. pressing the left arrow key allows me to go backwards along the previous path. 3. pressing the right arrow allows me to go ahead along the path uptil the second last point and permit to continue measuring. 4. Return total distance. I'm stuck at how to "comunicate" and wait for left/right arrow keyboard user input. All help is appreciated. (most of the code below comes from Lee) (defun c:mes (/ DLST PT PTLST) ; (if (car (setq ptLst (list (getpoint "\nSpecify First Point: "))) ) (progn (setq q1 (car ptlst)) (while (setq pt (getpoint "\nSpecify Next Point: " (car ptLst))) (mapcar (function (lambda (from to) (grdraw from to 3 1) ) ) (reverse (setq ptLst (cons pt ptLst))) (cdr (reverse ptLst)) ) (setq dLst (cons (distance (car ptlst) (cadr ptlst)) dLst) ) ; change the value (princ (strcat "\n<< Distance: " (rtos (car dLst) 2 2) " -- " "Cumulative: " (setq d1 (rtos (apply (function +) dLst) 2 2)) " >>" ) ) );while (LWPoly ptlst) );progn ; // added now (setq pt (getpoint "\nSpecify Next Point 2 : ")); else );if (defun LWPoly (lst) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length lst)) (cons 70 0)) ;cur fit vertices (mapcar (function (lambda (p) (cons 10 p))) lst)))) );defun Quote Link to comment Share on other sites More sharing options...
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.