wanted LISP routine for switching layers

Discussion in 'AutoCAD' started by Frank Richarz, Jan 22, 2004.

  1. First off, I'm not even sure this is possible but I thought I'd ask.

    I have a drawing sheet that contains both a ceiling plan and a floor plan.
    I have a script that will turn the correct layers on and off, but when I put
    both of these drawings on the same sheet I cannot turn one on without
    turning the layers off for the other one. I have had to go into the
    viewport and manually turn the layers on and off.

    Is there a way to do this with a script, that I could go into the viewport
    and run the script, then go into the other viewport and run another script
    without effecting the first one.

    Like I said, I'm not sure if its even possible.

    Thanks for your help.
     
    Frank Richarz, Jan 22, 2004
    #1
  2. Frank Richarz

    Jeff Mishler Guest

    Yes, use vplayer inplace of layer.....and in vplayer there is no "off/on",
    only "freeze/thaw"

    Jeff
     
    Jeff Mishler, Jan 22, 2004
    #2
  3. Frank Richarz

    Mike Weaver Guest

    Frank,
    If the plans are separate xrefs you can put them on their own layer and
    vpfreeze that layer in the appropriate viewport.

    If the two plans reside in the same drawing can modify your script to use
    the vplayer command instead of layer.

    Mike Weaver
     
    Mike Weaver, Jan 22, 2004
    #3
  4. Frank Richarz

    tsigwing Guest

    I've done a similar type thing. When I get the viewport showing what I want, I store the layer names for the layers that are turned on and not frozen in that viewport. I have a reactor that runs so that whenever you change layouts, it checks to see if the viewports have this information and if so it will do a vplayer freeze for all layers except that list that I stored. Works like a champ. Does add about a 5 second delay for really big drawings though when you change sheets.
     
    tsigwing, Jan 22, 2004
    #4
  5. Frank Richarz

    James Buzbee Guest

    "but when I put both of these drawings on the same sheet"
    If you mean you xref the "base drawing" into a plot sheet . . . forget
    vplayer. Here's what I do: Xref in "MyBasePlan.dwg" and rename it, in the
    xref manager, to "MyBasePlanRCP". Move it over in a clear space and then
    Xref it in again. Now you have 2 seperate xrefs with 2 seperate names, so
    the layers are appended as follows: "MyBasePlanRCP|A-Wall" and
    "MyBasePlan|A-Wall". See?

    Your script will need to differentiate between the two - (strcat
    "MyBasePlanRCP|" lname) for the layer name.

    I actually do this with a lisp routine that compares my standard layer
    states in a database drawing to layers in the active document - and I can
    filter xrefs.

    jb
     
    James Buzbee, Jan 23, 2004
    #5
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.