# TheSwamp

## Code Red => AutoLISP (Vanilla / Visual) => Topic started by: 2e4lite on November 01, 2013, 10:27:16 PM

Title: How to make the tangent?
Post by: 2e4lite on November 01, 2013, 10:27:16 PM
Who can write a program that can make the tangent by specifying the point in 2d curves,the length and the angle?  It will a great help to me.Thanks!
Title: Re: How to make the tangent ？
Post by: Kerry on November 01, 2013, 10:37:33 PM

What information do you know.?

Title: Re: How to make the tangent?
Post by: ymg on November 02, 2013, 04:14:26 AM
Not sure if it is what you are looking for, but using this little bit of code by AlanJT
you have the angle.  You already have the point.

So your tangent is an xline starting at your point with angle as slope.

ymg

Code - Auto/Visual Lisp: [Select]
1. ;; Return angle along curve, at specified point (on curve)                    ;
2. ;; e - valid curve (ENAME or VLA-OBJECT)                                      ;
3. ;; p - point on curve                                                         ;
4. ;; Alan J. Thompson, 11.04.10                                                 ;
5.
6. (defun AngleAtPoint (e p)
7. )
8.
9. ;; Example call and entmaking an XLINE
10. (setq a (angleatpoint enameofcurve point))
11. (entmakex   (list    '(0 . "XLINE")  '(100 . "AcDbEntity")  '(100 . "AcDbXline")  '(62 . 1) (cons 10 point)  (list 11 (cos a) (sin a) 0.0)))
12.