From 9588b2de83f0c9480990ca1fa76c51f4d3fdce28 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Wed, 25 Nov 2015 10:46:36 +0000 Subject: [PATCH] EgtMachKernel : - aggiunta gestione RB per affondamento taglio con lama. --- Sawing.cpp | 36 +++++++++++++++++++++++++++++++++--- Sawing.h | 1 + 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/Sawing.cpp b/Sawing.cpp index e3bad4c..dff0a7f 100644 --- a/Sawing.cpp +++ b/Sawing.cpp @@ -353,7 +353,8 @@ Sawing::Apply( void) // lavoro ogni singola catena int nPathId = m_pGeomDB->GetFirstGroupInGroup( nAuxId) ; while ( nPathId != GDB_ID_NULL) { - PathApply( nPathId, nClId) ; + if ( ! PathApply( nPathId, nClId)) + return false ; nPathId = m_pGeomDB->GetNextGroup( nPathId) ; } @@ -765,9 +766,14 @@ Sawing::PathApply( int nPathId, int nClId) double dThick ; pCompo->GetThickness( dThick) ; + // recupero distanza da fondo dei grezzi interessati dal percorso + double dRbDist ; + if ( ! GetDistanceFromRawBottom( nCopyId, 2 * m_TParams.m_dThick, dRbDist)) + return false ; + // valuto l'espressione dell'affondamento - string sExec = "TH=" + (( dThick * vtExtr.z < 0) ? ToString( fabs( dThick)) : ToString( 0)) ; - ExeLuaExecLine( sExec) ; + ExeLuaSetGlobNumVar( "TH", (( dThick * vtExtr.z < 0) ? fabs( dThick) : 0)) ; + ExeLuaSetGlobNumVar( "RB", dRbDist) ; double dDepth ; if ( ! ExeLuaEvalNumExpr( m_Params.m_sDepth, &dDepth)) { string sOut = "Depth not computable by Sawing" ; @@ -1044,3 +1050,27 @@ Sawing::AdjustPositionForAxesCalc( const CamData* pCamData, Point3d& ptP) return true ; } + +//---------------------------------------------------------------------------- +bool +Sawing::GetDistanceFromRawBottom( int nPathId, double dToler, double & dRbDist) +{ + // recupero distanza da fondo dei grezzi interessati dal percorso + dRbDist = 0 ; + BBox3d b3Compo ; + if ( ! m_pGeomDB->GetGlobalBBox( nPathId, b3Compo)) + return false ; + b3Compo.Expand( dToler, dToler, 0) ; + int nRawId = m_pMchMgr->GetFirstRawPart() ; + while ( nRawId != GDB_ID_NULL) { + BBox3d b3Raw ; + int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ; + if ( m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw) && b3Compo.OverlapsXY( b3Raw)) { + double dDist = b3Compo.GetMax().z - b3Raw.GetMin().z ; + if ( dDist > dRbDist) + dRbDist = dDist ; + } + nRawId = m_pMchMgr->GetNextRawPart( nRawId) ; + } + return true ; +} diff --git a/Sawing.h b/Sawing.h index bc1f43d..ed6fc9d 100644 --- a/Sawing.h +++ b/Sawing.h @@ -60,6 +60,7 @@ class Sawing : public Machining bool CalculateToolAndCorrVersors( const ICurve* pCurve, Vector3d& vtTool, Vector3d& vtCorr) ; bool AdjustForSide( ICurve* pCurve) ; bool AdjustForEdges( ICurveLine* pLine, double dElev, bool bIsFirst, bool bIsLast, bool bExtAngPC, bool bExtAngCN) ; + bool GetDistanceFromRawBottom( int nPathId, double dToler, double& dRbDist) ; private : SELVECTOR m_vId ; // identificativi entità geometriche da lavorare