diff --git a/Tool.cpp b/Tool.cpp index 8c35e7f..7959901 100644 --- a/Tool.cpp +++ b/Tool.cpp @@ -744,5 +744,11 @@ Tool::SetAdditiveTool( const std::string& sToolName, double dH, double dR, doubl } } - return SetGenTool( sToolName, &m_Outline, nToolNum) ; + //return SetGenTool( sToolName, &m_Outline, nToolNum) ; + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////// Per test additivi ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + bool bOk = SetGenTool( sToolName, &m_Outline, nToolNum) ; + m_nType = ADDITIVE ; + return bOk; + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } \ No newline at end of file diff --git a/VolZmapCreation.cpp b/VolZmapCreation.cpp index f2d2210..aaf284b 100644 --- a/VolZmapCreation.cpp +++ b/VolZmapCreation.cpp @@ -736,10 +736,14 @@ VolZmap::CreateEmptyMap( const Point3d& ptO, double dLengthX, double dLengthY, d m_dMaxZ[2] = ( bTriDex ? dLengthY : 0) ; // Tipologia - m_nShape = BOX ; + m_nShape = GENERIC ; // Aggiornamento dello stato m_nStatus = OK ; - + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////// Per test additivi ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + AddTool(); + SetCurrTool(0); + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// return true ; } \ No newline at end of file diff --git a/VolZmapVolume.cpp b/VolZmapVolume.cpp index 450143f..931e7fd 100644 --- a/VolZmapVolume.cpp +++ b/VolZmapVolume.cpp @@ -255,6 +255,10 @@ bool VolZmap::AddIntervals( int nGrid, int nI, int nJ, double dMin, double dMax, const Vector3d& vtNMin, const Vector3d& vtNMax) { + // Restringo minimo e massimo entro i limiti della mappa + dMin = Clamp( dMin, m_dMinZ[nGrid], m_dMaxZ[nGrid]) ; + dMax = Clamp( dMax, m_dMinZ[nGrid], m_dMaxZ[nGrid]) ; + // Controllo che dMin e dMax non siano quasi coincidenti if ( abs( dMax - dMin) < EPS_SMALL) return true ; @@ -309,11 +313,11 @@ VolZmap::AddIntervals( int nGrid, int nI, int nJ, vDexel.back().vtMaxN = vtNma ; vDexel.back().nToolMax = m_vTool[m_nCurrTool].GetCurrentToolNum() ; - if ( dMax > m_dMaxZ[nGrid]) + /*if ( dMax > m_dMaxZ[nGrid]) m_dMaxZ[nGrid] = dMax ; if ( dMin < m_dMinZ[nGrid]) - m_dMinZ[nGrid] = dMin ; + m_dMinZ[nGrid] = dMin ;*/ m_OGrMgr.Reset() ; @@ -726,22 +730,25 @@ VolZmap::MillingTranslationStep( const Point3d& ptPs, const Point3d& ptPe, const 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) { - vRes[i] = async( launch::async, &VolZmap::SelectMotion, this, i, cref( ptLs[i]), cref( ptLe[i]), cref( vtLs[i]), cref( 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::nanoseconds{ 1}) == future_status::ready) { - bOk = vRes[i].get() && bOk ; - ++ nTerminated ; - } - } + SelectMotion( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ; } + // Ciclo sulle mappe + //vector< future> vRes ; + //vRes.resize( m_nMapNum) ; + //for ( int i = 0 ; i < m_nMapNum ; ++ i) { + // vRes[i] = async( launch::async, &VolZmap::SelectMotion, this, i, cref( ptLs[i]), cref( ptLe[i]), cref( vtLs[i]), cref( 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::nanoseconds{ 1}) == future_status::ready) { + // bOk = vRes[i].get() && bOk ; + // ++ nTerminated ; + // } + // } + //} return true ; } @@ -828,7 +835,7 @@ VolZmap::SelectMotion( int nGrid, const Point3d& ptLs, const Point3d& ptLe, cons Chs_Milling( nGrid, ptLs, ptLe, vtL, vtAL) ; break ; case Tool::ADDITIVE : - // Chiama metodo + AddingMotion( nGrid, ptLs, ptLe, vtL) ; break ; } } @@ -906,7 +913,7 @@ VolZmap::SelectMotion( int nGrid, const Point3d& ptLs, const Point3d& ptLe, cons Chs_Milling( nGrid, ptLs, ptLe, vtL, vtAL) ; break ; case Tool::ADDITIVE : - // Chiama metodo + AddingMotion( nGrid, ptLs, ptLe, vtL) ; break ; } } @@ -7806,13 +7813,14 @@ VolZmap::AddingMotion( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d vtV1 = ptE - ptS ; double dLen1 = vtV1.Len() ; - vtV1 / dLen1 ; - Vector3d vtV2 = Z_AX ^ vtV1 ; + vtV1 /= dLen1 ; if ( dCornerRad < EPS_SMALL) { if ( nGrid == 0) { + Vector3d vtV2 = Z_AX ^ vtV1 ; + for ( int i = nStartI ; i <= nEndI ; ++ i) { for ( int j = nStartJ ; j <= nEndJ ; ++ j) { @@ -7836,8 +7844,8 @@ VolZmap::AddingMotion( int nGrid, const Point3d& ptS, const Point3d& ptE, const PolyFrame.Set( ptS - dHei * vtAx, vtV1, vtAx ^ vtV1, vtAx) ; for ( int i = nStartI ; i <= nEndI ; ++ i) { for ( int j = nStartJ ; j <= nEndJ ; ++ j) { - - Point3d ptC( ( i + 0.5) * m_dStep - ptS.x, ( j + 0.5) * m_dStep - ptS.y, 0) ; + + Point3d ptC( ( i + 0.5) * m_dStep, ( j + 0.5) * m_dStep, 0) ; Point3d ptInt1, ptInt2 ; Vector3d vtN1, vtN2 ; @@ -7847,7 +7855,12 @@ VolZmap::AddingMotion( int nGrid, const Point3d& ptS, const Point3d& ptE, const AddIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, - vtN1, - vtN2) ; } - if ( IntersLineMyPolyhedron( ptC - dLen1 * vtV1, Z_AX, PolyFrame, dLen1, dRad, dHei, 0, + if ( IntersLineCylinder( ptC - dLen1 * vtV1, Z_AX, CylFrame, dHei, dRad, true, true, + ptInt1, vtN1, ptInt2, vtN2)) { + AddIntervals( nGrid, i, j, ptInt1.z + dLen1 * vtV1.z, ptInt2.z + dLen1 * vtV1.z, - vtN1, - vtN2) ; + } + + if ( IntersLineMyPolyhedron( ptC, Z_AX, PolyFrame, dLen1, 2 * dRad, dHei, 0, ptInt1, vtN1, ptInt2, vtN2)) { AddIntervals( nGrid, i, j, ptInt1.z, ptInt2.z, - vtN1, - vtN2) ; }