Introduction

The PostScript programming language is designed to describe the layout of graphics and text on the printed page. This website provides online utilities that show examples in actual practice.

10.25.2009

CAD Example :: CYLINDER

postscript postscript_cad-cylinder

PostScript :: CAD Example - CYLINDER

Example : CYLINDER

cylinder

%!
/inch {72 mul} def
/cm {inch 2.54 div } def
/mm {cm 10 div } def

/VisibleLine { 0.25 mm setlinewidth [] 0 setdash } def
/CentreLine { 0.13 mm setlinewidth [12 3 0.5 3] 0 setdash } def

/RECTANGLE {
 1 index 1 index moveto
 3 index 1 index lineto
 3 index 3 index lineto
 1 index 3 index lineto
 1 index 1 index lineto
 clear
 } def

/CIRCLE {
 2 index 2 index moveto
 0 index 0 rmoveto
 0 360 arc
 clear
 } def

/HCenterLine {
0 0 moveto +50 mm 0 rlineto 
0 0 moveto -50 mm 0 rlineto 
 } def

/VCenterLine {
0 0 moveto 0 +50 mm rlineto 
0 0 moveto 0 -50 mm rlineto 
 } def

/FrontView {
40 mm 20 mm -20 mm -20 mm RECTANGLE
} def

/SideView {
0 mm 0 mm 20 mm CIRCLE
} def

newpath
400 600 translate 
0 0 moveto
HCenterLine CentreLine stroke
FrontView VisibleLine stroke


-250 0 translate 
0 0 moveto
HCenterLine CentreLine stroke
VCenterLine CentreLine stroke
SideView VisibleLine stroke

showpage

postscript postscript_cad-cylinder