From dffc7ec956210af7c0309cfd6937ce11ab2fe336 Mon Sep 17 00:00:00 2001 From: DarioS Date: Tue, 20 Sep 2022 07:50:41 +0200 Subject: [PATCH] EgtMachKernel 2.4i3 : - in lavorazione WaterJet aggiunta gestione ponticelli. --- EgtMachKernel.rc | Bin 11774 -> 11774 bytes MachConst.h | 2 + WaterJetting.cpp | 107 +++++++++++++++++++++++++++++++++++++++++++++++ WaterJetting.h | 1 + 4 files changed, 110 insertions(+) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 95f622f3d2750ceb40de48812cf858f0ab1d6e59..7eafb922d31a4c3976ba39d36becc97973886c11 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/MachConst.h b/MachConst.h index 1532eab..f1731b9 100644 --- a/MachConst.h +++ b/MachConst.h @@ -31,6 +31,8 @@ const std::string MACH_FIXT_GROUP = "Fixt" ; const std::string MACH_SETUP_GROUP = "Setup" ; // Gruppo dei grezzi in una macchinata const std::string MACH_RAW_GROUP = "Raws" ; +// Gruppo dei collegamenti per waterjet in una macchinata +const std::string MACH_BRIDGES_GROUP = "Bridges" ; // Gruppo delle operazioni in una macchinata const std::string MACH_OPER_GROUP = "Opers" ; // Chiave per info fase di appartenenza di una fixture diff --git a/WaterJetting.cpp b/WaterJetting.cpp index e443110..ae7f88c 100644 --- a/WaterJetting.cpp +++ b/WaterJetting.cpp @@ -1177,6 +1177,11 @@ WaterJetting::Chain( int nGrpDestId) vInds.emplace_back( Id) ; } } + // verifico se sono necessarie sistemazioni per collegamenti (bridges) + if ( abs( m_Params.m_dSideAngle) < EPS_ANG_SMALL && + m_pGeomDB->GetFirstNameInGroup( m_pMchMgr->GetCurrMachGroup(), MACH_BRIDGES_GROUP) != GDB_ID_NULL) { + AdjustCurvesForBridges( vpCrvs, vInds) ; + } // preparo i dati per il concatenamento bool bFirst = true ; Point3d ptNear = ORIG ; @@ -1263,6 +1268,108 @@ WaterJetting::Chain( int nGrpDestId) return true ; } +//---------------------------------------------------------------------------- +bool +WaterJetting::AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs, SELVECTOR& vInds) +{ + // Gruppo dei collegamenti + struct Bridge { + int nId ; + int nEnt1 ; + int nEnt2 ; + double dWidth ; + Point3d ptP1 ; + Point3d ptP2 ; + Bridge( int nI, int nE1, int nE2, double dW, const Point3d& ptQ1, const Point3d& ptQ2) + : nId( nI), nEnt1( nE1), nEnt2( nE2), dWidth( dW), ptP1( ptQ1), ptP2( ptQ2) {} + } ; + vector vBridges ; + int nBridGrpId = m_pGeomDB->GetFirstNameInGroup( m_pMchMgr->GetCurrMachGroup(), MACH_BRIDGES_GROUP) ; + int nBridgeId = m_pGeomDB->GetFirstInGroup( nBridGrpId) ; + while ( nBridgeId != GDB_ID_NULL) { + int nEnt1, nEnt2 ; + double dWidth ; + Point3d ptP1, ptP2 ; + if ( m_pGeomDB->GetInfo( nBridgeId, "EntStart", nEnt1) && + m_pGeomDB->GetInfo( nBridgeId, "EntEnd", nEnt2) && + m_pGeomDB->GetInfo( nBridgeId, "BridgeW", dWidth) && + ExeStartPoint( nBridgeId, GDB_ID_ROOT, ptP1) && + ExeEndPoint( nBridgeId, GDB_ID_ROOT, ptP2)) { + vBridges.emplace_back( nBridgeId, nEnt1, nEnt2, dWidth, ptP1, ptP2) ; + } + nBridgeId = m_pGeomDB->GetNext( nBridgeId) ; + } + + // Verifico i collegamenti che interessano le geometrie della lavorazione + for ( int i = 0 ; i < int( vBridges.size()) ; ++ i) { + // cerco le due curve interessate dal collegamento + int nI1 = -1 ; + for ( int j = 0 ; j < int( vInds.size()) ; ++ j) { + if ( vInds[j].nId == vBridges[i].nEnt1) { + nI1 = j ; + break ; + } + } + int nI2 = -1 ; + for ( int j = 0 ; j < int( vInds.size()) ; ++ j) { + if ( vInds[j].nId == vBridges[i].nEnt2) { + nI2 = j ; + break ; + } + } + if ( nI1 == -1 || nI2 == -1) + continue ; + // calcolo e verifico la posizione dei punti di collegamento sulle due curve + double const DIST_MAX = 5 ; + double dDist1, dU1, dLenP1, dLen1 ; int nF1 ; + DistPointCurve distPC1( vBridges[i].ptP1, *vpCrvs[nI1]) ; + if ( ! distPC1.GetDist( dDist1) || dDist1 > DIST_MAX || + ! distPC1.GetParamAtMinDistPoint( 0, dU1, nF1) || + ! vpCrvs[nI1]->GetLengthAtParam( dU1, dLenP1) || + ! vpCrvs[nI1]->GetLength( dLen1) || + dLenP1 < vBridges[i].dWidth + m_TParams.m_dDiam || + ( dLen1 - dLenP1) < vBridges[i].dWidth + m_TParams.m_dDiam) + continue ; + double dDist2, dU2, dLenP2, dLen2 ; int nF2 ; + DistPointCurve distPC2( vBridges[i].ptP2, *vpCrvs[nI2]) ; + if ( ! distPC2.GetDist( dDist2) || dDist2 > DIST_MAX || + ! distPC2.GetParamAtMinDistPoint( 0, dU2, nF2) || + ! vpCrvs[nI2]->GetLengthAtParam( dU2, dLenP2) || + ! vpCrvs[nI2]->GetLength( dLen2) || + dLenP2 < vBridges[i].dWidth + m_TParams.m_dDiam || + ( dLen2 - dLenP2) < vBridges[i].dWidth + m_TParams.m_dDiam) + continue ; + // spezzo le curve nei punti del collegamento e creo i segmenti di collegamento + PtrOwner pCopy1( vpCrvs[nI1]->Clone()) ; + PtrOwner pCopy2( vpCrvs[nI2]->Clone()) ; + PtrOwner pLinkA( CreateCurveLine()) ; + PtrOwner pLinkB( CreateCurveLine()) ; + if ( IsNull( pCopy1) || IsNull( pCopy2) || IsNull( pLinkA) || IsNull( pLinkB)) + continue ; + vpCrvs[nI1]->TrimEndAtLen( dLenP1 - vBridges[i].dWidth / 2) ; + pCopy1->TrimStartAtLen( dLenP1 + vBridges[i].dWidth / 2) ; + vpCrvs[nI2]->TrimEndAtLen( dLenP2 - vBridges[i].dWidth / 2) ; + pCopy2->TrimStartAtLen( dLenP2 + vBridges[i].dWidth / 2) ; + Point3d ptAs ; vpCrvs[nI1]->GetEndPoint( ptAs) ; + Point3d ptAe ; pCopy2->GetStartPoint( ptAe) ; + pLinkA->Set( ptAs, ptAe) ; + Point3d ptBs ; vpCrvs[nI2]->GetEndPoint( ptBs) ; + Point3d ptBe ; pCopy1->GetStartPoint( ptBe) ; + pLinkB->Set( ptBs, ptBe) ; + // inserisco le nuove curve nel vettore delle curve e aggiorno il vettore degli indici + vpCrvs.emplace_back( Release( pCopy1)) ; + vInds.emplace_back( vInds[nI1]) ; + vpCrvs.emplace_back( Release( pCopy2)) ; + vInds.emplace_back( vInds[nI2]) ; + vpCrvs.emplace_back( Release( pLinkA)) ; + vInds.emplace_back( 0, 0) ; + vpCrvs.emplace_back( Release( pLinkB)) ; + vInds.emplace_back( 0, 0) ; + } + + return true ; +} + //---------------------------------------------------------------------------- bool WaterJetting::VerifySideAngle( void) diff --git a/WaterJetting.h b/WaterJetting.h index 5225649..5c1636e 100644 --- a/WaterJetting.h +++ b/WaterJetting.h @@ -72,6 +72,7 @@ class WaterJetting : public Machining bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ; bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ; bool Chain( int nGrpDestId) ; + bool AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs, SELVECTOR& vInds) ; bool VerifySideAngle( void) ; bool ProcessPath( int nPathId, int nPvId, int nClId) ; bool AdjustPathForInternalAngles( ICurveComposite* pCompo) ;