You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
119 lines
3.7 KiB
C++
119 lines
3.7 KiB
C++
#include "StdAfx.h"
|
|
#include "DeviceCut.h"
|
|
#include "Propertie.h"
|
|
#include "PropertieMgr.h"
|
|
#include "WorkAreaMgr.h"
|
|
#include "MsgBox.h"
|
|
#include "GlobalDrawMgr.h"
|
|
#include "WorkCmdMotorToMachineOrigin.h"
|
|
|
|
CDeviceCut::CDeviceCut(void)
|
|
{
|
|
m_DelayAfterOpenLaser = 3000;//开激光前延时
|
|
m_DelayAfterCloseLaser = 1000;//关激光后延时(毫秒)
|
|
|
|
m_bPrepareState = false;//设备是否被初始化(未初始化时不能使用某些功能)
|
|
}
|
|
CDeviceCut::~CDeviceCut(void)
|
|
{
|
|
}
|
|
#if 1//复写module 的函数
|
|
CMFCPropertyGridProperty *CDeviceCut::CreatGridProperty()
|
|
{
|
|
CString PropertyName;//属性名称
|
|
CString Description;//描述
|
|
CString Path = _T("cut");//存储路径
|
|
CString Name;
|
|
//-------------------------------------------------------------------------------//
|
|
PropertyName = _T("切割");
|
|
CMFCPropertyGridProperty* pGroup = new CMFCPropertyGridProperty(PropertyName);
|
|
//-------------------------------------------------------------------------------//
|
|
{
|
|
//添加属性变量映射
|
|
Name = _T("m_DelayAfterOpenLaser");//变量名字
|
|
CPropertie *pPropertie = new CPropertie;
|
|
pPropertie->SetpVal((void*)&m_DelayAfterOpenLaser);
|
|
pPropertie->SetType(_PROP_TYPE_INT);
|
|
pPropertie->SetpModule(this);
|
|
pPropertie->SetPath(Path);
|
|
pPropertie->SetName(Name);
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
|
//添加属性显示
|
|
PropertyName = _T("开激光后延时");
|
|
Description = _T("(单位: 毫秒)打开激光后延时一段时间平台才运动,因为激光能量有一个上升的过程");
|
|
CMFCPropertyGridProperty* p = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_DelayAfterOpenLaser, Description);
|
|
pGroup->AddSubItem(p);
|
|
|
|
gDevicePropertieMgr.Insert(p, pPropertie);
|
|
}
|
|
{
|
|
//添加属性变量映射
|
|
Name = _T("m_DelayAfterCloseLaser");//变量名字
|
|
CPropertie *pPropertie = new CPropertie;
|
|
pPropertie->SetpVal((void*)&m_DelayAfterCloseLaser);
|
|
pPropertie->SetType(_PROP_TYPE_INT);
|
|
pPropertie->SetpModule(this);
|
|
pPropertie->SetPath(Path);
|
|
pPropertie->SetName(Name);
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
|
//添加属性显示
|
|
PropertyName = _T("关激光后延时");
|
|
Description = _T("(单位: 毫秒)关闭激光后延时一段时间平台才运动,解决拖尾问题");
|
|
CMFCPropertyGridProperty* p = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_DelayAfterCloseLaser, Description);
|
|
pGroup->AddSubItem(p);
|
|
|
|
gDevicePropertieMgr.Insert(p, pPropertie);
|
|
}
|
|
|
|
return pGroup;
|
|
}
|
|
void CDeviceCut::ExportPar(ofstream *pFile)
|
|
{
|
|
(*pFile)<<"[模块] [CDeviceCut]------------------------------------------------"<<endl;
|
|
(*pFile)<<"[开激光后延时(毫秒)][m_DelayAfterOpenLaser] = "<<m_DelayAfterOpenLaser<<endl;
|
|
(*pFile)<<"[关激光后延时(毫秒)][m_DelayAfterCloseLaser] = "<<m_DelayAfterCloseLaser<<endl;
|
|
}
|
|
#endif
|
|
|
|
//设置准备状态
|
|
void CDeviceCut::SetPrepareState(bool b)
|
|
{
|
|
m_bPrepareState = b;
|
|
if(b)
|
|
gLogMgr->WriteDebugLog("设备准备状态--OK");
|
|
else
|
|
gLogMgr->WriteDebugLog("设备准备状态--ERROR",_LOG_ERROR);
|
|
};
|
|
//获取设备的准备状态
|
|
bool CDeviceCut::GetPrepareState()
|
|
{
|
|
if(!m_bPrepareState)
|
|
{
|
|
CMsgBox MsgBox;
|
|
MsgBox.Show("设备未处于准备状态,请先初始化设备!",true);
|
|
}
|
|
return m_bPrepareState;
|
|
}
|
|
#if 1
|
|
//启动正常工作
|
|
void CDeviceCut::StartWork()
|
|
{
|
|
Work(false);
|
|
}
|
|
//启动模拟工作
|
|
void CDeviceCut::StartSimulateWork()
|
|
{
|
|
Work(true);
|
|
}
|
|
#endif
|
|
#if 1
|
|
//获取鼠标指定点的容器
|
|
void CDeviceCut::GetPointData(CObjContainer &ObjContainer,vector<Dbxy> &vec)
|
|
{
|
|
//提取所有obj 的数据到vec 中--------------------------------------------------
|
|
ObjContainer.GetOnePoint(vec);
|
|
}
|
|
#endif
|