EgtMachKernel 1.9k1 :

- nel generatore e estimatore aggiunta variabile EMT.SPLITARCS con info spezzatura archi
- in svuotature migliorata gestione lati aperti con pulizia transizioni chiuso-aperto.
This commit is contained in:
Dario Sassi
2018-11-15 18:38:27 +00:00
parent a111ddbd7f
commit 9c33e2f4fc
6 changed files with 86 additions and 10 deletions
+61 -8
View File
@@ -1274,10 +1274,13 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
if ( plPlane.GetVersN() * vtExtr * dArea < 0)
pCompo->Invert() ;
// sposto l'inizio a metà del tratto più lungo
AdjustContourStart( pCompo) ;
// sistemazioni per eventuali lati aperti
if ( bSomeOpen) {
// raggio di riferimento
double dRad = 0.5 * m_TParams.m_dDiam + GetOffsR() ;
// raggio di riferimento per offset
double dRad = 0.25 * m_TParams.m_dDiam + GetOffsR() ;
// estraggo tutte le curve in un vettore
ICURVEPOVECTOR vpCrvs ;
vpCrvs.reserve( pCompo->GetCurveCount()) ;
@@ -1289,13 +1292,66 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
vpCrvs[i]->SimpleOffset( dRad) ;
}
// reinserisco le curve, chiudendo eventuali gap
bool bOpenCurr = false ;
double dDiam = m_TParams.m_dDiam + 2.0 + 2 * GetOffsR() ;
for ( int i = 0 ; i < int( vpCrvs.size()) ; ++ i) {
// stato curve
bool bOpenPrev = bOpenCurr ;
bOpenCurr = ( vpCrvs[i]->GetTempProp() != 0) ;
// chiudo eventuale gap
if ( i > 0) {
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
Point3d ptStart ; vpCrvs[i]->GetStartPoint( ptStart) ;
if ( ! AreSamePointEpsilon( ptEnd, ptStart, 10 * EPS_SMALL))
pCompo->AddLine( ptStart) ;
if ( ! AreSamePointEpsilon( ptEnd, ptStart, 10 * EPS_SMALL)) {
if ( ! bOpenPrev && bOpenCurr) {
Vector3d vtTg ; pCompo->GetEndDir( vtTg) ;
Vector3d vtOrt = vtTg ; vtOrt.Rotate( vtExtr, 0, 1) ;
Point3d ptArc = ptEnd + dDiam * vtOrt ;
Point3d ptLine = ptArc - 5 * dDiam * vtTg ;
PtrOwner<ICurveComposite> pJCrv( CreateCurveComposite()) ;
if ( IsNull( pJCrv))
return false ;
pJCrv->SetExtrusion( vtExtr) ;
pJCrv->AddPoint( ptLine) ;
pJCrv->AddLine( ptArc, false) ;
pJCrv->AddArcTg( ptEnd, false) ;
IntersCurveCurve intCC( *pJCrv, *vpCrvs[i]) ;
IntCrvCrvInfo aInfo ;
if ( intCC.GetIntCrvCrvInfo( intCC.GetIntersCount() - 1, aInfo)) {
pJCrv->TrimEndAtParam( aInfo.IciA[0].dU) ;
vpCrvs[i]->TrimStartAtParam( aInfo.IciB[0].dU) ;
pCompo->AddCurve( ::Release( pJCrv), true, 10 * EPS_SMALL) ;
}
else
pCompo->AddLine( ptStart) ;
}
else if ( bOpenPrev && ! bOpenCurr) {
Vector3d vtTg ; vpCrvs[i]->GetStartDir( vtTg) ;
Vector3d vtOrt = vtTg ; vtOrt.Rotate( vtExtr, 0, 1) ;
Point3d ptArc = ptStart + dDiam * vtOrt ;
Point3d ptLine = ptArc + 5 * dDiam * vtTg ;
PtrOwner<ICurveComposite> pJCrv( CreateCurveComposite()) ;
if ( IsNull( pJCrv))
return false ;
pJCrv->SetExtrusion( vtExtr) ;
pJCrv->AddPoint( ptLine) ;
pJCrv->AddLine( ptArc) ;
pJCrv->AddArcTg( ptStart) ;
const ICurve* pLCrv = pCompo->GetLastCurve() ;
IntersCurveCurve intCC( *pJCrv, *pLCrv) ;
IntCrvCrvInfo aInfo ;
if ( intCC.GetIntCrvCrvInfo( 0, aInfo)) {
double dUs, dUe ; pCompo->GetDomain( dUs, dUe) ;
pCompo->TrimEndAtParam( dUe - 1 + aInfo.IciB[0].dU) ;
pJCrv->TrimStartAtParam( aInfo.IciA[0].dU) ;
pCompo->AddCurve( ::Release( pJCrv), true, 10 * EPS_SMALL) ;
}
else
pCompo->AddLine( ptStart) ;
}
else
pCompo->AddLine( ptStart) ;
}
}
// aggiungo la curva
pCompo->AddCurve( ::Release( vpCrvs[i]), true, 10 * EPS_SMALL) ;
@@ -1303,7 +1359,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
pCompo->Close() ;
}
// unisco le parti allineate (tranne inizio-fine se chiusa)
// unisco le parti allineate (tranne inizio-fine)
if ( ! pCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL, false))
return false ;
@@ -1461,9 +1517,6 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
m_pGeomDB->SetName( nPxId, sPathName) ;
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
// sposto l'inizio a metà del tratto più lungo
AdjustContourStart( pCompo) ;
// verifico se archi vanno approssimati con segmenti di retta
int nSplitArcs = m_pMchMgr->GetCurrMachiningsMgr()->GetSplitArcs() ;
bool bSplitArcs = ( nSplitArcs == SPLAR_ALWAYS ||