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.

179 lines
4.8 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#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"
//#include "Program9SuoXzzMgr.h"
//#include "ProgramCspMarkMgr.h"
CMarkCtrl::CMarkCtrl(void)
{
m_bMarkPciThreadRunning = false;//mark 线程是否正在执行
pData = NULL;
}
CMarkCtrl::~CMarkCtrl(void)
{
}
void CMarkCtrl::StartMarkPci(vector<vector<Dbxy2>> &DataVec)
{
Pci365CardMgr::GetInstance()->InitPci365Card();
m_bMarkPciThreadRunning = true;
pData = &DataVec;
m_markThread = std::thread(&CMarkCtrl::MarkPciThreadExt, this);
m_markThread.join();
}
void CMarkCtrl::StartMarkSemiVb(vector<vector<Dbxy2>> &DataVec)
{
Pci365CardMgr::GetInstance()->InitPci365Card();
m_bMarkPciThreadRunning = true;
pData = &DataVec;
m_markThread = std::thread(&CMarkCtrl::MarkPciSemiThread, this);
m_markThread.join();
}
//设置标刻参数
void CMarkCtrl::SetMarkParam(CLaipuVbDllMgr &LaipuVbDll)
{
//振镜参数--------------------------------------------------------------
//double su = 2.170;//振镜步长um
//float ms = 100;//标刻速度mm/s
//float mms = 500;//空移速度mm/s
//long tcf = 20;//关激光前延时us
//long tch = 70;//关激光后延时us
//long tof = 100;//开激光前延时us
//long toh = 80;//开激光后延时us
//long dr_time = 30;//拐点延时 us
//float laserfre =30;//激光频率khz
//float laserpower = 10;//激光功率
//float maxlaserpower = 100;//激光最大功率
m_su = 1.3673;
LaipuVbDll.GetCom()->Marking_para(&m_ms,
&m_mms,&m_tcf,&m_tch,&m_tof,&m_toh,&m_su,&m_laserpower,&m_laserfre,&m_maxlaserpower,&m_dr_time);
}
void CMarkCtrl::MarkPciThreadExt()
{
long low = 0;
long high = 0;
auto m_laipuVbDLLPtr = std::make_shared<CLaipuVbDllMgr>();
m_laipuVbDLLPtr->VbIniCard(low,high);//初始化
SetMarkParam(*(m_laipuVbDLLPtr.get()));//设置参数
Sleep(100);
m_laipuVbDLLPtr->MarkingStart();//准备
for(int i=0;i<m_markTimes;i++)
{
//std::vector<std::vector<Dbxy>> m_testVec;
//Dbxy point1 = { -5, 0 };
//Dbxy point2 = { 5, 0 };
//std::vector<Dbxy> line1 = { point1, point2 };
//Dbxy point3 = { 0, 5 };
//Dbxy point4 = { 0, -5 };
//std::vector<Dbxy> line2 = { point3, point4 };
//m_testVec = { line1, line2 };
//double x = 1.0;
//double y = 1.0;
//for (int i = 0; i < 9; i++) {
// std::vector<Dbxy> line2 = { Dbxy(-x, y), Dbxy(x, y), Dbxy(x, -y), Dbxy(-x, -y), Dbxy(-x, y) };
// x += 1;
// y += 1;
// m_testVec.push_back(line2);
// //m_laipuVbDLLPtr->CallMarkingData(m_testVec);
//}
//m_laipuVbDLLPtr->CallMarkingData(m_testVec);
m_laipuVbDLLPtr->CallMarkingData(*pData);//加工
}
//结束---------------------------------------------------------------------
long fileno = -1;
long fileAll = 1;
long MarkM = 8;//标刻模式(多模板,多d位置)
long m_sel = 1;//文件选择方式
long head = 0;
//模板编号及位置偏移
m_laipuVbDLLPtr->CallMarkingEnd(fileno,fileAll,MarkM,m_sel,head,NULL);//结束
m_bMarkPciThreadRunning = false;
}
void CMarkCtrl::MarkPciSemiThread()
{
long low = 0;
long high = 0;
auto m_laipuVbDLLPtr = std::make_shared<CLaipuVbDllMgr>();
m_laipuVbDLLPtr->m_pauseDelay = m_pauseDelay;
m_laipuVbDLLPtr->m_pauseFirstDelay = m_pauseFirstDelay;
m_laipuVbDLLPtr->VbIniCard(low, high);//初始化
SetMarkParam(*(m_laipuVbDLLPtr.get()));//设置参数
Sleep(100);
m_laipuVbDLLPtr->MarkingStart();//准备
for (int i = 0; i < m_markTimes; i++)
{
m_laipuVbDLLPtr->CallMarkingDataInSemi(*pData);//加工
}
//结束---------------------------------------------------------------------
long fileno = -1;
long fileAll = 1;
long MarkM = 8;//标刻模式(多模板,多d位置)
long m_sel = 1;//文件选择方式
long head = 0;
//模板编号及位置偏移
m_laipuVbDLLPtr->CallMarkingEnd(fileno, fileAll, MarkM, m_sel, head, NULL);//结束
m_bMarkPciThreadRunning = false;
}
void CMarkCtrl::SetConfigMarkParam(
double su,
float ms,
float mms,
long tcf,
long tch,
long tof,
long toh,
long dr_time,
float laserfre,
float laserpower,
float maxlaserpower)
{
m_su = su;//振镜步长um
m_ms = ms;//标刻速度mm/s
m_mms = mms;//空移速度mm/s
m_tcf = tcf;//关激光前延时us
m_tch = tch;//关激光后延时us
m_tof = tof;//开激光前延时us
m_toh = toh;//开激光后延时us
m_dr_time = dr_time;//拐点延时 us
m_laserfre = laserfre;//激光频率khz
m_laserpower = laserpower;//激光功率
m_maxlaserpower = maxlaserpower;//激光最大功率
}
void CMarkCtrl::OpenLaser(bool isOpen)
{
Pci365CardMgr::GetInstance()->InitPci365Card();
Pci365CardMgr::GetInstance()->CtrlLaserGate(isOpen);
}