EgtMachKernel 2.6d1 :
- se robot sempre spezzatura - spezzatura movimenti per robot - in tagli con lama, tolto da Apply preview.
This commit is contained in:
+64
-57
@@ -1693,10 +1693,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
|
||||
|
||||
// verifico se archi vanno approssimati con segmenti di retta
|
||||
int nSplitArcs = m_pMchMgr->GetCurrMachiningsMgr()->GetSplitArcs() ;
|
||||
bool bSplitArcs = ( nSplitArcs == SPLAR_ALWAYS ||
|
||||
( nSplitArcs == SPLAR_NO_XY_PLANE && ! vtExtr.IsZplus()) ||
|
||||
( nSplitArcs == SPLAR_GEN_PLANE && vtExtr.IsGeneric())) ;
|
||||
bool bSplitArcs = GetSplitArcs( vtExtr) ;
|
||||
|
||||
// assegno il vettore estrazione al gruppo del percorso
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
|
||||
@@ -2076,6 +2073,16 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
}
|
||||
}
|
||||
|
||||
// se necessario, approssimo con rette
|
||||
if ( bSplitArcs) {
|
||||
for ( auto& pMCrv : vpCrvs) {
|
||||
if ( ! ApproxWithLines( pMCrv)) {
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// inserisco i movimenti di svuotatura
|
||||
for ( int j = 1 ; j <= nStep ; ++ j) {
|
||||
// ciclo sui percorsi
|
||||
@@ -2191,7 +2198,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
}
|
||||
// altrimenti, aggiungo retrazione di collegamento
|
||||
else {
|
||||
if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2222,7 +2229,17 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
m_pMchMgr->SetLastError( 2413, "Error in Pocketing : Toolpath not computable") ;
|
||||
return false ;
|
||||
}
|
||||
VerifyArcs( pOffs2) ;
|
||||
|
||||
// se necessario, approssimo con rette
|
||||
if ( bSplitArcs) {
|
||||
if ( ! ApproxWithLines( pOffs2)) {
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti verifico archi
|
||||
else
|
||||
VerifyArcs( pOffs2) ;
|
||||
|
||||
// se richiesto, la inverto
|
||||
if ( m_Params.m_bInvert)
|
||||
@@ -2279,7 +2296,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
dStElev = -LIO_ELEV_TOL ;
|
||||
}
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddLinkApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr)) {
|
||||
if ( ! AddLinkApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2337,7 +2354,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
}
|
||||
// se ci sono ancora curve, aggiungo retrazione di collegamento
|
||||
if ( OffsCrv2.GetCurveCount() > 0) {
|
||||
if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3064,8 +3081,16 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
// sposto l'inizio a metà del tratto più lungo
|
||||
AdjustContourStart( pOffs) ;
|
||||
|
||||
// verifico archi
|
||||
VerifyArcs( pOffs) ;
|
||||
// se necessario, approssimo con rette
|
||||
if ( bSplitArcs) {
|
||||
if ( ! ApproxWithLines( pOffs)) {
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti verifico archi
|
||||
else
|
||||
VerifyArcs( pOffs) ;
|
||||
|
||||
// coefficiente di riduzione feed di lavorazione di questa curva
|
||||
double dFeedRid = min( GetSideStep() / m_TParams.m_dDiam, 1.0) ;
|
||||
@@ -3175,7 +3200,7 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
return false ;
|
||||
}
|
||||
// aggiungo retrazione
|
||||
if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3268,7 +3293,7 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
dStElev = max( dStElev, j * dStep) ;
|
||||
dStElev -= ( ptP - ptS) * vtExtr ;
|
||||
// sempre approccio di collegamento
|
||||
if ( ! AddLinkApproach( ptP, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr)) {
|
||||
if ( ! AddLinkApproach( ptP, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3284,7 +3309,7 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
ptE.Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
|
||||
// movimento al punto finale
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( AddLinearMove( ptE) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptE, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// risalita
|
||||
Point3d ptQ ;
|
||||
@@ -3305,7 +3330,7 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
}
|
||||
// altrimenti aggiungo retrazione di collegamento
|
||||
else {
|
||||
if ( ! AddLinkRetract( ptQ, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
if ( ! AddLinkRetract( ptQ, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3659,7 +3684,7 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
if ( IsNull( pCurve))
|
||||
return false ;
|
||||
// aggiungo affondamento
|
||||
pCurve->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
|
||||
pCurve->Translate( -vtTool * ( dDepth - dElev + j * dStep)) ;
|
||||
// se prima entità
|
||||
if ( i == 0 ) {
|
||||
// dati inizio entità
|
||||
@@ -3954,7 +3979,7 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
|
||||
pRCrv->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL, false) ;
|
||||
// se necessario, approssimo archi con rette
|
||||
if ( bSplitArcs && ! ApproxWithLines( pRCrv)) {
|
||||
m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Linear Approx not computable") ;
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
VerifyArcs( pRCrv) ;
|
||||
@@ -3992,7 +4017,7 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
|
||||
}
|
||||
// se necessario, approssimo archi con rette
|
||||
if ( bSplitArcs && ! ApproxWithLines( pMCrv)) {
|
||||
m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Linear Approx not computable") ;
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// eventuale sistemazione archi
|
||||
@@ -4181,7 +4206,7 @@ Pocketing::CalcCircleSpiral( const Point3d& ptCen, const Vector3d& vtN, double d
|
||||
}
|
||||
// se necessario, approssimo con rette
|
||||
if ( bSplitArcs && ! ApproxWithLines( pMCrv)) {
|
||||
m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Linear Approx not computable") ;
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// eventuale sistemazione archi
|
||||
@@ -4898,7 +4923,7 @@ Pocketing::ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv,
|
||||
pRCrv->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL, false) ;
|
||||
// se necessario, approssimo archi con rette
|
||||
if ( bSplitArcs && ! ApproxWithLines( pRCrv)) {
|
||||
m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Linear Approx not computable") ;
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
VerifyArcs( pRCrv) ;
|
||||
@@ -4923,7 +4948,7 @@ Pocketing::ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv,
|
||||
|
||||
// se necessario, approssimo archi con rette
|
||||
if ( bSplitArcs && ! ApproxWithLines( pMCrv)) {
|
||||
m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Linear Approx not computable") ;
|
||||
m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
VerifyArcs( pMCrv) ;
|
||||
@@ -5052,15 +5077,13 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
|
||||
// se distanza di sicurezza minore di distanza di inizio
|
||||
if ( dSafeDist < dAppr + 10 * EPS_SMALL) {
|
||||
// 1 -> punto sopra inizio
|
||||
if ( ( ! m_bAggrBottom && AddRapidStart( ptP1) == GDB_ID_NULL) ||
|
||||
( m_bAggrBottom && AddRapidMove( ptP1) == GDB_ID_NULL))
|
||||
if ( AddRapidStartOrMove( ptP1, ! m_bAggrBottom) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
// 1a -> punto molto sopra inizio
|
||||
Point3d ptP1a = ptP1 + vtTool * ( dSafeDist - dAppr) ;
|
||||
if ( ( ! m_bAggrBottom && AddRapidStart( ptP1a) == GDB_ID_NULL) ||
|
||||
( m_bAggrBottom && AddRapidMove( ptP1a) == GDB_ID_NULL))
|
||||
if ( AddRapidStartOrMove( ptP1a, ! m_bAggrBottom) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// 1 -> punto sopra inizio
|
||||
if ( ( dElev + dAppr) > 10 * EPS_SMALL || (( dElev + dAppr) > -EPS_ZERO && dAppr > EPS_SMALL)) {
|
||||
@@ -5081,8 +5104,7 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
|
||||
else {
|
||||
// affondo diretto al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
if ( ( ! m_bAggrBottom && AddRapidStart( ptP) == GDB_ID_NULL) ||
|
||||
( m_bAggrBottom && AddRapidMove( ptP) == GDB_ID_NULL))
|
||||
if ( AddRapidStartOrMove( ptP, ! m_bAggrBottom) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
@@ -5091,7 +5113,7 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bOutStart)
|
||||
double dElev, double dAppr, bool bSplitArcs, bool bOutStart)
|
||||
{
|
||||
// se sopra attacco c'è spazio per approccio
|
||||
if ( ( dElev + dAppr) > 10 * EPS_SMALL) {
|
||||
@@ -5099,19 +5121,19 @@ Pocketing::AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double d
|
||||
Point3d ptP1b = ptP + vtTool * ( dElev + dAppr) ;
|
||||
if ( ( dElev + dAppr) > EPS_SMALL) {
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidMove( ptP1b) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP1b, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// affondo al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
SetFeed( bOutStart ? GetStartFeed() : GetTipFeed()) ;
|
||||
if ( AddLinearMove( ptP) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
// affondo diretto al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidMove( ptP) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
@@ -5120,14 +5142,14 @@ Pocketing::AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double d
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr)
|
||||
double dElev, double dAppr, bool bSplitArcs)
|
||||
{
|
||||
// se sopra uscita c'è spazio per approccio
|
||||
if ( ( dElev + dAppr) > 10 * EPS_SMALL) {
|
||||
// 4 -> movimento di risalita sopra il punto finale
|
||||
SetFeed( GetEndFeed()) ;
|
||||
Point3d ptP4 = ptP + vtTool * ( dElev + dAppr) ;
|
||||
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
@@ -5252,17 +5274,8 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3
|
||||
PtrOwner<ICurveArc> pArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pArc) || ! pArc->Set( ptCen, vtN, dRad, - vtCen, dAngCen, dDeltaN))
|
||||
return false ;
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs) {
|
||||
PtrOwner<ICurveComposite> pCompo ;
|
||||
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pArc))) || ! ApproxWithLines( pCompo))
|
||||
return false ;
|
||||
return ( AddCurveMove( pCompo, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
else {
|
||||
// emetto l'elica
|
||||
return ( AddCurveMove( pArc, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
// emetto l'elica (con eventuale spezzatura)
|
||||
return ( AddCurveMove( pArc, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
// altrimenti zigzag
|
||||
else
|
||||
@@ -5279,12 +5292,12 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3
|
||||
// verifico se fattibile
|
||||
if ( bSkipControl || VerifyLeadInZigZag( pCompo, ptPa, ptPb)) {
|
||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||
if ( AddLinearMove( ptPa - vtN * ( i - 0.75) * dStep, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptPa - vtN * ( i - 0.75) * dStep, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( AddLinearMove( ptPb - vtN * ( i - 0.25) * dStep, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptPb - vtN * ( i - 0.25) * dStep, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
return ( AddLinearMove( ptStart, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
return ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
// altrimenti diretto
|
||||
else {
|
||||
@@ -5318,11 +5331,8 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3
|
||||
double dNini = ( ptP1 - ORIG) * vtN ;
|
||||
double dNfin = ( ptStart - ORIG) * vtN ;
|
||||
AdjustCurveSlope( pCrv, dNini, dNfin) ;
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs && ! ApproxWithLines( pCrv))
|
||||
return false ;
|
||||
// emetto
|
||||
return ( AddCurveMove( pCrv) != GDB_ID_NULL) ;
|
||||
// emetto (con eventuale spezzatura)
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
// altrimenti diretto
|
||||
else
|
||||
@@ -5333,7 +5343,7 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3
|
||||
Point3d ptCurr = ptP1 ;
|
||||
GetCurrPos( ptCurr) ;
|
||||
if ( ! AreSamePointApprox( ptCurr, ptStart)) {
|
||||
if ( AddLinearMove( ptStart, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
@@ -5404,11 +5414,8 @@ Pocketing::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector
|
||||
Point3d ptFin ; pCrv->GetEndPoint( ptFin) ;
|
||||
ptFin += vtN * 1.0 ;
|
||||
pCrv->ModifyEnd( ptFin) ;
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs && ! ApproxWithLines( pCrv))
|
||||
return false ;
|
||||
// emetto
|
||||
AddCurveMove( pCrv) ;
|
||||
// emetto (con eventuale spezzatura)
|
||||
AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) ;
|
||||
// determino elevazione su fine uscita
|
||||
ptP1 = ptFin ;
|
||||
double dEndElev ;
|
||||
|
||||
Reference in New Issue
Block a user