Abrasive Posted September 17, 2022 Posted September 17, 2022 I'm trying to put together a routine, how could I find the angle from clicked point to current cursor location? (I'm not clicking a second location) A second but separate routine I would like to find the angle of the line I just drew, then ask a question. Quote
mhupp Posted September 17, 2022 Posted September 17, 2022 enable dynamic mode. https://www.javatpoint.com/autocad-dynamic-input Quote
Abrasive Posted September 17, 2022 Author Posted September 17, 2022 @mhupp Looking for a LISP routine. I want to store the variable then use it in the rest of the routine. Trying to modify the routine in one of my other posts... Getting better at LISP code but still very amature. Quote
Tharwat Posted September 17, 2022 Posted September 17, 2022 You can do it as follows: (setq p1 (getpoint "\nFirst point :")) (setq p2 (getpoint "\nSecond point :" p1)) (angle p1 p2) Quote
Steven P Posted September 17, 2022 Posted September 17, 2022 Weird how things come up, when a question is asked a similar one is asked soon after. Weekend so CAD is off but would GrRead so the trick here - there was another question with an answer suggesting to look at this the other day. Not something I have looked into much, I believe Lee Mac had a tutorial or a LISP on his website with some example functions which might help here. The format might be something along the lines of: - Pick a point - While loop - while the cursor is moving or not moving (in the back of my head, the Lee Mac examples did something like that) - get current cursor position from Grread - end while loop - calculate angles there would have to be some control I think to tell the LISP to record the cursor position I think Quote
Abrasive Posted September 17, 2022 Author Posted September 17, 2022 @Steven P Yes the subject came up in a post that you replied to, with a routine. Your routine works exactly as advertised!....lol I'm trying to expand that routine to draw the hypotenuse in the direction of the cursor. Since I'm entering the numbers I can't use the exact angle but will find the "quadrant" the line is drawn in. In my line of work every job is different and we use the hypotenuse and short leg. Sometimes I need to draw several dozen lines a day. @TharwatThanks! I think I can adapt that to one of my routines.... Quote
BIGAL Posted September 18, 2022 Posted September 18, 2022 You posted this request elsewhere please post that link also, helps when a solution is offered at another forum, your input was hypotenuse length and vertical lenght of end leg. Would not use +- for values solve the problem of the 4 quadrants. Would not take long to work out +Hor & +Ver is q1 -Hor & +Ver is q2 -Hor & -Ver is q3 +Hor & -Ver is q4 This is something similar using Mirror choice to flip after Line is made. Could do a Q1 Q2 Q3 Q4 choice. That way just enter the 2 values. Look in downloads here for Multi getvals.lsp and Multi Radio Buttons for the library dcl functions. The dcl's could be patched into 1 dcl. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.