EgtGeomKernel :

- modifiche per aggiunta altezza tagliente di utensili per virtual milling.
This commit is contained in:
Dario Sassi
2020-04-15 09:45:36 +00:00
parent d96e356607
commit a2464c41cc
6 changed files with 65 additions and 19 deletions
+49 -7
View File
@@ -20,14 +20,15 @@
#include "/EgtDev/Include/EGkLinePntTgCurve.h"
#include "/EgtDev/Include/EGkFilletChamfer.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkIntersCurves.h"
#include <algorithm>
using namespace std ;
//----------------------------------------------------------------------------
Tool::Tool( bool bApproxWithLines)
: m_dLinTol( LIN_TOL_STD), m_dAngTolDeg( ANG_TOL_APPROX_DEG), m_nType( UNDEF), m_nCurrentNum( 0), m_dHeight( 0),
m_dTipHeight( 0), m_dRadius( 0), m_dRCorner( 0), m_dTipRadius( 0), m_dRefRadius( 0), m_dMrtChsWidth( 0), m_dMrtChsThickness( 0),
: m_dLinTol( LIN_TOL_STD), m_dAngTolDeg( ANG_TOL_APPROX_DEG), m_nType( UNDEF), m_nCurrentNum( 0), m_dHeight( 0), m_dTipHeight( 0),
m_dRadius( 0), m_dRCorner( 0), m_dTipRadius( 0), m_dRefRadius( 0), m_dCutterHeight( 0), m_dMrtChsWidth( 0), m_dMrtChsThickness( 0),
m_bApproxWithLines( bApproxWithLines)
{
}
@@ -70,7 +71,7 @@ Tool::SetTolerances( double dLinTol, double dAngTolDeg)
//----------------------------------------------------------------------------
bool
Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR, int nToolNum)
Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR, double dCutterH, int nToolNum)
{
// Impostazioni generali
m_sName = sToolName ;
@@ -78,6 +79,7 @@ Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR,
m_nType = UNDEF ;
m_Outline.Clear() ;
m_ArcLineApprox.Clear() ;
m_dCutterHeight = dCutterH ;
// verifica sulle minime dimensioni globali
if ( dH < EPS_SMALL || dR < EPS_SMALL || dCornR < - EPS_SMALL)
@@ -149,13 +151,17 @@ Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR,
else
return false ;
return true ;
// eventuali sistemazioni per altezza tagliente
if ( ModifyForCutterHeight())
return SetGenTool( sToolName, &m_Outline, nToolNum) ;
else
return true ;
}
//----------------------------------------------------------------------------
bool
Tool::SetAdvTool( const string& sToolName, double dH, double dR,
double dTipH, double dTipR, double dCornR, int nToolNum)
double dTipH, double dTipR, double dCornR, double dCutterH, int nToolNum)
{
// Impostazioni generali
m_sName = sToolName ;
@@ -163,6 +169,7 @@ Tool::SetAdvTool( const string& sToolName, double dH, double dR,
m_nType = UNDEF ;
m_Outline.Clear() ;
m_ArcLineApprox.Clear() ;
m_dCutterHeight = dCutterH ;
// Verifica dimensioni globali
if ( dH < EPS_SMALL || dR < EPS_SMALL || dTipH < - EPS_SMALL || dTipR < - EPS_SMALL || dCornR < - EPS_SMALL)
@@ -170,7 +177,7 @@ Tool::SetAdvTool( const string& sToolName, double dH, double dR,
// Se altezza punta nulla, ricado nel caso standard
if ( dTipH < EPS_SMALL || abs( dTipR - dR) < EPS_SMALL)
return SetStdTool( sToolName, dH, dR, dCornR, nToolNum) ;
return SetStdTool( sToolName, dH, dR, dCornR, dCutterH, nToolNum) ;
// Caso avanzato
m_dHeight = dH ;
@@ -197,7 +204,11 @@ Tool::SetAdvTool( const string& sToolName, double dH, double dR,
m_Outline.AddLine( pt2) ;
m_Outline.AddLine( Point3d( m_dTipRadius, - m_dHeight, 0)) ;
m_Outline.AddLine( pt5) ;
return true ;
// eventuali sistemazioni per altezza tagliente
if ( ModifyForCutterHeight())
return SetGenTool( sToolName, &m_Outline, nToolNum) ;
else
return true ;
}
// Altrimenti utensile generico
@@ -300,9 +311,40 @@ Tool::SetAdvTool( const string& sToolName, double dH, double dR,
m_Outline.AddLine( pt5) ;
}
// eventuali sistemazioni per altezza tagliente
ModifyForCutterHeight() ;
return SetGenTool( sToolName, &m_Outline, nToolNum) ;
}
//----------------------------------------------------------------------------
bool
Tool::ModifyForCutterHeight( void)
{
// Se altezza tagliente non definita o superiore alla altezza utensile non devo fare alcunché
if ( m_dCutterHeight < EPS_SMALL || m_dCutterHeight > m_dHeight - EPS_SMALL)
return false ;
// quota di taglio
double dYtrim = -m_dHeight + m_dCutterHeight ;
// linea di taglio
const double LEN_EXTRA = 10 ;
CurveLine clTrim ;
clTrim.SetPDL( Point3d( -LEN_EXTRA, dYtrim, 0), 0, max( m_dRadius, m_dTipRadius) + LEN_EXTRA) ;
// intersezione con il profilo
IntersCurveCurve intCC( m_Outline, clTrim) ;
int nInters = intCC.GetIntersCount() ;
if ( nInters > 0) {
IntCrvCrvInfo aInfo ;
intCC.GetIntCrvCrvInfo( nInters - 1, aInfo) ;
double dU = ( aInfo.bOverlap ? aInfo.IciA[1].dU : aInfo.IciA[0].dU) ;
m_Outline.TrimStartAtParam( dU) ;
m_Outline.AddLine( Point3d( 0, dYtrim, 0), false) ;
m_Outline.AddLine( ORIG, false) ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
Tool::SetSawTool( const string& sToolName, double dH, double dR,