diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index e04e26e..22e5187 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ diff --git a/Pocketing.cpp b/Pocketing.cpp index d38f1f7..1bb5594 100644 --- a/Pocketing.cpp +++ b/Pocketing.cpp @@ -1835,8 +1835,9 @@ Pocketing::GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo) if ( IsNull( pCrv)) return false ; // calcolo la regione - PtrOwner pSfr ; - pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), 0.5 * m_TParams.m_dDiam, false, false)) ; + SurfFlatRegionByContours SfrCntrRr ; + SfrCntrRr.AddCurve( Release( pCrv)) ; + PtrOwner pSfr( SfrCntrRr.GetSurf()) ; if ( IsNull( pSfr)) return false ; // ne recupero il contorno @@ -1850,7 +1851,7 @@ Pocketing::GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo) return false ; // assegno nome e colore m_pGeomDB->SetName( nC2Id, MCH_PV_CUT) ; - m_pGeomDB->SetMaterial( nC2Id, LIME) ; + m_pGeomDB->SetMaterial( nC2Id, RED) ; // eventuali altri contorni ( interni di contornatura chiusa) const int MAX_INT_LOOP = 1000 ; for ( int i = 1 ; i <= MAX_INT_LOOP ; ++i) { @@ -1864,14 +1865,14 @@ Pocketing::GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo) return false ; // assegno nome e colore m_pGeomDB->SetName( nC3Id, MCH_PV_CUT) ; - m_pGeomDB->SetMaterial( nC3Id, LIME) ; + m_pGeomDB->SetMaterial( nC3Id, RED) ; } // inserisco la regione nel DB int nRId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfr)) ; if ( nRId == GDB_ID_NULL) return false ; m_pGeomDB->SetName( nRId, MCH_PV_RCUT) ; - m_pGeomDB->SetMaterial( nRId, INVISIBLE) ; + m_pGeomDB->SetMaterial( nRId, Color( 255, 0, 0, 60)) ; // la copio anche come regione ridotta int nRrId = m_pGeomDB->Copy( nRId, GDB_ID_NULL, nPathId) ; if ( nRrId == GDB_ID_NULL) @@ -1909,8 +1910,10 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con // se utensile che non lavora di testa poichè ingresso non fuori dal pezzo, errore if ( m_TParams.m_nType == TT_MILL_NOTIP) { - m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ; - return false ; + if ( ! LeadInIsOk()) { + m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ; + return false ; + } } // determino numero e affondamento degli step @@ -2454,8 +2457,10 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con // se utensile che non lavora di testa poichè ingresso non fuori dal pezzo, errore if ( m_TParams.m_nType == TT_MILL_NOTIP) { - m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ; - return false ; + if ( ! LeadInIsOk()) { + m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ; + return false ; + } } // determino numero e affondamento degli step @@ -2780,8 +2785,10 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c // se utensile che non lavora di testa e ingresso non fuori dal pezzo, errore if ( m_TParams.m_nType == TT_MILL_NOTIP && ! bOutStart) { - m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ; - return false ; + if ( ! LeadInIsOk()) { + m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ; + return false ; + } } // determino numero e affondamento degli step @@ -2941,8 +2948,10 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool, // se utensile che non lavora di testa poichè ingresso non fuori dal pezzo, errore if ( m_TParams.m_nType == TT_MILL_NOTIP) { - m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ; - return false ; + if ( ! LeadInIsOk()) { + m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ; + return false ; + } } // ciclo sulle regioni diff --git a/Pocketing.h b/Pocketing.h index 89ec6e3..72b8bf3 100644 --- a/Pocketing.h +++ b/Pocketing.h @@ -134,6 +134,10 @@ class Pocketing : public Machining if ( m_Params.m_nLeadInType != POCKET_LI_GLIDE && m_Params.m_dLiElev < 10 * EPS_SMALL) return POCKET_LI_NONE ; return m_Params.m_nLeadInType ; } + int LeadInIsOk( void) const + { if ( m_TParams.m_nType != TT_MILL_NOTIP) + return true ; + return ( GetLeadInType() == POCKET_LI_HELIX && m_Params.m_dLiTang >= 0.49 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; } int GetLeadOutType( void) const { if ( m_Params.m_dLoTang < std::min( 0.1 * m_TParams.m_dDiam, 1.0)) return POCKET_LO_NONE ;