diff --git a/Drilling.cpp b/Drilling.cpp index f4ca07f..2656da9 100644 --- a/Drilling.cpp +++ b/Drilling.cpp @@ -96,7 +96,6 @@ struct HoleInfo { int nIndInSelVector = 0 ; // indice nel vettore m_vId (id fori selezionati) } ; - struct ToolInfo { const ToolData* pTool ; // puntatore per utensile (nullo se utensile non presente) @@ -2110,6 +2109,8 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double GetElevation( m_nPhase, hole.ptIni, hole.vtDir, m_TParams.m_dDiam / 2, hole.vtDir, dElev) ; // determino alcune caratteristiche dell'utensile double dTExtrLen = max( 0.0, m_TParams.m_dTLen - m_TParams.m_dLen) ; + // necessità di spezzatura per robot + bool bSplitArcs = GetSplitArcs( V_NULL) ; // imposto dati comuni SetPathId( nPathId) ; SetToolDir( hole.vtDir) ; @@ -2131,7 +2132,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double 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 @@ -2141,7 +2142,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double return false ; SetFlag( 0) ; } - if ( AddRapidMove( ptP1) == GDB_ID_NULL) + if ( AddRapidMove( ptP1, bSplitArcs) == GDB_ID_NULL) return false ; } else { @@ -2154,7 +2155,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double // 2 -> punto fuori (se diverso dal precedente) if ( m_Params.m_dStartPos < dAppr) { Point3d ptP2 = hole.ptIni + hole.vtDir * ( m_Params.m_dStartPos + dTExtrLen) ; - if ( AddRapidMove( ptP2) == GDB_ID_NULL) + if ( AddRapidMove( ptP2, bSplitArcs) == GDB_ID_NULL) return false ; } // 3 -> punto termine velocità ridotta iniziale (se previsto) @@ -2165,7 +2166,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double Point3d ptP3 = hole.ptIni - hole.vtDir * dStartSlowLen ; if ( ! bStd && ! bEndSlow) ptP3 -= hole.vtDir * dAddLen ; - if ( AddLinearMove( ptP3) == GDB_ID_NULL) + if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL) return false ; } // 4 -> punto termine velocità standard (se risulta) @@ -2176,7 +2177,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double Point3d ptP4 = hole.ptIni - hole.vtDir * ( hole.dLen - dEndSlowLen) ; if ( ! bEndSlow) ptP4 -= hole.vtDir * dAddLen ; - if ( AddLinearMove( ptP4) == GDB_ID_NULL) + if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL) return false ; } // 5 -> punto termine velocità finale ridotta (se previsto) @@ -2184,27 +2185,27 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double SetFeed( GetTipFeed()) ; SetFlag( 101) ; // fondo del foro Point3d ptP5 = hole.ptIni - hole.vtDir * ( hole.dLen + dAddLen) ; - if ( AddLinearMove( ptP5) == GDB_ID_NULL) + if ( AddLinearMove( ptP5, bSplitArcs) == GDB_ID_NULL) return false ; } // 6 -> ritorno all'approccio del foro SetFeed( GetEndFeed()) ; SetFlag( 104) ; // risalita sopra il foro - if ( AddLinearMove( ptP1) == GDB_ID_NULL) + if ( AddLinearMove( ptP1, bSplitArcs) == GDB_ID_NULL) return false ; // 7 -> punto fuori (se uso aggregato da sotto) if ( m_bAggrBottom) { SetFlag( 0) ; Point3d ptP0 = ptP1 + m_vtAggrBottom * ( m_dDistBottom + m_AggrBottom.dEncH + dSafeZ) ; Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAppr + dTExtrLen) ; - if ( AddRapidMove( ptP0, MCH_CL_AGB_OUT) == GDB_ID_NULL) + if ( AddRapidMove( ptP0, bSplitArcs, MCH_CL_AGB_OUT) == GDB_ID_NULL) return false ; // se rinvio da sotto che richiede speciale rotazione if ( m_AggrBottom.nType == 1) { Vector3d vtAux = m_vtAggrBottom ; vtAux.Rotate( Z_AX, 0, 1) ; SetAuxDir( vtAux) ; - if ( AddRapidMove( ptP00, MCH_CL_AGB_UP) == GDB_ID_NULL) + if ( AddRapidMove( ptP00, bSplitArcs, MCH_CL_AGB_UP) == GDB_ID_NULL) return false ; } } @@ -2241,6 +2242,8 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) GetElevation( m_nPhase, hole.ptIni, hole.vtDir, m_TParams.m_dDiam / 2, hole.vtDir, dElev) ; // determino alcune caratteristiche dell'utensile double dTExtrLen = max( 0.0, m_TParams.m_dTLen - m_TParams.m_dLen) ; + // necessità di spezzatura per robot + bool bSplitArcs = GetSplitArcs( V_NULL) ; // imposto dati comuni SetPathId( nPathId) ; SetToolDir( hole.vtDir) ; @@ -2262,7 +2265,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) return false ; SetFlag( 0) ; SetAuxDir( m_vtAggrBottom) ; - 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 @@ -2272,7 +2275,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) return false ; SetFlag( 0) ; } - if ( AddRapidMove( ptP1) == GDB_ID_NULL) + if ( AddRapidMove( ptP1, bSplitArcs) == GDB_ID_NULL) return false ; } else { @@ -2283,7 +2286,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) // 2 -> punto fuori (se diverso dal precedente) if ( m_Params.m_dStartPos < dAppr) { Point3d ptP2 = hole.ptIni + hole.vtDir * ( m_Params.m_dStartPos + dTExtrLen) ; - if ( AddRapidMove( ptP2) == GDB_ID_NULL) + if ( AddRapidMove( ptP2, bSplitArcs) == GDB_ID_NULL) return false ; } // ciclo di affondamento a step @@ -2303,13 +2306,13 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) SetFeed( GetEndFeed()) ; SetFlag( 103) ; // punto di scarico truciolo Point3d ptPr = hole.ptIni + hole.vtDir * dReturnPos ; - if ( AddLinearMove( ptPr) == GDB_ID_NULL) + if ( AddLinearMove( ptPr, bSplitArcs) == GDB_ID_NULL) return false ; // riaffondo SetFeed( GetEndFeed()) ; SetFlag( 0) ; Point3d ptPa = hole.ptIni - hole.vtDir * ( dCurrLen - APPR_STEP) ; - if ( AddLinearMove( ptPa) == GDB_ID_NULL) + if ( AddLinearMove( ptPa, bSplitArcs) == GDB_ID_NULL) return false ; } // lunghezza di fine step @@ -2332,7 +2335,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) Point3d ptP3 = hole.ptIni - hole.vtDir * dLen ; if ( bHoleEnd) ptP3 -= hole.vtDir * dAddLen ; - if ( AddLinearMove( ptP3) == GDB_ID_NULL) + if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL) return false ; // aggiorno posizione e verifico se step completato dCurrLen = dLen ; @@ -2357,7 +2360,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) Point3d ptP4 = hole.ptIni - hole.vtDir * dLen ; if ( bHoleEnd) ptP4 -= hole.vtDir * dAddLen ; - if ( AddLinearMove( ptP4) == GDB_ID_NULL) + if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL) return false ; // aggiorno posizione e verifico se step completato dCurrLen = dLen ; @@ -2381,7 +2384,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) Point3d ptP5 = hole.ptIni - hole.vtDir * dLen ; if ( bHoleEnd) ptP5 -= hole.vtDir * dAddLen ; - if ( AddLinearMove( ptP5) == GDB_ID_NULL) + if ( AddLinearMove( ptP5, bSplitArcs) == GDB_ID_NULL) return false ; // aggiorno posizione dCurrLen = dLen ; @@ -2391,7 +2394,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) // 6 -> ritorno all'approccio del foro SetFeed( GetEndFeed()) ; SetFlag( 104) ; // risalita sopra il foro - if ( AddLinearMove( ptP1) == GDB_ID_NULL) + if ( AddLinearMove( ptP1, bSplitArcs) == GDB_ID_NULL) return false ; // 7 -> punto fuori (se uso aggregato da sotto) @@ -2399,14 +2402,14 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) SetFlag( 0) ; Point3d ptP0 = ptP1 + m_vtAggrBottom * ( m_dDistBottom + m_AggrBottom.dEncH + dSafeZ) ; Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAppr + dTExtrLen) ; - if ( AddRapidMove( ptP0, MCH_CL_AGB_OUT) == GDB_ID_NULL) + if ( AddRapidMove( ptP0, bSplitArcs, MCH_CL_AGB_OUT) == GDB_ID_NULL) return false ; // se rinvio da sotto che richiede speciale rotazione if ( m_AggrBottom.nType == 1) { Vector3d vtAux = m_vtAggrBottom ; vtAux.Rotate( Z_AX, 0, 1) ; SetAuxDir( vtAux) ; - if ( AddRapidMove( ptP00, MCH_CL_AGB_UP) == GDB_ID_NULL) + if ( AddRapidMove( ptP00, bSplitArcs, MCH_CL_AGB_UP) == GDB_ID_NULL) return false ; } } diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index bc956e2..9e60c41 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ diff --git a/GeoConst.h b/GeoConst.h index d73c9e6..4b3b058 100644 --- a/GeoConst.h +++ b/GeoConst.h @@ -20,8 +20,9 @@ const double LIN_TOL_STD = 0.1 ; const double LIN_TOL_MID = 0.05 ; const double LIN_TOL_RAW = 0.5 ; -const double ANG_TOL_MAX_DEG = 90 ; const double ANG_TOL_STD_DEG = 15 ; +const double ANG_TOL_MID_DEG = 45 ; +const double ANG_TOL_MAX_DEG = 90 ; const double LIN_FEA_STD = 20 ; //----------- Costante per offset salva spigoli di lama su cornici curve ---- diff --git a/MachMgr.h b/MachMgr.h index 67e67f1..e1808ca 100644 --- a/MachMgr.h +++ b/MachMgr.h @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2023 +// EgalTech 2015-2024 //---------------------------------------------------------------------------- -// File : MachMgr.h Data : 28.10.23 Versione : 2.5j4 +// File : MachMgr.h Data : 30.03.24 Versione : 2.6d1 // Contenuto : Dichiarazione della classe MachMgr. // // @@ -13,6 +13,7 @@ // 21.09.22 DS Aggiunta GetAxisOffset. // 25.08.23 DS Aggiunta CopyMachGroup. // 28.10.23 DS Aggiunte GetClEntAxesVal e GetToolSetupPosInCurrSetup. +// 30.03.24 DS Aggiunte GetAllAxesNames e GetCalcTable. // //---------------------------------------------------------------------------- @@ -327,9 +328,10 @@ class MachMgr : public IMachMgr // Machine Calc bool SetCalcTable( const std::string& sTable) override ; bool SetCalcTool( const std::string& sTool, const std::string& sHead, int nExit) override ; - bool GetAllCurrAxesName( STRVECTOR& vAxName) const override ; + bool GetAllCurrAxesNames( STRVECTOR& vAxName) const override ; bool SetRotAxisBlock( const std::string& sAxis, double dVal) override ; bool GetRotAxisBlocked( int nInd, std::string& sAxis, double& dVal) const override ; + bool GetCalcTable( std::string& sTable) const override ; bool GetCalcTool( std::string& sTool) const override ; bool GetCalcHead( std::string& sHead) const override ; bool GetCalcExit( int& nExit) const override ; @@ -370,6 +372,7 @@ class MachMgr : public IMachMgr bool ResetAxisPos( const std::string& sAxis) override ; bool ResetAllAxesPos( void) override ; bool GetAllTablesNames( STRVECTOR& vNames) const override ; + bool GetAllAxesNames( STRVECTOR& vNames) const override ; bool GetAllHeadsNames( STRVECTOR& vNames) const override ; bool GetAllTcPosNames( STRVECTOR& vNames) const override ; bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) override ; diff --git a/MachMgrDBMachinings.cpp b/MachMgrDBMachinings.cpp index af04225..2649d99 100644 --- a/MachMgrDBMachinings.cpp +++ b/MachMgrDBMachinings.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2015 +// EgalTech 2015-2024 //---------------------------------------------------------------------------- -// File : MachMgrDBMachinings.cpp Data : 11.11.15 Versione : 1.6k5 +// File : MachMgrDBMachinings.cpp Data : 29.03.24 Versione : 2.6d1 // Contenuto : Implementazione gestione DB lavorazioni della classe MachMgr. // // @@ -304,6 +304,8 @@ MachMgr::MdbSetGeneralParam( int nType, double dVal) return pMsMgr->SetSafeAggrBottZ( dVal) ; case MGP_MAXDEPTHSAFE : return pMsMgr->SetMaxDepthSafe( dVal) ; + case MGP_APPROXLINTOL : + return pMsMgr->SetApproxLinTol( dVal) ; } return false ; } @@ -379,6 +381,9 @@ MachMgr::MdbGetGeneralParam( int nType, double& dVal) const case MGP_MAXDEPTHSAFE : dVal = pMsMgr->GetMaxDepthSafe() ; return true ; + case MGP_APPROXLINTOL : + dVal = pMsMgr->GetApproxLinTol() ; + return true ; } return false ; } diff --git a/MachMgrMachines.cpp b/MachMgrMachines.cpp index 7c5f4cb..ef4ba1b 100644 --- a/MachMgrMachines.cpp +++ b/MachMgrMachines.cpp @@ -534,6 +534,14 @@ MachMgr::SetCalcSolCh( int nScc, bool bExact) return pMch->SetSolCh( nScc, bExact) ; } +//---------------------------------------------------------------------------- +bool +MachMgr::GetCalcTable( string& sTable) const +{ + Machine* pMch = GetCurrMachine() ; + return ( ( pMch != nullptr) ? pMch->GetCurrTable( sTable) : false) ; +} + //---------------------------------------------------------------------------- bool MachMgr::GetCalcTool( string& sTool) const @@ -609,6 +617,17 @@ MachMgr::GetAllTablesNames( STRVECTOR& vNames) const return ( ( pMch != nullptr) ? pMch->GetAllTablesNames( vNames) : false) ; } +//---------------------------------------------------------------------------- +bool +MachMgr::GetAllAxesNames( STRVECTOR& vNames) const +{ + // pulisco il vettore + vNames.clear() ; + // richiedo elenco assi alla macchina corrente + Machine* pMch = GetCurrMachine() ; + return ( ( pMch != nullptr) ? pMch->GetAllAxesNames( vNames) : false) ; +} + //---------------------------------------------------------------------------- bool MachMgr::GetAllHeadsNames( STRVECTOR& vNames) const @@ -649,10 +668,10 @@ MachMgr::GetCurrRotAxes( void) const //---------------------------------------------------------------------------- bool -MachMgr::GetAllCurrAxesName( STRVECTOR& vAxName) const +MachMgr::GetAllCurrAxesNames( STRVECTOR& vAxName) const { Machine* pMch = GetCurrMachine() ; - return ( ( pMch != nullptr) ? pMch->GetAllCurrAxesName( vAxName) : false) ; + return ( ( pMch != nullptr) ? pMch->GetAllCurrAxesNames( vAxName) : false) ; } //---------------------------------------------------------------------------- diff --git a/Machine.h b/Machine.h index 561905e..896ffdd 100644 --- a/Machine.h +++ b/Machine.h @@ -61,6 +61,7 @@ class Machine { int nId = GetGroup( sTcPos) ; return ( IsTcPosGroup( nId) ? nId : GDB_ID_NULL) ; } bool GetAllTablesNames( STRVECTOR& vNames) const ; + bool GetAllAxesNames( STRVECTOR& vNames) const ; bool GetAllHeadsNames( STRVECTOR& vNames) const ; bool GetAllTcPosNames( STRVECTOR& vNames) const ; int GetFirstTable( void) const ; @@ -122,9 +123,9 @@ class Machine int GetCurrLinAxes( void) const ; int GetCurrRotAxes( void) const ; bool GetCurrAxisName( int nInd, std::string& sAxName) const ; - bool GetAllCurrAxesName( STRVECTOR& vAxName) const ; + bool GetAllCurrAxesNames( STRVECTOR& vAxName) const ; bool GetCurrAxisToken( int nInd, std::string& sAxToken) const ; - bool GetAllCurrAxesToken( STRVECTOR& vAxToken) const ; + bool GetAllCurrAxesTokens( STRVECTOR& vAxToken) const ; bool GetCurrAxisMin( int nInd, double& dMin) const ; bool GetCurrAxisMax( int nInd, double& dMax) const ; bool GetCurrAxisOffset( int nInd, double& dOffset) const ; diff --git a/MachineAxes.cpp b/MachineAxes.cpp index 8a1fcce..c74522a 100644 --- a/MachineAxes.cpp +++ b/MachineAxes.cpp @@ -23,6 +23,22 @@ using namespace std ; +//---------------------------------------------------------------------------- +bool +Machine::GetAllAxesNames( STRVECTOR& vNames) const +{ + // reset lista nomi + vNames.clear() ; + // ricerca degli assi + for ( const auto& snGro : m_mapGroups) { + if ( IsAxisGroup( snGro.second)) + vNames.push_back( snGro.first) ; + } + // ordino alfabeticamente + sort( vNames.begin(), vNames.end()) ; + return true ; +} + //---------------------------------------------------------------------------- bool Machine::GetAxisToken( const string& sAxis, string& sToken) const diff --git a/MachineCalc.cpp b/MachineCalc.cpp index 9eb9f90..dc1d8c3 100644 --- a/MachineCalc.cpp +++ b/MachineCalc.cpp @@ -1830,7 +1830,7 @@ Machine::GetCurrAxisName( int nInd, string& sAxName) const //---------------------------------------------------------------------------- bool -Machine::GetAllCurrAxesName( STRVECTOR& vAxName) const +Machine::GetAllCurrAxesNames( STRVECTOR& vAxName) const { vAxName.clear() ; bool bOk = true ; @@ -1879,7 +1879,7 @@ Machine::GetCurrAxisToken( int nInd, string& sAxToken) const //---------------------------------------------------------------------------- bool -Machine::GetAllCurrAxesToken( STRVECTOR& vAxToken) const +Machine::GetAllCurrAxesTokens( STRVECTOR& vAxToken) const { vAxToken.clear() ; bool bOk = true ; diff --git a/Machining.cpp b/Machining.cpp index 7436a6f..66afae6 100644 --- a/Machining.cpp +++ b/Machining.cpp @@ -148,6 +148,15 @@ Machining::PrepareToolPreview( void) const int nId = m_pGeomDB->CopyGlob( nHeadId, GDB_ID_NULL, nStId) ; m_pGeomDB->SetMode( nId, GDB_MD_STD) ; m_pGeomDB->SetStatus( nId, GDB_ST_OFF) ; + // elimino eventuali gruppi opportunamente indicati + int nSubId = m_pGeomDB->GetFirstGroupInGroup( nId) ; + while ( nSubId != GDB_ID_NULL) { + int nNextSubId = m_pGeomDB->GetNextGroup( nSubId) ; + bool bShow = true ; + if ( m_pGeomDB->GetInfo( nSubId, KEY_PREVIEWSHOW, bShow) && ! bShow) + m_pGeomDB->Erase( nSubId) ; + nSubId = nNextSubId ; + } return ( nId != GDB_ID_NULL) ; } diff --git a/MachiningsMgr.cpp b/MachiningsMgr.cpp index 0109d16..650c331 100644 --- a/MachiningsMgr.cpp +++ b/MachiningsMgr.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2022 +// EgalTech 2015-2024 //---------------------------------------------------------------------------- -// File : MachiningsMgr.cpp Data : 04.02.22 Versione : 2.4b1 +// File : MachiningsMgr.cpp Data : 29.03.24 Versione : 2.6d1 // Contenuto : Implementazione gestore database lavorazioni. // // @@ -16,6 +16,7 @@ // 22.06.20 DS Agg. per nuovi parametri attacco tagli di lama (MF_CURR_VER = 1010). // 09.11.20 DS Agg. per nuovi parametri tagli di lama (MF_CURR_VER = 1011). // 04.02.22 DS Agg. per nuovi parametri svuotature con epicicli (MF_CURR_VER = 1012). +// 29.03.24 DS Agg. parametro APPROX_LINTOL (MF_CURR_VER = 1013). // //---------------------------------------------------------------------------- @@ -42,7 +43,7 @@ const string MF_HEADER = "[HEADER]" ; const string MF_VERSION = "VERSION" ; const string MF_TOTAL = "TOTAL" ; const string MF_SIZE = "SIZE" ; -const int MF_CURR_VER = 1012 ; +const int MF_CURR_VER = 1013 ; const string MF_GENERAL = "[GENERAL]" ; const string MF_3AXCOMP = "3AXCOMP" ; const bool MF_CURR_3AXCOMP = false ; @@ -64,6 +65,8 @@ const string MF_INTSAWARCMAXSIDEANG = "INTSAWARCMAXSIDEANG" ; const double MF_CURR_INTSAWARCMAXSIDEANG = 45 ; const string MF_SPLITARCS = "SPLITARCS" ; const int MF_CURR_SPLITARCS = SPLAR_NEVER ; +const string MF_APPROX_LINTOL = "APPROX_LINTOL" ; +const double MF_CURR_APPROX_LINTOL = 0.05 ; const string MF_MAXDEPTHSAFE = "MAXDEPTHSAFE" ; const double MF_CURR_MAXDEPTHSAFE = 2.0 ; @@ -85,6 +88,7 @@ MachiningsMgr::MachiningsMgr( void) m_dExtSawArcMinRad = MF_CURR_EXTSAWARCMINRAD ; m_dIntSawArcMaxSideAng = MF_CURR_INTSAWARCMAXSIDEANG ; m_nSplitArcs = MF_CURR_SPLITARCS ; + m_dApproxLinTol = MF_CURR_APPROX_LINTOL ; m_dMaxDepthSafe = MF_CURR_MAXDEPTHSAFE ; } @@ -312,6 +316,8 @@ MachiningsMgr::LoadGeneral( Scanner& TheScanner, bool& bEnd) bOk = FromString( sVal, m_dIntSawArcMaxSideAng) ; else if ( ToUpper( sKey) == MF_SPLITARCS) bOk = FromString( sVal, m_nSplitArcs) ; + else if ( ToUpper( sKey) == MF_APPROX_LINTOL) + bOk = FromString( sVal, m_dApproxLinTol) ; else if ( ToUpper( sKey) == MF_MAXDEPTHSAFE) bOk = FromString( sVal, m_dMaxDepthSafe) ; else @@ -499,6 +505,10 @@ MachiningsMgr::SaveGeneral( Writer& TheWriter) const sOut = MF_MAXDEPTHSAFE + "=" + ToString( m_dMaxDepthSafe) ; bOk = bOk && TheWriter.OutText( sOut) ; } + if ( m_nDbVer >= 1013) { + sOut = MF_APPROX_LINTOL + "=" + ToString( m_dApproxLinTol) ; + bOk = bOk && TheWriter.OutText( sOut) ; + } return bOk ; } @@ -1175,6 +1185,20 @@ MachiningsMgr::SetSplitArcs( int nFlag) return true ; } +//---------------------------------------------------------------------------- +bool +MachiningsMgr::SetApproxLinTol( double dLinTol) +{ + // verifico non sia inferiore al minimo + dLinTol = max( dLinTol, EPS_SMALL) ; + // se cambiato, salvo e setto modifica + if ( abs( dLinTol - m_dApproxLinTol) > EPS_SMALL) { + m_dApproxLinTol = dLinTol ; + m_bModified = true ; + } + return true ; +} + //---------------------------------------------------------------------------- bool MachiningsMgr::SetMaxDepthSafe( double dSafe) diff --git a/MachiningsMgr.h b/MachiningsMgr.h index 706ae64..4eedd7f 100644 --- a/MachiningsMgr.h +++ b/MachiningsMgr.h @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2015 +// EgalTech 2015-2024 //---------------------------------------------------------------------------- -// File : MachiningsMgr.h Data : 02.06.15 Versione : 1.6f1 +// File : MachiningsMgr.h Data : 29.03.24 Versione : 2.6d1 // Contenuto : Dichiarazione della classe MachiningsMgr. // // @@ -79,6 +79,9 @@ class MachiningsMgr bool SetSplitArcs( int nFlag) ; int GetSplitArcs( void) const { return m_nSplitArcs ; } + bool SetApproxLinTol( double dLinTol) ; + double GetApproxLinTol( void) const + { return m_dApproxLinTol ; } bool SetMaxDepthSafe( double dSafe) ; double GetMaxDepthSafe( void) const { return m_dMaxDepthSafe ; } @@ -131,5 +134,6 @@ class MachiningsMgr double m_dExtSawArcMinRad ; double m_dIntSawArcMaxSideAng ; int m_nSplitArcs ; + double m_dApproxLinTol ; double m_dMaxDepthSafe ; } ; \ No newline at end of file diff --git a/Milling.cpp b/Milling.cpp index 1ae4c05..1fa4f16 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -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 pCrv( GetArc2PVN( ptStart, ptMid, - vtStart, vtTool)) ; if ( IsNull( pCrv)) return false ; pCrv->Invert() ; - // eventuale spezzatura - if ( bSplitArcs) { - PtrOwner 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 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 pArc( CreateCurveArc()) ; if ( IsNull( pArc) || ! pArc->Set( ptCen, vtTool, dRad, - vtCen, dAngCen, dDeltaN)) return false ; - // eventuale spezzatura - if ( bSplitArcs) { - PtrOwner 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 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) ; diff --git a/Milling.h b/Milling.h index 7a916df..a6c0ada 100644 --- a/Milling.h +++ b/Milling.h @@ -99,10 +99,11 @@ class Milling : public Machining bool AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep, bool bSplitArcs) ; bool 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) ; bool AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, const Vector3d& vtTool, - double dSafeZ, double dSawStElev, double dStElev, double dAppr, bool bAddInsert = false) ; - bool AddDirectApproach( const Point3d& ptP) ; + double dSafeZ, double dSawStElev, double dStElev, double dAppr, + bool bFirst, bool bSplitArcs, bool bAddInsert = false) ; + bool AddDirectApproach( const Point3d& ptP, bool bSplitArcs) ; bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ, double dElev, double dAppr, bool bAboveEnd) ; bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, const Vector3d& vtTool, diff --git a/Mortising.cpp b/Mortising.cpp index 1a8de01..ba467e7 100644 --- a/Mortising.cpp +++ b/Mortising.cpp @@ -1570,7 +1570,7 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co int nFirstFlag = ( bFirst ? 1 : 0) ; SetFlag( nFirstFlag) ; Point3d ptP1 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + dStartElev + dSafeZ) ; - int nStart = ( bFirst ? AddRapidStart( ptP1) : AddRapidMove( ptP1)) ; + int nStart = AddRapidStartOrMove( ptP1, bFirst) ; if ( nStart == GDB_ID_NULL) return false ; SetFlag( 0) ; diff --git a/Operation.cpp b/Operation.cpp index 2ff83c3..e4c54ff 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -1242,7 +1242,7 @@ Operation::ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp) //---------------------------------------------------------------------------- bool -Operation::ApproxWithLines( ICurveComposite* pCompo, double dMaxLen) const +Operation::ApproxWithLines( ICurveComposite* pCompo, bool bFeed) const { // recupero estrusione e spessore Vector3d vtExtr = Z_AX ; @@ -1251,10 +1251,12 @@ Operation::ApproxWithLines( ICurveComposite* pCompo, double dMaxLen) const pCompo->GetThickness( dThick) ; // calcolo approssimazione lineare PolyLine PL ; - if ( ! pCompo->ApproxWithLines( 50 * EPS_SMALL, ANG_TOL_MAX_DEG, ICurve::APL_SPECIAL, PL)) + double dLinTol = GetApproxLinTol() ; + if ( ! pCompo->ApproxWithLines( dLinTol, ANG_TOL_MID_DEG, ICurve::APL_SPECIAL, PL)) return false ; // se prevista massima lunghezza - if ( dMaxLen > 100 * EPS_SMALL) + double dMaxLen = GetMaxSplitLen( true, bFeed) ; + if ( dMaxLen > 99 * EPS_SMALL) PL.AdjustForMaxSegmentLen( dMaxLen) ; // sostituisco le linee alle curve originali pCompo->Clear() ; @@ -2281,21 +2283,45 @@ Operation::CalculateClPathRobotAxesValues( int nClPathId, int nLinAxes, int nRot pCamData->SetAxes( CamData::AS_ERR, vAxVal) ; return false ; } - // se inizio, scelgo la prima soluzione + // se inizio if ( bFirst) { - vAxVal = vAng1 ; + // porto gli angoli ai valori più vicini ai precedenti con offset di uno o più giri + for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) { + m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ; + if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome) + m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ; + } + for ( int i = 0 ; i < int( vAng2.size()) ; ++ i) { + m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng2[i]) ; + if ( abs( vAng2[i] - vAxRotPrec[i]) > dAngDeltaMinForHome) + m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ; + } bFirst = false ; } - // altrimenti, scelgo la soluzione più vicina + // altrimenti movimenti successivi else { - // minimizzo rotazione polso - if ( abs( vAng1[3] - vAxRotPrec[3]) < abs( vAng2[3] - vAxRotPrec[3]) + 10 * EPS_ANG_SMALL) - vAxVal = vAng1 ; - else - vAxVal = vAng2 ; - // controllo continuità di R6 dalla posizione precedente - m_pMchMgr->GetNearestAngleInStroke( 5, vAxRotPrec[5], vAxVal[5]) ; + // porto gli angoli ai valori più vicini ai precedenti con offset di uno o più giri + for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) { + if ( bRotContOnNext) + vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ; + else + m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ; + } + for ( int i = 0 ; i < int( vAng2.size()) ; ++ i) { + if ( bRotContOnNext) + vAng2[i] = AngleNearAngle( vAng2[i], vAxRotPrec[i]) ; + else + m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng2[i]) ; + } } + // Scelgo la soluzione più vicina + // minimizzo rotazione polso + if ( vAng2.empty() || abs( vAng1[3] - vAxRotPrec[3]) < abs( vAng2[3] - vAxRotPrec[3]) + 10 * EPS_ANG_SMALL) + vAxVal = vAng1 ; + else + vAxVal = vAng2 ; + // controllo continuità di R6 dalla posizione precedente + m_pMchMgr->GetNearestAngleInStroke( 5, vAxRotPrec[5], vAxVal[5]) ; // verifico di essere nelle corse degli assi int nStat ; bool bOsOk = m_pMchMgr->VerifyOutstroke( 0, 0, 0, vAxVal, false, nStat) ; @@ -3435,18 +3461,23 @@ Operation::CalcRobotAxesAbovePos( const Point3d& ptP, const Vector3d& vtT, const if ( vAx.size() < 6) { vAx = vAng1 ; } - // altrimenti, scelgo la soluzione più vicina - else { - // salvo precedente R6 - double dPrevR6 = vAx[5] ; - // minimizzo rotazione polso - if ( abs( vAng1[3] - vAx[3]) < abs( vAng2[3] - vAx[3]) + 10 * EPS_ANG_SMALL) - vAx = vAng1 ; - else - vAx = vAng2 ; - // controllo continuità di R6 dalla posizione precedente - m_pMchMgr->GetNearestAngleInStroke( 5, dPrevR6, vAx[5]) ; - } + // altrimenti, scelgo la soluzione più vicina + else { + // porto gli angoli ai valori più vicini ai precedenti con offset di uno o più giri + for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) + m_pMchMgr->GetNearestAngleInStroke( i, vAx[i], vAng1[i]) ; + for ( int i = 0 ; i < int( vAng2.size()) ; ++ i) + m_pMchMgr->GetNearestAngleInStroke( i, vAx[i], vAng2[i]) ; + // salvo precedente R6 + double dPrevR6 = vAx[5] ; + // minimizzo rotazione polso + if ( vAng2.empty() || abs( vAng1[3] - vAx[3]) < abs( vAng2[3] - vAx[3]) + 10 * EPS_ANG_SMALL) + vAx = vAng1 ; + else + vAx = vAng2 ; + // controllo continuità di R6 dalla posizione precedente + m_pMchMgr->GetNearestAngleInStroke( 5, dPrevR6, vAx[5]) ; + } // verifico di essere nelle corse degli assi int nStat ; if ( ! m_pMchMgr->VerifyOutstroke( 0, 0, 0, vAx, false, nStat) || nStat != 0) @@ -3754,7 +3785,7 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn return false ; // Recupero assi correnti e ne verifico la costanza STRVECTOR vAxName ; - pMch->GetAllCurrAxesName( vAxName) ; + pMch->GetAllCurrAxesNames( vAxName) ; if ( vAxName.size() != vAxStart.size() || vAxName.size() != vAxEnd.size()) return false ; // Porto la macchina in home diff --git a/Operation.h b/Operation.h index 6d4ce72..d734a5d 100644 --- a/Operation.h +++ b/Operation.h @@ -14,6 +14,7 @@ #pragma once +#include "MachMgr.h" #include "MachConst.h" #include "MachineStruConst.h" #include "/EgtDev/Include/EGkPoint3d.h" @@ -21,7 +22,6 @@ #include "/EgtDev/Include/EGkSelection.h" #include "/EgtDev/Include/EgtNumCollection.h" -class MachMgr ; class CamData ; class ICurve ; class ICurveComposite ; @@ -43,7 +43,7 @@ class Operation : public IUserObj virtual int GetPhase( void) const { return m_nPhase ; } virtual bool RemoveHome( void) ; - std::string GetName( void) const ; + std::string GetName( void) const ; public : virtual int GetType( void) const = 0 ; @@ -61,6 +61,21 @@ class Operation : public IUserObj { return true ; } virtual bool AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCen) const { return true ; } + virtual bool NeedSplit( bool bSplit = true, bool bFeed = true) const + { return ( bSplit && ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot())) ; } + virtual double GetMaxSplitLen( bool bSplit = true, bool bFeed = true) const + { return ( bSplit && ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot()) ? ( bFeed ? 5 : 50) : 0) ; } + virtual bool GetSplitArcs( const Vector3d& vtTool) const + { if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot()) + return true ; + int nSplitArcs = m_pMchMgr->GetCurrMachiningsMgr()->GetSplitArcs() ; + return ( nSplitArcs == SPLAR_ALWAYS || + ( nSplitArcs == SPLAR_NO_XY_PLANE && ! vtTool.IsZplus()) || + ( nSplitArcs == SPLAR_GEN_PLANE && vtTool.IsGeneric())) ; } + virtual double GetApproxLinTol( void) const + { if ( m_pMchMgr == nullptr) + return 50 * EPS_SMALL ; + return m_pMchMgr->GetCurrMachiningsMgr()->GetApproxLinTol() ; } protected : Operation( void) ; @@ -105,7 +120,7 @@ class Operation : public IUserObj bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, double dToolThick, int nGrade = 3) ; bool ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp = false) const ; - bool ApproxWithLines( ICurveComposite* pCompo, double dMaxLen = 0) const ; + bool ApproxWithLines( ICurveComposite* pCompo, bool bFeed = true) const ; bool VerifyArcs( ICurveComposite* pCompo, double dMaxAngCen = MAX_ANG_CEN) const ; bool CalcAndSetBBox( int nClId) ; @@ -198,12 +213,26 @@ class Operation : public IUserObj int AddRapidStart( const Point3d& ptP, const std::string& sName) ; int AddRapidMove( const Point3d& ptP) ; int AddRapidMove( const Point3d& ptP, const std::string& sName) ; + int AddRapidMove( const Point3d& ptP, bool bSplit) ; + int AddRapidMove( const Point3d& ptP, bool bSplit, const std::string& sName) ; + int AddRapidStartOrMove( const Point3d& ptP, bool bFirst) + { return ( bFirst ? AddRapidStart( ptP) : AddRapidMove( ptP)) ; } + int AddRapidStartOrMove( const Point3d& ptP, bool bFirst, const std::string& sName) + { return ( bFirst ? AddRapidStart( ptP, sName) : AddRapidMove( ptP, sName)) ; } + int AddRapidStartOrMove( const Point3d& ptP, bool bFirst, bool bSplit) + { return ( bFirst ? AddRapidStart( ptP) : AddRapidMove( ptP, bSplit)) ; } + int AddRapidStartOrMove( const Point3d& ptP, bool bFirst, bool bSplit, const std::string& sName) + { return ( bFirst ? AddRapidStart( ptP, sName) : AddRapidMove( ptP, bSplit, sName)) ; } int AddLinearMove( const Point3d& ptP) ; int AddLinearMove( const Point3d& ptP, const std::string& sName) ; + int AddLinearMove( const Point3d& ptP, bool bSplit) ; + int AddLinearMove( const Point3d& ptP, bool bSplit, const std::string& sName) ; int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN) ; int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN, const std::string& sName) ; - int AddCurveMove( const ICurve* pCrv, bool bOnlySimple = false) ; - int AddCurveMove( const ICurve* pCrv, const std::string& sName, bool bOnlySimple = false) ; + int AddCurveMove( const ICurve* pCrv) ; + int AddCurveMove( const ICurve* pCrv, const std::string& sName) ; + int AddCurveMove( const ICurve* pCrv, bool bSplit) ; + int AddCurveMove( const ICurve* pCrv, bool bSplit, const std::string& sName) ; bool ResetMoveData( void) ; protected : diff --git a/OperationCL.cpp b/OperationCL.cpp index f1fa3a3..e031620 100644 --- a/OperationCL.cpp +++ b/OperationCL.cpp @@ -212,6 +212,46 @@ Operation::AddRapidMove( const Point3d& ptP, const string& sName) return nId ; } +//---------------------------------------------------------------------------- +int +Operation::AddRapidMove( const Point3d& ptP, bool bSplit) +{ + // se non richiesta spezzatura con massima lunghezza, emissione normale + if ( ! NeedSplit( bSplit)) + return AddRapidMove( ptP) ; + // altrimenti opportuna spezzatura + Point3d ptS ; + if ( ! GetCurrPos( ptS)) + return GDB_ID_NULL ; + double dLen = Dist( ptS, ptP) ; + double dStep = GetMaxSplitLen( true, false) ; + int nStep = int( dLen / dStep + 0.999) ; + int nFirstId = GDB_ID_NULL ; + for ( int i = 1 ; i <= nStep ; ++ i) { + int nId = AddRapidMove( Media( ptS, ptP, i * 1.0 / nStep)) ; + if ( nId == GDB_ID_NULL) + return GDB_ID_NULL ; + if ( nFirstId == GDB_ID_NULL) + nFirstId = nId ; + SetFlag( 0) ; + SetFlag2( 0) ; + } + return nFirstId ; +} + +//---------------------------------------------------------------------------- +int +Operation::AddRapidMove( const Point3d& ptP, bool bSplit, const string& sName) +{ + int nFirstId = AddRapidMove( ptP, bSplit) ; + int nId = nFirstId ; + while ( nId != GDB_ID_NULL) { + m_pGeomDB->SetName( nId, sName) ; + nId = m_pGeomDB->GetNext( nId) ; + } + return nFirstId ; +} + //---------------------------------------------------------------------------- int Operation::AddLinearMove( const Point3d& ptP) @@ -270,6 +310,44 @@ Operation::AddLinearMove( const Point3d& ptP, const string& sName) return nId ; } +//---------------------------------------------------------------------------- +int +Operation::AddLinearMove( const Point3d& ptP, bool bSplit) +{ + // se non richiesta spezzatura con massima lunghezza, emissione normale + if ( ! NeedSplit( bSplit)) + return AddLinearMove( ptP) ; + // altrimenti opportuna spezzatura + Point3d ptS ; + if ( ! GetCurrPos( ptS)) + return GDB_ID_NULL ; + double dLen = Dist( ptS, ptP) ; + double dStep = GetMaxSplitLen( true, true) ; + int nStep = int( dLen / dStep + 0.999) ; + int nFirstId = GDB_ID_NULL ; + for ( int i = 1 ; i <= nStep ; ++ i) { + int nId = AddLinearMove( Media( ptS, ptP, i * 1.0 / nStep)) ; + if ( nId == GDB_ID_NULL) + return GDB_ID_NULL ; + if ( nFirstId == GDB_ID_NULL) + nFirstId = nId ; + } + return nFirstId ; +} + +//---------------------------------------------------------------------------- +int +Operation::AddLinearMove( const Point3d& ptP, bool bSplit, const string& sName) +{ + int nFirstId = AddLinearMove( ptP, bSplit) ; + int nId = nFirstId ; + while ( nId != GDB_ID_NULL) { + m_pGeomDB->SetName( nId, sName) ; + nId = m_pGeomDB->GetNext( nId) ; + } + return nFirstId ; +} + //---------------------------------------------------------------------------- int Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN) @@ -346,7 +424,7 @@ Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, //---------------------------------------------------------------------------- int -Operation::AddCurveMove( const ICurve* pCrv, bool bOnlySimple) +Operation::AddCurveMove( const ICurve* pCrv) { // verifico che la curva esista if ( pCrv == nullptr) @@ -367,8 +445,8 @@ Operation::AddCurveMove( const ICurve* pCrv, bool bOnlySimple) pArc->GetEndPoint( ptP3) ; return AddArcMove( ptP3, ptCen, dAngCen, vtN) ; } - // se ammesse curve composite - else if ( ! bOnlySimple) { + // se arco o curva composita + else if ( pCrv->GetType() == CRV_ARC || pCrv->GetType() == CRV_COMPO) { // in ogni caso, converto in archi e rette PtrOwner pCompo( CreateCurveComposite()) ; if ( ! pCompo->AddCurve( *pCrv)) @@ -407,16 +485,43 @@ Operation::AddCurveMove( const ICurve* pCrv, bool bOnlySimple) } return nFirstId ; } - // altrimenti + // altre curve non ammesse else return GDB_ID_NULL ; } //---------------------------------------------------------------------------- int -Operation::AddCurveMove( const ICurve* pCrv, const string& sName, bool bOnlySimple) +Operation::AddCurveMove( const ICurve* pCrv, const string& sName) { - int nFirstId = AddCurveMove( pCrv, bOnlySimple) ; + int nFirstId = AddCurveMove( pCrv) ; + int nId = nFirstId ; + while ( nId != GDB_ID_NULL) { + m_pGeomDB->SetName( nId, sName) ; + nId = m_pGeomDB->GetNext( nId) ; + } + return nFirstId ; +} + +//---------------------------------------------------------------------------- +int +Operation::AddCurveMove( const ICurve* pCrv, bool bSplit) +{ + // se non richiesta spezzatura, emissione normale + if ( ! bSplit) + return AddCurveMove( pCrv) ; + // altrimenti opportuna spezzatura + PtrOwner pCompo ; + if ( ! pCompo.Set( ConvertCurveToComposite( pCrv->Clone())) || ! ApproxWithLines( pCompo)) + return false ; + return AddCurveMove( pCompo) ; +} + +//---------------------------------------------------------------------------- +int +Operation::AddCurveMove( const ICurve* pCrv, bool bSplit, const string& sName) +{ + int nFirstId = AddCurveMove( pCrv, bSplit) ; int nId = nFirstId ; while ( nId != GDB_ID_NULL) { m_pGeomDB->SetName( nId, sName) ; diff --git a/Pocketing.cpp b/Pocketing.cpp index e9978ff..ffee199 100644 --- a/Pocketing.cpp +++ b/Pocketing.cpp @@ -1693,10 +1693,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId) m_pGeomDB->SetMaterial( nPxId, BLUE) ; // verifico se archi vanno approssimati con segmenti di retta - int nSplitArcs = m_pMchMgr->GetCurrMachiningsMgr()->GetSplitArcs() ; - bool bSplitArcs = ( nSplitArcs == SPLAR_ALWAYS || - ( nSplitArcs == SPLAR_NO_XY_PLANE && ! vtExtr.IsZplus()) || - ( nSplitArcs == SPLAR_GEN_PLANE && vtExtr.IsGeneric())) ; + bool bSplitArcs = GetSplitArcs( vtExtr) ; // assegno il vettore estrazione al gruppo del percorso m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ; @@ -2076,6 +2073,16 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con } } + // se necessario, approssimo con rette + if ( bSplitArcs) { + for ( auto& pMCrv : vpCrvs) { + if ( ! ApproxWithLines( pMCrv)) { + m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ; + return false ; + } + } + } + // inserisco i movimenti di svuotatura for ( int j = 1 ; j <= nStep ; ++ j) { // ciclo sui percorsi @@ -2191,7 +2198,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con } // altrimenti, aggiungo retrazione di collegamento else { - if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) { + if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bSplitArcs)) { m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ; return false ; } @@ -2222,7 +2229,17 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con m_pMchMgr->SetLastError( 2413, "Error in Pocketing : Toolpath not computable") ; return false ; } - VerifyArcs( pOffs2) ; + + // se necessario, approssimo con rette + if ( bSplitArcs) { + if ( ! ApproxWithLines( pOffs2)) { + m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ; + return false ; + } + } + // altrimenti verifico archi + else + VerifyArcs( pOffs2) ; // se richiesto, la inverto if ( m_Params.m_bInvert) @@ -2279,7 +2296,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con dStElev = -LIO_ELEV_TOL ; } // approccio al punto iniziale - if ( ! AddLinkApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr)) { + if ( ! AddLinkApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bSplitArcs)) { m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ; return false ; } @@ -2337,7 +2354,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con } // se ci sono ancora curve, aggiungo retrazione di collegamento if ( OffsCrv2.GetCurveCount() > 0) { - if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) { + if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bSplitArcs)) { m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ; return false ; } @@ -3064,8 +3081,16 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con // sposto l'inizio a metà del tratto più lungo AdjustContourStart( pOffs) ; - // verifico archi - VerifyArcs( pOffs) ; + // se necessario, approssimo con rette + if ( bSplitArcs) { + if ( ! ApproxWithLines( pOffs)) { + m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ; + return false ; + } + } + // altrimenti verifico archi + else + VerifyArcs( pOffs) ; // coefficiente di riduzione feed di lavorazione di questa curva double dFeedRid = min( GetSideStep() / m_TParams.m_dDiam, 1.0) ; @@ -3175,7 +3200,7 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con return false ; } // aggiungo retrazione - if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) { + if ( ! AddLinkRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bSplitArcs)) { m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ; return false ; } @@ -3268,7 +3293,7 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con dStElev = max( dStElev, j * dStep) ; dStElev -= ( ptP - ptS) * vtExtr ; // sempre approccio di collegamento - if ( ! AddLinkApproach( ptP, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr)) { + if ( ! AddLinkApproach( ptP, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bSplitArcs)) { m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ; return false ; } @@ -3284,7 +3309,7 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con ptE.Translate( - vtTool * ( dDepth - dElev + j * dStep)) ; // movimento al punto finale SetFeed( GetFeed()) ; - if ( AddLinearMove( ptE) == GDB_ID_NULL) + if ( AddLinearMove( ptE, bSplitArcs) == GDB_ID_NULL) return false ; // risalita Point3d ptQ ; @@ -3305,7 +3330,7 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con } // altrimenti aggiungo retrazione di collegamento else { - if ( ! AddLinkRetract( ptQ, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr)) { + if ( ! AddLinkRetract( ptQ, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bSplitArcs)) { m_pMchMgr->SetLastError( 2418, "Error in Pocketing : Link not computable") ; return false ; } @@ -3659,7 +3684,7 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool, if ( IsNull( pCurve)) return false ; // aggiungo affondamento - pCurve->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ; + pCurve->Translate( -vtTool * ( dDepth - dElev + j * dStep)) ; // se prima entità if ( i == 0 ) { // dati inizio entità @@ -3954,7 +3979,7 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs, pRCrv->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL, false) ; // se necessario, approssimo archi con rette if ( bSplitArcs && ! ApproxWithLines( pRCrv)) { - m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Linear Approx not computable") ; + m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ; return false ; } VerifyArcs( pRCrv) ; @@ -3992,7 +4017,7 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs, } // se necessario, approssimo archi con rette if ( bSplitArcs && ! ApproxWithLines( pMCrv)) { - m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Linear Approx not computable") ; + m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ; return false ; } // eventuale sistemazione archi @@ -4181,7 +4206,7 @@ Pocketing::CalcCircleSpiral( const Point3d& ptCen, const Vector3d& vtN, double d } // se necessario, approssimo con rette if ( bSplitArcs && ! ApproxWithLines( pMCrv)) { - m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Linear Approx not computable") ; + m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ; return false ; } // eventuale sistemazione archi @@ -4898,7 +4923,7 @@ Pocketing::ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, pRCrv->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL, false) ; // se necessario, approssimo archi con rette if ( bSplitArcs && ! ApproxWithLines( pRCrv)) { - m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Linear Approx not computable") ; + m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ; return false ; } VerifyArcs( pRCrv) ; @@ -4923,7 +4948,7 @@ Pocketing::ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, // se necessario, approssimo archi con rette if ( bSplitArcs && ! ApproxWithLines( pMCrv)) { - m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Linear Approx not computable") ; + m_pMchMgr->SetLastError( 2419, "Error in Pocketing : Linear Approx not computable") ; return false ; } VerifyArcs( pMCrv) ; @@ -5052,15 +5077,13 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe // 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, ! m_bAggrBottom) == GDB_ID_NULL) return false ; } else { // 1a -> punto molto sopra inizio Point3d ptP1a = ptP1 + vtTool * ( dSafeDist - dAppr) ; - if ( ( ! m_bAggrBottom && AddRapidStart( ptP1a) == GDB_ID_NULL) || - ( m_bAggrBottom && AddRapidMove( ptP1a) == GDB_ID_NULL)) + if ( AddRapidStartOrMove( ptP1a, ! m_bAggrBottom) == GDB_ID_NULL) return false ; // 1 -> punto sopra inizio if ( ( dElev + dAppr) > 10 * EPS_SMALL || (( dElev + dAppr) > -EPS_ZERO && dAppr > EPS_SMALL)) { @@ -5081,8 +5104,7 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe else { // affondo diretto al punto iniziale SetFlag( 0) ; - if ( ( ! m_bAggrBottom && AddRapidStart( ptP) == GDB_ID_NULL) || - ( m_bAggrBottom && AddRapidMove( ptP) == GDB_ID_NULL)) + if ( AddRapidStartOrMove( ptP, ! m_bAggrBottom) == GDB_ID_NULL) return false ; } return true ; @@ -5091,7 +5113,7 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe //---------------------------------------------------------------------------- bool Pocketing::AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ, - double dElev, double dAppr, bool bOutStart) + double dElev, double dAppr, bool bSplitArcs, bool bOutStart) { // se sopra attacco c'è spazio per approccio if ( ( dElev + dAppr) > 10 * EPS_SMALL) { @@ -5099,19 +5121,19 @@ Pocketing::AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double d Point3d ptP1b = ptP + vtTool * ( dElev + dAppr) ; if ( ( dElev + dAppr) > EPS_SMALL) { SetFlag( 0) ; - if ( AddRapidMove( ptP1b) == GDB_ID_NULL) + if ( AddRapidMove( ptP1b, bSplitArcs) == GDB_ID_NULL) return false ; } // affondo al punto iniziale SetFlag( 0) ; SetFeed( bOutStart ? GetStartFeed() : GetTipFeed()) ; - if ( AddLinearMove( ptP) == GDB_ID_NULL) + if ( AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL) return false ; } else { // affondo diretto al punto iniziale SetFlag( 0) ; - if ( AddRapidMove( ptP) == GDB_ID_NULL) + if ( AddRapidMove( ptP, bSplitArcs) == GDB_ID_NULL) return false ; } return true ; @@ -5120,14 +5142,14 @@ Pocketing::AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double d //---------------------------------------------------------------------------- bool Pocketing::AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ, - double dElev, double dAppr) + double dElev, double dAppr, bool bSplitArcs) { // se sopra uscita c'è spazio per approccio if ( ( dElev + dAppr) > 10 * EPS_SMALL) { // 4 -> movimento di risalita sopra il punto finale SetFeed( GetEndFeed()) ; Point3d ptP4 = ptP + vtTool * ( dElev + dAppr) ; - if ( AddLinearMove( ptP4) == GDB_ID_NULL) + if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL) return false ; } return true ; @@ -5252,17 +5274,8 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3 PtrOwner pArc( CreateCurveArc()) ; if ( IsNull( pArc) || ! pArc->Set( ptCen, vtN, dRad, - vtCen, dAngCen, dDeltaN)) return false ; - // eventuale spezzatura - if ( bSplitArcs) { - PtrOwner pCompo ; - if ( ! pCompo.Set( ConvertCurveToComposite( 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) ; } // altrimenti zigzag else @@ -5279,12 +5292,12 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3 // verifico se fattibile if ( bSkipControl || VerifyLeadInZigZag( pCompo, ptPa, ptPb)) { for ( int i = 1 ; i <= nStep ; ++ i) { - if ( AddLinearMove( ptPa - vtN * ( i - 0.75) * dStep, MCH_CL_LEADIN) == GDB_ID_NULL) + if ( AddLinearMove( ptPa - vtN * ( i - 0.75) * dStep, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL) return false ; - if ( AddLinearMove( ptPb - vtN * ( i - 0.25) * dStep, MCH_CL_LEADIN) == GDB_ID_NULL) + if ( AddLinearMove( ptPb - vtN * ( i - 0.25) * dStep, 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) ; } // altrimenti diretto else { @@ -5318,11 +5331,8 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3 double dNini = ( ptP1 - ORIG) * vtN ; double dNfin = ( ptStart - ORIG) * vtN ; 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) ; } // altrimenti diretto else @@ -5333,7 +5343,7 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3 Point3d ptCurr = ptP1 ; GetCurrPos( ptCurr) ; if ( ! AreSamePointApprox( ptCurr, ptStart)) { - if ( AddLinearMove( ptStart, MCH_CL_LEADIN) == GDB_ID_NULL) + if ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) == GDB_ID_NULL) return false ; } return true ; @@ -5404,11 +5414,8 @@ Pocketing::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector Point3d ptFin ; pCrv->GetEndPoint( ptFin) ; ptFin += vtN * 1.0 ; pCrv->ModifyEnd( ptFin) ; - // eventuale spezzatura - if ( bSplitArcs && ! ApproxWithLines( pCrv)) - return false ; - // emetto - AddCurveMove( pCrv) ; + // emetto (con eventuale spezzatura) + AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) ; // determino elevazione su fine uscita ptP1 = ptFin ; double dEndElev ; diff --git a/Pocketing.h b/Pocketing.h index bd2e724..025933b 100644 --- a/Pocketing.h +++ b/Pocketing.h @@ -118,9 +118,9 @@ class Pocketing : public Machining bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ, double dElev, double dAppr, bool bOutStart) ; bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ, - double dElev, double dAppr, bool bOutStart = false) ; + double dElev, double dAppr, bool bSplitArcs, bool bOutStart = false) ; bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ, - double dElev, double dAppr) ; + double dElev, double dAppr, bool bSplitArcs) ; bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ, double dElev, double dAppr) ; bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN, diff --git a/Processor.cpp b/Processor.cpp index 4e2d77d..d4a1f89 100644 --- a/Processor.cpp +++ b/Processor.cpp @@ -521,8 +521,8 @@ bool Processor::UpdateAxes( void) { // Carico i nomi degli assi macchina attivi - return m_pMachine->GetAllCurrAxesName( m_AxesName) && - m_pMachine->GetAllCurrAxesToken( m_AxesToken) ; + return m_pMachine->GetAllCurrAxesNames( m_AxesName) && + m_pMachine->GetAllCurrAxesTokens( m_AxesToken) ; } //---------------------------------------------------------------------------- diff --git a/Sawing.cpp b/Sawing.cpp index 71c0397..d8ebf6b 100644 --- a/Sawing.cpp +++ b/Sawing.cpp @@ -629,9 +629,6 @@ Sawing::Preview( bool bRecalc) bool Sawing::Apply( bool bRecalc, bool bPostApply) { - - Preview( bRecalc) ; - // reset numero tagli nella lavorazione int nCurrCuts = m_nCuts ; m_nCuts = 0 ; @@ -2899,7 +2896,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv, CalculateToolAndCorrVersors( vtCurrDir, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtCurrTool, vtCurrCorr) ; SetToolDir( vtCurrTool) ; SetCorrAuxDir( vtCurrCorr) ; - if ( AddCurveMove( pSmpCrv, true) == GDB_ID_NULL) + if ( AddCurveMove( pSmpCrv) == GDB_ID_NULL) return false ; } // 4 -> retrazione @@ -2977,7 +2974,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv, pCopy->SimpleOffset( dOffs) ; } // emissione - if ( AddCurveMove( pCopy, true) == GDB_ID_NULL) + if ( AddCurveMove( pCopy) == GDB_ID_NULL) return false ; } } @@ -3010,7 +3007,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv, // inversione pCopy->Invert() ; // emissione - if ( AddCurveMove( pCopy, true) == GDB_ID_NULL) + if ( AddCurveMove( pCopy) == GDB_ID_NULL) return false ; } } @@ -3077,7 +3074,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv, pCopy->SimpleOffset( dOffs) ; } // emissione - if ( AddCurveMove( pCopy, true) == GDB_ID_NULL) + if ( AddCurveMove( pCopy) == GDB_ID_NULL) return false ; } // se non è ultimo passo diff --git a/Simulator.cpp b/Simulator.cpp index a84fc62..c52fa2e 100644 --- a/Simulator.cpp +++ b/Simulator.cpp @@ -579,8 +579,8 @@ Simulator::UpdateAxes( void) if ( pMachine == nullptr) return false ; // Carico i nomi e i token degli assi macchina attivi - if ( ! pMachine->GetAllCurrAxesName( m_AxesName) || - ! pMachine->GetAllCurrAxesToken( m_AxesToken)) + if ( ! pMachine->GetAllCurrAxesNames( m_AxesName) || + ! pMachine->GetAllCurrAxesTokens( m_AxesToken)) return false ; // Aggiorno flag di invertito, offset, tipo e posizione corrente degli assi macchina attivi for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {