EgtMachKernel :
- in finitura superfici corretto calcolo esterno di inizio e fine per movimento ortogonale di attacco e uscita.
This commit is contained in:
+81
-9
@@ -1479,9 +1479,17 @@ SurfFinishing::AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
vtStart -= dStartOnExtr * vtExtr ;
|
||||
vtStart.Normalize() ;
|
||||
}
|
||||
// determino normale della superficie sul punto iniziale
|
||||
Vector3d vtNorm ;
|
||||
if ( ! GetSurfaceNormalAtPoint( pCAvTlStm, frSurf, ptStart, vtExtr, vtNorm)) {
|
||||
Point3d ptEnd ;
|
||||
pCurve->GetEndPoint( ptEnd) ;
|
||||
if ( ! GetSurfaceNormalAtPoint( pCAvTlStm, frSurf, ptEnd, vtExtr, vtNorm))
|
||||
vtNorm = V_NULL ;
|
||||
}
|
||||
// determino inizio attacco
|
||||
Point3d ptP1 ;
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, ptP1))
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, vtNorm, ptP1))
|
||||
return false ;
|
||||
// eventuale correzione inizio attacco per evitare interferenze
|
||||
if ( ! GetLastGoodPoint( pCAvTlStm, frSurf, ptStart, ptP1, vtTool, ptP1))
|
||||
@@ -1535,9 +1543,17 @@ SurfFinishing::AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
vtEnd -= dEndOnExtr * vtExtr ;
|
||||
vtEnd.Normalize() ;
|
||||
}
|
||||
// determino normale della superficie sul punto finale
|
||||
Vector3d vtNorm ;
|
||||
if ( ! GetSurfaceNormalAtPoint( pCAvTlStm, frSurf, ptEnd, vtExtr, vtNorm)) {
|
||||
Point3d ptStart ;
|
||||
pCurve->GetStartPoint( ptStart) ;
|
||||
if ( ! GetSurfaceNormalAtPoint( pCAvTlStm, frSurf, ptStart, vtExtr, vtNorm))
|
||||
vtNorm = V_NULL ;
|
||||
}
|
||||
// determino fine uscita
|
||||
Point3d ptP1 ;
|
||||
if ( ! CalcLeadOutEnd( ptEnd, vtEnd, vtExtr, ptP1))
|
||||
if ( ! CalcLeadOutEnd( ptEnd, vtEnd, vtExtr, vtNorm, ptP1))
|
||||
return false ;
|
||||
// eventuale correzione fine uscita per evitare interferenze
|
||||
if ( ! GetLastGoodPoint( pCAvTlStm, frSurf, ptEnd, ptP1, vtTool, ptP1))
|
||||
@@ -1949,9 +1965,17 @@ SurfFinishing::AddOneWay( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
vtStart -= dStartOnExtr * vtExtr ;
|
||||
vtStart.Normalize() ;
|
||||
}
|
||||
// determino normale della superficie sul punto iniziale
|
||||
Vector3d vtNorm ;
|
||||
if ( ! GetSurfaceNormalAtPoint( pCAvTlStm, frSurf, ptStart, vtExtr, vtNorm)) {
|
||||
Point3d ptEnd ;
|
||||
pCurve->GetEndPoint( ptEnd) ;
|
||||
if ( ! GetSurfaceNormalAtPoint( pCAvTlStm, frSurf, ptEnd, vtExtr, vtNorm))
|
||||
vtNorm = V_NULL ;
|
||||
}
|
||||
// determino inizio attacco
|
||||
Point3d ptP1 ;
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, ptP1))
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, vtNorm, ptP1))
|
||||
return false ;
|
||||
// eventuale correzione inizio attacco per evitare interferenze
|
||||
if ( ! GetLastGoodPoint( pCAvTlStm, frSurf, ptStart, ptP1, vtTool, ptP1))
|
||||
@@ -2005,9 +2029,17 @@ SurfFinishing::AddOneWay( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
vtEnd -= dEndOnExtr * vtExtr ;
|
||||
vtEnd.Normalize() ;
|
||||
}
|
||||
// determino normale della superficie sul punto finale
|
||||
Vector3d vtNorm ;
|
||||
if ( ! GetSurfaceNormalAtPoint( pCAvTlStm, frSurf, ptEnd, vtExtr, vtNorm)) {
|
||||
Point3d ptStart ;
|
||||
pCurve->GetStartPoint( ptStart) ;
|
||||
if ( ! GetSurfaceNormalAtPoint( pCAvTlStm, frSurf, ptStart, vtExtr, vtNorm))
|
||||
vtNorm = V_NULL ;
|
||||
}
|
||||
// determino fine uscita
|
||||
Point3d ptP1 ;
|
||||
if ( ! CalcLeadOutEnd( ptEnd, vtEnd, vtExtr, ptP1))
|
||||
if ( ! CalcLeadOutEnd( ptEnd, vtEnd, vtExtr, vtNorm, ptP1))
|
||||
return false ;
|
||||
// eventuale correzione fine uscita per evitare interferenze
|
||||
if ( ! GetLastGoodPoint( pCAvTlStm, frSurf, ptEnd, ptP1, vtTool, ptP1))
|
||||
@@ -2255,9 +2287,17 @@ SurfFinishing::AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
vtStart -= dStartOnExtr * vtExtr ;
|
||||
vtStart.Normalize() ;
|
||||
}
|
||||
// determino normale della superficie sul punto iniziale
|
||||
Vector3d vtNorm ;
|
||||
if ( ! GetSurfaceNormalAtPoint( pCAvTlStm, frSurf, ptStart, vtExtr, vtNorm)) {
|
||||
Point3d ptEnd ;
|
||||
pCurve->GetEndPoint( ptEnd) ;
|
||||
if ( ! GetSurfaceNormalAtPoint( pCAvTlStm, frSurf, ptEnd, vtExtr, vtNorm))
|
||||
vtNorm = V_NULL ;
|
||||
}
|
||||
// determino inizio attacco
|
||||
Point3d ptP1 ;
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, ptP1))
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, vtNorm, ptP1))
|
||||
return false ;
|
||||
// eventuale correzione inizio attacco per evitare interferenze
|
||||
if ( ! GetLastGoodPoint( pCAvTlStm, frSurf, ptStart, ptP1, vtTool, ptP1))
|
||||
@@ -2311,9 +2351,17 @@ SurfFinishing::AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
vtEnd -= dEndOnExtr * vtExtr ;
|
||||
vtEnd.Normalize() ;
|
||||
}
|
||||
// determino normale della superficie sul punto finale
|
||||
Vector3d vtNorm ;
|
||||
if ( ! GetSurfaceNormalAtPoint( pCAvTlStm, frSurf, ptEnd, vtExtr, vtNorm)) {
|
||||
Point3d ptStart ;
|
||||
pCurve->GetStartPoint( ptStart) ;
|
||||
if ( ! GetSurfaceNormalAtPoint( pCAvTlStm, frSurf, ptStart, vtExtr, vtNorm))
|
||||
vtNorm = V_NULL ;
|
||||
}
|
||||
// determino fine uscita
|
||||
Point3d ptP1 ;
|
||||
if ( ! CalcLeadOutEnd( ptEnd, vtEnd, vtExtr, ptP1))
|
||||
if ( ! CalcLeadOutEnd( ptEnd, vtEnd, vtExtr, vtNorm, ptP1))
|
||||
return false ;
|
||||
// eventuale correzione fine uscita per evitare interferenze
|
||||
if ( ! GetLastGoodPoint( pCAvTlStm, frSurf, ptEnd, ptP1, vtTool, ptP1))
|
||||
@@ -2582,7 +2630,7 @@ SurfFinishing::GetLeadInType( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfFinishing::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool, Point3d& ptP1) const
|
||||
SurfFinishing::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool, const Vector3d& vtNorm, Point3d& ptP1) const
|
||||
{
|
||||
// Assegno tipo e parametri
|
||||
int nType = GetLeadInType() ;
|
||||
@@ -2599,6 +2647,8 @@ SurfFinishing::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart,
|
||||
Vector3d vtPerp = vtStart ;
|
||||
Vector3d vtRot = OrthoCompo( vtTool, vtStart) ;
|
||||
vtPerp.Rotate( vtRot, 0, -1) ;
|
||||
if ( vtPerp * vtNorm < -EPS_ZERO)
|
||||
vtPerp.Invert() ;
|
||||
ptP1 = ptStart - vtStart * dTang + vtPerp * dPerp ;
|
||||
}
|
||||
return true ;
|
||||
@@ -2646,7 +2696,7 @@ SurfFinishing::GetLeadOutType( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfFinishing::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, Point3d& ptP1) const
|
||||
SurfFinishing::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, const Vector3d& vtNorm, Point3d& ptP1) const
|
||||
{
|
||||
// Assegno tipo e parametri
|
||||
int nType = GetLeadOutType() ;
|
||||
@@ -2675,6 +2725,8 @@ SurfFinishing::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, cons
|
||||
Vector3d vtPerp = vtEnd ;
|
||||
Vector3d vtRot = OrthoCompo( vtTool, vtEnd) ;
|
||||
vtPerp.Rotate( vtRot, 0, -1) ;
|
||||
if ( vtPerp * vtNorm < -EPS_ZERO)
|
||||
vtPerp.Invert() ;
|
||||
ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp ;
|
||||
}
|
||||
return true ;
|
||||
@@ -2726,7 +2778,7 @@ SurfFinishing::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Po
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfFinishing::GetLastGoodPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, Point3d& ptP1)
|
||||
const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, Point3d& ptP1) const
|
||||
{
|
||||
// porto i punti e il versore nel riferimento superficie
|
||||
Point3d ptStartL = GetToLoc( ptStart, frSurf) ;
|
||||
@@ -2753,6 +2805,26 @@ SurfFinishing::GetLastGoodPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSur
|
||||
return bFound ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfFinishing::GetSurfaceNormalAtPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
const Point3d& ptTool, const Vector3d& vtTool, Vector3d& vtNorm) const
|
||||
{
|
||||
// porto il punto e il versore nel riferimento superficie
|
||||
Point3d ptToolL = GetToLoc( ptTool, frSurf) ;
|
||||
Vector3d vtToolL = GetToLoc( vtTool, frSurf) ;
|
||||
// porto i punti dal tip al naso mandrino
|
||||
ptToolL += vtToolL * m_TParams.m_dLen ;
|
||||
// affondo di poco il punto per ricavare ultima superficie di contatto e sua normale
|
||||
double dMove ;
|
||||
Vector3d vtNormL ;
|
||||
if ( ! pCAvTlStm->TestPosition( ptToolL - vtToolL, vtToolL, vtToolL, dMove, &vtNormL) || dMove < EPS_SMALL)
|
||||
return false ;
|
||||
// porto la normale in globale
|
||||
vtNorm = GetToGlob( vtNormL, frSurf) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
double
|
||||
SurfFinishing::GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const
|
||||
|
||||
+5
-3
@@ -90,12 +90,14 @@ class SurfFinishing : public Machining
|
||||
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
|
||||
bool AddLinkRetract( 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& vtTool, Point3d& ptP1) const ;
|
||||
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool, const Vector3d& vtNorm, Point3d& ptP1) const ;
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool, bool bSplitArcs) ;
|
||||
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, Point3d& ptP1) const ;
|
||||
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, const Vector3d& vtNorm, Point3d& ptP1) const ;
|
||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Point3d& ptP1, const Vector3d& vtTool, bool bSplitArcs) ;
|
||||
bool GetLastGoodPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, Point3d& ptP1) ;
|
||||
const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, Point3d& ptP1) const ;
|
||||
bool GetSurfaceNormalAtPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
const Point3d& ptTool, const Vector3d& vtTool, Vector3d& vtNorm) const ;
|
||||
bool GetActiveSurfaces( INTVECTOR& vSurfId) const ;
|
||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
|
||||
Reference in New Issue
Block a user