Author Topic: WHAT IS THE VARIABLE FOR "DISPLAY LOCKED"  (Read 3466 times)

0 Members and 1 Guest are viewing this topic.

STEVEDALLAS

  • Guest
WHAT IS THE VARIABLE FOR "DISPLAY LOCKED"
« on: April 30, 2007, 11:39:11 AM »
In Autocad 2004, what is the variable for the viewport being "display locked"?
I am trying to write a lisp that toggles it on or off.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: WHAT IS THE VARIABLE FOR "DISPLAY LOCKED"
« Reply #1 on: April 30, 2007, 11:51:39 AM »
Quote
; IAcadPViewport2: AutoCAD Paperspace Viewport Object
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00c2eb8c>
;   ArcSmoothness = 1000
;   Center = (4.9068 4.28198 0.0)
;   Clipped (RO) = 0
;   CustomScale = 0.531946
;   Direction = (0.0 0.0 1.0)
;   DisplayLocked = -1
<snip>
??

You could use ':vlax-true' or ':vlax-false' to set this also.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: WHAT IS THE VARIABLE FOR "DISPLAY LOCKED"
« Reply #2 on: April 30, 2007, 12:09:13 PM »
I don't think there is a system variable for that.
If you are in paper space & had 5 viewports, how would the variable differentiate between them?

You would have to approach it as Tim has suggested.


Not sure I understood the question though.
« Last Edit: April 30, 2007, 12:12:37 PM by CAB »
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.

Maverick®

  • Seagull
  • Posts: 14778
Re: WHAT IS THE VARIABLE FOR "DISPLAY LOCKED"
« Reply #3 on: April 30, 2007, 12:23:55 PM »
there is no sysvar for that as far as I know... try to follow up what Tim recommended. have fun

This post was quoted from the OP in 1 pt. font which I quoted so that the people who are reading this thread would be able to see it.  The post that I quoted was later deleted by the OP.  That is all. Go on about your business. Nothing to see here.....
« Last Edit: April 30, 2007, 02:16:02 PM by Maverick® »

STEVEDALLAS

  • Guest
Re: WHAT IS THE VARIABLE FOR "DISPLAY LOCKED"
« Reply #4 on: April 30, 2007, 12:32:15 PM »
OK, Here is my explanation.
We have a guy here that creates his viewports, locks the layer, then under properties selects "displaylocked yes".

So, If I need to do anything with it. I need to unlock and thaw the viewport layer, then select it, hit properties, scroll down to display locked, change that to "no".

Then fix it back when done.
The layer locking and thawing is no problem.
The layer lock takes more time than I wish to spend doing it.

Bottom line, That is what I am trying to write a routine to do.

ronjonp

  • Needs a day job
  • Posts: 7527

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

T.Willey

  • Needs a day job
  • Posts: 5251
Re: WHAT IS THE VARIABLE FOR "DISPLAY LOCKED"
« Reply #6 on: April 30, 2007, 12:55:19 PM »
This is how I would do it.  I would use 'ssget' to select all the viewports active in the layout.  I would gather their layers, while I step through them and unlock them all.  Then I would unlock all the layers that the viewports are on.  You can make a list that will save all the information so that it can be put back after you are done.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

STEVEDALLAS

  • Guest
Re: WHAT IS THE VARIABLE FOR "DISPLAY LOCKED"
« Reply #7 on: April 30, 2007, 12:59:15 PM »
These are great, however.
I get ---"Error: Automation Error. On locked layer",   when I try vpunlockall

Question: What is with the color changing?

ronjonp

  • Needs a day job
  • Posts: 7527
Re: WHAT IS THE VARIABLE FOR "DISPLAY LOCKED"
« Reply #8 on: April 30, 2007, 01:03:22 PM »
No error checking for locked layers......the color changing is just for visual aid to see if the viewport is locked or unlocked. This can be taken out fairly easy.

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

STEVEDALLAS

  • Guest
Re: WHAT IS THE VARIABLE FOR "DISPLAY LOCKED"
« Reply #9 on: April 30, 2007, 01:08:57 PM »
How do I get rid of the automation error?

STEVEDALLAS

  • Guest
Re: WHAT IS THE VARIABLE FOR "DISPLAY LOCKED"
« Reply #10 on: April 30, 2007, 01:15:41 PM »
ok, That is strange.
The routine by CAB now started working fine, no error.

THANKS EVERYONE!

ronjonp

  • Needs a day job
  • Posts: 7527
Re: WHAT IS THE VARIABLE FOR "DISPLAY LOCKED"
« Reply #11 on: April 30, 2007, 01:21:57 PM »
FWIW,

This should fix the locked layer error:

Code: [Select]
(defun unlock_all_layers (/)
  (vlax-map-collection
    (vla-get-layers
      (vla-get-activedocument (vlax-get-acad-object))
    )
    '(lambda (x)
       (cond ((eq (vla-get-lock x) :vlax-true)
      (setq lock (cons x lock))
      (vla-put-lock x :vlax-false)
     )
       )
     )
  )
 (princ)
)
(defun restore_locked_layers (/)
  (if lock
    (mapcar '(lambda (x)
       (vla-put-lock x :vlax-true)
     )
    lock
    )
  )
  (setq lock nil)
  (princ)
)
(defun c:vplockall (/ X lck prmpt ent clr clr2 obj)
  (vl-load-com)
  (unlock_all_layers)
  (initget 0 "Lock Unlock")
  (if (not *default*)
    (setq *default* "Lock")
  )
  (setq
    X (cond
((getkword
   (strcat
     "\n (L)ock or (U)nlock all viewports?  <<Hit Enter for "
     *default*
     ">>: "
   )
)
)
(*default*)
      )
  )
  (setq *default* X)
  (cond ((= X "Lock")
(setq lck   :vlax-true
       prmpt "locked..."
       clr   5
       clr2  acBlue
)
)
((= X "Unlock")
(setq lck   :vlax-false
       prmpt "unlocked..."
       clr   1
       clr2  acRed
)
)
  )
  (vlax-for lay (vla-get-layouts
  (vla-get-activedocument
    (vlax-get-acad-object)
  )
)
    (if (eq :vlax-false (vla-get-modeltype lay))
      (vlax-for ent (vla-get-block lay)
(if (= (vla-get-objectname ent) "AcDbViewport")
  (progn
    (vla-put-displaylocked ent lck)
    (vla-put-color ent clr)
    (if (setq
  obj (assoc 340 (entget (vlax-vla-object->ename ent)))
)
      (vla-put-color (vlax-ename->vla-object (cdr obj)) clr2)
    )
  )
)
      )
    )
  )
  (restore_locked_layers)
  (princ (strcat "\n All viewports have been " prmpt))
  (princ)
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

STEVEDALLAS

  • Guest
Re: WHAT IS THE VARIABLE FOR "DISPLAY LOCKED"
« Reply #12 on: April 30, 2007, 01:32:05 PM »
That did it.
Thanks again.