diff --git a/Disposition.cpp b/Disposition.cpp index 0756047..4d9a7b9 100644 --- a/Disposition.cpp +++ b/Disposition.cpp @@ -43,6 +43,7 @@ static std::string DIS_MVD_FLAG = "MvF" ; static std::string DIS_NUM = "NUM" ; static std::string DIS_HEAD = "Head" ; static std::string DIS_EXIT = "Exit" ; +static std::string DIS_SOMEBYHAND = "Sbh" ; //---------------------------------------------------------------------------- USEROBJ_REGISTER( "EMkDisposition", Disposition) ; @@ -71,6 +72,7 @@ Disposition::Clone( void) const pDisp->m_sHead = m_sHead ; pDisp->m_nExit = m_nExit ; pDisp->m_nShifts = m_nShifts ; + pDisp->m_bSomeByHand = m_bSomeByHand ; } catch( ...) { delete pDisp ; @@ -116,6 +118,7 @@ Disposition::Dump( string& sOut, bool bMM, const char* szNewLine) const sOut += "Num=" + ToString( m_nShifts) + szNewLine ; sOut += "Head=" + m_sHead + szNewLine ; sOut += "Exit=" + ToString( m_nExit) + szNewLine ; + sOut += "ByHand=" + ToString( m_bSomeByHand) + szNewLine ; return true ; } @@ -129,7 +132,7 @@ Disposition::Save( STRVECTOR& vString) const int nFxdLines = 1 + 3 * nFxdTot ; int nMvdTot = int( m_vMvrData.size()) ; int nMvdLines = 1 + 4 * nMvdTot ; - int nOther = 3 ; + int nOther = 4 ; vString.insert( vString.begin(), 4 + nFxdLines + nMvdLines + nOther, "") ; // Nome if ( ! SetVal( DIS_TABLE, m_sTabName, vString[++k])) @@ -169,6 +172,8 @@ Disposition::Save( STRVECTOR& vString) const return false ; if ( ! SetVal( DIS_EXIT, m_nExit, vString[++k])) return false ; + if ( ! SetVal( DIS_SOMEBYHAND, m_bSomeByHand, vString[++k])) + return false ; } catch( ...) { return false ; } return true ; @@ -237,13 +242,17 @@ Disposition::Load( const STRVECTOR& vString, int nBaseGdbId) if ( ! GetVal( vString[++k], DIS_EXIT, m_nExit)) return false ; } + if ( k + 1 < int( vString.size())) { + if ( ! GetVal( vString[++k], DIS_SOMEBYHAND, m_bSomeByHand)) + return false ; + } return true ; } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- Disposition::Disposition( void) - : m_bTabOk( false), m_nExit( 0), m_nShifts( 0) + : m_bTabOk( false), m_nExit( 0), m_nShifts( 0), m_bSomeByHand( false) { } @@ -836,6 +845,7 @@ Disposition::SpecialApply( bool bRecalc) static const string EVAR_HEAD = ".HEAD" ; // OUT (string) nome della testa static const string EVAR_EXIT = ".EXIT" ; // OUT (int) indice dell'uscita static const string EVAR_SHIFTS = ".SHIFTS" ; // OUT (int) numero di movimenti eseguiti + static const string EVAR_SBH = ".SBH" ; // OUT (bool) flag presenza operazioni manuali static const string ON_SPECIAL_APPLY = "OnSpecialApplyDisposition" ; // eseguo l'azione @@ -853,6 +863,7 @@ Disposition::SpecialApply( bool bRecalc) bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_HEAD, m_sHead) ; bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_EXIT, m_nExit) ; bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_SHIFTS, m_nShifts) ; + bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_SBH, m_bSomeByHand) ; bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ; // segnalo errori if ( nErr != 0) { @@ -912,3 +923,10 @@ Disposition::GetToolTcPos( void) const static string sDummy = "" ; return sDummy ; } + +//---------------------------------------------------------------------------- +bool +Disposition:: NeedPrevHome( void) const +{ + return ( IsEmpty() || m_bSomeByHand) ; +} diff --git a/Disposition.h b/Disposition.h index 6fb51b9..a876d49 100644 --- a/Disposition.h +++ b/Disposition.h @@ -61,13 +61,14 @@ class Disposition : public Operation { return ( m_nShifts == 0) ; } protected : // Operation - const std::string& GetToolName( void) const ; - const std::string& GetHeadName( void) const ; - int GetExitNbr( void) const ; - const std::string& GetToolTcPos( void) const ; + const std::string& GetToolName( void) const override ; + const std::string& GetHeadName( void) const override ; + int GetExitNbr( void) const override ; + const std::string& GetToolTcPos( void) const override ; int GetSolCh( void) const override { return 0 ; } - bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) override + bool NeedPrevHome( void) const override ; + bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override { return true ; } public : @@ -96,6 +97,8 @@ class Disposition : public Operation bool GetMoveRawData( int nInd, int& nRawId, int& nType, Point3d& ptPos, int& nFlag) const ; bool SpecialApply( bool bRecalc) ; bool GetToolData( string& sName, string& sHead, int& nExit) const ; + bool GetSomeByHand( void) const + { return m_bSomeByHand ; } private : bool VerifyFixture( int nFixtId) const ; @@ -111,6 +114,7 @@ class Disposition : public Operation std::string m_sHead ; // eventuale testa usata per muovere i pezzi int m_nExit ; // eventuale uscita sulla testa int m_nShifts ; // numero eventuali spostamenti con testa + bool m_bSomeByHand ; // presenza di operazioni manuali (anche in aggiunta ad automatiche) } ; //---------------------------------------------------------------------------- diff --git a/Drilling.cpp b/Drilling.cpp index 0246d92..8b50d29 100644 --- a/Drilling.cpp +++ b/Drilling.cpp @@ -1383,7 +1383,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) //---------------------------------------------------------------------------- bool -Drilling::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) +Drilling::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const { // non devo fare alcunché return true ; diff --git a/Drilling.h b/Drilling.h index dcb9a51..4a3d6fb 100644 --- a/Drilling.h +++ b/Drilling.h @@ -40,7 +40,7 @@ class Drilling : public Machining protected : // Operation int GetSolCh( void) const override { return m_Params.m_nSolCh ; } - bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) override ; + bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ; public : // Machining bool Prepare( const std::string& sDriName) override ; diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 8ebc4c2..9df6f3b 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ diff --git a/Generator.cpp b/Generator.cpp index 1ae2cd9..7cb6e4d 100644 --- a/Generator.cpp +++ b/Generator.cpp @@ -156,9 +156,10 @@ Generator::ProcessDisposition( int nOpId, int nOpInd) int nPhase = pDisp->GetPhase() ; m_pMchMgr->SetCurrPhase( nPhase) ; bool bEmpty = pDisp->IsEmpty() ; + bool bSomeByHand = pDisp->GetSomeByHand() ; // Emetto inizio disposizione - if ( ! OnDispositionStart( nOpId, nOpInd, nPhase, bEmpty)) + if ( ! OnDispositionStart( nOpId, nOpInd, nPhase, bEmpty, bSomeByHand)) return false ; // Emetto dati tavola @@ -484,7 +485,7 @@ Generator::OnProgramEnd( void) //---------------------------------------------------------------------------- bool -Generator::OnDispositionStart( int nOpId, int nOpInd, int nPhase, bool bEmpty) +Generator::OnDispositionStart( int nOpId, int nOpInd, int nPhase, bool bEmpty, bool bSomeByHand) { // assegno identificativo e indice disposizione bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DISPID, nOpId) ; @@ -493,6 +494,8 @@ Generator::OnDispositionStart( int nOpId, int nOpInd, int nPhase, bool bEmpty) bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PHASE, nPhase) ; // assegno flag disposizione passiva bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EMPTY, bEmpty) ; + // assegno flag disposizione con operazioni manuali + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SBH, bSomeByHand) ; // chiamo la funzione di inizio disposizione bOk = bOk && m_pMachine->LuaCallFunction( ON_DISPOSITION_START) ; return bOk ; diff --git a/Generator.h b/Generator.h index 8c024db..444604c 100644 --- a/Generator.h +++ b/Generator.h @@ -42,7 +42,7 @@ class Generator bool OnProgramEnd( void) ; bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit) ; bool OnToolDeselect( const std::string& sNextHead, int nNextExit) ; - bool OnDispositionStart( int nOpId, int nOpInd, int nPhase, bool bEmpty) ; + bool OnDispositionStart( int nOpId, int nOpInd, int nPhase, bool bEmpty, bool bSomeByHand) ; bool OnDispositionEnd( void) ; bool OnTableData( const std::string& sName, const Point3d& ptOri1) ; bool OnFixtureData( int nFixId, int nFixInd, const std::string& sName, diff --git a/MachMgr.h b/MachMgr.h index ff6b5f6..7bc56c4 100644 --- a/MachMgr.h +++ b/MachMgr.h @@ -195,6 +195,7 @@ class MachMgr : public IMachMgr bool GetOperationStatus( int nId, bool& bShow) const override ; bool SetAllOperationsStatus(bool bExceptFirstDisp, bool bShow) override ; bool ChangeOperationPhase( int nMchId, int nNewPhase) override ; + bool RemoveOperationHome( int nId) override ; // Operations : dispositions int GetPhaseDisposition( int nPhase) const override ; bool DispositionSpecialApply( int nId, bool bRecalc) override ; diff --git a/MachMgrOperations.cpp b/MachMgrOperations.cpp index 9c41859..930b599 100644 --- a/MachMgrOperations.cpp +++ b/MachMgrOperations.cpp @@ -460,17 +460,17 @@ MachMgr::SetAllOperationsStatus( bool bExceptFirstDisp, bool bShow) //---------------------------------------------------------------------------- bool -MachMgr::ChangeOperationPhase( int nId, int nNewPhase) +MachMgr::ChangeOperationPhase( int nMchId, int nNewPhase) { // l'operazione deve esistere e non essere una disposizione - int nType = GetOperationType( nId) ; + int nType = GetOperationType( nMchId) ; if ( nType == OPER_NULL || nType == OPER_DISP) return false ; // verifico che la nuova fase esista if ( nNewPhase > m_nPhasesCount) return false ; // se la fase dell'operazione è già giusta, esco subito con successo - if ( GetOperationPhase( nId) == nNewPhase) + if ( GetOperationPhase( nMchId) == nNewPhase) return true ; // cerco l'ultima operazione della nuova fase int nRefId = GDB_ID_NULL ; @@ -486,16 +486,32 @@ MachMgr::ChangeOperationPhase( int nId, int nNewPhase) if ( nRefId == GDB_ID_NULL) return false ; // recupero la lavorazione - Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nId)) ; + Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nMchId)) ; if ( pMch == nullptr) return false ; // sposto la lavorazione - if ( ! m_pGeomDB->Relocate( nId, nRefId, GDB_AFTER)) + if ( ! m_pGeomDB->Relocate( nMchId, nRefId, GDB_AFTER)) return false ; // assegno nuova fase return pMch->SetPhase( nNewPhase) ; } +//---------------------------------------------------------------------------- +bool +MachMgr::RemoveOperationHome( int nId) +{ + // l'operazione deve esistere + int nType = GetOperationType( nId) ; + if ( nType == OPER_NULL) + return false ; + // ne recupero il gestore + Operation* pOper = GetOperation( m_pGeomDB->GetUserObj( nId)) ; + if ( pOper == nullptr) + return false ; + // rimuovo il posizionamento finale in home + return pOper->RemoveHome() ; +} + //---------------------------------------------------------------------------- // Dispositions //---------------------------------------------------------------------------- diff --git a/Machining.cpp b/Machining.cpp index 392d46e..157bb22 100644 --- a/Machining.cpp +++ b/Machining.cpp @@ -63,3 +63,10 @@ Machining::GetToolTcPos( void) const { return GetToolData().m_sTcPos ; } + +//---------------------------------------------------------------------------- +bool +Machining:: NeedPrevHome( void) const +{ + return false ; +} diff --git a/Machining.h b/Machining.h index 4681e65..3e944f4 100644 --- a/Machining.h +++ b/Machining.h @@ -20,10 +20,11 @@ class Machining : public Operation { protected : // Operation - const std::string& GetToolName( void) const ; - const std::string& GetHeadName( void) const ; - int GetExitNbr( void) const ; - const std::string& GetToolTcPos( void) const ; + const std::string& GetToolName( void) const override ; + const std::string& GetHeadName( void) const override ; + int GetExitNbr( void) const override ; + const std::string& GetToolTcPos( void) const override ; + bool NeedPrevHome( void) const override ; public : virtual bool Prepare( const std::string& sMchName) = 0 ; diff --git a/MachiningsMgr.cpp b/MachiningsMgr.cpp index 64696aa..8795644 100644 --- a/MachiningsMgr.cpp +++ b/MachiningsMgr.cpp @@ -1,13 +1,13 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2015 +// EgalTech 2015-2016 //---------------------------------------------------------------------------- -// File : MachiningsMgr.cpp Data : 02.06.15 Versione : 1.6f1 +// File : MachiningsMgr.cpp Data : 13.07.16 Versione : 1.6r8 // Contenuto : Implementazione gestore database lavorazioni. // // // // Modifiche : 02.06.15 DS Creazione modulo. -// +// 13.07.16 DS Aggiunta gestione SplitArcs (MF_CURR_VER = 1005). // //---------------------------------------------------------------------------- @@ -35,7 +35,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 = 1004 ; +const int MF_CURR_VER = 1005 ; const string MF_GENERAL = "[GENERAL]" ; const string MF_3AXCOMP = "3AXCOMP" ; const bool MF_CURR_3AXCOMP = false ; diff --git a/Milling.cpp b/Milling.cpp index cf42c5f..f7ef0ed 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -885,7 +885,7 @@ Milling::Chain( int nGrpDestId) //---------------------------------------------------------------------------- bool -Milling::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) +Milling::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const { // non devo fare alcunché return true ; diff --git a/Milling.h b/Milling.h index 6a69413..38cd635 100644 --- a/Milling.h +++ b/Milling.h @@ -39,7 +39,7 @@ class Milling : public Machining protected : // Operation int GetSolCh( void) const override { return m_Params.m_nSolCh ; } - bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) override ; + bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ; public : // Machining bool Prepare( const std::string& sMillName) override ; diff --git a/Operation.cpp b/Operation.cpp index be30e4b..c287ca1 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -455,11 +455,11 @@ Operation::CalculateAxesValues( void) { if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) return false ; - // recupero l'operazione precedente non vuota + // recupero l'operazione precedente non vuota o che richiede home precedente int nPrevOpId = m_pMchMgr->GetPrevActiveOperation( m_nOwnerId) ; Operation* pPrevOp = GetOperation( m_pGeomDB->GetUserObj( nPrevOpId)) ; while ( pPrevOp != nullptr) { - if ( ! pPrevOp->IsEmpty()) + if ( ! pPrevOp->IsEmpty() || pPrevOp->NeedPrevHome()) break ; else { nPrevOpId = m_pMchMgr->GetPrevActiveOperation( nPrevOpId) ; @@ -468,15 +468,15 @@ Operation::CalculateAxesValues( void) } // recupero l'utensile precedente string sPrevTool ; - if ( pPrevOp != nullptr) + if ( pPrevOp != nullptr && ! pPrevOp->IsEmpty()) sPrevTool = pPrevOp->GetToolName() ; // imposto l'utensile per i calcoli macchina if ( ! m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr())) return false ; - // rimuovo posizionamento home da lavorazione precedente (non può più essere l'ultima) - if ( pPrevOp != nullptr) + // rimuovo posizionamento home da lavorazione precedente se non richiesto (non può più essere l'ultima) + if ( pPrevOp != nullptr && ! NeedPrevHome()) pPrevOp->RemoveHome() ; // recupero il numero di assi lineari e rotanti attivi @@ -758,11 +758,11 @@ Operation::AdjustStartEndMovements( bool bOnlyStart) if ( nClId == GDB_ID_NULL) return false ; - // recupero la lavorazione precedente non vuota + // recupero ultima operazione precedente non vuota o che richiede home precedente int nPrevOpId = m_pMchMgr->GetPrevActiveOperation( m_nOwnerId) ; Operation* pPrevOp = GetOperation( m_pGeomDB->GetUserObj( nPrevOpId)) ; while ( pPrevOp != nullptr) { - if ( ! pPrevOp->IsEmpty()) + if ( ! pPrevOp->IsEmpty() || pPrevOp->NeedPrevHome()) break ; else { nPrevOpId = m_pMchMgr->GetPrevActiveOperation( nPrevOpId) ; @@ -771,14 +771,14 @@ Operation::AdjustStartEndMovements( bool bOnlyStart) } // recupero l'utensile precedente e i dati della sua testa string sPrevTool ; - if ( pPrevOp != nullptr) + if ( pPrevOp != nullptr && ! pPrevOp->IsEmpty()) sPrevTool = pPrevOp->GetToolName() ; // determino posizione precedente assi DBLVECTOR vAxVal ; bool bHomeZ = false ; - // se primo utensile, uso la posizione home - if ( sPrevTool.empty()) { + // se primo utensile o richiesto, uso la posizione home + if ( sPrevTool.empty() || NeedPrevHome()) { // imposto l'utensile per i calcoli macchina if ( ! m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr())) return false ; diff --git a/Operation.h b/Operation.h index 2cb1f2e..39f0d8d 100644 --- a/Operation.h +++ b/Operation.h @@ -36,6 +36,7 @@ class Operation : public IUserObj { m_nPhase = nPhase ; return true ; } virtual int GetPhase( void) const { return m_nPhase ; } + virtual bool RemoveHome( void) ; public : virtual bool IsEmpty( void) const = 0 ; @@ -46,7 +47,8 @@ class Operation : public IUserObj virtual int GetExitNbr( void) const = 0 ; virtual int GetSolCh( void) const = 0 ; virtual const std::string& GetToolTcPos( void) const = 0 ; - virtual bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) = 0 ; + virtual bool NeedPrevHome( void) const = 0 ; + virtual bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const = 0 ; protected : Operation( void) ; @@ -77,7 +79,6 @@ class Operation : public IUserObj bool AddRise( DBLVECTOR& vAxVal, double dDelta = - 1) ; bool RemoveRise( void) ; bool AddHome( void) ; - bool RemoveHome( void) ; bool CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) ; bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) ; diff --git a/OutputConst.h b/OutputConst.h index 55bf286..f37cec1 100644 --- a/OutputConst.h +++ b/OutputConst.h @@ -36,6 +36,7 @@ static const std::string GVAR_DISPID = ".DISPID" ; // (int) identifica static const std::string GVAR_DISPIND = ".DISPIND" ; // (int) indice disposizione static const std::string GVAR_PHASE = ".PHASE" ; // (int) indice fase static const std::string GVAR_EMPTY = ".EMPTY" ; // (bool) flag disposizione passiva +static const std::string GVAR_SBH = ".SBH" ; // (bool) flag disposizione con operazioni manuali static const std::string GVAR_TABNAME = ".TABNAME" ; // (string) nome tavola static const std::string GVAR_TABORI1 = ".TABORI1" ; // (Point3d) prima origine di tavola static const std::string GVAR_FIXID = ".FIXID" ; // (int) identificativo bloccaggio (fixture) diff --git a/SawFinishing.cpp b/SawFinishing.cpp index c7f2be0..087d879 100644 --- a/SawFinishing.cpp +++ b/SawFinishing.cpp @@ -605,7 +605,7 @@ SawFinishing::GetGeometry( SELVECTOR& vIds) const //---------------------------------------------------------------------------- bool -SawFinishing::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) +SawFinishing::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const { // compenso il raggio dell'utensile ptP += pCamData->GetCorrDir() * ( m_TParams.m_dDiam / 2) ; diff --git a/SawFinishing.h b/SawFinishing.h index 3b6539f..a717aca 100644 --- a/SawFinishing.h +++ b/SawFinishing.h @@ -42,7 +42,7 @@ class SawFinishing : public Machining protected : // Operation int GetSolCh( void) const override { return m_Params.m_nSolCh ; } - bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) override ; + bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ; public : // Machining bool Prepare( const std::string& sSawName) override ; diff --git a/SawRoughing.cpp b/SawRoughing.cpp index 614385b..9278340 100644 --- a/SawRoughing.cpp +++ b/SawRoughing.cpp @@ -578,7 +578,7 @@ SawRoughing::GetGeometry( SELVECTOR& vIds) const //---------------------------------------------------------------------------- bool -SawRoughing::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) +SawRoughing::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const { // compenso il raggio dell'utensile ptP += pCamData->GetCorrDir() * ( m_TParams.m_dDiam / 2) ; diff --git a/SawRoughing.h b/SawRoughing.h index b2cb334..d6a7254 100644 --- a/SawRoughing.h +++ b/SawRoughing.h @@ -42,7 +42,7 @@ class SawRoughing : public Machining protected : // Operation int GetSolCh( void) const override { return m_Params.m_nSolCh ; } - bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) override ; + bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ; public : // Machining bool Prepare( const std::string& sSawName) override ; diff --git a/Sawing.cpp b/Sawing.cpp index c3a5cf1..3af872e 100644 --- a/Sawing.cpp +++ b/Sawing.cpp @@ -715,7 +715,7 @@ Sawing::GetGeometry( SELVECTOR& vIds) const //---------------------------------------------------------------------------- bool -Sawing::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) +Sawing::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const { // compenso il raggio dell'utensile ptP += pCamData->GetCorrDir() * ( m_TParams.m_dDiam / 2) ; @@ -1187,8 +1187,9 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve pLine->Translate( - vtCorr * dDepth) ; // calcolo elevazione (sui due bordi della striscia, leggermente allargata) double dElev, dElev2 ; - Vector3d vtSafe = vtTool * ( 10 * EPS_SMALL) ; - Vector3d vtThick = vtTool * ( m_TParams.m_dThick + 10 * EPS_SMALL) ; + Vector3d vtToolH( vtTool.x, vtTool.y, 0) ; + Vector3d vtSafe = vtToolH * ( 10 * EPS_SMALL) ; + Vector3d vtThick = vtToolH * ( m_TParams.m_dThick / vtToolH.SqLen() + 10 * EPS_SMALL) ; if ( ! GetElevation( m_nPhase, pLine->GetStart() - vtSafe, pLine->GetEnd() - vtSafe, vtCorr, dElev) || ! GetElevation( m_nPhase, pLine->GetStart() + vtThick, pLine->GetEnd() + vtThick, vtCorr, dElev2) ) { LOG_INFO( GetEMkLogger(), "Error in Sawing : Entity GetElevation") ; diff --git a/Sawing.h b/Sawing.h index 7b4ad0d..20115c1 100644 --- a/Sawing.h +++ b/Sawing.h @@ -42,7 +42,7 @@ class Sawing : public Machining protected : // Operation int GetSolCh( void) const override { return m_Params.m_nSolCh ; } - bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) override ; + bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ; public : // Machining bool Prepare( const std::string& sSawName) override ;