AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

Custom HATCH patterns and Menu access

Table of Contents

Overview

The ACAD slide-library is pre-compiled when shipped, which means that in order to add a custom pattern to it, the library has to be recompiled. This option is not practical for most users. Users who define custom hatch patterns may encounter difficulties when trying to access their patterns through the normal command sequence or through dialog boxes. This document discusses two other options for adding and accessing custom hatch patterns in AutoCAD Releases 12, 13, and 14.

AutoCAD Release 12

This section explains two options for adding and selecting custom hatch patterns in AutoCAD R12.

Option 1: Custom hatch image tile menu and the HATCH command

To create a custom hatch pattern in R12, refer to the User's Guide, Chapter 18: "Linetypes and Hatch Patterns" in the section Creating Hatch Patterns. You can make the following changes to the menu (.mnu) file:

1. Add the custom section immediately below the Hatch command in the Draw pop menu: [--]
[/HHatch...]^C^C_bhatch
[/MMyHatch...]^C^C$I=icon_myhatch $I=*
[--]

2. In the ***icon section of the same .mnu file, add the image tile menu:
***icon
**icon_myhatch
[MyHatch]
[cmj(myzag,MyZag)]^c^c_hatch myzag
If you have more than one slide image and want them to appear, list them at the end of this section.

3. Create a pattern (like the one shown below) and save it in a file named myzag.pat. Save the file in the \SUPPORT subdirectory.
*MYZAG, Staircase effect
0, 0,0, .15,.15, .15,-.15
90, .15,0, .15,.15, .15,-.15

4. Create a 3 x 2 unit polygon and boundary hatch it using the custom pattern by entering the name of your pattern in the field next to the Pattern button in the dialog box.

5. Do a Zoom Extents and make a slide of this hatched polygon using the MSLIDE command. Repeat steps 4 and 5 for each pattern and slide.

6. Make a slide library with all of the slides in it using the following commands: (This example shows a slide and slide library in the \SUPPORT subdirectory.)
dir *.sld/b > cmj.txt
slidelib cmj < cmj.txt

7. Use the MENU command to load and compile the new .mnu file. Select the MyHatch option from the Draw pull-down menu. This should bring up an image tile menu with slides in it. Selection can be made with either the image or the name in the list to the left of the images.
This option uses the HATCH command and the selected pattern.

Option 2: Add patterns to existing acad.patand work without icons

1. Add your custom hatch pattern definitions (like the one below) to the end of the existing acad.pat file.
*MYZAG, Staircase effect
0, 0,0, .15,.15, .15,-.15
90, .15,0, .15,.15, .15,-.15

2. Save the acad.pat file after adding your custom hatch pattern definitions.
You will get a text reference (with a blank box) in the image tile menu so you do not have to remember the hatch pattern names - only what they look like.
This option works with the BHATCH command.

AutoCAD Release 13

This section explains two options for adding and selecting custom hatch patterns in AutoCAD R13.


Note: The menu syntax used in R13 is slightly different than it is in R12.


Option 1: Custom hatch image tile menu and the HATCH command

To create a custom hatch pattern in R13, refer to the Customization Guide, chapter 2: "Linetypes and Hatch Patterns" in the section Creating Hatch Patterns. Make the following changes in the menu file (mnu):

1. Add the custom section below the Hatch title in the Draw pop menu in acadfull.mnu. Notice the -> and <- marks; these indicate a nested menu. The new listing must follow the last line of the nested menu in order to appear after the Hatch option. By inserting one line earlier in the code, MyHatch would appear in the sub-menu of the Hatch selection between Bhatch and Psfill.

[->&Hatch]

ID_Bhatch [&Hatch...]^C^C_bhatch

ID_Psfill [<-PostScript &Fill]^C^C_psfill

[&MyHatch...]^C^C$I=image_myhatch $I=*

[--]

2. In the *** image section of the same .mnu file, add the image tile menu. This section is now labeled "image" instead of "icon" (as it was in R12).

***image

**image_myhatch

[MyHatch]

[cmj(myzag,MyZag)]^C^C_hatch myzag

3. Create a pattern (like the one show below) and save it in a file named myzag.pat. in the \SUPPORT subdirectory. The pattern syntax is identical to R12 and .pat files used in R12 also work in R13.

*MYZAG, Staircase effect

0, 0,0, .15,.15, .15,-.15

90, .15,0, .15,.15, .15,-.15

4. Create a 3 x 2 unit polygon and boundary hatch it with the custom pattern by entering the name of the custom pattern in the field next to the Pattern button (while you are in the Boundary Hatch dialog box).

5. Do a Zoom Extents and make a slide of this hatched polygon using the MSLIDE command. Repeat steps 4 and 5 for each custom pattern and slide.

6. Make a slide library using the following commands: (This example shows the slide and slide library are placed in the \SUPPORT subdirectory.) Note that slides and slide libraries created in R12 are still usable in R13.

dir *.sld/b > cmj.txt

slidelib cmj < cmj.txt

7. Load the new menu file (.mnu) using either the MENU or the MENULOAD commands. Select the MyHatch option from the Draw pull-down menu to display an image tile menu with the slide(s) in it. Selection can be made with either the image tile or the pattern name in the list to the left.

This option uses the HATCH command and the selected pattern.

Option 2: Add patterns to existing acad.pat and work without icons

1. Add the custom pattern definitions to the end of the existing acad.pat file.

*MYZAG, Staircase effect

0, 0,0, .15,.15, .15,-.15

90, .15,0, .15,.15, .15,-.15

2. Save the acad.pat file after adding your custom hatch pattern definitions.

You will get a text reference within a blank image in the Pattern list in the Boundary Hatch dialog box. As a result, you do not have to remember the hatch pattern names - only what they look like.

This option works with the BHATCH command.

AutoCAD Release 14

This section explains two options for adding and selecting custom hatch patterns in AutoCAD R14.


Note: The only change from R13 is the location of the HATCH command in the Draw pop menu definition. Slides and slide libraries created in R12 or R13 can still be used in R14. The same custom .pat files you used in R12 and R13 will also work in R14.


Option 1: Custom hatch image tile menu and the HATCH command

To create a custom hatch pattern in R14, refer to the online Customization Guide, chapter 2: "Linetypes and Hatch Patterns" in the section titled Creating Hatch Patterns. Make the following changes in the menu (mnu) file:

1. Add the custom section immediately below the Hatch title in the Draw pop menu. The same code used in R13 is functional here; only the surrounding code looks different.

[--]

ID_Bhatch [&Hatch...]^C^C_bhatch

[&MyHatch...]^C^C$I=image_myhatch $I=*

ID_Boundary [&Boundary...]^C^C_boundary

ID_Region [Regio&n]^C^C_region

[--]

2. In the *** image section of the same .mnu file, add the image tile menu. Once again, there is no change from the R13 code used here.

***image

**image_myhatch

[MyHatch]

[cmj(myzag,MyZag)]^C^C_hatch myzag

3. Create a pattern and save it in a file called myzag.pat in the \SUPPORT subdirectory.

*MYZAG, Staircase effect

0, 0,0, .15,.15, .15,-.15

90, .15,0, .15,.15, .15,-.15

4. Create a 3 x 2 unit polygon and boundary hatch it using the custom pattern. (Enter the name of your pattern in the field next to the Pattern button when you are in the Boundary Hatch dialog box.)

5. Do a Zoom Extents and make a slide of this hatched polygon using the MSLIDE command. Repeat steps 4 and 5 for each custom pattern and slide.

6. Make a slide library with all the slides in it using the following commands: (This example shows a slide and slide library in the \SUPPORT subdirectory.)

dir *.sld/b > cmj.txt

slidelib cmj < cmj.txt

7. Load the new .mnu using either the MENU or MENULOAD commands. Select the MyHatch option from the Draw pull-down menu to display an image tile menu that contains the slide(s). You can select the slides by either using the image tile or the pattern name in the list at the left.

This option uses the HATCH command and the selected hatch pattern.

Option 2: Add patterns to existing acad.patand work without icons

1. Add the custom pattern definitions to the end of the existing acad.pat file.

*MYZAG, Staircase effect

0, 0,0, .15,.15, .15,-.15

90, .15,0, .15,.15, .15,-.15

You will get a text reference within a blank image in the Pattern list in the Boundary Hatch dialog box. You do not have to remember the hatch pattern names - only what they look like.

This option works with the BHATCH command.

Back To Top
 
The AutoLisp/Visual Lisp/VBA Resource Website

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website