Files
Dario Sassi a4831980e7 EgtMachKernel :
- piccoli aggiustamenti.
2026-04-19 10:54:10 +02:00

586 lines
36 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2015-2024
//----------------------------------------------------------------------------
// File : MachMgr.h Data : 25.11.24 Versione : 2.6k5
// Contenuto : Dichiarazione della classe MachMgr.
//
//
//
// Modifiche : 23.03.15 DS Creazione modulo.
// 16.05.19 DS Aggiunto parametro sToolMakersDir a Init.
// 17.08.20 DS Aggiunte GetAxisMin e GetAxisMax.
// 17.03.21 DS Aggiunte funzioni per import/export utensili.
// 21.09.22 DS Aggiunta GetAxisOffset.
// 25.08.23 DS Aggiunta CopyMachGroup.
// 28.10.23 DS Aggiunte GetClEntAxesVal e GetToolSetupPosInCurrSetup.
// 30.03.24 DS Aggiunte GetAllAxesNames e GetCalcTable.
// 02.04.24 DS Aggiunta GetClEntAxesMask.
// 22.04.24 DS Aggiunta GetExitId.
// 25.11.24 DS Aggiunta GetMachiningSkippedGeometry.
//
//----------------------------------------------------------------------------
#pragma once
#include "MachConst.h"
#include "Machine.h"
#include "ToolsMgr.h"
#include "MachiningsMgr.h"
#include "SetupMgr.h"
#include "Simulator.h"
#include "/EgtDev/Include/EMkMachMgr.h"
#include "/EgtDev/Include/EgtNumCollection.h"
//----------------------------------------------------------------------------
struct MachGrp {
std::string MGeoName ;
int SetupGroupId ;
int FixtGroupId ;
int RawGroupId ;
int OperGroupId ;
MachGrp( void)
: MGeoName(), SetupGroupId( GDB_ID_NULL), FixtGroupId( GDB_ID_NULL),
RawGroupId( GDB_ID_NULL), OperGroupId( GDB_ID_NULL) {}
MachGrp( const std::string& MgName, int SgId, int FgId, int RgId, int OgId)
: MGeoName( MgName), SetupGroupId( SgId), FixtGroupId( FgId),
RawGroupId( RgId), OperGroupId( OgId) {}
} ;
//----------------------------------------------------------------------------
struct AxisBlock {
std::string sAxis ;
double dVal ;
AxisBlock( void)
: sAxis(), dVal( 0) {}
AxisBlock( const std::string& sA, double dV)
: sAxis( sA), dVal( dV) {}
} ;
//----------------------------------------------------------------------------
struct MachineData {
std::string sName ;
std::string sDir ;
Machine* pMachine ;
ToolsMgr* pTsMgr ;
MachiningsMgr* pMsMgr ;
MachineData( void)
: pMachine( nullptr), pTsMgr( nullptr), pMsMgr( nullptr) {}
MachineData( const std::string& sN, const std::string& sD, Machine* pM, ToolsMgr* pTM, MachiningsMgr* pMM)
{ sName = sN ; sDir = sD ; pMachine = pM ; pTsMgr = pTM ; pMsMgr = pMM ; }
} ;
//----------------------------------------------------------------------------
class MachMgr : public IMachMgr
{
public :
// Basic
~MachMgr( void) override ;
bool Init( const std::string& sMachinesDir, const std::string& sToolMakersDir, IGeomDB* pGeomDB,
int nContextId, const std::string& sLuaLibsDir, const std::string& sLuaLastRequire) override ;
bool Update( void) override ;
bool Insert( int nInsGrp) override ;
int GetLastErrorId( void) const override
{ return m_nLastError ; }
std::string GetLastErrorString( void) const override
{ return m_sLastError ; }
int GetWarningId( int nInd) const override
{ if ( nInd < 0 || nInd >= int( m_Warnings.size())) return 0 ; return m_Warnings[ nInd].first ; }
std::string GetWarningString( int nInd) const override
{ if ( nInd < 0 || nInd >= int( m_Warnings.size())) return "" ; return m_Warnings[ nInd].second ; }
// Machines
bool GetMachines( STRVECTOR& vsMachineNames, STRVECTOR& vsMachineDirs) const override ;
bool SetCurrMachine( const std::string& sMachineName) override ;
bool GetCurrMachineName( std::string& sMachineName) const override ;
bool GetCurrMachineDir( std::string& sMachineDir) const override ;
// MachGroups
bool IsMachBase( int nId) const override ;
int GetMachGroupCount( void) const override ;
int GetFirstMachGroup( void) const override ;
int GetNextMachGroup( int nId) const override ;
int GetLastMachGroup( void) const override ;
int GetPrevMachGroup( int nId) const override ;
bool GetMachGroupNewName( std::string& sName) const override ;
int AddMachGroup( const std::string& sName, const std::string& sMachineName) override ;
int CopyMachGroup( const std::string& sSouName, const std::string& sName) override ;
bool RemoveMachGroup( int nId) override ;
bool ChangeMachGroupName( int nId, const std::string& sNewName) override ;
std::string GetMachGroupName( int nId) const override ;
std::string GetMachGroupMachineName( int nId) const override ;
int GetMachGroupId( const std::string& sName) const override ;
bool SetCurrMachGroup( int nId) override ;
bool ResetCurrMachGroup( void) override ;
int GetCurrMachGroup( void) const override ;
// Phases
int AddPhase( void) override ;
bool SetCurrPhase( int nPhase, bool bForced = false) override ;
int GetCurrPhase( void) const override ;
bool RemoveLastPhase( void) override ;
int GetPhaseCount( void) const override ;
// RawParts
int GetRawPartCount( void) const override ;
int GetFirstRawPart( void) const override ;
int GetNextRawPart( int nId) const override ;
bool IsRawPart( int nId) const override
{ return VerifyRawPart( nId) ; }
int AddRawPart( const Point3d& ptOrig, double dLen, double dWidth, double dHeight, Color cCol) override ;
int AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color cCol) override ;
bool ModifyRawPart( int nRawId, const Point3d& ptOrig, double dLen, double dWidth, double dHeight, Color cCol) override ;
bool ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dHeight, Color cCol) override ;
bool ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dHeight) override ;
bool ModifyRawPartHeight( int nRawId, double dHeight) override ;
bool KeepRawPart( int nRawId, int nSouPhase) override ;
bool VerifyRawPartPhase( int nRawId, int nPhase) const override ;
bool RemoveRawPartFromCurrPhase( int nRawId) override ;
bool RemoveRawPart( int nRawId) override ;
bool RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg) override ;
bool MoveToCornerRawPart( int nRawId, const Point3d& ptCorner, int nFlag) override ;
bool MoveToCenterRawPart( int nRawId, const Point3d& ptCenter, int nFlag) override ;
bool MoveRawPart( int nRawId, const Vector3d& vtMove) override ;
bool GetRawPartCenter( int nRawId, Point3d& ptCen) override ;
bool GetRawPartBBox( int nRawId, BBox3d& b3Raw) override ;
int SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId) override ;
// Parts
int GetPartInRawPartCount( int nRawId) const override ;
int GetFirstPartInRawPart( int nRawId) const override ;
int GetNextPartInRawPart( int nId) const override ;
bool AddPartToRawPart( int nPartId, const Point3d& ptPos, int nRawId) override ;
int GetRawPartFromPart( int nPartId) override ;
bool RemovePartFromRawPart( int nPartId) override ;
bool TranslatePartInRawPart( int nPartId, const Vector3d& vtMove) override ;
bool RotatePartInRawPart( int nPartId, const Vector3d& vtAx, double dAngRotDeg) override ;
// Tables and Fixtures
bool SetTable( const std::string& sTable) override ;
bool SetTableAreaOffset( double dOffsXP, double dOffsYP, double dOffsXM, double dOffsYM) override ;
bool GetTable( std::string& sTable) const override ;
bool GetTableRef( int nInd, Point3d& ptPos) const override ;
bool GetTableArea( int nInd, BBox3d& b3Area) const override ;
bool GetTableAreaOffset( int nInd, BBox3d& b3AreaOffs) const override ;
bool ChangeTable( const std::string& sTable, bool bUpdateDisp) override ;
bool ShowOnlyTable( bool bVal) override ;
bool MoveDispAxis( const std::string& sName, double dPos) override ;
bool RemoveDispAxis( const std::string& sName) override ;
bool KeepAllDispAxes( int nSouPhase) override ;
int AddFixture( const std::string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov) override ;
bool KeepFixture( int nFxtId, int nSouPhase) override ;
bool RemoveFixture( int nFxtId) override ;
bool VerifyFixture( int nFxtId) const override ;
int GetFirstFixture( void) const override ;
int GetNextFixture( int nFxtId) const override ;
bool MoveFixture( int nId, const Vector3d& vtMove) override ;
bool RotateFixture( int nId, double dDeltaAngDeg) override ;
bool SetFixtureLink( int nId, const std::string& sTaLink) override ;
bool MoveFixtureMobile( int nId, double dDeltaMov) override ;
bool SetFixtureMobile( int nId, double dMov) override ;
// Tools DataBase
bool TdbGetToolNewName( std::string& sName) const override ;
bool TdbAddTool( const std::string& sName, int nType) override ;
bool TdbCopyTool( const std::string& sSource, const std::string& sName) override ;
bool TdbRemoveTool( const std::string& sName) override ;
bool TdbGetFirstTool( int nFamily, std::string& sName, int& nType) const override ;
bool TdbGetNextTool( int nFamily, std::string& sName, int& nType) const override ;
bool TdbGetToolFromUUID( const std::string& sTuuid, std::string& sName) const override ;
bool TdbSetCurrTool( const std::string& sName) override ;
bool TdbSaveCurrTool( void) override ;
bool TdbIsCurrToolModified( void) const override ;
bool TdbSetCurrToolParam( int nType, bool bVal) override ;
bool TdbSetCurrToolParam( int nType, int nVal) override ;
bool TdbSetCurrToolParam( int nType, double dVal) override ;
bool TdbSetCurrToolParam( int nType, const std::string& sVal) override ;
bool TdbSetCurrToolValInNotes( int nType, const std::string& sKey, bool bVal) override ;
bool TdbSetCurrToolValInNotes( int nType, const std::string& sKey, int nVal) override ;
bool TdbSetCurrToolValInNotes( int nType, const std::string& sKey, double dVal) override ;
bool TdbSetCurrToolValInNotes( int nType, const std::string& sKey, const std::string& sVal) override ;
bool TdbRemoveCurrToolValInNotes( int nType, const std::string& sKey) override ;
bool TdbGetCurrToolParam( int nType, bool& bVal) const override ;
bool TdbGetCurrToolParam( int nType, int& nVal) const override ;
bool TdbGetCurrToolParam( int nType, double& dVal) const override ;
bool TdbGetCurrToolParam( int nType, std::string& sVal) const override ;
bool TdbGetCurrToolValInNotes( int nType, const std::string& sKey, bool& bVal) const override ;
bool TdbGetCurrToolValInNotes( int nType, const std::string& sKey, int& nVal) const override ;
bool TdbGetCurrToolValInNotes( int nType, const std::string& sKey, double& dVal) const override ;
bool TdbGetCurrToolValInNotes( int nType, const std::string& sKey, std::string& sVal) const override ;
bool TdbGetCurrToolMaxDepth( double& dMaxDepth) const override ;
bool TdbGetCurrToolThDiam( double& dThDiam) const override ;
bool TdbGetCurrToolThLength( double& dThLen) const override ;
int TdbCurrToolDraw( int nGenCtx, int nToolCtx) const override ;
bool TdbReload( void) override ;
bool TdbSave( void) const override ;
bool TdbGetToolDir( std::string& sToolDir) const override ;
bool TdbGetToolHolderDir( std::string& sTHolderDir) const override ;
bool TdbExport( const STRVECTOR& vsToolsNames, const std::string& sOutFile) const override ;
bool TdbToBeImported( const std::string& sFile, STRVECTOR& vsToolNames, INTVECTOR& vToolsTypes) const override;
bool TdbImport( const std::string& sFile, const STRVECTOR& vsToolsToImport, const STRVECTOR& vsToolsNames, STRVECTOR& vsImported) override ;
// Setup
int GetCurrSetup( void) const override ;
bool GetDefaultSetupName( std::string& sName) const override ;
bool ImportSetup( const std::string& sName) override ;
bool ExistsCurrSetup( void) const override ;
bool VerifyCurrSetup( STRVECTOR& vsErrors) override ;
bool FindToolInCurrSetup( const std::string& sTool) const override ;
bool GetToolSetupPosInCurrSetup( const std::string& sTool, std::string& sTcPos) const override ;
bool GetToolsInCurrSetupPos( const std::string& sTcPos, STRVECTOR& vsTools) const override ;
bool UpdateCurrSetup( void) override ;
bool EraseCurrSetup( void) override ;
// Machinings DataBase
bool MdbGetMachiningNewName( std::string& sName) const override ;
bool MdbAddMachining( const std::string& sName, int nType) override ;
bool MdbCopyMachining( const std::string& sSource, const std::string& sName) override ;
bool MdbRemoveMachining( const std::string& sName) override ;
bool MdbGetFirstMachining( int nType, std::string& sName) const override ;
bool MdbGetNextMachining( int nType, std::string& sName) const override ;
bool MdbGetMachiningFromUUID( const std::string& sMuuid, std::string& sName) const override ;
bool MdbSetCurrMachining( const std::string& sName) override ;
bool MdbSaveCurrMachining( void) override ;
bool MdbIsCurrMachiningModified( void) const override ;
bool MdbSetCurrMachiningParam( int nType, bool bVal) override ;
bool MdbSetCurrMachiningParam( int nType, int nVal) override ;
bool MdbSetCurrMachiningParam( int nType, double dVal) override ;
bool MdbSetCurrMachiningParam( int nType, const std::string& sVal) override ;
bool MdbGetCurrMachiningParam( int nType, bool& bVal) const override ;
bool MdbGetCurrMachiningParam( int nType, int& nVal) const override ;
bool MdbGetCurrMachiningParam( int nType, double& dVal) const override ;
bool MdbGetCurrMachiningParam( int nType, std::string& sVal) const override ;
bool MdbSetGeneralParam( int nType, bool bVal) override ;
bool MdbSetGeneralParam( int nType, int nVal) override ;
bool MdbSetGeneralParam( int nType, double dVal) override ;
bool MdbGetGeneralParam( int nType, bool& bVal) const override ;
bool MdbGetGeneralParam( int nType, int& nVal) const override ;
bool MdbGetGeneralParam( int nType, double& dVal) const override ;
bool MdbReload( void) override ;
bool MdbSave( void) const override ;
bool MdbGetMachiningDir( std::string& sMchDir) const override ;
bool MdbExport( const STRVECTOR& vsMachiningsNames, const std::string& sOutFile) const override ;
bool MdbToBeImported( const std::string& sFile, STRVECTOR& vsMachiningsNames, INTVECTOR& vMachiningsTypes) const override ;
bool MdbImport( const std::string& sFile, const STRVECTOR& vsMachiningsToImport, const STRVECTOR& vsMachiningsNames,
STRVECTOR& vsImported) override ;
// Operations : general
int GetOperationCount( void) const override ;
int GetFirstOperation( void) const override ;
int GetNextOperation( int nId) const override ;
int GetLastOperation( void) const override ;
int GetPrevOperation( int nId) const override ;
int GetFirstActiveOperation( bool bNeedMachNotEmpty = false) const override ;
int GetNextActiveOperation( int nId, bool bNeedMachNotEmpty = false) const override ;
int GetLastActiveOperation( bool bNeedMachNotEmpty = false) const override ;
int GetPrevActiveOperation( int nId, bool bNeedMachNotEmpty = false) const override ;
int GetOperationType( int nId) const override ;
int GetOperationPhase( int nId) const override ;
bool SetOperationName( int nId, const std::string& sName) override ;
std::string GetOperationName( int nId) const override ;
int GetOperationId( const std::string& sName) const override ;
bool IsOperationEmpty( int nId, int nEmptyType = 0) const override ;
bool RemoveOperation( int nId) override ;
bool RemoveAllPhaseOperations( int nPhase) override ;
bool RemoveAllOperations( void) override ;
bool SetOperationMode( int nId, bool bActive) override ;
bool GetOperationMode( int nId, bool& bActive) const override ;
bool SetAllOperationsMode( bool bExceptFirstDisp, bool bActive) override ;
bool SetOperationStatus( int nId, bool bShow) override ;
bool GetOperationStatus( int nId, bool& bShow) const override ;
bool SetAllOperationsStatus(bool bExceptFirstDisp, bool bShow) override ;
bool AdjustOperationPhase( int nMchId) override ;
bool ChangeOperationPhase( int nMchId, int nNewPhase) override ;
int GetPhaseLastOperation( int nPhase) const override ;
bool RemoveOperationHome( int nId) override ;
// Operations : dispositions
int GetPhaseDisposition( int nPhase) const override ;
bool DispositionSpecialApply( int nId, bool bRecalc) override ;
bool DispositionSpecialUpdate( int nId) override ;
bool GetDispositionToolData( int nId, std::string& sName, std::string& sHead, int& nExit, std::string& sTcPos) override ;
// Operations : machinings
int AddMachining( const std::string& sName, const std::string& sMachining) override ;
int AddMachining( const std::string& sName, int nMchType, const std::string& sTool) override ;
int CopyMachining( const std::string& sName, const std::string& sSouName) override ;
bool SetCurrMachining( int nId) override ;
bool ResetCurrMachining( void) override ;
int GetCurrMachining( void) const override ;
bool SetMachiningParam( int nType, bool bVal, bool* pbChanged = nullptr) override ;
bool SetMachiningParam( int nType, int nVal, bool* pbChanged = nullptr) override ;
bool SetMachiningParam( int nType, double dVal, bool* pbChanged = nullptr) override ;
bool SetMachiningParam( int nType, const std::string& sVal, bool* pbChanged = nullptr) override ;
bool SetMachiningGeometry( const SELVECTOR& vIds) override ;
bool MachiningPreview( bool bRecalc) override ;
bool ExistsMachiningPreview( void) override ;
bool RemoveMachiningPreview( void) override ;
bool MachiningApply( bool bRecalc, bool bPostApply = true) override ;
bool MachiningUpdate( bool bPostApply = true) override ;
bool ChangePreviewMachiningToolShow( int nLookFlag) override ;
bool PreparePreviewMachiningTool( void) const override ;
bool RemovePreviewMachiningTool( void) const override ;
int GetPreviewMachiningToolStepCount( void) const override ;
int PreviewMachiningTool( int nEntId, int nStep) const override ;
bool GetMachiningParam( int nType, bool& bVal) const override ;
bool GetMachiningParam( int nType, int& nVal) const override ;
bool GetMachiningParam( int nType, double& dVal) const override ;
bool GetMachiningParam( int nType, std::string& sVal) const override ;
bool GetMachiningGeometry( SELVECTOR& vIds) const override ;
bool GetMachiningSkippedGeometry( SELVECTOR& vIds) const override ;
bool IsMachiningEmpty( int nEmptyType = 0) const override ;
bool GetMachiningStartPoint( Point3d& ptStart) const override ;
bool GetMachiningEndPoint( Point3d& ptEnd) const override ;
bool GetMachiningStartAxes( bool bSkipClimb, DBLVECTOR& vAxVal) const override ;
bool GetMachiningEndAxes( bool bSkipRise, DBLVECTOR& vAxVal) const override ;
// CL Entities Interrogations
bool GetClEntMove( int nEntId, int& nMove) const override ;
bool GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const override ;
bool GetClEntIndex( int nEntId, int& nIndex) const override ;
bool GetClEntFeed( int nEntId, double& dFeed) const override ;
bool GetClEntAxesStatus( int nEntId, int& nStatus) const override ;
bool GetClEntAxesMask( int nEntId, int& nMask) const override ;
bool GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const override ;
bool GetClEntTDir( int nEntId, Vector3d& vtTDir) const override ;
bool GetClEntCDir( int nEntId, Vector3d& vtCDir) const override ;
bool GetClEntADir( int nEntId, Vector3d& vtADir) const override ;
// Simulation
bool SimInit( void) override ;
bool SimStart( bool bFirst) override ;
bool SimMove( int& nStatus) override ;
bool SimGetAxisInfoPos( int nI, std::string& sName, std::string& sToken, bool& bLinear, double& dVal) const override ;
bool SimGetToolInfo( std::string& sName, double& dSpeed) const override ;
bool SimGetOperationInfo( std::string& sName, int& nType) const override ;
bool SimGetMoveInfo( int& nGmove, double& dFeed) const override ;
bool SimSetStep( double dStep) override ;
bool SimSetUiStatus( int nUiStatus) override ;
bool SimEnableToolTipTrace( bool bEnable) override ;
bool SimGoHome( void) override ;
bool SimExit( void) override ;
// Generation
bool Generate( const std::string& sCncFile, const std::string& sInfo) override ;
bool Estimate( const std::string& sEstFile, const std::string& sInfo) override ;
// Machine Calc
bool SetCalcTable( const std::string& sTable) override ;
bool SetCalcTool( const std::string& sTool, const std::string& sHead, int nExit) override ;
bool SetCalcSolCh( int nScc, bool bExact) override ;
bool SetRotAxisBlock( const std::string& sAxis, double dVal) override ;
bool GetCalcTable( std::string& sTable) const override ;
bool GetCalcTool( std::string& sTool) const override ;
bool GetCalcHead( std::string& sHead) const override ;
bool GetCalcExit( int& nExit) const override ;
bool GetCalcSolCh( int& nScc, bool& bExact) const override ;
bool GetAllCurrAxesNames( STRVECTOR& vAxName) const override ;
bool GetRotAxisBlocked( int nInd, std::string& sAxis, double& dVal) const override ;
bool GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const override ;
bool GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const override ;
bool GetCalcPositions( const Point3d& ptP, double dAngA, double dAngB,
double& dX, double& dY, double& dZ) const override ;
bool GetCalcPositions( const Point3d& ptP, const DBLVECTOR& vAng,
double& dX, double& dY, double& dZ) const override ;
bool GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const override ;
bool GetCalcTipFromPositions( double dX, double dY, double dZ, double dAngA, double dAngB,
bool bOverall, bool bBottom, Point3d& ptTip) const override ;
bool GetCalcTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
bool bOverall, bool bBottom, Point3d& ptTip) const override ;
bool GetCalcToolDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const override ;
bool GetCalcAuxDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const override ;
bool GetNearestAngleInStroke( int nInd, double dAngRef, double& dAng) const override ;
bool LimitAngleToStroke( int nInd, double& dAng) const override ;
bool VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) const override ;
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const override ;
std::string GetOutstrokeInfo( bool bMM = true) const override ;
// Machine
int GetBaseId( const std::string& sBase) const override ;
int GetTableId( const std::string& sTable) const override ;
int GetAxisId( const std::string& sAxis) const override ;
int GetHeadId( const std::string& sHead) const override ;
int GetHeadExitCount( const std::string& sHead) const override ;
int GetExitId( const std::string& sHead, int nExit) const override ;
int GetTcPosId( const std::string& sTcPos) const override ;
bool GetAxisToken( const std::string& sAxis, std::string& sToken) const override ;
bool GetAxisType( const std::string& sAxis, bool& bLinear) const override ;
bool GetAxisDir( const std::string& sAxis, Vector3d& vtDir) const override ;
bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const override ;
bool GetAxisOffset( const std::string& sAxis, double& dOffset) const override ;
bool SetAxisPos( const std::string& sAxis, double dVal, double* pdNewVal = nullptr) override ;
bool GetAxisPos( const std::string& sAxis, double& dVal) const override ;
bool GetAxisMin( const std::string& sAxis, double& dMin) const override ;
bool GetAxisMax( const std::string& sAxis, double& dMaxn) const override ;
bool GetAxisHomePos( const std::string& sAxis, double& dHomeVal) const override ;
bool ResetAxisPos( const std::string& sAxis) override ;
bool ResetAllAxesPos( void) override ;
bool GetAllTablesNames( STRVECTOR& vNames) const override ;
bool GetAllAxesNames( STRVECTOR& vNames) const override ;
bool GetAllHeadsNames( STRVECTOR& vNames) const override ;
bool GetAllTcPosNames( STRVECTOR& vNames) const override ;
bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) override ;
bool GetLoadedTool( const std::string& sHead, int nExit, std::string& sTool) const override ;
bool UnloadTool( const std::string& sHead, int nExit) override ;
bool ResetHeadSet( const std::string& sHead) override ;
bool SetMachineLook( int nFlag) override ;
int GetMachineLook( void) const override ;
public :
MachMgr( void) ;
// Basic
int GetContextId( void) const
{ return m_nContextId ; }
IGeomDB* GetGeomDB( void) const
{ return m_pGeomDB ; }
int GetMachBaseId( void) const
{ return m_nMachBaseId ; }
int GetMachAuxId( void) const
{ return m_nMachAuxId ; }
std::string GetLuaLibsDir( void) const
{ return m_sLuaLibsDir ; }
std::string GetLuaLastRequire( void) const
{ return m_sLuaLastRequire ; }
bool SetLastError( int nErr, const std::string& sErr) ;
void ResetLastError( void)
{ m_nLastError = 0 ; m_sLastError.clear() ; }
bool SetWarning( int nWarn, const std::string& sWarn) ;
void ResetWarnings( void)
{ m_Warnings.clear() ; }
// Current Machine
std::string GetCurrSetupDir( void) const
{ Machine* pMch = GetCurrMachine() ;
return ( pMch != nullptr ? pMch->GetMachineDir() + "\\" + SETUP_DIR : "") ; }
std::string GetCurrFixtDir( void) const
{ Machine* pMch = GetCurrMachine() ;
return ( pMch != nullptr ? pMch->GetMachineDir() + "\\" + FIXTURES_DIR : "") ; }
// MachGroups
std::string GetCurrMGeoName( void) const
{ return ( ExistsCurrMachGroup() ? m_cCurrMGrp.MGeoName : "") ; }
int GetCurrSetupGroupId( void) const
{ return ( ExistsCurrMachGroup() ? m_cCurrMGrp.SetupGroupId : GDB_ID_NULL) ; }
int GetCurrFixtGroupId( void) const
{ return ( ExistsCurrMachGroup() ? m_cCurrMGrp.FixtGroupId : GDB_ID_NULL) ; }
int GetCurrRawGroupId( void) const
{ return ( ExistsCurrMachGroup() ? m_cCurrMGrp.RawGroupId : GDB_ID_NULL) ; }
int GetCurrOperId( void) const
{ return ( ExistsCurrMachGroup() ? m_cCurrMGrp.OperGroupId : GDB_ID_NULL) ; }
// RawParts
bool VerifyRawPart( int nRawId, bool bLinkedAllowed = true) const ;
bool GetRawPartPhases( int nRawId, INTVECTOR& vPhase) const ;
// Tables and Fixtures
bool VerifyFixtureInGroup( int nFxtId, bool bLinkedAllowed = true) const ;
bool GetFixturePhases( int nFxtId, INTVECTOR& vPhase) const ;
int GetUnusedFixture( const std::string& sName, int nPhase) const ;
bool IsUnusedFixture( int nId, int nPhase) const ;
// Setup
SetupMgr& GetCurrSetupMgr( void) const
{ return const_cast<SetupMgr&>( m_stuMgr) ; }
// Machines
bool IsCurrMachineLoaded( void) const ;
Machine* GetCurrMachine( void) const ;
ToolsMgr* GetCurrToolsMgr( void) const ;
MachiningsMgr* GetCurrMachiningsMgr( void) const ;
// MachineCalc
int GetCurrLinAxes( void) const ;
int GetCurrRotAxes( void) const ;
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
bool GetCurrAxisHomePos( int nInd, double& dHome) const ;
bool GetCurrAxisMax( int nInd, double& dHome) const ;
bool GetCurrAxisMin( int nInd, double& dHome) const ;
const Frame3d& GetCurrLinAxesFrame( void) const ;
bool GetCurrIsMcent( void) const ;
bool GetCurrIsRobot( void) const ;
bool ApplyRotAxisBlock( void) ;
void ClearRotAxisBlock( void)
{ m_vAxisBlock.clear() ; }
bool IsKinematicRotAxisBlocked( int nInd) const ;
int GetCalcTool( void) const ;
int GetCalcHead( void) const ;
int GetCalcExit( void) const ;
double GetCalcRot1W( void) const ;
bool GetCalcMaxDeltaR2OnFirst( void) const ;
bool GetCalcPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const ;
bool VerifyAngleOutstroke( int nInd, double dAng) const ;
bool ExistProtectedAreas( void) const ;
// Operations
bool GetOperationNewName( std::string& sName) const ;
const ToolData* GetMachiningToolData( void) const ;
// Simulation
bool SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
bool SimRemoveCollisionObj( int nFrameId) ;
bool SimGetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) const ;
bool SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
bool SimOnCollision( int nCdInd, int nObjInd, int& nErr) ;
bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) ;
bool SimEnableToolsForVmill( bool bEnable) ;
int SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ;
bool SimSaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) ;
// Machine
bool ResetAllAxesPos( bool bStdAxes, bool bDispAxes) ;
bool IsDispositionAxis( const std::string& sAxis, const std::string& sTable = "") const ;
bool GetHeadAbove( const std::string& sHead) const ;
double GetAngDeltaMinForHome( void) const ;
private :
// Basic
void Clear( void) ;
int FindMachBase( int nGroupId) const ;
bool VerifyMachBase( void) const ;
bool CreateMachBase( void) ;
bool IsMachAux( int nId) const ;
bool VerifyMachAux( void) const ;
bool CreateMachAux( void) ;
// MachGroups
bool PrepareCurrMachGroup( int nId) ;
bool VerifyMachGroup( int nId, MachGrp& mgData) const ;
bool ExistsCurrMachGroup( void) const
{ return ( m_pGeomDB != nullptr && m_nCurrMGrpId != GDB_ID_NULL) ; }
// Machines
bool LoadMachine( const std::string& sMachineName) ;
int GetMachine( const std::string& sMachineName) const ;
int GetCurrMachineId( void) const ;
// Phases
bool PrepareCurrPhase( int nPhase, bool bDoDisp, bool bForced) ;
int CalcPhaseCount( void) const ;
// RawParts
int AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol) ;
int AddRawPart( int nSurfId, Color cCol) ;
int AddRawPart( int nSurfUpId, int nSurfDownId, double dHeight, Color cCol) ;
bool SetRawPartCenter( int nRawId) ;
bool ResetRawPartCenter( int nRawId) ;
// Parts
bool SwapParts( bool bToRawPart) ;
bool SwapRawPartParts( int nRawId, bool bToRawPart) ;
int SwapRawPartPart( int nId, bool bToRawPart) ;
bool UpdateStatusMgoLayers( int nPartId, bool bToRawPart) ;
bool ShowRootParts( bool bShow) ;
// Tools DataBase
bool UpdateAllToolDraws( void) const ;
bool UpdateToolDraw( const EgtUUID& UuidTool, double& dTHoldBase, double& dTHoldLen, double& dTHoldDiam) const ;
int UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx, bool bToSave) const ;
int UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx, bool bToSave) const ;
std::string GetToolMakerKeyFromType( int nType) const ;
std::string GetToolHolderPath( const std::string& sHeadName, int nExit, int nType, const std::string& sUserNotes) const ;
// Operations : general
bool InitOperation( int nId) ;
// Operations : dispositions
int AddDisposition( const std::string& sName) ;
private :
typedef std::vector<MachineData> MCHDATAVECTOR ;
typedef std::vector<AxisBlock> AXBLOCKVECTOR ;
private :
int m_nContextId ; // indice contesto corrente (1-based)
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico del contesto corrente
STRVECTOR m_vMachinesBaseDir ; // direttori di base delle macchine (ordine molto importante)
std::string m_sToolMakersDir ; // direttorio dei generatori di disegni utensili standard
std::string m_sLuaLibsDir ; // direttorio delle librerie lua
std::string m_sLuaLastRequire ; // nome ultima libreria caricata
int m_nLastError ; // identificativo ultimo errore
std::string m_sLastError ; // descrittivo ultimo errore
INTSTRVECTOR m_Warnings ; // identificativi e descrittivi avvisi
int m_nMachBaseId ; // identificativo gruppo base per le macchinate
int m_nMachAuxId ; // identificativo gruppo base per le macchine
int m_nCurrMGrpId ; // identificativo macchinata corrente
MachGrp m_cCurrMGrp ; // dati principali macchinata corrente
int m_nCurrMch ; // indice macchina corrente (0-based)
MCHDATAVECTOR m_vMachines ; // elenco macchine caricate
SetupMgr m_stuMgr ; // gestore attrezzaggio macchinata corrente
int m_nPhasesCount ; // numero fasi di lavorazione della macchinata corrente
int m_nCurrPhase ; // indice fase corrente (1-based)
int m_nCurrDispId ; // identificativo della disposizione corrente
int m_nCurrMachiningId ; // identificativo della lavorazione corrente
AXBLOCKVECTOR m_vAxisBlock ; // elenco assi da bloccare
ISimulator* m_pSimul ; // puntatore al simulatore attivo
} ;