Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TAB angle lock

5 REPLIES 5
Reply
Message 1 of 6
cjm771
1268 Views, 5 Replies

TAB angle lock

Hi guys I want to create a shortcut key (like TAB) for example and whenever I start a polyline or move or whatever, I can hit TAB which will grab the angle my cursor is at, and then use the angle lock to lock the cmd into that direction. (This is essentially what can be done in rhino if you are familiar with this). 

 

The manual way in autocad is typing it ("<45") but I just want to calculate angle from the start point to cursor point. and then once hitting tab or a key or a new command, it will lock with that angle. How can I go about programming this, I have never programmed in autocad but am eager in learning how this might be possible. Thanks so much!

 

5 REPLIES 5
Message 2 of 6
scot-65
in reply to: cjm771

Look at the available transparent commands - the ones with the 'hyphens in front

as well as assigning the "F-Keys".

 

If not mistaken, you will need to set up UCS names, but I do not know if UCS is a

transparent command.

 

Would you consider reversing the order?

Meaning rotate the UCS first, then start the command?

I know that can be done.

 

Attached image is a screen capture showing how to assign a F-key.

You might need to define a command name first (not sure) or write

the macro: ucs;[your ucs name];...

 

Command CUI will get you there.

Drag and drop the command from the lower-left pane into the tree above.

Highlight the line you just created in the tree and edit in the lower-right pane.

 

???


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.


Message 3 of 6
pbejse
in reply to: cjm771

What about Polar Tracking or F10

At Polar Angle Settings

-Increment angle 45

 

HTH

 

Message 4 of 6
Kent1Cooper
in reply to: cjm771


@cjm771 wrote:

Hi guys I want to create a shortcut key (like TAB) for example and whenever I start a polyline or move or whatever, I can hit TAB which will grab the angle my cursor is at, and then use the angle lock to lock the cmd into that direction. (This is essentially what can be done in rhino if you are familiar with this). 

 

The manual way in autocad is typing it ("<45") but I just want to calculate angle from the start point to cursor point. and then once hitting tab or a key or a new command, it will lock with that angle. How can I go about programming this, I have never programmed in autocad but am eager in learning how this might be possible. Thanks so much!

 


This does it if you type (sca) [including the parentheses] when a prompt is asking for a next point, such as in Line or Move or Copy.  I leave it to you to assign (sca) to a Function key or Alt-whatever or other key combination.

 

(defun sca (); = Snap to Crosshair-location Angle
  (setvar 'snapang
    (angle
      (getvar 'lastpoint)
      (cadr (grread T))
    )
  )
  (setvar 'orthomode 1)
  (princ)
)

Kent Cooper, AIA
Message 5 of 6
cjm771
in reply to: cjm771

Thanks kent!

 

Works great!! Only two questions

 

1) is it possible that upon completion of the next click (if it is a polyline or the end of a move command or whatever..) can it return to the normal non ortho mode? It seems it gets stuck in ortho at that angle forever.that would be awesome!

 

2) It is posisble that once in this sca mode...that even if i osnap to a point...that it will still conform to the angle and esentially project (like an strack situation) to keep with that angle? 

 

Also  what is a good documentation to learn this AutoLISP, I very much would like to learn! Thanks, again!

Message 6 of 6
Ian_Bryant
in reply to: cjm771

Hi,

adapting Kent's suggestion you could assign the macro

^P(strcat "<" (angtos (angle (getvar 'lastpoint) (cadr (grread T))))) ^P

to a function key or other shortcut key combination,

This will handle your 1st request.

For your 2nd request, you could try turning on osnap tracking

with the F11 key before or after using the above macro.

Ian


 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost