From 0f7805a9a13b43de4cef530e97bbffbb10f6baa6 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Sat, 31 Oct 2015 09:46:49 +0000 Subject: [PATCH] EgtExecutor 1.6j4 : - modifiche per gestione DB utensili e generatore codice CN. --- EXE_MachMgr.cpp | 336 ++++++++++++++----------- EgtExecutor.rc | Bin 11694 -> 11694 bytes LUA_GeomDB.cpp | 18 ++ LUA_MachMgr.cpp | 639 ++++++++++++++++++++++++++---------------------- 4 files changed, 561 insertions(+), 432 deletions(-) diff --git a/EXE_MachMgr.cpp b/EXE_MachMgr.cpp index e4082fc..d608faa 100644 --- a/EXE_MachMgr.cpp +++ b/EXE_MachMgr.cpp @@ -219,7 +219,7 @@ ExeGetCurrMachGroup( void) } //----------------------------------------------------------------------------- -// Raw Parts +// Raw Parts & Parts //----------------------------------------------------------------------------- int ExeGetRawPartCount( void) @@ -594,146 +594,26 @@ ExeShowOnlyTable( bool bVal) //----------------------------------------------------------------------------- int -ExeAddSubPiece( const string& sName, const Point3d& ptPos, double dAngRotDeg) +ExeAddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg) { GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_MACHMGR( pGseCtx, false) - // inserisco il sottopezzo nella posizione indicata - return pGseCtx->m_pMachMgr->AddSubPiece( sName, ptPos, dAngRotDeg) ; -} - -//----------------------------------------------------------------------------- -// Machine Calc -//----------------------------------------------------------------------------- -bool -ExeSetAxisPos( const string& sAxis, double dVal) -{ - GseContext* pGseCtx = GetCurrGseContext() ; - VERIFY_CTX_MACHMGR( pGseCtx, false) - // metto l'asse nella nuova posizione - return pGseCtx->m_pMachMgr->SetAxisPos( sAxis, dVal) ; -} - -//----------------------------------------------------------------------------- -bool -ExeGetAxisPos( const string& sAxis, double* pdVal) -{ - GseContext* pGseCtx = GetCurrGseContext() ; - VERIFY_CTX_MACHMGR( pGseCtx, false) - // verifico il parametro di ritorno - if ( pdVal == nullptr) - return false ; - // metto l'asse nella nuova posizione - return pGseCtx->m_pMachMgr->GetAxisPos( sAxis, *pdVal) ; -} - -//----------------------------------------------------------------------------- -bool -ExeGetAxisHomePos( const string& sAxis, double* pdHomeVal) -{ - GseContext* pGseCtx = GetCurrGseContext() ; - VERIFY_CTX_MACHMGR( pGseCtx, false) - // verifico il parametro di ritorno - if ( pdHomeVal == nullptr) - return false ; - // metto l'asse nella nuova posizione - return pGseCtx->m_pMachMgr->GetAxisHomePos( sAxis, *pdHomeVal) ; -} - -//----------------------------------------------------------------------------- -bool -ExeResetAxisPos( const string& sAxis) -{ - GseContext* pGseCtx = GetCurrGseContext() ; - VERIFY_CTX_MACHMGR( pGseCtx, false) - // metto l'asse nella posizione home - return pGseCtx->m_pMachMgr->ResetAxisPos( sAxis) ; -} - -//----------------------------------------------------------------------------- -bool -ExeLoadTool( const string& sHead, int nExit, const string& sTool) -{ - GseContext* pGseCtx = GetCurrGseContext() ; - VERIFY_CTX_MACHMGR( pGseCtx, false) - // carico l'utensile sulla macchina della macchinata corrente in posizione indicata - return pGseCtx->m_pMachMgr->LoadTool( sHead, nExit, sTool) ; -} - -//----------------------------------------------------------------------------- -bool -ExeResetHeadSet( const string& sHead) -{ - GseContext* pGseCtx = GetCurrGseContext() ; - VERIFY_CTX_MACHMGR( pGseCtx, false) - // carico l'utensile sulla macchina della macchinata corrente in posizione indicata - return pGseCtx->m_pMachMgr->ResetHeadSet( sHead) ; -} - -//----------------------------------------------------------------------------- -bool -ExeSetCalcTable( const std::string& sTable) -{ - GseContext* pGseCtx = GetCurrGseContext() ; - VERIFY_CTX_MACHMGR( pGseCtx, false) - // imposto la tavola corrente della macchinata corrente per i calcoli - return pGseCtx->m_pMachMgr->SetCalcTable( sTable) ; -} - -//----------------------------------------------------------------------------- -bool -ExeSetCalcTool( const std::string& sTool, const std::string& sHead, int nExit) -{ - GseContext* pGseCtx = GetCurrGseContext() ; - VERIFY_CTX_MACHMGR( pGseCtx, false) - // imposto l'utensile corrente per il calcolo sulla macchina della macchinata corrente - return pGseCtx->m_pMachMgr->SetCalcTool( sTool, sHead, nExit) ; -} - -//----------------------------------------------------------------------------- -bool -ExeGetCalcTool( std::string& sTool) -{ - GseContext* pGseCtx = GetCurrGseContext() ; - VERIFY_CTX_MACHMGR( pGseCtx, false) - // restituisco il nome dell'utensile corrente per il calcolo sulla macchina della macchinata corrente - return pGseCtx->m_pMachMgr->GetCalcTool( sTool) ; -} - -//----------------------------------------------------------------------------- -bool -ExeGetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA, - int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) -{ - GseContext* pGseCtx = GetCurrGseContext() ; - VERIFY_CTX_MACHMGR( pGseCtx, false) - // calcolo gli angoli macchina dalle direzioni fresa e ausiliaria passate - return pGseCtx->m_pMachMgr->GetCalcAngles( vtDirT, vtDirA, nStat, dAngA1, dAngB1, dAngA2, dAngB2) ; -} - -//----------------------------------------------------------------------------- -bool -ExeGetCalcPositions( const Point3d& ptP, double dAngA, double dAngB, - int& nStat, double& dX, double& dY, double& dZ) -{ - GseContext* pGseCtx = GetCurrGseContext() ; - VERIFY_CTX_MACHMGR( pGseCtx, false) - // calcolo gli angoli macchina dalla direzione fresa passata - return pGseCtx->m_pMachMgr->GetCalcPositions( ptP, dAngA, dAngB, nStat, dX, dY, dZ) ; -} - -//----------------------------------------------------------------------------- -bool -ExeVerifyOutOfStroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) -{ - GseContext* pGseCtx = GetCurrGseContext() ; - VERIFY_CTX_MACHMGR( pGseCtx, false) - // verifica l'extracorsa degli assi - return pGseCtx->m_pMachMgr->VerifyOutOfStroke( dX, dY, dZ, dAngA, dAngB, nStat) ; + // inserisco il dispositivo di presa nella posizione indicata + return pGseCtx->m_pMachMgr->AddFixture( sName, ptPos, dAngRotDeg) ; } //----------------------------------------------------------------------------- // DB utensili +//----------------------------------------------------------------------------- +bool +ExeTdbGetToolNewName( string& sName) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // recupero un nuovo nome a partire da quello passato + return pGseCtx->m_pMachMgr->TdbGetToolNewName( sName) ; +} + //----------------------------------------------------------------------------- bool ExeTdbAddTool( const string& sName, int nType) @@ -786,62 +666,82 @@ ExeTdbGetNextTool( int nFamily, string& sName, int& nType) //----------------------------------------------------------------------------- bool -ExeTdbSetToolParam( const string& sName, int nType, int nVal) +ExeTdbSetCurrTool( const std::string& sName) { GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_MACHMGR( pGseCtx, false) // imposta il parametro dell'utensile - return pGseCtx->m_pMachMgr->TdbSetToolParam( sName, nType, nVal) ; + return pGseCtx->m_pMachMgr->TdbSetCurrTool( sName) ; } //----------------------------------------------------------------------------- bool -ExeTdbSetToolParam( const string& sName, int nType, double dVal) +ExeTdbSaveCurrTool( void) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // imposta il parametro dell'utensile + return pGseCtx->m_pMachMgr->TdbSaveCurrTool() ; +} + +//----------------------------------------------------------------------------- +bool +ExeTdbSetCurrToolParam( int nType, int nVal) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // imposta il parametro dell'utensile + return pGseCtx->m_pMachMgr->TdbSetCurrToolParam( nType, nVal) ; +} + +//----------------------------------------------------------------------------- +bool +ExeTdbSetCurrToolParam( int nType, double dVal) { GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_MACHMGR( pGseCtx, false) // imposto il parametro dell'utensile - return pGseCtx->m_pMachMgr->TdbSetToolParam( sName, nType, dVal) ; + return pGseCtx->m_pMachMgr->TdbSetCurrToolParam( nType, dVal) ; } //----------------------------------------------------------------------------- bool -ExeTdbSetToolParam( const string& sName, int nType, const string& sVal) +ExeTdbSetCurrToolParam( int nType, const string& sVal) { GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_MACHMGR( pGseCtx, false) // imposto il parametro dell'utensile - return pGseCtx->m_pMachMgr->TdbSetToolParam( sName, nType, sVal) ; + return pGseCtx->m_pMachMgr->TdbSetCurrToolParam( nType, sVal) ; } //----------------------------------------------------------------------------- bool -ExeTdbGetToolParam( const string& sName, int nType, int& nVal) +ExeTdbGetCurrToolParam( int nType, int& nVal) { GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_MACHMGR( pGseCtx, false) // recupero il parametro dell'utensile - return pGseCtx->m_pMachMgr->TdbGetToolParam( sName, nType, nVal) ; + return pGseCtx->m_pMachMgr->TdbGetCurrToolParam( nType, nVal) ; } //----------------------------------------------------------------------------- bool -ExeTdbGetToolParam( const string& sName, int nType, double& dVal) +ExeTdbGetCurrToolParam( int nType, double& dVal) { GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_MACHMGR( pGseCtx, false) // recupero il parametro dell'utensile - return pGseCtx->m_pMachMgr->TdbGetToolParam( sName, nType, dVal) ; + return pGseCtx->m_pMachMgr->TdbGetCurrToolParam( nType, dVal) ; } //----------------------------------------------------------------------------- bool -ExeTdbGetToolParam( const string& sName, int nType, string& sVal) +ExeTdbGetCurrToolParam( int nType, string& sVal) { GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_MACHMGR( pGseCtx, false) // recupero il parametro dell'utensile - return pGseCtx->m_pMachMgr->TdbGetToolParam( sName, nType, sVal) ; + return pGseCtx->m_pMachMgr->TdbGetCurrToolParam( nType, sVal) ; } //----------------------------------------------------------------------------- @@ -1019,3 +919,147 @@ ExeSimStop( void) // termino la simulazione della macchinata corrente return pGseCtx->m_pMachMgr->SimStop() ; } + +//----------------------------------------------------------------------------- +// Generazione +//----------------------------------------------------------------------------- +bool +ExeGenerate( const string& sCncFile) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // avvio la generazione del partprogram della macchinata corrente + return pGseCtx->m_pMachMgr->Generate( sCncFile) ; +} + +//----------------------------------------------------------------------------- +// Machine Calc +//----------------------------------------------------------------------------- +bool +ExeSetCalcTable( const std::string& sTable) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // imposto la tavola corrente della macchinata corrente per i calcoli + return pGseCtx->m_pMachMgr->SetCalcTable( sTable) ; +} + +//----------------------------------------------------------------------------- +bool +ExeSetCalcTool( const std::string& sTool, const std::string& sHead, int nExit) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // imposto l'utensile corrente per il calcolo sulla macchina della macchinata corrente + return pGseCtx->m_pMachMgr->SetCalcTool( sTool, sHead, nExit) ; +} + +//----------------------------------------------------------------------------- +bool +ExeGetCalcTool( std::string& sTool) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // restituisco il nome dell'utensile corrente per il calcolo sulla macchina della macchinata corrente + return pGseCtx->m_pMachMgr->GetCalcTool( sTool) ; +} + +//----------------------------------------------------------------------------- +bool +ExeGetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA, + int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // calcolo gli angoli macchina dalle direzioni fresa e ausiliaria passate + return pGseCtx->m_pMachMgr->GetCalcAngles( vtDirT, vtDirA, nStat, dAngA1, dAngB1, dAngA2, dAngB2) ; +} + +//----------------------------------------------------------------------------- +bool +ExeGetCalcPositions( const Point3d& ptP, double dAngA, double dAngB, + int& nStat, double& dX, double& dY, double& dZ) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // calcolo gli angoli macchina dalla direzione fresa passata + return pGseCtx->m_pMachMgr->GetCalcPositions( ptP, dAngA, dAngB, nStat, dX, dY, dZ) ; +} + +//----------------------------------------------------------------------------- +bool +ExeVerifyOutOfStroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // verifica l'extracorsa degli assi + return pGseCtx->m_pMachMgr->VerifyOutOfStroke( dX, dY, dZ, dAngA, dAngB, nStat) ; +} + +//----------------------------------------------------------------------------- +// Machine Move +//----------------------------------------------------------------------------- +bool +ExeSetAxisPos( const string& sAxis, double dVal) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // metto l'asse nella nuova posizione + return pGseCtx->m_pMachMgr->SetAxisPos( sAxis, dVal) ; +} + +//----------------------------------------------------------------------------- +bool +ExeGetAxisPos( const string& sAxis, double* pdVal) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // verifico il parametro di ritorno + if ( pdVal == nullptr) + return false ; + // metto l'asse nella nuova posizione + return pGseCtx->m_pMachMgr->GetAxisPos( sAxis, *pdVal) ; +} + +//----------------------------------------------------------------------------- +bool +ExeGetAxisHomePos( const string& sAxis, double* pdHomeVal) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // verifico il parametro di ritorno + if ( pdHomeVal == nullptr) + return false ; + // metto l'asse nella nuova posizione + return pGseCtx->m_pMachMgr->GetAxisHomePos( sAxis, *pdHomeVal) ; +} + +//----------------------------------------------------------------------------- +bool +ExeResetAxisPos( const string& sAxis) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // metto l'asse nella posizione home + return pGseCtx->m_pMachMgr->ResetAxisPos( sAxis) ; +} + +//----------------------------------------------------------------------------- +bool +ExeLoadTool( const string& sHead, int nExit, const string& sTool) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // carico l'utensile sulla macchina della macchinata corrente in posizione indicata + return pGseCtx->m_pMachMgr->LoadTool( sHead, nExit, sTool) ; +} + +//----------------------------------------------------------------------------- +bool +ExeResetHeadSet( const string& sHead) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // carico l'utensile sulla macchina della macchinata corrente in posizione indicata + return pGseCtx->m_pMachMgr->ResetHeadSet( sHead) ; +} diff --git a/EgtExecutor.rc b/EgtExecutor.rc index fd1a11bf53433ce2880d031dd78643733c4634cb..c74dcd17258b68d803de076a48db895a84789648 100644 GIT binary patch delta 97 zcmZ1%y)JsgA2vpl%@@V4Gflq2na5}{Ignd-a{*Tk3sCf++-0W82LxfF21;&>n->Y| cF@rU@0x76sKgP|Iq`|@mn->Y| cF@rU@0x76sKgP|Iq`|@m