home - about - advertise     

AutoCAD Tutorial

AutoCAD 2004 Customization Tutorial: Shapes with Straight Lines, Part 2

June 12, 2003

In a previous tutorial I explained how you can create shape files for defining simple straight line shapes. Here you learn more on defining straight line shapes. If you are not familiar with shapes read the following tutorials first, please read the previous tutorial and also one on Using Shapes.

1. Download the following drawing file. The file will help you in calculating shape information [Figure 1].


Note: If you are using an earlier release of AutoCAD download R15_shapes.dwg.

2. Open the file in AutoCAD.

3. Disable all running OSnaps but Intersection.

4. Draw a 22 square [Figure 1]. Here you will define "P1" as the insertion point. The line P1-P2 should not appear on screen.

Figure 1

5. In command line enter Notepad and then press Enter twice to start Notepad.

6. In Notepad window enter the proper code [Figure 2].

Figure 2


  • The description codes are broken into 3 lines for your convenience. You may write them in a single or multiple lines.

  • The 005 saves the current location of the pen. The 006 will later restore the location.

  • The 002 causes the pen up. Thus the 01A line will not appear in the shape. The 001 later puts the pen down to start drawing.

  • The 01A means draw a unit line in the A direction. The 020 means draw a 2 unit line in the 0 direction.

7. Save the file as "slcomp.shp".

8. Compile and then load the compiled file "slcomp.shx" in a new drawing.

9. Insert the shape.

10. Close the new drawing without saving.

11. In AutoCAD draw the squares shown in Figure 3.

Figure 3

12. In Notepad enter the proper code to define the new shape [Figure 4].

Figure 4


  • The 007 uses another shape to define the current shape. The sub-shape number should follow this code. For example here sub-shape 201 (i.e. the square) will be drawn.

  • The 003 divides the size of all subsequent shapes by a number that follows the code. In this example the size of subsequent shapes will be divided by 2.

  • The 004 multiplies the size of all subsequent shapes by the number that follows the code. Here the 3 is used. Since the division factor is still in effect the final multiplication factor will be 3/2 or rather 1.5.

13. Compile the shape file.

14. Load the compiled shape file in a new drawing.

15. Insert the new shape in the drawing and then close the drawing without saving.

About the Author

Alireza Parsai is the founder of cadpanel.com. He is a mechanical engineer with more than 12 years experience with AutoCAD. Alireza is an Autodesk Authorized Author, the AutoCAD consultant for Al Khawarizmi Institute, a contributing editor for Augiworld magazine, a writer for CAD Digest, an instructor for AUGI Training Program, and an elected speaker for Autodesk University 2002. He has written 7 books in Farsi, 3 booklets in English, and more than 30 articles for different magazines and newsletters. You can reach him at alireza.parsai@cadpanel.com or visit his website www.cadpanel.com

More CAD Corner tutorials >>

CADdigest Weekly
Email (required) *

A week's worth of articles will be emailed to you. See latest issue .