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:
Dario Sassi
2017-03-17 08:30:25 +00:00
parent fdb622516f
commit 9707d91882
6 changed files with 221 additions and 99 deletions
+25 -5
View File
@@ -881,8 +881,25 @@ Milling::GetCurve( SelData Id)
bool
Milling::AdjustCurveFromSurf( ICurveComposite* pCrvCompo)
{
// con utensile fresa fa il contorno
// tipo di utilizzo contorno superficie
enum { SURF_CONT = 0, SURF_TOP = 1, SURF_BOTTOM = 2} ;
int nSurf ;
// se fresa, lo recupero dalle note utente
if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
string sSurf = ExtractSurf( m_Params.m_sUserNotes) ;
if ( sSurf == "C")
nSurf = SURF_CONT ;
else if ( sSurf == "T")
nSurf = SURF_TOP ;
else
nSurf = SURF_BOTTOM ;
}
// altrimenti lama, sempre bottom
else
nSurf = SURF_BOTTOM ;
// se richiesto contorno
if ( nSurf == SURF_CONT) {
// cerco l'estremo più alto e lo imposto come inizio
double dU = 0 ;
double dUmax = 0 ;
@@ -898,19 +915,21 @@ Milling::AdjustCurveFromSurf( ICurveComposite* pCrvCompo)
if ( dU != 0)
pCrvCompo->ChangeStartPoint( dUmax) ;
}
// con utensile lama tiene solo la parte sotto
// altrimenti
else {
// ingombro
BBox3d b3Box ;
pCrvCompo->GetLocalBBox( b3Box) ;
double dZmin = b3Box.GetMin().z ;
double dZtol = min( ( b3Box.GetMax().z - b3Box.GetMin().z) / 2., 20.) ;
double dZmax = b3Box.GetMax().z ;
double dZtol = min( ( dZmax - dZmin) / 4., 20.) ;
// elimino le linee troppo sopra il minimo dall'inizio e poi dalla fine
const ICurve* pCrv = pCrvCompo->GetFirstCurve() ;
while ( pCrv != nullptr) {
Point3d ptMid ; pCrv->GetMidPoint( ptMid) ;
Vector3d vtDir ; pCrv->GetMidDir( vtDir) ;
if ( ptMid.z > dZmin + dZtol) {
if ( ( nSurf == SURF_BOTTOM && ptMid.z > dZmin + dZtol) ||
( nSurf == SURF_TOP && ptMid.z < dZmax - dZtol)) {
ICurve* pErase = pCrvCompo->RemoveFirstOrLastCurve( false) ;
delete( pErase) ;
pCrv = pCrvCompo->GetFirstCurve() ;
@@ -922,7 +941,8 @@ Milling::AdjustCurveFromSurf( ICurveComposite* pCrvCompo)
while ( pCrv != nullptr) {
Point3d ptMid ; pCrv->GetMidPoint( ptMid) ;
Vector3d vtDir ; pCrv->GetMidDir( vtDir) ;
if ( ptMid.z > dZmin + dZtol) {
if ( ( nSurf == SURF_BOTTOM && ptMid.z > dZmin + dZtol) ||
( nSurf == SURF_TOP && ptMid.z < dZmax - dZtol)) {
ICurve* pErase = pCrvCompo->RemoveFirstOrLastCurve( true) ;
delete( pErase) ;
pCrv = pCrvCompo->GetLastCurve() ;
+20 -1
View File
@@ -608,7 +608,7 @@ Operation::GetClPathFinalAxesValues( int nClPathId, DBLVECTOR& vAxVal)
}
//----------------------------------------------------------------------------
std::string
string
Operation::ExtractHint( const std::string& sNotes)
{
const string KEY_HINT = "Hint:" ;
@@ -626,6 +626,25 @@ Operation::ExtractHint( const std::string& sNotes)
return sHint ;
}
//----------------------------------------------------------------------------
string
Operation::ExtractSurf( const std::string& sNotes)
{
const string KEY_SURF = "Surf:" ;
string sHint ;
STRVECTOR vsCmd ;
Tokenize( sNotes, ";", vsCmd) ;
for each (const auto& sCmd in vsCmd) {
// se per assi rotanti
if ( sCmd.find( KEY_SURF) != string::npos) {
sHint = sCmd ;
ReplaceString( sHint, KEY_SURF, "") ;
break ;
}
}
return sHint ;
}
//----------------------------------------------------------------------------
bool
Operation::CalculateAxesValues( const string& sHint)
+1
View File
@@ -79,6 +79,7 @@ class Operation : public IUserObj
bool GetFinalAxesValues( DBLVECTOR& vAxVal) ;
bool GetClPathFinalAxesValues( int nClPathId, DBLVECTOR& vAxVal) ;
std::string ExtractHint( const std::string& sNotes) ;
std::string ExtractSurf( const std::string& sNotes) ;
bool CalculateAxesValues( const std::string& sHint) ;
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
+161 -80
View File
@@ -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 ;
}
+3 -2
View File
@@ -81,9 +81,10 @@ class Pocketing : public Machining
bool bSplitArcs, ICurveComposite* pMCrv, ICurveComposite* pRCrv) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN, Point3d& ptP1) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
const ICurveComposite* pRCrv, Point3d& ptP1) ;
bool 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) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
const ICurveComposite* pRCrv, bool bSplitArcs, Point3d& ptP1, double& dElev) ;
double GetRadiusForStartEndElevation( void) ;
+11 -11
View File
@@ -22,6 +22,7 @@
#include "OutputConst.h"
#include "/EgtDev/Include/EMkToolConst.h"
#include "/EgtDev/Include/EMkOperationConst.h"
#include "/EgtDev/Include/EgtNumUtils.h"
using namespace std ;
@@ -234,10 +235,7 @@ Simulator::GetMoveInfo( int& nGmove, double& dFeed) const
// Assegno feed
dFeed = pCamData->GetFeed() ;
// Assegno tipo di movimento
if ( dFeed < EPS_SMALL)
nGmove = 0 ;
else
nGmove = 1 ;
nGmove = pCamData->GetMoveType() ;
return true ;
}
@@ -247,12 +245,7 @@ Simulator::SetStep( double dStep)
{
const double MIN_STEP = 0.1 ;
const double MAX_STEP = 100.0 ;
if ( dStep < MIN_STEP)
m_dStep = MIN_STEP ;
else if ( dStep > MAX_STEP)
m_dStep = MAX_STEP ;
else
m_dStep = dStep ;
m_dStep = Clamp( dStep, MIN_STEP, MAX_STEP) ;
return true ;
}
@@ -689,9 +682,16 @@ Simulator::ManageMove( int& nStatus)
nStatus = MCH_SIM_ERR ;
return false ;
}
const DBLVECTOR& AxesEnd = pCamData->GetAxesVal() ;
DBLVECTOR AxesEnd = pCamData->GetAxesVal() ;
// Tipo di movimento
int nMoveType = pCamData->GetMoveType() ;
// Se movimento in rapido muovo solo gli assi abilitati dal mask
if ( nMoveType == 0) {
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {
if ( ( pCamData->GetAxesMask() & 1 << i) == 0)
AxesEnd[i] = m_AxesVal[i] ;
}
}
// Se inizio di nuova entità
if ( m_nEntId != GDB_ID_NULL && m_dCoeff < EPS_ZERO) {