From 6a716b84e4e6c1c08aa18b806b26e1bd029aa156 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 31 Dec 2018 09:23:56 +0000 Subject: [PATCH] EgtGeomKernel : - in Tool aggiunta distinzione tra Outline e ApproxOutline - le GetOutline di VolZmap e CAvToolSurfTm accettano un parametro per indicare se standard o approssimata. --- CAvToolSurfTm.h | 4 ++-- CAvToolTriangle.cpp | 8 ++++---- Tool.cpp | 4 ++-- Tool.h | 6 ++++-- VolZmap.cpp | 2 +- VolZmap.h | 2 ++ VolZmapVolume.cpp | 32 ++++++++++++++++---------------- 7 files changed, 31 insertions(+), 27 deletions(-) diff --git a/CAvToolSurfTm.h b/CAvToolSurfTm.h index 3679795..64f6408 100644 --- a/CAvToolSurfTm.h +++ b/CAvToolSurfTm.h @@ -34,8 +34,8 @@ class CAvToolSurfTm : public ICAvToolSurfTm { return m_Tool.GetRadius() ; } double GetToolHeight( void) const override { return m_Tool.GetHeigth() ; } - const ICurveComposite* GetToolOutline( void) const override - { return m_Tool.GetOutline() ;} + const ICurveComposite& GetToolOutline( bool bApprox = false) const override + { return ( bApprox ? m_Tool.GetApproxOutline() : m_Tool.GetOutline()) ;} bool TestPosition( const Point3d& ptT, const Vector3d& vtDir, double& dTotDist) override ; bool TestPath( PNTULIST& lPntM, const Vector3d& vtDir, double dLinTol) override ; diff --git a/CAvToolTriangle.cpp b/CAvToolTriangle.cpp index aeef682..b0339c7 100644 --- a/CAvToolTriangle.cpp +++ b/CAvToolTriangle.cpp @@ -212,15 +212,15 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d& // riferimento per componenti Point3d ptCompOrig = ptToolOrig - tlTool.GetHeigth() * vtToolAx ; // analizzo le curve del profilo a partire dall'ultima - const CurveComposite* pToolProfile = tlTool.GetOutline() ; - int nCrv = pToolProfile->GetCurveCount() - 1 ; - const ICurve* pCurve = pToolProfile->GetCurve( nCrv) ; + const CurveComposite& ToolProfile = tlTool.GetApproxOutline() ; + int nCrv = ToolProfile.GetCurveCount() - 1 ; + const ICurve* pCurve = ToolProfile.GetCurve( nCrv) ; const ICurve* pNextCurve = nullptr ; while ( pCurve != nullptr) { // distanza di allontanamento del tratto corrente double dDist2 = 0 ; // curva precedente - const ICurve* pPrevCurve = pToolProfile->GetCurve( -- nCrv) ; + const ICurve* pPrevCurve = ToolProfile.GetCurve( -- nCrv) ; // Se segmento if ( pCurve->GetType() == CRV_LINE) { // Recupero gli estremi diff --git a/Tool.cpp b/Tool.cpp index 4e8e526..8357fff 100644 --- a/Tool.cpp +++ b/Tool.cpp @@ -17,8 +17,8 @@ #include "CurveArc.h" #include "Tool.h" #include "GeoConst.h" -#include "/EgtDev/Include/EGKLinePntTgCurve.h" -#include "/EgtDev/Include/EGKFilletChamfer.h" +#include "/EgtDev/Include/EGkLinePntTgCurve.h" +#include "/EgtDev/Include/EGkFilletChamfer.h" #include "/EgtDev/Include/EGkDistPointCurve.h" #include diff --git a/Tool.h b/Tool.h index c7b35f9..6b84c80 100644 --- a/Tool.h +++ b/Tool.h @@ -53,8 +53,10 @@ class Tool { return m_dMrtChsWidth ; } double GetMrtChsThickness() const { return m_dMrtChsThickness ; } - const CurveComposite* GetOutline() const - { return ( m_ArcLineApprox.GetCurveCount() == 0 ? &m_Outline : &m_ArcLineApprox) ; } + const CurveComposite& GetOutline( void) const + { return ( m_Outline) ; } + const CurveComposite& GetApproxOutline( void) const + { return ( m_ArcLineApprox.GetCurveCount() == 0 ? m_Outline : m_ArcLineApprox) ; } public : enum ToolType { UNDEF = 0, // Utensile indefinito diff --git a/VolZmap.cpp b/VolZmap.cpp index 75a4324..1457240 100644 --- a/VolZmap.cpp +++ b/VolZmap.cpp @@ -41,7 +41,7 @@ VolZmap::VolZmap(void) m_dMaxZ[i] = 0 ; m_nFracLin[i] = 0 ; } - m_Tool.SetTolerances( 0.2, ANG_TOL_APPROX_DEG) ; + m_Tool.SetTolerances( LIN_TOL_STD, ANG_TOL_APPROX_DEG) ; } //---------------------------------------------------------------------------- diff --git a/VolZmap.h b/VolZmap.h index 367d167..afbfdc2 100644 --- a/VolZmap.h +++ b/VolZmap.h @@ -91,6 +91,8 @@ class VolZmap : public IVolZmap, public IGeoObjRW bool SetGenTool( const std::string& sToolName, const ICurveComposite* pToolOutline, int nFlag) override ; bool SetMortiserTool( const std::string& sToolName, double dH, double dW, double dTh, double dRc, int nFlag) override ; bool SetChiselTool( const std::string& sToolName, double dH, double dW, double dTh, int nFlag) override ; + const ICurveComposite& GetToolOutline( bool bApprox = false) const override + { return ( bApprox ? m_Tool.GetApproxOutline() : m_Tool.GetOutline()) ;} bool MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Point3d& ptPe, const Vector3d& vtDe) override ; bool MillingStep( const Point3d& ptPs, const Vector3d& vtDs, const Vector3d& vtAs, const Point3d& ptPe, const Vector3d& vtDe, const Vector3d& vtAe) override ; diff --git a/VolZmapVolume.cpp b/VolZmapVolume.cpp index fbbeb0a..b61df95 100644 --- a/VolZmapVolume.cpp +++ b/VolZmapVolume.cpp @@ -1683,8 +1683,8 @@ VolZmap::GenTool_ZDrilling( unsigned int nGrid, const Point3d& ptS, const Point3 Vector3d vtMove = ptE - ptS ; // Ciclo sulle curve - const CurveComposite* pToolProfile = m_Tool.GetOutline() ; - const ICurve* pCurve = pToolProfile->GetFirstCurve() ; + const CurveComposite& ToolProfile = m_Tool.GetApproxOutline() ; + const ICurve* pCurve = ToolProfile.GetFirstCurve() ; while ( pCurve != nullptr) { double dHeight ; @@ -1742,7 +1742,7 @@ VolZmap::GenTool_ZDrilling( unsigned int nGrid, const Point3d& ptS, const Point3 ptF = ptI + vtMove ; // Passo alla curva successiva del profilo - pCurve = pToolProfile->GetNextCurve() ; + pCurve = ToolProfile.GetNextCurve() ; } return true ; @@ -1760,8 +1760,8 @@ VolZmap::GenTool_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d Vector3d vtMove = ptE - ptS ; // Ciclo sulle curve del profilo utensile - const CurveComposite* pToolProfile = m_Tool.GetOutline() ; - const ICurve* pCurve = pToolProfile->GetFirstCurve() ; + const CurveComposite& ToolProfile = m_Tool.GetApproxOutline() ; + const ICurve* pCurve = ToolProfile.GetFirstCurve() ; while ( pCurve != nullptr) { double dHeight ; @@ -1819,7 +1819,7 @@ VolZmap::GenTool_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d ptF = ptI + vtMove ; // Passo alla curva successiva del profilo - pCurve = pToolProfile->GetNextCurve() ; + pCurve = ToolProfile.GetNextCurve() ; } return true ; @@ -2879,9 +2879,9 @@ VolZmap::GenTool_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d Vector3d vtMove = ptE - ptS ; // Ciclo sulle curve del profilo - const CurveComposite* pToolProfile = m_Tool.GetOutline() ; + const CurveComposite& ToolProfile = m_Tool.GetApproxOutline() ; const ICurve* pPrevCurve = nullptr ; - const ICurve* pCurve = pToolProfile->GetFirstCurve() ; + const ICurve* pCurve = ToolProfile.GetFirstCurve() ; while ( pCurve != nullptr) { double dHeight ; @@ -2906,7 +2906,7 @@ VolZmap::GenTool_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d } // Verifiche curva successiva per eventuale tappo sotto bool bTapB = false ; - const ICurve* pNextCurve = pToolProfile->GetNextCurve() ; + const ICurve* pNextCurve = ToolProfile.GetNextCurve() ; if ( pNextCurve != nullptr && pNextCurve->GetType() == CRV_LINE) { const ICurveLine* pOthLine = GetCurveLine( pNextCurve) ; Point3d ptOthStart = pOthLine->GetStart() ; @@ -2940,7 +2940,7 @@ VolZmap::GenTool_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d else { // Passo alla curva successiva pPrevCurve = pCurve ; - pCurve = pToolProfile->GetNextCurve() ; + pCurve = ToolProfile.GetNextCurve() ; } } @@ -2961,7 +2961,7 @@ VolZmap::GenTool_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d dHeight = abs( ptStart.y - ptEnd.y) ; // Passo alla curva successiva pPrevCurve = pCurve ; - pCurve = pToolProfile->GetNextCurve() ; + pCurve = ToolProfile.GetNextCurve() ; } // Determino le posizioni iniziale e finale del componente successivo @@ -2982,9 +2982,9 @@ VolZmap::GenTool_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& Vector3d vtMove = ptE - ptS ; // Ciclo sulle curve del profilo - const CurveComposite* pToolProfile = m_Tool.GetOutline() ; + const CurveComposite& ToolProfile = m_Tool.GetApproxOutline() ; const ICurve* pPrevCurve = nullptr ; - const ICurve* pCurve = pToolProfile->GetFirstCurve() ; + const ICurve* pCurve = ToolProfile.GetFirstCurve() ; while ( pCurve != nullptr) { double dHeight ; @@ -3009,7 +3009,7 @@ VolZmap::GenTool_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& } // verifiche curva successiva per eventuale tappo sotto bool bTapB = false ; - const ICurve* pNextCurve = pToolProfile->GetNextCurve() ; + const ICurve* pNextCurve = ToolProfile.GetNextCurve() ; if ( pNextCurve != nullptr && pNextCurve->GetType() == CRV_LINE) { const ICurveLine* pOthLine = GetCurveLine( pNextCurve) ; Point3d ptOthStart = pOthLine->GetStart() ; @@ -3043,7 +3043,7 @@ VolZmap::GenTool_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& else { // Passo alla curva successiva pPrevCurve = pCurve ; - pCurve = pToolProfile->GetNextCurve() ; + pCurve = ToolProfile.GetNextCurve() ; } } @@ -3064,7 +3064,7 @@ VolZmap::GenTool_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& dHeight = abs( ptStart.y - ptEnd.y) ; // Passo alla curva successiva pPrevCurve = pCurve ; - pCurve = pToolProfile->GetNextCurve() ; + pCurve = ToolProfile.GetNextCurve() ; } // Determino le posizioni iniziale e finale del componente successivo