diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index f86d77d..8578705 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ diff --git a/Estimator.cpp b/Estimator.cpp index 4673c77..16b7657 100644 --- a/Estimator.cpp +++ b/Estimator.cpp @@ -179,6 +179,15 @@ Estimator::CallOnTableData( void) return m_pMachine->LuaCallFunction( ON_ESTIM_TABLE_DATA) ; } +//---------------------------------------------------------------------------- +bool +Estimator::CallOnTableAxisData( void) +{ + if ( ! m_pMachine->LuaExistsFunction( ON_ESTIM_TABLE_AXIS_DATA)) + return true ; + return m_pMachine->LuaCallFunction( ON_ESTIM_TABLE_AXIS_DATA) ; +} + //---------------------------------------------------------------------------- bool Estimator::CallOnFixtureData( void) diff --git a/Estimator.h b/Estimator.h index 0e394ca..0e69351 100644 --- a/Estimator.h +++ b/Estimator.h @@ -33,6 +33,7 @@ class Estimator : public Processor bool CallOnDispositionStart( void) override ; bool CallOnDispositionEnd( void) override ; bool CallOnTableData( void) override ; + bool CallOnTableAxisData( void) override ; bool CallOnFixtureData( void) override ; bool CallOnRawMoveData( void) override ; bool CallOnToolSelect( void) override ; diff --git a/Generator.cpp b/Generator.cpp index 0b648d9..912a7ea 100644 --- a/Generator.cpp +++ b/Generator.cpp @@ -181,6 +181,13 @@ Generator::CallOnTableData( void) return m_pMachine->LuaCallFunction( ON_TABLE_DATA) ; } +//---------------------------------------------------------------------------- +bool +Generator::CallOnTableAxisData( void) +{ + return m_pMachine->LuaCallFunction( ON_TABLE_AXIS_DATA) ; +} + //---------------------------------------------------------------------------- bool Generator::CallOnFixtureData( void) diff --git a/Generator.h b/Generator.h index af0a659..7578250 100644 --- a/Generator.h +++ b/Generator.h @@ -33,6 +33,7 @@ class Generator : public Processor bool CallOnDispositionStart( void) override ; bool CallOnDispositionEnd( void) override ; bool CallOnTableData( void) override ; + bool CallOnTableAxisData( void) override ; bool CallOnFixtureData( void) override ; bool CallOnRawMoveData( void) override ; bool CallOnToolSelect( void) override ; diff --git a/Machine.h b/Machine.h index da86b7a..f322c1a 100644 --- a/Machine.h +++ b/Machine.h @@ -50,6 +50,7 @@ class Machine int GetAxisId( const std::string& sAxis) const { int nId = GetGroup( sAxis) ; return ( IsAxisGroup( nId) ? nId : GDB_ID_NULL) ; } + bool GetAxisName( int nAxId, std::string& sAxis) const ; int GetHeadId( const std::string& sHead) const { int nId = GetGroup( sHead) ; return ( IsHeadGroup( nId) ? nId : GDB_ID_NULL) ; } @@ -73,6 +74,7 @@ class Machine { return ( GetTcPos( nGroup) != nullptr) ; } bool IsExitGroup( int nGroup) const { return ( GetExit( nGroup) != nullptr) ; } + bool GetAllAxesIds( INTVECTOR& vIds) const ; bool GetAllTablesNames( STRVECTOR& vNames) const ; bool GetAllAxesNames( STRVECTOR& vNames) const ; bool GetAllHeadsNames( STRVECTOR& vNames) const ; @@ -106,6 +108,7 @@ class Machine bool GetAxisMin( const std::string& sAxis, double& dMin) const ; bool GetAxisMax( const std::string& sAxis, double& dMax) const ; bool GetAxisHomePos( const std::string& sAxis, double& dHomeVal) const ; + bool IsDispositionAxis( int nAxisId, int nTableId = GDB_ID_NULL) const ; bool IsDispositionAxis( const std::string& sAxis, const std::string& sTable = "") const ; bool ResetAxisPos( const std::string& sAxis) ; bool ResetAllAxesPos( bool bStdAxes, bool bDispAxes) ; diff --git a/MachineAxes.cpp b/MachineAxes.cpp index b6b10f8..299dee6 100644 --- a/MachineAxes.cpp +++ b/MachineAxes.cpp @@ -23,6 +23,22 @@ using namespace std ; +//---------------------------------------------------------------------------- +bool +Machine::GetAllAxesIds( INTVECTOR& vIds) const +{ + // reset lista identificativi + vIds.clear() ; + // ricerca degli assi + for ( const auto& snGro : m_mapGroups) { + if ( IsAxisGroup( snGro.second)) + vIds.push_back( snGro.second) ; + } + // se richiesto, ordino alfabeticamente + sort( vIds.begin(), vIds.end()) ; + return true ; +} + //---------------------------------------------------------------------------- bool Machine::GetAllAxesNames( STRVECTOR& vNames) const @@ -34,10 +50,22 @@ Machine::GetAllAxesNames( STRVECTOR& vNames) const if ( IsAxisGroup( snGro.second)) vNames.push_back( snGro.first) ; } - // ordino alfabeticamente + // se richiesto, ordino alfabeticamente sort( vNames.begin(), vNames.end()) ; return true ; } +//---------------------------------------------------------------------------- +bool +Machine::GetAxisName( int nAxId, string& sName) const +{ + // recupero il relativo gestore + const Axis* pAx = GetAxis( nAxId) ; + if ( pAx == nullptr) + return false ; + // recupero il token dell'asse + sName = pAx->GetName() ; + return true ; +} //---------------------------------------------------------------------------- bool @@ -234,6 +262,21 @@ Machine::GetAxisHomePos( const string& sAxis, double& dHomeVal) const return true ; } +//---------------------------------------------------------------------------- +bool +Machine::IsDispositionAxis( int nAxisId, int nTableId) const +{ + // se direttamente dipendente dalla tavola + int nParentId = m_pGeomDB->GetParentId( nAxisId) ; + if ( ( nTableId != GDB_ID_NULL && nParentId == nTableId) || IsTableGroup( nParentId)) + return true ; + // altrimenti deve dipendere da asse dipendente dalla tavola + if ( ! IsAxisGroup( nParentId)) + return false ; + int nGrParId = m_pGeomDB->GetParentId( nParentId) ; + return ( ( nTableId != GDB_ID_NULL && nGrParId == nTableId) || IsTableGroup( nGrParId)) ; +} + //---------------------------------------------------------------------------- bool Machine::IsDispositionAxis( const string& sAxis, const string& sTable) const @@ -251,15 +294,8 @@ Machine::IsDispositionAxis( const string& sAxis, const string& sTable) const if ( nTabId == GDB_ID_NULL) return false ; } - // se direttamente dipendente dalla tavola - int nParentId = m_pGeomDB->GetParentId( nAxId) ; - if ( ( nTabId != GDB_ID_NULL && nParentId == nTabId) || IsTableGroup( nParentId)) - return true ; - // altrimenti deve dipendere da asse dipendente dalla tavola - if ( ! IsAxisGroup( nParentId)) - return false ; - int nGrParId = m_pGeomDB->GetParentId( nParentId) ; - return ( ( nTabId != GDB_ID_NULL && nGrParId == nTabId) || IsTableGroup( nGrParId)) ; + // eseguo + return IsDispositionAxis( nAxId, nTabId) ; } //---------------------------------------------------------------------------- diff --git a/OutputConst.h b/OutputConst.h index f1ac027..368bbab 100644 --- a/OutputConst.h +++ b/OutputConst.h @@ -45,6 +45,10 @@ static const std::string GVAR_EMPTY = ".EMPTY" ; // (bool) flag disp static const std::string GVAR_SBH = ".SBH" ; // (bool) flag disposizione con operazioni manuali static const std::string GVAR_TABNAME = ".TABNAME" ; // (string) nome tavola static const std::string GVAR_TABORI1 = ".TABORI1" ; // (Point3d) prima origine di tavola +static const std::string GVAR_TAIND = ".TAIND" ; // (int) indice asse tavola +static const std::string GVAR_TANAME = ".TANAME" ; // (string) nome asse tavola +static const std::string GVAR_TAPOS = ".TAPOS" ; // (double) posizione asse tavola +static const std::string GVAR_TAMOVED = ".TAMOVED" ; // (bool) flag asse tavola con movimento static const std::string GVAR_FIXID = ".FIXID" ; // (int) identificativo bloccaggio (fixture) static const std::string GVAR_FIXIND = ".FIXIND" ; // (int) indice bloccaggio static const std::string GVAR_FIXNAME = ".FIXNAME" ; // (string) nome bloccaggio @@ -198,6 +202,7 @@ static const std::string ON_TOOL_DATA = "OnToolData" ; static const std::string ON_DISPOSITION_START = "OnDispositionStart" ; static const std::string ON_DISPOSITION_END = "OnDispositionEnd" ; static const std::string ON_TABLE_DATA = "OnTableData" ; +static const std::string ON_TABLE_AXIS_DATA = "OnTableAxisData" ; static const std::string ON_FIXTURE_DATA = "OnFixtureData" ; static const std::string ON_RAWMOVE_DATA = "OnRawMoveData" ; static const std::string ON_TOOL_SELECT = "OnToolSelect" ; @@ -220,6 +225,7 @@ static const std::string ON_ESTIM_TOOL_DATA = "OnEstimToolData" ; static const std::string ON_ESTIM_DISPOSITION_START = "OnEstimDispositionStart" ; static const std::string ON_ESTIM_DISPOSITION_END = "OnEstimDispositionEnd" ; static const std::string ON_ESTIM_TABLE_DATA = "OnEstimTableData" ; +static const std::string ON_ESTIM_TABLE_AXIS_DATA = "OnEstimTableAxisData" ; static const std::string ON_ESTIM_FIXTURE_DATA = "OnEstimFixtureData" ; static const std::string ON_ESTIM_RAWMOVE_DATA = "OnEstimRawMoveData" ; static const std::string ON_ESTIM_TOOL_SELECT = "OnEstimToolSelect" ; diff --git a/Processor.cpp b/Processor.cpp index 756eb01..17afa52 100644 --- a/Processor.cpp +++ b/Processor.cpp @@ -224,6 +224,38 @@ Processor::ProcessDisposition( int nOpId, int nOpInd) if ( ! OnTableData( sTable, ptOri1)) return false ; + // Recupero assi tavola mossi nella disposizione + INTVECTOR vMovAxId ; + for ( int i = 0 ; ; ++ i) { + string sName ; + double dPos ; + if ( pDisp->GetMoveAxisData( i, sName, dPos)) { + int nAxId = m_pMachine->GetAxisId( sName) ; + if ( nAxId != GDB_ID_NULL) + vMovAxId.emplace_back( nAxId) ; + } + else + break ; + } + + // Emetto posizioni assi di tavola + INTVECTOR vAxisId ; + m_pMachine->GetAllAxesIds( vAxisId) ; + int nTableId = m_pMachine->GetTableId( sTable) ; + int nInd = 0 ; + for ( int nAxId : vAxisId) { + string sName ; + double dPos ; + if ( m_pMachine->IsDispositionAxis( nAxId, nTableId) && + m_pMachine->GetAxisName( nAxId, sName) && + m_pMachine->GetAxisPos( sName, dPos)) { + ++ nInd ; + bool bMoved = ( std::find( vMovAxId.begin(), vMovAxId.end(), nAxId) != vMovAxId.end()) ; + if ( ! OnTableAxisData( nInd, sName, dPos, bMoved)) + return false ; + } + } + // Emetto dati bloccaggi for ( int i = 0 ; ; ++ i) { string sName ; @@ -246,7 +278,7 @@ Processor::ProcessDisposition( int nOpId, int nOpInd) Point3d ptPos ; int nFlag ; if ( pDisp->GetMoveRawData( i, nRawId, nType, ptPos, nFlag)) { - if ( ! OnRawMoveData( nRawId, i + 1, nType, ptPos, nFlag)) + if ( ! OnRawMoveData( nRawId, i + 1, nType, ptPos, nFlag)) return false ; } else @@ -807,6 +839,20 @@ Processor::OnTableData( const string& sName, const Point3d& ptOri1) return bOk ; } +//---------------------------------------------------------------------------- +bool +Processor::OnTableAxisData( int nAxisInd, const string& sName, double dPos, bool bMoved) +{ + // assegno dati movimento asse di tavola + bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TAIND, nAxisInd) ; + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TANAME, sName) ; + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TAPOS, dPos) ; + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TAMOVED, bMoved) ; + // chiamo la funzione di gestione dati movimento asse di tavola + bOk = bOk && CallOnTableAxisData() ; + return true ; +} + //---------------------------------------------------------------------------- bool Processor::OnFixtureData( int nFixId, int nFixInd, const string& sName, const Point3d& ptPos, @@ -826,11 +872,11 @@ Processor::OnFixtureData( int nFixId, int nFixInd, const string& sName, const Po //---------------------------------------------------------------------------- bool -Processor::OnRawMoveData( int nRawId, int RawMoveInd, int nType, const Point3d& ptPos, int nFlag) +Processor::OnRawMoveData( int nRawId, int nRawMoveInd, int nType, const Point3d& ptPos, int nFlag) { // assegno dati bloccaggio bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWID, nRawId) ; - bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWIND, RawMoveInd) ; + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWIND, nRawMoveInd) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWTYPE, nType) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWPOS, ptPos) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWFLAG, nFlag) ; diff --git a/Processor.h b/Processor.h index bef3865..1db7c98 100644 --- a/Processor.h +++ b/Processor.h @@ -47,9 +47,10 @@ class Processor bool OnDispositionStart( int nOpId, int nOpInd, int nPhase, bool bEmpty, bool bSomeByHand) ; bool OnDispositionEnd( void) ; bool OnTableData( const std::string& sName, const Point3d& ptOri1) ; + bool OnTableAxisData( int nAxisInd, const std::string& sName, double dPos, bool bMoved) ; bool OnFixtureData( int nFixId, int nFixInd, const std::string& sName, const Point3d& ptPos, double dAngDeg, double dMov) ; - bool OnRawMoveData( int nRawId, int RawMoveInd, int nType, const Point3d& ptPos, int nFlag) ; + bool OnRawMoveData( int nRawId, int nRawMoveInd, int nType, const Point3d& ptPos, int nFlag) ; bool OnMachiningStart( int nOpId, int nOpInd, double dSpeed, const Point3d& ptMin, const Point3d& ptMax, const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ; bool OnMachiningEnd( void) ; @@ -80,6 +81,7 @@ class Processor virtual bool CallOnDispositionStart( void) = 0 ; virtual bool CallOnDispositionEnd( void) = 0 ; virtual bool CallOnTableData( void) = 0 ; + virtual bool CallOnTableAxisData( void) = 0 ; virtual bool CallOnFixtureData( void) = 0 ; virtual bool CallOnRawMoveData( void) = 0 ; virtual bool CallOnToolSelect( void) = 0 ; diff --git a/SurfFinishing.cpp b/SurfFinishing.cpp index 68c80af..9786676 100644 --- a/SurfFinishing.cpp +++ b/SurfFinishing.cpp @@ -3825,9 +3825,10 @@ SurfFinishing::AddOptimal( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSr if ( ! IsNull( pSfrZConst) && pSfrZConst->IsValid()) { // recupero dai parametri eventuale Offset di sovrapposizione per ZConst - double dZConstOverlap = m_TParams.m_dDiam ; + double dZConstOverlap = m_TParams.m_dDiam / 2 ; if ( GetValInNotes( m_Params.m_sUserNotes, "ZConstOverlap", dZConstOverlap)) - dZConstOverlap = Clamp( dZConstOverlap, 0., m_TParams.m_dDiam) ; + dZConstOverlap = Clamp( dZConstOverlap, 0., m_TParams.m_dDiam / 2) ; + dZConstOverlap += m_TParams.m_dDiam / 2 ; // effettuo un Offset del raggio utensile ( o definito da parametro) per la superficie a ZConst pSfrZConst->Offset( dZConstOverlap, ICurve::OFF_FILLET) ;