EgtMachKernel (MillingToolComp) :
- aggiunta gestione per Milling ZigZag a singolo step e multi step.
This commit is contained in:
+97
-10
@@ -2977,8 +2977,10 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
}
|
||||
// se attacco a zigzag o a spirale o a guida, non affondo
|
||||
else if ( IsLeadInHelixOrZigzagOrGlide()) {
|
||||
ptP1 += vtTool * ( dStElev + GetLeadInOutToler()) ;
|
||||
dStElev = - GetLeadInOutToler() ;
|
||||
if ( ! m_bToolComp || ( m_bToolComp && ! ( GetLeadInType() == MILL_LI_GLIDE && ! pCompo->IsClosed()))) {
|
||||
ptP1 += vtTool * ( dStElev + GetLeadInOutToler()) ;
|
||||
dStElev = - GetLeadInOutToler() ;
|
||||
}
|
||||
if ( m_bToolComp) {
|
||||
Point3d ptCurr ; GetCurrPos( ptCurr) ;
|
||||
if ( ! AreSamePointApprox( ptCurr, ptP1))
|
||||
@@ -4872,7 +4874,7 @@ Milling::GetLeadInType( void) const
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool,
|
||||
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1) const
|
||||
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1)
|
||||
{
|
||||
// Assegno tipo e parametri
|
||||
int nType = GetLeadInType() ;
|
||||
@@ -4908,8 +4910,18 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
|
||||
bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) ||
|
||||
( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ;
|
||||
// verifico di poter fare l'ingresso a inseguimento
|
||||
if ( nType == MILL_LI_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL)
|
||||
nType = MILL_LI_NONE ;
|
||||
if ( nType == MILL_LI_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL) {
|
||||
if ( ! m_bToolComp)
|
||||
nType = MILL_LI_NONE ;
|
||||
else {
|
||||
Vector3d vtPerp = vtStart ;
|
||||
Vector3d vtRot = OrthoCompo( vtTool, vtStart) ;
|
||||
vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 = ptStart + vtPerp * GetToolCompPerpLen() ;
|
||||
vtDir1 = ptP1 - ptStart ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Calcolo punto iniziale
|
||||
switch ( nType) {
|
||||
case MILL_LI_NONE :
|
||||
@@ -5058,8 +5070,22 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) ||
|
||||
( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ;
|
||||
// verifico di poter fare l'ingresso a inseguimento
|
||||
if ( nType == MILL_LI_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL)
|
||||
nType = MILL_LI_NONE ;
|
||||
if ( nType == MILL_LI_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL) {
|
||||
if ( ! m_bToolComp)
|
||||
nType = MILL_LI_NONE ;
|
||||
else {
|
||||
// aggiungo movimento per l'inizio del percorso
|
||||
int nIdTC = AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) ;
|
||||
if ( nIdTC == GDB_ID_NULL)
|
||||
return false ;
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nIdTC)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
pCamData->SetCorrType( GetCorrType( TOOL_CORR_IN, bInvert)) ;
|
||||
m_pGeomDB->SetMaterial( nIdTC, AQUA) ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Eseguo a seconda del tipo
|
||||
switch ( nType) {
|
||||
case MILL_LI_NONE :
|
||||
@@ -5547,7 +5573,7 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
|
||||
case MILL_LI_TANGENT : nType = MILL_LO_TANGENT ; break ;
|
||||
case MILL_LI_GLIDE : nType = MILL_LO_GLIDE ; break ;
|
||||
case MILL_LI_ZIGZAG : nType = MILL_LO_NONE ; break ;
|
||||
case MILL_LI_HELIX : nType = ( ! m_bToolComp ? MILL_LO_NONE : MILL_LO_LINEAR) ; break ;
|
||||
case MILL_LI_HELIX : nType = MILL_LO_NONE ; break ;
|
||||
default : nType = MILL_LO_NONE ; break ;
|
||||
}
|
||||
dTang = m_Params.m_dLiTang ;
|
||||
@@ -5561,12 +5587,73 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
|
||||
dElev = min( m_Params.m_dLiElev, dEndElev + GetLeadInOutToler()) ;
|
||||
dCompLen = m_Params.m_dLiCompLen ;
|
||||
}
|
||||
// verifico in caso di tool compensation se richiesta uscita con 1/4 di elica
|
||||
if ( m_bToolComp && GetLeadInType() == MILL_LI_HELIX && GetLeadOutType() == MILL_LO_AS_LI) {
|
||||
bool bAtLeft = ( bInvert != ( m_Params.m_nWorkSide != MILL_WS_RIGHT)) ;
|
||||
// vettore dal punto al centro dell'elica
|
||||
Vector3d vtCen = vtEnd ;
|
||||
vtCen.Rotate( vtTool, 0, ( bAtLeft ? 1 : -1)) ;
|
||||
// dati dell'elica
|
||||
double dRad = 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
|
||||
Point3d ptCen = ptEnd + vtCen * dRad ;
|
||||
double dDeltaN = ( ptEnd - ptP1) * vtTool ;
|
||||
double dAngCen = ( bAtLeft ? ANG_RIGHT : - ANG_RIGHT) ;
|
||||
// creo l'elica
|
||||
PtrOwner<ICurveArc> pArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pArc) || ! pArc->Set( ptCen, vtTool, dRad, - vtCen, dAngCen, 0.))
|
||||
return false ;
|
||||
// emetto l'elica (con eventuale spezzatura)
|
||||
int nIdS = m_pGeomDB->GetLastInGroup( m_nPathId) ;
|
||||
if ( AddCurveMove( pArc, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
int nIdE = m_pGeomDB->GetLastInGroup( m_nPathId) ;
|
||||
for ( int nId = nIdS + 1 ; nId <= nIdE ; ++ nId) {
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
|
||||
if ( pCamData != nullptr) {
|
||||
pCamData->SetCorrType( GetCorrType( TOOL_CORR_PATH, bInvert)) ;
|
||||
m_pGeomDB->SetMaterial( nId, AQUA) ;
|
||||
}
|
||||
}
|
||||
// emetto il tratto perpendicolare
|
||||
Point3d ptCorrS ; pArc->GetEndPoint( ptCorrS) ;
|
||||
Vector3d vtCorrDir = ptCen - ptCorrS ; vtCorrDir.Normalize() ;
|
||||
Point3d ptCorrE = ptCorrS + m_Params.m_dLiCompLen * vtCorrDir ;
|
||||
int nIdTC = AddLinearMove( ptCorrE, bSplitArcs, MCH_CL_LEADIN) ;
|
||||
if ( nIdTC == GDB_ID_NULL)
|
||||
return false ;
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nIdTC)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
pCamData->SetCorrType( GetCorrType( TOOL_CORR_OUT, bInvert)) ;
|
||||
m_pGeomDB->SetMaterial( nIdTC, AQUA) ;
|
||||
ptP1 = ptCorrE ;
|
||||
vtDir1 = vtCorrDir ;
|
||||
return true ;
|
||||
}
|
||||
// senso di rotazione da dir tg a dir esterna
|
||||
bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) ||
|
||||
( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ;
|
||||
// verifico di poter fare l'uscita a inseguimento
|
||||
if ( nType == MILL_LO_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL)
|
||||
nType = MILL_LO_NONE ;
|
||||
if ( nType == MILL_LO_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL) {
|
||||
if ( ! m_bToolComp)
|
||||
nType = MILL_LO_NONE ;
|
||||
else {
|
||||
Vector3d vtPerp = vtEnd ;
|
||||
Vector3d vtRot = OrthoCompo( vtTool, vtEnd) ;
|
||||
vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 = ptEnd + vtPerp * GetToolCompPerpLen() ;
|
||||
vtDir1 = ptP1 - ptEnd ;
|
||||
int nIdTC = AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADIN) ;
|
||||
if ( nIdTC == GDB_ID_NULL)
|
||||
return false ;
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nIdTC)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
pCamData->SetCorrType( GetCorrType( TOOL_CORR_IN, bInvert)) ;
|
||||
m_pGeomDB->SetMaterial( nIdTC, AQUA) ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// eseguo a seconda del tipo
|
||||
switch ( nType) {
|
||||
case MILL_LO_NONE :
|
||||
|
||||
@@ -116,7 +116,7 @@ class Milling : public Machining
|
||||
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, const Vector3d& vtTool,
|
||||
double dSafeZ, double dSawEndElev, double dEndElev, double dAppr, bool bAddExtract = false) ;
|
||||
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool,
|
||||
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1) const ;
|
||||
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1) ;
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
|
||||
const Vector3d& vtTool, double dStElev, bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs) ;
|
||||
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool,
|
||||
|
||||
Reference in New Issue
Block a user