diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 0ce7943..3d9f86a 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ diff --git a/Machine.cpp b/Machine.cpp index ac3e9c9..81b39f7 100644 --- a/Machine.cpp +++ b/Machine.cpp @@ -34,6 +34,8 @@ Machine::Machine( void) m_pGeomDB = nullptr ; m_nGroupId = GDB_ID_NULL ; m_nTempGroupId = GDB_ID_NULL ; + m_dAxisMaxAdjust = EPS_SMALL ; + m_dExitMaxAdjust = EPS_SMALL ; m_nCalcTabId = GDB_ID_NULL ; m_nCalcHeadId = GDB_ID_NULL ; m_nCalcExitId = GDB_ID_NULL ; @@ -336,9 +338,16 @@ Machine::AdjustAxisVector( int nLay, const string& sPart, const string& sName, Vector3d vtDelta = ptPos - ptBase ; vtDelta -= ( vtDelta * vtDirN) * vtDirN ; if ( ! vtDelta.IsSmall()) { - string sOut = " Wrong Axis Base move = (" + ToString( vtDelta) + ")" ; - LOG_ERROR( GetEMkLogger(), sOut.c_str()) ; - return false ; + if ( vtDelta.Len() > m_dAxisMaxAdjust) { + string sOut = " Wrong Axis Base move = (" + ToString( vtDelta) + ")" ; + LOG_ERROR( GetEMkLogger(), sOut.c_str()) ; + return false ; + } + else { + string sOut = " Move = (" + ToString( vtDelta) + ")" ; + LOG_ERROR( GetEMkLogger(), sOut.c_str()) ; + m_pGeomDB->TranslateGlob( nId, vtDelta) ; + } } return true ; } @@ -545,18 +554,27 @@ Machine::CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit) int nT = m_pGeomDB->GetFirstNameInGroup( nLay, sName) ; if ( nT != GDB_ID_NULL && m_pGeomDB->GetGeoType( nT) == GEO_FRAME3D) { // recupero frame - const Frame3d& frFrame = GetGeoFrame3d( m_pGeomDB->GetGeoObj( nT))->GetFrame() ; + Frame3d frFrame = GetGeoFrame3d( m_pGeomDB->GetGeoObj( nT))->GetFrame() ; // verifico dati frame rispetto ad uscita (in globale) Point3d ptPos = frFrame.Orig() ; ptPos.ToGlob( frHead) ; Vector3d vtTDir = frFrame.VersZ() ; - vtTDir.ToGlob(frHead) ; + vtTDir.ToGlob( frHead) ; vtTDir.Normalize() ; Vector3d vtDelta = vMuExit[i].ptPos - ptPos ; if ( ! vtDelta.IsSmall()) { - string sOut = " Wrong Exit Position " + sName + " move = (" + ToString( vtDelta) +")" ; - LOG_ERROR( GetEMkLogger(), sOut.c_str()) ; - return false ; + if ( vtDelta.Len() > m_dExitMaxAdjust) { + string sOut = " Wrong Exit Position " + sName + " move = (" + ToString( vtDelta) +")" ; + LOG_ERROR( GetEMkLogger(), sOut.c_str()) ; + return false ; + } + else { + string sOut = " Exit " + sName + " move = (" + ToString( vtDelta) +")" ; + LOG_ERROR( GetEMkLogger(), sOut.c_str()) ; + vtDelta.ToLoc( frHead) ; + frFrame.Translate( vtDelta) ; + GetGeoFrame3d( m_pGeomDB->GetGeoObj( nT))->Set( frFrame) ; + } } Vector3d vtDirN = vMuExit[i].vtTDir ; if ( ! vtDirN.Normalize() || ! AreSameVectorApprox( vtTDir, vtDirN)) { diff --git a/Machine.h b/Machine.h index ee3aebd..19a4a12 100644 --- a/Machine.h +++ b/Machine.h @@ -144,6 +144,8 @@ class Machine int m_nGroupId ; // Id del gruppo della macchina int m_nTempGroupId ; // Id del gruppo temporaneo macchina per carico STRINT_UMAP m_mapGroups ; // dizionario dei gruppi della macchina + double m_dAxisMaxAdjust ; // massimo aggiustamento asse da geometria a descrizione cinematica + double m_dExitMaxAdjust ; // massimo aggiustamento uscita da geometria a descrizione cinematica // dati di calcolo int m_nCalcTabId ; // tavola corrente per calcoli int m_nCalcHeadId ; // testa corrente per calcoli diff --git a/MachineLua.cpp b/MachineLua.cpp index 5767828..46cfe06 100644 --- a/MachineLua.cpp +++ b/MachineLua.cpp @@ -163,6 +163,12 @@ Machine::LuaEmtGeneral( lua_State* L) // lettura eventuale campo 'Processor' dalla tabella string sProcessor ; LuaGetTabFieldParam( L, 1, "Processor", sProcessor) ; + // lettura eventuale campo 'AxisMaxAdjust' dalla tabella (default EPS_SMALL) + double dAxisMaxAdjust = EPS_SMALL ; + LuaGetTabFieldParam( L, 1, "AxisMaxAdjust", dAxisMaxAdjust) ; + // lettura eventuale campo 'ExitMaxAdjust' dalla tabella (default EPS_SMALL) + double dExitMaxAdjust = EPS_SMALL ; + LuaGetTabFieldParam( L, 1, "ExitMaxAdjust", dExitMaxAdjust) ; LuaClearStack( L) ; // info @@ -190,6 +196,10 @@ Machine::LuaEmtGeneral( lua_State* L) LOG_INFO( GetEMkLogger(), " Processor file not specified") } + // imposto massimo spostamento assi e uscite tra definizione cinematica e geometria + m_pMchLua->m_dAxisMaxAdjust = dAxisMaxAdjust ; + m_pMchLua->m_dExitMaxAdjust = dExitMaxAdjust ; + return 0 ; }