[Search tip detail and code files using keywords, tip number, author name, etc ]
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
Create Hatch Patterns with Macros in LISP
Tip# 3965 By Steven Matchett On 27-Aug-2012
Rated By 1 users Downloaded : 1096
Categories : Create Hatch
Software type : AutoCAD 2013
Rename File To : hhatch.lsp
Make four different patterns with short keystroke combinations.

Steven Matchett shares four custom hatch command macros that will automatically create hatches of specific pattern types with short keystroke combinations in AutoCAD.

"These are my most frequently used hatches, and the LISP code that goes with them. Users can change the values to suit their needs. They are set up for imperial units, so the scale can be changed along with the pattern and angle."

;solid hatch
(defun c:hs ()
(command "-bhatch" "p" "solid" ))

;grating hatch with a scale of 20
(defun c:hg ()
(command "-bhatch" "p" "grate" "20" "0" ))

;hatch at 45°////
(defun c:h+ ()
(command "-bhatch" "p" "ansi31" "6" "0" ))

;hatch at -45°\\
(defun c:h- ()
(command "-bhatch" "p" "ansi31" "6" "90" ))

Notes from Cadalyst Tip Reviewer Brian Benton: This is a simple LISP routine that contains several hatch creation macros. Load the LISP file, then type HS (for a solid hatch), HG (for a grate hatch at 20 scale), H+ (for an ANSI31 hatch at 45 degrees), or H- (for an ANSI31 hatch at 90 degrees). You can change these routines — or add more to them — easily enough; simply replace the hatch pattern name and change the scale value as desired.


Average Rating:

User comments