EgtMachKernel :
- in Pocketing corretti attacchi e raccordi per lucidature con epicicli.
This commit is contained in:
+84
-13
@@ -20,6 +20,7 @@
|
||||
#include "MachiningConst.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkBiArcs.h"
|
||||
#include "/EgtDev/Include/EGkArcSpecial.h"
|
||||
#include "/EgtDev/Include/EGkChainCurves.h"
|
||||
#include "/EgtDev/Include/EGkOffsetCurve.h"
|
||||
@@ -3538,6 +3539,11 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
|
||||
// eventuale sistemazione archi
|
||||
VerifyArcs( pMCrv) ;
|
||||
|
||||
// setto estrusione
|
||||
Vector3d vtExtr ;
|
||||
if ( pCompo->GetExtrusion( vtExtr))
|
||||
pMCrv->SetExtrusion( vtExtr) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -3610,6 +3616,58 @@ Pocketing::CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, const
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::CalcBoundedLinkWithBiArcs( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd,
|
||||
const ICurve* pCrvBound, ICurveComposite* pCrvLink)
|
||||
{
|
||||
double dAngStart, dAngEnd ;
|
||||
vtStart.GetAngleXY( X_AX, dAngStart) ;
|
||||
vtEnd.GetAngleXY( X_AX, dAngEnd) ;
|
||||
PtrOwner<ICurve> pBiArcLink( GetBiArc( ptStart, -dAngStart, ptEnd, -dAngEnd, 0.5)) ;
|
||||
if ( IsNull( pBiArcLink))
|
||||
return false ;
|
||||
|
||||
// verifico se esce dalla svuotatura
|
||||
CRVCVECTOR ccClass ;
|
||||
IntersCurveCurve intCC( *pBiArcLink, *pCrvBound) ;
|
||||
intCC.GetCurveClassification( 0, EPS_SMALL, ccClass) ;
|
||||
// se nessuno o un solo tratto e interno, il biarco è il collegamento
|
||||
if ( ccClass.empty() || ( ccClass.size() == 1 && ccClass[0].nClass == CRVC_IN)) {
|
||||
pCrvLink->AddCurve( Release( pBiArcLink)) ;
|
||||
}
|
||||
// altrimenti creo un percorso con biarchi e opportuni tratti della curva di contenimento
|
||||
else {
|
||||
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompo))
|
||||
return false ;
|
||||
|
||||
double dPar1, dPar2 ;
|
||||
Point3d ptMinDist1, ptMinDist2 ;
|
||||
Vector3d vtDir1, vtDir2 ;
|
||||
double dAng1, dAng2 ;
|
||||
int nFlag ;
|
||||
|
||||
DistPointCurve distPtSCrv( ptStart, *pCrvBound) ;
|
||||
distPtSCrv.GetParamAtMinDistPoint( 0, dPar1, nFlag) ;
|
||||
pCrvBound->GetPointTang( dPar1, ICurve::FROM_MINUS, ptMinDist1, vtDir1) ;
|
||||
vtDir1.GetAngleXY( X_AX, dAng1) ;
|
||||
|
||||
DistPointCurve distPtECrv( ptEnd, *pCrvBound) ;
|
||||
distPtECrv.GetParamAtMinDistPoint( 0, dPar2, nFlag) ;
|
||||
pCrvBound->GetPointTang( dPar2, ICurve::FROM_MINUS, ptMinDist2, vtDir2) ;
|
||||
vtDir2.GetAngleXY( X_AX, dAng2) ;
|
||||
|
||||
pCompo->AddCurve( GetBiArc( ptStart, -dAngStart, ptMinDist1, -dAng1, 0.5)) ; // primo biarco
|
||||
pCompo->AddCurve( pCrvBound->CopyParamRange( dPar1, dPar2)) ; // tratto di pCrvBound
|
||||
pCompo->AddCurve( GetBiArc( ptMinDist2, -dAng2, ptEnd, -dAngEnd, 0.5)) ; // secondo biarco
|
||||
|
||||
pCrvLink->AddCurve( Release( pCompo)) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Pocketing::CalcCircleSpiral( const Point3d& ptCen, const Vector3d& vtN, double dOutRad, double dIntRad,
|
||||
@@ -3696,6 +3754,11 @@ Pocketing::ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv,
|
||||
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
|
||||
PtrOwner<ICurveComposite> pCrvBound( CreateCurveComposite()) ; // curva bound da usare per CalcBoundedLink
|
||||
ICRVCOMPOPOVECTOR vpCrvsEp ;
|
||||
|
||||
Frame3d frLoc ;
|
||||
Vector3d vtExtr ; pMCrv->GetExtrusion( vtExtr) ;
|
||||
frLoc.Set( ORIG, vtExtr) ;
|
||||
pMCrv->ToLoc( frLoc) ;
|
||||
|
||||
for ( int i = 0 ; i < pMCrv->GetCurveCount() ; i ++) {
|
||||
int nProp = 0 ;
|
||||
@@ -3704,7 +3767,7 @@ Pocketing::ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv,
|
||||
|
||||
// se è un tratto di collegamento ho concluso percorso su cui aggiungere epicicli
|
||||
if ( nProp == LINK_CURVE_PROP) {
|
||||
if ( pCompo->IsValid()) {
|
||||
if ( pCompo->IsValid()) {
|
||||
PtrOwner<ICurveComposite> pCrvEp( CreateCurveComposite()) ;
|
||||
// la curva di bound è l'offset che calcolo in AddEpicycles per la prima curva compo trovata in pMCrv
|
||||
bool bAddEp = ( ! pCrvBound->IsValid()) ? AddEpicycles( pCompo, pCrvEp, pCrvBound) : AddEpicycles( pCompo, pCrvEp) ;
|
||||
@@ -3732,14 +3795,17 @@ Pocketing::ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv,
|
||||
// calcolo i collegamenti
|
||||
ICURVEPOVECTOR vLinks( vpCrvsEp.size()) ;
|
||||
for ( int i = 1 ; i < int( vpCrvsEp.size()) ; ++ i) {
|
||||
// punti di inizio e fine
|
||||
Point3d ptStart ;
|
||||
// punti e direzioni di inizio e fine
|
||||
Point3d ptStart ; Vector3d vtStart ;
|
||||
vpCrvsEp[i-1]->GetEndPoint( ptStart) ;
|
||||
Point3d ptEnd ;
|
||||
vpCrvsEp[i-1]->GetEndDir( vtStart) ;
|
||||
Point3d ptEnd ; Vector3d vtEnd ;
|
||||
vpCrvsEp[i]->GetStartPoint( ptEnd) ;
|
||||
// calcolo il collegamento (garantendo che non esca dalla svuotatura)
|
||||
vpCrvsEp[i]->GetStartDir( vtEnd) ;
|
||||
|
||||
// calcolo il collegamento con biarchi (garantendo che non esca dalla svuotatura)
|
||||
PtrOwner<ICurveComposite> pCrvLink( CreateCurveComposite()) ;
|
||||
if ( CalcBoundedLink( ptStart, ptEnd, pCrvBound, pCrvLink)) {
|
||||
if ( CalcBoundedLinkWithBiArcs( ptStart, vtStart, ptEnd, vtEnd, pCrvBound, pCrvLink)) {
|
||||
vLinks[i].Set( Release( pCrvLink)) ;
|
||||
}
|
||||
else {
|
||||
@@ -3752,13 +3818,16 @@ Pocketing::ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv,
|
||||
pRCrv->Clear() ;
|
||||
if ( vpCrvsEp.size() >= 2) {
|
||||
// punti di inizio e fine
|
||||
Point3d ptStart ;
|
||||
Point3d ptStart ; Vector3d vtStart ;
|
||||
vpCrvsEp.back()->GetEndPoint( ptStart) ;
|
||||
Point3d ptEnd ;
|
||||
vpCrvsEp.front()->GetStartPoint( ptEnd) ;
|
||||
// calcolo il ritorno (garantendo che non esca dalla svuotatura)
|
||||
vpCrvsEp.back()->GetEndDir( vtStart) ;
|
||||
Point3d ptEnd ; Vector3d vtEnd ;
|
||||
vpCrvsEp.front()->GetStartPoint( ptEnd) ;
|
||||
vpCrvsEp.front()->GetStartDir( vtEnd) ;
|
||||
|
||||
// calcolo il ritorno con biarchi (garantendo che non esca dalla svuotatura)
|
||||
PtrOwner<ICurveComposite> pCrvLink( CreateCurveComposite()) ;
|
||||
if ( CalcBoundedLink( ptStart, ptEnd, pCrvBound, pCrvLink)) {
|
||||
if ( CalcBoundedLinkWithBiArcs( ptStart, vtStart, ptEnd, vtEnd, pCrvBound, pCrvLink)) {
|
||||
pRCrv->AddCurve( Release( pCrvLink)) ;
|
||||
pRCrv->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL, false) ;
|
||||
// se necessario, approssimo archi con rette
|
||||
@@ -3772,13 +3841,13 @@ Pocketing::ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv,
|
||||
m_pMchMgr->SetLastError( 2413, "Error in Pocketing : Toolpath not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// creo il percorso di lavoro a partire dalla raccolta delle curve con epicicli e dei collegamenti
|
||||
pMCrv->Clear() ;
|
||||
for ( int i = 0 ; i < int( vpCrvsEp.size()) ; ++ i) {
|
||||
// se collegamento da aggiungere
|
||||
if ( ! IsNull( vLinks[i])) {
|
||||
if ( ! IsNull( vLinks[i])) {
|
||||
// accodo nel percorso di lavorazione
|
||||
pMCrv->AddCurve( Release( vLinks[i])) ;
|
||||
}
|
||||
@@ -3793,6 +3862,8 @@ Pocketing::ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv,
|
||||
}
|
||||
VerifyArcs( pMCrv) ;
|
||||
|
||||
pMCrv->ToGlob( frLoc) ;
|
||||
pRCrv->ToGlob( frLoc) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,8 @@ class Pocketing : public Machining
|
||||
ICurveComposite* pMCrv, ICurveComposite* pRCrv) ;
|
||||
bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, const ICurve* pCrvBound,
|
||||
ICurveComposite* pCrvLink) ;
|
||||
bool CalcBoundedLinkWithBiArcs( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd,
|
||||
const ICurve* pCrvBound, ICurveComposite* pCrvLink) ;
|
||||
bool CalcCircleSpiral( const Point3d& ptCen, const Vector3d& vtN, double dOutRad, double dIntRad,
|
||||
bool bSplitArcs, ICurveComposite* pMCrv, ICurveComposite* pRCrv) ;
|
||||
bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ;
|
||||
|
||||
Reference in New Issue
Block a user