您好,欢迎访问三七文档
当前位置:首页 > 办公文档 > 求职简历 > WINCC动画脚本集萃
WINCC动画脚本电机风扇旋转(几何---起始角度):#includeapdefap.hlong_main(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){staticDWORDf=20;if(GetTagBit(DI电机运行信号)){f=f+30;if(f==360)(f=0);}returnf;}电机风扇旋转(几何---结束角度):#includeapdefap.hlong_main(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){staticDWORDi=80;if(GetTagBit(DI电机运行信号)){i=i+30;if(i==360)(i=0);}returni;}**物料水平右移动(几何---位置X)(停车后,物料回到原点)**#includeapdefap.hlong_main(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){staticinta=350;if(GetTagBit(DI电机运行信号)&&(a=730)){a+=20;if(a=720)(a=350);}if(!GetTagBit(DI电机运行信号))(a=350);returna;}物料水平右移动(几何---位置X)(停车后,物料停在该点)#includeapdefap.hlong_main(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){staticinta=350;if(GetTagBit(DI电机运行信号)&&(a=730)){a+=20;if(a=720)(a=350);}returna;}物料向上移动(几何---位置Y)(停车后,物料停在该点)#includeapdefap.hlong_main(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){staticintb=450;if(GetTagBit(DI电机运行信号)&&(b=290)){b-=10;if(b=280)(b=450);}returnb;}年月日(静态文本)#includeapdefap.hchar*_main(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){time_ttimer;structtm*ptm;char*p;time(&timer);ptm=localtime(&timer);p=SysMalloc(9);sprintf(p,%04d/%02d/%02d,ptm-tm_year-100+2000,ptm-tm_mon+1,ptm-tm_mday);return(p);}时分秒(静态文本)#includeapdefap.hchar*_main(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){time_ttimer;structtm*ptm;char*p;time(&timer);ptm=localtime(&timer);p=SysMalloc(9);sprintf(p,%02d:%02d:%02d,ptm-tm_hour,ptm-tm_min,ptm-tm_sec);return(p);}登陆到指定的用户名无须手动输入(按钮操作)#includeapdefap.hvoidOnLButtonDown(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName,UINTnFlags,intx,inty){#pragmacode(useadmin.dll)#includePWRT_API.H#pragmacode()PWRTSilentLogin(用户名,口令);}**显示登陆对话框无须热键(按钮操作)**#includeapdefap.hvoidOnLButtonDown(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName,UINTnFlags,intx,inty){#pragmacode(useadmin.dll)#includePWRT_api.h#pragmacode()PWRTLogin('c');}退出WINCC运行(按钮操作)#includeapdefap.hvoidOnLButtonDown(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName,UINTnFlags,intx,inty){{DeactivateRTProject();}}单位递增按钮(到上限不提示出错)#includeapdefap.hvoidOnClick(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){DWORDvalue;value=GetTagDWord(AI标签);if(value90)(value=上限);elsevalue=value+10;SetTagDWord(AI标签,value);}单位递减按钮(到下限不提示出错)#includeapdefap.hvoidOnClick(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){DWORDvalue;value=GetTagDWord(AI标签);if(value10)(value=下限);elsevalue=value-10;SetTagDWord(AI标签,value);}**单位递增按钮(到上限提示出错)**#includeapdefap.hvoidOnClick(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){DWORDvalue;HWNDhWnd=NULL;hWnd=FindWindow(NULL,Wincc-运行系统-);value=GetTagDWord(AI标签);if(value=90)(value=value+10);elseMessageBox(hWnd,已到达上限值!,错误,MB_OK|MB_ICONWARNING|MB_APPLMODAL);SetTagDWord(AI标签,value);}**单位递减按钮(到下限提示出错)**#includeapdefap.hvoidOnClick(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){DWORDvalue;HWNDhWnd=NULL;hWnd=FindWindow(NULL,Wincc-运行系统-);value=GetTagDWord(AI标签);if(value0)(value=value-10);elseMessageBox(hWnd,已到达下限值!,错误,MB_OK|MB_ICONWARNING|MB_APPLMODAL);SetTagDWord(AI标签,value);}**自动登陆到指定的用户(画面属性--其它—授权)**#includeapdefap.hlong_main(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){#pragmacode(useadmin.dll)#includePWRT_API.H#pragmacode()PWRTSilentLogin(用户名,口令);return(0X0);}**询问框(最好用于单机启动,组启也可,2个按钮,NO不操作)**#includeapdefap.hvoidOnLButtonDown(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName,UINTnFlags,intx,inty){HWNDhWnd=NULL;int上位启动信号;hWnd=FindWindow(NULL,WinCCC-Course);if(GetTagBit(DI备妥)){上位启动信号=MessageBox(hWnd,电源已备妥,您现在确定要启动吗?,启动!,MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL);printf(\r\nExample3\r\n);if(上位启动信号==IDNO)(printf(UserselectedNObutton\r\n));else(SetTagByte(上位启动信号,1));}elseMessageBox(hWnd,电源未备妥,请查证后重试!,启动!,MB_OK|MB_ICONHAND|MB_APPLMODAL);}**询问框(最好用于单机启动,组启也可,3个按钮,NO复位)**#includeapdefap.hvoidOnLButtonDown(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName,UINTnFlags,intx,inty){HWNDhWnd=NULL;int上位启动信号;hWnd=FindWindow(NULL,WinCCC-Course);if(GetTagBit(DI备妥)){上位启动信号=MessageBox(hWnd,电源已备妥,您现在确定要启动吗?,启动!,MB_YESNOCANCEL|MB_ICONQUESTION|MB_APPLMODAL);if(上位启动信号==IDCANCEL)(printf(UserselectedNObutton\r\n));else{if(上位启动信号==IDYES)(SetTagByte(上位启动信号,1));else(SetTagByte(上位启动信号,0));}}elseMessageBox(hWnd,电源未备妥,请查证后重试!,启动!,MB_OK|MB_ICONHAND|MB_APPLMODAL);}**搅拌器左侧扇页(几何—宽度)**#includeapdefap.hlong_main(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){staticinth=50;staticintu=0;if(GetTagBit(DI电机运行信号)){if((h0)&&(h=50)){(h-=2);returnh;}if((u=0)&&(u50)){(u+=2);returnu;}u=0;h=50;returnh;returnu;}if(!GetTagBit(DI电机运行信号)){h=50;u=0;returnh;returnu;}}**搅拌器左侧扇页(几何—位置X,右侧扇页没有位置变化)**#includeapdefap.hlong_main(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){staticinth=75;staticintu=125;if(GetTagBit(DI电机运行信号)){if((h=75)&&(h125)){(h+=2);returnh;}if((u=125)&&(u75)){(u-=2);returnu;}u=125;h=75;returnh;returnu;}if(
本文标题:WINCC动画脚本集萃
链接地址:https://www.777doc.com/doc-1736777 .html