From 3cc3ddd9b71dfd81a60bac081992ddfd55fb8acc Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 12 Mar 2019 08:16:41 +0000 Subject: [PATCH] EgtMachKernel : - modifiche a tagli di lama su segmenti di retta per allungamento baffi da comandi speciali (SWE= e EWE=) in note utente. --- Sawing.cpp | 36 +++++++++++++++++++++++++----------- Sawing.h | 2 +- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/Sawing.cpp b/Sawing.cpp index cf96970..0d2c043 100644 --- a/Sawing.cpp +++ b/Sawing.cpp @@ -1540,14 +1540,26 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve } } + // recupero eventuali estensioni dei baffi (whiskers) + double dStartWhiskExt = 0 ; + if ( m_Params.m_nLeadInType == SAW_LI_CENT) + FromString( ExtractInfo( m_Params.m_sUserNotes, "SWE="), dStartWhiskExt) ; + double dEndWhiskExt = 0 ; + if ( m_Params.m_nLeadOutType == SAW_LO_CENT) + FromString( ExtractInfo( m_Params.m_sUserNotes, "EWE="), dEndWhiskExt) ; + // Se richiesto Preview if ( nPvId != GDB_ID_NULL) { - if ( ! GenerateLinePv( pLine, vtTool, vtCorr, dElev, dExtraCut, dRbHeight, sName, nPvId)) + if ( ! GenerateLinePv( pLine, vtTool, vtCorr, dElev, dExtraCut, dRbHeight, sName, dStartWhiskExt, dEndWhiskExt, nPvId)) return false ; } // Se richiesta geometria di lavorazione if ( nClId != GDB_ID_NULL) { + if ( dStartWhiskExt > EPS_SMALL) + pLine->ExtendStartByLen( dStartWhiskExt) ; + if ( dEndWhiskExt > EPS_SMALL) + pLine->ExtendEndByLen( dEndWhiskExt) ; if ( ! GenerateLineCl( pLine, vtTool, vtCorr, dElev, dExtraCut, sName, dDeltaLiExt, dDeltaLoExt, FvVar, nClId)) return false ; } @@ -1561,7 +1573,7 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve //---------------------------------------------------------------------------- bool Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const Vector3d& vtCorr, - double dElev, double dExtraCut, double dRbHeight, const string& sName, int nPvId) + double dElev, double dExtraCut, double dRbHeight, const string& sName, double dStartWhiskExt, double dEndWhiskExt, int nPvId) { // creo gruppo per anteprima di lavorazione della linea int nPxId = m_pGeomDB->AddGroup( GDB_ID_NULL, nPvId, Frame3d()) ; @@ -1579,6 +1591,8 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V Vector3d vtDZ( 0, 0, 0.1) ; // distanza XY tra centro e bordo taglio double dDeltaT = (( dElev < 0.5 * m_TParams.m_dDiam) ? sqrt( dElev * m_TParams.m_dDiam - dElev * dElev) : 0) ; + double dDtIni = dDeltaT + dStartWhiskExt ; + double dDtEnd = dDeltaT + dEndWhiskExt ; // direzione del taglio Vector3d vtDir ; pLine->GetStartDir( vtDir) ; @@ -1596,13 +1610,13 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V m_pGeomDB->SetMaterial( nId, colCut) ; // rettangolo per parte parziale iniziale - int nId2 = ExeCreateRectangle3P( nPxId, ptIni - vtDir * dDeltaT, ptIni + vtToolH, ptIni, RTY_LOC) ; + int nId2 = ExeCreateRectangle3P( nPxId, ptIni - vtDir * dDtIni, ptIni + vtToolH, ptIni, RTY_LOC) ; // assegno nome e colore m_pGeomDB->SetName( nId2, MCH_PV_PRE_CUT) ; m_pGeomDB->SetMaterial( nId2, BLUE) ; // rettangolo per parte parziale finale - int nId3 = ExeCreateRectangle3P( nPxId, ptEnd, ptCross + vtDir * dDeltaT, ptEnd + vtDir * dDeltaT, RTY_LOC) ; + int nId3 = ExeCreateRectangle3P( nPxId, ptEnd, ptCross + vtDir * dDtEnd, ptEnd + vtDir * dDtEnd, RTY_LOC) ; // assegno nome e colore m_pGeomDB->SetName( nId3, MCH_PV_POST_CUT) ; m_pGeomDB->SetMaterial( nId3, BLUE) ; @@ -1625,8 +1639,8 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V } // regione di taglio completo per nesting - int nRId = ExeCreateSurfFrRectangle3P( nPxId, ptRIni - vtDir * ( dDeltaT + dExtraL), - ptRCross + vtDir * ( dDeltaT + dExtraL), ptREnd, RTY_LOC) ; + int nRId = ExeCreateSurfFrRectangle3P( nPxId, ptRIni - vtDir * ( dDtIni + dExtraL), + ptRCross + vtDir * ( dDtEnd + dExtraL), ptREnd, RTY_LOC) ; m_pGeomDB->SetName( nRId, MCH_PV_RCUT) ; m_pGeomDB->SetMaterial( nRId, INVISIBLE) ; // regione di taglio ridotto per nesting (sono escluse le parti iniziale e finale) @@ -1636,13 +1650,13 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V m_pGeomDB->SetName( nRrId, MCH_PV_RRCUT) ; m_pGeomDB->SetMaterial( nRrId, INVISIBLE) ; // regione di ingresso al taglio (parte iniziale) - int nRsId = ExeCreateSurfFrRectangle3P( nPxId, ptRIni - vtDir * ( dDeltaT + dExtraL), + int nRsId = ExeCreateSurfFrRectangle3P( nPxId, ptRIni - vtDir * ( dDtIni + dExtraL), ptRIni + vtRToolH, ptRIni, RTY_LOC) ; m_pGeomDB->SetName( nRsId, MCH_PV_RLICUT) ; m_pGeomDB->SetMaterial( nRsId, INVISIBLE) ; // regione di uscita dal taglio (parte finale) - int nReId = ExeCreateSurfFrRectangle3P( nPxId, ptREnd, ptRCross + vtDir * ( dDeltaT + dExtraL), - ptREnd + vtDir * ( dDeltaT + dExtraL) , RTY_LOC) ; + int nReId = ExeCreateSurfFrRectangle3P( nPxId, ptREnd, ptRCross + vtDir * ( dDtEnd + dExtraL), + ptREnd + vtDir * ( dDtEnd + dExtraL) , RTY_LOC) ; m_pGeomDB->SetName( nReId, MCH_PV_RLOCUT) ; m_pGeomDB->SetMaterial( nReId, INVISIBLE) ; @@ -1660,11 +1674,11 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V m_pGeomDB->SetName( nDwnId, MCH_PV_DOWN_CUT) ; m_pGeomDB->SetMaterial( nDwnId, colCut) ; // rettangolo per parte parziale iniziale - int nDwnId2 = ExeCreateRectangle3P( nPxId, ptIni - vtDir * dDeltaT, ptIni + vtToolH + vtMove, ptIni, RTY_LOC) ; + int nDwnId2 = ExeCreateRectangle3P( nPxId, ptIni - vtDir * dDtIni, ptIni + vtToolH + vtMove, ptIni, RTY_LOC) ; m_pGeomDB->SetName( nDwnId2, MCH_PV_DOWN_PRE_CUT) ; m_pGeomDB->SetMaterial( nDwnId2, BLUE) ; // rettangolo per parte parziale finale - int nDwnId3 = ExeCreateRectangle3P( nPxId, ptEnd, ptCross + vtDir * dDeltaT + vtMove, ptEnd + vtDir * dDeltaT, RTY_LOC) ; + int nDwnId3 = ExeCreateRectangle3P( nPxId, ptEnd, ptCross + vtDir * dDtEnd + vtMove, ptEnd + vtDir * dDtEnd, RTY_LOC) ; m_pGeomDB->SetName( nDwnId3, MCH_PV_DOWN_POST_CUT) ; m_pGeomDB->SetMaterial( nDwnId3, BLUE) ; // regione di taglio completo per nesting diff --git a/Sawing.h b/Sawing.h index 8344946..807a8ad 100644 --- a/Sawing.h +++ b/Sawing.h @@ -81,7 +81,7 @@ class Sawing : public Machining double dDepth, double dExtraCut, double dRbHeight, bool bIsFirst, bool bIsLast, const std::string& sName, int nPvId, int nClId) ; bool GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const Vector3d& vtCorr, - double dElev, double dExtraCut, double dRbHeight, const std::string& sName, int nPvId) ; + double dElev, double dExtraCut, double dRbHeight, const std::string& sName, double dStartWhiskExt, double dEndWhiskExt, int nPvId) ; bool GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, double dExtraCut, const std::string& sName, double dDeltaLiExt, double dDeltaLoExt, const FseVar& FvVar, int nClId) ; bool ProcessExtCurve( const ICurve* pCrvP, const ICurveComposite* pCrvC, const ICurve* pCrvN,