[Search tip detail and code files using keywords, tip number, author name, etc ]
 
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
Rotate the UCS
Tip# 3495 By Leonid Nemirovsky On 26-Sep-2010
4
Rated By 1 users Downloaded : 324
Categories : User Coordinate System
Software type : AutoCAD 2011
Rename File To : uo.lsp
LISP code that rotates the UCS on the z-axis.

Frequent tipster Leonid Nemirovsky sent us a bit of code he just made to help rotate the UCS in AutoCAD.

"First I was doing it manually, but then I wrote this simple code that rotates the UCS on the z-axis between two selected points. It's simple, but I use it a lot."
 
(defun c:uo ()
(setq pt1 (getpoint " Select First Point: "))
(if (= pt1 nil)(exit))
(setq pt2 (getpoint " Select Second Point: "))
(if (= pt2 nil)(exit))
(command "ucs" "Z" pt1 pt2 "")
(princ)
)
 

Notes from Cadalyst Tip Patrol: Len is right: this code is very simple. It is set up to rotate the UCS about the z-axis. If you need to draw orthogonal lines at a different angle, load this routine, type UO, click a reference point, then click a second point to define the angle — that's it. You can do this manually through the UCS command, but it has a few more steps to it. Just make sure to rotate about the z-axis.

 

Average Rating:
4


User comments
Comment by Peterson,Pete
Posted on 2010-09-29 09:57:56
How about . . . Prompt for "'object' or 'two points' ". Respond with O' for object, or if not 'O' then 'Pick 1st point' 'pick 2nd point'. Twice as usefull.