How to make this work

Discussion in 'AutoCAD' started by Kevin R. Knox, Jan 7, 2005.

  1. I have a macro to hatch stuff. It works. I want it to set a layer and then
    reset the original layer when finished, but it bombs. The lisp reads the
    DIMSCALE part correctly.

    (DEFUN C:RHA ()
    (SETQ DS (GETVAR "DIMSCALE"))
    (SETQ CLAY (GETVAR "CLAYER"))
    (COMMAND "._LAYER" "M" "HATCH-PVMT" "CO" "8" "" "")
    (COMMAND "-BHATCH" "P" "DOTS" DS "E" "A" "I" "Y" "S" "N" "A" "Y" "")
    ;(COMMAND "LAYER" "SET" CLAY "")
    (PRINC))

    The line commented out is the culpret. How do I end the -BHATCH command
    nicely so the layer command works?
     
    Kevin R. Knox, Jan 7, 2005
    #1
  2. Kevin R. Knox

    ecable Guest

    (setvar "clayer" clay)
    Should work
     
    ecable, Jan 7, 2005
    #2
  3. Kevin R. Knox

    OLD-CADaver Guest

    <<(setvar "clayer" clay) Should work >>

    So should his (command "layer" sequence. I suspect something's askew with the BHATCH line, like he's missing a response for hatch angle... or something.

    What version of AutoCAD? R2002 requires a response for angle right after scale.
     
    OLD-CADaver, Jan 7, 2005
    #3
  4. Kevin R. Knox

    GaryDF Guest

    Try this out...

    error in your bhatch command.. you had E for angle?
    setvar "clayer" clay...to return to previous layer
    localized variables (/ ds clay)


    (defun C:RHA (/ ds clay)
    (setq DS (getvar "DIMSCALE") CLAY (getvar "CLAYER"))
    (command ".-layer" "M" "HATCH-PVMT" "CO" "8" "" "")
    (command ".-bhatch" "P" "DOTS" DS "" "A" "I" "Y" "S" "N" "A" "Y" "")
    (while (> (getvar "cmdactive") 0)(command pause))
    (command "")
    (setvar "clayer" CLAY)
    (princ)
    )

    Gary
     
    GaryDF, Jan 7, 2005
    #4
  5. GaryDF,
    Thanks... but
    The layer HATCH-PVMT is created but the hatch ends up on CLAY not HATCH-PVMT
    The E for angle = east to ACAD

    How to get hatch on HATCH-PVMT layer and CLAY to be final layer?

    ~KRK~
     
    Kevin R. Knox, Jan 7, 2005
    #5
  6. Kevin R. Knox

    GaryDF Guest

    Selected new hatch, is on Layer: "HATCH-PVMT"


    Select objects:

    HATCH Layer: "HATCH-PVMT"
    Space: Model space
    Handle = 9EB1
    Hatch pattern DOTS
    Hatch scale 48.00000000
    Hatch angle 0.0000
    Associative



    hatched on new layer and previous layer returned.
    works fine here...using autocad 2005 windows 2000

    Gary
     
    GaryDF, Jan 7, 2005
    #6
  7. Kevin R. Knox

    ecable Guest

    Works in A2000i W2K
    HATCH Layer: "HATCH-PVMT"
    Space: Model space
    Handle = 38C
    Hatch pattern DOTS
    Hatch scale 96.0000
    Hatch angle 0
    Associative
    CLAY is current
     
    ecable, Jan 7, 2005
    #7
  8. I pasted all but the last ) works like a charm Thanks!
     
    Kevin R. Knox, Jan 8, 2005
    #8
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.