Author Topic: Lock viewports  (Read 3330 times)

0 Members and 1 Guest are viewing this topic.

LPS

  • Guest
Lock viewports
« on: January 25, 2005, 11:40:18 AM »
Is there a way, or does anyone have a utility, to "lock a vieport" so that newly created layers will not show in the viewport? Newbies have been messing up my plots !

whdjr

  • Guest
Lock viewports
« Reply #1 on: January 25, 2005, 11:46:16 AM »
I don't think there is any way to stop a NEW layer from showing in a viewport.  You can however use vplayer or layerstates to help solve the problem. :)

ronjonp

  • Needs a day job
  • Posts: 7529
Lock viewports
« Reply #2 on: January 25, 2005, 12:37:02 PM »
If you have 2005 you can use group filters and they will not show new layers created.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Andrea

  • Water Moccasin
  • Posts: 2372
Lock viewports
« Reply #3 on: January 27, 2005, 11:50:39 PM »
you can save your layer state.. via layer dialog box..."DDLMODES"

or


try to play with layermanager "LMAN"
Keep smile...

t-bear

  • Guest
Lock viewports
« Reply #4 on: January 28, 2005, 09:01:29 AM »
This is something that might help.....was developed back in the CADalog days by the folks that are now "guru-ing (that a word?) here.
Code: [Select]
;Will freeze selected layers in ALL vports, you pick 'em, they're chilled!
;Thanks to the "gurus" at CADalog forums for this routine...3/7/03
;Keith, Trev, Hendie & Paul
;
;
(defun c:vplfrz   ()
  (setvar "TileMode" 0) ;  Force PaperSpace
  (setq vpFlag (getvar "cvport"))
  (if (= vpFlag 1)
    (progn
      (setq sel-vpt 1)
      (setq sel-vport (car (entsel "\nSelect view port: ")))
      (if (= sel-vport nil)
   (progn
     (alert "You must select a viewport\nTry again!")
     (c:vplfrz)
   )
   (progn
     (setq entvport (entget sel-vport))
     (if (= (cdr (assoc 0 entvport)) "VIEWPORT")
       (frz-vplayer)
       (progn
         (alert "You must select a viewport\nTry again!")
         (c:vplfrz)
       )
     )
   )
      )
    ); else Viewport is already selected
    (frz-vplayer)
  ) ;endif (= vpFlag 1)
)

(defun frz-vplayer ()
  (setq   e2    (entget sel-vport)
   viewport (cdr (assoc 69 e2))
  )
  (command "mspace")
  (setvar "cvport" viewport)
  (setq loop "")
  (while loop
    (setq
      pik (nentsel "\nSelect an item on XREF to Freeze: ESC to Exit:")
    )

    (cond
      ((/= pik nil)
       (setq lay (assoc 8 (entget (car pik))))
       (setq str (cdr lay))
       (command "vplayer" "f" str "All" "") ; Freeze in ALL viewports
      )
      ((= pik nil)
       (alert "Nothing Selected!\nTry Again!")
       (frz-vplayer)
      )
    )
  ) ; End while
  (command "pspace")
  (princ)
)

(prompt "\nType VPLFRZ to run")
(prin1)

Give it a try.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Lock viewports
« Reply #5 on: January 28, 2005, 11:22:13 AM »
Here is one I just updated, it was also written back in 2003

This routine will Freeze the layer of a selected entity in ALL tabs
and ALL viewports except the active viewport  

If you run the routine in model space it will freeze in ALL viewports

Code: [Select]
;;;   vpf.lsp     Viewport Layer Freeze
;;;
;;; ARGUMENTS
;;; none
;;;
;;; USAGE
;;; vpf
;;;
;;; PLATFORMS
;;; 2000+
;;;
;;; AUTHOR
;;; Copyright© 2005 Charles Alan Butler
;;; ab2draft@TampaBay.rr.com
;;;
;;; VERSION
;;; 3.1 Jan 28, 2005
;;;
;;;  This routine will Freeze the layer of a selected entity in ALL tabs
;;;  and ALL viewports except the active viewport  
;;;
;;;  If you run the routine in model space it will freeze in ALL viewports
;;;
;;; YOU MAY USE THIS CODE ONLY FOR *NON-COMMERCIAL*
;;; PURPOSES AND ONLY IF YOU RETAIN
;;; THIS HEADER COMPLETE AND UNALTERED
;;; you must contact me if you want to use it commercially
;;;


;;======  Main Lisp Routine  =======

(defun c:vpf (/ oldcmd vpflag sel-vport entvport pik str laylist ms)
   ;; error function
   (defun *error* (msg)
    (if (not (member msg
       '("console break" "Function cancelled" "quit / exit abort"))
     )
     (princ (strcat "\nError: " msg))
    ) ; if
    (if (/= laylist "")
     (if ms
      (command "-layer" "thaw" laylist "")
      (command "vplayer" "t" laylist "All" "" ; reset selectd layers
               "pspace")
     )
    )
    (setvar "CMDECHO" oldcmd)
    (princ)
   ) ;end error function

  (setq oldcmd (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  (if (= (getvar "TileMode") 1) ; in model space
    ;;------------------------------------------------
    (progn
      (prompt "\n****  Layers chosen will be frozen in all viewports.")
      (setq ms t)
    )
    ;;------------------------------------------------
    (progn ;else in a layout
      (setq vpflag (getvar "cvport")) ; get viewport #
      (while (= vpflag 1) ; No active viewport, Loop until one is picked
        (setq sel-vport (car (entsel "\nSelect view port: ")))
        (if (= sel-vport nil)
          (alert
            "You must select a viewport\n    --=<  Try again!  >=--"
          )
          (progn
            (setq entvport (entget sel-vport))
            (if (= (cdr (assoc 0 entvport)) "VIEWPORT")
              (progn
                (setq vpflag (cdr (assoc 69 entvport))
                )
                (command "mspace")
                (setvar "cvport" vpflag)
              ) ;  endif  viewport
            )
          )
        ) ;  endif cond  sel-vport
      ) ;endwhile (= vpFlag 1)
    )
    ;;------------------------------------------------
  ) ; endif

  ;;================================
  ;;  Get Entity and Freeze Layer  
  ;;================================

  (setq laylist "") ; initialize our layer list
  (command "undo" "begin")
  (setq pik (nentsel "\nSelect an item whose layer to freeze: "))
  (while pik
    (setq
      laylist (strcat laylist (cdr (assoc 8 (entget (car pik)))) ",")
    )
    ;;  Freeze selected layers for visual feedback
    (setq str (cdr (assoc 8 (entget (car pik)))))
    (if ms
      (if (= str (getvar "clayer"))
        (alert "Layer current, will be frozen in viewports.")
        (command "-layer" "freeze" str "")
      )
      (command "vplayer" "f" str "All" "")
    )
    (setq pik (nentsel "\nSelect an item whose layer to freeze: "))
  )
  (cond
    ((and ms (/= laylist "")) ;  Freeze layers in ALL viewports and ALL TABs
     (setvar "TileMode" 0) ;  Force Paper Space
     (command "vplayer" "f" laylist "All" "")
     (setvar "TileMode" 1) ;  Back to Model Space
     (command "-layer" "thaw" laylist "")
    )
    ((/= laylist "") ;  Freeze layers in ALL viewports and ALL TABs
     (command "vplayer" "t" laylist "Current" "") ; restore working VP
    )
  ) ; end cond stmt
  (command "undo" "end")
  (setvar "CMDECHO" oldcmd)
  (princ)

) ;  end defun
(prompt "\nType VPF to run")
(prin1)

I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

t-bear

  • Guest
Lock viewports
« Reply #6 on: January 28, 2005, 01:48:05 PM »
Yah, that's the other one I was looking for.  Thanks CAB, I can stop looking through the "library" now.......

Crank

  • Water Moccasin
  • Posts: 1503
Lock viewports
« Reply #7 on: January 28, 2005, 02:08:57 PM »
In the help-file of the express tools there is some interesting reading about LAYVPI and LAYVPMODE:
Quote

LAYVPI

--------------------------------------------------------------------------------

Isolates an object's layer to the current viewport

Isolates the layer of the selected object in the current viewport, by freezing the layer in all viewports except the current one. Includes an option to control whether the operation affects all layouts or only the current one.

Command: LAYVPI
sample sample comment
Select an object on the layer to be Isolated in viewport or [Options/Undo]: Use an object selection method, enter O for options or enter U to cancel the previous selection
Select an option [Layouts/Selection]: Layouts
Isolate layers in [All layouts/Current layout] <Current>: All

Select an option [Layouts/Selection]: S
[No nesting/Entity level nesting/]<Block level nesting>: Select an option


Layout Options
All Layouts In all layouts, freezes layers of selected objects in all but the current viewport.
Current Layout In the current layout, freezes layers of selected objects in all but the current viewport. Once this option is set, it is the default until it is changed.

Selection Options
No Nesting Freezes layers of selected objects. If a block or an xref is selected, the layer on which that block or xref is inserted is frozen.  
Entity Level Nesting Freezes layers of selected objects, even if they are nested in an xref or a block.  
Block Level Nesting Freezes layers of selected objects. If a selected object is nested in a block, the layer on which that block is inserted is frozen (similar to the "No Nesting" option). If a selected object is nested in an xref, the layer of the object itself is frozen (similar to the "Entity Level Nesting" option).  

Note:
LAYVPI works only when Tilemode is set to 0 and only in drawings where two or more paper space viewports are defined.

Express menu: Layers  Isolate Layer to Current Viewport
 Command line: LAYVPI
 Files: layvpi.lsp


Quote

LAYVPMODE

--------------------------------------------------------------------------------

Controls whether the layer utilities LAYISO, LAYFRZ and LAYOFF use VPFreeze or the standard layer Freeze or Off when used in a floating paper space viewport.

Command: LAYVPMODE
Use 'VpFreeze' in place of 'Freeze' or 'Off' when in paper space? <Y>: Enter Yes or No


The default value for this command is 'Yes' which means; use vpFreeze in place of freeze or off when in a floating paper space viewport.

Example: by default, LAYISO uses vpFreeze to isolate layers in a floating paper space viewport. The selected layers are isolated in the current viewport only. However, if you enter N (no) at the prompt, LAYISO, LAYFRZ and LAYOFF do not use vpFreeze, but use Freeze or Off.


--------------------------------------------------------------------------------
 Command line: LAYVPMODE
 Files: acetlayr.lsp

;)
Vault Professional 2023     +     AEC Collection

Andrea

  • Water Moccasin
  • Posts: 2372
Lock viewports
« Reply #8 on: January 28, 2005, 10:06:37 PM »
Hey Crank....

Interesting..

the first time i heard this command...

i'll take a try...

thanks.
Keep smile...