EgtMachKernel :

- aggiunta lavorazione a tuffo su tutto il percorso in mortasatura.
This commit is contained in:
SaraP
2022-06-17 17:55:47 +02:00
parent d61450cf20
commit ddc91c60e9
2 changed files with 45 additions and 16 deletions
+43 -15
View File
@@ -1383,8 +1383,10 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
SetToolDir( vtTool) ;
SetAuxDir( vtAux) ;
// Calcolo la mortasatura
if ( ! GenerateMortisingCl( pCompo, vtTool, dDepth, dElev, dOkStep, nPlunge))
// Calcolo la mortasatura
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
if ( ! GenerateMortisingCl( ptStart, ptEnd, vtTool, dDepth, dElev, dOkStep, nPlunge))
return false ;
}
@@ -1470,12 +1472,9 @@ Mortising::GenerateMortisingPv( int nPathId, const ICurveComposite* pCompo)
//----------------------------------------------------------------------------
bool
Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep, int nPlunge)
Mortising::GenerateMortisingCl( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, double dDepth, double dElev,
double dOkStep, int nPlunge, bool bFirst)
{
// estremi della curva composita
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
// compensazione elevazione/affondamento
double dDelta = dElev - dDepth ;
@@ -1490,9 +1489,11 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
GetElevation( m_nPhase, ptLi, vtTool, GetRadiusForStartEndElevation(), vtTool, dStartElev) ;
// 1 -> punto approccio
SetFlag( 1) ;
int nFirstFlag = bFirst ? 1 : 0 ;
SetFlag( nFirstFlag) ;
Point3d ptP1 = ( nPlunge != 2 ? ptStart : ptEnd) + vtTool * ( dDelta + dStartElev + dSafeZ) ;
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
int nStart = bFirst ? AddRapidStart( ptP1) : AddRapidMove( ptP1) ;
if ( nStart == GDB_ID_NULL)
return false ;
SetFlag( 0) ;
@@ -1512,7 +1513,7 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
// eseguo ciclo a seconda del tipo di step
Point3d ptLast ;
if ( nPlunge == 1) {
if ( nPlunge == 1 || nPlunge == 3) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
@@ -1592,7 +1593,7 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
// altrimenti ridetermino elevazione su fine percorso di lavoro
if ( ! bUnderEnd)
GetElevation( m_nPhase, ptLo, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndElev) ;
// 6 -> ritorno all'approccio
SetFeed( GetEndFeed()) ;
SetFlag( 104) ; // risalita sopra la fine
@@ -1600,11 +1601,38 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
if ( AddLinearMove( ptP6) == GDB_ID_NULL)
return false ;
// reset dati di movimento
ResetMoveData() ;
if ( nPlunge == 3) {
// incremento numero di mortasature
++ m_nMortises ;
Vector3d vtDir = ptEnd - ptStart ;
double dLen = vtDir.Len() ;
vtDir.Normalize() ;
int kMax = ( int) floor( dLen / m_TParams.m_dDiam) ;
for ( int k = 1 ; k <= kMax ; k ++) {
Point3d ptNewStart = ptStart + vtDir * k * m_TParams.m_dDiam ;
// se ultimo punto verifico non sia già quello finale
if ( k == kMax && AreSamePointEpsilon( ptNewStart, ptEnd, 10 * EPS_SMALL)) {
if ( ! GenerateMortisingCl( ptEnd, ptStart, vtTool, dDepth, dElev, dOkStep, 0, false))
return false ;
}
else {
if ( ! GenerateMortisingCl( ptNewStart, ptEnd, vtTool, dDepth, dElev, dOkStep, 1, false))
return false ;
}
}
// evenutale ultimo punto
Point3d ptLast = ptStart + vtDir * kMax * m_TParams.m_dDiam ;
if ( ! AreSamePointEpsilon( ptEnd, ptLast, 10 * EPS_SMALL))
if ( ! GenerateMortisingCl( ptEnd, ptStart, vtTool, dDepth, dElev, dOkStep, 0, false))
return false ;
}
if ( bFirst) {
// reset dati di movimento
ResetMoveData() ;
// incremento numero di mortasature
++ m_nMortises ;
}
return true ;
}
+2 -1
View File
@@ -74,7 +74,8 @@ class Mortising : public Machining
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dThick, double& dElev) const ;
bool GenerateMortisingPv( int nPathId, const ICurveComposite* pCompo) ;
bool GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep, int nPlunge) ;
bool GenerateMortisingCl( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep,
int nPlunge, bool bFirst = true) ;
double GetRadiusForStartEndElevation( void) const ;
private :