AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

I enclose a lisp routine which I find quite useful. It draws an arc tangent to an existing line, beginning in any designated point on the line and ending through a designated point exterior to the line. It draws any of the two possible solutions. I would like that it should be able to draw the arc tangent, not only to a line, but also to a straight segment of a lwpolyline.
For that, I would need a method of picking a straight segment of lwpolyline, and getting as output the two extreme points (vertex) of that segment. . If you, or anybody else, know how to do it, please answer to mailto:rbravocos@terra.es

Rogelio Bravo

;CODING STARTS HERE
(defun C:arctg ( / rec pt1 pt2 ang pt3 pt4 resp ref)
;draw arc tangent to existing line,
; beginning in designated point on the line
; and ending through a designated point exterior to the line
(setq rec (entget (car (entsel "\nPick base line:"))))
(setq pt1 (cdr (assoc 10 rec)));punto inicial recta
(setq pt2 (cdr (assoc 11 rec)));punto final recta
(setq ang (angle pt1 pt2)); angulo recta
(setq ref (getvar "osmode"));almacena valor inicial de osmode
(command "_osnap" "_end,_nea");establece nuevos refent
(setq pt3 (getpoint "\nPick, on the line, the initial point of arc: "))
(setvar "osmode" ref);restablece valores iniciales de osmode
(setq pt4 (getpoint "\nPick final point of arc: "))
(command "_arc" pt3 "_e" pt4 "_d" (/ (* 180.0 ang) pi))
(initget 6 "Yes No")
(if (null (setq resp (getkword "\nšIs arc correctly oriented? (Y/N)<Y>:" )))
(setq resp "Yes")
)
(while (/= resp "Yes")
(setq ang (+ ang pi))
(command "_erase" "_l" "")
(command "_arc" pt3 "_e" pt4 "_d" (/ (* 180.0 ang) pi))
(initget 6 "Yes No")
(if (null (setq resp (getkword "\nšIs arc correctly oriented? (Y/N)<Y>:" )))
(setq resp "Yes")
)
);end while
)
;CODING ENDS HERE

The AutoLisp/Visual Lisp/VBA Resource Website

Copyright © 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website