EgtMachKernel 2.2c1 :

- in Milling modificato riconoscimento percorso chiuso per cambio inizio (per evitare percorsi sovrapposti di pulizia spigoli)
- in Milling, Pocketing, Mortising e Chiseling corretto cambio affondamento che supera l'elevazione
- in gestione utensili aggiunte funzioni SetCurrToolValInNotes, RemoveCurrToolValInNotes e GetCurrToolValInNotes.
This commit is contained in:
Dario Sassi
2020-03-07 08:59:15 +00:00
parent c5f0bc1034
commit 82f3d1a5d8
9 changed files with 235 additions and 84 deletions
+5 -14
View File
@@ -37,7 +37,6 @@ using namespace std ;
// 2902 = "Error in Chiseling : Offset not computable"
// 2903 = "Error in Chiseling : Empty RawBox"
// 2904 = "Error in Chiseling : Depth not computable"
// 2905 = "Error in Chiseling : machining depth (xxx) bigger than MaxMaterial (yyy)"
// 2906 = "Error in Chiseling : Entity GetElevation"
// 2907 = "Error in Chiseling : Chaining failed"
// 2908 = "Error in Chiseling : axes values not calculable"
@@ -1274,19 +1273,11 @@ Chiseling::ProcessPath( int nPathId, int nPvId, int nClId)
// verifico di non superare il massimo materiale
const double MAXMAT_TOL = EPS_SMALL ;
if ( dElev > m_TParams.m_dMaxMat + MAXMAT_TOL) {
if ( dDepth + max( dThick, 0.0) > m_TParams.m_dMaxMat) {
string sInfo = "Warning in Chiseling : machining depth (" + ToString( dElev, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
m_pMchMgr->SetWarning( 2955, sInfo) ;
dDepth = m_TParams.m_dMaxMat - max( dThick, 0.0) ;
dElev = m_TParams.m_dMaxMat ;
}
else {
string sInfo = "Error in Chiseling : machining depth (" + ToString( dElev, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
m_pMchMgr->SetLastError( 2905, sInfo) ;
return false ;
}
string sInfo = "Warning in Chiseling : machining depth (" + ToString( dElev, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
m_pMchMgr->SetWarning( 2955, sInfo) ;
dDepth -= dElev - m_TParams.m_dMaxMat ;
dElev = m_TParams.m_dMaxMat ;
}
// vettore dei fori quadrati
BIN
View File
Binary file not shown.
+9
View File
@@ -166,10 +166,19 @@ class MachMgr : public IMachMgr
bool TdbSetCurrToolParam( int nType, int nVal) override ;
bool TdbSetCurrToolParam( int nType, double dVal) override ;
bool TdbSetCurrToolParam( int nType, const std::string& sVal) override ;
bool TdbSetCurrToolValInNotes( int nType, const std::string& sKey, bool bVal) override ;
bool TdbSetCurrToolValInNotes( int nType, const std::string& sKey, int nVal) override ;
bool TdbSetCurrToolValInNotes( int nType, const std::string& sKey, double dVal) override ;
bool TdbSetCurrToolValInNotes( int nType, const std::string& sKey, const std::string& sVal) override ;
bool TdbRemoveCurrToolValInNotes( int nType, const std::string& sKey) override ;
bool TdbGetCurrToolParam( int nType, bool& bVal) const override ;
bool TdbGetCurrToolParam( int nType, int& nVal) const override ;
bool TdbGetCurrToolParam( int nType, double& dVal) const override ;
bool TdbGetCurrToolParam( int nType, std::string& sVal) const override ;
bool TdbGetCurrToolValInNotes( int nType, const std::string& sKey, bool& bVal) const override ;
bool TdbGetCurrToolValInNotes( int nType, const std::string& sKey, int& nVal) const override ;
bool TdbGetCurrToolValInNotes( int nType, const std::string& sKey, double& dVal) const override ;
bool TdbGetCurrToolValInNotes( int nType, const std::string& sKey, std::string& sVal) const override ;
bool TdbGetCurrToolMaxDepth( double& dMaxDepth) const override ;
bool TdbGetCurrToolThDiam( double& dThDiam) const override ;
int TdbCurrToolDraw( int nGenCtx, int nToolCtx) const override ;
+108
View File
@@ -198,6 +198,66 @@ MachMgr::TdbSetCurrToolParam( int nType, const string& sVal)
return pTsMgr->SetCurrToolParam( nType, sVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::TdbSetCurrToolValInNotes( int nType, const string& sKey, bool bVal)
{
// recupero il gestore di utensili della macchina corrente
ToolsMgr* pTsMgr = GetCurrToolsMgr() ;
if ( pTsMgr == nullptr)
return false ;
// assegno il parametro
return pTsMgr->SetCurrToolValInNotes( nType, sKey, bVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::TdbSetCurrToolValInNotes( int nType, const string& sKey, int nVal)
{
// recupero il gestore di utensili della macchina corrente
ToolsMgr* pTsMgr = GetCurrToolsMgr() ;
if ( pTsMgr == nullptr)
return false ;
// assegno il parametro
return pTsMgr->SetCurrToolValInNotes( nType, sKey, nVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::TdbSetCurrToolValInNotes( int nType, const string& sKey, double dVal)
{
// recupero il gestore di utensili della macchina corrente
ToolsMgr* pTsMgr = GetCurrToolsMgr() ;
if ( pTsMgr == nullptr)
return false ;
// assegno il parametro
return pTsMgr->SetCurrToolValInNotes( nType, sKey, dVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::TdbSetCurrToolValInNotes( int nType, const string& sKey, const std::string& sVal)
{
// recupero il gestore di utensili della macchina corrente
ToolsMgr* pTsMgr = GetCurrToolsMgr() ;
if ( pTsMgr == nullptr)
return false ;
// assegno il parametro
return pTsMgr->SetCurrToolValInNotes( nType, sKey, sVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::TdbRemoveCurrToolValInNotes( int nType, const string& sKey)
{
// recupero il gestore di utensili della macchina corrente
ToolsMgr* pTsMgr = GetCurrToolsMgr() ;
if ( pTsMgr == nullptr)
return false ;
// leggo il parametro
return pTsMgr->RemoveCurrToolValInNotes( nType, sKey) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::TdbGetCurrToolParam( int nType, bool& bVal) const
@@ -246,6 +306,54 @@ MachMgr::TdbGetCurrToolParam( int nType, string& sVal) const
return pTsMgr->GetCurrToolParam( nType, sVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::TdbGetCurrToolValInNotes( int nType, const string& sKey, bool& bVal) const
{
// recupero il gestore di utensili della macchina corrente
ToolsMgr* pTsMgr = GetCurrToolsMgr() ;
if ( pTsMgr == nullptr)
return false ;
// leggo il parametro
return pTsMgr->GetCurrToolValInNotes( nType, sKey, bVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::TdbGetCurrToolValInNotes( int nType, const string& sKey, int& nVal) const
{
// recupero il gestore di utensili della macchina corrente
ToolsMgr* pTsMgr = GetCurrToolsMgr() ;
if ( pTsMgr == nullptr)
return false ;
// leggo il parametro
return pTsMgr->GetCurrToolValInNotes( nType, sKey, nVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::TdbGetCurrToolValInNotes( int nType, const string& sKey, double& dVal) const
{
// recupero il gestore di utensili della macchina corrente
ToolsMgr* pTsMgr = GetCurrToolsMgr() ;
if ( pTsMgr == nullptr)
return false ;
// leggo il parametro
return pTsMgr->GetCurrToolValInNotes( nType, sKey, dVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::TdbGetCurrToolValInNotes( int nType, const string& sKey, string& sVal) const
{
// recupero il gestore di utensili della macchina corrente
ToolsMgr* pTsMgr = GetCurrToolsMgr() ;
if ( pTsMgr == nullptr)
return false ;
// leggo il parametro
return pTsMgr->GetCurrToolValInNotes( nType, sKey, sVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::TdbGetCurrToolMaxDepth( double& dMaxDepth) const
+3 -3
View File
@@ -1476,7 +1476,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
Vector3d vtStart, vtEnd ;
pCompo->GetStartDir( vtStart) ;
pCompo->GetEndDir( vtEnd) ;
if ( ! AreSameVectorApprox( vtStart, vtEnd)) {
if ( ! AreSameOrOppositeVectorApprox( vtStart, vtEnd)) {
bool bAngCCW = ( ( vtEnd ^ vtStart) * vtTool > 0.0) ;
if ( m_Params.m_dOverlap > EPS_SMALL ||
m_Params.m_nWorkSide == MILL_WS_CENTER ||
@@ -1677,7 +1677,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
string sInfo = "Warning in Milling : machining depth (" + ToString( dElev, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
m_pMchMgr->SetWarning( 2358, sInfo) ;
dDepth = m_TParams.m_dMaxMat - max( dThick, 0.0) ;
dDepth -= dElev - m_TParams.m_dMaxMat ;
dElev = m_TParams.m_dMaxMat ;
}
}
@@ -1698,7 +1698,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
string sInfo = "Warning in Milling : machining depth (" + ToString( dElev, 1) +
") bigger than MaxDepth (" + ToString( dMaxDepth, 1) + ")" ;
m_pMchMgr->SetWarning( 2358, sInfo) ;
dDepth -= ( dElev - dMaxDepth) ;
dDepth -= dElev - dMaxDepth ;
dElev = dMaxDepth ;
}
}
+29 -28
View File
@@ -1260,37 +1260,38 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
return false ;
}
// verifico di non superare il massimo materiale
if ( dElev > m_TParams.m_dMaxMat + EPS_SMALL) {
// se lo step supera la capacità dell'utensile
if ( m_Params.m_dStep > m_TParams.m_dMaxMat + EPS_SMALL) {
dOkStep = m_TParams.m_dMaxMat ;
string sInfo = "Warning in Mortising : machining step (" + ToString( m_Params.m_dStep, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
m_pMchMgr->SetWarning( 2557, sInfo) ;
}
// se lavorazione singola e l'elevazione supera la capacità dell'utensile
if ( ( dOkStep < EPS_SMALL || dOkStep > dElev) && dElev > m_TParams.m_dMaxMat + EPS_SMALL) {
// se lo step supera la capacità dell'utensile
if ( m_Params.m_dStep > m_TParams.m_dMaxMat + EPS_SMALL) {
dOkStep = m_TParams.m_dMaxMat ;
string sInfo = "Warning in Mortising : machining step (" + ToString( m_Params.m_dStep, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
m_pMchMgr->SetWarning( 2557, sInfo) ;
}
// se lavorazione singola
if ( dOkStep < EPS_SMALL || dOkStep > dElev) {
// se l'elevazione supera la capacità dell'utensile
if ( dElev > m_TParams.m_dMaxMat + EPS_SMALL) {
// segnalo, riduco e continuo
string sInfo = "Warning in Mortising : machining depth (" + ToString(dElev, 1) +
") bigger than MaxMaterial (" + ToString(m_TParams.m_dMaxMat, 1) + ")" ;
m_pMchMgr->SetWarning(2558, sInfo) ;
dDepth -= dElev - m_TParams.m_dMaxMat ;
dElev = m_TParams.m_dMaxMat ;
}
}
// altrimenti lavorazione a step
else {
// massimo affondamento dell'utensile
double dMaxDepth = m_TParams.m_dMaxMat ;
// se l'elevazione supera il massimo affondamento dell'utensile
if ( dElev > dMaxDepth + EPS_SMALL) {
// segnalo, riduco e continuo
dDepth = m_TParams.m_dMaxMat - max( dThick, 0.0) ;
string sInfo = "Warning in Mortising : machining depth (" + ToString( dElev, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
") bigger than MaxDepth (" + ToString( dMaxDepth, 1) + ")" ;
m_pMchMgr->SetWarning( 2558, sInfo) ;
}
// altrimenti lavorazione a step
else {
// massimo affondamento dell'utensile
double dMaxDepth = m_TParams.m_dMaxMat ;
// se l'elevazione supera il massimo affondamento dell'utensile
if ( dElev > dMaxDepth + EPS_SMALL) {
// segnalo, riduco e continuo
string sInfo = "Warning in Mortising : machining depth (" + ToString( dElev, 1) +
") bigger than MaxDepth (" + ToString( dMaxDepth, 1) + ")" ;
m_pMchMgr->SetWarning( 2558, sInfo) ;
dDepth -= ( dElev - dMaxDepth) ;
dElev = dMaxDepth ;
}
}
dDepth -= dElev - dMaxDepth ;
dElev = dMaxDepth ;
}
}
// se richiesta anteprima
+11 -31
View File
@@ -45,7 +45,6 @@ using namespace std ;
// 2404 = "Error in Pocketing : Tool Not Perpendicular to Flat Area"
// 2405 = "Error in Pocketing : Empty RawBox"
// 2406 = "Error in Pocketing : Depth not computable"
// 2407 = "Error in Pocketing : machining depth (xxx) bigger than MaxMaterial (yyy)"
// 2408 = "Error in Pocketing : Entity GetElevation"
// 2409 = "Error in Pocketing : missing aggregate from bottom"
// 2410 = "Error in Pocketing : path too far from part sides"
@@ -1536,21 +1535,11 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
if ( dOkStep < EPS_SMALL || dOkStep > dElev) {
// se l'elevazione supera la capacità dell'utensile
if ( dElev > m_TParams.m_dMaxMat + EPS_SMALL) {
// se affondamento riducibile : segnalo, riduco e continuo
if ( dDepth + max( dThick, 0.0) > m_TParams.m_dMaxMat) {
string sInfo = "Warning in Pocketing : machining depth (" + ToString( dElev, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
m_pMchMgr->SetWarning( 2458, sInfo) ;
dDepth = m_TParams.m_dMaxMat - max( dThick, 0.0) ;
dElev = m_TParams.m_dMaxMat ;
}
// altrimenti errore
else {
string sInfo = "Error in Pocketing : machining depth (" + ToString( dElev, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
m_pMchMgr->SetLastError( 2407, sInfo) ;
return false ;
}
string sInfo = "Warning in Pocketing : machining depth (" + ToString( dElev, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
m_pMchMgr->SetWarning( 2458, sInfo) ;
dDepth -= dElev - m_TParams.m_dMaxMat ;
dElev = m_TParams.m_dMaxMat ;
}
}
// altrimenti lavorazione a step
@@ -1559,21 +1548,12 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
double dSafe = m_pMchMgr->GetCurrMachiningsMgr()->GetMaxDepthSafe() ;
double dMaxDepth = m_TParams.m_dLen - ( m_TParams.m_dDiam > m_dTHoldDiam ? 0 : m_dTHoldLen) - dSafe ;
if ( dElev > dMaxDepth + EPS_SMALL) {
// se affondamento riducibile : segnalo, riduco e continuo
if ( dDepth + max( dThick, 0.0) > dElev - dMaxDepth) {
string sInfo = "Warning in Pocketing : machining depth (" + ToString( dElev, 1) +
") bigger than MaxDepth (" + ToString( dMaxDepth, 1) + ")" ;
m_pMchMgr->SetWarning( 2458, sInfo) ;
dDepth -= ( dElev - dMaxDepth) ;
dElev = dMaxDepth ;
}
// altrimenti errore
else {
string sInfo = "Error in Pocketing : machining depth (" + ToString( dElev, 1) +
") bigger than MaxDepth (" + ToString( dMaxDepth, 1) + ")" ;
m_pMchMgr->SetLastError( 2429, sInfo) ;
return false ;
}
// segnalo, riduco e continuo
string sInfo = "Warning in Pocketing : machining depth (" + ToString( dElev, 1) +
") bigger than MaxDepth (" + ToString( dMaxDepth, 1) + ")" ;
m_pMchMgr->SetWarning( 2458, sInfo) ;
dDepth -= dElev - dMaxDepth ;
dElev = dMaxDepth ;
}
}
-2
View File
@@ -20,8 +20,6 @@
#include "DllMain.h"
#include "MachConst.h"
#include "/EgtDev/Include/EGkGeomDB.h"
#include "/EgtDEv/Include/EmkToolConst.h"
#include "/EgtDEv/Include/EGnStringKeyVal.h"
#include "/EgtDEv/Include/EGnFileUtils.h"
#include "/EgtDEv/Include/EGnScanner.h"
#include "/EgtDEv/Include/EGnWriter.h"
+70 -6
View File
@@ -14,6 +14,8 @@
#pragma once
#include "ToolData.h"
#include "/EgtDEv/Include/EmkToolConst.h"
#include "/EgtDev/Include/EGnStringKeyVal.h"
#include <unordered_map>
#include <map>
@@ -47,17 +49,17 @@ class ToolsMgr
bool SetCurrToolParam( int nType, int nVal) ;
bool SetCurrToolParam( int nType, double dVal) ;
bool SetCurrToolParam( int nType, const std::string& sVal) ;
template <class T> bool SetCurrToolValInNotes( int nType, const std::string& sKey, T& Val) ;
bool RemoveCurrToolValInNotes( int nType, const std::string& sKey) ;
bool GetCurrToolParam( int nType, bool& bVal) const ;
bool GetCurrToolParam( int nType, int& nVal) const ;
bool GetCurrToolParam( int nType, double& dVal) const ;
bool GetCurrToolParam( int nType, std::string& sVal) const ;
template <class T> bool GetCurrToolValInNotes( int nType, const std::string& sKey, T& Val) const ;
bool GetCurrToolMaxDepth( double dSafe, double& dMaxDepth) const ;
bool GetCurrToolThDiam( double& dThDiam) const ;
const ToolData* GetCurrTool( void) const
{ if ( m_bCurrTool)
return &m_tdCurrTool ;
else
return nullptr ; }
const ToolData* GetCurrTool(void) const
{ return (m_bCurrTool ? &m_tdCurrTool : nullptr) ; }
private :
bool Clear( void) ;
@@ -83,4 +85,66 @@ class ToolsMgr
ToolData m_tdCurrTool ;
mutable bool m_bModified ;
mutable UUIDVECTOR m_utModified ;
} ;
} ;
//----------------------------------------------------------------------------
template <class T>
bool
ToolsMgr::SetCurrToolValInNotes( int nType, const std::string& sKey, T& Val)
{
// deve esistere utensile corrente
if ( ! m_bCurrTool)
return false ;
// le note ammesse sono utente o sistema
if ( nType != TPA_USERNOTES && nType != TPA_SYSNOTES)
return false ;
// recupero le note da aggiornare
std::string sNotes ;
if ( ! m_tdCurrTool.GetParam( nType, sNotes))
return false ;
// aggiorno le note
if ( ! SetValInNotes( sKey, Val, sNotes))
return false ;
// salvo le note
return m_tdCurrTool.SetParam( nType, sNotes) ;
}
//----------------------------------------------------------------------------
template <class T>
bool
ToolsMgr::GetCurrToolValInNotes( int nType, const std::string& sKey, T& Val) const
{
// deve esistere utensile corrente
if ( ! m_bCurrTool)
return false ;
// le note ammesse sono utente o sistema
if ( nType != TPA_USERNOTES && nType != TPA_SYSNOTES)
return false ;
// recupero le note da cui leggere il valore
std::string sNotes ;
if ( ! m_tdCurrTool.GetParam( nType, sNotes))
return false ;
// recupero il valore
return GetValInNotes( sNotes, sKey, Val) ;
}
//----------------------------------------------------------------------------
inline bool
ToolsMgr::RemoveCurrToolValInNotes( int nType, const std::string& sKey)
{
// deve esistere utensile corrente
if ( ! m_bCurrTool)
return false ;
// le note ammesse sono utente o sistema
if ( nType != TPA_USERNOTES && nType != TPA_SYSNOTES)
return false ;
// recupero le note da aggiornare
std::string sNotes ;
if ( ! m_tdCurrTool.GetParam( nType, sNotes))
return false ;
// aggiorno le note
if ( ! RemoveValInNotes( sKey, sNotes))
return false ;
// salvo le note
return m_tdCurrTool.SetParam( nType, sNotes) ;
}