RotateUCS

Short description

This AutoLISP routine lets the user rotate the current UCS around the Z axis by a user-specified angle, resets the snap angle, and optionally saves the new UCS under a custom name. It is useful when drafting in rotated views but still wanting a clean UCS orientation for further drawing.
rotateucs

Command:

Command: C:RotateUCS When run, it switches to World UCS first, then asks for an angle, rotates the UCS, prints the angle, and then asks whether to save the UCS with a name.

Description:

When executed, the program does the following: • Sets the UCS to World using (command “_UCS” “_W”) so the rotation always starts from a known base. • Resets the snap angle to 0 using (command “_snapang” 0) so the cursor/ortho aligns with the new UCS properly. • Prompts the user: “Specify rotation angle:” and reads the angle in radians (AutoCAD default). • Converts the angle from radians to degrees with (* angle (/ 180 pi)) because the UCS command expects degrees. • Calls (command “_UCS” “_Z” ang1) to rotate the UCS around the Z axis by the specified angle. • Prints a confirmation message like “Angle of UCS: 45.00” using (princ …) and (rtos …) for formatting. • Finally asks the user for a UCS name and, if provided, saves the UCS with (command “_UCS” “_Save” ucsname).

Helper function: (if any)​

Helper / important calls in the code:(command “_UCS” “_W”) — ensures the rotation starts from World UCS.(command “_snapang” 0) — resets SNAPANG so draft aids are aligned.(getangle …) — prompts the user for an angle in radians.(* angle (/ 180 pi)) — conversion from radians to degrees.(command “_UCS” “_Z” ang1) — rotates the UCS around Z by the given degrees.(command “_UCS” “_Save” ucsname) — optional UCS save under the entered name.

Functionalities:

Main Functionalities:Rotate UCS around Z by a user-defined angle.Auto-reset snap angle to 0 so the drafting angle matches the UCS.Start from World UCS every time to avoid cumulative rotation errors.Display the final angle to the user for confirmation.Optionally save the rotated UCS under a custom name for later reuse.

Result:

Result: The current UCS is rotated around the Z axis by the angle the user specifies, the snap angle is aligned to it, and the user can store this UCS under a name to return to it later. This makes it easier to draft on rotated building wings, site orientations, or non-orthogonal geometry while keeping the cursor and ortho aligned.
Pixel

Additional info:

Share this page:

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Categories: AutoCAD_Lips
0
Would love your thoughts, please comment.x
()
x