diff --git a/Axis.cpp b/Axis.cpp index baafff8..ef9a9c9 100644 --- a/Axis.cpp +++ b/Axis.cpp @@ -50,6 +50,7 @@ Axis::Clone( void) const pAx->m_bInvert = m_bInvert ; pAx->m_dOffset = m_dOffset ; pAx->m_nType = m_nType ; + pAx->m_nUse = m_nUse ; pAx->m_ptPos = m_ptPos ; pAx->m_vtDir = m_vtDir ; pAx->m_Stroke = m_Stroke ; @@ -74,6 +75,7 @@ Axis::Dump( string& sOut, bool bMM, const char* szNewLine) const sOut += "Name=" + m_sName + szNewLine ; sOut += "Token=" + m_sToken + szNewLine ; sOut += "Type=" + ToString( m_nType) + szNewLine ; + sOut += "Use=" + ToString( m_nUse) + szNewLine ; sOut += "Pos=" + ToString( GetInUiUnits( m_ptPos, bMM), 4) + szNewLine ; sOut += "Dir=" + ToString( m_vtDir) + szNewLine ; if ( m_nType == MCH_AT_LINEAR) @@ -113,20 +115,21 @@ Axis::GetGeomDB( void) const //---------------------------------------------------------------------------- Axis::Axis( void) : m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_bInvert( false), m_dOffset( 0), - m_nType( MCH_AT_NONE), m_Stroke( {{0,0}}), m_dHomeVal( 0), m_dCurrVal( 0) + m_nType( MCH_AT_NONE), m_nUse( MCH_AU_NONE), m_Stroke( {{0,0}}), m_dHomeVal( 0), m_dCurrVal( 0) { } //---------------------------------------------------------------------------- bool Axis::Set( const string& sName, const string& sToken, bool bInvert, double dOffset, - int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) + int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) { m_sName = sName ; m_sToken = sToken ; m_bInvert = bInvert ; m_dOffset = dOffset ; - m_nType = nType ; + m_nType = ( nType == MCH_AT_ROTARY ? MCH_AT_ROTARY : MCH_AT_LINEAR) ; + m_nUse = (( nUse == MCH_AU_DISPOSITION || nUse == MCH_AU_AUXILIAR) ? nUse : MCH_AU_GENERAL) ; m_ptPos = ptPos ; m_vtDir = vtDir ; m_Stroke = Stroke ; diff --git a/Axis.h b/Axis.h index 6c22f9c..d7c7660 100644 --- a/Axis.h +++ b/Axis.h @@ -1,13 +1,13 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2022 +// EgalTech 2015-2025 //---------------------------------------------------------------------------- -// File : Axis.h Data : 21.09.22 Versione : 2.4i +// File : Axis.h Data : 17.04.25 Versione : 2.7d2 // Contenuto : Dichiarazione della classe Axis. // // // // Modifiche : 24.05.15 DS Creazione modulo. -// +// 17.04.25 DS Aggiunto campo Use. // //---------------------------------------------------------------------------- @@ -31,7 +31,7 @@ class Axis : public IUserObj public : Axis( void) ; bool Set( const std::string& sName, const std::string& sToken, bool bInvert, double dOffset, - int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) ; + int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) ; bool Modify( const Point3d& ptPos, double dAxisMaxAdjust) ; bool Modify( const Vector3d& vtDir, double dAxisMaxRotAdj) ; bool Modify( const STROKE& Stroke) ; @@ -48,6 +48,8 @@ class Axis : public IUserObj { return m_dOffset ; } int GetType( void) const { return m_nType ; } + int GetUse( void) const + { return m_nUse ; } const Point3d& GetPos( void) const { return m_ptPos ; } const Vector3d& GetDir( void) const @@ -67,6 +69,7 @@ class Axis : public IUserObj bool m_bInvert ; double m_dOffset ; int m_nType ; + int m_nUse ; Point3d m_ptPos ; Vector3d m_vtDir ; STROKE m_Stroke ; diff --git a/Machine.cpp b/Machine.cpp index c767e6c..8552db3 100644 --- a/Machine.cpp +++ b/Machine.cpp @@ -295,8 +295,8 @@ Machine::AdjustTable( int nLay, const Point3d& ptRef1) //---------------------------------------------------------------------------- bool Machine::LoadMachineAxis( const string& sName, const string& sParent, const string& sToken, bool bInvert, - double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, - double dHome, bool bAdjustAux, const string& sGeo, const STRVECTOR& vsAux) + double dOffset, int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir, + const STROKE& Stroke, double dHome, bool bAdjustAux, const string& sGeo, const STRVECTOR& vsAux) { // verifico sia di tipo ammesso if ( nType != MCH_AT_LINEAR && nType != MCH_AT_ROTARY) { @@ -336,7 +336,7 @@ Machine::LoadMachineAxis( const string& sName, const string& sParent, const stri Axis* pAxis = new(nothrow) Axis ; if ( pAxis == nullptr) return false ; - pAxis->Set( sName, sToken, bInvert, dOffset, nType, ptPos, vtDir, Stroke, dHome) ; + pAxis->Set( sName, sToken, bInvert, dOffset, nType, nUse, ptPos, vtDir, Stroke, dHome) ; m_pGeomDB->SetUserObj( nLay, pAxis) ; // verifico il vettore rappresentativo dell'asse if ( ! AdjustAxis( nLay, sPart, sName, nType, ptPos, vtDir, bAdjustAux)) diff --git a/Machine.h b/Machine.h index 963d0be..378942f 100644 --- a/Machine.h +++ b/Machine.h @@ -228,8 +228,8 @@ class Machine const STRVECTOR& vsColl, const std::string& sGeo, const STRVECTOR& vsAux) ; bool AdjustTable( int nLay, const Point3d& ptRef1) ; bool LoadMachineAxis( const std::string& sName, const std::string& sParent, const std::string& sToken, bool bInvert, - double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, - double dHome, bool bAdjustAux, const std::string& sGeo, const STRVECTOR& vsAux) ; + double dOffset, int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir, + const STROKE& Stroke, double dHome, bool bAdjustAux, const std::string& sGeo, const STRVECTOR& vsAux) ; bool AdjustAxis( int nLay, const std::string& sPart, const std::string& sName, int nType, const Point3d& ptPos, const Vector3d& vtDir, bool bAdjustAux) ; bool ModifyMachineAxisPosition( const std::string& sName, const Point3d& ptPos) ; diff --git a/MachineAxes.cpp b/MachineAxes.cpp index 299dee6..6ff6aa8 100644 --- a/MachineAxes.cpp +++ b/MachineAxes.cpp @@ -266,6 +266,14 @@ Machine::GetAxisHomePos( const string& sAxis, double& dHomeVal) const bool Machine::IsDispositionAxis( int nAxisId, int nTableId) const { + // se non dichiarato o ausiliario + const Axis* pAx = GetAxis( nAxisId) ; + if ( pAx == nullptr || pAx->GetUse() == MCH_AU_AUXILIAR) + return false ; + // se dichiarato di disposizione + if ( pAx->GetUse() == MCH_AU_DISPOSITION) + return true ; + // altrimenti è di tipo generale e va bene solo se dipende direttamente o indirettamente dalla tavola // se direttamente dipendente dalla tavola int nParentId = m_pGeomDB->GetParentId( nAxisId) ; if ( ( nTableId != GDB_ID_NULL && nParentId == nTableId) || IsTableGroup( nParentId)) diff --git a/MachineLua.cpp b/MachineLua.cpp index 3886d58..ce09098 100644 --- a/MachineLua.cpp +++ b/MachineLua.cpp @@ -45,6 +45,7 @@ static const string FLD_GEO = "Geo" ; static const string FLD_AUX = "Aux" ; static const string FLD_TOKEN = "Token" ; static const string FLD_TYPE = "Type" ; +static const string FLD_USE = "Use" ; static const string FLD_INVERT = "Invert" ; static const string FLD_AXIS_OFFSET = "Offset" ; static const string FLD_REF1 = "Ref1" ; @@ -536,6 +537,9 @@ Machine::LuaEmtAxis( lua_State* L) // lettura campo 'Type' dalla tabella int nType ; LuaCheckTabFieldParam( L, 1, FLD_TYPE, nType) + // lettura eventuale campo 'Use' della tabella (default General) + int nUse = MCH_AU_GENERAL ; + LuaGetTabFieldParam( L, 1, FLD_USE, nUse) ; // lettura campo 'Pos' dalla tabella Point3d ptPos ; LuaCheckTabFieldParam( L, 1, FLD_POS, ptPos) @@ -569,7 +573,7 @@ Machine::LuaEmtAxis( lua_State* L) // carico i dati dell'asse if ( ! m_pMchLua->LoadMachineAxis( sName, sParent, sToken, bInvert, dOffset, - nType, ptPos, vtDir, Stroke, dHome, bAdjustAux, sGeo, vsAux)) + nType, nUse, ptPos, vtDir, Stroke, dHome, bAdjustAux, sGeo, vsAux)) return luaL_error( L, " Load Machine Axis failed") ; // restituisco l'indice dell'asse diff --git a/MachineStruConst.h b/MachineStruConst.h index 236402c..133748b 100644 --- a/MachineStruConst.h +++ b/MachineStruConst.h @@ -81,6 +81,13 @@ enum MchAxisType { MCH_AT_NONE = 0, MCH_AT_LINEAR = 1, MCH_AT_ROTARY = 2} ; +//---------------------------------------------------------------------------- +// Uso di assi della macchina +enum MchAxisUse { MCH_AU_NONE = 0, + MCH_AU_GENERAL = 1, + MCH_AU_DISPOSITION = 2, + MCH_AU_AUXILIAR = 3} ; + //---------------------------------------------------------------------------- // Tipo di testa della macchina enum MchHeadType { MCH_HT_NONE = 0,