From 329136f5ca8f71477aeeef80a3c6f41afe930d73 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 12 Dec 2016 09:18:50 +0000 Subject: [PATCH] =?UTF-8?q?EgtMachKernel=20:=20-=20aggiunta=20gestione=20I?= =?UTF-8?q?nvert=20su=20asse=20(per=20ora=20solo=20in=20simulazione)=20-?= =?UTF-8?q?=20possibilit=C3=A0=20di=20invertire=20lavorazione=20fori=20pas?= =?UTF-8?q?santi=20-=20in=20simulazione=20e=20generazione=20aggiunti=20pun?= =?UTF-8?q?ti=20estremi=20di=20box=20lavorazione.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Drilling.cpp | 26 ++++++++++++-- Generator.cpp | 12 +++++-- Generator.h | 3 +- Machine.h | 3 +- MachineAxes.cpp | 16 +++++++++ MachineLua.cpp | 4 +-- Milling.cpp | 6 ++++ OutputConst.h | 2 ++ Sawing.cpp | 6 ++++ Simulator.cpp | 91 ++++++++++++++++++++++++++++++++++++++++--------- Simulator.h | 5 ++- 11 files changed, 149 insertions(+), 25 deletions(-) diff --git a/Drilling.cpp b/Drilling.cpp index 6476105..ff27fde 100644 --- a/Drilling.cpp +++ b/Drilling.cpp @@ -832,6 +832,11 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName LOG_INFO( GetEMkLogger(), sOut.c_str()) ; return true ; } + // se richiesta inversione e foro passante, provvedo + if ( m_Params.m_bInvert && ! hole.bBlind) { + hole.ptIni -= hole.vtDir * hole.dLen ; + hole.vtDir.Invert() ; + } // assegno il vettore estrazione al gruppo del percorso m_pGeomDB->SetInfo( nPathId, KEY_EXTR, hole.vtDir) ; // assegno il punto di inizio al gruppo del percorso @@ -866,6 +871,13 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName LOG_INFO( GetEMkLogger(), sOut.c_str()) ; } } + + // assegno al gruppo l'ingombro del percorso di lavoro + BBox3d b3Grp ; + m_pGeomDB->GetGlobalBBox( nPathId, b3Grp) ; + m_pGeomDB->SetInfo( nPathId, KEY_PMIN, b3Grp.GetMin()) ; + m_pGeomDB->SetInfo( nPathId, KEY_PMAX, b3Grp.GetMax()) ; + return true ; } @@ -1149,8 +1161,18 @@ Drilling::GetHoleData( SelData Id, Hole& hole) hole.vtDir.ToGlob( frGlob) ; hole.vtDir.Normalize() ; hole.dLen = abs( dDepth) ; - // se verticale e arriva fino al fondo grezzo, allora passante altrimenti cieco - hole.bBlind = ! ( vtExtrG.IsZplus() && hole.dLen > dRbDist - EPS_SMALL) ; + // per default è cieco + hole.bBlind = true ; + // se verticale ed arriva fino al fondo grezzo, allora passante + if ( hole.vtDir.IsZplus() && hole.dLen > dRbDist - EPS_SMALL) + hole.bBlind = false ; + // altrimenti determino la distanza del fondo del foro dal bordo del grezzo + else { + Point3d ptEnd = hole.ptIni - hole.vtDir * hole.dLen ; + double dElev ; + if ( GetElevation( m_nPhase, hole.ptIni, - hole.vtDir, dElev) && dElev <= hole.dLen + 10) + hole.bBlind = false ; + } return true ; } diff --git a/Generator.cpp b/Generator.cpp index 5ff6997..dc5faf1 100644 --- a/Generator.cpp +++ b/Generator.cpp @@ -334,8 +334,12 @@ Generator::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd) // Recupero versore estrusione associato al percorso (normale al piano di interpolazione) Vector3d vtExtr ; m_pGeomDB->GetInfo( nClPathId, KEY_EXTR, vtExtr) ; + // Recupero punti di minimo e massimo ingombro + Point3d ptMin, ptMax ; + m_pGeomDB->GetInfo( nClPathId, KEY_PMIN, ptMin) ; + m_pGeomDB->GetInfo( nClPathId, KEY_PMAX, ptMax) ; // Emetto inizio percorso di lavoro - if ( ! OnPathStart( nClPathId, nClPathInd, ptStart, vtExtr)) + if ( ! OnPathStart( nClPathId, nClPathInd, ptStart, vtExtr, ptMin, ptMax)) return false ; // Ciclo su tutte le entità del percorso CL @@ -727,7 +731,8 @@ Generator::OnMachiningEnd( void) //---------------------------------------------------------------------------- bool -Generator::OnPathStart( int nClPathId, int nClPathInd, const Point3d& ptStart, const Vector3d& vtExtr) +Generator::OnPathStart( int nClPathId, int nClPathInd, const Point3d& ptStart, const Vector3d& vtExtr, + const Point3d& ptMin, const Point3d& ptMax) { // assegno identificativo e indice percorso di lavorazione bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ; @@ -735,6 +740,9 @@ Generator::OnPathStart( int nClPathId, int nClPathInd, const Point3d& ptStart, c // assegno punto iniziale e versore estrusione bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_START, ptStart) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXTR, vtExtr) ; + // assegno punti estremi dell'ingombro del percorso di lavorazione + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PMIN, ptMin) ; + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PMAX, ptMax) ; // chiamo la funzione di inizio percorso di lavorazione bOk = bOk && m_pMachine->LuaCallFunction( ON_PATH_START) ; return bOk ; diff --git a/Generator.h b/Generator.h index cfca568..af8874c 100644 --- a/Generator.h +++ b/Generator.h @@ -51,7 +51,8 @@ class Generator bool OnRawMoveData( int nRawId, int RawMoveInd, int nType, const Point3d& ptPos, int nFlag) ; bool OnMachiningStart( int nOpId, int nOpInd, double dSpeed) ; bool OnMachiningEnd( void) ; - bool OnPathStart( int nClPathId, int nClPathInd, const Point3d& ptStart, const Vector3d& vtExtr) ; + bool OnPathStart( int nClPathId, int nClPathInd, const Point3d& ptStart, const Vector3d& vtExtr, + const Point3d& ptMin, const Point3d& ptMax) ; bool OnPathEnd( void) ; bool OnRapid( int nMove, const DBLVECTOR& AxesEnd, int nAxesMask, int nFlag) ; bool OnLinear( int nMove, const DBLVECTOR& AxesEnd, double dFeed, int nFlag) ; diff --git a/Machine.h b/Machine.h index c80e749..eca76bf 100644 --- a/Machine.h +++ b/Machine.h @@ -56,7 +56,8 @@ class Machine bool UnloadTool( const string& sHead, int nExit) ; bool ResetHeadSet( const std::string& sHead) ; bool GetAxisToken( const std::string& sAxis, std::string& sToken) const ; - bool GetAxisType( const string& sAxis, bool& bLinear) const ; + bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const ; + bool GetAxisType( const std::string& sAxis, bool& bLinear) const ; bool SetAxisPos( const std::string& sAxis, double dVal) ; bool GetAxisPos( const std::string& sAxis, double& dVal) const ; bool GetAxisHomePos( const std::string& sAxis, double& dHomeVal) const ; diff --git a/MachineAxes.cpp b/MachineAxes.cpp index dbd3316..f277d07 100644 --- a/MachineAxes.cpp +++ b/MachineAxes.cpp @@ -38,6 +38,22 @@ Machine::GetAxisToken( const string& sAxis, string& sToken) const return true ; } +//---------------------------------------------------------------------------- +bool +Machine::GetAxisInvert( const string& sAxis, bool& bInvert) const +{ + // controllo GeomDB + if ( m_pGeomDB == nullptr) + return false ; + // recupero il relativo gestore + Axis* pAx = GetAxis( GetGroup( sAxis)) ; + if ( pAx == nullptr) + return false ; + // recupero il flag di inversione dell'asse + bInvert = pAx->GetInvert() ; + return true ; +} + //---------------------------------------------------------------------------- bool Machine::GetAxisType( const string& sAxis, bool& bLinear) const diff --git a/MachineLua.cpp b/MachineLua.cpp index a820eb1..48ca9e2 100644 --- a/MachineLua.cpp +++ b/MachineLua.cpp @@ -394,9 +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) + // lettura eventuale campo 'Invert' dalla tabella (default false) bool bInvert = false ; - LuaGetTabFieldParam( L, 1, FLD_TYPE, bInvert) ; + LuaGetTabFieldParam( L, 1, FLD_INVERT, bInvert) ; // lettura campo 'Type' dalla tabella int nType ; LuaCheckTabFieldParam( L, 1, FLD_TYPE, nType) diff --git a/Milling.cpp b/Milling.cpp index 3e2edbb..76c70dc 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -1294,6 +1294,12 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId) if ( ! AddSpiralMilling( pCompo, vtTool, vtExtr, dDepth, dElev, bSplitArcs)) return false ; } + + // assegno al gruppo l'ingombro del percorso di lavoro + BBox3d b3Grp ; + m_pGeomDB->GetGlobalBBox( nPxId, b3Grp) ; + m_pGeomDB->SetInfo( nPxId, KEY_PMIN, b3Grp.GetMin()) ; + m_pGeomDB->SetInfo( nPxId, KEY_PMAX, b3Grp.GetMax()) ; } // incremento numero di fresate diff --git a/OutputConst.h b/OutputConst.h index 1a9d042..07fb5b6 100644 --- a/OutputConst.h +++ b/OutputConst.h @@ -68,6 +68,8 @@ static const std::string GVAR_PATHID = ".PATHID" ; // (int) identifica static const std::string GVAR_PATHIND = ".PATHIND" ; // (int) indice percorso di lavorazione static const std::string GVAR_START = ".START" ; // (Point3d) punto iniziale del percorso originale static const std::string GVAR_EXTR = ".EXTR" ; // (Vector3d)versore estrusione +static const std::string GVAR_PMIN = ".PMIN" ; // (Point3d) punto minimo di ingombro del percorso di lavorazione +static const std::string GVAR_PMAX = ".PMAX" ; // (Point3d) punto massimo di ingombro del percorso di lavorazione static const std::string GVAR_MOVEID = ".MOVEID" ; // (int) identificativo movimento static const std::string GVAR_MOVEIND = ".MOVEIND" ; // (int) indice movimento static const std::string GVAR_MOVE = ".MOVE" ; // (int) tipo di movimento (0,1,2,3) diff --git a/Sawing.cpp b/Sawing.cpp index 63205b4..32cf2dd 100644 --- a/Sawing.cpp +++ b/Sawing.cpp @@ -1525,6 +1525,12 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V return false ; } + // assegno al gruppo l'ingombro del percorso di lavoro + BBox3d b3Grp ; + m_pGeomDB->GetGlobalBBox( nPxId, b3Grp) ; + m_pGeomDB->SetInfo( nPxId, KEY_PMIN, b3Grp.GetMin()) ; + m_pGeomDB->SetInfo( nPxId, KEY_PMAX, b3Grp.GetMax()) ; + return true ; } diff --git a/Simulator.cpp b/Simulator.cpp index 27fde05..495c433 100644 --- a/Simulator.cpp +++ b/Simulator.cpp @@ -136,9 +136,13 @@ Simulator::Start( void) // recupero versore estrusione associato al percorso (normale al piano di interpolazione) Vector3d vtExtr ; m_pGeomDB->GetInfo( m_nCLPathId, KEY_EXTR, vtExtr) ; + // recupero punti di minimo e massimo ingombro + Point3d ptMin, ptMax ; + m_pGeomDB->GetInfo( m_nCLPathId, KEY_PMIN, ptMin) ; + m_pGeomDB->GetInfo( m_nCLPathId, KEY_PMAX, ptMax) ; // richiamo gestione evento inizio percorso di lavoro ++ m_nCLPathInd ; - if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, ptStart, vtExtr)) + if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, ptStart, vtExtr, ptMin, ptMax)) return false ; return true ; @@ -183,9 +187,13 @@ Simulator::Move( int& nStatus) // recupero versore estrusione associato al percorso (normale al piano di interpolazione) Vector3d vtExtr ; m_pGeomDB->GetInfo( m_nCLPathId, KEY_EXTR, vtExtr) ; + // recupero punti di minimo e massimo ingombro + Point3d ptMin, ptMax ; + m_pGeomDB->GetInfo( m_nCLPathId, KEY_PMIN, ptMin) ; + m_pGeomDB->GetInfo( m_nCLPathId, KEY_PMAX, ptMax) ; // richiamo gestione evento inizio percorso di lavoro ++ m_nCLPathInd ; - if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, ptStart, vtExtr)) { + if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, ptStart, vtExtr, ptMin, ptMax)) { nStatus = MCH_SIM_ERR ; return false ; } @@ -249,8 +257,6 @@ Simulator::Move( int& nStatus) nStatus = MCH_SIM_ERR ; return false ; } - // recupero eventuali forzature assi da gestione inizio disposizione - UpdateAxesPos() ; break ; } // altrimenti disposizione passiva @@ -292,9 +298,13 @@ Simulator::Move( int& nStatus) // recupero versore estrusione associato al percorso (normale al piano di interpolazione) Vector3d vtExtr ; m_pGeomDB->GetInfo( m_nCLPathId, KEY_EXTR, vtExtr) ; + // recupero punti di minimo e massimo ingombro + Point3d ptMin, ptMax ; + m_pGeomDB->GetInfo( m_nCLPathId, KEY_PMIN, ptMin) ; + m_pGeomDB->GetInfo( m_nCLPathId, KEY_PMAX, ptMax) ; // richiamo gestione evento inizio percorso di lavoro ++ m_nCLPathInd ; - if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, ptStart, vtExtr)) { + if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, ptStart, vtExtr, ptMin, ptMax)) { nStatus = MCH_SIM_ERR ; return false ; } @@ -429,7 +439,19 @@ Simulator::GetAxisInfoPos( int nI, string& sToken, bool& bLinear, double& dVal) sToken = m_AuxAxesToken[ nI - nAxisCount] ; bLinear = m_AuxAxesLinear[ nI - nAxisCount] ; } - return m_pMchMgr->GetAxisPos( sName, dVal) ; + // recupero la posizione + if ( ! m_pMchMgr->GetAxisPos( sName, dVal)) + return false ; + // verifico se da invertire + if ( nI < nAxisCount) { + if ( m_AxesInvert[nI]) + dVal = - dVal ; + } + else { + if ( m_AuxAxesInvert[nI - nAxisCount]) + dVal = - dVal ; + } + return true ; } //---------------------------------------------------------------------------- @@ -599,11 +621,16 @@ Simulator::UpdateAxes( void) if ( ! pMachine->GetAllCurrAxesName( m_AxesName) || ! pMachine->GetAllCurrAxesToken( m_AxesToken)) return false ; - // Aggiorno il tipo e la posizione corrente degli assi macchina attivi + // Aggiorno flag invertito, il tipo e la posizione corrente degli assi macchina attivi + m_AxesInvert.clear() ; + m_AxesLinear.clear() ; m_AxesVal.clear() ; for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) { + bool bInvert ; + m_pMachine->GetAxisInvert( m_AxesName[i], bInvert) ; + m_AxesInvert.push_back( bInvert) ; bool bLinear ; - m_pMachine->GetAxisType(m_AxesName[i], bLinear) ; + m_pMachine->GetAxisType( m_AxesName[i], bLinear) ; m_AxesLinear.push_back( bLinear) ; double dVal ; m_pMachine->GetAxisPos( m_AxesName[i], dVal) ; @@ -670,6 +697,8 @@ Simulator::OnDispositionStarting( int nOpId, int nOpInd, int nPhase, return true ; // chiamo la funzione di inizio disposizione bOk = bOk && m_pMachine->LuaCallFunction( ON_SIMUL_DISPOSITION_STARTING) ; + // forzo aggiornamento posizione assi (possono essere stati mossi nello script) + UpdateAxesPos() ; return bOk ; } @@ -693,6 +722,8 @@ Simulator::OnDispositionStart( int nOpId, int nOpInd, int nPhase, return true ; // chiamo la funzione di inizio disposizione bOk = bOk && m_pMachine->LuaCallFunction( ON_SIMUL_DISPOSITION_START) ; + // forzo aggiornamento posizione assi (possono essere stati mossi nello script) + UpdateAxesPos() ; return bOk ; } @@ -705,6 +736,8 @@ Simulator::OnDispositionEnd( void) return true ; // chiamo la funzione di fine disposizione bool bOk = m_pMachine->LuaCallFunction( ON_SIMUL_DISPOSITION_END) ; + // forzo aggiornamento posizione assi (possono essere stati mossi nello script) + UpdateAxesPos() ; return bOk ; } @@ -735,7 +768,10 @@ Simulator::OnToolSelect( const string& sTool, const string& sHead, int nExit, co if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_TOOL_SELECT)) return true ; // chiamo la funzione di selezione utensile - return m_pMachine->LuaCallFunction( ON_SIMUL_TOOL_SELECT) ; + bool bOk = m_pMachine->LuaCallFunction( ON_SIMUL_TOOL_SELECT) ; + // forzo aggiornamento posizione assi (possono essere stati mossi nello script) + UpdateAxesPos() ; + return bOk ; } //---------------------------------------------------------------------------- @@ -750,9 +786,12 @@ Simulator::OnToolDeselect( const string& sNextHead, int nNextExit, const string& bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_NEXTTCPOS, sNextTcPos) ; // verifico esistenza funzione if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_TOOL_DESELECT)) - return true ; + return bOk ; // chiamo la funzione di deselezione utensile - return m_pMachine->LuaCallFunction( ON_SIMUL_TOOL_DESELECT) ; + bOk = bOk && m_pMachine->LuaCallFunction( ON_SIMUL_TOOL_DESELECT) ; + // forzo aggiornamento posizione assi (possono essere stati mossi nello script) + UpdateAxesPos() ; + return bOk ; } //---------------------------------------------------------------------------- @@ -767,7 +806,10 @@ Simulator::OnMachiningStart( int nOpId, int nOpInd) if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_MACHINING_START)) return true ; // chiamo la funzione di inizio disposizione - return m_pMachine->LuaCallFunction( ON_SIMUL_MACHINING_START) ; + bool bOk = m_pMachine->LuaCallFunction( ON_SIMUL_MACHINING_START) ; + // forzo aggiornamento posizione assi (possono essere stati mossi nello script) + UpdateAxesPos() ; + return bOk ; } //---------------------------------------------------------------------------- @@ -777,14 +819,17 @@ Simulator::OnMachiningEnd( void) // verifico esistenza funzione if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_MACHINING_END)) return true ; - // chiamo la funzione di fine disposizione + // chiamo la funzione di fine lavorazione bool bOk = m_pMachine->LuaCallFunction( ON_SIMUL_MACHINING_END) ; + // forzo aggiornamento posizione assi (possono essere stati mossi nello script) + UpdateAxesPos() ; return bOk ; } //---------------------------------------------------------------------------- bool -Simulator::OnPathStart( int nClPathId, int nClPathInd, const Point3d& ptStart, const Vector3d& vtExtr) +Simulator::OnPathStart( int nClPathId, int nClPathInd, const Point3d& ptStart, const Vector3d& vtExtr, + const Point3d& ptMin, const Point3d& ptMax) { // assegno identificativo e indice percorso di lavorazione bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ; @@ -792,11 +837,16 @@ Simulator::OnPathStart( int nClPathId, int nClPathInd, const Point3d& ptStart, c // assegno punto iniziale e versore estrusione bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_START, ptStart) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXTR, vtExtr) ; + // assegno punti estremi dell'ingombro del percorso di lavorazione + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PMIN, ptMin) ; + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PMAX, ptMax) ; // verifico esistenza funzione if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_PATH_START)) return bOk ; // chiamo la funzione di inizio percorso di lavorazione bOk = bOk && m_pMachine->LuaCallFunction( ON_SIMUL_PATH_START) ; + // forzo aggiornamento posizione assi (possono essere stati mossi nello script) + UpdateAxesPos() ; return bOk ; } @@ -809,6 +859,8 @@ Simulator::OnPathEnd( void) return true ; // chiamo la funzione di fine percorso di lavorazione bool bOk = m_pMachine->LuaCallFunction( ON_SIMUL_PATH_END) ; + // forzo aggiornamento posizione assi (possono essere stati mossi nello script) + UpdateAxesPos() ; return bOk ; } @@ -819,6 +871,7 @@ Simulator::OnMoveStart( const CamData* pCamData) // pulisco dati assi ausiliari m_AuxAxesName.clear() ; m_AuxAxesToken.clear() ; + m_AuxAxesInvert.clear() ; m_AuxAxesLinear.clear() ; m_AuxAxesVal.clear() ; m_AuxAxesEnd.clear() ; @@ -853,7 +906,7 @@ Simulator::OnMoveStart( const CamData* pCamData) if ( ! bOk) return false ; - // forzo aggiornamento posizione assi (possono essere stati messi nello script) + // forzo aggiornamento posizione assi (possono essere stati mossi nello script) UpdateAxesPos() ; // recupero i dati di ritorno @@ -862,19 +915,23 @@ Simulator::OnMoveStart( const CamData* pCamData) return true ; m_AuxAxesName.reserve( nNumAuxAxes) ; m_AuxAxesToken.reserve( nNumAuxAxes) ; + m_AuxAxesInvert.reserve( nNumAuxAxes) ; + m_AuxAxesLinear.reserve( nNumAuxAxes) ; m_AuxAxesVal.reserve( nNumAuxAxes) ; m_AuxAxesEnd.reserve( nNumAuxAxes) ; for ( int i = 1 ; i <= nNumAuxAxes && bOk ; ++ i) { - string sName ; string sToken ; bool bLinear ; double dVal ; double dEnd ; + string sName ; string sToken ; bool bInvert ; bool bLinear ; double dVal ; double dEnd ; string sAuxAxVal = GLOB_VAR + GVAR_AN ; ReplaceString( sAuxAxVal, "N", ToString( i)) ; string sAuxAxName = GLOB_VAR + GVAR_ANN ; ReplaceString( sAuxAxName, "N", ToString( i)) ; if ( m_pMachine->LuaGetGlobVar( sAuxAxName, sName) && m_pMachine->GetAxisToken( sName, sToken) && + m_pMachine->GetAxisInvert( sName, bInvert) && m_pMachine->GetAxisType( sName, bLinear) && m_pMachine->GetAxisPos( sName, dVal) && m_pMachine->LuaGetGlobVar( sAuxAxVal, dEnd)) { m_AuxAxesName.emplace_back( sName) ; m_AuxAxesToken.emplace_back( sToken) ; + m_AuxAxesInvert.push_back( bInvert) ; m_AuxAxesLinear.push_back( bLinear) ; m_AuxAxesVal.emplace_back( dVal) ; m_AuxAxesEnd.emplace_back( dEnd) ; @@ -895,6 +952,8 @@ Simulator::OnMoveEnd( void) return true ; // chiamo la funzione bool bOk = m_pMachine->LuaCallFunction( ON_SIMUL_MOVE_END) ; + // forzo aggiornamento posizione assi (possono essere stati mossi nello script) + UpdateAxesPos() ; return bOk ; } diff --git a/Simulator.h b/Simulator.h index 30079d4..c58d6c4 100644 --- a/Simulator.h +++ b/Simulator.h @@ -52,7 +52,8 @@ class Simulator bool OnToolDeselect( const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos) ; bool OnMachiningStart( int nOpId, int nOpInd) ; bool OnMachiningEnd( void) ; - bool OnPathStart( int nClPathId, int nClPathInd, const Point3d& ptStart, const Vector3d& vtExtr) ; + bool OnPathStart( int nClPathId, int nClPathInd, const Point3d& ptStart, const Vector3d& vtExtr, + const Point3d& ptMin, const Point3d& ptMax) ; bool OnPathEnd( void) ; bool OnMoveStart( const CamData* pCamData) ; bool OnMoveEnd( void) ; @@ -73,10 +74,12 @@ class Simulator std::string m_sTool ; // nome dell'utensile corrente STRVECTOR m_AxesName ; // nomi degli assi macchina attivi STRVECTOR m_AxesToken ; // token degli assi macchina attivi + BOOLVECTOR m_AxesInvert ; // flag di asse con verso invertito BOOLVECTOR m_AxesLinear ; // flag di lineare degli assi macchina attivi DBLVECTOR m_AxesVal ; // valori degli assi macchina all'inizio del movimento corrente STRVECTOR m_AuxAxesName ; // nomi degli assi macchina ausiliari abilitati STRVECTOR m_AuxAxesToken ; // token degli assi macchina ausiliari abilitati + BOOLVECTOR m_AuxAxesInvert ; // flag di asse con verso invertito degli assi macchina ausiliari abilitati BOOLVECTOR m_AuxAxesLinear ; // flag di lineare degli assi macchina ausiliari abilitati DBLVECTOR m_AuxAxesVal ; // valori degli assi macchina ausiliari all'inizio del movimento corrente DBLVECTOR m_AuxAxesEnd ; // valori degli assi macchina ausiliari alla fine del movimento corrente