EgtMachKernel :
- corrette svuotature di cerchi su piani diversi da XY - aggiunti a svuotature attacchi a scivolo (GLIDE) - aggiunti suggerimenti - gestito in simulatore mask assi in movimenti in rapido - corretta in simulatore visualizzazione tipo movimento.
This commit is contained in:
+161
-80
@@ -1411,7 +1411,7 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
|
||||
m_pMchMgr->SetLastError( 2411, "Error in Pocketing : toolpath allocation failed") ;
|
||||
return false ;
|
||||
}
|
||||
if ( ! CalcSpiral( pCompo, bSplitArcs, Get( pMCrv), Get( pRCrv)))
|
||||
if ( ! CalcSpiral( pCompo, bSplitArcs, pMCrv, pRCrv))
|
||||
return false ;
|
||||
|
||||
// determino numero e affondamento degli step
|
||||
@@ -1423,6 +1423,7 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
|
||||
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) {
|
||||
@@ -1444,16 +1445,17 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
|
||||
// se primo step, approccio e affondo
|
||||
if ( j == 1) {
|
||||
// determino inizio attacco
|
||||
Point3d ptP1 ;
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, ptP1))
|
||||
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(), dStElev))
|
||||
dStElev = dElev ;
|
||||
dStElev -= ( ptP1 - ptStart) * vtExtr ;
|
||||
// se attacco a zigzag o a spirale, l'elevazione va nell'attacco
|
||||
if ( GetLeadInType() == POCKET_LI_ZIGZAG || GetLeadInType() == POCKET_LI_HELIX) {
|
||||
// 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 ;
|
||||
}
|
||||
@@ -1462,7 +1464,7 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
|
||||
return false ;
|
||||
// aggiungo attacco
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, ! m_Params.m_bInvert, bSplitArcs)) {
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, pRCrv, ! m_Params.m_bInvert, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2414, "Error in Pocketing : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1470,8 +1472,8 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
|
||||
// altrimenti solo collegamento
|
||||
else {
|
||||
SetFeed( GetStartFeed()) ;
|
||||
Point3d ptP1 = ptStart + vtExtr * dStep ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, ! m_Params.m_bInvert, bSplitArcs)) {
|
||||
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") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1500,16 +1502,27 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
|
||||
if ( i == nMaxInd) {
|
||||
// se step intermedio, ritorno all'inizio direttamente
|
||||
if ( j < nStep) {
|
||||
// copio la curva di ritorno
|
||||
PtrOwner<ICurve> pRet( pRCrv->Clone()) ;
|
||||
if ( IsNull( pRet))
|
||||
return false ;
|
||||
// aggiungo affondamento
|
||||
pRet->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
|
||||
// emetto
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( AddCurveMove( pRet) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// 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 ;
|
||||
}
|
||||
}
|
||||
// atrimenti ultimo step, uscita e retrazione
|
||||
else {
|
||||
@@ -1553,7 +1566,7 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
m_pMchMgr->SetLastError( 2411, "Error in Pocketing : toolpath allocation failed") ;
|
||||
return false ;
|
||||
}
|
||||
if ( ! CalcSpiral( pCompo, bSplitArcs, Get( pMCrv), Get( pRCrv)))
|
||||
if ( ! CalcSpiral( pCompo, bSplitArcs, pMCrv, pRCrv))
|
||||
return false ;
|
||||
pMCrv->Invert() ;
|
||||
pRCrv->Invert() ;
|
||||
@@ -1567,6 +1580,7 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
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) {
|
||||
@@ -1588,8 +1602,7 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
// se primo step, approccio e affondo
|
||||
if ( j == 1) {
|
||||
// determino inizio attacco
|
||||
Point3d ptP1 ;
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, ptP1)) {
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, pRCrv, ptP1)) {
|
||||
m_pMchMgr->SetLastError( 2414, "Error in Pocketing : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1598,8 +1611,10 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), dStElev))
|
||||
dStElev = dElev ;
|
||||
dStElev -= ( ptP1 - ptStart) * vtExtr ;
|
||||
// se attacco a zigzag o a spirale, l'elevazione va nell'attacco
|
||||
if ( GetLeadInType() == POCKET_LI_ZIGZAG || GetLeadInType() == POCKET_LI_HELIX) {
|
||||
// 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 ;
|
||||
}
|
||||
@@ -1608,7 +1623,7 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
return false ;
|
||||
// aggiungo attacco
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, m_Params.m_bInvert, bSplitArcs)) {
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, pRCrv, m_Params.m_bInvert, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2414, "Error in Pocketing : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1616,8 +1631,8 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
// altrimenti solo collegamento
|
||||
else {
|
||||
SetFeed( GetStartFeed()) ;
|
||||
Point3d ptP1 = ptStart + vtExtr * dStep ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, m_Params.m_bInvert, bSplitArcs)) {
|
||||
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") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1644,18 +1659,29 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
}
|
||||
// se ultima entità
|
||||
if ( i == nMaxInd) {
|
||||
// se step intermedio, ritorno all'inizio direttamente
|
||||
// se step intermedio
|
||||
if ( j < nStep) {
|
||||
// copio la curva di ritorno
|
||||
PtrOwner<ICurve> pRet( pRCrv->Clone()) ;
|
||||
if ( IsNull( pRet))
|
||||
return false ;
|
||||
// aggiungo affondamento
|
||||
pRet->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
|
||||
// emetto
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( AddCurveMove( pRet) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// 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 ;
|
||||
}
|
||||
}
|
||||
// atrimenti ultimo step, uscita e retrazione
|
||||
else {
|
||||
@@ -1665,15 +1691,15 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
Vector3d vtEnd ;
|
||||
pCurve->GetEndDir( vtEnd) ;
|
||||
// aggiungo uscita
|
||||
Point3d ptP1 ;
|
||||
Point3d ptQ ;
|
||||
double dEndElev = dElev ;
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, pRCrv, bSplitArcs, ptP1, dEndElev)) {
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, pRCrv, bSplitArcs, ptQ, dEndElev)) {
|
||||
m_pMchMgr->SetLastError( 2415, "Error in Pocketing : LeadOut not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// aggiungo retrazione
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dEndElev, dAppr))
|
||||
if ( ! AddRetract( ptQ, vtTool, dSafeZ, dEndElev, dAppr))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -1694,8 +1720,8 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, bool bSplitArcs,
|
||||
Point3d ptCen ; Vector3d vtN ; double dRad ; bool bCCW ;
|
||||
if ( pCompo->IsACircle( 10 * EPS_SMALL, ptCen, vtN, dRad, bCCW)) {
|
||||
double dIntRad = 0 ;
|
||||
if ( GetLeadInType() == POCKET_LI_HELIX || GetLeadInType() == POCKET_LI_ZIGZAG)
|
||||
dIntRad = 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
|
||||
if ( m_Params.m_nSubType == POCKET_SUB_SPIRALOUT && GetLeadInType() == POCKET_LI_HELIX)
|
||||
dIntRad = min( 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam), dRad - dOffs) ;
|
||||
return CalcCircleSpiral( ptCen, vtN, dRad - dOffs, dIntRad, bSplitArcs, pMCrv, pRCrv) ;
|
||||
}
|
||||
|
||||
@@ -1773,6 +1799,10 @@ Pocketing::CalcCircleSpiral( const Point3d& ptCen, const Vector3d& vtN, double d
|
||||
return false ;
|
||||
}
|
||||
|
||||
// imposto versore estrusione sulle curve composite
|
||||
pMCrv->SetExtrusion( vtN) ;
|
||||
pRCrv->SetExtrusion( vtN) ;
|
||||
|
||||
// creo e inserisco la circonferenza esterna
|
||||
PtrOwner<ICurveArc> pArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pArc) || ! pArc->Set( ptCen, vtN, dOutRad)) {
|
||||
@@ -1785,21 +1815,25 @@ Pocketing::CalcCircleSpiral( const Point3d& ptCen, const Vector3d& vtN, double d
|
||||
if ( m_Params.m_bInvert)
|
||||
pMCrv->Invert() ;
|
||||
|
||||
// aggiungo le semicirconferenze della spirale ( devono essere in numero dispari)
|
||||
int nStep = int( ceil( ( dOutRad - dIntRad) / ( 0.5 * GetSideStep()))) ;
|
||||
if ( IsEven( nStep))
|
||||
nStep += 1 ;
|
||||
double dStep = ( dOutRad - dIntRad) / nStep ;
|
||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||
if ( ! IsEven( i))
|
||||
pMCrv->AddArcTg( ptCen - vtDir * ( dOutRad - i * dStep)) ;
|
||||
else
|
||||
pMCrv->AddArcTg( ptCen + vtDir * ( dOutRad - i * dStep)) ;
|
||||
}
|
||||
// se raggio esterno maggiore dell'interno
|
||||
if ( dOutRad > dIntRad + 10 * EPS_SMALL) {
|
||||
|
||||
// aggiungo la circonferenza interna
|
||||
pMCrv->AddArcTg( ptCen + vtDir * dIntRad) ;
|
||||
pMCrv->AddArcTg( ptCen - vtDir * dIntRad) ;
|
||||
// aggiungo le semicirconferenze della spirale ( devono essere in numero dispari)
|
||||
int nStep = int( ceil( ( dOutRad - dIntRad) / ( 0.5 * GetSideStep()))) ;
|
||||
if ( IsEven( nStep))
|
||||
nStep += 1 ;
|
||||
double dStep = ( dOutRad - dIntRad) / nStep ;
|
||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||
if ( ! IsEven( i))
|
||||
pMCrv->AddArcTg( ptCen - vtDir * ( dOutRad - i * dStep)) ;
|
||||
else
|
||||
pMCrv->AddArcTg( ptCen + vtDir * ( dOutRad - i * dStep)) ;
|
||||
}
|
||||
|
||||
// aggiungo la circonferenza interna
|
||||
pMCrv->AddArcTg( ptCen + vtDir * dIntRad) ;
|
||||
pMCrv->AddArcTg( ptCen - vtDir * dIntRad) ;
|
||||
}
|
||||
|
||||
// verifico il percorso di lavoro
|
||||
if ( pMCrv->GetCurveCount() == 0) {
|
||||
@@ -1814,19 +1848,21 @@ Pocketing::CalcCircleSpiral( const Point3d& ptCen, const Vector3d& vtN, double d
|
||||
// eventuale sistemazione archi
|
||||
VerifyArcs( pMCrv) ;
|
||||
|
||||
// calcolo il percorso di ritorno
|
||||
// calcolo l'eventuale percorso di ritorno
|
||||
Point3d ptStart ; pMCrv->GetStartPoint( ptStart) ;
|
||||
Point3d ptEnd ; pMCrv->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtStart ; pMCrv->GetStartDir( vtStart) ;
|
||||
PtrOwner<ICurveArc> pArc2( CreateCurveArc()) ;
|
||||
if ( IsNull( pArc2) || ! pArc2->Set2PVN( ptStart, ptEnd, - vtStart, vtN)) {
|
||||
m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Return toolpath not computable") ;
|
||||
return false ;
|
||||
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") ;
|
||||
return false ;
|
||||
}
|
||||
pRCrv->AddCurve( Release( pArc2)) ;
|
||||
// inverto e eventualmente sistemo archi
|
||||
pRCrv->Invert() ;
|
||||
VerifyArcs( pRCrv) ;
|
||||
}
|
||||
pRCrv->AddCurve( Release( pArc2)) ;
|
||||
// inverto e eventualmente sistemo archi
|
||||
pRCrv->Invert() ;
|
||||
VerifyArcs( pRCrv) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -1960,23 +1996,30 @@ Pocketing::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
Point3d& ptP1)
|
||||
const ICurveComposite* pRCrv, Point3d& ptP1)
|
||||
{
|
||||
// Assegno tipo e parametri
|
||||
int nType = GetLeadInType() ;
|
||||
double dLen= m_Params.m_dLiTang ;
|
||||
if ( nType == POCKET_LI_GLIDE && pRCrv->GetCurveCount() == 0)
|
||||
nType = POCKET_LI_NONE ;
|
||||
// senso di rotazione da dir tg a dir esterna
|
||||
bool bCcwRot = true ;
|
||||
// !!! provvisorio : GLIDE -> NONE !!!
|
||||
if ( nType == POCKET_LI_GLIDE)
|
||||
nType = POCKET_LI_NONE ;
|
||||
// Calcolo punto iniziale
|
||||
switch ( nType) {
|
||||
case POCKET_LI_NONE :
|
||||
ptP1 = ptStart ;
|
||||
return true ;
|
||||
case POCKET_LI_GLIDE :
|
||||
return false ;
|
||||
{
|
||||
double dLen, dU ;
|
||||
if ( ! pRCrv->GetLength( dLen) || ! pRCrv->GetParamAtLength( dLen - m_Params.m_dLiTang, dU) ||
|
||||
! pRCrv->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP1)) {
|
||||
if ( ! pRCrv->GetStartPoint( ptP1))
|
||||
return false ;
|
||||
}
|
||||
ptP1 += vtN * ( vtN * ( ptStart - ptP1)) ;
|
||||
return true ;
|
||||
}
|
||||
case POCKET_LI_ZIGZAG :
|
||||
case POCKET_LI_HELIX :
|
||||
ptP1 = ptStart ;
|
||||
@@ -1989,12 +2032,11 @@ Pocketing::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, con
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
|
||||
const Vector3d& vtN, bool bAtLeft, bool bSplitArcs)
|
||||
const Vector3d& vtN, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs)
|
||||
{
|
||||
// Assegno il tipo
|
||||
int nType = GetLeadInType() ;
|
||||
// !!! provvisorio : GLIDE -> NONE !!!
|
||||
if ( nType == POCKET_LI_GLIDE)
|
||||
if ( nType == POCKET_LI_GLIDE && pRCrv->GetCurveCount() == 0)
|
||||
nType = POCKET_LI_NONE ;
|
||||
// Eseguo a seconda del tipo
|
||||
switch ( nType) {
|
||||
@@ -2005,7 +2047,47 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3
|
||||
}
|
||||
return true ;
|
||||
case POCKET_LI_GLIDE :
|
||||
// !!! DA FARE !!!
|
||||
{
|
||||
// recupero la parte richiesta della curva di ritorno
|
||||
PtrOwner<ICurveComposite> pCrv ;
|
||||
double dLen, dU ;
|
||||
if ( pRCrv->GetLength( dLen) && pRCrv->GetParamAtLength( dLen - m_Params.m_dLiTang, dU)) {
|
||||
double dParS, dParE ;
|
||||
pRCrv->GetDomain( dParS, dParE) ;
|
||||
if ( ! pCrv.Set( CreateCurveComposite()) || ! pCrv->AddCurve( pRCrv->CopyParamRange( dU, dParE)))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( ! pCrv.Set( pRCrv->Clone()))
|
||||
return false ;
|
||||
}
|
||||
// la porto alla giusta quota
|
||||
Point3d ptFin ; pCrv->GetEndPoint( ptFin) ;
|
||||
Vector3d vtMove = ptStart - ptFin ;
|
||||
pCrv->Translate( vtMove) ;
|
||||
// sposto il punto iniziale e rendo uniforme la pendenza
|
||||
double dDeltaN = ( ptP1 - ptStart) * vtN ;
|
||||
int i = 0 ;
|
||||
double dCurrLen = 0 ;
|
||||
const ICurve* pSCrv = pCrv->GetFirstCurve() ;
|
||||
while ( pSCrv != nullptr) {
|
||||
double dCrvLen ;
|
||||
pSCrv->GetLength( dCrvLen) ;
|
||||
double dCurrDeltaN = dDeltaN * ( 1.0 - dCurrLen / dLen) ;
|
||||
Point3d ptJoin ;
|
||||
pSCrv->GetStartPoint( ptJoin) ;
|
||||
pCrv->ModifyJoint( i, ptJoin + vtN * dCurrDeltaN) ;
|
||||
// passo al successivo
|
||||
dCurrLen += dCrvLen ;
|
||||
pSCrv = pCrv->GetNextCurve() ;
|
||||
++ i ;
|
||||
}
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs && ! ApproxWithLines( pCrv))
|
||||
return false ;
|
||||
// emetto
|
||||
return ( AddCurveMove( pCrv) != GDB_ID_NULL) ;
|
||||
}
|
||||
return false ;
|
||||
case POCKET_LI_ZIGZAG :
|
||||
{
|
||||
@@ -2020,9 +2102,7 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3
|
||||
if ( AddLinearMove( ptPb - vtN * ( i - 0.25) * dStep, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
if ( AddLinearMove( ptStart, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
return true ;
|
||||
return ( AddLinearMove( ptStart, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
case POCKET_LI_HELIX :
|
||||
{
|
||||
@@ -2062,7 +2142,8 @@ Pocketing::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector
|
||||
{
|
||||
// assegno i parametri
|
||||
int nType = GetLeadOutType() ;
|
||||
double dTang = m_Params.m_dLoTang ;
|
||||
if ( nType == POCKET_LO_GLIDE && pRCrv->GetCurveCount() == 0)
|
||||
nType = POCKET_LO_NONE ;
|
||||
// eseguo a seconda del tipo
|
||||
switch ( nType) {
|
||||
case POCKET_LO_NONE :
|
||||
@@ -2078,7 +2159,7 @@ Pocketing::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector
|
||||
// recupero la parte richiesta della curva di ritorno
|
||||
PtrOwner<ICurveComposite> pCrv ;
|
||||
double dU ;
|
||||
if ( pRCrv->GetParamAtLength( dTang, dU)) {
|
||||
if ( pRCrv->GetParamAtLength( m_Params.m_dLoTang, dU)) {
|
||||
if ( ! pCrv.Set( CreateCurveComposite()) || ! pCrv->AddCurve( pRCrv->CopyParamRange( 0, dU)))
|
||||
return false ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user