EgtMachKernel :
- altre modifiche alle svuotature ZigZag ottimizzate.
This commit is contained in:
+43
-59
@@ -1949,45 +1949,26 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
|
||||
// verifico se si tratta di caso ottimizzato
|
||||
bool bOptimizedZigZag = false ;
|
||||
bool bInRawLeadIn = false ;
|
||||
bool bOutRawLeadIn = false ;
|
||||
if ( ! OptimizedZigZag( nPathId, frPocket, bOptimizedZigZag, vpCrvs))
|
||||
return false ;
|
||||
if ( bOptimizedZigZag) {
|
||||
if ( bOptimizedZigZag && ! vpCrvs.empty()) {
|
||||
nOffsCrvNbr = 1 ;
|
||||
//if ( ! m_Params.m_bInvert) {
|
||||
// verifico se attacco fuori dal grezzo
|
||||
Point3d ptStart ;
|
||||
vpCrvs[0]->GetStartPoint( ptStart) ;
|
||||
Vector3d vtDir ;
|
||||
vpCrvs[0]->GetStartDir( vtDir) ;
|
||||
ptStart += -vtDir * ( m_TParams.m_dDiam / 2 + dSafeZ) ;
|
||||
ptStart.ToGlob( frPocket) ;
|
||||
ptStart += - vtTool * dDepth ;
|
||||
double dTestElev ;
|
||||
if ( GetElevation( m_nPhase, ptStart, vtTool, m_TParams.m_dDiam / 2, vtTool, dTestElev) && dTestElev > EPS_SMALL)
|
||||
bInRawLeadIn = true ;
|
||||
// sistemo attacco e uscita
|
||||
if ( ! bInRawLeadIn)
|
||||
vpCrvs[0]->ExtendStartByLen( m_TParams.m_dDiam / 2 + dSafeZ) ;
|
||||
vpCrvs[0]->ExtendEndByLen( m_TParams.m_dDiam / 4) ;
|
||||
//}
|
||||
//else {
|
||||
//// verifico se attacco fuori dal grezzo
|
||||
// Point3d ptEnd ;
|
||||
// vpCrvs[0]->GetEndPoint( ptEnd) ;
|
||||
// Vector3d vtEndDir ;
|
||||
// vpCrvs[0]->GetEndDir( vtEndDir) ;
|
||||
// ptEnd += vtEndDir * ( m_TParams.m_dDiam / 2 + dSafeZ) ;
|
||||
// ptEnd.ToGlob( frPocket) ;
|
||||
// ptEnd += - vtTool * dDepth ;
|
||||
// double dTestElev ;
|
||||
// if ( GetElevation( m_nPhase, ptEnd, vtTool, m_TParams.m_dDiam / 2, vtTool, dTestElev) && dTestElev > EPS_SMALL)
|
||||
// bInRawLeadIn = true ;
|
||||
//// sistemo attacco e uscita
|
||||
// if ( ! bInRawLeadIn)
|
||||
// vpCrvs[0]->ExtendEndByLen( m_TParams.m_dDiam / 2 + dSafeZ) ;
|
||||
// vpCrvs[0]->ExtendStartByLen( m_TParams.m_dDiam / 4) ;
|
||||
//}
|
||||
// verifico se attacco fuori dal grezzo
|
||||
Point3d ptStart ;
|
||||
vpCrvs[0]->GetStartPoint( ptStart) ;
|
||||
Vector3d vtDir ;
|
||||
vpCrvs[0]->GetStartDir( vtDir) ;
|
||||
ptStart += -vtDir * ( m_TParams.m_dDiam / 2 + dSafeZ) ;
|
||||
ptStart.ToGlob( frPocket) ;
|
||||
ptStart += - vtTool * dDepth ;
|
||||
double dTestElev ;
|
||||
if ( ! GetElevation( m_nPhase, ptStart, vtTool, m_TParams.m_dDiam / 2, vtTool, dTestElev) || dTestElev < EPS_SMALL)
|
||||
bOutRawLeadIn = true ;
|
||||
// sistemo attacco e uscita
|
||||
if ( bOutRawLeadIn)
|
||||
vpCrvs[0]->ExtendStartByLen( m_TParams.m_dDiam / 2 + dSafeZ) ;
|
||||
vpCrvs[0]->ExtendEndByLen( m_TParams.m_dDiam / 4) ;
|
||||
}
|
||||
|
||||
// se caso non ottimizzato calcolo curva offsettata del raggio utensile + sovramateriale + (se non lucidatura) extra
|
||||
@@ -2027,13 +2008,6 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se richiesta inversione
|
||||
//if ( m_Params.m_bInvert) {
|
||||
// // ciclo sui percorsi
|
||||
// for ( int k = 0 ; k < int( vpCrvs.size()) ; ++ k)
|
||||
// vpCrvs[k]->Invert() ;
|
||||
//}
|
||||
|
||||
// se lucidatura
|
||||
if ( m_TParams.m_nType == TT_MILL_POLISHING) {
|
||||
// ciclo sui percorsi
|
||||
@@ -2097,7 +2071,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
dStElev = max( dStElev, j * dStep) ;
|
||||
dStElev -= ( ptP1 - ptStart) * vtExtr ;
|
||||
// se ottimizzata e attacco nel grezzo
|
||||
if ( bOptimizedZigZag && bInRawLeadIn) {
|
||||
if ( bOptimizedZigZag && ! bOutRawLeadIn) {
|
||||
// se richiesto attacco a zigzag o a spirale, l'elevazione va nell'attacco
|
||||
if ( GetLeadInType() == POCKET_LI_ZIGZAG || GetLeadInType() == POCKET_LI_HELIX) {
|
||||
ptP1 += vtExtr * dStElev ;
|
||||
@@ -2106,7 +2080,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
}
|
||||
// se inizio, approccio globale al punto iniziale
|
||||
if ( bStart) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, false)) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bOutRawLeadIn)) {
|
||||
m_pMchMgr->SetLastError( 2414, "Error in Pocketing : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2114,14 +2088,14 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
}
|
||||
// altrimenti, approccio di collegamento
|
||||
else {
|
||||
if ( ! AddLinkApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr)) {
|
||||
if ( ! AddLinkApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bOutRawLeadIn)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// aggiungo attacco
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, pCompo, nullptr, ! m_Params.m_bInvert, bSplitArcs, ! bInRawLeadIn, bOptimizedZigZag)) {
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, pCompo, nullptr, ! m_Params.m_bInvert, bSplitArcs, bOutRawLeadIn, bOptimizedZigZag)) {
|
||||
m_pMchMgr->SetLastError( 2415, "Error in Pocketing : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2347,8 +2321,8 @@ Pocketing::CalcZigZag( const ICurveComposite* pOffs,
|
||||
double dLen ; pOffs->GetLength( dLen) ;
|
||||
|
||||
// passi in Y
|
||||
int nYStep = static_cast<int>( ceil( ( dDimY - 20 * EPS_SMALL) / GetSideStep())) ;
|
||||
double dYStep = ( nYStep > 0 ? ( dDimY - 20 * EPS_SMALL) / nYStep : 0) ;
|
||||
int nYStep = static_cast<int>( ceil( ( dDimY - 30 * EPS_SMALL) / GetSideStep())) ;
|
||||
double dYStep = ( nYStep > 0 ? ( dDimY - 30 * EPS_SMALL) / nYStep : 0) ;
|
||||
int nRef = ( ( nYStep + ( m_Params.m_bInvert ? 0 : 1)) % 2) ;
|
||||
|
||||
// tratto valido
|
||||
@@ -2647,7 +2621,7 @@ Pocketing::ZigZagOptimizedOneClosedEdge( ICurveComposite* pCrvPocket, int nClose
|
||||
pCrvPocket->GetExtrusion( vtExtr) ;
|
||||
pCrv->SetExtrusion( vtExtr) ;
|
||||
|
||||
pCrv->SimpleOffset( - m_TParams.m_dDiam / 2) ;
|
||||
pCrv->SimpleOffset( - m_TParams.m_dDiam / 2 + 10 * EPS_SMALL) ;
|
||||
pCrv->ExtendStartByLen( 100) ;
|
||||
pCrv->ExtendEndByLen( 100) ;
|
||||
|
||||
@@ -2702,17 +2676,20 @@ Pocketing::ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INT
|
||||
double dLen2 ; pCrv2->GetLength( dLen2) ;
|
||||
|
||||
// taglio per ultima la curva più lunga
|
||||
if ( dLen1 > dLen2)
|
||||
swap( pCrv1, pCrv2) ;
|
||||
if ( dLen1 > dLen2) {
|
||||
PtrOwner<ICurveLine> pTmp( Release( pCrv1)) ;
|
||||
pCrv1.Set( Release( pCrv2)) ;
|
||||
pCrv2.Set( Release( pTmp)) ;
|
||||
}
|
||||
|
||||
pCrv1->SimpleOffset( - m_TParams.m_dDiam / 2) ;
|
||||
pCrv1->SimpleOffset( - m_TParams.m_dDiam / 2 + 10 * EPS_SMALL) ;
|
||||
pCrv1->ExtendStartByLen( 100) ;
|
||||
pCrv1->ExtendEndByLen( 100) ;
|
||||
if ( ! CutCurveWithLine( pCrvPocket, pCrv1))
|
||||
return false ;
|
||||
|
||||
// sarà la prima curva del percorso
|
||||
pCrv2->SimpleOffset( - m_TParams.m_dDiam / 2) ;
|
||||
pCrv2->SimpleOffset( - m_TParams.m_dDiam / 2 + 10 * EPS_SMALL) ;
|
||||
pCrv2->ExtendStartByLen( 100) ;
|
||||
pCrv2->ExtendEndByLen( 100) ;
|
||||
if ( ! CutCurveWithLine( pCrvPocket, pCrv2))
|
||||
@@ -2744,6 +2721,13 @@ Pocketing::ZigZagOptimizedThreeClosedEdges( ICurveComposite* pCrvPocket, const I
|
||||
pCrv3->GetStartPoint( ptStart3) ;
|
||||
if ( ! AreSamePointApprox( ptEnd1, ptStart2) || ! AreSamePointApprox( ptEnd2, ptStart3))
|
||||
return true ;
|
||||
// verifico che primo e terzo non siano troppo lunghe
|
||||
double dLen1 ;
|
||||
pCrv1->GetLength( dLen1) ;
|
||||
double dLen2 ;
|
||||
pCrv2->GetLength( dLen2) ;
|
||||
if ( dLen1 > 1.5 * m_TParams.m_dDiam || dLen2 > 1.5 * m_TParams.m_dDiam)
|
||||
return true ;
|
||||
|
||||
// setto il vettore estrusione per eseguire correttamente offset
|
||||
Vector3d vtExtr ;
|
||||
@@ -2752,20 +2736,20 @@ Pocketing::ZigZagOptimizedThreeClosedEdges( ICurveComposite* pCrvPocket, const I
|
||||
pCrv2->SetExtrusion( vtExtr) ;
|
||||
pCrv3->SetExtrusion( vtExtr) ;
|
||||
|
||||
pCrv1->SimpleOffset( - m_TParams.m_dDiam / 2) ;
|
||||
pCrv1->SimpleOffset( - m_TParams.m_dDiam / 2 + 10 * EPS_SMALL) ;
|
||||
pCrv1->ExtendStartByLen( 100) ;
|
||||
pCrv1->ExtendEndByLen( 100) ;
|
||||
if ( ! CutCurveWithLine( pCrvPocket, pCrv1))
|
||||
return false ;
|
||||
|
||||
pCrv3->SimpleOffset( - m_TParams.m_dDiam / 2) ;
|
||||
pCrv3->SimpleOffset( - m_TParams.m_dDiam / 2 + 10 * EPS_SMALL) ;
|
||||
pCrv3->ExtendStartByLen( 100) ;
|
||||
pCrv3->ExtendEndByLen( 100) ;
|
||||
if ( ! CutCurveWithLine( pCrvPocket, pCrv3))
|
||||
return false ;
|
||||
|
||||
// sarà la prima curva del percorso
|
||||
pCrv2->SimpleOffset( - m_TParams.m_dDiam / 2) ;
|
||||
pCrv2->SimpleOffset( - m_TParams.m_dDiam / 2 + 10 * EPS_SMALL) ;
|
||||
pCrv2->ExtendStartByLen( 100) ;
|
||||
pCrv2->ExtendEndByLen( 100) ;
|
||||
if ( ! CutCurveWithLine( pCrvPocket, pCrv2))
|
||||
@@ -4192,7 +4176,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)
|
||||
double dElev, double dAppr, bool bOutStart)
|
||||
{
|
||||
// se sopra attacco c'è spazio per approccio
|
||||
if ( ( dElev + dAppr) > 10 * EPS_SMALL) {
|
||||
@@ -4205,7 +4189,7 @@ Pocketing::AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double d
|
||||
}
|
||||
// affondo al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
SetFeed( GetTipFeed()) ;
|
||||
SetFeed( bOutStart ? GetStartFeed() : GetTipFeed()) ;
|
||||
if ( AddLinearMove( ptP) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@ class Pocketing : public Machining
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bOutStart) ;
|
||||
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr) ;
|
||||
double dElev, double dAppr, bool bOutStart = false) ;
|
||||
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
|
||||
Reference in New Issue
Block a user