layer manager help

Discussion in 'AutoCAD' started by lukebui, Jan 27, 2004.

  1. lukebui

    lukebui Guest

    I create a button that tell it to restore a certain layer manager and plot it out. I have a problem that if the layer manager doesn't exist then it cancel the command.

    Is there a way that i can told it to loop that command. meaning that If it doesn't find the layer then skip to the next.

    Thank for your help
     
    lukebui, Jan 27, 2004
    #1
  2. lukebui

    Scot-65 Guest

    :

    Lukebui,

    Try this:

    (if (tblsearch "Layer" "Desired_layer") (freeze/thaw/off/on) );if


    Is this what you are looking for?

    Scot-65
     
    Scot-65, Jan 30, 2004
    #2
  3. lukebui

    ECCAD Guest

    I'm not sure what you mean by 'layer manager', however, you can check if a 'layername' exists, and take action, based on that. Here is a function to check if a layer exists.

    ;; check_layer.lsp
    ;;
    ;; Usage: (setq Check (check_layer "mylayername")) -> in Lisp
    ;; Returns: 'Check'
    ;; (if (= Check 1); layer name was found
    ;; (if (= Check 0); layer name was not found
    ;;
    (defun check_layer (la_name / laylist lt ln lx)
    (setq laylist nil Check 0)
    (setq lt (tblnext "LAYER" T)); reset to top of Table
    (while (setq lt (tblnext "LAYER"))
    (setq ln (cdr lt))
    (setq lx (strcase (cdr (assoc 2 ln))))
    (if (or (= la_name "0")(= lx (strcase la_name)))
    (setq Check 1)
    ); end if
    ); end while
    (princ)
    ); end function
    (princ); silent load
     
    ECCAD, Jan 31, 2004
    #3
  4. lukebui

    ECCAD Guest

    If you mean the 'layer manager' functions (in Bonus Tools, R14) don't exist (when you pick the button), Then in your Acad.lsp file do:
    (if (findfile "ac_bonus")(load "ac_bonus")); load bonus tools
     
    ECCAD, Jan 31, 2004
    #4
  5. lukebui

    ECCAD Guest

    Correction.
    (if (findfile "ac_bonus.lsp")(load "ac_bonus.lsp")); load bonus tools

    Sorry bout that.

    Bob
     
    ECCAD, Jan 31, 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.