EgtMachKernel 1.6r4 :
- prima versione del bloccaggio assi rotanti.
This commit is contained in:
Binary file not shown.
@@ -31,11 +31,21 @@ struct MachGrp {
|
||||
MachGrp( void)
|
||||
: MGeoName(), SetupGroupId( GDB_ID_NULL), FixtGroupId( GDB_ID_NULL),
|
||||
RawGroupId( GDB_ID_NULL), OperGroupId( GDB_ID_NULL) {}
|
||||
MachGrp( std::string MgName, int SgId, int FgId, int RgId, int OgId)
|
||||
MachGrp( const std::string& MgName, int SgId, int FgId, int RgId, int OgId)
|
||||
: MGeoName( MgName), SetupGroupId( SgId), FixtGroupId( FgId),
|
||||
RawGroupId( RgId), OperGroupId( OgId) {}
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
struct AxisBlock {
|
||||
std::string sAxis ;
|
||||
double dVal ;
|
||||
AxisBlock( void)
|
||||
: sAxis(), dVal( 0) {}
|
||||
AxisBlock( const std::string& sA, double dV)
|
||||
: sAxis( sA), dVal( dV) {}
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
struct MachineData {
|
||||
Machine* pMachine ;
|
||||
@@ -219,11 +229,10 @@ class MachMgr : public IMachMgr
|
||||
// Machine Calc
|
||||
bool SetCalcTable( const std::string& sTable) override ;
|
||||
bool SetCalcTool( const std::string& sTool, const std::string& sHead, int nExit) override ;
|
||||
bool SetRotAxisBlock( const std::string& sAxis, double dVal) override ;
|
||||
bool GetCalcTool( std::string& sTool) override ;
|
||||
bool GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) override ;
|
||||
bool BlockKinematicRotAxis( const std::string& sAxis, double dVal) ;
|
||||
bool FreeKinematicRotAxis( const std::string& sAxis) ;
|
||||
bool GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) ;
|
||||
bool GetCalcPositions( const Point3d& ptP, double dAngA, double dAngB,
|
||||
@@ -235,6 +244,7 @@ class MachMgr : public IMachMgr
|
||||
bool GetCalcToolDirFromAngles( double dAngA, double dAngB, Vector3d& vtDir) override ;
|
||||
bool GetNearestAngleInStroke( int nId, double dAngRef, double& dAng) override ;
|
||||
bool VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) override ;
|
||||
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat) ;
|
||||
const std::string& GetOutstrokeInfo( void) const override ;
|
||||
// Machine
|
||||
int GetBaseId( const std::string& sBase) const override ;
|
||||
@@ -290,8 +300,9 @@ class MachMgr : public IMachMgr
|
||||
int GetCurrRotAxes( void) ;
|
||||
bool GetAllCurrAxesName( STRVECTOR& vAxName) ;
|
||||
bool GetAllCalcAxesHomePos( DBLVECTOR& vAxHomeVal) ;
|
||||
double GetCalcRot1W( void) ;
|
||||
bool ApplyRotAxisBlock( void) ;
|
||||
bool IsKinematicRotAxisBlocked( int nInd) ;
|
||||
double GetCalcRot1W( void) ;
|
||||
// operations
|
||||
bool GetOperationNewName( std::string& sName) const ;
|
||||
const ToolData* GetMachiningToolData( void) const ;
|
||||
@@ -334,6 +345,7 @@ class MachMgr : public IMachMgr
|
||||
|
||||
private :
|
||||
typedef std::vector<MachineData> MCHDATAVECTOR ;
|
||||
typedef std::vector<AxisBlock> AXBLOCKVECTOR ;
|
||||
|
||||
private :
|
||||
int m_nContextId ; // indice contesto corrente (1-based)
|
||||
@@ -351,5 +363,6 @@ class MachMgr : public IMachMgr
|
||||
int m_nCurrPhase ; // indice fase corrente (1-based)
|
||||
int m_nCurrDispId ; // identificativo della disposizione corrente
|
||||
int m_nCurrMachiningId ; // identificativo della lavorazione corrente
|
||||
AXBLOCKVECTOR m_vAxisBlock ; // elenco assi da bloccare
|
||||
Simulator* m_pSimul ; // puntatore al simulatore attivo
|
||||
} ;
|
||||
|
||||
+49
-25
@@ -245,6 +245,46 @@ MachMgr::SetCalcTool( const string& sTool, const string& sHead, int nExit)
|
||||
return ( ( pMch != nullptr) ? pMch->SetCurrTool( sTool, sHead, nExit) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SetRotAxisBlock( const string& sAxis, double dVal)
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
int nAxId = pMch->GetAxisId( sAxis) ;
|
||||
if ( nAxId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_vAxisBlock.emplace_back( sAxis, dVal) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::ApplyRotAxisBlock( void)
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// applico blocchi
|
||||
bool bOk = true ;
|
||||
for ( auto& abVal : m_vAxisBlock) {
|
||||
if ( ! pMch->BlockKinematicRotAxis( abVal.sAxis, abVal.dVal))
|
||||
bOk = false ;
|
||||
}
|
||||
// pulisco
|
||||
m_vAxisBlock.clear() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::IsKinematicRotAxisBlocked( int nInd)
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->IsKinematicRotAxisBlocked( nInd) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCalcTool( string& sTool)
|
||||
@@ -302,30 +342,6 @@ MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
return ( ( pMch != nullptr) ? pMch->GetAngles( vtDirT, vtDirA, nStat, dAngA1, dAngB1, dAngA2, dAngB2) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::BlockKinematicRotAxis( const string& sAxis, double dVal)
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->BlockKinematicRotAxis( sAxis, dVal) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::FreeKinematicRotAxis( const string& sAxis)
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->FreeKinematicRotAxis( sAxis) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::IsKinematicRotAxisBlocked( int nInd)
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->IsKinematicRotAxisBlocked( nInd) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
@@ -382,9 +398,17 @@ MachMgr::GetNearestAngleInStroke( int nId, double dAngRef, double& dAng)
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat)
|
||||
{
|
||||
DBLVECTOR vAng(2) ; vAng[0] = dAngA ; vAng[1] = dAngB ;
|
||||
return VerifyOutstroke( dX, dY, dZ, vAng, nStat) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat)
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
return ( ( pMch != nullptr) ? pMch->VerifyOutstroke( dX, dY, dZ, dAngA, dAngB, nStat) : false) ;
|
||||
return ( ( pMch != nullptr) ? pMch->VerifyOutstroke( dX, dY, dZ, vAng, nStat) : false) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -89,7 +89,7 @@ class Machine
|
||||
bool bBottom, Point3d& ptTip) const ;
|
||||
bool GetToolDirFromAngles( double dAngA, double dAngB, Vector3d& vtDir) const ;
|
||||
bool GetNearestAngleInStroke( int nId, double dAngRef, double& dAng) const ;
|
||||
bool VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) const ;
|
||||
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat) const ;
|
||||
const std::string& GetOutstrokeInfo( void) const
|
||||
{ return m_sOutstrokeInfo ; }
|
||||
bool LinkRawPartToGroup( int nRawPartId, const std::string& sGroupName) ;
|
||||
|
||||
+26
-60
@@ -937,74 +937,40 @@ Machine::GetNearestAngleInStroke( int nId, double dAngRef, double& dAng) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) const
|
||||
Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat) const
|
||||
{
|
||||
// default tutto ok
|
||||
nStat = 0 ;
|
||||
m_sOutstrokeInfo.clear() ;
|
||||
// primo lineare
|
||||
if ( m_vCalcLinAx.size() >= 1) {
|
||||
if ( dX < m_vCalcLinAx[0].stroke.Min) {
|
||||
nStat += 1 ;
|
||||
string sAxName = GetAxis( m_vCalcLinAx[0].nGrpId)->GetName() ;
|
||||
m_sOutstrokeInfo += sAxName + "=" + ToString( dX - m_vCalcLinAx[0].stroke.Min, 1) + " (L1-) " ;
|
||||
// verifica degli assi lineari
|
||||
DBLVECTOR vLin( 3) ; vLin[0] = dX ; vLin[1] = dY ; vLin[2] = dZ ;
|
||||
for ( size_t i = 0 ; i < m_vCalcLinAx.size() && i < vLin.size() ; ++ i) {
|
||||
if ( vLin[i] < m_vCalcLinAx[i].stroke.Min) {
|
||||
nStat += ( 1 << ( 2 * i)) ;
|
||||
string sAxName = GetAxis( m_vCalcLinAx[i].nGrpId)->GetName() ;
|
||||
m_sOutstrokeInfo += sAxName + "=" + ToString( vLin[i] - m_vCalcLinAx[i].stroke.Min, 1) +
|
||||
" (L" + ToString( int(i) + 1) + "-) " ;
|
||||
}
|
||||
else if( dX > m_vCalcLinAx[0].stroke.Max) {
|
||||
nStat += 2 ;
|
||||
string sAxName = GetAxis( m_vCalcLinAx[0].nGrpId)->GetName() ;
|
||||
m_sOutstrokeInfo += sAxName + "=" + ToString( dX - m_vCalcLinAx[0].stroke.Max, 1) + " (L1+) " ;
|
||||
else if( vLin[i] > m_vCalcLinAx[i].stroke.Max) {
|
||||
nStat += ( 2 << ( 2 * i)) ;
|
||||
string sAxName = GetAxis( m_vCalcLinAx[i].nGrpId)->GetName() ;
|
||||
m_sOutstrokeInfo += sAxName + "=" + ToString( vLin[i] - m_vCalcLinAx[i].stroke.Max, 1) +
|
||||
" (L" + ToString( int(i) + 1) + "+) " ;
|
||||
}
|
||||
}
|
||||
// secondo lineare
|
||||
if ( m_vCalcLinAx.size() >= 2) {
|
||||
if ( dY < m_vCalcLinAx[1].stroke.Min) {
|
||||
nStat += 4 ;
|
||||
string sAxName = GetAxis( m_vCalcLinAx[1].nGrpId)->GetName() ;
|
||||
m_sOutstrokeInfo += sAxName + "=" + ToString( dY - m_vCalcLinAx[1].stroke.Min, 1) + " (L2-) " ;
|
||||
// verifica degli assi rotanti
|
||||
for ( size_t i = 0 ; i < m_vCalcRotAx.size() && i < vAng.size() ; ++ i) {
|
||||
if ( vAng[i] < m_vCalcRotAx[i].stroke.Min) {
|
||||
nStat += ( 64 << ( 2 * i)) ;
|
||||
string sAxName = GetAxis( m_vCalcRotAx[i].nGrpId)->GetName() ;
|
||||
m_sOutstrokeInfo += sAxName + "=" + ToString( vAng[i] - m_vCalcRotAx[i].stroke.Min, 1) +
|
||||
" (R" + ToString( int(i) + 1) + "-) " ;
|
||||
}
|
||||
else if( dY > m_vCalcLinAx[1].stroke.Max) {
|
||||
nStat += 8 ;
|
||||
string sAxName = GetAxis( m_vCalcLinAx[1].nGrpId)->GetName() ;
|
||||
m_sOutstrokeInfo += sAxName + "=" + ToString( dY - m_vCalcLinAx[1].stroke.Max, 1) + " (L2+) " ;
|
||||
}
|
||||
}
|
||||
// terzo lineare
|
||||
if ( m_vCalcLinAx.size() >= 3) {
|
||||
if ( dZ < m_vCalcLinAx[2].stroke.Min) {
|
||||
nStat += 16 ;
|
||||
string sAxName = GetAxis( m_vCalcLinAx[2].nGrpId)->GetName() ;
|
||||
m_sOutstrokeInfo += sAxName + "=" + ToString( dZ - m_vCalcLinAx[2].stroke.Min, 1) + " (L3-) " ;
|
||||
}
|
||||
else if( dZ > m_vCalcLinAx[2].stroke.Max) {
|
||||
nStat += 32 ;
|
||||
string sAxName = GetAxis( m_vCalcLinAx[2].nGrpId)->GetName() ;
|
||||
m_sOutstrokeInfo += sAxName + "=" + ToString( dZ - m_vCalcLinAx[2].stroke.Max, 1) + " (L3+) " ;
|
||||
}
|
||||
}
|
||||
// eventuale primo rotante
|
||||
if ( m_vCalcRotAx.size() >= 1) {
|
||||
if ( dAngA < m_vCalcRotAx[0].stroke.Min) {
|
||||
nStat += 64 ;
|
||||
string sAxName = GetAxis( m_vCalcRotAx[0].nGrpId)->GetName() ;
|
||||
m_sOutstrokeInfo += sAxName + "=" + ToString( dAngA - m_vCalcRotAx[0].stroke.Min, 1) + " (R1-) " ;
|
||||
}
|
||||
else if( dAngA > m_vCalcRotAx[0].stroke.Max) {
|
||||
nStat += 128 ;
|
||||
string sAxName = GetAxis( m_vCalcRotAx[0].nGrpId)->GetName() ;
|
||||
m_sOutstrokeInfo += sAxName + "=" + ToString( dAngA - m_vCalcRotAx[0].stroke.Max, 1) + " (R1+) " ;
|
||||
}
|
||||
}
|
||||
// eventuale secondo rotante
|
||||
if ( m_vCalcRotAx.size() >= 2) {
|
||||
if ( dAngB < m_vCalcRotAx[1].stroke.Min) {
|
||||
nStat += 256 ;
|
||||
string sAxName = GetAxis( m_vCalcRotAx[1].nGrpId)->GetName() ;
|
||||
m_sOutstrokeInfo += sAxName + "=" + ToString( dAngB - m_vCalcRotAx[1].stroke.Min, 1) + " (R2-) " ;
|
||||
}
|
||||
else if( dAngB > m_vCalcRotAx[1].stroke.Max) {
|
||||
nStat += 512 ;
|
||||
string sAxName = GetAxis( m_vCalcRotAx[1].nGrpId)->GetName() ;
|
||||
m_sOutstrokeInfo += sAxName + "=" + ToString( dAngB - m_vCalcRotAx[1].stroke.Max, 1) + " (R2+) " ;
|
||||
else if( vAng[i] > m_vCalcRotAx[i].stroke.Max) {
|
||||
nStat += ( 128 << ( 2 * i)) ;
|
||||
string sAxName = GetAxis( m_vCalcRotAx[i].nGrpId)->GetName() ;
|
||||
m_sOutstrokeInfo += sAxName + "=" + ToString( vAng[i] - m_vCalcRotAx[i].stroke.Max, 1) +
|
||||
" (R" + ToString( int(i) + 1) + "+) " ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
|
||||
+3
-1
@@ -472,6 +472,9 @@ Operation::CalculateAxesValues( void)
|
||||
// recupero peso primo asse rotante di testa
|
||||
double dRot1W = m_pMchMgr->GetCalcRot1W() ;
|
||||
|
||||
// applico eventuali blocchi di assi rotanti
|
||||
m_pMchMgr->ApplyRotAxisBlock() ;
|
||||
|
||||
// recupero gruppo della geometria di lavorazione (Cutter Location)
|
||||
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
|
||||
if ( nClId == GDB_ID_NULL)
|
||||
@@ -532,7 +535,6 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes,
|
||||
}
|
||||
// calcolo degli assi rotanti della macchina
|
||||
int nRStat ;
|
||||
//m_pMchMgr->BlockKinematicRotAxis( "C", 90) ;
|
||||
DBLVECTOR vAng1, vAng2 ;
|
||||
bool bROk = m_pMchMgr->GetCalcAngles( pCamData->GetToolDir(), pCamData->GetAuxDir(), nRStat, vAng1, vAng2) ;
|
||||
if ( ! bROk || nRStat == 0) {
|
||||
|
||||
+2
-1
@@ -282,8 +282,9 @@ Simulator::Move( int& nStatus)
|
||||
DBLVECTOR OutAxes = pCamData->GetAxesVal() ;
|
||||
for ( size_t i = OutAxes.size() ; i < 5 ; ++ i)
|
||||
OutAxes.emplace_back( 0) ;
|
||||
DBLVECTOR vAng( OutAxes.begin() + 3, OutAxes.end()) ;
|
||||
int nStat ;
|
||||
m_pMachine->VerifyOutstroke( OutAxes[0], OutAxes[1], OutAxes[2], OutAxes[3], OutAxes[4], nStat) ;
|
||||
m_pMachine->VerifyOutstroke( OutAxes[0], OutAxes[1], OutAxes[2], vAng, nStat) ;
|
||||
nStatus = MCH_SIM_OUTSTROKE ;
|
||||
return false ; }
|
||||
case CamData::AS_DIR_ERR :
|
||||
|
||||
Reference in New Issue
Block a user