资源描述:
《WINCC动画脚本集萃.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、.WINCC电机风扇旋转(几何---起始角度):#include"apdefap.h" long_main(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){static DWORD f=20;if (GetTagBit("DI电机运行信号")) { f=f+30;if(f==360)(f=0);}returnf;}电机风扇旋转(几何---结束角度):#include"apdefap.h" long_main(char*lps
2、zPictureName,char*lpszObjectName,char*lpszPropertyName){static DWORD i=80;if (GetTagBit("DI电机运行信号")){ i=i+30;if(i==360)(i=0);}returni;}**物料水平右移动(几何---位置X)(停车后,物料回到原点)**#include"apdefap.h" long_main(char*lpszPictureName,char*lpszObjectName,char*lpszProp
3、ertyName)word范文.{static int a=350;if (GetTagBit("DI电机运行信号") &&(a<=730)) { a+=20;if(a>=720) (a=350);}if(!GetTagBit("DI电机运行信号")) (a=350); returna;}物料水平右移动(几何---位置X)(停车后,物料停在该点)#include"apdefap.h" long_main(char*lpszPictureName,char*lpszObjectName,char*lpsz
4、PropertyName){static int a=350;if (GetTagBit("DI电机运行信号") &&(a<=730)) { a+=20;if (a>=720) (a=350);} returna;} 物料向上移动(几何---位置Y)(停车后,物料停在该点)#include"apdefap.h" long_main(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){static int b=450;if (
5、GetTagBit("DI电机运行信号") &&(b>=290)) { b-=10;if (b<=280) (b=450);word范文.} returnb;}年月日(静态文本)#include"apdefap.h" char*_main(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){time_t timer;structtm*ptm;char*p;time(&timer);ptm=localtime(&timer);
6、p=SysMalloc(9);sprintf(p,"%04d/%02d/%02d",ptm->tm_year-100+2000,ptm->tm_mon+1,ptm->tm_mday);return(p);} 时分秒(静态文本)#include"apdefap.h" char*_main(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName){time_t timer;structtm*ptm;char*p;time(&timer);ptm
7、=localtime(&timer);p=SysMalloc(9);word范文.sprintf(p,"%02d:%02d:%02d",ptm->tm_hour,ptm->tm_min,ptm->tm_sec); return(p);}登陆到指定的用户名无须手动输入(按钮操作)#include"apdefap.h"voidOnLButtonDown(char*lpszPictureName,char*lpszObjectName,char*lpszPropertyName,UINTnFlags,int
8、x,inty){#pragmacode("useadmin.dll")#include"PWRT_API.H"#pragmacode()PWRTSilentLogin("用户名","口令");} **显示登陆对话框无须热键(按钮操作)**#include"apdefap.h"voidOnLButtonDown(char*lpszPictureName,char*lpszObjectName,char