⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 control.bak

📁 This is a CNCPro source file. It is include the G-Code interpreter source.
💻 BAK
📖 第 1 页 / 共 5 页
字号:
            gotoxy(4,6); cprintf("<7> Switch %c With %c", software.z_label, software.a_label);
            gotoxy(3,8); cprintf("Rotate Coord. System About An Axis");
            while((i=getch())!=27)
              {if(i>='1' && i<='7')
                 {gettext(22,19,59,25,buffer2);
                  box(22,19,59,25, RED,BLACK,WHITE,WHITE);
                  gotoxy(7,3); cprintf("Are You Sure You Want To");
                  gotoxy(6,4);
                  if(i=='1')   cprintf("Rotate +90 Degrees About %c",software.x_label);
                  if(i=='2')   cprintf("Rotate -90 Degrees About %c",software.x_label);
                  if(i=='3')   cprintf("Rotate +90 Degrees About %c",software.y_label);
                  if(i=='4')   cprintf("Rotate -90 Degrees About %c",software.y_label);
                  if(i=='5')   cprintf("Rotate +90 Degrees About %c",software.z_label);
                  if(i=='6')   cprintf("Rotate -90 Degrees About %c",software.z_label);
                  if(i=='7')   cprintf("Switch %c and %c",software.z_label,software.a_label);
                  gotoxy(4,5); cprintf("<Enter> To Accept  <Esc> To Abort");
                  while((ch=getch())!=27 && ch!=13 && ch!=32);
                  if(ch==13 || ch==32)
                    {if(i=='1') rotate_x(&software, &hardware, &pt);
                     if(i=='3') rotate_y(&software, &hardware, &pt);
                     if(i=='5') rotate_z(&software, &hardware, &pt);
                     if(i=='2') {rotate_x(&software, &hardware, &pt); rotate_x(&software, &hardware, &pt); rotate_x(&software, &hardware, &pt);}
                     if(i=='4') {rotate_y(&software, &hardware, &pt); rotate_y(&software, &hardware, &pt); rotate_y(&software, &hardware, &pt);}
                     if(i=='6') {rotate_z(&software, &hardware, &pt); rotate_z(&software, &hardware, &pt); rotate_z(&software, &hardware, &pt);}
                     if(i=='7') switch_z_a(&software, &hardware, &pt);
                     update_display(&software, pt.x_pos, pt.y_pos, pt.z_pos, pt.a_pos, 0, 0, ctrl.frate, ALL);
                    }
                  puttext(22,19,59,25,buffer2);
                 }
              }
            puttext(22,18,59,25,buffer);
            break;
         case 27:
            gettext(22,19,59,24,buffer);
            box(22,19,59,24, RED,BLACK,WHITE,WHITE);
            gotoxy(4,3); cprintf(" Are You Sure You Want To Exit?");
            gotoxy(4,4); cprintf("<Enter> To Accept  <Esc> To Abort");
            while(1)
              {ch=getch();
               if(ch==27 || ch==13 || ch==32) break;
              }
            if(ch==27) kp=0;
            else if(version==DEMO) msg=QUIT;
            puttext(22,19,59,24,buffer);
            break;
        }
      switch(kp)
        {case 31+1000:  //alt s
         case 33+1000:  //alt f
         case 24+1000:  //alt o
         case 71+1000:  //home
         case 18+1000:  //alt e
         case 'e': case 'E':
         case 'u': case 'U':
           pt.x_pos=(world.x_pos-gcode.x_coord[ctrl.cs])*ctrl.pty;
           pt.y_pos=(world.y_pos-gcode.y_coord[ctrl.cs])*ctrl.pty;
           pt.z_pos=(world.z_pos-gcode.z_coord[ctrl.cs])*ctrl.pty;
           pt.a_pos=(world.a_pos-gcode.a_coord[ctrl.cs])*ctrl.pty;
           break;
         case 'o': case 'O':
         case 'r': case 'R':
         case 't': case 'T':
         case 72+1000:  //up
         case 77+1000:  //right
         case 80+1000:  //down
         case 75+1000:  //left
         case 73+1000:  //page up
         case 81+1000:  //page down
         case '+': case '=':
         case '-':
         case 'z': case 'Z':
         case 'M': case 'm':
           world.x_pos=world.x_pos-(world.x_pos-gcode.x_coord[ctrl.cs])*ctrl.pty+pt.x_pos;
           world.y_pos=world.y_pos-(world.y_pos-gcode.y_coord[ctrl.cs])*ctrl.pty+pt.y_pos;
           world.z_pos=world.z_pos-(world.z_pos-gcode.z_coord[ctrl.cs])*ctrl.pty+pt.z_pos;
           world.a_pos=world.a_pos-(world.a_pos-gcode.a_coord[ctrl.cs])*ctrl.pty+pt.a_pos;
           pt.x_pos=pt.x_pos*ctrl.pty; pt.y_pos=pt.y_pos*ctrl.pty;
           pt.z_pos=pt.z_pos*ctrl.pty; pt.a_pos=pt.a_pos*ctrl.pty;
           break;
        }
      if(msg>=X_PLIMIT && msg<=A_NLIMIT) msg=limit_msg(&hardware, &software, &pt, msg);
      if(msg==E_STOP)
        {if(ctrl.M03==ON)
           {if(hardware.io1_on==HIGH) clear_io_bit(&hardware, hardware.io1_bit);
            else set_io_bit(&hardware, hardware.io1_bit);
            ctrl.M03=OFF;}
         if(ctrl.M07==ON)
           {if(hardware.io2_on==HIGH) clear_io_bit(&hardware, hardware.io2_bit);
            else set_io_bit(&hardware, hardware.io2_bit);
            ctrl.M07=OFF;}
         if(ctrl.M08==ON)
           {if(hardware.io3_on==HIGH) clear_io_bit(&hardware, hardware.io3_bit);
            else set_io_bit(&hardware, hardware.io3_bit);
            ctrl.M08=OFF;}
         if(ctrl.M10==ON)
           {if(hardware.io4_on==HIGH) clear_io_bit(&hardware, hardware.io4_bit);
            else set_io_bit(&hardware, hardware.io4_bit);
            ctrl.M10=OFF;}
         estop_msg();
        }
      if(msg==BREAK) message("Machine Break Commanded.");
      if(msg==QUIT) break;
      control_text(&software,&pt,&ctrl,&gcode);
      msg=COMPLETE;
     }

   if(msg==QUIT)
     {box(20,5,60,17, LIGHTGRAY,WHITE,WHITE,BLUE);
      gotoxy(4,4);  cprintf("                                   ");
      gotoxy(4,5);  cprintf(" Thank You For Evaluating CNC Pro  ");
      gotoxy(4,6);  cprintf("         YA (C) 1999, 2000         ");
      gotoxy(4,7);  cprintf("                                   ");
      gotoxy(4,8);  cprintf("  To Order Your Licensed Version   ");
      gotoxy(4,9);  cprintf("      Go To World Wide Web:        ");
      gotoxy(4,10); cprintf(" http://www.yeagerautomation.com   ");
      gotoxy(4,11); cprintf("                                   ");
      end_realtime();
      sleep(5);
     }
   else end_realtime();
   //end realtime control

   normvideo();
   _setcursortype(_NORMALCURSOR);
   window(1,1,80,25);
   clrscr();
   if(strcmp(ctrl.file,"NONE")!=0) fclose(ifp);
   save_setup(&hardware, &software, "SETUP.INI");
   save_screen_setup(&world,&pt,&ctrl);

   return 0;
}

void control_screen(struct soft_setup *software, struct pos *pt, 
                    struct control *ctrl, struct gcode_setup *gcode)
{
   int i;

   window(1,1,80,25); textbackground(BLACK); clrscr();
   window(24,6,40,14); textbackground(RED); clrscr();
   
   window(1,1,40,1); textbackground(BLUE); clrscr();
   gotoxy(4,1); textcolor(LIGHTGRAY);
   cprintf("ile      etup      perator      elp");
   textcolor(WHITE); gotoxy(3,1); putch('F'); gotoxy(12,1); putch('S');
   gotoxy(22,1); putch('O'); gotoxy(35,1); putch('H');

   window(1,1,80,25); textbackground(BLACK); textcolor(WHITE);

   gotoxy(24, 15);   putch(218);
   for(i=25; i<40; i++) putch(196);
   putch(191);
   for(i=16; i<19; i++)
     {gotoxy(24, i);  putch(179);
      gotoxy(40, i);  putch(179);
     }
   gotoxy(24, 19); putch(192);
   for (i=25; i<40; i++) putch(196);
   putch(217);

   gotoxy(1, 2);   putch(218);
   for(i=2; i<40; i++) putch(196);
   putch(191);
   for(i=3; i<4; i++)
     {gotoxy(1, i);  putch(179);
      gotoxy(40, i);  putch(179);
     }
   gotoxy(1, 4); putch(192);
   for (i=2; i<40; i++) putch(196);
   putch(217);

   gotoxy(41, 2);   putch(218);
   for(i=42; i<80; i++) putch(196);
   putch(191);
   for(i=3; i<19; i++)
     {gotoxy(41, i);  putch(179);
      gotoxy(80, i);  putch(179);
     }
   gotoxy(41, 19); putch(192);
   for (i=42; i<80; i++) putch(196);
   putch(217);

   textbackground(RED);
   gotoxy(24, 6);   putch(218);
   for(i=25; i<40; i++) putch(196);
   putch(191);
   for(i=7; i<14; i++)
     {gotoxy(24, i);  putch(179);
      gotoxy(40, i);  putch(179);
     }
   gotoxy(24, 14); putch(192);
   for (i=25; i<40; i++) putch(196);
   putch(217);
   textbackground(BLACK);
   
   gotoxy(2,6);  cprintf("     Menu");
   gotoxy(2,7);  cprintf("<%c>......",26);
   gotoxy(2,8);  cprintf("<%c>......",27);
   gotoxy(2,9);  cprintf("<%c>......",24);
   gotoxy(2,10); cprintf("<%c>......",25);
   gotoxy(2,11); cprintf("<PgUp>...");
   gotoxy(2,12); cprintf("<PgDn>...");
   gotoxy(2,13); cprintf("<+>......");
   gotoxy(2,14); cprintf("<->......");
   gotoxy(2,15); cprintf("<J>......Jog");
   gotoxy(2,16); cprintf("<I>......Inc");
   gotoxy(2,17); cprintf("<F>......Feed Rate");
   gotoxy(2,18); cprintf("<Home>...Home");
   gotoxy(2,19); cprintf("<Z>......Adj. Axis");
   gotoxy(2,20); cprintf("<E>......Execute");
   gotoxy(2,21); cprintf("<Alt-E>..Line Exe.");
   gotoxy(2,22); cprintf("<P>......Program");
   gotoxy(2,23); cprintf("<M>......Move");
   gotoxy(2,24); cprintf("<A>......Rot/SW Ax");
   gotoxy(2,25); cprintf("<Esc>....Exit");
   gotoxy(24,20); cprintf("<V>...Const. Contour");
   gotoxy(24,21); cprintf("<F5>..");
   gotoxy(24,22); cprintf("<F6>..");
   gotoxy(24,23); cprintf("<F7>..");
   gotoxy(24,24); cprintf("<F8>..");
   gotoxy(42,10); putch(26);
   gotoxy(54,20); cprintf("<O>...Coordinate Offset");
   gotoxy(54,21); cprintf("<T>...Tool");
   gotoxy(54,22); cprintf("<R>...Move");
   gotoxy(54,23); cprintf("<U>...Units");
   gotoxy(54,24); cprintf("<W>...");

   control_text(software, pt, ctrl, gcode);
}

void control_text(struct soft_setup *software, struct pos *pt, 
                  struct control *ctrl, struct gcode_setup *gcode)
{
   window(1,1,80,25); textbackground(BLACK); textcolor(WHITE);
   update_display(software, (*pt).x_pos, (*pt).y_pos, (*pt).z_pos, (*pt).a_pos, 0, 0, (*ctrl).frate, ALL);
   if((*software).invert_arrows==ON)
     {gotoxy(11,7); cprintf("Jog +Y"); gotoxy(11,8); cprintf("Jog -Y");
      gotoxy(11,9); cprintf("Jog +X"); gotoxy(11,10); cprintf("Jog -X");
     }
   else
     {gotoxy(11,7); cprintf("Jog +X"); gotoxy(11,8); cprintf("Jog -X");
      gotoxy(11,9); cprintf("Jog +Y"); gotoxy(11,10); cprintf("Jog -Y");
     }
   gotoxy(11,11); cprintf("Jog +Z"); gotoxy(11,12); cprintf("Jog -Z");
   gotoxy(11,13);
   if((*software).a_status==ON) cprintf("Jog +%c",(*software).a_label);
   else cprintf("<N/A> ");
   gotoxy(11,14);
   if((*software).a_status==ON) cprintf("Jog -%c",(*software).a_label);
   else cprintf("<N/A> ");
   gotoxy(14,15);
   if((*ctrl).jog_type==INC) cprintf("(Inc) ");
   if((*ctrl).jog_type==SLOW) cprintf("(Slow)");
   if((*ctrl).jog_type==FAST) cprintf("(Fast)");
   gotoxy(14,16); cprintf("(%7s)",prn_val((*ctrl).jog_inc));
   gotoxy(30,21); cprintf("%s",(*software).io1_label);
   gotoxy(30,22); cprintf("%s",(*software).io2_label);
   gotoxy(30,23); cprintf("%s",(*software).io3_label);
   gotoxy(30,24); cprintf("%s",(*software).io4_label);
   gotoxy(26,16); cprintf("   FR");
   gotoxy(26,17); cprintf("CurFR");
   gotoxy(26,18); cprintf(" %c FR",(*software).a_label);
   gotoxy(48,1); cprintf("G-Code File: %12s",(*ctrl).file);
   gotoxy(24,25); cprintf("Machine Configuration: %12s", (*software).file);
   if((*software).a_status==OFF) {gotoxy(32,18); cprintf("<N/A>  ");}
   textbackground(RED);
   if((*software).a_status==OFF) {gotoxy(29,13); cprintf("<N/A>     ");}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -