Merge remote-tracking branch 'origin/HEAD' into Sara
This commit is contained in:
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2021
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachMgr.h Data : 17.03.21 Versione : 2.3c1
|
||||
// File : MachMgr.h Data : 24.05.21 Versione : 2.3e3
|
||||
// Contenuto : Dichiarazione della classe MachMgr.
|
||||
//
|
||||
//
|
||||
@@ -441,7 +441,7 @@ class MachMgr : public IMachMgr
|
||||
bool GetOperationNewName( std::string& sName) const ;
|
||||
const ToolData* GetMachiningToolData( void) const ;
|
||||
// Simulation
|
||||
bool SimAddCollisionObj( int nInd, int nFrameId, int nType, double dPar1, double dPar2, double dPar3) ;
|
||||
bool SimAddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
|
||||
bool SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
|
||||
bool SimOnCollision( int nCdInd, int nObjInd, int& nErr) ;
|
||||
// Machine
|
||||
|
||||
@@ -150,13 +150,13 @@ MachMgr::SimExit( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SimAddCollisionObj( int nInd, int nFrameId, int nType, double dPar1, double dPar2, double dPar3)
|
||||
MachMgr::SimAddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
|
||||
{
|
||||
// verifico simulatore
|
||||
if ( m_pSimul == nullptr)
|
||||
return false ;
|
||||
// aggiungo un oggetto da verificare per la collisione con il grezzo
|
||||
return m_pSimul->AddCollisionObj( nInd, nFrameId, nType, dPar1, dPar2, dPar3) ;
|
||||
return m_pSimul->AddCollisionObj( nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -332,6 +332,7 @@ class Machine
|
||||
static int LuaEmtSetLastError( lua_State* L) ;
|
||||
static int LuaEmtSetWarning( lua_State* L) ;
|
||||
static int LuaEmtAddCollisionObj( lua_State* L) ;
|
||||
static int LuaEmtAddCollisionObjEx( lua_State* L) ;
|
||||
static int LuaEmtExecCollisionCheck( lua_State* L) ;
|
||||
static int LuaEmtOnCollision( lua_State* L) ;
|
||||
} ;
|
||||
|
||||
+33
-1
@@ -122,6 +122,8 @@ Machine::LuaInit( const string& sMachineName)
|
||||
m_LuaMgr.RegisterFunction( "EmtSetWarning", Machine::LuaEmtSetWarning) ;
|
||||
// registro la funzione per aggiungere un oggetto da verificare per la collisione in simulazione
|
||||
m_LuaMgr.RegisterFunction( "EmtAddCollisionObj", Machine::LuaEmtAddCollisionObj) ;
|
||||
// registro la funzione estesa per aggiungere un oggetto da verificare per la collisione in simulazione
|
||||
m_LuaMgr.RegisterFunction( "EmtAddCollisionObjEx", Machine::LuaEmtAddCollisionObjEx) ;
|
||||
// registro la funzione di esecuzione della verifica di collisione in simulazione
|
||||
m_LuaMgr.RegisterFunction( "EmtExecCollisionCheck", Machine::LuaEmtExecCollisionCheck) ;
|
||||
// registro la funzione di gestione della collisione in simulazione
|
||||
@@ -1202,7 +1204,37 @@ Machine::LuaEmtAddCollisionObj( lua_State* L)
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// assegno i dati
|
||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimAddCollisionObj( nInd, nFrameId, nType, dPar1, dPar2, dPar3)) ;
|
||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimAddCollisionObj( nInd, nFrameId, nType, Vector3d(), dPar1, dPar2, dPar3)) ;
|
||||
// assegno risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtAddCollisionObjEx( lua_State* L)
|
||||
{
|
||||
// 7 parametri : nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3
|
||||
int nInd ;
|
||||
LuaCheckParam( L, 1, nInd)
|
||||
int nFrameId ;
|
||||
LuaCheckParam( L, 2, nFrameId)
|
||||
int nType ;
|
||||
LuaCheckParam( L, 3, nType)
|
||||
Vector3d vtMove ;
|
||||
LuaCheckParam( L, 4, vtMove)
|
||||
double dPar1 ;
|
||||
LuaCheckParam( L, 5, dPar1)
|
||||
double dPar2 ;
|
||||
LuaCheckParam( L, 6, dPar2)
|
||||
double dPar3 ;
|
||||
LuaCheckParam( L, 7, dPar3)
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// assegno i dati
|
||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimAddCollisionObj( nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3)) ;
|
||||
// assegno risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
|
||||
@@ -104,6 +104,8 @@ const std::string MCH_EXIT = "T" ;
|
||||
const std::string MCH_ZMAXONROT = "ZMAXONROT" ;
|
||||
// Info di testa per una extra risalita in Z
|
||||
const std::string MCH_ZEXTRA = "ZEXTRA" ;
|
||||
// Info di testa per abilitare rotazione a Zmax
|
||||
const std::string MCH_ROTATZMAX = "ROTATZMAX" ;
|
||||
// Info di testa per dichiarazione Home Z in basso
|
||||
const std::string MCH_ZHOMEDOWN = "ZHOMEDOWN" ;
|
||||
// Info di testa per dichiarazione Da Sopra
|
||||
|
||||
+43
-4
@@ -1758,6 +1758,7 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
|
||||
DBLVECTOR vAxVal2 = vAxVal ; vAxVal2[2] = dHomeZ ;
|
||||
DBLVECTOR vAxIni2 = vAxIni ; vAxIni2[2] = dHomeZ ;
|
||||
if ( ! TestCollisionAvoid( vAxVal2, vAxIni2)) {
|
||||
// se ammessa risalita aggiuntiva
|
||||
double dExtraZ, dMaxAngV ;
|
||||
if ( GetExtraZ( dHomeZ, dExtraZ, dMaxAngV)) {
|
||||
if ( vAxVal2.size() < 5 || ( abs( vAxVal2[4]) < dMaxAngV && abs( vAxIni2[4]) < dMaxAngV)) {
|
||||
@@ -1772,14 +1773,37 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
|
||||
else
|
||||
bToZmax = true ;
|
||||
}
|
||||
// se altrimenti ammessa rotazione a Zmax e richiesta rotazione
|
||||
else if ( GetRotationAtZmax() &&
|
||||
(( vAxVal2.size() >= 4 && abs( vAxVal2[3] - vAxIni2[3]) > 5) ||
|
||||
( vAxVal2.size() >= 5 && abs( vAxVal2[4] - vAxIni2[4]) > 5))) {
|
||||
// verifico se va bene rotazione assi iniziale e poi movimento
|
||||
DBLVECTOR vAxMid2 = vAxVal2 ;
|
||||
vAxMid2[3] = vAxIni2[3] ;
|
||||
if ( vAxVal2.size() >= 5)
|
||||
vAxMid2[4] = vAxIni2[4] ;
|
||||
if ( TestCollisionAvoid( vAxVal2, vAxMid2) &&
|
||||
TestCollisionAvoid( vAxMid2, vAxIni2) &&
|
||||
pPrevOp->AddRise( vAxVal2) &&
|
||||
pPrevOp->AddSpecialRise( vAxMid2, true, GDB_ID_NULL, 5)) {
|
||||
vAxVal = vAxMid2 ;
|
||||
bMaxZ = true ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
// Se richiesta risalita a Zmax
|
||||
if ( bToZmax || ForcedZmax( vAxVal, vAxIni)) {
|
||||
// Se già a Zmax
|
||||
if ( bMaxZ) {
|
||||
// non devo fare alcunché
|
||||
}
|
||||
// se altrimenti richiesta risalita a Zmax
|
||||
else if ( bToZmax || ForcedZmax( vAxVal, vAxIni)) {
|
||||
// cancello eventuale risalita parziale della lavorazione precedente
|
||||
pPrevOp->RemoveRise() ;
|
||||
// aggiungo risalita a Zmax
|
||||
@@ -2240,7 +2264,7 @@ Operation::AddRise( DBLVECTOR& vAxVal, double dDelta, int nClPathId, bool bZHome
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk, int nClPathId)
|
||||
Operation::AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk, int nClPathId, int nFlag)
|
||||
{
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
@@ -2286,7 +2310,8 @@ Operation::AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk, int nClPathId)
|
||||
pCam->SetAxes( ( bOk ? CamData::AS_OK : CamData::AS_OUTSTROKE), vAxVal) ;
|
||||
pCam->SetMoveType( 0) ;
|
||||
pCam->SetFeed( 0) ;
|
||||
pCam->SetFlag( 0) ;
|
||||
pCam->SetFlag( nFlag) ;
|
||||
pCam->SetFlag2( 0) ;
|
||||
// associo questo oggetto a quello geometrico
|
||||
m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
|
||||
|
||||
@@ -2495,6 +2520,20 @@ Operation::GetExtraZ( double dSafeZ, double& dExtraZ, double& dMaxAngV) const
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetRotationAtZmax( void) const
|
||||
{
|
||||
// Recupero macchina corrente
|
||||
Machine* pMch = ( m_pMchMgr != nullptr ? m_pMchMgr->GetCurrMachine() : nullptr) ;
|
||||
if ( pMch == nullptr)
|
||||
return 0 ;
|
||||
// Se testa con Info ROTATZMAX la recupero e restituisco abilitazione rotazione a Zmax
|
||||
int nHeadId = pMch->GetCurrHead() ;
|
||||
int nVal = 0 ;
|
||||
return ( m_pGeomDB->GetInfo( nHeadId, MCH_ROTATZMAX, nVal) && nVal != 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const
|
||||
|
||||
+2
-1
@@ -107,11 +107,12 @@ class Operation : public IUserObj
|
||||
bool ToolChangeNeeded( const Operation& Op1, const Operation& Op2) const ;
|
||||
bool RemoveClimb( int nClPathId) ;
|
||||
bool AddRise( DBLVECTOR& vAxVal, double dDelta = - 1, int nClPathId = GDB_ID_NULL, bool bZHomeDown = false) ;
|
||||
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL) ;
|
||||
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, int nFlag = 0) ;
|
||||
bool RemoveRise( int nClPathId = GDB_ID_NULL) ;
|
||||
bool AddHome( void) ;
|
||||
bool CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const ;
|
||||
bool GetExtraZ( double dSafeZ, double& dExtraZ, double& dMaxAngV) const ;
|
||||
bool GetRotationAtZmax( void) const ;
|
||||
bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
|
||||
int GetUserNotesZmax( void) const ;
|
||||
bool GetZHomeDown( void) const ;
|
||||
|
||||
+19
-4
@@ -24,6 +24,7 @@
|
||||
#include "/EgtDev/Include/EGkCDeBoxClosedSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkCDeCylClosedSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkCDeSpheClosedSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkCDeConeFrustumClosedSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkVolZmap.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
@@ -1231,6 +1232,10 @@ Simulator::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
|
||||
// esecuzione controlli di collisione
|
||||
bool bOk = true ;
|
||||
Frame3d frObj = pGeoFrame->GetFrame() ;
|
||||
if ( ! m_CollObj[j].vtMove.IsSmall())
|
||||
frObj.Translate( m_CollObj[j].vtMove.x * frObj.VersX() +
|
||||
m_CollObj[j].vtMove.y * frObj.VersY() +
|
||||
m_CollObj[j].vtMove.z * frObj.VersZ()) ;
|
||||
Frame3d frParent ; m_pGeomDB->GetGlobFrame( m_CollObj[j].nFrameId, frParent) ;
|
||||
frObj.LocToLoc( frParent, frCd) ;
|
||||
if ( m_CollObj[j].nType == MCH_SIM_COB_BOX) {
|
||||
@@ -1252,6 +1257,12 @@ Simulator::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
|
||||
else
|
||||
bOk = ! CDeSpheClosedSurfTm( frObj.Orig(), m_CollObj[j].dPar1, m_dSafeDist, *pSTM) ;
|
||||
}
|
||||
else if ( m_CollObj[j].nType == MCH_SIM_COB_CONE) {
|
||||
if ( pVZM != nullptr)
|
||||
bOk = pVZM->AvoidConeFrustum( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeConeFrustumClosedSurfTm( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, m_dSafeDist, *pSTM) ;
|
||||
}
|
||||
if ( ! bOk) {
|
||||
nCdInd = i ;
|
||||
nObjInd = j ;
|
||||
@@ -1752,7 +1763,7 @@ Simulator::OnResetMachine( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::AddCollisionObj( int nInd, int nFrameId, int nType, double dPar1, double dPar2, double dPar3)
|
||||
Simulator::AddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
|
||||
{
|
||||
// verifiche sui parametri
|
||||
if ( nInd <= 0 || nFrameId <= GDB_ID_NULL)
|
||||
@@ -1763,17 +1774,21 @@ Simulator::AddCollisionObj( int nInd, int nFrameId, int nType, double dPar1, dou
|
||||
return false ;
|
||||
break ;
|
||||
case MCH_SIM_COB_CYL :
|
||||
if ( abs( dPar1) < EPS_SMALL || abs( dPar2) < EPS_SMALL)
|
||||
if ( dPar1 < EPS_SMALL || abs( dPar2) < EPS_SMALL)
|
||||
return false ;
|
||||
break ;
|
||||
case MCH_SIM_COB_SPHE :
|
||||
if ( abs( dPar1) < EPS_SMALL)
|
||||
if ( dPar1 < EPS_SMALL)
|
||||
return false ;
|
||||
break ;
|
||||
case MCH_SIM_COB_CONE :
|
||||
if ( ( dPar1 < EPS_SMALL && dPar2 < EPS_SMALL) || dPar3 < EPS_SMALL)
|
||||
return false ;
|
||||
break ;
|
||||
default :
|
||||
return false ;
|
||||
}
|
||||
// aggiungo al vettore
|
||||
m_CollObj.emplace_back( nInd, nFrameId, nType, dPar1, dPar2, dPar3) ;
|
||||
m_CollObj.emplace_back( nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
+5
-4
@@ -37,7 +37,7 @@ class Simulator
|
||||
bool GetToolInfo( std::string& sName, double& dSpeed) const ;
|
||||
bool GetOperationInfo( std::string& sName, int& nType) const ;
|
||||
bool GetMoveInfo( int& nGmove, double& dFeed) const ;
|
||||
bool AddCollisionObj( int nInd, int nFrameId, int nType, double dPar1, double dPar2, double dPar3) ;
|
||||
bool AddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
|
||||
bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
|
||||
bool OnCollision( int nCdInd, int nObjInd, int& nErr) ;
|
||||
|
||||
@@ -94,12 +94,13 @@ class Simulator
|
||||
int nInd ;
|
||||
int nFrameId ;
|
||||
int nType ;
|
||||
Vector3d vtMove ;
|
||||
double dPar1 ;
|
||||
double dPar2 ;
|
||||
double dPar3 ;
|
||||
CollObj( void) : nInd( 0), nFrameId( -1), nType( 0), dPar1( 0), dPar2( 0), dPar3( 0) {}
|
||||
CollObj( int nI, int nF, int nT, double dP1, double dP2, double dP3)
|
||||
: nInd( nI), nFrameId( nF), nType( nT), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
|
||||
CollObj( void) : nInd( 0), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
|
||||
CollObj( int nI, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
|
||||
: nInd( nI), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
|
||||
} ;
|
||||
typedef std::vector< CollObj> COBVECTOR ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user