diff --git a/Axis.cpp b/Axis.cpp index ead754a..f03318b 100644 --- a/Axis.cpp +++ b/Axis.cpp @@ -44,6 +44,7 @@ Axis::Clone( void) const pAx->m_pGeomDB = nullptr ; pAx->m_sName = m_sName ; pAx->m_sToken = m_sToken ; + pAx->m_bInvert = m_bInvert ; pAx->m_nType = m_nType ; pAx->m_ptPos = m_ptPos ; pAx->m_vtDir = m_vtDir ; @@ -114,11 +115,12 @@ Axis::Axis( void) //---------------------------------------------------------------------------- bool -Axis::Set( const string& sName, const string& sToken, int nType, +Axis::Set( const string& sName, const string& sToken, bool bInvert, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) { m_sName = sName ; m_sToken = sToken ; + m_bInvert = bInvert ; m_nType = nType ; m_ptPos = ptPos ; m_vtDir = vtDir ; diff --git a/Axis.h b/Axis.h index d887e92..37b420c 100644 --- a/Axis.h +++ b/Axis.h @@ -30,7 +30,7 @@ class Axis : public IUserObj public : Axis( void) ; - bool Set( const std::string& sName, const std::string& sToken, int nType, + bool Set( const std::string& sName, const std::string& sToken, bool bInvert, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) ; bool Modify( const STROKE& Stroke) ; bool Modify( double dHome) ; @@ -40,6 +40,8 @@ class Axis : public IUserObj { return m_sName ; } const std::string& GetToken( void) const { return m_sToken ; } + bool GetInvert( void) const + { return m_bInvert ; } int GetType( void) const { return m_nType ; } const Point3d& GetPos( void) const @@ -58,6 +60,7 @@ class Axis : public IUserObj IGeomDB* m_pGeomDB ; std::string m_sName ; std::string m_sToken ; + bool m_bInvert ; int m_nType ; Point3d m_ptPos ; Vector3d m_vtDir ; diff --git a/Machine.cpp b/Machine.cpp index 851ef32..b5808f4 100644 --- a/Machine.cpp +++ b/Machine.cpp @@ -272,7 +272,7 @@ Machine::AdjustTable( int nLay, const Point3d& ptRef1) //---------------------------------------------------------------------------- bool -Machine::LoadMachineAxis( const string& sName, const string& sParent, const string& sToken, +Machine::LoadMachineAxis( const string& sName, const string& sParent, const string& sToken, bool bInvert, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome, bool bAdjustAux, const string& sGeo, const STRVECTOR& vsAux) { @@ -314,7 +314,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, nType, ptPos, vtDir, Stroke, dHome) ; + pAxis->Set( sName, sToken, bInvert, nType, 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 631e3ac..c80e749 100644 --- a/Machine.h +++ b/Machine.h @@ -137,7 +137,7 @@ class Machine 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, - int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, + bool bInvert, int nType, 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) ; diff --git a/MachineLua.cpp b/MachineLua.cpp index 121cfd9..a820eb1 100644 --- a/MachineLua.cpp +++ b/MachineLua.cpp @@ -36,6 +36,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_INVERT = "Invert" ; static const string FLD_REF1 = "Ref1" ; static const string FLD_SCALE = "Scale" ; static const string FLD_POS = "Pos" ; @@ -393,6 +394,9 @@ Machine::LuaEmtAxis( lua_State* L) // lettura eventuale campo 'Token' dalla tabella (default Name) string sToken = sName ; LuaGetTabFieldParam( L, 1, FLD_TOKEN, sToken) ; + // lettura eventuale campo Invert dalla tabella (default false) + bool bInvert = false ; + LuaGetTabFieldParam( L, 1, FLD_TYPE, bInvert) ; // lettura campo 'Type' dalla tabella int nType ; LuaCheckTabFieldParam( L, 1, FLD_TYPE, nType) @@ -428,7 +432,7 @@ Machine::LuaEmtAxis( lua_State* L) return luaL_error( L, " Unknown Machine") ; // carico i dati dell'asse - if ( ! m_pMchLua->LoadMachineAxis( sName, sParent, sToken, nType, ptPos, vtDir, + if ( ! m_pMchLua->LoadMachineAxis( sName, sParent, sToken, bInvert, nType, ptPos, vtDir, Stroke, dHome, bAdjustAux, sGeo, vsAux)) return luaL_error( L, " Load Machine Axis failed") ; diff --git a/MachiningsMgr.cpp b/MachiningsMgr.cpp index 66d0ff0..471b482 100644 --- a/MachiningsMgr.cpp +++ b/MachiningsMgr.cpp @@ -903,9 +903,11 @@ MachiningsMgr::GetCurrMachiningParam( int nType, std::string& sVal) const bool MachiningsMgr::Set3AxComp( bool b3AxComp) { - // salvo e setto modifica - m_b3AxComp = b3AxComp ; - m_bModified = true ; + // se cambiato, salvo e setto modifica + if ( b3AxComp != m_b3AxComp) { + m_b3AxComp = b3AxComp ; + m_bModified = true ; + } return true ; } @@ -913,9 +915,11 @@ MachiningsMgr::Set3AxComp( bool b3AxComp) bool MachiningsMgr::Set5AxComp( bool b5AxComp) { - // salvo e setto modifica - m_b5AxComp = b5AxComp ; - m_bModified = true ; + // se cambiato, salvo e setto modifica + if ( b5AxComp != m_b5AxComp) { + m_b5AxComp = b5AxComp ; + m_bModified = true ; + } return true ; } @@ -1002,6 +1006,9 @@ MachiningsMgr::SetSplitArcs( int nFlag) { if ( nFlag < SPLAR_NEVER || nFlag > SPLAR_ALWAYS) return false ; - m_nSplitArcs = nFlag ; + if ( nFlag != m_nSplitArcs) { + m_nSplitArcs = nFlag ; + m_bModified = true ; + } return true ; }