diff --git a/ChainCurves.cpp b/ChainCurves.cpp index 55fad0f..71711af 100644 --- a/ChainCurves.cpp +++ b/ChainCurves.cpp @@ -22,7 +22,7 @@ using namespace std ; //---------------------------------------------------------------------------- bool -ChainCurves::Init( bool bAllowInvert, double dToler, int nCrvNbrHint) +ChainCurves::Init( bool bAllowInvert, double dToler, int nCrvNbrHint, double dCellDim) { m_bAllowInvert = bAllowInvert ; m_dToler = max( dToler, EPS_SMALL) ; @@ -30,8 +30,7 @@ ChainCurves::Init( bool bAllowInvert, double dToler, int nCrvNbrHint) m_sCrvId.rehash( nCrvNbrHint) ; m_vCrvData.clear() ; m_vCrvData.reserve( nCrvNbrHint) ; - const double DIM_CELL = 10.0 ; - m_PointGrid.Init( 2 * nCrvNbrHint, DIM_CELL) ; + m_PointGrid.Init( 2 * nCrvNbrHint, dCellDim) ; m_bFromNear = false ; m_vForkData.clear() ; m_bIsFork = false ; diff --git a/StmStandard.cpp b/StmStandard.cpp index 657da5e..9906aa9 100644 --- a/StmStandard.cpp +++ b/StmStandard.cpp @@ -22,55 +22,25 @@ using namespace std ; //------------------------------------------------------------------------------- -ISurfTriMesh* -GetSurfTriMeshBox( double dDimX, double dDimY, double dHeight, bool bRegular) +static ISurfTriMesh* +GetStandardSurfTriMeshBox( double dDimX, double dDimY, double dHeight) { - // le dimensioni devono essere significative - if ( dDimX < EPS_SMALL || dDimY < EPS_SMALL || abs( dHeight) < EPS_SMALL) - return nullptr ; - // se richiesta trimesh regolare, i triangoli devono essere quasi equilateri pertanto calcolo come dividere le varie parti - double dMaxStep = INFINITO ; - if ( bRegular) { - double dMin1 = min( dDimX, dDimY) ; - double dMin2 = min( max( dDimX, dDimY), abs( dHeight)) ; - dMaxStep = min( max( dMin1, dMin2), 2 * min( dMin1, dMin2)) ; - dMaxStep = max( dMaxStep, 1.) ; - } - int nStepX = max( int( dDimX / dMaxStep + 0.9), 1) ; - double dStepX = dDimX / nStepX ; - int nStepY = max( int( dDimY / dMaxStep + 0.9), 1) ; - double dStepY = dDimY / nStepY ; - int nStepZ = max( int( abs( dHeight) / dMaxStep + 0.9), 1) ; - double dStepZ = dHeight / nStepZ ; // creo la polilinea del contorno della base PolyLine PL ; int nU = 0 ; - PL.AddUPoint( nU, ORIG) ; - for ( int i = 1 ; i <= nStepX ; ++i) - PL.AddUPoint( ++ nU, Point3d( i * dStepX, 0, 0)) ; - for ( int j = 1 ; j <= nStepY ; ++j) - PL.AddUPoint( ++ nU, Point3d( dDimX, j * dStepY, 0)) ; - for ( int i = 1 ; i <= nStepX ; ++i) - PL.AddUPoint( ++ nU, Point3d( dDimX - i * dStepX, dDimY, 0)) ; - for ( int j = 1 ; j <= nStepY ; ++j) - PL.AddUPoint( ++ nU, Point3d( 0, dDimY - j * dStepY, 0)) ; + PL.AddUPoint( nU, Point3d( 0, 0, 0)) ; + PL.AddUPoint( ++ nU, Point3d( dDimX, 0, 0)) ; + PL.AddUPoint( ++ nU, Point3d( dDimX, dDimY, 0)) ; + PL.AddUPoint( ++ nU, Point3d( 0, dDimY, 0)) ; + PL.AddUPoint( ++ nU, Point3d( 0, 0, 0)) ; if ( dHeight < 0) PL.Invert() ; // vettore altezza (estrusione) - Vector3d vtExtr( 0, 0, dStepZ) ; - // creo e setto la prima superficie trimesh laterale + Vector3d vtExtr( 0, 0, dHeight) ; + // creo e setto la superficie trimesh laterale PtrOwner pSTM( CreateSurfTriMesh()) ; if ( IsNull( pSTM) || ! pSTM->CreateByExtrusion( PL, vtExtr)) return nullptr ; - // aggiungo eventuali altre superfici trimesh laterali - for ( int k = 1 ; k < nStepZ ; ++ k) { - PtrOwner pSTMx( CreateSurfTriMesh()) ; - if ( IsNull( pSTMx) || ! pSTMx->CreateByExtrusion( PL, vtExtr)) - return nullptr ; - pSTMx->Translate( Vector3d( 0, 0, k * dStepZ)) ; - if ( ! pSTM->DoSewing( *pSTMx)) - return nullptr ; - } // creo la prima superficie di estremità PtrOwner pSTM1( CreateSurfTriMesh()) ; if ( IsNull( pSTM1) || ! pSTM1->CreateByFlatContour( PL)) @@ -89,6 +59,98 @@ GetSurfTriMeshBox( double dDimX, double dDimY, double dHeight, bool bRegular) // restituisco la superficie return Release( pSTM) ; } +//------------------------------------------------------------------------------- +static ISurfTriMesh* +GetRegularSurfTriMeshBox( double dDimX, double dDimY, double dHeight) +{ + // i triangoli devono essere quasi equilateri pertanto calcolo come dividere le varie parti + double dMaxStep = INFINITO ; + double dMin1 = min( dDimX, dDimY) ; + double dMin2 = min( max( dDimX, dDimY), abs( dHeight)) ; + dMaxStep = min( max( dMin1, dMin2), 2 * min( dMin1, dMin2)) ; + dMaxStep = max( dMaxStep, 1.) ; + int nStepX = max( int( dDimX / dMaxStep + 0.9), 1) ; + double dStepX = dDimX / nStepX ; + int nStepY = max( int( dDimY / dMaxStep + 0.9), 1) ; + double dStepY = dDimY / nStepY ; + int nStepZ = max( int( abs( dHeight) / dMaxStep + 0.9), 1) ; + double dStepZ = dHeight / nStepZ ; + // creo la polilinea del contorno della base + PolyLine PL1 ; + int nU1 = 0 ; + PL1.AddUPoint( nU1, ORIG) ; + for ( int i = 1 ; i <= nStepX ; ++i) + PL1.AddUPoint( ++ nU1, Point3d( i * dStepX, 0, 0)) ; + for ( int j = 1 ; j <= nStepY ; ++j) + PL1.AddUPoint( ++ nU1, Point3d( dDimX, j * dStepY, 0)) ; + for ( int i = 1 ; i <= nStepX ; ++i) + PL1.AddUPoint( ++ nU1, Point3d( dDimX - i * dStepX, dDimY, 0)) ; + for ( int j = 1 ; j <= nStepY ; ++j) + PL1.AddUPoint( ++ nU1, Point3d( 0, dDimY - j * dStepY, 0)) ; + if ( dHeight < 0) + PL1.Invert() ; + // vettore altezza (estrusione) + Vector3d vtExtr1( 0, 0, dStepZ) ; + // creo e unisco le superfici trimesh laterali + PtrOwner pSTM1 ; + for ( int k = 0 ; k < nStepZ ; ++ k) { + PtrOwner pSTMz( CreateSurfTriMesh()) ; + if ( IsNull( pSTMz) || ! pSTMz->CreateByExtrusion( PL1, vtExtr1)) + return nullptr ; + pSTMz->Translate( Vector3d( 0, 0, k * dStepZ)) ; + if ( IsNull( pSTM1)) + pSTM1.Set( Release( pSTMz)) ; + else if ( ! pSTM1->DoSewing( *pSTMz)) + return nullptr ; + } + // creo la polilinea del lato sinistro della superficie inferiore + PolyLine PL2 ; + int nU2 = 0 ; + PL2.AddUPoint( nU2, ORIG) ; + for ( int j = 1 ; j <= nStepY ; ++j) + PL2.AddUPoint( ++ nU2, Point3d( 0, j * dStepY, 0)) ; + // vettore estrusione + Vector3d vtExtr2( dStepX, 0, 0) ; + // creo e unisco le superfici trimesh inferiori + PtrOwner pSTM2 ; + for ( int i = 0 ; i < nStepX ; ++ i) { + PtrOwner pSTMx( CreateSurfTriMesh()) ; + if ( IsNull( pSTMx) || ! pSTMx->CreateByExtrusion( PL2, vtExtr2)) + return nullptr ; + pSTMx->Translate( Vector3d( i * dStepX, 0, 0)) ; + if ( IsNull( pSTM2)) + pSTM2.Set( Release( pSTMx)) ; + else if ( ! pSTM2->DoSewing( *pSTMx)) + return nullptr ; + } + // la copio + PtrOwner pSTM3( pSTM2->Clone()) ; + if ( IsNull( pSTM3)) + return nullptr ; + // inverto e traslo la superficie superiore + pSTM3->Invert() ; + pSTM3->Translate( Vector3d( 0, 0, dHeight)) ; + // le unisco alla superficie del fianco + if ( ! pSTM1->DoSewing( *pSTM2) || ! pSTM1->DoSewing( *pSTM3)) + return nullptr ; + // restituisco la superficie + return Release( pSTM1) ; +} + +//------------------------------------------------------------------------------- +ISurfTriMesh* +GetSurfTriMeshBox( double dDimX, double dDimY, double dHeight, bool bRegular) +{ + // le dimensioni devono essere significative + if ( dDimX < EPS_SMALL || dDimY < EPS_SMALL || abs( dHeight) < EPS_SMALL) + return nullptr ; + // se trimesh standard + if ( ! bRegular) + return GetStandardSurfTriMeshBox( dDimX, dDimY, dHeight) ; + // altrimenti regolarizzata + else + return GetRegularSurfTriMeshBox( dDimX, dDimY, dHeight) ; +} //------------------------------------------------------------------------------- ISurfTriMesh* diff --git a/SurfTriMeshBooleans.cpp b/SurfTriMeshBooleans.cpp index 0916fae..810a63a 100644 --- a/SurfTriMeshBooleans.cpp +++ b/SurfTriMeshBooleans.cpp @@ -33,6 +33,9 @@ using namespace std ; +//---------------------------------------------------------------------------- +const double BOOLEAN_SCALE = 1024 ; + //---------------------------------------------------------------------------- static int IntersRectangleTriangle( const Point3d& ptP, const Vector3d& vtL1, const Vector3d& vtL2, @@ -951,7 +954,7 @@ SurfTriMesh::RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECT // Creo i loop ChainCurves LoopCreator ; - LoopCreator.Init( false, 10 * EPS_SMALL, int( it->second.size())) ; + LoopCreator.Init( false, 10 * EPS_SMALL, int( it->second.size()), 10 * BOOLEAN_SCALE) ; // Carico le curve per concatenarle for ( int nCv = 0 ; nCv < int( it->second.size()); ++ nCv) { Point3d ptSt = it->second[nCv].ptSt ; @@ -962,7 +965,7 @@ SurfTriMesh::RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECT } // Recupero i concatenamenti INTVECTOR vIds ; - Point3d ptNearStart ; + Point3d ptNearStart = ( it->second.size() > 0 ? it->second[0].ptSt : ORIG) ; CHAINVECTOR vChain ; while ( LoopCreator.GetChainFromNear( ptNearStart, false, vIds)) { Chain chTemp ; @@ -2382,8 +2385,8 @@ SurfTriMesh::Add( const ISurfTriMesh& Other) SurfB.CopyFrom( &Other) ; Frame3d frScalingRef ; frScalingRef.Set( m_vVert[0].ptP, X_AX, Y_AX, Z_AX) ; - Scale( frScalingRef, 1024., 1024., 1024.) ; - SurfB.Scale( frScalingRef, 1024., 1024., 1024.) ; + Scale( frScalingRef, BOOLEAN_SCALE, BOOLEAN_SCALE, BOOLEAN_SCALE) ; + SurfB.Scale( frScalingRef, BOOLEAN_SCALE, BOOLEAN_SCALE, BOOLEAN_SCALE) ; IntersectTriMeshTriangle( SurfB) ; IdentifyParts() ; SurfB.IdentifyParts() ; @@ -2412,7 +2415,7 @@ SurfTriMesh::Add( const ISurfTriMesh& Other) return false ; RemoveTJunctions() ; bool bResult = ( AdjustVertices() && DoCompacting()) ; - Scale( frScalingRef, 1. / 1024., 1. / 1024., 1. / 1024.) ; + Scale( frScalingRef, 1. / BOOLEAN_SCALE, 1. / BOOLEAN_SCALE, 1. / BOOLEAN_SCALE) ; return bResult ; } @@ -2425,8 +2428,8 @@ SurfTriMesh::Intersect( const ISurfTriMesh& Other) SurfB.CopyFrom( &Other) ; Frame3d frScalingRef ; frScalingRef.Set( m_vVert[0].ptP, X_AX, Y_AX, Z_AX) ; - Scale( frScalingRef, 1024., 1024., 1024.) ; - SurfB.Scale( frScalingRef, 1024., 1024., 1024.) ; + Scale( frScalingRef, BOOLEAN_SCALE, BOOLEAN_SCALE, BOOLEAN_SCALE) ; + SurfB.Scale( frScalingRef, BOOLEAN_SCALE, BOOLEAN_SCALE, BOOLEAN_SCALE) ; IntersectTriMeshTriangle( SurfB) ; IdentifyParts() ; SurfB.IdentifyParts() ; @@ -2455,7 +2458,7 @@ SurfTriMesh::Intersect( const ISurfTriMesh& Other) return false ; RemoveTJunctions() ; bool bResult = ( AdjustVertices() && DoCompacting()) ; - Scale( frScalingRef, 1. / 1024., 1. / 1024., 1. / 1024.) ; + Scale( frScalingRef, 1. / BOOLEAN_SCALE, 1. / BOOLEAN_SCALE, 1. / BOOLEAN_SCALE) ; return bResult ; } @@ -2468,8 +2471,8 @@ SurfTriMesh::Subtract( const ISurfTriMesh& Other) SurfB.CopyFrom( &Other) ; Frame3d frScalingRef; frScalingRef.Set( m_vVert[0].ptP, X_AX, Y_AX, Z_AX) ; - Scale( frScalingRef, 1024., 1024., 1024.) ; - SurfB.Scale( frScalingRef, 1024., 1024., 1024.) ; + Scale( frScalingRef, BOOLEAN_SCALE, BOOLEAN_SCALE, BOOLEAN_SCALE) ; + SurfB.Scale( frScalingRef, BOOLEAN_SCALE, BOOLEAN_SCALE, BOOLEAN_SCALE) ; IntersectTriMeshTriangle( SurfB) ; IdentifyParts() ; SurfB.IdentifyParts() ; @@ -2499,7 +2502,7 @@ SurfTriMesh::Subtract( const ISurfTriMesh& Other) return false ; RemoveTJunctions() ; bool bResult = ( AdjustVertices() && DoCompacting()) ; - Scale( frScalingRef, 1. / 1024., 1. / 1024., 1. / 1024.) ; + Scale( frScalingRef, 1. / BOOLEAN_SCALE, 1. / BOOLEAN_SCALE, 1. / BOOLEAN_SCALE) ; return bResult ; } @@ -2515,11 +2518,11 @@ SurfTriMesh::GetSurfClassification( const ISurfTriMesh& ClassifierSurf, SurfC.CopyFrom( &ClassifierSurf) ; Frame3d frScalingRef ; frScalingRef.Set( m_vVert[0].ptP, X_AX, Y_AX, Z_AX) ; - Scale( frScalingRef, 1024., 1024., 1024.) ; - SurfC.Scale( frScalingRef, 1024., 1024., 1024.) ; + Scale( frScalingRef, BOOLEAN_SCALE, BOOLEAN_SCALE, BOOLEAN_SCALE) ; + SurfC.Scale( frScalingRef, BOOLEAN_SCALE, BOOLEAN_SCALE, BOOLEAN_SCALE) ; IntersectTriMeshTriangle( SurfC) ; IdentifyParts() ; - Scale( frScalingRef, 1. / 1024., 1. / 1024., 1. / 1024.) ; + Scale( frScalingRef, 1. / BOOLEAN_SCALE, 1. / BOOLEAN_SCALE, 1. / BOOLEAN_SCALE) ; int nTriaNum = GetTriangleSize() ; for ( int nT = 0 ; nT < nTriaNum ; ++ nT) { diff --git a/VolZmap.cpp b/VolZmap.cpp index aff5663..5bf2b56 100644 --- a/VolZmap.cpp +++ b/VolZmap.cpp @@ -787,7 +787,7 @@ VolZmap::CheckMapConnection( void) int nTerminated = 0 ; while ( nTerminated < nActiveThread) { for ( int i = 0 ; i < nThreadMax ; ++ i) { - if ( vRes[i].valid() && vRes[i].wait_for( chrono::microseconds{ 10}) == future_status::ready) { + if ( vRes[i].valid() && vRes[i].wait_for( chrono::microseconds{ 1}) == future_status::ready) { vRes[i].get() ; ++ nTerminated ; } diff --git a/VolZmapGraphics.cpp b/VolZmapGraphics.cpp index 6236530..a379ed9 100644 --- a/VolZmapGraphics.cpp +++ b/VolZmapGraphics.cpp @@ -947,7 +947,7 @@ VolZmap::UpdateTripleMapGraphics( void) const int nTerminated = 0 ; while ( nTerminated < nBlockUpdated) { for ( int i = 0 ; i < m_nNumBlock ; ++ i) { - if ( m_BlockToUpdate[i] && vRes[i].valid() && vRes[i].wait_for( chrono::microseconds{ 10}) == future_status::ready) { + if ( m_BlockToUpdate[i] && vRes[i].valid() && vRes[i].wait_for( chrono::microseconds{ 1}) == future_status::ready) { bOk = vRes[i].get() && bOk ; ++ nTerminated ; } diff --git a/VolZmapVolume.cpp b/VolZmapVolume.cpp index aa31b3d..ca003e5 100644 --- a/VolZmapVolume.cpp +++ b/VolZmapVolume.cpp @@ -20,6 +20,8 @@ #include "GeoConst.h" #include "/EgtDev/Include/EgtNumUtils.h" #include "/EgtDev/Include/EGkStringUtils3d.h" +#include "/EgtDev/Include/EgtPerfCounter.h" +#include using namespace std ; @@ -527,11 +529,27 @@ VolZmap::MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d& vtALe.ToLoc( m_MapFrame) ; vtALe.Normalize() ; + //static PerformanceCounter Counter ; + //{ + //string sOut = "Draw=" + ToString( Counter.Stop(), 3) ; + //LOG_INFO( GetEGkLogger(), sOut.c_str()) + //Counter.Start() ; + //} + // Se pura traslazione + bool bOk ; if ( AreSameVectorApprox( vtDLs, vtDLe)) - return MillingTranslationStep( ptPLs, ptPLe, vtDLs, vtALs) ; + bOk = MillingTranslationStep( ptPLs, ptPLe, vtDLs, vtALs) ; else - return MillingGeneralMotionStep( ptPLs, vtDLs, vtALs, ptPLe, vtDLe, vtALe) ; + bOk = MillingGeneralMotionStep( ptPLs, vtDLs, vtALs, ptPLe, vtDLe, vtALe) ; + + //{ + //string sOut = "Calc=" + ToString( Counter.Stop(), 3) ; + //LOG_INFO( GetEGkLogger(), sOut.c_str()) + //Counter.Start() ; + //} + + return bOk ; } //---------------------------------------------------------------------------- @@ -569,14 +587,26 @@ VolZmap::MillingGeneralMotionStep( const Point3d& ptPs, const Vector3d& vtDs, co bool VolZmap::MillingTranslationStep( const Point3d& ptPs, const Point3d& ptPe, const Vector3d& vtD, const Vector3d& vtA) { - Point3d ptLs[3] ; - Point3d ptLe[3] ; - Vector3d vtLs[3] ; - Vector3d vtALs[3] ; + Point3d ptLs[N_MAPS] ; + Point3d ptLe[N_MAPS] ; + Vector3d vtLs[N_MAPS] ; + Vector3d vtALs[N_MAPS] ; InitializePointsAndVectors( ptPs, ptPe, vtD, vtA, ptLs, ptLe, vtLs, vtALs) ; // Ciclo sulle mappe + vector< future> vRes ; + vRes.resize( m_nMapNum) ; for ( int i = 0 ; i < m_nMapNum ; ++ i) { - SelectMotion( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ; + vRes[i] = async( launch::async, &VolZmap::SelectMotion, this, i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ; + } + bool bOk = true ; + int nTerminated = 0 ; + while ( nTerminated < m_nMapNum) { + for ( int i = 0 ; i < m_nMapNum ; ++ i) { + if ( vRes[i].valid() && vRes[i].wait_for(chrono::microseconds{ 1}) == future_status::ready) { + bOk = vRes[i].get() && bOk ; + ++ nTerminated ; + } + } } return true ; } @@ -1684,7 +1714,8 @@ VolZmap::GenTool_ZDrilling( int nGrid, const Point3d& ptS, const Point3d& ptE, c frNormFrame.Set( ORIG, X_AX, - Z_AX, Y_AX) ; // Ciclo sulle curve const CurveComposite& ToolProfile = m_Tool.GetApproxOutline() ; - const ICurve* pCurve = ToolProfile.GetFirstCurve() ; + int i = - 1 ; + const ICurve* pCurve = ToolProfile.GetCurve( ++ i) ; while ( pCurve != nullptr) { double dHeight = 0 ; @@ -1751,7 +1782,7 @@ VolZmap::GenTool_ZDrilling( int nGrid, const Point3d& ptS, const Point3d& ptE, c ptF = ptI + vtMove ; // Passo alla curva successiva del profilo - pCurve = ToolProfile.GetNextCurve() ; + pCurve = ToolProfile.GetCurve( ++ i) ; } return true ; @@ -1773,7 +1804,8 @@ VolZmap::GenTool_ZMilling( int nGrid, const Point3d& ptS, const Point3d& ptE, co frNormFrame.Set( ORIG, X_AX, -Z_AX, Y_AX) ; // Ciclo sulle curve del profilo utensile const CurveComposite& ToolProfile = m_Tool.GetApproxOutline() ; - const ICurve* pCurve = ToolProfile.GetFirstCurve() ; + int i = - 1 ; + const ICurve* pCurve = ToolProfile.GetCurve( ++ i) ; while ( pCurve != nullptr) { double dHeight = 0 ; @@ -1840,7 +1872,7 @@ VolZmap::GenTool_ZMilling( int nGrid, const Point3d& ptS, const Point3d& ptE, co ptF = ptI + vtMove ; // Passo alla curva successiva del profilo - pCurve = ToolProfile.GetNextCurve() ; + pCurve = ToolProfile.GetCurve( ++ i) ; } return true ; @@ -2897,8 +2929,9 @@ VolZmap::GenTool_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE, co frNormFrame.Set( ORIG, X_AX, -Z_AX, Y_AX) ; // Ciclo sulle curve del profilo const CurveComposite& ToolProfile = m_Tool.GetApproxOutline() ; + int i = - 1 ; const ICurve* pPrevCurve = nullptr ; - const ICurve* pCurve = ToolProfile.GetFirstCurve() ; + const ICurve* pCurve = ToolProfile.GetCurve( ++ i) ; while ( pCurve != nullptr) { double dHeight = 0 ; @@ -2931,7 +2964,7 @@ VolZmap::GenTool_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE, co } // Verifiche curva successiva per eventuale tappo sotto bool bTapB = false ; - const ICurve* pNextCurve = ToolProfile.GetNextCurve() ; + const ICurve* pNextCurve = ToolProfile.GetCurve( ++ i) ; if ( pNextCurve != nullptr && pNextCurve->GetType() == CRV_LINE) { const ICurveLine* pOthLine = GetCurveLine( pNextCurve) ; Point3d ptOthStart = pOthLine->GetStart() ; @@ -2966,7 +2999,7 @@ VolZmap::GenTool_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE, co else { // Passo alla curva successiva pPrevCurve = pCurve ; - pCurve = ToolProfile.GetNextCurve() ; + pCurve = ToolProfile.GetCurve( ++ i) ; } } @@ -2987,7 +3020,7 @@ VolZmap::GenTool_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE, co dHeight = abs( ptStart.y - ptEnd.y) ; // Passo alla curva successiva pPrevCurve = pCurve ; - pCurve = ToolProfile.GetNextCurve() ; + pCurve = ToolProfile.GetCurve( ++ i) ; } // Determino le posizioni iniziale e finale del componente successivo @@ -3014,8 +3047,9 @@ VolZmap::GenTool_Milling( int nGrid, const Point3d& ptS, const Point3d& ptE, con frNormFrame.Set( ORIG, X_AX, -Z_AX, Y_AX) ; // Ciclo sulle curve del profilo const CurveComposite& ToolProfile = m_Tool.GetApproxOutline() ; + int i = - 1 ; const ICurve* pPrevCurve = nullptr ; - const ICurve* pCurve = ToolProfile.GetFirstCurve() ; + const ICurve* pCurve = ToolProfile.GetCurve( ++ i) ; while ( pCurve != nullptr) { double dHeight = 0 ; @@ -3048,7 +3082,7 @@ VolZmap::GenTool_Milling( int nGrid, const Point3d& ptS, const Point3d& ptE, con } // verifiche curva successiva per eventuale tappo sotto bool bTapB = false ; - const ICurve* pNextCurve = ToolProfile.GetNextCurve() ; + const ICurve* pNextCurve = ToolProfile.GetCurve( ++ i) ; if ( pNextCurve != nullptr && pNextCurve->GetType() == CRV_LINE) { const ICurveLine* pOthLine = GetCurveLine( pNextCurve) ; Point3d ptOthStart = pOthLine->GetStart() ; @@ -3083,7 +3117,7 @@ VolZmap::GenTool_Milling( int nGrid, const Point3d& ptS, const Point3d& ptE, con else { // Passo alla curva successiva pPrevCurve = pCurve ; - pCurve = ToolProfile.GetNextCurve() ; + pCurve = ToolProfile.GetCurve( ++ i) ; } } @@ -3104,7 +3138,7 @@ VolZmap::GenTool_Milling( int nGrid, const Point3d& ptS, const Point3d& ptE, con dHeight = abs( ptStart.y - ptEnd.y) ; // Passo alla curva successiva pPrevCurve = pCurve ; - pCurve = ToolProfile.GetNextCurve() ; + pCurve = ToolProfile.GetCurve( ++ i) ; } // Determino le posizioni iniziale e finale del componente successivo