Article View: comp.lang.postscript
Article #414Re: Color PostScript from AutoCAD ADI
From: Pete Hartman
Date: Tue, 07 Apr 1992 04:58
Date: Tue, 07 Apr 1992 04:58
54 lines
2152 bytes
2152 bytes
I didn't mention it, but we are running AutoCAD on Sun Workstations.
The best suggestion I got was basically this:
If you assign pens, (the default is only one pen, you can assign up to
15), the postscript output has comments of the form "%Pen X" where X
is the number of the pen. This can be pretty simply filtered (on the
Suns anyway) to convert the comments into appropriate postscript
setrgbcolor values.
Using ACADPLCMD="cat %s | acadfilter | lpr -P${COLOR_PRINTER}"
and the following script, as well as the Autospool facility, I
was able to get reasonable results (though I would *like* to be
able to print out the color wheel, there's no facility for assigning
255 pens!).
#!/usr/local/bin/perl
#
# acadfilter
#
# filter to convert autocad postscript output to color postscript
# assumes the following pen assignments:
#
# Pen # Color Pen # Color
# 1 Red
# 2 Yellow 6 Magenta
# 3 Green 7 Black
# 4 Cyan 8 Dark Grey
# 5 Blue 9 Light Grey
$pens = 9;
@pen = ("1 0 0 setrgbcolor %Pen 1 = red\n",
"1 1 0 setrgbcolor %Pen 2 = yellow\n",
"0 1 0 setrgbcolor %Pen 3 = green\n",
"0 1 1 setrgbcolor %Pen 4 = cyan\n",
"0 0 1 setrgbcolor %Pen 5 = blue\n",
"1 0 1 setrgbcolor %Pen 6 = magenta\n",
"0 0 0 setrgbcolor %Pen 7 = black\n",
".5 .5 .5 setrgbcolor %Pen 8 = dark_grey\n",
".75 .75 .75 setrgbcolor %Pen 9 = light_grey\n"
);
while (<>) {
if (/^%Pen (\d+)/) {
print $pen[$1-1] unless ($1 > $pens);
} else {
print $_;
}
}
exit(0);
--
Pete Hartman Bradley University pwh@bradley.bradley.edu
"Snow Goons are Bad News"
Technical Details
Message-ID:
<1992Apr7.045853.902@bradley.bradley.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!mp.cs.niu.edu!ux1.cso.uiuc.edu!bradley.bradley.edu!pwhReferences:
<1992Apr3.181200.20743@bradley.bradley.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!mp.cs.niu.edu!ux1.cso.uiuc.edu!bradley.bradley.edu!pwh From: pwh@bradley.bradley.edu (Pete Hartman) Newsgroups: comp.lang.postscript,alt.cad.autocad Subject: Re: Color PostScript from AutoCAD ADI Message-ID: <1992Apr7.045853.902@bradley.bradley.edu> Date: 7 Apr 92 04:58:53 GMT References: <1992Apr3.181200.20743@bradley.bradley.edu> Distribution: usa Organization: Bradley University Lines: 55