From 8318dcc2a882d7e9347d4d9fb260a3e17ac189fc Mon Sep 17 00:00:00 2001 From: DarioS Date: Sun, 29 Aug 2021 19:31:35 +0200 Subject: [PATCH 1/4] =?UTF-8?q?EgtMachKernel=20:=20-=20nella=20lavorazione?= =?UTF-8?q?=20di=20Finitura=20Superfici=20=C3=A8=20ora=20specificare=20qua?= =?UTF-8?q?li=20superfici=20considerare=20(se=20non=20si=20specificano=20s?= =?UTF-8?q?ono=20considerate=20tutte).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SurfFinishing.cpp | 62 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 19 deletions(-) diff --git a/SurfFinishing.cpp b/SurfFinishing.cpp index f328878..5d57601 100644 --- a/SurfFinishing.cpp +++ b/SurfFinishing.cpp @@ -840,28 +840,39 @@ bool SurfFinishing::VerifyGeometry( SelData Id, int& nSubs) { // ammessi : curve o superfici - - // per ora accetto solo curve - const ICurve* pCurve = nullptr ; const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ; - // se direttamente la curva - if ( Id.nSub == SEL_SUB_ALL) { - pCurve = ::GetCurve( pGObj) ; - if ( pCurve != nullptr) { - if ( pCurve->GetType() == CRV_COMPO) - nSubs = ::GetCurveComposite( pCurve)->GetCurveCount() ; - else - nSubs = 0 ; + if ( pGObj == nullptr) + return false ; + // se curva + if ( ( pGObj->GetType() & GEO_CURVE) != 0) { + const ICurve* pCurve = nullptr ; + // se direttamente la curva + if ( Id.nSub == SEL_SUB_ALL) { + pCurve = ::GetCurve( pGObj) ; + if ( pCurve != nullptr) { + if ( pCurve->GetType() == CRV_COMPO) + nSubs = ::GetCurveComposite( pCurve)->GetCurveCount() ; + else + nSubs = 0 ; + } } + // altrimenti sottocurva di composita + else { + const ICurveComposite* pCompo = GetCurveComposite( pGObj) ; + if ( pCompo != nullptr) + pCurve = pCompo->GetCurve( Id.nSub) ; + nSubs = 0 ; + } + return ( pCurve != nullptr) ; } - // altrimenti sottocurva di composita - else { - const ICurveComposite* pCompo = GetCurveComposite( pGObj) ; - if ( pCompo != nullptr) - pCurve = pCompo->GetCurve( Id.nSub) ; - nSubs = 0 ; + // se altrimenti è superficie trimesh + else if ( pGObj->GetType() == SRF_TRIMESH) { + const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ; + return ( pSurf != nullptr && pSurf->GetFacetCount() >= 1) ; } - return ( pCurve != nullptr) ; + // altrimenti errore + else + return false ; } //---------------------------------------------------------------------------- @@ -921,6 +932,10 @@ SurfFinishing::GetCurves( SelData Id, ICURVEPLIST& lstPC) lstPC.emplace_back( Release( pCurve)) ; return true ; } + // se altrimenti superficie + else if ( pGObj->GetType() == SRF_TRIMESH) + return true ; + // altrimenti errore else return false ; } @@ -1222,7 +1237,16 @@ SurfFinishing::GetActiveSurfaces( INTVECTOR& vSurfId) const // verifiche if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) return false ; - // ciclo sui grezzi attivi nella fase + // cerco tra gli oggetti selezionati + for ( const auto& Id : m_vId) { + int nEntId = Id.nId ; + if ( m_pGeomDB->GetGeoType( nEntId) == SRF_TRIMESH) + vSurfId.emplace_back( nEntId) ; + } + // se trovate superfici, considero solo queste ed esco + if ( ! vSurfId.empty()) + return true ; + // altrimenti considero tutte le superfici dei pezzi nei grezzi attivi della fase int nRawId = m_pMchMgr->GetFirstRawPart() ; while ( nRawId != GDB_ID_NULL) { if ( m_pMchMgr->VerifyRawPartPhase(nRawId, m_nPhase)) { From b3a13a94bb34925ad93a90a85b9556592175330b Mon Sep 17 00:00:00 2001 From: DarioS Date: Mon, 6 Sep 2021 10:24:14 +0200 Subject: [PATCH 2/4] EgtMachKernel 2.3i1 : - link tra lavorazioni con maggiori sicurezze - corretta gestione svuotature da sotto con testa da sotto. --- EgtMachKernel.rc | Bin 11774 -> 11774 bytes Operation.cpp | 6 +++--- Pocketing.cpp | 30 ++++++++++++++++++------------ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 5ca33c8975edd401dd83397881491aae1c24a251..313c1538bb6663fe0cd4c1ee1a34776dd11b77f1 100644 GIT binary patch delta 121 zcmewt{V#gMH#SyF1|0^&&A-{KnVB;g3@1O7)ZLuM)x!c8zsNNCgkT;*P6$a3MUMyL R=2g-z%(yjz6ex#q0RVOLCb$3q delta 121 zcmewt{V#gMH#Sxa1|0^Y&A-{KnVB;fj3z&n)ZLuM)x!c8zsNNCgkT;*P6$a3MUMyL R=2g-z%(yjz6ex#q0RVN|Cb$3q diff --git a/Operation.cpp b/Operation.cpp index aa0f140..0c1b468 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -1840,7 +1840,7 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink) dSafeZ = dUnsafeZ ; } else { - for ( int i = 1 ; i <= 4 ; ++ i) { + for ( int i = 1 ; i <= 3 ; ++ i) { double dTestSafeZ = ( dUnsafeZ + dSafeZ) / 2 ; vAxVal2[2] = dTestSafeZ ; vAxIni2[2] = dTestSafeZ ; @@ -2035,7 +2035,7 @@ Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation* // riprovo con una Z intermedia double dSafeZ = dHomeZ ; double dUnsafeZ = dTopZ ; - for ( int i = 1 ; i <= 4 ; ++ i) { + for ( int i = 1 ; i <= 3 ; ++ i) { double dTestSafeZ = ( dUnsafeZ + dSafeZ) / 2 ; vAxPrevTmp[2] = dTestSafeZ ; vAxCurrTmp[2] = dTestSafeZ ; @@ -2656,7 +2656,7 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn INTVECTOR vCollId ; pMch->GetCurrHeadCollGroups( vCollId) ; // distanza di sicurezza - const double TOL_SAFEDIST = 10.0 ; + const double TOL_SAFEDIST = 5.0 ; const double MIN_SAFEDIST = 10.0 ; double dSafeDist = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ; dSafeDist = max( dSafeDist - TOL_SAFEDIST, MIN_SAFEDIST) ; diff --git a/Pocketing.cpp b/Pocketing.cpp index 7bfa04f..b9b8a57 100644 --- a/Pocketing.cpp +++ b/Pocketing.cpp @@ -2018,8 +2018,9 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con double dStElev ; if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev)) dStElev = j * dStep ; - bool bUnderRaw = GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; - if ( bUnderRaw == m_bAboveHead) + bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom && + GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; + if ( bUnderRaw) dStElev = max( dStElev, j * dStep) ; dStElev -= ( ptP1 - ptStart) * vtExtr ; // se inizio, approccio globale al punto iniziale @@ -2157,8 +2158,9 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con double dStElev ; if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev)) dStElev = dStep ; - bool bUnderRaw = GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; - if ( bUnderRaw == m_bAboveHead) + bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom && + GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; + if ( bUnderRaw) dStElev = max( dStElev, dStep) ; dStElev -= ( ptP1 - ptStart) * vtExtr ; // se attacco a zigzag o a spirale o a scivolo, l'elevazione va nell'attacco @@ -2525,8 +2527,9 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con double dStElev ; if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev)) dStElev = dStep ; - bool bUnderRaw = GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; - if ( bUnderRaw == m_bAboveHead) + bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom && + GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; + if ( bUnderRaw) dStElev = max( dStElev, dStep) ; dStElev -= ( ptP1 - ptStart) * vtExtr ; // se attacco a zigzag o a spirale o a scivolo, l'elevazione va nell'attacco @@ -2678,8 +2681,9 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con double dStElev ; if ( ! GetElevation( m_nPhase, ptS - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev)) dStElev = j * dStep ; - bool bUnderRaw = GetPointUnderRaw( ptP, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; - if ( bUnderRaw == m_bAboveHead) + bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom && + GetPointUnderRaw( ptP, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; + if ( bUnderRaw) dStElev = max( dStElev, j * dStep) ; dStElev -= ( ptP - ptS) * vtExtr ; // sempre approccio di collegamento @@ -2824,8 +2828,9 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c double dStElev ; if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev)) dStElev = dStep ; - bool bUnderRaw = GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; - if ( bUnderRaw == m_bAboveHead) + bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom && + GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; + if ( bUnderRaw) dStElev = max( dStElev, dStep) ; dStElev -= ( ptP1 - ptStart) * vtExtr ; // se attacco a zigzag o a spirale o a scivolo, l'elevazione va nell'attacco @@ -3010,8 +3015,9 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool, double dStElev ; if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev)) dStElev = dStep ; - bool bUnderRaw = GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; - if ( bUnderRaw == m_bAboveHead) + bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom && + GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; + if ( bUnderRaw) dStElev = max( dStElev, dStep) ; dStElev -= ( ptP1 - ptStart) * vtExtr ; // se attacco a zigzag o a spirale o a scivolo, l'elevazione va nell'attacco From 7b3a544c9fae497da02c3f2794fcaf06297c1a77 Mon Sep 17 00:00:00 2001 From: DarioS Date: Tue, 7 Sep 2021 18:04:02 +0200 Subject: [PATCH 3/4] EgtMachKernel 2.3i2 : - modifiche alla verifica Z sicura per link tra lavorazioni. --- EgtMachKernel.rc | Bin 11774 -> 11774 bytes Operation.cpp | 10 ++++++++++ 2 files changed, 10 insertions(+) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 313c1538bb6663fe0cd4c1ee1a34776dd11b77f1..2f04ae0eae80cdbc44abe81cc96cf8c3e6ba16db 100644 GIT binary patch delta 97 zcmewt{V#gMFE&P_&A-`fnHh~HKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmU8!BZvS1 delta 97 zcmewt{V#gMFE&QQ&A-`fnHdcyKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmU3rBY*$^ diff --git a/Operation.cpp b/Operation.cpp index 0c1b468..14b07eb 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -1853,6 +1853,16 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink) } } } + // se necessario, riprovo appena prima di Zmax + if ( ! bPartRise) { + double dOffsZ = 5 * ( bZHomeDown ? 1 : -1) ; + vAxVal2[2] = dHomeZ + dOffsZ ; + vAxIni2[2] = dHomeZ + dOffsZ ; + if ( TestCollisionAvoid( vAxVal2, vAxIni2)) { + bPartRise = true ; + dSafeZ = dOffsZ ; + } + } if ( ! bPartRise) { // cancello eventuale risalita parziale della lavorazione precedente pPrevOp->RemoveRise() ; From 0c3ad1ebe5a0fec28823a7a0608055f631ec93cc Mon Sep 17 00:00:00 2001 From: DarioS Date: Tue, 7 Sep 2021 18:44:54 +0200 Subject: [PATCH 4/4] EgtMachKernel 2.3i3 : - corretta recente modifica per calcolo Zsafe in link tra lavorazioni. --- EgtMachKernel.rc | Bin 11774 -> 11774 bytes Operation.cpp | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 2f04ae0eae80cdbc44abe81cc96cf8c3e6ba16db..01e3d387ca8b7988603395a8072d5833d287c4f5 100644 GIT binary patch delta 97 zcmewt{V#gMFE&Qw&A-`fnHh~IKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmUD-Bai?9 delta 97 zcmewt{V#gMFE&P_&A-`fnHh~HKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmU8!BZvS1 diff --git a/Operation.cpp b/Operation.cpp index 14b07eb..748b2f8 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -1860,7 +1860,7 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink) vAxIni2[2] = dHomeZ + dOffsZ ; if ( TestCollisionAvoid( vAxVal2, vAxIni2)) { bPartRise = true ; - dSafeZ = dOffsZ ; + dSafeZ = dHomeZ + dOffsZ ; } } if ( ! bPartRise) {