I find the Align Space tool in the Express tools works nicely for aligning viewports to model space lines or picked points. Basically it is a macro that automates the process of applying a DVIEW TWIST. Be aware that it will also scale the viewport to fit your picks, but once you get the view rotated it is easy to reset the scale.
Save the lisp file to some location of your choosing. From there, there are many ways to load....one is:
type APPLOAD. Then you can browse to the file and press Load. This loads it in the active drawing.
In the same dialog, if you do like the routine and want it to auto-load for you in each drawing...pick the Contents button by the briefcase, then pick Add, and browse to the file again.
The commands - for the RVIEW.lsp (with UCS to View) the command is RVIEW.
for RVIEW2 (UCS to World) the command is RVIEW2
Unless I am missing something you shouldn't need a LISP routine for this. You already have one with the Express tools.
I agree that you don't need a lisp routine to rotate the view - it's purely user preference.
To just rotate the view in the viewport (or in Model space), RVIEW is much faster - type RVIEW and pick two points - done. Want to get the view back to World - type RVIEW and pick W - done. Want to specify an angle to rotate the view - type RVIEW and enter the angle - done. I just don't like the multi-step procedures of the other installed options.
But sure, other commands are out there...mvsetup is pretty nice to line up plan and profile viewports....and if you wanted to rotate the physical viewport with the view - then definitely vprotateassoc is the way to go. Totally user preference is all I'm sayin'
RVIEW is much faster
It's faster, but misleading, as every routine based on UCS commands.
As stated by Allen, the only right solution in the model space is _DVIEW => _TWIST
Actually. The whole thing would be much simpler if AutoCAD would let you set the VIEWTWIST from the command line. I'm attaching an old lisp that will set the Snapangle parallel to the rotated view.
Antonio, you're right (I was thinking inside the box - how we do it here)...
RView forces UCS to View
RView2 forces UCS to World
RView3 never gives UCS any thought...(attached).
Thanks for the critique...
That looks promising since it doesn't use a UCS. I had to add (vl-load-com) after the local variables to get it to run. I'd say that if your going to use a lisp to set the viewtwist that this would be the best one to use.