12/3/2008

.
.
DesignCAD News

DesignCAD News
Go back to the newsletter

Creating Custom Line Styles and Shapes

Creating a Custom Line Style

Some of the line styles used by DesignCAD are found in the DCLSTYLE.SYS file located in the DesignCAD directory. You can create your own custom line styles for use in DesignCAD by adding them to this file. The file DCLSTYLE.SYS is an ASCII file that can be edited with a text editor or a word processor in ASCII mode. Be sure you have a second copy of the file DCLSTYLE.SYS before you modify it.

The file DCLSTYLE.SYS consists of a series of line styles. Each line style is in the following format:

Line Style Name (no more than 30 characters long); Text Comment (optional)

Number of Lines and Shapes

Line or shape definition (there will be a separate line of values for each line or shape)

The Number of Lines and Shapes indicates the number of separate line segments and shapes that make up the line style.

Line Definition values:

A. PD, PU

1) PD = length of pen down (line segment)

2) PU = length of pen up (space after line segment)

Shape Definition values:

A. [S(width, height) R(z angle) P(x,y) ; %^%-%|Shape Name]

1) S = size of shape; original size is used if size is not specified; if only one value is specified, width and height are the same. (optional)

2) R = rotation; original angle is used if rotation is not specified. (optional)

3) P = position of shape relative to the end of the previous Line or Shape definition; if only one value is specified, it is assigned to x. (optional)

Note: When these commands are present, Scale should be used first, then Rotation, and finally Position.

4) %^ = shape orientation won't be affected by the order of points of the line. (optional)

5) %- = ignores the bold flag of the line. (optional)

6) %| = shape does not rotate with the line segment.

Note: If more than one of %^, %-, and %| are used, there should not be a space between them.

7) Shape Name = shape to be used in line style; must be defined in DCSHAPE.SYS.

The following is an example of a simple line style that has only one line segment definition.

Long Dash

1

50, 10

This simple line style will look like this:

The next example is a little more complicated. Notice that the only thing that changed in the first three lines between this example and the last one are the Line Style Name and the Number of Lines and Shapes has changed from "1" to "2." The same long dash (50) and small space (10) are still in the line style.

Long Dash and Star

2

50, 10

[P(-35,0) ; Star], 0

The additional line of the "Long Dash and Star" line style inserts a "Star" shape (defined in the DCSHAPE.SYS file). All of the information for the "Star" shape is entered as the fourth line of the "Long Dash and Star" line style [P(-35,0) ; Star], 0. The center of the star is placed so that its center is centered on the line segment defined in the third line of the "Long Dash and Star" line style (-35 = 50/2+10, the value 50 = length of the original dash; the value 10 = amount of space that follows the dash in the line segment definition). This line style will look like this:

Now a more complicated line style from scratch.

DCAD

2

2, 1

[; DCAD], 20

Doesn't look that complicated does it? It's really not. It just requires that you add a shape to the DCSHAPE.SYS file.

Note: Be sure that the last line of both the DCLSTYLE.SYS and DCSHAPE.SYS is an empty carriage return.

 

Creating a Custom Line Style Shape

The shapes that can be used by DesignCAD line styles are found in the DCSHAPE.SYS file located in the DesignCAD directory. You can create your own custom shapes for use in DesignCAD line styles by adding them to this file. The file DCSHAPE.SYS is an ASCII file that can be edited with a text editor or a word processor in ASCII mode. Be sure you have a second copy of the file DCSHAPE.SYS before you modify it.

Each shape definition is in the following format:

Shape Name (no more than 30 characters long); Text Comment (optional)

Command and its number of points

Points for command (points appear on separate lines and consist of x and y coordinates; x and y coordinates may be separated by a space or a comma)

Additional commands and points

* (indicates the end of the shape)

Commands allowed in the DCSHAPE.SYS file are:

1) A = Three-point arc with center, starting, and ending points

Note: Identical starting and ending points make a circle.

2) C = Spline curve

3) V = Polyline

The best way to make a new shape is to record a macro and use the Arc (Center, Begin, end), Curve, and Line commands to draw the shape. Once the drawing of the shape has been recorded as a macro, you can open the macro file, delete the information that is not needed for the DCSHAPE.SYS file, and change the command names to the DCSHAPE.SYS format.

Here is a portion of the recorded macro and the equivalent portion of what was added to the DCSHAPE.SYS file to create the DCAD shape (in this comparison, blank lines in the DCAD shape definition are used only to keep the code comparison parallel; there should not be blank lines in the actual DCSHAPE.SYS file):

>SetStartPoint DCAD

{

}

>Line v 2

{

<PointXYZ 0.0000,0.0000,0.0000 0.0000,0.0000

<PointXYZ 0.0000,4.0000,0.0000 0.0000,4.0000

}

>Curve c 3

{

<PointXYZ 0.0000,4.0000,0.0000 0.0000,4.0000

<PointXYZ 1.7500,3.8000,0.0000 1.7500,3.8000

<PointXYZ 2.7500,3.0000,0.0000 2.7500,3.0000

<Type 0

}

>Line v 2

{

<PointXYZ 2.7500,3.0000,0.0000 2.7500,3.0000

<PointXYZ 2.7500,1.0000,0.0000 2.7500,1.0000

}

>Curve c 3

{

<PointXYZ 0.0000,0.0000,0.0000 0.0000,0.0000

<PointXYZ 1.7500,0.2000,0.0000 1.7500,0.2000

<PointXYZ 2.7500,1.0000,0.0000 2.7500,1.0000

<Type 0

}

… …

Don't forget to end the shape definition with an asterisk (*).

Go back to the newsletter


Printer-friendly version