EgtMachKernel 2.1f3 :
- completamento svuotature a spirale.
This commit is contained in:
Binary file not shown.
+312
-275
@@ -2553,147 +2553,157 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
|
||||
// calcolo la spirale dall'esterno all'interno e la curva che unisce inizio e fine
|
||||
PtrOwner<ICurveComposite> pMCrv( CreateCurveComposite()) ;
|
||||
PtrOwner<ICurveComposite> pRCrv( CreateCurveComposite()) ;
|
||||
if ( IsNull( pMCrv) || IsNull( pRCrv)) {
|
||||
m_pMchMgr->SetLastError( 2411, "Error in Pocketing : toolpath allocation failed") ;
|
||||
return false ;
|
||||
}
|
||||
if ( ! CalcSpiral( pCompo, bSplitArcs, pMCrv, pRCrv))
|
||||
return false ;
|
||||
// ciclo sulle regioni
|
||||
const int MAX_REGS = 50 ;
|
||||
int nReg = 0 ;
|
||||
while ( nReg < MAX_REGS) {
|
||||
|
||||
// determino numero e affondamento degli step
|
||||
int nStep = 1 ;
|
||||
nStep = max( 1, static_cast<int>( ceil( dElev / dOkStep))) ;
|
||||
double dStep = dElev / nStep ;
|
||||
|
||||
int nMaxInd = pMCrv->GetCurveCount() - 1 ;
|
||||
int nMaxRInd = pRCrv->GetCurveCount() - 1 ;
|
||||
|
||||
// ciclo sugli step
|
||||
Point3d ptP1 ;
|
||||
for ( int j = 1 ; j <= nStep ; ++ j) {
|
||||
// ciclo sulle curve elementari
|
||||
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
|
||||
// curva corrente
|
||||
const ICurve* pCrvC = pMCrv->GetCurve( i) ;
|
||||
// copio la curva
|
||||
PtrOwner<ICurve> pCurve( pCrvC->Clone()) ;
|
||||
if ( IsNull( pCurve))
|
||||
return false ;
|
||||
// aggiungo affondamento
|
||||
pCurve->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
|
||||
// se prima entità
|
||||
if ( i == 0 ) {
|
||||
// dati inizio entità
|
||||
Point3d ptStart ;
|
||||
pCurve->GetStartPoint( ptStart) ;
|
||||
Vector3d vtStart ;
|
||||
pCurve->GetStartDir( vtStart) ;
|
||||
// se primo step, approccio e affondo
|
||||
if ( j == 1) {
|
||||
// determino inizio attacco
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, pRCrv, ptP1))
|
||||
return false ;
|
||||
// determino elevazione su inizio attacco
|
||||
double dStElev ;
|
||||
if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev))
|
||||
dStElev = dElev ;
|
||||
dStElev -= ( ptP1 - ptStart) * vtExtr ;
|
||||
// se attacco a zigzag o a spirale o a scivolo, l'elevazione va nell'attacco
|
||||
if ( GetLeadInType() == POCKET_LI_ZIGZAG ||
|
||||
GetLeadInType() == POCKET_LI_HELIX ||
|
||||
GetLeadInType() == POCKET_LI_GLIDE) {
|
||||
ptP1 += vtExtr * dStElev ;
|
||||
dStElev = 0 ;
|
||||
}
|
||||
// approccio al punto iniziale
|
||||
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, pCompo, pRCrv, ! m_Params.m_bInvert, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2415, "Error in Pocketing : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti solo collegamento
|
||||
else {
|
||||
SetFeed( GetStartFeed()) ;
|
||||
GetCurrPos( ptP1) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, pCompo, pRCrv, ! m_Params.m_bInvert, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// elaborazioni sulla curva corrente
|
||||
if ( pCurve->GetType() == CRV_LINE) {
|
||||
ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
// calcolo la spirale dall'esterno all'interno e la curva che unisce inizio e fine
|
||||
PtrOwner<ICurveComposite> pMCrv( CreateCurveComposite()) ;
|
||||
PtrOwner<ICurveComposite> pRCrv( CreateCurveComposite()) ;
|
||||
if ( IsNull( pMCrv) || IsNull( pRCrv)) {
|
||||
m_pMchMgr->SetLastError( 2411, "Error in Pocketing : toolpath allocation failed") ;
|
||||
return false ;
|
||||
}
|
||||
if ( ! CalcSpiral( pCompo, nReg, bSplitArcs, pMCrv, pRCrv))
|
||||
return false ;
|
||||
// se terminate le regioni, esco
|
||||
if ( pMCrv->GetCurveCount() == 0)
|
||||
break ;
|
||||
++ nReg ;
|
||||
|
||||
// determino numero e affondamento degli step
|
||||
int nStep = 1 ;
|
||||
nStep = max( 1, static_cast<int>( ceil( dElev / dOkStep))) ;
|
||||
double dStep = dElev / nStep ;
|
||||
|
||||
int nMaxInd = pMCrv->GetCurveCount() - 1 ;
|
||||
int nMaxRInd = pRCrv->GetCurveCount() - 1 ;
|
||||
|
||||
// ciclo sugli step
|
||||
Point3d ptP1 ;
|
||||
for ( int j = 1 ; j <= nStep ; ++ j) {
|
||||
// ciclo sulle curve elementari
|
||||
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
|
||||
// curva corrente
|
||||
const ICurve* pCrvC = pMCrv->GetCurve( i) ;
|
||||
// copio la curva
|
||||
PtrOwner<ICurve> pCurve( pCrvC->Clone()) ;
|
||||
if ( IsNull( pCurve))
|
||||
return false ;
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
ICurveArc* pArc = GetCurveArc( pCurve) ;
|
||||
Point3d ptCen = pArc->GetCenter() ;
|
||||
double dAngCen = pArc->GetAngCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
Point3d ptP3 ;
|
||||
pArc->GetEndPoint( ptP3) ;
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se ultima entità
|
||||
if ( i == nMaxInd) {
|
||||
// se step intermedio, ritorno all'inizio direttamente
|
||||
if ( j < nStep) {
|
||||
// se necessario ritorno all'inizio
|
||||
if ( nMaxRInd >= 0) {
|
||||
// copio la curva di ritorno
|
||||
PtrOwner<ICurveComposite> pRet( pRCrv->Clone()) ;
|
||||
if ( IsNull( pRet))
|
||||
// aggiungo affondamento
|
||||
pCurve->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
|
||||
// se prima entità
|
||||
if ( i == 0 ) {
|
||||
// dati inizio entità
|
||||
Point3d ptStart ;
|
||||
pCurve->GetStartPoint( ptStart) ;
|
||||
Vector3d vtStart ;
|
||||
pCurve->GetStartDir( vtStart) ;
|
||||
// se primo step, approccio e affondo
|
||||
if ( j == 1) {
|
||||
// determino inizio attacco
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, pRCrv, ptP1))
|
||||
return false ;
|
||||
// aggiungo affondamento
|
||||
pRet->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
|
||||
// se attacco a scivolo, accorcio della lunghezza dell'attacco
|
||||
if ( GetLeadInType() == POCKET_LI_GLIDE) {
|
||||
double dLen ; pRet->GetLength( dLen) ;
|
||||
if ( dLen > m_Params.m_dLiTang + 10 * EPS_SMALL)
|
||||
pRet->TrimEndAtLen( dLen - m_Params.m_dLiTang) ;
|
||||
else
|
||||
pRet->Clear() ;
|
||||
// determino elevazione su inizio attacco
|
||||
double dStElev ;
|
||||
if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev))
|
||||
dStElev = dElev ;
|
||||
dStElev -= ( ptP1 - ptStart) * vtExtr ;
|
||||
// se attacco a zigzag o a spirale o a scivolo, l'elevazione va nell'attacco
|
||||
if ( GetLeadInType() == POCKET_LI_ZIGZAG ||
|
||||
GetLeadInType() == POCKET_LI_HELIX ||
|
||||
GetLeadInType() == POCKET_LI_GLIDE) {
|
||||
ptP1 += vtExtr * dStElev ;
|
||||
dStElev = 0 ;
|
||||
}
|
||||
// emetto
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( pRet->GetCurveCount() > 0 && AddCurveMove( pRet) == GDB_ID_NULL)
|
||||
// approccio al punto iniziale
|
||||
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, pCompo, pRCrv, ! m_Params.m_bInvert, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2415, "Error in Pocketing : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti solo collegamento
|
||||
else {
|
||||
SetFeed( GetStartFeed()) ;
|
||||
GetCurrPos( ptP1) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, pCompo, pRCrv, ! m_Params.m_bInvert, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// atrimenti ultimo step, uscita e retrazione
|
||||
else {
|
||||
// dati fine entità
|
||||
Point3d ptEnd ;
|
||||
pCurve->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtEnd ;
|
||||
pCurve->GetEndDir( vtEnd) ;
|
||||
// aggiungo uscita
|
||||
Point3d ptP1 ;
|
||||
double dEndElev = dElev ;
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, pRCrv, bSplitArcs, ptP1, dEndElev)) {
|
||||
m_pMchMgr->SetLastError( 2416, "Error in Pocketing : LeadOut not computable") ;
|
||||
// elaborazioni sulla curva corrente
|
||||
if ( pCurve->GetType() == CRV_LINE) {
|
||||
ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
ICurveArc* pArc = GetCurveArc( pCurve) ;
|
||||
Point3d ptCen = pArc->GetCenter() ;
|
||||
double dAngCen = pArc->GetAngCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
Point3d ptP3 ;
|
||||
pArc->GetEndPoint( ptP3) ;
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se ultima entità
|
||||
if ( i == nMaxInd) {
|
||||
// se step intermedio, ritorno all'inizio direttamente
|
||||
if ( j < nStep) {
|
||||
// se necessario ritorno all'inizio
|
||||
if ( nMaxRInd >= 0) {
|
||||
// copio la curva di ritorno
|
||||
PtrOwner<ICurveComposite> pRet( pRCrv->Clone()) ;
|
||||
if ( IsNull( pRet))
|
||||
return false ;
|
||||
// aggiungo affondamento
|
||||
pRet->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
|
||||
// se attacco a scivolo, accorcio della lunghezza dell'attacco
|
||||
if ( GetLeadInType() == POCKET_LI_GLIDE) {
|
||||
double dLen ; pRet->GetLength( dLen) ;
|
||||
if ( dLen > m_Params.m_dLiTang + 10 * EPS_SMALL)
|
||||
pRet->TrimEndAtLen( dLen - m_Params.m_dLiTang) ;
|
||||
else
|
||||
pRet->Clear() ;
|
||||
}
|
||||
// emetto
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( pRet->GetCurveCount() > 0 && AddCurveMove( pRet) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// aggiungo retrazione
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
m_pMchMgr->SetLastError( 2417, "Error in Pocketing : Retract not computable") ;
|
||||
return false ;
|
||||
// atrimenti ultimo step, uscita e retrazione
|
||||
else {
|
||||
// dati fine entità
|
||||
Point3d ptEnd ;
|
||||
pCurve->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtEnd ;
|
||||
pCurve->GetEndDir( vtEnd) ;
|
||||
// aggiungo uscita
|
||||
Point3d ptP1 ;
|
||||
double dEndElev = dElev ;
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, pRCrv, bSplitArcs, ptP1, dEndElev)) {
|
||||
m_pMchMgr->SetLastError( 2416, "Error in Pocketing : LeadOut not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// aggiungo retrazione
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
m_pMchMgr->SetLastError( 2417, "Error in Pocketing : Retract not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2713,151 +2723,162 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
|
||||
// calcolo la spirale dall'interno all'esterno
|
||||
PtrOwner<ICurveComposite> pMCrv( CreateCurveComposite()) ;
|
||||
PtrOwner<ICurveComposite> pRCrv( CreateCurveComposite()) ;
|
||||
if ( IsNull( pMCrv) || IsNull( pRCrv)) {
|
||||
m_pMchMgr->SetLastError( 2411, "Error in Pocketing : toolpath allocation failed") ;
|
||||
return false ;
|
||||
}
|
||||
if ( ! CalcSpiral( pCompo, bSplitArcs, pMCrv, pRCrv))
|
||||
return false ;
|
||||
pMCrv->Invert() ;
|
||||
pRCrv->Invert() ;
|
||||
// ciclo sulle regioni
|
||||
const int MAX_REGS = 50 ;
|
||||
int nReg = 0 ;
|
||||
while ( nReg < MAX_REGS) {
|
||||
|
||||
// determino numero e affondamento degli step
|
||||
int nStep = 1 ;
|
||||
nStep = max( 1, static_cast<int>( ceil( dElev / dOkStep))) ;
|
||||
double dStep = dElev / nStep ;
|
||||
|
||||
int nMaxInd = pMCrv->GetCurveCount() - 1 ;
|
||||
int nMaxRInd = pRCrv->GetCurveCount() - 1 ;
|
||||
|
||||
// ciclo sugli step
|
||||
Point3d ptP1 ;
|
||||
for ( int j = 1 ; j <= nStep ; ++ j) {
|
||||
// ciclo sulle curve elementari
|
||||
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
|
||||
// curva corrente
|
||||
const ICurve* pCrvC = pMCrv->GetCurve( i) ;
|
||||
// copio la curva
|
||||
PtrOwner<ICurve> pCurve( pCrvC->Clone()) ;
|
||||
if ( IsNull( pCurve))
|
||||
return false ;
|
||||
// aggiungo affondamento
|
||||
pCurve->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
|
||||
// se prima entità
|
||||
if ( i == 0 ) {
|
||||
// dati inizio entità
|
||||
Point3d ptStart ;
|
||||
pCurve->GetStartPoint( ptStart) ;
|
||||
Vector3d vtStart ;
|
||||
pCurve->GetStartDir( vtStart) ;
|
||||
// se primo step, approccio e affondo
|
||||
if ( j == 1) {
|
||||
// determino inizio attacco
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, pRCrv, ptP1)) {
|
||||
m_pMchMgr->SetLastError( 2415, "Error in Pocketing : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// determino elevazione su inizio attacco
|
||||
double dStElev ;
|
||||
if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev))
|
||||
dStElev = dElev ;
|
||||
dStElev -= ( ptP1 - ptStart) * vtExtr ;
|
||||
// se attacco a zigzag o a spirale o a scivolo, l'elevazione va nell'attacco
|
||||
if ( GetLeadInType() == POCKET_LI_ZIGZAG ||
|
||||
GetLeadInType() == POCKET_LI_HELIX ||
|
||||
GetLeadInType() == POCKET_LI_GLIDE) {
|
||||
ptP1 += vtExtr * dStElev ;
|
||||
dStElev = 0 ;
|
||||
}
|
||||
// approccio al punto iniziale
|
||||
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, pCompo, pRCrv, m_Params.m_bInvert, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2415, "Error in Pocketing : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti solo collegamento
|
||||
else {
|
||||
SetFeed( GetStartFeed()) ;
|
||||
GetCurrPos( ptP1) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, pCompo, pRCrv, m_Params.m_bInvert, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// elaborazioni sulla curva corrente
|
||||
if ( pCurve->GetType() == CRV_LINE) {
|
||||
ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
// calcolo la spirale dall'interno all'esterno
|
||||
PtrOwner<ICurveComposite> pMCrv( CreateCurveComposite()) ;
|
||||
PtrOwner<ICurveComposite> pRCrv( CreateCurveComposite()) ;
|
||||
if ( IsNull( pMCrv) || IsNull( pRCrv)) {
|
||||
m_pMchMgr->SetLastError( 2411, "Error in Pocketing : toolpath allocation failed") ;
|
||||
return false ;
|
||||
}
|
||||
if ( ! CalcSpiral( pCompo, nReg, bSplitArcs, pMCrv, pRCrv))
|
||||
return false ;
|
||||
// se terminate le regioni, esco
|
||||
if ( pMCrv->GetCurveCount() == 0)
|
||||
break ;
|
||||
++ nReg ;
|
||||
// inverto i percorsi, perchè sono calcolati dall'esterno all'interno
|
||||
pMCrv->Invert() ;
|
||||
pRCrv->Invert() ;
|
||||
|
||||
// determino numero e affondamento degli step
|
||||
int nStep = 1 ;
|
||||
nStep = max( 1, static_cast<int>( ceil( dElev / dOkStep))) ;
|
||||
double dStep = dElev / nStep ;
|
||||
|
||||
int nMaxInd = pMCrv->GetCurveCount() - 1 ;
|
||||
int nMaxRInd = pRCrv->GetCurveCount() - 1 ;
|
||||
|
||||
// ciclo sugli step
|
||||
Point3d ptP1 ;
|
||||
for ( int j = 1 ; j <= nStep ; ++ j) {
|
||||
// ciclo sulle curve elementari
|
||||
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
|
||||
// curva corrente
|
||||
const ICurve* pCrvC = pMCrv->GetCurve( i) ;
|
||||
// copio la curva
|
||||
PtrOwner<ICurve> pCurve( pCrvC->Clone()) ;
|
||||
if ( IsNull( pCurve))
|
||||
return false ;
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
ICurveArc* pArc = GetCurveArc( pCurve) ;
|
||||
Point3d ptCen = pArc->GetCenter() ;
|
||||
double dAngCen = pArc->GetAngCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
Point3d ptP3 ;
|
||||
pArc->GetEndPoint( ptP3) ;
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se ultima entità
|
||||
if ( i == nMaxInd) {
|
||||
// se step intermedio
|
||||
if ( j < nStep) {
|
||||
// se necessario ritorno all'inizio
|
||||
if ( nMaxRInd >= 0) {
|
||||
// copio la curva di ritorno
|
||||
PtrOwner<ICurveComposite> pRet( pRCrv->Clone()) ;
|
||||
if ( IsNull( pRet))
|
||||
// aggiungo affondamento
|
||||
pCurve->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
|
||||
// se prima entità
|
||||
if ( i == 0 ) {
|
||||
// dati inizio entità
|
||||
Point3d ptStart ;
|
||||
pCurve->GetStartPoint( ptStart) ;
|
||||
Vector3d vtStart ;
|
||||
pCurve->GetStartDir( vtStart) ;
|
||||
// se primo step, approccio e affondo
|
||||
if ( j == 1) {
|
||||
// determino inizio attacco
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, pRCrv, ptP1)) {
|
||||
m_pMchMgr->SetLastError( 2415, "Error in Pocketing : LeadIn not computable") ;
|
||||
return false ;
|
||||
// aggiungo affondamento
|
||||
pRet->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
|
||||
// se attacco a scivolo, accorcio della lunghezza dell'attacco
|
||||
if ( GetLeadInType() == POCKET_LI_GLIDE) {
|
||||
double dLen ; pRet->GetLength( dLen) ;
|
||||
if ( dLen > m_Params.m_dLiTang + 10 * EPS_SMALL)
|
||||
pRet->TrimEndAtLen( dLen - m_Params.m_dLiTang) ;
|
||||
else
|
||||
pRet->Clear() ;
|
||||
}
|
||||
// emetto
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( pRet->GetCurveCount() > 0 && AddCurveMove( pRet) == GDB_ID_NULL)
|
||||
// determino elevazione su inizio attacco
|
||||
double dStElev ;
|
||||
if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev))
|
||||
dStElev = dElev ;
|
||||
dStElev -= ( ptP1 - ptStart) * vtExtr ;
|
||||
// se attacco a zigzag o a spirale o a scivolo, l'elevazione va nell'attacco
|
||||
if ( GetLeadInType() == POCKET_LI_ZIGZAG ||
|
||||
GetLeadInType() == POCKET_LI_HELIX ||
|
||||
GetLeadInType() == POCKET_LI_GLIDE) {
|
||||
ptP1 += vtExtr * dStElev ;
|
||||
dStElev = 0 ;
|
||||
}
|
||||
// approccio al punto iniziale
|
||||
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, pCompo, pRCrv, m_Params.m_bInvert, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2415, "Error in Pocketing : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti solo collegamento
|
||||
else {
|
||||
SetFeed( GetStartFeed()) ;
|
||||
GetCurrPos( ptP1) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, pCompo, pRCrv, m_Params.m_bInvert, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// atrimenti ultimo step, uscita e retrazione
|
||||
else {
|
||||
// dati fine entità
|
||||
Point3d ptEnd ;
|
||||
pCurve->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtEnd ;
|
||||
pCurve->GetEndDir( vtEnd) ;
|
||||
// aggiungo uscita
|
||||
Point3d ptQ ;
|
||||
double dEndElev = dElev ;
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, pRCrv, bSplitArcs, ptQ, dEndElev)) {
|
||||
m_pMchMgr->SetLastError( 2416, "Error in Pocketing : LeadOut not computable") ;
|
||||
// elaborazioni sulla curva corrente
|
||||
if ( pCurve->GetType() == CRV_LINE) {
|
||||
ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
ICurveArc* pArc = GetCurveArc( pCurve) ;
|
||||
Point3d ptCen = pArc->GetCenter() ;
|
||||
double dAngCen = pArc->GetAngCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
Point3d ptP3 ;
|
||||
pArc->GetEndPoint( ptP3) ;
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se ultima entità
|
||||
if ( i == nMaxInd) {
|
||||
// se step intermedio
|
||||
if ( j < nStep) {
|
||||
// se necessario ritorno all'inizio
|
||||
if ( nMaxRInd >= 0) {
|
||||
// copio la curva di ritorno
|
||||
PtrOwner<ICurveComposite> pRet( pRCrv->Clone()) ;
|
||||
if ( IsNull( pRet))
|
||||
return false ;
|
||||
// aggiungo affondamento
|
||||
pRet->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
|
||||
// se attacco a scivolo, accorcio della lunghezza dell'attacco
|
||||
if ( GetLeadInType() == POCKET_LI_GLIDE) {
|
||||
double dLen ; pRet->GetLength( dLen) ;
|
||||
if ( dLen > m_Params.m_dLiTang + 10 * EPS_SMALL)
|
||||
pRet->TrimEndAtLen( dLen - m_Params.m_dLiTang) ;
|
||||
else
|
||||
pRet->Clear() ;
|
||||
}
|
||||
// emetto
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( pRet->GetCurveCount() > 0 && AddCurveMove( pRet) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// aggiungo retrazione
|
||||
if ( ! AddRetract( ptQ, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
m_pMchMgr->SetLastError( 2417, "Error in Pocketing : Retract not computable") ;
|
||||
return false ;
|
||||
// atrimenti ultimo step, uscita e retrazione
|
||||
else {
|
||||
// dati fine entità
|
||||
Point3d ptEnd ;
|
||||
pCurve->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtEnd ;
|
||||
pCurve->GetEndDir( vtEnd) ;
|
||||
// aggiungo uscita
|
||||
Point3d ptQ ;
|
||||
double dEndElev = dElev ;
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, pRCrv, bSplitArcs, ptQ, dEndElev)) {
|
||||
m_pMchMgr->SetLastError( 2416, "Error in Pocketing : LeadOut not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// aggiungo retrazione
|
||||
if ( ! AddRetract( ptQ, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) {
|
||||
m_pMchMgr->SetLastError( 2417, "Error in Pocketing : Retract not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2868,9 +2889,13 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::CalcSpiral( const ICurveComposite* pCompo, bool bSplitArcs,
|
||||
Pocketing::CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
|
||||
ICurveComposite* pMCrv, ICurveComposite* pRCrv)
|
||||
{
|
||||
// inizializzo i risultati
|
||||
pMCrv->Clear() ;
|
||||
pRCrv->Clear() ;
|
||||
|
||||
// primo offset pari al raggio utensile + sovramateriale
|
||||
double dTRad = 0.5 * m_TParams.m_dDiam ;
|
||||
double dOffs = dTRad + GetOffsR() ;
|
||||
@@ -2883,7 +2908,10 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, bool bSplitArcs,
|
||||
dIntRad = min( 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam), dRad - dOffs) ;
|
||||
m_dMaxHelixRad = dIntRad ;
|
||||
}
|
||||
return CalcCircleSpiral( ptCen, vtN, dRad - dOffs, dIntRad, bSplitArcs, pMCrv, pRCrv) ;
|
||||
if ( nReg == 0)
|
||||
return CalcCircleSpiral( ptCen, vtN, dRad - dOffs, dIntRad, bSplitArcs, pMCrv, pRCrv) ;
|
||||
else
|
||||
return true ;
|
||||
}
|
||||
|
||||
// ciclo di offset verso l'interno
|
||||
@@ -2901,14 +2929,23 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, bool bSplitArcs,
|
||||
m_pMchMgr->SetLastError( 2412, "Error in Pocketing : Offset not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// recupero le curve di offset e le metto sullo stack
|
||||
// se primo offset e richiesta regione oltre il massimo, esco
|
||||
if ( nIter == 0 && nReg >= OffsCrv.GetCurveCount())
|
||||
return true ;
|
||||
// recupero le curve di offset e le metto sullo stack (se primo offset solo quella voluta)
|
||||
int nCount = 0 ;
|
||||
ICurve* pCrv = OffsCrv.GetLongerCurve() ;
|
||||
while ( pCrv != nullptr) {
|
||||
vCrvStack.emplace_back( pCrv) ;
|
||||
vRadStack.emplace_back( dCurrRad) ;
|
||||
if ( nIter == 0)
|
||||
break ;
|
||||
if ( nIter != 0 || nReg == nCount) {
|
||||
vCrvStack.emplace_back( pCrv) ;
|
||||
vRadStack.emplace_back( dCurrRad) ;
|
||||
if ( nIter == 0)
|
||||
break ;
|
||||
}
|
||||
else
|
||||
delete( pCrv) ;
|
||||
pCrv = OffsCrv.GetCurve() ;
|
||||
++ nCount ;
|
||||
}
|
||||
// recupero la prossima curva di offset
|
||||
PtrOwner<ICurve> pNextOffs ;
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ class Pocketing : public Machining
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool CalcSpiral( const ICurveComposite* pCompo, bool bSplitArcs,
|
||||
bool CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
|
||||
ICurveComposite* pMCrv, ICurveComposite* pRCrv) ;
|
||||
bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, const ICurve* pCrvBound,
|
||||
ICurveComposite* pCrvLink) ;
|
||||
|
||||
Reference in New Issue
Block a user