From a4d4eab90df29f97832f8b69db40723044ead07f Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 7 Dec 2020 11:53:57 +0000 Subject: [PATCH] EgtMachKernel : - in lavorazione WaterJetting migliorata la gestione degli angoli interni con archi. --- WaterJetting.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/WaterJetting.cpp b/WaterJetting.cpp index ef789ae..88ba474 100644 --- a/WaterJetting.cpp +++ b/WaterJetting.cpp @@ -1956,6 +1956,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo PtrOwner pCurve( pCrvC->Clone()) ; if ( IsNull( pCurve)) return false ; + double dUprev = 0 ; // se prima entità, approccio e affondo if ( i == 0) { // imposto indice dei punti precedenti la partenza @@ -2008,7 +2009,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo // anello PtrOwner pCrvA( GetArc2PVN( ptPe, ptPs, vtEnd, vtN)) ; if ( ! IsNull( pCrvA) && pCrvA->GetType() == CRV_ARC) { - if ( ! AddCurveMove( pCrvA)) + if ( AddCurveMove( pCrvA) == GDB_ID_NULL) return false ; } else { @@ -2028,7 +2029,6 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo // Feed ridotta double dMinFeed = GetActualReducedFeed() ; // ciclo sui punti di accelerazione - double dUprev = 0 ; for ( int j = 1 ; j <= ACC_PNT_NUM ; ++ j) { double dCoeff = j / double( ACC_PNT_NUM) ; double dU ; pCrvC->GetParamAtLength( dCoeff * dAccLen, dU) ; @@ -2037,7 +2037,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo return false ; CalcAndSetToolCorrAuxDir( pCompo, i + dU) ; SetFeed( ( 1 - dCoeff) * dMinFeed + dCoeff * GetActualFeed()) ; - if ( ! AddCurveMove( pCrvT)) + if ( AddCurveMove( pCrvT) == GDB_ID_NULL) return false ; dUprev = dU ; } @@ -2060,10 +2060,11 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo // Feed ridotta double dMinFeed = GetActualReducedFeed() ; // Direzioni utensile nell'angolo e finale - Vector3d vtTp = CalcToolDir( pCompo, i) ; - Vector3d vtTn = CalcToolDir( pCompo, i + 0.5) ; + double dUsta = 0 ; + double dUend ; pCrvC->GetParamAtLength( dAccLen, dUend) ; + Vector3d vtTp = CalcToolDir( pCompo, i + dUsta) ; + Vector3d vtTn = CalcToolDir( pCompo, i + dUend) ; // ciclo sui punti di accelerazione - double dUprev = 0 ; for ( int j = 1 ; j <= ACC_PNT_NUM ; ++ j) { double dCoeff = j / double( ACC_PNT_NUM) ; double dU ; pCrvC->GetParamAtLength( dCoeff * dAccLen, dU) ; @@ -2075,13 +2076,13 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo Vector3d vtCorr = CalcCorrDir( pCompo, i + dU) ; SetToolCorrAuxDir( vtTool, vtCorr) ; SetFeed( ( 1 - dCoeff) * dMinFeed + dCoeff * GetActualFeed()) ; - if ( ! AddCurveMove( pCrvT)) + if ( AddCurveMove( pCrvT) == GDB_ID_NULL) return false ; dUprev = dU ; } } } - // se non è l'ultima entità, verifico se dopo c'è un angolo interno + // se non è l'ultima entità, verifico con l'entità successiva double dNextFeed = GetActualFeed() ; if ( i < nMaxInd) { // controlli per indice del punto di arrivo @@ -2104,7 +2105,6 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo // Feed ridotta double dMinFeed = GetActualReducedFeed() ; // ciclo sui punti di decelerazione - double dUprev = 0 ; for ( int j = 0 ; j < ACC_PNT_NUM ; ++ j) { double dCoeff = j / double( ACC_PNT_NUM) ; double dU ; pCrvC->GetParamAtLength( dLen - ( 1 - dCoeff) * dAccLen, dU) ; @@ -2113,7 +2113,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo return false ; CalcAndSetToolCorrAuxDir( pCompo, i + dU) ; SetFeed( ( 1 - dCoeff) * GetActualFeed() + dCoeff * dMinFeed) ; - if ( ! AddCurveMove( pCrvT)) + if ( AddCurveMove( pCrvT) == GDB_ID_NULL) return false ; dUprev = dU ; } @@ -2137,10 +2137,11 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo // Feed ridotta double dMinFeed = GetActualReducedFeed() ; // Direzioni utensile iniziale e nell'angolo - Vector3d vtTp = CalcToolDir( pCompo, i + 0.5) ; - Vector3d vtTn = CalcToolDir( pCompo, i + 1) ; + double dUsta ; pCrvC->GetParamAtLength( dLen - dAccLen, dUsta) ; + double dUend = 1 ; + Vector3d vtTp = CalcToolDir( pCompo, i + dUsta) ; + Vector3d vtTn = CalcToolDir( pCompo, i + dUend) ; // ciclo sui punti di decelerazione - double dUprev = 0 ; for ( int j = 0 ; j < ACC_PNT_NUM ; ++ j) { double dCoeff = j / double( ACC_PNT_NUM) ; double dU ; pCrvC->GetParamAtLength( dLen - ( 1 - dCoeff) * dAccLen, dU) ; @@ -2152,7 +2153,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo Vector3d vtCorr = CalcCorrDir( pCompo, i + dU) ; SetToolCorrAuxDir( vtTool, vtCorr) ; SetFeed( ( 1 - dCoeff) * GetActualFeed() + dCoeff * dMinFeed) ; - if ( ! AddCurveMove( pCrvT)) + if ( AddCurveMove( pCrvT) == GDB_ID_NULL) return false ; dUprev = dU ; }