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.
578 lines
16 KiB
C++
578 lines
16 KiB
C++
|
|
// TestDlg.cpp : 实现文件
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "LaiPuLaser.h"
|
|
#include "DlgTest.h"
|
|
#include "afxdialogex.h"
|
|
#include "LogMgr.h"
|
|
#include "GlobalFunction.h"
|
|
// CDlgTest 对话框
|
|
#include <windows.h>
|
|
#include <stdio.h>
|
|
#include "PciCh365Mgr.h"
|
|
#include "PlatformXY.h"
|
|
#include "PciPort.h"
|
|
#include "CommPortMgr.h"
|
|
#include "GratingRuler.h"
|
|
#include "Motor.h"
|
|
#include "MouseToolmgr.h"
|
|
#include "WorkCmdMotorToOffsetPos.h"
|
|
#include "AuthorityMgr.h"
|
|
#include "WorkCmdMovePlatformXY.h"
|
|
#include "Laser.h"
|
|
#include "LaipuVbDllMgr.h"
|
|
#include "CameraKeyence.h"
|
|
#include "WorkCmdInvoker.h"
|
|
#include "MsgBox.h"
|
|
#include "WorkCmdFactory.h"
|
|
#include "DlgMarkArea.h"
|
|
#include "MarkAreaMgr.h"
|
|
#include "ObjComponentMgr.h"
|
|
#include "DlgObjComponent.h"
|
|
#include "PciPortMgr.h"
|
|
#include "WorkTime.h"
|
|
#include "FileMgr.h"
|
|
#include "LaipuVbDllMgr.h"
|
|
#include "ProgramCutMgr.h"
|
|
#include "CommonFlowMgr.h"
|
|
#include "DxfReadMgr.h"
|
|
#include "ExceptionMsg.h"
|
|
#include "Product.h"
|
|
#include "PltReader.h"
|
|
#include "ProductMgr.h"
|
|
#include "WorkFileMgr.h"
|
|
#include "LaipuVbDllMgr.h"
|
|
#include "MotionCard_PCI1245.h"
|
|
#include "Program_SZ_XL_TrackWorkFlow.h"
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC(CDlgTest, CDialogEx)
|
|
BEGIN_MESSAGE_MAP(CDlgTest, CDialogEx)
|
|
ON_BN_CLICKED(IDC_TEST_BTN1, &CDlgTest::OnBnClickedTestBtn1)
|
|
ON_BN_CLICKED(IDC_OPEN_PORT, &CDlgTest::OnBnClickedOpenPort)
|
|
ON_BN_CLICKED(IDC_CLOSE_PORT, &CDlgTest::OnBnClickedClosePort)
|
|
ON_BN_CLICKED(IDC_TEST_BTN2, &CDlgTest::OnBnClickedTestBtn2)
|
|
ON_BN_CLICKED(IDC_READ_PORT, &CDlgTest::OnBnClickedReadPort)
|
|
ON_BN_CLICKED(IDC_WRITE_TO_COMM, &CDlgTest::OnBnClickedWriteToComm)
|
|
ON_EN_CHANGE(IDC_CMD_INPUT, OnEnChangeEdit)
|
|
|
|
ON_WM_MOUSEWHEEL()//鼠标滚轴消息
|
|
ON_BN_CLICKED(IDC_MARK_AREA_DLG, &CDlgTest::OnBnClickedMarkAreaDlg)
|
|
ON_BN_CLICKED(IDC_OBJ_COMP_DLG, &CDlgTest::OnBnClickedObjCompDlg)
|
|
ON_BN_CLICKED(IDC_CREAT_OBJ_BY_LAYER, &CDlgTest::OnBnClickedCreatObjByLayerShape)
|
|
ON_BN_CLICKED(IDC_OPEN_DXF, &CDlgTest::OnBnClickedReadDxfFile)
|
|
ON_BN_CLICKED(IDC_OPEN_PLT, &CDlgTest::OnBnClickedReadPltFile)
|
|
ON_BN_CLICKED(IDC_PCI_MARK, &CDlgTest::OnBnClickedPciMark)
|
|
ON_BN_CLICKED(IDC_PCI_MULTI_AREA_MARK, &CDlgTest::OnBnClickedPciMultiAreaMark)
|
|
ON_BN_CLICKED(IDC_CUT_BY_PLATFROM, &CDlgTest::OnBnClickedCutByPlatfrom)
|
|
ON_BN_CLICKED(IDC_CCD_CATCH, &CDlgTest::OnBnClickedCcdCatch)
|
|
ON_BN_CLICKED(IDC_CCD_CATCH_TWO_MARK, &CDlgTest::OnBnClickedCcdCatchTwoMark)
|
|
ON_BN_CLICKED(IDC_OBJ_TO_CCD_MODE, &CDlgTest::OnBnClickedObjToCcdMode)
|
|
ON_BN_CLICKED(IDC_SET_MARK_PT, &CDlgTest::OnBnClickedSetMarkPt)
|
|
|
|
ON_BN_CLICKED(IDC_READ_OBJ, &CDlgTest::OnBnClickedReadObjFile)
|
|
ON_BN_CLICKED(IDC_SAVE_OBJ, &CDlgTest::OnBnClickedSaveObjFile)
|
|
ON_BN_CLICKED(IDC_CREAT_VISION_DATA, &CDlgTest::OnBnClickedCreatVisionData)
|
|
|
|
ON_BN_CLICKED(IDC_OPEN_MAK, &CDlgTest::OnBnClickedOpenMak)
|
|
ON_BN_CLICKED(IDC_ADJUST_PRODUCT_POS, &CDlgTest::OnBnClickedAdjustProductPos)
|
|
END_MESSAGE_MAP()
|
|
|
|
bool bObjToCcdMode = false;
|
|
bool gFlg = false;
|
|
|
|
|
|
|
|
CDlgTest::CDlgTest(CWnd* pParent /*=NULL*/)
|
|
{
|
|
m_PortNum = 0;//测试的pci 端口号
|
|
m_Input1 = 1;
|
|
m_CommPort = 1;
|
|
m_CommStr = "Trigger,1\r\n";
|
|
m_PortState = _T("状态: ");
|
|
m_MarkTimes = 1;
|
|
m_CyclicTimes = 1;
|
|
}
|
|
CDlgTest::~CDlgTest()
|
|
{
|
|
}
|
|
void CDlgTest::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialogEx::DoDataExchange(pDX);
|
|
DDX_Text(pDX, IDC_PORT_STATE, m_PortState);
|
|
DDX_Text(pDX, IDC_INPUT1, m_Input1);
|
|
DDX_Text(pDX, IDC_COMM_PORT, m_CommPort);
|
|
DDX_Text(pDX, IDC_COMM_STR, m_CommStr);
|
|
DDX_Text(pDX, IDC_COMM_REV, m_CommRev);
|
|
DDX_Text(pDX, IDC_MARK_CNT, m_MarkTimes);
|
|
DDX_Text(pDX, IDC_CYCLIC_TIMES, m_CyclicTimes);
|
|
DDX_Text(pDX, IDC_PORT_NUM, m_PortNum);
|
|
DDX_Control(pDX, IDC_CMD_INPUT, m_CmdInputEdit);
|
|
#ifdef __TBAR_CODE__
|
|
DDX_Control(pDX, IDC_TBARCODE51, m_Tbarcode51);
|
|
#endif
|
|
DDX_Text(pDX, IDC_CMD_INPUT, m_CmdInputStr);
|
|
DDX_Control(pDX, IDC_WRITE_TO_COMM, m_SendToComBtn);
|
|
DDX_Control(pDX, IDC_OPEN_PORT, m_OpenPciPortBtn);
|
|
DDX_Control(pDX, IDC_CLOSE_PORT, m_ClosePciPortBtn);
|
|
DDX_Control(pDX, IDC_READ_PORT, m_ReadPciPortBtn);
|
|
DDX_Control(pDX, IDC_TEST_BTN1, m_Test1Btn);
|
|
DDX_Control(pDX, IDC_TEST_BTN2, m_Test2Btn);
|
|
DDX_Control(pDX, IDC_OBJ_COMP_DLG, m_ObjCompSetBtn);
|
|
DDX_Control(pDX, IDC_MARK_AREA_DLG, m_MarkAreaSetBtn);
|
|
DDX_Control(pDX, IDC_CREAT_OBJ_BY_LAYER, m_CreatObjBtn);
|
|
DDX_Control(pDX, IDC_OPEN_DXF, m_ReadDxfBtn);
|
|
DDX_Control(pDX, IDC_OPEN_PLT, m_ReadPltBtn);
|
|
DDX_Control(pDX, IDC_READ_OBJ, m_ReadObjBtn);
|
|
DDX_Control(pDX, IDC_OPEN_MAK, m_ReadMakBtn);
|
|
|
|
DDX_Control(pDX, IDC_SAVE_OBJ, m_SaveObjBtn);
|
|
|
|
DDX_Control(pDX, IDC_PCI_MARK, m_PciMarkBtn);
|
|
DDX_Control(pDX, IDC_PCI_MULTI_AREA_MARK, m_PciAreaMarkBtn);
|
|
DDX_Control(pDX, IDC_CUT_BY_PLATFROM, m_CutByPlatformBtn);
|
|
DDX_Control(pDX, IDC_CCD_CATCH, m_CameraCatchBtn);
|
|
DDX_Control(pDX, IDC_CCD_CATCH_TWO_MARK, m_CameraCatchMarkBtn);
|
|
DDX_Control(pDX, IDC_OBJ_TO_CCD_MODE, m_ObjToCCDModeBtn);
|
|
DDX_Control(pDX, IDC_SET_MARK_PT, m_SetMarkBtn);
|
|
DDX_Control(pDX, IDC_CREAT_VISION_DATA, m_CreatVisionDataBtn);
|
|
DDX_Control(pDX, IDC_ADJUST_PRODUCT_POS, m_AdjustProductPosBtn);
|
|
}
|
|
BOOL CDlgTest::OnInitDialog()
|
|
{
|
|
CDialogEx::OnInitDialog();
|
|
|
|
m_ObjCompSetBtn.SetUpColor(RGB_GREEN);
|
|
m_MarkAreaSetBtn.SetUpColor(RGB_GREEN);
|
|
m_CreatObjBtn.SetUpColor(RGB_PINK);
|
|
m_ReadDxfBtn.SetUpColor(RGB_PINK);
|
|
m_ReadPltBtn.SetUpColor(RGB_PINK);
|
|
m_ReadObjBtn.SetUpColor(RGB_PINK);
|
|
m_SaveObjBtn.SetUpColor(RGB_PINK);
|
|
m_ReadMakBtn.SetUpColor(RGB_PINK);
|
|
|
|
m_PciMarkBtn.SetUpColor(RGB_GREEN1);
|
|
m_PciAreaMarkBtn.SetUpColor(RGB_GREEN1);
|
|
m_CutByPlatformBtn.SetUpColor(RGB_GREEN1);
|
|
|
|
m_CameraCatchBtn.SetUpColor(RGB_BLUE1);
|
|
m_CameraCatchMarkBtn.SetUpColor(RGB_BLUE1);
|
|
m_CreatVisionDataBtn.SetUpColor(RGB_BLUE1);
|
|
m_SetMarkBtn.SetUpColor(RGB_PINK);
|
|
m_ObjToCCDModeBtn.SetUpColor(RGB_GREEN);
|
|
|
|
m_AdjustProductPosBtn.SetUpColor(RGB_GREEN1);
|
|
UpdateData(FALSE);
|
|
return TRUE;
|
|
}
|
|
|
|
#if 1
|
|
//测试入口
|
|
void CDlgTest::OnBnClickedTestBtn1()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY,true)==false)
|
|
return;
|
|
UpdateData(TRUE);
|
|
|
|
}
|
|
void CDlgTest::OnBnClickedTestBtn2()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY,true)==false)
|
|
return;
|
|
UpdateData(TRUE);
|
|
|
|
}
|
|
int CDlgTest::GetInput1()
|
|
{
|
|
UpdateData(TRUE);
|
|
return m_Input1;
|
|
}
|
|
|
|
#endif
|
|
#if 1//pci 端口测试
|
|
//端口号只能是0~16
|
|
bool CDlgTest::CheckPortNum()
|
|
{
|
|
if(0<=m_PortNum&&m_PortNum<16)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
//打开端口
|
|
void CDlgTest::OnBnClickedOpenPort()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY,true)==false)
|
|
return;
|
|
UpdateData(TRUE);
|
|
if(CheckPortNum())
|
|
{
|
|
SPciPort PciPort;
|
|
PciPort.num = m_PortNum;
|
|
gLogMgr->WriteDebugLog("打开端口","m_PortNum", m_PortNum);
|
|
try
|
|
{
|
|
gPciCh365Mgr->WritePortState(PciPort,true);
|
|
}
|
|
catch(CExceptionMsg &Msg)
|
|
{
|
|
CString str("Func : OpenPciPort---->");
|
|
str += Msg.GetMsgStr();
|
|
gLogMgr->WriteDebugLog(str,_LOG_ERROR);
|
|
}
|
|
}
|
|
}
|
|
//关闭端口
|
|
void CDlgTest::OnBnClickedClosePort()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY,true)==false)
|
|
return;
|
|
UpdateData(TRUE);
|
|
if(CheckPortNum())
|
|
{
|
|
SPciPort PciPort;
|
|
PciPort.num = m_PortNum;
|
|
gLogMgr->WriteDebugLog("关闭端口","m_PortNum", m_PortNum);
|
|
try
|
|
{
|
|
gPciCh365Mgr->WritePortState(PciPort,false);
|
|
}
|
|
catch(CExceptionMsg &Msg)
|
|
{
|
|
CString str("Func : OpenPciPort---->");
|
|
str += Msg.GetMsgStr();
|
|
gLogMgr->WriteDebugLog(str,_LOG_ERROR);
|
|
}
|
|
}
|
|
}
|
|
void CDlgTest::OnBnClickedReadPort()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY,true)==false)
|
|
return;
|
|
UpdateData(TRUE);
|
|
if(CheckPortNum())
|
|
{
|
|
SPciPort port;
|
|
port.num = m_PortNum;
|
|
gLogMgr->WriteDebugLog("读取端口","m_PortNum", m_PortNum);
|
|
try
|
|
{
|
|
bool ret = gPciCh365Mgr->ReadPortState(port);
|
|
if(ret)
|
|
{
|
|
m_PortState = _T("状态: ON");
|
|
}
|
|
else
|
|
{
|
|
m_PortState = _T("状态: OFF");
|
|
}
|
|
UpdateData(FALSE);
|
|
}
|
|
catch(CExceptionMsg &Msg)
|
|
{
|
|
CString str("Func : ReadPciPort---->");
|
|
str += Msg.GetMsgStr();
|
|
gLogMgr->WriteDebugLog(str,_LOG_ERROR);
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#if 1//串口
|
|
//发送字符串到串口
|
|
void CDlgTest::OnBnClickedWriteToComm()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY,true)==false)
|
|
return;
|
|
UpdateData(TRUE);
|
|
|
|
CCommPortMgr com;
|
|
//打开串口
|
|
if(com.Open(m_CommPort,115200)==false)
|
|
{
|
|
return;
|
|
}
|
|
int DelayTime = 200;
|
|
|
|
CString str1 = m_CommStr;
|
|
CString str = str1+char(13)+char(10);
|
|
com.Write(str);
|
|
Sleep(DelayTime);
|
|
|
|
//读取反馈
|
|
m_CommRev = com.ReadStr();
|
|
|
|
com.Close();
|
|
|
|
UpdateData(FALSE);
|
|
}
|
|
#endif
|
|
#if 1//配合标题栏的字符输入
|
|
//设置cmd edit 聚焦
|
|
void CDlgTest::SetCmdEditFocus()
|
|
{
|
|
GetDlgItem(IDC_CMD_INPUT)->SetFocus();
|
|
}
|
|
//截获一部分键盘输入传递给view
|
|
BOOL CDlgTest::PreTranslateMessage(MSG* pMsg)
|
|
{
|
|
if(pMsg->message==WM_KEYDOWN)
|
|
{
|
|
char c = pMsg->wParam;
|
|
if(c==VK_RETURN)
|
|
{
|
|
return TRUE;
|
|
}
|
|
if(c==VK_ESCAPE || c==VK_CONTROL||c==VK_DELETE)
|
|
{
|
|
return GetCurViewPtr()->PreTranslateMessage(pMsg);
|
|
}
|
|
if(c == 'A' || c == 'Z' || c == 'Y')
|
|
{
|
|
return GetCurViewPtr()->PreTranslateMessage(pMsg);
|
|
}
|
|
if(c==VK_LEFT||c==VK_RIGHT||c==VK_UP||c==VK_DOWN)
|
|
{
|
|
return GetCurViewPtr()->PreTranslateMessage(pMsg);
|
|
//BOOL ret = CDialogEx::PreTranslateMessage(pMsg);//先让光标移动
|
|
//SetCaptionInputStr();//再更新光标的位置
|
|
//return ret;
|
|
}
|
|
}
|
|
if(pMsg->message==WM_KEYUP)
|
|
{
|
|
switch(pMsg->wParam)
|
|
{
|
|
case VK_CONTROL:
|
|
return GetCurViewPtr()->PreTranslateMessage(pMsg);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
return CDialogEx::PreTranslateMessage(pMsg);
|
|
}
|
|
void CDlgTest::OnEnChangeEdit()
|
|
{
|
|
UpdateData(TRUE);
|
|
//检查是否输入了space 键
|
|
char space = ' ';
|
|
if(m_CmdInputStr.Find(space,0)!= -1)
|
|
{
|
|
//提取输入的数值
|
|
if(gMouseToolMgr.OnSetCmd(m_CmdInputStr))
|
|
{
|
|
GetFrame()->ResetCaptionBar();
|
|
ResetCmdInputStr();
|
|
}
|
|
else
|
|
{
|
|
gLogMgr->WriteCmd(STR_INPUT_ERROR+m_CmdInputStr,STR_NULL,STR_NULL);
|
|
ResetCmdInputStr();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
SetCaptionInputStr();
|
|
}
|
|
}
|
|
void CDlgTest::ResetCmdInputStr()
|
|
{
|
|
m_CmdInputStr = "";
|
|
UpdateData(FALSE);
|
|
}
|
|
void CDlgTest::SetCaptionInputStr()
|
|
{
|
|
UpdateData(TRUE);
|
|
//获取当前鼠标光标的位置
|
|
int nStartChar;
|
|
int nEndChar;
|
|
m_CmdInputEdit.GetSel(nStartChar,nEndChar);
|
|
CString str1(m_CmdInputStr,nStartChar);
|
|
CString str3 = "_";
|
|
CString str4(m_CmdInputStr);
|
|
str4.Delete(0,nStartChar);
|
|
|
|
GetFrame()->SetCaptionInputStr(str1+str3+str4);
|
|
GetFrame()->RefreashCaptionBar();
|
|
}
|
|
//截获鼠标滚动消息回传给view
|
|
BOOL CDlgTest::OnMouseWheel(UINT nFlags,short zDelta,CPoint point)
|
|
{
|
|
return GetCurViewPtr()->OnMouseWheel(nFlags,zDelta,point);
|
|
}
|
|
#endif
|
|
|
|
#if 1//数据相关功能
|
|
void CDlgTest::OnBnClickedMarkAreaDlg()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY,true)==false)
|
|
return;
|
|
CDlgMarkArea dlg(*gMarkAreaMgr);
|
|
dlg.DoModal();
|
|
}
|
|
void CDlgTest::OnBnClickedObjCompDlg()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_ADMIN,true)==false)
|
|
return;
|
|
CDlgObjComponent dlg(*gObjComponentMgr);
|
|
dlg.DoModal();
|
|
}
|
|
void CDlgTest::OnBnClickedCreatObjByLayerShape()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY,true)==false)
|
|
return;
|
|
CMsgBox MsgBox;
|
|
if(MsgBox.ConfirmOkCancel("通过图形创建obj 对象?"))
|
|
{
|
|
gObjComponentMgr->CreatObjByLayerObj();
|
|
GetCurViewPtr()->RefreshView();
|
|
}
|
|
}
|
|
void CDlgTest::OnBnClickedReadDxfFile()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_ADMIN,true)==false)
|
|
return;
|
|
gDxfReadMgr->OpenDxfFileDlg(-90);
|
|
}
|
|
void CDlgTest::OnBnClickedReadPltFile()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_ADMIN,true)==false)
|
|
return;
|
|
gPltReader->OpenFile();
|
|
}
|
|
void CDlgTest::OnBnClickedOpenMak()
|
|
{
|
|
gProgramCutMgr->OpenMarkFile();
|
|
}
|
|
void CDlgTest::OnBnClickedReadObjFile()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_ADMIN,true)==false)
|
|
return;
|
|
CWorkFileMgr WorkFileMgr;
|
|
WorkFileMgr.OpenObjFile();
|
|
}
|
|
void CDlgTest::OnBnClickedSaveObjFile()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY,true)==false)
|
|
return;
|
|
CWorkFileMgr WorkFileMgr;
|
|
WorkFileMgr.SaveObjFile();
|
|
}
|
|
|
|
#endif
|
|
|
|
#if 1//常用功能
|
|
bool bPciMarkFlg = false;//防止重复进入报错
|
|
void CDlgTest::OnBnClickedPciMark()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY,true)==false)
|
|
return;
|
|
if(!bPciMarkFlg)
|
|
{
|
|
bPciMarkFlg = true;
|
|
UpdateData(TRUE);
|
|
bool bSel = ((CButton*)GetDlgItem(IDC_NEED_SEL_CHECK))->GetCheck();
|
|
gCommonFlowMgr->NormalMarkByPciCard(bSel,m_MarkTimes,m_CyclicTimes);
|
|
|
|
bPciMarkFlg = false;
|
|
}
|
|
}
|
|
void CDlgTest::OnBnClickedPciMultiAreaMark()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY,true)==false)
|
|
return;
|
|
CMsgBox MsgBox;
|
|
if(MsgBox.ConfirmOkCancel(_T("Start PCI MultiMark?"))==false)
|
|
return;
|
|
vector<CProduct> &ProductVec = gProductMgr->GetProductVec();
|
|
int size = ProductVec.size();
|
|
for(int i=0;i<size;i++)
|
|
{
|
|
CProduct &Product = ProductVec[i];
|
|
bool bSel = ((CButton*)GetDlgItem(IDC_NEED_SEL_CHECK))->GetCheck();
|
|
gCommonFlowMgr->MultipleAreaMark(Product,bSel);
|
|
}
|
|
}
|
|
void CDlgTest::OnBnClickedCutByPlatfrom()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY,true)==false)
|
|
return;
|
|
CMsgBox MsgBox;
|
|
if(MsgBox.ConfirmOkCancel(_T("Start Cut By Platfrom?"))==false)
|
|
return;
|
|
vector<CProduct> &ProductVec = gProductMgr->GetProductVec();
|
|
int size = ProductVec.size();
|
|
for(int i=0;i<size;i++)
|
|
{
|
|
CProduct &Product = ProductVec[i];
|
|
bool bSel = ((CButton*)GetDlgItem(IDC_NEED_SEL_CHECK))->GetCheck();
|
|
gCommonFlowMgr->CutShapeByPlatform(Product,bSel);
|
|
}
|
|
}
|
|
#endif
|
|
#if 1
|
|
//触发ccd 识别,并计算连续两次识别点的距离
|
|
void CDlgTest::OnBnClickedCcdCatch()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY,true)==false)
|
|
return;
|
|
gCommonFlowMgr->CameraCatch();
|
|
}
|
|
//设置选择的obj 为mark 点
|
|
void CDlgTest::OnBnClickedSetMarkPt()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY,true)==false)
|
|
return;
|
|
gObjComponentMgr->SetMarkObj();
|
|
CLayer &layer = GetLayerInstance();
|
|
layer.NotSelAllObj();//全不选
|
|
GetCurViewPtr()->RefreshView();
|
|
}
|
|
//识别产品的偏移和旋转
|
|
void CDlgTest::OnBnClickedCcdCatchTwoMark()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY,true)==false)
|
|
return;
|
|
|
|
}
|
|
//选择obj 移动到CCD中心观察
|
|
void CDlgTest::OnBnClickedObjToCcdMode()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY,true)==false)
|
|
return;
|
|
vector<CProduct> &ProductVec = gProductMgr->GetProductVec();
|
|
if(!ProductVec.empty())
|
|
{
|
|
gCommonFlowMgr->MoveSelObjToCamera(ProductVec[0]);
|
|
}
|
|
}
|
|
//测量生成vision.dat
|
|
void CDlgTest::OnBnClickedCreatVisionData()
|
|
{
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY,true)==false)
|
|
return;
|
|
CMsgBox MsgBox;
|
|
if(MsgBox.ConfirmOkCancel(_T("开始测量 \"Vision.dat\"?"))==false)
|
|
return;
|
|
if(gCommonFlowMgr->AutoMeasureVisionData())
|
|
{
|
|
MsgBox.Show("测量 \"Vision.dat\" 结束! ");
|
|
}
|
|
}
|
|
void CDlgTest::OnBnClickedAdjustProductPos()
|
|
{
|
|
CMsgBox MsgBox;
|
|
if(MsgBox.ConfirmOkCancel("调整抓取偏移位置?")==false)
|
|
return;
|
|
gProductMgr->SetProductCenterPt();
|
|
//保存加工参数
|
|
gProgramCutMgr->SaveWorkParFile();
|
|
}
|
|
|
|
#endif
|