From daf053dfd30a3c20524d92290be9d3dc2ac599ec Mon Sep 17 00:00:00 2001
From: LWQ <1806950222@qq.com>
Date: 星期三, 30 七月 2025 19:27:02 +0800
Subject: [PATCH] 1.修复:区分测量精度及研磨量距离单像素精度功能 2.修改:上传到CIM的数据

---
 ENRIT/Process/InspectCamera.cpp |   70 ++++++++++++++++++++++++++++++----
 1 files changed, 61 insertions(+), 9 deletions(-)

diff --git a/ENRIT/Process/InspectCamera.cpp b/ENRIT/Process/InspectCamera.cpp
index f6df629..85efa19 100644
--- a/ENRIT/Process/InspectCamera.cpp
+++ b/ENRIT/Process/InspectCamera.cpp
@@ -1091,7 +1091,20 @@
 	dConv = pCamera->m_dConvResolution[nStageNo];
 	dScan = pCamera->m_dScanResolution[nStageNo];
 	if(dConv <= 0 || dScan <= 0)
-		return FALSE;	
+		return FALSE;
+
+	if (m_pRecipe != nullptr) {
+		CProfileInspect_Prm& profile = m_pRecipe->m_ProfilePrm;
+		double dConvRes = profile.m_dConvResolution[eDimension][nStageNo];
+		if (dConvRes > 0.0) {
+			dConv = dConvRes;
+		}
+
+		double dScanRes = profile.m_dScanResolution[eDimension][nStageNo];
+		if (dScanRes > 0.0) {
+			dScan = dScanRes;
+		}
+	}
 
 	srand((unsigned int)time(NULL));
 
@@ -1674,7 +1687,15 @@
 
 	double dConv = pCamera->m_dConvResolution[g_pBase->m_nStageNo];
 	if(dConv <= 0)
-		return FALSE;	
+		return FALSE;
+
+	if (m_pRecipe != nullptr) {
+		CProfileInspect_Prm& profile = m_pRecipe->m_ProfilePrm;
+		double dConvRes = profile.m_dConvResolution[emDim][g_pBase->m_nStageNo];
+		if (dConvRes > 0.0) {
+			dConv = dConvRes;
+		}
+	}
 
 	double		dProfileAvg;
 	double		dChamferAvg;
@@ -1851,7 +1872,15 @@
 
 	double dConv = pCamera->m_dConvResolution[g_pBase->m_nStageNo];
 	if(dConv <= 0)
-		return FALSE;	
+		return FALSE;
+
+	if (m_pRecipe != nullptr) {
+		CProfileInspect_Prm& profile = m_pRecipe->m_ProfilePrm;
+		double dConvRes = profile.m_dConvResolution[emDim][g_pBase->m_nStageNo];
+		if (dConvRes > 0.0) {
+			dConv = dConvRes;
+		}
+	}
 
 	INS_EDGE_RESULT_INFO *pResInfo =  NULL;
 	pResInfo =  m_pGlassData->GetEdgeResultInfo(emDim);
@@ -1955,6 +1984,19 @@
 	{
 		g_pLog->DisplayMessage(_T("%s MakeProfilePosition Res Null : Frame %d, %d,%.3f,%.3f"),PANEL_SIDE[emDim],stFrame.nFrameIdx,g_pBase->m_nStageNo,dConv,dScan);
 		return FALSE;
+	}
+
+	if (m_pRecipe != nullptr) {
+		CProfileInspect_Prm& profile = m_pRecipe->m_ProfilePrm;
+		double dConvRes = profile.m_dConvResolution[emDim][g_pBase->m_nStageNo];
+		if (dConvRes > 0.0) {
+			dConv = dConvRes;
+		}
+
+		double dScanRes = profile.m_dScanResolution[emDim][g_pBase->m_nStageNo];
+		if (dScanRes > 0.0) {
+			dScan = dScanRes;
+		}
 	}
 
 	ptOffset.x = (float)((double)ptOffset.x / dConv);
@@ -4009,12 +4051,22 @@
 	if(nStageNo < 0 || nStageNo > 1)
 		nStageNo = 0;
 
-	int			nChipInsArea = (int)((double)pChipPrm->m_nChippingInsArea/pCamera->m_dConvResolution[nStageNo]);
-	CRect		rectChip = CRect(rectChamfer.CenterPoint().x,0,rectChamfer.CenterPoint().x,rectChamfer.Height());
-	int			nCrackInsArea = (int)((double)pChipPrm->m_nCrackINsArea/pCamera->m_dConvResolution[nStageNo]);
-	CRect		rectCrack = CRect(rectChamfer.CenterPoint().x,0,rectChamfer.CenterPoint().x,rectChamfer.Height());
-	int			nBrokenInsArea = (int)((double)pChipPrm->m_nBrokenInsArea/pCamera->m_dConvResolution[nStageNo]);
-	CRect		rectBroken = CRect(rectChamfer.CenterPoint().x,0,rectChamfer.CenterPoint().x,rectChamfer.Height());
+	double dConvRes = pCamera->m_dConvResolution[nStageNo];
+
+	//if (m_pRecipe != nullptr) {
+	//	CProfileInspect_Prm& profile = m_pRecipe->m_ProfilePrm;
+	//	double dProfileRes = profile.m_dConvResolution[eDim][nStageNo];
+	//	if (dProfileRes > 0.0) {
+	//		dConvRes = dProfileRes;
+	//	}
+	//}
+
+	int		nChipInsArea = (int)((double)pChipPrm->m_nChippingInsArea / dConvRes);
+	CRect	rectChip = CRect(rectChamfer.CenterPoint().x, 0, rectChamfer.CenterPoint().x, rectChamfer.Height());
+	int		nCrackInsArea = (int)((double)pChipPrm->m_nCrackINsArea / dConvRes);
+	CRect	rectCrack = CRect(rectChamfer.CenterPoint().x, 0, rectChamfer.CenterPoint().x, rectChamfer.Height());
+	int		nBrokenInsArea = (int)((double)pChipPrm->m_nBrokenInsArea / dConvRes);
+	CRect	rectBroken = CRect(rectChamfer.CenterPoint().x, 0, rectChamfer.CenterPoint().x, rectChamfer.Height());
 
 	rectChip.InflateRect(align_4byte(nChipInsArea)/2,0);	
 	rectCrack.InflateRect(align_4byte(nCrackInsArea)/2,0);	

--
Gitblit v1.9.3