EgtMachKernel 1.8b7 :

- corretta gestione disposizioni con spostamento pezzi consecutive e con teste diverse
- aggiunta GetRotAxisBlocked
- aggiunto controllo validità nome su utensili.
This commit is contained in:
Dario Sassi
2017-03-02 07:56:39 +00:00
parent 0941600e08
commit 284525c926
8 changed files with 63 additions and 8 deletions
+3 -2
View File
@@ -1076,11 +1076,12 @@ Disposition::SpecialApply( bool bRecalc)
// segnalo errori
if ( nErr != 0) {
bOk = false ;
m_nShifts = - 1 ;
string sOut = " Error in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ;
LOG_INFO( GetEMkLogger(), sOut.c_str())
}
// se disposizione vuota, esco
if ( m_nShifts == 0)
if ( m_nShifts <= 0)
return bOk ;
// calcolo assi macchina
string sHint = "" ;
@@ -1097,7 +1098,7 @@ Disposition::SpecialApply( bool bRecalc)
bool
Disposition::GetToolData( string& sName, string& sHead, int& nExit, string& sTcPos) const
{
sName = "" ;
sName = "*" + m_sHead ;
sHead = m_sHead ;
nExit = m_nExit ;
sTcPos = m_sTcPos ;
BIN
View File
Binary file not shown.
+3 -2
View File
@@ -438,7 +438,7 @@ Generator::UpdateTool( const string& sTool)
{
// Salvo l'utensile attuale come precedente
m_sPrevTool = m_sTool ;
// Se cambiato ...
// Se cambiato utensile ...
if ( sTool != m_sTool) {
// lo imposto come corrente
if ( ! m_pMchMgr->TdbSetCurrTool( sTool))
@@ -758,7 +758,8 @@ bool
Generator::OnToolSelect( const string& sTool, const string& sHead, int nExit, const string& sTcPos)
{
// assegno il nome dell'utensile, la testa, l'uscita e l'eventuale posizione nel toolchanger
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TOOL, sTool) ;
string sOutTool = ( ( sTool.empty() || sTool.front() == '*') ? "" : sTool) ;
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TOOL, sOutTool) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_HEAD, sHead) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, nExit) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, sTcPos) ;
+1
View File
@@ -261,6 +261,7 @@ class MachMgr : public IMachMgr
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 GetRotAxisBlocked( int nInd, std::string& sAxis, double& dVal) override ;
bool GetCalcTool( std::string& sTool) const override ;
bool GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const override ;
+28
View File
@@ -333,6 +333,34 @@ MachMgr::SetRotAxisBlock( const string& sAxis, double dVal)
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetRotAxisBlocked( int nInd, string& sAxis, double& dVal)
{
// se bloccaggi non ancora impostati
if ( ! m_vAxisBlock.empty()) {
if ( nInd < 0 || nInd >= int( m_vAxisBlock.size()))
return false ;
sAxis = m_vAxisBlock[nInd].sAxis ;
dVal = m_vAxisBlock[nInd].dVal ;
return true ;
}
// altrimenti cerco negli assi rotanti correnti
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
int nMyInd = 0 ;
for ( int i = 0 ; i < pMch->GetCurrRotAxes() ; ++ i) {
if ( pMch->GetKinematicRotAxisBlocked( i, sAxis, dVal)) {
if ( nMyInd == nInd)
return true ;
else
++ nMyInd ;
}
}
return false ;
}
//----------------------------------------------------------------------------
bool
MachMgr::ApplyRotAxisBlock( void)
+1
View File
@@ -85,6 +85,7 @@ class Machine
bool FreeKinematicRotAxis( const std::string& sName) ;
bool FreeKinematicRotAxis( int nId) ;
bool IsKinematicRotAxisBlocked( int nInd) const ;
bool GetKinematicRotAxisBlocked( int nInd, std::string& sName, double& dVal) const ;
bool SetSolCh( int nScc) ;
int GetCurrLinAxes( void) const ;
int GetCurrRotAxes( void) const ;
+18 -3
View File
@@ -210,9 +210,12 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
double dTOvLen = 0 ;
double dTOvDiam = 0 ;
// se definito
if ( ! sTool.empty()) {
if ( ! LoadTool( sHead, nExit, sTool))
if ( ! sTool.empty() && sTool.front() != '*') {
if ( ! LoadTool( sHead, nExit, sTool)) {
string sOut = "Missing tool " + sTool ;
LOG_INFO( GetEMkLogger(), sOut.c_str())
return false ;
}
nToolId = m_pGeomDB->GetFirstNameInGroup( nExitId, sTool) ;
if ( nToolId == GDB_ID_NULL || m_pGeomDB->GetGdbType( nToolId) != GDB_TY_GROUP)
return false ;
@@ -233,7 +236,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
dTDiam = 0 ;
dTOvLen = 0 ;
dTOvDiam = 0 ;
m_pMchMgr->TdbSetCurrTool( sTool) ;
m_pMchMgr->TdbSetCurrTool( "") ;
}
// assegno tutti i dati
m_nCalcHeadId = nHeadId ;
@@ -531,6 +534,18 @@ Machine::IsKinematicRotAxisBlocked( int nInd) const
return m_vCalcRotAx[nInd].bFixed ;
}
//----------------------------------------------------------------------------
bool
Machine::GetKinematicRotAxisBlocked( int nInd, string& sName, double& dVal) const
{
int nRotAxTot = int( m_vCalcRotAx.size()) ;
if ( nInd < 0 || nInd >= nRotAxTot || ! m_vCalcRotAx[nInd].bFixed)
return false ;
m_pGeomDB->GetName( m_vCalcRotAx[nInd].nGrpId, sName) ;
dVal = m_vCalcRotAx[nInd].dFixVal ;
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::SetSolCh( int nScc)
+9 -1
View File
@@ -333,6 +333,9 @@ ToolsMgr::GetToolNewName( string& sName) const
bool
ToolsMgr::AddTool( const string& sName, int nType)
{
// verifico validità del nome
if ( ! IsValidName( sName))
return false ;
// verifico unicità del nome
if ( m_suData.find( sName) != m_suData.end())
return false ;
@@ -359,6 +362,9 @@ ToolsMgr::AddTool( const string& sName, int nType)
bool
ToolsMgr::CopyTool( const string& sSource, const string& sName)
{
// verifico validità del nome
if ( ! IsValidName( sName))
return false ;
// verifico unicità del nome
if ( m_suData.find( sName) != m_suData.end())
return false ;
@@ -568,8 +574,10 @@ ToolsMgr::SetCurrToolParam( int nType, const string& sVal)
// non è possibile cambiare UUID
if ( nType == TPA_UUID)
return false ;
// è possibile cambiare il nome, solo se il nuovo non è già presente nel DB (escluso utensile corrente)
// è possibile cambiare il nome, solo se il nuovo è valido e non è già presente nel DB (escluso utensile corrente)
if ( nType == TPA_NAME) {
if ( ! IsValidName( sVal))
return false ;
const ToolData* pTdata = GetTool( sVal) ;
if ( pTdata != nullptr && pTdata->m_Uuid != m_tdCurrTool.m_Uuid)
return false ;