EgtMachKernel 2.3d2 :
- aggiunta gestione Dist e StemDiam in utensili - aggiunta funzione EmtModifyExitPosition - aggiunta gestione Dist a OnSetHead e aggiornamento posizione uscita.
This commit is contained in:
Binary file not shown.
@@ -13,6 +13,7 @@
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "DllMain.h"
|
||||
#include "Exit.h"
|
||||
#include "MachConst.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
@@ -110,6 +111,22 @@ Exit::Set( const string& sName, const Point3d& ptPos, const Vector3d& vtTDir)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Exit::Modify( const Point3d& ptPos, double dExitMaxAdjust)
|
||||
{
|
||||
// Verifico che lo spostamento non superi il massimo ammesso
|
||||
Vector3d vtDelta = ptPos - m_ptPos ;
|
||||
if ( vtDelta.Len() > dExitMaxAdjust) {
|
||||
string sOut = " Modify Exit " + m_sName + " Position (" + ToString( ptPos) + ") failed" ;
|
||||
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
|
||||
return false ;
|
||||
}
|
||||
// Assegno la nuova posizione
|
||||
m_ptPos = ptPos ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Exit::SetTool( const string& sTool)
|
||||
|
||||
@@ -31,6 +31,7 @@ class Exit : public IUserObj
|
||||
public :
|
||||
Exit( void) ;
|
||||
bool Set( const std::string& sName, const Point3d& ptPos, const Vector3d& vtTDir) ;
|
||||
bool Modify( const Point3d& ptPos, double dExitMaxAdjust) ;
|
||||
bool SetTool( const std::string& sTool) ;
|
||||
const std::string& GetName( void) { return m_sName ; }
|
||||
const Point3d& GetPos( void) { return m_ptPos ; }
|
||||
|
||||
+21
@@ -935,6 +935,27 @@ Machine::CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::ModifyMachineExitPosition( const string& sHead, int nExit, const Point3d& ptPos)
|
||||
{
|
||||
// controllo GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero testa
|
||||
int nHeadId = GetGroup( sHead) ;
|
||||
Head* pHead = GetHead( nHeadId) ;
|
||||
if ( pHead == nullptr)
|
||||
return false ;
|
||||
// recupero uscita
|
||||
int nExitId = m_pGeomDB->GetFirstNameInGroup( nHeadId, MCH_EXIT + ToString( nExit)) ;
|
||||
Exit* pExit = GetExit( nExitId) ;
|
||||
if ( pExit == nullptr)
|
||||
return false ;
|
||||
// eseguo la modifica
|
||||
return pExit->Modify( ptPos, m_dExitMaxAdjust) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::SetLook( int nFlag)
|
||||
|
||||
@@ -232,6 +232,7 @@ class Machine
|
||||
bool LoadTool( Exit* pExit, const std::string& sTool) ;
|
||||
bool AdjustExitFrames( int nLay, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir) ;
|
||||
bool CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit) ;
|
||||
bool ModifyMachineExitPosition( const std::string& sHead, int nExit, const Point3d& ptPos) ;
|
||||
bool CalculateKinematicChain( void) ;
|
||||
bool AddKinematicAxis( bool bOnHead, int nId) ;
|
||||
bool GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
@@ -309,6 +310,7 @@ class Machine
|
||||
static int LuaEmtModifyAxisDirection( lua_State* L) ;
|
||||
static int LuaEmtModifyAxisStroke( lua_State* L) ;
|
||||
static int LuaEmtModifyAxisHome( lua_State* L) ;
|
||||
static int LuaEmtModifyExitPosition( lua_State* L) ;
|
||||
static int LuaEmtAddRapidStart( lua_State* L) ;
|
||||
static int LuaEmtAddRapidMove( lua_State* L) ;
|
||||
static int LuaEmtAddLinearMove( lua_State* L) ;
|
||||
|
||||
+24
-15
@@ -29,21 +29,23 @@ using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
|
||||
static const string EVAR_TABNAME = ".TABNAME" ; // (string) nome della tavola macchina
|
||||
static const string EVAR_HEAD = ".HEAD" ; // (string) nome della testa
|
||||
static const string EVAR_EXIT = ".EXIT" ; // (int) numero dell'uscita
|
||||
static const string EVAR_TOOL = ".TOOL" ; // (string) nome dell'utensile
|
||||
static const string EVAR_TOTDIAM = ".TOTDIAM" ; // (num) diametro di ingombro dell'utensile
|
||||
static const string EVAR_TOTLEN = ".TOTLEN" ; // (num) lunghezza di ingombro dell'utensile
|
||||
static const string EVAR_L1 = ".L1" ; // (num) valore del primo asse lineare
|
||||
static const string EVAR_L2 = ".L2" ; // (num) valore del secondo asse lineare
|
||||
static const string EVAR_L3 = ".L3" ; // (num) valore del terzo asse lineare
|
||||
static const string EVAR_R1 = ".R1" ; // (num) valore del primo asse rotante
|
||||
static const string EVAR_R2 = ".R2" ; // (num) valore del secondo asse rotante
|
||||
static const string EVAR_R3 = ".R3" ; // (num) valore del terzo asse rotante
|
||||
static const string EVAR_R4 = ".R4" ; // (num) valore del quarto asse rotante
|
||||
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
|
||||
static const string EVAR_STAT = ".STAT" ; // OUT (int) codice di stato ( 0 = ok)
|
||||
static const string EVAR_TABNAME = ".TABNAME" ; // (string) nome della tavola macchina
|
||||
static const string EVAR_HEAD = ".HEAD" ; // (string) nome della testa
|
||||
static const string EVAR_EXIT = ".EXIT" ; // (int) numero dell'uscita
|
||||
static const string EVAR_TOOL = ".TOOL" ; // (string) nome dell'utensile
|
||||
static const string EVAR_TOTDIAM = ".TOTDIAM" ; // (num) diametro di ingombro dell'utensile
|
||||
static const string EVAR_TOTLEN = ".TOTLEN" ; // (num) lunghezza di ingombro dell'utensile
|
||||
static const string EVAR_DIST = ".DIST" ; // (num) distanza dell'utensile (per seghe a catena)
|
||||
static const string EVAR_EXITPOS = ".EXITPOS" ; // (point) posizione attuale dell'uscita
|
||||
static const string EVAR_L1 = ".L1" ; // (num) valore del primo asse lineare
|
||||
static const string EVAR_L2 = ".L2" ; // (num) valore del secondo asse lineare
|
||||
static const string EVAR_L3 = ".L3" ; // (num) valore del terzo asse lineare
|
||||
static const string EVAR_R1 = ".R1" ; // (num) valore del primo asse rotante
|
||||
static const string EVAR_R2 = ".R2" ; // (num) valore del secondo asse rotante
|
||||
static const string EVAR_R3 = ".R3" ; // (num) valore del terzo asse rotante
|
||||
static const string EVAR_R4 = ".R4" ; // (num) valore del quarto asse rotante
|
||||
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
|
||||
static const string EVAR_STAT = ".STAT" ; // OUT (int) codice di stato ( 0 = ok)
|
||||
static const string EVAR_AUXINFO = ".AUXINFO" ; // OUT (string) stringa con info ausiliarie
|
||||
static const string EMC_VAR_BACKUP = "QQQ_EMC" ; // nome del backup della tabella sopra indicata
|
||||
static const string AXIS_NAME_PROTECTEDAREAS = "PRA" ;
|
||||
@@ -226,6 +228,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
|
||||
double dTDiam = 0 ;
|
||||
double dTOvLen = 0 ;
|
||||
double dTOvDiam = 0 ;
|
||||
double dTDist = 0 ;
|
||||
// se definito
|
||||
if ( ! sTool.empty()) {
|
||||
// carico anche gli utensili su eventuali altre uscite della testa
|
||||
@@ -245,6 +248,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
|
||||
! m_pMchMgr->TdbGetCurrToolParam( TPA_TOTLEN, dTOvLen) ||
|
||||
! m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, dTOvDiam))
|
||||
return false ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_DIST, dTDist) ; // opzionale
|
||||
}
|
||||
// altrimenti casi speciali senza utensile
|
||||
else {
|
||||
@@ -256,6 +260,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
|
||||
dTDiam = 0 ;
|
||||
dTOvLen = 0 ;
|
||||
dTOvDiam = 0 ;
|
||||
dTDist = 0 ;
|
||||
m_pMchMgr->TdbSetCurrTool( "") ;
|
||||
}
|
||||
// assegno tutti i dati
|
||||
@@ -280,8 +285,10 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_HEAD, sHead) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_EXIT, nExit) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOOL, sTool) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_EXITPOS, m_ptCalcPos) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOTDIAM, dTOvDiam) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOTLEN, dTOvLen) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_DIST, dTDist) ;
|
||||
// chiamo funzione
|
||||
bOk = bOk && LuaCallFunction( ON_SET_HEAD) ;
|
||||
// reset variabili
|
||||
@@ -292,6 +299,8 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
|
||||
// in caso di errore esco
|
||||
if ( ! bOk)
|
||||
return false ;
|
||||
// aggiorno
|
||||
m_ptCalcPos = pExit->GetPos() ;
|
||||
}
|
||||
// determino la catena cinematica
|
||||
return CalculateKinematicChain() ;
|
||||
|
||||
@@ -93,6 +93,7 @@ Machine::LuaInit( const string& sMachineName)
|
||||
m_LuaMgr.RegisterFunction( "EmtModifyAxisDirection", Machine::LuaEmtModifyAxisDirection) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtModifyAxisStroke", Machine::LuaEmtModifyAxisStroke) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtModifyAxisHome", Machine::LuaEmtModifyAxisHome) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtModifyExitPosition", Machine::LuaEmtModifyExitPosition) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtLinkRawPartToGroup", Machine::LuaEmtLinkRawPartToGroup) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtUnlinkRawPartFromGroup", Machine::LuaEmtUnlinkRawPartFromGroup) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtUnlinkAllRawPartsFromGroups", Machine::LuaEmtUnlinkAllRawPartsFromGroups) ;
|
||||
@@ -900,6 +901,28 @@ Machine::LuaEmtModifyAxisHome( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtModifyExitPosition( lua_State* L)
|
||||
{
|
||||
// 3 parametri : sHead, nExit, ptPos
|
||||
string sHead ;
|
||||
LuaCheckParam( L, 1, sHead)
|
||||
int nExit ;
|
||||
LuaCheckParam( L, 2, nExit)
|
||||
Point3d ptPos ;
|
||||
LuaCheckParam( L, 3, ptPos)
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// modifico la posizione dell'uscita della testa
|
||||
bool bOk = m_pMchLua->ModifyMachineExitPosition( sHead, nExit, ptPos) ;
|
||||
// assegno risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtLinkRawPartToGroup( lua_State* L)
|
||||
|
||||
@@ -353,6 +353,10 @@ ToolData::SetParam( int nType, double dVal)
|
||||
case TPA_MINFEED :
|
||||
m_dMinFeed = dVal ;
|
||||
return true ;
|
||||
case TPA_DIST :
|
||||
return SetValInNotes( TSI_DIST, dVal, m_sSysNotes) ;
|
||||
case TPA_STEMDIAM :
|
||||
return SetValInNotes( TSI_STEM_DIAM, dVal, m_sSysNotes) ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
@@ -392,6 +396,7 @@ ToolData::GetParam( int nType, bool& bVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case TPA_ACTIVE :
|
||||
bVal = false ;
|
||||
return GetValInNotes( m_sSysNotes, TSI_ACTIVE, bVal) ;
|
||||
}
|
||||
bVal = false ;
|
||||
@@ -479,6 +484,12 @@ ToolData::GetParam( int nType, double& dVal) const
|
||||
case TPA_MINFEED :
|
||||
dVal = m_dMinFeed ;
|
||||
return true ;
|
||||
case TPA_DIST :
|
||||
dVal = 0 ;
|
||||
return GetValInNotes( m_sSysNotes, TSI_DIST, dVal) ;
|
||||
case TPA_STEMDIAM :
|
||||
dVal = 0 ;
|
||||
return GetValInNotes( m_sSysNotes, TSI_STEM_DIAM, dVal) ;
|
||||
}
|
||||
dVal = 0 ;
|
||||
return false ;
|
||||
|
||||
+1
-6
@@ -788,8 +788,6 @@ ToolsMgr::GetCurrToolThLength( double& dThLen) const
|
||||
return false ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ToolsMgr::Export( const STRVECTOR& vsToolsNames, const string& sOutFile, bool bCompressed)
|
||||
@@ -898,7 +896,6 @@ ToolsMgr::ExportOneTool( const string& sToolName, Writer& TheWriter, const int&
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ToolsMgr::ToBeImported( const string& sFile, STRVECTOR& vsToolsNames, INTVECTOR& vToolsTypes)
|
||||
@@ -951,7 +948,7 @@ ToolsMgr::ToBeImported( const string& sFile, STRVECTOR& vsToolsNames, INTVECTOR&
|
||||
else // se tool ha più types è errore, non potrà essere importato
|
||||
bAdd = false ;
|
||||
}
|
||||
if( ToUpper( sKey) == "NAME") {
|
||||
if ( ToUpper( sKey) == "NAME") {
|
||||
if ( ! bToolName){
|
||||
bToolName = true ;
|
||||
sName = sVal ;
|
||||
@@ -1086,7 +1083,6 @@ ToolsMgr::Import( const string& sFile, const STRVECTOR& vsToolsToImport, const S
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
bool
|
||||
ToolsMgr::ReadTool( Scanner& TheScanner, ToolData& tData, const int& nToolSize) const
|
||||
@@ -1124,7 +1120,6 @@ ToolsMgr::ReadTool( Scanner& TheScanner, ToolData& tData, const int& nToolSize)
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ToolsMgr::CopyToolDraw( const string& sDraw, const string& sOutDraw, const string& sToolName)
|
||||
|
||||
Reference in New Issue
Block a user