Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %!ps-nonconforming
- /inch {72 mul} bind def
- /half {0.5 mul} bind def
- /buffer 20 string def
- /cot {dup cos exch sin div} bind def
- /comment {pop} bind def
- /fraction {div} bind def
- /init {/Helvetica 10 selectfont
- currentpagedevice /PageSize get dup 1 get /pageheight exch def
- 0 get /pagewidth exch def
- /fontheight {currentfont dup /FontBBox get dup 3 get % top
- exch 1 get sub % top - bottom
- exch /FontMatrix get 3 get mul} bind def % adjusted by height multiplier
- /lineheight {fontheight 1.2 mul} bind def % add 20% for line spacing
- /newline {0 lineheight neg rmoveto} bind def
- } bind def
- % chain info from http://www.gizmology.net/sprockets.htm
- % pitch diameter is the diameter of the sprocket at the center of the rollers
- % Pitch Diameter = P ÷ sin (180° ÷ N)
- /pitchdiameter {(pitch teeth -) comment 180 exch div sin div} def
- % outside diameter is the diameter of the sprocket at the ends of the teeth
- % Outside Diameter = P × (0.6 + cot ( 180° ÷ N) )
- /outerdiameter {(pitch teeth -) comment 180 exch div cot .6 add mul} def
- /sprocket {(bore pitch rollerdiameter teeth -) comment
- /teeth exch def
- /rollerdiameter exch def
- /pitch exch def
- /bore exch def
- /pitchangle 360 teeth div def
- /rollerradius rollerdiameter half def
- /pitchradius pitch teeth pitchdiameter half def
- /outerradius pitch teeth outerdiameter half def
- gsave
- currentpoint translate newpath
- % remember rotation is in Cartesian space, so *counterclockwise*
- 0.5 setgray
- gsave 0 0 pitchradius 0 360 arc closepath stroke grestore
- gsave 0 0 outerradius 0 360 arc closepath stroke grestore
- 0 setgray % black for drilling and cutting
- gsave 0 0 bore half (radius) comment 0 360 arc closepath stroke grestore
- teeth {
- gsave
- 0 pitchradius moveto currentpoint translate
- newpath pitchangle half neg rotate
- 0 0 moveto
- % draw cross at centerpoint
- gsave 0 rollerradius half rlineto stroke grestore
- gsave 0 rollerradius half neg rlineto stroke grestore
- gsave rollerradius half 0 rlineto stroke grestore
- gsave rollerradius half neg 0 rlineto stroke grestore
- % circles for drilling base of teeth and for cutting the rest
- newpath % necessary to prevent unwanted radius line
- 0 0 rollerradius 180 pitchangle add 0 arc stroke
- 0 0 pitch rollerradius sub 0 45 arc stroke
- 0 0 pitch rollerradius sub 135 pitchangle add 180 pitchangle add arc stroke
- grestore pitchangle rotate
- } repeat
- grestore
- } def
- init
- pagewidth 1 3 fraction mul pageheight 1 3 fraction mul moveto
- 5 16 fraction inch 1 2 fraction inch 5 16 fraction inch 5 sprocket
- pagewidth 2 3 fraction mul pageheight 1 3 fraction mul moveto
- 5 16 fraction inch 1 2 fraction inch 5 16 fraction inch 6 sprocket
- pagewidth 1 3 fraction mul pageheight 2 3 fraction mul moveto
- 5 16 fraction inch 1 2 fraction inch 5 16 fraction inch 7 sprocket
- pagewidth 2 3 fraction mul pageheight 2 3 fraction mul moveto
- 5 16 fraction inch 1 2 fraction inch 5 16 fraction inch 8 sprocket
- showpage
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement