Files
EgtMachKernel/Operation.h
T
Dario Sassi 5ec2993913 EgtMachKernel :
- aggiunta possibilità di fresare e svuotare direttamente i testi
- migliorata gestione PMIN e PMAX dei percorsi di lavoro
- aggiunti MMIN e MMAX alle lavorazioni.
2018-04-16 09:23:16 +00:00

158 lines
8.1 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2016-2016
//----------------------------------------------------------------------------
// File : Operation.h Data : 29.04.16 Versione : 1.6p4
// Contenuto : Dichiarazione della classe Operation da cui derivano
// Disposition e Machining.
//
//
//
// Modifiche : 29.04.16 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "MachConst.h"
#include "MachineStruConst.h"
#include "/EgtDev/Include/EGkPoint3d.h"
#include "/EgtDev/Include/EGkUserObj.h"
#include "/EgtDev/Include/EGkSelection.h"
#include "/EgtDev/Include/EgtNumCollection.h"
class MachMgr ;
class CamData ;
class ICurve ;
class ICurveComposite ;
//----------------------------------------------------------------------------
class Operation : public IUserObj
{
public : // IUserObj
bool SetOwner( int nId, IGeomDB* pGDB) override ;
int GetOwner( void) const override ;
IGeomDB* GetGeomDB( void) const override ;
public :
virtual bool Init( MachMgr* pMchMgr) ;
virtual bool SetPhase( int nPhase)
{ m_nPhase = nPhase ; return true ; }
virtual int GetPhase( void) const
{ return m_nPhase ; }
virtual bool RemoveHome( void) ;
public :
virtual int GetType( void) const = 0 ;
virtual bool IsEmpty( void) const = 0 ;
protected :
virtual const std::string& GetToolName( void) const = 0 ;
virtual const std::string& GetHeadName( void) const = 0 ;
virtual int GetExitNbr( void) const = 0 ;
virtual int GetSolCh( void) const = 0 ;
virtual const std::string& GetToolTcPos( void) const = 0 ;
virtual bool NeedPrevHome( void) const = 0 ;
virtual bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
{ return true ; }
virtual bool AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCen) const
{ return true ; }
protected :
Operation( void) ;
protected :
bool GetElevation( int nPhase, const Point3d& ptP,
const Vector3d& vtDir, double& dElev) ;
bool GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2,
const Vector3d& vtDir, double& dElev) ;
bool GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptP3,
const Vector3d& vtDir, double& dElev) ;
bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad,
const Vector3d& vtDir, double& dElev) ;
bool GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist) ;
bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double& dDist, Vector3d& vtDir) ;
bool GetDistanceFromRawBottom( int nPhase, int nPathId, double dToler, double& dRbDist) ;
bool GetRawGlobBox( int nPhase, int nPathId, double dToler, BBox3d& b3Raw) ;
bool GetRawGlobBox( int nPhase, const BBox3d& b3Test, double dToler, BBox3d& b3Raw) ;
bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, double dToolThick) ;
bool ApproxWithArcsIfUseful( ICurveComposite* pCompo) ;
bool ApproxWithLines( ICurveComposite* pCompo) ;
bool VerifyArcs( ICurveComposite* pCompo, double dMaxAngCen = MAX_ANG_CEN) ;
bool CalcAndSetBBox( int nClId) ;
bool GetInitialAxesValues( DBLVECTOR& vAxVal) ;
bool GetClPathInitialAxesValues( int nClPathId, DBLVECTOR& vAxVal) ;
bool GetFinalAxesValues( DBLVECTOR& vAxVal) ;
bool GetClPathFinalAxesValues( int nClPathId, DBLVECTOR& vAxVal) ;
std::string Operation::ExtractInfo( const std::string& sNotes, const std::string& sKey) ;
std::string ExtractHint( const std::string& sNotes) ;
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) ;
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
bool AdjustOneStartMovement( int nClPathId, int nPrevClPathId, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
bool ToolChangeNeeded( const Operation& Op1, const Operation& Op2) ;
bool RemoveClimb( int nClPathId) ;
bool AddRise( DBLVECTOR& vAxVal, double dDelta = - 1, int nClPathId = GDB_ID_NULL) ;
bool RemoveRise( int nClPathId = GDB_ID_NULL) ;
bool AddHome( void) ;
bool CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) ;
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) ;
bool SpecialMoveZup( Vector3d& vtTool, DBLVECTOR& vAx, bool& bModif) ;
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) ;
protected :
int m_nOwnerId ; // identificativo dell'oggetto geometrico possessore
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
int m_nPhase ; // indice della fase di appartenenza (da 1 in su)
protected :
bool SetPathId( int nPathId) ;
bool SetToolDir( const Vector3d& vtDir) ;
bool SetCorrDir( const Vector3d& vtDir) ;
bool SetAuxDir( const Vector3d& vtDir) ;
bool SetCorrAuxDir( const Vector3d& vtDir) ;
bool SetFeed( double dFeed) ;
bool SetFlag( int nFlag) ;
bool GetCurrPos( Point3d& ptCurr) const
{ if ( ! m_bCurr) return false ; ptCurr = m_ptCurr ; return true ; }
int AddRapidStart( const Point3d& ptP) ;
int AddRapidStart( const Point3d& ptP, const std::string& sName) ;
int AddRapidMove( const Point3d& ptP) ;
int AddRapidMove( const Point3d& ptP, const std::string& sName) ;
int AddLinearMove( const Point3d& ptP) ;
int AddLinearMove( const Point3d& ptP, const std::string& sName) ;
int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN) ;
int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN, const std::string& sName) ;
int AddCurveMove( const ICurve* pCrv, bool bOnlySimple = false) ;
int AddCurveMove( const ICurve* pCrv, const std::string& sName, bool bOnlySimple = false) ;
bool ResetMoveData( void) ;
protected :
int m_nPathId ; // identificativo del gruppo corrente di inserimento dati
bool m_bCurr ; // punto corrente valido
Point3d m_ptCurr ; // posizione corrente
Vector3d m_vtTool ; // direzione fresa corrente
Vector3d m_vtCorr ; // direzione correzione corrente
Vector3d m_vtAux ; // direzione ausiliaria corrente
double m_dFeed ; // feed corrente
int m_nFlag ; // flag corrente
} ;
//----------------------------------------------------------------------------
inline const Operation* GetOperation( const IUserObj* pUserObj)
{ return dynamic_cast<const Operation*>( pUserObj) ; }
inline Operation* GetOperation( IUserObj* pUserObj)
{ return dynamic_cast< Operation*>( pUserObj) ; }
//----------------------------------------------------------------------------
// tipo posizione utensile
enum { TOOL_PARAL = 1, TOOL_ORTHO = 2, TOOL_ORTUP = 3} ;
// tipo di utilizzo contorno faccia
enum { FACE_DOWN = 1, FACE_TOP = 2, FACE_FRONT = 3, FACE_BACK = 4, FACE_LEFT = 5, FACE_RIGHT = 6, FACE_CONT = 7} ;