Jump to content

Angle of Cursor and Line


Tom Matson
 Share

Recommended Posts

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.

Link to comment
Share on other sites

@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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

@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.... 

Link to comment
Share on other sites

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.

 

image.png.2b8d7c082931ce321481bac2ac40bace.png

 

Could do a Q1 Q2 Q3 Q4 choice. That way just enter the 2 values.

image.png.2a2bfed0ef664eb3fb5ac0a6dc3cd940.png

 

image.png.00fc9656e899767f5b95fedb23674e95.png

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...