EgtGeomKernel 1.9i2 :

- migliorie a Vmill con chisel e mortiser.
This commit is contained in:
Dario Sassi
2018-09-08 09:06:31 +00:00
parent ba057f8c8d
commit 4f0a5e600f
3 changed files with 69 additions and 58 deletions
+60 -35
View File
@@ -3341,20 +3341,27 @@ VolZmap::CompPar_ZDrilling( unsigned int nGrid, double dLenX, double dLenY, doub
const Point3d& ptS, const Point3d& ptE,
const Vector3d& vtToolDir, const Vector3d& vtAux)
{
Point3d ptMyS = ptS - EPS_SMALL * vtToolDir ;
Point3d ptMyE = ptE - EPS_SMALL * vtToolDir ;
dLenX -= ( 2 * EPS_SMALL) ;
dLenY -= ( 2 * EPS_SMALL) ;
dLenZ -= ( 2 * EPS_SMALL) ;
// 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) ;
bool bInterf = BBoxParaComp( nGrid, dLenX, dLenY, dLenZ, ptMyS, ptMyE, vtToolDir, vtAux, nStartI, nStartJ, nEndI, nEndJ) ;
if ( ! bInterf)
return true ;
// Costruisco un sistema di riferimento nel piano
Point3d ptOXY( ptS.x, ptS.y, 0) ;
Point3d ptOXY( ptMyS.x, ptMyS.y, 0) ;
Vector3d vtV1 = vtToolDir ^ vtAux ;
Vector3d vtV2 = vtAux ;
// Quote estreme del volume asportato
double dMinZ = min( min( ptS.z, ptS.z - vtToolDir.z * dLenZ), min( ptE.z, ptE.z - vtToolDir.z * dLenZ)) ;
double dMaxZ = max( max( ptS.z, ptS.z - vtToolDir.z * dLenZ), max( ptE.z, ptE.z - vtToolDir.z * dLenZ)) ;
double dMinZ = min( min( ptMyS.z, ptMyS.z - vtToolDir.z * dLenZ), min( ptMyE.z, ptMyE.z - vtToolDir.z * dLenZ)) ;
double dMaxZ = max( max( ptMyS.z, ptMyS.z - vtToolDir.z * dLenZ), max( ptMyE.z, ptMyE.z - vtToolDir.z * dLenZ)) ;
for ( unsigned int i = nStartI ; i <= nEndI ; ++ i) {
for ( unsigned int j = nStartJ ; j <= nEndJ ; ++ j) {
@@ -3368,8 +3375,7 @@ VolZmap::CompPar_ZDrilling( unsigned int nGrid, double dLenX, double dLenY, doub
double dR1 = vtR * vtV1 ;
double dR2 = vtR * vtV2 ;
if ( abs( dR1) < 0.5 * dLenX - EPS_SMALL &&
abs( dR2) < 0.5 * dLenY - EPS_SMALL)
if ( abs( dR1) < 0.5 * dLenX && abs( dR2) < 0.5 * dLenY)
SubtractIntervals( nGrid, i, j, dMinZ, dMaxZ, Z_AX, - Z_AX) ;
}
}
@@ -3785,25 +3791,32 @@ VolZmap::CompPar_ZMilling( unsigned int nGrid, double dLenX, double dLenY, doubl
const Point3d& ptS, const Point3d& ptE,
const Vector3d& vtToolDir, const Vector3d& vtAux)
{
Point3d ptMyS = ptS - EPS_SMALL * vtToolDir ;
Point3d ptMyE = ptE - EPS_SMALL * vtToolDir ;
dLenX -= ( 2 * EPS_SMALL) ;
dLenY -= ( 2 * EPS_SMALL) ;
dLenZ -= ( 2 * EPS_SMALL) ;
// 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) ;
bool bInterf = BBoxParaComp( nGrid, dLenX, dLenY, dLenZ, ptMyS, ptMyE, vtToolDir, vtAux, nStartI, nStartJ, nEndI, nEndJ) ;
if ( ! bInterf)
return true ;
// Quote estreme Z
double dMinZ = min( min( ptS.z, ptS.z - vtToolDir.z * dLenZ), min( ptE.z, ptE.z - vtToolDir.z * dLenZ)) ;
double dMaxZ = max( max( ptS.z, ptS.z - vtToolDir.z * dLenZ), max( ptE.z, ptE.z - vtToolDir.z * dLenZ)) ;
double dMinZ = min( min( ptMyS.z, ptMyS.z - vtToolDir.z * dLenZ), min( ptMyE.z, ptMyE.z - vtToolDir.z * dLenZ)) ;
double dMaxZ = max( max( ptMyS.z, ptMyS.z - vtToolDir.z * dLenZ), max( ptMyE.z, ptMyE.z - vtToolDir.z * dLenZ)) ;
// Vettore di movimento
Vector3d vtMove = ptE - ptS ;
Vector3d vtMove = ptMyE - ptMyS ;
// Sistemi di riferimento del solido nella posizione iniziale e finale
Vector3d vtV2 = vtAux ;
Vector3d vtV1 = vtV2 ^ vtToolDir ;
vtV1.Normalize() ;
Point3d ptSXY( ptS.x, ptS.y, 0) ;
Point3d ptEXY( ptE.x, ptE.y, 0) ;
Point3d ptSXY( ptMyS.x, ptMyS.y, 0) ;
Point3d ptEXY( ptMyE.x, ptMyE.y, 0) ;
// Studio del volume asportato durante il moto
Frame3d MotionFrame ;
@@ -3835,22 +3848,20 @@ VolZmap::CompPar_ZMilling( unsigned int nGrid, double dLenX, double dLenY, doubl
double dRE2 = vtRE * vtV2 ;
// Asportazione materiale nella posizione iniziale
if ( abs( dRS1) < 0.5 * dLenX - EPS_SMALL &&
abs( dRS2) < 0.5 * dLenY - EPS_SMALL)
if ( abs( dRS1) < 0.5 * dLenX && abs( dRS2) < 0.5 * dLenY)
SubtractIntervals( nGrid, i, j, dMinZ, dMaxZ, Z_AX, - Z_AX) ;
// Asportazione materiale nella posizione finale
if ( abs( dRE1) < 0.5 * dLenX - EPS_SMALL &&
abs( dRE2) < 0.5 * dLenY - EPS_SMALL)
if ( abs( dRE1) < 0.5 * dLenX && abs( dRE2) < 0.5 * dLenY)
SubtractIntervals( nGrid, i, j, dMinZ, dMaxZ, Z_AX, - Z_AX) ;
// Asportazione materiale nel moto
Vector3d vtR = ptC - ptOrigXY ;
double dR1 = vtR * vtW1 ;
double dR2 = vtR * vtW2 ;
if ( dR2 > EPS_SMALL && dR2 < dLenW2 - EPS_SMALL &&
dR1 * dLenW2 > /*dLenW1*/dDeltaW1 * dR2 + EPS_SMALL &&
dR1 * dLenW2 < /*dDeltaW1*/dLenW1 * dLenW2 + /*dLenW1*/ dDeltaW1 * dR2 - EPS_SMALL)
if ( dR2 > 0 && dR2 < dLenW2 &&
dR1 * dLenW2 > dDeltaW1 * dR2 &&
dR1 * dLenW2 < dLenW1 * dLenW2 + dDeltaW1 * dR2)
SubtractIntervals( nGrid, i, j, dMinZ, dMaxZ, Z_AX, - Z_AX) ;
}
}
@@ -3998,9 +4009,16 @@ VolZmap::CompPar_Drilling( unsigned int nGrid, double dLenX, double dLenY, doubl
const Point3d& ptS, const Point3d& ptE,
const Vector3d& vtToolDir, const Vector3d& vtAux)
{
Point3d ptMyS = ptS - EPS_SMALL * vtToolDir ;
Point3d ptMyE = ptE - EPS_SMALL * vtToolDir ;
dLenX -= ( 2 * EPS_SMALL) ;
dLenY -= ( 2 * EPS_SMALL) ;
dLenZ -= ( 2 * EPS_SMALL) ;
// 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) ;
bool bInterf = BBoxParaComp( nGrid, dLenX, dLenY, dLenZ, ptMyS, ptMyE, vtToolDir, vtAux, nStartI, nStartJ, nEndI, nEndJ) ;
if ( ! bInterf)
return true ;
@@ -4010,8 +4028,8 @@ VolZmap::CompPar_Drilling( unsigned int nGrid, double dLenX, double dLenY, doubl
Vector3d vtV2 = vtAux ^ vtV1 ;
Vector3d vtV3 = vtAux ;
double dLenMove = ( ptE - ptS).Len() ;
Point3d ptO = ptS - ( ( ptE - ptS) * vtV1 > 0 ? dLenZ : dLenZ + dLenMove) * vtV1 - ( 0.5 * dLenX) * vtV2 ;
double dLenMove = ( ptMyE - ptMyS).Len() ;
Point3d ptO = ptMyS - ( ( ptMyE - ptMyS) * vtV1 > 0 ? dLenZ : dLenZ + dLenMove) * vtV1 - ( 0.5 * dLenX) * vtV2 ;
Frame3d ParaFrame ; ParaFrame.Set( ptO, vtV2, vtV3, vtV1) ;
for ( unsigned int i = nStartI ; i <= nEndI ; ++ i) {
@@ -4608,14 +4626,21 @@ VolZmap::CompPar_Milling( unsigned int nGrid, double dLenX, double dLenY, double
const Point3d& ptS, const Point3d& ptE,
const Vector3d& vtToolDir, const Vector3d& vtAux)
{
Point3d ptMyS = ptS - EPS_SMALL * vtToolDir ;
Point3d ptMyE = ptE - EPS_SMALL * vtToolDir ;
dLenX -= ( 2 * EPS_SMALL) ;
dLenY -= ( 2 * EPS_SMALL) ;
dLenZ -= ( 2 * EPS_SMALL) ;
// 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) ;
bool bInterf = BBoxParaComp( nGrid, dLenX, dLenY, dLenZ, ptMyS, ptMyE, vtToolDir, vtAux, nStartI, nStartJ, nEndI, nEndJ) ;
if ( ! bInterf)
return true ;
// Vettore di movimento
Vector3d vtMove = ptE - ptS ;
Vector3d vtMove = ptMyE - ptMyS ;
// Sistema di riferimento del solido nella posizione iniziale (con vtMove derivo quello finale)
Frame3d ParaFrame ;
@@ -4623,14 +4648,14 @@ VolZmap::CompPar_Milling( unsigned int nGrid, double dLenX, double dLenY, double
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()) ;
ParaFrame.ChangeOrig( ptMyS - dLenZ * ParaFrame.VersZ() - ( 0.5 * dLenX) * ParaFrame.VersX()) ;
// Studio del volume asportato durante il moto
Frame3d MotionFrame ;
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) ;
Point3d ptOrig = ptMyS - vtW3 / 2 - vtToolDir * ( dLenZ / 2) ;
double dLenW3 = vtW3.Len() ;
vtW3 /= dLenW3 ;
double dDeltaW3 = vtMove * vtW3 ;
@@ -4671,7 +4696,7 @@ VolZmap::CompPar_Milling( unsigned int nGrid, double dLenX, double dLenY, double
SubtractIntervals( nGrid, i, j, dMin, dMax, vtNmin, vtNmax) ;
}
// Solido nella posizione finale
// Solido nella posizione finale
if ( IntersLineMyPolyhedron( ptC - vtMove, Z_AX, ParaFrame, dLenX, dLenY, dLenZ, 0, ptInt1, ptInt2, vtN1, vtN2)) {
double dMin, dMax ;
Vector3d vtNmin, vtNmax ;
@@ -4911,16 +4936,16 @@ VolZmap::BBoxParaComp( unsigned int nGrid, double dLenX, double dLenY, double dL
// finale della punta dell'utensile.
Point3d ptSTip = ptS - vtD * dLenZ ;
Point3d ptETip = ptE - vtD * dLenZ ;
double dMaxDim = max( dLenX, dLenY) ;
double dSemiDiag = sqrt( dLenX * dLenX + dLenY * dLenY) / 2 ;
// Determinazione dei limiti del più piccolo parallelepipedo contenente il movimento
double dMinX = min( min( ptS.x, ptSTip.x), min( ptE.x, ptETip.x)) - dMaxDim ;
double dMinY = min( min( ptS.y, ptSTip.y), min( ptE.y, ptETip.y)) - dMaxDim ;
double dMinZ = min( min( ptS.z, ptSTip.z), min( ptE.z, ptETip.z)) - dMaxDim ;
double dMaxX = max( max( ptS.x, ptSTip.x), max( ptE.x, ptETip.x)) + dMaxDim ;
double dMaxY = max( max( ptS.y, ptSTip.y), max( ptE.y, ptETip.y)) + dMaxDim ;
double dMaxZ = max( max( ptS.z, ptSTip.z), max( ptE.z, ptETip.z)) + dMaxDim ;
double dMinX = min( min( ptS.x, ptSTip.x), min( ptE.x, ptETip.x)) - dSemiDiag ;
double dMinY = min( min( ptS.y, ptSTip.y), min( ptE.y, ptETip.y)) - dSemiDiag ;
double dMinZ = min( min( ptS.z, ptSTip.z), min( ptE.z, ptETip.z)) - dSemiDiag ;
double dMaxX = max( max( ptS.x, ptSTip.x), max( ptE.x, ptETip.x)) + dSemiDiag ;
double dMaxY = max( max( ptS.y, ptSTip.y), max( ptE.y, ptETip.y)) + dSemiDiag ;
double dMaxZ = max( max( ptS.z, ptSTip.z), max( ptE.z, ptETip.z)) + dSemiDiag ;
unsigned int nMaxNx = m_nNx[nGrid] ;
unsigned int nMaxNy = m_nNy[nGrid] ;