EgtMachKernel :
- in Sgrossature aggiunti i controlli sulle Feed per gli ingressi.
This commit is contained in:
+90
-12
@@ -124,6 +124,7 @@ static string KEY_SUBSTEP = "SUBSTEP" ;
|
||||
#include "/EgtDev/Include/EgtPerfCounter.h"
|
||||
#include "/EgtDev/Include/EGkExtText.h"
|
||||
string sPathSrfBool = "C:\\Temp\\" ;
|
||||
int nGrpDebugFeed = GDB_ID_NULL, nLayDebugFeed = GDB_ID_NULL ;
|
||||
#endif
|
||||
|
||||
const double STEP_TOL = 10. * EPS_SMALL ;
|
||||
@@ -3137,13 +3138,13 @@ SurfRoughing::GetLinkFromPaths( STEPINFOSRVECTOR& vStepInfo, int i, int j, const
|
||||
// recupero anche il suo punto iniziale, ovvero il punto finale del Link
|
||||
int nLinkType = -1 ;
|
||||
Point3d ptEnd ;
|
||||
if ( j < int( vStepInfo[i].vPaths.size()) - 1) {
|
||||
if ( j < ssize( vStepInfo[i].vPaths) - 1) {
|
||||
nLinkType = PLANAR ;
|
||||
vStepInfo[i].vPaths[j+1].pCrvPath->GetStartPoint( ptEnd) ;
|
||||
}
|
||||
else {
|
||||
// --- se non esiste lo Step i+1 errore
|
||||
if ( i + 1 >= int( vStepInfo.size()))
|
||||
if ( i + 1 >= ssize( vStepInfo))
|
||||
return false ;
|
||||
vStepInfo[i+1].vPaths.front().pCrvPath->GetStartPoint( ptEnd) ;
|
||||
nLinkType = ( ( ptEnd - ptStart) * vtTool < - 50 * EPS_SMALL ? DOWN : ABOVE) ;
|
||||
@@ -3191,7 +3192,7 @@ SurfRoughing::GetLinkFromPaths( STEPINFOSRVECTOR& vStepInfo, int i, int j, const
|
||||
return false ;
|
||||
// nel caso stessi ordinando per ZChunk, devo controllare di essere fuori dalla limite
|
||||
// anche per lo Step i+1
|
||||
// NB. Nel caso stessi ordinando per piani, vuol dire che ho già svuotato tutti il piano i-esimo
|
||||
// NB. Nel caso stessi ordinando per piani, vuol dire che ho già svuotato tutto il piano i-esimo
|
||||
// Se Safe, allora definisco il collegamento
|
||||
if ( bSafe) {
|
||||
pCrvLink->AddPoint( ptStart) ;
|
||||
@@ -3778,6 +3779,11 @@ SurfRoughing::AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool,
|
||||
STEPINFOSRVECTOR vStepInfo ;
|
||||
if ( ! CalcPaths( vPocket, vStepInfo))
|
||||
return false ;
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
nGrpDebugFeed = m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, GLOB_FRM) ;
|
||||
nLayDebugFeed = m_pGeomDB->AddGroup( GDB_ID_NULL, nGrpDebugFeed, GLOB_FRM) ;
|
||||
m_pGeomDB->SetName( nGrpDebugFeed, "Feed") ;
|
||||
#endif
|
||||
|
||||
// recupero distanze di sicurezza
|
||||
double dSafeZ = GetSafeZ() ;
|
||||
@@ -3788,13 +3794,18 @@ SurfRoughing::AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool,
|
||||
// punto finale del percorso precedente al corrente
|
||||
Point3d ptEnd = P_INVALID ;
|
||||
|
||||
// recupero parametro di Feed minima
|
||||
double dMinFeed = GetFeed() / FEED_MAX_REDUCE ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MINFEED, dMinFeed))
|
||||
dMinFeed = Clamp( dMinFeed, GetFeed() / FEED_MAX_REDUCE, GetFeed()) ;
|
||||
|
||||
// scorro il vettore dei piani di pocketing
|
||||
for ( int i = 0 ; i < int( vStepInfo.size()) ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( vStepInfo) ; ++ i) {
|
||||
|
||||
// riferimento alle informazioni relative allo step i-esimo
|
||||
StepInfoSR& currStep = vStepInfo[i] ;
|
||||
// scorro i percorsi calcolati per il piano di pocketing i-esimo
|
||||
for ( int j = 0 ; j < int( currStep.vPaths.size()) ; ++ j) {
|
||||
for ( int j = 0 ; j < ssize( currStep.vPaths) ; ++ j) {
|
||||
|
||||
// riferimento alle informazioni relative al percorso j-esimo del piano di pocketing i-esimo
|
||||
PathInfoSR& currPath = currStep.vPaths[j] ;
|
||||
@@ -3871,17 +3882,18 @@ SurfRoughing::AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool,
|
||||
ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
Vector3d vtMove ; pLine->GetStartDir( vtMove) ;
|
||||
SetFeed( Clamp( dCoeffFeed * GetFeed(), dMinFeed, GetFeed())) ;
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
DrawFeed( pLine, dCoeffFeed * GetRightFeed( vtMove, vtTool)) ;
|
||||
DrawFeed( pCurve->Clone(), dCoeffFeed * GetFeed(), nLayDebugFeed) ;
|
||||
#endif
|
||||
SetFeed( dCoeffFeed * GetRightFeed( vtMove, vtTool)) ;
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
ICurveArc* pArc = GetCurveArc( pCurve) ;
|
||||
SetFeed( Clamp( dCoeffFeed * GetFeed(), dMinFeed, GetFeed())) ;
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
DrawFeed( pArc, dCoeffFeed * GetFeed()) ;
|
||||
DrawFeed( pCurve->Clone(), dCoeffFeed * GetFeed(), nLayDebugFeed) ;
|
||||
#endif
|
||||
SetFeed( dCoeffFeed * GetFeed()) ;
|
||||
if ( AddCurveMove( pArc, bSplitArcs) == GDB_ID_NULL)
|
||||
@@ -3894,7 +3906,7 @@ SurfRoughing::AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool,
|
||||
pCurve->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtEnd ; pCurve->GetEndDir( vtEnd) ;
|
||||
// se sono l'ultima entità globale del percorso
|
||||
if ( i == int( vStepInfo.size()) - 1 && j == int( currStep.vPaths.size()) - 1) {
|
||||
if ( i == ssize( vStepInfo) - 1 && j == ssize( currStep.vPaths) - 1) {
|
||||
// aggiungo LeadOut
|
||||
Point3d ptP1 ;
|
||||
SetFeed( GetEndFeed()) ;
|
||||
@@ -3921,6 +3933,9 @@ SurfRoughing::AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool,
|
||||
}
|
||||
// imposto EndFeed e aggiungo il Link
|
||||
SetFeed( GetEndFeed()) ;
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
DrawFeed( pCrvLink->Clone(), GetEndFeed(), nLayDebugFeed) ;
|
||||
#endif
|
||||
AddCurveMove( pCrvLink, bSplitArcs) ;
|
||||
}
|
||||
}
|
||||
@@ -4113,6 +4128,12 @@ SurfRoughing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect
|
||||
PtrOwner<ICurveArc> pArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pArc) || ! pArc->Set( ptCen, vtN, dRad, - vtCen, dAngCen, dDeltaN))
|
||||
return false ;
|
||||
// dovendo creare l'elica, sono nel materiale, quindi regolo la Feed
|
||||
Vector3d vtTanHelix ; pArc->GetStartDir( vtTanHelix) ;
|
||||
SetFeed( GetRightStartFeed( vtTanHelix, vtN)) ;
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
DrawFeed( pArc->Clone(), GetRightStartFeed( vtTanHelix, vtN), nLayDebugFeed) ;
|
||||
#endif
|
||||
// emetto l'elica (con eventuale spezzatura)
|
||||
return ( AddCurveMove( pArc, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
@@ -4128,14 +4149,30 @@ SurfRoughing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect
|
||||
double dStep = - dDeltaN / nStep ;
|
||||
Point3d ptPa = ptP1 + vtStart * 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
|
||||
Point3d ptPb = ptP1 - vtStart * 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
|
||||
Vector3d vtTanZigZag = ( ptPa - vtN * 0.25 * dStep) - ptP1 ;
|
||||
SetFeed( GetRightStartFeed( vtTanZigZag, vtN)) ;
|
||||
// verifico se fattibile
|
||||
if ( bSkipControl || VerifyLeadInZigZag( pSfr, ptStart, ptPa, ptPb)) {
|
||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||
Point3d ptCurr ; GetCurrPos( ptCurr) ; pLine->Set( ptCurr, ptPa - vtN * ( i - 0.75) * dStep) ;
|
||||
DrawFeed( pLine->Clone(), GetRightStartFeed( vtTanZigZag, vtN), nLayDebugFeed) ;
|
||||
#endif
|
||||
if ( AddLinearMove( ptPa - vtN * ( i - 0.75) * dStep, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
GetCurrPos( ptCurr) ; pLine->Set( ptCurr, ptPb - vtN * ( i - 0.25) * dStep) ;
|
||||
DrawFeed( pLine->Clone(), GetRightStartFeed( vtTanZigZag, vtN), nLayDebugFeed) ;
|
||||
#endif
|
||||
if ( AddLinearMove( ptPb - vtN * ( i - 0.25) * dStep, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||
Point3d ptCurr ; GetCurrPos( ptCurr) ; pLine->Set( ptCurr, ptStart) ;
|
||||
DrawFeed( pLine->Clone(), GetRightStartFeed( vtTanZigZag, vtN), nLayDebugFeed) ;
|
||||
#endif
|
||||
return ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
// altrimenti diretto
|
||||
@@ -4170,6 +4207,14 @@ SurfRoughing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect
|
||||
double dNini = ( ptP1 - ORIG) * vtN ;
|
||||
double dNfin = ( ptStart - ORIG) * vtN ;
|
||||
AdjustCurveSlope( pCrv, dNini, dNfin) ;
|
||||
// assegno le Feed
|
||||
Point3d ptS ; pCrv->GetStartPoint( ptS) ;
|
||||
Point3d ptE ; pCrv->GetEndPoint( ptE) ;
|
||||
Vector3d vtFeedMove = ptE - ptS ;
|
||||
SetFeed( GetRightStartFeed( vtFeedMove, vtN)) ;
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
DrawFeed( pCrv->Clone(), GetRightStartFeed( vtFeedMove, vtN), nLayDebugFeed) ;
|
||||
#endif
|
||||
// emetto (con eventuale spezzatura)
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
@@ -4182,6 +4227,17 @@ SurfRoughing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect
|
||||
Point3d ptCurr = ptP1 ;
|
||||
GetCurrPos( ptCurr) ;
|
||||
if ( ! AreSamePointApprox( ptCurr, ptStart)) {
|
||||
Vector3d vtMove = ptStart - ptCurr ; vtMove.Normalize() ;
|
||||
double dElev = 0. ;
|
||||
bool bInMaterial = true ;
|
||||
if ( GetElevation( m_nPhase, ptCurr, ptStart, vtN, GetRadiusForStartEndElevation(), m_TParams.m_dLen, vtN, dElev) && dElev < 10. * EPS_SMALL)
|
||||
bInMaterial = false ;
|
||||
// Feed di Testa
|
||||
SetFeed( bInMaterial ? GetTipFeed() : GetStartFeed()) ;
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ; pLine->Set( ptCurr, ptStart) ;
|
||||
DrawFeed( pLine->Clone(), bInMaterial ? GetTipFeed() : GetStartFeed(), nLayDebugFeed) ;
|
||||
#endif
|
||||
if ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
@@ -4260,6 +4316,24 @@ SurfRoughing::GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) cons
|
||||
return min( GetFeed(), GetTipFeed() / abs( dCosMove)) ;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
double
|
||||
SurfRoughing::GetRightStartFeed( const Vector3d& vtMove, const Vector3d& vtTool) const
|
||||
{
|
||||
// Determino i versori
|
||||
Vector3d vtM = vtMove ;
|
||||
vtM.Normalize() ;
|
||||
Vector3d vtT = vtTool ;
|
||||
vtT.Normalize() ;
|
||||
// Angolo tra movimento e versore utensile
|
||||
double dCosMove = vtM * vtT ;
|
||||
// Se l'utensile non ha movimento significativo di punta, si restituisce la feed standard
|
||||
if ( dCosMove > - COS_ORTO_ANG_SMALL)
|
||||
return GetStartFeed() ;
|
||||
// Altrimenti non si deve superare la massima velocità di punta prevista
|
||||
return min( GetStartFeed(), GetTipFeed() / abs( dCosMove)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfRoughing::ResetCurveAllTempProp( ICurve* pCurve) const
|
||||
@@ -4899,15 +4973,19 @@ SurfRoughing::DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bUniform, Color C
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
SurfRoughing::DrawFeed( const ICurve* pCrv, double dFeed) const
|
||||
SurfRoughing::DrawFeed( const ICurve* pCrv, double dFeed, int nLay) const
|
||||
{
|
||||
if ( pCrv == nullptr)
|
||||
return ;
|
||||
|
||||
double dMinFeed = GetFeed() * GetSideStep() / m_TParams.m_dDiam ;
|
||||
// recupero parametro di Feed minima
|
||||
double dMinFeed = GetFeed() / FEED_MAX_REDUCE ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MINFEED, dMinFeed))
|
||||
dMinFeed = Clamp( dMinFeed, GetFeed() / FEED_MAX_REDUCE, GetFeed()) ;
|
||||
double myAngle = 120 * ( ( ( dFeed - dMinFeed) / ( GetFeed() - dMinFeed))) ;
|
||||
int nInd = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pCrv->Clone()) ;
|
||||
int nInd = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nLay, pCrv->Clone()) ;
|
||||
m_pGeomDB->SetMaterial( nInd, GetColorFromHSV( HSV( myAngle, 1., 1.))) ;
|
||||
return ;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
+2
-1
@@ -215,6 +215,7 @@ class SurfRoughing : public Machining
|
||||
ISurfFlatRegion* pSfrSearchCorners) const ;
|
||||
bool GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) const ;
|
||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||
double GetRightStartFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
bool ResetCurveAllTempProp( ICurve* pCurve) const ;
|
||||
bool RemoveChunksUnderTolerance( ISurfFlatRegion* pSfr, double dTol, ISurfFlatRegion* pSfrLimit,
|
||||
@@ -270,7 +271,7 @@ class SurfRoughing : public Machining
|
||||
|
||||
/* debug functions */
|
||||
void DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf, Color Col, bool bAlphaCoverage, std::string sName) const ;
|
||||
void DrawFeed( const ICurve* pCrv, double dFeed) const ;
|
||||
void DrawFeed( const ICurve* pCrv, double dFeed, int nLay) const ;
|
||||
void DrawNormalShaderSurfTm( const ISurfTriMesh* pStm, std::string sName) const ;
|
||||
/* end debug functions */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user