EgtMachKernel (MillingToolComp) :
- prima versione di prova per Tool Compensation per Milling.
This commit is contained in:
+343
-33
@@ -839,9 +839,26 @@ Milling::Apply( bool bRecalc, bool bPostApply)
|
||||
|
||||
// recupero flag correzione raggio fresa
|
||||
int nToolComp = TOOL_COMP_PROGRAM ;
|
||||
bool m_bToolComp = ( GetValInNotes( m_Params.m_sUserNotes, UN_TOOL_COMPENSATION, nToolComp) &&
|
||||
( nToolComp == TOOL_COMP_RADIUS || nToolComp == TOOL_COMP_LEN_AND_RAD) &&
|
||||
m_Params.m_nWorkSide != MILL_WS_CENTER) ;
|
||||
m_bToolComp = ( GetValInNotes( m_Params.m_sUserNotes, UN_TOOL_COMPENSATION, nToolComp) &&
|
||||
( nToolComp == TOOL_COMP_RADIUS || nToolComp == TOOL_COMP_LEN_AND_RAD) &&
|
||||
m_Params.m_nWorkSide != MILL_WS_CENTER) ;
|
||||
// compensazione utensile non applicata nel caso di famiglie di lame
|
||||
if ( m_bToolComp && ( m_TParams.m_nType & TF_SAWBLADE) != 0)
|
||||
m_bToolComp = false ;
|
||||
// compensazione utensile non applicata nel caso di attacco a None, ZigZag e Tang+Perp
|
||||
if ( m_bToolComp) {
|
||||
int nLeadInType = GetLeadInType() ;
|
||||
if ( nLeadInType == MILL_LI_NONE || nLeadInType == MILL_LI_ZIGZAG || nLeadInType == MILL_LI_TG_PERP)
|
||||
m_bToolComp = false ;
|
||||
}
|
||||
// compensazione utensile non applicata nel caso di Step Type Spiral
|
||||
if ( m_bToolComp && m_Params.m_nStepType == MILL_ST_SPIRAL)
|
||||
m_bToolComp = false ;
|
||||
// se compensazione utensile, forzo la componente perpendicolare di LeadIn e LeadOut
|
||||
if ( m_bToolComp) {
|
||||
m_Params.m_dLiCompLen = GetToolCompPerpLen() ;
|
||||
m_Params.m_dLoCompLen = GetToolCompPerpLen() ;
|
||||
}
|
||||
if ( m_bToolComp && m_TParams.m_nCorr == 0) {
|
||||
m_bToolComp = false ;
|
||||
m_pMchMgr->SetWarning( 2365, "Warning in Milling : No compensation in tool, so no compensation in machine") ;
|
||||
@@ -2570,8 +2587,20 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
}
|
||||
else {
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ! m_bToolComp) {
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
int nId = AddLinearMove( ptP3, bSplitArcs) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
pCamData->SetCorrType( GetCorrType( TOOL_CORR_PATH, false)) ;
|
||||
m_pGeomDB->SetMaterial( nId, AQUA) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
@@ -2590,8 +2619,20 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
double dAngCen = pArc->GetAngCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
Point3d ptP3 ; pArc->GetEndPoint( ptP3) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ! m_bToolComp) {
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
int nId = AddArcMove( ptP3, ptCen, dAngCen, vtN) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
pCamData->SetCorrType( GetCorrType( TOOL_CORR_PATH, false)) ;
|
||||
m_pGeomDB->SetMaterial( nId, AQUA) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// se ultima entità, uscita e retrazione
|
||||
@@ -2934,10 +2975,15 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
if ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se attacco a zigzag o a spirale, non affondo
|
||||
// se attacco a zigzag o a spirale o a guida, non affondo
|
||||
else if ( IsLeadInHelixOrZigzagOrGlide()) {
|
||||
ptP1 += vtTool * ( dStElev + GetLeadInOutToler()) ;
|
||||
dStElev = - GetLeadInOutToler() ;
|
||||
if ( m_bToolComp) {
|
||||
Point3d ptCurr ; GetCurrPos( ptCurr) ;
|
||||
if ( ! AreSamePointApprox( ptCurr, ptP1))
|
||||
AddLinearMove( ptP1, bSplitArcs, MCH_CL_SAFEIN) ;
|
||||
}
|
||||
}
|
||||
// altrimenti, affondo in feed opportuna
|
||||
else {
|
||||
@@ -2970,8 +3016,20 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
}
|
||||
else {
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ! m_bToolComp) {
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
int nId = AddLinearMove( ptP3, bSplitArcs) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
pCamData->SetCorrType( GetCorrType( TOOL_CORR_PATH, bInvert)) ;
|
||||
m_pGeomDB->SetMaterial( nId, AQUA) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
@@ -2990,8 +3048,20 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
double dAngCen = pArc->GetAngCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
Point3d ptP3 ; pArc->GetEndPoint( ptP3) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ! m_bToolComp) {
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
int nId = AddArcMove( ptP3, ptCen, dAngCen, vtN) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
pCamData->SetCorrType( GetCorrType( TOOL_CORR_PATH, bInvert)) ;
|
||||
m_pGeomDB->SetMaterial( nId, AQUA) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// se ultima entità, uscita e se ultimo step retrazione
|
||||
@@ -3007,9 +3077,11 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
// se non c'è attacco a zigzag o a spirale oppure ultimo step, aggiungo uscita
|
||||
Point3d ptP1 = ptEnd ;
|
||||
Vector3d vtDir1 ;
|
||||
if ( ! IsLeadInHelixOrZigzag() || k == nStep) {
|
||||
if ( ! IsLeadInHelixOrZigzag() || k == nStep || m_bToolComp) {
|
||||
if ( k != nStep && GetLeadInType() == MILL_LI_GLIDE)
|
||||
dEndElev = - GetLeadInOutToler() ;
|
||||
if ( k != nStep)
|
||||
dEndElev = 0. ;
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtTool, dEndElev, bInvert, pCompo, bSplitArcs, ptP1, vtDir1)) {
|
||||
m_pMchMgr->SetLastError( 2311, "Error in Milling : LeadOut not computable") ;
|
||||
@@ -4928,8 +5000,19 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
|
||||
vtDir1 = -vtStart ;
|
||||
return true ;
|
||||
case MILL_LI_HELIX :
|
||||
ptP1 = ptStart ;
|
||||
vtDir1 = -vtStart ;
|
||||
if ( ! m_bToolComp) {
|
||||
ptP1 = ptStart ;
|
||||
vtDir1 = -vtStart ;
|
||||
}
|
||||
else {
|
||||
bool bAtLeft = ( bInvert != ( m_Params.m_nWorkSide != MILL_WS_RIGHT)) ;
|
||||
// vettore dal punto al centro elica
|
||||
Vector3d vtCen = vtStart ;
|
||||
vtCen.Rotate( vtTool, 0, ( bAtLeft ? 1 : - 1)) ;
|
||||
// estensione per componente perpendicolare
|
||||
ptP1 = ptStart + vtCen * m_Params.m_dLiCompLen ;
|
||||
vtDir1 = -vtStart ;
|
||||
}
|
||||
return true ;
|
||||
default :
|
||||
return false ;
|
||||
@@ -4995,10 +5078,37 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
Vector3d vtRot = OrthoCompo( vtTool, vtStart) ;
|
||||
vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
Point3d ptMid = ptStart - vtStart * dTang + vtPerp * dPerp + vtTool * dElev ;
|
||||
if ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ! m_bToolComp) {
|
||||
if ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
int nIdTC = AddLinearMove( ptMid, 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) ;
|
||||
}
|
||||
}
|
||||
if ( ! m_bToolComp)
|
||||
return ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
else {
|
||||
int nIdS = m_pGeomDB->GetLastInGroup( m_nPathId) ;
|
||||
if ( AddLinearMove( ptStart, 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) ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
return ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
case MILL_LI_TG_PERP :
|
||||
{
|
||||
Vector3d vtPerp = vtStart ;
|
||||
@@ -5024,14 +5134,41 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
Vector3d vtRot = OrthoCompo( vtTool, vtStart) ;
|
||||
vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptMid = ptStart - vtStart * dTang + vtPerp * dPerp + vtTool * dElev ;
|
||||
if ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ! m_bToolComp) {
|
||||
if ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
int nIdTC = AddLinearMove( ptMid, 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) ;
|
||||
}
|
||||
}
|
||||
PtrOwner<ICurve> pCrv( GetArc2PVN( ptStart, ptMid, - vtStart, vtTool)) ;
|
||||
if ( IsNull( pCrv))
|
||||
return false ;
|
||||
pCrv->Invert() ;
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
if ( ! m_bToolComp)
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
else {
|
||||
int nIdS = m_pGeomDB->GetLastInGroup( m_nPathId) ;
|
||||
if ( AddCurveMove( pCrv, 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) ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
case MILL_LI_GLIDE :
|
||||
{
|
||||
@@ -5082,11 +5219,38 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
if ( dCompLen > 10 * EPS_SMALL) {
|
||||
Point3d ptMid ;
|
||||
pCrv->GetStartPoint( ptMid) ;
|
||||
if ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( ! m_bToolComp) {
|
||||
if ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
int nIdTC = AddLinearMove( ptMid, 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) ;
|
||||
}
|
||||
}
|
||||
// emetto (con eventuale spezzatura)
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
if ( ! m_bToolComp)
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
else {
|
||||
int nIdS = m_pGeomDB->GetLastInGroup( m_nPathId) ;
|
||||
if ( AddCurveMove( pCrv, 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) ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
case MILL_LI_ZIGZAG :
|
||||
{
|
||||
@@ -5160,6 +5324,8 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
// dati dell'elica
|
||||
double dRad = 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
|
||||
Point3d ptCen = ptP1 + vtCen * dRad ;
|
||||
if ( m_bToolComp)
|
||||
ptCen -= vtCen * GetToolCompPerpLen() ;
|
||||
double dDeltaN = ( ptStart - ptP1) * vtTool ;
|
||||
double dAngCen = ceil( - dDeltaN / ( m_Params.m_dLiElev + 10 * EPS_SMALL)) * ( bAtLeft ? ANG_FULL : - ANG_FULL) ;
|
||||
// creo l'elica
|
||||
@@ -5167,7 +5333,33 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
if ( IsNull( pArc) || ! pArc->Set( ptCen, vtTool, dRad, - vtCen, dAngCen, dDeltaN))
|
||||
return false ;
|
||||
// emetto l'elica (con eventuale spezzatura)
|
||||
return ( AddCurveMove( pArc, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
if ( ! m_bToolComp)
|
||||
return ( AddCurveMove( pArc, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
else {
|
||||
Point3d ptCorrE ; pArc->GetStartPoint( ptCorrE) ;
|
||||
Vector3d vtCorrDir = ptCorrE - ptCen ; vtCorrDir.Normalize() ;
|
||||
Point3d ptCorrS = ptCorrE - 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_IN, bInvert)) ;
|
||||
m_pGeomDB->SetMaterial( nIdTC, AQUA) ;
|
||||
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) ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
default :
|
||||
return false ;
|
||||
@@ -5355,7 +5547,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 = MILL_LO_NONE ; break ;
|
||||
case MILL_LI_HELIX : nType = ( ! m_bToolComp ? MILL_LO_NONE : MILL_LO_LINEAR) ; break ;
|
||||
default : nType = MILL_LO_NONE ; break ;
|
||||
}
|
||||
dTang = m_Params.m_dLiTang ;
|
||||
@@ -5396,14 +5588,40 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
|
||||
if ( ! vtDir1.Normalize())
|
||||
return false ;
|
||||
// inserisco movimento di uscita
|
||||
bool bOk = ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
bool bOk = true ;
|
||||
if ( ! m_bToolComp)
|
||||
bOk = ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
else {
|
||||
int nIdS = m_pGeomDB->GetLastInGroup( m_nPathId) ;
|
||||
bOk = ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
int nIdE = m_pGeomDB->GetLastInGroup( m_nPathId) ;
|
||||
for ( int nId = nIdS + 1 ; bOk && nId <= nIdE ; ++ nId) {
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
|
||||
bOk = ( pCamData != nullptr) ;
|
||||
if ( bOk) {
|
||||
pCamData->SetCorrType( GetCorrType( TOOL_CORR_PATH, bInvert)) ;
|
||||
m_pGeomDB->SetMaterial( nId, AQUA) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
|
||||
if ( dCompLen > 10 * EPS_SMALL) {
|
||||
vtDir1 = OrthoCompo( vtDir1, vtTool) ;
|
||||
bOk = bOk && vtDir1.Normalize() ;
|
||||
vtDir1.Rotate( vtTool, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 += vtDir1 * dCompLen ;
|
||||
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
if ( ! m_bToolComp)
|
||||
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
else {
|
||||
int nIdTC = AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) ;
|
||||
bOk = ( nIdTC != GDB_ID_NULL) ;
|
||||
CamData* pCamData = bOk ? GetCamData( m_pGeomDB->GetUserObj( nIdTC)) : nullptr ;
|
||||
bOk = bOk && ( pCamData != nullptr) ;
|
||||
if ( bOk) {
|
||||
pCamData->SetCorrType( GetCorrType( TOOL_CORR_OUT, bInvert)) ;
|
||||
m_pGeomDB->SetMaterial( nIdTC, AQUA) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// eventuale movimento in elevazione per flottante
|
||||
if ( m_bTHoldFloating && dFloatElev > 10 * EPS_SMALL) {
|
||||
@@ -5444,14 +5662,40 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
|
||||
Vector3d vtDirF ;
|
||||
if ( ! pCrv->GetEndDir( vtDirF))
|
||||
return false ;
|
||||
bool bOk = ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
bool bOk = true ;
|
||||
if ( ! m_bToolComp)
|
||||
bOk = ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
else {
|
||||
int nIdS = m_pGeomDB->GetLastInGroup( m_nPathId) ;
|
||||
bOk = ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
int nIdE = m_pGeomDB->GetLastInGroup( m_nPathId) ;
|
||||
for ( int nId = nIdS + 1 ; bOk && nId <= nIdE ; ++ nId) {
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
|
||||
bOk = ( pCamData != nullptr) ;
|
||||
if ( bOk) {
|
||||
pCamData->SetCorrType( GetCorrType( TOOL_CORR_PATH, bInvert)) ;
|
||||
m_pGeomDB->SetMaterial( nId, AQUA) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
|
||||
if ( dCompLen > 10 * EPS_SMALL) {
|
||||
vtDir1 = OrthoCompo( vtDirF, vtTool) ;
|
||||
bOk = bOk && vtDir1.Normalize() ;
|
||||
vtDir1.Rotate( vtTool, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 += vtDir1 * dCompLen ;
|
||||
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
if ( ! m_bToolComp)
|
||||
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
else {
|
||||
int nIdTC = AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) ;
|
||||
bOk = ( nIdTC != GDB_ID_NULL) ;
|
||||
CamData* pCamData = bOk ? GetCamData( m_pGeomDB->GetUserObj( nIdTC)) : nullptr ;
|
||||
bOk = bOk && ( pCamData != nullptr) ;
|
||||
if ( bOk) {
|
||||
pCamData->SetCorrType( GetCorrType( TOOL_CORR_OUT, bInvert)) ;
|
||||
m_pGeomDB->SetMaterial( nIdTC, AQUA) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// eventuale movimento in elevazione per flottante
|
||||
if ( m_bTHoldFloating && dFloatElev > 10 * EPS_SMALL) {
|
||||
@@ -5505,14 +5749,40 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
|
||||
pCrv->GetEndPoint( ptP1) ;
|
||||
pCrv->GetEndDir( vtDir1) ;
|
||||
// emetto
|
||||
bool bOk = ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
bool bOk = true ;
|
||||
if ( ! m_bToolComp)
|
||||
bOk = ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
else {
|
||||
int nIdS = m_pGeomDB->GetLastInGroup( m_nPathId) ;
|
||||
bOk = ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
int nIdE = m_pGeomDB->GetLastInGroup( m_nPathId) ;
|
||||
for ( int nId = nIdS + 1 ; bOk && nId <= nIdE ; ++ nId) {
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
|
||||
bOk = ( pCamData != nullptr) ;
|
||||
if ( bOk) {
|
||||
pCamData->SetCorrType( GetCorrType( TOOL_CORR_PATH, bInvert)) ;
|
||||
m_pGeomDB->SetMaterial( nId, AQUA) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
|
||||
if ( dCompLen > 10 * EPS_SMALL) {
|
||||
vtDir1 = OrthoCompo( vtDir1, vtTool) ;
|
||||
bOk = bOk && vtDir1.Normalize() ;
|
||||
vtDir1.Rotate( vtTool, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 += vtDir1 * dCompLen ;
|
||||
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
if ( ! m_bToolComp)
|
||||
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
else {
|
||||
int nIdTC = AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) ;
|
||||
bOk = ( nIdTC != GDB_ID_NULL) ;
|
||||
CamData* pCamData = bOk ? GetCamData( m_pGeomDB->GetUserObj( nIdTC)) : nullptr ;
|
||||
bOk = bOk && ( pCamData != nullptr) ;
|
||||
if ( bOk) {
|
||||
pCamData->SetCorrType( GetCorrType( TOOL_CORR_OUT, bInvert)) ;
|
||||
m_pGeomDB->SetMaterial( nIdTC, AQUA) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
@@ -6694,8 +6964,15 @@ Milling::CalcOffset( ICurveComposite* pCompo, double dSignOffs) const
|
||||
// se curva piatta con estrusione non perpendicolare forzo offset avanzato
|
||||
bool bAdvOffs = ( bIsFlat && abs( vtExtr * plPlane.GetVersN()) < cos( 0.1 * DEGTORAD)) ;
|
||||
// eseguo offset semplice
|
||||
if ( ! bAdvOffs && pCompo->SimpleOffset( dSignOffs, nFlag))
|
||||
if ( ! bAdvOffs) {
|
||||
pCompo->SimpleOffset( dSignOffs, nFlag) ;
|
||||
if ( m_bToolComp) {
|
||||
int nSign = ( dSignOffs > 0.) - ( dSignOffs < 0.) ;
|
||||
pCompo->SimpleOffset( - nSign * GetToolCompMinRadOffset()) ;
|
||||
pCompo->SimpleOffset( nSign * GetToolCompMinRadOffset()) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
// eseguo offset avanzato
|
||||
if ( bIsFlat) {
|
||||
OffsetCurve OffsCrv ;
|
||||
@@ -6704,6 +6981,11 @@ Milling::CalcOffset( ICurveComposite* pCompo, double dSignOffs) const
|
||||
if ( pOffs != nullptr) {
|
||||
pCompo->Clear() ;
|
||||
pCompo->AddCurve( pOffs) ;
|
||||
if ( m_bToolComp) {
|
||||
int nSign = ( dSignOffs > 0.) - ( dSignOffs < 0.) ;
|
||||
pCompo->SimpleOffset( - nSign * GetToolCompMinRadOffset()) ;
|
||||
pCompo->SimpleOffset( nSign * GetToolCompMinRadOffset()) ;
|
||||
}
|
||||
pCompo->ArcsBezierCurvesToArcsPerpExtr( LIN_TOL_MID, ANG_TOL_STD_DEG) ;
|
||||
return true ;
|
||||
}
|
||||
@@ -6811,3 +7093,31 @@ Milling::TrimExtendCurveToClosedStm( ICurveComposite* pCompo, int nCstmId, bool
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Milling::GetCorrType( int nToolCompEntity, bool bInvert) const
|
||||
{
|
||||
// verifica tipo di Entità
|
||||
if ( nToolCompEntity != TOOL_CORR_PATH && nToolCompEntity != TOOL_CORR_IN && nToolCompEntity != TOOL_CORR_OUT)
|
||||
return 0 ;
|
||||
// se entità di Uscita, allora valore 140
|
||||
if ( nToolCompEntity == TOOL_CORR_OUT)
|
||||
return 140 ;
|
||||
// Se lavorazione lato destro
|
||||
if ( m_Params.m_nWorkSide == MILL_WS_RIGHT) {
|
||||
if ( ! bInvert)
|
||||
return ( nToolCompEntity == TOOL_CORR_IN ? 141 : 41) ;
|
||||
else
|
||||
return ( nToolCompEntity == TOOL_CORR_IN ? 142 : 42) ;
|
||||
}
|
||||
// Se lavorazione lato sinistro
|
||||
else if ( m_Params.m_nWorkSide == MILL_WS_LEFT) {
|
||||
if ( ! bInvert)
|
||||
return ( nToolCompEntity == TOOL_CORR_IN ? 142 : 42) ;
|
||||
else
|
||||
return ( nToolCompEntity == TOOL_CORR_IN ? 141 : 41) ;
|
||||
}
|
||||
// per gli altri casi
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ class Milling : public Machining
|
||||
double m_dRampLen ;
|
||||
double m_dTopLen ;
|
||||
} ;
|
||||
enum ToolCorrEntity { TOOL_CORR_PATH = 0, TOOL_CORR_IN = 1, TOOL_CORR_OUT = 2 } ;
|
||||
|
||||
private :
|
||||
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
|
||||
@@ -138,6 +139,7 @@ class Milling : public Machining
|
||||
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false, bool bSawSpecial = false) const ;
|
||||
bool CalcOffset( ICurveComposite* pCompo, double dSignOffs) const ;
|
||||
bool TrimExtendCurveToClosedStm( ICurveComposite* pCompo, int nCstmId, bool bInvert) ;
|
||||
int GetCorrType( int nToolCompEntity, bool bInvert) const ;
|
||||
|
||||
private :
|
||||
double GetSpeed() const
|
||||
@@ -171,6 +173,10 @@ class Milling : public Machining
|
||||
m_Params.m_dLiTang >= 0.9 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
|
||||
double GetLeadInOutToler( void) const
|
||||
{ return ( m_bTHoldFloating ? LIO_ELEV_FLOAT : LIO_ELEV_TOL) ; }
|
||||
inline double GetToolCompMinRadOffset() const
|
||||
{ return 100. * EPS_SMALL ; }
|
||||
inline double GetToolCompPerpLen() const
|
||||
{ return 2.0 ; }
|
||||
friend class LeadIOStatus ;
|
||||
|
||||
private :
|
||||
|
||||
Reference in New Issue
Block a user