EgtMachKernel 1.8b6 :

- migliorati controlli massimo materiale in fresatura e svuotatura.
This commit is contained in:
Dario Sassi
2017-02-27 10:21:21 +00:00
parent b251726fbe
commit 4ed628593e
5 changed files with 101 additions and 29 deletions
+55 -13
View File
@@ -45,6 +45,7 @@ using namespace std ;
// 2311 = "Error in Milling : Linear Approx not computable"
// 2312 = "Error in Milling : LeadIn must be out of rawpart"
// 2313 = "Error in Milling : Chaining failed"
// 2314 = "Error in Milling : Tool MaxMaterial too small (xx)"
//----------------------------------------------------------------------------
USEROBJ_REGISTER( "EMkMilling", Milling) ;
@@ -1240,17 +1241,43 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
else
return false ;
// verifico che lo step dell'utensile sia sensato
double dOkStep = m_Params.m_dStep ;
const double MIN_ZSTEP = 1.0 ;
if ( dOkStep < MIN_ZSTEP) {
dOkStep = MIN_ZSTEP ;
string sInfo = "Warning in Milling : machining step too small (" +
ToString( m_Params.m_dStep, 2) + ")" ;
LOG_INFO( GetEMkLogger(), sInfo.c_str()) ;
}
// per frese normali, verifico di non superare il massimo materiale
if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
const double MAXMAT_TOL = EPS_SMALL ;
if ( ( m_Params.m_dStep < EPS_SMALL && dElev > m_TParams.m_dMaxMat + MAXMAT_TOL) ||
( m_Params.m_dStep > EPS_SMALL && m_Params.m_dStep > m_TParams.m_dMaxMat + EPS_SMALL)) {
// verifico che il massimo materiale dell'utensile sia sensato
const double MIN_MAXMAT = 1.0 ;
if ( m_TParams.m_dMaxMat < dElev && m_TParams.m_dMaxMat < MIN_MAXMAT) {
string sInfo = "Error in Milling : Tool MaxMaterial too small (" +
ToString( m_TParams.m_dMaxMat, 2) + ")" ;
m_pMchMgr->SetLastError( 2314, sInfo) ;
return false ;
}
// se lo step supera la capacità dell'utensile
if ( m_Params.m_dStep > m_TParams.m_dMaxMat + EPS_SMALL) {
dOkStep = m_TParams.m_dMaxMat ;
string sInfo = "Warning in Milling : machining step (" + ToString( m_Params.m_dStep, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
LOG_INFO( GetEMkLogger(), sInfo.c_str()) ;
}
// se lavorazione singola e l'elevazione supera la capacità dell'utensile
if ( ( dOkStep < EPS_SMALL || dOkStep > dElev) && dElev > m_TParams.m_dMaxMat + EPS_SMALL) {
// se affondamento riducibile : segnalo, riduco e continuo
if ( dDepth + max( dThick, 0.0) > m_TParams.m_dMaxMat) {
dDepth = m_TParams.m_dMaxMat - max( dThick, 0.0) ;
string sInfo = "Warning in Milling : machining depth (" + ToString( dElev, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
LOG_INFO( GetEMkLogger(), sInfo.c_str()) ;
}
// altrimenti errore
else {
string sInfo = "Error in Milling : machining depth (" + ToString( dElev, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
@@ -1298,18 +1325,18 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
SetToolDir( vtTool) ;
// Se una sola passata
if ( m_Params.m_dStep < EPS_SMALL || dElev <= m_Params.m_dStep) {
if ( dOkStep < EPS_SMALL || dElev <= dOkStep) {
if ( ! AddStandardMilling( pCompo, vtTool, vtExtr, dDepth, dElev, bSplitArcs))
return false ;
}
// se altrimenti passate a zig-zag
else if ( m_Params.m_nStepType == MILL_ST_ZIGZAG) {
if ( ! AddZigZagMilling( pCompo, vtTool, vtExtr, dDepth, dElev, bSplitArcs))
if ( ! AddZigZagMilling( pCompo, vtTool, vtExtr, dDepth, dElev, dOkStep, bSplitArcs))
return false ;
}
// se altrimenti passate a one-way
else if ( m_Params.m_nStepType == MILL_ST_ONEWAY) {
if ( ! AddOneWayMilling( pCompo, vtTool, vtExtr, dDepth, dElev, bSplitArcs))
if ( ! AddOneWayMilling( pCompo, vtTool, vtExtr, dDepth, dElev, dOkStep, bSplitArcs))
return false ;
}
// se altrimenti passate a spirale
@@ -1321,7 +1348,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
pCompo->TrimEndAtLen( dLen - m_Params.m_dOverlap) ;
}
// eseguo
if ( ! AddSpiralMilling( pCompo, vtTool, vtExtr, dDepth, dElev, bSplitArcs))
if ( ! AddSpiralMilling( pCompo, vtTool, vtExtr, dDepth, dElev, dOkStep, bSplitArcs))
return false ;
}
@@ -1639,7 +1666,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
//----------------------------------------------------------------------------
bool
Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, bool bSplitArcs)
double dDepth, double dElev, double dOkStep, bool bSplitArcs)
{
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
@@ -1647,7 +1674,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
double dAppr = m_Params.m_dStartPos ;
// determino numero e affondamento degli step
int nStep = max( 1, static_cast<int>( ceil( dElev / m_Params.m_dStep))) ;
int nStep = max( 1, static_cast<int>( ceil( dElev / dOkStep))) ;
double dStep = dElev / nStep ;
bool bClosed = pCompo->IsClosed() ;
@@ -1779,7 +1806,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
//----------------------------------------------------------------------------
bool
Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, bool bSplitArcs)
double dDepth, double dElev, double dOkStep, bool bSplitArcs)
{
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
@@ -1787,7 +1814,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
double dAppr = m_Params.m_dStartPos ;
// determino numero e affondamento degli step
int nStep = max( 1, static_cast<int>( ceil( dElev / m_Params.m_dStep))) ;
int nStep = max( 1, static_cast<int>( ceil( dElev / dOkStep))) ;
double dStep = dElev / nStep ;
bool bClosed = pCompo->IsClosed() ;
@@ -1900,7 +1927,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
//----------------------------------------------------------------------------
bool
Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, bool bSplitArcs)
double dDepth, double dElev, double dOkStep, bool bSplitArcs)
{
// recupero distanza di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
@@ -1912,7 +1939,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
dStart = m_Params.m_dLiElev ;
// determino numero e affondamento degli step
int nStep = max( 1, static_cast<int>( ceil( ( dElev + dStart) / m_Params.m_dStep))) ;
int nStep = max( 1, static_cast<int>( ceil( ( dElev + dStart) / dOkStep))) ;
double dStep = ( dElev + dStart) / nStep ;
// determino dati del percorso
@@ -2299,6 +2326,9 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
// senso di rotazione da dir tg a dir esterna
bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) ||
( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ;
// !!! provvisorio : GLIDE, ZIGZAG e HELIX -> NONE !!!
if ( nType == MILL_LI_GLIDE || nType == MILL_LI_ZIGZAG || nType == MILL_LI_HELIX)
nType = MILL_LI_NONE ;
// Calcolo punto iniziale
switch ( nType) {
case MILL_LI_NONE :
@@ -2314,6 +2344,12 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
case MILL_LI_GLIDE :
// !!! DA FARE !!!
return false ;
case MILL_LI_ZIGZAG :
// !!! DA FARE !!!
return false ;
case MILL_LI_HELIX :
// !!! DA FARE !!!
return false ;
default :
return false ;
}
@@ -2346,6 +2382,9 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
// se parametri tg e perp entrambi nulli, allora nessun attacco
if ( (( ptStart - ptP1) ^ vtN).IsSmall())
nType = MILL_LI_NONE ;
// !!! provvisorio : GLIDE, ZIGZAG e HELIX -> NONE !!!
if ( nType == MILL_LI_GLIDE || nType == MILL_LI_ZIGZAG || nType == MILL_LI_HELIX)
nType = MILL_LI_NONE ;
// Eseguo a seconda del tipo
switch ( nType) {
case MILL_LI_NONE :
@@ -2455,6 +2494,9 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
// senso di rotazione da dir tg a dir esterna
bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) ||
( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ;
// !!! provvisorio : GLIDE -> NONE !!!
if ( nType == MILL_LO_GLIDE)
nType = MILL_LO_NONE ;
// eseguo a seconda del tipo
switch ( nType) {
case MILL_LO_NONE :