EgtMachKernel :

- sistemazione messaggi di errore e avviso del WaterJetting.
This commit is contained in:
Dario Sassi
2019-09-24 09:21:04 +00:00
parent 1b984e6f2b
commit 2d41608df9
+69 -90
View File
@@ -35,37 +35,30 @@
using namespace std ;
//------------------------------ Errors --------------------------------------
// 2301 = "Error in Milling : UpdateToolData failed"
// 2302 = "Error in Milling : Offset not computable"
// 2303 = "Error in Milling : Empty RawBox"
// 2304 = "Error in Milling : Depth not computable"
// 2305 = "Error in Milling : machining depth (xx) bigger than MaxMaterial (yy)"
// 2306 = "Error in Milling : Entity GetElevation"
// 2307 = "Error in Milling : missing aggregate from bottom"
// 2308 = "Error in Milling : path too far from part sides"
// 2309 = "Error in Milling : Approach not computable"
// 2310 = "Error in Milling : LeadIn not computable"
// 2311 = "Error in Milling : LeadOut not computable"
// 2312 = "Error in Milling : Retract not computable"
// 2313 = "Error in Milling : Linear Approx not computable"
// 2314 = "Error in Milling : LeadIn must be out of rawpart"
// 2315 = "Error in Milling : Chaining failed"
// 2316 = "Error in Milling : Tool MaxMaterial too small (xx)"
// 2317 = "Error in Milling : axes values not calculable"
// 2318 = "Error in Milling : outstroke xx"
// 2319 = "Error in Milling : link movements not calculable"
// 2320 = "Error in Milling : link outstroke xx"
// 2321 = "Error in Milling : post apply not calculable"
// 2322 = "Error in Milling : Tool loading failed"
// 2323 = "Error in Milling : machining depth (xxx) bigger than MaxDepth (yyy)"
// 2351 = "Warning in Milling : Skipped entity (xx)"
// 2352 = "Warning in Milling : No machinable path"
// 2353 = "Warning in Milling : Tool name changed (xx)"
// 2354 = "Warning in Milling : Tool data changed (xx)"
// 2355 = "Warning in Milling : skipped Path too short"
// 2356 = "Warning in Milling : machining step too small (xx)"
// 2357 = "Warning in Milling : machining step (xxx) bigger than MaxMaterial (yyy)"
// 2358 = "Warning in Milling : machining depth (xxx) bigger than MaxMaterial (yyy)"
// 3201 = "Error in WaterJetting : UpdateToolData failed"
// 3202 = "Error in WaterJetting : Offset not computable"
// 3203 = "Error in WaterJetting : Empty RawBox"
// 3204 = "Error in WaterJetting : Depth not computable"
// 3205 = "Error in WaterJetting : machining depth (xx) bigger than MaxMaterial (yy)"
// 3206 = "Error in WaterJetting : Entity GetElevation"
// 3207 = "Error in WaterJetting : Approach not computable"
// 3208 = "Error in WaterJetting : LeadIn not computable"
// 3209 = "Error in WaterJetting : LeadOut not computable"
// 3210 = "Error in WaterJetting : Retract not computable"
// 3211 = "Error in WaterJetting : Linear Approx not computable"
// 3212 = "Error in WaterJetting : Chaining failed"
// 3213 = "Error in WaterJetting : Tool MaxMaterial too small (xx)"
// 3214 = "Error in WaterJetting : axes values not calculable"
// 3215 = "Error in WaterJetting : outstroke xx"
// 3216 = "Error in WaterJetting : link movements not calculable"
// 3217 = "Error in WaterJetting : link outstroke xx"
// 3218 = "Error in WaterJetting : post apply not calculable"
// 3219 = "Error in WaterJetting : Tool loading failed"
// 3251 = "Warning in WaterJetting : Skipped entity (xx)"
// 3252 = "Warning in WaterJetting : No machinable path"
// 3253 = "Warning in WaterJetting : Tool name changed (xx)"
// 3254 = "Warning in WaterJetting : Tool data changed (xx)"
// 3255 = "Warning in WaterJetting : skipped Path too short"
//----------------------------------------------------------------------------
USEROBJ_REGISTER( GetOperationClass( OPER_WATERJETTING), WaterJetting) ;
@@ -479,8 +472,8 @@ WaterJetting::SetGeometry( const SELVECTOR& vIds)
// test sull'entità
int nSubs ;
if ( ! VerifyGeometry( Id, nSubs, nType)) {
string sInfo = "Warning in Milling : Skipped entity " + ToString( Id) ;
m_pMchMgr->SetWarning( 2351, sInfo) ;
string sInfo = "Warning in WaterJetting : Skipped entity " + ToString( Id) ;
m_pMchMgr->SetWarning( 3251, sInfo) ;
continue ;
}
// posso aggiungere alla lista
@@ -523,7 +516,7 @@ WaterJetting::Preview( bool bRecalc)
// aggiorno dati geometrici dell'utensile
if ( ! UpdateToolData()) {
m_pMchMgr->SetLastError( 2301, "Error in Milling : UpdateToolData failed") ;
m_pMchMgr->SetLastError( 3201, "Error in WaterJetting : UpdateToolData failed") ;
return false ;
}
m_nHeadSolCh = m_pMchMgr->GetCurrMachine()->GetHeadSolCh( m_TParams.m_sHead) ;
@@ -532,7 +525,7 @@ WaterJetting::Preview( bool bRecalc)
// rendo corrente l'utensile usato nella lavorazione
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
m_pMchMgr->SetLastError( 2322, "Error in Milling : Tool loading failed") ;
m_pMchMgr->SetLastError( 3219, "Error in WaterJetting : Tool loading failed") ;
return false ;
}
// recupero i dati del portautensile
@@ -544,7 +537,7 @@ WaterJetting::Preview( bool bRecalc)
// se necessario, eseguo concatenamento ed inserisco i percorsi sotto la geometria ausiliaria
if ( bChain && ! Chain( nAuxId)) {
m_pMchMgr->SetLastError( 2315, "Error in Milling : Chaining failed") ;
m_pMchMgr->SetLastError( 3212, "Error in WaterJetting : Chaining failed") ;
return false ;
}
@@ -587,7 +580,7 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
// aggiorno dati geometrici dell'utensile
bool bToolChanged = true ;
if ( ! UpdateToolData( &bToolChanged)) {
m_pMchMgr->SetLastError( 2301, "Error in Milling : UpdateToolData failed") ;
m_pMchMgr->SetLastError( 3201, "Error in WaterJetting : UpdateToolData failed") ;
return false ;
}
m_nHeadSolCh = m_pMchMgr->GetCurrMachine()->GetHeadSolCh( m_TParams.m_sHead) ;
@@ -621,7 +614,7 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
// rendo corrente l'utensile usato nella lavorazione
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
m_pMchMgr->SetLastError( 2322, "Error in Milling : Tool loading failed") ;
m_pMchMgr->SetLastError( 3219, "Error in WaterJetting : Tool loading failed") ;
return false ;
}
// recupero i dati del portautensile
@@ -633,7 +626,7 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
// se necessario, eseguo concatenamento ed inserisco i percorsi sotto la geometria ausiliaria
if ( bChain && ! Chain( nAuxId)) {
m_pMchMgr->SetLastError( 2315, "Error in Milling : Chaining failed") ;
m_pMchMgr->SetLastError( 3212, "Error in WaterJetting : Chaining failed") ;
return false ;
}
@@ -686,7 +679,7 @@ WaterJetting::Update( bool bPostApply)
// se lavorazione vuota, esco
if ( m_nMills == 0) {
m_pMchMgr->SetWarning( 2352, "Warning in Milling : No machinable path") ;
m_pMchMgr->SetWarning( 3252, "Warning in WaterJetting : No machinable path") ;
return true ;
}
@@ -707,9 +700,9 @@ WaterJetting::Update( bool bPostApply)
if ( ! CalculateAxesValues( sHint)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2317, "Error in Milling : axes values not calculable") ;
m_pMchMgr->SetLastError( 3214, "Error in WaterJetting : axes values not calculable") ;
else
m_pMchMgr->SetLastError( 2318, "Error in Milling : outstroke ") ;
m_pMchMgr->SetLastError( 3215, "Error in WaterJetting : outstroke ") ;
return false ;
}
@@ -717,15 +710,15 @@ WaterJetting::Update( bool bPostApply)
if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2319, "Error in Milling : link movements not calculable") ;
m_pMchMgr->SetLastError( 3216, "Error in WaterJetting : link movements not calculable") ;
else
m_pMchMgr->SetLastError( 2320, "Error in Milling : link outstroke ") ;
m_pMchMgr->SetLastError( 3217, "Error in WaterJetting : link outstroke ") ;
return false ;
}
// esecuzione eventuali personalizzazioni
if ( bPostApply && ! PostApply()) {
m_pMchMgr->SetLastError( 2321, "Error in Milling : post apply not calculable") ;
m_pMchMgr->SetLastError( 3218, "Error in WaterJetting : post apply not calculable") ;
return false ;
}
@@ -900,15 +893,15 @@ WaterJetting::UpdateToolData( bool* pbChanged)
m_TParams = *pTdata ;
// eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in Milling : tool name changed (" +
string sInfo = "Warning in WaterJetting : tool name changed (" +
m_Params.m_sToolName + "->" + m_TParams.m_sName + ")" ;
m_pMchMgr->SetWarning( 2353, sInfo) ;
m_pMchMgr->SetWarning( 3253, sInfo) ;
m_Params.m_sToolName = m_TParams.m_sName ;
}
if ( bChanged) {
string sInfo = "Warning in Milling : tool data changed (" +
string sInfo = "Warning in WaterJetting : tool data changed (" +
m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 2354, sInfo) ;
m_pMchMgr->SetWarning( 3254, sInfo) ;
}
// se definito parametro di ritorno, lo assegno
if ( pbChanged != nullptr)
@@ -1106,8 +1099,8 @@ WaterJetting::Chain( int nGrpDestId)
// prendo le curve
ICURVEPLIST lstPC ;
if ( ! GetCurves( Id, lstPC)) {
string sInfo = "Warning in Milling : Skipped entity " + ToString( Id) ;
m_pMchMgr->SetWarning( 2351, sInfo) ;
string sInfo = "Warning in WaterJetting : Skipped entity " + ToString( Id) ;
m_pMchMgr->SetWarning( 3251, sInfo) ;
}
for ( auto pCrv : lstPC) {
vpCrvs.emplace_back( pCrv) ;
@@ -1300,7 +1293,7 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
// verifico che il percorso sia abbastanza lungo
double dLen ; pCompo->GetLength( dLen) ;
if ( dLen + m_Params.m_dStartAddLen + m_Params.m_dEndAddLen < 10 * EPS_SMALL) {
m_pMchMgr->SetWarning( 2355, "Warning in Milling : skipped Path too short") ;
m_pMchMgr->SetWarning( 3255, "Warning in WaterJetting : skipped Path too short") ;
return true ;
}
// se una sola entità circonferenza completa, la divido in due per poterla allungare
@@ -1337,7 +1330,7 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
double dSignOffs = ( m_Params.m_nWorkSide == WJET_WS_RIGHT) ? dOffs : - dOffs ;
// esecuzione offset
if ( ! CalcOffset( pCompo, dSignOffs)) {
m_pMchMgr->SetLastError( 2302, "Error in Milling : Offset not computable") ;
m_pMchMgr->SetLastError( 3202, "Error in WaterJetting : Offset not computable") ;
return false ;
}
}
@@ -1369,7 +1362,7 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
// recupero il box del grezzo in globale
BBox3d b3Raw ;
if ( ! GetRawGlobBox( m_nPhase, nPathId, 0.5 * m_TParams.m_dTDiam, b3Raw) || b3Raw.IsEmpty()) {
m_pMchMgr->SetLastError( 2303, "Error in Milling : Empty RawBox") ;
m_pMchMgr->SetLastError( 3203, "Error in WaterJetting : Empty RawBox") ;
return false ;
}
@@ -1386,7 +1379,7 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
double dDepth ;
string sMyDepth = m_Params.m_sDepth ;
if ( ! ExeLuaEvalNumExpr( ToUpper( sMyDepth), &dDepth)) {
m_pMchMgr->SetLastError( 2304, "Error in Milling : Depth not computable") ;
m_pMchMgr->SetLastError( 3204, "Error in WaterJetting : Depth not computable") ;
return false ;
}
// se spessore positivo, lo sottraggo dal risultato
@@ -1405,7 +1398,7 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
( nSplitArcs == SPLAR_NO_XY_PLANE && ! vtTool.IsZplus()) ||
( nSplitArcs == SPLAR_GEN_PLANE && vtTool.IsGeneric())) ;
if ( bSplitArcs && ! ApproxWithLines( pCompo)) {
m_pMchMgr->SetLastError( 2313, "Error in Milling : Linear Approx not computable") ;
m_pMchMgr->SetLastError( 3211, "Error in WaterJetting : Linear Approx not computable") ;
return false ;
}
@@ -1434,17 +1427,17 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
// verifico che il massimo materiale dell'utensile sia sensato
const double MIN_MAXMAT = 1.0 ;
if ( m_TParams.m_dMaxMat < dElev && m_TParams.m_dMaxMat < MIN_MAXMAT) {
string sInfo = "Error in Milling : Tool MaxMaterial too small (" +
string sInfo = "Error in WaterJetting : Tool MaxMaterial too small (" +
ToString( m_TParams.m_dMaxMat, 2) + ")" ;
m_pMchMgr->SetLastError( 2316, sInfo) ;
m_pMchMgr->SetLastError( 3213, sInfo) ;
return false ;
}
// verifico di non superare il massimo materiale con l'elevazione
if ( dElev > m_TParams.m_dMaxMat + EPS_SMALL) {
string sInfo = "Error in Milling : machining depth (" + ToString( dElev, 1) +
string sInfo = "Error in WaterJetting : machining depth (" + ToString( dElev, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
m_pMchMgr->SetLastError( 2305, sInfo) ;
m_pMchMgr->SetLastError( 3205, sInfo) ;
return false ;
}
@@ -1529,7 +1522,7 @@ WaterJetting::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d&
dElev = dCurrElev ;
}
else {
m_pMchMgr->SetLastError( 2306, "Error in Milling : Entity GetElevation") ;
m_pMchMgr->SetLastError( 3206, "Error in WaterJetting : Entity GetElevation") ;
return false ;
}
// da una parte
@@ -1539,7 +1532,7 @@ WaterJetting::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d&
dElev = dCurrElev ;
}
else {
m_pMchMgr->SetLastError( 2306, "Error in Milling : Entity GetElevation") ;
m_pMchMgr->SetLastError( 3206, "Error in WaterJetting : Entity GetElevation") ;
return false ;
}
// dall'altra parte
@@ -1549,7 +1542,7 @@ WaterJetting::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d&
dElev = dCurrElev ;
}
else {
m_pMchMgr->SetLastError( 2306, "Error in Milling : Entity GetElevation") ;
m_pMchMgr->SetLastError( 3206, "Error in WaterJetting : Entity GetElevation") ;
return false ;
}
}
@@ -1655,35 +1648,21 @@ WaterJetting::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d&
bool bAboveStart = GetPointAboveRaw( ptP1) ;
// imposto versore correzione e ausiliario sul punto di partenza
CalcAndSetCorrAuxDir( pCompo, i) ;
// aggiungo approccio per frese normali
if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
// correggo elevazione iniziale per punto inizio attacco (se testa da sopra senza aggregato approccio mai Z-)
if ( vtTool.z < - EPS_SMALL)
dStElev -= ScalarXY( (ptP1 - ptStart), vtTool) ;
else
dStElev -= ( ptP1 - ptStart) * vtTool ;
// approccio al punto iniziale
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bOutStart, bAboveStart)) {
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
return false ;
}
}
// altrimenti, approccio per lame
else {
// verifico di entrare in aria
if ( ! bOutStart) {
m_pMchMgr->SetLastError( 2314, "Error in Milling : LeadIn must be out of rawpart") ;
return false ;
}
// affondo al punto iniziale
SetFlag( 0) ;
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
return false ;
// aggiungo approccio
// correggo elevazione iniziale per punto inizio attacco (se testa da sopra senza aggregato approccio mai Z-)
if ( vtTool.z < - EPS_SMALL)
dStElev -= ScalarXY( (ptP1 - ptStart), vtTool) ;
else
dStElev -= ( ptP1 - ptStart) * vtTool ;
// approccio al punto iniziale
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bOutStart, bAboveStart)) {
m_pMchMgr->SetLastError( 3207, "Error in WaterJetting : Approach not computable") ;
return false ;
}
// aggiungo attacco
SetFeed( GetStartFeed()) ;
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtTool, false, pCompo, bSplitArcs)) {
m_pMchMgr->SetLastError( 2310, "Error in Milling : LeadIn not computable") ;
m_pMchMgr->SetLastError( 3208, "Error in WaterJetting : LeadIn not computable") ;
return false ;
}
}
@@ -1722,7 +1701,7 @@ WaterJetting::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d&
Point3d ptP1 ;
SetFeed( GetEndFeed()) ;
if ( ! AddLeadOut( ptEnd, vtEnd, vtTool, dEndElev, false, pCompo, bSplitArcs, ptP1)) {
m_pMchMgr->SetLastError( 2311, "Error in Milling : LeadOut not computable") ;
m_pMchMgr->SetLastError( 3209, "Error in WaterJetting : LeadOut not computable") ;
return false ;
}
// aggiungo retrazione per frese normali
@@ -1736,7 +1715,7 @@ WaterJetting::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d&
bool bAboveEnd = GetPointAboveRaw( ptP1) ;
// aggiungo retrazione
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bAboveEnd)) {
m_pMchMgr->SetLastError( 2312, "Error in Milling : Retract not computable") ;
m_pMchMgr->SetLastError( 3210, "Error in WaterJetting : Retract not computable") ;
return false ;
}
}