
Watson Kilbourne wrote with a solution to the problem of SlideLib.Exe failing to append new SLD files to an existing SLB:
"I read your informative articles in Autodesk World regarding hatch patterns, and yes, there is a third-party developer that has a program to merge custom slide libraries and individual slides to an existing AutoCAD SLB file. Slide Manager (SLDMGR.EXE) is a $25 shareware program from John Intorcio, 335 Washington Street, Suite 178, Woburn, MA 01801, or email him via CompuServe at 73417,155. "
Chris Neperud asked if it was possible to create a custom linetype that is simply a continuous double line. I had suggested the MLine, or the DLine command in AutoCAD Release 12 and 11, and LT. Chris replied with a few more details:
"This works great but I should have been more specific. What I was hoping for was a linetype that I could use with polylines. For example, I would like to digitize water features using a double polyline, which I can then smooth using the PEdit Fit command. The MLine and MlEdit commands do not allow me to smooth the vertices. Digitizing with one polyline, smoothing it, and then offsetting it is a possibility but I am hoping to find a better way to do it."
In theory, a parallel linetype should be possible; but in practice, it is not. Here is what I found -- if youcan find a work-around that fixes the problem I found, please let me know!
Step 1. With the Notepad text editor, I opened the LTypeShp.Shp source code file for the shapes used by complex linetypes. (The file is found in the \support folder.) I added a parallel line shape, as follows:
*135,11,DUAL
2,014,1,020,2,02C,1,028,2,014,0
This code draws a pair of parallel line segments, each two units long. The parallel lines are offset by one unit from the centerline. The shape codes have the following meaning:
*135
Start of the next shape code.
11
Number of bytes in the code (fill in this number last).
DUAL
Name of the shape code, which is referenced by the linetype LIN
file.
2
Move (pen up) command
014
A vector, where "0" indicates a vector, "1"
is the length, and "4" is the direction (straight up
or north).
1
Draw (pen down) command.
020
Another vector, where "2" is the length and "0"
is the direction (west)
02C
Two-unit vector in direction C (straight down, or south).
028
Two-unit vector in direction 8 (east).
014
One-unit vector in direction 4 (north).
0
The lone zero signals the end of the shape definition; the eleventh
byte.
Step 2. I saved the LTypeShp.Shp file, then switched to AutoCAD.
Step 3. I compiled the SHP file into an SHX file with AutoCAD's Compile command. Since I made no errors, AutoCAD was pleased with me:
Command: compile
Compiling shape/font description file
Compilation successful.
Output file d:\acad13\com\support\ltypeshp.shx contains 132
bytes
Step 4. I switched back to Notepad and loaded the LTypeShp.Lin file. I wrote a parallel linetype definition, as follows:
*PARALLEL_LINES,======
A,[DUAL,ltypeshp.shx,s=.1]
This code is supposed to draw a parallel linetype. The linetype codes have the following meaning:
*PARALLEL_LINES
Start and name of the linetype.
======
A graphical representation using ASCII characters; optional.
A
The alignment code.
[
Start of the complex linetype section.
DUAL
Name of the shape code to use.
ltypeshp.shx
Name of the SHX file containing the shape code.
s=.1
Scale of the shape; here, scale = 10%.
]
End of the complex linetype section.
Step 5. I switched back to AutoCAD and used the -Linetype Load command to load the newly-defined linetype.
Command: -linetype
?/Create/Load/Set: load
Linetype(s) to load: parallel_lines
AutoCAD displays the Select Linetype File dialog box. I select LTypeShp.Lin and click the Open button. AutoCAD complains:
Bad definition of PARALLEL_LINES at line 11 of file ltypeshp.lin:
Shape or text may not be first spec.
That means that I cannot have a pure parallel line shape; instead, AutoCAD demands there be a dash (such as .1), a gap (-.1), or a dot (0) resulting in a less-than-perfect parallel line -- a parallel line with gaps.
In fact, AutoCAD requires a dash or gap before _and_ after the SHX shape, otherwise AutoCAD complains:
There must be between 2 and 12 dash/dot specs.
So, it appears that the best I can come up with is a broken parallel line created by the following LIN code:
*PARALLEL_LINES,= = = = = =
A,.01,[DUAL,ltypeshp.shx,s=.1],-.01
For this reason, the best way to deal with the problem is to apply the Offset command to a splined polyline. As for the MLine command, it is true that it can only consist of straight lines. If you are really desperate, you can:
1. Use the Explode command to reduce the mline to parallel line segments.
2. Use the PEdit Join command to: (1) turn the line segments into polylines; and (2) join the polyline segments into a single polyline.
3. Now use PEdit Spline or PEdit Fit command to create a smoothly flowing polyline.
Perhaps a splinable MLine will make its appearance in AutoCAD Release 14. The MLine first appeared in Autodesk's Generic CADD software, which could be draw straight lines (as of AutoCAD Release 13), automatically filleted lines, or as Bezier curves. To see Generic CADD generate 14 parallel, multi-colored lines as swooping Bezier curves is truly a beautiful sight to see.
Vijay Katkar is writing code for a dialog box with a list box. He told me, "I want to display strings in it -- just like the dialog box displayed by the Layer command. I am able to concatenate the values and print the strings but there is no vertical alignment, since the strings are of different lengths. I tried using the tab metacharacter (\t) in the string but it prints the literal '\t' in the list box. Is there any way I can get around this problem?"
I recall a similar problem: How to display quotation marks or the inches symbol within a text string? For example, I have a line of AutoLISP code that I want to print out as:
The diameter is 2.54"
Normally, I cannot use the quotation (") character in a string. AutoLISP uses the quotation as its string delimiter to mark the beginning and ending of the string. In the following line of code:
(prompt "The diameter is 2.54"")
AutoLISP sees the first quotation mark as the start of the string, the second quotation as the end of the string, and the third quotation mark as an error. The solution is the \nnn metacharacter. This lets me insert any ASCII character, including special characters, such as tab, escape, and quotation marks. The workaround here is to use the ASCII code for the quotation mark, \042, like this:
(prompt "The diameter is 2.54\042")
Similarly, Vijay needs to use the \009 metacharacter to space the text in his dialog box. And, in fact, that worked: "According to what you had told me, I used the same and it worked."
Comments on this tutorial series? Tell me about it.