AutoCAD 2004 Customization Tutorial: Adding Arcs to Shapes
June 13, 2003
There are some simple methods to add arcs to
shapes. In this tutorial you learn some of them. If you are not
familiar with shapes, please read the following tutorials first:
1.
Download the following drawing file. The file will help you in
calculating shape information [Figure 1]. The objects to the
right show the direction codes for drawing straight lines and
the objects to the left show the direction codes for drawing
arcs.
► R16_arc_shapes.dwg
Note: If you are using an earlier release of AutoCAD
download:
► R15_arc_shapes.dwg.

Figure 1 -
Click on image to enlarge
2.
Open the file in AutoCAD.
3.
Disable all running OSnaps but Intersection.
4.
Draw a circle [Figure 2]. The diameter of circle is 1 unit.

Figure 2
5. In
command line type Notepad and then press Enter twice. The
Notepad window appears.
6.
Enter the proper code to define the circle [Figure 3].

Figure 3
Notes:
-
The header line defines a shape called CIRCLE.
The shape number is 220 and it needs 14 codes to be defined.
-
The 002 stops drawing mode (i.e. pen up).
-
The 003,2 divides all the subsequent sizes by
2.
-
The 005 saves the current location of pen.
-
The 010 moves the pen 1 unit along direction 0
(i.e. positive X direction).
-
The 001 starts drawing mode (i.e. pen down).
-
The 00A indicates that you want to draw an
arc. The subsequent code (1,004) specifies the radius of the
arc to be 1 unit. The start octant direction is 0 and the end
direction is 4 or rather 180 degrees [Figure 01]. In 004 the
first number (0) switches to hexadecimal mode, the second
number (0) indicates the start octant direction and the last
number (4) refers to the end octant direction. The final
result is a half circle.
-
The other half circle is drawn with
00A,(1,040). Here the start octant direction is 4 and the end
octant direction is 0.
-
The 006 restores the saved pen location.
7.
Save the file as "arcs.shp".
8.
Start a new drawing.
9.
Compile the shape file to create "arcs.shx".
10.
Load "arcs.shx" in the new drawing file and then insert the
shape.
11.
Close the file without saving.
12. In
"R16_arc_shapes.dwg" draw a circle and 4 arcs [Figure 4].

Figure 4
13. In
Notepad enter the proper code to define the shape [Figure 5].

Figure 5
Notes:
-
The first line specifies the shape number,
number of codes you need to define the shape and the shape
name.
-
The 002 stops drawing mode, 005 saves the pen
direction, 01A moves the pen 1 unit along A direction, and 001
starts drawing mode (pen down).
-
The 00C starts the arc drawing session. This
code uses the displacement in X and Y direction along with a
bulge factor. Here for example for the first arc, the
displacement in X direction is 2 units, in Y direction 0 units
and the bulge factor is 127. The bulge factor is 0 for the
straight line and 127 for the half circle. The acceptable
values are between -127 to 127. You can calculate the bulge
factor with the following equation:
Bulge factor = ((2×Height)/Displacement)×127
-
The 006 restores the saved pen location.
-
With 004,2 any subsequent size will be
multiplied by 2.
-
The 007,220 inserts the 220 (circle) as a
sub-shape.
14.
Save the file. Compile and load it in a new drawing.
15.
Insert the shape and then close the new drawing file.
16. In
"R16_arc_shapes.dwg" draw a simple combination of straight lines
and an arc [Figure 6].

Figure 6
17.
Add the proper code to the shape file [Figure 7].

Figure 7
Notes:
Bulge factor = ((2×1)/4)×127 = 63.5 z 64
18.
Compile and load the shape file in a new drawing.
19.
Insert the shape in the new drawing file.
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.
|