home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 March / Chip_1998-03_cd.bin / tema / MINICAD / MC7DEMO / MINICAD.1 / WASHER.MPC < prev    next >
Text File  |  1997-04-30  |  14KB  |  780 lines

  1. Procedure Washer;
  2. {
  3. (c)1997, Diehl Graphsoft, Inc.
  4. Developed by Tom Urie
  5.  
  6. This procedure draws plain, lock, and user specified washers.
  7. }
  8.  
  9. LABEL 10,20,30,99;
  10. CONST
  11.     Filename1='WashPlnE.txt';
  12.     Filename2='WashPlnM.txt';
  13.     Filename3='WashLokE.txt';
  14.     Filename4='WashLokM.txt';
  15.     PathNameW = 'External\Data\';
  16.     PathNameM = ':Externals:External Data:';
  17.  
  18.     SWF=0.05;  {Used to determine the width of the slot on lock washers.}
  19.     Theta=30.0;  {Angle of the slot on lock washers.}
  20.  
  21. VAR
  22.     ID,OD,T :  REAL;
  23.     OD1,T1 : ARRAY [1..3] OF REAL;
  24.     x0,y0,x1,y1,x2,y2,SW : REAL;
  25.  
  26.     Style,Type,View,Series,n : INTEGER;
  27.     RFlag : ARRAY[1..5] OF INTEGER;
  28.     Ans,Abort,OK,Inch,SizeNotFound : BOOLEAN;
  29.  
  30.     Sz,Size,Size1,Pathname : STRING;
  31.  
  32.     SA,DA:LONGINT;
  33.     Fmt:INTEGER;
  34.     SF,UPI:REAL;
  35.     UM,UM2:STRING;
  36.  
  37. Procedure WasherDialog;
  38. {
  39. This procedure defines the various dialog boxes.
  40. }
  41. VAR
  42.     h,DialogType,Width,x1,y1,x2,y2,px1,px2,px3,px4,py1,py2,py3,py4 : INTEGER;
  43.  
  44. Procedure AlignScr(Width:INTEGER; VAR x1,x2:INTEGER);
  45. VAR
  46.     scrx1,scry1,scrx2,scry2:INTEGER;
  47. BEGIN
  48.     GetScreen(scrx1,scry1,scrx2,scry2);
  49.     x1:=((scrx1+scrx2) div 2)-(Width div 2);
  50.     x2:=x1+Width; 
  51. END;
  52.  
  53. Procedure LocateButtons(DialogType,scnh,scnw : INTEGER);
  54. {
  55. This procedure locates the 'OK' and 'Cancel' buttons.
  56. }
  57. VAR
  58.     v1,v2,v3,v4 : INTEGER;
  59.     Mac : BOOLEAN;
  60.  
  61. Procedure Swap(VAR  m1,m2,m3,m4 : INTEGER);
  62. VAR
  63.     Temp : INTEGER;
  64. BEGIN
  65.     Temp:=m1;
  66.     m1:=m3;
  67.     m3:=Temp;
  68.     Temp:=m2;
  69.     m2:=m4;
  70.     m4:=Temp;
  71. END;        {of Swap}
  72.  
  73. BEGIN
  74.     Mac:=FALSE;
  75.     PathName:=PathNameW;
  76.     GetVersion(v1,v2,v3,v4);
  77.     IF v4 = 1 THEN
  78.     BEGIN
  79.         Mac:=TRUE;
  80.         PathName:=PathNameM;
  81.     END;
  82.  
  83.     IF DialogType = 1 THEN
  84.     BEGIN
  85.         px1:=(scnw DIV 2) - 80;
  86.         px2:=(scnw DIV 2) - 10;
  87.         px3:=(scnw DIV 2) + 10;
  88.         px4:=(scnw DIV 2) + 80;
  89.         IF Mac THEN SWAP(px1,px2,px3,px4);
  90.  
  91.         py1:=scnh-40;
  92.         py2:=scnh-20;
  93.         py3:=py1;
  94.         py4:=py2;
  95.     END ELSE IF DialogType = 2 THEN
  96.     BEGIN
  97.         px1:=scnw - 180;
  98.         px2:=scnw - 110;
  99.         px3:=scnw - 90;
  100.         px4:=scnw - 20;
  101.         IF Mac THEN SWAP(px1,px2,px3,px4);
  102.  
  103.         py1:=scnh-40;
  104.         py2:=scnh-20;
  105.         py3:=py1;
  106.         py4:=py2;
  107.     END ELSE
  108.     BEGIN
  109.         px1:=scnw - 90;
  110.         px2:=scnw - 20;
  111.         px3:=px1;
  112.         px4:=px2;
  113.  
  114.         py1:=scnh -70;
  115.         py2:=scnh - 50;
  116.         py3:=scnh - 40;
  117.         py4:=scnh - 20;
  118.         IF Mac THEN SWAP(py1,py2,py3,py4);
  119.     END;
  120. END;        {of Locate Buttons}
  121.  
  122. Procedure MakeDialog1;
  123. {
  124. This procedure defines the dialog box for Plain Washers.
  125. }
  126. CONST
  127.     y1=100;
  128.     scnh=245;
  129.     scnw=280;
  130.  
  131. BEGIN
  132.     DialogType:=1;
  133.     AlignScr(scnw,x1,x2);
  134.     y2:=y1+scnh;
  135.     LocateButtons(DialogType,scnh,scnw);
  136.  
  137.     BeginDialog(1,1,x1,y1,x2,y2);
  138.         h:=40;
  139.         AddButton('OK',1,1,px1,py1,px2,py2);
  140.         AddButton('Cancel',2,1,px3,py3,px4,py4);
  141.  
  142.         AddField('Type:',13,1,20,44-h,60,60-h);
  143.         AddButton('Inch (Type B Plain Washer)',14,3,20,65-h,250,80-h);
  144.         AddButton('Metric (Metric Plain Washer)',15,3,20,85-h,260,100-h);
  145.  
  146.         AddField('Bolt or Screw Size:',4,1,20,117-h,160,133-h);
  147.         AddField('',5,2,165,118-h,225,133-h);
  148.         AddField('in',16,1,233,118-h,255,133-h);
  149.  
  150.         h:=45;
  151.         AddField('Series:',6,1,20,154-h,100,170-h);
  152.         AddButton('Narrow',7,3,20,175-h,100,190-h);
  153.         AddButton('Regular',8,3,20,195-h,100,210-h);
  154.         AddButton('Wide',9,3,20,215-h,100,230-h);
  155.  
  156.         AddField('View:',10,1,165,154-h,205,170-h);
  157.         AddButton('Top',11,3,165,175-h,210,190-h);
  158.         AddButton('Side',12,3,165,195-h,210,210-h);
  159.     EndDialog;
  160. END;
  161.  
  162. Procedure MakeDialog2;
  163. {
  164. This procedure defines the dialog box for User Defined Plain Washers.
  165. }
  166. CONST
  167.     y1=100;
  168.     scnh=170;
  169.     scnw=270;
  170.  
  171. BEGIN
  172.     DialogType:=3;
  173.     AlignScr(scnw,x1,x2);
  174.     y2:=y1+scnh;
  175.     LocateButtons(DialogType,scnh,scnw);
  176.  
  177.     BeginDialog(2,1,x1,y1,x2,y2);
  178.         h:=30;
  179.         AddButton('OK',1,1,px1,py1,px2,py2);
  180.         AddButton('Cancel',2,1,px3,py3,px4,py4);
  181.  
  182.         AddField('Inside Diameter:',4,1,20,44-h,143,60-h);
  183.         AddField('',5,2,156,45-h,240,60-h);
  184.  
  185.         AddField('Outside Diameter:',6,1,20,69-h,143,85-h);
  186.         AddField('',7,2,156,70-h,240,85-h);
  187.  
  188.         AddField('Thickness:',8,1,20,94-h,143,110-h);
  189.         AddField('',9,2,156,95-h,240,110-h);
  190.  
  191.         AddField('View:',10,1,20,124-h,90,140-h);
  192.         AddButton('Top',11,3,20,145-h,65,160-h);
  193.         AddButton('Side',12,3,20,165-h,65,180-h);
  194.     EndDialog;
  195. END;
  196.  
  197. Procedure MakeDialog3;
  198. {
  199. This procedure defines the dialog box for Lock Washers.
  200. }
  201. CONST
  202.     y1=100;
  203.     scnh=225;
  204.     scnw=280;
  205.  
  206. BEGIN
  207.     DialogType:=1;
  208.     AlignScr(scnw,x1,x2);
  209.     y2:=y1+scnh;
  210.     LocateButtons(DialogType,scnh,scnw);
  211.  
  212.     BeginDialog(3,1,x1,y1,x2,y2);
  213.         AddButton('OK',1,1,px1,py1,px2,py2);
  214.         AddButton('Cancel',2,1,px3,py3,px4,py4);
  215.  
  216.         h:=40;
  217.         AddField('Type:',13,1,20,44-h,60,60-h);
  218.         AddButton('Inch',14,3,20,65-h,70,80-h);
  219.         AddButton('Metric',15,3,80,65-h,140,80-h);
  220.  
  221.         AddField('Bolt or Screw Size:',4,1,20,97-h,160,113-h);
  222.         AddField('',5,2,165,98-h,225,113-h);
  223.         AddField('in',17,1,233,98-h,255,113-h);
  224.  
  225.         h:=45;
  226.         AddField('Series:',6,1,20,134-h,100,150-h);
  227.         AddButton('Regular',7,3,20,155-h,100,170-h);
  228.         AddButton('Heavy',8,3,20,175-h,100,190-h);
  229.         AddButton('Extra Duty',9,3,20,195-h,100,210-h);
  230.         AddField('',16,1,105,195-h,155,210-h);
  231.  
  232.         AddField('View:',10,1,165,134-h,205,150-h);
  233.         AddButton('Top',11,3,165,155-h,210,170-h);
  234.         AddButton('Side',12,3,165,175-h,210,190-h);
  235.     EndDialog;
  236. END;
  237.  
  238. Procedure MakeDialog4;
  239. {
  240. This procedure defines the main dialog box.
  241. }
  242. CONST
  243.     y1=100;
  244.     scnh=150;
  245.     scnw=270;
  246.  
  247. BEGIN
  248.     DialogType:=1;
  249.     AlignScr(scnw,x1,x2);
  250.     y2:=y1+scnh;
  251.     LocateButtons(DialogType,scnh,scnw);
  252.  
  253.     BeginDialog(4,1,x1,y1,x2,y2);
  254.         AddButton('OK',1,1,px1,py1,px2,py2);
  255.         AddButton('Cancel',2,1,px3,py3,px4,py4);
  256.  
  257.         h:=40;
  258.         AddField('Type of Washer:',4,1,20,44-h,195,60-h);
  259.         AddButton('Plain Washer - Commercial',5,3,20,65-h,220,80-h);    
  260.         AddButton('Plain Washer - User Defined',6,3,20,85-h,220,100-h);
  261.         AddButton('Helical Spring Lock Washer',7,3,20,105-h,220,120-h);
  262.     EndDialog;
  263. END;
  264.  
  265. BEGIN
  266.     MakeDialog1;
  267.     MakeDialog2;
  268.     MakeDialog3;
  269.     MakeDialog4;
  270. END;
  271.  
  272. Procedure GetData;
  273. {
  274. This procedure opens the data file and reads the data.
  275. }
  276. LABEL 10,20,99;
  277.  
  278. VAR
  279.     File,Filename,WarningStr : STRING;
  280.     File1 : ARRAY[1..4] OF STRING;
  281.  
  282. BEGIN
  283.     File1[1]:=Filename1;
  284.     File1[2]:=Filename2;
  285.     File1[3]:=Filename3;
  286.     File1[4]:=Filename4;
  287.     File:=File1[Type];
  288.  
  289.     Filename:=Concat(Pathname,File);
  290.     Open(Filename);
  291.  
  292.     IF FndError THEN
  293.     BEGIN
  294.         ClrDialog;
  295.         Sysbeep;
  296.         WarningStr:=Concat('The data file <',File,'> cannot be found. Check your Toolkit Manual for further explanation.');
  297.         AlrtDialog(WarningStr);
  298.         Abort:=TRUE;
  299.         GoTo 99;
  300.     END;
  301.  
  302.     SizeNotFound:=FALSE;
  303.     WHILE NOT Eoln(Filename) DO BEGIN
  304.         IF Type <> 4 THEN
  305. ReadLn(Sz,ID,OD1[1],OD1[2],OD1[3],T1[1],T1[2],T1[3])
  306.         ELSE
  307.             ReadLn(Sz,ID,OD1[1],OD1[2],T1[1],T1[2]);
  308.         IF Sz=Size THEN GoTo 20;
  309.     END;
  310.  
  311.     Close(Filename);
  312.     10:SysBeep;
  313.     AlrtDialog('That size is not available!');
  314.     SizeNotFound:=TRUE;
  315.     GoTo 99;
  316.  
  317.     20:Close(Filename);
  318.     OD:=OD1[Series];
  319.     T:=T1[Series];
  320.     IF OD  = 0.0 THEN GOTO 10;
  321. 99:END;
  322.  
  323. Procedure SetRButton(i,Item : INTEGER);
  324. BEGIN
  325.     IF RFlag[i] <> Item THEN BEGIN
  326.         SetItem(RFlag[i],FALSE);
  327.         SetItem(Item,TRUE);
  328.         RFlag[i]:=Item;
  329.     END;
  330. END;
  331.  
  332. Procedure GetInfo1;
  333. {
  334. This procedure displays the Plain Washer dialog box and retrieves the information.
  335. }
  336. LABEL 10,99;
  337. VAR
  338.     Done:boolean;
  339.     Item:integer;
  340.  
  341. BEGIN
  342.     Done:=FALSE;
  343.     Abort:=FALSE;
  344.     
  345.     Type:=1;
  346.     View:=1;
  347.     Series:=2;
  348.     Inch:=TRUE;
  349.     RFlag[1]:=8;
  350.     RFlag[2]:=11;
  351.     RFlag[3]:=14;
  352.  
  353.     GetDialog(1);
  354.     SetTitle('Plain Washers');
  355.     SetItem(RFlag[1],TRUE);
  356.     SetItem(RFlag[2],TRUE);
  357.     SetItem(RFlag[3],TRUE);
  358.     SetField(5,Size1);
  359.  
  360.     10:SelField(5);
  361.     REPEAT
  362.         DialogEvent(Item);
  363.         IF Item=1 THEN
  364.             Done:=TRUE;
  365.  
  366.         IF Item=2 THEN
  367.         BEGIN
  368.             Done:=TRUE;
  369.             Abort:=TRUE;
  370.         END;
  371.  
  372.         IF (Item > 6) AND (Item < 10) THEN
  373.         BEGIN
  374.             SetRButton(1,Item);
  375.             Series:=Item-6;
  376.         END;
  377.  
  378.         IF (Item=11) OR (Item=12) THEN
  379.         BEGIN
  380.             SetRButton(2,Item);
  381.             View:=Item-10;
  382.         END;
  383.  
  384.         IF Item=14 THEN
  385.         BEGIN
  386.             SetRButton(3,Item);
  387.             Type:=1;
  388.             Inch:=TRUE;
  389.             SetField(16,'in');
  390.             SelField(5);
  391.         END;
  392.  
  393.         IF Item=15 THEN
  394.         BEGIN
  395.             SetRButton(3,Item);
  396.             Type:=2;
  397.             Inch:=FALSE;
  398.             SetField(16,'mm');
  399.             SelField(5);
  400.         END;
  401.     UNTIL DONE;
  402.  
  403.     IF Abort THEN GOTO 99;
  404.     Size1:=GetField(5);
  405.     UprString(Size);
  406.     Size:=ConCat('''',Size1,'''');
  407.     UprString(Size);
  408.  
  409.     GetData;
  410.     IF Abort THEN GOTO 99;
  411.     IF SizeNotFound THEN
  412.     BEGIN
  413.         Done:=FALSE;
  414.         GOTO 10;
  415.     END;
  416.  
  417.     99:ClrDialog;
  418. END;
  419.  
  420. Procedure GetInfo2;
  421. {
  422. This procedure displays the User Defined Washer dialog box and retrieves the information.
  423. }
  424. LABEL 10,99;
  425. VAR
  426.     Done:boolean;
  427.     Item:integer;
  428.  
  429. BEGIN
  430.     Done:=FALSE;
  431.     Abort:=FALSE;
  432.     
  433.     View:=1;
  434.     RFlag[1]:=11;
  435.  
  436.     GetDialog(2);
  437.     SetTitle('User Defined Plain Washers');
  438.     SetItem(RFlag[1],TRUE);
  439.     SetField(5,Num2Str(4,ID));
  440.     SetField(7,Num2Str(4,OD));
  441.     SetField(9,Num2Str(4,T));
  442.  
  443.     10:SelField(5);
  444.     REPEAT
  445.         DialogEvent(Item);
  446.         IF Item=1 THEN
  447.             Done:=TRUE;
  448.  
  449.         IF Item=2 THEN
  450.         BEGIN
  451.             Done:=TRUE;
  452.             Abort:=TRUE;
  453.         END;
  454.  
  455.         IF (Item = 11) OR (Item = 12) THEN
  456.         BEGIN
  457.             SetRButton(1,Item);
  458.             View:=Item-10;
  459.         END;
  460.     UNTIL DONE;
  461.  
  462.     IF Abort THEN GOTO 99;
  463.     OK:=ValidNumStr(GetField(5),ID);
  464.     OK:=ValidNumStr(GetField(7),OD);
  465.     OK:=ValidNumStr(GetField(9),T);
  466.  
  467.     IF ID < OD THEN GOTO 99;
  468.     SysBeep;
  469.     AlrtDialog('ID must be less than OD!');
  470.     Done:=FALSE;
  471.     GOTO 10;
  472.     99:ClrDialog;
  473. END;
  474.  
  475. Procedure GetInfo3;
  476. {
  477. This procedure displays the Helical Spring Lock Washer dialog box and retrieves the informaion.
  478. }
  479. LABEL 10,99;
  480. VAR
  481.     Done:boolean;
  482.     Item:integer;
  483.  
  484. BEGIN
  485.     Done:=FALSE;
  486.     Abort:=FALSE;
  487.     
  488.     Type:=3;
  489.     View:=1;
  490.     Series:=1;
  491.     Inch:=TRUE;
  492.     RFlag[1]:=7;
  493.     RFlag[2]:=11;
  494.     RFlag[3]:=14;
  495.  
  496.     GetDialog(3);
  497.     SetTitle('Helical Spring Lock Washers');
  498.     SetItem(RFlag[1],TRUE);
  499.     SetItem(RFlag[2],TRUE);
  500.     SetItem(RFlag[3],TRUE);
  501.     SetField(5,Size1);
  502.  
  503.     10:SelField(5);
  504.     REPEAT
  505.         DialogEvent(Item);
  506.         IF Item=1 THEN
  507.             Done:=TRUE;
  508.  
  509.         IF Item=2 THEN
  510.         BEGIN
  511.             Done:=TRUE;
  512.             Abort:=TRUE;
  513.         END;
  514.  
  515.         IF (Item > 6) AND (Item < 9) THEN
  516.         BEGIN
  517.             SetRButton(1,Item);
  518.             Series:=Item-6;
  519.         END;
  520.  
  521.         IF Item = 9 THEN
  522.         BEGIN
  523.             If Type <> 4 THEN
  524.             BEGIN
  525.                 SetRButton(1,Item);
  526.                 Series:=Item-6;
  527.             END
  528.             ELSE Sysbeep;
  529.         END;
  530.  
  531.         IF (Item=11) OR (Item=12) THEN
  532.         BEGIN
  533.             SetRButton(2,Item);
  534.             View:=Item-10;
  535.         END;
  536.  
  537.         IF Item=14 THEN
  538.         BEGIN
  539.             SetRButton(3,Item);
  540.             Type:=3;
  541.             Inch:=TRUE;
  542.             SetField(16,'');
  543.             SetField(17,'in');
  544.             SelField(5);
  545.         END;
  546.  
  547.         IF Item=15 THEN
  548.         BEGIN
  549.             SetRButton(3,Item);
  550.             Type:=4;
  551.             Inch:=FALSE;
  552.             SetField(16,'<n/a>');
  553.             SetField(17,'mm');
  554.             SelField(5);
  555.             IF Series = 3 THEN
  556.             BEGIN
  557.                 SetRButton(1,7);
  558.                 Series:=1;
  559.             END;
  560.         END;
  561.     UNTIL DONE;
  562.  
  563.     IF Abort THEN GOTO 99;
  564.     Size1:=GetField(5);
  565.     UprString(Size);
  566.     Size:=ConCat('''',Size1,'''');
  567.     UprString(Size);
  568.  
  569.     GetData;
  570.     IF Abort THEN GOTO 99;
  571.     IF SizeNotFound THEN
  572.     BEGIN
  573.         Done:=FALSE;
  574.         GOTO 10;
  575.     END;
  576.  
  577.     99:ClrDialog;
  578. END;
  579.  
  580. Procedure GetInfo4;
  581. {
  582. This procedure displays the main dialog box and retrieves the information.
  583. }
  584. VAR
  585.     Done:BOOLEAN;
  586.     Item:INTEGER;
  587.  
  588. BEGIN
  589.     Done:=FALSE;
  590.     Abort:=FALSE;
  591.     RFlag[1]:=5;
  592.     GetDialog(4);
  593.     SetTitle('Washers');
  594.     SetItem(RFlag[1],TRUE);
  595.     REPEAT
  596.         DialogEvent(Item);
  597.         IF Item = 1 THEN
  598.             Done:=TRUE;
  599.  
  600.         IF Item = 2 THEN
  601.         BEGIN
  602.             Done:=TRUE;
  603.             Abort:=TRUE;
  604.         END;
  605.  
  606.         IF Item > 4 THEN
  607.         BEGIN
  608.             SetRButton(1,Item);
  609.             Style:=Item-4;
  610.         END;
  611.     UNTIL DONE;
  612.  
  613.     ClrDialog;
  614. END;
  615.  
  616. {
  617. Main program.
  618. }
  619.  
  620. BEGIN
  621.     DSelectAll;
  622.     PushAttrs;
  623.     Inch:=TRUE;
  624.     Style:=1;
  625.  
  626. {
  627. Create the dialog boxes.
  628. }
  629.  
  630.     WasherDialog;
  631.     SetCursor(ArrowC);
  632.  
  633. {
  634. Display the main dialog box and get the type of washer to draw.
  635. }
  636.  
  637.     GetInfo4;
  638.     IF Abort THEN GOTO 99;
  639.  
  640. {
  641. Display the proper dialog box and get the information.
  642. }
  643.  
  644.     IF Style = 1 THEN GetInfo1
  645.     ELSE IF Style = 2 THEN GetInfo2
  646.     ELSE GetInfo3;
  647.     IF Abort THEN GOTO 99;
  648.  
  649. {
  650.     IF (Style = 1) OR (Style = 3) THEN BEGIN
  651.         Ans:=FALSE;
  652.         10:IF Style = 1 THEN
  653.             GetInfo1
  654.         ELSE
  655.             GetInfo3;
  656.         IF Abort THEN GOTO 99;
  657.         GetData;
  658.         IF Abort THEN GOTO 99;
  659.         IF Ans THEN GOTO 10;
  660.             OD:=OD1[Series];
  661.             T:=T1[Series];
  662.     END
  663.     ELSE BEGIN
  664.         Type:=5;
  665.         ANS:=FALSE;
  666.         20:GetInfo2;
  667.         IF Abort THEN GOTO 99;
  668.         IF ID < OD THEN GOTO 30;
  669.         Ans:=TRUE;
  670.         SysBeep;
  671.         AlrtDialog('ID must be less than OD!');
  672.         GOTO 20;
  673.     END;
  674. }
  675.  
  676. {
  677. Get the units per inch and adjust the parameters accordingly.
  678. }
  679.  
  680.     GetUnits(SA,DA,Fmt,UPI,UM,UM2);
  681.     IF Inch = TRUE THEN
  682.         SF:=UPI
  683.     ELSE
  684.         SF:=UPI/25.4;
  685.     ID:=SF*ID;
  686.     OD:=SF*OD;
  687.     T:=SF*T;
  688.     30:GetPt(x0,y0);    
  689.  
  690. {
  691. Draw Top View.
  692. }
  693.  
  694.     IF View=1 THEN
  695.     BEGIN
  696. {
  697.         Absolute;
  698.         MoveTo(x0,y0);
  699.         Relative;
  700.         Arc(-OD/2,OD/2,OD/2,-OD/2,0,360);
  701.         Arc(-ID/2,ID/2,ID/2,-ID/2,0,360);
  702.         IF (Type=3) OR (TYPE=4) THEN
  703.         BEGIN
  704.             SW:=SWF*ID;
  705.             x1:=SW/2;
  706.             y1:=Sqrt((OD/2)^2-x1^2);
  707.             x2:=SW/2;
  708.             y2:=Sqrt((ID/2)^2-x1^2);
  709.             Move(-x1,-y1);
  710.             Line(0,(y1-y2));
  711.             Move(2*x1,0);
  712.             Line(0,(y2-y1));
  713.         END;
  714. }
  715.         IF (Type = 3) OR (TYPE = 4) THEN
  716.             SW:=SWF*ID
  717.         ELSE
  718.             SW:=0;
  719.  
  720.         Absolute;
  721.         MoveTo(x0+SW/2, y0-OD/2);
  722.         Relative;
  723.         ClosePoly;
  724.         BeginPoly;
  725.             LineTo(0, 0);
  726.             ArcTo(OD/2-SW/2, 0, OD/2);
  727.             ArcTo(0, OD, OD/2);
  728.             ArcTo(-OD, 0, OD/2);
  729.             ArcTo(0, -OD, OD/2);
  730.             LineTo(OD/2-SW/2, 0);
  731.             IF (Type = 3) OR (Type = 4) THEN
  732.                 LineTo(0, (OD - ID)/2)
  733.             ELSE
  734.                 MoveTo(0, (OD - ID)/2);
  735.  
  736.             ArcTo(-(ID/2-SW/2), 0, ID/2);
  737.             ArcTo(0, ID, ID/2);
  738.             ArcTo(ID, 0, ID/2);
  739.             ArcTo(0, -ID, ID/2);
  740.             LineTo(-(ID/2-SW/2), 0);
  741.             IF (Type = 3) OR (Type = 4) THEN
  742.                 LineTo(0, -(OD - ID)/2)
  743.             ELSE
  744.                 MoveTo(0, -(OD - ID)/2);
  745.         EndPoly;
  746.  
  747.     END
  748.  
  749. {
  750. Draw Side View.
  751. }
  752.  
  753.     ELSE BEGIN
  754.         Absolute;
  755.         MoveTo(x0,y0);
  756.         Relative;
  757.         Rect(-OD/2,t,OD/2,0);
  758.         PushAttrs;
  759.         PenPat(-2);
  760.         Move(-ID/2,0);
  761.         Line(0,t);
  762.         Move(ID,0);
  763.         Line(0,-t);
  764.         PopAttrs;
  765.         IF (Type=3) OR (TYPE=4) THEN
  766.         BEGIN
  767.             SW:=SWF*ID;
  768.             x1:=T*Tan(Deg2Rad(Theta));
  769.             Move(-ID/2,T);
  770.             Line(-x1,-T);
  771.             Move(-SW,0);
  772.             Line(x1,T);
  773.         END;
  774.     END;
  775.  
  776.     PopAttrs;
  777. 99:END;
  778.  
  779. Run(Washer);
  780.