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.
TwoLaserHead-PushJig/LaiPuLaser/MarkCtrl.cpp

116 lines
3.3 KiB
C++

#include "StdAfx.h"
#include "MarkCtrl.h"
#include "LaipuVbDllMgr.h"
#include "WorkDataMgr.h"
#include "LogMgr.h"
#include "MarkParMgr.h"
#include "GlobalFunction.h"
#include "Mirror.h"
#include "ProductMgr.h"
#include "PciCh365Mgr.h"
#include "WorkCmdContainer.h"
#include "WorkCmdMarkArea.h"
#include "WorkCmdInvoker.h"
#include "MarkArea.h"
#include "WorkTime.h"
#include "ExceptionMsg.h"
#include "CommonFlowMgr.h"
CMarkCtrl::CMarkCtrl(void)
{
}
CMarkCtrl::~CMarkCtrl(void)
{
}
#if 1
#include "ClientMgr.h"
void CMarkCtrl::StartMarkPci(vector<vector<Dbxy>> &DateVec,vector<vector<Dbxy>> &SpecialDateVec,int AreaCycleCnt)
{
gLogMgr->WriteDebugLog("StartMarkPci",_LOG_FUNC);
if(gPciCh365Mgr->IsInitialize()==false)
{
CString LogStr("Func : StartMarkPci ---->Pci Card Not Init");
CExceptionMsg Msg;
Msg.SetMsg(LogStr);
throw Msg;
}
//CLaipuVbDllMgr &LaipuVbDll = *gLaipuVbDllMgr;
long low = gPciCh365Mgr->GetOutPortState(true);
long high = gPciCh365Mgr->GetOutPortState(false);
long fileno = -1;
long fileAll = 1;
long MarkM = 8;//标刻模式(多模板,多位置)
long m_sel = 1;//文件选择方式
long head = 0;
CLaipuVbDllMgr LaipuVbDll;
try
{
LaipuVbDll.VbIniCard(low, high);//初始化
SetMarkParam(LaipuVbDll);//设置参数
LaipuVbDll.MarkingStart();//准备
for (int i = 0; i < AreaCycleCnt; i++)
{
LaipuVbDll.CallMarkingData(DateVec);//加工
}
if (!SpecialDateVec.empty())//特殊对象只加工一次
{
LaipuVbDll.CallMarkingData(SpecialDateVec);//加工
}
//结束---------------------------------------------------------------------
//模板编号及位置偏移
LaipuVbDll.CallMarkingEnd(fileno, fileAll, MarkM, m_sel, head, NULL);//结束
}
catch (_com_error e)
{
LaipuVbDll.CallMarkingEnd(fileno, fileAll, MarkM, m_sel, head, NULL);//结束
CString str = (LPCTSTR)e.Description();
CExceptionMsg Msg;
Msg.SetMsg(str);
throw Msg;
}
catch (...)
{
LaipuVbDll.CallMarkingEnd(fileno, fileAll, MarkM, m_sel, head, NULL);//结束
CString str = "激光标刻时,发生未知错误!";
CExceptionMsg Msg;
Msg.SetMsg(str);
throw Msg;
}
}
//设置标刻参数
void CMarkCtrl::SetMarkParam(CLaipuVbDllMgr &LaipuVbDll)
{
gMarkParMgr->SetCurPenNum(0);//只使用0 号笔的参数
CMarkPar &MarkPar = gMarkParMgr->GetCurPen();
//振镜参数--------------------------------------------------------------
//float ms = MarkPar.ms;//标刻速度mm/s
float ms = (float)gCommonFlowMgr->GetCutSpeed();
float mms = MarkPar.mms;//空移速度mm/s
long tcf = MarkPar.tcf;//关激光前延时us
long tch = MarkPar.tch;//关激光后延时us
long tof = MarkPar.tof;//开激光前延时us
long toh = MarkPar.toh;//开激光后延时us
long dr_time = MarkPar.dr_time;//拐点延时 us
double su = gMirror->GetMirrorStep();//振镜步长um
float laserfre = MarkPar.laserfre;//激光频率
float laserpower = MarkPar.laserpower;//激光功率
float maxlaserpower = MarkPar.maxlaserpower;//激光最大功率
CString LogStr;
LogStr.Format(_T("Fuc:SetMarkParam : [CutSpeed] = [%f] "),ms);
gLogMgr->WriteDebugLog(LogStr);
LogStr.Format(_T("Fuc:SetMarkParam : [laserfre] = [%f] ,[laserpower] = [%f] ,[maxlaserpower] = [%f]"),laserfre,laserpower,maxlaserpower);
gLogMgr->WriteDebugLog(LogStr);
LaipuVbDll.GetCom()->Marking_para(&ms,&mms,&tcf,&tch,&tof,&toh,&su,&laserpower,&laserfre,&maxlaserpower,&dr_time);
}
#endif