Friday, December 28, 2012

How to rotate or twist the view in AutoCAD

Here are some AutoLISP commands that can be useful if you want to rotate or twist the view. Change 90 to any other angle if you like. For counterclockwise change to –90. If you have a recent version of AutoCAD and just want 90 degrees relative rotation use the built in ViewCube functionality and the two arrows at the top right.

The DVIEW command can be used to also manually to twist the view using the twist option that twists or tilts the view around the line of sight. The twist angle is measured counterclockwise, with 0 degrees to the right.

The AutoCAD system variable VIEWTWIST stores the view rotation angle for the current viewport measured relative to the WCS and is also named as “Roll angle” (Displays the rotation angle of the view within your viewing plane, which is a plane parallel to your monitor's screen.) in the View Manager. This is being used for rotating the view relative the current rotation.

; By Jimmy Bergmark, www.jtbworld.com
; Rotate 90 degrees relative the current twist rotation
(defun c:r90 ()
  (command "._dview" "" "_twist" (+ (* 180.0 (/ (getvar "viewtwist") pi)) 90 ) "")
  (princ)
)

; Rotate -90 degrees relative the current twist rotation
(defun c:r-90 ()
  (command "._dview" "" "_twist" (+ (* 180.0 (/ (getvar "viewtwist") pi)) -90 ) "")
  (princ)
)

; Rotate to 90 degrees fixed twist rotation
(defun c:r90f ()
  (command "._dview" "" "_twist" 90 "")
  (princ)
)

; Rotate to 0 degrees fixed twist rotation
(defun c:r0f ()
  (command "._dview" "" "_twist" 0 "")
  (princ)
)

Before

and after rotating the view 90 degrees.


Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner