增加校验计算方法

This commit is contained in:
TAO Cheng
2013-06-09 18:16:29 +08:00
parent 4e286a5367
commit b1841d69f6
16 changed files with 1836 additions and 15 deletions
@@ -0,0 +1,94 @@
// Utility_Lite.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "Utility_Lite.h"
#include "Utility_LiteDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CUtility_LiteApp
BEGIN_MESSAGE_MAP(CUtility_LiteApp, CWinApp)
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()
// CUtility_LiteApp construction
CUtility_LiteApp::CUtility_LiteApp()
{
// support Restart Manager
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
// The one and only CUtility_LiteApp object
CUtility_LiteApp theApp;
// CUtility_LiteApp initialization
BOOL CUtility_LiteApp::InitInstance()
{
// InitCommonControlsEx() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// Set this to include all the common control classes you want to use
// in your application.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
AfxEnableControlContainer();
// Create the shell manager, in case the dialog contains
// any shell tree view or shell list view controls.
CShellManager *pShellManager = new CShellManager;
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need
// Change the registry key under which our settings are stored
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
CUtility_LiteDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Delete the shell manager created above.
if (pShellManager != NULL)
{
delete pShellManager;
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
@@ -0,0 +1,32 @@
// Utility_Lite.h : main header file for the PROJECT_NAME application
//
#pragma once
#ifndef __AFXWIN_H__
#error "include 'stdafx.h' before including this file for PCH"
#endif
#include "resource.h" // main symbols
// CUtility_LiteApp:
// See Utility_Lite.cpp for the implementation of this class
//
class CUtility_LiteApp : public CWinApp
{
public:
CUtility_LiteApp();
// Overrides
public:
virtual BOOL InitInstance();
// Implementation
DECLARE_MESSAGE_MAP()
};
extern CUtility_LiteApp theApp;
@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{0E5F6F86-6883-47F0-9DC9-8232BBF13B58}</ProjectGuid>
<RootNamespace>Utility_Lite</RootNamespace>
<Keyword>MFCProj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
<None Include="res\Utility_Lite.ico" />
<None Include="res\Utility_Lite.rc2" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="Utility_Lite.h" />
<ClInclude Include="Utility_LiteDlg.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="Utility_Lite.cpp" />
<ClCompile Include="Utility_LiteDlg.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Utility_Lite.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties RESOURCE_FILE="Utility_Lite.rc" />
</VisualStudio>
</ProjectExtensions>
</Project>
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
<None Include="res\Utility_Lite.rc2">
<Filter>Resource Files</Filter>
</None>
<None Include="res\Utility_Lite.ico">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Utility_Lite.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Utility_LiteDlg.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Utility_Lite.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Utility_LiteDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Utility_Lite.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>
@@ -0,0 +1,93 @@
// Utility_LiteDlg.h : header file
//
#pragma once
#define MAX_BUFF_SIZE 0x200
typedef struct{
double x;
double y;
double z;
}Struct_3DPoint;
typedef struct{
double XShift;
double YShift;
double Dis1;
double Dis2;
double Dis3;
double DisAverage;
double StandErr;
}CalShiftReport;
// CUtility_LiteDlg dialog
class CUtility_LiteDlg : public CDialogEx
{
// Construction
public:
CUtility_LiteDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
enum { IDD = IDD_UTILITY_LITE_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
HICON m_hIcon;
CFont m_BTNFont;
// Generated message map functions
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
protected:
CString m_OutMessage;
CEdit m_edMSG;
Struct_3DPoint TopSurfacePnts[3];
Struct_3DPoint BottomSurfacePnts[3];
Struct_3DPoint ReferencePlanePnts[3];
double TopPlaneCoeff[4];
double BottomPlaneCoeff[4];
double ReferencePlaneCoeff[4];
double CalibrateValue;
double CalibrateTopLaserValue;
double CalibrateBottomLaserValue;
double dStandThickness;
double CalXShiftMin,CalXShiftMax,CalXShiftStep;
double CalYShiftMin,CalYShiftMax,CalYShiftStep;
double TopLaserValue;
double dYShiftInputVal;
double dXShiftInputVal;
Struct_3DPoint m_BottomSurfacePNTs[3];
Struct_3DPoint m_TopSurfacePNTs[3];
public:
void InitData();
void GetPNTSData();
void UpdateDisplayPNTSData();
afx_msg void OnBnClickedButtonImagedll2laserCalculate();
BOOL ThreePntsConstructPlane(Struct_3DPoint* pArr,double* Coe);
double PointToPlaneDistance(Struct_3DPoint PntPos,double* Coe);
double DoublePlaneAngle(double* Coe1,double* Coe2);
double LineToPlaneAngle(double* LineVector,double* Coe);
void CalculatePNT2Plane();
void CalculateXYSHIFT();
void CalculateXYSHIFT_METHOD2();
void CalculateXYSHIFT_METHOD3();
void CalculateXYSHIFT_Result();
void ReadData();
void OutputWithScroll(const CString &strNewText,CEdit &edtOutput);
BOOL ExportReportCSV(const CString &FilePathName);
afx_msg void OnBnClickedButtonSaveAllMsg();
afx_msg void OnBnClickedButtonClearAllMsg();
afx_msg void OnBnClickedButtonOpenDataFile();
};
@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// Utility_Lite.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
@@ -0,0 +1,58 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#pragma once
#ifndef _SECURE_ATL
#define _SECURE_ATL 1
#endif
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#endif
#include "targetver.h"
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
// turns off MFC's hiding of some common and often safely ignored warning messages
#define _AFX_ALL_WARNINGS
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxcontrolbars.h> // MFC support for ribbons and control bars
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif
@@ -0,0 +1,8 @@
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>
@@ -111,7 +111,7 @@ void CSO7_Verfication_Algorithm::OnBnClickedButtonImagedll2laserCalculate()
//calibrate //calibrate
ReferencePlanePnts[2].z=TopLaserValue-CalibrateTopLaserValue+CalibrateValue+CalibrateBottomLaserValue; ReferencePlanePnts[2].z=TopLaserValue-CalibrateTopLaserValue+CalibrateValue+CalibrateBottomLaserValue;
ThreePntsConstructionPanel(ReferencePlanePnts,ReferencePlaneCoeff); ThreePntsConstructPlane(ReferencePlanePnts,ReferencePlaneCoeff);
//=====================Top Surface================================== //=====================Top Surface==================================
GetDlgItem(IDC_EDIT_IMAGEDLL_2LASER_X4)->GetWindowText(str); GetDlgItem(IDC_EDIT_IMAGEDLL_2LASER_X4)->GetWindowText(str);
cTempValue=T2A(str); cTempValue=T2A(str);
@@ -147,7 +147,7 @@ void CSO7_Verfication_Algorithm::OnBnClickedButtonImagedll2laserCalculate()
//calibrate //calibrate
TopSurfacePnts[2].z=TopLaserValue-CalibrateTopLaserValue+CalibrateValue+CalibrateBottomLaserValue; TopSurfacePnts[2].z=TopLaserValue-CalibrateTopLaserValue+CalibrateValue+CalibrateBottomLaserValue;
ThreePntsConstructionPanel(TopSurfacePnts,TopPlaneCoeff); ThreePntsConstructPlane(TopSurfacePnts,TopPlaneCoeff);
//====================Bottom Surface================================ //====================Bottom Surface================================
GetDlgItem(IDC_EDIT_IMAGEDLL_2LASER_X7)->GetWindowText(str); GetDlgItem(IDC_EDIT_IMAGEDLL_2LASER_X7)->GetWindowText(str);
cTempValue=T2A(str); cTempValue=T2A(str);
@@ -177,7 +177,7 @@ void CSO7_Verfication_Algorithm::OnBnClickedButtonImagedll2laserCalculate()
cTempValue=T2A(str); cTempValue=T2A(str);
BottomSurfacePnts[2].z=atof(cTempValue); BottomSurfacePnts[2].z=atof(cTempValue);
ThreePntsConstructionPanel(BottomSurfacePnts,BottomPlaneCoeff); ThreePntsConstructPlane(BottomSurfacePnts,BottomPlaneCoeff);
/*************************************************************** /***************************************************************
result result
@@ -187,9 +187,9 @@ void CSO7_Verfication_Algorithm::OnBnClickedButtonImagedll2laserCalculate()
double dAnswer(0.0); double dAnswer(0.0);
CString csOutput; CString csOutput;
//==================Top - Reference================================ //==================Top - Reference================================
Top2ReferenceDis[0]=PointToPanelDistance(TopSurfacePnts[0],ReferencePlaneCoeff); Top2ReferenceDis[0]=PointToPlaneDistance(TopSurfacePnts[0],ReferencePlaneCoeff);
Top2ReferenceDis[1]=PointToPanelDistance(TopSurfacePnts[1],ReferencePlaneCoeff); Top2ReferenceDis[1]=PointToPlaneDistance(TopSurfacePnts[1],ReferencePlaneCoeff);
Top2ReferenceDis[2]=PointToPanelDistance(TopSurfacePnts[2],ReferencePlaneCoeff); Top2ReferenceDis[2]=PointToPlaneDistance(TopSurfacePnts[2],ReferencePlaneCoeff);
Top2ReferenceDis[3]=(Top2ReferenceDis[0]+Top2ReferenceDis[1]+Top2ReferenceDis[2])/3.0; Top2ReferenceDis[3]=(Top2ReferenceDis[0]+Top2ReferenceDis[1]+Top2ReferenceDis[2])/3.0;
@@ -203,9 +203,9 @@ void CSO7_Verfication_Algorithm::OnBnClickedButtonImagedll2laserCalculate()
((CButton*)(GetDlgItem(IDC_EDIT_IMAGEDLL_2LASER_MEASURED_VALUE4)))->SetWindowText(csOutput); ((CButton*)(GetDlgItem(IDC_EDIT_IMAGEDLL_2LASER_MEASURED_VALUE4)))->SetWindowText(csOutput);
Bottom2ReferenceDis[0]=PointToPanelDistance(BottomSurfacePnts[0],ReferencePlaneCoeff); Bottom2ReferenceDis[0]=PointToPlaneDistance(BottomSurfacePnts[0],ReferencePlaneCoeff);
Bottom2ReferenceDis[1]=PointToPanelDistance(BottomSurfacePnts[1],ReferencePlaneCoeff); Bottom2ReferenceDis[1]=PointToPlaneDistance(BottomSurfacePnts[1],ReferencePlaneCoeff);
Bottom2ReferenceDis[2]=PointToPanelDistance(BottomSurfacePnts[2],ReferencePlaneCoeff); Bottom2ReferenceDis[2]=PointToPlaneDistance(BottomSurfacePnts[2],ReferencePlaneCoeff);
Bottom2ReferenceDis[3]=(Bottom2ReferenceDis[0]+Bottom2ReferenceDis[1]+Bottom2ReferenceDis[2])/3.0; Bottom2ReferenceDis[3]=(Bottom2ReferenceDis[0]+Bottom2ReferenceDis[1]+Bottom2ReferenceDis[2])/3.0;
dAnswer=Top2ReferenceDis[3]-Bottom2ReferenceDis[3]; dAnswer=Top2ReferenceDis[3]-Bottom2ReferenceDis[3];
@@ -224,7 +224,7 @@ void CSO7_Verfication_Algorithm::OnBnClickedButtonImagedll2laserCalculate()
} }
//=================================================================== //===================================================================
BOOL CSO7_Verfication_Algorithm::ThreePntsConstructionPanel(Struct_3DPoint* pArr,double* Coe) BOOL CSO7_Verfication_Algorithm::ThreePntsConstructPlane(Struct_3DPoint* pArr,double* Coe)
{ {
Struct_3DPoint p1,p2,p3; Struct_3DPoint p1,p2,p3;
@@ -244,7 +244,7 @@ BOOL CSO7_Verfication_Algorithm::ThreePntsConstructionPanel(Struct_3DPoint* pArr
return TRUE; return TRUE;
}; };
//=================================================================== //===================================================================
double CSO7_Verfication_Algorithm::PointToPanelDistance(Struct_3DPoint PntPos,double* Coe) double CSO7_Verfication_Algorithm::PointToPlaneDistance(Struct_3DPoint PntPos,double* Coe)
{ {
double m_result(0.0); double m_result(0.0);
double a(0.0),b(0.0),c(0.0),d(0.0); double a(0.0),b(0.0),c(0.0),d(0.0);
@@ -154,19 +154,62 @@ void CSo7_Manual_Machine::OnBnClickedRadioSo7ManualMachineCommonCmd3()
//=================================================== //===================================================
void CSo7_Manual_Machine::OnBnClickedRadioSo7ManualMachineSendDataTypeHex() void CSo7_Manual_Machine::OnBnClickedRadioSo7ManualMachineSendDataTypeHex()
{ {
// TODO: Add your control notification handler code here m_SendType=HEXADECIMAL;
} }
//=================================================== //===================================================
void CSo7_Manual_Machine::OnBnClickedRadioSo7ManualMachineSendDataTypeAnscii() void CSo7_Manual_Machine::OnBnClickedRadioSo7ManualMachineSendDataTypeAnscii()
{ {
// TODO: Add your control notification handler code here m_SendType=ANSCII;
} }
//=================================================== //===================================================
void CSo7_Manual_Machine::OnBnClickedButtonSo7ManualMachineSendData() void CSo7_Manual_Machine::OnBnClickedButtonSo7ManualMachineSendData()
{ {
// TODO: Add your control notification handler code here /*
UpdateData(TRUE);
USES_CONVERSION;
CString csSendData(L"");
GetDlgItem(IDC_EDIT_SO7_MANUAL_MACHINE_DATA)->GetWindowText(csSendData);
const char* cSendData=T2A(csSendData);
if (m_SendType==HEXADECIMAL)
{
char* stop;
BYTE bSendData[MAX_OUTPUT_BUFFER_SIZE]={0};
INT iSendDataLength=(csSendData.GetLength()+1)/3;
for(INT i=0;i<iSendDataLength;i++)
{
bSendData[i]=(BYTE)strtol(cSendData+i*3,&stop,16);
}
}
else
{
m_pSO7_Serial->m_csRecv=_T("");
//加上回车换行符
CString csTemp;
csTemp.Format(_T("\r\n"));
csSendData+=csTemp;
cSendData=T2A(csSendData);
}
DWORD iSendDataLength=csSendData.GetLength();
DWORD iWriteByte=m_pSO7_Serial->Send(cSendData,iSendDataLength);
((CListBox *)GetDlgItem(IDC_LIST_SHOWMESSAGE))->InsertString(-1,CString(_T("[Send]: "))+cSendData);//
csSendData.Format(_T("Send(%dByte)"),iWriteByte);
m_StatusBar.SetText(csSendData, 1, 0);
//接受数据
INT iRetrys(0);
while(!m_pSO7_Serial->m_iRecvState && iRetrys<20)
{
iRetrys++;
Sleep(100);
}
*/
} }
//=================================================== //===================================================
@@ -1,6 +1,9 @@
#pragma once #pragma once
typedef enum{
HEXADECIMAL = 0,
ANSCII,
}RS232SendType;
// CSo7_Manual_Machine dialog // CSo7_Manual_Machine dialog
class CSo7_Manual_Machine : public CDialog class CSo7_Manual_Machine : public CDialog
@@ -21,6 +24,7 @@ protected:
protected: protected:
CStatusBarCtrl m_StatusBar; CStatusBarCtrl m_StatusBar;
CEdit m_edit_Log; CEdit m_edit_Log;
char m_SendType;
public: public:
afx_msg void OnBnClickedButtonSo7ManualMachineStartMachine(); afx_msg void OnBnClickedButtonSo7ManualMachineStartMachine();
afx_msg void OnBnClickedButtonSo7ManualMachineStopMachine(); afx_msg void OnBnClickedButtonSo7ManualMachineStopMachine();
@@ -3,6 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010 # Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Usb_Util", "UsbUtil\Usb_Util.vcxproj", "{50B21A79-C887-4F7E-8911-7E3A685BFA25}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Usb_Util", "UsbUtil\Usb_Util.vcxproj", "{50B21A79-C887-4F7E-8911-7E3A685BFA25}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Utility_Lite", "LITE\Utility_Lite\Utility_Lite.vcxproj", "{0E5F6F86-6883-47F0-9DC9-8232BBF13B58}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
@@ -25,6 +27,15 @@ Global
{50B21A79-C887-4F7E-8911-7E3A685BFA25}.Template|Win32.Build.0 = Template|Win32 {50B21A79-C887-4F7E-8911-7E3A685BFA25}.Template|Win32.Build.0 = Template|Win32
{50B21A79-C887-4F7E-8911-7E3A685BFA25}.Template|x64.ActiveCfg = Template|x64 {50B21A79-C887-4F7E-8911-7E3A685BFA25}.Template|x64.ActiveCfg = Template|x64
{50B21A79-C887-4F7E-8911-7E3A685BFA25}.Template|x64.Build.0 = Template|x64 {50B21A79-C887-4F7E-8911-7E3A685BFA25}.Template|x64.Build.0 = Template|x64
{0E5F6F86-6883-47F0-9DC9-8232BBF13B58}.Debug|Win32.ActiveCfg = Debug|Win32
{0E5F6F86-6883-47F0-9DC9-8232BBF13B58}.Debug|Win32.Build.0 = Debug|Win32
{0E5F6F86-6883-47F0-9DC9-8232BBF13B58}.Debug|x64.ActiveCfg = Debug|Win32
{0E5F6F86-6883-47F0-9DC9-8232BBF13B58}.Release|Win32.ActiveCfg = Release|Win32
{0E5F6F86-6883-47F0-9DC9-8232BBF13B58}.Release|Win32.Build.0 = Release|Win32
{0E5F6F86-6883-47F0-9DC9-8232BBF13B58}.Release|x64.ActiveCfg = Release|Win32
{0E5F6F86-6883-47F0-9DC9-8232BBF13B58}.Template|Win32.ActiveCfg = Release|Win32
{0E5F6F86-6883-47F0-9DC9-8232BBF13B58}.Template|Win32.Build.0 = Release|Win32
{0E5F6F86-6883-47F0-9DC9-8232BBF13B58}.Template|x64.ActiveCfg = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE