EgtMachKernel 1.6l9 :

- aggiunta funzione per Info su extra-corse
- aggiunte funzioni GetOperationMode e GetOperationStatus
- migliorata simulazione con sole rotazioni
- in simulazione, quando si incontra una extra-corsa è possibile richiedere info relative.
This commit is contained in:
Dario Sassi
2016-01-18 08:01:58 +00:00
parent b23c5c5699
commit a449bd16cc
9 changed files with 128 additions and 29 deletions
BIN
View File
Binary file not shown.
+4 -1
View File
@@ -159,8 +159,10 @@ class MachMgr : public IMachMgr
bool RemoveOperation( int nId) override ;
bool RemoveAllOperations( bool bExceptFirstDisp) override ;
bool SetOperationMode( int nId, bool bActive) override ;
bool GetOperationMode( int nId, bool& bActive) const override ;
bool SetAllOperationsMode( bool bExceptFirstDisp, bool bActive) override ;
bool SetOperationStatus( int nId, bool bShow) override ;
bool GetOperationStatus( int nId, bool& bShow) const override ;
bool SetAllOperationsStatus(bool bExceptFirstDisp, bool bShow) override ;
// Operations : dispositions
int AddDisposition( const std::string& sName) override ;
@@ -203,7 +205,8 @@ class MachMgr : public IMachMgr
bool bBottom, Point3d& ptTip) override ;
bool GetCalcToolDirFromAngles( double dAngA, double dAngB, Vector3d& vtDir) override ;
bool GetNearestAngleInStroke( int nId, double dAngRef, double& dAng) override ;
bool VerifyOutOfStroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) override ;
bool VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) override ;
const std::string& GetOutstrokeInfo( void) const override ;
// Machine Move
bool SetAxisPos( const std::string& sAxis, double dVal) override ;
bool GetAxisPos( const std::string& sAxis, double& dVal) override ;
+6 -1
View File
@@ -88,10 +88,14 @@ MachMgr::ShowOnlyTable( bool bVal)
// verifico DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// recupero la macchina corrente
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// recupero l'identificativo del gruppo della macchina
int nMGeoId = pMch->GetMGeoId() ;
// recupero la tavola corrente
int nTabId = pMch->GetCurrTable() ;
if ( nTabId == GDB_ID_NULL)
@@ -99,7 +103,7 @@ MachMgr::ShowOnlyTable( bool bVal)
// nascondo o visualizzo i fratelli e tutti i fratelli degli ascendenti
int nCurrId = nTabId ;
int nParentId = m_pGeomDB->GetParentId( nCurrId) ;
while ( nParentId != GDB_ID_NULL && nParentId != GetMachAuxId()) {
while ( nParentId != GDB_ID_NULL && nParentId != nMGeoId) {
int nId = m_pGeomDB->GetFirstInGroup( nParentId) ;
while ( nId != GDB_ID_NULL) {
if ( nId != nCurrId)
@@ -109,5 +113,6 @@ MachMgr::ShowOnlyTable( bool bVal)
nCurrId = nParentId ;
nParentId = m_pGeomDB->GetParentId( nParentId) ;
}
return true ;
}
+14 -2
View File
@@ -342,10 +342,22 @@ MachMgr::GetNearestAngleInStroke( int nId, double dAngRef, double& dAng)
//----------------------------------------------------------------------------
bool
MachMgr::VerifyOutOfStroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat)
MachMgr::VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat)
{
if ( m_nCurrMch < 0 || m_nCurrMch >= int( m_vMachines.size()) ||
m_vMachines[m_nCurrMch].pMachine == nullptr)
return false ;
return m_vMachines[m_nCurrMch].pMachine->VerifyOutOfStroke( dX, dY, dZ, dAngA, dAngB, nStat) ;
return m_vMachines[m_nCurrMch].pMachine->VerifyOutstroke( dX, dY, dZ, dAngA, dAngB, nStat) ;
}
//----------------------------------------------------------------------------
const std::string&
MachMgr::GetOutstrokeInfo( void) const
{
if ( m_nCurrMch < 0 || m_nCurrMch >= int( m_vMachines.size()) ||
m_vMachines[m_nCurrMch].pMachine == nullptr) {
static string sNull = "" ;
return sNull ;
}
return m_vMachines[m_nCurrMch].pMachine->GetOutstrokeInfo() ;
}
+30
View File
@@ -285,6 +285,21 @@ MachMgr::SetOperationMode( int nId, bool bActive)
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetOperationMode( int nId, bool& bActive) const
{
// verifico sia una Operazione
if ( GetOperationType( nId) == OPER_NULL)
return false ;
// recupero stato di attivazione/disattivazione
int nMode ;
if ( ! m_pGeomDB->GetMode( nId, nMode))
return false ;
bActive = ( nMode == GDB_MD_STD) ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SetAllOperationsMode( bool bExceptFirstDisp, bool bActive)
@@ -312,6 +327,21 @@ MachMgr::SetOperationStatus( int nId, bool bShow)
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetOperationStatus( int nId, bool& bShow) const
{
// verifico sia una Operazione
if ( GetOperationType( nId) == OPER_NULL)
return false ;
// recupero stato di visualizzazione
int nStat ;
if ( ! m_pGeomDB->GetStatus( nId, nStat))
return false ;
bShow = ( nStat == GDB_ST_ON) ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SetAllOperationsStatus( bool bExceptFirstDisp, bool bShow)
+12 -5
View File
@@ -68,7 +68,9 @@ class Machine
bool bBottom, Point3d& ptTip) ;
bool GetToolDirFromAngles( double dAngA, double dAngB, Vector3d& vtDir) ;
bool GetNearestAngleInStroke( int nId, double dAngRef, double& dAng) ;
bool VerifyOutOfStroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) ;
bool VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) ;
const std::string& GetOutstrokeInfo( void) const
{ return m_sOutstrokeInfo ; }
bool LuaCallFunction( const std::string& sFun) ;
bool LuaCreateGlobTable( const std::string& sName) ;
bool LuaResetGlobVar( const std::string& sName) ;
@@ -100,13 +102,17 @@ class Machine
double dRot1W, const STROKE& Rot2Stroke, int nSolCh, const std::string& sGeo) ;
int GetGroup( const std::string& sGroup) const ;
Axis* GetAxis( int nGroup) const ;
bool IsAxisGroup( int nGroup) const { return ( GetAxis( nGroup) != nullptr) ; }
bool IsAxisGroup( int nGroup) const
{ return ( GetAxis( nGroup) != nullptr) ; }
Table* GetTable( int nGroup) const ;
bool IsTableGroup( int nGroup) const { return ( GetTable( nGroup) != nullptr) ; }
bool IsTableGroup( int nGroup) const
{ return ( GetTable( nGroup) != nullptr) ; }
Head* GetHead( int nGroup) const ;
bool IsHeadGroup( int nGroup) const { return ( GetHead( nGroup) != nullptr) ; }
bool IsHeadGroup( int nGroup) const
{ return ( GetHead( nGroup) != nullptr) ; }
Exit* GetExit( int nGroup) const ;
bool IsExitGroup( int nGroup) const { return ( GetExit( nGroup) != nullptr) ; }
bool IsExitGroup( int nGroup) const
{ return ( GetExit( nGroup) != nullptr) ; }
bool AddHeadToSet( const std::string& sHSet, const std::string& sName) ;
const STRVECTOR& GetHSet( const std::string& sHead) const ;
bool EnableHeadInSet( const std::string& sHead) ;
@@ -149,6 +155,7 @@ class Machine
double m_dCalcTRad ; // raggio utensile corrente per calcoli
KINAXISVECTOR m_vCalcLinAx ; // vettore assi lineari attivi per calcoli
KINAXISVECTOR m_vCalcRotAx ; // vettore assi rotanti attivi per calcoli
std::string m_sOutstrokeInfo ; // informazioni su ultimo extra corsa
// Static per interprete Lua di macchina
private :
+44 -13
View File
@@ -652,44 +652,75 @@ Machine::GetNearestAngleInStroke( int nId, double dAngRef, double& dAng)
//----------------------------------------------------------------------------
bool
Machine::VerifyOutOfStroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat)
Machine::VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat)
{
// default tutto ok
nStat = 0 ;
m_sOutstrokeInfo.clear() ;
// primo lineare
if ( m_vCalcLinAx.size() >= 1) {
if ( dX < m_vCalcLinAx[0].stroke.Min)
if ( dX < m_vCalcLinAx[0].stroke.Min) {
nStat += 1 ;
else if( dX > m_vCalcLinAx[0].stroke.Max)
string sAxName = GetAxis( m_vCalcLinAx[0].nGrpId)->GetName() ;
m_sOutstrokeInfo += sAxName + "=" + ToString( dX - m_vCalcLinAx[0].stroke.Min, 1) + " (L1-) " ;
}
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+) " ;
}
}
// secondo lineare
if ( m_vCalcLinAx.size() >= 2) {
if ( dY < m_vCalcLinAx[1].stroke.Min)
if ( dY < m_vCalcLinAx[1].stroke.Min) {
nStat += 4 ;
else if( dY > m_vCalcLinAx[1].stroke.Max)
string sAxName = GetAxis( m_vCalcLinAx[1].nGrpId)->GetName() ;
m_sOutstrokeInfo += sAxName + "=" + ToString( dY - m_vCalcLinAx[1].stroke.Min, 1) + " (L2-) " ;
}
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)
if ( dZ < m_vCalcLinAx[2].stroke.Min) {
nStat += 16 ;
else if( dZ > m_vCalcLinAx[2].stroke.Max)
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)
if ( dAngA < m_vCalcRotAx[0].stroke.Min) {
nStat += 64 ;
else if( dAngA > m_vCalcRotAx[0].stroke.Max)
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)
if ( dAngB < m_vCalcRotAx[1].stroke.Min) {
nStat += 256 ;
else if( dAngB > m_vCalcRotAx[1].stroke.Max)
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+) " ;
}
}
return true ;
}
@@ -714,7 +745,7 @@ Machine::GetAllCurrAxesName( STRVECTOR& vAxName)
{
vAxName.clear() ;
bool bOk = true ;
// ciclo sugi assi lineari correnti
// ciclo sugli assi lineari correnti
for ( auto& CalcLinAx : m_vCalcLinAx) {
Axis* pAx = GetAxis( CalcLinAx.nGrpId) ;
if ( pAx != nullptr)
@@ -722,7 +753,7 @@ Machine::GetAllCurrAxesName( STRVECTOR& vAxName)
else
bOk = false ;
}
// ciclo sugi assi rotanti correnti
// ciclo sugli assi rotanti correnti
for ( auto& CalcRotAx : m_vCalcRotAx) {
Axis* pAx = GetAxis( CalcRotAx.nGrpId) ;
if ( pAx != nullptr)
+4 -1
View File
@@ -13,6 +13,7 @@
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "DllMain.h"
#include "MachMgr.h"
#include "Machining.h"
#include "MachiningConst.h"
@@ -628,10 +629,12 @@ Machining::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes,
vAxVal.emplace_back( dAngB1) ;
// verifico i limiti di corsa degli assi
int nStat ;
bool bOsOk = m_pMchMgr->VerifyOutOfStroke( dX, dY, dZ, dAngA1, dAngB1, nStat) ;
bool bOsOk = m_pMchMgr->VerifyOutstroke( dX, dY, dZ, dAngA1, dAngB1, nStat) ;
if ( ! bOsOk || nStat != 0) {
bOk = false ;
pCamData->SetAxes( CamData::AS_OUTSTROKE, vAxVal) ;
string sInfo = "Outstroke : " + m_pMchMgr->GetOutstrokeInfo() ;
LOG_INFO( GetEMkLogger(), sInfo.c_str())
continue ;
}
// salvo i valori degli assi
+14 -6
View File
@@ -145,9 +145,14 @@ Simulator::Move( int& nStatus)
switch ( pCamData->GetAxesStatus()) {
case CamData::AS_OK :
break ;
case CamData::AS_OUTSTROKE :
case CamData::AS_OUTSTROKE : {
DBLVECTOR OutAxes = pCamData->GetAxisVal() ;
for ( size_t i = OutAxes.size() ; i < 5 ; ++ i)
OutAxes.emplace_back( 0) ;
int nStat ;
m_pMchMgr->VerifyOutstroke( OutAxes[0], OutAxes[1], OutAxes[2], OutAxes[3], OutAxes[4], nStat) ;
nStatus = MCH_SIM_OUTSTROKE ;
return false ;
return false ; }
case CamData::AS_DIR_ERR :
nStatus = MCH_SIM_DIR_ERR ;
return false ;
@@ -159,10 +164,13 @@ Simulator::Move( int& nStatus)
// Verifico se movimento in rapido
bool bRapid = ( pCamData->GetFeed() < EPS_SMALL) ;
// Calcolo distanza di movimento
double dDist = 0 ;
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i)
dDist += ( AxesEnd[i] - m_AxesVal[i]) * ( AxesEnd[i] - m_AxesVal[i]) ;
dDist = sqrt( dDist) ;
double dSqDist = 0 ;
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {
// coefficiente moltiplicativo per differenziare assi lineari (primi3) e rotanti (altri)
double dSqCoeff = (( i >= 3) ? 100 : 1) ;
dSqDist += dSqCoeff * ( AxesEnd[i] - m_AxesVal[i]) * ( AxesEnd[i] - m_AxesVal[i]) ;
}
double dDist = sqrt( dSqDist) ;
m_dCoeff += ( bRapid ? 4 : 1) * m_dStep / dDist ;
if ( m_dCoeff > 1)
m_dCoeff = 1 ;