From 3b93e47fe703235a8c10431e3dc0437ec89e7ae5 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Wed, 30 Apr 2025 11:21:23 +0200 Subject: [PATCH 1/2] EgtMachKernel : - correzioni per movimenti in rapido con robot. --- Operation.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Operation.cpp b/Operation.cpp index 5622575..0fa8852 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -43,7 +43,7 @@ using namespace std ; //---------------------------------------------------------------------------- const double MAX_DIST_RAW = 200.0 ; -const double MAX_ROBOT_G0_LEN = 299.0 ; +const double MAX_ROBOT_G0_LEN = 101.0 ; //---------------------------------------------------------------------------- bool @@ -3721,15 +3721,16 @@ Operation::AddRise( DBLVECTOR& vAxVal, double dDelta, int nClPathId, int nToMinM if ( vAxVal.size() < 6) return false ; // verifico se richiesta Zmax - bool bZmax = ( dDelta < 0) ; + bool bZmax = ( ! isfinite( dDelta)) ; // calcolo gli assi (compresa verifica corse) - double dNewDeltaZ ; Point3d ptEnd = pCamData->GetEndPoint() ; Vector3d vtTool = pCamData->GetToolDir() ; Vector3d vtAux = pCamData->GetAuxDir() ; - bOk = CalcRobotAxesAbovePos( ptEnd, vtTool, vtAux, dDelta, vAxVal, &dNewDeltaZ) ; + DBLVECTOR vAxRise = vAxVal ; + double dNewDeltaZ ; + bOk = CalcRobotAxesAbovePos( ptEnd, vtTool, vtAux, dDelta, vAxRise, &dNewDeltaZ) ; // assegno i dati - pCam->SetAxes( ( bOk ? CamData::AS_OK : CamData::AS_OUTSTROKE), vAxVal) ; + pCam->SetAxes( ( bOk ? CamData::AS_OK : CamData::AS_OUTSTROKE), vAxRise) ; pCam->SetMoveType( 0) ; pCam->SetFeed( 0) ; pCam->SetFlag( ( bZmax ? 3 : 0)) ; @@ -3737,7 +3738,7 @@ Operation::AddRise( DBLVECTOR& vAxVal, double dDelta, int nClPathId, int nToMinM // associo questo oggetto a quello geometrico m_pGeomDB->SetUserObj( nId, Release( pCam)) ; // aggiungo eventuali posizioni intermedie per garantire movimento lineare entro tolleranze - int nStep = 1 + int( dNewDeltaZ / MAX_ROBOT_G0_LEN) ; + int nStep = 1 + int( ( dNewDeltaZ - EPS_SMALL) / MAX_ROBOT_G0_LEN) ; double dStep = dNewDeltaZ / nStep ; for ( int i = 1 ; i < nStep ; ++ i) { // copio l'entità @@ -3988,7 +3989,7 @@ Operation::AddRobotClimb( int nEntId, double dDeltaZ) pCdEnt->SetFlag( 2) ; pCdEnt->SetFlag2( ( bZmax ? 1 : 0)) ; // aggiungo eventuali posizioni intermedie per garantire movimento lineare entro tolleranze - int nStep = 1 + int( dNewDeltaZ / MAX_ROBOT_G0_LEN) ; + int nStep = 1 + int( ( dNewDeltaZ - EPS_SMALL) / MAX_ROBOT_G0_LEN) ; double dStep = dNewDeltaZ / nStep ; for ( int i = 1 ; i < nStep ; ++ i) { // copio l'entità @@ -4023,7 +4024,7 @@ Operation::CalcRobotAxesAbovePos( const Point3d& ptP, const Vector3d& vtT, const return false ; } // se DeltaZ non specificata vado a Zmax - if ( dDeltaZ < 0 ) { + if ( ! isfinite( dDeltaZ)) { // recupero quota tavola Point3d ptRef1 ; pMch->GetCurrTableRef1( ptRef1) ; From 5104da23b09cf5da460740fb9ebaf227676208aa Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Fri, 2 May 2025 19:08:38 +0200 Subject: [PATCH 2/2] =?UTF-8?q?EgtMachKernel=202.7e1=20:=20-=20possibilit?= =?UTF-8?q?=C3=A0=20di=20scegliere=20la=20classe=20di=20Pocketing=20da=20i?= =?UTF-8?q?ni=20dell'eseguibile=20([Mach]=20Pocketing=3D1/2)=20-=20modific?= =?UTF-8?q?he=20a=20PocketingNT=20per=20compatibilit=C3=A0=20con=20robot.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EgtMachKernel.rc | Bin 11774 -> 11774 bytes EgtMachKernel.vcxproj | 1 + EgtMachKernel.vcxproj.filters | 3 +++ MachMgrBasic.cpp | 3 +++ MachiningRegister.h | 40 ++++++++++++++++++++++++++++++++++ OperationConst.h | 2 -- Pocketing.cpp | 4 +--- PocketingNT.cpp | 22 ++++++------------- 8 files changed, 55 insertions(+), 20 deletions(-) create mode 100644 MachiningRegister.h diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 00e37388f74f08d4a435daa6190133a2f91a947f..ae520d7c0022518528a753e560d5c8ed82676d27 100644 GIT binary patch delta 121 zcmewt{V#gMH#SyN1|0^&&A-{KnVC}=3@1O7)ZLuM)x!c8zsNNCgkT;*P6$a3MUMyL R=2g-z%(yjz6ex#q0RU}_CYS&K delta 121 zcmewt{V#gMH#Sxi1|0_D&A-{KnVC} + diff --git a/EgtMachKernel.vcxproj.filters b/EgtMachKernel.vcxproj.filters index 884c3d5..511298e 100644 --- a/EgtMachKernel.vcxproj.filters +++ b/EgtMachKernel.vcxproj.filters @@ -767,6 +767,9 @@ Header Files + + Header Files + diff --git a/MachMgrBasic.cpp b/MachMgrBasic.cpp index 457ab9a..71c84ad 100644 --- a/MachMgrBasic.cpp +++ b/MachMgrBasic.cpp @@ -16,6 +16,7 @@ #include "MachMgr.h" #include "MachConst.h" #include "DllMain.h" +#include "MachiningRegister.h" #include "/EgtDev/Include/EMkDllMain.h" #include "/EgtDev/Include/EGnStringUtils.h" #include "/EgtDev/Include/EGnFileUtils.h" @@ -32,6 +33,8 @@ CreateMachMgr( void) // verifico la chiave e le opzioni if ( ! GetEMkNetHwKey() && ! TestKeyForEMk( GetEMkKey(), 0, GetEMkLogger())) return nullptr ; + // registro classe operazione per pocketing + RegisterPocketing() ; // creo il MachMgr return static_cast ( new(nothrow) MachMgr) ; } diff --git a/MachiningRegister.h b/MachiningRegister.h new file mode 100644 index 0000000..2775165 --- /dev/null +++ b/MachiningRegister.h @@ -0,0 +1,40 @@ +//---------------------------------------------------------------------------- +// EgalTech 2025-2025 +//---------------------------------------------------------------------------- +// File : MachiningRegister.h Data : 02.05.25 Versione : 2.7e1 +// Contenuto : Funzioni per registrazione dinamica oggetti delle lavorazioni +// (per decidere tra versioni diverse di una lavorazione). +// +// +// Modifiche : 02.05.25 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include "OperationConst.h" +#include "Pocketing.h" +#include "PocketingNT.h" +#include "/EgtDev/Include/EGkUserObjFactory.h" +#include "/EgtDev/Include/EgtIniFile.h" + +//---------------------------------------------------------------------------- +// Registrazione dinamica delle svuotature da parametro nel file Ini dell'eseguibile +inline bool +RegisterPocketing( void) +{ + const char* SEC_MACH = "Mach" ; + const char* KEY_POCKETING = "Pocketing" ; + static bool bFirst = true ; + if ( bFirst) { + std::string sIniPath ; + ExeGetIniFile( sIniPath) ; + if ( GetPrivateProfileInt( SEC_MACH, KEY_POCKETING, 1, sIniPath.c_str()) == 2) + UserObjRegister::DoRegister( GetOperationClass( OPER_POCKETING)) ; + else + UserObjRegister::DoRegister( GetOperationClass( OPER_POCKETING)) ; + bFirst = false ; + } + return true ; +} diff --git a/OperationConst.h b/OperationConst.h index 84a6102..8c79e18 100644 --- a/OperationConst.h +++ b/OperationConst.h @@ -18,8 +18,6 @@ #include "/EgtDev/Include/EMkOperationConst.h" #include -#define POCKETING_NT 0 - //---------------------------------------------------------------------------- static const std::string s_OpeClass[] = {"", "EMkDisposition", diff --git a/Pocketing.cpp b/Pocketing.cpp index b4f9b1c..9f1a55b 100644 --- a/Pocketing.cpp +++ b/Pocketing.cpp @@ -95,9 +95,7 @@ const string UN_MAXOPTSIZE = "MaxOptSize" ; // 2458 = "Warning in Pocketing : machining depth (xxx) bigger than MaxMaterial (yyy)" //---------------------------------------------------------------------------- -#if POCKETING_NT != 1 - USEROBJ_REGISTER( GetOperationClass( OPER_POCKETING), Pocketing) ; -#endif +// USEROBJ_REGISTER( GetOperationClass( OPER_POCKETING), Pocketing) ; //---------------------------------------------------------------------------- const string& diff --git a/PocketingNT.cpp b/PocketingNT.cpp index 645f949..731972b 100644 --- a/PocketingNT.cpp +++ b/PocketingNT.cpp @@ -112,9 +112,7 @@ const string UN_OPENEXTENSION = "OpenExtension" ; #endif //---------------------------------------------------------------------------- -#if POCKETING_NT == 1 - USEROBJ_REGISTER( GetOperationClass( OPER_POCKETING), PocketingNT) ; -#endif +// USEROBJ_REGISTER( GetOperationClass( OPER_POCKETING), PocketingNT) ; //---------------------------------------------------------------------------- const string& @@ -2956,7 +2954,7 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou ( m_Params.m_nSubType == POCKET_SUB_ZIGZAG && ! currPath.bIsZigZagOneWayBorder) || ( m_Params.m_nSubType == POCKET_SUB_ONEWAY && ! currPath.bIsZigZagOneWayBorder)) ; if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtTool, currStep.pSfrPock, Get( currPath.pCrvGuideIn), - ( m_Params.m_nSubType == POCKET_SUB_SPIRALOUT) ? m_Params.m_bInvert : ! m_Params.m_bInvert, + ( m_Params.m_nSubType == POCKET_SUB_SPIRALOUT ? m_Params.m_bInvert : ! m_Params.m_bInvert), bSplitArcs, bNoneForced, false)) { m_pMchMgr->SetLastError( 3013, "Error in PocketingNT : LeadIn not computable") ; return false ; @@ -2968,18 +2966,12 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou Point3d ptP3 = pLine->GetEnd() ; Vector3d vtMove ; pLine->GetStartDir( vtMove) ; SetFeed( dCoeffFeed * GetRightFeed( vtMove, vtTool)) ; - if ( AddLinearMove( ptP3) == GDB_ID_NULL) + if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL) return false ; } - else if ( pCurve->GetType() == CRV_ARC) { - ICurveArc* pArc = GetCurveArc( pCurve) ; - Point3d ptCen = pArc->GetCenter() ; - double dAngCen = pArc->GetAngCenter() ; - Vector3d vtN = pArc->GetNormVersor() ; - Point3d ptP3 ; - pArc->GetEndPoint( ptP3) ; + else { SetFeed( dCoeffFeed * GetFeed()) ; - if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL) + if ( AddCurveMove( pCurve, bSplitArcs) == GDB_ID_NULL) return false ; } // se ultima entità @@ -3057,9 +3049,9 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou } // tratto lineare sopra al punto corrente SetFeed( GetEndFeed()) ; - AddLinearMove( ptEnd + vtTool * dCurrElev) ; + AddLinearMove( ptEnd + vtTool * dCurrElev, bSplitArcs) ; // tratto lineare sopra a ptDest - AddLinearMove( ptDest + vtTool * dNextElev) ; + AddLinearMove( ptDest + vtTool * dNextElev, bSplitArcs) ; // aggiorno le elevazioni dCurrElev = dNextElev ; }