Quantcast
Channel: stardot.org.uk
Viewing all articles
Browse latest Browse all 3395

programming • Re: Weekend coding challenge: collecting twin triangles

$
0
0
Ah, someone else who uses PostScript!

This little snippet generates a picture of copper-strip breadboard at 2:1 scale, and might have been my first attempt at "electronics CAD":

Code:

%!PS-Adobe-3.0%  Draw copper-strip breadboard%  First, define some sensible measuring units/mm { 72 mul 25.4 div } def/cm { 72 mul 2.54 div } def%  Draw a single strip of track, vertically up the screen%  Strip is 4 mm. wide, with 2 mm. holes at 5.08 mm. intervals/strip {    gsave    .75 setgray    0 277 mm rlineto    4 mm 0 rlineto    0 -277 mm rlineto    -4 mm 0 rlineto    closepath    fill    grestore    0 setgray    0 277 mm rlineto gsave stroke grestore    4 mm -277 mm rmoveto    0 277 mm rlineto stroke    mm 2 mm add /midx exch def    20 5.08 277 {        mm /midy exch def        1 setgray        midx midy 1 mm 0 360 arc closepath fill        0 setgray        midx midy 1 mm 0 360 arc closepath stroke    } for} def% Work across the screen drawing strips.1 mm setlinewidth10 5.08 199 {    dup    mm 10 mm moveto    strip} forshowpage

Statistics: Posted by julie_m — Tue May 20, 2025 5:33 pm



Viewing all articles
Browse latest Browse all 3395

Trending Articles