EgtExecutor 1.8k4 :

- a ApplyAllMachinings di Exe e Lua aggiunto parametro di ricalcolo
- in Lua corretta EgtSetInfo con stringhe numeriche.
This commit is contained in:
Dario Sassi
2017-12-02 18:38:30 +00:00
parent a3f5a10e14
commit 1fd62c7180
4 changed files with 46 additions and 40 deletions
+8 -6
View File
@@ -2340,7 +2340,7 @@ ExeGetMachiningEndPoint( Point3d& ptEnd)
//-----------------------------------------------------------------------------
bool
ExeApplyAllMachinings( bool bStopOnFirstErr, string& sErrList)
ExeApplyAllMachinings( bool bRecalc, bool bStopOnFirstErr, string& sErrList)
{
sErrList.clear() ;
IMachMgr* pMachMgr = GetCurrMachMgr() ;
@@ -2357,7 +2357,7 @@ ExeApplyAllMachinings( bool bStopOnFirstErr, string& sErrList)
while ( nOperId != GDB_ID_NULL) {
if ( pMachMgr->GetOperationType( nOperId) == OPER_DISP) {
pMachMgr->SetCurrPhase( pMachMgr->GetOperationPhase( nOperId)) ;
if ( ! pMachMgr->DispositionSpecialApply( nOperId, true)) {
if ( ! pMachMgr->DispositionSpecialApply( nOperId, bRecalc)) {
bOk = false ;
if ( pMachMgr->GetLastErrorId() != 0)
sErrList += pMachMgr->GetOperationName( nOperId) + " -> " + pMachMgr->GetLastErrorString() + "\r\n" ;
@@ -2367,7 +2367,7 @@ ExeApplyAllMachinings( bool bStopOnFirstErr, string& sErrList)
}
else {
pMachMgr->SetCurrMachining( nOperId) ;
if ( ! pMachMgr->MachiningApply( true)) {
if ( ! pMachMgr->MachiningApply( bRecalc, true)) {
bOk = false ;
if ( pMachMgr->GetLastErrorId() != 0) {
sErrList += pMachMgr->GetOperationName( nOperId) + " -> " + pMachMgr->GetLastErrorString() ;
@@ -2390,11 +2390,13 @@ ExeApplyAllMachinings( bool bStopOnFirstErr, string& sErrList)
pMachMgr->ResetCurrMachining() ;
// Ripristino stato visualizzazione macchina
pMachMgr->SetMachineLook( nCurrLook) ;
// Progetto modificato
ExeSetModified() ;
// Se richiesto ricalcolo, progetto modificato
if ( bRecalc)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtApplyAllMachinings(" + string( bStopOnFirstErr ? "true" : "false") + ")" +
string sLua = "EgtApplyAllMachinings(" + string( bRecalc ? "true" : "false") + ")" +
string( bStopOnFirstErr ? "true" : "false") + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
BIN
View File
Binary file not shown.
+33 -31
View File
@@ -498,40 +498,42 @@ LuaSetInfo( lua_State* L)
string sKey ;
LuaCheckParam( L, 2, sKey)
bool bOk = false ;
if ( lua_isboolean( L, 3)) {
bool bVal ;
LuaGetParam( L, 3, bVal) ;
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, bVal) ;
}
else if ( lua_isnumber( L, 3)) {
double dVal ;
LuaGetParam( L, 3, dVal) ;
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, dVal) ;
}
else if ( lua_isstring( L, 3)) {
string sVal ;
LuaGetParam( L, 3, sVal) ;
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, sVal) ;
}
else if ( lua_istable( L, 3)) {
Frame3d frVal ;
BBox3d b3Val ;
Vector3d vtVal ; // va bene anche per Point3d
if ( LuaGetParam( L, 3, frVal)) {
switch ( lua_type( L, 3)) {
case LUA_TBOOLEAN :
{ bool bVal ;
LuaGetParam( L, 3, bVal) ;
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, frVal) ;
}
else if ( LuaGetParam( L, 3, b3Val)) {
bOk = ExeSetInfo( nId, sKey, bVal) ;
} break ;
case LUA_TNUMBER :
{ double dVal ;
LuaGetParam( L, 3, dVal) ;
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, b3Val) ;
}
else if ( LuaGetParam( L, 3, vtVal)) {
bOk = ExeSetInfo( nId, sKey, dVal) ;
} break ;
case LUA_TSTRING :
{ string sVal ;
LuaGetParam( L, 3, sVal) ;
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, vtVal) ;
}
bOk = ExeSetInfo( nId, sKey, sVal) ;
} break ;
case LUA_TTABLE :
{ Frame3d frVal ;
BBox3d b3Val ;
Vector3d vtVal ; // va bene anche per Point3d
if ( LuaGetParam( L, 3, frVal)) {
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, frVal) ;
}
else if ( LuaGetParam( L, 3, b3Val)) {
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, b3Val) ;
}
else if ( LuaGetParam( L, 3, vtVal)) {
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, vtVal) ;
}
} break ;
}
// restituisco il risultato
LuaSetParam( L, bOk) ;
+5 -3
View File
@@ -2507,13 +2507,15 @@ LuaGetMachiningEndPoint( lua_State* L)
static int
LuaApplyAllMachinings( lua_State* L)
{
// 1 o nessun parametro : [bStopOnFirstErr]
// 1 o 2 o nessun parametro : [ bRecalc [, bStopOnFirstErr]]
bool bRecalc = true ;
bool bStopOnFirstErr = false ;
LuaGetParam( L, 1, bStopOnFirstErr) ;
if ( LuaGetParam( L, 1, bRecalc))
LuaGetParam( L, 2, bStopOnFirstErr) ;
LuaClearStack( L) ;
// eseguo ricalcolo delle lavorazioni
string sErrList ;
bool bOk = ExeApplyAllMachinings( bStopOnFirstErr, sErrList) ;
bool bOk = ExeApplyAllMachinings( bRecalc, bStopOnFirstErr, sErrList) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
if ( ! bOk)