EgtMachKernel :

- correzione calcolo elevazione fresature.
This commit is contained in:
Dario Sassi
2016-09-26 13:51:30 +00:00
parent d01434d783
commit fde68bd68f
2 changed files with 42 additions and 5 deletions
+41 -4
View File
@@ -1041,7 +1041,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
// calcolo l'elevazione massima
double dElev ;
if ( CalcPathElevation( pCompo, vtTool, dDepth, dElev)) {
if ( CalcPathElevation( pCompo, vtTool, dDepth, 0.5 * m_TParams.m_dDiam, dElev)) {
if ( dElev < EPS_SMALL && AreSameVectorApprox( vtExtr, Z_AX)) {
BBox3d b3Crv ;
pCompo->GetLocalBBox( b3Crv) ;
@@ -1052,9 +1052,12 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
return false ;
// verifico di non superare il massimo materiale
if ( ( m_Params.m_dStep < EPS_SMALL && dElev > m_TParams.m_dMaxMat + EPS_SMALL) ||
const double MAXMAT_TOL = EPS_SMALL ;
if ( ( m_Params.m_dStep < EPS_SMALL && dElev > m_TParams.m_dMaxMat + MAXMAT_TOL) ||
( m_Params.m_dStep > EPS_SMALL && m_Params.m_dStep > m_TParams.m_dMaxMat + EPS_SMALL)) {
LOG_INFO( GetEMkLogger(), "Error in Milling : machining depth bigger than MaxMaterial") ;
string sInfo = "Error in Milling : machining depth (" + ToString( dElev, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
LOG_INFO( GetEMkLogger(), sInfo.c_str()) ;
return false ;
}
@@ -1119,7 +1122,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
//----------------------------------------------------------------------------
bool
Milling::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth,
Milling::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad,
double& dElev)
{
dElev = 0 ;
@@ -1133,7 +1136,21 @@ Milling::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtToo
pCrvC->GetStartPoint( ptStart) ;
pCrvC->GetMidPoint( ptMid) ;
pCrvC->GetEndPoint( ptEnd) ;
Vector3d vtStartPerp, vtMidPerp, vtEndPerp, vtTg ;
pCrvC->GetStartDir( vtTg) ;
vtStartPerp = vtTg ^ vtTool ;
vtStartPerp.Normalize() ;
vtStartPerp *= dRad ;
pCrvC->GetMidDir( vtTg) ;
vtMidPerp = vtTg ^ vtTool ;
vtMidPerp.Normalize() ;
vtMidPerp *= dRad ;
pCrvC->GetEndDir( vtTg) ;
vtEndPerp = vtTg ^ vtTool ;
vtEndPerp.Normalize() ;
vtEndPerp *= dRad ;
Vector3d vtDepth = vtTool * dDepth ;
// linea centro utensile
if ( GetElevation( m_nPhase, ptStart - vtDepth, ptMid - vtDepth, ptEnd - vtDepth, vtTool, dCurrElev)) {
if ( dCurrElev > dElev)
dElev = dCurrElev ;
@@ -1142,6 +1159,26 @@ Milling::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtToo
LOG_INFO( GetEMkLogger(), "Error in Milling : Entity GetElevation") ;
return false ;
}
// da una parte
if ( GetElevation( m_nPhase, ptStart + vtStartPerp - vtDepth, ptMid + vtMidPerp - vtDepth,
ptEnd + vtEndPerp - vtDepth, vtTool, dCurrElev)) {
if ( dCurrElev > dElev)
dElev = dCurrElev ;
}
else {
LOG_INFO( GetEMkLogger(), "Error in Milling : Entity GetElevation") ;
return false ;
}
// dall'altra parte
if ( GetElevation( m_nPhase, ptStart - vtStartPerp - vtDepth, ptMid - vtMidPerp - vtDepth,
ptEnd - vtEndPerp - vtDepth, vtTool, dCurrElev)) {
if ( dCurrElev > dElev)
dElev = dCurrElev ;
}
else {
LOG_INFO( GetEMkLogger(), "Error in Milling : Entity GetElevation") ;
return false ;
}
}
return true ;
}
+1 -1
View File
@@ -66,7 +66,7 @@ class Milling : public Machining
ICurve* GetCurve( SelData Id) ;
bool Chain( int nGrpDestId) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double& dElev) ;
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double& dElev) ;
bool GenerateMillingPv( int nPathId, const ICurveComposite* pCompo) ;
bool AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, bool bSplitArcs) ;