Keyence utility V2.0:add csv file save type.
This commit is contained in:
@@ -1889,7 +1889,7 @@ SSI_STATUS_MOTION CSO7_Proto::Load_SevenOcean_Inifile(CString cso7IniFile)
|
|||||||
//=========================================================================================
|
//=========================================================================================
|
||||||
SSI_STATUS_MOTION CSO7_Proto::Save_So7_Config()
|
SSI_STATUS_MOTION CSO7_Proto::Save_So7_Config()
|
||||||
{
|
{
|
||||||
FILE* m_pOutFile;
|
FILE* m_pOutFile= NULL;
|
||||||
char *outBuff = NULL;
|
char *outBuff = NULL;
|
||||||
CString csAppPath;
|
CString csAppPath;
|
||||||
GetAppPath(csAppPath);
|
GetAppPath(csAppPath);
|
||||||
|
|||||||
@@ -1088,3 +1088,18 @@ Construct Cso7_Proto.
|
|||||||
Destruct Cso7_Proto.
|
Destruct Cso7_Proto.
|
||||||
Construct Cso7_Proto.
|
Construct Cso7_Proto.
|
||||||
Destruct Cso7_Proto.
|
Destruct Cso7_Proto.
|
||||||
|
Construct Cso7_Proto.
|
||||||
|
Destruct Cso7_Proto.
|
||||||
|
Construct Cso7_Proto.
|
||||||
|
Destruct Cso7_Proto.
|
||||||
|
Construct Cso7_Proto.
|
||||||
|
Init:Open device succeed .
|
||||||
|
_start_machine
|
||||||
|
Exit: Exit_SO7Usb
|
||||||
|
Destruct Cso7_Proto.
|
||||||
|
Construct Cso7_Proto.
|
||||||
|
Destruct Cso7_Proto.
|
||||||
|
Construct Cso7_Proto.
|
||||||
|
Destruct Cso7_Proto.
|
||||||
|
Construct Cso7_Proto.
|
||||||
|
Destruct Cso7_Proto.
|
||||||
|
|||||||
@@ -12,3 +12,7 @@ Construct Cso7_Proto.
|
|||||||
Destruct Cso7_Proto.
|
Destruct Cso7_Proto.
|
||||||
Construct Cso7_Proto.
|
Construct Cso7_Proto.
|
||||||
Destruct Cso7_Proto.
|
Destruct Cso7_Proto.
|
||||||
|
Construct Cso7_Proto.
|
||||||
|
Destruct Cso7_Proto.
|
||||||
|
Construct Cso7_Proto.
|
||||||
|
Destruct Cso7_Proto.
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ void CKeyence_UtilDlg::OnBnClickedButtonTestKeyenceSaveLog()
|
|||||||
|
|
||||||
CString FileName;
|
CString FileName;
|
||||||
CString PathName;
|
CString PathName;
|
||||||
FILE* m_pOutFile;
|
|
||||||
|
|
||||||
FileName=_T("LK_G_Data.txt");
|
FileName=_T("LK_G_Data.txt");
|
||||||
CString szFilter=_T("TXT Files(*.txt)|*.txt|CSV Files(*.csv)|*.csv|ALL Files(*.*)|*.*||");
|
CString szFilter=_T("TXT Files(*.txt)|*.txt|CSV Files(*.csv)|*.csv|ALL Files(*.*)|*.*||");
|
||||||
@@ -228,16 +228,18 @@ void CKeyence_UtilDlg::OnBnClickedButtonTestKeyenceSaveLog()
|
|||||||
|
|
||||||
if( fdlg.DoModal()==IDOK)
|
if( fdlg.DoModal()==IDOK)
|
||||||
{
|
{
|
||||||
|
|
||||||
PathName=fdlg.GetPathName();
|
PathName=fdlg.GetPathName();
|
||||||
|
switch(fdlg.m_ofn.nFilterIndex)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
FILE* m_pOutFile;
|
||||||
_wfopen_s(&m_pOutFile, PathName, _T("wt"));
|
_wfopen_s(&m_pOutFile, PathName, _T("wt"));
|
||||||
if (!m_pOutFile)
|
if (!m_pOutFile)
|
||||||
{
|
{
|
||||||
MessageBox( _T("File name Error."), _T("Message"), MB_OK);
|
MessageBox( _T("File name Error."), _T("Message"), MB_OK);
|
||||||
};
|
}
|
||||||
switch(fdlg.m_ofn.nFilterIndex)
|
else
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
{
|
{
|
||||||
const char* outBuff=NULL;
|
const char* outBuff=NULL;
|
||||||
CString strOutput;
|
CString strOutput;
|
||||||
@@ -245,13 +247,23 @@ void CKeyence_UtilDlg::OnBnClickedButtonTestKeyenceSaveLog()
|
|||||||
outBuff=T2A(strOutput);
|
outBuff=T2A(strOutput);
|
||||||
fprintf(m_pOutFile,"%s", outBuff);
|
fprintf(m_pOutFile,"%s", outBuff);
|
||||||
fclose(m_pOutFile);
|
fclose(m_pOutFile);
|
||||||
|
m_OutMessage=_T("[Saving successful] Data Stored into ")+PathName+_T(".");
|
||||||
|
OutputWithScroll(m_OutMessage,m_edMSG);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
|
BOOL bSTATUS=ExportReportCSV(PathName);
|
||||||
|
if (bSTATUS)
|
||||||
|
{
|
||||||
|
m_OutMessage=_T("[Saving successful] Data Stored into ")+PathName+_T(".");
|
||||||
|
OutputWithScroll(m_OutMessage,m_edMSG);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox( _T("File name Error."), _T("Message"), MB_OK);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -260,6 +272,61 @@ void CKeyence_UtilDlg::OnBnClickedButtonTestKeyenceSaveLog()
|
|||||||
GetDlgItem(IDC_EDIT_TEST_KEYENCE_SETFOCUS)->SetFocus();
|
GetDlgItem(IDC_EDIT_TEST_KEYENCE_SETFOCUS)->SetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================
|
||||||
|
BOOL CKeyence_UtilDlg::ExportReportCSV(const CString &FilePathName)
|
||||||
|
{
|
||||||
|
FILE* m_pOutFile=NULL;
|
||||||
|
char *outBuff = NULL;
|
||||||
|
_wfopen_s(&m_pOutFile, FilePathName, _T("wt"));
|
||||||
|
if (!m_pOutFile)
|
||||||
|
{
|
||||||
|
free(outBuff);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Title
|
||||||
|
for (int i=0;i<8;i++)
|
||||||
|
{
|
||||||
|
if(m_LK_G_ProNOState[i])
|
||||||
|
{
|
||||||
|
fprintf(m_pOutFile,"NO.%d,NO.%d,NO.%d,", i,i,i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fprintf(m_pOutFile, "\n");
|
||||||
|
for (int i=0;i<8;i++)
|
||||||
|
{
|
||||||
|
if(m_LK_G_ProNOState[i])
|
||||||
|
{
|
||||||
|
if (i==m_LK_G_CalibrateNO)
|
||||||
|
{
|
||||||
|
fprintf(m_pOutFile,"OUT1,OUT2,ANSWER,");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(m_pOutFile,"OUT1,OUT2,AVERAGE,");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//OUTPUT DATA
|
||||||
|
KeyenceReport TmpReport;
|
||||||
|
for(size_t i=0;i<LK_GReport.size();i++)
|
||||||
|
{
|
||||||
|
TmpReport=LK_GReport.at(i);
|
||||||
|
if (TmpReport.ProgramNo==0)
|
||||||
|
{
|
||||||
|
fprintf(m_pOutFile, "\n");
|
||||||
|
}
|
||||||
|
fprintf(m_pOutFile,"%.4f,%.4f,%.4f,", TmpReport.OUT1Value,TmpReport.OUT2Value,TmpReport.Result);
|
||||||
|
}
|
||||||
|
fprintf(m_pOutFile, "\n");
|
||||||
|
|
||||||
|
fclose(m_pOutFile);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
// CKeyence_UtilDlg ÏûÏ¢´¦Àí³ÌÐò
|
// CKeyence_UtilDlg ÏûÏ¢´¦Àí³ÌÐò
|
||||||
@@ -413,6 +480,7 @@ void CKeyence_UtilDlg::OnEnKillfocusEditTestLkGInterval()
|
|||||||
}
|
}
|
||||||
void CKeyence_UtilDlg::OnBnClickedButtonTestKeyenceClearLog()
|
void CKeyence_UtilDlg::OnBnClickedButtonTestKeyenceClearLog()
|
||||||
{
|
{
|
||||||
|
LK_GReport.clear();
|
||||||
m_edMSG.SetWindowText(_T(""));
|
m_edMSG.SetWindowText(_T(""));
|
||||||
UpdateData(FALSE);
|
UpdateData(FALSE);
|
||||||
GetDlgItem(IDC_EDIT_TEST_KEYENCE_SETFOCUS)->SetFocus();
|
GetDlgItem(IDC_EDIT_TEST_KEYENCE_SETFOCUS)->SetFocus();
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ public:
|
|||||||
void Get_LK_G_DATA();
|
void Get_LK_G_DATA();
|
||||||
void RunCNC();
|
void RunCNC();
|
||||||
void OutputWithScroll(const CString &strNewText,CEdit &edtOutput);
|
void OutputWithScroll(const CString &strNewText,CEdit &edtOutput);
|
||||||
|
BOOL ExportReportCSV(const CString &FilePathName);
|
||||||
afx_msg BOOL PreTranslateMessage(MSG* pMsg);
|
afx_msg BOOL PreTranslateMessage(MSG* pMsg);
|
||||||
afx_msg void OnBnClickedButtonInitKeyenceLaser();
|
afx_msg void OnBnClickedButtonInitKeyenceLaser();
|
||||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user