Jump to content

Recommended Posts

Posted (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.

 

image.png.9addeeb99fe3bf208c428ace915726a9.png

 

Edited by sketch11
  • sketch11 changed the title to Rotate view
Posted

Just following up on this.

Posted

Have you looked at UCS OB plan, this will set a UCS to the direction of a selected object.

Posted

How would you incorporate into the code?

Posted

Draw a line on a angle UCS OB pick line then type PLAN.

Posted

I don't really understand.

This is a for a viewport as well.

Posted

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.

Posted

Sorry it's not working as expected.

Posted

It sounds like you want something different to what I am suggesting, post some images.

  • 3 weeks later...
Posted

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)
)

 

  • Like 1
Posted

Hi, thanks, I've tested initially and this works really well so far.

Cheers.

  • Like 1

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...