;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; Length.lsp By Michael Bulatovich May 5th 2007 ; ; ; ; Draws a polyline up to a specified length limit. ; ; When the next point would make the polyline longer ; ; than the maximum length specified, it draws a circle ; ; with a radius of the remaining length centered on the ; ; last valid point specified. ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun c:length ( / pt lpt len oldlen maxlen rad msg) (setvar "cmdecho" 0) (setq pt T len 0 );end setq (setq msg "\nSpecify maximum length limit") (if previous (setq msg (strcat "\n" msg " <" (rtos previous 2) ">: ")) (setq msg (strcat "\n" msg ": ")) ) (initget 6) (setq maxlen (getdist msg)) (if (null maxlen) (setq maxlen previous) ) (setq previous maxlen) (while pt (setq pt (getpoint "\nSelect starting point for path:")) (command "pline" pt) (while pt (setq lpt pt oldlen len pt (getpoint "\nSelect next point on path:") len (+ len (distance lpt pt)) );end setq (if (<= len maxlen) (progn (command pt) (princ (strcat "\nDeveloped length is now " (rtos len) ".") ) );end progn (progn (setq rad (- maxlen oldlen)) (command "") (command "circle" lpt rad) (prompt (strcat "\n"(rtos rad) " left from last point to maximum path length of " (rtos maxlen) ".\n(On circle's perimeter.)")) (setq pt nil) );end else progn );end if );end pt );end while (princ) );end defun