Printing a protractor?

In my experiments using a stepper motor to drive a dividing head, I'd like to re-assure myself by knowing exactly the position of the stepper motor.

What I'd like to be able to do is to print a protractor on A4 paper, but with 200 divisions instead of the 360 that you'd get with degrees.

Has anybody any pointers to a program (or Excel macro) to do this?

Also, I'd like to paste a strip numbered 1 to 80 around the periphery of the faceplate so that I know its position as well.

Reply to
Amateur Machinist
Loading thread data ...

This is easy enough to do in most CAD packages - you can draw a line for the first mark and the package will allow you to create a circular "array" of copies of that line, rotated by X degrees (1.8 in your case). I use AutoSketch which you pay good mone for, but there are free CAD packages around that should do this.

Simpler to do this using basically the same technique - print a "protractor" with 80 divisions, and number each one, then stick it on the face of the plate rather than the periphery.

Regards, Tony

Reply to
Tony Jeffree

I usually do this in postscript. Here's a little program to do what you want (create a file in notepad, copy and paste the program text and save as e.g. divisions.ps). If you have a postscript printer you can print directlyi otherwise you need to use a program like ghostview

formatting link
to make the 80 divisions version is an easy exercise.

So that you can see what the output is like quickly, I've put a version converted to pdf using ps2pdf on the web at

formatting link
the postscript is
formatting link

Alan

%!

300 300 translate

/Times-Roman findfont 10 scalefont setfont

/linelength {100} bind def /divisions {200} bind def /multi {5} bind def /str 3 string def

/rotateanddraw { 360 divisions div rotate linelength 20 sub 0 moveto linelength 0 lineto stroke % Is this a multiple of multi dup dup multi div floor multi mul eq {linelength 10 add 0 moveto str cvs show } {pop} ifelse } bind def

0 1 divisions 1 sub { rotateanddraw } for
Reply to
Alan Bain

OK, thanks.

Reply to
Amateur Machinist

A very helpful and thought-provoking reply, thank-you very much.

(Your website, however, refuses access to the division.ps version.)

I couldn't get ps2pdf to run and so used the conversion facility in ghostview.

I'll now devote some time to understanding the postscript language so that I can adapt your program for circle size and longer strokes on the numbered lines to make it easier to read. It is nearly a quarter of a century since I dabbled in Forth and there appear to be definite similarities and I'm guessing that your "bind" translate to the "allot" of Forth.

Thought-provoking? I wonder what the potential is for postscript to be used as a source of CNC designs, terminating in G-code?

Reply to
Amateur Machinist

I'd have been inclined to use a gsave/grestore pair in the subroutine, and rotate to where I need to be, rather use a cumulative rotate.

BugBear

Reply to
bugbear

Thanks again. A few minutes hacking produced the two versions, reproduced below.

I haven't fathomed the code necessary to draw the enclosing circles, nor how to pinpoint the centre of the circle but those are just niceties.

All I need now is a plastic laminator and a new cartridge for the laser printer (last changed 29-Jul-2006 and getting streaky having been shaken many times!) and I'm in business.

Thank-you, Alan, for a full response.

----- 200 version -----

%!

300 600 translate

/Times-Roman findfont 15 scalefont setfont

/linelength {200} bind def /divisions {200} bind def /multi {5} bind def /str 3 string def

/rotateanddraw { 360 divisions div rotate linelength 20 sub 0 moveto linelength 0 lineto stroke % Is this a multiple of multi dup dup multi div floor multi mul eq { linelength 30 sub 0 moveto linelength 30 add 0 lineto stroke linelength 10 add 0 moveto str cvs show } {pop} ifelse } bind def

0 1 divisions 1 sub { rotateanddraw } for

----- 80 version -----

%!

300 600 translate

/Times-Roman findfont 15 scalefont setfont

/linelength {200} bind def /divisions {80} bind def /multi {5} bind def /str 3 string def

/rotateanddraw { 360 divisions div rotate linelength 20 sub 0 moveto linelength 0 lineto stroke % Is this a multiple of multi dup dup multi div floor multi mul eq { linelength 30 sub 0 moveto linelength 30 add 0 lineto stroke linelength 10 add 0 moveto str cvs show } {pop} ifelse } bind def

0 1 divisions 1 sub { rotateanddraw } for
Reply to
Amateur Machinist

I'm sure that you could do it...but what would be the advantage over (a) writing G-code direct, or (b) generating DXF from a CAD drawing?

Regards, Tony

Reply to
Tony Jeffree

With no pretensions for elegance; merely cloning Alan Bain's code and trying a few hacks, now has the centrepop ...

%!

300 600 translate

/Times-Roman findfont 15 scalefont setfont

/linelength {200} bind def /divisions {200} bind def /multi {5} bind def /str 3 string def /centrepop {10} def

/rotateanddraw { 360 divisions div rotate linelength 20 sub 0 moveto linelength 0 lineto stroke % Is this a multiple of multi dup dup multi div floor multi mul eq { linelength 30 sub 0 moveto linelength 30 add 0 lineto stroke linelength 10 add 0 moveto str cvs show } {pop} ifelse } bind def

0 0 moveto centrepop 0 lineto stroke 0 0 moveto 360 4 div rotate centrepop 0 lineto stroke 0 0 moveto 360 4 div rotate centrepop 0 lineto stroke 0 0 moveto 360 4 div rotate centrepop 0 lineto stroke 0 0 moveto 360 4 div rotate

0 1 divisions 1 sub { rotateanddraw } for

Reply to
Amateur Machinist

Labouring the point somewhat, and apologies thereto, following on from Alan Bain's excellent stimulus, I've now found everything I need in the following tutorial ...

formatting link
A couple of weeks ago I was given a box of junk which included some steppers, stepper controllers and rotary encoders. I intend to use a rotary encoder as an electronic form of division plate together with the protractor scales that I've been "didacted" this morning by Alan Bain.

Musing on how much extra electronics I'd need to convert the pair of quadrature pulses from the rotary encoder into "step" and "direction" signals for the stepper controller, the answer turned out to be none whatsoever! The phase relationship between the pair of pulse streams is such that they can be connected directly, with just a couple of pull-up resistors (open collector outputs)

Reply to
Amateur Machinist

Definitely the last version, now with the enclosing circles having read through the tutorial. Haven't had such an enjoyable day hacking code since the days of the "Oric" home computer!

The centrepop code was removed as being redundant because when I drew the circular arcs, I got an initial radius drawn in and couldn't get rid of it, so used 4 of such radii to be the centre marker.

----------

%!

300 600 translate

/Times-Roman findfont 15 scalefont setfont

/linelength {200} bind def /strokelength {20} bind def /bigstrokelength {30} bind def /bigstrokeaddendum {30} bind def /divisions {80} bind def /multi {5} bind def /str 3 string def

/rotateanddraw { linelength strokelength sub 0 moveto linelength 0 lineto stroke % Is this a multiple of multi dup dup multi div floor multi mul eq { linelength bigstrokelength sub 0 moveto linelength bigstrokeaddendum add

0

lineto stroke linelength 10 add 0 moveto str cvs show } {pop} ifelse 360 divisions div rotate } bind def

% Inner circle

0 0 moveto 0 0 linelength strokelength sub 0 90 arc 0 0 moveto 0 0 linelength strokelength sub 90 180 arc 0 0 moveto 0 0 linelength strokelength sub 180 270 arc 0 0 moveto 0 0 linelength strokelength sub 270 360 arc stroke

% Outer circle

0 0 moveto 0 0 linelength 0 90 arc 0 0 moveto 0 0 linelength 90 180 arc 0 0 moveto 0 0 linelength 180 270 arc 0 0 moveto 0 0 linelength 270 360 arc stroke

0 1 divisions 1 sub { rotateanddraw } for

Reply to
Amateur Machinist

Hmm...not clear to me how you derive a sensible "direction" pulse that way though....

Regards, Tony

Reply to
Tony Jeffree

There's a quadrature to S&D decoder circuit in the CAD/CAM/EDM/DRO Yaho group files here:

formatting link
You have to join the group to get at it though so I can email you a copy if you don't want to do that - just email me offline.

Regards, Tony

Reply to
Tony Jeffree

Taking the two quadrature pulse streams as A and B ...

Clockwise, A transits low to high when B is high

Counterclockwise, A transits low to high when B is low.

Even though B is waggling up and down, it is in a stable state when A transits. (Similar to a stroboscopic effect)

Therefore use A as the Step and B as the Direction.

Reply to
Amateur Machinist

Yes ... from the purists point of view, you're stepping on the other edge when counterclockwise and are therefore 1/2 pulse displaced, but for a thumbwheel which I can spin back and forth. the no-extra-electronics solution is the engineer's solution!

(An engineer being someone who can do for 2p what any fool can do for £2)

Reply to
Amateur Machinist

formatting link

It comes up OK from the above URL. Not sure that I go along with a mixed analogue and digital circuit to achieve a digital function, though!

Reply to
Amateur Machinist

With the realisation that I can now produce accurate protractors using the laser printer, and that it would be a small extra effort to produce a matching vernier scale; and the further realisation that with the power of Excel I can produce numerical tables with little or no effort, do I even need the stepper motor approach?

With a protractor circle of 200 divisions, coupled with a 10 division vernier and an 80-tooth bull wheel, this would give me 80 * 200 *10 = 160,000 divisions of the circle.

Suddenly, and it is a "conversion on the road from Damascus" resulting from Alan Bain's introduction to the joys of Postscript this morning, there is no need for stepper motors (with or without micro-stepping) and no need for the Micro-Attachment of the Versatile Dividing Head developed by George Thomas. (With all due credit to him because he was working before the days of the widespread availability of computers and 600 DPI laser printers).

So, with a vernier-loaded cursor, a protractor of 200 divisions, and a circumferential braking mechanism and armed with Excel-generated tables for any number of divisions (and of course a second protractor on the faceplate so that you can read off how many whole turns you've done), you could divide down to a reasonable tolerance any no of divisions and not be more than a gnat's c*ck in error.

A further advantage is that you won't need any division plates at all!

This all seems to good to be true. There must be an error in my analysis, but I can't see what it is.

Reply to
Amateur Machinist

Neat.

Regards, Tony

Reply to
Tony Jeffree

formatting link
>

Yes, that R-C delay looks a bit crude I guess...but if it works?

Regards, Tony

Reply to
Tony Jeffree

If you use the entire length of an A4 sheet of paper at 600di, your best resolution is 7016 points. This assumes that the rollers in the printer can drive the paper with more accuracy than 1 part in 7000, that the paper won't distort by more than one part in 7000. and that the paper length fits the circumference of the disk to better than that accuracy.

The principle works, but don't expect too much from it. I spent a month over Christmas in China in 1995 Using a similar concept (with Nomex tape) when measuring torsional vibration on a steam turbine The raw errors were far higher than desirable.

If you only want the original 200 divisions, you won't have too many problems :-)

Mark Rand RTFM

Reply to
Mark Rand

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.