EgtMachKernel 2.6d1 :
- se robot sempre spezzatura - spezzatura movimenti per robot - in tagli con lama, tolto da Apply preview.
This commit is contained in:
+69
-106
@@ -1789,13 +1789,9 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
m_pGeomDB->GetName( nPathId, sPathName) ;
|
||||
|
||||
// eventuale approssimazione con segmenti di retta
|
||||
int nSplitArcs = m_pMchMgr->GetCurrMachiningsMgr()->GetSplitArcs() ;
|
||||
bool bSplitArcs = ( nSplitArcs == SPLAR_ALWAYS ||
|
||||
( nSplitArcs == SPLAR_NO_XY_PLANE && ! vtTool.IsZplus()) ||
|
||||
( nSplitArcs == SPLAR_GEN_PLANE && vtTool.IsGeneric())) ;
|
||||
bool bSplitArcs = GetSplitArcs( vtTool) ;
|
||||
if ( bSplitArcs) {
|
||||
double dMaxLen = ( m_pMchMgr->GetCurrIsRobot() ? 5 : 0) ;
|
||||
if ( ! ApproxWithLines( pCompo, dMaxLen)) {
|
||||
if ( ! ApproxWithLines( pCompo)) {
|
||||
m_pMchMgr->SetLastError( 2313, "Error in Milling : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2355,7 +2351,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
dStElev = -LIO_ELEV_TOL ;
|
||||
}
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart, bAboveStart)) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart, bAboveStart, true, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2414,7 +2410,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
bOk = false ;
|
||||
}
|
||||
// aggiungo opportuno approccio
|
||||
if ( ! AddSawBladeSideApproach( ptP1, vtAppr, vtTool, dSafeZ, dSawStartElev, dStElev, dAppr)) {
|
||||
if ( ! AddSawBladeSideApproach( ptP1, vtAppr, vtTool, dSafeZ, dSawStartElev, dStElev, dAppr, true, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2719,7 +2715,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
dStElev = - LIO_ELEV_TOL ;
|
||||
}
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart, bAboveStart)) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart, bAboveStart, true, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2771,7 +2767,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
bOk = false ;
|
||||
}
|
||||
// aggiungo opportuno approccio
|
||||
if ( ! AddSawBladeSideApproach( ptP1, vtAppr, vtTool, dSafeZ, dSawStartElev, dStElev, dAppr)) {
|
||||
if ( ! AddSawBladeSideApproach( ptP1, vtAppr, vtTool, dSafeZ, dSawStartElev, dStElev, dAppr, true, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3173,14 +3169,15 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
}
|
||||
// approccio standard al punto iniziale
|
||||
if ( k == 1 || bMidRetract) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart, bAhAboveStartEnd || bUhBelowStartEnd)) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart,
|
||||
bAhAboveStartEnd || bUhBelowStartEnd, k == 1, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti approccio diretto al punto iniziale
|
||||
else {
|
||||
if ( ! AddDirectApproach( ptP1)) {
|
||||
if ( ! AddDirectApproach( ptP1, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3243,24 +3240,26 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
}
|
||||
|
||||
// aggiungo opportuno approccio
|
||||
if ( ! AddSawBladeSideApproach( ptP1, vtAppr, vtTool, dSafeZ, dSawStartElev, dStElev, dAppr, bAddInsert)) {
|
||||
if ( ! AddSawBladeSideApproach( ptP1, vtAppr, vtTool, dSafeZ, dSawStartElev, dStElev, dAppr,
|
||||
k == 1, bSplitArcs, bAddInsert)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
SetFlag( 0) ;
|
||||
bool bFirst = ( k == 1) ;
|
||||
// se necessario inserimento
|
||||
if ( bAddInsert) {
|
||||
Point3d ptInsert = ptP1 + ( dStElev + dSafeZ) * vtTool ;
|
||||
if ( AddRapidStart( ptInsert) == GDB_ID_NULL)
|
||||
if ( AddRapidStartOrMove( ptInsert, bFirst, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
if ( AddRapidMove( ptP1) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP1, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// altrimenti direttamente al punto iniziale
|
||||
else {
|
||||
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
|
||||
if ( AddRapidStartOrMove( ptP1, bFirst, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -3544,7 +3543,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
bool bUhAboveStart = ! m_bAboveHead && GetUhPointAboveRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(),
|
||||
m_TParams.m_dLen, false, dSafeZ, vtEscape, dStElev) ;
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart, bAboveStart)) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart, bAboveStart, true, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3732,7 +3731,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
bool bUhAboveStart = ! m_bAboveHead && GetUhPointAboveRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(),
|
||||
m_TParams.m_dLen, false, dSafeZ, vtEscape, dStElev) ;
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart, bAboveStart)) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart, bAboveStart, true, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -4259,7 +4258,7 @@ Milling::AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Milling::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bOutStart, bool bAboveStart)
|
||||
double dElev, double dAppr, bool bOutStart, bool bAboveStart, bool bFirst, bool bSplitArcs)
|
||||
{
|
||||
SetFlag( 1) ;
|
||||
// se con aggregato da sotto o equivalente (rinvio a 90 gradi su testa 5 assi)
|
||||
@@ -4280,20 +4279,21 @@ Milling::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
|
||||
Vector3d vtAux = m_vtAggrBottom ;
|
||||
vtAux.Rotate( Z_AX, 0, 1) ;
|
||||
SetAuxDir( vtAux) ;
|
||||
if ( AddRapidStart( ptP00, MCH_CL_AGB_DWN) == GDB_ID_NULL)
|
||||
if ( AddRapidStartOrMove( ptP00, bFirst, bSplitArcs, MCH_CL_AGB_DWN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetAuxDir( m_vtAggrBottom) ;
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidMove( ptP0, MCH_CL_AGB_IN) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP0, bSplitArcs, MCH_CL_AGB_IN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// altrimenti rinvio normale
|
||||
else {
|
||||
SetAuxDir( m_vtAggrBottom) ;
|
||||
if ( AddRapidStart( ptP0, MCH_CL_AGB_IN) == GDB_ID_NULL)
|
||||
if ( AddRapidStartOrMove( ptP0, bFirst, bSplitArcs, MCH_CL_AGB_IN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetFlag( 0) ;
|
||||
}
|
||||
bFirst = false ;
|
||||
}
|
||||
// se testa da sopra senza aggregato da sotto e non con tavola basculante, approccio mai da Z negativo
|
||||
// oppure testa da sotto, approccio mai da Z positivo
|
||||
@@ -4311,20 +4311,18 @@ Milling::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
|
||||
// se distanza di sicurezza minore di distanza di inizio
|
||||
if ( dSafeDist < dAppr + 10 * EPS_SMALL) {
|
||||
// 1 -> punto sopra inizio
|
||||
if ( ( ! m_bAggrBottom && AddRapidStart( ptP1) == GDB_ID_NULL) ||
|
||||
( m_bAggrBottom && AddRapidMove( ptP1) == GDB_ID_NULL))
|
||||
if ( AddRapidStartOrMove( ptP1, bFirst, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
// 1a -> punto molto sopra inizio
|
||||
Point3d ptP1a = ptP1 + vtAppr * ( dSafeDist - dAppr) ;
|
||||
if ( ( ! m_bAggrBottom && AddRapidStart( ptP1a) == GDB_ID_NULL) ||
|
||||
( m_bAggrBottom && AddRapidMove( ptP1a) == GDB_ID_NULL))
|
||||
if ( AddRapidStartOrMove( ptP1a, bFirst, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// 1 -> punto sopra inizio
|
||||
if ( ( dElev + dAppr) > 10 * EPS_SMALL || (( dElev + dAppr) > -EPS_ZERO && dAppr > EPS_SMALL)) {
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidMove( ptP1) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP1, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
@@ -4334,27 +4332,26 @@ Milling::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
|
||||
SetFlag( 0) ;
|
||||
bool bStartFeed = ( bOutStart || m_TParams.m_nType == TT_MILL_NOTIP || m_TParams.m_nType == TT_MILL_POLISHING) ;
|
||||
SetFeed( bStartFeed ? GetStartFeed() : GetTipFeed()) ;
|
||||
if ( ! AreSamePointApprox( ptP1, ptP) && AddLinearMove( ptP) == GDB_ID_NULL)
|
||||
if ( ! AreSamePointApprox( ptP1, ptP) && AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// sono sopra il pezzo ma non abbastanza
|
||||
else if ( bAboveStart && ! m_bTiltingTab && ( min( dElevZ, 0.) + dAppr) > 10 * EPS_SMALL) {
|
||||
// 1b -> punto appena sopra inizio (in Z globale)
|
||||
Point3d ptP1b = ptP + Z_AX * ( min( dElevZ, 0.) + dAppr) ;
|
||||
if ( AddRapidStart( ptP1b) == GDB_ID_NULL)
|
||||
if ( AddRapidStartOrMove( ptP1b, bFirst, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// affondo al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
bool bStartFeed = ( bOutStart || m_TParams.m_nType == TT_MILL_NOTIP || m_TParams.m_nType == TT_MILL_POLISHING) ;
|
||||
SetFeed( bStartFeed ? GetStartFeed() : GetTipFeed()) ;
|
||||
if ( AddLinearMove( ptP) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
// affondo diretto al punto iniziale
|
||||
if ( ( ! m_bAggrBottom && AddRapidStart( ptP) == GDB_ID_NULL) ||
|
||||
( m_bAggrBottom && AddRapidMove( ptP) == GDB_ID_NULL))
|
||||
if ( AddRapidStartOrMove( ptP, bFirst, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetFlag( 0) ;
|
||||
}
|
||||
@@ -4364,13 +4361,14 @@ Milling::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Milling::AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, const Vector3d& vtTool,
|
||||
double dSafeZ, double dSawStElev, double dStElev, double dAppr, bool bAddInsert)
|
||||
double dSafeZ, double dSawStElev, double dStElev, double dAppr,
|
||||
bool bFirst, bool bSplitArcs, bool bAddInsert)
|
||||
{
|
||||
// per approccio orizzontale vtAppr deve essere già stato sistemato dal chiamante
|
||||
SetFlag( 1) ;
|
||||
// 1a -> punto fuori inizio
|
||||
Point3d ptP1a = ptP + vtAppr * ( dSawStElev + max( dAppr, dSafeZ)) ;
|
||||
bool bFirst = true ;
|
||||
bool bOutStart = true ;
|
||||
// se necessario ulteriore approccio
|
||||
if ( ! m_bTiltingTab) {
|
||||
Vector3d vtMove = Vector3d( vtTool.x, vtTool.y, 0) ;
|
||||
@@ -4383,18 +4381,18 @@ Milling::AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, co
|
||||
Point3d ptP1e = ptP1a + vtMove * ( dExtraElev + dSafeZ) ;
|
||||
if ( bAddInsert) {
|
||||
Point3d ptInsert = ptP1e + ( dStElev + dSafeZ) * vtTool ;
|
||||
if ( AddRapidStart( ptInsert) == GDB_ID_NULL)
|
||||
if ( AddRapidStartOrMove( ptInsert, bFirst, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidMove( ptP1e) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP1e, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( AddRapidStart( ptP1e) == GDB_ID_NULL)
|
||||
if ( AddRapidStartOrMove( ptP1e, bFirst, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetFlag( 0) ;
|
||||
}
|
||||
bFirst = false ;
|
||||
bOutStart = false ;
|
||||
}
|
||||
}
|
||||
else if ( ! m_bAboveHead && vtAppr.z > -LIM_DOWN_APPRZ) {
|
||||
@@ -4405,51 +4403,51 @@ Milling::AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, co
|
||||
Point3d ptP1e = ptP1a + vtMove * ( dExtraElev + dSafeZ) ;
|
||||
if ( bAddInsert) {
|
||||
Point3d ptInsert = ptP1e + ( dStElev + dSafeZ) * vtTool ;
|
||||
if ( AddRapidStart( ptInsert) == GDB_ID_NULL)
|
||||
if ( AddRapidStartOrMove( ptInsert, bFirst, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidMove( ptP1e) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP1e, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( AddRapidStart( ptP1e) == GDB_ID_NULL)
|
||||
if ( AddRapidStartOrMove( ptP1e, bFirst, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetFlag( 0) ;
|
||||
}
|
||||
bFirst = false ;
|
||||
bOutStart = false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// punto fuori inizio
|
||||
if ( bFirst) {
|
||||
if ( bOutStart) {
|
||||
if ( bAddInsert) {
|
||||
Point3d ptInsert = ptP1a + ( dStElev + dSafeZ) * vtTool ;
|
||||
if ( AddRapidStart( ptInsert) == GDB_ID_NULL)
|
||||
if ( AddRapidStartOrMove( ptInsert, bFirst, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidMove( ptP1a) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP1a, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( AddRapidStart( ptP1a) == GDB_ID_NULL)
|
||||
if ( AddRapidStartOrMove( ptP1a, bFirst, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetFlag( 0) ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( AddRapidMove( ptP1a) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP1a, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 1b -> punto appena sopra inizio (se necessario)
|
||||
if ( dSafeZ > dAppr + 10 * EPS_SMALL && dSawStElev + dAppr > 10 * EPS_SMALL) {
|
||||
Point3d ptP1b = ptP + vtAppr * ( dSawStElev + dAppr) ;
|
||||
if ( AddRapidMove( ptP1b) == GDB_ID_NULL)
|
||||
if ( AddRapidMove( ptP1b, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// affondo al punto iniziale in feed
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( AddLinearMove( ptP) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
@@ -4457,12 +4455,12 @@ Milling::AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, co
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Milling::AddDirectApproach( const Point3d& ptP)
|
||||
Milling::AddDirectApproach( const Point3d& ptP, bool bSplitArcs)
|
||||
{
|
||||
// affondo diretto al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( AddLinearMove( ptP) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
@@ -4805,18 +4803,18 @@ 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, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
return ( AddLinearMove( ptStart, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
return ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
case MILL_LI_TG_PERP :
|
||||
{
|
||||
Vector3d vtPerp = vtStart ;
|
||||
Vector3d vtRot = OrthoCompo( vtTool, vtStart) ;
|
||||
vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
Point3d ptMid = ptStart + vtPerp * dPerp ;
|
||||
return ( AddLinearMove( ptMid, MCH_CL_LEADIN) != GDB_ID_NULL &&
|
||||
AddLinearMove( ptStart, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
return ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL &&
|
||||
AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
case MILL_LI_TANGENT :
|
||||
{
|
||||
@@ -4827,23 +4825,14 @@ 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, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
PtrOwner<ICurve> pCrv( GetArc2PVN( ptStart, ptMid, - vtStart, vtTool)) ;
|
||||
if ( IsNull( pCrv))
|
||||
return false ;
|
||||
pCrv->Invert() ;
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs) {
|
||||
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pCrv)) || ! ApproxWithLines( pCompo))
|
||||
return false ;
|
||||
return ( AddCurveMove( pCompo, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
else {
|
||||
return ( AddCurveMove( pCrv, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
case MILL_LI_GLIDE :
|
||||
{
|
||||
@@ -4890,11 +4879,8 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
double dNini = ( ptP1 - ORIG) * vtTool ;
|
||||
double dNfin = ( ptStart - ORIG) * vtTool ;
|
||||
AdjustCurveSlope( pCrv, dNini, dNfin) ;
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs && ! ApproxWithLines( pCrv))
|
||||
return false ;
|
||||
// emetto
|
||||
return ( AddCurveMove( pCrv) != GDB_ID_NULL) ;
|
||||
// emetto (con eventuale spezzatura)
|
||||
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
case MILL_LI_ZIGZAG :
|
||||
{
|
||||
@@ -4932,9 +4918,6 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
Point3d ptIni ; pCrv->GetStartPoint( ptIni) ;
|
||||
Vector3d vtMove = ptStart - ptIni ;
|
||||
pCrv->Translate( vtMove) ;
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs && ! ApproxWithLines( pCrv))
|
||||
return false ;
|
||||
// la ripeto a zigzag
|
||||
double dDeltaN = ( ptStart - ptP1) * vtTool ;
|
||||
int nStep = int( ceil( - dDeltaN / ( m_Params.m_dLiElev + 10 * EPS_SMALL))) ;
|
||||
@@ -4949,7 +4932,7 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
// assegno la corretta pendenza
|
||||
AdjustCurveSlope( pCopy1, dNini, dNmid) ;
|
||||
// emetto
|
||||
if ( AddCurveMove( pCopy1) == GDB_ID_NULL)
|
||||
if ( AddCurveMove( pCopy1, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// copio per zag
|
||||
PtrOwner<ICurveComposite> pCopy2( pCrv->Clone()) ;
|
||||
@@ -4957,7 +4940,7 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
// assegno la corretta pendenza
|
||||
AdjustCurveSlope( pCopy2, dNmid, dNfin) ;
|
||||
// emetto
|
||||
if ( AddCurveMove( pCopy2) == GDB_ID_NULL)
|
||||
if ( AddCurveMove( pCopy2, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
@@ -4977,17 +4960,8 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
|
||||
PtrOwner<ICurveArc> pArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pArc) || ! pArc->Set( ptCen, vtTool, dRad, - vtCen, dAngCen, dDeltaN))
|
||||
return false ;
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs) {
|
||||
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pArc)) || ! ApproxWithLines( pCompo))
|
||||
return false ;
|
||||
return ( AddCurveMove( pCompo, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
else {
|
||||
// emetto l'elica
|
||||
return ( AddCurveMove( pArc, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
// emetto l'elica (con eventuale spezzatura)
|
||||
return ( AddCurveMove( pArc, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
|
||||
}
|
||||
default :
|
||||
return false ;
|
||||
@@ -5189,14 +5163,14 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
|
||||
vtDir1 = ptP1 - ptEnd ;
|
||||
if ( ! vtDir1.Normalize())
|
||||
return false ;
|
||||
bool bOk = ( AddLinearMove( ptP1, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
bool bOk = ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
|
||||
if ( m_Params.m_dLoCompLen > 10 * EPS_SMALL) {
|
||||
vtDir1 = OrthoCompo( vtDir1, vtTool) ;
|
||||
bOk = bOk && vtDir1.Normalize() ;
|
||||
vtDir1.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 += vtDir1 * m_Params.m_dLoCompLen ;
|
||||
bOk = bOk && ( AddLinearMove( ptP1, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
@@ -5208,8 +5182,8 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
|
||||
Point3d ptMid = ptEnd + vtPerp * dPerp ;
|
||||
ptP1 = ptMid + vtEnd * dTang + vtTool * dElev ;
|
||||
vtDir1 = ptP1 - ptMid ; vtDir1.Normalize() ;
|
||||
return ( AddLinearMove( ptMid, MCH_CL_LEADOUT) != GDB_ID_NULL &&
|
||||
AddLinearMove( ptP1, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
return ( AddLinearMove( ptMid, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL &&
|
||||
AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
}
|
||||
case MILL_LO_TANGENT :
|
||||
{
|
||||
@@ -5230,23 +5204,15 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
|
||||
if ( ! pCrv->GetEndDir( vtDirF))
|
||||
return false ;
|
||||
bool bOk = true ;
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs) {
|
||||
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pCrv)) || ! ApproxWithLines( pCompo))
|
||||
return false ;
|
||||
bOk = ( AddCurveMove( pCompo, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
}
|
||||
else {
|
||||
bOk = ( AddCurveMove( pCrv, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
}
|
||||
// emetto movimento
|
||||
bOk = ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
// eventuale movimento ortogonale (estensione di inserimento compensazione raggio utensile)
|
||||
if ( m_Params.m_dLoCompLen > 10 * EPS_SMALL) {
|
||||
vtDir1 = OrthoCompo( vtDirF, vtTool) ;
|
||||
bOk = bOk && vtDir1.Normalize() ;
|
||||
vtDir1.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ;
|
||||
ptP1 += vtDir1 * m_Params.m_dLoCompLen ;
|
||||
bOk = bOk && ( AddLinearMove( ptP1, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
bOk = bOk && ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
@@ -5291,11 +5257,8 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
|
||||
// assegno la corretta pendenza
|
||||
double dNini = ( ptEnd - ORIG) * vtTool ;
|
||||
AdjustCurveSlope( pCrv, dNini, dNini + dElev) ;
|
||||
// eventuale spezzatura
|
||||
if ( bSplitArcs && ! ApproxWithLines( pCrv))
|
||||
return false ;
|
||||
// emetto
|
||||
AddCurveMove( pCrv) ;
|
||||
AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) ;
|
||||
// assegno punto e direzione finale dell'uscita
|
||||
pCrv->GetEndPoint( ptP1) ;
|
||||
pCrv->GetEndDir( vtDir1) ;
|
||||
|
||||
Reference in New Issue
Block a user