From a91525108c941e043e014e4b9bc200f3888f9d13 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 25 May 2026 07:37:58 +0200 Subject: [PATCH] EgtMachKernel 3.1e5 : - modifiche a svuotature per correzioni raggio fresa in macchina - preparazione di fresature per correzioni raggio fresa in macchina. --- CamData.cpp | 12 +++++ CamData.h | 5 +- EgtMachKernel.rc | Bin 11774 -> 11774 bytes MachConst.h | 8 ++-- Milling.cpp | 120 ++++++++++++++++++++++++++++++++++------------- Milling.h | 1 + OutputConst.h | 1 + PocketingNT.cpp | 94 +++++++++++++++++++++++-------------- PocketingNT.h | 2 +- Processor.cpp | 14 ++++-- Processor.h | 4 +- 11 files changed, 180 insertions(+), 81 deletions(-) diff --git a/CamData.cpp b/CamData.cpp index 1c42a48..3b5cb48 100644 --- a/CamData.cpp +++ b/CamData.cpp @@ -587,11 +587,23 @@ CamData::CamData( void) bool CamData::SetMoveType( int nMove) { + if ( nMove < 0 || nMove > 3) + return false ; m_nMove = nMove ; ResetObjGraphics() ; return true ; } +//---------------------------------------------------------------------------- +bool +CamData::SetCorrType( int nCorr) +{ + if ( nCorr != 0 && nCorr != 41 && nCorr != 42 && nCorr != 140 && nCorr != 141 && nCorr != 142) + return false ; + m_nCorre = nCorr ; + return true ; +} + //---------------------------------------------------------------------------- bool CamData::SetToolDir( const Vector3d& vtDir) diff --git a/CamData.h b/CamData.h index 96bf94c..106d228 100644 --- a/CamData.h +++ b/CamData.h @@ -46,6 +46,7 @@ class CamData : public IUserObj public : CamData( void) ; bool SetMoveType( int nMove) ; + bool SetCorrType( int nCorr) ; bool SetToolDir( const Vector3d& vtDir) ; bool SetCorrDir( const Vector3d& vtDir) ; bool SetAuxDir( const Vector3d& vtDir) ; @@ -78,6 +79,8 @@ class CamData : public IUserObj { return ( m_nMove == 0 || m_nMove == 1) ; } bool IsArc( void) const { return ( m_nMove == 2 || m_nMove == 3) ; } + int GetCorrType( void) const + { return m_nCorre ; } const Vector3d& GetToolDir( void) const { return m_vtTool ; } const Vector3d& GetCorrDir( void) const @@ -144,7 +147,7 @@ class CamData : public IUserObj int m_nOwnerId ; IGeomDB* m_pGeomDB ; int m_nMove ; // tipo movimento (0=rapido, 1=lineare, 2=arco CW, 3=arco CCW) - int m_nCorre ; // tipo correzione (0, 41, 42, 141, 142, 40) + int m_nCorre ; // tipo correzione (0, 41, 42, 140, 141, 142) bool m_bToolShow ; // flag per forzare la visualizzazione della direzione utensile in ogni caso Vector3d m_vtTool ; // versore fresa Vector3d m_vtCorr ; // versore correzione diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index d199be436fd19ab0cc82db2b0d986e93e381d868..11a1c7e02d9fcf40b888a411fa2b605266b94498 100644 GIT binary patch delta 236 zcmewt{V#gMI%aKGhCGIJh8%`WhGK>c1_cHUhESkLCPN8BDnkm89}HwAf_cT0IklxX ze_&=~W;EUWUhX2(<& nF)y2}rOv|(a;PWRX*mp)AcsxOF#rGn diff --git a/MachConst.h b/MachConst.h index 327be26..780b5c4 100644 --- a/MachConst.h +++ b/MachConst.h @@ -194,8 +194,8 @@ static const double SING_CONE_ANG_DFLT = 0.01 ; //---------------------------------------------------------------------------- // Compensazione Raggio Utensile in Macchina enum { - TOOL_COMPENSATION_PROGRAM = 0, // Compensazione Utensile da Programma - TOOL_COMPENSATION_LENGTH = 1, // Compensazione Lunghezza Utensile in Macchina - TOOL_COMPENSATION_RADIUS = 2, // Compensazione Raggio Utensile in Macchina - TOOL_COMPENSATION_LENGHT_AND_RADIUS = 3 // Compensazione Lunghezza e Raggio Utensile in Macchina + TOOL_COMP_PROGRAM = 0, // Compensazione Utensile da Programma + TOOL_COMP_LENGTH = 1, // Compensazione Lunghezza Utensile in Macchina + TOOL_COMP_RADIUS = 2, // Compensazione Raggio Utensile in Macchina + TOOL_COMP_LEN_AND_RAD = 3 // Compensazione Lunghezza e Raggio Utensile in Macchina } ; diff --git a/Milling.cpp b/Milling.cpp index dd7ee50..c65636d 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -92,6 +92,7 @@ const double LIM_SIN_DIFF_DIR = 0.175 ; // 2362 = "Warning in Milling : tabs incompatible with saw blade" // 2363 = "Warning in Milling : tabs impossible" // 2364 = "Warning in Milling : tabs number less than minimum" +// 2365 = "Warning in Milling : No compensation in tool, so no compensation in machine" //---------------------------------------------------------------------------- USEROBJ_REGISTER( GetOperationClass( OPER_MILLING), Milling) ; @@ -259,6 +260,7 @@ Milling::Milling( void) m_bAggrBottom = false ; m_dCurrOscillLen = 0 ; m_dCurrTabsLen = 0 ; + m_bToolComp = false ; m_bStartOutRaw = false ; m_bEndOutRaw = false ; } @@ -835,6 +837,16 @@ Milling::Apply( bool bRecalc, bool bPostApply) CalcSurfAuxView( nAuxId, nAuxViewId) ; } + // recupero flag correzione raggio fresa + int nToolComp = TOOL_COMP_PROGRAM ; + bool m_bToolComp = ( GetValInNotes( m_Params.m_sUserNotes, UN_TOOL_COMPENSATION, nToolComp) && + ( nToolComp == TOOL_COMP_RADIUS || nToolComp == TOOL_COMP_LEN_AND_RAD) && + m_Params.m_nWorkSide != MILL_WS_CENTER) ; + if ( m_bToolComp && m_TParams.m_nCorr == 0) { + m_bToolComp = false ; + m_pMchMgr->SetWarning( 2365, "Warning in Milling : No compensation in tool, so no compensation in machine") ; + } + // lavoro ogni singola catena bool bOk = true ; int nPathId = m_pGeomDB->GetFirstGroupInGroup( nAuxId) ; @@ -1795,7 +1807,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId) double dOffs = 0.5 * m_TParams.m_dDiam + GetOffsR() ; if ( m_Params.m_nWorkSide != MILL_WS_CENTER && abs( dOffs) > EPS_SMALL) { // valore offset - double dSignOffs = ( m_Params.m_nWorkSide == MILL_WS_RIGHT) ? dOffs : - dOffs ; + double dSignOffs = (( m_Params.m_nWorkSide == MILL_WS_RIGHT) ? dOffs : - dOffs) ; // esecuzione offset if ( ! CalcOffset( pCompo, dSignOffs)) { m_pMchMgr->SetLastError( 2302, "Error in Milling : Offset not computable") ; @@ -4797,6 +4809,7 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const double dElev = m_Params.m_dLiElev ; if ( m_TParams.m_nType != TT_MILL_POLISHING) dElev = min( m_Params.m_dLiElev, dStElev + GetLeadInOutToler()) ; + double dCompLen = m_Params.m_dLiCompLen ; // se step invertito if ( bInvert) { // va aggiustato se non zigzag o spirale @@ -4815,6 +4828,7 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const dElev = m_Params.m_dLoElev ; if ( m_TParams.m_nType != TT_MILL_POLISHING) dElev = min( m_Params.m_dLoElev, dStElev + GetLeadInOutToler()) ; + dCompLen = m_Params.m_dLoCompLen ; } } } @@ -4838,15 +4852,15 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const vtDir1 = ptP1 - ptStart ; if ( ! vtDir1.Normalize()) return false ; - bool bOk = true ; // eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile) - if ( m_Params.m_dLiCompLen > 10 * EPS_SMALL) { + if ( dCompLen > 10 * EPS_SMALL) { vtDir1 = OrthoCompo( vtDir1, vtTool) ; - bOk = bOk && vtDir1.Normalize() ; - vtDir1.Rotate( vtRot, 0, ( bCcwRot ? -1 : 1)) ; - ptP1 += vtDir1 * m_Params.m_dLiCompLen ; + if ( ! vtDir1.Normalize()) + return false ; + vtDir1.Rotate( vtTool, 0, ( bCcwRot ? -1 : 1)) ; + ptP1 += vtDir1 * dCompLen ; } - return bOk ; + return true ; } case MILL_LI_TG_PERP : { Vector3d vtPerp = vtStart ; @@ -4864,17 +4878,18 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const vtDir1 = ptP1 - ptStart ; if ( ! vtDir1.Normalize()) return false ; - bool bOk = true ; // eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile) - if ( m_Params.m_dLiCompLen > 10 * EPS_SMALL) { + if ( dCompLen > 10 * EPS_SMALL) { PtrOwner pCrv( GetArc2PVN( ptStart, ptP1, - vtStart, vtTool)) ; - bOk = bOk && ! IsNull( pCrv) && pCrv->GetEndDir( vtDir1) ; + if ( IsNull( pCrv) || ! pCrv->GetEndDir( vtDir1)) + return false ; vtDir1 = OrthoCompo( vtDir1, vtTool) ; - bOk = bOk && vtDir1.Normalize() ; - vtDir1.Rotate( vtRot, 0, ( bCcwRot ? -1 : 1)) ; - ptP1 += vtDir1 * m_Params.m_dLiCompLen ; + if ( ! vtDir1.Normalize()) + return false ; + vtDir1.Rotate( vtTool, 0, ( bCcwRot ? -1 : 1)) ; + ptP1 += vtDir1 * dCompLen ; } - return bOk ; + return true ; } case MILL_LI_GLIDE : { @@ -4896,7 +4911,17 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const } ptP1 += vtTool * ( vtTool * ( ptStart - ptP1)) + vtTool * dElev ; vtDir1 = ptP1 - ptStart ; - return vtDir1.Normalize() ; + if ( ! vtDir1.Normalize()) + return false ; + // eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile) + if ( dCompLen > 10 * EPS_SMALL) { + vtDir1 = OrthoCompo( vtDir1, vtTool) ; + if ( ! vtDir1.Normalize()) + return false ; + vtDir1.Rotate( vtTool, 0, ( bCcwRot ? -1 : 1)) ; + ptP1 += vtDir1 * dCompLen ; + } + return true ; } case MILL_LI_ZIGZAG : ptP1 = ptStart ; @@ -4923,6 +4948,7 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& double dElev = m_Params.m_dLiElev ; if ( m_TParams.m_nType != TT_MILL_POLISHING) dElev = min( m_Params.m_dLiElev, dStElev + GetLeadInOutToler()) ; + double dCompLen = m_Params.m_dLiCompLen ; // se step invertito if ( bInvert) { // va aggiustato se non zigzag o spirale @@ -4941,6 +4967,7 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& dElev = m_Params.m_dLoElev ; if ( m_TParams.m_nType != TT_MILL_POLISHING) dElev = min( m_Params.m_dLoElev, dStElev + GetLeadInOutToler()) ; + dCompLen = m_Params.m_dLoCompLen ; } } } @@ -4963,7 +4990,7 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& dElev = 0 ; } // eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile) - if ( m_Params.m_dLiCompLen > 10 * EPS_SMALL) { + if ( dCompLen > 10 * EPS_SMALL) { Vector3d vtPerp = vtStart ; Vector3d vtRot = OrthoCompo( vtTool, vtStart) ; vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ; @@ -4992,7 +5019,7 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& dElev = 0 ; } // eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile) - if ( m_Params.m_dLiCompLen > 10 * EPS_SMALL) { + if ( dCompLen > 10 * EPS_SMALL) { Vector3d vtPerp = vtStart ; Vector3d vtRot = OrthoCompo( vtTool, vtStart) ; vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ; @@ -5051,6 +5078,13 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& double dNini = ( ptP1 - ORIG) * vtTool ; double dNfin = ( ptStart - ORIG) * vtTool ; AdjustCurveSlope( pCrv, dNini, dNfin) ; + // eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile) + if ( dCompLen > 10 * EPS_SMALL) { + Point3d ptMid ; + pCrv->GetStartPoint( ptMid) ; + if ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL) + return false ; + } // emetto (con eventuale spezzatura) return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ; } @@ -5165,6 +5199,7 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect double dElev = m_Params.m_dLoElev ; if ( m_TParams.m_nType != TT_MILL_POLISHING) dElev = min( m_Params.m_dLoElev, dEndElev + GetLeadInOutToler()) ; + double dCompLen = m_Params.m_dLoCompLen ; // se uscita come ingresso o step invertito if ( nType == MILL_LO_AS_LI || bInvert) { int nLiType = GetLeadInType() ; @@ -5186,10 +5221,11 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect dElev = m_Params.m_dLiElev ; if ( m_TParams.m_nType != TT_MILL_POLISHING) dElev = min( m_Params.m_dLiElev, dEndElev + GetLeadInOutToler()) ; + dCompLen = m_Params.m_dLiCompLen ; } // senso di rotazione da dir tg a dir esterna bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) || - ( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ; + ( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ; // verifico di poter fare l'uscita a inseguimento if ( nType == MILL_LO_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL) nType = MILL_LO_NONE ; @@ -5204,11 +5240,11 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect Vector3d vtRot = OrthoCompo( vtTool, vtEnd) ; vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ; ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp + vtTool * dElev ; - if ( m_Params.m_dLoCompLen > 10 * EPS_SMALL) { + if ( dCompLen > 10 * EPS_SMALL) { Vector3d vtPerp2 = vtEnd * dTang + vtPerp * dPerp ; if ( vtPerp2.Normalize()) { vtPerp2.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ; - ptP1 += vtPerp2 * m_Params.m_dLoCompLen ; + ptP1 += vtPerp2 * dCompLen ; } } return true ; @@ -5229,11 +5265,11 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect Vector3d vtRot = OrthoCompo( vtTool, vtEnd) ; vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ; ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp + vtTool * dElev ; - if ( m_Params.m_dLoCompLen > 10 * EPS_SMALL) { + if ( dCompLen > 10 * EPS_SMALL) { Vector3d vtPerp2 = vtEnd * dTang + vtPerp * dPerp ; if ( vtPerp2.Normalize()) { vtPerp2.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ; - ptP1 += vtPerp2 * m_Params.m_dLoCompLen ; + ptP1 += vtPerp2 * dCompLen ; } } return true ; @@ -5281,6 +5317,15 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect AdjustCurveSlope( pCrv, dNini, dNini + dElev) ; // assegno punto finale dell'uscita pCrv->GetEndPoint( ptP1) ; + // eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile) + if ( dCompLen > 10 * EPS_SMALL) { + Vector3d vtDir1 ; + pCrv->GetEndDir( vtDir1) ; + vtDir1 = OrthoCompo( vtDir1, vtTool) ; + vtDir1.Normalize() ; + vtDir1.Rotate( vtTool, 0, ( bCcwRot ? 1 : - 1)) ; + ptP1 += vtDir1 * dCompLen ; + } return true ; } default : @@ -5300,6 +5345,7 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d double dElev = m_Params.m_dLoElev ; if ( m_TParams.m_nType != TT_MILL_POLISHING) dElev = min( m_Params.m_dLoElev, dEndElev + GetLeadInOutToler()) ; + double dCompLen = m_Params.m_dLoCompLen ; // se uscita come ingresso o step invertito if ( nType == MILL_LO_AS_LI || bInvert) { int nLiType = GetLeadInType() ; @@ -5321,6 +5367,7 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d dElev = m_Params.m_dLiElev ; if ( m_TParams.m_nType != TT_MILL_POLISHING) dElev = min( m_Params.m_dLiElev, dEndElev + GetLeadInOutToler()) ; + dCompLen = m_Params.m_dLiCompLen ; } // senso di rotazione da dir tg a dir esterna bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) || @@ -5351,11 +5398,11 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d // inserisco movimento di uscita bool bOk = ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ; // eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile) - if ( m_Params.m_dLoCompLen > 10 * EPS_SMALL) { + if ( dCompLen > 10 * EPS_SMALL) { vtDir1 = OrthoCompo( vtDir1, vtTool) ; bOk = bOk && vtDir1.Normalize() ; - vtDir1.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ; - ptP1 += vtDir1 * m_Params.m_dLoCompLen ; + vtDir1.Rotate( vtTool, 0, ( bCcwRot ? 1 : - 1)) ; + ptP1 += vtDir1 * dCompLen ; bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ; } // eventuale movimento in elevazione per flottante @@ -5397,14 +5444,13 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d Vector3d vtDirF ; if ( ! pCrv->GetEndDir( vtDirF)) return false ; - bool bOk = true ; - bOk = ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ; + bool bOk = ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ; // eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile) - if ( m_Params.m_dLoCompLen > 10 * EPS_SMALL) { + if ( dCompLen > 10 * EPS_SMALL) { vtDir1 = OrthoCompo( vtDirF, vtTool) ; bOk = bOk && vtDir1.Normalize() ; - vtDir1.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ; - ptP1 += vtDir1 * m_Params.m_dLoCompLen ; + vtDir1.Rotate( vtTool, 0, ( bCcwRot ? 1 : - 1)) ; + ptP1 += vtDir1 * dCompLen ; bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ; } // eventuale movimento in elevazione per flottante @@ -5455,12 +5501,20 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d // assegno la corretta pendenza double dNini = ( ptEnd - ORIG) * vtTool ; AdjustCurveSlope( pCrv, dNini, dNini + dElev) ; - // emetto - AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) ; // assegno punto e direzione finale dell'uscita pCrv->GetEndPoint( ptP1) ; pCrv->GetEndDir( vtDir1) ; - return true ; + // emetto + bool bOk = ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ; + // eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile) + if ( dCompLen > 10 * EPS_SMALL) { + vtDir1 = OrthoCompo( vtDir1, vtTool) ; + bOk = bOk && vtDir1.Normalize() ; + vtDir1.Rotate( vtTool, 0, ( bCcwRot ? 1 : - 1)) ; + ptP1 += vtDir1 * dCompLen ; + bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ; + } + return bOk ; } default : return false ; diff --git a/Milling.h b/Milling.h index c7c24a6..33dac0c 100644 --- a/Milling.h +++ b/Milling.h @@ -194,6 +194,7 @@ class Milling : public Machining AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto double m_dCurrOscillLen ; // lunghezza corrente lungo il percorso per l'oscillazione double m_dCurrTabsLen ; // lunghezza corrente lungo il percorso per tabs + bool m_bToolComp ; // correzione raggio utensile abilitata dai dati bool m_bStartOutRaw ; // flag forzatura inizio fuori dal grezzo bool m_bEndOutRaw ; // flag forzatura fine fuori dal grezzo Vector3d m_vtStartDir ; // direzione iniziale del percorso in elaborazione diff --git a/OutputConst.h b/OutputConst.h index a22bac9..d12c529 100644 --- a/OutputConst.h +++ b/OutputConst.h @@ -174,6 +174,7 @@ static const std::string GVAR_MASK = ".MASK" ; // (int) mask asso static const std::string GVAR_FLAG = ".FLAG" ; // (int) flag associato ad ogni movimento static const std::string GVAR_FLAG2 = ".FLAG2" ; // (int) secondo flag associato ad ogni movimento static const std::string GVAR_INDEX = ".IDX" ; // (int) indice associato ad ogni movimento +static const std::string GVAR_CORR = ".CORR" ; // (int) tipo di correzione (0=no,41=sn,42=dx,140=out,141=in_sn,142=in_dx) static const std::string GVAR_TDIR = ".TDIR" ; // (Vector3d) versore utensile nel riferimento pezzo static const std::string GVAR_CDIR = ".CDIR" ; // (Vector3d) versore correzione nel riferimento pezzo static const std::string GVAR_ADIR = ".ADIR" ; // (Vector3d) versore ausiliario nel riferimento pezzo diff --git a/PocketingNT.cpp b/PocketingNT.cpp index 0006691..1f86740 100644 --- a/PocketingNT.cpp +++ b/PocketingNT.cpp @@ -101,6 +101,10 @@ static double TOOL_RAD_PTSTART = 20. ; // 2438 = "Error in PocketingNT : not valid Pocketing Volume" // 2439 = "Error in PocketingNT : special apply not calculable" // 2440 = "Error in PocketingNT : compensation tool LeadIn/LeadOut not computable" +// 2441 = "Error in PocketingNT : Detecting open edges failed" +// 2442 = "Error in PocketingNT : Error in CalcPocketing" +// 2443 = "Error in PocketingNT : Calc Limit Region failed" +// 2444 = "Error in PocketingNT : Slicing Raw failed" // 2451 = "Warning in PocketingNT : Skipped entity (xx)" // 2452 = "Warning in PocketingNT : No pocket" // 2453 = "Warning in PocketingNT : Tool name changed (xx)" @@ -109,7 +113,7 @@ static double TOOL_RAD_PTSTART = 20. ; // 2456 = "Warning in PocketingNT : machining step too small (xx)" // 2457 = "Warning in PocketingNT : machining step (xxx) bigger than MaxMaterial (yyy)" // 2458 = "Warning in PocketingNT : machining depth (xxx) bigger than MaxMaterial (yyy)" -// 2459 = "Warning in PocketingNT : Steps too far away from Raw" +// 2459 = "Warning in PocketingNT : No compensation in tool, so no compensation in machine" //---------------------------------------------------------------------------- // Debug @@ -3464,7 +3468,7 @@ PocketingNT::CheckMaxDepth( const ISurfFlatRegion* pSfr, double dDepth, const Ve // NB. La pStmExtrusion potrebbe esistere ma non toccare nessun lato adattato al grezzo PtrOwner pSfrRaw( GetSfrByStmIntersection( IPPStm, - dDepth, 0)) ; if ( IsNull( pSfrRaw)) { - m_pMchMgr->SetLastError( 3027, "Error in PocketingNT : Slicing Raw failed") ; + m_pMchMgr->SetLastError( 2444, "Error in PocketingNT : Slicing Raw failed") ; return false ; } if ( ! pSfrRaw->IsValid() || pSfrRaw->GetChunkCount() == 0) @@ -3479,7 +3483,7 @@ PocketingNT::CheckMaxDepth( const ISurfFlatRegion* pSfr, double dDepth, const Ve // determino i lati aperti della regione ricavata if ( ! ChooseCloseOrOpenEdge( pSfrAdj, pStmExtrusion)) { - m_pMchMgr->SetLastError( 3026, "Error in PocketingNT : Detecting open edges failed") ; + m_pMchMgr->SetLastError( 2441, "Error in PocketingNT : Detecting open edges failed") ; return false ; } @@ -3801,14 +3805,14 @@ PocketingNT::ProcessPath( int nPathId, int nPvId, int nClId) PtrOwner pStmRaw( GetRaw()) ; if ( IsNull( pStmRaw) || ! ChooseRawPart( pSfr, pStmRaw) || ! pStmRaw->IsValid() || pStmRaw->GetTriangleCount() == 0) { - m_pMchMgr->SetLastError( 3025, "Error in PocketingNT : RawPart not computable") ; + m_pMchMgr->SetLastError( 2436, "Error in PocketingNT : not valid Raw") ; return false ; } PtrOwner pStmTrim( GetStmTrim()) ; if ( ! IsNull( pStmTrim)) { if ( ! ChooseRawPart( pSfr, pStmTrim) || ! pStmTrim->IsValid() || pStmTrim->GetTriangleCount() == 0) { - m_pMchMgr->SetLastError( 3025, "Error in PocketingNT : RawPart not computable") ; + m_pMchMgr->SetLastError( 2436, "Error in PocketingNT : not valid Raw") ; return false ; } } @@ -4044,7 +4048,7 @@ PocketingNT::ProcessPath( int nPathId, int nPvId, int nClId) if ( pSfrPock->IsValid() && pSfrPock->GetChunkCount() > 0) { // determino i lati aperti if ( ! ChooseCloseOrOpenEdge( pSfrPock, pStmExtrusion)) { - m_pMchMgr->SetLastError( 3026, "Error in PocketingNT : Detecting open edges failed") ; + m_pMchMgr->SetLastError( 2441, "Error in PocketingNT : Detecting open edges failed") ; return false ; } #if DEBUG_SFR_STEPS @@ -4057,7 +4061,7 @@ PocketingNT::ProcessPath( int nPathId, int nPvId, int nClId) PtrOwner pSfrLimit( CreateSurfFlatRegion()) ; if ( IsNull( pSfrLimit) || ! CalcLimitRegion( pSfrPock, pSfrTrim, pSfrLimit)) { - m_pMchMgr->SetLastError( 3027, "Error in PocketingNT : Calc limit region failed") ; + m_pMchMgr->SetLastError( 2443, "Error in PocketingNT : Calc Limit Region failed") ; return false ; } #if DEBUG_SFR_STEPS @@ -4342,7 +4346,7 @@ PocketingNT::GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo) //---------------------------------------------------------------------------- bool PocketingNT::CalcRetCurve( PathInfoPO& PathInfo, const StepInfoPO& StepInfo, const ICurveComposite* pCrvPath, - const Vector3d& vtTool, bool bHolePocketing, const Point3d& ptHoleDest, bool bToolCompensation, bool bInVsOut, + const Vector3d& vtTool, bool bHolePocketing, const Point3d& ptHoleDest, bool bToolComp, bool bInVsOut, ICurveComposite* pCrvGlide) { /* Funzione per il calcolo della curva a sciovolo (piana) in entrata o in uscita @@ -4355,7 +4359,7 @@ PocketingNT::CalcRetCurve( PathInfoPO& PathInfo, const StepInfoPO& StepInfo, con // se caso speciale curva a spirale if ( bHolePocketing) { // se percorso normale, allora definisco la sipirale e la Guida - if ( ! bToolCompensation) { + if ( ! bToolComp) { Point3d ptStart ; pCrvPath->GetStartPoint( ptStart) ; Point3d ptEnd ; pCrvPath->GetEndPoint( ptEnd) ; if ( ! AreSamePointApprox( ptStart, ptEnd)) { @@ -4647,9 +4651,13 @@ PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo) } // verifico se presente parametro Tool Compensation - int nToolCompensation = -1 ; - bool bToolCompensation = ( GetValInNotes( m_Params.m_sUserNotes, UN_TOOL_COMPENSATION, nToolCompensation) && - ( nToolCompensation == TOOL_COMPENSATION_RADIUS || nToolCompensation == TOOL_COMPENSATION_LENGHT_AND_RADIUS)) ; + int nToolComp = TOOL_COMP_PROGRAM ; + bool bToolComp = ( GetValInNotes( m_Params.m_sUserNotes, UN_TOOL_COMPENSATION, nToolComp) && + ( nToolComp == TOOL_COMP_RADIUS || nToolComp == TOOL_COMP_LEN_AND_RAD)) ; + if ( bToolComp && m_TParams.m_nCorr == 0) { + bToolComp = false ; + m_pMchMgr->SetWarning( 2459, "Warning in PocketingNT : No compensation in tool, so no compensation in machine") ; + } // determino il SideStep double dSideStep = ( ! bPolishing ? GetSideStep() : m_Params.m_dSideStep) ; @@ -4665,8 +4673,8 @@ PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo) m_Params.m_dSideAngle, m_dOpenMinSafe, m_Params.m_nSubType, true, true, m_Params.m_bInvert, false, bConventionalMilling, true, bAdjustFeed, ptStartRef, vStepInfo[i].pSfrLimit, bAllOffset, dMaxOptSize, GetLeadInType(), m_Params.m_dLiTang, m_Params.m_dLiElev, GetLeadOutType(), m_Params.m_dLoTang, - bPolishing, m_Params.m_dEpicyclesRad, m_Params.m_dEpicyclesDist, bToolCompensation, vCrvPaths)) { - m_pMchMgr->SetLastError( 3028, "Error in PocketingNT : Error in CalcPocketing") ; + bPolishing, m_Params.m_dEpicyclesRad, m_Params.m_dEpicyclesDist, bToolComp, vCrvPaths)) { + m_pMchMgr->SetLastError( 2442, "Error in PocketingNT : Error in CalcPocketing") ; return false ; } // se non ho ottenuto percorsi, errore @@ -4744,7 +4752,7 @@ PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo) // altrimenti rimane fisso al punto iniziale del percorso precedente else { // se percorso di correzione, e caso precedente a spirale, non aggiorno il percorso - if ( bToolCompensation && ssize( vStepInfo[i].vPaths) == 2 && vStepInfo[i].vPaths[0].bOptCirle) + if ( bToolComp && ssize( vStepInfo[i].vPaths) == 2 && vStepInfo[i].vPaths[0].bOptCirle) ; // lascio invariato else vStepInfo[i].vPaths.front().pCrvPath->GetStartPoint( ptStartRef) ; @@ -4756,7 +4764,7 @@ PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo) // controllo se la svuotatura è riferita ad un foro chiuso bool bHolePocketing = true ; for ( int i = 0 ; i < ssize( vStepInfo) && bHolePocketing ; ++ i) { - int nPaths = ( bToolCompensation ? 2 : 1) ; + int nPaths = ( bToolComp ? 2 : 1) ; bHolePocketing = ( ssize( vStepInfo[i].vPaths) == nPaths && vStepInfo[i].vPaths[0].bOptCirle && ! vStepInfo[i].vPaths[0].bOutStart && ! vStepInfo[i].vPaths[0].bOutEnd) ; } @@ -4774,7 +4782,7 @@ PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo) // se ho percorsi di compensazione utensile, devo aggiungere all'inizio e alla fine della curva due tratti lineari perpendicolari ad // essa, in questo modo consento alla macchina di cambiare modalità ( questi tratti sono obbligatori) - if ( bToolCompensation) { + if ( bToolComp) { for ( int i = 0 ; i < ssize( vStepInfo) ; ++ i) { for ( int j = 0 ; j < ssize( vStepInfo[i].vPaths) ; ++ j) { if ( vStepInfo[i].vPaths[j].bToolCompensation && @@ -4791,15 +4799,15 @@ PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo) for ( int j = 0 ; j < ssize( vStepInfo[i].vPaths) ; ++ j) { if ( ( GetLeadInType() == POCKET_LI_GLIDE || bHolePocketing)) { Point3d ptHoleDest = P_INVALID ; - if ( bToolCompensation) { + if ( bToolComp) { if ( bHolePocketing && j == 1) vStepInfo[i].vPaths[0].pCrvPath->GetStartPoint( ptHoleDest) ; } PtrOwner pCrvGlideIn( CreateCurveComposite()) ; - if ( ! bToolCompensation || ( bToolCompensation && bHolePocketing && j == 1)) { + if ( ! bToolComp || ( bToolComp && bHolePocketing && j == 1)) { if ( IsNull( pCrvGlideIn) || ! CalcRetCurve( vStepInfo[i].vPaths[j], vStepInfo[i], vStepInfo[i].vPaths[j].pCrvPath, - vStepInfo[i].pSfrPock->GetNormVersor(), bHolePocketing, ptHoleDest, bToolCompensation, true, pCrvGlideIn)) { + vStepInfo[i].pSfrPock->GetNormVersor(), bHolePocketing, ptHoleDest, bToolComp, true, pCrvGlideIn)) { m_pMchMgr->SetLastError( 2415, "Error in PocketingNT : LeadIn not computable") ; return false ; } @@ -4811,11 +4819,11 @@ PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo) } } // se uscita a scivolo - if ( ( GetLeadOutType() == POCKET_LO_GLIDE || bHolePocketing) && ! bToolCompensation) { + if ( ( GetLeadOutType() == POCKET_LO_GLIDE || bHolePocketing) && ! bToolComp) { PtrOwner pCrvGlideOut( CreateCurveComposite()) ; if ( IsNull( pCrvGlideOut) || ! CalcRetCurve( vStepInfo[i].vPaths[j], vStepInfo[i], vStepInfo[i].vPaths[j].pCrvPath, - vStepInfo[i].pSfrPock->GetNormVersor(), bHolePocketing, P_INVALID, false, bToolCompensation, pCrvGlideOut)) { + vStepInfo[i].pSfrPock->GetNormVersor(), bHolePocketing, P_INVALID, false, bToolComp, pCrvGlideOut)) { m_pMchMgr->SetLastError( 2416, "Error in PocketingNT : LeadOut not computable") ; return false ; } @@ -5257,7 +5265,7 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou // calcolo ptP1 per LeadIn iniziale ( punto per approccio a seconda del LeadIn) Point3d ptP1 ; if ( ! CalcLeadInStart( ptStart, vtTool, currPath.pCrvGlideIn, ptP1)) { - m_pMchMgr->SetLastError( 3013, "Error in PocketingNT : LeadIn not computable") ; + m_pMchMgr->SetLastError( 2415, "Error in PocketingNT : LeadIn not computable") ; return false ; } // determino l'elevazione, per il primo percorso verifico anche la posizione della testa e nel caso @@ -5304,13 +5312,13 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou if ( bAbsFirst || ! OrthoCompo( ptMyPos - ptP1, vtTool).IsSmall()) { if ( bAbsFirst && bEscapeElev) { if ( ! AddApproach( ptP1 + vtEscape * dEscapeElev, vtEscape, dMySafeZ, dSafeAggrBottZ, 0., dMyAppr, bSplitArcs, currPath.bOutStart)) { - m_pMchMgr->SetLastError( 3011, "Error in PocketingNT : Approach not computable") ; + m_pMchMgr->SetLastError( 2414, "Error in PocketingNT : Approach not computable") ; return false ; } } else { if ( ! AddApproach( ptP1, vtTool, dMySafeZ, dSafeAggrBottZ, dMyElev, dMyAppr, bSplitArcs, currPath.bOutStart)) { - m_pMchMgr->SetLastError( 3011, "Error in PocketingNT : Approach not computable") ; + m_pMchMgr->SetLastError( 2414, "Error in PocketingNT : Approach not computable") ; return false ; } } @@ -5339,7 +5347,7 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtTool, currStep.pSfrPock, Get( currPath.pCrvGlideIn), Get( currPath.pCrvZigZagIn), ( m_Params.m_nSubType == POCKET_SUB_SPIRALOUT ? m_Params.m_bInvert : ! m_Params.m_bInvert), bSplitArcs, bNoneForced, false)) { - m_pMchMgr->SetLastError( 3013, "Error in PocketingNT : LeadIn not computable") ; + m_pMchMgr->SetLastError( 2415, "Error in PocketingNT : LeadIn not computable") ; return false ; } } @@ -5386,7 +5394,7 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou Point3d ptP1 ; SetFeed( GetEndFeed()) ; if ( ! AddLeadOut( ptEnd, vtEnd, vtTool, currStep.pSfrPock, currPath.pCrvGlideOut, bSplitArcs, false, ptP1)) { - m_pMchMgr->SetLastError( 3014, "Error in PocketingNT : LeadOut not computable") ; + m_pMchMgr->SetLastError( 2416, "Error in PocketingNT : LeadOut not computable") ; return false ; } /* ---- se lavorazione in Doppio in Parallelo ---- */ @@ -5410,7 +5418,7 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou if ( dEscapeElev > 10. * EPS_SMALL && vtEscape.Len() > 10. * EPS_SMALL) { AddLinearMove( ptP1 + vtTool * dLastElev, bSplitArcs) ; if ( ! AddRetract( ptP1 + vtTool * dLastElev, vtEscape, dSafeZ, dSafeAggrBottZ, dEscapeElev, dAppr, bSplitArcs)) { - m_pMchMgr->SetLastError( 3015, "Error in PocketingNT : Retract not computable") ; + m_pMchMgr->SetLastError( 2417, "Error in PocketingNT : Retract not computable") ; return false ; } } @@ -5419,7 +5427,7 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou if ( currPath.bToolCompensation && dLastElev < EPS_SMALL) dLastElev = currStep.dDepth ; if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dLastElev, dAppr, bSplitArcs)) { - m_pMchMgr->SetLastError( 3015, "Error in PocketingNT : Retract not computable") ; + m_pMchMgr->SetLastError( 2417, "Error in PocketingNT : Retract not computable") ; return false ; } } @@ -6898,9 +6906,13 @@ PocketingNT::AssignPropsToCamDataForToolCompensation( int nId, bool bLineIn, boo return false ; pCamData->SetFeed( GetStartFeed()) ; // Feed Iniziale // Flag 141 o 142 a seconda della posizione dell'utensile rispetto al percorso - m_pGeomDB->SetInfo( nId, KEY_TRC, bToolAtLeft ? 141 : 142) ; + pCamData->SetCorrType( ( bToolAtLeft ? 141 : 142)) ; + // Versore correzione + Vector3d vtCorr ; + GetCurveLine( pGeoObj)->GetEndDir( vtCorr) ; + pCamData->SetCorrDir( -vtCorr) ; // Modifica colore - m_pGeomDB->SetMaterial( nId, GREEN) ; + m_pGeomDB->SetMaterial( nId, AQUA) ; } // se tratto finale else if ( bLineOut) { @@ -6912,19 +6924,29 @@ PocketingNT::AssignPropsToCamDataForToolCompensation( int nId, bool bLineIn, boo return false ; pCamData->SetFeed( GetEndFeed()) ; // Feed Finale // Flag 140 per annullare la compensazione attivata precedentemente - m_pGeomDB->SetInfo( nId, KEY_TRC, 140) ; + pCamData->SetCorrType( 140) ; + // versore correzione è ora nullo + pCamData->SetCorrDir( V_NULL) ; // Modifica del colore - m_pGeomDB->SetMaterial( nId, GREEN) ; + m_pGeomDB->SetMaterial( nId, AQUA) ; } // se tratto generico else { CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ; if ( pCamData == nullptr) return false ; - // Flag 41 o 42 a seconda della posizione dell'utensile riseptto al percorso - m_pGeomDB->SetInfo( nId, KEY_TRC, bToolAtLeft ? 41 : 42) ; + // Flag 41 o 42 a seconda della posizione dell'utensile rispetto al percorso + pCamData->SetCorrType( ( bToolAtLeft ? 41 : 42)) ; + // versore correzione + Vector3d vtTool = pCamData->GetToolDir() ; + Vector3d vtCorr ; + GetCurve( pGeoObj)->GetEndDir( vtCorr) ; + vtCorr = OrthoCompo( vtCorr, vtTool) ; + vtCorr.Normalize() ; + vtCorr.Rotate( vtTool, 0, ( bToolAtLeft ? 1 : -1)) ; + pCamData->SetCorrDir( vtCorr) ; // Modifica del colore - m_pGeomDB->SetMaterial( nId, GREEN) ; + m_pGeomDB->SetMaterial( nId, AQUA) ; } return true ; diff --git a/PocketingNT.h b/PocketingNT.h index 146ab7e..1519880 100644 --- a/PocketingNT.h +++ b/PocketingNT.h @@ -136,7 +136,7 @@ class PocketingNT : public Machining bool CalcLimitRegion( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrRaw, ISurfFlatRegion* pSfrLimit) ; bool CalcPaths( STEPINFOPOVECTOR& vStepInfo) ; bool CalcRetCurve( PathInfoPO& PathInfo, const StepInfoPO& StepInfo, const ICurveComposite* pCrvPath, - const Vector3d& vtTool, bool bHolePocketing, const Point3d& ptHoleDest, bool bToolCompensation, bool bInVsOut, ICurveComposite* pCrvGlide) ; + const Vector3d& vtTool, bool bHolePocketing, const Point3d& ptHoleDest, bool bToolComp, bool bInVsOut, ICurveComposite* pCrvGlide) ; bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dStep, bool bSplitArcs, Point3d& ptPockStart, Point3d& ptPockEnd) ; double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ; double GetRightStartFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ; diff --git a/Processor.cpp b/Processor.cpp index 0087b5f..edef9cd 100644 --- a/Processor.cpp +++ b/Processor.cpp @@ -508,7 +508,8 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd, case 1 : // linea if ( ! OnLinear( nEntId, nEntInd, nMove, AxesEnd, pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(), - pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), nMoveNext, AxesNext)) + pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), + pCamData->GetCorrType(), nMoveNext, AxesNext)) return false ; break ; case 2 : // arco CW @@ -518,7 +519,8 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd, if ( ! OnArc( nEntId, nEntInd, nMove, AxesEnd, pCamData->GetAxesCen(), ptMid, pCamData->GetAxesRad(), pCamData->GetAxesAngCen(), pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(), - pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), nMoveNext, AxesNext)) + pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), + pCamData->GetCorrType(), nMoveNext, AxesNext)) return false ; break ; } @@ -1105,7 +1107,7 @@ Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd bool Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux, - double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) + double dFeed, int nFlag, int nFlag2, int nIndex, int nCorr, int nMoveNext, const DBLVECTOR& AxesNext) { // cancello variabili estranee ResetArcData() ; @@ -1137,6 +1139,8 @@ Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEn bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ; // assegno il valore dell'indice bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ; + // assegno il tipo di correzione + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_CORR, nCorr) ; // anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso if ( nMoveNext != -1) { bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ; @@ -1162,7 +1166,7 @@ bool Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux, - double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) + double dFeed, int nFlag, int nFlag2, int nIndex, int nCorr, int nMoveNext, const DBLVECTOR& AxesNext) { // assegno Id e indice entità di movimento bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ; @@ -1204,6 +1208,8 @@ Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ; // assegno il valore dell'indice bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ; + // assegno il tipo di correzione + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_CORR, nCorr) ; // anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso if ( nMoveNext != -1) { bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ; diff --git a/Processor.h b/Processor.h index 6fbec04..e3a4ca6 100644 --- a/Processor.h +++ b/Processor.h @@ -65,11 +65,11 @@ class Processor int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ; bool OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux, - double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ; + double dFeed, int nFlag, int nFlag2, int nIndex, int nCorr, int nMoveNext, const DBLVECTOR& AxesNext) ; bool OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux, - double dFeed, int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ; + double dFeed, int nFlag, int nFlag2, int nIndex, int nCorr, int nMoveNext, const DBLVECTOR& AxesNext) ; bool ResetArcData( void) ; protected :