From 01854f30ed08fa67ae99a082cd762172a5b87844 Mon Sep 17 00:00:00 2001 From: DarioS Date: Fri, 7 Jul 2023 17:08:56 +0200 Subject: [PATCH 1/5] EgtMachKernel 2.5g1 : - in svuotatura corretta gestione forzatura contorni chiusi (Open=0 in UserNotes della lavorazione) con i casi ottimizzati. --- EgtMachKernel.rc | Bin 11774 -> 11774 bytes Pocketing.cpp | 57 +++++++++++++++++++++++++++-------------------- Pocketing.h | 3 ++- 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index a2cd5a3667db460d70d3791739ce2127011b1521..19ed852938d01be548bdfa04a69601dd23370867 100644 GIT binary patch delta 121 zcmewt{V#gMH#Syt1|0^&&A-{KnVHiW3@1O7)ZLuM)x!c8zsNNCgkT;*P6$a3MUMyL R=2g-z%(yjz6ex#q0RVBoCa3@a delta 121 zcmewt{V#gMH#Sx?1|0_D&A-{KnVHiVj3+;o)ZLuM)x!c8zsNNCgkT;*P6$a3MUMyL R=2g-z%(yjz6ex#q0RVHUCa?ei diff --git a/Pocketing.cpp b/Pocketing.cpp index 3499e53..c4e10ef 100644 --- a/Pocketing.cpp +++ b/Pocketing.cpp @@ -1087,7 +1087,7 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC) // la duplico pCurve.Set( pOriCurve->Clone()) ; // recupero eventuali informazioni per lati aperti - SetCurveAllTempProp( Id.nId, pCurve) ; + SetCurveAllTempProp( Id.nId, false, pCurve) ; // se estrusione mancante, imposto default Vector3d vtExtr ; if ( ! pCurve->GetExtrusion( vtExtr) || vtExtr.IsSmall()) @@ -1249,14 +1249,16 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC) //---------------------------------------------------------------------------- bool -Pocketing::SetCurveAllTempProp( int nCrvId, ICurve* pCurve) +Pocketing::SetCurveAllTempProp( int nCrvId, bool bForcedClose, ICurve* pCurve, bool* pbSomeOpen) { if ( pCurve == nullptr) return false ; + if ( pbSomeOpen != nullptr) + *pbSomeOpen = false ; // reset proprietà temporanee ResetCurveAllTempProp( pCurve) ; - // verifico se presenti info per lati aperti - if ( ! m_pGeomDB->ExistsInfo( nCrvId, KEY_OPEN)) + // se forzato chiuso o non presenti info per lati aperti, esco + if ( bForcedClose || ! m_pGeomDB->ExistsInfo( nCrvId, KEY_OPEN)) return true ; // recupero info sui lati aperti INTVECTOR vOpen ; @@ -1264,13 +1266,20 @@ Pocketing::SetCurveAllTempProp( int nCrvId, ICurve* pCurve) // se curva composita ICurveComposite* pCC = GetCurveComposite( pCurve) ; if ( pCC != nullptr) { - for ( int j : vOpen) - pCC->SetCurveTempProp( j, 1) ; + for ( int j : vOpen) { + if ( pCC->SetCurveTempProp( j, 1)) { + if ( pbSomeOpen != nullptr) + *pbSomeOpen = true ; + } + } } // altrimenti else { - if ( ! vOpen.empty() && vOpen[0] == 0) + if ( ! vOpen.empty() && vOpen[0] == 0) { pCurve->SetTempProp( 1) ; + if ( pbSomeOpen != nullptr) + *pbSomeOpen = true ; + } } return true ; } @@ -1450,20 +1459,8 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId) pCompo->SetCurveTempProp( i, 0) ; // verifico se vanno gestiti i lati aperti - bool bSomeOpen = m_pGeomDB->ExistsInfo( nCrvId, KEY_OPEN) ; - if ( bSomeOpen) { - int nOpen ; - if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "Open="), nOpen) && nOpen == 0) - bSomeOpen = false ; - } - - // aggiorno flag per lati aperti - if ( bSomeOpen) { - INTVECTOR vOpen ; - m_pGeomDB->GetInfo( nCrvId, KEY_OPEN, vOpen) ; - for ( int j : vOpen) - pCompo->SetCurveTempProp( j, 1) ; - } + bool bSomeOpen ; + SetCurveAllTempProp( nCrvId, GetForcedClosed(), pCompo, &bSomeOpen) ; // recupero estrusione e spessore Vector3d vtExtr = Z_AX ; @@ -2574,7 +2571,7 @@ Pocketing::OptimizedZigZag( int nPathId, const Vector3d& vtTool, double dDepth, if ( IsNull( pCrvPocket)) return false ; pCrvPocket->ToLoc( frPocket) ; - SetCurveAllTempProp( nCrvId, pCrvPocket) ; + SetCurveAllTempProp( nCrvId, GetForcedClosed(), pCrvPocket) ; pCrvPocket->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL) ; // sistemo senso antiorario visto dalla direzione di estrusione Vector3d vtPocket; pCrvPocket->GetExtrusion( vtPocket) ; @@ -3831,7 +3828,8 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs, PtrOwner pCrvPocket( CloneCurveComposite( m_pGeomDB->GetGeoObj( nCrvId))) ; if ( IsNull( pCrvPocket)) return false ; - SetCurveAllTempProp( nCrvId, pCrvPocket) ; + bool bSomeOpen ; + SetCurveAllTempProp( nCrvId, GetForcedClosed(), pCrvPocket, &bSomeOpen) ; pCrvPocket->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL) ; Point3d pt ; @@ -3849,7 +3847,7 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs, double dPocketSize = vtOrtho.Len() ; double dMaxOptSize ; FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxOptSize="), dMaxOptSize) ; - if ( dPocketSize < m_TParams.m_dDiam + EPS_SMALL && + if ( ( ( bSomeOpen && dPocketSize < m_TParams.m_dDiam + EPS_SMALL) || abs( dPocketSize - m_TParams.m_dDiam) < EPS_SMALL) && ( ! FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxOptSize="), dMaxOptSize) || dPocketSize < dMaxOptSize)) { if ( nReg == 0) { CalcTrapezoidSpiral( pCrvPocket, vtDir, dPocketSize, pMCrv, pRCrv, bOptimizedTrap) ; @@ -5448,6 +5446,17 @@ Pocketing::GetRadiusForStartEndElevation( void) const return ( 0.5 * m_TParams.m_dTDiam + dDeltaRad) ; } +//---------------------------------------------------------------------------- +bool +Pocketing::GetForcedClosed( void) +{ + int nOpen ; + if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "Open="), nOpen) && nOpen == 0) + return true ; + else + return false ; +} + //---------------------------------------------------------------------------- bool Pocketing::GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOrt) diff --git a/Pocketing.h b/Pocketing.h index db36135..c62df12 100644 --- a/Pocketing.h +++ b/Pocketing.h @@ -68,7 +68,7 @@ class Pocketing : public Machining private : bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ; bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ; - bool SetCurveAllTempProp( int nCrvId, ICurve* pCurve) ; + bool SetCurveAllTempProp( int nCrvId, bool bForcedClose, ICurve* pCurve, bool* pbSomeOpen = nullptr) ; bool ResetCurveAllTempProp( ICurve* pCurve) ; bool Chain( int nGrpDestId) ; bool ProcessPath( int nPathId, int nPvId, int nClId) ; @@ -135,6 +135,7 @@ class Pocketing : public Machining const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1, double& dElev, bool& bOppositeHome) ; double GetRadiusForStartEndElevation( void) const ; + bool GetForcedClosed( void) ; bool GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOut) ; bool AdjustContourWithOpenEdges( ICurveComposite* pCompo) ; bool AdjustContourStart( ICurveComposite* pCompo) ; From 9b5adeaeb3ae8b1cfa887ad891c40eb84cab7e76 Mon Sep 17 00:00:00 2001 From: DarioS Date: Mon, 10 Jul 2023 11:17:59 +0200 Subject: [PATCH 2/5] EgtMachKernel : - i movimenti in rapido sono disegnati tratteggiati. --- CamData.cpp | 2 ++ Milling.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CamData.cpp b/CamData.cpp index a2d284e..f573efe 100644 --- a/CamData.cpp +++ b/CamData.cpp @@ -149,6 +149,8 @@ CamData::SetOwner( int nId, IGeomDB* pGDB) { m_nOwnerId = nId ; m_pGeomDB = pGDB ; + if ( m_pGeomDB != nullptr) + m_pGeomDB->SetStipple( m_nOwnerId, ( m_nMove == 0 ? 3 : 0), 0x8C8C) ; return ( m_nOwnerId != GDB_ID_NULL && m_pGeomDB != nullptr) ; } diff --git a/Milling.cpp b/Milling.cpp index 41e7ef7..cbd3989 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -2501,7 +2501,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo bAboveEnd = GetPointAboveRaw( ptP1, vtTool) ; else { Vector3d vtCorr = CalcCorrDir( pCompo, nMaxInd + 1) ; - bAboveEnd = GetPointOutOfRaw( ptP1, vtTool, vtCorr, dElev, dSafeZ) ; + bAboveEnd = GetPointOutOfRaw( ptP1, vtTool, vtCorr, dEndElev, dSafeZ) ; } } // correggo elevazione finale per punto fine uscita (se testa da sopra senza aggregato approccio mai Z-) From 80363af1f6fc98463f190a53985209fa69060d5b Mon Sep 17 00:00:00 2001 From: DarioS Date: Wed, 19 Jul 2023 09:54:12 +0200 Subject: [PATCH 3/5] EgtMachKernel : - piccola miglioria stilistica. --- Operation.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Operation.cpp b/Operation.cpp index d0b6027..50cec7e 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -1548,19 +1548,15 @@ Operation::SetBlockedRotAxis( const string& sBlockedAxis) const int nLinAxes = m_pMchMgr->GetCurrLinAxes() ; int nRotAxes = m_pMchMgr->GetCurrRotAxes() ; // lo cerco tra i token degli assi rotanti correnti - bool bFound = false ; - for ( int i = 0 ; i < nRotAxes && ! bFound ; ++ i) { + for ( int i = 0 ; i < nRotAxes ; ++ i) { string sAxToken ; if ( m_pMchMgr->GetCurrMachine()->GetCurrAxisToken( i + nLinAxes, sAxToken) && sKey == Trim( sAxToken, " \t\r\n=")) { string sAxis ; m_pMchMgr->GetCurrMachine()->GetCurrAxisName( i + nLinAxes, sAxis) ; - m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ; - bFound = true ; + return m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ; } } - if ( bFound) - return true ; // lo cerco tra gli assi rotanti della macchina return m_pMchMgr->SetRotAxisBlock( sKey, dVal) ; } From 8c1b61b6b8a6066da89caf03e4626b22c96a9b26 Mon Sep 17 00:00:00 2001 From: DarioS Date: Thu, 20 Jul 2023 20:43:33 +0200 Subject: [PATCH 4/5] =?UTF-8?q?EgtMachKernel=202.5g2=20:=20-=20prima=20di?= =?UTF-8?q?=20fare=20il=20calcolo=20degli=20assi=20nell'update=20delle=20l?= =?UTF-8?q?avorazioni=20si=20cancellano=20le=20entit=C3=A0=20di=20tipo=20C?= =?UTF-8?q?LIMB,=20RISE=20e=20HOME=20che=20potrebbero=20dare=20errori=20co?= =?UTF-8?q?me=20extra-corse=20e=20che=20in=20ogni=20caso=20verrebbero=20ca?= =?UTF-8?q?ncellate=20e=20ricalcolate=20subito=20dopo=20con=20la=20funzion?= =?UTF-8?q?e=20AdjustStartEndMovements.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Chiseling.cpp | 3 +++ Drilling.cpp | 3 +++ EgtMachKernel.rc | Bin 11774 -> 11774 bytes GenMachining.cpp | 3 +++ Milling.cpp | 3 +++ Mortising.cpp | 3 +++ Operation.cpp | 15 +++++++++++++++ Operation.h | 1 + Pocketing.cpp | 3 +++ SawFinishing.cpp | 3 +++ SawRoughing.cpp | 3 +++ Sawing.cpp | 3 +++ SurfFinishing.cpp | 3 +++ WaterJetting.cpp | 3 +++ 14 files changed, 49 insertions(+) diff --git a/Chiseling.cpp b/Chiseling.cpp index 9b2499a..cfa1a6a 100644 --- a/Chiseling.cpp +++ b/Chiseling.cpp @@ -595,6 +595,9 @@ Chiseling::Update( bool bPostApply) return true ; } + // elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo) + RemoveClimbRiseHome() ; + // imposto eventuale asse bloccato da lavorazione SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; diff --git a/Drilling.cpp b/Drilling.cpp index 2ed6e10..862a2da 100644 --- a/Drilling.cpp +++ b/Drilling.cpp @@ -615,6 +615,9 @@ Drilling::Update( bool bPostApply) return true ; } + // elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo) + RemoveClimbRiseHome() ; + // imposto eventuale asse bloccato da lavorazione SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 19ed852938d01be548bdfa04a69601dd23370867..dff3343204dae17e12a287441302312925d3e6c3 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/GenMachining.cpp b/GenMachining.cpp index 7a8f737..1d0b29e 100644 --- a/GenMachining.cpp +++ b/GenMachining.cpp @@ -636,6 +636,9 @@ GenMachining::Update( bool bPostApply) return true ; } + // elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo) + RemoveClimbRiseHome() ; + // imposto eventuale asse bloccato da lavorazione SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; diff --git a/Milling.cpp b/Milling.cpp index cbd3989..becae00 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -845,6 +845,9 @@ Milling::Update( bool bPostApply) return true ; } + // elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo) + RemoveClimbRiseHome() ; + // imposto eventuale asse bloccato da lavorazione SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; diff --git a/Mortising.cpp b/Mortising.cpp index aaeb17c..1a8de01 100644 --- a/Mortising.cpp +++ b/Mortising.cpp @@ -634,6 +634,9 @@ Mortising::Update( bool bPostApply) return true ; } + // elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo) + RemoveClimbRiseHome() ; + // imposto eventuale asse bloccato da lavorazione SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; diff --git a/Operation.cpp b/Operation.cpp index 50cec7e..0a1eb23 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -2894,6 +2894,21 @@ Operation::RemoveHome( void) return true ; } +//---------------------------------------------------------------------------- +bool +Operation::RemoveClimbRiseHome( void) +{ + // elimino le entità CLIMB, RISE e HOME delle diverse path dell'operazione + int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ; + int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ; + while ( nClPathId != GDB_ID_NULL) { + RemoveClimb( nClPathId) ; + RemoveRise( nClPathId) ; + nClPathId = m_pGeomDB->GetNextGroup( nClPathId) ; + } + return ( nClId != GDB_ID_NULL) ; +} + //---------------------------------------------------------------------------- bool Operation::CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const diff --git a/Operation.h b/Operation.h index 25a2efc..b98a570 100644 --- a/Operation.h +++ b/Operation.h @@ -135,6 +135,7 @@ class Operation : public IUserObj bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, int nFlag = 0) ; bool RemoveRise( int nClPathId = GDB_ID_NULL) ; bool AddHome( void) ; + bool RemoveClimbRiseHome( void) ; bool CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const ; bool GetExtraZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1, const DBLVECTOR& vAx2, const Vector3d& vtTool2, diff --git a/Pocketing.cpp b/Pocketing.cpp index c4e10ef..929ae0a 100644 --- a/Pocketing.cpp +++ b/Pocketing.cpp @@ -726,6 +726,9 @@ Pocketing::Update( bool bPostApply) return true ; } + // elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo) + RemoveClimbRiseHome() ; + // imposto eventuale asse bloccato da lavorazione SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; diff --git a/SawFinishing.cpp b/SawFinishing.cpp index f107165..926f96e 100644 --- a/SawFinishing.cpp +++ b/SawFinishing.cpp @@ -607,6 +607,9 @@ SawFinishing::Update( bool bPostApply) return true ; } + // elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo) + RemoveClimbRiseHome() ; + // imposto eventuale asse bloccato da lavorazione SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; diff --git a/SawRoughing.cpp b/SawRoughing.cpp index 03ea200..6acc7ab 100644 --- a/SawRoughing.cpp +++ b/SawRoughing.cpp @@ -571,6 +571,9 @@ SawRoughing::Update( bool bPostApply) return true ; } + // elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo) + RemoveClimbRiseHome() ; + // imposto eventuale asse bloccato da lavorazione SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; diff --git a/Sawing.cpp b/Sawing.cpp index 3331bb6..976a1e3 100644 --- a/Sawing.cpp +++ b/Sawing.cpp @@ -742,6 +742,9 @@ Sawing::Update( bool bPostApply) return true ; } + // elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo) + RemoveClimbRiseHome() ; + // imposto eventuale asse bloccato da lavorazione SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; diff --git a/SurfFinishing.cpp b/SurfFinishing.cpp index f750af5..21ee6f3 100644 --- a/SurfFinishing.cpp +++ b/SurfFinishing.cpp @@ -606,6 +606,9 @@ SurfFinishing::Update( bool bPostApply) return true ; } + // elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo) + RemoveClimbRiseHome() ; + // imposto eventuale asse bloccato da lavorazione SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; diff --git a/WaterJetting.cpp b/WaterJetting.cpp index 6cb4e90..cde1c3b 100644 --- a/WaterJetting.cpp +++ b/WaterJetting.cpp @@ -740,6 +740,9 @@ WaterJetting::Update( bool bPostApply) return true ; } + // elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo) + RemoveClimbRiseHome() ; + // imposto eventuale asse bloccato da lavorazione SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; From 1097f2a19f77801d64fe615ec214a3cba214c818 Mon Sep 17 00:00:00 2001 From: DarioS Date: Fri, 21 Jul 2023 15:12:35 +0200 Subject: [PATCH 5/5] EgtMachKernel : - semplificazioni con utilizzo di ConvertCurveToComposite. --- Chiseling.cpp | 4 ++-- Milling.cpp | 20 ++++++++++---------- Pocketing.cpp | 28 ++++++++++++++-------------- SawFinishing.cpp | 12 ++++++------ SawRoughing.cpp | 8 ++++---- Sawing.cpp | 4 ++-- SurfFinishing.cpp | 4 ++-- WaterJetting.cpp | 8 ++++---- 8 files changed, 44 insertions(+), 44 deletions(-) diff --git a/Chiseling.cpp b/Chiseling.cpp index cfa1a6a..4651bbd 100644 --- a/Chiseling.cpp +++ b/Chiseling.cpp @@ -1036,8 +1036,8 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC) for ( int nC = nCstart ; nC < nCend ; ++ nC) { // recupero i contorni del chunk for ( int nL = 0 ; nL < pReg->GetLoopCount( nC) ; ++ nL) { - PtrOwner pCrvCompo( CreateCurveComposite()) ; - if ( IsNull( pCrvCompo) || ! pCrvCompo->AddCurve( pReg->GetLoop( nC, nL))) + PtrOwner pCrvCompo ; + if ( ! pCrvCompo.Set( ConvertCurveToComposite( pReg->GetLoop( nC, nL)))) return false ; // assegno l'estrusione dalla normale alla regione pCrvCompo->SetExtrusion( vtN) ; diff --git a/Milling.cpp b/Milling.cpp index becae00..ec3e6fd 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -1385,8 +1385,8 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC) for ( int nC = nCstart ; nC < nCend ; ++ nC) { // recupero i contorni del chunk for ( int nL = 0 ; nL < pReg->GetLoopCount( nC) ; ++ nL) { - PtrOwner pCrvCompo( CreateCurveComposite()) ; - if ( IsNull( pCrvCompo) || ! pCrvCompo->AddCurve( pReg->GetLoop( nC, nL))) + PtrOwner pCrvCompo ; + if ( ! pCrvCompo.Set( ConvertCurveToComposite( pReg->GetLoop( nC, nL)))) return false ; // assegno l'estrusione dalla normale alla regione pCrvCompo->SetExtrusion( vtN) ; @@ -4441,7 +4441,7 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& if ( pCompo->GetLength( dLen) && pCompo->GetParamAtLength( dLen - m_dAddedOverlap - dTang, dU)) { double dParS, dParE ; pCompo->GetDomain( dParS, dParE) ; - if ( ! pCrv.Set( CreateCurveComposite()) || ! pCrv->AddCurve( pCompo->CopyParamRange( dU, dParE))) + if ( ! pCrv.Set( ConvertCurveToComposite( pCompo->CopyParamRange( dU, dParE)))) return false ; } else { @@ -4457,7 +4457,7 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& else { double dU ; if ( pCompo->GetParamAtLength( m_dAddedOverlap + dTang, dU)) { - if ( ! pCrv.Set( CreateCurveComposite()) || ! pCrv->AddCurve( pCompo->CopyParamRange( 0, dU))) + if ( ! pCrv.Set( ConvertCurveToComposite( pCompo->CopyParamRange( 0, dU)))) return false ; } else { @@ -4492,7 +4492,7 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& if ( pCompo->GetParamAtLength( dTang, dU)) { double dParS, dParE ; pCompo->GetDomain( dParS, dParE) ; - if ( ! pCrv.Set( CreateCurveComposite()) || ! pCrv->AddCurve( pCompo->CopyParamRange( dParS, dU))) + if ( ! pCrv.Set( ConvertCurveToComposite( pCompo->CopyParamRange( dParS, dU)))) return false ; } else { @@ -4505,7 +4505,7 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& if ( pCompo->GetLength( dLen) && pCompo->GetParamAtLength( dLen - dTang, dU)) { double dParS, dParE ; pCompo->GetDomain( dParS, dParE) ; - if ( ! pCrv.Set( CreateCurveComposite()) || ! pCrv->AddCurve( pCompo->CopyParamRange( dU, dParE))) + if ( ! pCrv.Set( ConvertCurveToComposite( pCompo->CopyParamRange( dU, dParE)))) return false ; } else { @@ -4666,7 +4666,7 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect if ( ! bInvert) { double dU ; if ( pCompo->GetParamAtLength( m_dAddedOverlap + dTang, dU)) { - if ( ! pCrv.Set( CreateCurveComposite()) || ! pCrv->AddCurve( pCompo->CopyParamRange( 0, dU))) + if ( ! pCrv.Set( ConvertCurveToComposite( pCompo->CopyParamRange( 0, dU)))) return false ; } else { @@ -4681,7 +4681,7 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect if ( pCompo->GetLength( dLen) && pCompo->GetParamAtLength( dLen - m_dAddedOverlap - dTang, dU)) { double dParS, dParE ; pCompo->GetDomain( dParS, dParE) ; - if ( ! pCrv.Set( CreateCurveComposite()) || ! pCrv->AddCurve( pCompo->CopyParamRange( dU, dParE))) + if ( ! pCrv.Set( ConvertCurveToComposite( pCompo->CopyParamRange( dU, dParE)))) return false ; } else { @@ -4797,7 +4797,7 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d if ( ! bInvert) { double dU ; if ( pCompo->GetParamAtLength( m_dAddedOverlap + dTang, dU)) { - if ( ! pCrv.Set( CreateCurveComposite()) || ! pCrv->AddCurve( pCompo->CopyParamRange( 0, dU))) + if ( ! pCrv.Set( ConvertCurveToComposite( pCompo->CopyParamRange( 0, dU)))) return false ; } else { @@ -4812,7 +4812,7 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d if ( pCompo->GetLength( dLen) && pCompo->GetParamAtLength( dLen - m_dAddedOverlap - dTang, dU)) { double dParS, dParE ; pCompo->GetDomain( dParS, dParE) ; - if ( ! pCrv.Set( CreateCurveComposite()) || ! pCrv->AddCurve( pCompo->CopyParamRange( dU, dParE))) + if ( ! pCrv.Set( ConvertCurveToComposite( pCompo->CopyParamRange( dU, dParE)))) return false ; } else { diff --git a/Pocketing.cpp b/Pocketing.cpp index 929ae0a..3c3ad71 100644 --- a/Pocketing.cpp +++ b/Pocketing.cpp @@ -1226,8 +1226,8 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC) for ( int nC = nCstart ; nC < nCend ; ++ nC) { // recupero i contorni del chunk for ( int nL = 0 ; nL < pReg->GetLoopCount( nC) ; ++ nL) { - PtrOwner pCrvCompo( CreateCurveComposite()) ; - if ( IsNull( pCrvCompo) || ! pCrvCompo->AddCurve( pReg->GetLoop( nC, nL))) + PtrOwner pCrvCompo ; + if ( ! pCrvCompo.Set( ConvertCurveToComposite( pReg->GetLoop( nC, nL)))) return false ; // reset proprietà temporanee ResetCurveAllTempProp( pCrvCompo) ; @@ -2044,8 +2044,8 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con nOffsCrvNbr = 0 ; // setto a zero per non rientrare nel while else { // recupero la prima curva di offset - PtrOwner pOffs( CreateCurveComposite()) ; - if ( IsNull( pOffs) || ! pOffs->AddCurve( OffsCrv.GetLongerCurve())) { + PtrOwner pOffs ; + if ( ! pOffs.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve()))) { m_pMchMgr->SetLastError( 2413, "Error in Pocketing : Toolpath not computable") ; return false ; } @@ -2227,8 +2227,8 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con while ( OffsCrv2.GetCurveCount() > 0) { // recupero la prima curva di offset - PtrOwner pOffs2( CreateCurveComposite()) ; - if ( IsNull( pOffs2) || ! pOffs2->AddCurve( OffsCrv2.GetLongerCurve())) { + PtrOwner pOffs2 ; + if ( ! pOffs2.Set( ConvertCurveToComposite( OffsCrv2.GetLongerCurve()))) { m_pMchMgr->SetLastError( 2413, "Error in Pocketing : Toolpath not computable") ; return false ; } @@ -3061,8 +3061,8 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con while ( OffsCrv.GetCurveCount() > 0) { // recupero la prima curva di offset - PtrOwner pOffs( CreateCurveComposite()) ; - if ( IsNull( pOffs) || ! pOffs->AddCurve( OffsCrv.GetLongerCurve())) { + PtrOwner pOffs ; + if ( ! pOffs.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve()))) { m_pMchMgr->SetLastError( 2413, "Error in Pocketing : Toolpath not computable") ; return false ; } @@ -3206,8 +3206,8 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con // ciclo sulle curve risultanti while ( OffsCrv2.GetCurveCount() > 0) { - PtrOwner pOffs2( CreateCurveComposite()) ; - if ( IsNull( pOffs2) || ! pOffs2->AddCurve( OffsCrv2.GetLongerCurve())) { + PtrOwner pOffs2 ; + if ( ! pOffs2.Set( ConvertCurveToComposite( OffsCrv2.GetLongerCurve()))) { m_pMchMgr->SetLastError( 2413, "Error in Pocketing : Toolpath not computable") ; return false ; } @@ -5262,8 +5262,8 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3 return false ; // eventuale spezzatura if ( bSplitArcs) { - PtrOwner pCompo( CreateCurveComposite()) ; - if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pArc)) || ! ApproxWithLines( pCompo)) + PtrOwner pCompo ; + if ( ! pCompo.Set( ConvertCurveToComposite( Release( pArc))) || ! ApproxWithLines( pCompo)) return false ; return ( AddCurveMove( pCompo, MCH_CL_LEADIN) != GDB_ID_NULL) ; } @@ -5310,7 +5310,7 @@ Pocketing::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3 if ( pRCrv->GetLength( dLen) && pRCrv->GetParamAtLength( dLen - m_Params.m_dLiTang, dU)) { double dParS, dParE ; pRCrv->GetDomain( dParS, dParE) ; - if ( ! pCrv.Set( CreateCurveComposite()) || ! pCrv->AddCurve( pRCrv->CopyParamRange( dU, dParE))) + if ( ! pCrv.Set( ConvertCurveToComposite( pRCrv->CopyParamRange( dU, dParE)))) return false ; } else { @@ -5398,7 +5398,7 @@ Pocketing::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector PtrOwner pCrv ; double dU ; if ( pRCrv->GetParamAtLength( m_Params.m_dLoTang, dU)) { - if ( ! pCrv.Set( CreateCurveComposite()) || ! pCrv->AddCurve( pRCrv->CopyParamRange( 0, dU))) + if ( ! pCrv.Set( ConvertCurveToComposite( pRCrv->CopyParamRange( 0, dU)))) return false ; } else { diff --git a/SawFinishing.cpp b/SawFinishing.cpp index 926f96e..849b4ea 100644 --- a/SawFinishing.cpp +++ b/SawFinishing.cpp @@ -982,8 +982,8 @@ SawFinishing::AdjustGeometry( int nAuxId) if ( ! pGuide->IsFlat( plPlane, false, 10 * EPS_SMALL) || ! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), Z_AX)) return false ; // verifiche sulla curva (che trasformo in composita) - PtrOwner pCompo( CreateCurveComposite()) ; - if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pGuide))) + PtrOwner pCompo ; + if ( ! pCompo.Set( ConvertCurveToComposite( Release( pGuide)))) return false ; // converto in archi e rette pCompo->ArcsBezierCurvesToArcsPerpExtr( LIN_TOL_MID, ANG_TOL_STD_DEG) ; @@ -2403,8 +2403,8 @@ SawFinishing::CalcCurvedAlongVerticalCuts( ICurve* pSect, int nUmin, int nUmax, Vector3d vtMove = ( dY - m_TParams.m_dThick / 2) * Z_AX ; OffsetCurve OffsCrv ; OffsCrv.Make( pGuide, dOffs, ICurve::OFF_FILLET) ; - PtrOwner pCut( CreateCurveComposite()) ; - if ( IsNull( pCut) || ! pCut->AddCurve( OffsCrv.GetLongerCurve())) + PtrOwner pCut ; + if ( ! pCut.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve()))) return false ; VerifyArcs( pCut) ; pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ; @@ -2478,8 +2478,8 @@ SawFinishing::CalcCurvedAlongStdCuts( ICurve* pSect, double dUmin, double dUmax, Vector3d vtMove = ( ptP.y - m_TParams.m_dThick / 2) * Z_AX ; OffsetCurve OffsCrv ; OffsCrv.Make( pGuide, dOffs, ICurve::OFF_FILLET) ; - PtrOwner pCut( CreateCurveComposite()) ; - if ( IsNull( pCut) || ! pCut->AddCurve( OffsCrv.GetLongerCurve())) + PtrOwner pCut ; + if ( ! pCut.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve()))) return false ; VerifyArcs( pCut) ; pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ; diff --git a/SawRoughing.cpp b/SawRoughing.cpp index 6acc7ab..2c32078 100644 --- a/SawRoughing.cpp +++ b/SawRoughing.cpp @@ -940,8 +940,8 @@ SawRoughing::AdjustGeometry( int nAuxId) if ( ! pGuide->IsFlat( plPlane, false, 10 * EPS_SMALL) || ! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), Z_AX)) return false ; // verifiche sulla curva (che trasformo in composita) - PtrOwner pCompo( CreateCurveComposite()) ; - if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pGuide))) + PtrOwner pCompo ; + if ( ! pCompo.Set( ConvertCurveToComposite( Release( pGuide)))) return false ; // converto in archi e rette pCompo->ArcsBezierCurvesToArcsPerpExtr( LIN_TOL_MID, ANG_TOL_STD_DEG) ; @@ -1330,8 +1330,8 @@ SawRoughing::CalculateCurvedToolPath( int nAuxId, int nClId) // creo la curva di taglio OffsetCurve OffsCrv ; OffsCrv.Make( pGuide, dX, ICurve::OFF_FILLET) ; - PtrOwner pCut( CreateCurveComposite()) ; - if ( IsNull( pCut) || ! pCut->AddCurve( OffsCrv.GetLongerCurve())) + PtrOwner pCut ; + if ( ! pCut.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve()))) return false ; VerifyArcs( pCut) ; Vector3d vtMove = ( dY - m_TParams.m_dThick / 2) * Z_AX ; diff --git a/Sawing.cpp b/Sawing.cpp index 976a1e3..5f43449 100644 --- a/Sawing.cpp +++ b/Sawing.cpp @@ -1279,8 +1279,8 @@ Sawing::GetCurve( SelData Id) // recupero l'indice del chunk int nChunk = ( ( Id.nSub == SEL_SUB_ALL) ? 0 : Id.nSub) ; // recupero il contorno esterno del chunk - PtrOwner pCrvCompo( CreateCurveComposite()) ; - if ( IsNull( pCrvCompo) || ! pCrvCompo->AddCurve( pReg->GetLoop( nChunk, 0))) + PtrOwner pCrvCompo ; + if ( ! pCrvCompo.Set( ConvertCurveToComposite( pReg->GetLoop( nChunk, 0)))) return nullptr ; // recupero la normale della regione Vector3d vtN = pReg->GetNormVersor() ; diff --git a/SurfFinishing.cpp b/SurfFinishing.cpp index 21ee6f3..d3f5649 100644 --- a/SurfFinishing.cpp +++ b/SurfFinishing.cpp @@ -1331,8 +1331,8 @@ SurfFinishing::AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, bool bStart = true ; while ( OffsCrv.GetCurveCount() > 0) { // recupero la prima curva di offset - PtrOwner pOffs( CreateCurveComposite()) ; - if ( IsNull( pOffs) || ! pOffs->AddCurve( OffsCrv.GetLongerCurve())) { + PtrOwner pOffs ; + if ( ! pOffs.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve()))) { m_pMchMgr->SetLastError( 3110, "Error in SurfFinishing : Toolpath not computable") ; return false ; } diff --git a/WaterJetting.cpp b/WaterJetting.cpp index cde1c3b..1722d2a 100644 --- a/WaterJetting.cpp +++ b/WaterJetting.cpp @@ -2610,8 +2610,8 @@ WaterJetting::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect pCrv->Invert() ; // eventuale spezzatura if ( bSplitArcs) { - PtrOwner pCompo( CreateCurveComposite()) ; - if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pCrv)) || ! ApproxWithLines( pCompo)) + PtrOwner pCompo ; + if ( ! pCompo.Set( ConvertCurveToComposite( Release( pCrv))) || ! ApproxWithLines( pCompo)) return false ; return ( AddCurveMove( pCompo, MCH_CL_LEADIN) != GDB_ID_NULL) ; } @@ -2681,8 +2681,8 @@ WaterJetting::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vec return false ; // eventuale spezzatura if ( bSplitArcs) { - PtrOwner pCompo( CreateCurveComposite()) ; - if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pCrv)) || ! ApproxWithLines( pCompo)) + PtrOwner pCompo ; + if ( ! pCompo.Set( ConvertCurveToComposite( Release( pCrv))) || ! ApproxWithLines( pCompo)) return false ; return ( AddCurveMove( pCompo, MCH_CL_LEADOUT) != GDB_ID_NULL) ; }