|
function InitDraw() {
draw = document.getElementById("MxDrawXCtrl");
draw.ImplementCommandEventFun = function DoCommandEventFunc(iCmd) {
if (iCmd == 1) {
// 启动时打开文件
draw.OpenDwgFile(draw.GetOcxAppPath() + "\\Blk\\animation.dwg");
var animation = draw.NewComObject("IMxDrawAnimation");
//把对象初始化成动画状态
animation.InitAnimationEntity2("211");
animation.InitAnimationEntity2("212");
animation.InitAnimationEntity2("213");
// 启动一个控件时钟事件,用于实现动画。
draw.CallLongParam1("Mx_StartUserTimer", 30);
}
};
draw.ImplementCustomEvent = function CustomEvent(sEventName) {
if (sEventName == "Mx_UserTimer")
{
var animation = draw.NewComObject("IMxDrawAnimation");
//开始一个动画绘制过程
animation.StartDraw();
// 211 212 213是需要旋转实体的句柄.
RotateEnt("211", animation);
RotateEnt("212", animation);
RotateEnt("213", animation);
//结束动画绘制过程
animation.EndDraw();
// 注意需要显示释放递代器.,不然会引起错误
animation = null;
CollectGarbage();
}
};
}
|