diff --git a/EgtMachKernel.vcxproj b/EgtMachKernel.vcxproj
index 6ccdae8..ac9b300 100644
--- a/EgtMachKernel.vcxproj
+++ b/EgtMachKernel.vcxproj
@@ -21,7 +21,7 @@
{0BD58222-92F3-48B2-B656-4497D1956874}
EgtMachKernel
- 10.0.17763.0
+ 10.0.20348.0
diff --git a/Pocketing.cpp b/Pocketing.cpp
index f91130c..617d27c 100644
--- a/Pocketing.cpp
+++ b/Pocketing.cpp
@@ -5501,25 +5501,49 @@ Pocketing::AdjustContourWithOpenEdges( ICurveComposite* pCompo)
AdjustContourStart( pCompo) ;
// raggio di riferimento per offset
double dRad = 0.5 * m_TParams.m_dDiam + GetOffsR() ;
- // estraggo tutte le curve in un vettore
+ // estraggo parti con proprietà uniforme in un vettore
ICURVEPOVECTOR vpCrvs ;
- vpCrvs.reserve( pCompo->GetCurveCount()) ;
- while ( pCompo->GetCurveCount() > 0)
- vpCrvs.emplace_back( pCompo->RemoveFirstOrLastCurve( false)) ;
- // elimino le curve troppo corte (10 epsilon)
- for ( int i = 0 ; i < int( vpCrvs.size()) ;) {
- double dLen = 0 ; vpCrvs[i]->GetLength( dLen) ;
- if ( dLen < 10 * EPS_SMALL)
- vpCrvs.erase( vpCrvs.begin() + i) ;
- else
- ++ i ;
+ int nCurrTempProp ;
+ int nParStart = 0 ;
+ for ( int i = 0 ; i < pCompo->GetCurveCount() ; ++ i) {
+ int nTempProp ;
+ pCompo->GetCurveTempProp( i, nTempProp) ;
+ if ( i == 0) {
+ nCurrTempProp = nTempProp ;
+ nParStart = i ;
+ }
+ else if ( nCurrTempProp != nTempProp) {
+ PtrOwner pCrv( pCompo->CopyParamRange( nParStart, i)) ;
+ if ( IsNull( pCrv))
+ return false ;
+ pCrv->SetTempProp( nCurrTempProp) ;
+ pCrv->SetExtrusion( vtExtr) ;
+ vpCrvs.emplace_back( Release( pCrv)) ;
+ nCurrTempProp = nTempProp ;
+ nParStart = i ;
+ }
}
+ PtrOwner pCrv( pCompo->CopyParamRange( nParStart, pCompo->GetCurveCount())) ;
+ if ( IsNull( pCrv))
+ return false ;
+ pCrv->SetTempProp( nCurrTempProp) ;
+ pCrv->SetExtrusion( vtExtr) ;
+ vpCrvs.emplace_back( Release( pCrv)) ;
// offsetto del raggio le curve aperte
for ( int i = 0 ; i < int( vpCrvs.size()) ; ++ i) {
- if ( vpCrvs[i]->GetTempProp() == 1)
- vpCrvs[i]->SimpleOffset( dRad) ;
+ if ( vpCrvs[i]->GetTempProp() == 1) {
+ OffsetCurve OffsCrv ;
+ if ( ! OffsCrv.Make( vpCrvs[i], dRad, ICurve::OFF_FILLET) || OffsCrv.GetCurveCount() == 0) {
+ m_pMchMgr->SetLastError( 2412, "Error in Pocketing : Offset not computable") ;
+ return false ;
+ }
+ vpCrvs[i].Set( OffsCrv.GetLongerCurve()) ;
+ vpCrvs[i]->SetTempProp( 1) ;
+ }
}
// reinserisco le curve, chiudendo eventuali gap
+ pCompo->Clear() ;
+ pCompo->SetExtrusion( vtExtr) ;
bool bOpenCurr = false ;
double dDiam = 1.05 * m_TParams.m_dDiam + 2 * GetOffsR() ;
for ( int i = 0 ; i < int( vpCrvs.size()) ; ++ i) {
@@ -5552,8 +5576,14 @@ Pocketing::AdjustContourWithOpenEdges( ICurveComposite* pCompo)
pJCrv->ToGlob( frPocket) ;
vpCrvs[i]->ToGlob( frPocket) ;
// taglio opportunamente le curve
- IntCrvCrvInfo aInfo ;
- if ( intCC.GetIntCrvCrvInfo( intCC.GetIntersCount() - 1, aInfo)) {
+ if ( intCC.GetIntersCount() > 0) {
+ // cerco la prima intersezione che entra nella curva aperta
+ IntCrvCrvInfo aInfo ;
+ for ( int j = 0 ; j < intCC.GetIntersCount() ; ++ j) {
+ if ( intCC.GetIntCrvCrvInfo( j, aInfo) && aInfo.IciA[0].nPrevTy == ICCT_OUT) {
+ break ;
+ }
+ }
pJCrv->TrimEndAtParam( aInfo.IciA[0].dU) ;
vpCrvs[i]->TrimStartAtParam( aInfo.IciB[0].dU) ;
pCompo->AddCurve( ::Release( pJCrv), true, 10 * EPS_SMALL) ;