0 Members and 1 Guest are viewing this topic.
(defun c:p45 () (/ a1 a pt1 pt0 pbg ang1 len ed) ;; ;; http://forums.augi.com/showthread.php?91585-Draw-a-line-starting-from-the-midpoint-of-itself ;; (princ "\n Re+Place Object\(s\) with 1.0\" Line at Angle of Choice.." ) ;_ end of princ (setvar "cmdecho" 0) (setq A1 (if A1 A1 (/ pi 4) ) ;_ end of if (if (setq ang1 (getangle "\n Enter/Pick Angle to Use: <" ; acquire angle (angtos A1) " >" ) ;_ end of getangle ) ;_ end of setq (setq A1 (angtof ang1)) ) ;_ end of if ) ; (if ;check for angle other than nil ; (= ang1 nil) ; if angle not nil.. ; (setq ang (angtof "45")) ; use 45° if Enter is pressed ; (setq ang ang1) ; else use entered # >> ; ) ; end if (while (setq pt1 (getpoint "\nPick Basepoint of Object(s) to Replace: ")) ; 'points' are picked (setq len 0.5) ;setq half-length (setq pt0 (polar pt1 ang1 len)) ;Calculate other endpoint (setq pt1 (polar pt1 ang1 (* -2 len))) ; move location/base to place at mid/pick (setq ed (list '(0 . "LINE") ; make line (cons 10 pt0) (cons 11 (polar pt1 ang1 len)) ) ;_ end of list ) ;_ end of setq ;; (entmake ed) ;insert the line ) ;_ end of while (princ) (princ " Erase Anything?") (vl-cmdf "erase" pause) (setvar "cmdecho" 1) (princ) ) ;_ end of defun;) ;_ end of defun;|«Visual LISP© Format Options»(72 2 50 2 T "end of " 60 9 0 1 0 nil T nil T);*** DO NOT add text below the comment! ***|;
(defun c:p45 ( / ang1 pt1 pt0 len ed) ;; ;; http://forums.augi.com/showthread.php?91585-Draw-a-line-starting-from-the-midpoint-of-itself ;; (setvar 'cmdecho 0) (princ "\n Re+Place Object\(s\) with 1.0\" Line at Angle of Choice..") (if (= *PA-1 nil)(setq *PA-1 (/ pi 4.0))) ;; initial var fill if nil.. (if (setq ang1 (getangle (strcat "\n Enter/Pick Angle to Use: <"(angtos *PA-1)"> "))) ;; acquire angle (angtos A1) " >" *PA-1 (setq ang1 *PA-1) ) (while (setq pt1 (getpoint "\nPick Basepoint of Object(s) to Replace: ")) ; 'points' are picked (setq len 0.5) ;setq half-length (setq pt0 (polar pt1 ang1 len)) ;Calculate other endpoint (setq pt1 (polar pt1 ang1 (* -2 len))) ; move location/base to place at mid/pick (setq ed (list '(0 . "LINE") ; make line (cons 10 pt1) (cons 11 (polar pt0 ang1 len)) ; changed to put start-point at left ) ;_ end of list ) ;_ end of setq ;; (entmake ed) ;insert the line ) ;_ end of while (princ " Erase Anything?") (vl-cmdf "erase" pause) (setq *PA-1 ang1) ;; last change to save angle for repeat ;; hope that global is safe (setvar 'cmdecho 1) (princ)) ;_ end of defun