diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index b5a863e..b063ad4 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ diff --git a/PocketingNT.cpp b/PocketingNT.cpp index c7bb6b5..b30df29 100644 --- a/PocketingNT.cpp +++ b/PocketingNT.cpp @@ -122,8 +122,10 @@ static double TOOL_RAD_PTSTART = 20. ; #define DEBUG_SAFETY_LINK 0 // Debug raccordi tra percorsi di lavorazioni differenti #define DEBUG_FEED 0 // Debug per Feed #define DEBUG_START_POINT 0 // Debug per scelta del punto iniziale +#define DEBUG_PATH_CL 0 // Debug per valori memorizzati nel percorso del CL #define DEBUG 0 // Debug -#if DEBUG_STM_TOPOLOGY || DEBUG_OPEN_EDGE_EXTENSION || DEBUG_OPEN_EDGE_IN_RAW || DEBUG_SFR_STEPS || DEBUG_SFR_RAW || DEBUG_GLIDE || DEBUG_SAFETY_LINK || DEBUG_FEED || DEBUG_START_POINT || DEBUG +#if DEBUG_STM_TOPOLOGY || DEBUG_OPEN_EDGE_EXTENSION || DEBUG_OPEN_EDGE_IN_RAW || DEBUG_SFR_STEPS || DEBUG_SFR_RAW || DEBUG_GLIDE || \ + DEBUG_SAFETY_LINK || DEBUG_FEED || DEBUG_START_POINT || DEBUG_PATH_CL || DEBUG #include "EgtDev/Include/EGkGeoPoint3d.h" #include "EgtDev/Include/EGkGeoVector3d.h" #include "EgtDev/Include/EGkFrame3d.h" @@ -3735,11 +3737,6 @@ PocketingNT::ProcessPath( int nPathId, int nPvId, int nClId) // verifico se archi vanno approssimati con segmenti di retta bool bSplitArcs = GetSplitArcs( vtExtr) ; - // assegno il vettore estrazione al gruppo del percorso - m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ; - // assegno l'elevazione massima - m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ; - // determino numero e affondamento degli step int nStep = max( 1, static_cast( ceil( dElev / dOkStep))) ; double dStep = dElev / nStep ; @@ -3819,8 +3816,33 @@ PocketingNT::ProcessPath( int nPathId, int nPvId, int nClId) SetPathId( nPxId) ; SetToolDir( vtTool) ; - if ( ! AddPocket( vStepInfo, vtTool, dElev, dStep, bSplitArcs)) + // calcolo le lavorazioni + Point3d ptPockStart ; pSfr->GetCentroid( ptPockStart) ; + Point3d ptPockEnd = ptPockStart ; + if ( ! AddPocket( vStepInfo, vtTool, dStep, bSplitArcs, ptPockStart, ptPockEnd)) return false ; + + // assegno il vettore estrazione al gruppo del percorso + m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ; + // assegno l'elevazione massima + m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ; + // assegno il punto di inizio e fine al gruppo del percorso + m_pGeomDB->SetInfo( nPxId, KEY_START, ptPockStart) ; + m_pGeomDB->SetInfo( nPxId, KEY_END, ptPockEnd) ; + #if DEBUG_PATH_CL + PtrOwner ptS( CreateGeoPoint3d()) ; ptS->Set( ptPockStart) ; + int nPtSId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, Release( ptS)) ; + m_pGeomDB->SetMaterial( nPtSId, AQUA) ; + PtrOwner ptE( CreateGeoPoint3d()) ; ptE->Set( ptPockEnd) ; + int nPtEId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, Release( ptE)) ; + m_pGeomDB->SetMaterial( nPtEId, ORANGE) ; + PtrOwner vtT( CreateGeoVector3d()) ; vtT->Set( vtTool, ptPockEnd) ; + int nVtId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, Release( vtT)) ; + m_pGeomDB->SetMaterial( nVtId, Color( abs( vtTool.x), abs( vtTool.y), abs( vtTool.z))) ; + PtrOwner pLine( CreateCurveLine()) ; pLine->Set( ptPockEnd, ptPockEnd + vtTool * dElev) ; + int nLineID = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, Release( pLine)) ; + m_pGeomDB->SetMaterial( nLineID, FUCHSIA) ; + #endif } // incremento numero di svuotature @@ -4489,7 +4511,8 @@ PocketingNT::ManageSmoothLink( const PathInfoPO& currPath, const PathInfoPO& nex //---------------------------------------------------------------------------- bool -PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dElev, double dStep, bool bSplitArcs) +PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dStep, bool bSplitArcs, + Point3d& ptPockStart, Point3d& ptPockEnd) { // se non ho superfici da svuotare, non faccio nulla if ( vStepInfo.empty()) @@ -4548,6 +4571,10 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou // flag approccio libero in aria if ( currPath.bOutStart) dCoeffFeed = ( dTempParam > EPS_SMALL ? dTempParam : 1) ; + // se prima entità in assoluto, memorizzo il punto iniziale + bool bAbsFirst = ( i == 0 && j == 0) ; + if ( bAbsFirst) + ptPockStart = ptStart ; // calcolo ptP1 per LeadIn iniziale ( punto per approccio a seconda del LeadIn) Point3d ptP1 ; if ( ! CalcLeadInStart( ptStart, vtTool, currPath.pCrvGlideIn, ptP1)) { @@ -4556,9 +4583,8 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou } // determino l'elevazione, per il primo percorso verifico anche la posizione della testa e nel caso // aggiungo un eventuale direzione di 'Escape' - bool bAbsFirst = ( i == 0 && j == 0) ; double dEscapeElev = 0. ; - Vector3d vtEscape ; + Vector3d vtEscape ; if ( bAbsFirst) CalcFirstElevation( ptStart, ptP1, vtTool, currStep, dSafeZ, dStep, dCurrElev, dEscapeElev, vtEscape) ; bool bEscapeElev = ( dEscapeElev > 10. * EPS_SMALL && vtEscape.Len() > 10. * EPS_SMALL) ; @@ -4647,6 +4673,8 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou Vector3d vtEnd ; pCurve->GetEndDir( vtEnd) ; // se sono l'ultima entità globale del percorso if ( i == ssize( vStepInfo) - 1 && j == ssize( currStep.vPaths) - 1) { + // memorizzo il punto finale della lavorazione + ptPockEnd = ptEnd ; // aggiungo LeadOut Point3d ptP1 ; SetFeed( GetEndFeed()) ; diff --git a/PocketingNT.h b/PocketingNT.h index 012cd2e..999d864 100644 --- a/PocketingNT.h +++ b/PocketingNT.h @@ -133,7 +133,7 @@ class PocketingNT : public Machining bool CalcPaths( STEPINFOPOVECTOR& vStepInfo) ; bool CalcRetCurve( PathInfoPO& PathInfo, const StepInfoPO& StepInfo, const ICurveComposite* pCrvPath, const Vector3d& vtTool, bool bHolePocketing, bool bInVsOut, ICurveComposite* pCrvGlide) ; - bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dElev, double dStep, bool bSplitArcs) ; + bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dStep, bool bSplitArcs, Point3d& ptPockStart, Point3d& ptPockEnd) ; double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) ; bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ; bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ;