Category : Printer + Display Graphics
Archive   : SPIN.ZIP
Filename : CUBE.PAS

 
Output of file : CUBE.PAS contained in archive : SPIN.ZIP
Program Cube;

(* This program generates an AcroSpin file called CUBE.FIL that displays a *)
(* cube. I wrote this program using Turbo Pascal Version 3.0. You can *)
(* modify the color of the cube and the colors of the printing by changing *)
(* the constants in the next section. *)
(* David B. Parker *)

(* Constants. *)

Const
CubeColor = 14; (* Color to use for the cube. *)
FragileColor = 12; (* Color to use for 'FRAGILE'. *)
ThisEndColor = 10; (* Color to use for 'THIS END UP'. *)

(* Variables. *)

Var Output : Text; (* Output file. *)
I, J, K: Integer; (* Looping variables. *)

(* Include the subroutine that writes out text strings. *)

{$I WRITETEX.PAS}

(* Open the output file. *)

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

(* Write out the 'FRAGILE' and 'THIS END UP' messages. *)

WriteText(FragileColor, (* Color. *)
10000.0*0.1,10000.0*0.1, (* X and Y scale factors. *)
0.0,0.0,30.0, (* Rotate 30 dgr. around Z. *)
10000.0*0.25,10000.0*0.25,10000.0*1.0, (* Position of lower left. *)
'FRAGILE'); (* Character string. *)

WriteText(ThisEndColor, (* Color. *)
10000.0*0.08,10000.0*0.08, (* X and Y scale factors. *)
-90.0,10.0,0.0, (* Rotation angles. *)
10000.0*0.10,10000.0*1.0,10000.0*0.45, (* Position of lower left. *)
'THIS END UP'); (* Character string. *)

(* Write out the 8 end points for the cube. The name given to each end point *)
(* consists of the prefix P followed by a number from 0 to 7. *)

For I := 0 To 1 Do
For J := 0 To 1 Do
For K := 0 To 1 Do
Writeln(Output,'EndPoint X ',Round(10000.0*I),
' Y ',Round(10000.0*J),
' Z ',Round(10000.0*K),
' Name P',4*I+2*J+K);

(* Write out the 12 lines for the cube. This loop uses a tricky little *)
(* algorithm to decide which end points need to be connected. *)

For I := 0 To 6 Do
For J := 0 To 2 Do
If (I And (1 Shl J)) = 0 Then
Writeln(Output,'Line From P',I,' To P',I+(1 Shl J),
' Color ',CubeColor);

(* Close the output file. *)

Close(Output);
End.


  3 Responses to “Category : Printer + Display Graphics
Archive   : SPIN.ZIP
Filename : CUBE.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/