Files
Riccardo Elitropi 708fe02b9b EgtMachKernel (NewLink) :
- correzione a funzione SpecialLink e aggiunto parametro a funzione GetDoubleToolData.
2026-03-19 09:52:01 +01:00

171 lines
8.6 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : Disposition.h Data : 27.05.15 Versione : 1.6e7
// Contenuto : Dichiarazione della classe Disposition.
//
//
//
// Modifiche : 27.05.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Operation.h"
//----------------------------------------------------------------------------
struct AxisData
{
std::string sName ; // nome dell'asse ausiliario da muovere
double dPos ; // posizione dell'asse
AxisData( void)
: sName(), dPos( 0) {}
AxisData( const std::string& sN, double dP)
: sName( sN), dPos( dP) {}
} ;
typedef std::vector<AxisData> AXDATAVECTOR ;
//----------------------------------------------------------------------------
struct FixtureData
{
std::string sName ; // nome del dispositivo di bloccaggio
int nId ; // identificativo
Point3d ptPos ; // posizione nel riferimento tavola
double dAng ; // angolo di rotazione attorno al centro
double dMov ; // posizione eventuale parte mobile
std::string sTaLink ; // eventuale asse di tavola a cui è fissata
FixtureData( void)
: sName(), nId( GDB_ID_NULL), ptPos(), dAng( 0), dMov( 0), sTaLink() {}
FixtureData( const std::string& sN, int nI, const Point3d& ptP, double dA, double dM)
: sName( sN), nId( nI), ptPos( ptP), dAng( dA), dMov( dM) {}
} ;
typedef std::vector<FixtureData> FIXDATAVECTOR ;
//----------------------------------------------------------------------------
struct MoveRawData
{
int nRawId ; // identificativo del grezzo
int nType ; // tipo di movimento ( 1=MoveToCorner, 2=MoveToCenter, 3=Rotate)
Point3d ptP ; // punto di riferimento / angoli di Eulero CAC'
int nFlag ; // flag sottotipo movimento/rotazione
enum { NONE = 0, COR = 1, CEN = 2, ROT = 3} ;
MoveRawData( void)
: nRawId( 0), nType( NONE), ptP(), nFlag( 0) {}
MoveRawData( int nId, int nT, const Point3d& ptR, int nF)
: nRawId( nId), nType( nT), ptP( ptR), nFlag( nF) {}
} ;
typedef std::vector<MoveRawData> MVRDATAVECTOR ;
//----------------------------------------------------------------------------
class Disposition : public Operation
{
public : // IUserObj
Disposition* Clone( void) const override ;
const std::string& GetClassName( void) const override ;
bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;
bool ToSave( void) const override
{ return true ; }
bool Save( int nBaseId, STRVECTOR& vString) const override ;
bool Load( const STRVECTOR& vString, int nBaseGdbId) override ;
public : // Operation
int GetType( void) const override
{ return OPER_DISP ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nShifts == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
protected : // Operation
const std::string& GetToolName( void) const override ;
const std::string& GetHeadName( void) const override ;
int GetExitNbr( void) const override ;
const std::string& GetToolTcPos( void) const override ;
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const override
{ return false ; }
int GetSolCh( void) const override
{ return 0 ; }
bool NeedPrevHome( void) const override ;
public :
Disposition( void) ;
public :
bool SetTable( const std::string& sTable) ;
bool SetAreaOffset( double dOffsXP, double dOffsYP, double dOffsXM, double dOffsYM) ;
bool ResetAreaOffset( void) ;
bool Apply( bool bVerifyTab) ;
bool IsSetTableName( void) const
{ return ! m_sTabName.empty() ; }
bool GetTable( std::string& sTable) const ;
bool GetTableRef1( Point3d& ptRef1) const ;
bool GetTableArea1( BBox3d& b3Area1) const ;
bool GetTableAreaOffset1( BBox3d& b3AreaOffs1) const ;
bool MoveAxis( const std::string& sName, double dPos) ;
bool RemoveAxis( const std::string& sName) ;
int AddFixture( const std::string& sName, int nId, const Point3d& ptPos, double dAngDeg = 0,
double dMov = 0, bool bAddToList = true) ;
int GetFirstFixture( void) ;
int GetNextFixture( int nId) ;
bool MoveFixture( int nId, const Vector3d& vtMove) ;
bool RotateFixture( int nId, double dDeltaAngDeg) ;
bool SetFixtureLink( int nId, const std::string& sTaLink) ;
bool MoveFixtureMobile( int nId, double dDeltaMov) ;
bool SetFixtureMobile( int nId, double dMov) ;
bool PlaceFixture( int nId, const Point3d& ptPos, double dAngDeg, double dMov) ;
bool RemoveFixture( int nId) ;
bool MoveToCornerRawPart( int nRawId, const Point3d& ptP, int nFlag, bool bAddToList = true, bool bVerify = true) ;
bool MoveToCenterRawPart( int nRawId, const Point3d& ptP, int nFlag, bool bAddToList = true, bool bVerify = true) ;
bool MoveRawPart( int nRawId, const Vector3d& vtMove) ;
bool RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg) ;
bool ApplyRotationToRawPart( int nRawId, double dAngCDeg, double dAngADeg, double dAngC1Deg, bool bAddToList = true) ;
bool UpdateRawPartId( int nRawId, int nNewRawId) ;
bool RemoveRawPart( int nRawId) ;
bool GetMoveAxisData( int nInd, std::string& sName, double& dPos) const ;
bool GetFixtureData( int nInd, std::string& sName, int& nId, Point3d& ptPos,
double& dAngDeg, double& dMov, std::string& sTaLink) const ;
bool GetMoveRawData( int nInd, int& nRawId, int& nType, Point3d& ptPos, int& nFlag) const ;
bool SpecialApply( bool bRecalc) ;
bool SpecialUpdate( void) ;
bool GetToolData( std::string& sName, std::string& sHead, int& nExit, std::string& sTcPos) const ;
bool GetSomeByHand( void) const
{ return m_bSomeByHand ; }
bool IsWithTool( void)
{ return ( m_nShifts != -1) ;}
private :
bool InsertMoveInfoInList( int nRawId, int nType, const Point3d& ptP, int nFlag) ;
bool IsInTable( const Point3d& ptP) ;
bool IsInTable( const BBox3d& b3B) ;
private :
bool m_bTabOk ; // flag di tavola verificata
std::string m_sTabName ; // nome della tavola di appartenenza
Point3d m_ptRef1 ; // origine 1 della tavola
BBox3d m_b3Area1 ; // area utile 1 della tavola
std::array<double,4> m_dAreaOffset ; // eventuali allargamenti dell'area sui 4 lati (0=XP, 1=YP, 2=XM, 3=YM)
AXDATAVECTOR m_vAxData ; // elenco movimenti assi ausiliari
FIXDATAVECTOR m_vFixData ; // elenco posizionamento bloccaggi
MVRDATAVECTOR m_vMvrData ; // elenco movimenti grezzi
std::string m_sHead ; // eventuale testa usata per muovere i pezzi
int m_nExit ; // eventuale uscita sulla testa
std::string m_sTcPos ; // eventuale posizione nel cambiautensili
int m_nStatus ; // stato di aggiornamento degli eventuali spostamenti con testa
int m_nShifts ; // numero eventuali spostamenti con testa
bool m_bSomeByHand ; // presenza di operazioni manuali (anche in aggiunta ad automatiche)
} ;
//----------------------------------------------------------------------------
inline const Disposition* GetDisposition( const IUserObj* pUserObj)
{ return dynamic_cast<const Disposition*>( pUserObj) ; }
inline Disposition* GetDisposition( IUserObj* pUserObj)
{ return dynamic_cast< Disposition*>( pUserObj) ; }