/* This EAGLE-USER-LANGUAGE Programm operates the "SMASH" - command on
 * all parts of a board or schematic !
 * created by YUM, 061096
 *
 * Run this file from your board or schematic window and proceed sm_all.scr
 * thereafter. You will enjoy seeing that all your parts or elements are
 * automatically smashed !
 * One exception: if two or more parts or elements, which have exactly
 *                the same origin on one side (top or bottom), only one of
 *                it is smashed.
 * For questions contact me:
 * yum@fexphds01.tu-graz.ac.at
 * FAX: ++43-316-873-8655 (Recipient: Mr. Reinhard Daemon)
 * 
 * It may be necessary that you change the output-directory !
*/

int cnt=0, i = 0, coordx[], coordy[];



if (board) board(B)
  { 
/*    int cnt = 0; 
 *   int i = 0;
 *   int coordx[], coordy[]; 
*/

    B.elements(E)
      { 
        coordx[cnt] = u2mil(E.x);
        coordy[cnt] = u2mil(E.y);
        cnt++;
      }
  }
if (schematic) schematic(S)
  {
    S.parts(P)
      {
        P.instances(E)
          {
            coordx[cnt] = u2mil(E.x);
            coordy[cnt] = u2mil(E.y);
            cnt++;
          }  
      }
  }


    output("SM_ALL.SCR","t")
      {
        printf("grid mil;\n"); 

        if (board)
          {
            printf("dis 23;\n");       
            printf("dis -24;\n");   
          } 

        for (i = 0; i < cnt; i++)
          printf("smash (%d %d);\n",coordx[i], coordy[i]);

        if (board)
          {
            printf("dis 24;\n");
            printf("dis -23;\n");
            for (i = 0; i < cnt; i++)
              printf("smash (%d %d);\n",coordx[i], coordy[i]);   
          } 

        printf("grid last;\n");
      }
  
