EgtGeomKernel 1.9h4 :

- correzione a virtual milling con Chisel e Mortiser su ZMap.
This commit is contained in:
Dario Sassi
2018-08-30 14:19:49 +00:00
parent 07b1f21ecd
commit 2d3657a268
2 changed files with 35 additions and 52 deletions
+35 -52
View File
@@ -642,7 +642,7 @@ VolZmap::MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d&
// Proiezione dei vettori sulle rispettive griglie
Vector3d vtLsXY( vtLs[i].x, vtLs[i].y, 0) ;
// Versore utensile parallelo all'asse Z
// Versore utensile parallelo all'asse Z (coincide con spillone)
if ( vtLsXY.SqLen() < EPS_SMALL * EPS_SMALL) {
Vector3d vtMove = ptLe[i] - ptLs[i] ;
@@ -707,7 +707,7 @@ VolZmap::MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d&
}
}
// Versore utensile nel piano
// Versore utensile nel piano XY (perpendicolare allo spillone)
else if ( abs( vtLs[i].z) < EPS_SMALL) {
Vector3d vtMove = ptLe[i] - ptLs[i] ;
@@ -782,6 +782,7 @@ VolZmap::MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d&
Vector3d vtMLong = ( vtMove * vtLs[i]) * vtLs[i] ;
Vector3d vtMOrt = vtMove - vtMLong ;
double dSqLLong = vtMLong.SqLen() ;
double dSqLOrt = vtMOrt.SqLen() ;
// Foratura
@@ -805,7 +806,7 @@ VolZmap::MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d&
break ;
}
}
// Fresatura con vettore movimento generico rispetto all'utensile
else {
switch ( m_Tool.GetType()) {
case Tool::GEN :
@@ -819,10 +820,14 @@ VolZmap::MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d&
Conus_Milling( i, ptLs[i], ptLe[i], vtLs[i]) ;
break ;
case Tool::MORTISER :
Mrt_Milling( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ;
// ammesso solo movimento perpendicolare all'asse utensile
if ( dSqLLong < EPS_SMALL * EPS_SMALL)
Mrt_Milling( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ;
break ;
case Tool::CHISEL :
Chs_Milling( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ;
// ammesso solo movimento perpendicolare all'asse utensile
if ( dSqLLong < EPS_SMALL * EPS_SMALL)
Chs_Milling( i, ptLs[i], ptLe[i], vtLs[i], vtALs[i]) ;
break ;
}
}
@@ -3780,6 +3785,9 @@ VolZmap::CompPar_ZMilling( unsigned int nGrid, double dLenX, double dLenY, doubl
const Point3d& ptS, const Point3d& ptE,
const Vector3d& vtToolDir, const Vector3d& vtAux)
{
// uso funzione generica per verifica rapida
return CompPar_Milling( nGrid, dLenX, dLenY, dLenZ, ptS, ptE, vtToolDir, vtAux) ;
// Controllo sull'interferenza utensile-solido
unsigned int nStartI, nStartJ, nEndI, nEndJ ;
bool bInterf = BBoxParaComp( nGrid, dLenX, dLenY, dLenZ, ptS, ptE, vtToolDir, vtAux, nStartI, nStartJ, nEndI, nEndJ) ;
@@ -3819,8 +3827,7 @@ VolZmap::CompPar_ZMilling( unsigned int nGrid, double dLenX, double dLenY, doubl
Vector3d vtW2 = ( bSymmetry ? vtAnsatz : - vtAnsatz) ;
Vector3d vtW1 = ( bSymmetry ? vtToolDir : - vtToolDir) ;
Frame3d MotionFrame ;
Point3d ptDiagMin = ptLs - vtW2 * ( 0.5 * dLenX) + vtW3 * ( 0.5 * dLenY) ;
Point3d ptDiagMax = ptLs + vtW2 * ( 0.5 * dLenX) - vtW3 * ( 0.5 * dLenY) ;
@@ -3829,7 +3836,6 @@ VolZmap::CompPar_ZMilling( unsigned int nGrid, double dLenX, double dLenY, doubl
Vector3d vtU2 = ( vtU1 * vtMove > 0 ? vtMove - vtMove * vtU1 * vtU1 :
vtMove * vtU1 * vtU1 - vtMove) ;
vtU2.Normalize() ;
Vector3d vtU3 = vtU1 ^ vtU2 ;
Point3d ptOMot = ( vtMove * vtU1 > 0 ? ptDiagMin : ptDiagMin + vtMove) ;
@@ -3867,10 +3873,8 @@ VolZmap::CompPar_ZMilling( unsigned int nGrid, double dLenX, double dLenY, doubl
// Asportazione materiale nel moto
Vector3d vtR = ptC - ptOMotXY ;
double dR1 = vtR * vtU1 ;
double dR2 = vtR * vtU2 ;
if ( dR2 > EPS_SMALL && dR2 < dLen2 - EPS_SMALL &&
dR1 * dLen2 > dLen1 * dR2 + EPS_SMALL &&
dR1 * dLen2 < dHx * dLen2 + dLen1 * dR2 - EPS_SMALL)
@@ -4640,50 +4644,28 @@ VolZmap::CompPar_Milling( unsigned int nGrid, double dLenX, double dLenY, double
// Vettore di movimento
Vector3d vtMove = ptE - ptS ;
// Sistema di riferimento del solido
// nelle posizioni iniziale e finale.
Vector3d vtV1 = vtToolDir ;
Vector3d vtV2 = ( vtMove * ( vtV1 ^ vtAux) > 0 ? ( vtV1 ^ vtAux) : ( vtAux ^ vtV1)) ;
Vector3d vtV3 = vtV1 ^ vtV2 ;
Point3d ptO = ptS - dLenZ * vtV1 - vtV2 * ( 0.5 * dLenX) ;
Frame3d ParaFrame ; ParaFrame.Set( ptO, vtV2, vtV3, vtV1) ;
// Sistema di riferimento del solido nella posizione iniziale (con vtMove derivo quello finale)
Frame3d ParaFrame ;
Vector3d vtV3 = vtToolDir ;
Vector3d vtV1 = vtAux ^ vtV3 ;
Vector3d vtV2 = vtV3 ^ vtV1 ;
ParaFrame.Set( ORIG, vtV1, vtV2, vtV3) ;
ParaFrame.ChangeOrig( ptS - dLenZ * ParaFrame.VersZ() - ( 0.5 * dLenX) * ParaFrame.VersX()) ;
// Studio del volume asportato durante il moto
Point3d ptLs = ( vtMove * vtAux >= 0 ? ptS : ptE) ;
Point3d ptLe = ( vtMove * vtAux >= 0 ? ptE : ptS) ;
Vector3d vtW3 = vtAux ;
Vector3d vtAnsatz = ( vtW3 ^ vtToolDir) ;
Vector3d vtMv = ptLe - ptLs ;
bool bSymmetry = vtMv * vtAnsatz > 0 ;
Vector3d vtW2 = ( bSymmetry ? vtAnsatz : - vtAnsatz) ;
Vector3d vtW1 = ( bSymmetry ? vtToolDir : - vtToolDir) ;
Point3d ptBase = bSymmetry ? ptLs - dLenZ * vtW1 : ptLs ;
Frame3d MotionFrame ;
Point3d ptDiagMin = ptBase - vtW2 * ( 0.5 * dLenX) + vtW3 * ( 0.5 * dLenY) ;
Point3d ptDiagMax = ptBase + vtW2 * ( 0.5 * dLenX) - vtW3 * ( 0.5 * dLenY) ;
Vector3d vtU1 = ptDiagMax - ptDiagMin ;
double dDimLong = ( ptDiagMax - ptDiagMin).Len() ;
vtU1.Normalize() ;
bool bSymmetry2 = vtU1 * vtMv > 0 ;
Vector3d vtU2 = ( bSymmetry2 ? vtMv - vtMv * vtU1 * vtU1 :
vtMv * vtU1 * vtU1 - vtMv) ;
vtU2.Normalize() ;
Vector3d vtU3 = vtU1 ^ vtU2 ;
Point3d ptOMotion = ( bSymmetry2 ? ptDiagMin : ptDiagMin + vtMv) + vtU3 * ( 0.5 * dLenZ) ;
MotionFrame.Set( ptOMotion, vtU2, vtU3, vtU1) ;
double dDeltaLong = abs( vtMv * vtU1) ;
double dDimOrt = abs( vtMv * vtU2) ;
Vector3d vtDiagA = dLenX * ParaFrame.VersX() + dLenY * ParaFrame.VersY() ;
Vector3d vtDiagB = dLenX * ParaFrame.VersX() - dLenY * ParaFrame.VersY() ;
Vector3d vtW3 = ( abs( vtDiagA * vtMove) <= abs( vtDiagB * vtMove) ? vtDiagA : vtDiagB) ;
Point3d ptOrig = ptS - vtW3 / 2 - vtToolDir * ( dLenZ / 2) ;
double dLenW3 = vtW3.Len() ;
vtW3 /= dLenW3 ;
double dDeltaW3 = vtMove * vtW3 ;
Vector3d vtW1 = vtMove - dDeltaW3 * vtW3 ;
double dLenW1 = vtW1.Len() ;
vtW1 /= dLenW1 ;
Vector3d vtW2 = vtW3 ^ vtW1 ;
MotionFrame.Set( ptOrig, vtW1, vtW2, vtW3) ;
for ( unsigned int i = nStartI ; i <= nEndI ; ++ i) {
for ( unsigned int j = nStartJ ; j <= nEndJ ; ++ j) {
@@ -4737,7 +4719,8 @@ VolZmap::CompPar_Milling( unsigned int nGrid, double dLenX, double dLenY, double
}
// Volume spazzato nel moto
if ( IntersLineMyPolyhedron( ptC, Z_AX, MotionFrame, dDimOrt, dLenZ, dDimLong, dDeltaLong, ptInt1, ptInt2, vtN1, vtN2)) {
//if ( IntersLineMyPolyhedron( ptC, Z_AX, MotionFrame, dDimOrt, dLenZ, dDimLong, dDeltaLong, ptInt1, ptInt2, vtN1, vtN2)) {
if ( IntersLineMyPolyhedron( ptC, Z_AX, MotionFrame, dLenW1, dLenZ, dLenW3, dDeltaW3, ptInt1, ptInt2, vtN1, vtN2)) {
double dMin, dMax ;
Vector3d vtNmin, vtNmax ;
if ( ptInt1.z < ptInt2.z) {