From 44a9bdadf6cfc334f4aedf9da4f74f6fc99d7e0b Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 1 Jun 2017 15:02:59 +0000 Subject: [PATCH] EgtMachKernel 1.8e6 : - aggiunte GetMachiningStartPoint e GetMachiningEndPoint. --- EgtMachKernel.rc | Bin 11774 -> 11774 bytes MachMgr.h | 2 ++ MachMgrOperations.cpp | 32 +++++++++++++++++++++ Machining.cpp | 65 +++++++++++++++++++++++++++++++++++------- Machining.h | 4 ++- 5 files changed, 92 insertions(+), 11 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index b2571a761532275c986427333c2d19f858e55386..be26b1215a10af742d4200fb606992414a8fe71d 100644 GIT binary patch delta 97 zcmewt{V#gMFE&QA&A-`fnHkL{Ka|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmUTDBd7oX delta 97 zcmewt{V#gMFE&Qg&A-`fnHfzdKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmUO4BcK2P diff --git a/MachMgr.h b/MachMgr.h index 62fc687..80716f4 100644 --- a/MachMgr.h +++ b/MachMgr.h @@ -251,6 +251,8 @@ class MachMgr : public IMachMgr bool GetMachiningParam( int nType, std::string& sVal) const override ; bool GetMachiningGeometry( SELVECTOR& vIds) const override ; bool IsMachiningEmpty( void) const override ; + bool GetMachiningStartPoint( Point3d& ptStart) const override ; + bool GetMachiningEndPoint( Point3d& ptEnd) const override ; // Simulation bool SimStart( bool bFirst) override ; bool SimMove( int& nStatus) override ; diff --git a/MachMgrOperations.cpp b/MachMgrOperations.cpp index f52f180..6674d63 100644 --- a/MachMgrOperations.cpp +++ b/MachMgrOperations.cpp @@ -1043,3 +1043,35 @@ MachMgr::IsMachiningEmpty( void) const // restituisco lo stato return pMch->IsEmpty() ; } + +//---------------------------------------------------------------------------- +bool +MachMgr::GetMachiningStartPoint( Point3d& ptStart) const +{ + // recupero la lavorazione corrente + int nCurrMchId = GetCurrMachining() ; + if ( nCurrMchId == GDB_ID_NULL) + return false ; + // ne recupero il gestore + Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ; + if ( pMch == nullptr) + return false ; + // restituisco il punto iniziale del primo percorso di lavorazione + return pMch->GetStartPoint( ptStart) ; +} + +//---------------------------------------------------------------------------- +bool +MachMgr::GetMachiningEndPoint( Point3d& ptEnd) const +{ + // recupero la lavorazione corrente + int nCurrMchId = GetCurrMachining() ; + if ( nCurrMchId == GDB_ID_NULL) + return false ; + // ne recupero il gestore + Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ; + if ( pMch == nullptr) + return false ; + // restituisco il punto finale dell'ultimo percorso di lavorazione + return pMch->GetEndPoint( ptEnd) ; +} diff --git a/Machining.cpp b/Machining.cpp index 1ad43e9..0738766 100644 --- a/Machining.cpp +++ b/Machining.cpp @@ -16,17 +16,8 @@ #include "DllMain.h" #include "MachMgr.h" #include "Machining.h" -#include "MachiningConst.h" -#include "CamData.h" -#include "/EgtDev/Include/EGkAngle.h" #include "/EgtDev/Include/EGkGeoPoint3d.h" -#include "/EgtDev/Include/EGkCurveLine.h" -#include "/EgtDev/Include/EGkCurveArc.h" -#include "/EgtDev/Include/EgkDistPointCurve.h" -#include "/EgtDev/Include/EgkIntersCurves.h" -#include "/EgtDev/Include/EGkIntersLineSurfTm.h" -#include "/EgtDev/Include/EGkGeomDB.h" -#include "/EgtDev/Include/EgtPointerOwner.h" +#include "/EgtDev/Include/EGkCurve.h" using namespace std ; @@ -71,6 +62,60 @@ Machining:: NeedPrevHome( void) const return false ; } +//---------------------------------------------------------------------------- +bool +Machining::GetStartPoint( Point3d& ptStart) const +{ + // verifico validità gestore DB geometrico + if ( m_pGeomDB == nullptr) + return false ; + // recupero gruppo per geometria di lavorazione (Cutter Location) + int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ; + if ( nClId == GDB_ID_NULL) + return false ; + // recupero la prima entità del primo sottogruppo + int nEntId = m_pGeomDB->GetFirstInGroup( m_pGeomDB->GetFirstGroupInGroup( nClId)) ; + if ( nEntId == GDB_ID_NULL) + return false ; + // recupero il punto iniziale di questa entità + const IGeoObj* pGeoObj = m_pGeomDB->GetGeoObj( nEntId) ; + if ( pGeoObj->GetType() == GEO_PNT3D) { + ptStart = GetGeoPoint3d( pGeoObj)->GetPoint() ; + return true ; + } + else if ( ( pGeoObj->GetType() & GEO_CURVE) != 0) + return GetCurve( pGeoObj)->GetStartPoint( ptStart) ; + else + return false ; +} + +//---------------------------------------------------------------------------- +bool +Machining::GetEndPoint( Point3d& ptEnd) const +{ + // verifico validità gestore DB geometrico + if ( m_pGeomDB == nullptr) + return false ; + // recupero gruppo per geometria di lavorazione (Cutter Location) + int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ; + if ( nClId == GDB_ID_NULL) + return false ; + // recupero l'ultima entità dell'ultimo sottogruppo + int nEntId = m_pGeomDB->GetLastInGroup( m_pGeomDB->GetLastGroupInGroup( nClId)) ; + if ( nEntId == GDB_ID_NULL) + return false ; + // recupero il punto finale di questa entità + const IGeoObj* pGeoObj = m_pGeomDB->GetGeoObj( nEntId) ; + if ( pGeoObj->GetType() == GEO_PNT3D) { + ptEnd = GetGeoPoint3d( pGeoObj)->GetPoint() ; + return true ; + } + else if ( ( pGeoObj->GetType() & GEO_CURVE) != 0) + return GetCurve( pGeoObj)->GetEndPoint( ptEnd) ; + else + return false ; +} + //---------------------------------------------------------------------------- bool Machining::PostApply( void) diff --git a/Machining.h b/Machining.h index 0c6a87b..c2d2855 100644 --- a/Machining.h +++ b/Machining.h @@ -43,10 +43,12 @@ class Machining : public Operation virtual bool GetGeometry( SELVECTOR& vIds) const = 0 ; public : - bool PostApply( void) ; + bool GetStartPoint( Point3d& ptStart) const ; + bool GetEndPoint( Point3d& ptEnd) const ; protected : Machining( void) ; + bool PostApply( void) ; } ; //----------------------------------------------------------------------------