EgtMachKernel :
- in svuotature gestione SpiralIn e SpiralOut ottimizzate per cerchi - in svuotatura aggiunti attacchi zigzag e elica e uscita Glide - in contornatura miglioramenti vari.
This commit is contained in:
+111
-69
@@ -31,6 +31,21 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//------------------------------ Errors --------------------------------------
|
||||
// 2301 = "Error in Milling : UpdateToolData failed"
|
||||
// 2302 = "Error in Milling : Offset not computable"
|
||||
// 2303 = "Error in Milling : Empty RawBox"
|
||||
// 2304 = "Error in Milling : Depth not computable"
|
||||
// 2305 = "Error in Milling : machining depth (xx) bigger than MaxMaterial (yy)"
|
||||
// 2306 = "Error in Milling : Entity GetElevation"
|
||||
// 2307 = "Error in Milling : missing aggregate from bottom"
|
||||
// 2308 = "Error in Milling : path too far from part sides"
|
||||
// 2309 = "Error in Milling : LeadIn not computable"
|
||||
// 2310 = "Error in Milling : LeadOut not computable"
|
||||
// 2311 = "Error in Milling : Linear Approx not computable"
|
||||
// 2312 = "Error in Milling : LeadIn must be out of rawpart"
|
||||
// 2313 = "Error in Milling : Chaining failed"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
USEROBJ_REGISTER( "EMkMilling", Milling) ;
|
||||
|
||||
@@ -416,13 +431,15 @@ Milling::Preview( bool bRecalc)
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
if ( ! UpdateToolData()) {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : UpdateToolData failed") ;
|
||||
m_pMchMgr->SetLastError( 2301, "Error in Milling : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se necessario, eseguo concatenamento ed inserisco i percorsi sotto la geometria ausiliaria
|
||||
if ( bChain && ! Chain( nAuxId))
|
||||
if ( bChain && ! Chain( nAuxId)) {
|
||||
m_pMchMgr->SetLastError( 2313, "Error in Milling : Chaining failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// recupero gruppo per geometria di Preview
|
||||
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
|
||||
@@ -479,13 +496,15 @@ Milling::Apply( bool bRecalc)
|
||||
|
||||
// aggiorno dati geometrici dell'utensile
|
||||
if ( ! UpdateToolData()) {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : UpdateToolData failed") ;
|
||||
m_pMchMgr->SetLastError( 2301, "Error in Milling : UpdateToolData failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se necessario, eseguo concatenamento ed inserisco i percorsi sotto la geometria ausiliaria
|
||||
if ( bChain && ! Chain( nAuxId))
|
||||
if ( bChain && ! Chain( nAuxId)) {
|
||||
m_pMchMgr->SetLastError( 2313, "Error in Milling : Chaining failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// recupero gruppo per geometria di lavorazione (Cutter Location)
|
||||
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
|
||||
@@ -1009,6 +1028,9 @@ Milling::Chain( int nGrpDestId)
|
||||
pCrvCompo->SetThickness( dThick) ;
|
||||
// aggiorno il nuovo punto vicino
|
||||
pCrvCompo->GetEndPoint( ptNear) ;
|
||||
// se utile, approssimo con archi
|
||||
if ( ! ApproxWithArcsIfUseful( pCrvCompo))
|
||||
return false ;
|
||||
// creo nuovo gruppo
|
||||
int nPathId = m_pGeomDB->AddGroup( GDB_ID_NULL, nGrpDestId, Frame3d()) ;
|
||||
if ( nPathId == GDB_ID_NULL)
|
||||
@@ -1071,8 +1093,8 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
double dThick ;
|
||||
pCompo->GetThickness( dThick) ;
|
||||
|
||||
// eventuali allungamenti/accorciamenti per percorso aperto
|
||||
if ( ! pCompo->IsClosed()) {
|
||||
// eventuali allungamenti/accorciamenti per percorso aperto o chiuso senza sovrapposizione
|
||||
if ( ! pCompo->IsClosed() || m_Params.m_dOverlap < EPS_SMALL) {
|
||||
// verifico che il percorso sia abbastanza lungo
|
||||
double dLen ; pCompo->GetLength( dLen) ;
|
||||
if ( dLen + m_Params.m_dStartAddLen + m_Params.m_dEndAddLen < 10 * EPS_SMALL) {
|
||||
@@ -1106,14 +1128,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// valore offset
|
||||
double dSignOffs = ( m_Params.m_nWorkSide == MILL_WS_RIGHT) ? dOffs : - dOffs ;
|
||||
// flag offset
|
||||
int nFlag = ICurve::OFF_EXTEND ;
|
||||
// se percorso chiuso senza overlap ed inizio/fine è un angolo esterno
|
||||
if ( pCompo->IsClosed() && m_Params.m_dOverlap < EPS_SMALL) {
|
||||
Vector3d vtStart, vtEnd ;
|
||||
if ( pCompo->GetStartDir( vtStart) && pCompo->GetEndDir( vtEnd) &&
|
||||
( vtEnd ^ vtStart) * vtExtr * dSignOffs > 0)
|
||||
nFlag += ICurve::OFF_FORCE_OPEN ;
|
||||
}
|
||||
int nFlag = ICurve::OFF_FILLET ;
|
||||
// esecuzione offset
|
||||
if ( ! pCompo->SimpleOffset( dSignOffs, nFlag)) {
|
||||
// se curva piatta, provo con offset avanzato
|
||||
@@ -1132,7 +1147,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
}
|
||||
}
|
||||
if ( ! bOk) {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : Offset not computable") ;
|
||||
m_pMchMgr->SetLastError( 2302, "Error in Milling : Offset not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -1165,7 +1180,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// recupero il box del grezzo in globale
|
||||
BBox3d b3Raw ;
|
||||
if ( ! GetRawGlobBox( m_nPhase, nPathId, 0.5 * m_TParams.m_dDiam, b3Raw) || b3Raw.IsEmpty()) {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : Empty RawBox") ;
|
||||
m_pMchMgr->SetLastError( 2303, "Error in Milling : Empty RawBox") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -1182,7 +1197,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
double dDepth ;
|
||||
string sMyDepth = m_Params.m_sDepth ;
|
||||
if ( ! ExeLuaEvalNumExpr( ToUpper( sMyDepth), &dDepth)) {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : Depth not computable") ;
|
||||
m_pMchMgr->SetLastError( 2304, "Error in Milling : Depth not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// se spessore positivo, lo sottraggo dal risultato
|
||||
@@ -1200,31 +1215,13 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
bool bSplitArcs = ( nSplitArcs == SPLAR_ALWAYS ||
|
||||
( nSplitArcs == SPLAR_NO_XY_PLANE && ! vtExtr.IsZplus()) ||
|
||||
( nSplitArcs == SPLAR_GEN_PLANE && vtExtr.IsGeneric())) ;
|
||||
if ( bSplitArcs) {
|
||||
const double ANG_TOL_MAX_DEG = 90 ;
|
||||
PolyLine PL ;
|
||||
if ( pCompo->ApproxWithLines( 50 * EPS_SMALL, ANG_TOL_MAX_DEG, ICurve::APL_SPECIAL, PL)) {
|
||||
// sostituisco le linee alle curve originali
|
||||
pCompo->Clear() ;
|
||||
pCompo->FromPolyLine( PL) ;
|
||||
// riassegno estrusione e spessore
|
||||
pCompo->SetExtrusion( vtExtr) ;
|
||||
pCompo->SetThickness( dThick) ;
|
||||
}
|
||||
if ( bSplitArcs && ! ApproxWithLines( pCompo)) {
|
||||
m_pMchMgr->SetLastError( 2311, "Error in Milling : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
|
||||
const double MAX_ANG_CEN = 150 + EPS_ANG_SMALL ;
|
||||
int nMaxInd = pCompo->GetCurveCount() - 1 ;
|
||||
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
|
||||
// se arco con angolo al centro oltre il limite, lo divido a metà
|
||||
const ICurveArc* pArc = GetCurveArc( pCompo->GetCurve( i)) ;
|
||||
if ( pArc != nullptr && abs( pArc->GetAngCenter()) > MAX_ANG_CEN) {
|
||||
pCompo->AddJoint( i + 0.5) ;
|
||||
++ i ;
|
||||
++ nMaxInd ;
|
||||
}
|
||||
}
|
||||
VerifyArcs( pCompo) ;
|
||||
|
||||
// calcolo il versore fresa
|
||||
Vector3d vtTool = Z_AX ;
|
||||
@@ -1257,7 +1254,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
else {
|
||||
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()) ;
|
||||
m_pMchMgr->SetLastError( 2305, sInfo.c_str()) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -1377,7 +1374,7 @@ Milling::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtToo
|
||||
dElev = dCurrElev ;
|
||||
}
|
||||
else {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : Entity GetElevation") ;
|
||||
m_pMchMgr->SetLastError( 2306, "Error in Milling : Entity GetElevation") ;
|
||||
return false ;
|
||||
}
|
||||
// da una parte
|
||||
@@ -1387,7 +1384,7 @@ Milling::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtToo
|
||||
dElev = dCurrElev ;
|
||||
}
|
||||
else {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : Entity GetElevation") ;
|
||||
m_pMchMgr->SetLastError( 2306, "Error in Milling : Entity GetElevation") ;
|
||||
return false ;
|
||||
}
|
||||
// dall'altra parte
|
||||
@@ -1397,7 +1394,7 @@ Milling::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtToo
|
||||
dElev = dCurrElev ;
|
||||
}
|
||||
else {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : Entity GetElevation") ;
|
||||
m_pMchMgr->SetLastError( 2306, "Error in Milling : Entity GetElevation") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -1419,8 +1416,8 @@ Milling::VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vt
|
||||
int nHeadId = m_pMchMgr->GetHeadId( m_TParams.m_sHead) ;
|
||||
int nAgbType ;
|
||||
if ( ! m_pGeomDB->GetInfo( nHeadId, "AGB_TYPE", nAgbType) || nAgbType == 0) {
|
||||
string sOut = "Milling error : missing aggregate from bottom" ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str()) ;
|
||||
string sOut = "Error in Milling : missing aggregate from bottom" ;
|
||||
m_pMchMgr->SetLastError( 2307, sOut.c_str()) ;
|
||||
return false ;
|
||||
}
|
||||
// recupero la massima distanza consentita dal rinvio
|
||||
@@ -1460,8 +1457,8 @@ Milling::VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vt
|
||||
}
|
||||
// se supera il limite, errore
|
||||
if ( dDist > dAgbDmax) {
|
||||
string sOut = "Milling error : path too far from part sides" ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str()) ;
|
||||
string sOut = "Error in Milling : path too far from part sides" ;
|
||||
m_pMchMgr->SetLastError( 2308, sOut.c_str()) ;
|
||||
return false ;
|
||||
}
|
||||
// assegno direzione di accesso e segnalo utilizzo aggregato da sotto
|
||||
@@ -1558,19 +1555,26 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
Point3d ptP1 ;
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, false, ptP1))
|
||||
return false ;
|
||||
// aggiungo approccio per frese normali con spazio sopra attacco
|
||||
// determino se l'inizio dell'attacco è fuori dal grezzo
|
||||
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool) ;
|
||||
// aggiungo approccio per frese normali con spazio sopra attacco
|
||||
if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
|
||||
// determino elevazione su inizio attacco
|
||||
// determino elevazione su inizio percorso di lavoro
|
||||
double dStElev ;
|
||||
if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), dStElev))
|
||||
dStElev = dElev ;
|
||||
dStElev -= ( ptP1 - ptStart) * vtExtr ;
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dStElev, dAppr))
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dStElev, dAppr, bOutStart))
|
||||
return false ;
|
||||
}
|
||||
// altrimenti, approccio per lame o diretto
|
||||
else {
|
||||
// verifico di entrare in aria
|
||||
if ( ! bOutStart) {
|
||||
m_pMchMgr->SetLastError( 2312, "Error in Milling : LeadIn must be out of rawpart") ;
|
||||
return false ;
|
||||
}
|
||||
// affondo al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
|
||||
@@ -1579,7 +1583,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
// aggiungo attacco
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, false, bSplitArcs)) {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : LeadIn not computable") ;
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -1613,7 +1617,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
Point3d ptP1 ;
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, false, bSplitArcs, ptP1)) {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : LeadOut not computable") ;
|
||||
m_pMchMgr->SetLastError( 2310, "Error in Milling : LeadOut not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// aggiungo retrazione per frese normali
|
||||
@@ -1676,6 +1680,8 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
Point3d ptP1 ;
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, bInvert, ptP1))
|
||||
return false ;
|
||||
// determino se l'inizio dell'attacco è fuori dal grezzo
|
||||
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool) ;
|
||||
// se primo step aggiungo approccio per frese normali
|
||||
if ( j == 1 && ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
|
||||
// determino elevazione su inizio attacco
|
||||
@@ -1684,7 +1690,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
dStElev = dElev ;
|
||||
dStElev -= ( ptP1 - ptStart) * vtExtr ;
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dStElev, dAppr))
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dStElev, dAppr, bOutStart))
|
||||
return false ;
|
||||
}
|
||||
// altrimenti, affondo al punto iniziale
|
||||
@@ -1693,6 +1699,12 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
if ( ( m_TParams.m_nType & TF_SAWBLADE) != 0) {
|
||||
SetFlag( 0) ;
|
||||
if ( j == 1) {
|
||||
// verifico di entrare in aria
|
||||
if ( ! bOutStart) {
|
||||
m_pMchMgr->SetLastError( 2312, "Error in Milling : LeadIn must be out of rawpart") ;
|
||||
return false ;
|
||||
}
|
||||
// eseguo affondo
|
||||
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
@@ -1701,9 +1713,9 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti, affondo in feed di testa
|
||||
// altrimenti, affondo in feed opportuna
|
||||
else {
|
||||
SetFeed( GetTipFeed()) ;
|
||||
SetFeed( bOutStart ? GetStartFeed() : GetTipFeed()) ;
|
||||
if ( AddLinearMove( ptP1) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
@@ -1711,7 +1723,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
// aggiungo attacco
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, bInvert, bSplitArcs)) {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : LeadIn not computable") ;
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -1745,7 +1757,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
Point3d ptP1 ;
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, bInvert, bSplitArcs, ptP1)) {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : LeadOut not computable") ;
|
||||
m_pMchMgr->SetLastError( 2310, "Error in Milling : LeadOut not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// se ultimo step aggiungo retrazione per frese normali
|
||||
@@ -1804,6 +1816,8 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
Point3d ptP1 ;
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, false, ptP1))
|
||||
return false ;
|
||||
// determino se l'inizio dell'attacco è fuori dal grezzo
|
||||
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool) ;
|
||||
// aggiungo approccio per frese normali
|
||||
if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
|
||||
// determino elevazione su inizio attacco
|
||||
@@ -1812,11 +1826,16 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
dStElev = dElev ;
|
||||
dStElev -= ( ptP1 - ptStart) * vtExtr ;
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dStElev, dAppr))
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dStElev, dAppr, bOutStart))
|
||||
return false ;
|
||||
}
|
||||
// altrimenti, approccio per lame
|
||||
else {
|
||||
// verifico di entrare in aria
|
||||
if ( ! bOutStart) {
|
||||
m_pMchMgr->SetLastError( 2312, "Error in Milling : LeadIn must be out of rawpart") ;
|
||||
return false ;
|
||||
}
|
||||
// affondo al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
|
||||
@@ -1825,7 +1844,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
// aggiungo attacco
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, false, bSplitArcs)) {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : LeadIn not computable") ;
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -1859,7 +1878,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
Point3d ptP1 ;
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, false, bSplitArcs, ptP1)) {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : LeadOut not computable") ;
|
||||
m_pMchMgr->SetLastError( 2310, "Error in Milling : LeadOut not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// aggiungo retrazione per frese normali
|
||||
@@ -1928,6 +1947,8 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
Point3d ptP1 ;
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, false, ptP1))
|
||||
return false ;
|
||||
// determino se l'inizio dell'attacco è fuori dal grezzo
|
||||
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool) ;
|
||||
// aggiungo approccio per frese normali
|
||||
if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
|
||||
// determino elevazione su inizio attacco
|
||||
@@ -1936,11 +1957,17 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
dStElev = 0 ;
|
||||
dStElev -= ( ptP1 - ptStart) * vtExtr ;
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dStElev, dAppr))
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dStElev, dAppr, bOutStart))
|
||||
return false ;
|
||||
}
|
||||
// altrimenti, affondo al punto iniziale per lame
|
||||
else {
|
||||
// verifico di entrare in aria
|
||||
if ( ! bOutStart) {
|
||||
m_pMchMgr->SetLastError( 2312, "Error in Milling : LeadIn must be out of rawpart") ;
|
||||
return false ;
|
||||
}
|
||||
// eseguo affondamento
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
|
||||
return false ;
|
||||
@@ -1948,7 +1975,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
// aggiungo attacco
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, false, bSplitArcs)) {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : LeadIn not computable") ;
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -1986,7 +2013,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
Point3d ptP1 ;
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, false, bSplitArcs, ptP1)) {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : LeadOut not computable") ;
|
||||
m_pMchMgr->SetLastError( 2310, "Error in Milling : LeadOut not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// aggiungo retrazione per frese normali
|
||||
@@ -2045,8 +2072,10 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), dStElev))
|
||||
dStElev = dElev ;
|
||||
dStElev -= ( ptP1 - ptStart) * vtExtr ;
|
||||
// determino se l'inizio dell'attacco è fuori dal grezzo
|
||||
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool) ;
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dStElev, dAppr))
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dStElev, dAppr, bOutStart))
|
||||
return false ;
|
||||
}
|
||||
// altrimenti, affondo per lame
|
||||
@@ -2058,7 +2087,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
// aggiungo attacco
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtExtr, bInvert, bSplitArcs)) {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : LeadIn not computable") ;
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -2096,7 +2125,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
Point3d ptP1 ;
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, bInvert, bSplitArcs, ptP1)) {
|
||||
LOG_INFO( GetEMkLogger(), "Error in Milling : LeadOut not computable") ;
|
||||
m_pMchMgr->SetLastError( 2310, "Error in Milling : LeadOut not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// aggiungo retrazione per frese normali
|
||||
@@ -2118,7 +2147,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Milling::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr)
|
||||
Milling::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr, bool bOutStart)
|
||||
{
|
||||
SetFlag( 1) ;
|
||||
// se con aggregato da sotto
|
||||
@@ -2164,6 +2193,7 @@ Milling::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
|
||||
Point3d ptP1a = ptP1b + vtTool * ( dSafeZ - dAppr) ;
|
||||
if ( ( ! m_bAggrBottom && AddRapidStart( ptP1a) == GDB_ID_NULL) ||
|
||||
( m_bAggrBottom && AddRapidMove( ptP1a) == GDB_ID_NULL))
|
||||
return false ;
|
||||
// 1b -> punto appena sopra inizio
|
||||
if ( ( dElev + dAppr) > EPS_SMALL) {
|
||||
SetFlag( 0) ;
|
||||
@@ -2173,7 +2203,7 @@ Milling::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
|
||||
}
|
||||
// affondo al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
SetFeed( GetTipFeed()) ;
|
||||
SetFeed( bOutStart ? GetStartFeed() : GetTipFeed()) ;
|
||||
if ( AddLinearMove( ptP) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
@@ -2514,5 +2544,17 @@ double
|
||||
Milling::GetRadiusForStartEndElevation( void)
|
||||
{
|
||||
const double DELTA_ELEV_RAD = 20.0 ;
|
||||
return ( 0.5 * m_TParams.m_dTDiam + DELTA_ELEV_RAD) ;
|
||||
double dDeltaRad = DELTA_ELEV_RAD + max( m_Params.m_dStartAddLen, m_Params.m_dEndAddLen) ;
|
||||
return ( 0.5 * m_TParams.m_dTDiam + dDeltaRad) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Milling::GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool)
|
||||
{
|
||||
// determino se l'inizio dell'attacco è fuori dal grezzo
|
||||
double dTemp ;
|
||||
if ( ! GetElevation( m_nPhase, ptP, vtTool, 0.5 * m_TParams.m_dDiam, dTemp))
|
||||
return false ;
|
||||
return ( dTemp < 10 * EPS_SMALL) ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user