EgtMachKernel :
- modifiche a Pocketing per svuotature a ZigZag ottimizzate.
This commit is contained in:
+8
-4
@@ -2081,6 +2081,7 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
|
||||
// passo al successivo
|
||||
nPrevClPathId = nClPathId ;
|
||||
nClPathId = m_pGeomDB->GetNextGroup( nClPathId) ;
|
||||
pPrevOp = nullptr ;
|
||||
}
|
||||
|
||||
// aggiungo risalita finale
|
||||
@@ -2203,14 +2204,17 @@ Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation*
|
||||
}
|
||||
// risalita sopra fine percorso precedente
|
||||
DBLVECTOR vAxNew1 ;
|
||||
double dDelta = ( ! bZHomeDown ? max( dSafeZ - vAxPrev[2], 0.) : min( dSafeZ - vAxPrev[2], 0.)) ;
|
||||
if ( nPrevClPathId == GDB_ID_NULL) {
|
||||
if ( pPrevOp == nullptr ||
|
||||
! pPrevOp->RemoveRise() ||
|
||||
! pPrevOp->AddRise( vAxNew1, dDelta, GDB_ID_NULL, bZHomeDown))
|
||||
if ( pPrevOp == nullptr || ! pPrevOp->RemoveRise())
|
||||
return false ;
|
||||
DBLVECTOR vAxPrevNoRise ;
|
||||
pPrevOp->GetFinalAxesValues( false, vAxPrevNoRise) ;
|
||||
double dDelta = ( ! bZHomeDown ? max( dSafeZ - vAxPrevNoRise[2], 0.) : min( dSafeZ - vAxPrevNoRise[2], 0.)) ;
|
||||
if ( ! pPrevOp->AddRise( vAxNew1, dDelta, GDB_ID_NULL, bZHomeDown))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
double dDelta = ( ! bZHomeDown ? max( dSafeZ - vAxPrev[2], 0.) : min( dSafeZ - vAxPrev[2], 0.)) ;
|
||||
if ( ! AddRise( vAxNew1, dDelta, nPrevClPathId, bZHomeDown))
|
||||
return false ;
|
||||
}
|
||||
|
||||
+210
-40
@@ -37,6 +37,8 @@
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
|
||||
#include "/EgtDev/Include/EGkGeoObjSave.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//------------------------------ Errors --------------------------------------
|
||||
@@ -1947,18 +1949,45 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
|
||||
// verifico se si tratta di caso ottimizzato
|
||||
bool bOptimizedZigZag = false ;
|
||||
bool bInRawLeadIn = false ;
|
||||
if ( ! OptimizedZigZag( nPathId, frPocket, bOptimizedZigZag, vpCrvs))
|
||||
return false ;
|
||||
if ( bOptimizedZigZag) {
|
||||
nOffsCrvNbr = 1 ;
|
||||
if ( ! m_Params.m_bInvert) {
|
||||
vpCrvs[0]->ExtendStartByLen( m_TParams.m_dDiam / 2 + dSafeZ) ;
|
||||
//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 {
|
||||
vpCrvs[0]->ExtendStartByLen( m_TParams.m_dDiam / 4) ;
|
||||
vpCrvs[0]->ExtendEndByLen( m_TParams.m_dDiam / 2 + dSafeZ) ;
|
||||
}
|
||||
//}
|
||||
//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) ;
|
||||
//}
|
||||
}
|
||||
|
||||
// se caso non ottimizzato calcolo curva offsettata del raggio utensile + sovramateriale + (se non lucidatura) extra
|
||||
@@ -1999,11 +2028,11 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
}
|
||||
|
||||
// se richiesta inversione
|
||||
if ( m_Params.m_bInvert) {
|
||||
// ciclo sui percorsi
|
||||
for ( int k = 0 ; k < int( vpCrvs.size()) ; ++ k)
|
||||
vpCrvs[k]->Invert() ;
|
||||
}
|
||||
//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) {
|
||||
@@ -2067,6 +2096,14 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
if ( bUnderRaw)
|
||||
dStElev = max( dStElev, j * dStep) ;
|
||||
dStElev -= ( ptP1 - ptStart) * vtExtr ;
|
||||
// se ottimizzata e attacco nel grezzo
|
||||
if ( bOptimizedZigZag && bInRawLeadIn) {
|
||||
// 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 ;
|
||||
dStElev = 0 ;
|
||||
}
|
||||
}
|
||||
// se inizio, approccio globale al punto iniziale
|
||||
if ( bStart) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, false)) {
|
||||
@@ -2084,7 +2121,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
|
||||
}
|
||||
// aggiungo attacco
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, pCompo, nullptr, ! m_Params.m_bInvert, bSplitArcs, true)) {
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, pCompo, nullptr, ! m_Params.m_bInvert, bSplitArcs, ! bInRawLeadIn, bOptimizedZigZag)) {
|
||||
m_pMchMgr->SetLastError( 2415, "Error in Pocketing : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2312,6 +2349,7 @@ Pocketing::CalcZigZag( const ICurveComposite* pOffs,
|
||||
// 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 nRef = ( ( nYStep + ( m_Params.m_bInvert ? 0 : 1)) % 2) ;
|
||||
|
||||
// tratto valido
|
||||
struct Section {
|
||||
@@ -2331,7 +2369,7 @@ Pocketing::CalcZigZag( const ICurveComposite* pOffs,
|
||||
int nCount = 0 ;
|
||||
for ( int i = 0 ; i <= nYStep ; ++ i) {
|
||||
// determino senso
|
||||
bool bPlus = (( i % 2) == 0) ;
|
||||
bool bPlus = (( i % 2) == nRef) ;
|
||||
// definisco la linea
|
||||
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||
const double EXP_LEN = 1.0 ;
|
||||
@@ -2404,7 +2442,7 @@ Pocketing::CalcZigZag( const ICurveComposite* pOffs,
|
||||
break ;
|
||||
}
|
||||
// determino senso
|
||||
bool bPlus = (( nI % 2) == 0) ;
|
||||
bool bPlus = (( nI % 2) == nRef) ;
|
||||
// aggiungo la sezione alla curva
|
||||
Section& Sec = vvSec[nI][nJ] ;
|
||||
Sec.bActive = false ;
|
||||
@@ -2503,8 +2541,8 @@ Pocketing::OptimizedZigZag( int nPathId, Frame3d& frPocket, bool& bOptimizedZigZ
|
||||
// recupero gli id dei lati chiusi
|
||||
INTVECTOR vnInfoOpen ;
|
||||
m_pGeomDB->GetInfo( nCrvId, "OPEN", vnInfoOpen) ;
|
||||
// se sono più di due, esco
|
||||
if ( pCrvPocket->GetCurveCount() - vnInfoOpen.size() > 2)
|
||||
// se sono più di tre, esco
|
||||
if ( pCrvPocket->GetCurveCount() - vnInfoOpen.size() > 3)
|
||||
return true ;
|
||||
INTVECTOR vnInfoClosed( pCrvPocket->GetCurveCount() - vnInfoOpen.size()) ;
|
||||
int k = 0 ;
|
||||
@@ -2514,23 +2552,56 @@ Pocketing::OptimizedZigZag( int nPathId, Frame3d& frPocket, bool& bOptimizedZigZ
|
||||
k ++ ;
|
||||
}
|
||||
}
|
||||
int nClosedSides = vnInfoClosed.size() ;
|
||||
|
||||
// modifico pCrvPocket per poterla passare a CalcZigZag
|
||||
if ( vnInfoClosed.size() == 0)
|
||||
bool bTwoOpposite ;
|
||||
switch ( nClosedSides) {
|
||||
case 0 :
|
||||
bOptimizedZigZag = true ;
|
||||
else if ( vnInfoClosed.size() == 1)
|
||||
break ;
|
||||
case 1 :
|
||||
ZigZagOptimizedOneClosedEdge( pCrvPocket, vnInfoClosed[0], bOptimizedZigZag) ;
|
||||
else // size = 2
|
||||
ZigZagOptimizedTwoClosedEdges( pCrvPocket, vnInfoClosed, bOptimizedZigZag) ;
|
||||
break ;
|
||||
case 2 :
|
||||
ZigZagOptimizedTwoClosedEdges( pCrvPocket, vnInfoClosed, bOptimizedZigZag, bTwoOpposite) ;
|
||||
break ;
|
||||
case 3 :
|
||||
ZigZagOptimizedThreeClosedEdges( pCrvPocket, vnInfoClosed, bOptimizedZigZag) ;
|
||||
break ;
|
||||
default :
|
||||
bOptimizedZigZag = false ;
|
||||
break ;
|
||||
}
|
||||
|
||||
if ( ! bOptimizedZigZag)
|
||||
return true ;
|
||||
|
||||
// oriento il frame della svuotatura allineando asse x con il lato closed
|
||||
// se lati tutti aperti, sposto il segmento di retta più lungo in prima posizione
|
||||
if ( nClosedSides == 0) {
|
||||
int nMax = 0 ;
|
||||
double dMaxLen = 0 ;
|
||||
for ( int i = 0 ; i < int( pCrvPocket->GetCurveCount()) ; ++ i) {
|
||||
const ICurve* pCrv = pCrvPocket->GetCurve( i) ;
|
||||
if ( pCrv->GetType() == CRV_LINE) {
|
||||
double dLen = 0 ; pCrv->GetLength( dLen) ;
|
||||
if ( dLen > dMaxLen) {
|
||||
dMaxLen = dLen ;
|
||||
nMax = i ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( nMax > 0)
|
||||
pCrvPocket->ChangeStartPoint( nMax) ;
|
||||
}
|
||||
|
||||
// oriento il frame della svuotatura allineando asse X con il primo lato (closed)
|
||||
Vector3d vtEdgeDir ;
|
||||
pCrvPocket->GetFirstCurve()->GetStartDir( vtEdgeDir) ;
|
||||
pCrvPocket->GetStartDir( vtEdgeDir) ;
|
||||
double dAng ;
|
||||
vtEdgeDir.GetAngleXY( X_AX, dAng) ;
|
||||
if ( nClosedSides == 0)
|
||||
dAng += m_Params.m_dSideAngle ;
|
||||
pCrvPocket->ToGlob( frPocket) ;
|
||||
Point3d ptCen = frPocket.Orig() ;
|
||||
Vector3d vtExtr = frPocket.VersZ() ;
|
||||
@@ -2541,9 +2612,23 @@ Pocketing::OptimizedZigZag( int nPathId, Frame3d& frPocket, bool& bOptimizedZigZ
|
||||
if ( ! CalcZigZag( pCrvPocket, vpCrvs))
|
||||
return false ;
|
||||
|
||||
// se un solo lato chiuso lo inverto per partire dall'esterno
|
||||
if ( vnInfoClosed.size() == 1)
|
||||
// se un lato chiuso o due lati chiusi consecutivi o tre lati chiusi...
|
||||
if ( nClosedSides == 1 || ( nClosedSides == 2 && ! bTwoOpposite) || nClosedSides == 3) {
|
||||
// inverto il percorso
|
||||
vpCrvs[0]->Invert() ;
|
||||
// allungo opportunamente inizio e fine
|
||||
Point3d ptStart ;
|
||||
vpCrvs[0]->GetStartPoint( ptStart) ;
|
||||
Vector3d vtDir ;
|
||||
vpCrvs[0]->GetStartDir( vtDir) ;
|
||||
vtDir.Rotate( Z_AX, ( m_Params.m_bInvert ? - 90 : 90)) ;
|
||||
ptStart += vtDir ;
|
||||
Point3d ptEnd ;
|
||||
vpCrvs[0]->GetEndPoint( ptEnd) ;
|
||||
ptEnd += OrthoCompo( ptStart - ptEnd, X_AX) ;
|
||||
vpCrvs[0]->AddLine( ptEnd, true) ;
|
||||
vpCrvs[0]->AddLine( ptStart, false) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -2566,6 +2651,7 @@ Pocketing::ZigZagOptimizedOneClosedEdge( ICurveComposite* pCrvPocket, int nClose
|
||||
pCrv->ExtendStartByLen( 100) ;
|
||||
pCrv->ExtendEndByLen( 100) ;
|
||||
|
||||
// sarà la prima curva del percorso
|
||||
if ( ! CutCurveWithLine( pCrvPocket, pCrv))
|
||||
return false ;
|
||||
|
||||
@@ -2575,7 +2661,7 @@ Pocketing::ZigZagOptimizedOneClosedEdge( ICurveComposite* pCrvPocket, int nClose
|
||||
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag)
|
||||
Pocketing::ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag, bool& bOpposite)
|
||||
{
|
||||
// recupero le due curve chiuse
|
||||
PtrOwner<ICurveLine> pCrv1( CloneCurveLine( pCrvPocket->GetCurve( vnClosedIds[0]))) ;
|
||||
@@ -2583,12 +2669,27 @@ Pocketing::ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INT
|
||||
// verifico siano linee
|
||||
if ( IsNull( pCrv1) || IsNull( pCrv2))
|
||||
return true ;
|
||||
// verifico abbiano direzioni opposte
|
||||
// verifico abbiano direzioni opposte
|
||||
Vector3d vtDir1, vtDir2 ;
|
||||
pCrv1->GetStartDir( vtDir1) ;
|
||||
pCrv2->GetStartDir( vtDir2) ;
|
||||
if ( ! AreOppositeVectorApprox( vtDir1, vtDir2))
|
||||
return true ;
|
||||
if ( AreOppositeVectorApprox( vtDir1, vtDir2))
|
||||
bOpposite = true ;
|
||||
else {
|
||||
// verifico siano consecutive
|
||||
Point3d ptStart1 ;
|
||||
pCrv1->GetStartPoint( ptStart1) ;
|
||||
Point3d ptEnd1 ;
|
||||
pCrv1->GetEndPoint( ptEnd1) ;
|
||||
Point3d ptStart2 ;
|
||||
pCrv2->GetStartPoint( ptStart2) ;
|
||||
Point3d ptEnd2 ;
|
||||
pCrv2->GetEndPoint( ptEnd2) ;
|
||||
if ( AreSamePointApprox( ptEnd1, ptStart2) || AreSamePointApprox( ptEnd2, ptStart1))
|
||||
bOpposite = false ;
|
||||
else
|
||||
return true ;
|
||||
}
|
||||
|
||||
// setto il vettore estrusione per eseguire correttamente offset
|
||||
Vector3d vtExtr ;
|
||||
@@ -2596,12 +2697,74 @@ Pocketing::ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INT
|
||||
pCrv1->SetExtrusion( vtExtr) ;
|
||||
pCrv2->SetExtrusion( vtExtr) ;
|
||||
|
||||
// determino la curva chiusa più lunga
|
||||
double dLen1 ; pCrv1->GetLength( dLen1) ;
|
||||
double dLen2 ; pCrv2->GetLength( dLen2) ;
|
||||
|
||||
// taglio per ultima la curva più lunga
|
||||
if ( dLen1 > dLen2)
|
||||
swap( pCrv1, pCrv2) ;
|
||||
|
||||
pCrv1->SimpleOffset( - m_TParams.m_dDiam / 2) ;
|
||||
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->ExtendStartByLen( 100) ;
|
||||
pCrv2->ExtendEndByLen( 100) ;
|
||||
if ( ! CutCurveWithLine( pCrvPocket, pCrv2))
|
||||
return false ;
|
||||
|
||||
bOptimizedZigZag = true ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::ZigZagOptimizedThreeClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag)
|
||||
{
|
||||
// recupero le tre curve chiuse
|
||||
PtrOwner<ICurveLine> pCrv1( CloneCurveLine( pCrvPocket->GetCurve( vnClosedIds[0]))) ;
|
||||
PtrOwner<ICurveLine> pCrv2( CloneCurveLine( pCrvPocket->GetCurve( vnClosedIds[1]))) ;
|
||||
PtrOwner<ICurveLine> pCrv3( CloneCurveLine( pCrvPocket->GetCurve( vnClosedIds[2]))) ;
|
||||
// verifico siano linee
|
||||
if ( IsNull( pCrv1) || IsNull( pCrv2) || IsNull( pCrv3))
|
||||
return true ;
|
||||
// verifico siano consecutive
|
||||
Point3d ptEnd1 ;
|
||||
pCrv1->GetEndPoint( ptEnd1) ;
|
||||
Point3d ptStart2 ;
|
||||
pCrv2->GetStartPoint( ptStart2) ;
|
||||
Point3d ptEnd2 ;
|
||||
pCrv2->GetEndPoint( ptEnd2) ;
|
||||
Point3d ptStart3 ;
|
||||
pCrv3->GetStartPoint( ptStart3) ;
|
||||
if ( ! AreSamePointApprox( ptEnd1, ptStart2) || ! AreSamePointApprox( ptEnd2, ptStart3))
|
||||
return true ;
|
||||
|
||||
// setto il vettore estrusione per eseguire correttamente offset
|
||||
Vector3d vtExtr ;
|
||||
pCrvPocket->GetExtrusion( vtExtr) ;
|
||||
pCrv1->SetExtrusion( vtExtr) ;
|
||||
pCrv2->SetExtrusion( vtExtr) ;
|
||||
pCrv3->SetExtrusion( vtExtr) ;
|
||||
|
||||
pCrv1->SimpleOffset( - m_TParams.m_dDiam / 2) ;
|
||||
pCrv1->ExtendStartByLen( 100) ;
|
||||
pCrv1->ExtendEndByLen( 100) ;
|
||||
if ( ! CutCurveWithLine( pCrvPocket, pCrv1))
|
||||
return false ;
|
||||
|
||||
pCrv3->SimpleOffset( - m_TParams.m_dDiam / 2) ;
|
||||
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->ExtendStartByLen( 100) ;
|
||||
pCrv2->ExtendEndByLen( 100) ;
|
||||
@@ -2994,14 +3157,20 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
|
||||
if ( bOutStart) {
|
||||
// calcolo il punto fuori
|
||||
Point3d ptOut = ptMidOpen + vtMidOut * ( 0.5 * m_TParams.m_dDiam + dSafeZ) ;
|
||||
// aggiungo al ritorno l'uscita
|
||||
if ( pRCrv->GetCurveCount() == 0) {
|
||||
Point3d ptStart ; pMCrv->GetStartPoint( ptStart) ;
|
||||
pRCrv->AddPoint( ptStart) ;
|
||||
// verifico che il punto sia veramente fuori dal grezzo
|
||||
double dStElev ;
|
||||
if ( ! GetElevation( m_nPhase, ptOut, vtTool, 0.5 * m_TParams.m_dDiam, vtTool, dStElev) || dStElev < EPS_SMALL) {
|
||||
// aggiungo al ritorno l'uscita
|
||||
if ( pRCrv->GetCurveCount() == 0) {
|
||||
Point3d ptStart ; pMCrv->GetStartPoint( ptStart) ;
|
||||
pRCrv->AddPoint( ptStart) ;
|
||||
}
|
||||
pRCrv->AddLine( ptOut, true) ;
|
||||
// premetto alla spirale la partenza da fuori
|
||||
pMCrv->AddLine( ptOut, false) ;
|
||||
}
|
||||
pRCrv->AddLine( ptOut, true) ;
|
||||
// premetto alla spirale la partenza da fuori
|
||||
pMCrv->AddLine( ptOut, false) ;
|
||||
else
|
||||
bOutStart = false ;
|
||||
}
|
||||
|
||||
// se utensile che non lavora di testa e ingresso non fuori dal pezzo, errore
|
||||
@@ -4161,7 +4330,8 @@ Pocketing::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, con
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
const ICurveComposite* pCompo, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs, bool bNoneForced)
|
||||
const ICurveComposite* pCompo, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
|
||||
bool bNoneForced, bool bSkipControl)
|
||||
{
|
||||
// Assegno il tipo
|
||||
int nType = GetLeadInType() ;
|
||||
@@ -4180,7 +4350,7 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3
|
||||
double dDeltaN = ( ptStart - ptP1) * vtN ;
|
||||
double dAngCen = ceil( - dDeltaN / ( m_Params.m_dLiElev + 10 * EPS_SMALL)) * ( bAtLeft ? ANG_FULL : - ANG_FULL) ;
|
||||
// verifico se fattibile
|
||||
if ( VerifyLeadInHelix( pCompo, ptCen, dRad)) {
|
||||
if ( bSkipControl || VerifyLeadInHelix( pCompo, ptCen, dRad)) {
|
||||
// creo l'elica
|
||||
PtrOwner<ICurveArc> pArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pArc) || ! pArc->Set( ptCen, vtN, dRad, - vtCen, dAngCen, dDeltaN))
|
||||
@@ -4210,7 +4380,7 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3
|
||||
Point3d ptPa = ptP1 + vtStart * 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
|
||||
Point3d ptPb = ptP1 - vtStart * 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
|
||||
// verifico se fattibile
|
||||
if ( VerifyLeadInZigZag( pCompo, ptPa, ptPb)) {
|
||||
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)
|
||||
return false ;
|
||||
@@ -4622,4 +4792,4 @@ Pocketing::VerifyLeadInZigZag( const ICurveComposite* pCompo, const Point3d& ptP
|
||||
if ( ! DistPointCurve( ptPbL, *pCompo).GetDist( dMinDistPb))
|
||||
return false ;
|
||||
return ( dMinDistPa > 0.5 * m_TParams.m_dDiam - 10 * EPS_SMALL && dMinDistPb > 0.5 * m_TParams.m_dDiam - 10 * EPS_SMALL) ;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -80,7 +80,8 @@ class Pocketing : public Machining
|
||||
bool CalcZigZag( const ICurveComposite* pOffs, ICRVCOMPOPOVECTOR& vpCrvs) ;
|
||||
bool OptimizedZigZag( int nPathId, Frame3d& frPocket, bool& bOptimizedZigZag, ICRVCOMPOPOVECTOR& vpCrvs) ;
|
||||
bool ZigZagOptimizedOneClosedEdge( ICurveComposite* pCrvPocket, int nClosedId, bool& bOptimizedZigZag) ;
|
||||
bool ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag) ;
|
||||
bool ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag, bool& bOpposite) ;
|
||||
bool ZigZagOptimizedThreeClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag) ;
|
||||
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
|
||||
bool AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
|
||||
@@ -110,7 +111,8 @@ class Pocketing : public Machining
|
||||
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
const ICurveComposite* pRCrv, Point3d& ptP1) const ;
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
const ICurveComposite* pCompo, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs, bool bNoneForced = false) ;
|
||||
const ICurveComposite* pCompo, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
|
||||
bool bNoneForced = false, bool bSkipControl = false) ;
|
||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
|
||||
const ICurveComposite* pRCrv, bool bSplitArcs, Point3d& ptP1, double& dElev, bool bNoneForced = false) ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
|
||||
Reference in New Issue
Block a user