EgtMachKernel 2.7a4 :

- modifiche per aggiunta SetFixtureLink per collegamento tra bloccaggio ed asse tavola.
This commit is contained in:
Dario Sassi
2025-01-31 08:59:58 +01:00
parent 6613639f96
commit 333673005f
8 changed files with 67 additions and 12 deletions
+37 -4
View File
@@ -56,6 +56,7 @@ static string DIS_FXD_NAME = "FxN" ;
static string DIS_FXD_POS = "FxP" ;
static string DIS_FXD_ANG = "FxA" ;
static string DIS_FXD_MOV = "FxM" ;
static string DIS_FXD_LINK = "FxL" ;
static string DIS_MVD_TOT = "MvT" ;
static string DIS_MVD_ID = "MvI" ;
static string DIS_MVD_TYPE = "MvT" ;
@@ -135,7 +136,8 @@ Disposition::Dump( string& sOut, bool bMM, const char* szNewLine) const
ToString( FixData.nId) + ",(" +
ToString( FixData.ptPos) + ")," +
ToString( FixData.dAng) + "," +
ToString( FixData.dMov) + szNewLine ;
ToString( FixData.dMov) + "," +
( IsEmptyOrSpaces( FixData.sTaLink) ? "__" : FixData.sTaLink) + szNewLine ;
}
for ( const auto& MvrData : m_vMvrData) {
sOut += "MvD=" + ToString( MvrData.nRawId) + "," ;
@@ -172,7 +174,7 @@ Disposition::Save( int nBaseId, STRVECTOR& vString) const
int nAxdTot = int( m_vAxData.size()) ;
int nAxdLines = ( nAxdTot == 0 ? 0 : 1 + 2 * nAxdTot) ;
int nFxdTot = int( m_vFixData.size()) ;
int nFxdLines = 1 + 4 * nFxdTot ;
int nFxdLines = 1 + 5 * nFxdTot ;
int nMvdTot = int( m_vMvrData.size()) ;
int nMvdLines = 1 + 4 * nMvdTot ;
int nOther = 7 ;
@@ -206,7 +208,8 @@ Disposition::Save( int nBaseId, STRVECTOR& vString) const
if ( ! SetVal( DIS_FXD_NAME, FixData.sName, vString[++k]) ||
! SetVal( DIS_FXD_POS, FixData.ptPos, vString[++k]) ||
! SetVal( DIS_FXD_ANG, FixData.dAng, vString[++k]) ||
! SetVal( DIS_FXD_MOV, FixData.dMov, vString[++k]))
! SetVal( DIS_FXD_MOV, FixData.dMov, vString[++k]) ||
! SetVal( DIS_FXD_LINK, FixData.sTaLink, vString[++k]))
return false ;
}
// Dati posizionamento grezzi
@@ -293,6 +296,10 @@ Disposition::Load( const STRVECTOR& vString, int nBaseGdbId)
if ( ! GetVal( vString[++k], DIS_FXD_MOV, FixData.dMov))
-- k ;
}
if ( k + 1 < int( vString.size())) {
if ( ! GetVal( vString[++k], DIS_FXD_LINK, FixData.sTaLink))
-- k ;
}
}
// dati posizionamento grezzi
int nMvdTot ;
@@ -850,6 +857,31 @@ Disposition::RotateFixture( int nId, double dDeltaAngDeg)
return true ;
}
//----------------------------------------------------------------------------
bool
Disposition::SetFixtureLink( int nId, const string& sTaLink)
{
// verifica validità sottopezzo
if ( m_pMchMgr == nullptr || ! m_pMchMgr->VerifyFixtureInGroup( nId, false))
return false ;
// verifico aggiornamento tavola
if ( ! m_bTabOk && ! SetTable( m_sTabName))
return false ;
// verifico ch eil link sia un asse di disposizione (ovvero dipendente dalla tavola)
if ( ! m_pMchMgr->IsDispositionAxis( sTaLink, m_sTabName))
return false ;
// aggiorno la posizione dell'oggetto nel vettore dei comandi
for ( auto& FixData : m_vFixData) {
if ( FixData.nId == nId) {
FixData.sTaLink = sTaLink ;
break ;
}
}
// imposto stato a modificato
m_nStatus |= MCH_ST_PARAM_MODIF ;
return true ;
}
//----------------------------------------------------------------------------
bool
Disposition::MoveFixtureMobile( int nId, double dDeltaMov)
@@ -1437,7 +1469,7 @@ Disposition::GetMoveAxisData( int nInd, string& sName, double& dPos) const
//----------------------------------------------------------------------------
bool
Disposition::GetFixtureData( int nInd, string& sName, int& nId, Point3d& ptPos,
double& dAngDeg, double& dMov) const
double& dAngDeg, double& dMov, string& sTaLink) const
{
// verifico MachMgr e GeomDB
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
@@ -1451,6 +1483,7 @@ Disposition::GetFixtureData( int nInd, string& sName, int& nId, Point3d& ptPos,
ptPos = m_vFixData[nInd].ptPos ;
dAngDeg = m_vFixData[nInd].dAng ;
dMov = m_vFixData[nInd].dMov ;
sTaLink = m_vFixData[nInd].sTaLink ;
return true ;
}
+4 -2
View File
@@ -35,8 +35,9 @@ struct FixtureData
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) {}
: 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) {}
} ;
@@ -108,6 +109,7 @@ class Disposition : public Operation
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) ;
@@ -121,7 +123,7 @@ class Disposition : public Operation
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) const ;
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) ;
BIN
View File
Binary file not shown.
+1
View File
@@ -168,6 +168,7 @@ class MachMgr : public IMachMgr
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
+15 -2
View File
@@ -213,10 +213,11 @@ MachMgr::KeepFixture( int nFxtId, int nSouPhase)
if ( pSouDisp == nullptr || pDisp == nullptr)
return false ;
for ( int i = 0 ; ; ++ i) {
string sName ; int nId ; Point3d ptPos ; double dAngDeg ; double dMov ;
if ( pSouDisp->GetFixtureData( i, sName, nId, ptPos, dAngDeg, dMov)) {
string sName ; int nId ; Point3d ptPos ; double dAngDeg ; double dMov ; string sTaLink ;
if ( pSouDisp->GetFixtureData( i, sName, nId, ptPos, dAngDeg, dMov, sTaLink)) {
if ( nId == nFxtId) {
pDisp->AddFixture( sName, nId, ptPos, dAngDeg, dMov) ;
pDisp->SetFixtureLink( nId, sTaLink) ;
break ;
}
}
@@ -300,6 +301,18 @@ MachMgr::RotateFixture( int nId, double dDeltaAngDeg)
return pDisp->RotateFixture( nId, dDeltaAngDeg) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SetFixtureLink( int nId, const string& sTaLink)
{
// recupero l'oggetto disposizione corrente
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
if ( pDisp == nullptr)
return false ;
// eseguo l'operazione
return pDisp->SetFixtureLink( nId, sTaLink) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::MoveFixtureMobile( int nId, double dDeltaMov)
+1
View File
@@ -55,6 +55,7 @@ static const std::string GVAR_FIXNAME = ".FIXNAME" ; // (string) nome bloc
static const std::string GVAR_FIXPOS = ".FIXPOS" ; // (Point3d) posizione bloccaggio
static const std::string GVAR_FIXANG = ".FIXANG" ; // (num) angolo di rotazione bloccaggio
static const std::string GVAR_FIXMOB = ".FIXMOB" ; // (num) movimento eventuale parte mobile del bloccaggio
static const std::string GVAR_FIXTAL = ".FIXTAL" ; // (string) nome dell'asse di tavola a cui è fissato
static const std::string GVAR_RAWID = ".RAWID" ; // (int) identificativo grezzo
static const std::string GVAR_RAWIND = ".RAWIND" ; // (int) indice movimento del grezzo
static const std::string GVAR_RAWTYPE = ".RAWTYPE" ; // (int) tipo di movimento del grezzo
+8 -3
View File
@@ -263,8 +263,9 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
Point3d ptPos ;
double dAngDeg ;
double dMov ;
if ( pDisp->GetFixtureData( i, sName, nId, ptPos, dAngDeg, dMov)) {
if ( ! OnFixtureData( nId, i + 1, sName, ptPos, dAngDeg, dMov))
string sTaLink ;
if ( pDisp->GetFixtureData( i, sName, nId, ptPos, dAngDeg, dMov, sTaLink)) {
if ( ! OnFixtureData( nId, i + 1, sName, ptPos, dAngDeg, dMov, sTaLink))
return false ;
}
else
@@ -856,7 +857,7 @@ Processor::OnTableAxisData( int nAxisInd, const string& sName, double dPos, bool
//----------------------------------------------------------------------------
bool
Processor::OnFixtureData( int nFixId, int nFixInd, const string& sName, const Point3d& ptPos,
double dAngDeg, double dMov)
double dAngDeg, double dMov, const string& sTaLink)
{
// assegno dati bloccaggio
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXID, nFixId) ;
@@ -865,6 +866,10 @@ Processor::OnFixtureData( int nFixId, int nFixInd, const string& sName, const Po
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXPOS, ptPos) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXANG, dAngDeg) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXMOB, dMov) ;
if ( ! IsEmptyOrSpaces( sTaLink))
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXTAL, sTaLink) ;
else
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_FIXTAL) ;
// chiamo la funzione di gestione dati bloccaggio
bOk = bOk && CallOnFixtureData() ;
return bOk ;
+1 -1
View File
@@ -49,7 +49,7 @@ class Processor
bool OnTableData( const std::string& sName, const Point3d& ptOri1) ;
bool OnTableAxisData( int nAxisInd, const std::string& sName, double dPos, bool bMoved) ;
bool OnFixtureData( int nFixId, int nFixInd, const std::string& sName,
const Point3d& ptPos, double dAngDeg, double dMov) ;
const Point3d& ptPos, double dAngDeg, double dMov, const std::string& sTaLink) ;
bool OnRawMoveData( int nRawId, int nRawMoveInd, int nType, const Point3d& ptPos, int nFlag) ;
bool OnMachiningStart( int nOpId, int nOpInd, double dSpeed, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ;