Results 1 to 3 of 3

Thread: get a warning when in an unlocked viewport

  1. #1
    Wish List Administration
    Join Date
    2011-08
    Posts
    4,581

    Default get a warning when in an unlocked viewport

    Summary: get a warning when in an unlocked view port

    Description: How many times have you jumped into a view port, made a minor change just to find out that the view port was not locked and now you are lost in space inside a view port? Well, it drives me crazy. What if AutoCad detected that you were now inside an unlocked view port and popped up with a warning that states that the view port is unlocked and if you want to continue? Sounds simple..sounds like it would be great!! Perhaps a switch or prompt that would you allow to jump out of the view port easily and back into paper space.

    Product and Feature: AutoCAD Civil 3D - Other

    Submitted By: mmorison751262 on 11/03/2017


  2. #2
    Woo! Hoo! my 1st post
    Join Date
    2017-06
    Posts
    1

    Default Re: get a warning when in an unlocked viewport

    Quote Originally Posted by Wish List System View Post
    Summary: get a warning when in an unlocked view port

    Description: How many times have you jumped into a view port, made a minor change just to find out that the view port was not locked and now you are lost in space inside a view port? Well, it drives me crazy. What if AutoCad detected that you were now inside an unlocked view port and popped up with a warning that states that the view port is unlocked and if you want to continue? Sounds simple..sounds like it would be great!! Perhaps a switch or prompt that would you allow to jump out of the view port easily and back into paper space.

    Product and Feature: AutoCAD Civil 3D - Other

    Submitted By: mmorison751262 on 11/03/2017
    Better yet..how about having the view port automatically lock when exiting it every time. A prompt can ask you if you wish to unlock it. or you can check a box to never show you this prompt again. I vote for locked view ports unless we want it unlocked.!!

  3. #3
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719

    Default Re: get a warning when in an unlocked viewport

    You add some things there at the end that I don't particularly care for, but this should get you started for the 'pop up warning' bit:

    Code:
    (vl-load-com)
    
    (defun c:ViewportWarning ()
      (princ "\rVIEWPORTWARNING = ")
    
      (if *Reactor_ViewportWarning*
        (progn                                                              ; Turn off
          (vlr-remove *Reactor_ViewportWarning*)
          (setq *Reactor_ViewportWarning* nil)
          (setq ViewportWarning:SysVarChanged nil)
          (princ "OFF ")
        )
    
        (progn                                                              ; Turn on
          (or *Reactor_ViewportWarning*
              (setq *Reactor_ViewportWarning*
                     (vlr-sysvar-reactor
                       "ViewportWarning"
                       '(
                         (:vlr-sysvarchanged . ViewportWarning:SysVarChanged)
                        )
                     )
              )
          )
    
          (defun ViewportWarning:SysVarChanged (rea var / ctab)
            (if
              (and
                (= T (cadr var))
                (= "CVPORT" (strcase (car var)))
                (/= "Model" (setq ctab (getvar 'ctab)))
                (/= 1 (getvar 'cvport))
              )
              (alert
                (strcat "The active viewport on " ctab " is unlocked. ")
              )
            )
          )
    
          (princ "ON ")
        )
      )
    
      (princ)
    )
    
    ;; Uncomment next line to make it start automagically when loaded:
    ;;(c:ViewportWarning)

    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •