TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: ziele_o2k on December 07, 2017, 03:36:45 PM

Title: Rotate _Plan (Viewtwist) using lisp
Post by: ziele_o2k on December 07, 2017, 03:36:45 PM
Hi,

I'm working on tool for printing to pdf files. It is based on dynamic block (drawing frame). I have one question, how to quickly rotate plan to my block orientation (change viewtwist). When I'm printing with window option in model space, I have to change that.
Attached image explains everyithing I think.
Title: Re: Rotate _Plan (Viewtwist) using lisp
Post by: ziele_o2k on December 08, 2017, 02:32:30 AM
Ok, I will ask in this way. Can it be done in another way (using VanillaLisp or VisualLisp) than this:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:r2e ( / RTD ang )
  2.   (defun RTD (r / ) (/ (* r 180.0) pi))
  3.   (setq ang (RTD(cdr (assoc 50 (entget (car (entsel)))))))
  4.   (command "._dview" "" "_twist" (* -1 ang) "")
  5.   (command "._ucs" "_view" "")
  6.   (princ)
  7. )
I'm always trying to avoid command in my lisps...
Title: Re: Rotate _Plan (Viewtwist) using lisp
Post by: sasi on December 22, 2017, 12:46:38 AM
you can use this lisp load and just type RV in model space and give directions exactly which way you want.
Title: Re: Rotate _Plan (Viewtwist) using lisp
Post by: stevej on December 22, 2017, 01:12:25 AM
I've used this one for a few years.  Select two points on the line you want to be horizontal.

Steve

Code: [Select]
;;
;; Posted by smorales02 12MAR2008
;; www.cadtutor.net/forum/showthread.php?21135-DVIEW-twist-or-UCS
;; Post 11
;;
;          ***  This program uses the dview to twist a view  ***
;               and to set the crosshairs to bottom of screen
;;;;The dtr funtion converts degrees to radians
;;;;The rtd funtion converts radians to degrees
(defun rtd (a) (/ (* a 180.0)pi))
(defun dtr (a)
        (* pi (/ a 180.0)))
 
(DEFUN C:TW(/ W2 W1 ANG)
        (PRINC"\nSelect two point along the desired horizontal line. ")
        (SETVAR"OSMODE"512)
(IF(SETQ W2(GETPOINT"\nFirst point (left): "))
(PROGN(INITGET 1)
(SETQ W1(GETPOINT"\nSecond point: "W2)ANG(ANGLE W2 W1))
        (COMMAND"DVIEW""L" "" "TW"(- 360(RTD ANG))"")(SETVAR"SNAPANG"ANG)))
        (SETVAR"OSMODE" 0))