EgtMachKernel :
- gestione rinvio da sotto con gestione normale e con rotazione alla MDC.
This commit is contained in:
+74
-67
@@ -47,16 +47,18 @@ using namespace std ;
|
||||
// 2411 = "Error in Pocketing : toolpath allocation failed"
|
||||
// 2412 = "Error in Pocketing : Offset not computable"
|
||||
// 2413 = "Error in Pocketing : Toolpath not computable"
|
||||
// 2414 = "Error in Pocketing : LeadIn not computable"
|
||||
// 2415 = "Error in Pocketing : LeadOut not computable"
|
||||
// 2416 = "Error in Pocketing : Link not computable"
|
||||
// 2417 = "Error in Pocketing : Linear Approx not computable"
|
||||
// 2418 = "Error in Pocketing : Return toolpath not computable"
|
||||
// 2419 = "Error in Pocketing : Chaining failed"
|
||||
// 2420 = "Error in Pocketing : Tool MaxMaterial too small (xxx)"
|
||||
// 2421 = "Error in Pocketing : axes values not calculable"
|
||||
// 2422 = "Error in Pocketing : link movements not calculable"
|
||||
// 2423 = "Error in Pocketing : post apply not calculable"
|
||||
// 2414 = "Error in Pocketing : Approach not computable"
|
||||
// 2415 = "Error in Pocketing : LeadIn not computable"
|
||||
// 2416 = "Error in Pocketing : LeadOut not computable"
|
||||
// 2417 = "Error in Pocketing : Retract not computable"
|
||||
// 2418 = "Error in Pocketing : Link not computable"
|
||||
// 2419 = "Error in Pocketing : Linear Approx not computable"
|
||||
// 2420 = "Error in Pocketing : Return toolpath not computable"
|
||||
// 2421 = "Error in Pocketing : Chaining failed"
|
||||
// 2422 = "Error in Pocketing : Tool MaxMaterial too small (xxx)"
|
||||
// 2423 = "Error in Pocketing : axes values not calculable"
|
||||
// 2424 = "Error in Pocketing : link movements not calculable"
|
||||
// 2425 = "Error in Pocketing : post apply not calculable"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
USEROBJ_REGISTER( "EMkPocketing", Pocketing) ;
|
||||
@@ -429,7 +431,7 @@ Pocketing::Preview( bool bRecalc)
|
||||
|
||||
// se necessario, eseguo concatenamento ed inserisco i percorsi sotto la geometria ausiliaria
|
||||
if ( bChain && ! Chain( nAuxId)) {
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Chaining failed") ;
|
||||
m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Chaining failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -494,7 +496,7 @@ Pocketing::Apply( bool bRecalc)
|
||||
|
||||
// se necessario, eseguo concatenamento ed inserisco i percorsi sotto la geometria ausiliaria
|
||||
if ( bChain && ! Chain( nAuxId)) {
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Chaining failed") ;
|
||||
m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Chaining failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -543,19 +545,19 @@ Pocketing::Apply( bool bRecalc)
|
||||
if ( ! m_Params.m_sInitAngs.empty())
|
||||
sHint = m_Params.m_sInitAngs ;
|
||||
if ( ! CalculateAxesValues( sHint)) {
|
||||
m_pMchMgr->SetLastError( 2421, "Error in Pocketing : axes values not calculable") ;
|
||||
m_pMchMgr->SetLastError( 2423, "Error in Pocketing : axes values not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
m_pMchMgr->SetLastError( 2422, "Error in Pocketing : link movements not calculable") ;
|
||||
m_pMchMgr->SetLastError( 2424, "Error in Pocketing : link movements not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
if ( ! PostApply()) {
|
||||
m_pMchMgr->SetLastError( 2423, "Error in Pocketing : post apply not calculable") ;
|
||||
m_pMchMgr->SetLastError( 2425, "Error in Pocketing : post apply not calculable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -1132,7 +1134,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
if ( m_TParams.m_dMaxMat < dElev && m_TParams.m_dMaxMat < MIN_MAXMAT) {
|
||||
string sInfo = "Error in Pocketing : Tool MaxMaterial too small (" +
|
||||
ToString( m_TParams.m_dMaxMat, 2) + ")" ;
|
||||
m_pMchMgr->SetLastError( 2420, sInfo) ;
|
||||
m_pMchMgr->SetLastError( 2422, sInfo) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -1319,16 +1321,11 @@ Pocketing::VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d&
|
||||
bool bTabTilting = false ;
|
||||
if ( m_pMchMgr->GetCurrMachine()->GetCurrTableIsTilting( bTabTilting) && bTabTilting)
|
||||
return true ;
|
||||
// verifico se c'è rinvio da sotto
|
||||
int nHeadId = m_pMchMgr->GetHeadId( m_TParams.m_sHead) ;
|
||||
int nAgbType ;
|
||||
if ( ! m_pGeomDB->GetInfo( nHeadId, "AGB_TYPE", nAgbType) || nAgbType == 0) {
|
||||
// recupero dati di eventuale rinvio da sotto
|
||||
if ( ! GetAggrBottomData( m_TParams.m_sHead, m_AggrBottom) || m_AggrBottom.nType == 0) {
|
||||
m_pMchMgr->SetLastError( 2409, "Error in Pocketing : missing aggregate from bottom") ;
|
||||
return false ;
|
||||
}
|
||||
// recupero la massima distanza consentita dal rinvio
|
||||
double dAgbDmax = 0 ;
|
||||
m_pGeomDB->GetInfo( nHeadId, "AGB_DMAX", dAgbDmax) ;
|
||||
// calcolo la massima distanza minima del percorso dal contorno del grezzo
|
||||
double dDist = 0 ;
|
||||
Vector3d vtDir ;
|
||||
@@ -1362,7 +1359,7 @@ Pocketing::VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d&
|
||||
}
|
||||
}
|
||||
// se supera il limite, errore
|
||||
if ( dDist > dAgbDmax) {
|
||||
if ( dDist > m_AggrBottom.dDMax) {
|
||||
m_pMchMgr->SetLastError( 2410, "Error in Pocketing : path too far from part sides") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1509,12 +1506,14 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
|
||||
dStElev = 0 ;
|
||||
}
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr))
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr)) {
|
||||
m_pMchMgr->SetLastError( 2414, "Error in Pocketing : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// aggiungo attacco
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, pRCrv, ! m_Params.m_bInvert, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2414, "Error in Pocketing : LeadIn not computable") ;
|
||||
m_pMchMgr->SetLastError( 2415, "Error in Pocketing : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -1523,7 +1522,7 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
|
||||
SetFeed( GetStartFeed()) ;
|
||||
ptP1 -= vtExtr * dStep ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, pRCrv, ! m_Params.m_bInvert, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2416, "Error in Pocketing : Link not computable") ;
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -1585,12 +1584,14 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
|
||||
double dEndElev = dElev ;
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, pRCrv, bSplitArcs, ptP1, dEndElev)) {
|
||||
m_pMchMgr->SetLastError( 2415, "Error in Pocketing : LeadOut not computable") ;
|
||||
m_pMchMgr->SetLastError( 2416, "Error in Pocketing : LeadOut not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// aggiungo retrazione
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr))
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
m_pMchMgr->SetLastError( 2417, "Error in Pocketing : Retract not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1653,7 +1654,7 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
if ( j == 1) {
|
||||
// determino inizio attacco
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, pRCrv, ptP1)) {
|
||||
m_pMchMgr->SetLastError( 2414, "Error in Pocketing : LeadIn not computable") ;
|
||||
m_pMchMgr->SetLastError( 2415, "Error in Pocketing : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// determino elevazione su inizio attacco
|
||||
@@ -1669,12 +1670,14 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
dStElev = 0 ;
|
||||
}
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr))
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr)) {
|
||||
m_pMchMgr->SetLastError( 2414, "Error in Pocketing : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// aggiungo attacco
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, pRCrv, m_Params.m_bInvert, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2414, "Error in Pocketing : LeadIn not computable") ;
|
||||
m_pMchMgr->SetLastError( 2415, "Error in Pocketing : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -1683,7 +1686,7 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
SetFeed( GetStartFeed()) ;
|
||||
ptP1 -= vtExtr * dStep ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, pRCrv, m_Params.m_bInvert, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2416, "Error in Pocketing : Link not computable") ;
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -1745,12 +1748,14 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
double dEndElev = dElev ;
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, pRCrv, bSplitArcs, ptQ, dEndElev)) {
|
||||
m_pMchMgr->SetLastError( 2415, "Error in Pocketing : LeadOut not computable") ;
|
||||
m_pMchMgr->SetLastError( 2416, "Error in Pocketing : LeadOut not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// aggiungo retrazione
|
||||
if ( ! AddRetract( ptQ, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr))
|
||||
if ( ! AddRetract( ptQ, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
m_pMchMgr->SetLastError( 2417, "Error in Pocketing : Retract not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1826,7 +1831,7 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, bool bSplitArcs,
|
||||
}
|
||||
// se necessario, approssimo archi con rette
|
||||
if ( bSplitArcs && ! ApproxWithLines( pMCrv)) {
|
||||
m_pMchMgr->SetLastError( 2417, "Error in Pocketing : Linear Approx not computable") ;
|
||||
m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// eventuale sistemazione archi
|
||||
@@ -1892,7 +1897,7 @@ Pocketing::CalcCircleSpiral( const Point3d& ptCen, const Vector3d& vtN, double d
|
||||
}
|
||||
// se necessario, approssimo con rette
|
||||
if ( bSplitArcs && ! ApproxWithLines( pMCrv)) {
|
||||
m_pMchMgr->SetLastError( 2417, "Error in Pocketing : Linear Approx not computable") ;
|
||||
m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// eventuale sistemazione archi
|
||||
@@ -1905,7 +1910,7 @@ Pocketing::CalcCircleSpiral( const Point3d& ptCen, const Vector3d& vtN, double d
|
||||
if ( ! AreSamePointApprox( ptStart, ptEnd)) {
|
||||
PtrOwner<ICurveArc> pArc2( CreateCurveArc()) ;
|
||||
if ( IsNull( pArc2) || ! pArc2->Set2PVN( ptStart, ptEnd, - vtStart, vtN)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Return toolpath not computable") ;
|
||||
m_pMchMgr->SetLastError( 2420, "Error in Pocketing : Return toolpath not computable") ;
|
||||
return false ;
|
||||
}
|
||||
pRCrv->AddCurve( Release( pArc2)) ;
|
||||
@@ -1925,11 +1930,6 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
|
||||
SetFlag( 1) ;
|
||||
// se con aggregato da sotto
|
||||
if ( m_bAggrBottom) {
|
||||
// ne recupero alcuni dati
|
||||
double dAgbEncH = 0 ;
|
||||
double dAgbEncV = 0 ;
|
||||
m_pGeomDB->GetInfo( m_pMchMgr->GetHeadId( m_TParams.m_sHead), "AGB_ENCH", dAgbEncH) ;
|
||||
m_pGeomDB->GetInfo( m_pMchMgr->GetHeadId( m_TParams.m_sHead), "AGB_ENCV", dAgbEncV) ;
|
||||
// aggiuntivo in Z
|
||||
double dAggZ = max( dElev + max( dSafeAggrBottZ, dAppr), 0.) ;
|
||||
// distanza dal bordo del pezzo
|
||||
@@ -1937,18 +1937,27 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
|
||||
if ( ! GetDistanceFromRawSide( m_nPhase, ptP, m_vtAux, dDistBottom))
|
||||
dDistBottom = 0 ;
|
||||
// pre-approccio
|
||||
Point3d ptP0 = ptP - Z_AX * dAggZ + m_vtAux * ( dDistBottom + dAgbEncH + dSafeZ) ;
|
||||
Point3d ptP00 = ptP0 + Z_AX * ( dAgbEncV + m_TParams.m_dLen + dAggZ - dElev) ;
|
||||
Vector3d vtAux = m_vtAux ;
|
||||
vtAux.Rotate( Z_AX, 90) ;
|
||||
SetAuxDir( vtAux) ;
|
||||
if ( AddRapidStart( ptP00, MCH_CL_AGB_DWN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
vtAux.Rotate( Z_AX, - 90) ;
|
||||
SetAuxDir( vtAux) ;
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidMove( ptP0, MCH_CL_AGB_IN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
Point3d ptP0 = ptP - Z_AX * dAggZ + m_vtAux * ( dDistBottom + m_AggrBottom.dEncH + dSafeZ) ;
|
||||
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAggZ - dElev) ;
|
||||
// se rinvio da sotto che richiede speciale rotazione
|
||||
if ( m_AggrBottom.nType == 1) {
|
||||
Vector3d vtAux = m_vtAux ;
|
||||
vtAux.Rotate( Z_AX, 90) ;
|
||||
SetAuxDir( vtAux) ;
|
||||
if ( AddRapidStart( ptP00, MCH_CL_AGB_DWN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetAuxDir( m_vtAux) ;
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidMove( ptP0, MCH_CL_AGB_IN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// altrimenti rinvio normale
|
||||
else {
|
||||
SetAuxDir( m_vtAux) ;
|
||||
if ( AddRapidStart( ptP0, MCH_CL_AGB_IN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetFlag( 0) ;
|
||||
}
|
||||
}
|
||||
// se sopra attacco c'è spazio per sicurezza o approccio
|
||||
double dSafeDist = ( m_bAggrBottom ? dSafeAggrBottZ : dSafeZ) ;
|
||||
@@ -2022,11 +2031,6 @@ Pocketing::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ
|
||||
}
|
||||
// se con aggregato da sotto
|
||||
if ( m_bAggrBottom) {
|
||||
// ne recupero alcuni dati
|
||||
double dAgbEncH = 0 ;
|
||||
double dAgbEncV = 0 ;
|
||||
m_pGeomDB->GetInfo( m_pMchMgr->GetHeadId( m_TParams.m_sHead), "AGB_ENCH", dAgbEncH) ;
|
||||
m_pGeomDB->GetInfo( m_pMchMgr->GetHeadId( m_TParams.m_sHead), "AGB_ENCV", dAgbEncV) ;
|
||||
// aggiuntivo in Z
|
||||
double dAggZ = max( dElev + max( dSafeAggrBottZ, dAppr), 0.) ;
|
||||
// distanza dal bordo del pezzo
|
||||
@@ -2034,15 +2038,18 @@ Pocketing::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ
|
||||
if ( ! GetDistanceFromRawSide( m_nPhase, ptP, m_vtAux, dDistBottom))
|
||||
dDistBottom = 0 ;
|
||||
// post-retract
|
||||
Point3d ptP0 = ptP - Z_AX * dAggZ + m_vtAux * ( dDistBottom + dAgbEncH + dSafeZ) ;
|
||||
Point3d ptP00 = ptP0 + Z_AX * ( dAgbEncV + m_TParams.m_dLen + dAggZ - dElev) ;
|
||||
Point3d ptP0 = ptP - Z_AX * dAggZ + m_vtAux * ( dDistBottom + m_AggrBottom.dEncH + dSafeZ) ;
|
||||
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAggZ - dElev) ;
|
||||
if ( AddRapidMove( ptP0, MCH_CL_AGB_OUT) == GDB_ID_NULL)
|
||||
return false ;
|
||||
Vector3d vtAux = m_vtAux ;
|
||||
vtAux.Rotate( Z_AX, 90) ;
|
||||
SetAuxDir( vtAux) ;
|
||||
if ( AddRapidMove( ptP00, MCH_CL_AGB_UP) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// se rinvio da sotto che richiede speciale rotazione
|
||||
if ( m_AggrBottom.nType == 1) {
|
||||
Vector3d vtAux = m_vtAux ;
|
||||
vtAux.Rotate( Z_AX, 90) ;
|
||||
SetAuxDir( vtAux) ;
|
||||
if ( AddRapidMove( ptP00, MCH_CL_AGB_UP) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user