EgtMachKernel :

- aggiustamenti per lavorazioni in doppio.
This commit is contained in:
Dario Sassi
2025-11-17 08:53:14 +01:00
parent ae9bc56917
commit 286a9906b7
8 changed files with 167 additions and 57 deletions
+28 -34
View File
@@ -392,34 +392,32 @@ Machining::ToolPreview( int nEntId, int nStep) const
return nEntId ;
}
//----------------------------------------------------------------------------
int
Machining::GetDoubleType( const string& sUserNotes)
{
int nDouble ;
if ( ! GetValInNotes( sUserNotes, UN_DOUBLE, nDouble) ||
( nDouble != 1 && nDouble != 2 && nDouble != 3))
return 0 ;
else
return nDouble ;
}
//----------------------------------------------------------------------------
bool
Machining::CalcMirrorByDouble( int nClId, const string& sUserNotes)
Machining::GetDoubleToolData( string& sDblTool, string& sDblHead, int& nDblExit)
{
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
return false ;
// recupero macchina corrente
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr)
return false ;
// verifico se prevista lavorazione in doppio
int nDouble ;
if ( ! GetValInNotes( sUserNotes, UN_DOUBLE, nDouble) ||
( nDouble != 1 && nDouble != 2 && nDouble != 3))
return true ;
// recupero dati utensile principale
string sMainTool ; string sMainHead ; int nMainExit ;
if ( ! pMch->GetCurrTool( sMainTool) || ! pMch->GetCurrHead( sMainHead) || ! pMch->GetCurrExit( nMainExit))
return false ;
// recupero dati utensile in doppio
string sDblTool ; string sDblHead ; int nDblExit ; string sDblTcPos ;
if ( ! GetValInNotes( GetToolData().m_sUserNotes, "DOUBLE", sDblTool))
return false ;
string sDblTcPos ;
if ( ! m_pMchMgr->GetCurrSetupMgr().GetToolData( sDblTool, sDblTcPos, sDblHead, nDblExit)) {
const ToolData* pTdata = pTMgr->GetTool( sDblTool) ;
if ( pTdata == nullptr)
@@ -427,6 +425,20 @@ Machining::CalcMirrorByDouble( int nClId, const string& sUserNotes)
sDblHead = pTdata->m_sHead ;
nDblExit = pTdata->m_nExit ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Machining::CalcMirrorByDouble( int nClId, const string& sUserNotes)
{
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
return false ;
// verifico se prevista lavorazione in doppio
int nDouble = GetDoubleType( sUserNotes) ;
if ( nDouble == 0)
return true ;
// assegno Id entità originali
int nPathId = m_pGeomDB->GetFirstNameInGroup( nClId, MCH_PATH + "*") ;
@@ -499,24 +511,6 @@ Machining::CalcMirrorByDouble( int nClId, const string& sUserNotes)
if ( GetValInNotes( sUserNotes, UN_DELTAZ, dDeltaZ) && abs( dDeltaZ) > EPS_SMALL)
m_pGeomDB->TranslateGlob( nDblId, Vector3d( 0, 0, dDeltaZ)) ;
// elimino approcci e retrazioni (CLIMB e RISE)
RemoveClimbRiseHome( false) ;
// imposto testa in doppio
if ( ! pMch->SetCurrTool( sDblTool, sDblHead, nDblExit))
return false ;
// calcolo gli assi macchina
string sHint = ExtractHint( sUserNotes) ;
string sInitAngs ;
if ( GetParam( MPA_INITANGS, sInitAngs) && ! sInitAngs.empty())
sHint = sInitAngs ;
if ( ! CalculateDoubleAxesValues( sHint))
return false ;
// ripristino testa principale
pMch->SetCurrTool( sMainTool, sMainHead, nMainExit) ;
return true ;
}