9f60658c35
- gestione spiazzamento identificativi per i diversi oggetti derivati da UserObj - in Disposition, nei movimenti, si aggiornano Id grezzi - nelle lavorazioni si aggiornano gli identificativi della geometria originale.
118 lines
5.5 KiB
C++
118 lines
5.5 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 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
|
|
FixtureData( void)
|
|
: sName(), nId( GDB_ID_NULL), ptPos(), dAng( 0) {}
|
|
FixtureData( const std::string& sN, int nI, const Point3d& ptP, double dA)
|
|
: sName( sN), nId( nI), ptPos( ptP), dAng( dA) {}
|
|
} ;
|
|
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( STRVECTOR& vString) const override ;
|
|
bool Load( const STRVECTOR& vString, int nBaseGdbId) override ;
|
|
|
|
public : // Operation
|
|
bool IsEmpty( void) const override
|
|
{ return ( m_nShifts == 0) ; }
|
|
|
|
protected : // Operation
|
|
const std::string& GetToolName( void) const ;
|
|
const std::string& GetHeadName( void) const ;
|
|
int GetExitNbr( void) const ;
|
|
const std::string& GetToolTcPos( void) const ;
|
|
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) override
|
|
{ return true ; }
|
|
|
|
public :
|
|
Disposition( void) ;
|
|
|
|
public :
|
|
bool SetTable( const std::string& sTable) ;
|
|
bool Apply( void) ;
|
|
bool IsSetTableName( void) const
|
|
{ return ! m_sTabName.empty() ; }
|
|
bool GetTable( std::string& sTable) const ;
|
|
bool GetTableRef1( Point3d& ptRef1) const ;
|
|
bool GetTableArea1( BBox3d& b3Area1) const ;
|
|
int AddFixture( const std::string& sName, const Point3d& ptPos, double dAngDeg = 0, bool bAddToList = true) ;
|
|
bool MoveFixture( int nId, const Vector3d& vtMove) ;
|
|
bool RotateFixture( int nId, double dAngDeg) ;
|
|
bool RemoveFixture( int nId) ;
|
|
bool MoveToCornerRawPart( int nRawId, const Point3d& ptP, int nFlag, bool bAddToList = true) ;
|
|
bool MoveToCenterRawPart( int nRawId, const Point3d& ptP, int nFlag, bool bAddToList = 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 RemoveRawPart( int nRawId) ;
|
|
bool GetFixtureData( int nInd, std::string& sName, int& nId, Point3d& ptPos, double& dAngDeg) const ;
|
|
bool GetMoveRawData( int nInd, int& nRawId, int& nType, Point3d& ptPos, int& nFlag) const ;
|
|
bool SpecialApply( bool bRecalc) ;
|
|
bool GetToolData( string& sName, string& sHead, int& nExit) const ;
|
|
|
|
private :
|
|
bool VerifyFixture( int nFixtId) const ;
|
|
bool VerifyRawPart( int nRawId) const ;
|
|
|
|
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
|
|
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
|
|
int m_nShifts ; // numero eventuali spostamenti con testa
|
|
} ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
inline const Disposition* GetDisposition( const IUserObj* pUserObj)
|
|
{ return dynamic_cast<const Disposition*>( pUserObj) ; }
|
|
inline Disposition* GetDisposition( IUserObj* pUserObj)
|
|
{ return dynamic_cast< Disposition*>( pUserObj) ; }
|