If you ever are in need of printing your own azimuth setting circles, having a piece of software to generate the rule marks is very useful.
I needed to create a 360-degree paper tape to wrap around the base of my dobsonian, which had a roughly 12" diameter (I measured its circumference at 955mm). Here's a Perl script which generates a PostScript file on STDOUT. You will need to change the circumference on line 9 (in millimeters). Then you would need a utility such as ps2pdf to convert the PostScript file to PDF and print it out (taking note when printing out to avoid scaling the file).
The script attempts to create the paper tape on a single sheet of paper, and currently will not behave properly for circumferences that exceed the size of the single sheet of paper. I really should fix the script so that it creates more than four segments for the tape.
And here's what the PDF output looks like:
Cut carefully!
I needed to create a 360-degree paper tape to wrap around the base of my dobsonian, which had a roughly 12" diameter (I measured its circumference at 955mm). Here's a Perl script which generates a PostScript file on STDOUT. You will need to change the circumference on line 9 (in millimeters). Then you would need a utility such as ps2pdf to convert the PostScript file to PDF and print it out (taking note when printing out to avoid scaling the file).
The script attempts to create the paper tape on a single sheet of paper, and currently will not behave properly for circumferences that exceed the size of the single sheet of paper. I really should fix the script so that it creates more than four segments for the tape.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | #!/usr/bin/perl # # generate a 360-degree scale tape using postscript use strict; use POSIX; # define the circumference of the circle my $circ = 955; my $mm_per_degree = $circ / 360; # derivations my $point_per_mm = 72 / 25.4; my $point_per_degree = $point_per_mm / $mm_per_degree; # minimum (x, y) in points (for margin) my $minX = 36; my $minY = 36; # go from 0.. 360 degrees for (my $deg = 0; $deg < 360; $deg++) { my $x_offset = POSIX::floor($deg / 90) * 64 + $minX; my $y_offset = $minY; my $mm = ($deg % 90) * $mm_per_degree; my $y = ($mm * $point_per_mm) + $y_offset; my $line_length = 18; if ($deg % 5 == 0) { $line_length = 24; } if ($deg % 10 == 0) { $line_length = 32; } my $lX = $x_offset + $line_length; my $tX = $x_offset + $line_length + 10; # estimate the length of the text label my $labelLen = length(sprintf("%d", $deg)); my $tY = $y - (3 * $labelLen); print <<EOF; newpath $x_offset $y moveto $lX $y lineto 1 setlinewidth stroke EOF # add an additional (long) line at the end and a long rule for cutting if ($deg % 90 == 89) { my $nY = (($deg % 90) + 1) * $mm_per_degree * $point_per_mm + $y_offset; my $lX = $x_offset + 48; my $cX = $x_offset + 48; print <<EOF; $x_offset $nY moveto $lX $nY lineto 1 setlinewidth stroke $x_offset $minY moveto $x_offset $nY lineto 1 setlinewidth stroke $cX $minY moveto $cX $nY lineto 1 setlinewidth stroke EOF } if ($deg % 10 == 0) { print <<EOF; $tX $tY moveto 90 rotate /Courier findfont 12 scalefont setfont ($deg) show -90 rotate EOF } } print "showpage"; |
And here's what the PDF output looks like:
Cut carefully!
No comments:
Post a Comment