Macro to apply hatch

Discussion in 'AutoCAD' started by Peter Kastmiler, Feb 9, 2005.

  1. Is there any better way to apply hatching than this toolbar macro which I made into a button:

    ^C^C-layer;set;a_hatch;^C-h;ansi31;8;0;

    I got the idea to create a button for the 6/7 hatches that I use constantly. It seemed like a good idea to save keystrokes. However, this routine forces me to select an object, what about picking inside a boundary. How could that be accomplished?

    Thanks in advance for any suggestions.
    PK
     
    Peter Kastmiler, Feb 9, 2005
    #1
  2. Peter Kastmiler

    petervose Guest

    How about
    (command "layer" "m" "a_hatch" "")
    (command "bhatch" pause "p" "ansi31" "8" "0" "")
     
    petervose, Feb 9, 2005
    #2
  3. While typing in a plain H (if you keep AutoCAD's standard shortcuts) gives
    you the BHATCH command, typing in -H gives you the regular old HATCH
    command, not BHATCH without the dialog box, and that doesn't allow point
    selection. You need to use -BHATCH if you're in a script or macro. Withing
    a (command) function, you don't need the hyphen (see petervose's reply).
     
    Kent Cooper, AIA, Feb 9, 2005
    #3
  4. I use these a lot. They were developed by input from this group
    Draw a rectangle/pline, set your dimscale to 30 or so, load the lisp and
    click inside the rectangle/pline
    BHA - hatches with a line ansi31
    CHA - hatches with a solid
    FHA - hatches with a user hatch
    RHA - hatches with a dot pattern

    They all capture the current layer, set a new layer, get the dimscale for
    hatch scale, perform the hatch, and reset the saved layer.
    I load them with the acad.lsp file using a partial load approach:
    (defun c:bha()(load "LSP/bha")(c:bha));
    To run I just need to type bha

    Hope this gets you started
    ~KRK~


    constantly. It seemed like a good idea to save keystrokes. However, this
    routine forces me to select an object, what about picking inside a boundary.
    How could that be accomplished?
     
    Kevin R. Knox, Feb 10, 2005
    #4
  5. Thanks for the fine suggestions.

    I ended up using the "command..." routine for my macros. The autolisp routine got me thinking, is it possible to run two bhatch command routines on the same pick area? Such as:

    (command "layer" "s" "a_hatch" "")
    (command "bhatch" pause "p" "lines_horiz" "1.25" "0" "") (command "bhatch" "p" pause "ansi32" "3.0" "0" "")

    Thanks,
    PK
     
    Peter Kastmiler, Feb 11, 2005
    #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.