Bhatch in Lisp

Discussion in 'AutoCAD' started by FrenkZA, Dec 23, 2004.

  1. FrenkZA

    FrenkZA Guest

    After making a new layer i want the current layer back after the command Bhatch.
    But in the dialogbox Bhatch i can only select one object.
    or i can select "inherit properties"
    Does anybody kwows, what i have done wrong???
     
    FrenkZA, Dec 23, 2004
    #1
  2. FrenkZA

    T.Willey Guest

    Why don't you just change the layer of the hatch after the command is finished?

    Tim
     
    T.Willey, Dec 23, 2004
    #2
  3. FrenkZA

    Dommy2Hotty Guest

    Have a look...

    Code:
    ;;***********************************************
    ;;           Hatch_EL_Siding_4in.lsp            *
    ;;          Created by Dominic Cesare           *
    ;;                           *
    ;;                 02.27.04                     *
    ;;             Revised: 03.03.04                *
    ;;             Revised: 04.16.04                *
    ;;***********************************************
    
    ;;**********************
    ;;*  Start of Routine  *
    ;;**********************
    
    ;informs user how to run lisp
    (prompt "\nType Hatch_Elevation_Siding_4in to run.....")
    
    ;define function
    (defun c:Hatch_Elevation_Siding_4in ()
    (setq temperr *error*)
    (setq *error* trap1)
    ;getting current vars
    (setq oldlayer (getvar "clayer"))
    (setq oldecho (getvar "cmdecho"))
    (setq oldhpname (getvar "hpname"))
    (setq oldhpspace (getvar "hpspace"))
    (setq oldhpang (getvar "hpang"))
    ;turning off echo
    (setvar "cmdecho" 0)
    ;creating layer BRICK-EL
    (command "-layer" "m" "EL-HATCH-SIDING" "c" "251" "" "")
    ;setting hatch vars
    (setvar "hpname" "_user,_o")
    (setvar "hpspace" 4)
    (setvar "hpang" 0)
    ;inform user to change snapbase variable
    (prompt "\nSelect Origin for hatch or ENTER for no change.....")
    ;starting snapbase command
    (command "snapbase")
    (while (eq (logand (getvar "CmdActive") 1) 1)
    ; get user's input
    (command pause)
    ;_ closes while
    )
    ;inform user to select internal point for hatch
    (prompt "\nSelect Internal Point.....")
    ;starting hatch command
    (command "-bhatch")
    (while (eq (logand (getvar "CmdActive") 1) 1)
    ; get user's input
    (command pause)
    ;_ closes while
    )
    ;setting old vars
    (setvar "hpname" oldhpname)
    (setvar "hpspace" oldhpspace)
    (setvar "hpang" oldhpang)
    (setvar "clayer" oldlayer)
    (setvar "cmdecho" oldecho)
    (setq *error* temperr)
    (princ)
    )
    
    (defun trap1 (errmsg)
    (command "u")
    (setvar "hpname" oldhpname)
    (setvar "hpspace" oldhpscale)
    (setvar "hpang" oldhpang)
    (setvar "clayer" oldlayer)
    (setvar "cmdecho" oldecho)
    (setq *error* temperr)
    (prompt "Resetting System Variables...")
    (princ)
    )
    
    ;;**********************
    ;;*  End of Routine    *
    ;;**********************
     
    Dommy2Hotty, Dec 23, 2004
    #3
  4. FrenkZA

    FrenkZA Guest

    Thanks very much,

    the lines:

    (while (eq (logand (getvar "CmdActive") 1) 1)
    (command pause)

    closed the bhatch command before i changed the layer
     
    FrenkZA, Dec 24, 2004
    #4
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.