Category : Printer + Display Graphics
Archive   : ACROSPIN.ZIP
Filename : GEAR.PAS

 
Output of file : GEAR.PAS contained in archive : ACROSPIN.ZIP
Program Gear;

(* This program generates an AcroSpin file called GEAR.FIL that displays a *)
(* gear. I wrote this program using Turbo Pascal Version 3.0. You can *)
(* modify the colors, number of angles used to approximate the central hole, *)
(* and the number of teeth, by changing the constants in the next section. *)
(* *)
(* David B. Parker *)

(* Constants. *)

Const
HoleAngles = 16; (* Number of sides on central hole. *)
HoleColor = 9; (* Color of central hole. *)
NumberOfTeeth = 12; (* Number of teeth on gear. *)
ToothColor = 13; (* Color of teeth. *)
DimensionColor = 15; (* Color of the dimensions. *)

(* Variables. *)

Var I, J : Integer; (* Looping variables. *)
SinAngle, CosAngle: Array[0..5] Of Real; (* Useful sines and cosines. *)
Output : Text; (* Output file. *)

(* Include the routine to write out text. *)

{$I WRITETEX.PAS}

(* Open the output file. *)

Begin
Assign(Output,'GEAR.FIL');
Rewrite(Output);

(* Write out the end points for the central hole. *)

For I := 0 To HoleAngles-1 Do
Begin
Writeln(Output,'EndPoint',
' X ',Round(10000.0*0.25*Cos(2.0*Pi*I/HoleAngles)),
' Y ',Round(10000.0*0.25*Sin(2.0*Pi*I/HoleAngles)),
' Z ',Round(10000.0*1.0),
' Name HH',I);
Writeln(Output,'EndPoint',
' X ',Round(10000.0*0.25*Cos(2.0*Pi*I/HoleAngles)),
' Y ',Round(10000.0*0.25*Sin(2.0*Pi*I/HoleAngles)),
' Z 0',
' Name HL',I);
End;

(* Write out the lines for the central hole. *)

For I := 0 To HoleAngles-1 Do
Begin
J := I+1;
If J = HoleAngles Then J := 0;
Writeln(Output,'Line From HL',I,' To HL',J,' Color ',HoleColor);
Writeln(Output,'Line From HL',I,' To HH',I,' Color ',HoleColor);
Writeln(Output,'Line From HH',I,' To HH',J,' Color ',HoleColor);
End;

(* Write out the end points for the teeth. *)

SinAngle[1] := Sin(14.5*Pi/180.0);
CosAngle[1] := Cos(14.5*Pi/180.0);
SinAngle[2] := 9.0/8.0*SinAngle[1];
CosAngle[2] := -Sqrt(1.0-Sqr(SinAngle[2]));
SinAngle[3] := SinAngle[1]*CosAngle[2]+CosAngle[1]*SinAngle[2];
CosAngle[3] := SinAngle[1]*SinAngle[2]-CosAngle[1]*CosAngle[2];
SinAngle[4] := 9.0/10.0*SinAngle[1];
CosAngle[4] := Sqrt(1.0-Sqr(SinAngle[4]));
SinAngle[5] := SinAngle[1]*CosAngle[4]-CosAngle[1]*SinAngle[4];
CosAngle[5] := SinAngle[1]*SinAngle[4]+CosAngle[1]*CosAngle[4];
For I := 0 To NumberOfTeeth-1 Do
Begin
SinAngle[0] := Sin(2.0*I*Pi/NumberOfTeeth);
CosAngle[0] := Cos(2.0*I*Pi/NumberOfTeeth);
Writeln(Output,'EndPoint',
' X ',Round(10000.0*4.0/3.0
*(CosAngle[0]*CosAngle[3]+SinAngle[0]*SinAngle[3])),
' Y ',Round(10000.0*4.0/3.0
*(SinAngle[0]*CosAngle[3]-CosAngle[0]*SinAngle[3])),
' Z ',Round(10000.0*1.0),
' Name GH',I,'P0');
Writeln(Output,'EndPoint',
' X ',Round(10000.0*4.0/3.0
*(CosAngle[0]*CosAngle[3]+SinAngle[0]*SinAngle[3])),
' Y ',Round(10000.0*4.0/3.0
*(SinAngle[0]*CosAngle[3]-CosAngle[0]*SinAngle[3])),
' Z 0',
' Name GL',I,'P0');
Writeln(Output,'EndPoint',
' X ',Round(10000.0*5.0/3.0
*(CosAngle[0]*CosAngle[5]-SinAngle[0]*SinAngle[5])),
' Y ',Round(10000.0*5.0/3.0
*(SinAngle[0]*CosAngle[5]+CosAngle[0]*SinAngle[5])),
' Z ',Round(10000.0*1.0):6,
' Name GH',I,'P1');
Writeln(Output,'EndPoint',
' X ',Round(10000.0*5.0/3.0
*(CosAngle[0]*CosAngle[5]-SinAngle[0]*SinAngle[5])),
' Y ',Round(10000.0*5.0/3.0
*(SinAngle[0]*CosAngle[5]+CosAngle[0]*SinAngle[5])),
' Z 0',
' Name GL',I,'P1');
CosAngle[0] := Cos(2.0*(I+0.5)*Pi/NumberOfTeeth);
SinAngle[0] := Sin(2.0*(I+0.5)*Pi/NumberOfTeeth);
Writeln(Output,'EndPoint',
' X ',Round(10000.0*5.0/3.0
*(CosAngle[0]*CosAngle[5]+SinAngle[0]*SinAngle[5])),
' Y ',Round(10000.0*5.0/3.0
*(SinAngle[0]*CosAngle[5]-CosAngle[0]*SinAngle[5])),
' Z ',Round(10000.0*1.0),
' Name GH',I,'P2');
Writeln(Output,'EndPoint',
' X ',Round(10000.0*5.0/3.0
*(CosAngle[0]*CosAngle[5]+SinAngle[0]*SinAngle[5])),
' Y ',Round(10000.0*5.0/3.0
*(SinAngle[0]*CosAngle[5]-CosAngle[0]*SinAngle[5])),
' Z 0',
' Name GL',I,'P2');
Writeln(Output,'EndPoint',
' X ',Round(10000.0*4.0/3.0
*(CosAngle[0]*CosAngle[3]-SinAngle[0]*SinAngle[3])),
' Y ',Round(10000.0*4.0/3.0
*(SinAngle[0]*CosAngle[3]+CosAngle[0]*SinAngle[3])),
' Z ',Round(10000.0*1.0),
' Name GH',I,'P3');
Writeln(Output,'EndPoint',
' X ',Round(10000.0*4.0/3.0
*(CosAngle[0]*CosAngle[3]-SinAngle[0]*SinAngle[3])),
' Y ',Round(10000.0*4.0/3.0
*(SinAngle[0]*CosAngle[3]+CosAngle[0]*SinAngle[3])),
' Z 0',
' Name GL',I,'P3');
End;

(* Write out the lines for the teeth. *)

For I := 0 To NumberOfTeeth-1 Do
Begin
J := I+1;
If J = NumberOfTeeth Then J := 0;
Writeln(Output,'Line From GL',I,'P0 To GL',I,'P1 Color ',ToothColor);
Writeln(Output,'Line From GL',I,'P0 To GH',I,'P0 Color ',ToothColor);
Writeln(Output,'Line From GH',I,'P0 To GH',I,'P1 Color ',ToothColor);
Writeln(Output,'Line From GL',I,'P1 To GL',I,'P2 Color ',ToothColor);
Writeln(Output,'Line From GL',I,'P1 To GH',I,'P1 Color ',ToothColor);
Writeln(Output,'Line From GH',I,'P1 To GH',I,'P2 Color ',ToothColor);
Writeln(Output,'Line From GL',I,'P2 To GL',I,'P3 Color ',ToothColor);
Writeln(Output,'Line From GL',I,'P2 To GH',I,'P2 Color ',ToothColor);
Writeln(Output,'Line From GH',I,'P2 To GH',I,'P3 Color ',ToothColor);
Writeln(Output,'Line From GL',I,'P3 To GL',J,'P0 Color ',ToothColor);
Writeln(Output,'Line From GL',I,'P3 To GH',I,'P3 Color ',ToothColor);
Writeln(Output,'Line From GH',I,'P3 To GH',J,'P0 Color ',ToothColor);
End;

(* Write out the diameter dimension of the gear. *)

Writeln(Output,'EndPoint X ',Round(10000.0*6.0/3.0),
' Y ',Round(-10000.0*5.0/3.0),
' Z ',Round(10000.0*0.5),
' Name D1');
Writeln(Output,'EndPoint X ',Round(10000.0*6.0/3.0-500.0),
' Y ',Round(-10000.0*5.0/3.0),
' Z ',Round(10000.0*0.5),
' Name D3');
Writeln(Output,'EndPoint X ',Round(10000.0*6.0/3.0+500.0),
' Y ',Round(-10000.0*5.0/3.0),
' Z ',Round(10000.0*0.5),
' Name D4');
Writeln(Output,'EndPoint X ',Round(10000.0*6.0/3.0),
' Y ',Round(10000.0*5.0/3.0),
' Z ',Round(10000.0*0.5),
' Name D2');
Writeln(Output,'EndPoint X ',Round(10000.0*6.0/3.0-500.0),
' Y ',Round(10000.0*5.0/3.0),
' Z ',Round(10000.0*0.5),
' Name D5');
Writeln(Output,'EndPoint X ',Round(10000.0*6.0/3.0+500.0),
' Y ',Round(10000.0*5.0/3.0),
' Z ',Round(10000.0*0.5),
' Name D6');
Writeln(Output,'Line From D3 To D4 Color ',DimensionColor);
Writeln(Output,'Line From D1 To D2 Color ',DimensionColor);
Writeln(Output,'Line From D5 To D6 Color ',DimensionColor);
WriteText(DimensionColor,
2000.0,2000.0,
0.0,0.0,90.0,
10000.0*6.0/3.0+3000.0,-4000.0,5000.0,
'3.25"');

(* Write out the thickness dimension of the gear. *)

Writeln(Output,'EndPoint X ',Round(-10000.0*6.0/3.0),
' Y 0',
' Z 0',
' Name T1');
Writeln(Output,'EndPoint X ',Round(-10000.0*6.0/3.0-500.0),
' Y 0',
' Z 0',
' Name T3');
Writeln(Output,'EndPoint X ',Round(-10000.0*6.0/3.0+500.0),
' Y 0',
' Z 0',
' Name T4');
Writeln(Output,'EndPoint X ',Round(-10000.0*6.0/3.0),
' Y 0',
' Z ',Round(10000.0*1.0),
' Name T2');
Writeln(Output,'EndPoint X ',Round(-10000.0*6.0/3.0-500.0),
' Y 0',
' Z ',Round(10000.0*1.0),
' Name T5');
Writeln(Output,'EndPoint X ',Round(-10000.0*6.0/3.0+500.0),
' Y 0',
' Z ',Round(10000.0*1.0),
' Name T6');
Writeln(Output,'Line From T3 To T4 Color ',DimensionColor);
Writeln(Output,'Line From T1 To T2 Color ',DimensionColor);
Writeln(Output,'Line From T5 To T6 Color ',DimensionColor);
WriteText(DimensionColor,
2000.0,2000.0,
90.0,-90.0,0.0,
-10000.0*6.0/3.0-3000.0,0.0,7500.0,
'1.0"');

(* Close the output file. *)

Close(Output);
End.


  3 Responses to “Category : Printer + Display Graphics
Archive   : ACROSPIN.ZIP
Filename : GEAR.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/