Layer States Manager For AutoCAD For Mac (Visual Friendly CLI)

A layer state is a combination of layer settings (On/Off, Freeze/Thaw, etc.) that can be saved and later restored. Layer states differ from layer filters in that filters simply allow you to “save” short lists of layers, whereas layer states allow you to save different visibility and properties settings for use at a later time. A layer state saves all the visibility and properties settings for all the layers in the drawing. Saving multiple layer states allows you to quickly reset particular On/Off, Freeze/Thaw, etc. combinations to improve your efficiency working with particular groups of layers.

In OTB AutoCAD for Mac you can manage layer states (most of the really important layer state operations) using the “stAte” option of “-LAYER” command (you can do the basics like saving, restoring and deleting layer states). But going trough command prompts, typing different options sometimes is not very convenient. Moreover, being inside the command-LAYER it is quite difficult to work with the names of layer states – every time you have to type a question mark to see a list of layer states, stored in a drawing.

So, now I want to present you my AotoLISP routine, that made command line interface (CLI) to “Layer States Manager” more visual friendly. In this routine I have used build-in AutoLISP functions for layer states manipulations – (layerstate-xxx). For the moment my routine allows you to perform basic operations with layer states:

  • list layer states names saved in the drawing,
  • save new layer states
  • restore saved layer states
  • delete existing layer states
  • export layer state to .LAS file and import layer state from .LAS file

With LMAN you can restore layer states in Model space and in viewports in Layouts (you can restore layer states for each viewport individually). Importing layer states from drawing files is not supported in my routine, for now you have to open DWG file, export layer state to .LAS file and then import it to another DWG.

How to use

If you want to save specific layer state, you have first to setup layers via Layers Palette. After you load routine via APPLOAD command, you can type LMAN command to start routine, then you will see all available options:

If you select “?” – you will see all layer states saved in drawing. Save option lets you to save new layer state with specific settings. For now routine allows you to save all property settings together (On/Off, Freeze/Thaw, Color, Visibility in current VP, Lock/Unlock, Linetype, Lineweight, etc.), if you want to save only specific settings for each layer state, you should use “Save” option of “stAte” inside “-LAYER” command.

If you choose “Restore”, “EXport” or “Delete” option, you will be presented with list of layer states (it creates dynamically) from which you can select particular state to operate with:

You can always exit from any of options (or from command itself) by hitting Return key on keyboard, because “eXit” is default option.

If you want to learn more about using layer states, please refer to AutoCAD 2011 (2012) Online Help.

In my routine I have used (cvport-ename) function from “Working with Layer States in AutoCAD for Mac” post by Tom Stoeckel.

To try LMAN for AutoCAD for Mac – download it here LayerStates v.1.0.zip, uzip and place to some folder in your Home folder, then use APPLOAD command to load it for use in AutoCAD. Please, feel free to leave your feedback and comments.

EDIT: I just have updated LMAN routine. Now it includes ability to redefine (i.e. save new state of layers under existing name)  Layer State inside drawing or when importing Layer State from .LAS file. Download link –  LayerStates v.1.1.zip.

EDIT 2: New version of LMAN routine available for download – LayerStates v.1.2.zip – I have fixed the bug related to the current units in drawing file.

Advertisements

17 Responses to “Layer States Manager For AutoCAD For Mac (Visual Friendly CLI)”

  1. This is exactly what I was looking for! It would be great if mac would someday adopt the robust, early 00’s layer state manager that used to exist in the windows version. Keep up the good work! Love all of these routines!

  2. Upon further review, there does not seem to be a way to simply update a layer state. You would have to delete the state and then re-save if you wanted to use the same name.

    • maximka2010 Says:

      Hi nards,
      Thank you for your comment. When I asked to leave comments, I meant exactly this kind comments: suggestions and reports about bugs.
      So now you can try updated version of LMAN (see end of post).

  3. […] LMAN routine. Now it includes ability to redefine (i.e. save new state of layers under existing name)  […]

  4. Great work,webmaster,nice design!

  5. Hi Maxim,
    Love the site. Thank you for your hard work and dedication.
    I have AutoCAD 2011 for Mac. I primarily use my 15″ Macbook Pro for my CAD work. I have a lot of difficulty using the layer manager. I can’t easily switch current layers unless I close and then reopen the file. The same applies for adding layers. If I hit the add layer button, nothing happens. Then after opening and closing the file the added layer appears. Is this something that others are having problems with? Do you think AutoCAD will address this?
    Any help would be greatly appreciated.
    All the Best,
    Kevin

    • maximka2010 Says:

      Hi Kevin,
      Actually I didn’t have these issues with Layer Manager at all, so looks like I can not help you at the moment. I think these Layer troubles could depend on many reasons: amount of RAM on your Mac, DWG file size, and most important – quantity of layers in your file. Do you have such issues in files with just a few layers? Have you tried to change/add layers when Layer manager is in undocking position?
      Maxim

  6. Thanks for the reply Maxim,

    I only have 10 or less layers in my drawing. The drawing file is a house floor plan, very small file 287 KB.
    The computer is the newest macbook pro with a 2 GHz intel Core i7 processor with 4 GB of memory. I am using the latest 10.6 Mac OS. I don’t think I can manually allocate more memory to the autoCAD application, but I’m not sure. I know in previous versions of snow leopard you could.
    I have monitored the CPU usage and even with multiple applications running in the background Im barely pushing 50%. Generally I only open autoCAD when working, so no other applications are running that I know of.
    I always have layer manager docked, so no I never tried to add layers with the manager undocked.
    Kevin

    • maximka2010 Says:

      Hi Kevin,
      As I wrote before – I didn’t have these issues with Layer Manager at all. So looks like I couldn’t help you 😦
      The only one thing I can advise – try to “Reset Application Options…” on Application tab of Preferences dialog.
      Maxim

  7. Hi Maxim,

    Been trying the LMAN routine for a little while today. Nice routine – very much appreciated.

    Question as to whether there is a limit to the number of saved layer states that will work under this routine. I use six typically, but can only get four to function. The bottom two do nothing. I have tried this form several different angles, including opening a drawing that contains the layer states (it recognizes all six); I have re-saved the layer states; I have deleted and imported the layer states, but continue to have the same results. Not sure if I’m doing something wrong, but would be happy to share the dwg file with you for your own testing if appropriate.

    ….

    Mac specifics:

    MacBook Pro, 2.66 GHz Intel Core i7 with 8 GB 1067 MHz DDR3 RAM; Mac OS X 10.6.7 (I know … there are a lot of problems 10.6.7 caused).

    Thanks again for what you have put together here.

    Rick

    • maximka2010 Says:

      Hi Rick,

      I have tested LMAN with more than 6 layer states and it seems to work properly for me. Could you share your problem file? I’ll try to test it.
      (I sent email to you)
      EDIT: Could you try also LMAN routine with some modifications – LayerStates-1_2.fas.zip.
      Let me know if it works with your file

  8. Jim LaPier Says:

    Thanks so much for this routine! Its great! Had a question, if I may impose.
    I’d like to do 2 things.
    1) import a group of .las files instead of one at a time. I thought about accomplishing this through your routine, having it run through a macro and loading each one individually, but I can’t seem to suppress the file selection dialog box.
    2) I’d love to automate this (really, duplicate it and remove some functionality) to be able to have a user enact the command, it immediately goes to the restore drop down, and when one is selected, end the command.

    I’m going to try to do this myself with the great tools and resources you’ve listed, but I wanted to thank you for your site and giving me a path to start down with this routine.
    Great job!

    • maximka2010 Says:

      Hi Jim,

      Thank you for appreciating my work!
      Regarding to your questions – of course you can change the functionality of the program (or rather a simplified version), but unfortunately I now do not have enough free time to do so. I will try to do it later (if you do not get ahead of me 😉 )
      Let me know if you need “source code” of my routine, I can send it to you. I can also publish successful results (if any) of your work here, on macacad.com

      Maxim

      • Jim LaPier Says:

        Maxim-
        If you could send me the source code, that would be AWESOME!
        I’ll send you a message with my email on a forum we both frequent.
        Thanks!

        Jim

      • Jim LaPier Says:

        OK, I didn’t realize I couldn’t send a PM through that forum.
        If you could send the lisp to jimlapier@me.com, I’d appreciate it so much. I’ll let you know when its tweaked for my needs so you can post it!
        Jim

  9. hi there, i thouroughly enjoyed going through your blog. thanks for the job well done.

  10. Hi there, i just wanted to drop you a line to say that i thoroughly enjoyed this particular post of yours, I have subscribed to your RSS feeds and have skimmed a few of your posts before but this one really stood out for me. I know that I am just a stranger to you but I figured you might appreciate the appreciation 🙂 – Take care – and keep blogging.

Comments are closed.

%d bloggers like this: