EgtMachKernel (NewLink) :

- correzione a funzione SpecialLink e aggiunto parametro a funzione GetDoubleToolData.
This commit is contained in:
Riccardo Elitropi
2026-03-19 09:52:01 +01:00
parent b418e2d3ef
commit 708fe02b9b
9 changed files with 42 additions and 35 deletions
+1 -1
View File
@@ -89,7 +89,7 @@ class Disposition : public Operation
const std::string& GetHeadName( void) const override ;
int GetExitNbr( void) const override ;
const std::string& GetToolTcPos( void) const override ;
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblHead, int& nDblExit) const override
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const override
{ return false ; }
int GetSolCh( void) const override
{ return 0 ; }
+2 -2
View File
@@ -753,8 +753,8 @@ Drilling::Update( bool bPostApply)
// elimino le entità CLIMB, RISE e HOME della lavorazione in doppio
RemoveClimbRiseHome( false) ;
// recupero i dati della testa in doppio e la imposto
string sDblTool ; string sDblHead ; int nDblExit ;
bool bOk = GetDoubleToolData( sDblTool, sDblHead, nDblExit) &&
string sDblTool ; string sDblTcPos ; string sDblHead ; int nDblExit ;
bool bOk = GetDoubleToolData( sDblTool, sDblTcPos, sDblHead, nDblExit) &&
m_pMchMgr->SetCalcTool( sDblTool, sDblHead, nDblExit) ;
// imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis, true) ;
+7 -8
View File
@@ -304,14 +304,14 @@ Machining::MyPrepareToolPreview( bool bDouble)
return false ;
// se necessario, imposto l'utensile corrente
string sTool, sHead ;
string sTool, sTcPos, sHead ;
int nExitDBLId ;
if ( ! bDouble) {
sTool = GetToolName() ;
sHead = GetHeadName() ;
}
else {
if ( ! GetDoubleToolData( sTool, sHead, nExitDBLId))
if ( ! GetDoubleToolData( sTool, sTcPos, sHead, nExitDBLId))
return false ;
}
@@ -646,8 +646,8 @@ Machining::PrepareToolPreview( void)
}
if ( bOk && nStdIdDBL != GDB_ID_NULL) {
// imposto l'utensile per la lavorazione in doppio
string sTool, sHead ; int nDblExit ;
bOk = ( GetDoubleToolData( sTool, sHead, nDblExit)) ;
string sTool, sTcPos, sHead ; int nDblExit ;
bOk = ( GetDoubleToolData( sTool, sTcPos, sHead, nDblExit)) ;
if ( bOk) {
bool bOkToolSet = ( m_pMchMgr->SetCalcTool( sTool, sHead, nDblExit)) ;
bOk = bOkToolSet && MyPrepareToolPreview( true) && MyChangeToolPreviewShow( m_nLookFlag, true) ;
@@ -833,8 +833,8 @@ Machining::MyToolPreview( int nEntId, bool bDouble) const
if ( ! bDouble)
m_pMchMgr->GetAllCurrAxesNames( vAxNames) ;
else {
string sDBLTool, sDBLHead ; int nDBLExit ;
bool bOk = ( GetDoubleToolData( sDBLTool, sDBLHead, nDBLExit) && m_pMchMgr->SetCalcTool( sDBLTool, sDBLHead, nDBLExit)) ;
string sDBLTool, sDBLTcPos, sDBLHead ; int nDBLExit ;
bool bOk = ( GetDoubleToolData( sDBLTool, sDBLTcPos, sDBLHead, nDBLExit) && m_pMchMgr->SetCalcTool( sDBLTool, sDBLHead, nDBLExit)) ;
if ( bOk)
m_pMchMgr->GetAllCurrAxesNames( vAxNames) ;
m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()) ;
@@ -1020,7 +1020,7 @@ Machining::GetDoubleType( const string& sUserNotes)
//----------------------------------------------------------------------------
bool
Machining::GetDoubleToolData( string& sDblTool, string& sDblHead, int& nDblExit) const
Machining::GetDoubleToolData( string& sDblTool, string& sDblTcPos, string& sDblHead, int& nDblExit) const
{
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
return false ;
@@ -1031,7 +1031,6 @@ Machining::GetDoubleToolData( string& sDblTool, string& sDblHead, int& nDblExit)
// recupero dati utensile in doppio
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)
+1 -1
View File
@@ -62,7 +62,7 @@ class Machining : public Operation
bool SpecialApply( std::string& sErr) ;
bool PostApply( std::string& sErr) ;
int GetDoubleType( const std::string& sUserNotes) ;
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblHead, int& nDblExit) const override ;
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const override ;
bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) ;
bool ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const ;
+2 -2
View File
@@ -910,8 +910,8 @@ Milling::Update( bool bPostApply)
// elimino le entità CLIMB, RISE e HOME della lavorazione in doppio
RemoveClimbRiseHome( false) ;
// recupero i dati della testa in doppio e la imposto
string sDblTool ; string sDblHead ; int nDblExit ;
bool bOk = GetDoubleToolData( sDblTool, sDblHead, nDblExit) &&
string sDblTool ; string sTcPos; string sDblHead ; int nDblExit ;
bool bOk = GetDoubleToolData( sDblTool, sTcPos, sDblHead, nDblExit) &&
m_pMchMgr->SetCalcTool( sDblTool, sDblHead, nDblExit) ;
// imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis, true) ;
+24 -16
View File
@@ -3503,7 +3503,7 @@ bool
Operation::ManageDoubleOperNew( Operation* pPrevOpe)
{
// recupero i dati della lavorazione precedente
string sPrevTool, sPrevHead ; int nPrevExitNbr ;
string sPrevTool, sPrevTcPos, sPrevHead ; int nPrevExitNbr ;
string sPrevDblTool, sPrevDblHead ; int nPrevDblExitNbr ;
bool bPrevInDouble = false ;
if ( pPrevOpe != nullptr && ! pPrevOpe->IsEmpty( NEED_ONE_TP_OK)) {
@@ -3513,15 +3513,15 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
bPrevInDouble = ( pPrevOpe->GetFirstFullToolpath( false) != GDB_ID_NULL) ;
}
if ( bPrevInDouble) {
if ( ! pPrevOpe->GetDoubleToolData( sPrevDblTool, sPrevDblHead, nPrevDblExitNbr))
if ( ! pPrevOpe->GetDoubleToolData( sPrevDblTool, sPrevTcPos, sPrevDblHead, nPrevDblExitNbr))
return false ;
}
// verifico se la lavorazione corrente è singola e in caso contrario recupero i dati della testa in doppio
string sCurrDblTool, sCurrDblHead ; int nCurrDblExitNbr ;
string sCurrDblTool, sCurrTcPos, sCurrDblHead ; int nCurrDblExitNbr ;
bool bCurrInDouble = ( GetFirstFullToolpath( false) != GDB_ID_NULL) ;
if ( bCurrInDouble) {
if ( ! GetDoubleToolData( sCurrDblTool, sCurrDblHead, nCurrDblExitNbr))
if ( ! GetDoubleToolData( sCurrDblTool, sCurrTcPos, sCurrDblHead, nCurrDblExitNbr))
return false ;
}
@@ -3620,7 +3620,7 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
if ( ! MoveHeadFromMachToMach( pPrevOpe, true, sPrevTool, sPrevHead, nPrevExitNbr,
true, GetToolName(), GetHeadName(), GetExitNbr(), false))
return false ;
// Porto la testa double delle lavorazione precednete alla lavorazine corrente
// Porto la testa double delle lavorazione precedente alla lavorazine corrente
if ( ! MoveHeadFromMachToMach( pPrevOpe, false, sPrevDblTool, sPrevDblHead, nPrevDblExitNbr,
false, sCurrDblTool, sCurrDblHead, nCurrDblExitNbr, false))
return false ;
@@ -4340,9 +4340,9 @@ Operation::ToolChangeNeeded( const Operation& Ope1, bool bMain1, const Operation
// se confronto il principale di Ope1 con il secondario di Ope2
else if ( bMain1 && ! bMain2) {
// verifico che la seconda operazione sia in doppio
string sDblTool2, sDblHead2 ;
string sDblTool2, sDblTcPos2, sDblHead2 ;
int nDblExitNbr2 ;
if ( ! Ope2.GetDoubleToolData( sDblTool2, sDblHead2, nDblExitNbr2))
if ( ! Ope2.GetDoubleToolData( sDblTool2, sDblTcPos2, sDblHead2, nDblExitNbr2))
return true ;
// se non cambia l'utensile, non cambia la testa fisica
if ( EqualNoCase( Ope1.GetToolName(), sDblTool2))
@@ -4354,9 +4354,9 @@ Operation::ToolChangeNeeded( const Operation& Ope1, bool bMain1, const Operation
// se confronto il secondario di Ope1 con il principale di Ope2
else if ( ! bMain1 && bMain2) {
// verifico che la prima operazione sia in doppio
string sDblTool1, sDblHead1 ;
string sDblTool1, sDblTcPos1, sDblHead1 ;
int nDblExitNbr1 ;
if ( ! Ope1.GetDoubleToolData( sDblTool1, sDblHead1, nDblExitNbr1))
if ( ! Ope1.GetDoubleToolData( sDblTool1, sDblTcPos1, sDblHead1, nDblExitNbr1))
return true ;
// se non cambia l'utensile, non cambia la testa fisica
if ( EqualNoCase( sDblTool1, Ope2.GetToolName()))
@@ -4368,10 +4368,10 @@ Operation::ToolChangeNeeded( const Operation& Ope1, bool bMain1, const Operation
// se confronto utensili secondari
else {
// verifico che le due lavorazioni siano in doppio
string sDblTool1, sDblTool2, sDblHead1, sDblHead2 ;
string sDblTool1, sDblTool2, sDblTcPos1, sDblTcPos2, sDblHead1, sDblHead2 ;
int nDblExitNbr1, nDblExitNbr2 ;
if ( ! Ope1.GetDoubleToolData( sDblTool1, sDblHead1, nDblExitNbr1) ||
! Ope2.GetDoubleToolData( sDblTool2, sDblHead2, nDblExitNbr2))
if ( ! Ope1.GetDoubleToolData( sDblTool1, sDblTcPos1, sDblHead1, nDblExitNbr1) ||
! Ope2.GetDoubleToolData( sDblTool2, sDblTcPos2, sDblHead2, nDblExitNbr2))
return true ;
// se non cambia l'utensile, non cambia la testa fisica
if ( EqualNoCase( sDblTool1, sDblTool2))
@@ -5927,10 +5927,18 @@ Operation::SpecialLink( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TOOL, GetToolName()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_HEAD, GetHeadName()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_EXIT, GetExitNbr()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TCPOS, GetToolTcPos()) ;
string sToolName = GetToolName() ;
string sHeadName = GetHeadName() ;
int nExitNbr = GetExitNbr() ;
string sTcPos = GetToolTcPos() ;
if ( ( pPrevOpe != nullptr && ! bPrevMain) || ( pNextOpe != nullptr && ! bNextMain)) {
if ( ! GetDoubleToolData( sToolName, sTcPos, sHeadName, nExitNbr))
return false ;
}
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TOOL, sToolName) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_HEAD, sHeadName) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_EXIT, nExitNbr) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TCPOS, sTcPos) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PREVMCHID, ( pPrevOpe != nullptr ? pPrevOpe->GetOwner() : GDB_ID_NULL)) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PREVMAIN, ( bPrevMain ? MCH_CL : MCH_DBL)) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PREVPHASE, ( pPrevOpe != nullptr ? pPrevOpe->m_nPhase : 0)) ;
+1 -1
View File
@@ -63,7 +63,7 @@ class Operation : public IUserObj
virtual int GetExitNbr( void) const = 0 ;
virtual int GetSolCh( void) const = 0 ;
virtual const std::string& GetToolTcPos( void) const = 0 ;
virtual bool GetDoubleToolData( std::string& sDblTool, std::string& sDblHead, int& nDblExit) const = 0 ;
virtual bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const = 0 ;
virtual bool NeedPrevHome( void) const = 0 ;
virtual bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
{ return true ; }
+2 -2
View File
@@ -781,8 +781,8 @@ Pocketing::Update( bool bPostApply)
// elimino le entità CLIMB, RISE e HOME della lavorazione in doppio
RemoveClimbRiseHome( false) ;
// recupero i dati della testa in doppio e la imposto
string sDblTool ; string sDblHead ; int nDblExit ;
bool bOk = GetDoubleToolData( sDblTool, sDblHead, nDblExit) &&
string sDblTool ; string sDblTcPos ; string sDblHead ; int nDblExit ;
bool bOk = GetDoubleToolData( sDblTool, sDblTcPos, sDblHead, nDblExit) &&
m_pMchMgr->SetCalcTool( sDblTool, sDblHead, nDblExit) ;
// imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis, true) ;
+2 -2
View File
@@ -858,8 +858,8 @@ PocketingNT::Update( bool bPostApply)
// elimino le entità CLIMB, RISE e HOME della lavorazione in doppio
RemoveClimbRiseHome( false) ;
// recupero i dati della testa in doppio e la imposto
string sDblTool ; string sDblHead ; int nDblExit ;
bool bOk = GetDoubleToolData( sDblTool, sDblHead, nDblExit) &&
string sDblTool ; string sDblTcPos ; string sDblHead ; int nDblExit ;
bool bOk = GetDoubleToolData( sDblTool, sDblTcPos, sDblHead, nDblExit) &&
m_pMchMgr->SetCalcTool( sDblTool, sDblHead, nDblExit) ;
// imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis, true) ;