Creating Custom Linetypes -- Part IV

Format of the DCADWIN.LIN file, continued...

Our example:

>ElecLine
4.0
0 40
0 -7
-71.56 -3.953
90 7.5
0 3.5
-90 -3.75
-180 3.5
-90 -3.75
0 3.5
71.56 -3.953
0 -7
0 40


Now we come to the real work of the line definition. The rest of the lines in our example tell DataCAD how to draw the line on screen.

The easiest way to think of how these lines of numbers work is to think in terms of an old pen plotter. In order to control this plotter we need to tell the plotter where we want to move the pen. We also have to tell the plotter whether the pen should be down (in contact with the paper) or up in order to move without drawing lines. This example is not very different from how the HPGL plot file format works.

Now that we have a way of thinking about our task, let's break it down even further. How do we tell it how to move the pen? For our purposes we will use what you may recognize as the relative polar input method from DataCAD. Relative polar movement provides the program with two pieces of information in order to move our 'pen'. What you tell the program is what angle to move and how far to move at that angle. Each of the lines in our example from line 3 to the end are matched pairs of numbers that each tell the 'pen' to move a certain angle and distance. We will call each of these individual pairs of numbers a "stroke" since this fits in with our plotter metaphor.

Let's apply this idea to the third line of the example definition above. This line reads:

0 40

What this translates to is: move the 'pen' at an angle of 0 for 40 units. As discussed earlier these units are completely arbitrary and could represent fractions of an inch or hundreds of feet. What you must remember is that from start to end the line must be 100 units long. If you exceed 100 or are under 100 units the line will not appear as you imagine it will. Our imaginary 'pen' can travel well over 100 units in total in rendering the line but from the first point to the last point of the defined linetype must be 100 units.

You may begin to see that in this method of 'pen' control you can only create straight line segments. You may also be wondering how you get a linetype such as INSUL that appears to be comprised of many curves. The answer is that you can only create straight line segments but if you make enough short straight line segments they will appear to curve.

To move the pen without drawing a stroke simply preface the distance to move with a '-':

71.56 -3.953

In our example the line above moves the pen at an angle of 71.56 for a distance of 3.953 but no line is drawn. You can use negative angles as well but these will draw a stroke unless the matching distance is negative.

The last rule to remember is that the maximum number of 'pen' strokes is 19. You must finish your line definition in 19 moves or the program will truncate the definition with the 19th stroke and the line will not have the desired appearance.

Continue with Part V



Thank you for printing this page. Please feel free to contact us for further assistance. You can call our sales department at +1 (800) 394-2231, Monday through Friday from 8:00 a.m. to 5:00 p.m. Eastern time or send an e-mail message to info@datacad.com.