From e03c692b64dde14a544dd04c44367c455011d025 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Sun, 19 Jun 2016 16:22:54 +0000 Subject: [PATCH] EgtMachKernel 1.6r10 : - le funzioni lua di caricamento oggetti macchina ne restituiscono l'Id - piccola miglioria a visualizzazione macchina. --- EgtMachKernel.rc | Bin 11782 -> 11798 bytes Machine.cpp | 32 +++++++++++++++++++++---------- MachineLua.cpp | 48 +++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 64 insertions(+), 16 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index db10f3010dcecbba76fd18f7c4b4e0d3dc96b3cd..696b8490f98eaf23912748e09d0c4951a4baff34 100644 GIT binary patch delta 121 zcmZpRnHIC*4;!-~gTdy%Y_`mdhLbOHNKP)`6x*C7R@@+`L2B2gt`%?7_Hs PkF*y=3RTAe| diff --git a/Machine.cpp b/Machine.cpp index 41a374e..d1052c0 100644 --- a/Machine.cpp +++ b/Machine.cpp @@ -821,8 +821,12 @@ Machine::SetLook( int nFlag) while ( nParentId != GDB_ID_NULL && nParentId != nMBaseId) { int nId = m_pGeomDB->GetFirstInGroup( nParentId) ; while ( nId != GDB_ID_NULL) { - if ( nId != nTabCurrId) - m_pGeomDB->SetStatus( nId, ( bTabOnly ? GDB_ST_OFF : GDB_ST_ON)) ; + if ( nId != nTabCurrId) { + if ( m_pGeomDB->GetGeoType( nId) != GEO_FRAME3D) + m_pGeomDB->SetStatus( nId, ( bTabOnly ? GDB_ST_OFF : GDB_ST_ON)) ; + else + m_pGeomDB->SetStatus( nId, GDB_ST_OFF) ; + } nId = m_pGeomDB->GetNext( nId) ; } nTabCurrId = nParentId ; @@ -845,10 +849,14 @@ Machine::SetLook( int nFlag) } int nId = m_pGeomDB->GetFirstInGroup( nParentId) ; while ( nId != GDB_ID_NULL) { - if ( nId != nToolCurrId) - m_pGeomDB->SetStatus( nId, ( bHide ? GDB_ST_OFF : GDB_ST_ON)) ; + if ( m_pGeomDB->GetGeoType( nId) != GEO_FRAME3D) { + if ( nId != nToolCurrId) + m_pGeomDB->SetStatus( nId, ( bHide ? GDB_ST_OFF : GDB_ST_ON)) ; + else + m_pGeomDB->SetStatus( nId, GDB_ST_ON) ; + } else - m_pGeomDB->SetStatus( nId, GDB_ST_ON) ; + m_pGeomDB->SetStatus( nId, GDB_ST_OFF) ; nId = m_pGeomDB->GetNext( nId) ; } nToolCurrId = nParentId ; @@ -858,12 +866,16 @@ Machine::SetLook( int nFlag) // sistemo gli oggetti del gruppo di base int nId = m_pGeomDB->GetFirstInGroup( nMBaseId) ; while ( nId != GDB_ID_NULL) { - if ( nId != nTabCurrId && nId != nToolCurrId) - m_pGeomDB->SetStatus( nId, ( nFlag != MCH_LOOK_ALL ? GDB_ST_OFF : GDB_ST_ON)) ; - else if ( nId == nTabCurrId) - m_pGeomDB->SetStatus( nId, GDB_ST_ON) ; + if ( m_pGeomDB->GetGeoType( nId) != GEO_FRAME3D) { + if ( nId != nTabCurrId && nId != nToolCurrId) + m_pGeomDB->SetStatus( nId, ( nFlag != MCH_LOOK_ALL ? GDB_ST_OFF : GDB_ST_ON)) ; + else if ( nId == nTabCurrId) + m_pGeomDB->SetStatus( nId, GDB_ST_ON) ; + else + m_pGeomDB->SetStatus( nId, ( nFlag == MCH_LOOK_TAB ? GDB_ST_OFF : GDB_ST_ON)) ; + } else - m_pGeomDB->SetStatus( nId, ( nFlag == MCH_LOOK_TAB ? GDB_ST_OFF : GDB_ST_ON)) ; + m_pGeomDB->SetStatus( nId, GDB_ST_OFF) ; nId = m_pGeomDB->GetNext( nId) ; } diff --git a/MachineLua.cpp b/MachineLua.cpp index 23718a8..bada567 100644 --- a/MachineLua.cpp +++ b/MachineLua.cpp @@ -316,7 +316,13 @@ Machine::LuaEmtBase( lua_State* L) if ( ! m_pMchLua->LoadMachineBase( sName, sGeo, vsAux)) return luaL_error( L, " Load Machine Base failed") ; - return 0 ; + // restituisco l'indice della base + int nBaseId = m_pMchLua->GetBaseId( sName) ; + if ( nBaseId != GDB_ID_NULL) + LuaSetParam( L, nBaseId) ; + else + LuaSetParam( L) ; + return 1 ; } //---------------------------------------------------------------------------- @@ -358,7 +364,13 @@ Machine::LuaEmtTable( lua_State* L) if ( ! m_pMchLua->LoadMachineTable( sName, sParent, nType, Ref1, sGeo, vsAux)) return luaL_error( L, " Load Machine Table failed") ; - return 0 ; + // restituisco l'indice della tavola + int nTableId = m_pMchLua->GetTableId( sName) ; + if ( nTableId != GDB_ID_NULL) + LuaSetParam( L, nTableId) ; + else + LuaSetParam( L) ; + return 1 ; } //---------------------------------------------------------------------------- @@ -416,7 +428,13 @@ Machine::LuaEmtAxis( lua_State* L) Stroke, dHome, bAdjustAux, sGeo, vsAux)) return luaL_error( L, " Load Machine Axis failed") ; - return 0 ; + // restituisco l'indice dell'asse + int nAxisId = m_pMchLua->GetAxisId( sName) ; + if ( nAxisId != GDB_ID_NULL) + LuaSetParam( L, nAxisId) ; + else + LuaSetParam( L) ; + return 1 ; } //---------------------------------------------------------------------------- @@ -498,7 +516,13 @@ Machine::LuaEmtStdHead( lua_State* L) dRot1W, Rot2Stroke, nSolCh, sGeo, vsAux)) return luaL_error( L, " Load Machine Standard Head failed") ; - return 0 ; + // restituisco l'indice della testa + int nHeadId = m_pMchLua->GetHeadId( sName) ; + if ( nHeadId != GDB_ID_NULL) + LuaSetParam( L, nHeadId) ; + else + LuaSetParam( L) ; + return 1 ; } //---------------------------------------------------------------------------- @@ -567,7 +591,13 @@ Machine::LuaEmtMultiHead( lua_State* L) dRot1W, Rot2Stroke, nSolCh, sGeo, vsAux)) return luaL_error( L, " Load Machine Standard Head failed") ; - return 0 ; + // restituisco l'indice della testa + int nHeadId = m_pMchLua->GetHeadId( sName) ; + if ( nHeadId != GDB_ID_NULL) + LuaSetParam( L, nHeadId) ; + else + LuaSetParam( L) ; + return 1 ; } //---------------------------------------------------------------------------- @@ -625,7 +655,13 @@ Machine::LuaEmtSpecialHead( lua_State* L) dRot1W, Rot2Stroke, nSolCh, sGeo, vsAux)) return luaL_error( L, " Load Machine Special Head failed") ; - return 0 ; + // restituisco l'indice della testa + int nHeadId = m_pMchLua->GetHeadId( sName) ; + if ( nHeadId != GDB_ID_NULL) + LuaSetParam( L, nHeadId) ; + else + LuaSetParam( L) ; + return 1 ; } //----------------------------------------------------------------------------