[Search tip detail and code files using keywords, tip number, author name, etc ]
 
Reset Hatch Variables after Using Match Properties in the Hatch Editor
Tip# 3967 By Brian Glover On 27-Aug-2012
2
Rated By 1 users
Categories : Hatch Data
Software type : AutoCAD 2013
Rename File To : No Files to download.
Reset your AutoCAD hatch pattern settings to the default values.

Brian Glover shares a command macro with us that will reset your AutoCAD hatch pattern settings to the default values.

"The Match Properties function on the Hatch Creation ribbon or the Hatch Editor ribbon provides a quick and easy means of duplicating a hatch pattern already in a drawing. It does have one big drawback: All of the properties from the selected hatch are kept current after you stop hatching. That means that the next time you hatch something, the previously selected hatch settings are current.

"This is not a problem if all that you need to change is the pattern name, but many hatches in my office have a lot to change (background color, angle, scale, and transparency for example). Also, hatches can be on one of four different layers, depending on what they are depicting, and that is now a lot to stop, check, and/or change every time you start to hatch something.

"I have always thought AutoCAD ought to have an option that will clear Match Hatch Properties when the hatch command ends, but it doesn't, so I created my own. Using the system variables, I created a new command called Hatch Reset and placed it on my Home ribbon, and on the two hatch-contextual ribbons.

"When creating the new command with the CUI (Customize User Interface), in the Macro cell type the following all on one line; an explanation of the terms follows. (Note that this could also be made into a script by deleting the ^C^C and saving it as a text file named HatchReset.scr.)

^C^C(setvar "HPANG" 0)(setvar "HPBACKGROUNDCOLOR" ".")(setvar "HPCOLOR" ".")(setvar "HPLAYER" ".")(setvar "HPNAME" ".")(setvar "HPSCALE" 1)(setvar "HPTRANSPARENCY" ".")

"SETVAR is used to set a system variable.

HPANG controls the hatch angle and is reset to 0. (Note that there are no quotes around the zero.)

HPBACKGROUNDCOLOR controls the hatch background color, and the "." resets it to None.

HPCOLOR controls the hatch color override, and the "." resets it to None.

HPLAYER controls the hatch layer, and the "." resets it to Use Current.

HPNAME controls the hatch pattern name, and the "." resets it to the default ANSI31.

HPSCALE controls the hatch scale, and is reset to 1. (Note there are no quotes around the one.)

HPTRANSPARENCY controls the hatch transparency and the "." resets it to Bylayer."

Notes from Cadalyst Tip Reviewer Brian Benton: I have experienced the same frustration the tipster has described. Much of the CAD work I have done included hatch objects to more clearly define areas in a visual manner. This routine worked well and as described. Just make a command for it in the CUI and place the command in a toolbar, palette, ribbon panel, or in the Quick Access toolbar (that's where I put it.) Just click the icon to reset.

 

Average Rating:
2


User comments
Comment by Shehata,Tawfik
Posted on 2012-08-27 19:50:29
The “addselected” command (Introduced in AutoCAD 2010 Subscription pack), can do the trick too. Select the hatch you want, right click and select “Add Selected” or if your AutoCAD settings (PICKFIRST & SHORTCUTMENU)doesn’t allow it, run the command “addselected” then pick the hatch. This will enable you to duplicate a hatch without affecting your current hatch settings.