EgtMachKernel :
- aggiunto flag bToolOn a EmtAddCollisionObjEx per dichiarare che è utensile in lavoro (necessario quando si usano più utensili contemporaneamente).
This commit is contained in:
@@ -452,7 +452,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, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
|
||||
bool SimAddCollisionObj( int nInd, bool bToolOn, 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) ;
|
||||
bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst) ;
|
||||
|
||||
@@ -150,13 +150,13 @@ MachMgr::SimExit( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SimAddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
|
||||
MachMgr::SimAddCollisionObj( int nInd, bool bToolOn, 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, vtMove, dPar1, dPar2, dPar3) ;
|
||||
return m_pSimul->AddCollisionObj( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+5
-3
@@ -1262,7 +1262,7 @@ 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, Vector3d(), dPar1, dPar2, dPar3)) ;
|
||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimAddCollisionObj( nInd, false, nFrameId, nType, Vector3d(), dPar1, dPar2, dPar3)) ;
|
||||
// assegno risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -1272,7 +1272,7 @@ Machine::LuaEmtAddCollisionObj( lua_State* L)
|
||||
int
|
||||
Machine::LuaEmtAddCollisionObjEx( lua_State* L)
|
||||
{
|
||||
// 7 parametri : nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3
|
||||
// 7 o 8 parametri : nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3 [,bToolOn]
|
||||
int nInd ;
|
||||
LuaCheckParam( L, 1, nInd)
|
||||
int nFrameId ;
|
||||
@@ -1287,12 +1287,14 @@ Machine::LuaEmtAddCollisionObjEx( lua_State* L)
|
||||
LuaCheckParam( L, 6, dPar2)
|
||||
double dPar3 ;
|
||||
LuaCheckParam( L, 7, dPar3)
|
||||
bool bToolOn = false ;
|
||||
LuaGetParam( L, 8, bToolOn) ;
|
||||
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)) ;
|
||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimAddCollisionObj( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3)) ;
|
||||
// assegno risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
|
||||
+4
-4
@@ -1319,8 +1319,8 @@ Simulator::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
|
||||
// verifico se è l'utensile attivo
|
||||
string sHead ; m_pGeomDB->GetName( m_pGeomDB->GetParentId( m_CollObj[j].nFrameId), sHead) ;
|
||||
string sExit ; m_pGeomDB->GetName( m_CollObj[j].nFrameId, sExit) ;
|
||||
bool bIsTool = ( sHead == m_sHead &&
|
||||
( sExit == string( "_T") + ToString( m_nExit) || sExit == string( "_TT") + ToString( m_nExit))) ;
|
||||
bool bIsTool = m_CollObj[j].bToolOn ||
|
||||
( sHead == m_sHead && ( sExit == "_T" + ToString( m_nExit) || sExit == "_TT" + ToString( m_nExit))) ;
|
||||
// se utensile attivo su grezzo in lavoro e non è rapido, salto
|
||||
if ( bIsTool && bIsRaw && nMoveType != 0)
|
||||
continue ;
|
||||
@@ -1922,7 +1922,7 @@ Simulator::OnResetMachine( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::AddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
|
||||
Simulator::AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
|
||||
{
|
||||
// verifiche sui parametri
|
||||
if ( nInd <= 0 || nFrameId <= GDB_ID_NULL)
|
||||
@@ -1948,7 +1948,7 @@ Simulator::AddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& v
|
||||
return false ;
|
||||
}
|
||||
// aggiungo al vettore
|
||||
m_CollObj.emplace_back( nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
|
||||
m_CollObj.emplace_back( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -53,7 +53,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, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
|
||||
bool AddCollisionObj( int nInd, bool bToolOn, 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) ;
|
||||
bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst) ;
|
||||
@@ -111,15 +111,16 @@ class Simulator
|
||||
private :
|
||||
struct CollObj {
|
||||
int nInd ;
|
||||
bool bToolOn ;
|
||||
int nFrameId ;
|
||||
int nType ;
|
||||
Vector3d vtMove ;
|
||||
double dPar1 ;
|
||||
double dPar2 ;
|
||||
double dPar3 ;
|
||||
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) {}
|
||||
CollObj( void) : nInd( 0), bToolOn( false), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
|
||||
CollObj( int nI, bool bTOn, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
|
||||
: nInd( nI), bToolOn( bTOn), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
|
||||
} ;
|
||||
typedef std::vector<CollObj> COBVECTOR ;
|
||||
struct VmTool
|
||||
|
||||
Reference in New Issue
Block a user