I know that this blog has a lot of AutoLISP code on it. I will focus on regular drafting topics soon. It’s just that I have recently needed these LISP routines and thought that if they were handy for me, they would also be handy for you as well. Here is another LISP routine to add to your collection…
Without using a LISP routine, you can create an arc that is tangent to the last drawn line/arc by using the “Continue” option of the arc command (as seen below).
Also in AutoCAD 2012 there is the new BLEND command which will do pretty much the same thing as the LISP routine with the exception that with the BLEND tool, you have to pick two objects in order for it to work. This lisp routine simply asks you to select an existing line or arc and it starts a tangent arc from the end closest to where you pick. and you are able to either pick another line/arc or click anywhere you choose which is really helpful.
- ARCTAN <enter> to start
- Specify the object that the arc is to be tangent to.
- Specify the end point on the selected object to be the start point or the arc
- Specify the end point of the arc
- Prompt: “Is arc oriented correctly?” Y = will keep the arc the way it is. N = will flip the arc as seen on the single line in the animation.
;;; CADALYST 05/08 www.cadalyst.com/code ;;; Tip 2290: Arctan.LSP Tangent Arc Generators, File 1 of 5 (c) 2008 Rogelio Bravo ;;; Modified BY Greg Battin for english use ;;; ;; ARCTAN draws an arc tangent to any kind of object ;; picking any other point as end point of arc ;; written by Rogelio Bravo, Spain (defun C:arctan () (graphscr) (vl-load-com) (setq obj (car (entsel "\nPick base entity for arc:"))) (setq ref (getvar "osmode")); (command "_osnap" "_end,_nea"); (setq ptan (getpoint "\nSpecify start point of arc:")) (setvar "osmode" ref); (setq pam (vlax-curve-getParamAtPoint obj ptan)) (setq vtr (vlax-curve-getFirstDeriv obj pam));; (setq ang (angle '(0 0 0) vtr)); ;;(setq ref (getvar "osmode")); ;;(command "_osnap" "_end,_nea"); ;;(setvar "osmode" ref); (setq pt4 (getpoint "\nSpecify end point of arc: ")) (command "_arc" ptan "_e" pt4 "_d" (/ (* 180.0 ang) pi)) (initget 6 "Y N") (if (null (setq resp (getkword "\nIs arc oriented correctly? (Y/N)<Y>:" ))) (setq resp "Y") ) (while (/= resp "Y") (setq ang (+ ang pi)) (command "_erase" "_l" "") (command "_arc" ptan "_e" pt4 "_d" (/ (* 180.0 ang) pi)) (initget 6 "Si No") (if (null (setq resp (getkword "\nIs arc oriented correctly? (Y/N)<Y>:" ))) (setq resp "Y") ) );end while )