Hello, I'm wondering if anyone can tell me how to find the point where I can start my polyline in AutoLisp. I know all the vertices of my polyline, but I'm looping through the list of vertices, and I know the third and fourth points of the polyline. I know the previous and following points, what I want to do is start my polyline 0.5 at an angle towards the previous point. Go to the two points I already know, then end my polyline 0.5 towards the following point. I am able to get the angle towards the direction I want to go. But I'm not a math wiz and don't know what the best way would be to do this. I know how to do this typing the commands in at the command line, but need to know how to do this in AutoLisp. Any help would be appreciated. Thanks.
Solved! Go to Solution.
Solved by p_mcknight. Go to Solution.
polar
Returns the UCS 3D point at a specified angle and distance from a point
That is so much easier than the way I found how to do it late last night! I researched online and found a math website that showed how to get the point using the sine and cosine and it worked, but made for way more code than yours. Here is what I ended up with last night:
(setq ang1 (angle vtpt2 vtpt1)) (setq ang2 (angle vtpt3 vtpt4)) (setq startpt (list (+ (car vtpt2) (* 0.5 (cos ang1))) (+ (cadr vtpt2) (* 0.5 (sin ang1))))) (setq endpt (list (+ (car vtpt3) (* 0.5 (cos ang2))) (+ (cadr vtpt3) (* 0.5 (sin ang2)))))
Your way is much better and easier for me to understand:
(setq startpt (polar vtpt2 (angle vtpt2 vtpt1) 0.5))
Thanks for the help!