Turning off layers

Discussion in 'AutoCAD' started by Jamie Myers, Jul 30, 2003.

  1. Jamie Myers

    Jamie Myers Guest

    I need to turn off all layers execpt for two using lisp. The two are
    "walls" and "headers". I've looked at the tablnext and tblsearch functions
    and they only confused me.

    Thanks
    Jamie Myers
    The EARTHWORKS Group
    Murrells Inlet, SC
     
    Jamie Myers, Jul 30, 2003
    #1
  2. Jamie Myers

    Rudy Tovar Guest

    (command "layer" "f" "*" "t" "walls,headers" "")
    --
    Rodolfo Tovar
    www.Cadentity.com
    AUTODESK
    Authorized Developer
    MASi
    (Modulated Architectural Symbols Innovated)
    Version 2.01
    6 yrs Time Tested and it Works....
    Coming Soon.....
     
    Rudy Tovar, Jul 30, 2003
    #2
  3. Jamie Myers

    Rudy Tovar Guest

    Correction...
    (command "layer" "off" "*" "on" "walls,headers" "")
    --
    Rodolfo Tovar
    www.Cadentity.com
    AUTODESK
    Authorized Developer
    MASi
    (Modulated Architectural Symbols Innovated)
    Version 2.01
    6 yrs Time Tested and it Works....
    Coming Soon.....



     
    Rudy Tovar, Jul 30, 2003
    #3
  4. Jamie Myers

    Jamie Myers Guest

    I need to save the layers so that I may turn them back on? Sorry I didn't
    state that before.

    What is a way to save the state of all the layers and bring only the saved
    set back on after I've done some other things in my lisp? If I have a layer
    already off before this routine, I want to be able to keep it off
    afterwards.
     
    Jamie Myers, Jul 30, 2003
    #4
  5. Jamie Myers

    Rudy Tovar Guest

    Why don't you just use Lman?
     
    Rudy Tovar, Jul 30, 2003
    #5
  6. Jamie Myers

    Jamie Myers Guest

    I dunno how to use that with lisp
     
    Jamie Myers, Jul 30, 2003
    #6
  7. Jamie Myers

    Jamie Myers Guest

    That's helpful info and I will be able to use it, but, How do I get all the
    layer names of my drawing? I can use a while or repeat function to go
    through the list. I just can't figure out how to get the list of layers.

    With your example, (tblsearch "layer" "0"), and I had a layer named XYZ, how
    would I be able to search for layer XYZ and have the routine find it on it's
    own.
     
    Jamie Myers, Jul 30, 2003
    #7
  8. Jamie Myers

    Rudy Tovar Guest

    first layer "0"
    (tblnext "layer" t)
    then
    (tblnext "layer")

    Example
    (tblnext "layer" t)
    (while (setq la (tblnext "layer"))
    (princ la)
    ;do_what_ever
    )
    --
    Rodolfo Tovar
    www.Cadentity.com
    AUTODESK
    Authorized Developer
    MASi
    (Modulated Architectural Symbols Innovated)
    Version 2.01
    6 yrs Time Tested and it Works....
    Coming Soon.....
     
    Rudy Tovar, Jul 30, 2003
    #8
  9. oops, missing the (reverse), if it matters to you.

    ; author - Puckett
    ; - string, valid table name
    ; returns each item name from
    (defun table (s / d r)
    (while (setq d (tblnext s (null d)))
    (setq r (cons (cdr (assoc 2 d)) r))
    )
    (reverse r)
    )
     
    Jason Piercey, Jul 30, 2003
    #9
  10. Jamie Myers

    Rudy Tovar Guest

    He's still going to have to cycle through all the layers and set them then
    OFF if they're not and then recycle them back ON.


     
    Rudy Tovar, Jul 30, 2003
    #10
  11. I understand what needs to be done, I was just answering the
    question being asked.
     
    Jason Piercey, Jul 30, 2003
    #11
  12. Jamie Myers

    Rudy Tovar Guest

    Note this is only good for Layers that are on and thawed.

    Will return that layers list on and thawed.

    So you'll only have to turn on this list.

    --
    Rodolfo Tovar
    www.Cadentity.com
    AUTODESK
    Authorized Developer
    MASi
    (Modulated Architectural Symbols Innovated)
    Version 2.01
    6 yrs Time Tested and it Works....
    Coming Soon.....
     
    Rudy Tovar, Jul 30, 2003
    #12
  13. Jamie Myers

    Jamie Myers Guest

    Okay, what do I use for ? the string "layer"?

    This is what I have come up to now based on Paul's ideas:

    (setq layr nil) ;<-- or just localize the layr variable...
    (while (setq layr (tblnext "layer" (not layr)))
    (if (= (assoc 70 layr) 0) (setq LayerSet (cons (cdr (assoc 2 layr))
    LayerSet)))
    );; while

    And it still doesn't work.

    I don't know if I'm asking the right way, or that it's just too dang
    complicated. Let me try to explain another way. I want the routine to step
    through all the layers in the drawing and retrieve the names of the ones
    that are ON and these will go into a list to be used later to turn all of
    them back on.

    And yet another way:

    Let's say there are layers 1, 2, 3, 4, 5, 6, 7, 8 and 9. 2, 4 and 6 are
    turned off, and 8 and 9 are frozen. Now, I want to turn off 1, 3, 5, 7, 8
    and 9. A little later in the lisp, I will thaw layers 8 and 9. Do some
    other stuff and then freeze 8 and 9 back. Then, I want to turn all layers
    1, 3, 5, 7, 8 and 9, leaving 2, 4 and 6 off.
     
    Jamie Myers, Jul 30, 2003
    #13
  14. Jamie Myers

    Rudy Tovar Guest

    read my last reply to Jason.

    Will return only the layers that are ON and THAWED.

    Then simply turn ON those layers in the list.

    Exactly what you wanted.
    --
    Rodolfo Tovar
    www.Cadentity.com
    AUTODESK
    Authorized Developer
    MASi
    (Modulated Architectural Symbols Innovated)
    Version 2.01
    6 yrs Time Tested and it Works....
    Coming Soon.....




     
    Rudy Tovar, Jul 30, 2003
    #14
  15. Jamie Myers

    Jamie Myers Guest

    No it's not what I need, I don't think. I can't get any information to come
    from this. Either it gives me a *Too few arguments* error from , which I
    have no idea what is supposed to be, or, I can't get the table to use to
    turn all the layers back on. I believe you guys have totally miss what it
    is that I'm needing. Or, maybe you guys need to explain it a little better.
    Tell me what each part of what you guys came up with does, and I might be
    able to figure out which part of it isn't what I want. All I want is a list
    of the fisical layer names, (i.e. walls, doors, windows) in a list ("walls"
    "doors" "windows") and a way to turn on these layers when done. I don't
    care about if they are frozen or not. If they are on when the routine
    starts, then they will be on when it ends.

    --
    Rabbit
    --
    Drafters triangle:
    Quality + Quickness = Lisp Expert
    Quality + Cheap = Salary Worker
    Timely + Cheap = Trained Monkey


     
    Jamie Myers, Jul 30, 2003
    #15
  16. Jamie Myers

    Jamie Myers Guest

    Do I have to feed this routine a list of the layers I want turned off, or
    will it turn off all of them on it's own. If it turns them all off, I can
    do a (command "_layer" "on" *Layer I want on* "") Then after I get done
    with the rest of my lisp, I'll be able to turn all of them back on, right?

     
    Jamie Myers, Jul 30, 2003
    #16
  17. You feed IsoLayers a list of layers that you want left ON. The UnIsolayers
    function will restore the layers to their on/off states at the time that the
    IsoLayers was run, no matter what other layer on/off hoops you've jumped
    through in between.
     
    Bobby C. Jones, Jul 30, 2003
    #17
  18. Jamie Myers

    Rudy Tovar Guest

    I read the last response which I feel you didn't understand.

    The utility returns layers that are ON, you simple make sure that you turn
    OFF the LIST RETURNED. Then You TURN ON the LAYERs for WALLS AND HEADERs,
    then Toggle the LIST of LAYERs ON again.

    Sorry you didn't understand, but I don't want credit, I want you to LEARN
    how it WORKS.
     
    Rudy Tovar, Jul 30, 2003
    #18
  19. Jamie Myers

    Jamie Myers Guest

    Yes, I do wanna learn this, but what really throws me at the very biginning
    of that routine is the argument . What needs to be sent to it?
     
    Jamie Myers, Jul 31, 2003
    #19
  20. Take another look at the header of that function.

    ; - string, valid table name <<<<<<

    --

    -Jason
    Member of the Autodesk Discussion Forum Moderator Program




    <SNIP>
     
    Jason Piercey, Jul 31, 2003
    #20
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.