Results 1 to 8 of 8

Thread: Automatically Thaw All Layers Changing From Tilemode 1 To 0

  1. #1
    100 Club
    Join Date
    2005-04
    Posts
    112
    Login to Give a bone
    0

    Question Automatically Thaw All Layers Changing From Tilemode 1 To 0

    When I am on the Model Tab (Tilemode 1) & am using a current named layer state with some of the layers frozen, upon clicking on one of my layout tabs (change back to Tilemode 0), I would like a lisp routine to automatically thaw all layers (Command is LAYTHW), so my layers are frozen or thawed per viewport the way I set them up per viewport on each layout tab.

    Otherwise, I have to remember to manually use LAYTHW once I am back on a layout tab. If I don't, some of my layers are globally frozen in all viewports. This can be a major headache if I forget to do this prior to plotting to a multi-page pdf file (1 layout tab per single page in the multi-page pdf file), because some of the layers on some of the layouts will be un-intentionally frozen.

    Thanks

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Automatically Thaw All Layers Changing From Tilemode 1 To 0

    As Layer States store all the properties not just frozen or thawed you would be better served with a lisp that toggles a group of layers frozen or thawed.

    This to toggle a layer thaw/frozen: http://www.cadtutor.net/forum/showth...l=1#post466953

    Jimmy Bergmark has a lisp that toggles a group of layers frozen or thawed on his Free Autolisp page: http://jtbworld.com/autolisp-visual-lisp

  3. #3
    100 Club
    Join Date
    2005-04
    Posts
    112
    Login to Give a bone
    0

    Default Re: Automatically Thaw All Layers Changing From Tilemode 1 To 0

    I have my Layer States set up to restore ONLY the visibility properties of layers, not all layer properties. So again, l want a lisp routine that AUTOMATICALLY thaws all layers (Command is LAYTHW) when I change TILEMODE from 1 to 0.
    Last edited by rbdome; 2017-06-02 at 05:25 PM.

  4. #4
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Automatically Thaw All Layers Changing From Tilemode 1 To 0

    Can you attach a small drawing with a layer state that only includes freeze/thaw state for its layers? What version of AutoCAD are you using?

  5. #5
    100 Club
    Join Date
    2005-04
    Posts
    112
    Login to Give a bone
    0

    Post Re: Automatically Thaw All Layers Changing From Tilemode 1 To 0

    Version 2018. Attached is the Layer States Manager Dialog- After you create a Named Layer State, Click Clear All Button, then check only those Layer properties you want to restore for that Named Layer State. Then click the Update Button. You can do this in prior AutoCAD versions, although the Update button was referred to as the Save button prior to ACAD 2018.
    Attached Files Attached Files

  6. #6
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Automatically Thaw All Layers Changing From Tilemode 1 To 0

    This will create layerstate lsname if there isn't one and turn all layers on & thawed.
    Otherwize it will restore then delete the layer state:
    Code:
    (defun c:LayAll (/ CMD lsname)  (setq CMD (getvar "Cmdecho"))
      (setvar "Cmdecho" 0)
      (setq lsname "Off_or_Frozen")
      (if (layerstate-has lsname)
        (progn
          (layerstate-restore lsname nil nil)
          (princ "\nOff or Frozen layers restored")
          (layerstate-delete lsname)
        )
        (progn
          (layerstate-save lsname nil nil)
          (command "layon" "laythw")
    ;      (command "vplayer" "t" "*" "Current" "")
        )
      )
      (setvar "Cmdecho" CMD)
      (princ)
    )
    Macro to toggle all the layers visible:
    Code:
    ^C^C^P(or C:LayAll (load "LayAll.lsp"));LayAll
    - - - Updated - - -

    Quote Originally Posted by rbdome View Post
    Version 2018. Attached is the Layer States Manager Dialog- After you create a Named Layer State, Click Clear All Button, then check only those Layer properties you want to restore for that Named Layer State. Then click the Update Button. You can do this in prior AutoCAD versions, although the Update button was referred to as the Save button prior to ACAD 2018.
    As you didn't want to use the Layer States Manager Dialog to restore the layers that doesn't really help. All the properties are still saved in the layer state. Lots of ways to do this just not using layer state commands or lisp functions.

  7. #7
    100 Club
    Join Date
    2005-04
    Posts
    112
    Login to Give a bone
    0

    Default Re: Automatically Thaw All Layers Changing From Tilemode 1 To 0

    Thanks,
    But this looks like it won't be done AUTOMATICALLY if I change from Tilemode 1 to 0. Am I not understanding something? The lisp code should include reference to the TILEMODE System Variable, in order for the automation to occur, should it not? I am a lisp newbie- I don't know the code for reference to TILEMODE in the lisp script.

  8. #8
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Automatically Thaw All Layers Changing From Tilemode 1 To 0

    Bon apetite.

    You will need to change the layering using activex NOT command pipe expressions!!! (they do not work with reactors)

    P=

    Code:
    (defun sysvarCallBack (rxnCall lstCallback)
     (if (= (car lstCallback) "TILEMODE")
      (if (=  (vlax-invoke  (vla-get-activedocument (vlax-get-acad-object)) "getvariable" "Tilemode") 1)
       (princ "\nIm in Model Space!\n")
       (princ "\nIm not in Model Space!\n")
      )
     )
    )
    
    (setq rxnSysVar  (vlr-sysvar-reactor nil '((:vlr-sysvarchanged . sysvarCallback))))
    (vl-load-com)
    Last edited by peter; 2017-06-07 at 11:36 PM.
    AutomateCAD

Similar Threads

  1. Temporarily Thaw/turn-on all layers.
    By Wish List System in forum AutoCAD Wish List
    Replies: 7
    Last Post: 2014-10-30, 05:22 AM
  2. Reading Attribute Value to Thaw and Freeze layers
    By gvriend820643 in forum AutoLISP
    Replies: 7
    Last Post: 2011-10-05, 09:36 PM
  3. Lisp Routine to Thaw layers when plotting
    By rscampoli in forum AutoLISP
    Replies: 13
    Last Post: 2010-11-24, 02:47 PM
  4. Tilemode Automatically Z. Extents
    By CADDMIAMI in forum AutoCAD General
    Replies: 1
    Last Post: 2009-10-20, 05:46 PM
  5. Freeze & Thaw Layers
    By rhayes.99001 in forum ACA General
    Replies: 1
    Last Post: 2007-08-23, 01:49 AM

Posting Permissions

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