sketch11 Posted May 23, 2022 Posted May 23, 2022 (edited) Hi, I think this is from another post. To rotate a view, all you need to do is run the macro and then enter the angle. ^C^C_dview;all;;tw;\;^P(progn(setvar "snapang" (- (getvar "viewtwist")))(princ)) Is there a way to make it snap using the mouse snaps. For example, if I rotate a shape I can snap the rotation angle using the mouse. See below. Edited May 23, 2022 by sketch11 Quote
SLW210 Posted May 23, 2022 Posted May 23, 2022 I moved your thread to the The CUI, Hatches, Linetypes, Scripts & Macros Forum. Quote
BIGAL Posted May 28, 2022 Posted May 28, 2022 Have you looked at UCS OB plan, this will set a UCS to the direction of a selected object. Quote
sketch11 Posted May 28, 2022 Author Posted May 28, 2022 How would you incorporate into the code? Quote
BIGAL Posted May 28, 2022 Posted May 28, 2022 Draw a line on a angle UCS OB pick line then type PLAN. Quote
sketch11 Posted May 28, 2022 Author Posted May 28, 2022 I don't really understand. This is a for a viewport as well. Quote
BIGAL Posted May 28, 2022 Posted May 28, 2022 We only used viewports in layouts not model. So we would do UCS OB S giveitaname. Then go to layout viewport and UCS R giveitaname plan. Quote
BIGAL Posted May 30, 2022 Posted May 30, 2022 It sounds like you want something different to what I am suggesting, post some images. Quote
tombu Posted June 15, 2022 Posted June 15, 2022 Modifying the one you have to allow either entering an angle or using snaps to set snapang then using that value for dview twist: ^C^C^P(setvar 'angdir 1)(setvar 'snapang (getangle "Pick or enter TWist angle : "))(setvar 'angdir 0)(command "_.dview" "l" "" "_tw" (/(*(-(getvar 'snapang))180)pi) "") To make sure angdir is reset and to unlock then relock a viewport you want to twist this slight modification of BlackBox's lisp is what I'm using: (vl-load-com) ;;; Alternative Macro to allow either entering an angle or using snaps to set snapang then using that value for dview twist: ;;; ^C^C^P(setvar 'angdir 1)(setvar 'snapang (getangle "Pick or enter TWist angle : "))(setvar 'angdir 0)(command "_.dview" "l" "" "_tw" (/(*(-(getvar 'snapang))180)pi) "") ;;;--------------------------------------------------------------------; ;;; Twist dview function by BlackBox https://forums.augi.com/showthread.php?174367-multiline-text-rotation&p=1344593#post1344593 ;;; Modified to allow either entering an angle or using snaps to set snapang then using that value for dview twist: ;;; (defun c:TW () (c:TWIST)) ;;; ^P(or C:TWist (load "TWist.lsp"));TWist ;;; (load "TWist.lsp") TWist (defun c:TWist (/ *error* cmdecho angdir snapang osmode acDoc ActiveVport NotLock) (prompt "\rTWist") (defun *error* (msg) (and cmdecho (setvar 'cmdecho cmdecho)) (and angdir (setvar 'angdir angdir)) ; (and snapang (setvar 'snapang snapang)) (and osmode (setvar 'osmode osmode)) (if acDoc (vla-endundomark acDoc) ) (or (= NotLock 1)(vla-put-DisplayLocked ActiveVport :vlax-true)) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it ) (princ) ) (if (and (setq cmdecho (getvar 'cmdecho)) (setvar 'cmdecho 0) (or (= 1 (getvar 'tilemode)) (and (= 0 (getvar 'tilemode))(< 1 (getvar 'cvport))) ) (setq angdir (getvar 'angdir)) (setvar 'angdir 1) (setq osmode (getvar 'osmode)) (setvar 'osmode 512) ; (setq snapang (getvar 'snapang)) ) (progn (vla-startundomark (setq acDoc (vla-get-activedocument (vlax-get-acad-object))) ) (if (= 0 (getvar 'tilemode)) (progn (setq ActiveVport (vla-get-ActivePViewport acDoc) VpLock (vla-get-DisplayLocked ActiveVport) ) ; (princ "\n(= 0 (getvar 'tilemode)) = ")(princ (= 0 (getvar 'tilemode))) (if (equal :vlax-true VpLock) (vla-put-DisplayLocked ActiveVport :vlax-false) (setq NotLock 1) ) ;if (equal :vlax-true VpLock) ) ) ;if (= 0 (getvar 'tilemode) (progn (setvar 'snapang (getangle "Pick or enter TWist angle : ")) (command "._dview" "l" "" "_tw" (/(*(-(getvar 'snapang))180)pi) "" ) (setvar 'angdir angdir) (or (= NotLock 1)(vla-put-DisplayLocked ActiveVport :vlax-true)) ) ;progn ) ;progn (alert "\nMust be in a Layout's viewport or the Model tab!") ) (*error* nil) ) 1 Quote
sketch11 Posted June 16, 2022 Author Posted June 16, 2022 Hi, thanks, I've tested initially and this works really well so far. Cheers. 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.