From 7b90e2b1528a9b32bdb49941727d40d866d8158f Mon Sep 17 00:00:00 2001 From: DarioS Date: Sat, 25 Sep 2021 12:50:10 +0200 Subject: [PATCH 01/11] EgtMachKernel 2.3i7 : - in fresature aggiunto Attacco Tang+Perp e Uscita Perp+Tang. --- EgtMachKernel.rc | Bin 11774 -> 11774 bytes Milling.cpp | 39 ++++++++++++++++++++++++++++++++++----- MillingData.cpp | 5 +++-- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 14f173e3c744620ea961a7d8c9e1e92de4c6508c..f5678ce7651596ce230c5092fbf7fbe2567d29e2 100644 GIT binary patch delta 97 zcmewt{V#gMFE&Q=&A-`fnHkL|Ka|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmUYMBd`Df delta 97 zcmewt{V#gMFE&QA&A-`fnHkL{Ka|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmUTDBd7oX diff --git a/Milling.cpp b/Milling.cpp index 5c6a213..00168b3 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -2673,12 +2673,12 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool int nLoType = GetLeadOutType() ; if ( nLiType == MILL_LI_NONE && ( nLoType == MILL_LO_NONE || nLoType == MILL_LO_AS_LI)) bMidRetract = false ; - if ( ( nLiType == MILL_LI_TANGENT || nLiType == MILL_LI_LINEAR) && + if ( ( nLiType == MILL_LI_TANGENT || nLiType == MILL_LI_LINEAR || nLiType == MILL_LI_TG_PERP) && nLoType == MILL_LO_AS_LI && abs( m_Params.m_dLiTang) < EPS_SMALL) bMidRetract = false ; - if ( ( nLiType == MILL_LI_TANGENT || nLiType == MILL_LI_LINEAR) && - ( nLoType == MILL_LO_TANGENT || nLoType == MILL_LO_LINEAR) && + if ( ( nLiType == MILL_LI_TANGENT || nLiType == MILL_LI_LINEAR || nLiType == MILL_LI_TG_PERP) && + ( nLoType == MILL_LO_TANGENT || nLoType == MILL_LO_LINEAR || nLoType == MILL_LO_PERP_TG) && abs( m_Params.m_dLiTang) < EPS_SMALL && abs( m_Params.m_dLoTang) < EPS_SMALL && abs( m_Params.m_dLiPerp - m_Params.m_dLoPerp) < EPS_SMALL) @@ -3735,6 +3735,7 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const if ( nType != MILL_LI_ZIGZAG && nType != MILL_LI_HELIX) { switch ( m_Params.m_nLeadOutType) { case MILL_LO_LINEAR : nType = MILL_LI_LINEAR ; break ; + case MILL_LO_PERP_TG : nType = MILL_LI_TG_PERP ; break ; case MILL_LO_TANGENT : nType = MILL_LI_TANGENT ; break ; case MILL_LO_GLIDE : nType = MILL_LI_GLIDE ; break ; case MILL_LO_AS_LI : /* resta inalterato */ ; break ; @@ -3749,7 +3750,7 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const } // senso di rotazione da dir tg a dir esterna bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) || - ( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ; + ( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ; // verifico di poter fare l'ingresso a inseguimento if ( nType == MILL_LI_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL) nType = MILL_LI_NONE ; @@ -3759,6 +3760,7 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const ptP1 = ptStart ; return true ; case MILL_LI_LINEAR : + case MILL_LI_TG_PERP : case MILL_LI_TANGENT : { Vector3d vtPerp = vtStart ; Vector3d vtRot = vtN - vtN * vtStart * vtStart ; @@ -3806,12 +3808,14 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& // Assegno il tipo int nType = GetLeadInType() ; double dTang = m_Params.m_dLiTang ; + double dPerp = m_Params.m_dLiPerp ; // se step invertito if ( bInvert) { // va aggiustato se non zigzag o spirale if ( nType != MILL_LI_ZIGZAG && nType != MILL_LI_HELIX) { switch ( GetLeadOutType()) { case MILL_LO_LINEAR : nType = MILL_LI_LINEAR ; break ; + case MILL_LO_PERP_TG : nType = MILL_LI_TG_PERP ; break ; case MILL_LO_TANGENT : nType = MILL_LI_TANGENT ; break ; case MILL_LO_GLIDE : nType = MILL_LI_GLIDE ; break ; case MILL_LO_AS_LI : /* resta inalterato */ ; break ; @@ -3819,8 +3823,12 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& } if ( m_Params.m_nLeadOutType != MILL_LO_AS_LI) dTang = m_Params.m_dLoTang ; + dPerp = m_Params.m_dLoPerp ; } } + // senso di rotazione da dir tg a dir esterna + bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) || + ( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ; // verifico di poter fare l'ingresso a inseguimento if ( nType == MILL_LI_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL) nType = MILL_LI_NONE ; @@ -3830,6 +3838,16 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& return true ; case MILL_LI_LINEAR : return ( AddLinearMove( ptStart, MCH_CL_LEADIN) != GDB_ID_NULL) ; + case MILL_LI_TG_PERP : + { + // direzione perpendicolare + Vector3d vtPerp = vtStart ; + Vector3d vtRot = vtN - vtN * vtStart * vtStart ; + vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ; + Point3d ptMid = ptStart + vtPerp * dPerp ; + return ( AddLinearMove( ptMid, MCH_CL_LEADIN) != GDB_ID_NULL && + AddLinearMove( ptStart, MCH_CL_LEADIN) != GDB_ID_NULL) ; + } case MILL_LI_TANGENT : { PtrOwner pCrv( GetArc2PVN( ptStart, ptP1, - vtStart, vtN)) ; @@ -4022,6 +4040,7 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d int nLiType = GetLeadInType() ; switch ( nLiType) { case MILL_LI_LINEAR : nType = MILL_LO_LINEAR ; break ; + case MILL_LI_TG_PERP : nType = MILL_LO_PERP_TG ; break ; case MILL_LI_TANGENT : nType = MILL_LO_TANGENT ; break ; case MILL_LI_GLIDE : nType = MILL_LO_GLIDE ; break ; case MILL_LI_ZIGZAG : nType = MILL_LO_NONE ; break ; @@ -4038,7 +4057,7 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d } // senso di rotazione da dir tg a dir esterna bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) || - ( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ; + ( bInvert && m_Params.m_nWorkSide != MILL_WS_LEFT)) ; // verifico di poter fare l'uscita a inseguimento if ( nType == MILL_LO_GLIDE && ! pCompo->IsClosed() && m_dAddedOverlap < EPS_SMALL) nType = MILL_LO_NONE ; @@ -4055,6 +4074,16 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp + vtN * dElev ; return ( AddLinearMove( ptP1, MCH_CL_LEADOUT) != GDB_ID_NULL) ; } + case MILL_LO_PERP_TG : + { + Vector3d vtPerp = vtEnd ; + Vector3d vtRot = vtN - vtN * vtEnd * vtEnd ; + vtPerp.Rotate( vtRot, 0, ( bCcwRot ? 1 : - 1)) ; + Point3d ptMid = ptEnd + vtPerp * dPerp ; + ptP1 = ptMid + vtEnd * dTang + vtN * dElev ; + return ( AddLinearMove( ptMid, MCH_CL_LEADOUT) != GDB_ID_NULL && + AddLinearMove( ptP1, MCH_CL_LEADOUT) != GDB_ID_NULL) ; + } case MILL_LO_TANGENT : { // calcolo punto finale dell'uscita diff --git a/MillingData.cpp b/MillingData.cpp index a06fa96..3d1a2a7 100644 --- a/MillingData.cpp +++ b/MillingData.cpp @@ -574,7 +574,8 @@ MillingData::VerifyLeadInType( int nVal) const { return ( nVal == MILL_LI_NONE || nVal == MILL_LI_LINEAR || nVal == MILL_LI_TANGENT || nVal == MILL_LI_GLIDE || - nVal == MILL_LI_ZIGZAG || nVal == MILL_LI_HELIX) ; + nVal == MILL_LI_ZIGZAG || nVal == MILL_LI_HELIX || + nVal == MILL_LI_TG_PERP) ; } //---------------------------------------------------------------------------- @@ -583,7 +584,7 @@ MillingData::VerifyLeadOutType( int nVal) const { return ( nVal == MILL_LO_NONE || nVal == MILL_LO_LINEAR || nVal == MILL_LO_TANGENT || nVal == MILL_LO_GLIDE || - nVal == MILL_LO_AS_LI) ; + nVal == MILL_LO_AS_LI || nVal == MILL_LO_PERP_TG) ; } //---------------------------------------------------------------------------- From bb8b6b9fc196cad5d0f71ef2f65b8490a4915afb Mon Sep 17 00:00:00 2001 From: DarioS Date: Sun, 26 Sep 2021 16:29:34 +0200 Subject: [PATCH 02/11] EgtMachKernel : - aggiustamento per nuovo parametro richiesto da ISurfTriMesh::GetSilhouette. --- MachMgrRawParts.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MachMgrRawParts.cpp b/MachMgrRawParts.cpp index 6a8cc7c..3ca21b0 100644 --- a/MachMgrRawParts.cpp +++ b/MachMgrRawParts.cpp @@ -414,7 +414,7 @@ MachMgr::AddRawPart( int nSurfId, Color cCol) // ne calcolo la silhouette secondo Z+ POLYLINEVECTOR vPL ; bool bSilh = false ; - if ( pStm->GetSilhouette( Z_AX, vPL) && vPL.size() > 0) { + if ( pStm->GetSilhouette( Z_AX, 10.0, vPL) && vPL.size() > 0) { // cerco il contorno esterno int nInd = - 1 ; double dMaxArea = 0 ; From 52a26ceb527880f859fc8fe6de4f5cdb29f2a8eb Mon Sep 17 00:00:00 2001 From: DarioS Date: Mon, 4 Oct 2021 09:15:29 +0200 Subject: [PATCH 03/11] EgtMachKernel 2.3j1 : - corretto controlli attacchi/uscite lame in fresature con testa da sotto. --- EgtMachKernel.rc | Bin 11774 -> 11782 bytes Milling.cpp | 15 +++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index f5678ce7651596ce230c5092fbf7fbe2567d29e2..e177d567b791f9a17bd6c9783e66a7d3d43d5097 100644 GIT binary patch delta 129 zcmewt-4?Uq8ymYJg8_pMgW=}iY}U-oSqz4gA4=+OPUGrfL6W)1H2H*J9zs?KMHWS$ T2jk{d(k{&SG=r2Vhj0M^?&c=# delta 121 zcmZpR`4_$68yl-7gARlF=D%##%*>e#=93+TbvI`TxiM~D$L+=pm%PX{`HWy5l7b!< PxEzK?X*?R0=5PZ5z=0$Q diff --git a/Milling.cpp b/Milling.cpp index 00168b3..719d55f 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -1480,7 +1480,7 @@ Milling::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const // se utensile lama if ( ( m_TParams.m_nType & TF_SAWBLADE) != 0) { // traslazione opposta a quanto fatto in AdjustPathDrawForSaw - double dOffset = 0.5 * m_TParams.m_dTDiam - 10 * EPS_SMALL ; + double dOffset = 0.5 * m_TParams.m_dDiam - 10 * EPS_SMALL ; ptP.Translate( dOffset * pCamData->GetCorrDir()) ; } // negli altri casi, non devo fare alcunché @@ -1501,7 +1501,7 @@ Milling::AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCen) co // se versori correzione uguali, correggo il centro if ( AreSameVectorApprox( pCamData->GetCorrDir(), pPrevCamData->GetCorrDir())) { // traslazione opposta a quanto fatto in AdjustPathDrawForSaw - double dOffset = 0.5 * m_TParams.m_dTDiam - 10 * EPS_SMALL ; + double dOffset = 0.5 * m_TParams.m_dDiam - 10 * EPS_SMALL ; ptCen.Translate( dOffset * pCamData->GetCorrDir()) ; } } @@ -1943,7 +1943,7 @@ Milling::AdjustPathDrawForSaw( int nClPathId) if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) return true ; // porto il percorso praticamente sull'estremo della lama ( appena meno per evitare di trasformare archi in punti) - double dOffset = 0.5 * m_TParams.m_dTDiam - 10 * EPS_SMALL ; + double dOffset = 0.5 * m_TParams.m_dDiam - 10 * EPS_SMALL ; Vector3d vtPrevCorr ; for ( int nId = m_pGeomDB->GetFirstInGroup( nClPathId) ; nId != GDB_ID_NULL ; @@ -2237,7 +2237,8 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo // determino se l'inizio dell'attacco è fuori dal grezzo bool bOutStart = GetPointOutOfRaw( ptP1, vtTool, dElev, dSafeZ) ; // determino se l'inizio dell'attacco è sopra il grezzo - bool bAboveStart = m_bAboveHead && GetPointAboveRaw( ptP1, vtTool) ; + bool bGeomAboveStart = GetPointAboveRaw( ptP1, vtTool) ; + bool bAboveStart = ( m_bAboveHead && bGeomAboveStart) ; // imposto versore correzione e ausiliario sul punto di partenza CalcAndSetCorrAuxDir( pCompo, i) ; // aggiungo approccio per frese normali @@ -2273,7 +2274,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo double dSawStartElev = 0 ; bool bUnderStart = m_bAboveHead && GetPointUnderRaw( ptP1, vtTool, m_TParams.m_dTDiam / 2, GetRadiusForStartEndElevation( false), m_TParams.m_dLen, true, dSafeZ, dSawStartElev) ; - if ( ! bUnderStart && bOk) { + if ( ! bGeomAboveStart && ! bUnderStart && bOk) { m_pMchMgr->SetLastError( 2314, "Error in Milling : LeadIn must be out of rawpart") ; bOk = false ; } @@ -2382,11 +2383,13 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo // verifico di uscire in aria bool bOutEnd = GetPointOutOfRaw( ptP1, vtTool, dElev, dSafeZ) ; if ( ! bOutEnd) { + // verifico se sono sopra + bool bGeomAboveEnd = GetPointAboveRaw( ptP1, vtTool) ; // verifico se sono sotto double dSawEndElev = 0 ; bool bUnderEnd = m_bAboveHead && GetPointUnderRaw( ptP1, vtTool, m_TParams.m_dTDiam / 2, GetRadiusForStartEndElevation( false), m_TParams.m_dLen, true, dSafeZ, dSawEndElev) ; - if ( ! bUnderEnd && bOk) { + if ( ! bGeomAboveEnd && ! bUnderEnd && bOk) { m_pMchMgr->SetLastError( 2324, "Error in Milling : LeadOut must be out of rawpart") ; bOk = false ; } From fa6928c593b92810dc43c48d8c9157ee40bedebf Mon Sep 17 00:00:00 2001 From: DarioS Date: Tue, 5 Oct 2021 11:42:03 +0200 Subject: [PATCH 04/11] EgtMachKernel : - in Svuotature Oneway corretto errore con contorno esterno circonferenza. --- Pocketing.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Pocketing.cpp b/Pocketing.cpp index b9b8a57..f9a6d84 100644 --- a/Pocketing.cpp +++ b/Pocketing.cpp @@ -2494,6 +2494,9 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con // sposto l'inizio a metà del tratto più lungo AdjustContourStart( pOffs) ; + // verifico archi + VerifyArcs( pOffs) ; + // coefficiente di riduzione feed di lavorazione di questa curva double dFeedRid = min( GetSideStep() / m_TParams.m_dDiam, 1.0) ; From 5a8fb790b08904dd646ebafbbb482bc657885c50 Mon Sep 17 00:00:00 2001 From: DarioS Date: Tue, 5 Oct 2021 20:19:21 +0200 Subject: [PATCH 05/11] EgtMachKernel 2.3j2 : - corretto aggiornamento disegni utensili e dimensioni portautensili. --- EgtMachKernel.rc | Bin 11782 -> 11782 bytes MachMgr.h | 4 ++-- MachMgrDBTools.cpp | 32 +++++++++++++++++++++++--------- ToolsMgr.cpp | 17 ++++------------- ToolsMgr.h | 2 +- 5 files changed, 30 insertions(+), 25 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index e177d567b791f9a17bd6c9783e66a7d3d43d5097..9a81641cfd7099d5aad64ab19b7e69b5cc6d0d1d 100644 GIT binary patch delta 97 zcmZpRX^YwLhmFx_^ItYwW=5mQj>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHP01iS delta 97 zcmZpRX^YwLhmFy2^ItYwW=6xwj>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHOf?`f diff --git a/MachMgr.h b/MachMgr.h index cc4b3ea..528e152 100644 --- a/MachMgr.h +++ b/MachMgr.h @@ -484,11 +484,11 @@ class MachMgr : public IMachMgr bool ShowRootParts( bool bShow) ; // Tools DataBase bool UpdateAllToolDraws( void) const ; - bool UpdateToolDraw( const EgtUUID& UuidTool) const ; + bool UpdateToolDraw( const EgtUUID& UuidTool, double& dTHoldLen, double& dTHoldDiam) const ; int UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx, bool bToSave) const ; int UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx, bool bToSave) const ; std::string GetToolMakerKeyFromType( int nType) const ; - std::string GetToolHolderPath( const std::string& sHeadName, int nExit, int nType) const ; + std::string GetToolHolderPath( const std::string& sHeadName, int nExit, int nType, const std::string& sUserNotes) const ; // Operations : general bool InitOperation( int nId) ; // Operations : dispositions diff --git a/MachMgrDBTools.cpp b/MachMgrDBTools.cpp index ceb7a8a..e0ed411 100644 --- a/MachMgrDBTools.cpp +++ b/MachMgrDBTools.cpp @@ -526,9 +526,15 @@ MachMgr::UpdateAllToolDraws( void) const // verifico se non esiste il disegno associato string sDraw ; pTdata->GetParam( TPA_DRAW, sDraw) ; bool bNoDraw = ( ! sDraw.empty() && ! ExistsFile( sToolDir + "\\" + sDraw)) ; - // se modificato o senza disegno, ne lancio la creazione - if ( bModif || bNoDraw) - UpdateToolDraw( UuidTool) ; + // se modificato o senza disegno, ne lancio la creazione e aggiorno dati portautensile + if ( bModif || bNoDraw) { + double dTHoldLen = 0, dTHoldDiam = 0 ; + UpdateToolDraw( UuidTool, dTHoldLen, dTHoldDiam) ; + pTsMgr->SetCurrTool( sName) ; + pTsMgr->UpdateCurrToolHolderData( dTHoldLen, dTHoldDiam) ; + pTsMgr->SaveCurrTool() ; + pTsMgr->SetCurrTool( "") ; + } // passo al successivo bNext = pTsMgr->GetNextTool( TF_ALL, sName, nType) ; } @@ -542,7 +548,7 @@ MachMgr::UpdateAllToolDraws( void) const //---------------------------------------------------------------------------- bool -MachMgr::UpdateToolDraw( const EgtUUID& UuidTool) const +MachMgr::UpdateToolDraw( const EgtUUID& UuidTool, double& dTHoldLen, double& dTHoldDiam) const { // recupero il gestore di utensili della macchina corrente ToolsMgr* pTsMgr = GetCurrToolsMgr() ; @@ -581,6 +587,12 @@ MachMgr::UpdateToolDraw( const EgtUUID& UuidTool) const // Salvo il disegno ExeSetCurrentContext( nToolCtx) ; bOk = bOk && ExeSaveFile( sDrawPath, GDB_SV_BIN) ; + // Recupero i dati del portautensile + int nToolId = ExeGetFirstGroupInGroup( GDB_ID_ROOT) ; + if ( ! ExeGetInfo( nToolId, TTH_LEN, dTHoldLen)) + dTHoldLen = 0 ; + if ( ! ExeGetInfo( nToolId, TTH_DIAM, dTHoldDiam)) + dTHoldDiam = 0 ; // Ripristino il contesto originale ExeSetCurrentContext( nGenCtx) ; ExeDeleteContext( nToolCtx) ; @@ -631,8 +643,10 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC dCore = ( dLen >= dThick ? dThick - 1 : 2 * dLen - dThick) ; double dSpeed = 0 ; pTdata->GetParam( TPA_SPEED, dSpeed) ; + string sUserNotes ; + pTdata->GetParam( TPA_USERNOTES, sUserNotes) ; // Recupero la path dell'eventuale portautensile - string sThPath = GetToolHolderPath( sHeadName, nExit, nType) ; + string sThPath = GetToolHolderPath( sHeadName, nExit, nType, sUserNotes) ; // Carico generatore disegno utensile string sMaker = GetPrivateProfileStringUtf8( TOOLS_SEC.c_str(), GetToolMakerKeyFromType( nType).c_str(), "", sMachIni.c_str()) ; if ( sMaker.empty()) @@ -775,7 +789,7 @@ MachMgr::GetToolMakerKeyFromType( int nType) const //---------------------------------------------------------------------------- string -MachMgr::GetToolHolderPath( const string& sHeadName, int nExit, int nType) const +MachMgr::GetToolHolderPath( const string& sHeadName, int nExit, int nType, const std::string& sUserNotes) const { // Verifiche su testa e uscita if ( sHeadName.empty() || nExit == 0) @@ -822,9 +836,9 @@ MachMgr::GetToolHolderPath( const string& sHeadName, int nExit, int nType) const sToolHolder = GetPrivateProfileStringUtf8( TOOLS_SEC.c_str(), MILLHOLDER_KEY.c_str(), "", sMachIni.c_str()) ; } // Verifico se sovrascritto da nota dell'utensile - string sNotes, sVal ; - if ( TdbGetCurrToolParam( TPA_USERNOTES, sNotes) && - GetValInNotes( sNotes, "TH", sVal) && + string sVal ; + if ( ! sUserNotes.empty() && + GetValInNotes( sUserNotes, "TH", sVal) && ExistsFile( sToolHolderDir + "\\" + sVal)) sToolHolder = sVal ; // Se non trovato ancora, esco diff --git a/ToolsMgr.cpp b/ToolsMgr.cpp index 4108993..404bc1b 100644 --- a/ToolsMgr.cpp +++ b/ToolsMgr.cpp @@ -542,8 +542,6 @@ ToolsMgr::SaveCurrTool( void) m_suData.emplace( m_tdCurrTool.m_sName, m_tdCurrTool.m_Uuid) ; } } - // aggiorno dati portautensile - UpdateCurrToolHolderData() ; // eseguo salvataggio m_bModified = true ; if ( find( m_utModified.begin(), m_utModified.end(), m_tdCurrTool.m_Uuid) == m_utModified.end()) @@ -554,18 +552,11 @@ ToolsMgr::SaveCurrTool( void) //---------------------------------------------------------------------------- bool -ToolsMgr::UpdateCurrToolHolderData( void) +ToolsMgr::UpdateCurrToolHolderData( double dTHoldLen, double dTHoldDiam) { - // Leggo i dati del portautensile dal disegno dell'utensile - PtrOwner pGeomDB( CreateGeomDB()) ; - pGeomDB->Init() ; - string sDrawPath = m_sToolsDir + "\\" + m_tdCurrTool.m_sDraw ; - pGeomDB->Load( sDrawPath) ; - int nToolId = pGeomDB->GetFirstGroupInGroup( GDB_ID_ROOT) ; - double dTHoldLen = 0 ; - pGeomDB->GetInfo( nToolId, TTH_LEN, dTHoldLen) ; - double dTHoldDiam = 0 ; - pGeomDB->GetInfo( nToolId, TTH_DIAM, dTHoldDiam) ; + // verifico validità utensile corrente + if ( ! m_bCurrTool) + return false ; // Aggiorno i dati nelle note di sistema SetValInNotes( TSI_THLEN, dTHoldLen, m_tdCurrTool.m_sSysNotes) ; SetValInNotes( TSI_THDIAM, dTHoldDiam, m_tdCurrTool.m_sSysNotes) ; diff --git a/ToolsMgr.h b/ToolsMgr.h index 8dba009..4ab95cb 100644 --- a/ToolsMgr.h +++ b/ToolsMgr.h @@ -56,6 +56,7 @@ class ToolsMgr bool GetCurrToolParam( int nType, double& dVal) const ; bool GetCurrToolParam( int nType, std::string& sVal) const ; template bool GetCurrToolValInNotes( int nType, const std::string& sKey, T& Val) const ; + bool UpdateCurrToolHolderData( double dTHoldLen, double dTHoldDiam) ; bool GetCurrToolMaxDepth( double dSafe, double& dMaxDepth) const ; bool GetCurrToolThDiam( double& dThDiam) const ; bool GetCurrToolThLength( double& dThLen) const ; @@ -72,7 +73,6 @@ class ToolsMgr bool SaveHeader( Writer& TheWriter) const ; bool SaveOneTool( const EgtUUID& Uuid, int& nCounter, Writer& TheWriter) const ; bool VerifyTool( int nFamily, std::string& sName, int& nType) const ; - bool UpdateCurrToolHolderData( void) ; bool ExportOneTool( const std::string& sToolName, Writer& TheWriter, const int& nCounter, const std::string& sOutDir) ; bool ReadTool( Scanner& TheScanner, ToolData& tData, const int& nToolSize) const ; bool CopyToolDraw( const std::string& sDraw, const std::string& sOutDraw, const std::string& sToolName) ; From 8e64f0ad00f7a376367acbbf88e04d0099f0e13c Mon Sep 17 00:00:00 2001 From: DarioS Date: Thu, 7 Oct 2021 06:54:49 +0200 Subject: [PATCH 06/11] EgtMachKernel 2.3j3 : - in svuotature con lati aperti corretta elevazione attacco con testa da sotto. --- EgtMachKernel.rc | Bin 11782 -> 11782 bytes Pocketing.cpp | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 9a81641cfd7099d5aad64ab19b7e69b5cc6d0d1d..b8c0b43e3c44897a88fe76289205af0c1dd41a41 100644 GIT binary patch delta 97 zcmZpRX^YwLhmFyA^ItYwW=7-5j>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHPhB8F delta 97 zcmZpRX^YwLhmFx_^ItYwW=5mQj>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHP01iS diff --git a/Pocketing.cpp b/Pocketing.cpp index f9a6d84..9c20002 100644 --- a/Pocketing.cpp +++ b/Pocketing.cpp @@ -2833,7 +2833,7 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c dStElev = dStep ; bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom && GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; - if ( bUnderRaw) + if ( bUnderRaw || ( bOutStart && ! m_bAboveHead)) dStElev = max( dStElev, dStep) ; dStElev -= ( ptP1 - ptStart) * vtExtr ; // se attacco a zigzag o a spirale o a scivolo, l'elevazione va nell'attacco From 23c0e1c8d586a67d6d5228bcd79a7a6d58259a32 Mon Sep 17 00:00:00 2001 From: DarioS Date: Sun, 10 Oct 2021 20:04:54 +0200 Subject: [PATCH 07/11] EgtMachKernel 2.3j4 : - in fresatura corretta gestione elevazione di attacco e uscita con OneWay. --- EgtMachKernel.rc | Bin 11782 -> 11782 bytes Milling.cpp | 18 ++++++++++++++---- ToolData.cpp | 6 +++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index b8c0b43e3c44897a88fe76289205af0c1dd41a41..f6e423b73f43ee0918f135febf1b724b37ae7238 100644 GIT binary patch delta 97 zcmZpRX^YwLhmFx>^ItYwW=50Aj>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHQ1Kv2 delta 97 zcmZpRX^YwLhmFyA^ItYwW=7-5j>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHPhB8F diff --git a/Milling.cpp b/Milling.cpp index 719d55f..332fee6 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -2747,14 +2747,19 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool // aggiungo approccio per frese normali if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) { // correggo elevazione iniziale per punto inizio attacco (se testa da sopra senza aggregato approccio mai Z-) + Point3d ptP1m = ptP1 - 10 * EPS_SMALL * vtTool ; Vector3d vtEscape = vtTool ; if ( m_bAboveHead && ! m_bAggrBottom && vtTool.z < - EPS_SMALL) { vtEscape.z = 0 ; vtEscape.Normalize() ; } double dNewStElev ; - if ( GetElevation( m_nPhase, ptP1 - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtEscape, dNewStElev) && dNewStElev > EPS_SMALL) - dStElev = min( dStElev, dNewStElev) ; + if ( GetElevation( m_nPhase, ptP1m, vtTool, GetRadiusForStartEndElevation(), vtEscape, dNewStElev) && dNewStElev > EPS_SMALL) { + if ( bAboveStartEnd) + dStElev = min( dStElev, dNewStElev) ; + else + dStElev = max( dStElev, dNewStElev) ; + } // determino se l'inizio dell'attacco è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione bool bUnderStart = m_bAboveHead && GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ; @@ -2864,14 +2869,19 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool // aggiungo retrazione per frese normali (esclusi step intermedi senza retrazione) if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0 && ( j == nStep || bMidRetract)) { // correggo elevazione finale per punto fine uscita (se testa da sopra senza aggregato approccio mai Z-) + Point3d ptP1m = ptP1 - 10 * EPS_SMALL * vtTool ; Vector3d vtEscape = vtTool ; if ( m_bAboveHead && ! m_bAggrBottom && vtTool.z < - EPS_SMALL) { vtEscape.z = 0 ; vtEscape.Normalize() ; } double dNewEndElev ; - if ( GetElevation( m_nPhase, ptP1 - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtEscape, dNewEndElev) && dNewEndElev > EPS_SMALL) - dEndElev = min( dEndElev, dNewEndElev) ; + if ( GetElevation( m_nPhase, ptP1m, vtTool, GetRadiusForStartEndElevation(), vtEscape, dNewEndElev) && dNewEndElev > EPS_SMALL) { + if ( bAboveStartEnd) + dEndElev = min( dEndElev, dNewEndElev) ; + else + dEndElev = max( dEndElev, dNewEndElev) ; + } // determino se l'inizio dell'uscita è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione bool bUnderEnd = m_bAboveHead && GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dEndElev) ; diff --git a/ToolData.cpp b/ToolData.cpp index f69acfa..40b62a7 100644 --- a/ToolData.cpp +++ b/ToolData.cpp @@ -354,19 +354,19 @@ ToolData::SetParam( int nType, double dVal) m_dMinFeed = dVal ; return true ; case TPA_DIST : - if ( abs( dVal) > 0) + if ( abs( dVal) > EPS_SMALL) SetValInNotes( TSI_DIST, dVal, m_sSysNotes) ; else RemoveValInNotes( TSI_DIST, m_sSysNotes) ; return true ; case TPA_STEMDIAM : - if ( abs( dVal) > 0) + if ( abs( dVal) > EPS_SMALL) SetValInNotes( TSI_STEM_DIAM, dVal, m_sSysNotes) ; else RemoveValInNotes( TSI_STEM_DIAM, m_sSysNotes) ; return true ; case TPA_CORE : - if ( abs( dVal) > 0) + if ( abs( dVal) > EPS_SMALL) SetValInNotes( TSI_CORE, dVal, m_sSysNotes) ; else RemoveValInNotes( TSI_CORE, m_sSysNotes) ; From 73ce1f1018907781095861c92e85f4bcdd9245eb Mon Sep 17 00:00:00 2001 From: DarioS Date: Thu, 14 Oct 2021 11:07:49 +0200 Subject: [PATCH 08/11] EgtMachKernel 2.3j5 : - aggiunta funzione EmtModifyHeadAuxDirection - corretto scambio parametri attacco/uscita in fresatura cquando percorso invertito - assi bloccati ora impostabili da lavorazione con nome asse oppure con suo token. --- Chiseling.cpp | 9 +-------- Drilling.cpp | 9 +-------- EgtMachKernel.rc | Bin 11782 -> 11782 bytes GenMachining.cpp | 9 +-------- Head.cpp | 14 ++++++++++++-- Head.h | 5 +++-- Machine.cpp | 20 ++++++++++++++++++-- Machine.h | 6 ++++-- MachineLua.cpp | 25 +++++++++++++++++++++++-- Milling.cpp | 12 +++--------- Mortising.cpp | 9 +-------- Operation.cpp | 45 ++++++++++++++++++++++++++++++++++++++++++++- Operation.h | 1 + Pocketing.cpp | 9 +-------- SawFinishing.cpp | 9 +-------- SawRoughing.cpp | 9 +-------- Sawing.cpp | 9 +-------- SurfFinishing.cpp | 9 +-------- WaterJetting.cpp | 9 +-------- 19 files changed, 118 insertions(+), 100 deletions(-) diff --git a/Chiseling.cpp b/Chiseling.cpp index 97967fa..fb10684 100644 --- a/Chiseling.cpp +++ b/Chiseling.cpp @@ -588,14 +588,7 @@ Chiseling::Update( bool bPostApply) } // imposto eventuale asse bloccato da lavorazione - if ( ! m_Params.m_sBlockedAxis.empty()) { - string sAxis, sVal ; - Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ; - double dVal = 0 ; - FromString( sVal, dVal) ; - m_pMchMgr->ClearRotAxisBlock() ; - m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ; - } + SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; // calcolo gli assi macchina string sHint = ExtractHint( m_Params.m_sUserNotes) ; diff --git a/Drilling.cpp b/Drilling.cpp index dfb43fd..79f84b4 100644 --- a/Drilling.cpp +++ b/Drilling.cpp @@ -607,14 +607,7 @@ Drilling::Update( bool bPostApply) } // imposto eventuale asse bloccato da lavorazione - if ( ! m_Params.m_sBlockedAxis.empty()) { - string sAxis, sVal ; - Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ; - double dVal = 0 ; - FromString( sVal, dVal) ; - m_pMchMgr->ClearRotAxisBlock() ; - m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ; - } + SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; // calcolo gli assi macchina string sHint = ExtractHint( m_Params.m_sUserNotes) ; diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index f6e423b73f43ee0918f135febf1b724b37ae7238..373ae003cd3b6ddc4e56095e2d0c4da3325ba294 100644 GIT binary patch delta 97 zcmZpRX^YwLhmFy6^ItYwW=7M=j>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHQiUK= delta 97 zcmZpRX^YwLhmFx>^ItYwW=50Aj>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHQ1Kv2 diff --git a/GenMachining.cpp b/GenMachining.cpp index 084f81b..b99b083 100644 --- a/GenMachining.cpp +++ b/GenMachining.cpp @@ -629,14 +629,7 @@ GenMachining::Update( bool bPostApply) } // imposto eventuale asse bloccato da lavorazione - if ( ! m_Params.m_sBlockedAxis.empty()) { - string sAxis, sVal ; - Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ; - double dVal = 0 ; - FromString( sVal, dVal) ; - m_pMchMgr->ClearRotAxisBlock() ; - m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ; - } + SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; // calcolo gli assi macchina string sHint = ExtractHint( m_Params.m_sUserNotes) ; diff --git a/Head.cpp b/Head.cpp index 0000ee6..3e9abae 100644 --- a/Head.cpp +++ b/Head.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2017 +// EgalTech 2015-2021 //---------------------------------------------------------------------------- -// File : Head.cpp Data : 11.01.17 Versione : 1.6x6 +// File : Head.cpp Data : 14.10.21 Versione : 2.3j5 // Contenuto : Oggetto testa per gruppo testa di macchina. // // @@ -122,6 +122,7 @@ Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet, m_vsHSet.clear() ; m_vsHSet.push_back( sHSet) ; m_vtADir = vtADir ; + m_vtADir.Normalize() ; m_dRot1W = dRot1W ; m_Rot2Stroke = Rot2Stroke ; if ( IsValidHeadScc( nSolCh)) @@ -142,3 +143,12 @@ Head::AddHeadToHSet( const string& sHead) m_vsHSet.emplace_back( sHead) ; return true ; } + +//---------------------------------------------------------------------------- +bool +Head::ModifyHeadAuxDirection( const Vector3d& vtADir) +{ + m_vtADir = vtADir ; + m_vtADir.Normalize() ; + return true ; +} diff --git a/Head.h b/Head.h index 79df95c..72ff153 100644 --- a/Head.h +++ b/Head.h @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2015 +// EgalTech 2015-2021 //---------------------------------------------------------------------------- -// File : Head.h Data : 25.05.15 Versione : 1.6e7 +// File : Head.h Data : 14.10.21 Versione : 2.3j5 // Contenuto : Dichiarazione della classe Head. // // @@ -34,6 +34,7 @@ class Head : public IUserObj const Vector3d& vtADir, double dRot1W, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl) ; bool AddHeadToHSet( const std::string& sHead) ; + bool ModifyHeadAuxDirection( const Vector3d& vtADir) ; const std::string& GetName( void) const { return m_sName ; } int GetType( void) const diff --git a/Machine.cpp b/Machine.cpp index 7c1072b..061e13a 100644 --- a/Machine.cpp +++ b/Machine.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2015 +// EgalTech 2015-2021 //---------------------------------------------------------------------------- -// File : Machine.cpp Data : 06.05.15 Versione : 1.6e3 +// File : Machine.cpp Data : 14.10.21 Versione : 2.3j5 // Contenuto : Implementazione gestione macchina. // // @@ -801,6 +801,22 @@ Machine::EnableHeadInSet( const string& sHead) return true ; } +//---------------------------------------------------------------------------- +bool +Machine::ModifyMachineHeadAuxDirection( const string& sHead, const Vector3d& vtADir) +{ + // controllo GeomDB + if ( m_pGeomDB == nullptr) + return false ; + // recupero testa + int nHeadId = GetGroup( sHead) ; + Head* pHead = GetHead( nHeadId) ; + if ( pHead == nullptr) + return false ; + // eseguo la modifica + return pHead->ModifyHeadAuxDirection( vtADir) ; +} + //---------------------------------------------------------------------------- bool Machine::AdjustExitFrames( int nLay, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir) diff --git a/Machine.h b/Machine.h index ec80b37..bde783f 100644 --- a/Machine.h +++ b/Machine.h @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2015 +// EgalTech 2015-2021 //---------------------------------------------------------------------------- -// File : Machine.h Data : 06.05.15 Versione : 1.6e3 +// File : Machine.h Data : 14.10.21 Versione : 2.3j5 // Contenuto : Dichiarazione della classe Machine. // // @@ -230,6 +230,7 @@ class Machine const STRVECTOR& GetHSet( const std::string& sHead) const ; bool EnableHeadInSet( const std::string& sHead) ; bool LoadTool( Exit* pExit, const std::string& sTool) ; + bool ModifyMachineHeadAuxDirection( const std::string& sHead, const Vector3d& vtADir) ; bool AdjustExitFrames( int nLay, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir) ; bool CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit) ; bool ModifyMachineExitPosition( const std::string& sHead, int nExit, const Point3d& ptPos) ; @@ -310,6 +311,7 @@ class Machine static int LuaEmtModifyAxisDirection( lua_State* L) ; static int LuaEmtModifyAxisStroke( lua_State* L) ; static int LuaEmtModifyAxisHome( lua_State* L) ; + static int LuaEmtModifyHeadAuxDirection( lua_State* L) ; static int LuaEmtModifyExitPosition( lua_State* L) ; static int LuaEmtAddRapidStart( lua_State* L) ; static int LuaEmtAddRapidMove( lua_State* L) ; diff --git a/MachineLua.cpp b/MachineLua.cpp index e8808f1..4e930d5 100644 --- a/MachineLua.cpp +++ b/MachineLua.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2020 +// EgalTech 2015-2021 //---------------------------------------------------------------------------- -// File : MachineLua.cpp Data : 26.04.20 Versione : 2.2d4 +// File : MachineLua.cpp Data : 14.10.21 Versione : 2.3j5 // Contenuto : Implementazione gestione macchina : funzioni Lua. // // @@ -93,6 +93,7 @@ Machine::LuaInit( const string& sMachineName) m_LuaMgr.RegisterFunction( "EmtModifyAxisDirection", Machine::LuaEmtModifyAxisDirection) ; m_LuaMgr.RegisterFunction( "EmtModifyAxisStroke", Machine::LuaEmtModifyAxisStroke) ; m_LuaMgr.RegisterFunction( "EmtModifyAxisHome", Machine::LuaEmtModifyAxisHome) ; + m_LuaMgr.RegisterFunction( "EmtModifyHeadAuxDirection", Machine::LuaEmtModifyHeadAuxDirection) ; m_LuaMgr.RegisterFunction( "EmtModifyExitPosition", Machine::LuaEmtModifyExitPosition) ; m_LuaMgr.RegisterFunction( "EmtLinkRawPartToGroup", Machine::LuaEmtLinkRawPartToGroup) ; m_LuaMgr.RegisterFunction( "EmtUnlinkRawPartFromGroup", Machine::LuaEmtUnlinkRawPartFromGroup) ; @@ -903,6 +904,26 @@ Machine::LuaEmtModifyAxisHome( lua_State* L) return 1 ; } +//---------------------------------------------------------------------------- +int +Machine::LuaEmtModifyHeadAuxDirection( lua_State* L) +{ + // 2 parametri : sHead, vtADir + string sHead ; + LuaCheckParam( L, 1, sHead) + Vector3d vtADir ; + LuaCheckParam( L, 2, vtADir) + LuaClearStack( L) ; + // verifico ci sia una macchina attiva + if ( m_pMchLua == nullptr) + return luaL_error( L, " Unknown Machine") ; + // modifico la direzione ausiliaria della testa + bool bOk = m_pMchLua->ModifyMachineHeadAuxDirection( sHead, vtADir) ; + // assegno risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + //---------------------------------------------------------------------------- int Machine::LuaEmtModifyExitPosition( lua_State* L) diff --git a/Milling.cpp b/Milling.cpp index 332fee6..7ec3924 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -823,14 +823,7 @@ Milling::Update( bool bPostApply) } // imposto eventuale asse bloccato da lavorazione - if ( ! m_Params.m_sBlockedAxis.empty()) { - string sAxis, sVal ; - Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ; - double dVal = 0 ; - FromString( sVal, dVal) ; - m_pMchMgr->ClearRotAxisBlock() ; - m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ; - } + SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; // calcolo gli assi macchina string sHint = ExtractHint( m_Params.m_sUserNotes) ; @@ -3834,9 +3827,10 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& case MILL_LO_AS_LI : /* resta inalterato */ ; break ; default : nType = MILL_LI_NONE ; break ; } - if ( m_Params.m_nLeadOutType != MILL_LO_AS_LI) + if ( m_Params.m_nLeadOutType != MILL_LO_AS_LI) { dTang = m_Params.m_dLoTang ; dPerp = m_Params.m_dLoPerp ; + } } } // senso di rotazione da dir tg a dir esterna diff --git a/Mortising.cpp b/Mortising.cpp index 94b6119..98b9a89 100644 --- a/Mortising.cpp +++ b/Mortising.cpp @@ -627,14 +627,7 @@ Mortising::Update( bool bPostApply) } // imposto eventuale asse bloccato da lavorazione - if ( ! m_Params.m_sBlockedAxis.empty()) { - string sAxis, sVal ; - Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ; - double dVal = 0 ; - FromString( sVal, dVal) ; - m_pMchMgr->ClearRotAxisBlock() ; - m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ; - } + SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; // calcolo gli assi macchina string sHint = ExtractHint( m_Params.m_sUserNotes) ; diff --git a/Operation.cpp b/Operation.cpp index ebe96f1..d99ea44 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -1209,6 +1209,49 @@ Operation::ExtractHint( const string& sNotes) const return ExtractInfo( sNotes, "Hint:") ; } +//---------------------------------------------------------------------------- +bool +Operation::SetBlockedRotAxis( const string& sBlockedAxis) const +{ + if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) + return false ; + // cancello bloccaggio attuale + m_pMchMgr->ClearRotAxisBlock() ; + // se non ci sono bloccaggi, esco + if ( sBlockedAxis.empty()) + return true ; + // recupero token/nome asse e valore + string sKey, sVal ; + Split( sBlockedAxis, "=", true, sKey, sVal) ; + if ( sKey.empty() || sVal.empty()) + return true ; + double dVal = 0 ; + if ( ! FromString( sVal, dVal)) + return true ; + // imposto l'utensile per i calcoli macchina + if ( ! m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr())) + return false ; + // recupero numero assi lineari e rotanti correnti + 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) { + string sAxToken ; + if ( m_pMchMgr->GetCurrMachine()->GetCurrAxisToken( i + nLinAxes, sAxToken) && + sKey == Trim( sAxToken)) { + string sAxis ; + m_pMchMgr->GetCurrMachine()->GetCurrAxisName( i + nLinAxes, sAxis) ; + m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ; + bFound = true ; + } + } + if ( bFound) + return true ; + // lo cerco tra gli assi rotanti della macchina + return m_pMchMgr->SetRotAxisBlock( sKey, dVal) ; +} + //---------------------------------------------------------------------------- bool Operation::CalculateAxesValues( const string& sHint, bool bSolChExact) @@ -1267,7 +1310,7 @@ Operation::CalculateAxesValues( const string& sHint, bool bSolChExact) if ( ! sHint.empty()) { STRVECTOR vsTok ; Tokenize( sHint, ",;", vsTok) ; - for (const auto& sTok : vsTok) { + for ( const auto& sTok : vsTok) { string szKey, szVal ; Split( sTok, "=", true, szKey, szVal) ; Trim( szKey) ; diff --git a/Operation.h b/Operation.h index 27f468d..3a65767 100644 --- a/Operation.h +++ b/Operation.h @@ -99,6 +99,7 @@ class Operation : public IUserObj bool GetClPathFinalAxesValues( int nClPathId, bool bSkipRise, DBLVECTOR& vAxVal) const ; std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ; std::string ExtractHint( const std::string& sNotes) const ; + bool SetBlockedRotAxis( const std::string& sBlockedAxis) const ; bool CalculateAxesValues( const std::string& sHint, bool bSolChExact = false) ; bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ; diff --git a/Pocketing.cpp b/Pocketing.cpp index 9c20002..c794e12 100644 --- a/Pocketing.cpp +++ b/Pocketing.cpp @@ -687,14 +687,7 @@ Pocketing::Update( bool bPostApply) } // imposto eventuale asse bloccato da lavorazione - if ( ! m_Params.m_sBlockedAxis.empty()) { - string sAxis, sVal ; - Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ; - double dVal = 0 ; - FromString( sVal, dVal) ; - m_pMchMgr->ClearRotAxisBlock() ; - m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ; - } + SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; // calcolo gli assi macchina string sHint = ExtractHint( m_Params.m_sUserNotes) ; diff --git a/SawFinishing.cpp b/SawFinishing.cpp index 87d84fd..70ab75f 100644 --- a/SawFinishing.cpp +++ b/SawFinishing.cpp @@ -600,14 +600,7 @@ SawFinishing::Update( bool bPostApply) } // imposto eventuale asse bloccato da lavorazione - if ( ! m_Params.m_sBlockedAxis.empty()) { - string sAxis, sVal ; - Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ; - double dVal = 0 ; - FromString( sVal, dVal) ; - m_pMchMgr->ClearRotAxisBlock() ; - m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ; - } + SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; // calcolo gli assi macchina string sHint = ExtractHint( m_Params.m_sUserNotes) ; diff --git a/SawRoughing.cpp b/SawRoughing.cpp index 8f16025..f96a0ed 100644 --- a/SawRoughing.cpp +++ b/SawRoughing.cpp @@ -564,14 +564,7 @@ SawRoughing::Update( bool bPostApply) } // imposto eventuale asse bloccato da lavorazione - if ( ! m_Params.m_sBlockedAxis.empty()) { - string sAxis, sVal ; - Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ; - double dVal = 0 ; - FromString( sVal, dVal) ; - m_pMchMgr->ClearRotAxisBlock() ; - m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ; - } + SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; // calcolo gli assi macchina string sHint = ExtractHint( m_Params.m_sUserNotes) ; diff --git a/Sawing.cpp b/Sawing.cpp index fd70fcf..a92b0da 100644 --- a/Sawing.cpp +++ b/Sawing.cpp @@ -735,14 +735,7 @@ Sawing::Update( bool bPostApply) } // imposto eventuale asse bloccato da lavorazione - if ( ! m_Params.m_sBlockedAxis.empty()) { - string sAxis, sVal ; - Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ; - double dVal = 0 ; - FromString( sVal, dVal) ; - m_pMchMgr->ClearRotAxisBlock() ; - m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ; - } + SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; // calcolo gli assi macchina string sHint = ExtractHint( m_Params.m_sUserNotes) ; diff --git a/SurfFinishing.cpp b/SurfFinishing.cpp index 5d57601..b187f9f 100644 --- a/SurfFinishing.cpp +++ b/SurfFinishing.cpp @@ -593,14 +593,7 @@ SurfFinishing::Update( bool bPostApply) } // imposto eventuale asse bloccato da lavorazione - if ( ! m_Params.m_sBlockedAxis.empty()) { - string sAxis, sVal ; - Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ; - double dVal = 0 ; - FromString( sVal, dVal) ; - m_pMchMgr->ClearRotAxisBlock() ; - m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ; - } + SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; // calcolo gli assi macchina string sHint = ExtractHint( m_Params.m_sUserNotes) ; diff --git a/WaterJetting.cpp b/WaterJetting.cpp index c5dd2b4..907edfe 100644 --- a/WaterJetting.cpp +++ b/WaterJetting.cpp @@ -725,14 +725,7 @@ WaterJetting::Update( bool bPostApply) } // imposto eventuale asse bloccato da lavorazione - if ( ! m_Params.m_sBlockedAxis.empty()) { - string sAxis, sVal ; - Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ; - double dVal = 0 ; - FromString( sVal, dVal) ; - m_pMchMgr->ClearRotAxisBlock() ; - m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ; - } + SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; // calcolo gli assi macchina string sHint = ExtractHint( m_Params.m_sUserNotes) ; From 543afd4c7a5924dc248fee2b91665c00283de7a8 Mon Sep 17 00:00:00 2001 From: DarioS Date: Sun, 24 Oct 2021 18:10:31 +0200 Subject: [PATCH 09/11] EgtMachKernel 2.3j6 : - adattamenti per modifiche a GeomKernel. --- EgtMachKernel.rc | Bin 11782 -> 11782 bytes Pocketing.cpp | 8 ++++---- SawFinishing.cpp | 2 +- SawRoughing.cpp | 2 +- SurfFinishing.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 373ae003cd3b6ddc4e56095e2d0c4da3325ba294..289246400aec55917217800a6a1891771a120e89 100644 GIT binary patch delta 97 zcmZpRX^YwLhmFx}^ItYwW=6Bgj>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHR2d*z delta 97 zcmZpRX^YwLhmFy6^ItYwW=7M=j>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHQiUK= diff --git a/Pocketing.cpp b/Pocketing.cpp index c794e12..7409a2e 100644 --- a/Pocketing.cpp +++ b/Pocketing.cpp @@ -1713,7 +1713,7 @@ Pocketing::CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& v // calcolo la classificazione della curva rispetto al contorno IntersCurveCurve intCC( *pLine, *pCompoL) ; CRVCVECTOR ccClass ; - if ( intCC.GetCurveClassification( 0, ccClass)) { + if ( intCC.GetCurveClassification( 0, EPS_SMALL, ccClass)) { // determino gli intervalli di curva interni Intervals inOk ; for ( auto& ccOne : ccClass) { @@ -2291,7 +2291,7 @@ Pocketing::CalcZigZag( const ICurveComposite* pOffs, // calcolo la classificazione della curva rispetto al contorno esterno offsettato IntersCurveCurve intCC( *pLine, *pOffs) ; CRVCVECTOR ccClass ; - if ( ! intCC.GetCurveClassification( 0, ccClass)) { + if ( ! intCC.GetCurveClassification( 0, EPS_SMALL, ccClass)) { m_pMchMgr->SetLastError( 2413, "Error in Pocketing : Toolpath not computable") ; return false ; } @@ -2651,7 +2651,7 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con // calcolo la classificazione della curva rispetto al contorno esterno offsettato IntersCurveCurve intCC( *pLine, *pOffs2) ; CRVCVECTOR ccClass ; - if ( ! intCC.GetCurveClassification( 0, ccClass)) { + if ( ! intCC.GetCurveClassification( 0, EPS_SMALL, ccClass)) { m_pMchMgr->SetLastError( 2413, "Error in Pocketing : Toolpath not computable") ; return false ; } @@ -3313,7 +3313,7 @@ Pocketing::CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, const // classifico la curva di collegamento rispetto a quella di contenimento CRVCVECTOR ccClass ; IntersCurveCurve intCC( *LineLoc, *CrvOutLoc) ; - intCC.GetCurveClassification( 0, ccClass) ; + intCC.GetCurveClassification( 0, EPS_SMALL, ccClass) ; // se nessuno o un solo tratto e interno, la retta è il collegamento if ( ccClass.empty() || ( ccClass.size() == 1 && ccClass[0].nClass == CRVC_IN)) { pCrvLink->AddCurve( Release( pLine)) ; diff --git a/SawFinishing.cpp b/SawFinishing.cpp index 70ab75f..67c0a58 100644 --- a/SawFinishing.cpp +++ b/SawFinishing.cpp @@ -1767,7 +1767,7 @@ SawFinishing::TrimSection( ICurve* pCrv) // calcolo la classificazione della curva rispetto alla regione CRVCVECTOR ccClass ; - if ( ! pSfr->GetCurveClassification( *pCrv, ccClass)) + if ( ! pSfr->GetCurveClassification( *pCrv, EPS_SMALL, ccClass)) return false ; // determino l'intervallo di curva da conservare diff --git a/SawRoughing.cpp b/SawRoughing.cpp index f96a0ed..1b6aa2e 100644 --- a/SawRoughing.cpp +++ b/SawRoughing.cpp @@ -1452,7 +1452,7 @@ SawRoughing::TrimSection( ICurve* pCrv) // calcolo la classificazione della curva rispetto alla regione CRVCVECTOR ccClass ; - if ( ! pSfr->GetCurveClassification( *pCrv, ccClass)) + if ( ! pSfr->GetCurveClassification( *pCrv, EPS_SMALL, ccClass)) return false ; // determino l'intervallo di curva da conservare diff --git a/SurfFinishing.cpp b/SurfFinishing.cpp index b187f9f..58c287f 100644 --- a/SurfFinishing.cpp +++ b/SurfFinishing.cpp @@ -1492,7 +1492,7 @@ SurfFinishing::CalcZigZag( const ICurveComposite* pOffs, // calcolo la classificazione della curva rispetto al contorno esterno offsettato IntersCurveCurve intCC( *pLine, *pOffs) ; CRVCVECTOR ccClass ; - if ( ! intCC.GetCurveClassification( 0, ccClass)) { + if ( ! intCC.GetCurveClassification( 0, EPS_SMALL, ccClass)) { m_pMchMgr->SetLastError( 3110, "Error in SurfFinishing : Toolpath not computable") ; return false ; } From ac178100655425cf11ed99c1b28a5af134ab3a88 Mon Sep 17 00:00:00 2001 From: DarioS Date: Tue, 2 Nov 2021 08:21:07 +0100 Subject: [PATCH 10/11] EgtMachKernel 2.3j8 : - aggiunta funzione lua EmtGetAllLinkedRawParts - corretto calcolo GetPointUnderRaw. --- EgtMachKernel.rc | Bin 11782 -> 11782 bytes Machine.cpp | 7 +++++++ Machine.h | 2 ++ MachineLua.cpp | 17 +++++++++++++++++ Operation.cpp | 2 +- 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 289246400aec55917217800a6a1891771a120e89..d266acd50a23310fe789efa079eb4e6214ebe0ea 100644 GIT binary patch delta 97 zcmZpRX^YwLhmFx<^ItYwW=4z2j>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHS3w|Z delta 97 zcmZpRX^YwLhmFx}^ItYwW=6Bgj>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHR2d*z diff --git a/Machine.cpp b/Machine.cpp index 061e13a..da2d70a 100644 --- a/Machine.cpp +++ b/Machine.cpp @@ -1097,6 +1097,13 @@ Machine::IsLinkedRawPart( int nRawId) const return ( find( m_vLinkedRawParts.begin(), m_vLinkedRawParts.end(), nRawId) != m_vLinkedRawParts.end()) ; } +//---------------------------------------------------------------------------- +const INTVECTOR& +Machine:: GetAllLinkedRawParts( void) const +{ + return m_vLinkedRawParts ; +} + //---------------------------------------------------------------------------- bool Machine::UnlinkRawPartFromGroup( int nRawPartId) diff --git a/Machine.h b/Machine.h index bde783f..ececbb0 100644 --- a/Machine.h +++ b/Machine.h @@ -151,6 +151,7 @@ class Machine { return m_nMachineLook ; } bool LinkRawPartToGroup( int nRawPartId, const std::string& sGroupName) ; bool IsLinkedRawPart( int nRawId) const ; + const INTVECTOR& GetAllLinkedRawParts( void) const ; bool UnlinkRawPartFromGroup( int nRawPartId) ; bool UnlinkAllRawPartsFromGroups( void) ; bool LinkFixtureToGroup( int nFxtId, const std::string& sGroupName) ; @@ -321,6 +322,7 @@ class Machine static int LuaEmtGetAxesPos( lua_State* L) ; static int LuaEmtGetBackAuxDir( lua_State* L) ; static int LuaEmtLinkRawPartToGroup( lua_State* L) ; + static int LuaEmtGetAllLinkedRawParts( lua_State* L) ; static int LuaEmtUnlinkRawPartFromGroup( lua_State* L) ; static int LuaEmtUnlinkAllRawPartsFromGroups( lua_State* L) ; static int LuaEmtLinkFixtureToGroup( lua_State* L) ; diff --git a/MachineLua.cpp b/MachineLua.cpp index 4e930d5..b63d858 100644 --- a/MachineLua.cpp +++ b/MachineLua.cpp @@ -96,6 +96,7 @@ Machine::LuaInit( const string& sMachineName) m_LuaMgr.RegisterFunction( "EmtModifyHeadAuxDirection", Machine::LuaEmtModifyHeadAuxDirection) ; m_LuaMgr.RegisterFunction( "EmtModifyExitPosition", Machine::LuaEmtModifyExitPosition) ; m_LuaMgr.RegisterFunction( "EmtLinkRawPartToGroup", Machine::LuaEmtLinkRawPartToGroup) ; + m_LuaMgr.RegisterFunction( "EmtGetAllLinkedRawParts", Machine::LuaEmtGetAllLinkedRawParts) ; m_LuaMgr.RegisterFunction( "EmtUnlinkRawPartFromGroup", Machine::LuaEmtUnlinkRawPartFromGroup) ; m_LuaMgr.RegisterFunction( "EmtUnlinkAllRawPartsFromGroups", Machine::LuaEmtUnlinkAllRawPartsFromGroups) ; m_LuaMgr.RegisterFunction( "EmtLinkFixtureToGroup", Machine::LuaEmtLinkFixtureToGroup) ; @@ -984,6 +985,22 @@ Machine::LuaEmtUnlinkRawPartFromGroup( lua_State* L) return 1 ; } +//---------------------------------------------------------------------------- +int +Machine::LuaEmtGetAllLinkedRawParts( lua_State* L) +{ + // nessun parametro + LuaClearStack( L) ; + // verifico ci sia una macchina attiva + if ( m_pMchLua == nullptr) + return luaL_error( L, " Unknown Machine") ; + // recupero l'elenco dei grezzi agganciati ad un gruppo macchina + const INTVECTOR& vLinkedRawParts = m_pMchLua->GetAllLinkedRawParts() ; + // assegno risultato + LuaSetParam( L, vLinkedRawParts) ; + return 1 ; +} + //---------------------------------------------------------------------------- int Machine::LuaEmtUnlinkAllRawPartsFromGroups( lua_State* L) diff --git a/Operation.cpp b/Operation.cpp index d99ea44..646112f 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -372,7 +372,7 @@ Operation::GetPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double int nStmId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ; BBox3d b3Raw ; m_pGeomDB->GetGlobalBBox( nStmId, b3Raw) ; - b3Raw.Expand( 0.5 * dSafeZ) ; + b3Raw.Expand( 0.5 * dSafeZ, 0.5 * dSafeZ, 0) ; if ( ! b3Raw.IsEmpty() && b3Raw.OverlapsXY( b3Tool) && ptP.z + dExtraZ < b3Raw.GetMin().z - 10 * EPS_SMALL) { double dRawCentZ = ( b3Raw.GetMin().z + b3Raw.GetMax().z) / 2 ; double dRawDimZ = b3Raw.GetMax().z - b3Raw.GetMin().z ; From cfb2fea0bdd6627485111e68a57482098dc62c82 Mon Sep 17 00:00:00 2001 From: DarioS Date: Mon, 15 Nov 2021 09:53:18 +0100 Subject: [PATCH 11/11] EgtMachKernel 2.3k1 : - modifiche a Mortising per ricalcolo elevazione su attacco uscita indipendente da MaxElev. --- EgtMachKernel.rc | Bin 11782 -> 11782 bytes Mortising.cpp | 6 ++++++ 2 files changed, 6 insertions(+) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index d266acd50a23310fe789efa079eb4e6214ebe0ea..73bec79e8407069b04d5e0b1153d10dc584d8d78 100644 GIT binary patch delta 121 zcmZpRX^YwLgN@aYL5IO`^ItY=X69@L!^w`qx|_3v+!!~nNOI~D}d`2)2NkJbA OTnNOI~D}d`2)2NkJbA OTn punto approccio SetFlag( 1) ; @@ -1562,6 +1565,9 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v Point3d ptLo = ptLast + vtTool * dDelta ; bool bUnderEnd = GetPointUnderRaw( ptLo, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dEndElev) ; + // altrimenti ridetermino elevazione su fine percorso di lavoro + if ( ! bUnderEnd) + GetElevation( m_nPhase, ptLo, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndElev) ; // 6 -> ritorno all'approccio SetFeed( GetEndFeed()) ;