diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc index fa9b849..1df8e39 100644 Binary files a/EgtGeomKernel.rc and b/EgtGeomKernel.rc differ diff --git a/VolZmapVolume.cpp b/VolZmapVolume.cpp index 51867ce..fd78d24 100644 --- a/VolZmapVolume.cpp +++ b/VolZmapVolume.cpp @@ -874,6 +874,7 @@ VolZmap::MillingStep( int nCurrTool, bool bOk ; if ( AreSameVectorApprox( vtDLs, vtDLe)) bOk = MillingTranslationStep( ptPLs, ptPLe, vtDLs, vtALs) ; + // altrimenti anche rotazione else bOk = MillingGeneralMotionStep( ptPLs, vtDLs, vtALs, ptPLe, vtDLe, vtALe) ; @@ -886,15 +887,36 @@ VolZmap::MillingStep( int nCurrTool, return bOk ; } +//---------------------------------------------------------------------------- +static bool +GetAlongAcrossRotation( const Vector3d& vtDir1, const Vector3d& vtDir2, const Vector3d& vtRef, + double& dAlongAngDeg, double& dAcrossAngDeg) +{ + Vector3d vtAxis = vtRef ; + if ( vtAxis.Normalize()) { + bool bDet ; vtDir1.GetRotation( vtDir2, vtAxis, dAcrossAngDeg, bDet) ; + Vector3d vtDirM = GetRotate( vtDir1, vtAxis, dAcrossAngDeg) ; + vtDirM.GetAngle( vtDir2, dAlongAngDeg) ; + } + else { + vtDir1.GetAngle( vtDir2, dAlongAngDeg) ; + dAcrossAngDeg = 0 ; + } + return true ; +} + //---------------------------------------------------------------------------- bool VolZmap::MillingGeneralMotionStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d& vtAs, const Point3d& ptPe, const Vector3d& vtDe, const Vector3d& vtAe) { + // Calcolo angoli di rotazione utensile longitudinale e trasversale rispetto al movimento + double dAlongAngDeg, dAcrossAngDeg ; + GetAlongAcrossRotation( vtDs, vtDe, ptPe - ptPs, dAlongAngDeg, dAcrossAngDeg) ; // Divido il movimento in tratti con direzione utensile costante - const double ANG_STEP = 0.04 ; - double dAngDeg ; vtDs.GetAngle( vtDe, dAngDeg) ; - int nStepCnt = int( abs( dAngDeg) / ANG_STEP) + 1 ; + const double ANG_ACROSS_STEP = 0.04 ; + const double ANG_ALONG_STEP = 1.0 ; + int nStepCnt = int( max( { abs( dAlongAngDeg) / ANG_ALONG_STEP, abs( dAcrossAngDeg) / ANG_ACROSS_STEP, 1.})) ; bool bOk = true ; Point3d ptSt = ptPs ; for ( int i = 0 ; i <= nStepCnt && bOk ; ++ i) { @@ -1168,7 +1190,7 @@ VolZmap::SelectMotion( int nGrid, const Point3d& ptLs, const Point3d& ptLe, cons } -// ---------- VERSORE UTENSILE DERETTO COME Z -------------------------------- +// ---------- VERSORE UTENSILE DIRETTO COME Z -------------------------------- // ---------- Cilindro e sfera -----------------------------------------------