EgtMachKernel :

- in Finiture di lama Section migliorati i controlli per Start/End Len Agg, e semplificazione del codice
- in Finiture di Lama Along5A aggiunto controllo per svincolo.
This commit is contained in:
Riccardo Elitropi
2026-08-27 16:58:16 +02:00
parent 498b758ce0
commit b63914f60b
2 changed files with 45 additions and 70 deletions
+44 -69
View File
@@ -1885,12 +1885,12 @@ SawFinishing::CalculateStraightSectionToolPath( int nAuxId, int nClId)
// Recupero ed elaboro le sezioni per portarle ad essere la curva del centro in basso della lama
ICurve* pSect,
* pOrigSect ;
ISurfFlatRegion* pSfrLimit ;
if ( ! CalculateOffsetSection( nSectGrpId, frSect, pSect, pOrigSect, pSfrLimit))
ISurfFlatRegion* pMySfrTabLimit ;
if ( ! CalculateOffsetSection( nSectGrpId, frSect, pSect, pOrigSect, pMySfrTabLimit))
return false ;
PtrOwner<ICurve> pCrv( pSect),
pCrvOrig( pOrigSect) ;
PtrOwner<ISurfFlatRegion> pSfrTabLimit( pSfrLimit) ;
PtrOwner<ISurfFlatRegion> pSfrTabLimit( pMySfrTabLimit) ;
if ( IsNull( pCrv) || ! pCrv->IsValid() || IsNull( pCrvOrig) || ! pCrvOrig->IsValid() ||
IsNull( pSfrTabLimit) || ! pSfrTabLimit->IsValid())
return false ;
@@ -1977,67 +1977,38 @@ SawFinishing::CalculateStraightSectionToolPath( int nAuxId, int nClId)
return false ;
}
// Se link standard, allungo inizio e fine della sezione dello spessore lama (senza scendere sotto la quota Z di sicurezza)
// Se link standard, allungo inizio e fine
if ( m_Params.m_nLeadLinkType == SAWFIN_LL_STD) {
Point3d ptS, ptE ;
pCompo->GetStartPoint( ptS) ; pCompo->GetEndPoint( ptE) ;
Vector3d vtS, vtE ;
pCompo->GetStartDir( vtS) ; vtS.Invert() ; pCompo->GetEndDir( vtE) ;
PtrOwner<ICurveLine> pLineS( CreateCurveLine()),
pLineE( CreateCurveLine()) ;
if ( IsNull( pLineS) || ! pLineS->Set( ptS, ptS + vtS * m_TParams.m_dThick) ||
IsNull( pLineE) || ! pLineE->Set( ptE, ptE + vtE * m_TParams.m_dThick))
return false ;
PtrOwner<ICurve> pCrvLimit( pSfrTabLimit->GetLoop( 0, 0)) ;
if ( IsNull( pCrvLimit) || ! pCrvLimit->IsValid())
return false ;
// --- aggiunta estensione iniziale (verifica con sezione e tavola)
pLineS->SetExtrusion( GetToLoc( vtTool, frSect)) ;
PtrOwner<ISurfFlatRegion> pSfrSawShape( GetSurfFlatRegionFromFatCurve( pLineS->Clone(), m_TParams.m_dDiam / 2. + GetOffsR() - 10. * EPS_SMALL, false, false)) ;
if ( IsNull( pSfrSawShape) || ! pSfrSawShape->IsValid() ||
! pSfrSawShape->Translate( GetToLoc( vtCorr, frSect) * m_TParams.m_dDiam / 2.))
return false ;
CRVCVECTOR ccClass ;
if ( ! pSfrSawShape->GetCurveClassification( *pCrvOrig, EPS_SMALL, ccClass))
return false ;
bool bInters = false ;
for ( int j = 0 ; ! bInters && j < ssize( ccClass) ; ++ j)
bInters = ( ccClass[j].nClass == CRVC_IN) ;
if ( ! bInters) {
IntersCurveCurve ICCS( *pLineS, *pCrvLimit) ;
if ( ICCS.GetIntersCount() == 0)
pCompo->AddLine( ptS + vtS * m_TParams.m_dThick, false) ;
else {
IntCrvCrvInfo aInfo ;
if ( ! ICCS.GetIntCrvCrvInfo( 0, aInfo))
return false ;
pCompo->AddLine( aInfo.IciA->ptI, false) ;
}
}
// --- aggiunta estensione finale (verifica con sezione e tavola)
pLineE->SetExtrusion( GetToLoc( vtTool, frSect)) ;
pSfrSawShape.Set( GetSurfFlatRegionFromFatCurve( pLineE->Clone(), m_TParams.m_dDiam / 2. + GetOffsR() - 10. * EPS_SMALL, false, false)) ;
if ( IsNull( pSfrSawShape) || ! pSfrSawShape->IsValid() ||
! pSfrSawShape->Translate( GetToLoc( vtCorr, frSect) * m_TParams.m_dDiam / 2.))
return false ;
ccClass.clear() ;
if ( ! pSfrSawShape->GetCurveClassification( *pCrvOrig, EPS_SMALL, ccClass))
return false ;
bInters = false ;
for ( int j = 0 ; ! bInters && j < ssize( ccClass) ; ++ j)
bInters = ( ccClass[j].nClass == CRVC_IN) ;
if ( ! bInters) {
IntersCurveCurve ICCE( *pLineE, *pCrvLimit) ;
if ( ICCE.GetIntersCount() == 0)
pCompo->AddLine( ptE + vtE * m_TParams.m_dThick, true) ;
else {
IntCrvCrvInfo aInfo ;
if ( ! ICCE.GetIntCrvCrvInfo( 0, aInfo))
return false ;
pCompo->AddLine( aInfo.IciA->ptI, true) ;
}
pCompo->ExtendStartByLen( m_Params.m_dStartPos) ;
pCompo->ExtendEndByLen( m_Params.m_dStartPos) ;
}
// Verifica collisioni con tavola
PtrOwner<ISurfFlatRegion> pSfrLimit( GetSurfFlatRegionFromFatCurve( pCrvOrig->Clone(), m_TParams.m_dDiam / 2. + GetOffsR() - 10. * EPS_SMALL, false, false)) ;
if ( IsNull( pSfrLimit) || ! pSfrLimit->IsValid() || ! pSfrLimit->Translate( -Y_AX * ( m_TParams.m_dDiam / 2.)))
return false ;
if ( ! pSfrLimit->Add( *pSfrTabLimit))
return false ;
CRVCVECTOR ccClass ;
if ( ! pSfrLimit->GetCurveClassification( *pCompo, EPS_SMALL, ccClass))
return false ;
bool bOk = false ;
for ( int i = 0 ; i < ssize( ccClass) ; ++ i) {
if ( ccClass[i].nClass == CRVC_OUT) {
PtrOwner<ICurve> pCrv( pCompo->CopyParamRange( ccClass[i].dParS, ccClass[i].dParE)) ;
if ( ! pCrv->IsValid())
return false ;
pCompo->Clear() ;
pCompo->AddCurve( ::Release( pCrv)) ;
bOk = true ;
break ;
}
}
if ( ! bOk) {
pCompo->Clear() ;
return true ;
}
// La porto in globale
pCompo->ToGlob( frSect) ;
// traslo la sezione lungo la direzione della guida per farla coicidere con il suo punto iniziale
@@ -2089,10 +2060,8 @@ SawFinishing::CalculateStraightSectionToolPath( int nAuxId, int nClId)
dStep = dL / nStep ;
Point3d ptP ;
if ( m_Params.m_nLeadLinkType == SAWFIN_LL_OUT) {
if ( m_Params.m_nLeadLinkType == SAWFIN_LL_OUT)
pCrvOrig->ToGlob( frSect) ;
pSfrTabLimit->ToGlob( frSect) ;
}
for ( int i = 0 ; i <= nStep ; ++ i) {
// vettore di spostamento
@@ -3782,7 +3751,7 @@ SawFinishing::CalcAlong5ACuts( const SECTIONVECTOR& vSections, const Frame3d& fr
}
else {
if ( ! CalcAlong5AZigZagCut( ptStart, ptEnd, vtGdDir, vtTool, vtToolPrev, vtCorr, vtCorrPrev, dElev, dLastElev, bExtend, false,
bFirst, bSpecialAppr))
bFirst, bSpecialAppr, 2. * ( dStep - 10. * EPS_SMALL)))
return false ;
}
// salvo dati correnti
@@ -3918,7 +3887,7 @@ SawFinishing::CalcAlong5AOneWayCut( const Point3d& ptStart, const Point3d& ptEnd
bool
SawFinishing::CalcAlong5AZigZagCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir, const Vector3d& vtTool,
const Vector3d& vtToolPrev, const Vector3d& vtCorr, const Vector3d& vtCorrPrev, double dElev,
double dLastElev, bool bExtend, bool bVert, bool bFirst, bool bAppr)
double dLastElev, bool bExtend, bool bVert, bool bFirst, bool bAppr, double dMaxDist)
{
// recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ;
@@ -3959,13 +3928,19 @@ SawFinishing::CalcAlong5AZigZagCut( const Point3d& ptStart, const Point3d& ptEnd
// 1 -> approccio
// effettuo una retroazione se :
// - ho un approccio forzato dovuto all'inversione dell'utensile
// - ho un approccio forzato dovuto all'inversione dell'utensile o ad un collegamento diretto che rovina la sezione
// - la deviazione angolare tra la passata corrente e la precedente supera la tolleranza
const double ANG_DEG_MAX = 10. ;
bool bPrevRetract = false ;
bool bAwayLink = false ;
if ( m_Params.m_nLeadLinkType != SAWFIN_LL_OUT) {
Point3d ptCurr ; GetCurrPos( ptCurr) ;
if ( SqDist( ptCurr, ptNewStart) > dMaxDist * dMaxDist)
bAwayLink = true ;
}
if ( ! bFirst && vtToolPrev.IsValid() && vtTool.IsValid()) {
// se approccio forzato per inversione utensile
if ( bAppr) {
// se approccio forzato per inversione utensile o Link troppo distante
if ( bAppr || bAwayLink) {
// recupero il punto corrente
Point3d ptCurr ; GetCurrPos( ptCurr) ;
// tengo l'utensile orientato come la passata precedente
+1 -1
View File
@@ -133,7 +133,7 @@ class SawFinishing : public Machining
bool bExtend, bool bVert, bool bFirst, bool bAppr) ;
bool CalcAlong5AZigZagCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir, const Vector3d& vtTool,
const Vector3d& vtToolPrev, const Vector3d& vtCorr, const Vector3d& vtCorrPrev, double dElev,
double dLastElev, bool bExtend, bool bVert, bool bFirst, bool bAppr) ;
double dLastElev, bool bExtend, bool bVert, bool bFirst, bool bAppr, double dMaxDist) ;
bool CalcAlongOneWayCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir,
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bExtend, bool bVert) ;
bool CalcAlongZigZagCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir, const Vector3d& vtTool,