EgtExecutor 1.8f4 :
- aggiunte Exe e Lua UpdateMachining e UpdateAllMachinings.
This commit is contained in:
+66
-3
@@ -2133,7 +2133,7 @@ ExePreviewMachining( bool bRecalc)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// imposto la geometria alla lavorazione corrente
|
||||
// eseguo il ricalcolo del preview sulla lavorazione corrente
|
||||
bool bOk = pMachMgr->MachiningPreview( bRecalc) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
@@ -2151,7 +2151,7 @@ ExeApplyMachining( bool bRecalc)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// imposto la geometria alla lavorazione corrente
|
||||
// ricalcolo la lavorazione corrente
|
||||
bool bOk = pMachMgr->MachiningApply( bRecalc) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
@@ -2163,6 +2163,24 @@ ExeApplyMachining( bool bRecalc)
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeUpdateMachining( void)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// aggiorno assi macchina e collegamento con precedente della lavorazione corrente
|
||||
bool bOk = pMachMgr->MachiningUpdate() ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtUpdateMachining()" +
|
||||
string( " -- Ok=") + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetMachiningParam( int nType, bool& bVal)
|
||||
@@ -2245,7 +2263,7 @@ ExeGetMachiningEndPoint( Point3d& ptEnd)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeUpdateAllMachinings( bool bStopOnFirstErr, string& sErrList)
|
||||
ExeApplyAllMachinings( bool bStopOnFirstErr, string& sErrList)
|
||||
{
|
||||
sErrList.clear() ;
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
@@ -2288,6 +2306,51 @@ ExeUpdateAllMachinings( bool bStopOnFirstErr, string& sErrList)
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeUpdateAllMachinings( bool bStopOnFirstErr, string& sErrList)
|
||||
{
|
||||
sErrList.clear() ;
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, false)
|
||||
// Recupero fase corrente e lavorazione corrente della macchinata corrente
|
||||
int nCurrPhase = pMachMgr->GetCurrPhase() ;
|
||||
int nCurrMach = pMachMgr->GetCurrMachining() ;
|
||||
// Eseguo ricalcolo ordinato di assi macchina e link per tutte le operazioni attive in lista
|
||||
bool bOk = true ;
|
||||
int nOperId = pMachMgr->GetFirstActiveOperation() ;
|
||||
while ( nOperId != GDB_ID_NULL) {
|
||||
if ( pMachMgr->GetOperationType( nOperId) == OPER_DISP) {
|
||||
pMachMgr->SetCurrPhase( pMachMgr->GetOperationPhase( nOperId)) ;
|
||||
if ( ! pMachMgr->DispositionSpecialUpdate( nOperId)) {
|
||||
bOk = false ;
|
||||
if ( pMachMgr->GetLastErrorId() != 0)
|
||||
sErrList += pMachMgr->GetLastErrorString() + "\r\n" ;
|
||||
if ( bStopOnFirstErr)
|
||||
break ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
pMachMgr->SetCurrMachining( nOperId) ;
|
||||
if ( ! pMachMgr->MachiningUpdate()) {
|
||||
bOk = false ;
|
||||
if ( pMachMgr->GetLastErrorId() != 0)
|
||||
sErrList += pMachMgr->GetLastErrorString() + "\r\n" ;
|
||||
if ( bStopOnFirstErr)
|
||||
break ;
|
||||
}
|
||||
}
|
||||
nOperId = pMachMgr->GetNextActiveOperation( nOperId) ;
|
||||
}
|
||||
// Ripristino fase e lavorazione inizialmente correnti
|
||||
pMachMgr->SetCurrPhase( nCurrPhase) ;
|
||||
if ( nCurrMach != GDB_ID_NULL)
|
||||
pMachMgr->SetCurrMachining( nCurrMach) ;
|
||||
else
|
||||
pMachMgr->ResetCurrMachining() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Simulazione
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Binary file not shown.
@@ -2373,6 +2373,19 @@ LuaApplyMachining( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaUpdateMachining( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// aggiorno assi macchina e collegamento con operazione precedente per la lavorazione corrente
|
||||
bool bOk = ExeUpdateMachining() ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetMachiningGeometry( lua_State* L)
|
||||
@@ -2437,6 +2450,26 @@ LuaGetMachiningEndPoint( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaApplyAllMachinings( lua_State* L)
|
||||
{
|
||||
// 1 o nessun parametro : [bStopOnFirstErr]
|
||||
bool bStopOnFirstErr = false ;
|
||||
LuaGetParam( L, 1, bStopOnFirstErr) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo ricalcolo delle lavorazioni
|
||||
string sErrList ;
|
||||
bool bOk = ExeApplyAllMachinings( bStopOnFirstErr, sErrList) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
if ( ! bOk)
|
||||
LuaSetParam( L, sErrList) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaUpdateAllMachinings( lua_State* L)
|
||||
@@ -3343,11 +3376,13 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetMachiningGeometry", LuaSetMachiningGeometry) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPreviewMachining", LuaPreviewMachining) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtApplyMachining", LuaApplyMachining) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtUpdateMachining", LuaUpdateMachining) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningParam", LuaGetMachiningParam) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningGeometry", LuaGetMachiningGeometry) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtIsMachiningEmpty", LuaIsMachiningEmpty) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningStartPoint", LuaGetMachiningStartPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningEndPoint", LuaGetMachiningEndPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtApplyAllMachinings", LuaApplyAllMachinings) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtUpdateAllMachinings", LuaUpdateAllMachinings) ;
|
||||
// Simulation
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSimStart", LuaSimStart) ;
|
||||
|
||||
Reference in New Issue
Block a user