Compare commits

..

1 Commits

Author SHA1 Message Date
Riccardo Elitropi ca72ddf1a4 EgtMachKernel :
- aggiunto utensile Vmill Additivo.
2024-04-22 13:22:50 +02:00
103 changed files with 6927 additions and 42662 deletions
+3 -6
View File
@@ -50,7 +50,6 @@ Axis::Clone( void) const
pAx->m_bInvert = m_bInvert ; pAx->m_bInvert = m_bInvert ;
pAx->m_dOffset = m_dOffset ; pAx->m_dOffset = m_dOffset ;
pAx->m_nType = m_nType ; pAx->m_nType = m_nType ;
pAx->m_nUse = m_nUse ;
pAx->m_ptPos = m_ptPos ; pAx->m_ptPos = m_ptPos ;
pAx->m_vtDir = m_vtDir ; pAx->m_vtDir = m_vtDir ;
pAx->m_Stroke = m_Stroke ; pAx->m_Stroke = m_Stroke ;
@@ -75,7 +74,6 @@ Axis::Dump( string& sOut, bool bMM, const char* szNewLine) const
sOut += "Name=" + m_sName + szNewLine ; sOut += "Name=" + m_sName + szNewLine ;
sOut += "Token=" + m_sToken + szNewLine ; sOut += "Token=" + m_sToken + szNewLine ;
sOut += "Type=" + ToString( m_nType) + szNewLine ; sOut += "Type=" + ToString( m_nType) + szNewLine ;
sOut += "Use=" + ToString( m_nUse) + szNewLine ;
sOut += "Pos=" + ToString( GetInUiUnits( m_ptPos, bMM), 4) + szNewLine ; sOut += "Pos=" + ToString( GetInUiUnits( m_ptPos, bMM), 4) + szNewLine ;
sOut += "Dir=" + ToString( m_vtDir) + szNewLine ; sOut += "Dir=" + ToString( m_vtDir) + szNewLine ;
if ( m_nType == MCH_AT_LINEAR) if ( m_nType == MCH_AT_LINEAR)
@@ -115,21 +113,20 @@ Axis::GetGeomDB( void) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
Axis::Axis( void) Axis::Axis( void)
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_bInvert( false), m_dOffset( 0), : m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_bInvert( false), m_dOffset( 0),
m_nType( MCH_AT_NONE), m_nUse( MCH_AU_NONE), m_Stroke( {{0,0}}), m_dHomeVal( 0), m_dCurrVal( 0) m_nType( MCH_AT_NONE), m_Stroke( {{0,0}}), m_dHomeVal( 0), m_dCurrVal( 0)
{ {
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Axis::Set( const string& sName, const string& sToken, bool bInvert, double dOffset, Axis::Set( const string& sName, const string& sToken, bool bInvert, double dOffset,
int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome)
{ {
m_sName = sName ; m_sName = sName ;
m_sToken = sToken ; m_sToken = sToken ;
m_bInvert = bInvert ; m_bInvert = bInvert ;
m_dOffset = dOffset ; m_dOffset = dOffset ;
m_nType = ( nType == MCH_AT_ROTARY ? MCH_AT_ROTARY : MCH_AT_LINEAR) ; m_nType = nType ;
m_nUse = (( nUse == MCH_AU_DISPOSITION || nUse == MCH_AU_AUXILIAR) ? nUse : MCH_AU_GENERAL) ;
m_ptPos = ptPos ; m_ptPos = ptPos ;
m_vtDir = vtDir ; m_vtDir = vtDir ;
m_Stroke = Stroke ; m_Stroke = Stroke ;
+4 -7
View File
@@ -1,13 +1,13 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2025 // EgalTech 2015-2022
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : Axis.h Data : 17.04.25 Versione : 2.7d2 // File : Axis.h Data : 21.09.22 Versione : 2.4i
// Contenuto : Dichiarazione della classe Axis. // Contenuto : Dichiarazione della classe Axis.
// //
// //
// //
// Modifiche : 24.05.15 DS Creazione modulo. // Modifiche : 24.05.15 DS Creazione modulo.
// 17.04.25 DS Aggiunto campo Use. //
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -31,7 +31,7 @@ class Axis : public IUserObj
public : public :
Axis( void) ; Axis( void) ;
bool Set( const std::string& sName, const std::string& sToken, bool bInvert, double dOffset, bool Set( const std::string& sName, const std::string& sToken, bool bInvert, double dOffset,
int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) ; int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) ;
bool Modify( const Point3d& ptPos, double dAxisMaxAdjust) ; bool Modify( const Point3d& ptPos, double dAxisMaxAdjust) ;
bool Modify( const Vector3d& vtDir, double dAxisMaxRotAdj) ; bool Modify( const Vector3d& vtDir, double dAxisMaxRotAdj) ;
bool Modify( const STROKE& Stroke) ; bool Modify( const STROKE& Stroke) ;
@@ -48,8 +48,6 @@ class Axis : public IUserObj
{ return m_dOffset ; } { return m_dOffset ; }
int GetType( void) const int GetType( void) const
{ return m_nType ; } { return m_nType ; }
int GetUse( void) const
{ return m_nUse ; }
const Point3d& GetPos( void) const const Point3d& GetPos( void) const
{ return m_ptPos ; } { return m_ptPos ; }
const Vector3d& GetDir( void) const const Vector3d& GetDir( void) const
@@ -69,7 +67,6 @@ class Axis : public IUserObj
bool m_bInvert ; bool m_bInvert ;
double m_dOffset ; double m_dOffset ;
int m_nType ; int m_nType ;
int m_nUse ;
Point3d m_ptPos ; Point3d m_ptPos ;
Vector3d m_vtDir ; Vector3d m_vtDir ;
STROKE m_Stroke ; STROKE m_Stroke ;
-14
View File
@@ -473,8 +473,6 @@ CamData::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
if ( ! m_ptCen.Mirror( ptOn, vtNorm)) if ( ! m_ptCen.Mirror( ptOn, vtNorm))
return false ; return false ;
m_dAngCen = - m_dAngCen ; m_dAngCen = - m_dAngCen ;
if ( ! m_vtN.Mirror( vtNorm))
return false ;
if ( ! m_vtTool.Mirror( vtNorm)) if ( ! m_vtTool.Mirror( vtNorm))
return false ; return false ;
if ( ! m_vtCorr.Mirror( vtNorm)) if ( ! m_vtCorr.Mirror( vtNorm))
@@ -587,23 +585,11 @@ CamData::CamData( void)
bool bool
CamData::SetMoveType( int nMove) CamData::SetMoveType( int nMove)
{ {
if ( nMove < 0 || nMove > 3)
return false ;
m_nMove = nMove ; m_nMove = nMove ;
ResetObjGraphics() ; ResetObjGraphics() ;
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
CamData::SetCorrType( int nCorr)
{
if ( nCorr != 0 && nCorr != 41 && nCorr != 42 && nCorr != 140 && nCorr != 141 && nCorr != 142)
return false ;
m_nCorre = nCorr ;
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
CamData::SetToolDir( const Vector3d& vtDir) CamData::SetToolDir( const Vector3d& vtDir)
+1 -6
View File
@@ -46,7 +46,6 @@ class CamData : public IUserObj
public : public :
CamData( void) ; CamData( void) ;
bool SetMoveType( int nMove) ; bool SetMoveType( int nMove) ;
bool SetCorrType( int nCorr) ;
bool SetToolDir( const Vector3d& vtDir) ; bool SetToolDir( const Vector3d& vtDir) ;
bool SetCorrDir( const Vector3d& vtDir) ; bool SetCorrDir( const Vector3d& vtDir) ;
bool SetAuxDir( const Vector3d& vtDir) ; bool SetAuxDir( const Vector3d& vtDir) ;
@@ -73,14 +72,10 @@ class CamData : public IUserObj
{ m_bToolShow = bShow ; return true ; } { m_bToolShow = bShow ; return true ; }
int GetMoveType( void) const int GetMoveType( void) const
{ return m_nMove ; } { return m_nMove ; }
bool IsRapid( void) const
{ return ( m_nMove == 0) ; }
bool IsLine( void) const bool IsLine( void) const
{ return ( m_nMove == 0 || m_nMove == 1) ; } { return ( m_nMove == 0 || m_nMove == 1) ; }
bool IsArc( void) const bool IsArc( void) const
{ return ( m_nMove == 2 || m_nMove == 3) ; } { return ( m_nMove == 2 || m_nMove == 3) ; }
int GetCorrType( void) const
{ return m_nCorre ; }
const Vector3d& GetToolDir( void) const const Vector3d& GetToolDir( void) const
{ return m_vtTool ; } { return m_vtTool ; }
const Vector3d& GetCorrDir( void) const const Vector3d& GetCorrDir( void) const
@@ -147,7 +142,7 @@ class CamData : public IUserObj
int m_nOwnerId ; int m_nOwnerId ;
IGeomDB* m_pGeomDB ; IGeomDB* m_pGeomDB ;
int m_nMove ; // tipo movimento (0=rapido, 1=lineare, 2=arco CW, 3=arco CCW) int m_nMove ; // tipo movimento (0=rapido, 1=lineare, 2=arco CW, 3=arco CCW)
int m_nCorre ; // tipo correzione (0, 41, 42, 140, 141, 142) int m_nCorre ; // tipo correzione (0, 41, 42, 141, 142, 40)
bool m_bToolShow ; // flag per forzare la visualizzazione della direzione utensile in ogni caso bool m_bToolShow ; // flag per forzare la visualizzazione della direzione utensile in ogni caso
Vector3d m_vtTool ; // versore fresa Vector3d m_vtTool ; // versore fresa
Vector3d m_vtCorr ; // versore correzione Vector3d m_vtCorr ; // versore correzione
+25 -46
View File
@@ -44,7 +44,6 @@ using namespace std ;
// 2910 = "Error in Chiseling : link movements not calculable" // 2910 = "Error in Chiseling : link movements not calculable"
// 2911 = "Error in Chiseling : link outstroke xx" // 2911 = "Error in Chiseling : link outstroke xx"
// 2912 = "Error in Chiseling : post apply not calculable" // 2912 = "Error in Chiseling : post apply not calculable"
// 2913 = "Error in Chiseling : special apply not calculable"
// 2951 = "Warning in Chiseling : Skipped entity (xx)" // 2951 = "Warning in Chiseling : Skipped entity (xx)"
// 2952 = "Warning in Chiseling : Plunges not found" // 2952 = "Warning in Chiseling : Plunges not found"
// 2953 = "Warning in Chiseling : Tool name changed (xx)" // 2953 = "Warning in Chiseling : Tool name changed (xx)"
@@ -398,8 +397,7 @@ Chiseling::SetGeometry( const SELVECTOR& vIds)
// verifico validità gestore DB geometrico // verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// copia temporanea e reset della geometria corrente // reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ; m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce) // verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
int nType = GEO_NONE ; int nType = GEO_NONE ;
@@ -415,8 +413,7 @@ Chiseling::SetGeometry( const SELVECTOR& vIds)
m_vId.emplace_back( Id) ; m_vId.emplace_back( Id) ;
} }
// aggiorno lo stato // aggiorno lo stato
if ( m_vId != vOldId) m_nStatus |= MCH_ST_GEO_MODIF ;
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare // restituisco presenza geometria da lavorare
return ( ! m_vId.empty() || vIds.empty()) ; return ( ! m_vId.empty() || vIds.empty()) ;
} }
@@ -498,25 +495,21 @@ Chiseling::Apply( bool bRecalc, bool bPostApply)
return false ; return false ;
// aggiorno dati geometrici dell'utensile // aggiorno dati geometrici dell'utensile
if ( ! UpdateToolData()) { bool bToolChanged = true ;
if ( ! UpdateToolData( &bToolChanged)) {
m_pMchMgr->SetLastError( 2901, "Error in Chiseling : UpdateToolData failed") ; m_pMchMgr->SetLastError( 2901, "Error in Chiseling : UpdateToolData failed") ;
return false ; return false ;
} }
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento // verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) { if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione // confermo i percorsi di lavorazione
m_nChisels = nCurrChisels ; m_nChisels = nCurrChisels ;
string sLog = string( "Chiseling apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ; LOG_DBG_INFO( GetEMkLogger(), "Chiseling apply skipped : status already ok") ;
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente // eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply)) if ( ! Update( bPostApply))
return false ; return false ;
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ; LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo // esco con successo
return true ; return true ;
@@ -621,19 +614,6 @@ Chiseling::Update( bool bPostApply)
return false ; return false ;
} }
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni speciali
string sSpecErr ;
if ( bPostApply && ! SpecialApply( sSpecErr)) {
if ( ! IsEmptyOrSpaces( sSpecErr))
m_pMchMgr->SetLastError( 2913, sSpecErr) ;
else
m_pMchMgr->SetLastError( 2913, "Error in Chiseling : special apply not calculable") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione // gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) { if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ; string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
@@ -644,11 +624,14 @@ Chiseling::Update( bool bPostApply)
return false ; return false ;
} }
// esecuzione eventuali personalizzazioni finali // assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
string sPostErr ; CalcAndSetAxesBBox() ;
if ( bPostApply && ! PostApply( sPostErr)) {
if ( ! IsEmptyOrSpaces( sPostErr)) // esecuzione eventuali personalizzazioni
m_pMchMgr->SetLastError( 2912, sPostErr) ; string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2912, sErr) ;
else else
m_pMchMgr->SetLastError( 2912, "Error in Chiseling : post apply not calculable") ; m_pMchMgr->SetLastError( 2912, "Error in Chiseling : post apply not calculable") ;
return false ; return false ;
@@ -778,20 +761,16 @@ Chiseling::GetToolData( void) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Chiseling::UpdateToolData( void) Chiseling::UpdateToolData( bool* pbChanged)
{ {
// recupero il gestore DB utensili della macchina corrente // recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ; ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr) if ( pTMgr == nullptr)
return false ; return false ;
// recupero l'utensile nel DB utensili (se fallisce con UUID provo con il nome) // recupero l'utensile nel DB utensili
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) { if ( pTdata == nullptr)
pTdata = pTMgr->GetTool( m_Params.m_sToolName) ; return false ;
if ( pTdata == nullptr)
return false ;
m_Params.m_ToolUuid = m_TParams.m_Uuid ;
}
// salvo posizione TC, testa e uscita originali // salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ; string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ; string sOrigHead = m_TParams.m_sHead ;
@@ -829,9 +808,9 @@ Chiseling::UpdateToolData( void)
m_Params.m_sToolName + ")" ; m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 2954, sInfo) ; m_pMchMgr->SetWarning( 2954, sInfo) ;
} }
// se modificato, aggiusto lo stato // se definito parametro di ritorno, lo assegno
if ( bChanged) if ( pbChanged != nullptr)
m_nStatus = MCH_ST_TO_VERIFY ; *pbChanged = bChanged ;
return true ; return true ;
} }
@@ -1031,7 +1010,7 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// la porto in globale // la porto in globale
pCrvCompo->ToGlob( frGlob) ; pCrvCompo->ToGlob( frGlob) ;
// sistemazioni varie // sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, {}, 0) ; AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, 0) ;
// la restituisco // la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ; lstPC.emplace_back( Release( pCrvCompo)) ;
return true ; return true ;
@@ -1067,7 +1046,7 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// la porto in globale // la porto in globale
pCrvCompo->ToGlob( frGlob) ; pCrvCompo->ToGlob( frGlob) ;
// sistemazioni varie // sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, {}, 0) ; AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, 0) ;
// la restituisco // la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ; lstPC.emplace_back( Release( pCrvCompo)) ;
} }
@@ -1538,7 +1517,7 @@ Chiseling::GenerateChiselingCl( const SqHole& hole, int nPathId)
SetAuxDir( hole.vtAux) ; SetAuxDir( hole.vtAux) ;
// 1 -> punto approccio // 1 -> punto approccio
SetFlag( 1) ; SetFlag( 1) ;
double dAppr = GetSafeZ() ; double dAppr = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
Point3d ptP1 = hole.ptIni + hole.vtExtr * dAppr ; Point3d ptP1 = hole.ptIni + hole.vtExtr * dAppr ;
if ( AddRapidStart( ptP1) == GDB_ID_NULL) if ( AddRapidStart( ptP1) == GDB_ID_NULL)
return false ; return false ;
+3 -9
View File
@@ -37,14 +37,8 @@ class Chiseling : public Machining
public : // Operation public : // Operation
int GetType( void) const override int GetType( void) const override
{ return OPER_CHISELING ; } { return OPER_CHISELING ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override bool IsEmpty( void) const override
{ if ( m_nChisels == 0) { return ( m_nChisels == 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 bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; } { m_nStatus |= nModif ; return true ; }
@@ -66,7 +60,7 @@ class Chiseling : public Machining
bool GetParam( int nType, int& nVal) const override ; bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ; bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ; bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( void) override ; bool UpdateToolData( bool* pbChanged = nullptr) override ;
const ToolData& GetToolData( void) const override ; const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ; bool GetGeometry( SELVECTOR& vIds) const override ;
+50 -271
View File
@@ -21,24 +21,22 @@
#include "/EgtDev/Include/EGkAngle.h" #include "/EgtDev/Include/EGkAngle.h"
#include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkUserObjFactory.h" #include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EGnStringKeyVal.h" #include "/EgtDev/Include/EGnStringKeyVal.h"
#include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnFileUtils.h"
using namespace std ; using namespace std ;
//------------------------------ Errors -------------------------------------- //------------------------------ Errors --------------------------------------
// 2001 = "Error moving axis xx" // 2001 = "Error adding fixture xx"
// 2002 = "Error adding fixture xx" // 2002 = "Error placing fixture xx"
// 2003 = "Error placing fixture xx" // 2003 = "Error in MoveToCornerRawPart xx"
// 2004 = "Error in MoveToCornerRawPart xx" // 2004 = "Error in MoveToCenterRawPart xx"
// 2005 = "Error in MoveToCenterRawPart xx" // 2005 = "Error in ApplyRotationToRawPart xx"
// 2006 = "Error in ApplyRotationToRawPart xx" // 2006 = "Error in OnSpecialApplyDisposition (xxx)"
// 2007 = "Error in OnSpecialApplyDisposition (xxx)" // 2007 = "Error in Disposition : axes values not calculable"
// 2008 = "Error in Disposition : axes values not calculable" // 2008 = "Error in Disposition : outstroke xxx"
// 2009 = "Error in Disposition : outstroke xxx" // 2009 = "Error in Disposition : link movements not calculable"
// 2010 = "Error in Disposition : link movements not calculable" // 2010 = "Error in Disposition : link outstroke xxx"
// 2011 = "Error in Disposition : link outstroke xxx"
// 2051 = "Table Ref1 changed : (xyz) -> (XYZ)" // 2051 = "Table Ref1 changed : (xyz) -> (XYZ)"
// 2052 = "Warning in Disposition : No shifts" // 2052 = "Warning in Disposition : No shifts"
// 2053 = "Warning in OnSpecialApplyDisposition (xxx)" // 2053 = "Warning in OnSpecialApplyDisposition (xxx)"
@@ -48,15 +46,11 @@ static string DIS_TABLE = "Tab" ;
static string DIS_PHASE = "Ph" ; static string DIS_PHASE = "Ph" ;
static string DIS_REF1 = "Ref1" ; static string DIS_REF1 = "Ref1" ;
static string DIS_AREA1 = "Area1" ; static string DIS_AREA1 = "Area1" ;
static string DIS_AXD_TOT = "AxT" ;
static string DIS_AXD_NAME = "AxN" ;
static string DIS_AXD_POS = "AxP" ;
static string DIS_FXD_TOT = "FxT" ; static string DIS_FXD_TOT = "FxT" ;
static string DIS_FXD_NAME = "FxN" ; static string DIS_FXD_NAME = "FxN" ;
static string DIS_FXD_POS = "FxP" ; static string DIS_FXD_POS = "FxP" ;
static string DIS_FXD_ANG = "FxA" ; static string DIS_FXD_ANG = "FxA" ;
static string DIS_FXD_MOV = "FxM" ; static string DIS_FXD_MOV = "FxM" ;
static string DIS_FXD_LINK = "FxL" ;
static string DIS_MVD_TOT = "MvT" ; static string DIS_MVD_TOT = "MvT" ;
static string DIS_MVD_ID = "MvI" ; static string DIS_MVD_ID = "MvI" ;
static string DIS_MVD_TYPE = "MvT" ; static string DIS_MVD_TYPE = "MvT" ;
@@ -98,7 +92,6 @@ Disposition::Clone( void) const
pDisp->m_b3Area1 = m_b3Area1 ; pDisp->m_b3Area1 = m_b3Area1 ;
pDisp->m_dAreaOffset = m_dAreaOffset ; pDisp->m_dAreaOffset = m_dAreaOffset ;
pDisp->m_bTabOk = m_bTabOk ; pDisp->m_bTabOk = m_bTabOk ;
pDisp->m_vAxData = m_vAxData ;
pDisp->m_vFixData = m_vFixData ; pDisp->m_vFixData = m_vFixData ;
pDisp->m_vMvrData = m_vMvrData ; pDisp->m_vMvrData = m_vMvrData ;
pDisp->m_sHead = m_sHead ; pDisp->m_sHead = m_sHead ;
@@ -127,17 +120,12 @@ Disposition::Dump( string& sOut, bool bMM, const char* szNewLine) const
sOut += DIS_REF1 + EQUAL + "(" + ToString( m_ptRef1, 3) + ")" + szNewLine ; sOut += DIS_REF1 + EQUAL + "(" + ToString( m_ptRef1, 3) + ")" + szNewLine ;
sOut += DIS_AREA1 + EQUAL + "(" + ToString( m_b3Area1, 3) + ")" + szNewLine ; sOut += DIS_AREA1 + EQUAL + "(" + ToString( m_b3Area1, 3) + ")" + szNewLine ;
sOut += DIS_AREA1_OFFS + EQUAL + "(" + ToString( m_dAreaOffset) + ")" + szNewLine ; sOut += DIS_AREA1_OFFS + EQUAL + "(" + ToString( m_dAreaOffset) + ")" + szNewLine ;
for ( const auto& AxData : m_vAxData) {
sOut += "AxD=" + AxData.sName + "," +
ToString( AxData.dPos) + szNewLine ;
}
for ( const auto& FixData : m_vFixData) { for ( const auto& FixData : m_vFixData) {
sOut += "FxD=" + FixData.sName + "," + sOut += "FxD=" + FixData.sName + "," +
ToString( FixData.nId) + ",(" + ToString( FixData.nId) + ",(" +
ToString( FixData.ptPos) + ")," + ToString( FixData.ptPos) + ")," +
ToString( FixData.dAng) + "," + ToString( FixData.dAng) + "," +
ToString( FixData.dMov) + "," + ToString( FixData.dMov) + szNewLine ;
( IsEmptyOrSpaces( FixData.sTaLink) ? "__" : FixData.sTaLink) + szNewLine ;
} }
for ( const auto& MvrData : m_vMvrData) { for ( const auto& MvrData : m_vMvrData) {
sOut += "MvD=" + ToString( MvrData.nRawId) + "," ; sOut += "MvD=" + ToString( MvrData.nRawId) + "," ;
@@ -171,14 +159,12 @@ Disposition::Save( int nBaseId, STRVECTOR& vString) const
{ {
try { try {
int k = - 1 ; int k = - 1 ;
int nAxdTot = int( m_vAxData.size()) ;
int nAxdLines = ( nAxdTot == 0 ? 0 : 1 + 2 * nAxdTot) ;
int nFxdTot = int( m_vFixData.size()) ; int nFxdTot = int( m_vFixData.size()) ;
int nFxdLines = 1 + 5 * nFxdTot ; int nFxdLines = 1 + 4 * nFxdTot ;
int nMvdTot = int( m_vMvrData.size()) ; int nMvdTot = int( m_vMvrData.size()) ;
int nMvdLines = 1 + 4 * nMvdTot ; int nMvdLines = 1 + 4 * nMvdTot ;
int nOther = 7 ; int nOther = 7 ;
vString.insert( vString.begin(), 4 + nAxdLines + nFxdLines + nMvdLines + nOther, "") ; vString.insert( vString.begin(), 4 + nFxdLines + nMvdLines + nOther, "") ;
// Nome // Nome
if ( ! SetVal( DIS_TABLE, m_sTabName, vString[++k])) if ( ! SetVal( DIS_TABLE, m_sTabName, vString[++k]))
return false ; return false ;
@@ -191,16 +177,6 @@ Disposition::Save( int nBaseId, STRVECTOR& vString) const
// Prima area // Prima area
if ( ! SetVal( DIS_AREA1, m_b3Area1, vString[++k])) if ( ! SetVal( DIS_AREA1, m_b3Area1, vString[++k]))
return false ; return false ;
// Dati assi (se presenti)
if ( nAxdTot > 0) {
if ( ! SetVal( DIS_AXD_TOT, nAxdTot, vString[++k]))
return false ;
for ( const auto& AxData : m_vAxData) {
if ( ! SetVal( DIS_AXD_NAME, AxData.sName, vString[++k]) ||
! SetVal( DIS_AXD_POS, AxData.dPos, vString[++k]))
return false ;
}
}
// Dati sottopezzi // Dati sottopezzi
if ( ! SetVal( DIS_FXD_TOT, nFxdTot, vString[++k])) if ( ! SetVal( DIS_FXD_TOT, nFxdTot, vString[++k]))
return false ; return false ;
@@ -208,8 +184,7 @@ Disposition::Save( int nBaseId, STRVECTOR& vString) const
if ( ! SetVal( DIS_FXD_NAME, FixData.sName, vString[++k]) || if ( ! SetVal( DIS_FXD_NAME, FixData.sName, vString[++k]) ||
! SetVal( DIS_FXD_POS, FixData.ptPos, vString[++k]) || ! SetVal( DIS_FXD_POS, FixData.ptPos, vString[++k]) ||
! SetVal( DIS_FXD_ANG, FixData.dAng, 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 ; return false ;
} }
// Dati posizionamento grezzi // Dati posizionamento grezzi
@@ -262,27 +237,12 @@ Disposition::Load( const STRVECTOR& vString, int nBaseGdbId)
// prima area // prima area
if ( ! GetVal( vString[++k], DIS_AREA1, m_b3Area1)) if ( ! GetVal( vString[++k], DIS_AREA1, m_b3Area1))
return false ; return false ;
// dati assi opzionali
int nAxdTot = 0 ;
if ( ! GetVal( vString[++k], DIS_AXD_TOT, nAxdTot))
-- k ;
int nAxdLines = ( nAxdTot == 0 ? 0 : 1 + 2 * nAxdTot) ;
if ( nAxdTot > 0) {
if ( int( vString.size()) < 3 + nAxdLines + 1)
return false ;
m_vAxData.insert( m_vAxData.begin(), nAxdTot, AxisData()) ;
for ( auto& AxData : m_vAxData) {
if ( ! GetVal( vString[++k], DIS_AXD_NAME, AxData.sName) ||
! GetVal( vString[++k], DIS_AXD_POS, AxData.dPos))
return false ;
}
}
// dati sottopezzi // dati sottopezzi
int nFxdTot ; int nFxdTot ;
if ( ! GetVal( vString[++k], DIS_FXD_TOT, nFxdTot)) if ( ! GetVal( vString[++k], DIS_FXD_TOT, nFxdTot))
return false ; return false ;
int nFxdLines = 1 + 3 * nFxdTot ; int nFxdLines = 1 + 3 * nFxdTot ;
if ( int( vString.size()) < 3 + nAxdLines + nFxdLines + 1) if ( int( vString.size()) < 3 + nFxdLines + 1)
return false ; return false ;
m_vFixData.insert( m_vFixData.begin(), nFxdTot, FixtureData()) ; m_vFixData.insert( m_vFixData.begin(), nFxdTot, FixtureData()) ;
for ( auto& FixData : m_vFixData) { for ( auto& FixData : m_vFixData) {
@@ -296,17 +256,13 @@ Disposition::Load( const STRVECTOR& vString, int nBaseGdbId)
if ( ! GetVal( vString[++k], DIS_FXD_MOV, FixData.dMov)) if ( ! GetVal( vString[++k], DIS_FXD_MOV, FixData.dMov))
-- k ; -- k ;
} }
if ( k + 1 < int( vString.size())) {
if ( ! GetVal( vString[++k], DIS_FXD_LINK, FixData.sTaLink))
-- k ;
}
} }
// dati posizionamento grezzi // dati posizionamento grezzi
int nMvdTot ; int nMvdTot ;
if ( ! GetVal( vString[++k], DIS_MVD_TOT, nMvdTot)) if ( ! GetVal( vString[++k], DIS_MVD_TOT, nMvdTot))
return false ; return false ;
int nMvdLines = 1 + 4 * nMvdTot ; int nMvdLines = 1 + 4 * nMvdTot ;
if ( int( vString.size()) < 3 + nAxdLines + nFxdLines + nMvdLines) if ( int( vString.size()) < 3 + nFxdLines + nMvdLines)
return false ; return false ;
m_vMvrData.insert( m_vMvrData.begin(), nMvdTot, MoveRawData()) ; m_vMvrData.insert( m_vMvrData.begin(), nMvdTot, MoveRawData()) ;
for ( auto& MvrData : m_vMvrData) { for ( auto& MvrData : m_vMvrData) {
@@ -479,16 +435,6 @@ Disposition::Apply( bool bVerifyTab)
if ( ( ! m_bTabOk || bVerifyTab) && ! SetTable( m_sTabName)) if ( ( ! m_bTabOk || bVerifyTab) && ! SetTable( m_sTabName))
return false ; return false ;
bool bOk = true ; bool bOk = true ;
// annullo movimento assi
m_pMchMgr->ResetAllAxesPos( false, true) ;
// aggiornamento movimenti assi
for ( auto& AxData : m_vAxData) {
if ( ! m_pMchMgr->SetAxisPos( AxData.sName, AxData.dPos)) {
string sOut = "Error moving axis " + AxData.sName ;
m_pMchMgr->SetLastError( 2001, sOut) ;
bOk = false ;
}
}
// aggiornamento sottopezzi // aggiornamento sottopezzi
for ( auto& FixData : m_vFixData) { for ( auto& FixData : m_vFixData) {
// se sottopezzo da caricare // se sottopezzo da caricare
@@ -496,7 +442,7 @@ Disposition::Apply( bool bVerifyTab)
int nId = AddFixture( FixData.sName, GDB_ID_NULL, FixData.ptPos, FixData.dAng, FixData.dMov, false) ; int nId = AddFixture( FixData.sName, GDB_ID_NULL, FixData.ptPos, FixData.dAng, FixData.dMov, false) ;
if ( nId == GDB_ID_NULL) { if ( nId == GDB_ID_NULL) {
string sOut = "Error adding fixture " + FixData.sName ; string sOut = "Error adding fixture " + FixData.sName ;
m_pMchMgr->SetLastError( 2002, sOut) ; m_pMchMgr->SetLastError( 2001, sOut) ;
bOk = false ; bOk = false ;
} }
else else
@@ -506,7 +452,7 @@ Disposition::Apply( bool bVerifyTab)
else { else {
if ( ! PlaceFixture( FixData.nId, FixData.ptPos, FixData.dAng, FixData.dMov)) { if ( ! PlaceFixture( FixData.nId, FixData.ptPos, FixData.dAng, FixData.dMov)) {
string sOut = "Error placing fixture " + ToString( FixData.nId) ; string sOut = "Error placing fixture " + ToString( FixData.nId) ;
m_pMchMgr->SetLastError( 2003, sOut) ; m_pMchMgr->SetLastError( 2002, sOut) ;
bOk = false ; bOk = false ;
} }
} }
@@ -528,21 +474,21 @@ Disposition::Apply( bool bVerifyTab)
case MoveRawData::COR : case MoveRawData::COR :
if ( ! MoveToCornerRawPart( vMvrData.nRawId, vMvrData.ptP, vMvrData.nFlag, false, false)) { if ( ! MoveToCornerRawPart( vMvrData.nRawId, vMvrData.ptP, vMvrData.nFlag, false, false)) {
string sOut = "Error in MoveToCornerRawPart " + ToString( vMvrData.nRawId) ; string sOut = "Error in MoveToCornerRawPart " + ToString( vMvrData.nRawId) ;
m_pMchMgr->SetLastError( 2004, sOut) ; m_pMchMgr->SetLastError( 2003, sOut) ;
bOk = false ; bOk = false ;
} }
break ; break ;
case MoveRawData::CEN : case MoveRawData::CEN :
if ( ! MoveToCenterRawPart( vMvrData.nRawId, vMvrData.ptP, vMvrData.nFlag, false, false)) { if ( ! MoveToCenterRawPart( vMvrData.nRawId, vMvrData.ptP, vMvrData.nFlag, false, false)) {
string sOut = "Error in MoveToCenterRawPart " + ToString( vMvrData.nRawId) ; string sOut = "Error in MoveToCenterRawPart " + ToString( vMvrData.nRawId) ;
m_pMchMgr->SetLastError( 2005, sOut) ; m_pMchMgr->SetLastError( 2004, sOut) ;
bOk = false ; bOk = false ;
} }
break ; break ;
case MoveRawData::ROT : case MoveRawData::ROT :
if ( ! ApplyRotationToRawPart( vMvrData.nRawId, vMvrData.ptP.x, vMvrData.ptP.y, vMvrData.ptP.z, false)) { if ( ! ApplyRotationToRawPart( vMvrData.nRawId, vMvrData.ptP.x, vMvrData.ptP.y, vMvrData.ptP.z, false)) {
string sOut = "Error in ApplyRotationToRawPart " + ToString( vMvrData.nRawId) ; string sOut = "Error in ApplyRotationToRawPart " + ToString( vMvrData.nRawId) ;
m_pMchMgr->SetLastError( 2006, sOut) ; m_pMchMgr->SetLastError( 2005, sOut) ;
bOk = false ; bOk = false ;
} }
break ; break ;
@@ -574,69 +520,6 @@ Disposition::IsInTable( const BBox3d& b3B)
return b3AllArea.EnclosesXY( b3B) ; return b3AllArea.EnclosesXY( b3B) ;
} }
//----------------------------------------------------------------------------
bool
Disposition::MoveAxis( const string& sName, double dPos)
{
// verifico MachMgr e GeomDB
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
// verifico tavola
if ( ! m_bTabOk && ! SetTable( m_sTabName))
return false ;
// verifico sia un asse di disposizione (ovvero dipendente dalla tavola)
if ( ! m_pMchMgr->IsDispositionAxis( sName, m_sTabName))
return false ;
// cerco eventuale movimento dello stesso asse già inserito
int nInd = -1 ;
for ( int i = 0 ; i < int( m_vAxData.size()) ; ++ i) {
if ( m_vAxData[i].sName == sName) {
nInd = i ;
break ;
}
}
// eseguo movimento
if ( ! m_pMchMgr->SetAxisPos( sName, dPos))
return false ;
// salvo movimento
if ( nInd < 0)
m_vAxData.emplace_back( sName, dPos) ;
else
m_vAxData[nInd].dPos = dPos ;
m_nStatus |= MCH_ST_GEO_MODIF ;
return true ;
}
//----------------------------------------------------------------------------
bool
Disposition::RemoveAxis( const string& sName)
{
// verifico MachMgr e GeomDB
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
// verifico tavola
if ( ! m_bTabOk && ! SetTable( m_sTabName))
return false ;
// verifico sia un asse di disposizione (ovvero dipendente dalla tavola)
if ( ! m_pMchMgr->IsDispositionAxis( sName, m_sTabName))
return false ;
// cerco eventuale movimento dello stesso asse già inserito
int nInd = -1 ;
for ( int i = 0 ; i < int( m_vAxData.size()) ; ++ i) {
if ( m_vAxData[i].sName == sName) {
nInd = i ;
break ;
}
}
// se non trovato, non devo fare alcunché
if ( nInd < 0)
return true ;
// rimetto asse in home e rimuovo movimento dalla lista
m_pMchMgr->ResetAxisPos( sName) ;
m_vAxData.erase( m_vAxData.begin() + nInd) ;
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
Disposition::AddFixture( const string& sName, int nId, const Point3d& ptPos, double dAngDeg, Disposition::AddFixture( const string& sName, int nId, const Point3d& ptPos, double dAngDeg,
@@ -734,26 +617,20 @@ Disposition::AddFixture( const string& sName, int nId, const Point3d& ptPos, dou
return GDB_ID_NULL ; return GDB_ID_NULL ;
} }
// muovo eventuale parte mobile // muovo eventuale parte mobile
double dMovEff = dMov ;
int nMobId = m_pGeomDB->GetFirstNameInGroup( nFixtId, FXT_MOBILE) ; int nMobId = m_pGeomDB->GetFirstNameInGroup( nFixtId, FXT_MOBILE) ;
if ( nMobId != GDB_ID_NULL) { if ( nMobId != GDB_ID_NULL) {
double dMinVal = 0 ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MINPOS, dMinVal) ;
double dMaxVal = INFINITO ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MAXPOS, dMaxVal) ;
double dCurrVal = 0 ; double dCurrVal = 0 ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ; m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ;
dMovEff = Clamp( dMov, dMinVal, dMaxVal) ; if ( abs( dMov - dCurrVal) > EPS_SMALL) {
if ( abs( dMovEff - dCurrVal) > EPS_SMALL) {
Vector3d vtDir = Z_AX ; Vector3d vtDir = Z_AX ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ; m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ;
m_pGeomDB->TranslateGroup( nMobId, ( dMovEff - dCurrVal) * vtDir) ; m_pGeomDB->TranslateGroup( nMobId, (dMov - dCurrVal) * vtDir) ;
m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, dMovEff) ; m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, dMov) ;
} }
} }
// se da aggiungere alla lista // se da aggiungere alla lista
if ( bAddToList) { if ( bAddToList) {
m_vFixData.emplace_back( sName, nFixtId, ptPos, dAngDeg, dMovEff) ; m_vFixData.emplace_back( sName, nFixtId, ptPos, dAngDeg, dMov) ;
m_nStatus |= MCH_ST_GEO_MODIF ; m_nStatus |= MCH_ST_GEO_MODIF ;
} }
return nFixtId ; return nFixtId ;
@@ -857,31 +734,6 @@ Disposition::RotateFixture( int nId, double dDeltaAngDeg)
return true ; 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 bool
Disposition::MoveFixtureMobile( int nId, double dDeltaMov) Disposition::MoveFixtureMobile( int nId, double dDeltaMov)
@@ -892,72 +744,22 @@ Disposition::MoveFixtureMobile( int nId, double dDeltaMov)
// verifico aggiornamento tavola // verifico aggiornamento tavola
if ( ! m_bTabOk && ! SetTable( m_sTabName)) if ( ! m_bTabOk && ! SetTable( m_sTabName))
return false ; return false ;
// recupero la parte mobile // muovo eventuale parte mobile
int nMobId = m_pGeomDB->GetFirstNameInGroup( nId, FXT_MOBILE) ; int nMobId = m_pGeomDB->GetFirstNameInGroup( nId, FXT_MOBILE) ;
if ( nMobId == GDB_ID_NULL) if ( nMobId != GDB_ID_NULL) {
return false ; double dCurrVal = 0 ;
// recupero limiti di corsa e posizione m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ;
double dMinVal = 0 ; if ( abs( dDeltaMov) > EPS_SMALL) {
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MINPOS, dMinVal) ; Vector3d vtDir = Z_AX ;
double dMaxVal = INFINITO ; m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MAXPOS, dMaxVal) ; m_pGeomDB->TranslateGroup( nMobId, dDeltaMov * vtDir) ;
double dCurrVal = 0 ; m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, ( dCurrVal + dDeltaMov)) ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ;
// verifico movimento richiesto e fattibile non nullo
double dDeltaEff = Clamp( dCurrVal + dDeltaMov, dMinVal, dMaxVal) - dCurrVal ;
if ( abs( dDeltaEff) < EPS_SMALL)
return true ;
// eseguo il movimento
Vector3d vtDir = Z_AX ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ;
m_pGeomDB->TranslateGroup( nMobId, dDeltaEff * vtDir) ;
m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, ( dCurrVal + dDeltaEff)) ;
// aggiorno la posizione dell'oggetto nel vettore dei comandi
for ( auto& FixData : m_vFixData) {
if ( FixData.nId == nId) {
FixData.dMov += dDeltaEff ;
break ;
} }
} }
// imposto stato a modificato
m_nStatus |= MCH_ST_PARAM_MODIF ;
return true ;
}
//----------------------------------------------------------------------------
bool
Disposition::SetFixtureMobile( int nId, double dMov)
{
// 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 ;
// recupero la parte mobile
int nMobId = m_pGeomDB->GetFirstNameInGroup( nId, FXT_MOBILE) ;
if ( nMobId == GDB_ID_NULL)
return false ;
// recupero limiti di corsa e posizione
double dMinVal = 0 ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MINPOS, dMinVal) ;
double dMaxVal = INFINITO ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MAXPOS, dMaxVal) ;
double dCurrVal = 0 ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ;
// verifico movimento richiesto e fattibile non nullo
double dMovEff = Clamp( dMov, dMinVal, dMaxVal) ;
if ( abs( dMovEff - dCurrVal) < EPS_SMALL)
return true ;
// eseguo il movimento
Vector3d vtDir = Z_AX ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ;
m_pGeomDB->TranslateGroup( nMobId, ( dMovEff - dCurrVal) * vtDir) ;
m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, dMovEff) ;
// aggiorno la posizione dell'oggetto nel vettore dei comandi // aggiorno la posizione dell'oggetto nel vettore dei comandi
for ( auto& FixData : m_vFixData) { for ( auto& FixData : m_vFixData) {
if ( FixData.nId == nId) { if ( FixData.nId == nId) {
FixData.dMov = dMovEff ; FixData.dMov += dDeltaMov ;
break ; break ;
} }
} }
@@ -1005,21 +807,15 @@ Disposition::PlaceFixture( int nId, const Point3d& ptPos, double dAngDeg, double
if ( abs( dAngDeg) > EPS_ANG_SMALL) if ( abs( dAngDeg) > EPS_ANG_SMALL)
m_pGeomDB->RotateGroup( nId, ORIG, Z_AX, dAngDeg) ; m_pGeomDB->RotateGroup( nId, ORIG, Z_AX, dAngDeg) ;
// muovo eventuale parte mobile // muovo eventuale parte mobile
double dMovEff = dMov ;
int nMobId = m_pGeomDB->GetFirstNameInGroup( nId, FXT_MOBILE) ; int nMobId = m_pGeomDB->GetFirstNameInGroup( nId, FXT_MOBILE) ;
if ( nMobId != GDB_ID_NULL) { if ( nMobId != GDB_ID_NULL) {
double dMinVal = 0 ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MINPOS, dMinVal) ;
double dMaxVal = INFINITO ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MAXPOS, dMaxVal) ;
double dCurrVal = 0 ; double dCurrVal = 0 ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ; m_pGeomDB->GetInfo( nMobId, FXT_MOB_CPOS, dCurrVal) ;
dMovEff = Clamp( dMov, dMinVal, dMaxVal) ; if ( abs( dMov - dCurrVal) > EPS_SMALL) {
if ( abs( dMovEff - dCurrVal) > EPS_SMALL) {
Vector3d vtDir = Z_AX ; Vector3d vtDir = Z_AX ;
m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ; m_pGeomDB->GetInfo( nMobId, FXT_MOB_MOVEDIR, vtDir) ;
m_pGeomDB->TranslateGroup( nMobId, ( dMovEff - dCurrVal) * vtDir) ; m_pGeomDB->TranslateGroup( nMobId, ( dMov - dCurrVal) * vtDir) ;
m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, dMovEff) ; m_pGeomDB->SetInfo( nMobId, FXT_MOB_CPOS, dMov) ;
} }
} }
// aggiorno la posizione dell'oggetto nel vettore dei comandi // aggiorno la posizione dell'oggetto nel vettore dei comandi
@@ -1027,7 +823,7 @@ Disposition::PlaceFixture( int nId, const Point3d& ptPos, double dAngDeg, double
if ( FixData.nId == nId) { if ( FixData.nId == nId) {
FixData.ptPos = ptPos ; FixData.ptPos = ptPos ;
FixData.dAng = dAngDeg ; FixData.dAng = dAngDeg ;
FixData.dMov = dMovEff ; FixData.dMov = dMov ;
break ; break ;
} }
} }
@@ -1091,7 +887,7 @@ Disposition::MoveToCornerRawPart( int nRawId, const Point3d& ptP, int nFlag, boo
case MCH_CR_TR : case MCH_CR_TR :
vtMove = ( m_ptRef1 + ptP) - Point3d( b3Raw.GetMax().x, b3Raw.GetMax().y, b3Raw.GetMin().z) ; vtMove = ( m_ptRef1 + ptP) - Point3d( b3Raw.GetMax().x, b3Raw.GetMax().y, b3Raw.GetMin().z) ;
break ; break ;
default : // MCH_CR_BL default : // RPCP_BL
vtMove = ( m_ptRef1 + ptP) - b3Raw.GetMin() ; vtMove = ( m_ptRef1 + ptP) - b3Raw.GetMin() ;
break ; break ;
case MCH_CR_BR : case MCH_CR_BR :
@@ -1142,7 +938,7 @@ Disposition::MoveToCenterRawPart( int nRawId, const Point3d& ptP, int nFlag, boo
case MCH_CE_TC : case MCH_CE_TC :
vtMove = ( m_ptRef1 + ptP) - Point3d( ptCen.x, b3Raw.GetMax().y, ptCen.z) ; vtMove = ( m_ptRef1 + ptP) - Point3d( ptCen.x, b3Raw.GetMax().y, ptCen.z) ;
break ; break ;
default : // MCH_CE_ML default : // RPCE_ML
vtMove = ( m_ptRef1 + ptP) - Point3d( b3Raw.GetMin().x, ptCen.y, ptCen.z) ; vtMove = ( m_ptRef1 + ptP) - Point3d( b3Raw.GetMin().x, ptCen.y, ptCen.z) ;
break ; break ;
case MCH_CE_MR : case MCH_CE_MR :
@@ -1266,7 +1062,7 @@ Disposition::RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg)
case MCH_CR_TR : case MCH_CR_TR :
vtCorr = Vector3d( b3Raw.GetMax().x - b3OriRaw.GetMax().x, b3Raw.GetMax().y - b3OriRaw.GetMax().y, b3Raw.GetMin().z - b3OriRaw.GetMin().z) ; vtCorr = Vector3d( b3Raw.GetMax().x - b3OriRaw.GetMax().x, b3Raw.GetMax().y - b3OriRaw.GetMax().y, b3Raw.GetMin().z - b3OriRaw.GetMin().z) ;
break ; break ;
default : // MCH_CR_BL default : // RPCP_BL
vtCorr = Vector3d( b3Raw.GetMin().x - b3OriRaw.GetMin().x, b3Raw.GetMin().y - b3OriRaw.GetMin().y, b3Raw.GetMin().z - b3OriRaw.GetMin().z) ; vtCorr = Vector3d( b3Raw.GetMin().x - b3OriRaw.GetMin().x, b3Raw.GetMin().y - b3OriRaw.GetMin().y, b3Raw.GetMin().z - b3OriRaw.GetMin().z) ;
break ; break ;
case MCH_CR_BR : case MCH_CR_BR :
@@ -1281,7 +1077,7 @@ Disposition::RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg)
case MCH_CE_TC : case MCH_CE_TC :
vtCorr = Vector3d( ptCen.x - ptOriCen.x, b3Raw.GetMax().y - b3OriRaw.GetMax().y, ptCen.z - ptOriCen.z) ; vtCorr = Vector3d( ptCen.x - ptOriCen.x, b3Raw.GetMax().y - b3OriRaw.GetMax().y, ptCen.z - ptOriCen.z) ;
break ; break ;
default : // MCH_CE_ML default : // RPCE_ML
vtCorr = Vector3d( b3Raw.GetMin().x - b3OriRaw.GetMin().x, ptCen.y - ptOriCen.y, ptCen.z - ptOriCen.z) ; vtCorr = Vector3d( b3Raw.GetMin().x - b3OriRaw.GetMin().x, ptCen.y - ptOriCen.y, ptCen.z - ptOriCen.z) ;
break ; break ;
case MCH_CE_MR : case MCH_CE_MR :
@@ -1450,26 +1246,10 @@ Disposition::RemoveRawPart( int nRawId)
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
Disposition::GetMoveAxisData( int nInd, string& sName, double& dPos) const
{
// verifico MachMgr e GeomDB
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
// verifico l'indice
if ( nInd < 0 || nInd >= int( m_vAxData.size()))
return false ;
// recupero i dati
sName = m_vAxData[nInd].sName ;
dPos = m_vAxData[nInd].dPos ;
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Disposition::GetFixtureData( int nInd, string& sName, int& nId, Point3d& ptPos, Disposition::GetFixtureData( int nInd, string& sName, int& nId, Point3d& ptPos,
double& dAngDeg, double& dMov, string& sTaLink) const double& dAngDeg, double& dMov) const
{ {
// verifico MachMgr e GeomDB // verifico MachMgr e GeomDB
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
@@ -1483,7 +1263,6 @@ Disposition::GetFixtureData( int nInd, string& sName, int& nId, Point3d& ptPos,
ptPos = m_vFixData[nInd].ptPos ; ptPos = m_vFixData[nInd].ptPos ;
dAngDeg = m_vFixData[nInd].dAng ; dAngDeg = m_vFixData[nInd].dAng ;
dMov = m_vFixData[nInd].dMov ; dMov = m_vFixData[nInd].dMov ;
sTaLink = m_vFixData[nInd].sTaLink ;
return true ; return true ;
} }
@@ -1598,7 +1377,7 @@ Disposition::SpecialApply( bool bRecalc)
string sOut = sMsg ; string sOut = sMsg ;
if ( IsEmptyOrSpaces( sOut)) if ( IsEmptyOrSpaces( sOut))
sOut = " Error in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ; sOut = " Error in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ;
m_pMchMgr->SetLastError( 2007, sOut) ; m_pMchMgr->SetLastError( 2006, sOut) ;
return false ; return false ;
} }
// recupero eventuale warning // recupero eventuale warning
@@ -1639,21 +1418,21 @@ Disposition::SpecialUpdate( void)
return true ; return true ;
} }
// calcolo assi macchina // calcolo assi macchina
if ( ! CalculateAxesValues( "")) { if ( ! CalculateAxesValues( "", false)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ; string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty()) if ( sInfo.empty())
m_pMchMgr->SetLastError( 2008, "Error in Disposition : axes values not calculable") ; m_pMchMgr->SetLastError( 2007, "Error in Disposition : axes values not calculable") ;
else else
m_pMchMgr->SetLastError( 2009, "Error in Disposition : outstroke ") ; m_pMchMgr->SetLastError( 2008, "Error in Disposition : outstroke ") ;
return false ; return false ;
} }
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine di tutti // gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine di tutti
if ( ! AdjustStartEndMovements()) { if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ; string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty()) if ( sInfo.empty())
m_pMchMgr->SetLastError( 2010, "Error in Disposition : link movements not calculable") ; m_pMchMgr->SetLastError( 2009, "Error in Disposition : link movements not calculable") ;
else else
m_pMchMgr->SetLastError( 2011, "Error in Disposition : link outstroke ") ; m_pMchMgr->SetLastError( 2010, "Error in Disposition : link outstroke ") ;
return false ; return false ;
} }
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso // assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
+4 -31
View File
@@ -15,18 +15,6 @@
#include "Operation.h" #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 struct FixtureData
{ {
@@ -35,9 +23,8 @@ struct FixtureData
Point3d ptPos ; // posizione nel riferimento tavola Point3d ptPos ; // posizione nel riferimento tavola
double dAng ; // angolo di rotazione attorno al centro double dAng ; // angolo di rotazione attorno al centro
double dMov ; // posizione eventuale parte mobile double dMov ; // posizione eventuale parte mobile
std::string sTaLink ; // eventuale asse di tavola a cui è fissata
FixtureData( void) FixtureData( void)
: sName(), nId( GDB_ID_NULL), ptPos(), dAng( 0), dMov( 0), sTaLink() {} : sName(), nId( GDB_ID_NULL), ptPos(), dAng( 0), dMov( 0) {}
FixtureData( const std::string& sN, int nI, const Point3d& ptP, double dA, double dM) FixtureData( const std::string& sN, int nI, const Point3d& ptP, double dA, double dM)
: sName( sN), nId( nI), ptPos( ptP), dAng( dA), dMov( dM) {} : sName( sN), nId( nI), ptPos( ptP), dAng( dA), dMov( dM) {}
} ; } ;
@@ -73,14 +60,8 @@ class Disposition : public Operation
public : // Operation public : // Operation
int GetType( void) const override int GetType( void) const override
{ return OPER_DISP ; } { return OPER_DISP ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override bool IsEmpty( void) const override
{ if ( m_nShifts == 0) { return ( 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 bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; } { m_nStatus |= nModif ; return true ; }
@@ -89,8 +70,6 @@ class Disposition : public Operation
const std::string& GetHeadName( void) const override ; const std::string& GetHeadName( void) const override ;
int GetExitNbr( void) const override ; int GetExitNbr( void) const override ;
const std::string& GetToolTcPos( 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 int GetSolCh( void) const override
{ return 0 ; } { return 0 ; }
bool NeedPrevHome( void) const override ; bool NeedPrevHome( void) const override ;
@@ -109,17 +88,13 @@ class Disposition : public Operation
bool GetTableRef1( Point3d& ptRef1) const ; bool GetTableRef1( Point3d& ptRef1) const ;
bool GetTableArea1( BBox3d& b3Area1) const ; bool GetTableArea1( BBox3d& b3Area1) const ;
bool GetTableAreaOffset1( BBox3d& b3AreaOffs1) 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, int AddFixture( const std::string& sName, int nId, const Point3d& ptPos, double dAngDeg = 0,
double dMov = 0, bool bAddToList = true) ; double dMov = 0, bool bAddToList = true) ;
int GetFirstFixture( void) ; int GetFirstFixture( void) ;
int GetNextFixture( int nId) ; int GetNextFixture( int nId) ;
bool MoveFixture( int nId, const Vector3d& vtMove) ; bool MoveFixture( int nId, const Vector3d& vtMove) ;
bool RotateFixture( int nId, double dDeltaAngDeg) ; bool RotateFixture( int nId, double dDeltaAngDeg) ;
bool SetFixtureLink( int nId, const std::string& sTaLink) ;
bool MoveFixtureMobile( int nId, double dDeltaMov) ; bool MoveFixtureMobile( int nId, double dDeltaMov) ;
bool SetFixtureMobile( int nId, double dMov) ;
bool PlaceFixture( int nId, const Point3d& ptPos, double dAngDeg, double dMov) ; bool PlaceFixture( int nId, const Point3d& ptPos, double dAngDeg, double dMov) ;
bool RemoveFixture( int nId) ; bool RemoveFixture( int nId) ;
bool MoveToCornerRawPart( int nRawId, const Point3d& ptP, int nFlag, bool bAddToList = true, bool bVerify = true) ; bool MoveToCornerRawPart( int nRawId, const Point3d& ptP, int nFlag, bool bAddToList = true, bool bVerify = true) ;
@@ -129,9 +104,8 @@ class Disposition : public Operation
bool ApplyRotationToRawPart( int nRawId, double dAngCDeg, double dAngADeg, double dAngC1Deg, bool bAddToList = true) ; bool ApplyRotationToRawPart( int nRawId, double dAngCDeg, double dAngADeg, double dAngC1Deg, bool bAddToList = true) ;
bool UpdateRawPartId( int nRawId, int nNewRawId) ; bool UpdateRawPartId( int nRawId, int nNewRawId) ;
bool RemoveRawPart( int nRawId) ; 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, bool GetFixtureData( int nInd, std::string& sName, int& nId, Point3d& ptPos,
double& dAngDeg, double& dMov, std::string& sTaLink) const ; double& dAngDeg, double& dMov) const ;
bool GetMoveRawData( int nInd, int& nRawId, int& nType, Point3d& ptPos, int& nFlag) const ; bool GetMoveRawData( int nInd, int& nRawId, int& nType, Point3d& ptPos, int& nFlag) const ;
bool SpecialApply( bool bRecalc) ; bool SpecialApply( bool bRecalc) ;
bool SpecialUpdate( void) ; bool SpecialUpdate( void) ;
@@ -152,7 +126,6 @@ class Disposition : public Operation
Point3d m_ptRef1 ; // origine 1 della tavola Point3d m_ptRef1 ; // origine 1 della tavola
BBox3d m_b3Area1 ; // area utile 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) 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 FIXDATAVECTOR m_vFixData ; // elenco posizionamento bloccaggi
MVRDATAVECTOR m_vMvrData ; // elenco movimenti grezzi MVRDATAVECTOR m_vMvrData ; // elenco movimenti grezzi
std::string m_sHead ; // eventuale testa usata per muovere i pezzi std::string m_sHead ; // eventuale testa usata per muovere i pezzi
+1 -1
View File
@@ -18,7 +18,7 @@
#include <string> #include <string>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
const std::string& GetEMkVer( void) ; std::string GetEMkVer( void) ;
ILogger* GetEMkLogger( void) ; ILogger* GetEMkLogger( void) ;
const std::string& GetEMkKey( void) ; const std::string& GetEMkKey( void) ;
bool GetEMkNetHwKey( void) ; bool GetEMkNetHwKey( void) ;
+400 -1871
View File
File diff suppressed because it is too large Load Diff
+21 -68
View File
@@ -18,24 +18,15 @@
#include "ToolData.h" #include "ToolData.h"
#include "MachiningConst.h" #include "MachiningConst.h"
//----------------------------------------------------------------------------
// definizione strutture e vettori per fori, utensili e maschere
struct Hole ; struct Hole ;
struct MHDrill ; struct MHDrill ;
struct HoleInfo ; struct HoleInfo ;
struct ToolInfo ; struct ToolInfo ;
class ICurve ; class ICurve ;
typedef std::vector<MHDrill> TABMHDRILL ; typedef std::vector<std::vector<MHDrill>> TABMHDRILL ;
typedef std::vector<HoleInfo> VECTORHOLE ; typedef std::vector<HoleInfo> VECTORHOLE ;
typedef std::vector<ToolInfo> VECTORTOOL ; typedef std::vector<ToolInfo> VECTORTOOL ;
//----------------------------------------------------------------------------
// definizione tipologia foratura
const int DRILL_TYPE_ERR = 0 ;
const int DRILL_TYPE_STD = 1 ; // 1 tool
const int DRILL_TYPE_MULTI_FIXED = 2 ; // più utensili fissi
const int DRILL_TYPE_MULTI_SEL = 3 ; // più utensili selezionabili
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class Drilling : public Machining class Drilling : public Machining
{ {
@@ -51,14 +42,8 @@ class Drilling : public Machining
public : // Operation public : // Operation
int GetType( void) const override int GetType( void) const override
{ return OPER_DRILLING ; } { return OPER_DRILLING ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override bool IsEmpty( void) const override
{ if ( m_nDrillings == 0) { return ( m_nDrillings == 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 bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; } { m_nStatus |= nModif ; return true ; }
@@ -80,10 +65,9 @@ class Drilling : public Machining
bool GetParam( int nType, int& nVal) const override ; bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ; bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ; bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( void) override ; bool UpdateToolData( bool* pbChanged = nullptr) override ;
const ToolData& GetToolData( void) const override ; const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ; bool GetGeometry( SELVECTOR& vIds) const override ;
bool GetSkippedGeometry( SELVECTOR& vIds) const override ;
public : public :
Drilling( void) ; Drilling( void) ;
@@ -96,46 +80,18 @@ class Drilling : public Machining
ICurve* GetCurve( SelData Id) ; ICurve* GetCurve( SelData Id) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ; bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool GenerateHolePv( int nInd, const SelData& nCircId, const std::string& sPName, int nPvId) ; bool GenerateHolePv( int nInd, const SelData& nCircId, const std::string& sPName, int nPvId) ;
bool GenerateHoleCl( int nInd, const SelData& nCircId, const std::string& sPName, int nClId, bool GenerateHoleCl( int nInd, const SelData& nCircId, const std::string& sPName, int nClId, double dMHOff = .0, Vector3d vtAux = V_NULL) ;
double dMHOff = 0, const Vector3d& vtAux = V_NULL, int nDrillType = DRILL_TYPE_STD,
INTVECTOR* pvActiveExit = nullptr, ToolInfo* currToolData = nullptr) ;
bool AdapthPathToMainTool( int nInd, const SelData& nCircId, const std::string& sPName, int nClId,
double dMHOff, const Vector3d& vtAux, int nDrillType,
INTVECTOR* pvActiveExit, ToolData* currToolData) ;
bool GenerateHoleRegionPv( int nFirstId, int nCount, int nPvId) ; bool GenerateHoleRegionPv( int nFirstId, int nCount, int nPvId) ;
bool VerifyDiameter( double dHdiam, double dTdiam, double ddiamTol) ; bool VerifyDiameter( double dHdiam, double dTdiam, double ddiamTol) ;
bool VerifyHoleFromBottom( const Hole& hole, SelData Id) ; bool VerifyHoleFromBottom( const Hole& hole, SelData Id) ;
bool VerifyParallelDrilling( int nDouble, const Hole& hole) ; bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double nMHOff, Vector3d vtA) ;
bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double nMHOff, const Vector3d& vtA, const ToolData& currToolData) ; bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) ;
bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHOff, const Vector3d& vtA, const ToolData& currToolData) ; bool MultiHeadDrilling( const SELVECTOR& vId, int nClId, TABMHDRILL& vDrills, double& dMHOff, bool bOrd = true) ;
bool MultiHeadDrilling( const SELVECTOR& vId, int nClId, bool bFixed, TABMHDRILL& vDrills, double& dMHOff) ;
bool CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndMT, const Vector3d& vtTool, const Vector3d& vtAux) ; bool CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndMT, const Vector3d& vtTool, const Vector3d& vtAux) ;
bool CalcMaskSel( VECTORHOLE& vHoles, const VECTORTOOL& vTools, const Vector3d& vtTool, const Vector3d& vtAux) ;
bool CalcDrilledHolesByConfig( VECTORHOLE& vHoles, int nMyInd, int nIndConfig, INTVECTOR& vIndDrilled) ;
bool EraseDuplicatedConfigs( VECTORHOLE& vHoles) ;
bool KeepMinRotatedConfigs( VECTORHOLE& vHoles, const Vector3d& vtAux, const Vector3d& vtTool) ;
bool CalcMultiHeadUndrilledHoles( const VECTORHOLE& vHoles, INTVECTOR& vIdUndrilledHoles) ;
bool CalcMultiHeadPartialDrilledHoles( const TABMHDRILL& vDrills, const VECTORHOLE& vHoles, const VECTORTOOL& vTools,
const INTVECTOR& vIdUndrilledHoles, INTDBLVECTOR& vIdPartialdrilledHoles) ;
bool CheckBasedConfig( const VECTORHOLE& vHoles, int nHoleInd, int& nValidConfig, bool& bBaseCase) ;
bool GetClosestHolesToHole( const VECTORHOLE& vHoles, int nMyInd, bool bDrilled, INTVECTOR& vInds) ;
bool OrderConfigsForSelectableTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndToolMain, TABMHDRILL& vDrills) ;
bool GetConfigsWithMoreDrilledHoles( const VECTORHOLE& vHoles, INTVECTOR& vInds) ;
bool ChooseBestConfigForSelectableTools( const VECTORHOLE& vHoles, int nIndToolMain, INTVECTOR& vConfInds, int& nBestConf) ;
bool CheckOtherHolesWithTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP, bool CheckOtherHolesWithTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP,
const Frame3d& frHTM, const Frame3d& frHMTOP, double dDiamToler, int& nDrills) ; const Frame3d& frHTM, const Frame3d& frHMTOP, double dDiamToler, int& nDrills) ;
bool GetHoleBestConfig( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nInd, TABMHDRILL& tabDrills, const Vector3d& vtAux, const Vector3d& vtTool, int& nOkHole) ;
bool MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamToler, SelData Id) ; bool MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamToler, SelData Id) ;
bool MultiHeadOrderConfig( TABMHDRILL& tabDrills, const VECTORHOLE& vHoles, const Vector3d& vtTool, const Vector3d& vtAux) ; bool VerifyMultiParallelFixedDrills( void) ;
bool MultiHeadHoleToolsConfig( const VECTORHOLE& vHoles, int nConfig, INTINTVECTOR& vConfMask) ;
int VerifyMultiParallelDrills( void) ;
double GetDoubleLastStep( void) ;
/* debug functions */
void PrintConfigs( const VECTORHOLE& vHoles) ;
void PrintDescent( const MHDrill& myMHDescent) ;
/* end debug functions */
private : private :
double GetSpeed() const double GetSpeed() const
@@ -150,19 +106,16 @@ class Drilling : public Machining
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; } { return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
private : private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
DrillingData m_Params ; // parametri lavorazione DrillingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile ToolData m_TParams ; // parametri utensile
int m_nStatus ; // stato di aggiornamento della lavorazione int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nDrillings ; // numero di fori generati int m_nDrillings ; // numero di fori generati
bool m_bTiltingTab ; // flag utilizzo tavola basculante bool m_bTiltingTab ; // flag utilizzo tavola basculante
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
bool m_bAboveHead ; // flag utilizzo testa da sopra bool m_bAboveHead ; // flag utilizzo testa da sopra
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
double m_dDistBottom ; // distanza del foro dal bordo del grezzo double m_dDistBottom ; // distanza del foro dal bordo del grezzo
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
INTVECTOR m_vUndrilledId ; // vettore degli identificativi dei fori non svuotati
INTDBLVECTOR m_vPartialDrilledId ; // vettore degli identificatii dei fori lavorati parzialmente
// con profodnità mancante
} ; } ;
+10 -12
View File
@@ -31,7 +31,8 @@
const int STR_DIM = 40 ; const int STR_DIM = 40 ;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static HINSTANCE s_hModule = NULL ; static HINSTANCE s_hModule = NULL ;
static char s_szEMkNameVer[STR_DIM] ;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
extern "C" int APIENTRY extern "C" int APIENTRY
@@ -61,24 +62,21 @@ DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
const char* const char*
GetEMkVersion( void) GetEMkVersion( void)
{ {
static char s_szEMkNameVer[STR_DIM] = "" ; std::string sVer ;
if ( s_szEMkNameVer[0] == '\0') {
static std::string sVer ; GetModuleVersion( s_hModule, sVer) ;
GetModuleVersion( s_hModule, sVer) ; sprintf_s( s_szEMkNameVer, STR_DIM, "%s%s", EMK_STR, sVer.c_str()) ;
sprintf_s( s_szEMkNameVer, STR_DIM, "%s%s", EMK_STR, sVer.c_str()) ;
}
return s_szEMkNameVer ; return s_szEMkNameVer ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
const std::string& std::string
GetEMkVer( void) GetEMkVer( void)
{ {
static std::string s_sVer ; std::string sVer ;
if ( s_sVer.empty()) GetModuleVersion( s_hModule, sVer) ;
GetModuleVersion( s_hModule, s_sVer) ; return sVer ;
return s_sVer ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
BIN
View File
Binary file not shown.
+2 -2
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio 15
VisualStudioVersion = 17.12.35527.113 VisualStudioVersion = 15.0.28307.645
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EgtMachKernel", "EgtMachKernel.vcxproj", "{0BD58222-92F3-48B2-B656-4497D1956874}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EgtMachKernel", "EgtMachKernel.vcxproj", "{0BD58222-92F3-48B2-B656-4497D1956874}"
EndProject EndProject
+9 -54
View File
@@ -21,13 +21,13 @@
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{0BD58222-92F3-48B2-B656-4497D1956874}</ProjectGuid> <ProjectGuid>{0BD58222-92F3-48B2-B656-4497D1956874}</ProjectGuid>
<RootNamespace>EgtMachKernel</RootNamespace> <RootNamespace>EgtMachKernel</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v141_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
@@ -39,7 +39,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
@@ -105,7 +105,7 @@
<OpenMPSupport>false</OpenMPSupport> <OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -132,7 +132,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
<OpenMPSupport>true</OpenMPSupport> <OpenMPSupport>true</OpenMPSupport>
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions> <AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile> </ClCompile>
<Link> <Link>
@@ -167,7 +167,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration> <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<WholeProgramOptimization>false</WholeProgramOptimization> <WholeProgramOptimization>false</WholeProgramOptimization>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>false</GenerateDebugInformation> <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -202,7 +202,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations> <EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration> <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<WholeProgramOptimization>false</WholeProgramOptimization> <WholeProgramOptimization>false</WholeProgramOptimization>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions> <AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile> </ClCompile>
<Link> <Link>
@@ -237,8 +237,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="EMkDllMain.cpp" /> <ClCompile Include="EMkDllMain.cpp" />
<ClCompile Include="Estimator.cpp" /> <ClCompile Include="Estimator.cpp" />
<ClCompile Include="Exit.cpp" /> <ClCompile Include="Exit.cpp" />
<ClCompile Include="FiveAxisMilling.cpp" />
<ClCompile Include="FiveAxisMillingData.cpp" />
<ClCompile Include="Generator.cpp" /> <ClCompile Include="Generator.cpp" />
<ClCompile Include="GenMachining.cpp" /> <ClCompile Include="GenMachining.cpp" />
<ClCompile Include="GenMachiningData.cpp" /> <ClCompile Include="GenMachiningData.cpp" />
@@ -275,9 +273,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="OperationCL.cpp" /> <ClCompile Include="OperationCL.cpp" />
<ClCompile Include="Pocketing.cpp" /> <ClCompile Include="Pocketing.cpp" />
<ClCompile Include="PocketingData.cpp" /> <ClCompile Include="PocketingData.cpp" />
<ClCompile Include="PocketingNT.cpp" />
<ClCompile Include="Probing.cpp" />
<ClCompile Include="ProbingData.cpp" />
<ClCompile Include="Processor.cpp" /> <ClCompile Include="Processor.cpp" />
<ClCompile Include="SawFinishing.cpp" /> <ClCompile Include="SawFinishing.cpp" />
<ClCompile Include="SawFinishingData.cpp" /> <ClCompile Include="SawFinishingData.cpp" />
@@ -286,8 +281,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="SawRoughing.cpp" /> <ClCompile Include="SawRoughing.cpp" />
<ClCompile Include="SawRoughingData.cpp" /> <ClCompile Include="SawRoughingData.cpp" />
<ClCompile Include="SetupMgr.cpp" /> <ClCompile Include="SetupMgr.cpp" />
<ClCompile Include="SimulatorSP.cpp" /> <ClCompile Include="Simulator.cpp" />
<ClCompile Include="SimulatorMP.cpp" />
<ClCompile Include="stdafx.cpp"> <ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
@@ -297,8 +291,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="Head.cpp" /> <ClCompile Include="Head.cpp" />
<ClCompile Include="SurfFinishing.cpp" /> <ClCompile Include="SurfFinishing.cpp" />
<ClCompile Include="SurfFinishingData.cpp" /> <ClCompile Include="SurfFinishingData.cpp" />
<ClCompile Include="SurfRoughing.cpp" />
<ClCompile Include="SurfRoughingData.cpp" />
<ClCompile Include="Table.cpp" /> <ClCompile Include="Table.cpp" />
<ClCompile Include="TcPos.cpp" /> <ClCompile Include="TcPos.cpp" />
<ClCompile Include="ToolData.cpp" /> <ClCompile Include="ToolData.cpp" />
@@ -311,15 +303,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EGkArcSpecial.h" /> <ClInclude Include="..\Include\EGkArcSpecial.h" />
<ClInclude Include="..\Include\EGkBBox1d.h" /> <ClInclude Include="..\Include\EGkBBox1d.h" />
<ClInclude Include="..\Include\EGkBBox3d.h" /> <ClInclude Include="..\Include\EGkBBox3d.h" />
<ClInclude Include="..\Include\EGkBiArcs.h" /> <ClInclude Include="..\Include\EGkCDeBoxPolyhedron.h" />
<ClInclude Include="..\Include\EGkCalcPocketing.h" />
<ClInclude Include="..\Include\EGkCAvSilhouetteSurfTm.h" />
<ClInclude Include="..\Include\EGkCAvToolSurfTm.h" />
<ClInclude Include="..\Include\EGkCDeBoxClosedSurfTm.h" />
<ClInclude Include="..\Include\EGkCDeClosedSurfTmClosedSurfTm.h" />
<ClInclude Include="..\Include\EGkCDeConeFrustumClosedSurfTm.h" />
<ClInclude Include="..\Include\EGkCDeCylClosedSurfTm.h" />
<ClInclude Include="..\Include\EGkCDeSpheClosedSurfTm.h" />
<ClInclude Include="..\Include\EGkChainCurves.h" /> <ClInclude Include="..\Include\EGkChainCurves.h" />
<ClInclude Include="..\Include\EGkColor.h" /> <ClInclude Include="..\Include\EGkColor.h" />
<ClInclude Include="..\Include\EGkCurve.h" /> <ClInclude Include="..\Include\EGkCurve.h" />
@@ -327,12 +311,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EGkCurveAux.h" /> <ClInclude Include="..\Include\EGkCurveAux.h" />
<ClInclude Include="..\Include\EGkCurveComposite.h" /> <ClInclude Include="..\Include\EGkCurveComposite.h" />
<ClInclude Include="..\Include\EGkCurveLine.h" /> <ClInclude Include="..\Include\EGkCurveLine.h" />
<ClInclude Include="..\Include\EGkCurveLocal.h" />
<ClInclude Include="..\Include\EGkCurvePointDiffGeom.h" /> <ClInclude Include="..\Include\EGkCurvePointDiffGeom.h" />
<ClInclude Include="..\Include\EGkDistPointCurve.h" /> <ClInclude Include="..\Include\EGkDistPointCurve.h" />
<ClInclude Include="..\Include\EGkDistPointLine.h" />
<ClInclude Include="..\Include\EGkDistPointSurfFr.h" />
<ClInclude Include="..\Include\EGkDistPointSurfTm.h" />
<ClInclude Include="..\Include\EGkExtText.h" /> <ClInclude Include="..\Include\EGkExtText.h" />
<ClInclude Include="..\Include\EGkFrame3d.h" /> <ClInclude Include="..\Include\EGkFrame3d.h" />
<ClInclude Include="..\Include\EGkGdbConst.h" /> <ClInclude Include="..\Include\EGkGdbConst.h" />
@@ -345,14 +325,10 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EGkGeoObjType.h" /> <ClInclude Include="..\Include\EGkGeoObjType.h" />
<ClInclude Include="..\Include\EGkGeoPoint3d.h" /> <ClInclude Include="..\Include\EGkGeoPoint3d.h" />
<ClInclude Include="..\Include\EGkGeoVector3d.h" /> <ClInclude Include="..\Include\EGkGeoVector3d.h" />
<ClInclude Include="..\Include\EGkHashGrids1d.h" />
<ClInclude Include="..\Include\EGkHashGrids2d.h" /> <ClInclude Include="..\Include\EGkHashGrids2d.h" />
<ClInclude Include="..\Include\EGkIntersCurves.h" /> <ClInclude Include="..\Include\EGkIntersCurves.h" />
<ClInclude Include="..\Include\EGkIntersCurveSurfTm.h" />
<ClInclude Include="..\Include\EGkIntersLineBox.h" />
<ClInclude Include="..\Include\EGkIntersLineSurfTm.h" /> <ClInclude Include="..\Include\EGkIntersLineSurfTm.h" />
<ClInclude Include="..\Include\EGkIntersLineTria.h" /> <ClInclude Include="..\Include\EGkIntersLineTria.h" />
<ClInclude Include="..\Include\EGkIntersPlaneSurfTm.h" />
<ClInclude Include="..\Include\EGkIntervals.h" /> <ClInclude Include="..\Include\EGkIntervals.h" />
<ClInclude Include="..\Include\EGkLuaAux.h" /> <ClInclude Include="..\Include\EGkLuaAux.h" />
<ClInclude Include="..\Include\EGkMaterial.h" /> <ClInclude Include="..\Include\EGkMaterial.h" />
@@ -363,22 +339,15 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EGkPoint3d.h" /> <ClInclude Include="..\Include\EGkPoint3d.h" />
<ClInclude Include="..\Include\EGkPointGrid3d.h" /> <ClInclude Include="..\Include\EGkPointGrid3d.h" />
<ClInclude Include="..\Include\EGkPolyArc.h" /> <ClInclude Include="..\Include\EGkPolyArc.h" />
<ClInclude Include="..\Include\EGkPolygon3d.h" />
<ClInclude Include="..\Include\EGkPolygonElevation.h" />
<ClInclude Include="..\Include\EGkPolyLine.h" /> <ClInclude Include="..\Include\EGkPolyLine.h" />
<ClInclude Include="..\Include\EGkQuaternion.h" />
<ClInclude Include="..\Include\EGkSelection.h" /> <ClInclude Include="..\Include\EGkSelection.h" />
<ClInclude Include="..\Include\EGkSfrCreate.h" /> <ClInclude Include="..\Include\EGkSfrCreate.h" />
<ClInclude Include="..\Include\EGkStmFromCurves.h" /> <ClInclude Include="..\Include\EGkStmFromCurves.h" />
<ClInclude Include="..\Include\EGkStmFromTriangleSoup.h" />
<ClInclude Include="..\Include\EGkStmStandard.h" /> <ClInclude Include="..\Include\EGkStmStandard.h" />
<ClInclude Include="..\Include\EGkStringUtils3d.h" /> <ClInclude Include="..\Include\EGkStringUtils3d.h" />
<ClInclude Include="..\Include\EGkSurf.h" /> <ClInclude Include="..\Include\EGkSurf.h" />
<ClInclude Include="..\Include\EGkSurfBezier.h" />
<ClInclude Include="..\Include\EGkSurfFlatRegion.h" /> <ClInclude Include="..\Include\EGkSurfFlatRegion.h" />
<ClInclude Include="..\Include\EGkSurfLocal.h" />
<ClInclude Include="..\Include\EGkSurfTriMesh.h" /> <ClInclude Include="..\Include\EGkSurfTriMesh.h" />
<ClInclude Include="..\Include\EGkSurfTriMeshAux.h" />
<ClInclude Include="..\Include\EGkTriangle3d.h" /> <ClInclude Include="..\Include\EGkTriangle3d.h" />
<ClInclude Include="..\Include\EGkUiUnits.h" /> <ClInclude Include="..\Include\EGkUiUnits.h" />
<ClInclude Include="..\Include\EGkUserObj.h" /> <ClInclude Include="..\Include\EGkUserObj.h" />
@@ -387,7 +356,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EGkVolZmap.h" /> <ClInclude Include="..\Include\EGkVolZmap.h" />
<ClInclude Include="..\Include\EGnEgtUUID.h" /> <ClInclude Include="..\Include\EGnEgtUUID.h" />
<ClInclude Include="..\Include\EGnFileUtils.h" /> <ClInclude Include="..\Include\EGnFileUtils.h" />
<ClInclude Include="..\Include\EGnGetKeyData.h" />
<ClInclude Include="..\Include\EGnGetModuleVer.h" /> <ClInclude Include="..\Include\EGnGetModuleVer.h" />
<ClInclude Include="..\Include\EGnLuaAux.h" /> <ClInclude Include="..\Include\EGnLuaAux.h" />
<ClInclude Include="..\Include\EGnLuaMgr.h" /> <ClInclude Include="..\Include\EGnLuaMgr.h" />
@@ -402,7 +370,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EgtLibVer.h" /> <ClInclude Include="..\Include\EgtLibVer.h" />
<ClInclude Include="..\Include\EgtNumCollection.h" /> <ClInclude Include="..\Include\EgtNumCollection.h" />
<ClInclude Include="..\Include\EgtNumUtils.h" /> <ClInclude Include="..\Include\EgtNumUtils.h" />
<ClInclude Include="..\Include\EgtPerfCounter.h" />
<ClInclude Include="..\Include\EgtPointerOwner.h" /> <ClInclude Include="..\Include\EgtPointerOwner.h" />
<ClInclude Include="..\Include\EgtStringBase.h" /> <ClInclude Include="..\Include\EgtStringBase.h" />
<ClInclude Include="..\Include\EgtStringConverter.h" /> <ClInclude Include="..\Include\EgtStringConverter.h" />
@@ -430,8 +397,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="DrillingData.h" /> <ClInclude Include="DrillingData.h" />
<ClInclude Include="Estimator.h" /> <ClInclude Include="Estimator.h" />
<ClInclude Include="Exit.h" /> <ClInclude Include="Exit.h" />
<ClInclude Include="FiveAxisMilling.h" />
<ClInclude Include="FiveAxisMillingData.h" />
<ClInclude Include="Generator.h" /> <ClInclude Include="Generator.h" />
<ClInclude Include="GenMachining.h" /> <ClInclude Include="GenMachining.h" />
<ClInclude Include="GenMachiningData.h" /> <ClInclude Include="GenMachiningData.h" />
@@ -445,7 +410,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="MachiningData.h" /> <ClInclude Include="MachiningData.h" />
<ClInclude Include="MachiningDataFactory.h" /> <ClInclude Include="MachiningDataFactory.h" />
<ClInclude Include="MachiningCreate.h" /> <ClInclude Include="MachiningCreate.h" />
<ClInclude Include="MachiningRegister.h" />
<ClInclude Include="MachiningsMgr.h" /> <ClInclude Include="MachiningsMgr.h" />
<ClInclude Include="MachMgr.h" /> <ClInclude Include="MachMgr.h" />
<ClInclude Include="Milling.h" /> <ClInclude Include="Milling.h" />
@@ -454,13 +418,9 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="MortisingData.h" /> <ClInclude Include="MortisingData.h" />
<ClInclude Include="Operation.h" /> <ClInclude Include="Operation.h" />
<ClInclude Include="OperationConst.h" /> <ClInclude Include="OperationConst.h" />
<ClInclude Include="OperUserNotesConst.h" />
<ClInclude Include="OutputConst.h" /> <ClInclude Include="OutputConst.h" />
<ClInclude Include="Pocketing.h" /> <ClInclude Include="Pocketing.h" />
<ClInclude Include="PocketingData.h" /> <ClInclude Include="PocketingData.h" />
<ClInclude Include="PocketingNT.h" />
<ClInclude Include="Probing.h" />
<ClInclude Include="ProbingData.h" />
<ClInclude Include="Processor.h" /> <ClInclude Include="Processor.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<ClInclude Include="SawFinishing.h" /> <ClInclude Include="SawFinishing.h" />
@@ -473,19 +433,14 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="SetTempPhase.h" /> <ClInclude Include="SetTempPhase.h" />
<ClInclude Include="SetupMgr.h" /> <ClInclude Include="SetupMgr.h" />
<ClInclude Include="Simulator.h" /> <ClInclude Include="Simulator.h" />
<ClInclude Include="SimulatorSP.h" />
<ClInclude Include="SimulatorMP.h" />
<ClInclude Include="stdafx.h" /> <ClInclude Include="stdafx.h" />
<ClInclude Include="Head.h" /> <ClInclude Include="Head.h" />
<ClInclude Include="SurfFinishing.h" /> <ClInclude Include="SurfFinishing.h" />
<ClInclude Include="SurfFinishingData.h" /> <ClInclude Include="SurfFinishingData.h" />
<ClInclude Include="SurfRoughing.h" />
<ClInclude Include="SurfRoughingData.h" />
<ClInclude Include="Table.h" /> <ClInclude Include="Table.h" />
<ClInclude Include="TcPos.h" /> <ClInclude Include="TcPos.h" />
<ClInclude Include="ToolData.h" /> <ClInclude Include="ToolData.h" />
<ClInclude Include="ToolsMgr.h" /> <ClInclude Include="ToolsMgr.h" />
<ClInclude Include="ToolUserNotesConst.h" />
<ClInclude Include="WaterJetting.h" /> <ClInclude Include="WaterJetting.h" />
<ClInclude Include="WaterJettingData.h" /> <ClInclude Include="WaterJettingData.h" />
</ItemGroup> </ItemGroup>
+5 -140
View File
@@ -150,7 +150,7 @@
<ClCompile Include="MachMgrDBTools.cpp"> <ClCompile Include="MachMgrDBTools.cpp">
<Filter>Source Files\MachMgr</Filter> <Filter>Source Files\MachMgr</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="SimulatorSP.cpp"> <ClCompile Include="Simulator.cpp">
<Filter>Source Files\Output</Filter> <Filter>Source Files\Output</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="MachMgrPhases.cpp"> <ClCompile Include="MachMgrPhases.cpp">
@@ -234,30 +234,6 @@
<ClCompile Include="TcPos.cpp"> <ClCompile Include="TcPos.cpp">
<Filter>Source Files\Machine</Filter> <Filter>Source Files\Machine</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="FiveAxisMillingData.cpp">
<Filter>Source Files\Machinings</Filter>
</ClCompile>
<ClCompile Include="FiveAxisMilling.cpp">
<Filter>Source Files\Operations</Filter>
</ClCompile>
<ClCompile Include="SurfRoughingData.cpp">
<Filter>Source Files\Machinings</Filter>
</ClCompile>
<ClCompile Include="SurfRoughing.cpp">
<Filter>Source Files\Operations</Filter>
</ClCompile>
<ClCompile Include="SimulatorMP.cpp">
<Filter>Source Files\Output</Filter>
</ClCompile>
<ClCompile Include="PocketingNT.cpp">
<Filter>Source Files\Operations</Filter>
</ClCompile>
<ClCompile Include="ProbingData.cpp">
<Filter>Source Files\Machinings</Filter>
</ClCompile>
<ClCompile Include="Probing.cpp">
<Filter>Source Files\Operations</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="DllMain.h"> <ClInclude Include="DllMain.h">
@@ -353,7 +329,7 @@
<ClInclude Include="..\Include\EMkDispositionConst.h"> <ClInclude Include="..\Include\EMkDispositionConst.h">
<Filter>Header Files\Include</Filter> <Filter>Header Files\Include</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="SimulatorSP.h"> <ClInclude Include="Simulator.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Generator.h"> <ClInclude Include="Generator.h">
@@ -434,6 +410,9 @@
<ClInclude Include="..\Include\EGkBBox3d.h"> <ClInclude Include="..\Include\EGkBBox3d.h">
<Filter>Header Files\Include</Filter> <Filter>Header Files\Include</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\Include\EGkCDeBoxPolyhedron.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkChainCurves.h"> <ClInclude Include="..\Include\EGkChainCurves.h">
<Filter>Header Files\Include</Filter> <Filter>Header Files\Include</Filter>
</ClInclude> </ClInclude>
@@ -689,120 +668,6 @@
<ClInclude Include="..\Include\EGkBBox1d.h"> <ClInclude Include="..\Include\EGkBBox1d.h">
<Filter>Header Files\Include</Filter> <Filter>Header Files\Include</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="FiveAxisMillingData.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="FiveAxisMilling.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SurfRoughingData.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SurfRoughing.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkBiArcs.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCalcPocketing.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCAvSilhouetteSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCAvToolSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCDeBoxClosedSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCDeClosedSurfTmClosedSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCDeConeFrustumClosedSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCDeCylClosedSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCDeSpheClosedSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurveLocal.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkDistPointLine.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkDistPointSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkHashGrids1d.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkIntersCurveSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkIntersPlaneSurfTm.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPolygon3d.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPolygonElevation.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkQuaternion.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkSurfLocal.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGnGetKeyData.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtPerfCounter.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="SimulatorMP.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Simulator.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PocketingNT.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MachiningRegister.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ProbingData.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Probing.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="OperUserNotesConst.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ToolUserNotesConst.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkDistPointSurfFr.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkIntersLineBox.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkStmFromTriangleSoup.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkSurfBezier.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkSurfTriMeshAux.h">
<Filter>Header Files\Include</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="EgtMachKernel.rc"> <ResourceCompile Include="EgtMachKernel.rc">
+12 -76
View File
@@ -15,12 +15,9 @@
#include "stdafx.h" #include "stdafx.h"
#include "DllMain.h" #include "DllMain.h"
#include "Estimator.h" #include "Estimator.h"
#include "MachMgr.h" #include "Machine.h"
#include "OutputConst.h" #include "OutputConst.h"
#include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EGnGetKeyData.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/SELkKeyProc.h"
using namespace std ; using namespace std ;
@@ -48,75 +45,23 @@ Estimator::Init( MachMgr* pMchMgr)
bool bool
Estimator::Run( const string& sCncFile, const string& sInfo) Estimator::Run( const string& sCncFile, const string& sInfo)
{ {
// Controllo della licenza // emetto info di log
unsigned int nOpt1, nOpt2 ; { string sOut = "Estimator Run : " + sCncFile ;
int nOptExpDays ; LOG_INFO( GetEMkLogger(), sOut.c_str()) ; }
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( ! GetEMkNetHwKey())
nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
// Verifica della abilitazione
bool bMinTime = false ;
if ( nOptExpDays >= GetMinDay())
bMinTime = true ;
bool bCurrTime = false ;
if ( nOptExpDays >= GetCurrDay())
bCurrTime = true ;
bool bKey = false ;
if ( nRet == KEY_OK)
bKey = true ;
bool bAdvMach = false ;
if ( ( nOpt1 & KEYOPT_EMK_ADV) != 0)
bAdvMach = true ;
// Esecuzione
if ( bMinTime && bCurrTime && bKey) {
// se non previste lavorazioni avanzate, verifico la loro assenza
if ( ! bAdvMach) {
int nOpId = m_pMchMgr->GetFirstActiveOperation() ;
while ( nOpId != GDB_ID_NULL) {
int nType = m_pMchMgr->GetOperationType( nOpId) ;
if ( nType == OPER_SURFROUGHING || nType == OPER_SURFFINISHING || nType == OPER_FIVEAXISMILLING) {
m_pMchMgr->SetLastError( 1001, "ADVANCED_MACH_OFF") ;
std::string sErr = "Warning on Key (MKC/AMO)" ;
LOG_ERROR( GetEMkLogger(), sErr.c_str()) ;
return false ;
}
nOpId = m_pMchMgr->GetNextActiveOperation( nOpId) ;
}
}
// emetto info di log
{ string sOut = "Estimator Run : " + sCncFile ;
LOG_INFO( GetEMkLogger(), sOut.c_str()) ; }
// cancello l'eventuale file di uscita (e anche il file errore)
EraseFile( sCncFile) ;
string sErrFile = ChangeFileExtension( sCncFile, ERR_EXT) ;
EraseFile( sErrFile) ;
// lancio il processore
bool bOk = Processor::Run( sCncFile, sInfo) ;
// in caso di errore rinomino il file di output
if ( ! bOk)
RenameFile( sCncFile, sErrFile) ;
return bOk ;
}
// cancello l'eventuale file di uscita (e anche il file errore) // cancello l'eventuale file di uscita (e anche il file errore)
EraseFile( sCncFile) ; EraseFile( sCncFile) ;
string sErrFile = ChangeFileExtension( sCncFile, ERR_EXT) ; string sErrFile = ChangeFileExtension( sCncFile, ERR_EXT) ;
EraseFile( sErrFile) ; EraseFile( sErrFile) ;
// Generazione non abilitata // lancio il processore
m_pMchMgr->SetLastError( 1000, "NC_OFF") ; bool bOk = Processor::Run( sCncFile, sInfo) ;
std::string sErr = "Warning on Key (MKC/KYO)" ;
LOG_ERROR( GetEMkLogger(), sErr.c_str()) ; // in caso di errore rinomino il file di output
return false ; if ( ! bOk)
RenameFile( sCncFile, sErrFile) ;
return bOk ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -179,15 +124,6 @@ Estimator::CallOnTableData( void)
return m_pMachine->LuaCallFunction( ON_ESTIM_TABLE_DATA) ; return m_pMachine->LuaCallFunction( ON_ESTIM_TABLE_DATA) ;
} }
//----------------------------------------------------------------------------
bool
Estimator::CallOnTableAxisData( void)
{
if ( ! m_pMachine->LuaExistsFunction( ON_ESTIM_TABLE_AXIS_DATA))
return true ;
return m_pMachine->LuaCallFunction( ON_ESTIM_TABLE_AXIS_DATA) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Estimator::CallOnFixtureData( void) Estimator::CallOnFixtureData( void)
-1
View File
@@ -33,7 +33,6 @@ class Estimator : public Processor
bool CallOnDispositionStart( void) override ; bool CallOnDispositionStart( void) override ;
bool CallOnDispositionEnd( void) override ; bool CallOnDispositionEnd( void) override ;
bool CallOnTableData( void) override ; bool CallOnTableData( void) override ;
bool CallOnTableAxisData( void) override ;
bool CallOnFixtureData( void) override ; bool CallOnFixtureData( void) override ;
bool CallOnRawMoveData( void) override ; bool CallOnRawMoveData( void) override ;
bool CallOnToolSelect( void) override ; bool CallOnToolSelect( void) override ;
-1027
View File
File diff suppressed because it is too large Load Diff
-103
View File
@@ -1,103 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : FiveAxisMilling.h Data : 22.05.24 Versione : 2.6e5
// Contenuto : Dichiarazione della classe FiveAxisMilling.
//
//
//
// Modifiche : 22.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Machining.h"
#include "FiveAxisMillingData.h"
#include "ToolData.h"
class ICurve ;
class ICurveComposite ;
//----------------------------------------------------------------------------
class FiveAxisMilling : public Machining
{
public : // IUserObj
FiveAxisMilling* 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_FIVEAXISMILLING ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nMills == 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
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ;
public : // Machining
bool Prepare( const std::string& sMillName) override ;
bool SetParam( int nType, bool bVal) override ;
bool SetParam( int nType, int nVal) override ;
bool SetParam( int nType, double dVal) override ;
bool SetParam( int nType, const std::string& sVal) override ;
bool SetGeometry( const SELVECTOR& vIds) override ;
bool Preview( bool bRecalc) override ;
bool Apply( bool bRecalc, bool bPostApply) override ;
bool Update( bool bPostApply) override ;
bool GetParam( int nType, bool& bVal) const override ;
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
public :
FiveAxisMilling( void) ;
private :
bool MyApply( bool bRecalc, bool bPostApply) ;
bool VerifyGeometry( SelData Id, int& nSubs) ;
double GetApproxLinTol( void) const override ;
private :
double GetSpeed() const
{ return ( IsNullAngValue( m_Params.m_dSpeed) ? m_TParams.m_dSpeed : m_Params.m_dSpeed) ; }
double GetFeed() const
{ return ( IsNullLenValue( m_Params.m_dFeed) ? m_TParams.m_dFeed : m_Params.m_dFeed) ; }
double GetStartFeed() const
{ return ( IsNullLenValue( m_Params.m_dStartFeed) ? m_TParams.m_dStartFeed : m_Params.m_dStartFeed) ; }
double GetEndFeed() const
{ return ( IsNullLenValue( m_Params.m_dEndFeed) ? m_TParams.m_dEndFeed : m_Params.m_dEndFeed) ; }
double GetTipFeed() const
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
double GetOffsL() const
{ return ( IsUnknownValue( m_Params.m_dOffsL) ? m_TParams.m_dOffsL : m_Params.m_dOffsL) ; }
double GetOffsR() const
{ return ( IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; }
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
FiveAxisMillingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nMills ; // numero di percorsi di lavoro generati
bool m_bRunning ; // flag di calcoli in corso
} ;
-557
View File
@@ -1,557 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : FiveAxisMillingData.cpp Data : 22.05.24 Versione : 2.6e5
// Contenuto : Implementazione struttura dati fresatura a 5 assi.
//
//
//
// Modifiche : 22.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "FiveAxisMillingData.h"
#include "MachiningDataFactory.h"
#include "MachiningConst.h"
#include "/EgtDev/Include/EmkToolConst.h"
#include "/EgtDev/Include/EmkSimuGenConst.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include <array>
#include <cassert>
using namespace std ;
//----------------------------------------------------------------------------
enum nFiveAxisMillingKey {
KEY_AB = 0,
KEY_AI,
KEY_DH,
KEY_F,
KEY_FE,
KEY_FS,
KEY_FT,
KEY_INV,
KEY_NAME,
KEY_NNS,
KEY_NNU,
KEY_OL,
KEY_OR,
KEY_PS,
KEY_S,
KEY_SCC,
KEY_SUBTYPE,
KEY_TI,
KEY_TNAME,
KEY_TUUID,
KEY_UUID,
KEY_ZZZ} ; // rappresenta il numero di elementi
static const array<string,KEY_ZZZ> sFiveAxisMillingKey = {
"AB",
"AI",
"DH",
"F",
"FE",
"FS",
"FT",
"INV",
"NAME",
"NNS",
"NNU",
"OL",
"OR",
"PS",
"S",
"SCC",
"SUB",
"TI",
"TN",
"TU",
"UUID"} ;
//----------------------------------------------------------------------------
MCHDATA_REGISTER( MT_FIVEAXISMILLING, "FIVEAXISMILLING", FiveAxisMillingData) ;
//----------------------------------------------------------------------------
FiveAxisMillingData*
FiveAxisMillingData::Clone( void) const
{
// alloco oggetto
FiveAxisMillingData* pDdata = new(nothrow) FiveAxisMillingData ;
// copio i dati
if ( pDdata != nullptr) {
if ( ! pDdata->CopyFrom( this)) {
delete pDdata ;
return nullptr ;
}
}
return pDdata ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::CopyFrom( const MachiningData* pMdata)
{
// è inutile copiare se sorgente coincide con destinazione
if ( pMdata == this)
return true ;
// la sorgente deve essere dello stesso tipo
const FiveAxisMillingData* pFdata = GetFiveAxisMillingData( pMdata) ;
if ( pFdata == nullptr)
return false ;
// eseguo copia
m_Uuid = pFdata->m_Uuid ;
m_sName = pFdata->m_sName ;
m_ToolUuid = pFdata->m_ToolUuid ;
m_sToolName = pFdata->m_sToolName ;
m_sBlockedAxis = pFdata->m_sBlockedAxis ;
m_sInitAngs = pFdata->m_sInitAngs ;
m_nSolCh = pFdata->m_nSolCh ;
m_dSpeed = pFdata->m_dSpeed ;
m_dFeed = pFdata->m_dFeed ;
m_dEndFeed = pFdata->m_dEndFeed ;
m_dStartFeed = pFdata->m_dStartFeed ;
m_dTipFeed = pFdata->m_dTipFeed ;
m_dOffsL = pFdata->m_dOffsL ;
m_dOffsR = pFdata->m_dOffsR ;
m_bToolInvert = pFdata->m_bToolInvert ;
m_bInvert = pFdata->m_bInvert ;
m_sDepth = pFdata->m_sDepth ;
m_dStartPos = pFdata->m_dStartPos ;
m_nSubType = pFdata->m_nSubType ;
m_sSysNotes = pFdata->m_sSysNotes ;
m_sUserNotes = pFdata->m_sUserNotes ;
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::SameAs(const MachiningData* pMdata) const
{
// se coincide con altro -> uguali
if ( pMdata == this)
return true ;
// se sono di tipo diverso -> diversi
const FiveAxisMillingData* pFdata = GetFiveAxisMillingData( pMdata) ;
if ( pFdata == nullptr)
return false ;
// confronto termine a termine
return ( m_Uuid == pFdata->m_Uuid &&
m_sName == pFdata->m_sName &&
m_ToolUuid == pFdata->m_ToolUuid &&
m_sToolName == pFdata->m_sToolName &&
m_sBlockedAxis == pFdata->m_sBlockedAxis &&
m_sInitAngs == pFdata->m_sInitAngs &&
m_nSolCh == pFdata->m_nSolCh &&
abs( m_dSpeed - pFdata->m_dSpeed) < EPS_MACH_ANG_PAR &&
abs( m_dFeed - pFdata->m_dFeed) < EPS_MACH_LEN_PAR &&
abs( m_dEndFeed - pFdata->m_dEndFeed) < EPS_MACH_LEN_PAR &&
abs( m_dStartFeed - pFdata->m_dStartFeed) < EPS_MACH_LEN_PAR &&
abs( m_dTipFeed - pFdata->m_dTipFeed) < EPS_MACH_LEN_PAR &&
abs( m_dOffsL - pFdata->m_dOffsL) < EPS_MACH_LEN_PAR &&
abs( m_dOffsR - pFdata->m_dOffsR) < EPS_MACH_LEN_PAR &&
m_bToolInvert == pFdata->m_bToolInvert &&
m_bInvert == pFdata->m_bInvert &&
m_sDepth == pFdata->m_sDepth &&
abs( m_dStartPos - pFdata->m_dStartPos) < EPS_MACH_LEN_PAR &&
m_nSubType == pFdata->m_nSubType &&
m_sSysNotes == pFdata->m_sSysNotes &&
m_sUserNotes == pFdata->m_sUserNotes) ;
}
//----------------------------------------------------------------------------
int
FiveAxisMillingData::GetSize( void) const
{
// in debug verifico validità ultimo campo
assert( sFiveAxisMillingKey[KEY_UUID] == "UUID") ;
return KEY_ZZZ ;
}
//----------------------------------------------------------------------------
string
FiveAxisMillingData::GetTitle( void) const
{
return MCHDATA_GETNAME( FiveAxisMillingData) ;
}
//----------------------------------------------------------------------------
static int
FindFiveAxisMillingKey( const string& sKey)
{
auto TheRange = equal_range( sFiveAxisMillingKey.cbegin(), sFiveAxisMillingKey.cend(), sKey) ;
if ( TheRange.first == TheRange.second)
return - 1 ;
return int( TheRange.first - sFiveAxisMillingKey.cbegin()) ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::FromString( const string& sString, int& nKey)
{
// separo chiave da valore
string sKey, sVal ;
SplitFirst( sString, "=", sKey, sVal) ;
// riconosco la chiave
nKey = FindFiveAxisMillingKey( ToUpper( sKey)) ;
bool bOk = ( nKey >= 0) ;
switch ( nKey) {
case KEY_AB :
m_sBlockedAxis = sVal ;
break ;
case KEY_AI :
m_sInitAngs = sVal ;
break ;
case KEY_DH :
m_sDepth = sVal ;
if ( m_sDepth.empty())
m_sDepth = "0" ;
break ;
case KEY_F :
bOk = ::FromString( sVal, m_dFeed) ;
break ;
case KEY_FE :
bOk = ::FromString( sVal, m_dEndFeed) ;
break ;
case KEY_FS :
bOk = ::FromString( sVal, m_dStartFeed) ;
break ;
case KEY_FT :
bOk = ::FromString( sVal, m_dTipFeed) ;
break ;
case KEY_INV :
bOk = ::FromString( sVal, m_bInvert) ;
break ;
case KEY_NAME :
m_sName = sVal ;
bOk = ! m_sName.empty() ;
break ;
case KEY_NNS :
m_sSysNotes = sVal ;
break ;
case KEY_NNU :
m_sUserNotes = sVal ;
break ;
case KEY_OL :
bOk = ::FromString( sVal, m_dOffsL) ;
break ;
case KEY_OR :
bOk = ::FromString( sVal, m_dOffsR) ;
break ;
case KEY_PS :
bOk = ::FromString( sVal, m_dStartPos) ;
break ;
case KEY_S :
bOk = ::FromString( sVal, m_dSpeed) ;
break ;
case KEY_SCC :
bOk = ::FromString( sVal, m_nSolCh) ;
break ;
case KEY_SUBTYPE :
bOk = ::FromString( sVal, m_nSubType) ;
break ;
case KEY_TNAME :
m_sToolName = sVal ;
break ;
case KEY_TI :
bOk = ::FromString( sVal, m_bToolInvert) ;
break ;
case KEY_TUUID :
bOk = ::FromString( sVal, m_ToolUuid) ;
break ;
case KEY_UUID :
bOk = ::FromString( sVal, m_Uuid) ;
break ;
default :
bOk = false ;
break ;
}
return bOk ;
}
//----------------------------------------------------------------------------
string
FiveAxisMillingData::ToString( int nKey) const
{
switch ( nKey) {
case KEY_AB : return ( sFiveAxisMillingKey[KEY_AB] + "=" + m_sBlockedAxis) ;
case KEY_AI : return ( sFiveAxisMillingKey[KEY_AI] + "=" + m_sInitAngs) ;
case KEY_DH : return ( sFiveAxisMillingKey[KEY_DH] + "=" + m_sDepth) ;
case KEY_F : return ( sFiveAxisMillingKey[KEY_F] + "=" + ::ToString( m_dFeed)) ;
case KEY_FE : return ( sFiveAxisMillingKey[KEY_FE] + "=" + ::ToString( m_dEndFeed)) ;
case KEY_FS : return ( sFiveAxisMillingKey[KEY_FS] + "=" + ::ToString( m_dStartFeed)) ;
case KEY_FT : return ( sFiveAxisMillingKey[KEY_FT] + "=" + ::ToString( m_dTipFeed)) ;
case KEY_INV : return ( sFiveAxisMillingKey[KEY_INV] + "=" + ::ToString( m_bInvert)) ;
case KEY_NAME : return ( sFiveAxisMillingKey[KEY_NAME] + "=" + m_sName) ;
case KEY_NNS : return ( sFiveAxisMillingKey[KEY_NNS] + "=" + m_sSysNotes) ;
case KEY_NNU : return ( sFiveAxisMillingKey[KEY_NNU] + "=" + m_sUserNotes) ;
case KEY_OL : return ( sFiveAxisMillingKey[KEY_OL] + "=" + ::ToString( m_dOffsL)) ;
case KEY_OR : return ( sFiveAxisMillingKey[KEY_OR] + "=" + ::ToString( m_dOffsR)) ;
case KEY_PS : return ( sFiveAxisMillingKey[KEY_PS] + "=" + ::ToString( m_dStartPos)) ;
case KEY_S : return ( sFiveAxisMillingKey[KEY_S] + "=" + ::ToString( m_dSpeed)) ;
case KEY_SCC : return ( sFiveAxisMillingKey[KEY_SCC] + "=" + ::ToString( m_nSolCh)) ;
case KEY_SUBTYPE : return ( sFiveAxisMillingKey[KEY_SUBTYPE] + "=" + ::ToString( m_nSubType)) ;
case KEY_TI : return ( sFiveAxisMillingKey[KEY_TI] + "=" + ::ToString( m_bToolInvert)) ;
case KEY_TNAME : return ( sFiveAxisMillingKey[KEY_TNAME] + "=" + m_sToolName) ;
case KEY_TUUID : return ( sFiveAxisMillingKey[KEY_TUUID] + "=" + ::ToString( m_ToolUuid)) ;
case KEY_UUID : return ( sFiveAxisMillingKey[KEY_UUID] + "=" + ::ToString( m_Uuid)) ;
default : return "" ;
}
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::IsOptional( int nKey) const
{
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::VerifySolCh( int nVal) const
{
return IsValidOperationScc( nVal) ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::VerifyTool( const ToolsMgr* pToolsMgr, const string& sVal, const ToolData*& pTdata) const
{
if ( pToolsMgr == nullptr)
return false ;
pTdata = pToolsMgr->GetTool( sVal) ;
if ( pTdata == nullptr)
return false ;
if ( ( pTdata->m_nType & TF_MILL) == 0 && ( pTdata->m_nType & TF_SAWBLADE) == 0)
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const
{
if ( pToolsMgr == nullptr)
return false ;
pTdata = pToolsMgr->GetTool( m_ToolUuid) ;
return ( pTdata != nullptr) ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::SetParam( int nType, bool bVal)
{
switch ( nType) {
case MPA_INVERT :
m_bInvert = bVal ;
return true ;
case MPA_TOOLINVERT :
m_bToolInvert = bVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::SetParam( int nType, int nVal)
{
switch ( nType) {
case MPA_SCC :
if ( ! VerifySolCh( nVal))
return false ;
m_nSolCh = nVal ;
return true ;
case MPA_SUBTYPE :
m_nSubType = nVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::SetParam( int nType, double dVal)
{
switch ( nType) {
case MPA_SPEED :
m_dSpeed = dVal ;
return true ;
case MPA_FEED :
m_dFeed = dVal ;
return true ;
case MPA_STARTFEED :
m_dStartFeed = dVal ;
return true ;
case MPA_ENDFEED :
m_dEndFeed = dVal ;
return true ;
case MPA_TIPFEED :
m_dTipFeed = dVal ;
return true ;
case MPA_OFFSL :
m_dOffsL = dVal ;
return true ;
case MPA_OFFSR :
m_dOffsR = dVal ;
return true ;
case MPA_DEPTH :
m_sDepth = ::ToString( dVal) ;
return true ;
case MPA_STARTPOS :
m_dStartPos = dVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::SetParam( int nType, const string& sVal)
{
switch ( nType) {
case MPA_NAME :
m_sName = sVal ;
return true ;
case MPA_TOOL :
m_sToolName = sVal ;
return true ;
case MPA_DEPTH_STR :
m_sDepth = sVal ;
return true ;
case MPA_TUUID :
return ::FromString( sVal, m_ToolUuid) ;
case MPA_UUID :
return ::FromString( sVal, m_Uuid) ;
case MPA_SYSNOTES :
m_sSysNotes = sVal ;
return true ;
case MPA_USERNOTES :
m_sUserNotes = sVal ;
return true ;
case MPA_INITANGS :
m_sInitAngs = sVal ;
return true ;
case MPA_BLOCKEDAXIS :
m_sBlockedAxis = sVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::ResetTool( void)
{
m_sToolName.clear() ;
m_ToolUuid.Clear() ;
return true ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::GetParam( int nType, bool& bVal) const
{
switch ( nType) {
case MPA_INVERT :
bVal = m_bInvert ;
return true ;
case MPA_TOOLINVERT :
bVal = m_bToolInvert ;
return true ;
}
bVal = false ;
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::GetParam( int nType, int& nVal) const
{
switch ( nType) {
case MPA_TYPE :
nVal = MT_FIVEAXISMILLING ;
return true ;
case MPA_SCC :
nVal = m_nSolCh ;
return true ;
case MPA_SUBTYPE :
nVal = m_nSubType ;
return true ;
}
nVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::GetParam( int nType, double& dVal) const
{
switch ( nType) {
case MPA_SPEED :
dVal = m_dSpeed ;
return true ;
case MPA_FEED :
dVal = m_dFeed ;
return true ;
case MPA_STARTFEED :
dVal = m_dStartFeed ;
return true ;
case MPA_ENDFEED :
dVal = m_dEndFeed ;
return true ;
case MPA_TIPFEED :
dVal = m_dTipFeed ;
return true ;
case MPA_OFFSL :
dVal = m_dOffsL ;
return true ;
case MPA_OFFSR :
dVal = m_dOffsR ;
return true ;
case MPA_STARTPOS :
dVal = m_dStartPos ;
return true ;
}
dVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
FiveAxisMillingData::GetParam( int nType, string& sVal) const
{
switch ( nType) {
case MPA_NAME :
sVal = m_sName ;
return true ;
case MPA_TOOL :
sVal = m_sToolName ;
return true ;
case MPA_DEPTH_STR :
sVal = m_sDepth ;
return true ;
case MPA_TUUID :
sVal = ::ToString( m_ToolUuid) ;
return true ;
case MPA_UUID :
sVal = ::ToString( m_Uuid) ;
return true ;
case MPA_SYSNOTES :
sVal = m_sSysNotes ;
return true ;
case MPA_USERNOTES :
sVal = m_sUserNotes ;
return true ;
case MPA_INITANGS :
sVal = m_sInitAngs ;
return true ;
case MPA_BLOCKEDAXIS :
sVal = m_sBlockedAxis ;
return true ;
}
sVal = "" ;
return false ;
}
-76
View File
@@ -1,76 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : FiveAxisMillingData.h Data : 22.05.24 Versione : 2.6e5
// Contenuto : Dichiarazione della struct FiveAxisMillingData e costanti associate.
//
//
//
// Modifiche : 22.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "MachiningData.h"
//----------------------------------------------------------------------------
struct FiveAxisMillingData : public MachiningData
{
EgtUUID m_ToolUuid ; // identificativo universale dell'utensile
std::string m_sToolName ; // nome dell'utensile
std::string m_sInitAngs ; // angoli iniziali suggeriti (Nome1=val1,Nome2=val2)
std::string m_sBlockedAxis ; // eventuale asse rotante bloccato (Nome=val)
int m_nSolCh ; // criterio scelta soluzione (quando possibili molteplici)
double m_dSpeed ; // velocità di rotazione (+ se CCW, - se CW) ( se 0 da utensile)
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
double m_dTipFeed ; // velocità di lavorazione di sfondamento ( se 0 da utensile)
double m_dOffsR ; // offset radiale ( se UNKNOWN_PAR da utensile)
double m_dOffsL ; // offset longitudinale ( se UNKNOWN_PAR da utensile)
bool m_bToolInvert ; // flag per inversione direzione utensile da geometria
bool m_bInvert ; // flag di inversione direzione lavorazione
std::string m_sDepth ; // affondamento (espressione numerica)
double m_dStartPos ; // quota di inizio lavorazione (sempre >= 0)
int m_nSubType ; // da [GenMachining] di Ini di macchina
std::string m_sSysNotes ; // note interne
std::string m_sUserNotes ; // note dell'utente
FiveAxisMillingData( void)
: m_ToolUuid(), m_nSolCh( 0), m_dSpeed( 0), m_dFeed( 0), m_dStartFeed( 0), m_dEndFeed( 0), m_dTipFeed( 0),
m_dOffsR( 0), m_dOffsL( 0), m_bToolInvert( false), m_bInvert( false), m_dStartPos( 0), m_nSubType( 0) {}
FiveAxisMillingData* Clone( void) const override ;
bool CopyFrom( const MachiningData* pMdata) override ;
bool SameAs(const MachiningData* pMdata) const override ;
int GetType( void) const override
{ return MT_FIVEAXISMILLING ; }
int GetSize( void) const override ;
std::string GetTitle( void) const override ;
bool FromString( const std::string& sString, int& nKey) override ;
std::string ToString( int nKey) const override ;
bool IsOptional( int nKey) const override ;
bool SetParam( int nType, bool bVal) override ;
bool SetParam( int nType, int nVal) override ;
bool SetParam( int nType, double dVal) override ;
bool SetParam( int nType, const std::string& sVal) override ;
bool ResetTool( void) override ;
bool GetParam( int nType, bool& bVal) const override ;
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const override ;
bool VerifyTool( const ToolsMgr* pToolsMgr, const std::string& sVal, const ToolData*& pTdata) const override ;
bool VerifySolCh( int nVal) const ;
} ;
//----------------------------------------------------------------------------
inline const FiveAxisMillingData* GetFiveAxisMillingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_FIVEAXISMILLING)
return nullptr ;
return ( static_cast<const FiveAxisMillingData*>( pMdata)) ; }
inline FiveAxisMillingData* GetFiveAxisMillingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_FIVEAXISMILLING)
return nullptr ;
return ( static_cast<FiveAxisMillingData*>( pMdata)) ; }
+31 -80
View File
@@ -17,7 +17,6 @@
#include "DllMain.h" #include "DllMain.h"
#include "GenMachining.h" #include "GenMachining.h"
#include "OperationConst.h" #include "OperationConst.h"
#include "OperUserNotesConst.h"
#include "/EgtDev/Include/EGkCurveLine.h" #include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h" #include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h" #include "/EgtDev/Include/EGkCurveComposite.h"
@@ -40,8 +39,6 @@ using namespace std ;
// 2806 = "Error in GenMachining : link movements not calculable" // 2806 = "Error in GenMachining : link movements not calculable"
// 2807 = "Error in GenMachining : link outstroke xx" // 2807 = "Error in GenMachining : link outstroke xx"
// 2808 = "Error in GenMachining : post apply not calculable" // 2808 = "Error in GenMachining : post apply not calculable"
// 2809 = "Error in GenMachining : Tool loading failed"
// 2810 = "Error in GenMachining : special apply not calculable"
// 2851 = "Warning in GenMachining : Skipped entity (xx)" // 2851 = "Warning in GenMachining : Skipped entity (xx)"
// 2852 = "Warning in GenMachining : No machinable path" // 2852 = "Warning in GenMachining : No machinable path"
// 2853 = "Warning in GenMachining : Tool name changed (xx)" // 2853 = "Warning in GenMachining : Tool name changed (xx)"
@@ -57,8 +54,6 @@ static const string EVAR_INVERT = ".INVERT" ; // IN (bool) flag di inversio
static const string EVAR_STARTPOS = ".STARTPOS" ; // IN (num) quota di inizio lavorazione (sempre >= 0) static const string EVAR_STARTPOS = ".STARTPOS" ; // IN (num) quota di inizio lavorazione (sempre >= 0)
static const string EVAR_OFFSR = ".OFFSR" ; // IN (num) offset radiale static const string EVAR_OFFSR = ".OFFSR" ; // IN (num) offset radiale
static const string EVAR_OFFSL = ".OFFSL" ; // IN (num) offset longitudinale static const string EVAR_OFFSL = ".OFFSL" ; // IN (num) offset longitudinale
static const string EVAR_SYSNOTES = ".SYSNOTES" ; // IN (string) note interne
static const string EVAR_USERNOTES = ".USERNOTES" ;// IN (string) note dell'utente
static const string EVAR_TOOL = ".TOOL" ; // IN (string) nome dell'utensile static const string EVAR_TOOL = ".TOOL" ; // IN (string) nome dell'utensile
static const string EVAR_HEAD = ".HEAD" ; // IN (string) nome testa static const string EVAR_HEAD = ".HEAD" ; // IN (string) nome testa
static const string EVAR_EXIT = ".EXIT" ; // IN (int) indice uscita static const string EVAR_EXIT = ".EXIT" ; // IN (int) indice uscita
@@ -75,9 +70,10 @@ static const string EVAR_FEED = ".FEED" ; // IN (num) feed dell'utensil
static const string EVAR_STARTFEED = ".STARTFEED" ;// IN (num) feed di inizio dell'utensile static const string EVAR_STARTFEED = ".STARTFEED" ;// IN (num) feed di inizio dell'utensile
static const string EVAR_ENDFEED = ".ENDFEED" ; // IN (num) feed di fine dell'utensile static const string EVAR_ENDFEED = ".ENDFEED" ; // IN (num) feed di fine dell'utensile
static const string EVAR_TIPFEED = ".TIPFEED" ; // IN (num) feed di punta dell'utensile static const string EVAR_TIPFEED = ".TIPFEED" ; // IN (num) feed di punta dell'utensile
static const string EVAR_ISROBOT = ".ISROBOT" ; // IN (bool) flag per indicare che la cinematica è di tipo robot static const string EVAR_SYSNOTES = ".SYSNOTES" ; // IN (string) note interne
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok) static const string EVAR_USERNOTES = ".USERNOTES" ;// IN (string) note dell'utente
static const string EVAR_MILLS = ".MILLS" ; // OUT (int) numero di percorsi di lavoro static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
static const string EVAR_MILLS = ".MILLS" ; // OUT (int) numero di percorsi di lavoro
static const string ON_PREVIEW = "OnPreview_" ; static const string ON_PREVIEW = "OnPreview_" ;
static const string ON_APPLY = "OnApply_" ; static const string ON_APPLY = "OnApply_" ;
@@ -413,8 +409,7 @@ GenMachining::SetGeometry( const SELVECTOR& vIds)
// verifico validità gestore DB geometrico // verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// copia temporanea e reset della geometria corrente // reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ; m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce) // verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
int nType = GEO_NONE ; int nType = GEO_NONE ;
@@ -430,8 +425,7 @@ GenMachining::SetGeometry( const SELVECTOR& vIds)
m_vId.emplace_back( Id) ; m_vId.emplace_back( Id) ;
} }
// aggiorno lo stato // aggiorno lo stato
if ( m_vId != vOldId) m_nStatus |= MCH_ST_GEO_MODIF ;
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare // restituisco presenza geometria da lavorare
return ( ! m_vId.empty() || vIds.empty()) ; return ( ! m_vId.empty() || vIds.empty()) ;
} }
@@ -453,12 +447,6 @@ GenMachining::Preview( bool bRecalc)
return false ; return false ;
} }
// rendo corrente l'utensile usato nella lavorazione
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
m_pMchMgr->SetLastError( 2809, "Error in GenMachining : Tool loading failed") ;
return false ;
}
// recupero gruppo per geometria di Preview // recupero gruppo per geometria di Preview
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ; int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
@@ -503,8 +491,6 @@ GenMachining::Preview( bool bRecalc)
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSR, GetOffsR()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSR, GetOffsR()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSL, GetOffsL()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSL, GetOffsL()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
@@ -521,7 +507,8 @@ GenMachining::Preview( bool bRecalc)
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ISROBOT, m_pMchMgr->GetCurrIsRobot()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
// eseguo // eseguo
bOk = bOk && pMch->LuaCallFunction( sPreview, false) ; bOk = bOk && pMch->LuaCallFunction( sPreview, false) ;
// recupero valori parametri obbligatori // recupero valori parametri obbligatori
@@ -553,37 +540,27 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
return false ; return false ;
// aggiorno dati geometrici dell'utensile // aggiorno dati geometrici dell'utensile
if ( ! UpdateToolData()) { bool bToolChanged = true ;
if ( ! UpdateToolData( &bToolChanged)) {
m_pMchMgr->SetLastError( 2801, "Error in GenMachining : UpdateToolData failed") ; m_pMchMgr->SetLastError( 2801, "Error in GenMachining : UpdateToolData failed") ;
return false ; return false ;
} }
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento // verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) { if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione // confermo i percorsi di lavorazione
m_nMills = nCurrMills ; m_nMills = nCurrMills ;
string sLog = string( "GenMachining apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ; LOG_DBG_INFO( GetEMkLogger(), "GenMachining apply skipped : status already ok") ;
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente // eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply)) if ( ! Update( bPostApply))
return false ; return false ;
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ; LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo // esco con successo
return true ; return true ;
} }
m_nStatus = MCH_ST_TO_VERIFY ; m_nStatus = MCH_ST_TO_VERIFY ;
// rendo corrente l'utensile usato nella lavorazione
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
m_pMchMgr->SetLastError( 2809, "Error in GenMachining : Tool loading failed") ;
return false ;
}
// recupero gruppo per geometria di lavorazione (Cutter Location) // recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ; int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
@@ -628,8 +605,6 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSR, GetOffsR()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSR, GetOffsR()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSL, GetOffsL()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSL, GetOffsL()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
@@ -646,7 +621,8 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ISROBOT, m_pMchMgr->GetCurrIsRobot()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
// eseguo // eseguo
bOk = bOk && pMch->LuaCallFunction( sApply, false) ; bOk = bOk && pMch->LuaCallFunction( sApply, false) ;
// recupero valori parametri obbligatori // recupero valori parametri obbligatori
@@ -712,22 +688,9 @@ GenMachining::Update( bool bPostApply)
return false ; return false ;
} }
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni speciali
string sSpecErr ;
if ( bPostApply && ! SpecialApply( sSpecErr)) {
if ( ! IsEmptyOrSpaces( sSpecErr))
m_pMchMgr->SetLastError( 2810, sSpecErr) ;
else
m_pMchMgr->SetLastError( 2810, "Error in GenMachining : special apply not calculable") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione // gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
bool bVpl ; bool bVpl ;
if ( ! FromString( ExtractInfo( m_Params.m_sUserNotes, UN_VPL_COLON), bVpl)) if ( ! FromString( ExtractInfo( m_Params.m_sUserNotes, "Vpl:"), bVpl))
bVpl = true ; bVpl = true ;
if ( ! AdjustStartEndMovements( bVpl)) { if ( ! AdjustStartEndMovements( bVpl)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ; string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
@@ -738,11 +701,14 @@ GenMachining::Update( bool bPostApply)
return false ; return false ;
} }
// esecuzione eventuali personalizzazioni finali // assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
string sPostErr ; CalcAndSetAxesBBox() ;
if ( bPostApply && ! PostApply( sPostErr)) {
if ( ! IsEmptyOrSpaces( sPostErr)) // esecuzione eventuali personalizzazioni
m_pMchMgr->SetLastError( 2808, sPostErr) ; string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2808, sErr) ;
else else
m_pMchMgr->SetLastError( 2808, "Error in GenMachining : post apply not calculable") ; m_pMchMgr->SetLastError( 2808, "Error in GenMachining : post apply not calculable") ;
return false ; return false ;
@@ -866,20 +832,16 @@ GenMachining::GetToolData( void) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
GenMachining::UpdateToolData( void) GenMachining::UpdateToolData( bool* pbChanged)
{ {
// recupero il gestore DB utensili della macchina corrente // recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ; ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr) if ( pTMgr == nullptr)
return false ; return false ;
// recupero l'utensile nel DB utensili (se fallisce con UUID provo con il nome) // recupero l'utensile nel DB utensili
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) { if ( pTdata == nullptr)
pTdata = pTMgr->GetTool( m_Params.m_sToolName) ; return false ;
if ( pTdata == nullptr)
return false ;
m_Params.m_ToolUuid = m_TParams.m_Uuid ;
}
// salvo posizione TC, testa e uscita originali // salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ; string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ; string sOrigHead = m_TParams.m_sHead ;
@@ -917,9 +879,9 @@ GenMachining::UpdateToolData( void)
m_Params.m_sToolName + ")" ; m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 2854, sInfo) ; m_pMchMgr->SetWarning( 2854, sInfo) ;
} }
// se modificato, aggiusto lo stato // se definito parametro di ritorno, lo assegno
if ( bChanged) if ( pbChanged != nullptr)
m_nStatus = MCH_ST_TO_VERIFY ; *pbChanged = bChanged ;
return true ; return true ;
} }
@@ -986,14 +948,3 @@ GenMachining::VerifyGeometry( SelData Id, int& nSubs, int& nType)
else else
return false ; return false ;
} }
//----------------------------------------------------------------------------
double
GenMachining::GetApproxLinTol( void) const
{
double dLinTol ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_LINTOL, dLinTol))
return dLinTol ;
else
return Operation::GetApproxLinTol() ;
}
+3 -10
View File
@@ -35,14 +35,8 @@ class GenMachining : public Machining
public : // Operation public : // Operation
int GetType( void) const override int GetType( void) const override
{ return OPER_GENMACHINING ; } { return OPER_GENMACHINING ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override bool IsEmpty( void) const override
{ if ( m_nMills == 0) { return ( m_nMills == 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 bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; } { m_nStatus |= nModif ; return true ; }
@@ -64,7 +58,7 @@ class GenMachining : public Machining
bool GetParam( int nType, int& nVal) const override ; bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ; bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ; bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( void) override ; bool UpdateToolData( bool* pbChanged = nullptr) override ;
const ToolData& GetToolData( void) const override ; const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ; bool GetGeometry( SELVECTOR& vIds) const override ;
@@ -73,7 +67,6 @@ class GenMachining : public Machining
private : private :
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ; bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
double GetApproxLinTol( void) const override ;
private : private :
double GetSpeed() const double GetSpeed() const
+1 -1
View File
@@ -178,7 +178,7 @@ GenMachiningData::GetTitle( void) const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int int
FindGenMachiningKey( const string& sKey) FindGenMachiningKey( const string& sKey)
{ {
auto TheRange = equal_range( sGenMachiningKey.cbegin(), sGenMachiningKey.cend(), sKey) ; auto TheRange = equal_range( sGenMachiningKey.cbegin(), sGenMachiningKey.cend(), sKey) ;
+8 -34
View File
@@ -17,10 +17,9 @@
#include "Generator.h" #include "Generator.h"
#include "MachMgr.h" #include "MachMgr.h"
#include "OutputConst.h" #include "OutputConst.h"
#include "/EgtDev/Include/EMkDllMain.h"
#include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EGnGetKeyData.h" #include "/EgtDev/Include/EGnGetKeyData.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/SELkKeyProc.h"
using namespace std ; using namespace std ;
@@ -54,8 +53,8 @@ Generator::Run( const string& sCncFile, const string& sInfo)
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ; nOpt1, nOpt2, nOptExpDays) ;
if ( ! GetEMkNetHwKey()) if ( ! GetEMkNetHwKey())
nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, int nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ; nOpt1, nOpt2, nOptExpDays) ;
// Verifica della abilitazione // Verifica della abilitazione
bool bMinTime = false ; bool bMinTime = false ;
@@ -67,30 +66,12 @@ Generator::Run( const string& sCncFile, const string& sInfo)
bool bKey = false ; bool bKey = false ;
if ( nRet == KEY_OK) if ( nRet == KEY_OK)
bKey = true ; bKey = true ;
bool bNcOff = false ; bool bOption = false ;
if ( ( nOpt1 & KEYOPT_EMK_NC_OFF) != 0) if ( ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0)
bNcOff = true ; bOption = true ;
bool bAdvMach = false ;
if ( ( nOpt1 & KEYOPT_EMK_ADV) != 0)
bAdvMach = true ;
// Esecuzione // Esecuzione
if ( bMinTime && bCurrTime && bKey && ! bNcOff) { if ( bMinTime && bCurrTime && bKey && bOption) {
// se non previste lavorazioni avanzate, verifico la loro assenza
if ( ! bAdvMach) {
int nOpId = m_pMchMgr->GetFirstActiveOperation() ;
while ( nOpId != GDB_ID_NULL) {
int nType = m_pMchMgr->GetOperationType( nOpId) ;
if ( nType == OPER_SURFROUGHING || nType == OPER_SURFFINISHING || nType == OPER_FIVEAXISMILLING) {
m_pMchMgr->SetLastError( 1001, "ADVANCED_MACH_OFF") ;
std::string sErr = "Warning on Key (MKC/AMO)" ;
LOG_ERROR( GetEMkLogger(), sErr.c_str()) ;
return false ;
}
nOpId = m_pMchMgr->GetNextActiveOperation( nOpId) ;
}
}
// emetto info di log // emetto info di log
{ string sOut = "Generator Run : " + sCncFile ; { string sOut = "Generator Run : " + sCncFile ;
@@ -118,7 +99,7 @@ Generator::Run( const string& sCncFile, const string& sInfo)
// Generazione non abilitata // Generazione non abilitata
m_pMchMgr->SetLastError( 1000, "NC_OFF") ; m_pMchMgr->SetLastError( 1000, "NC_OFF") ;
std::string sErr = ( bNcOff ? "Warning on Key (MKC/NCO)" : "Warning on Key (MKC/KYO)") ; std::string sErr = "Warning on Key (MKC/NCO)" ;
LOG_ERROR( GetEMkLogger(), sErr.c_str()) ; LOG_ERROR( GetEMkLogger(), sErr.c_str()) ;
return false ; return false ;
} }
@@ -181,13 +162,6 @@ Generator::CallOnTableData( void)
return m_pMachine->LuaCallFunction( ON_TABLE_DATA) ; return m_pMachine->LuaCallFunction( ON_TABLE_DATA) ;
} }
//----------------------------------------------------------------------------
bool
Generator::CallOnTableAxisData( void)
{
return m_pMachine->LuaCallFunction( ON_TABLE_AXIS_DATA) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Generator::CallOnFixtureData( void) Generator::CallOnFixtureData( void)
-1
View File
@@ -33,7 +33,6 @@ class Generator : public Processor
bool CallOnDispositionStart( void) override ; bool CallOnDispositionStart( void) override ;
bool CallOnDispositionEnd( void) override ; bool CallOnDispositionEnd( void) override ;
bool CallOnTableData( void) override ; bool CallOnTableData( void) override ;
bool CallOnTableAxisData( void) override ;
bool CallOnFixtureData( void) override ; bool CallOnFixtureData( void) override ;
bool CallOnRawMoveData( void) override ; bool CallOnRawMoveData( void) override ;
bool CallOnToolSelect( void) override ; bool CallOnToolSelect( void) override ;
+3 -8
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2026 // EgalTech 2015-2015
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : GeoCalc.cpp Data : 08.05.26 Versione : 3.1e2 // File : GeoCalc.cpp Data : 12.05.15 Versione : 1.6e3
// Contenuto : Funzioni varie e speciali di calcolo geometrico. // Contenuto : Funzioni varie e speciali di calcolo geometrico.
// //
// //
@@ -14,7 +14,6 @@
//--------------------------- Include ---------------------------------------- //--------------------------- Include ----------------------------------------
#include "stdafx.h" #include "stdafx.h"
#include "GeoCalc.h" #include "GeoCalc.h"
#include "\EgtDev\Include\EGkAngle.h"
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
@@ -34,7 +33,7 @@ GetRotationComponent( const Vector3d& vtDir1, double dComp, const Vector3d& vtDi
Vector3d vtU = vtPvZW ; Vector3d vtU = vtPvZW ;
if ( ! vtU.Normalize()) { if ( ! vtU.Normalize()) {
// determino se equiversi o controversi // determino se equiversi o controversi
bool bEquiv = ( vtDir2 * vtRotAx > 0) ; bool bEquiv = ( vtDir2 * vtRotAx) > 0 ;
// se le componenti concordano, angolo indeterminato // se le componenti concordano, angolo indeterminato
if ( abs( dT0w - ( bEquiv ? dComp : - dComp)) < 0.5 * SIN_EPS_ANG_SMALL) { if ( abs( dT0w - ( bEquiv ? dComp : - dComp)) < 0.5 * SIN_EPS_ANG_SMALL) {
bDet = false ; bDet = false ;
@@ -87,10 +86,6 @@ GetRotationComponent( const Vector3d& vtDir1, double dComp, const Vector3d& vtDi
double dDeltaAngRad = acos( dNumer / dDenom) ; double dDeltaAngRad = acos( dNumer / dDenom) ;
dAng1Deg = ( dOffsAngRad + dDeltaAngRad) * RADTODEG ; dAng1Deg = ( dOffsAngRad + dDeltaAngRad) * RADTODEG ;
dAng2Deg = ( dOffsAngRad - dDeltaAngRad) * RADTODEG ; dAng2Deg = ( dOffsAngRad - dDeltaAngRad) * RADTODEG ;
if ( abs( dAng1Deg) <= abs( dAng2Deg))
dAng2Deg = AngleNearAngle( dAng2Deg, dAng1Deg) ;
else
dAng1Deg = AngleNearAngle( dAng1Deg, dAng2Deg) ;
bDet = true ; bDet = true ;
return 2 ; return 2 ;
} }
-3
View File
@@ -16,9 +16,6 @@
//----------------- Costanti generali ---------------------------------------- //----------------- Costanti generali ----------------------------------------
#include "/EgtDev/Include/EGkGeoConst.h" #include "/EgtDev/Include/EGkGeoConst.h"
//----------- Minima distanza di sicurezza ----------------------------------
const double MIN_SAFEDIST = 5.0 ;
//----------- Costanti per approssimazioni con polilinee o poliarchi -------- //----------- Costanti per approssimazioni con polilinee o poliarchi --------
const double LIN_TOL_STD = 0.1 ; const double LIN_TOL_STD = 0.1 ;
const double LIN_TOL_MID = 0.05 ; const double LIN_TOL_MID = 0.05 ;
+1 -60
View File
@@ -15,6 +15,7 @@
#include <string> #include <string>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Radice della gestione delle lavorazioni // Radice della gestione delle lavorazioni
const std::string MACH_BASE = "MachBase" ; const std::string MACH_BASE = "MachBase" ;
@@ -77,30 +78,12 @@ const std::string MACHININGS_DIR = "Machinings" ;
// Nome file delle lavorazioni // Nome file delle lavorazioni
const std::string MACHININGS_FILE = "Machinings.data" ; const std::string MACHININGS_FILE = "Machinings.data" ;
//----------------------------------------------------------------------------
// Sezione Generale nel file INI di macchina
const std::string GENERAL_SEC = "General" ;
// Chiave per materiale caratteristico
const std::string MATERIAL_KEY = "Material" ;
//----------------------------------------------------------------------------
// Sezione tastature nel file INI di macchina
const std::string PROBING_SEC = "Probing" ;
// Chiave (radice) per nome tastatura i-esima
const std::string PROBING_SCRIPT_KEY = "PrbScript" ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Sezione lavorazioni generiche nel file INI di macchina // Sezione lavorazioni generiche nel file INI di macchina
const std::string GENMACHINING_SEC = "GenMachining" ; const std::string GENMACHINING_SEC = "GenMachining" ;
// Chiave (radice) per nome lavorazione generica i-esima // Chiave (radice) per nome lavorazione generica i-esima
const std::string GENMACHINING_SCRIPT_KEY = "GenScript" ; const std::string GENMACHINING_SCRIPT_KEY = "GenScript" ;
//----------------------------------------------------------------------------
// Sezione fresature 5assi nel file INI di macchina
const std::string FIVEAXISMILLING_SEC = "5AxMilling" ;
// Chiave (radice) per nome lavorazione 5assi i-esima
const std::string FIVEAXISMILLING_SCRIPT_KEY = "5AxScript" ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Sezione di attrezzaggio nel file INI di macchina // Sezione di attrezzaggio nel file INI di macchina
const std::string SETUP_SEC = "Setup" ; const std::string SETUP_SEC = "Setup" ;
@@ -122,8 +105,6 @@ const std::string MORTISEMAKER_KEY = "MortiseMaker" ;
const std::string CHISELMAKER_KEY = "ChiselMaker" ; const std::string CHISELMAKER_KEY = "ChiselMaker" ;
// Chiave per generatore disegno waterjet // Chiave per generatore disegno waterjet
const std::string WATERJETMAKER_KEY = "WaterJetMaker" ; const std::string WATERJETMAKER_KEY = "WaterJetMaker" ;
// Chiave per generatore disegno tastatori
const std::string PROBEMAKER_KEY = "ProbeMaker" ;
// Chiave per porta utensili punte a forare (marmo) // Chiave per porta utensili punte a forare (marmo)
const std::string DRILLHOLDER_KEY = "DrillHolder" ; const std::string DRILLHOLDER_KEY = "DrillHolder" ;
// Chiave per porta utensili lame (marmo) // Chiave per porta utensili lame (marmo)
@@ -135,27 +116,6 @@ const std::string MILLHOLDER_KEY = "MillHolder" ;
// Sezione portautensili nel file INI di macchina // Sezione portautensili nel file INI di macchina
const std::string TOOLHOLDER_SEC = "ToolHolder" ; const std::string TOOLHOLDER_SEC = "ToolHolder" ;
//----------------------------------------------------------------------------
// Sezione lavorazioni nel file INI di macchina
const std::string MACHININGS_SEC = "Machinings" ;
// Chiave per abilitare discesa e risalita in rapido da fresature con estremi fuori dal grezzo
const std::string RAPIDONOUT_KEY = "RapidOnOut" ;
// Chiave per Drilling in Doppio in Parallelo
const std::string DRILLING_PARALLEL_KEY = "DrillingDoubleNT" ;
// Chiave per Pocketing in Doppio in Parallelo
const std::string POCKETING_PARALLEL_KEY = "PocketingDoubleNT" ;
// Chiave per Ottimizzazione delle Feed in PocketingNT
const std::string POCKETING_FEED_KEY = "PocketingAdjustFeedNT" ;
//----------------------------------------------------------------------------
// Tipo di Collegamento tra le lavorazioni (LinkType)
enum LINKTYPE {
LINK_NULL = 0,
LINK_HOME_TO_MACH = 1,
LINK_MACH_TO_HOME = 2,
LINK_MACH_TO_MACH = 3
} ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Minimo spessore del grezzo // Minimo spessore del grezzo
const double RAW_MIN_H = 1 ; const double RAW_MIN_H = 1 ;
@@ -163,7 +123,6 @@ const double RAW_MIN_H = 1 ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Minima feed // Minima feed
const double FEED_MIN = 1 ; const double FEED_MIN = 1 ;
constexpr double FEED_MAX_REDUCE = 5 ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Massimo angolo al centro per archi di CL // Massimo angolo al centro per archi di CL
@@ -172,7 +131,6 @@ const double MAX_ANG_CEN = 150.001 ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Tolleranza su elevazione per attacchi e uscite // Tolleranza su elevazione per attacchi e uscite
const double LIO_ELEV_TOL = 2.0 ; const double LIO_ELEV_TOL = 2.0 ;
const double LIO_ELEV_FLOAT = 10.0 ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Per FlatParts (vedi Nesting di EgtExecutor) // Per FlatParts (vedi Nesting di EgtExecutor)
@@ -182,20 +140,3 @@ const std::string NST_PARTREG_LAYER = "Region" ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Minima componente zeta di versore utensile per lavorazione da sopra (-45deg) // Minima componente zeta di versore utensile per lavorazione da sopra (-45deg)
const double MIN_ZDIR_TOP_TOOL = -0.7072 ; const double MIN_ZDIR_TOP_TOOL = -0.7072 ;
// Minima componente zeta di versore utensile per mortasatura quasi verticale (45deg)
const double MIN_ZDIR_VERT_CHSAW = 0.7072 ;
//----------------------------------------------------------------------------
// Valore di default del peso del primo asse rotante di macchina
static const double ROT1_WEIGHT_DFLT = 1 ;
// Valore di default per angolo di apertura del cono di direzioni coincidenti con singolarità
static const double SING_CONE_ANG_DFLT = 0.01 ;
//----------------------------------------------------------------------------
// Compensazione Raggio Utensile in Macchina
enum {
TOOL_COMP_PROGRAM = 0, // Compensazione Utensile da Programma
TOOL_COMP_LENGTH = 1, // Compensazione Lunghezza Utensile in Macchina
TOOL_COMP_RADIUS = 2, // Compensazione Raggio Utensile in Macchina
TOOL_COMP_LEN_AND_RAD = 3 // Compensazione Lunghezza e Raggio Utensile in Macchina
} ;
+23 -60
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2024 // EgalTech 2015-2024
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : MachMgr.h Data : 25.11.24 Versione : 2.6k5 // File : MachMgr.h Data : 02.04.24 Versione : 2.6d1
// Contenuto : Dichiarazione della classe MachMgr. // Contenuto : Dichiarazione della classe MachMgr.
// //
// //
@@ -15,8 +15,6 @@
// 28.10.23 DS Aggiunte GetClEntAxesVal e GetToolSetupPosInCurrSetup. // 28.10.23 DS Aggiunte GetClEntAxesVal e GetToolSetupPosInCurrSetup.
// 30.03.24 DS Aggiunte GetAllAxesNames e GetCalcTable. // 30.03.24 DS Aggiunte GetAllAxesNames e GetCalcTable.
// 02.04.24 DS Aggiunta GetClEntAxesMask. // 02.04.24 DS Aggiunta GetClEntAxesMask.
// 22.04.24 DS Aggiunta GetExitId.
// 25.11.24 DS Aggiunta GetMachiningSkippedGeometry.
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -123,10 +121,9 @@ class MachMgr : public IMachMgr
bool IsRawPart( int nId) const override bool IsRawPart( int nId) const override
{ return VerifyRawPart( nId) ; } { return VerifyRawPart( nId) ; }
int AddRawPart( const Point3d& ptOrig, double dLen, double dWidth, double dHeight, Color cCol) override ; int AddRawPart( const Point3d& ptOrig, double dLen, double dWidth, double dHeight, Color cCol) override ;
int AddRawPart( int nCrvSrfId, double dOverMat, Color cCol) override ;
int AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, 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, 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 ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol) override ;
bool ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dHeight) override ; bool ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dHeight) override ;
bool ModifyRawPartHeight( int nRawId, double dHeight) override ; bool ModifyRawPartHeight( int nRawId, double dHeight) override ;
bool KeepRawPart( int nRawId, int nSouPhase) override ; bool KeepRawPart( int nRawId, int nSouPhase) override ;
@@ -158,9 +155,6 @@ class MachMgr : public IMachMgr
bool GetTableAreaOffset( int nInd, BBox3d& b3AreaOffs) const override ; bool GetTableAreaOffset( int nInd, BBox3d& b3AreaOffs) const override ;
bool ChangeTable( const std::string& sTable, bool bUpdateDisp) override ; bool ChangeTable( const std::string& sTable, bool bUpdateDisp) override ;
bool ShowOnlyTable( bool bVal) 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 ; int AddFixture( const std::string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov) override ;
bool KeepFixture( int nFxtId, int nSouPhase) override ; bool KeepFixture( int nFxtId, int nSouPhase) override ;
bool RemoveFixture( int nFxtId) override ; bool RemoveFixture( int nFxtId) override ;
@@ -169,9 +163,7 @@ class MachMgr : public IMachMgr
int GetNextFixture( int nFxtId) const override ; int GetNextFixture( int nFxtId) const override ;
bool MoveFixture( int nId, const Vector3d& vtMove) override ; bool MoveFixture( int nId, const Vector3d& vtMove) override ;
bool RotateFixture( int nId, double dDeltaAngDeg) 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 MoveFixtureMobile( int nId, double dDeltaMov) override ;
bool SetFixtureMobile( int nId, double dMov) override ;
// Tools DataBase // Tools DataBase
bool TdbGetToolNewName( std::string& sName) const override ; bool TdbGetToolNewName( std::string& sName) const override ;
bool TdbAddTool( const std::string& sName, int nType) override ; bool TdbAddTool( const std::string& sName, int nType) override ;
@@ -215,11 +207,10 @@ class MachMgr : public IMachMgr
int GetCurrSetup( void) const override ; int GetCurrSetup( void) const override ;
bool GetDefaultSetupName( std::string& sName) const override ; bool GetDefaultSetupName( std::string& sName) const override ;
bool ImportSetup( const std::string& sName) override ; bool ImportSetup( const std::string& sName) override ;
bool ExistsCurrSetup( void) const override ;
bool VerifyCurrSetup( STRVECTOR& vsErrors) override ; bool VerifyCurrSetup( STRVECTOR& vsErrors) override ;
bool FindToolInCurrSetup( const std::string& sTool) const override ; bool FindToolInCurrSetup( const std::string& sTool) override ;
bool GetToolSetupPosInCurrSetup( const std::string& sTool, std::string& sTcPos) const override ; bool GetToolSetupPosInCurrSetup( const std::string& sTool, std::string& sTcPos) override ;
bool GetToolsInCurrSetupPos( const std::string& sTcPos, STRVECTOR& vsTools) const override ; bool GetToolsInCurrSetupPos( const std::string& sTcPos, STRVECTOR& vsTools) override ;
bool UpdateCurrSetup( void) override ; bool UpdateCurrSetup( void) override ;
bool EraseCurrSetup( void) override ; bool EraseCurrSetup( void) override ;
// Machinings DataBase // Machinings DataBase
@@ -260,16 +251,16 @@ class MachMgr : public IMachMgr
int GetNextOperation( int nId) const override ; int GetNextOperation( int nId) const override ;
int GetLastOperation( void) const override ; int GetLastOperation( void) const override ;
int GetPrevOperation( int nId) const override ; int GetPrevOperation( int nId) const override ;
int GetFirstActiveOperation( bool bNeedMachNotEmpty = false) const override ; int GetFirstActiveOperation( void) const override ;
int GetNextActiveOperation( int nId, bool bNeedMachNotEmpty = false) const override ; int GetNextActiveOperation( int nId) const override ;
int GetLastActiveOperation( bool bNeedMachNotEmpty = false) const override ; int GetLastActiveOperation( void) const override ;
int GetPrevActiveOperation( int nId, bool bNeedMachNotEmpty = false) const override ; int GetPrevActiveOperation( int nId) const override ;
int GetOperationType( int nId) const override ; int GetOperationType( int nId) const override ;
int GetOperationPhase( int nId) const override ; int GetOperationPhase( int nId) const override ;
bool SetOperationName( int nId, const std::string& sName) override ; bool SetOperationName( int nId, const std::string& sName) override ;
std::string GetOperationName( int nId) const override ; std::string GetOperationName( int nId) const override ;
int GetOperationId( const std::string& sName) const override ; int GetOperationId( const std::string& sName) const override ;
bool IsOperationEmpty( int nId, int nEmptyType = 0) const override ; bool IsOperationEmpty( int nId) const override ;
bool RemoveOperation( int nId) override ; bool RemoveOperation( int nId) override ;
bool RemoveAllPhaseOperations( int nPhase) override ; bool RemoveAllPhaseOperations( int nPhase) override ;
bool RemoveAllOperations( void) override ; bool RemoveAllOperations( void) override ;
@@ -287,7 +278,6 @@ class MachMgr : public IMachMgr
int GetPhaseDisposition( int nPhase) const override ; int GetPhaseDisposition( int nPhase) const override ;
bool DispositionSpecialApply( int nId, bool bRecalc) override ; bool DispositionSpecialApply( int nId, bool bRecalc) override ;
bool DispositionSpecialUpdate( int nId) override ; bool DispositionSpecialUpdate( int nId) override ;
bool GetDispositionToolData( int nId, std::string& sName, std::string& sHead, int& nExit, std::string& sTcPos) override ;
// Operations : machinings // Operations : machinings
int AddMachining( const std::string& sName, const std::string& sMachining) override ; 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 AddMachining( const std::string& sName, int nMchType, const std::string& sTool) override ;
@@ -305,33 +295,23 @@ class MachMgr : public IMachMgr
bool RemoveMachiningPreview( void) override ; bool RemoveMachiningPreview( void) override ;
bool MachiningApply( bool bRecalc, bool bPostApply = true) override ; bool MachiningApply( bool bRecalc, bool bPostApply = true) override ;
bool MachiningUpdate( bool bPostApply = true) override ; bool MachiningUpdate( bool bPostApply = true) override ;
bool ChangePreviewMachiningToolShow( int nLookFlag) override ;
bool PreparePreviewMachiningTool( void) const override ; bool PreparePreviewMachiningTool( void) const override ;
bool RemovePreviewMachiningTool( void) const override ; bool RemovePreviewMachiningTool( void) const override ;
int GetPreviewMachiningToolStepCount( void) const override ; int PreviewMachiningTool( int nEntId, int nFlag) const override ;
int PreviewMachiningTool( int nEntId, int nStep) const override ;
bool GetMachiningParam( int nType, bool& bVal) const override ; bool GetMachiningParam( int nType, bool& bVal) const override ;
bool GetMachiningParam( int nType, int& nVal) const override ; bool GetMachiningParam( int nType, int& nVal) const override ;
bool GetMachiningParam( int nType, double& dVal) const override ; bool GetMachiningParam( int nType, double& dVal) const override ;
bool GetMachiningParam( int nType, std::string& sVal) const override ; bool GetMachiningParam( int nType, std::string& sVal) const override ;
bool GetMachiningGeometry( SELVECTOR& vIds) const override ; bool GetMachiningGeometry( SELVECTOR& vIds) const override ;
bool GetMachiningSkippedGeometry( SELVECTOR& vIds) const override ; bool IsMachiningEmpty( void) const override ;
bool IsMachiningEmpty( int nEmptyType = 0) const override ;
bool GetMachiningStartPoint( Point3d& ptStart) const override ; bool GetMachiningStartPoint( Point3d& ptStart) const override ;
bool GetMachiningEndPoint( Point3d& ptEnd) 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 // CL Entities Interrogations
bool GetClEntMove( int nEntId, int& nMove) const override ; bool GetClEntMove( int nEntId, int& nMove) const override ;
bool GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const override ; bool GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const override ;
bool GetClEntIndex( int nEntId, int& nIndex) 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 GetClEntAxesMask( int nEntId, int& nMask) const override ;
bool GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) 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 // Simulation
bool SimInit( void) override ; bool SimInit( void) override ;
bool SimStart( bool bFirst) override ; bool SimStart( bool bFirst) override ;
@@ -342,7 +322,6 @@ class MachMgr : public IMachMgr
bool SimGetMoveInfo( int& nGmove, double& dFeed) const override ; bool SimGetMoveInfo( int& nGmove, double& dFeed) const override ;
bool SimSetStep( double dStep) override ; bool SimSetStep( double dStep) override ;
bool SimSetUiStatus( int nUiStatus) override ; bool SimSetUiStatus( int nUiStatus) override ;
bool SimEnableToolTipTrace( bool bEnable) override ;
bool SimGoHome( void) override ; bool SimGoHome( void) override ;
bool SimExit( void) override ; bool SimExit( void) override ;
// Generation // Generation
@@ -351,25 +330,21 @@ class MachMgr : public IMachMgr
// Machine Calc // Machine Calc
bool SetCalcTable( const std::string& sTable) override ; bool SetCalcTable( const std::string& sTable) override ;
bool SetCalcTool( const std::string& sTool, const std::string& sHead, int nExit) override ; bool SetCalcTool( const std::string& sTool, const std::string& sHead, int nExit) override ;
bool SetCalcSolCh( int nScc, bool bExact) override ; bool GetAllCurrAxesNames( STRVECTOR& vAxName) const override ;
bool SetRotAxisBlock( const std::string& sAxis, double dVal) override ; bool SetRotAxisBlock( const std::string& sAxis, double dVal) override ;
bool GetRotAxisBlocked( int nInd, std::string& sAxis, double& dVal) const override ;
bool GetCalcTable( std::string& sTable) const override ; bool GetCalcTable( std::string& sTable) const override ;
bool GetCalcTool( std::string& sTool) const override ; bool GetCalcTool( std::string& sTool) const override ;
bool GetCalcHead( std::string& sHead) const override ; bool GetCalcHead( std::string& sHead) const override ;
bool GetCalcExit( int& nExit) 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, bool GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const override ; int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const override ;
bool GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA, bool GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const override ; int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const override ;
bool GetCalcPositions( const Point3d& ptP, double dAngA, double dAngB, bool GetCalcPositions( const Point3d& ptP, double dAngA, double dAngB,
double& dX, double& dY, double& dZ) const override ; int& nStat, double& dX, double& dY, double& dZ) const override ;
bool GetCalcPositions( const Point3d& ptP, const DBLVECTOR& vAng, bool GetCalcPositions( const Point3d& ptP, const DBLVECTOR& vAng,
double& dX, double& dY, double& dZ) const override ; int& nStat, 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 GetCalcTipFromPositions( double dX, double dY, double dZ, double dAngA, double dAngB,
bool bOverall, bool bBottom, Point3d& ptTip) const override ; bool bOverall, bool bBottom, Point3d& ptTip) const override ;
bool GetCalcTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool GetCalcTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
@@ -379,7 +354,6 @@ class MachMgr : public IMachMgr
bool GetNearestAngleInStroke( int nInd, double dAngRef, double& dAng) const override ; bool GetNearestAngleInStroke( int nInd, double dAngRef, double& dAng) const override ;
bool LimitAngleToStroke( int nInd, 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, 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 ; std::string GetOutstrokeInfo( bool bMM = true) const override ;
// Machine // Machine
int GetBaseId( const std::string& sBase) const override ; int GetBaseId( const std::string& sBase) const override ;
@@ -387,11 +361,9 @@ class MachMgr : public IMachMgr
int GetAxisId( const std::string& sAxis) const override ; int GetAxisId( const std::string& sAxis) const override ;
int GetHeadId( const std::string& sHead) const override ; int GetHeadId( const std::string& sHead) const override ;
int GetHeadExitCount( 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 ; int GetTcPosId( const std::string& sTcPos) const override ;
bool GetAxisToken( const std::string& sAxis, std::string& sToken) const override ; bool GetAxisToken( const std::string& sAxis, std::string& sToken) const override ;
bool GetAxisType( const std::string& sAxis, bool& bLinear) 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 GetAxisInvert( const std::string& sAxis, bool& bInvert) const override ;
bool GetAxisOffset( const std::string& sAxis, double& dOffset) 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 SetAxisPos( const std::string& sAxis, double dVal, double* pdNewVal = nullptr) override ;
@@ -472,10 +444,8 @@ class MachMgr : public IMachMgr
int GetCurrRotAxes( void) const ; int GetCurrRotAxes( void) const ;
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ; bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
bool GetCurrAxisHomePos( int nInd, double& dHome) 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 ; const Frame3d& GetCurrLinAxesFrame( void) const ;
bool GetCurrIsMcent( void) const ; bool GetCurrIsCenter( void) const ;
bool GetCurrIsRobot( void) const ; bool GetCurrIsRobot( void) const ;
bool ApplyRotAxisBlock( void) ; bool ApplyRotAxisBlock( void) ;
void ClearRotAxisBlock( void) void ClearRotAxisBlock( void)
@@ -487,28 +457,22 @@ class MachMgr : public IMachMgr
double GetCalcRot1W( void) const ; double GetCalcRot1W( void) const ;
bool GetCalcMaxDeltaR2OnFirst( void) const ; bool GetCalcMaxDeltaR2OnFirst( void) const ;
bool GetCalcPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const ; bool GetCalcPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const ;
bool SetCalcSolCh( int nScc, bool bExact) ;
bool VerifyAngleOutstroke( int nInd, double dAng) const ; bool VerifyAngleOutstroke( int nInd, double dAng) const ;
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const ;
bool ExistProtectedAreas( void) const ; bool ExistProtectedAreas( void) const ;
// Operations // Operations
bool GetOperationNewName( std::string& sName) const ; bool GetOperationNewName( std::string& sName) const ;
const ToolData* GetMachiningToolData( void) const ; const ToolData* GetMachiningToolData( void) const ;
// Simulation // Simulation
bool SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, bool SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
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 SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
bool SimOnCollision( int nCdInd, int nObjInd, int& nErr) ; bool SimOnCollision( int nCdInd, int nObjInd, int& nErr) ;
bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag, bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst) ;
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) ;
bool SimEnableToolsForVmill( bool bEnable) ;
int SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ; int SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ;
bool SimSaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) ;
// Machine // 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 ; bool GetHeadAbove( const std::string& sHead) const ;
double GetDeltaSafeZ( const std::string& sHead) const ;
double GetAngDeltaMinForHome( void) const ; double GetAngDeltaMinForHome( void) const ;
private : private :
@@ -538,7 +502,6 @@ class MachMgr : public IMachMgr
int AddRawPart( int nSurfUpId, int nSurfDownId, double dHeight, Color cCol) ; int AddRawPart( int nSurfUpId, int nSurfDownId, double dHeight, Color cCol) ;
bool SetRawPartCenter( int nRawId) ; bool SetRawPartCenter( int nRawId) ;
bool ResetRawPartCenter( int nRawId) ; bool ResetRawPartCenter( int nRawId) ;
bool UpdateRawOutline( int nRawId) ;
// Parts // Parts
bool SwapParts( bool bToRawPart) ; bool SwapParts( bool bToRawPart) ;
bool SwapRawPartParts( int nRawId, bool bToRawPart) ; bool SwapRawPartParts( int nRawId, bool bToRawPart) ;
@@ -583,5 +546,5 @@ class MachMgr : public IMachMgr
int m_nCurrDispId ; // identificativo della disposizione corrente int m_nCurrDispId ; // identificativo della disposizione corrente
int m_nCurrMachiningId ; // identificativo della lavorazione corrente int m_nCurrMachiningId ; // identificativo della lavorazione corrente
AXBLOCKVECTOR m_vAxisBlock ; // elenco assi da bloccare AXBLOCKVECTOR m_vAxisBlock ; // elenco assi da bloccare
ISimulator* m_pSimul ; // puntatore al simulatore attivo Simulator* m_pSimul ; // puntatore al simulatore attivo
} ; } ;
+1 -8
View File
@@ -16,7 +16,6 @@
#include "MachMgr.h" #include "MachMgr.h"
#include "MachConst.h" #include "MachConst.h"
#include "DllMain.h" #include "DllMain.h"
#include "MachiningRegister.h"
#include "/EgtDev/Include/EMkDllMain.h" #include "/EgtDev/Include/EMkDllMain.h"
#include "/EgtDev/Include/EGnStringUtils.h" #include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnFileUtils.h"
@@ -33,8 +32,6 @@ CreateMachMgr( void)
// verifico la chiave e le opzioni // verifico la chiave e le opzioni
if ( ! GetEMkNetHwKey() && ! TestKeyForEMk( GetEMkKey(), 0, GetEMkLogger())) if ( ! GetEMkNetHwKey() && ! TestKeyForEMk( GetEMkKey(), 0, GetEMkLogger()))
return nullptr ; return nullptr ;
// registro classe operazione per pocketing
RegisterPocketing() ;
// creo il MachMgr // creo il MachMgr
return static_cast<IMachMgr*> ( new(nothrow) MachMgr) ; return static_cast<IMachMgr*> ( new(nothrow) MachMgr) ;
} }
@@ -314,11 +311,7 @@ MachMgr::SetLastError( int nErr, const string& sErr)
{ {
m_nLastError = nErr ; m_nLastError = nErr ;
m_sLastError = sErr ; m_sLastError = sErr ;
string sInfo ; string sInfo = m_sLastError + " (" + ToString( nErr) + ")" ;
if ( sErr._Starts_with( "Error"))
sInfo = m_sLastError + " (" + ToString( nErr) + ")" ;
else
sInfo = "Error " + ToString( nErr) + " : " + m_sLastError ;
LOG_ERROR( GetEMkLogger(), sInfo.c_str()) ; LOG_ERROR( GetEMkLogger(), sInfo.c_str()) ;
return true ; return true ;
} }
+1 -92
View File
@@ -2,7 +2,7 @@
// EgalTech 2019-2023 // EgalTech 2019-2023
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : MachMgrClEntities.cpp Data : 27.10.23 Versione : 2.5j4 // File : MachMgrClEntities.cpp Data : 27.10.23 Versione : 2.5j4
// Contenuto : Implementazione interrogazione entità CL della classe MachMgr. // Contenuto : Implementazione interrogazione entità CL della classe MachMgr.
// //
// //
// //
@@ -16,7 +16,6 @@
#include "DllMain.h" #include "DllMain.h"
#include "MachMgr.h" #include "MachMgr.h"
#include "MachConst.h" #include "MachConst.h"
#include "CamData.h"
using namespace std ; using namespace std ;
@@ -76,42 +75,6 @@ MachMgr::GetClEntIndex( int nEntId, int& nIndex) const
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntFeed( int nEntId, double& dFeed) const
{
// default
dFeed = 0 ;
// verifico validita GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero l'oggetto CamData
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero la feed
dFeed = pCamData->GetFeed() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntAxesStatus( int nEntId, int& nStatus) const
{
// default
nStatus = 0 ;
// verifico validita GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero l'oggetto CamData
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero il tipo di movimento
nStatus = pCamData->GetAxesStatus() ;
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::GetClEntAxesMask( int nEntId, int& nMask) const MachMgr::GetClEntAxesMask( int nEntId, int& nMask) const
@@ -147,57 +110,3 @@ MachMgr::GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const
vAxes = pCamData->GetAxesVal() ; vAxes = pCamData->GetAxesVal() ;
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntTDir( int nEntId, Vector3d& vtTDir) const
{
// default
vtTDir = V_NULL ;
// verifico validità GeomBD
if ( m_pGeomDB == nullptr)
return false ;
// recupero l'oggetto CamData
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero TDir
vtTDir = pCamData->GetToolDir() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntCDir( int nEntId, Vector3d& vtCDir) const
{
// default
vtCDir = V_NULL ;
// verifico validità GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero l'oggetto CamData
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero CDir
vtCDir = pCamData->GetCorrDir() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntADir( int nEntId, Vector3d& vtADir) const
{
// default
vtADir = V_NULL ;
// verifico validità GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero l'oggetto CamData
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero ADir
vtADir = pCamData->GetAuxDir() ;
return true ;
}
+1 -24
View File
@@ -15,7 +15,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "DllMain.h" #include "DllMain.h"
#include "MachMgr.h" #include "MachMgr.h"
#include "ToolUserNotesConst.h"
#include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtIniFile.h" #include "/EgtDev/Include/EgtIniFile.h"
@@ -652,8 +651,6 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
pTdata->GetParam( TPA_TIPFEED, dTipFeed) ; pTdata->GetParam( TPA_TIPFEED, dTipFeed) ;
string sUserNotes ; string sUserNotes ;
pTdata->GetParam( TPA_USERNOTES, sUserNotes) ; pTdata->GetParam( TPA_USERNOTES, sUserNotes) ;
string sSysNotes ;
pTdata->GetParam( TPA_SYSNOTES, sSysNotes) ;
// Recupero la path dell'eventuale portautensile // Recupero la path dell'eventuale portautensile
string sThPath = GetToolHolderPath( sHeadName, nExit, nType, sUserNotes) ; string sThPath = GetToolHolderPath( sHeadName, nExit, nType, sUserNotes) ;
// Carico generatore disegno utensile // Carico generatore disegno utensile
@@ -670,8 +667,6 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
bool bOk = ExeLuaSetGlobIntVar( "TOOL.TYPE", nType) ; bool bOk = ExeLuaSetGlobIntVar( "TOOL.TYPE", nType) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TIPFEED", dTipFeed) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TIPFEED", dTipFeed) ;
bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.USERNOTES", sUserNotes) ;
bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.SYSNOTES", sSysNotes) ;
switch ( nType) { switch ( nType) {
case TT_DRILL_STD : case TT_DRILL_STD :
case TT_DRILL_LONG : case TT_DRILL_LONG :
@@ -716,15 +711,6 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.THICK", dThick) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.THICK", dThick) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.CORNRAD", dCornRad) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.CORNRAD", dCornRad) ;
break ; break ;
case TT_PROBE :
bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.TOOLHOLDER", sThPath) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TOTLEN", dTotLen) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.STEMDIAM", dStemDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.HEIGHT", dThick) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.CORNRAD", dCornRad) ;
break ;
default : default :
return TD_INT_ERR ; return TD_INT_ERR ;
} }
@@ -776,8 +762,6 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx
pTdata->GetParam( TPA_DIST, dDist) ; pTdata->GetParam( TPA_DIST, dDist) ;
double dSpeed = 0 ; double dSpeed = 0 ;
pTdata->GetParam( TPA_SPEED, dSpeed) ; pTdata->GetParam( TPA_SPEED, dSpeed) ;
string sUserNotes ;
pTdata->GetParam( TPA_USERNOTES, sUserNotes) ;
// Imposto contesto per il disegno utensile // Imposto contesto per il disegno utensile
if ( ! ExeSetCurrentContext( nToolCtx)) if ( ! ExeSetCurrentContext( nToolCtx))
return TD_INT_ERR ; return TD_INT_ERR ;
@@ -788,7 +772,6 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIST", dDist) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIST", dDist) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ;
bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.USERNOTES", sUserNotes) ;
// Eseguo aggiornamento utensile // Eseguo aggiornamento utensile
bOk = bOk && ExeLuaCallFunction( "AdjustCustomTool") ; bOk = bOk && ExeLuaCallFunction( "AdjustCustomTool") ;
// Recupero errore // Recupero errore
@@ -821,8 +804,6 @@ MachMgr::GetToolMakerKeyFromType( int nType) const
return WATERJETMAKER_KEY ; return WATERJETMAKER_KEY ;
case TT_COMPO : case TT_COMPO :
return "" ; return "" ;
case TT_PROBE :
return PROBEMAKER_KEY ;
} }
return "" ; return "" ;
} }
@@ -864,10 +845,6 @@ MachMgr::GetToolHolderPath( const string& sHeadName, int nExit, int nType, const
string sKey2 = sKey + ":MILL_POLISHING" ; string sKey2 = sKey + ":MILL_POLISHING" ;
sToolHolder = GetPrivateProfileStringUtf8( TOOLHOLDER_SEC.c_str(), sKey2.c_str(), "", sMachIni.c_str()) ; sToolHolder = GetPrivateProfileStringUtf8( TOOLHOLDER_SEC.c_str(), sKey2.c_str(), "", sMachIni.c_str()) ;
} }
else if ( nType == TT_PROBE) {
string sKey2 = sKey + ":PROBE" ;
sToolHolder = GetPrivateProfileStringUtf8( TOOLHOLDER_SEC.c_str(), sKey2.c_str(), "", sMachIni.c_str()) ;
}
if ( sToolHolder.empty()) if ( sToolHolder.empty())
sToolHolder = GetPrivateProfileStringUtf8( TOOLHOLDER_SEC.c_str(), sKey.c_str(), "", sMachIni.c_str()) ; sToolHolder = GetPrivateProfileStringUtf8( TOOLHOLDER_SEC.c_str(), sKey.c_str(), "", sMachIni.c_str()) ;
// Se non trovato, provo da sezione Tools di Ini di macchina // Se non trovato, provo da sezione Tools di Ini di macchina
@@ -882,7 +859,7 @@ MachMgr::GetToolHolderPath( const string& sHeadName, int nExit, int nType, const
// Verifico se sovrascritto da nota dell'utensile // Verifico se sovrascritto da nota dell'utensile
string sVal ; string sVal ;
if ( ! sUserNotes.empty() && if ( ! sUserNotes.empty() &&
GetValInNotes( sUserNotes, TUN_TH, sVal) && GetValInNotes( sUserNotes, "TH", sVal) &&
ExistsFile( sToolHolderDir + "\\" + sVal)) ExistsFile( sToolHolderDir + "\\" + sVal))
sToolHolder = sVal ; sToolHolder = sVal ;
// Se non trovato ancora, esco // Se non trovato ancora, esco
+4 -75
View File
@@ -135,52 +135,6 @@ MachMgr::ShowOnlyTable( bool bVal)
return pMch->SetLook( bVal ? MCH_LOOK_TAB : MCH_LOOK_ALL) ; return pMch->SetLook( bVal ? MCH_LOOK_TAB : MCH_LOOK_ALL) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::MoveDispAxis( const string& sName, double dPos)
{
// recupero l'oggetto disposizione corrente
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
if ( pDisp == nullptr)
return GDB_ID_NULL ;
// eseguo l'operazione
return pDisp->MoveAxis( sName, dPos) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::RemoveDispAxis( const string& sName)
{
// recupero l'oggetto disposizione corrente
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
if ( pDisp == nullptr)
return GDB_ID_NULL ;
// eseguo l'operazione
return pDisp->RemoveAxis( sName) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::KeepAllDispAxes( int nSouPhase)
{
// se fase di origine non definita o uguale alla corrente, esco con successo
if ( nSouPhase == 0 || nSouPhase == m_nCurrPhase)
return true ;
// copio il posizionamento
Disposition* pSouDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( nSouPhase))) ;
Disposition* pDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( m_nCurrPhase))) ;
if ( pSouDisp == nullptr || pDisp == nullptr)
return false ;
for ( int i = 0 ; ; ++ i) {
string sName ; double dPos ;
if ( pSouDisp->GetMoveAxisData( i, sName, dPos))
pDisp->MoveAxis( sName, dPos) ;
else
break ;
}
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
MachMgr::AddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov) MachMgr::AddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov)
@@ -204,8 +158,8 @@ MachMgr::KeepFixture( int nFxtId, int nSouPhase)
// se fase corrente già presente, non devo fare alcunché // se fase corrente già presente, non devo fare alcunché
if ( find( vPhase.begin(), vPhase.end(), m_nCurrPhase) != vPhase.end()) if ( find( vPhase.begin(), vPhase.end(), m_nCurrPhase) != vPhase.end())
return true ; return true ;
// se fase di origine non definita o uguale alla corrente, esco con successo // se fase di origine non definita, esco con successo
if ( nSouPhase == 0 || nSouPhase == m_nCurrPhase) if ( nSouPhase == 0)
return true ; return true ;
// copio il posizionamento // copio il posizionamento
Disposition* pSouDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( nSouPhase))) ; Disposition* pSouDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( nSouPhase))) ;
@@ -213,11 +167,10 @@ MachMgr::KeepFixture( int nFxtId, int nSouPhase)
if ( pSouDisp == nullptr || pDisp == nullptr) if ( pSouDisp == nullptr || pDisp == nullptr)
return false ; return false ;
for ( int i = 0 ; ; ++ i) { for ( int i = 0 ; ; ++ i) {
string sName ; int nId ; Point3d ptPos ; double dAngDeg ; double dMov ; string sTaLink ; string sName ; int nId ; Point3d ptPos ; double dAngDeg ; double dMov ;
if ( pSouDisp->GetFixtureData( i, sName, nId, ptPos, dAngDeg, dMov, sTaLink)) { if ( pSouDisp->GetFixtureData( i, sName, nId, ptPos, dAngDeg, dMov)) {
if ( nId == nFxtId) { if ( nId == nFxtId) {
pDisp->AddFixture( sName, nId, ptPos, dAngDeg, dMov) ; pDisp->AddFixture( sName, nId, ptPos, dAngDeg, dMov) ;
pDisp->SetFixtureLink( nId, sTaLink) ;
break ; break ;
} }
} }
@@ -301,18 +254,6 @@ MachMgr::RotateFixture( int nId, double dDeltaAngDeg)
return pDisp->RotateFixture( nId, 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 bool
MachMgr::MoveFixtureMobile( int nId, double dDeltaMov) MachMgr::MoveFixtureMobile( int nId, double dDeltaMov)
@@ -325,18 +266,6 @@ MachMgr::MoveFixtureMobile( int nId, double dDeltaMov)
return pDisp->MoveFixtureMobile( nId, dDeltaMov) ; return pDisp->MoveFixtureMobile( nId, dDeltaMov) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::SetFixtureMobile( int nId, double dMov)
{
// recupero l'oggetto disposizione corrente
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
if ( pDisp == nullptr)
return false ;
// eseguo l'operazione
return pDisp->SetFixtureMobile( nId, dMov) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::VerifyFixtureInGroup( int nFxtId, bool bLinkedAllowed) const MachMgr::VerifyFixtureInGroup( int nFxtId, bool bLinkedAllowed) const
+2 -10
View File
@@ -18,7 +18,6 @@
#include "MachConst.h" #include "MachConst.h"
#include "Generator.h" #include "Generator.h"
#include "Estimator.h" #include "Estimator.h"
#include "/EgtDev/Include/EGnFileUtils.h"
using namespace std ; using namespace std ;
@@ -26,13 +25,6 @@ using namespace std ;
bool bool
MachMgr::Generate( const string& sCncFile, const string& sInfo) MachMgr::Generate( const string& sCncFile, const string& sInfo)
{ {
// se macchina multiprocesso è necessaria stima speciale
if ( GetCurrMachine() != nullptr && GetCurrMachine()->GetMultiProcess()) {
string sEstFile = ChangeFileExtension( sCncFile, "sest") ;
if ( ! Estimate( sEstFile, sInfo))
return false ;
}
// inizializzazione generatore // inizializzazione generatore
Generator genPP ; Generator genPP ;
if ( ! genPP.Init( this)) { if ( ! genPP.Init( this)) {
@@ -52,13 +44,13 @@ MachMgr::Generate( const string& sCncFile, const string& sInfo)
bool bool
MachMgr::Estimate( const string& sEstFile, const string& sInfo) MachMgr::Estimate( const string& sEstFile, const string& sInfo)
{ {
// inizializzazione stimatore // inizializzazione generatore
Estimator estPP ; Estimator estPP ;
if ( ! estPP.Init( this)) { if ( ! estPP.Init( this)) {
LOG_ERROR( GetEMkLogger(), "Error on Estimate Init") LOG_ERROR( GetEMkLogger(), "Error on Estimate Init")
return false ; return false ;
} }
// esecuzione della stima // esecuzione della generazione
if ( ! estPP.Run( sEstFile, sInfo)) { if ( ! estPP.Run( sEstFile, sInfo)) {
LOG_ERROR( GetEMkLogger(), "Error on Estimate Run") LOG_ERROR( GetEMkLogger(), "Error on Estimate Run")
return false ; return false ;
+1 -3
View File
@@ -387,10 +387,8 @@ MachMgr::SetCurrMachGroup( int nId)
// aggiorno attrezzaggio attivo // aggiorno attrezzaggio attivo
UpdateCurrSetup() ; UpdateCurrSetup() ;
// imposto la prima fase come corrente // imposto la prima fase come corrente
if ( ! SetCurrPhase( 1)) { if ( ! SetCurrPhase( 1))
ResetCurrMachGroup() ;
return false ; return false ;
}
// nascondo i pezzi rimasti sotto la radice // nascondo i pezzi rimasti sotto la radice
ShowRootParts( false) ; ShowRootParts( false) ;
// rendo visibile il nuovo gruppo corrente e la relativa macchina // rendo visibile il nuovo gruppo corrente e la relativa macchina
+26 -95
View File
@@ -210,8 +210,8 @@ MachMgr::GetCurrMachiningsMgr( void) const
// se DB lavorazioni non esiste, provo a crearlo e caricarlo // se DB lavorazioni non esiste, provo a crearlo e caricarlo
if ( m_vMachines[m_nCurrMch].pMsMgr == nullptr) { if ( m_vMachines[m_nCurrMch].pMsMgr == nullptr) {
PtrOwner<MachiningsMgr> pMsMgr( new( nothrow) MachiningsMgr) ; PtrOwner<MachiningsMgr> pMsMgr( new( nothrow) MachiningsMgr) ;
string sMachsDir = m_vMachines[m_nCurrMch].sDir + "\\" + MACHININGS_DIR ; string sMachsFile = m_vMachines[m_nCurrMch].sDir + "\\" + MACHININGS_DIR + "\\" + MACHININGS_FILE ;
if ( IsNull( pMsMgr) || ! pMsMgr->Load( sMachsDir, MACHININGS_FILE, GetCurrToolsMgr())) if ( IsNull( pMsMgr) || ! pMsMgr->Load( sMachsFile, GetCurrToolsMgr()))
return nullptr ; return nullptr ;
// salvo nel vettore // salvo nel vettore
const_cast<MachineData&>( m_vMachines[m_nCurrMch]).pMsMgr = Release( pMsMgr) ; const_cast<MachineData&>( m_vMachines[m_nCurrMch]).pMsMgr = Release( pMsMgr) ;
@@ -274,15 +274,6 @@ MachMgr::GetHeadExitCount( const string& sHead) const
return ( ( pMch != nullptr) ? pMch->GetHeadExitCount( sHead) : 0) ; return ( ( pMch != nullptr) ? pMch->GetHeadExitCount( sHead) : 0) ;
} }
//----------------------------------------------------------------------------
int
MachMgr::GetExitId( const string& sHead, int nExit) const
{
Machine* pMch = GetCurrMachine() ;
// recupero identificativo dell'uscita della testa indicata nella macchina corrente
return ( ( pMch != nullptr) ? pMch->GetExitId( sHead, nExit) : GDB_ID_NULL) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
MachMgr::GetTcPosId( const string& sTcPos) const MachMgr::GetTcPosId( const string& sTcPos) const
@@ -303,6 +294,18 @@ MachMgr::GetHeadAbove( const string& sHead) const
return ( ! m_pGeomDB->GetInfo( GetHeadId( sHead), MCH_ABOVE, bAbove) || bAbove) ; return ( ! m_pGeomDB->GetInfo( GetHeadId( sHead), MCH_ABOVE, bAbove) || bAbove) ;
} }
//----------------------------------------------------------------------------
double
MachMgr::GetDeltaSafeZ( const string& sHead) const
{
if ( m_pGeomDB == nullptr)
return 0 ;
// Leggo da testa Info ZSAFEDELTA
double dDeltaSafeZ = 0 ;
m_pGeomDB->GetInfo( GetHeadId( sHead), MCH_ZSAFEDELTA, dDeltaSafeZ) ;
return dDeltaSafeZ ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
double double
MachMgr::GetAngDeltaMinForHome( void) const MachMgr::GetAngDeltaMinForHome( void) const
@@ -330,15 +333,6 @@ MachMgr::GetAxisType( const string& sAxis, bool& bLinear) const
return ( ( pMch != nullptr) ? pMch->GetAxisType( sAxis, bLinear) : false) ; return ( ( pMch != nullptr) ? pMch->GetAxisType( sAxis, bLinear) : false) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::GetAxisDir( const string& sAxis, Vector3d& vtDir) const
{
Machine* pMch = GetCurrMachine() ;
// restituisco la direzione dell'asse indicato nella macchina corrente
return ( ( pMch != nullptr) ? pMch->GetAxisDir( sAxis, vtDir) : false) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::GetAxisInvert( const string& sAxis, bool& bInvert) const MachMgr::GetAxisInvert( const string& sAxis, bool& bInvert) const
@@ -405,27 +399,12 @@ MachMgr::ResetAxisPos( const string& sAxis)
return ( ( pMch != nullptr) ? pMch->ResetAxisPos( sAxis) : false) ; return ( ( pMch != nullptr) ? pMch->ResetAxisPos( sAxis) : false) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::IsDispositionAxis( const string& sAxis, const string& sTable) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->IsDispositionAxis( sAxis, sTable) : false) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::ResetAllAxesPos( void) MachMgr::ResetAllAxesPos( void)
{
return ResetAllAxesPos( true, false) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::ResetAllAxesPos( bool bStdAxes, bool bDispAxes)
{ {
Machine* pMch = GetCurrMachine() ; Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->ResetAllAxesPos( bStdAxes, bDispAxes) : false) ; return ( ( pMch != nullptr) ? pMch->ResetAllAxesPos() : false) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -555,17 +534,6 @@ MachMgr::SetCalcSolCh( int nScc, bool bExact)
return pMch->SetSolCh( nScc, bExact) ; return pMch->SetSolCh( nScc, bExact) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::GetCalcSolCh( int& nScc, bool& bExact) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// recupero il criterio di scelta della soluzione
return pMch->GetSolCh( nScc, bExact) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::GetCalcTable( string& sTable) const MachMgr::GetCalcTable( string& sTable) const
@@ -635,7 +603,7 @@ bool
MachMgr::GetCalcMaxDeltaR2OnFirst( void) const MachMgr::GetCalcMaxDeltaR2OnFirst( void) const
{ {
Machine* pMch = GetCurrMachine() ; Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetCurrCalcMaxDeltaR2OnFirst() : true) ; return ( ( pMch != nullptr) ? pMch->GetCurrMaxDeltaR2OnFirst() : true) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -722,22 +690,6 @@ MachMgr::GetCurrAxisHomePos( int nInd, double& dHome) const
return ( ( pMch != nullptr) ? pMch->GetCurrAxisHomePos( nInd, dHome) : false) ; return ( ( pMch != nullptr) ? pMch->GetCurrAxisHomePos( nInd, dHome) : false) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::GetCurrAxisMax( int nInd, double& dMax) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetCurrAxisMax( nInd, dMax) : false) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetCurrAxisMin( int nInd, double& dMin) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetCurrAxisMin( nInd, dMin) : false) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const Frame3d& const Frame3d&
MachMgr::GetCurrLinAxesFrame( void) const MachMgr::GetCurrLinAxesFrame( void) const
@@ -752,12 +704,12 @@ MachMgr::GetCurrLinAxesFrame( void) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::GetCurrIsMcent( void) const MachMgr::GetCurrIsCenter( void) const
{ {
Machine* pMch = GetCurrMachine() ; Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr) if ( pMch == nullptr)
return false ; return false ;
return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_MCENT) ; return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_CENTER) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -775,19 +727,8 @@ bool
MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA, MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const
{ {
nStat = 0 ; dAngA1 = 0 ; dAngB1 = 0 ; dAngA2 = 0 ; dAngB2 = 0 ; Machine* pMch = GetCurrMachine() ;
DBLVECTOR vAng1, vAng2 ; return ( ( pMch != nullptr) ? pMch->GetAngles( vtDirT, vtDirA, nStat, dAngA1, dAngB1, dAngA2, dAngB2) : false) ;
if ( ! GetCalcAngles( vtDirT, vtDirA, nStat, vAng1, vAng2))
return false ;
if ( vAng1.size() >= 1) {
dAngA1 = vAng1[0] ;
dAngA2 = vAng2[0] ;
if ( vAng1.size() >= 2) {
dAngB1 = vAng1[1] ;
dAngB2 = vAng2[1] ;
}
}
return true ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -795,7 +736,6 @@ bool
MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA, MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const
{ {
const_cast<MachMgr*>(this)->ApplyRotAxisBlock() ;
Machine* pMch = GetCurrMachine() ; Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetAngles( vtDirT, vtDirA, nStat, vAng1, vAng2) : false) ; return ( ( pMch != nullptr) ? pMch->GetAngles( vtDirT, vtDirA, nStat, vAng1, vAng2) : false) ;
} }
@@ -803,29 +743,20 @@ MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::GetCalcPositions( const Point3d& ptP, double dAngA, double dAngB, MachMgr::GetCalcPositions( const Point3d& ptP, double dAngA, double dAngB,
double& dX, double& dY, double& dZ) const int& nStat, double& dX, double& dY, double& dZ) const
{ {
DBLVECTOR vAng( 2) ; vAng[0] = dAngA ; vAng[1] = dAngB ; DBLVECTOR vAng( 2) ; vAng[0] = dAngA ; vAng[1] = dAngB ;
Machine* pMch = GetCurrMachine() ; Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetPositions( ptP, vAng, dX, dY, dZ) : false) ; return ( ( pMch != nullptr) ? pMch->GetPositions( ptP, vAng, nStat, dX, dY, dZ) : false) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::GetCalcPositions( const Point3d& ptP, const DBLVECTOR& vAng, MachMgr::GetCalcPositions( const Point3d& ptP, const DBLVECTOR& vAng,
double& dX, double& dY, double& dZ) const int& nStat, double& dX, double& dY, double& dZ) const
{ {
Machine* pMch = GetCurrMachine() ; Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetPositions( ptP, vAng, dX, dY, dZ) : false) ; return ( ( pMch != nullptr) ? pMch->GetPositions( ptP, vAng, nStat, dX, dY, dZ) : false) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetRobotAngles( ptP, vtDirT, vtDirA, vAng1, vAng2) : false) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -835,7 +766,7 @@ MachMgr::GetCalcTipFromPositions( double dX, double dY, double dZ, double dAngA,
{ {
DBLVECTOR vAng( 2) ; vAng[0] = dAngA ; vAng[1] = dAngB ; DBLVECTOR vAng( 2) ; vAng[0] = dAngA ; vAng[1] = dAngB ;
Machine* pMch = GetCurrMachine() ; Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetTipFromPositions( dX, dY, dZ, vAng, bOverall, bBottom, false, ptTip) : false) ; return ( ( pMch != nullptr) ? pMch->GetTipFromPositions( dX, dY, dZ, vAng, bOverall, bBottom, ptTip) : false) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -844,7 +775,7 @@ MachMgr::GetCalcTipFromPositions( double dX, double dY, double dZ, const DBLVECT
bool bOverall, bool bBottom, Point3d& ptTip) const bool bOverall, bool bBottom, Point3d& ptTip) const
{ {
Machine* pMch = GetCurrMachine() ; Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetTipFromPositions( dX, dY, dZ, vAng, bOverall, bBottom, false, ptTip) : false) ; return ( ( pMch != nullptr) ? pMch->GetTipFromPositions( dX, dY, dZ, vAng, bOverall, bBottom, ptTip) : false) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
+23 -120
View File
@@ -100,52 +100,48 @@ MachMgr::GetPrevOperation( int nId) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
MachMgr::GetFirstActiveOperation( bool bNeedMachNotEmpty) const MachMgr::GetFirstActiveOperation( void) const
{ {
int nId = GetFirstOperation() ; int nId = GetFirstOperation() ;
int nMode ; int nMode ;
while ( nId != GDB_ID_NULL && while ( nId != GDB_ID_NULL &&
(( m_pGeomDB->GetCalcMode( nId, nMode) && nMode == GDB_MD_HIDDEN) || m_pGeomDB->GetCalcMode( nId, nMode) && nMode == GDB_MD_HIDDEN)
( bNeedMachNotEmpty && IsValidMachiningType( GetOperationType( nId)) && IsOperationEmpty( nId, NEED_ONE_TP_OK))))
nId = GetNextOperation( nId) ; nId = GetNextOperation( nId) ;
return nId ; return nId ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
MachMgr::GetNextActiveOperation( int nId, bool bNeedMachNotEmpty) const MachMgr::GetNextActiveOperation( int nId) const
{ {
int nNextId = GetNextOperation( nId) ; int nNextId = GetNextOperation( nId) ;
int nMode ; int nMode ;
while ( nNextId != GDB_ID_NULL && while ( nNextId != GDB_ID_NULL &&
(( m_pGeomDB->GetCalcMode( nNextId, nMode) && nMode == GDB_MD_HIDDEN) || m_pGeomDB->GetCalcMode( nNextId, nMode) && nMode == GDB_MD_HIDDEN)
( bNeedMachNotEmpty && IsValidMachiningType( GetOperationType( nNextId)) && IsOperationEmpty( nNextId, NEED_ONE_TP_OK))))
nNextId = GetNextOperation( nNextId) ; nNextId = GetNextOperation( nNextId) ;
return nNextId ; return nNextId ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
MachMgr::GetLastActiveOperation( bool bNeedMachNotEmpty) const MachMgr::GetLastActiveOperation( void) const
{ {
int nId = GetLastOperation() ; int nId = GetLastOperation() ;
int nMode ; int nMode ;
while ( nId != GDB_ID_NULL && while ( nId != GDB_ID_NULL &&
(( m_pGeomDB->GetCalcMode( nId, nMode) && nMode == GDB_MD_HIDDEN) || m_pGeomDB->GetCalcMode( nId, nMode) && nMode == GDB_MD_HIDDEN)
( bNeedMachNotEmpty && IsValidMachiningType( GetOperationType( nId)) && IsOperationEmpty( nId, NEED_ONE_TP_OK))))
nId = GetPrevOperation( nId) ; nId = GetPrevOperation( nId) ;
return nId ; return nId ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
MachMgr::GetPrevActiveOperation( int nId, bool bNeedMachNotEmpty) const MachMgr::GetPrevActiveOperation( int nId) const
{ {
int nPrevId = GetPrevOperation( nId) ; int nPrevId = GetPrevOperation( nId) ;
int nMode ; int nMode ;
while ( nPrevId != GDB_ID_NULL && while ( nPrevId != GDB_ID_NULL &&
(( m_pGeomDB->GetCalcMode( nPrevId, nMode) && nMode == GDB_MD_HIDDEN) || m_pGeomDB->GetCalcMode( nPrevId, nMode) && nMode == GDB_MD_HIDDEN)
( bNeedMachNotEmpty && IsValidMachiningType( GetOperationType( nPrevId)) && IsOperationEmpty( nPrevId, NEED_ONE_TP_OK))))
nPrevId = GetPrevOperation( nPrevId) ; nPrevId = GetPrevOperation( nPrevId) ;
return nPrevId ; return nPrevId ;
} }
@@ -184,11 +180,14 @@ MachMgr::GetOperationPhase( int nId) const
bool bool
MachMgr::GetOperationNewName( string& sName) const MachMgr::GetOperationNewName( string& sName) const
{ {
// il parametro nome deve essere valido
if ( &sName == nullptr)
return false ;
// il gruppo per le operazioni deve essere presente nella macchinata corrente // il gruppo per le operazioni deve essere presente nella macchinata corrente
if ( GetCurrOperId() == GDB_ID_NULL) if ( GetCurrOperId() == GDB_ID_NULL)
return false ; return false ;
// se nome vuoto, assegno radice standard // se nome vuoto, assegno radice standard
if ( ! IsValidVal( sName)) if ( sName.empty())
sName = "Oper" ; sName = "Oper" ;
// se presenti caratteri vietati, li sostituisco // se presenti caratteri vietati, li sostituisco
ValidateVal( sName) ; ValidateVal( sName) ;
@@ -215,9 +214,6 @@ MachMgr::SetOperationName( int nId, const string& sName)
// verifico che faccia parte del gruppo delle operazioni // verifico che faccia parte del gruppo delle operazioni
if ( pIter->GetParentId() != GetCurrOperId()) if ( pIter->GetParentId() != GetCurrOperId())
return false ; return false ;
// verifico che il nome sia valido
if ( ! IsValidVal( sName))
return false ;
// verifico che il nome non sia già usato da una operazione // verifico che il nome non sia già usato da una operazione
if ( GetOperationId( sName) != GDB_ID_NULL) if ( GetOperationId( sName) != GDB_ID_NULL)
return false ; return false ;
@@ -232,10 +228,10 @@ MachMgr::GetOperationName( int nId) const
// recupero l'operazione // recupero l'operazione
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ; PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
if ( IsNull( pIter) || ! pIter->GoTo( nId)) if ( IsNull( pIter) || ! pIter->GoTo( nId))
return "" ; return 0 ;
// verifico che faccia parte del gruppo delle operazioni // verifico che faccia parte del gruppo delle operazioni
if ( pIter->GetParentId() != GetCurrOperId()) if ( pIter->GetParentId() != GetCurrOperId())
return "" ; return 0 ;
// recupero il nome dell'operazione riferita // recupero il nome dell'operazione riferita
string sName ; string sName ;
pIter->GetName( sName) ; pIter->GetName( sName) ;
@@ -247,12 +243,12 @@ int
MachMgr::GetOperationId( const string& sName) const MachMgr::GetOperationId( const string& sName) const
{ {
// verifica dei parametri // verifica dei parametri
if ( ! IsValidVal( sName)) if ( &sName == nullptr || sName.empty())
return GDB_ID_NULL ; return false ;
// recupero l'identificativo dell'operazione con il nome indicato // recupero l'identificativo dell'operazione con il nome indicato
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ; PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
if ( IsNull( pIter)) if ( IsNull( pIter))
return GDB_ID_NULL ; return false ;
bool bIter = pIter->GoToFirstInGroup( GetCurrOperId()) ; bool bIter = pIter->GoToFirstInGroup( GetCurrOperId()) ;
while ( bIter) { while ( bIter) {
// verifico il nome // verifico il nome
@@ -267,7 +263,7 @@ MachMgr::GetOperationId( const string& sName) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::IsOperationEmpty( int nId, int nEmptyType) const MachMgr::IsOperationEmpty( int nId) const
{ {
// verifiche // verifiche
if ( m_pGeomDB == nullptr || m_pGeomDB->GetParentId( nId) != GetCurrOperId()) if ( m_pGeomDB == nullptr || m_pGeomDB->GetParentId( nId) != GetCurrOperId())
@@ -277,7 +273,7 @@ MachMgr::IsOperationEmpty( int nId, int nEmptyType) const
if ( pOpe == nullptr) if ( pOpe == nullptr)
return true ; return true ;
// restituisco se vuota // restituisco se vuota
return pOpe->IsEmpty( nEmptyType) ; return pOpe->IsEmpty() ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -605,7 +601,6 @@ MachMgr::AddDisposition( const string& sName)
m_pGeomDB->SetUserObj( nId, pDisp) ; m_pGeomDB->SetUserObj( nId, pDisp) ;
pDisp->Init( this) ; pDisp->Init( this) ;
pDisp->SetPhase( m_nCurrPhase) ; pDisp->SetPhase( m_nCurrPhase) ;
ResetAllAxesPos( false, true) ;
return nId ; return nId ;
} }
@@ -677,18 +672,6 @@ MachMgr::DispositionSpecialUpdate( int nId)
return pDisp->SpecialUpdate() ; return pDisp->SpecialUpdate() ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::GetDispositionToolData( int nId, string& sName, string& sHead, int& nExit, string& sTcPos)
{
// recupero la disposizione
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( nId)) ;
if ( pDisp == nullptr)
return false ;
// recupero i dati utensile
return pDisp->GetToolData( sName, sHead, nExit, sTcPos) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Machinings // Machinings
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -1106,22 +1089,6 @@ MachMgr::MachiningUpdate( bool bPostApply)
return pMch->Update( bPostApply) ; return pMch->Update( bPostApply) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::ChangePreviewMachiningToolShow( int nLookFlag)
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// eseguo
return pMch->ChangeToolPreviewShow( nLookFlag) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::PreparePreviewMachiningTool( void) const MachMgr::PreparePreviewMachiningTool( void) const
@@ -1155,23 +1122,7 @@ MachMgr::RemovePreviewMachiningTool( void) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
MachMgr::GetPreviewMachiningToolStepCount( void) const MachMgr::PreviewMachiningTool( int nEntId, int nFlag) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return 0 ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return 0 ;
// eseguo
return pMch->GetToolPreviewStepCount() ;
}
//----------------------------------------------------------------------------
int
MachMgr::PreviewMachiningTool( int nEntId, int nStep) const
{ {
// recupero la lavorazione corrente // recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ; int nCurrMchId = GetCurrMachining() ;
@@ -1182,7 +1133,7 @@ MachMgr::PreviewMachiningTool( int nEntId, int nStep) const
if ( pMch == nullptr) if ( pMch == nullptr)
return GDB_ID_NULL ; return GDB_ID_NULL ;
// eseguo // eseguo
return pMch->ToolPreview( nEntId, nStep) ; return pMch->ToolPreview( nEntId, nFlag) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -1283,23 +1234,7 @@ MachMgr::GetMachiningGeometry( SELVECTOR& vIds) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::GetMachiningSkippedGeometry( SELVECTOR& vIds) const MachMgr::IsMachiningEmpty( void) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// restituisco la geometria non lavorata
return pMch->GetSkippedGeometry( vIds) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::IsMachiningEmpty( int nEmptyType) const
{ {
// recupero la lavorazione corrente // recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ; int nCurrMchId = GetCurrMachining() ;
@@ -1310,7 +1245,7 @@ MachMgr::IsMachiningEmpty( int nEmptyType) const
if ( pMch == nullptr) if ( pMch == nullptr)
return true ; return true ;
// restituisco lo stato // restituisco lo stato
return pMch->IsEmpty( nEmptyType) ; return pMch->IsEmpty() ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -1344,35 +1279,3 @@ MachMgr::GetMachiningEndPoint( Point3d& ptEnd) const
// restituisco il punto finale dell'ultimo percorso di lavorazione // restituisco il punto finale dell'ultimo percorso di lavorazione
return pMch->GetEndPoint( ptEnd) ; return pMch->GetEndPoint( ptEnd) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::GetMachiningStartAxes( bool bSkipClimb, DBLVECTOR& vAxVal) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// recupero i valori
return pMch->GetInitialAxesValues( bSkipClimb, true, vAxVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetMachiningEndAxes( bool bSkipRise, DBLVECTOR& vAxVal) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// recupero i valori
return pMch->GetFinalAxesValues( bSkipRise, true, vAxVal) ;
}
+72 -236
View File
@@ -28,9 +28,6 @@
#include "/EgtDev/Include/EGkSfrCreate.h" #include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkStmStandard.h" #include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkStmFromCurves.h" #include "/EgtDev/Include/EGkStmFromCurves.h"
#include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkCAvSilhouetteSurfTm.h"
#include "/EgtDev/Include/EgtPointerOwner.h" #include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EXeConst.h"
@@ -168,88 +165,6 @@ MachMgr::ModifyRawPart( int nRawId, const Point3d& ptOrig, double dLen, double d
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------
int
MachMgr::AddRawPart( int nCrvSrfId, double dOverMat, Color cCol)
{
// verifico il gruppo dei grezzi nella macchinata corrente
if ( GetCurrRawGroupId() == GDB_ID_NULL)
return GDB_ID_NULL ;
// recupero il tipo di oggetto per definire il grezzo
int nGtype = m_pGeomDB->GetGeoType( nCrvSrfId) ;
// costruzione del grezzo
int nRawId = GDB_ID_NULL ;
// se grezzo da superficie (per ora senza possibilità di offset)
if ( ( nGtype & GEO_SURF) != 0) {
// inserisco il grezzo
nRawId = AddRawPart( nCrvSrfId, cCol) ;
}
// se altrimenti grezzo da contorno
else if ( ( nGtype & GEO_CURVE) != 0) {
// recupero la curva
const ICurve* pCrv = GetCurve( m_pGeomDB->GetGeoObj( nCrvSrfId)) ;
if ( pCrv == nullptr)
return GDB_ID_NULL ;
// copio la curva in una composita
PtrOwner<ICurveComposite> pMyCrv( ConvertCurveToComposite( pCrv->Clone())) ;
if ( IsNull( pMyCrv))
return GDB_ID_NULL ;
// se non è chiusa, la chiudo
pMyCrv->Close() ;
// recupero l'estrusione e lo spessore
Vector3d vtExtr ;
if ( ! pMyCrv->GetExtrusion( vtExtr) || vtExtr.IsSmall())
vtExtr = Z_AX ;
double dThick = 0 ;
pMyCrv->GetThickness( dThick) ;
if ( abs( dThick) + 2 * dOverMat < 10 *EPS_SMALL)
dThick = 1 ;
// la oriento in senso CCW
Plane3d plPlane ;
double dArea ;
if ( ! pMyCrv->GetArea( plPlane, dArea))
return GDB_ID_NULL ;
if ( plPlane.GetVersN() * vtExtr * dArea < 0)
pMyCrv->Invert() ;
// ne eseguo l'offset
OffsetCurve OffsCrv ;
OffsCrv.Make( pMyCrv, dOverMat, ICurve::OFF_EXTEND) ;
PtrOwner<ICurve> pOffsCrv( OffsCrv.GetLongerCurve()) ;
if ( IsNull( pOffsCrv))
return GDB_ID_NULL ;
// aggiusto per sovramateriale lungo estrusione
pMyCrv->Translate( vtExtr * -copysign( dOverMat, dThick)) ;
// creo il solido
double dH = dThick + 2 * copysign( dOverMat, dThick) ;
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshByExtrusion( pOffsCrv, vtExtr * dH, true, 50 * EPS_SMALL)) ;
if ( IsNull( pStm))
return false ;
// lo inserisco nel DB geometrico
int nSrfId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, m_pGeomDB->GetParentId( nCrvSrfId), Release( pStm)) ;
if ( nSrfId == GDB_ID_NULL)
return GDB_ID_NULL ;
// inserisco il grezzo
nRawId = AddRawPart( nSrfId, cCol) ;
// cancello la superficie
m_pGeomDB->Erase( nSrfId) ;
}
// verifico costruzione grezzo
if ( nRawId == GDB_ID_NULL)
return GDB_ID_NULL ;
// se definita tavola, aggiusto posizione del grezzo
Point3d ptTabRef ;
if ( GetTableRef( 1, ptTabRef)) {
// recupero box del solido
int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
BBox3d b3RawSolid ;
// lo porto nell'angolo in basso a sinistra della tavola
if ( m_pGeomDB->GetGlobalBBox( nRawSolidId, b3RawSolid))
m_pGeomDB->TranslateGlob( nRawId, ptTabRef - b3RawSolid.GetMin()) ;
}
return nRawId ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
MachMgr::AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color cCol) MachMgr::AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color cCol)
@@ -270,9 +185,6 @@ MachMgr::AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color
if ( ( nGtype & GEO_SURF) != 0) { if ( ( nGtype & GEO_SURF) != 0) {
// inserisco il grezzo // inserisco il grezzo
nRawId = AddRawPart( nCrvSrfId, cCol) ; nRawId = AddRawPart( nCrvSrfId, cCol) ;
// se inserimento riuscito, nascondo la superficie originale
if ( nRawId != GDB_ID_NULL)
m_pGeomDB->SetStatus( nCrvSrfId, GDB_ST_OFF) ;
// annullo il sovra-materiale // annullo il sovra-materiale
dOverMat = 0 ; dOverMat = 0 ;
// calcolo il punto di inserimento nel grezzo // calcolo il punto di inserimento nel grezzo
@@ -372,7 +284,7 @@ MachMgr::AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight,
// assegno la fase al gruppo // assegno la fase al gruppo
m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ; m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
// creo solido e outline // creo solido e outline
bOk = bOk && ModifyRawPart( nRawId, nCrvId, dOverMat, dHeight, cCol) ; bOk = bOk && ModifyRawPart( nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol) ;
// se qualcosa è andato storto, cancello tutto // se qualcosa è andato storto, cancello tutto
if ( ! bOk) { if ( ! bOk) {
m_pGeomDB->Erase( nRawId) ; m_pGeomDB->Erase( nRawId) ;
@@ -384,7 +296,7 @@ MachMgr::AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dHeight, Color cCol) MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol)
{ {
// verifica validità grezzo // verifica validità grezzo
if ( ! VerifyRawPart( nRawId)) if ( ! VerifyRawPart( nRawId))
@@ -425,7 +337,7 @@ MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dHeight,
if ( IsNull( pOffsCrv)) if ( IsNull( pOffsCrv))
return false ; return false ;
// creo il solido // creo il solido
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshByExtrusion( pOffsCrv, Vector3d( 0, 0, dHeight), true)) ; PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshByExtrusion( pOffsCrv, Vector3d(0,0,dHeight), true)) ;
if ( IsNull( pStm)) if ( IsNull( pStm))
return false ; return false ;
// cancello eventuali vecchi solidi e curve di outline // cancello eventuali vecchi solidi e curve di outline
@@ -463,10 +375,6 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
int nRawGroupId = GetCurrRawGroupId() ; int nRawGroupId = GetCurrRawGroupId() ;
if ( nRawGroupId == GDB_ID_NULL) if ( nRawGroupId == GDB_ID_NULL)
return GDB_ID_NULL ; return GDB_ID_NULL ;
// verifico che la superficie sia chiusa
const ISurf* pSurf = GetSurf( m_pGeomDB->GetGeoObj( nSurfId)) ;
if ( pSurf == nullptr || ! pSurf->IsClosed())
return GDB_ID_NULL ;
// recupero l'ingombro della superficie in globale // recupero l'ingombro della superficie in globale
BBox3d b3Surf ; BBox3d b3Surf ;
if ( ! m_pGeomDB->GetGlobalBBox( nSurfId, b3Surf)) if ( ! m_pGeomDB->GetGlobalBBox( nSurfId, b3Surf))
@@ -480,23 +388,8 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
bool bOk = m_pGeomDB->SetName( nRawId, MACH_RAW_PART) ; bool bOk = m_pGeomDB->SetName( nRawId, MACH_RAW_PART) ;
// assegno la fase al gruppo // assegno la fase al gruppo
m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ; m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
// creo il grezzo // copio la superficie nel gruppo
int nId = GDB_ID_NULL ; int nId = m_pGeomDB->CopyGlob( nSurfId, GDB_ID_NULL, nRawId) ;
// partendo da superficie Trimesh copio
if ( pSurf->GetType() == SRF_TRIMESH)
nId = m_pGeomDB->CopyGlob( nSurfId, GDB_ID_NULL, nRawId) ;
// partendo da superficie Bezier devo recuperare la Trimesh ausiliaria e copiarla
else if ( pSurf->GetType() == SRF_BEZIER) {
const ISurfBezier* pSbez = GetSurfBezier( pSurf) ;
const ISurfTriMesh* pAuxStm = ( pSbez != nullptr ? pSbez->GetAuxSurf() : nullptr) ;
PtrOwner<ISurfTriMesh> pStm( pAuxStm != nullptr ? pAuxStm->Clone() : nullptr) ;
if ( ! IsNull( pStm)) {
Frame3d frSbez ;
m_pGeomDB->GetGlobFrame( nSurfId, frSbez) ;
pStm->LocToLoc( frSbez, frRaw) ;
nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pStm)) ;
}
}
bOk = bOk && ( nId != GDB_ID_NULL) ; bOk = bOk && ( nId != GDB_ID_NULL) ;
// assegno il nome al solido // assegno il nome al solido
bOk = bOk && m_pGeomDB->SetName( nId, MACH_RAW_SOLID) ; bOk = bOk && m_pGeomDB->SetName( nId, MACH_RAW_SOLID) ;
@@ -507,12 +400,74 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
// calcolo il punto centro del solido // calcolo il punto centro del solido
bOk = bOk && SetRawPartCenter( nRawId) ; bOk = bOk && SetRawPartCenter( nRawId) ;
// calcolo la curva di contorno // calcolo la curva di contorno
bOk = bOk && UpdateRawOutline( nRawId) ; if ( bOk) {
// creo la curva
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( IsNull( pCrvCompo))
return GDB_ID_NULL ;
// recupero la superficie trimesh
ISurfTriMesh* pStm = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return GDB_ID_NULL ;
// recupero l'ingombro della superficie in locale
BBox3d b3Srf ;
pStm->GetLocalBBox( b3Srf) ;
// ne calcolo la silhouette secondo Z+
POLYLINEVECTOR vPL ;
bool bSilh = false ;
if ( pStm->GetSilhouette( Z_AX, 10.0, vPL) && vPL.size() > 0) {
// cerco il contorno esterno
int nInd = - 1 ;
double dMaxArea = 0 ;
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
double dArea ;
if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) {
if ( dArea < 0)
vPL[i].Invert() ;
dMaxArea = abs( dArea) ;
nInd = i ;
}
}
// ne deduco la curva
PtrOwner<ICurveComposite> pCrvSilh( CreateCurveComposite()) ;
if ( nInd >= 0 && pCrvSilh->FromPolyLine( vPL[nInd])) {
pCrvSilh->SetExtrusion( Z_AX) ;
Plane3d plProj ;
plProj.Set( b3Srf.GetMin(), Z_AX) ;
pCrvCompo.Set( GetCurveComposite( ProjectCurveOnPlane( *pCrvSilh, plProj))) ;
pCrvCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL) ;
bSilh = ( ! IsNull( pCrvCompo)) ;
}
}
// non riuscita, la calcolo come contorno del box
if ( ! bSilh) {
Point3d ptMin ;
double dDimX, dDimY, dDimZ ;
b3Srf.GetMinDim( ptMin, dDimX, dDimY, dDimZ) ;
PolyLine PL ;
PL.AddUPoint( 0, ptMin) ;
PL.AddUPoint( 1, ptMin + Vector3d( dDimX, 0,0)) ;
PL.AddUPoint( 2, ptMin + Vector3d( dDimX, dDimY,0)) ;
PL.AddUPoint( 3, ptMin + Vector3d( 0, dDimY,0)) ;
PL.AddUPoint( 4, ptMin) ;
if ( ! pCrvCompo->FromPolyLine( PL) && ! pCrvCompo->SetExtrusion( Z_AX))
bOk = false ;
}
// inserisco la curva composita nel DB
int nCrvId = ( bOk ? m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pCrvCompo)) : GDB_ID_NULL) ;
bOk = bOk && ( nCrvId != GDB_ID_NULL) ;
// assegno il nome alla curva
bOk = bOk && m_pGeomDB->SetName( nCrvId, MACH_RAW_OUTLINE) ;
// assegno il colore alla curva
bOk = bOk && m_pGeomDB->SetMaterial( nCrvId, cCol) ;
}
// se qualcosa è andato storto, cancello tutto // se qualcosa è andato storto, cancello tutto
if ( ! bOk) { if ( ! bOk) {
m_pGeomDB->Erase( nRawId) ; m_pGeomDB->Erase( nRawId) ;
return GDB_ID_NULL ; return GDB_ID_NULL ;
} }
// nascondo la superficie originale
m_pGeomDB->SetStatus( nSurfId, GDB_ST_OFF) ;
// tutto ok // tutto ok
return nRawId ; return nRawId ;
} }
@@ -649,12 +604,12 @@ MachMgr::AddRawPart( int nSfrUpId, int nSfrDownId, double dHeight, Color cCol)
bOk = bOk && ( nSurfUpId != GDB_ID_NULL) ; bOk = bOk && ( nSurfUpId != GDB_ID_NULL) ;
bOk = bOk && m_pGeomDB->SetName( nSurfUpId, MACH_RAW_UP_REG) ; bOk = bOk && m_pGeomDB->SetName( nSurfUpId, MACH_RAW_UP_REG) ;
bOk = bOk && m_pGeomDB->SetMaterial( nSurfUpId, cCol) ; bOk = bOk && m_pGeomDB->SetMaterial( nSurfUpId, cCol) ;
bOk = bOk && m_pGeomDB->SetMode( nSurfUpId, GDB_MD_HIDDEN) ; bOk = bOk && m_pGeomDB->SetStatus( nSurfUpId, GDB_ST_OFF) ;
int nSurfDownId = ( bOk ? m_pGeomDB->CopyGlob( nSfrDownId, GDB_ID_NULL, nRawId) : GDB_ID_NULL) ; int nSurfDownId = ( bOk ? m_pGeomDB->CopyGlob( nSfrDownId, GDB_ID_NULL, nRawId) : GDB_ID_NULL) ;
bOk = bOk && ( nSurfDownId != GDB_ID_NULL) ; bOk = bOk && ( nSurfDownId != GDB_ID_NULL) ;
bOk = bOk && m_pGeomDB->SetName( nSurfDownId, MACH_RAW_DOWN_REG) ; bOk = bOk && m_pGeomDB->SetName( nSurfDownId, MACH_RAW_DOWN_REG) ;
bOk = bOk && m_pGeomDB->SetMaterial( nSurfDownId, cCol) ; bOk = bOk && m_pGeomDB->SetMaterial( nSurfDownId, cCol) ;
bOk = bOk && m_pGeomDB->SetMode( nSurfDownId, GDB_MD_HIDDEN) ; bOk = bOk && m_pGeomDB->SetStatus( nSurfDownId, GDB_ST_OFF) ;
} }
// se qualcosa è andato storto, cancello tutto // se qualcosa è andato storto, cancello tutto
@@ -782,8 +737,8 @@ MachMgr::KeepRawPart( int nRawId, int nSouPhase)
return false ; return false ;
if ( ! SwapRawPartParts( nRawId, true)) if ( ! SwapRawPartParts( nRawId, true))
return false ; return false ;
// se fase di origine non definita o uguale alla corrente, esco con successo // se fase di origine non definita, esco con successo
if ( nSouPhase == 0 || nSouPhase == m_nCurrPhase) if ( nSouPhase == 0)
return true ; return true ;
// copio il posizionamento // copio il posizionamento
Disposition* pSouDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( nSouPhase))) ; Disposition* pSouDisp = GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( nSouPhase))) ;
@@ -907,9 +862,6 @@ MachMgr::RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg)
LOG_ERROR( GetEMkLogger(), "Error on RotateRawPart") ; LOG_ERROR( GetEMkLogger(), "Error on RotateRawPart") ;
return false ; return false ;
} }
// se rotazione non è attorno a Z, aggiorno la curva di outline
if ( abs( dAngRotDeg) > EPS_ANG_ZERO && ! vtAx.IsZ())
UpdateRawOutline( nRawId) ;
return true ; return true ;
} }
@@ -1048,122 +1000,6 @@ MachMgr::GetRawPartBBox( int nRawId, BBox3d& b3Raw)
return m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw) ; return m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::UpdateRawOutline( int nRawId)
{
// cerco il solido del grezzo
int nSolId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
if ( nSolId == GDB_ID_NULL)
return false ;
// creo la curva
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( IsNull( pCrvCompo))
return false ;
// recupero la superficie trimesh in globale
SurfLocal pStmG( m_pGeomDB, nSolId, GLOB_FRM) ;
const ISurfTriMesh* pStm = GetSurfTriMesh( pStmG) ;
if ( pStm == nullptr)
return false ;
// recupero l'ingombro della superficie
BBox3d b3Srf ;
pStm->GetLocalBBox( b3Srf) ;
// ne calcolo la silhouette secondo Z+ globale
bool bSilh = false ;
const int NUM_TRIA_LIM = 500 ;
if ( pStm->GetTriangleCount() < NUM_TRIA_LIM) {
POLYLINEVECTOR vPL ;
if ( pStm->GetSilhouette( Z_AX, 10.0, vPL) && ! vPL.empty()) {
// cerco il contorno esterno
int nInd = - 1 ;
double dMaxArea = 0 ;
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
double dArea ;
if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) {
if ( dArea < 0)
vPL[i].Invert() ;
dMaxArea = abs( dArea) ;
nInd = i ;
}
}
// ne deduco la curva
PtrOwner<ICurveComposite> pCrvSilh( CreateCurveComposite()) ;
if ( nInd >= 0 && pCrvSilh->FromPolyLine( vPL[nInd])) {
pCrvSilh->SetExtrusion( Z_AX) ;
Plane3d plProj ;
plProj.Set( b3Srf.GetMin(), Z_AX) ;
pCrvCompo.Set( GetCurveComposite( ProjectCurveOnPlane( *pCrvSilh, plProj))) ;
if ( ! IsNull( pCrvCompo)) {
pCrvCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL) ;
bSilh = true ;
}
}
}
}
else {
PtrOwner<ICAvParSilhouettesSurfTm> pCavParSilh( CreateCAvParSilhouettesSurfTm()) ;
if ( ! IsNull( pCavParSilh)) {
Frame3d frSrf( b3Srf.GetMin()) ;
const double SILH_TOL = 1.0 ;
POLYLINEVECTOR vPL ;
if ( pCavParSilh->SetData( { pStm}, frSrf, SILH_TOL) &&
pCavParSilh->GetSilhouette( 0, vPL)) {
// cerco il contorno esterno
int nInd = - 1 ;
double dMaxArea = 0 ;
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
double dArea ;
if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) {
if ( dArea < 0)
vPL[i].Invert() ;
dMaxArea = abs( dArea) ;
nInd = i ;
}
}
// ne deduco la curva
if ( nInd >= 0 && pCrvCompo->FromPolyLine( vPL[nInd])) {
pCrvCompo->SetExtrusion( Z_AX) ;
bSilh = true ;
}
}
}
}
// non riuscita, la calcolo come contorno del box
if ( ! bSilh) {
Point3d ptMin ;
double dDimX, dDimY, dDimZ ;
b3Srf.GetMinDim( ptMin, dDimX, dDimY, dDimZ) ;
PolyLine PL ;
PL.AddUPoint( 0, ptMin) ;
PL.AddUPoint( 1, ptMin + Vector3d( dDimX, 0,0)) ;
PL.AddUPoint( 2, ptMin + Vector3d( dDimX, dDimY,0)) ;
PL.AddUPoint( 3, ptMin + Vector3d( 0, dDimY,0)) ;
PL.AddUPoint( 4, ptMin) ;
if ( pCrvCompo->FromPolyLine( PL))
pCrvCompo->SetExtrusion( Z_AX) ;
else
return false ;
}
// rimuovo eventuale vecchia curva
int nOtlId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_OUTLINE) ;
m_pGeomDB->Erase( nOtlId) ;
// inserisco la curva composita nel DB
Frame3d frRaw ;
m_pGeomDB->GetGroupGlobFrame( nRawId, frRaw) ;
pCrvCompo->ToLoc( frRaw) ;
int nCrvId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pCrvCompo)) ;
if ( nCrvId == GDB_ID_NULL)
return false ;
// assegno il nome alla curva
m_pGeomDB->SetName( nCrvId, MACH_RAW_OUTLINE) ;
// assegno il colore alla curva
Color cCol ;
if ( m_pGeomDB->GetMaterial( nSolId, cCol))
m_pGeomDB->SetMaterial( nCrvId, cCol) ;
return true ;
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static bool static bool
AssociateSurfs( IGeomDB* pGeomDB, int nSurfUpId, int nSurfDownId, vector<pair<int,int>>& vRawSurfs) AssociateSurfs( IGeomDB* pGeomDB, int nSurfUpId, int nSurfDownId, vector<pair<int,int>>& vRawSurfs)
+3 -11
View File
@@ -71,13 +71,6 @@ MachMgr::ImportSetup( const string& sName)
return m_stuMgr.Save() ; return m_stuMgr.Save() ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::ExistsCurrSetup( void) const
{
return m_stuMgr.Exists() ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::VerifyCurrSetup( STRVECTOR& vsErrors) MachMgr::VerifyCurrSetup( STRVECTOR& vsErrors)
@@ -132,21 +125,21 @@ MachMgr::VerifyCurrSetup( STRVECTOR& vsErrors)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::FindToolInCurrSetup( const string& sTool) const MachMgr::FindToolInCurrSetup( const string& sTool)
{ {
return m_stuMgr.FindTool( sTool) ; return m_stuMgr.FindTool( sTool) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::GetToolSetupPosInCurrSetup( const string& sTool, string& sTcPos) const MachMgr::GetToolSetupPosInCurrSetup( const string& sTool, string& sTcPos)
{ {
return m_stuMgr.GetToolSetupPos( sTool, sTcPos) ; return m_stuMgr.GetToolSetupPos( sTool, sTcPos) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::GetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools) const MachMgr::GetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools)
{ {
return m_stuMgr.GetToolsInSetupPos( sTcPos, vsTools) ; return m_stuMgr.GetToolsInSetupPos( sTcPos, vsTools) ;
} }
@@ -162,7 +155,6 @@ MachMgr::UpdateCurrSetup( void)
Machine* pMch = GetCurrMachine() ; Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr) if ( pMch == nullptr)
return false ; return false ;
pMch->ResetCurrTool() ;
return pMch->LoadAllTools() ; return pMch->LoadAllTools() ;
} }
+4 -67
View File
@@ -16,8 +16,7 @@
#include "DllMain.h" #include "DllMain.h"
#include "MachMgr.h" #include "MachMgr.h"
#include "MachConst.h" #include "MachConst.h"
#include "SimulatorSP.h" #include "Simulator.h"
#include "SimulatorMP.h"
using namespace std ; using namespace std ;
@@ -28,12 +27,7 @@ MachMgr::SimInit( void)
// alloco o rialloco il simulatore // alloco o rialloco il simulatore
if ( m_pSimul != nullptr) if ( m_pSimul != nullptr)
delete m_pSimul ; delete m_pSimul ;
if ( GetCurrMachine() == nullptr) m_pSimul = new( nothrow) Simulator ;
return false ;
if ( GetCurrMachine()->GetMultiProcess( 2))
m_pSimul = CreateSimulatorMP() ;
else
m_pSimul = CreateSimulatorSP() ;
if ( m_pSimul == nullptr) if ( m_pSimul == nullptr)
return false ; return false ;
// lo inizializzo // lo inizializzo
@@ -130,17 +124,6 @@ MachMgr::SimSetUiStatus( int nUiStatus)
return m_pSimul->SetUiStatus( nUiStatus) ; return m_pSimul->SetUiStatus( nUiStatus) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::SimEnableToolTipTrace( bool bEnable)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// imposto abilitazione disegno traccia della punta utensile
return m_pSimul->EnableToolTipTrace( bEnable) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::SimGoHome( void) MachMgr::SimGoHome( void)
@@ -176,29 +159,6 @@ MachMgr::SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, co
return m_pSimul->AddCollisionObj( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ; return m_pSimul->AddCollisionObj( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::SimRemoveCollisionObj( int nFrameId)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// rimuovo gli oggetti da verificare per la collisione con il grezzo con FrameId indicato
return m_pSimul->RemoveCollisionObj( nFrameId) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimGetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) const
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// recupero i dati dell'oggetto di collisione di posizione indicata nel relativo vettore
return m_pSimul->GetCollisionObj( nPos, nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) MachMgr::SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
@@ -223,25 +183,13 @@ MachMgr::SimOnCollision( int nCdInd, int nObjInd, int& nErr)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::SimSetToolForVmill( const string& sTool, const string& sHead, int nExit, int nFlag, double dPar1, double dPar2, MachMgr::SimSetToolForVmill( const string& sTool, const string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst)
const INTVECTOR& vVmill, bool bFirst)
{ {
// verifico simulatore // verifico simulatore
if ( m_pSimul == nullptr) if ( m_pSimul == nullptr)
return false ; return false ;
// imposto utensile per Vmill // imposto utensile per Vmill
return m_pSimul->SetToolForVmill( sTool, sHead, nExit, nFlag, dPar1, dPar2, vVmill, bFirst) ; return m_pSimul->SetToolForVmill( sTool, sHead, nExit, vVmill, bFirst) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimEnableToolsForVmill( bool bEnable)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// imposto abilitazione Vmill
return m_pSimul->EnableToolsForVmill( bEnable) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -254,14 +202,3 @@ MachMgr::SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
// lancio movimento assi // lancio movimento assi
return m_pSimul->MoveAxes( nMoveType, vAxNaEpSt) ; return m_pSimul->MoveAxes( nMoveType, vAxNaEpSt) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::SimSaveCmd( int nType, int nPar, const string& sPar, const string& sPar2)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// salvo il comando
return m_pSimul->SaveCmd( nType, nPar, sPar, sPar2) ;
}
+9 -16
View File
@@ -34,7 +34,6 @@ Machine::Machine( void)
{ {
m_pMchMgr = nullptr ; m_pMchMgr = nullptr ;
m_pGeomDB = nullptr ; m_pGeomDB = nullptr ;
m_nContextId = 0 ;
m_nGroupId = GDB_ID_NULL ; m_nGroupId = GDB_ID_NULL ;
m_nTempGroupId = GDB_ID_NULL ; m_nTempGroupId = GDB_ID_NULL ;
m_dAxisMaxAdjust = EPS_SMALL ; m_dAxisMaxAdjust = EPS_SMALL ;
@@ -42,18 +41,13 @@ Machine::Machine( void)
m_dExitMaxAdjust = EPS_SMALL ; m_dExitMaxAdjust = EPS_SMALL ;
m_dExitMaxRotAdj = 10 * EPS_ANG_SMALL ; m_dExitMaxRotAdj = 10 * EPS_ANG_SMALL ;
m_dAngDeltaMinForHome = INFINITO ; m_dAngDeltaMinForHome = INFINITO ;
m_nMultiProcess = 0 ;
m_nLinkAxesMoveOrder = 0 ;
m_nNewLinkMgr = 0 ;
m_nCalcTabId = GDB_ID_NULL ; m_nCalcTabId = GDB_ID_NULL ;
m_nCalcHeadId = GDB_ID_NULL ; m_nCalcHeadId = GDB_ID_NULL ;
m_nCalcExitId = GDB_ID_NULL ; m_nCalcExitId = GDB_ID_NULL ;
m_nCalcToolId = GDB_ID_NULL ; m_nCalcToolId = GDB_ID_NULL ;
m_dCalcRot1W = ROT1_WEIGHT_DFLT ; m_dCalcRot1W = 1 ;
m_dSingConeAng = SING_CONE_ANG_DFLT ;
m_bCalcMaxDeltaR2On1 = true ; m_bCalcMaxDeltaR2On1 = true ;
m_nCalcSolCh = MCH_SCC_NONE ; m_nCalcSolCh = MCH_SCC_NONE ;
m_bSolChExact = false ;
m_dCalcTLen = 0 ; m_dCalcTLen = 0 ;
m_dCalcTRad = 0 ; m_dCalcTRad = 0 ;
m_dCalcTOvLen = 0 ; m_dCalcTOvLen = 0 ;
@@ -66,7 +60,6 @@ Machine::Machine( void)
m_frLinAx.Reset( false) ; m_frLinAx.Reset( false) ;
m_frRobot.Reset( false) ; m_frRobot.Reset( false) ;
m_nCalcChainType = KIN_CHAIN_NONE ; m_nCalcChainType = KIN_CHAIN_NONE ;
m_dPrevAngA = NAN ;
m_nMachineLook = MCH_LOOK_NONE ; m_nMachineLook = MCH_LOOK_NONE ;
} }
@@ -92,7 +85,6 @@ Machine::Clear( void)
// reset membri // reset membri
m_pMchMgr = nullptr ; m_pMchMgr = nullptr ;
m_pGeomDB = nullptr ; m_pGeomDB = nullptr ;
m_nContextId = 0 ;
m_sName.clear() ; m_sName.clear() ;
m_sMachineDir.clear() ; m_sMachineDir.clear() ;
m_nGroupId = GDB_ID_NULL ; m_nGroupId = GDB_ID_NULL ;
@@ -112,7 +104,6 @@ Machine::Init( const string& sMachineName, const string& sMachineDir, MachMgr* p
return false ; return false ;
m_pMchMgr = pMchMgr ; m_pMchMgr = pMchMgr ;
m_pGeomDB = m_pMchMgr->GetGeomDB() ; m_pGeomDB = m_pMchMgr->GetGeomDB() ;
m_nContextId = m_pMchMgr->GetContextId() ;
// verifico direttorio dati macchina // verifico direttorio dati macchina
m_sMachineDir = sMachineDir ; m_sMachineDir = sMachineDir ;
if ( ! ExistsDirectory( m_sMachineDir)) if ( ! ExistsDirectory( m_sMachineDir))
@@ -142,14 +133,16 @@ Machine::Init( const string& sMachineName, const string& sMachineDir, MachMgr* p
// in caso di errore, cancello tutta la geometria // in caso di errore, cancello tutta la geometria
if ( ! bOk) { if ( ! bOk) {
m_pGeomDB->Erase( m_nGroupId) ; m_pGeomDB->Erase( m_nGroupId) ;
m_pGeomDB->Erase( m_nTempGroupId) ;
m_nGroupId = GDB_ID_NULL ; m_nGroupId = GDB_ID_NULL ;
m_nTempGroupId = GDB_ID_NULL ;
m_sName.clear() ; m_sName.clear() ;
m_sMachineDir.clear() ; m_sMachineDir.clear() ;
} }
// imposto stato di visualizzazione // imposto stato di visualizzazione
m_nMachineLook = ( bOk ? MCH_LOOK_ALL : MCH_LOOK_NONE) ; m_nMachineLook = ( bOk ? MCH_LOOK_ALL : MCH_LOOK_NONE) ;
// metto tutti gli assi in posizione home // metto tutti gli assi in posizione home
bOk = bOk && ResetAllAxesPos( true, true) ; bOk = bOk && ResetAllAxesPos() ;
// reset catena cinematica corrente // reset catena cinematica corrente
m_nCalcChainType = KIN_CHAIN_NONE ; m_nCalcChainType = KIN_CHAIN_NONE ;
return bOk ; return bOk ;
@@ -298,8 +291,8 @@ Machine::AdjustTable( int nLay, const Point3d& ptRef1)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::LoadMachineAxis( const string& sName, const string& sParent, const string& sToken, bool bInvert, Machine::LoadMachineAxis( const string& sName, const string& sParent, const string& sToken, bool bInvert,
double dOffset, int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir, double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
const STROKE& Stroke, double dHome, bool bAdjustAux, const string& sGeo, const STRVECTOR& vsAux) double dHome, bool bAdjustAux, const string& sGeo, const STRVECTOR& vsAux)
{ {
// verifico sia di tipo ammesso // verifico sia di tipo ammesso
if ( nType != MCH_AT_LINEAR && nType != MCH_AT_ROTARY) { if ( nType != MCH_AT_LINEAR && nType != MCH_AT_ROTARY) {
@@ -339,7 +332,7 @@ Machine::LoadMachineAxis( const string& sName, const string& sParent, const stri
Axis* pAxis = new(nothrow) Axis ; Axis* pAxis = new(nothrow) Axis ;
if ( pAxis == nullptr) if ( pAxis == nullptr)
return false ; return false ;
pAxis->Set( sName, sToken, bInvert, dOffset, nType, nUse, ptPos, vtDir, Stroke, dHome) ; pAxis->Set( sName, sToken, bInvert, dOffset, nType, ptPos, vtDir, Stroke, dHome) ;
m_pGeomDB->SetUserObj( nLay, pAxis) ; m_pGeomDB->SetUserObj( nLay, pAxis) ;
// verifico il vettore rappresentativo dell'asse // verifico il vettore rappresentativo dell'asse
if ( ! AdjustAxis( nLay, sPart, sName, nType, ptPos, vtDir, bAdjustAux)) if ( ! AdjustAxis( nLay, sPart, sName, nType, ptPos, vtDir, bAdjustAux))
@@ -1010,8 +1003,8 @@ Machine::CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit)
m_pGeomDB->SetName( nGT, sName) ; m_pGeomDB->SetName( nGT, sName) ;
// copio le info // copio le info
m_pGeomDB->CopyAllInfoFrom( nGT, nT) ; m_pGeomDB->CopyAllInfoFrom( nGT, nT) ;
// assegno info per eventuale movimento (sempre in Z globale) // assegno info per eventuale movimento
m_pGeomDB->SetInfo( nGT, MCH_EXIT_VAL, 0) ; m_pGeomDB->SetInfo( nGT, "Val", 0) ;
// installo e inizializzo il gestore dell'uscita // installo e inizializzo il gestore dell'uscita
Exit* pExit = new(nothrow) Exit ; Exit* pExit = new(nothrow) Exit ;
if ( pExit == nullptr) if ( pExit == nullptr)
+29 -70
View File
@@ -50,7 +50,6 @@ class Machine
int GetAxisId( const std::string& sAxis) const int GetAxisId( const std::string& sAxis) const
{ int nId = GetGroup( sAxis) ; { int nId = GetGroup( sAxis) ;
return ( IsAxisGroup( nId) ? nId : GDB_ID_NULL) ; } return ( IsAxisGroup( nId) ? nId : GDB_ID_NULL) ; }
bool GetAxisName( int nAxId, std::string& sAxis) const ;
int GetHeadId( const std::string& sHead) const int GetHeadId( const std::string& sHead) const
{ int nId = GetGroup( sHead) ; { int nId = GetGroup( sHead) ;
return ( IsHeadGroup( nId) ? nId : GDB_ID_NULL) ; } return ( IsHeadGroup( nId) ? nId : GDB_ID_NULL) ; }
@@ -61,20 +60,6 @@ class Machine
int GetTcPosId( const std::string& sTcPos) const int GetTcPosId( const std::string& sTcPos) const
{ int nId = GetGroup( sTcPos) ; { int nId = GetGroup( sTcPos) ;
return ( IsTcPosGroup( nId) ? nId : GDB_ID_NULL) ; } return ( IsTcPosGroup( nId) ? nId : GDB_ID_NULL) ; }
bool IsBaseGroup( int nGroup) const ;
bool IsAxisGroup( int nGroup) const
{ return ( GetAxis( nGroup) != nullptr) ; }
bool IsLinearAxisGroup( int nGroup) const ;
bool IsRotaryAxisGroup( int nGroup) const ;
bool IsTableGroup( int nGroup) const
{ return ( GetTable( nGroup) != nullptr) ; }
bool IsHeadGroup( int nGroup) const
{ return ( GetHead( nGroup) != nullptr) ; }
bool IsTcPosGroup( int nGroup) const
{ return ( GetTcPos( nGroup) != nullptr) ; }
bool IsExitGroup( int nGroup) const
{ return ( GetExit( nGroup) != nullptr) ; }
bool GetAllAxesIds( INTVECTOR& vIds) const ;
bool GetAllTablesNames( STRVECTOR& vNames) const ; bool GetAllTablesNames( STRVECTOR& vNames) const ;
bool GetAllAxesNames( STRVECTOR& vNames) const ; bool GetAllAxesNames( STRVECTOR& vNames) const ;
bool GetAllHeadsNames( STRVECTOR& vNames) const ; bool GetAllHeadsNames( STRVECTOR& vNames) const ;
@@ -86,12 +71,6 @@ class Machine
int GetHeadSelectType(const std::string& sHead) const ; int GetHeadSelectType(const std::string& sHead) const ;
double GetAngDeltaMinForHome( void) const double GetAngDeltaMinForHome( void) const
{ return m_dAngDeltaMinForHome ; } { return m_dAngDeltaMinForHome ; }
bool GetMultiProcess( int nOpt = 1) const
{ return ( m_nMultiProcess >= nOpt) ; }
int GetLinkAxesMoveOrder( void) const
{ return m_nLinkAxesMoveOrder ; }
bool GetNewLinkMgr( int nOpt = 1) const
{ return ( m_nNewLinkMgr >= nOpt || m_nCalcChainType == KIN_CHAIN_ROBOT) ; }
bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) ; bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) ;
bool GetLoadedTool( const std::string& sHead, int nExit, std::string& sTool) const ; bool GetLoadedTool( const std::string& sHead, int nExit, std::string& sTool) const ;
bool UnloadTool( const std::string& sHead, int nExit) ; bool UnloadTool( const std::string& sHead, int nExit) ;
@@ -100,21 +79,17 @@ class Machine
bool LoadAllTools( void) ; bool LoadAllTools( void) ;
bool UnloadAllTools( void) ; bool UnloadAllTools( void) ;
bool ResetHeadSet( const std::string& sHead) ; bool ResetHeadSet( const std::string& sHead) ;
const STRVECTOR& GetHSet( const std::string& sHead) const ;
bool GetAxisToken( const std::string& sAxis, std::string& sToken) const ; bool GetAxisToken( const std::string& sAxis, std::string& sToken) const ;
bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const ; bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const ;
bool GetAxisOffset( const std::string& sAxis, double& dOffset) const ; bool GetAxisOffset( const std::string& sAxis, double& dOffset) const ;
bool GetAxisType( const std::string& sAxis, bool& bLinear) const ; bool GetAxisType( const std::string& sAxis, bool& bLinear) const ;
bool GetAxisDir( const std::string& sAxis, Vector3d& vtDir) const ;
bool SetAxisPos( const std::string& sAxis, double dVal, bool bInStroke = true, double* pdNewVal = nullptr) ; bool SetAxisPos( const std::string& sAxis, double dVal, bool bInStroke = true, double* pdNewVal = nullptr) ;
bool GetAxisPos( const std::string& sAxis, double& dVal) const ; bool GetAxisPos( const std::string& sAxis, double& dVal) const ;
bool GetAxisMin( const std::string& sAxis, double& dMin) const ; bool GetAxisMin( const std::string& sAxis, double& dMin) const ;
bool GetAxisMax( const std::string& sAxis, double& dMax) const ; bool GetAxisMax( const std::string& sAxis, double& dMax) const ;
bool GetAxisHomePos( const std::string& sAxis, double& dHomeVal) const ; bool GetAxisHomePos( const std::string& sAxis, double& dHomeVal) const ;
bool IsDispositionAxis( int nAxisId, int nTableId = GDB_ID_NULL) const ;
bool IsDispositionAxis( const std::string& sAxis, const std::string& sTable = "") const ;
bool ResetAxisPos( const std::string& sAxis) ; bool ResetAxisPos( const std::string& sAxis) ;
bool ResetAllAxesPos( bool bStdAxes, bool bDispAxes) ; bool ResetAllAxesPos( void) ;
bool SetCurrTable( const std::string& sTable) ; bool SetCurrTable( const std::string& sTable) ;
bool ResetCurrTable( void) ; bool ResetCurrTable( void) ;
int GetCurrTable( void) const ; int GetCurrTable( void) const ;
@@ -133,14 +108,9 @@ class Machine
int GetCurrExit( void) const ; int GetCurrExit( void) const ;
bool GetCurrExit( int& nExit) const ; bool GetCurrExit( int& nExit) const ;
bool GetCurrHeadCollGroups( INTVECTOR& vIds) const ; bool GetCurrHeadCollGroups( INTVECTOR& vIds) const ;
bool IsCurrToolFloating( void) const ;
double GetCurrRot1W( void) const double GetCurrRot1W( void) const
{ return m_dCalcRot1W ; } { return m_dCalcRot1W ; }
bool SetSingConeAng( double dAng) bool GetCurrMaxDeltaR2OnFirst( void) const
{ m_dSingConeAng = dAng ; return true ;}
double GetCurrSingConeAng( void) const
{ return m_dSingConeAng ; }
bool GetCurrCalcMaxDeltaR2OnFirst( void) const
{ return m_bCalcMaxDeltaR2On1 ; } { return m_bCalcMaxDeltaR2On1 ; }
std::string GetKinematicAxis( int nInd) const ; std::string GetKinematicAxis( int nInd) const ;
bool BlockKinematicRotAxis( const std::string& sName, double dVal) ; bool BlockKinematicRotAxis( const std::string& sName, double dVal) ;
@@ -150,15 +120,12 @@ class Machine
bool IsKinematicRotAxisBlocked( int nInd) const ; bool IsKinematicRotAxisBlocked( int nInd) const ;
bool GetKinematicRotAxisBlocked( int nInd, std::string& sName, double& dVal) const ; bool GetKinematicRotAxisBlocked( int nInd, std::string& sName, double& dVal) const ;
bool SetSolCh( int nScc, bool bExact) ; bool SetSolCh( int nScc, bool bExact) ;
bool GetSolCh( int& nScc, bool& bExact)
{ nScc = m_nCalcSolCh ; bExact = m_bSolChExact ; return true ; }
int GetCurrLinAxes( void) const ; int GetCurrLinAxes( void) const ;
int GetCurrRotAxes( void) const ; int GetCurrRotAxes( void) const ;
bool GetCurrAxisName( int nInd, std::string& sAxName) const ; bool GetCurrAxisName( int nInd, std::string& sAxName) const ;
bool GetAllCurrAxesNames( STRVECTOR& vAxName) const ; bool GetAllCurrAxesNames( STRVECTOR& vAxName) const ;
bool GetCurrAxisToken( int nInd, std::string& sAxToken) const ; bool GetCurrAxisToken( int nInd, std::string& sAxToken) const ;
bool GetAllCurrAxesTokens( STRVECTOR& vAxToken) const ; bool GetAllCurrAxesTokens( STRVECTOR& vAxToken) const ;
bool GetCurrAxisType( int nInd, bool& bLinear, bool& bHead) const ;
bool GetCurrAxisMin( int nInd, double& dMin) const ; bool GetCurrAxisMin( int nInd, double& dMin) const ;
bool GetCurrAxisMax( int nInd, double& dMax) const ; bool GetCurrAxisMax( int nInd, double& dMax) const ;
bool GetCurrAxisOffset( int nInd, double& dOffset) const ; bool GetCurrAxisOffset( int nInd, double& dOffset) const ;
@@ -169,18 +136,18 @@ class Machine
{ return m_frLinAx ; } { return m_frLinAx ; }
int GetCurrKinematicChainType( void) const int GetCurrKinematicChainType( void) const
{ return m_nCalcChainType ; } { return m_nCalcChainType ; }
bool SetPrevAngA( double dAngA) const bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
{ m_dPrevAngA = dAngA ; return true ; } int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const ;
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA, bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ; int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
bool GetPositions( const Point3d& ptP, const DBLVECTOR& vAng, bool GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
double& dX, double& dY, double& dZ) const ; int& nStat, double& dX, double& dY, double& dZ) const ;
bool GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA, bool GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ; DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
bool GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
Point3d& ptNose) const ; Point3d& ptNose) const ;
bool GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
bool bOverall, bool bBottom, bool bBack, Point3d& ptTip) const ; bool bBottom, bool bOverall, Point3d& ptTip) const ;
bool GetToolDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const ; bool GetToolDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const ;
bool GetAuxDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const ; bool GetAuxDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const ;
bool GetPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const ; bool GetPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const ;
@@ -235,8 +202,8 @@ class Machine
const STRVECTOR& vsColl, const std::string& sGeo, const STRVECTOR& vsAux) ; const STRVECTOR& vsColl, const std::string& sGeo, const STRVECTOR& vsAux) ;
bool AdjustTable( int nLay, const Point3d& ptRef1) ; bool AdjustTable( int nLay, const Point3d& ptRef1) ;
bool LoadMachineAxis( const std::string& sName, const std::string& sParent, const std::string& sToken, bool bInvert, bool LoadMachineAxis( const std::string& sName, const std::string& sParent, const std::string& sToken, bool bInvert,
double dOffset, int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir, double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
const STROKE& Stroke, double dHome, bool bAdjustAux, const std::string& sGeo, const STRVECTOR& vsAux) ; double dHome, bool bAdjustAux, const std::string& sGeo, const STRVECTOR& vsAux) ;
bool AdjustAxis( int nLay, const std::string& sPart, const std::string& sName, bool AdjustAxis( int nLay, const std::string& sPart, const std::string& sName,
int nType, const Point3d& ptPos, const Vector3d& vtDir, bool bAdjustAux) ; int nType, const Point3d& ptPos, const Vector3d& vtDir, bool bAdjustAux) ;
bool ModifyMachineAxisPosition( const std::string& sName, const Point3d& ptPos) ; bool ModifyMachineAxisPosition( const std::string& sName, const Point3d& ptPos) ;
@@ -262,29 +229,38 @@ class Machine
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
const std::string& sGeo, const STRVECTOR& vsAux) ; const std::string& sGeo, const STRVECTOR& vsAux) ;
int GetGroup( const std::string& sGroup) const ; int GetGroup( const std::string& sGroup) const ;
bool IsBaseGroup( int nGroup) const ;
Axis* GetAxis( int nGroup) const ; Axis* GetAxis( int nGroup) const ;
bool IsAxisGroup( int nGroup) const
{ return ( GetAxis( nGroup) != nullptr) ; }
bool IsLinearAxisGroup( int nGroup) const ;
bool IsRotaryAxisGroup( int nGroup) const ;
Table* GetTable( int nGroup) const ; Table* GetTable( int nGroup) const ;
bool IsTableGroup( int nGroup) const
{ return ( GetTable( nGroup) != nullptr) ; }
Head* GetHead( int nGroup) const ; Head* GetHead( int nGroup) const ;
bool IsHeadGroup( int nGroup) const
{ return ( GetHead( nGroup) != nullptr) ; }
TcPos* GetTcPos( int nGroup) const ; TcPos* GetTcPos( int nGroup) const ;
bool IsTcPosGroup( int nGroup) const
{ return ( GetTcPos( nGroup) != nullptr) ; }
Exit* GetExit( int nGroup) const ; Exit* GetExit( int nGroup) const ;
bool IsExitGroup( int nGroup) const
{ return ( GetExit( nGroup) != nullptr) ; }
bool AddHeadToSet( const std::string& sHSet, const std::string& sName) ; bool AddHeadToSet( const std::string& sHSet, const std::string& sName) ;
const STRVECTOR& GetHSet( const std::string& sHead) const ;
bool EnableHeadInSet( const std::string& sHead) ; bool EnableHeadInSet( const std::string& sHead) ;
bool LoadTool( Exit* pExit, const std::string& sTool) ; bool LoadTool( Exit* pExit, const std::string& sTool) ;
bool ModifyMachineHeadAuxDirection( const std::string& sHead, const Vector3d& vtADir) ; bool ModifyMachineHeadAuxDirection( const std::string& sHead, const Vector3d& vtADir) ;
bool AdjustExitFrames( int nLay, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir) ; bool AdjustExitFrames( int nLay, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir) ;
bool CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit) ; bool CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit) ;
bool ModifyMachineExitPosition( const std::string& sHead, int nExit, const Point3d& ptPos) ; bool ModifyMachineExitPosition( const std::string& sHead, int nExit, const Point3d& ptPos) ;
bool ClearKinematicChain( void) ;
bool CalculateKinematicChain( void) ; bool CalculateKinematicChain( void) ;
bool AddKinematicAxis( bool bOnHead, int nId) ; bool AddKinematicAxis( bool bOnHead, int nId) ;
bool GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA, bool GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
const Vector3d& vtDirH, const Vector3d& vtDirI, const Vector3d& vtDirH, const Vector3d& vtDirI,
int nNumRotAx, const KinAxis& RotAx1, const KinAxis& RotAx2, int nNumRotAx, const KinAxis& RotAx1, const KinAxis& RotAx2,
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const ; int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const ;
bool GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
const Vector3d& vtDirH, const Vector3d& vtDirI,
const KinAxis& RotAx1, const KinAxis& RotAx2, const KinAxis& RotAx3,
int& nStat, double& dAngA1, double& dAngB1, double& dAngC1, double& dAngA2, double& dAngB2, double& dAngC2) const ;
bool GetDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const ; bool GetDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const ;
bool GetBackDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const ; bool GetBackDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const ;
bool GetSccDir( int nSolCh, const Vector3d& vtDirA, Vector3d& vtDirScc) const ; bool GetSccDir( int nSolCh, const Vector3d& vtDirA, Vector3d& vtDirScc) const ;
@@ -301,7 +277,6 @@ class Machine
// generali // generali
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
int m_nContextId ; // indice contesto corrente (1-based)
LuaMgr m_LuaMgr ; // interprete lua della macchina LuaMgr m_LuaMgr ; // interprete lua della macchina
Writer m_Writer ; // scrittore di file di testo Writer m_Writer ; // scrittore di file di testo
// dati macchina // dati macchina
@@ -315,9 +290,6 @@ class Machine
double m_dExitMaxAdjust ; // massimo aggiustamento uscita da geometria a descrizione cinematica double m_dExitMaxAdjust ; // massimo aggiustamento uscita da geometria a descrizione cinematica
double m_dExitMaxRotAdj ; // massima rotazione di aggiustamento uscita da geometria a descrizione cinematica double m_dExitMaxRotAdj ; // massima rotazione di aggiustamento uscita da geometria a descrizione cinematica
double m_dAngDeltaMinForHome ; // minima differenza angolare da valore precedente per scegliere di stare vicino a home double m_dAngDeltaMinForHome ; // minima differenza angolare da valore precedente per scegliere di stare vicino a home
int m_nMultiProcess ; // codice di macchina multi-processo (con stima speciale e simulazione ad hoc)
int m_nLinkAxesMoveOrder ; // codice ordine interpolazione assi nei collegamenti (0=interpolati, ...)
int m_nNewLinkMgr ; // codice del nuovo gestore link tra lavorazioni (0=vecchio, 1=nuovo)
INTVECTOR m_vLinkedRawParts ; // elenco dei grezzi agganciati a gruppi della macchina INTVECTOR m_vLinkedRawParts ; // elenco dei grezzi agganciati a gruppi della macchina
INTVECTOR m_vLinkedFixtures ; // elenco dei bloccaggi agganciati a gruppi della macchina INTVECTOR m_vLinkedFixtures ; // elenco dei bloccaggi agganciati a gruppi della macchina
INTVECTOR m_vLinkedParts ; // elenco dei pezzi agganciati a gruppi della macchina INTVECTOR m_vLinkedParts ; // elenco dei pezzi agganciati a gruppi della macchina
@@ -327,7 +299,6 @@ class Machine
int m_nCalcExitId ; // uscita corrente per calcoli int m_nCalcExitId ; // uscita corrente per calcoli
int m_nCalcToolId ; // utensile corrente per calcoli int m_nCalcToolId ; // utensile corrente per calcoli
double m_dCalcRot1W ; // peso del primo asse rotante per i confronti double m_dCalcRot1W ; // peso del primo asse rotante per i confronti
double m_dSingConeAng ; // angolo di apertura del cono di direzioni considerate coincidenti con asse singolare
bool m_bCalcMaxDeltaR2On1 ; // flag utilizzo controllo massimo delta secondo asse rotante su inizio lavorazione bool m_bCalcMaxDeltaR2On1 ; // flag utilizzo controllo massimo delta secondo asse rotante su inizio lavorazione
int m_nCalcSolCh ; // criterio di scelta della soluzione int m_nCalcSolCh ; // criterio di scelta della soluzione
bool m_bSolChExact ; // flag per scelta soluzione da soddisfare esattamente bool m_bSolChExact ; // flag per scelta soluzione da soddisfare esattamente
@@ -350,7 +321,6 @@ class Machine
int m_nCalcChainType ; // tipologia testa attiva (nulla, centro di lavoro o robot) int m_nCalcChainType ; // tipologia testa attiva (nulla, centro di lavoro o robot)
Point3d m_ptWristCen ; // centro del polso sferico nel riferimento testa/uscita di calcolo Point3d m_ptWristCen ; // centro del polso sferico nel riferimento testa/uscita di calcolo
Vector3d m_vtWristRef ; // direzione del polso sferico nel riferimento testa/uscita di calcolo Vector3d m_vtWristRef ; // direzione del polso sferico nel riferimento testa/uscita di calcolo
mutable double m_dPrevAngA ; // angolo precedente di riferimento per soluzione indeterminata
mutable OutStroke m_OutstrokeInfo ; // informazioni su ultima extra corsa mutable OutStroke m_OutstrokeInfo ; // informazioni su ultima extra corsa
// stato di visualizzazione // stato di visualizzazione
int m_nMachineLook ; // stato di visualizzazione della macchina int m_nMachineLook ; // stato di visualizzazione della macchina
@@ -381,17 +351,9 @@ class Machine
static int LuaEmtAddRapidMove( lua_State* L) ; static int LuaEmtAddRapidMove( lua_State* L) ;
static int LuaEmtAddLinearMove( lua_State* L) ; static int LuaEmtAddLinearMove( lua_State* L) ;
static int LuaEmtAddArcMove( lua_State* L) ; static int LuaEmtAddArcMove( lua_State* L) ;
static int LuaEmtAddClimb( lua_State* L) ;
static int LuaEmtRemoveClimb( lua_State* L) ;
static int LuaEmtAddRise( lua_State* L) ;
static int LuaEmtRemoveRise( lua_State* L) ;
static int LuaEmtAdjustConcavePartsInPath( lua_State* L) ;
static int LuaEmtGetMoveType( lua_State* L) ; static int LuaEmtGetMoveType( lua_State* L) ;
static int LuaEmtGetAxesPos( lua_State* L) ; static int LuaEmtGetAxesPos( lua_State* L) ;
static int LuaEmtGetBackAuxDir( lua_State* L) ; static int LuaEmtGetBackAuxDir( lua_State* L) ;
static int LuaEmtGetInitialAxesPos( lua_State* L) ;
static int LuaEmtGetFinalAxesPos( lua_State* L) ;
static int LuaEmtGetCurrAxesHomePos( lua_State* L) ;
static int LuaEmtLinkRawPartToGroup( lua_State* L) ; static int LuaEmtLinkRawPartToGroup( lua_State* L) ;
static int LuaEmtGetAllLinkedRawParts( lua_State* L) ; static int LuaEmtGetAllLinkedRawParts( lua_State* L) ;
static int LuaEmtUnlinkRawPartFromGroup( lua_State* L) ; static int LuaEmtUnlinkRawPartFromGroup( lua_State* L) ;
@@ -408,15 +370,12 @@ class Machine
static int LuaEmtSetWarning( lua_State* L) ; static int LuaEmtSetWarning( lua_State* L) ;
static int LuaEmtAddCollisionObj( lua_State* L) ; static int LuaEmtAddCollisionObj( lua_State* L) ;
static int LuaEmtAddCollisionObjEx( lua_State* L) ; static int LuaEmtAddCollisionObjEx( lua_State* L) ;
static int LuaEmtRemoveCollisionObj( lua_State* L) ;
static int LuaEmtGetCollisionObj( lua_State* L) ;
static int LuaEmtExecCollisionCheck( lua_State* L) ; static int LuaEmtExecCollisionCheck( lua_State* L) ;
static int LuaEmtOnCollision( lua_State* L) ; static int LuaEmtOnCollision( lua_State* L) ;
static int LuaEmtSetToolForVmill( lua_State* L) ; static int LuaEmtSetToolForVmill( lua_State* L) ;
static int LuaEmtAddToolForVmill( lua_State* L) ; static int LuaEmtAddToolForVmill( lua_State* L) ;
static int LuaEmtEnableToolsForVmill( lua_State* L) ;
static int LuaEmtMoveAxes( lua_State* L) ; static int LuaEmtMoveAxes( lua_State* L) ;
static int LuaEmtSaveCmd( lua_State* L) ;
} ; } ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -426,15 +385,15 @@ Machine::LuaSetGlobVar( const std::string& sVar, const T& Val)
{ {
// imposto contesto corretto // imposto contesto corretto
int nOldCtx = ExeGetCurrentContext() ; int nOldCtx = ExeGetCurrentContext() ;
if ( nOldCtx != m_nContextId) if ( nOldCtx != m_pMchMgr->GetContextId())
ExeSetCurrentContext( m_nContextId) ; ExeSetCurrentContext( m_pMchMgr->GetContextId()) ;
// imposto l'oggetto corrente per Lua // imposto l'oggetto corrente per Lua
Machine* pOldMchLua = m_pMchLua ; Machine* pOldMchLua = m_pMchLua ;
m_pMchLua = this ; m_pMchLua = this ;
// eseguo l'assegnamento // eseguo l'assegnamento
bool bOk = ::LuaSetGlobVar( m_LuaMgr.GetLuaState(), sVar, Val) ; bool bOk = ::LuaSetGlobVar( m_LuaMgr.GetLuaState(), sVar, Val) ;
// ripristino contesto originale // ripristino contesto originale
if ( nOldCtx != m_nContextId) if ( nOldCtx != m_pMchMgr->GetContextId())
ExeSetCurrentContext( nOldCtx) ; ExeSetCurrentContext( nOldCtx) ;
// ripristino dell'oggetto corrente per Lua // ripristino dell'oggetto corrente per Lua
m_pMchLua = pOldMchLua ; m_pMchLua = pOldMchLua ;
@@ -448,15 +407,15 @@ Machine::LuaGetGlobVar( const std::string& sVar, T& Val)
{ {
// imposto contesto corretto // imposto contesto corretto
int nOldCtx = ExeGetCurrentContext() ; int nOldCtx = ExeGetCurrentContext() ;
if ( nOldCtx != m_nContextId) if ( nOldCtx != m_pMchMgr->GetContextId())
ExeSetCurrentContext( m_nContextId) ; ExeSetCurrentContext( m_pMchMgr->GetContextId()) ;
// imposto l'oggetto corrente per Lua // imposto l'oggetto corrente per Lua
Machine* pOldMchLua = m_pMchLua ; Machine* pOldMchLua = m_pMchLua ;
m_pMchLua = this ; m_pMchLua = this ;
// eseguo la lettura // eseguo la lettura
bool bOk = ::LuaGetGlobVar( m_LuaMgr.GetLuaState(), sVar, Val) ; bool bOk = ::LuaGetGlobVar( m_LuaMgr.GetLuaState(), sVar, Val) ;
// ripristino contesto originale // ripristino contesto originale
if ( nOldCtx != m_nContextId) if ( nOldCtx != m_pMchMgr->GetContextId())
ExeSetCurrentContext( nOldCtx) ; ExeSetCurrentContext( nOldCtx) ;
// ripristino dell'oggetto corrente per Lua // ripristino dell'oggetto corrente per Lua
m_pMchLua = pOldMchLua ; m_pMchLua = pOldMchLua ;
+14 -116
View File
@@ -23,22 +23,6 @@
using namespace std ; using namespace std ;
//----------------------------------------------------------------------------
bool
Machine::GetAllAxesIds( INTVECTOR& vIds) const
{
// reset lista identificativi
vIds.clear() ;
// ricerca degli assi
for ( const auto& snGro : m_mapGroups) {
if ( IsAxisGroup( snGro.second))
vIds.push_back( snGro.second) ;
}
// se richiesto, ordino alfabeticamente
sort( vIds.begin(), vIds.end()) ;
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::GetAllAxesNames( STRVECTOR& vNames) const Machine::GetAllAxesNames( STRVECTOR& vNames) const
@@ -50,22 +34,10 @@ Machine::GetAllAxesNames( STRVECTOR& vNames) const
if ( IsAxisGroup( snGro.second)) if ( IsAxisGroup( snGro.second))
vNames.push_back( snGro.first) ; vNames.push_back( snGro.first) ;
} }
// se richiesto, ordino alfabeticamente // ordino alfabeticamente
sort( vNames.begin(), vNames.end()) ; sort( vNames.begin(), vNames.end()) ;
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
Machine::GetAxisName( int nAxId, string& sName) const
{
// recupero il relativo gestore
const Axis* pAx = GetAxis( nAxId) ;
if ( pAx == nullptr)
return false ;
// recupero il token dell'asse
sName = pAx->GetName() ;
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
@@ -75,7 +47,7 @@ Machine::GetAxisToken( const string& sAxis, string& sToken) const
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// recupero il relativo gestore // recupero il relativo gestore
const Axis* pAx = GetAxis( GetGroup( sAxis)) ; Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// recupero il token dell'asse // recupero il token dell'asse
@@ -91,7 +63,7 @@ Machine::GetAxisInvert( const string& sAxis, bool& bInvert) const
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// recupero il relativo gestore // recupero il relativo gestore
const Axis* pAx = GetAxis( GetGroup( sAxis)) ; Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// recupero il flag di inversione dell'asse in visualizzazione // recupero il flag di inversione dell'asse in visualizzazione
@@ -107,7 +79,7 @@ Machine::GetAxisOffset( const string& sAxis, double& dOffset) const
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// recupero il relativo gestore // recupero il relativo gestore
const Axis* pAx = GetAxis( GetGroup( sAxis)) ; Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// recupero il valore di offset dell'asse in visualizzazione // recupero il valore di offset dell'asse in visualizzazione
@@ -123,7 +95,7 @@ Machine::GetAxisType( const string& sAxis, bool& bLinear) const
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// recupero il relativo gestore // recupero il relativo gestore
const Axis* pAx = GetAxis( GetGroup( sAxis)) ; Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// recupero il tipo dell'asse // recupero il tipo dell'asse
@@ -131,22 +103,6 @@ Machine::GetAxisType( const string& sAxis, bool& bLinear) const
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
Machine::GetAxisDir( const string& sAxis, Vector3d& vtDir) const
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero il relativo gestore
const Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr)
return false ;
// recupero la direzione dell'asse
vtDir = pAx->GetDir() ;
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::SetAxisPos( const string& sAxis, double dVal, bool bInStroke, double* pdNewVal) Machine::SetAxisPos( const string& sAxis, double dVal, bool bInStroke, double* pdNewVal)
@@ -166,15 +122,6 @@ Machine::SetAxisPos( const string& sAxis, double dVal, bool bInStroke, double* p
double dCurrVal = pAx->GetCurrVal() ; double dCurrVal = pAx->GetCurrVal() ;
// limiti della corsa // limiti della corsa
STROKE Stroke = pAx->GetStroke() ; STROKE Stroke = pAx->GetStroke() ;
// se rotante e corrente, verifico se ci sono limitazioni aggiuntive (dalla testa)
if ( ! bLinear) {
for ( const auto& CalcRotAx : m_vCalcRotAx) {
if ( CalcRotAx.nGrpId == nAxGrp) {
Stroke.Min = max( Stroke.Min, CalcRotAx.stroke.Min) ;
Stroke.Max = min( Stroke.Max, CalcRotAx.stroke.Max) ;
}
}
}
// recupero il vettore dell'asse // recupero il vettore dell'asse
int nV = m_pGeomDB->GetFirstNameInGroup( nAxGrp, sAxis) ; int nV = m_pGeomDB->GetFirstNameInGroup( nAxGrp, sAxis) ;
const IGeoVector3d* pGV = GetGeoVector3d( m_pGeomDB->GetGeoObj( nV)) ; const IGeoVector3d* pGV = GetGeoVector3d( m_pGeomDB->GetGeoObj( nV)) ;
@@ -183,9 +130,8 @@ Machine::SetAxisPos( const string& sAxis, double dVal, bool bInStroke, double* p
Point3d ptPos = pGV->GetBase() ; Point3d ptPos = pGV->GetBase() ;
Vector3d vtDir = pGV->GetVector() ; Vector3d vtDir = pGV->GetVector() ;
vtDir.Normalize() ; vtDir.Normalize() ;
// se richiesto, limito il movimento alla corsa dell'asse // limito il movimento alla corsa dell'asse
if ( bInStroke) dVal = Clamp( dVal, Stroke.Min, Stroke.Max) ;
dVal = Clamp( dVal, Stroke.Min, Stroke.Max) ;
// eseguo il movimento // eseguo il movimento
if ( bLinear) if ( bLinear)
m_pGeomDB->TranslateGroup( nAxGrp, vtDir * ( dVal - dCurrVal)) ; m_pGeomDB->TranslateGroup( nAxGrp, vtDir * ( dVal - dCurrVal)) ;
@@ -206,7 +152,7 @@ Machine::GetAxisPos( const string& sAxis, double& dVal) const
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// recupero il relativo gestore // recupero il relativo gestore
const Axis* pAx = GetAxis( GetGroup( sAxis)) ; Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// recupero la posizione corrente // recupero la posizione corrente
@@ -222,7 +168,7 @@ Machine::GetAxisMin( const string& sAxis, double& dMin) const
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// recupero il gestore dell'asse // recupero il gestore dell'asse
const Axis* pAx = GetAxis( GetGroup( sAxis)) ; Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// recupero il minimo // recupero il minimo
@@ -238,7 +184,7 @@ Machine::GetAxisMax( const string& sAxis, double& dMax) const
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// recupero il gestore dell'asse // recupero il gestore dell'asse
const Axis* pAx = GetAxis( GetGroup( sAxis)) ; Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// recupero il massimo // recupero il massimo
@@ -254,7 +200,7 @@ Machine::GetAxisHomePos( const string& sAxis, double& dHomeVal) const
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// recupero il gestore dell'asse // recupero il gestore dell'asse
const Axis* pAx = GetAxis( GetGroup( sAxis)) ; Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// recupero la posizione home // recupero la posizione home
@@ -262,50 +208,6 @@ Machine::GetAxisHomePos( const string& sAxis, double& dHomeVal) const
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
Machine::IsDispositionAxis( int nAxisId, int nTableId) const
{
// se non dichiarato o ausiliario
const Axis* pAx = GetAxis( nAxisId) ;
if ( pAx == nullptr || pAx->GetUse() == MCH_AU_AUXILIAR)
return false ;
// se dichiarato di disposizione
if ( pAx->GetUse() == MCH_AU_DISPOSITION)
return true ;
// altrimenti è di tipo generale e va bene solo se dipende direttamente o indirettamente dalla tavola
// se direttamente dipendente dalla tavola
int nParentId = m_pGeomDB->GetParentId( nAxisId) ;
if ( ( nTableId != GDB_ID_NULL && nParentId == nTableId) || IsTableGroup( nParentId))
return true ;
// altrimenti deve dipendere da asse dipendente dalla tavola
if ( ! IsAxisGroup( nParentId))
return false ;
int nGrParId = m_pGeomDB->GetParentId( nParentId) ;
return ( ( nTableId != GDB_ID_NULL && nGrParId == nTableId) || IsTableGroup( nGrParId)) ;
}
//----------------------------------------------------------------------------
bool
Machine::IsDispositionAxis( const string& sAxis, const string& sTable) const
{
if ( m_pGeomDB == nullptr)
return false ;
// recupero Id asse
int nAxId = GetAxisId( sAxis) ;
if ( nAxId == GDB_ID_NULL)
return false ;
// recupero eventuale Id tavola
int nTabId = GDB_ID_NULL ;
if ( ! sTable.empty()) {
nTabId = GetTableId( sTable) ;
if ( nTabId == GDB_ID_NULL)
return false ;
}
// eseguo
return IsDispositionAxis( nAxId, nTabId) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::ResetAxisPos( const string& sAxis) Machine::ResetAxisPos( const string& sAxis)
@@ -323,17 +225,13 @@ Machine::ResetAxisPos( const string& sAxis)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::ResetAllAxesPos( bool bStdAxes, bool bDispAxes) Machine::ResetAllAxesPos( void)
{ {
// ciclo sui gruppi della macchina // ciclo sui gruppi della macchina
for ( auto Iter = m_mapGroups.cbegin() ; Iter != m_mapGroups.cend() ; ++ Iter) { for ( auto Iter = m_mapGroups.cbegin() ; Iter != m_mapGroups.cend() ; ++ Iter) {
if ( IsAxisGroup( Iter->second)) { if ( IsAxisGroup( Iter->second)) {
if ( ( bStdAxes && bDispAxes) || if ( ! ResetAxisPos( Iter->first))
( bStdAxes && ! IsDispositionAxis( Iter->first)) || return false ;
( bDispAxes && IsDispositionAxis( Iter->first))) {
if ( ! ResetAxisPos( Iter->first))
return false ;
}
} }
} }
return true ; return true ;
+196 -535
View File
File diff suppressed because it is too large Load Diff
+1 -3
View File
@@ -182,7 +182,7 @@ Machine::LoadTool( Exit* pExit, const string& sTool)
if ( nSolidId == GDB_ID_NULL) if ( nSolidId == GDB_ID_NULL)
return false ; return false ;
// sposto eventuali info relative al porta utensile (ToolHolder) nel gruppo SOLID // sposto eventuali info relative al porta utensile (ToolHolder) nel gruppo SOLID
double dVal ; string sVal ; double dVal ;
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_BASE, dVal)) if ( m_pGeomDB->GetInfo( nTGrpId, TTH_BASE, dVal))
m_pGeomDB->SetInfo( nSolidId, TTH_BASE, dVal) ; m_pGeomDB->SetInfo( nSolidId, TTH_BASE, dVal) ;
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_LEN, dVal)) if ( m_pGeomDB->GetInfo( nTGrpId, TTH_LEN, dVal))
@@ -191,8 +191,6 @@ Machine::LoadTool( Exit* pExit, const string& sTool)
m_pGeomDB->SetInfo( nSolidId, TTH_DIAM, dVal) ; m_pGeomDB->SetInfo( nSolidId, TTH_DIAM, dVal) ;
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_STEM_DIAM, dVal)) if ( m_pGeomDB->GetInfo( nTGrpId, TTH_STEM_DIAM, dVal))
m_pGeomDB->SetInfo( nSolidId, TTH_STEM_DIAM, dVal) ; m_pGeomDB->SetInfo( nSolidId, TTH_STEM_DIAM, dVal) ;
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_TYPE, sVal))
m_pGeomDB->SetInfo( nSolidId, TTH_TYPE, sVal) ;
// sposto il gruppo SOLID nell'uscita ed elimino la sua vecchia base // sposto il gruppo SOLID nell'uscita ed elimino la sua vecchia base
m_pGeomDB->RelocateGlob( nSolidId, nExGrp, GDB_FIRST_SON) ; m_pGeomDB->RelocateGlob( nSolidId, nExGrp, GDB_FIRST_SON) ;
m_pGeomDB->Erase( nTGrpId) ; m_pGeomDB->Erase( nTGrpId) ;
+8 -199
View File
@@ -1,15 +1,13 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2024 // EgalTech 2015-2021
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : MachineLua.cpp Data : 01.09.24 Versione : 2.6i1 // File : MachineLua.cpp Data : 14.10.21 Versione : 2.3j5
// Contenuto : Implementazione gestione macchina : funzioni Lua. // Contenuto : Implementazione gestione macchina : funzioni Lua.
// //
// //
// //
// Modifiche : 06.05.15 DS Creazione modulo. // Modifiche : 06.05.15 DS Creazione modulo.
// 26.04.20 DS Aggiunta gestione TcPos. // 26.04.20 DS Aggiunta gestione TcPos.
// 05.08.24 DS Aggiunta gestione SpecialEstimate.
// 01.09.24 DS SpecialEstimate è diventato MultiProcess.
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -36,16 +34,12 @@ static const string FLD_AXISMAXROTADJ = "AxisMaxRotAdj" ;
static const string FLD_EXITMAXADJUST = "ExitMaxAdjust" ; static const string FLD_EXITMAXADJUST = "ExitMaxAdjust" ;
static const string FLD_EXITMAXROTADJ = "ExitMaxRotAdj" ; static const string FLD_EXITMAXROTADJ = "ExitMaxRotAdj" ;
static const string FLD_ANGDELTAMINFORHOME = "AngDeltaMinForHome" ; static const string FLD_ANGDELTAMINFORHOME = "AngDeltaMinForHome" ;
static const string FLD_MULTIPROCESS = "MultiProcess" ;
static const string FLD_LINKAXESMOVEORDER = "LinkAxesMoveOrder" ;
static const string FLD_NEWLINKMGR = "NewLinkMgr" ;
static const string FLD_NAME = "Name" ; static const string FLD_NAME = "Name" ;
static const string FLD_PARENT = "Parent" ; static const string FLD_PARENT = "Parent" ;
static const string FLD_GEO = "Geo" ; static const string FLD_GEO = "Geo" ;
static const string FLD_AUX = "Aux" ; static const string FLD_AUX = "Aux" ;
static const string FLD_TOKEN = "Token" ; static const string FLD_TOKEN = "Token" ;
static const string FLD_TYPE = "Type" ; static const string FLD_TYPE = "Type" ;
static const string FLD_USE = "Use" ;
static const string FLD_INVERT = "Invert" ; static const string FLD_INVERT = "Invert" ;
static const string FLD_AXIS_OFFSET = "Offset" ; static const string FLD_AXIS_OFFSET = "Offset" ;
static const string FLD_REF1 = "Ref1" ; static const string FLD_REF1 = "Ref1" ;
@@ -121,14 +115,6 @@ Machine::LuaInit( const string& sMachineName)
m_LuaMgr.RegisterFunction( "EmtAddRapidMove", Machine::LuaEmtAddRapidMove) ; m_LuaMgr.RegisterFunction( "EmtAddRapidMove", Machine::LuaEmtAddRapidMove) ;
m_LuaMgr.RegisterFunction( "EmtAddLinearMove", Machine::LuaEmtAddLinearMove) ; m_LuaMgr.RegisterFunction( "EmtAddLinearMove", Machine::LuaEmtAddLinearMove) ;
m_LuaMgr.RegisterFunction( "EmtAddArcMove", Machine::LuaEmtAddArcMove) ; m_LuaMgr.RegisterFunction( "EmtAddArcMove", Machine::LuaEmtAddArcMove) ;
m_LuaMgr.RegisterFunction( "EmtAddClimb", Machine::LuaEmtAddClimb) ;
m_LuaMgr.RegisterFunction( "EmtRemoveClimb", Machine::LuaEmtRemoveClimb) ;
m_LuaMgr.RegisterFunction( "EmtAddRise", Machine::LuaEmtAddRise) ;
m_LuaMgr.RegisterFunction( "EmtRemoveRise", Machine::LuaEmtRemoveRise) ;
m_LuaMgr.RegisterFunction( "EmtGetInitialAxesPos", Machine::LuaEmtGetInitialAxesPos) ;
m_LuaMgr.RegisterFunction( "EmtGetFinalAxesPos", Machine::LuaEmtGetFinalAxesPos) ;
m_LuaMgr.RegisterFunction( "EmtGetCurrAxesHomePos", Machine::LuaEmtGetCurrAxesHomePos) ;
m_LuaMgr.RegisterFunction( "EmtAdjustConcavePartsInPath", Machine::LuaEmtAdjustConcavePartsInPath) ;
// registro le funzioni di lettura entità CL per lua // registro le funzioni di lettura entità CL per lua
m_LuaMgr.RegisterFunction( "EmtGetMoveType", Machine::LuaEmtGetMoveType) ; m_LuaMgr.RegisterFunction( "EmtGetMoveType", Machine::LuaEmtGetMoveType) ;
m_LuaMgr.RegisterFunction( "EmtGetAxesPos", Machine::LuaEmtGetAxesPos) ; m_LuaMgr.RegisterFunction( "EmtGetAxesPos", Machine::LuaEmtGetAxesPos) ;
@@ -145,10 +131,6 @@ Machine::LuaInit( const string& sMachineName)
m_LuaMgr.RegisterFunction( "EmtAddCollisionObj", Machine::LuaEmtAddCollisionObj) ; m_LuaMgr.RegisterFunction( "EmtAddCollisionObj", Machine::LuaEmtAddCollisionObj) ;
// registro la funzione estesa per aggiungere un oggetto da verificare per la collisione in simulazione // registro la funzione estesa per aggiungere un oggetto da verificare per la collisione in simulazione
m_LuaMgr.RegisterFunction( "EmtAddCollisionObjEx", Machine::LuaEmtAddCollisionObjEx) ; m_LuaMgr.RegisterFunction( "EmtAddCollisionObjEx", Machine::LuaEmtAddCollisionObjEx) ;
// registro la funzione per rimuovere oggetti con dato FrameId da verificare per la collisione in simulazione
m_LuaMgr.RegisterFunction( "EmtRemoveCollisionObj", Machine::LuaEmtRemoveCollisionObj) ;
// registro la funzione per avere i dati dell'oggetto con posizione indicata nel vettore da verificare per la collisione in simulazione
m_LuaMgr.RegisterFunction( "EmtGetCollisionObj", Machine::LuaEmtGetCollisionObj) ;
// registro la funzione di esecuzione della verifica di collisione in simulazione // registro la funzione di esecuzione della verifica di collisione in simulazione
m_LuaMgr.RegisterFunction( "EmtExecCollisionCheck", Machine::LuaEmtExecCollisionCheck) ; m_LuaMgr.RegisterFunction( "EmtExecCollisionCheck", Machine::LuaEmtExecCollisionCheck) ;
// registro la funzione di gestione della collisione in simulazione // registro la funzione di gestione della collisione in simulazione
@@ -157,12 +139,8 @@ Machine::LuaInit( const string& sMachineName)
m_LuaMgr.RegisterFunction( "EmtSetToolForVmill", Machine::LuaEmtSetToolForVmill) ; m_LuaMgr.RegisterFunction( "EmtSetToolForVmill", Machine::LuaEmtSetToolForVmill) ;
// registro la funzione di impostazione di utensile aggiuntivo per virtual milling in simulazione // registro la funzione di impostazione di utensile aggiuntivo per virtual milling in simulazione
m_LuaMgr.RegisterFunction( "EmtAddToolForVmill", Machine::LuaEmtAddToolForVmill) ; m_LuaMgr.RegisterFunction( "EmtAddToolForVmill", Machine::LuaEmtAddToolForVmill) ;
// registro la funzione per abilitare/disabilitare l'esecuzione del virtual milling
m_LuaMgr.RegisterFunction( "EmtEnableToolsForVmill", Machine::LuaEmtEnableToolsForVmill) ;
// registro la funzione di movimento assi in simulazione // registro la funzione di movimento assi in simulazione
m_LuaMgr.RegisterFunction( "EmtMoveAxes", Machine::LuaEmtMoveAxes) ; m_LuaMgr.RegisterFunction( "EmtMoveAxes", Machine::LuaEmtMoveAxes) ;
// registro la funzione di salvataggio comandi in simulazione MP
m_LuaMgr.RegisterFunction( "EmtSaveCmd", Machine::LuaEmtSaveCmd) ;
return true ; return true ;
} }
@@ -362,16 +340,6 @@ Machine::LuaEmtGeneral( lua_State* L)
// lettura eventuale campo 'AngDeltaForHome' dalla tabella (default INFINITO) // lettura eventuale campo 'AngDeltaForHome' dalla tabella (default INFINITO)
double dAngDeltaMinForHome = INFINITO ; double dAngDeltaMinForHome = INFINITO ;
LuaGetTabFieldParam( L, 1, FLD_ANGDELTAMINFORHOME, dAngDeltaMinForHome) ; LuaGetTabFieldParam( L, 1, FLD_ANGDELTAMINFORHOME, dAngDeltaMinForHome) ;
// lettura eventuale campo 'MultiProcess' dalla tabella (0=no, 1=si, 2=si con simulazione MP)
int nMultiProcess = 0 ;
LuaGetTabFieldParam( L, 1, FLD_MULTIPROCESS, nMultiProcess) ;
// lettura eventuale campo "LinkAxesMoveOrder" dalla tabella(0=interpolati, ...)
int nLinkAxesMoveOrder = 0 ;
LuaGetTabFieldParam( L, 1, FLD_LINKAXESMOVEORDER, nLinkAxesMoveOrder) ;
// lettura eventuale campo 'NewLinkMgr' dalla tabella (0=old, 1 =new)
int nNewLinkMgr = 0 ;
LuaGetTabFieldParam( L, 1, FLD_NEWLINKMGR, nNewLinkMgr) ;
// pulizia stack
LuaClearStack( L) ; LuaClearStack( L) ;
// info // info
@@ -421,13 +389,6 @@ Machine::LuaEmtGeneral( lua_State* L)
// imposto minima differenza angolare da posizione precedente per stare vivino a posizione home // imposto minima differenza angolare da posizione precedente per stare vivino a posizione home
m_pMchLua->m_dAngDeltaMinForHome = dAngDeltaMinForHome ; m_pMchLua->m_dAngDeltaMinForHome = dAngDeltaMinForHome ;
// imposto codice per macchina multiprocesso
m_pMchLua->m_nMultiProcess = nMultiProcess ;
// imposto codice per ordine interpolazione assi nei collegamenti
m_pMchLua->m_nLinkAxesMoveOrder = nLinkAxesMoveOrder ;
// imposto codice per gestione link tra lavorazioni
m_pMchLua->m_nNewLinkMgr = nNewLinkMgr ;
return 0 ; return 0 ;
} }
@@ -549,9 +510,6 @@ Machine::LuaEmtAxis( lua_State* L)
// lettura campo 'Type' dalla tabella // lettura campo 'Type' dalla tabella
int nType ; int nType ;
LuaCheckTabFieldParam( L, 1, FLD_TYPE, nType) LuaCheckTabFieldParam( L, 1, FLD_TYPE, nType)
// lettura eventuale campo 'Use' della tabella (default General)
int nUse = MCH_AU_GENERAL ;
LuaGetTabFieldParam( L, 1, FLD_USE, nUse) ;
// lettura campo 'Pos' dalla tabella // lettura campo 'Pos' dalla tabella
Point3d ptPos ; Point3d ptPos ;
LuaCheckTabFieldParam( L, 1, FLD_POS, ptPos) LuaCheckTabFieldParam( L, 1, FLD_POS, ptPos)
@@ -585,7 +543,7 @@ Machine::LuaEmtAxis( lua_State* L)
// carico i dati dell'asse // carico i dati dell'asse
if ( ! m_pMchLua->LoadMachineAxis( sName, sParent, sToken, bInvert, dOffset, if ( ! m_pMchLua->LoadMachineAxis( sName, sParent, sToken, bInvert, dOffset,
nType, nUse, ptPos, vtDir, Stroke, dHome, bAdjustAux, sGeo, vsAux)) nType, ptPos, vtDir, Stroke, dHome, bAdjustAux, sGeo, vsAux))
return luaL_error( L, " Load Machine Axis failed") ; return luaL_error( L, " Load Machine Axis failed") ;
// restituisco l'indice dell'asse // restituisco l'indice dell'asse
@@ -1433,65 +1391,6 @@ Machine::LuaEmtAddCollisionObjEx( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
int
Machine::LuaEmtRemoveCollisionObj( lua_State* L)
{
// 1 parametro : nFrameId
int nFrameId ;
LuaCheckParam( L, 1, nFrameId)
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// assegno i dati
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimRemoveCollisionObj( nFrameId)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtGetCollisionObj( lua_State* L)
{
// 1 parametro : nPos
int nPos ;
LuaCheckParam( L, 1, nPos)
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// recupero i dati
int nInd ;
bool bToolOn ;
int nFrameId ;
int nType ;
Vector3d vtMove ;
double dPar1 ;
double dPar2 ;
double dPar3 ;
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr &&
m_pMchLua->m_pMchMgr->SimGetCollisionObj( nPos, nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3)) ;
// assegno risultato
if ( bOk) {
LuaSetParam( L, true) ;
LuaSetParam( L, nInd) ;
LuaSetParam( L, bToolOn) ;
LuaSetParam( L, nFrameId) ;
LuaSetParam( L, nType) ;
LuaSetParam( L, vtMove) ;
LuaSetParam( L, dPar1) ;
LuaSetParam( L, dPar2) ;
LuaSetParam( L, dPar3) ;
return 9 ;
}
else {
LuaSetParam( L, false) ;
return 1 ;
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
Machine::LuaEmtExecCollisionCheck( lua_State* L) Machine::LuaEmtExecCollisionCheck( lua_State* L)
@@ -1539,7 +1438,7 @@ Machine::LuaEmtOnCollision( lua_State* L)
int int
Machine::LuaEmtSetToolForVmill( lua_State* L) Machine::LuaEmtSetToolForVmill( lua_State* L)
{ {
// 4 o 7 parametri : sTool, sHead, nExit, vVmill [, nFlag , dPar1, dPar2] // 4 parametri : sTool, sHead, nExit, vVmill
string sTool ; string sTool ;
LuaGetParam( L, 1, sTool) ; LuaGetParam( L, 1, sTool) ;
string sHead ; string sHead ;
@@ -1548,19 +1447,12 @@ Machine::LuaEmtSetToolForVmill( lua_State* L)
LuaGetParam( L, 3, nExit) ; LuaGetParam( L, 3, nExit) ;
INTVECTOR vVmill ; INTVECTOR vVmill ;
LuaGetParam( L, 4, vVmill) ; LuaGetParam( L, 4, vVmill) ;
int nFlag = 0 ;
LuaGetParam( L, 5, nFlag) ;
double dPar1 = 0 ;
LuaGetParam( L, 6, dPar1) ;
double dPar2 = 0 ;
LuaGetParam( L, 7, dPar2) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// verifico ci sia una macchina attiva // verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr) if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ; return luaL_error( L, " Unknown Machine") ;
// imposto dati primo utensile per virtual milling in simulazione // imposto dati primo utensile per virtual milling in simulazione
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, vVmill, true)) ;
m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, nFlag, dPar1, dPar2, vVmill, true)) ;
// assegno risultato // assegno risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -1570,7 +1462,7 @@ Machine::LuaEmtSetToolForVmill( lua_State* L)
int int
Machine::LuaEmtAddToolForVmill( lua_State* L) Machine::LuaEmtAddToolForVmill( lua_State* L)
{ {
// 4 o 7 parametri : sTool, sHead, nExit, vVmill [, nFlag, dPar1, dPar2] // 4 parametri : sTool, sHead, nExit, vVmill
string sTool ; string sTool ;
LuaGetParam( L, 1, sTool) ; LuaGetParam( L, 1, sTool) ;
string sHead ; string sHead ;
@@ -1579,37 +1471,12 @@ Machine::LuaEmtAddToolForVmill( lua_State* L)
LuaGetParam( L, 3, nExit) ; LuaGetParam( L, 3, nExit) ;
INTVECTOR vVmill ; INTVECTOR vVmill ;
LuaGetParam( L, 4, vVmill) ; LuaGetParam( L, 4, vVmill) ;
int nFlag = 0 ;
LuaGetParam( L, 5, nFlag) ;
double dPar1 = 0 ;
LuaGetParam( L, 6, dPar1) ;
double dPar2 = 0 ;
LuaGetParam( L, 7, dPar2) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// verifico ci sia una macchina attiva // verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr) if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ; return luaL_error( L, " Unknown Machine") ;
// imposto dati utensile aggiuntivo per virtual milling in simulazione // imposto dati utensile aggiuntivo per virtual milling in simulazione
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, vVmill, false)) ;
m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, nFlag, dPar1, dPar2, vVmill, false)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtEnableToolsForVmill( lua_State* L)
{
// 1 parametro : bEnable
bool bEnable = false ;
LuaGetParam( L, 1, bEnable) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// imposto abilitazione utensili per virtual milling in simulazione
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimEnableToolsForVmill( bEnable)) ;
// assegno risultato // assegno risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -1644,65 +1511,7 @@ Machine::LuaEmtMoveAxes( lua_State* L)
// assegno risultato // assegno risultato
if ( nRes == SIM_AXMV_RES_STOP) if ( nRes == SIM_AXMV_RES_STOP)
return luaL_error( L, "STOP") ; return luaL_error( L, "STOP") ;
else { else
LuaSetParam( L, ( nRes == SIM_AXMV_RES_OK)) ; LuaSetParam( L, ( nRes == SIM_AXMV_RES_OK)) ;
LuaSetParam( L, m_pMchLua->GetMultiProcess()) ;
}
return 2 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtSaveCmd( lua_State* L)
{
// parametri : nType,
int nType = 0 ;
LuaGetParam( L, 1, nType) ;
int nPar = 0 ;
LuaGetParam( L, 2, nPar) ;
string sPar ;
LuaGetParam( L, 3, sPar) ;
string sPar2 ;
if ( nType == 4) {
switch ( lua_type( L, 4)) {
case LUA_TNIL :
nPar = 0 ;
break ;
case LUA_TBOOLEAN :
{ nPar = 1 ;
bool bVal ;
LuaGetParam( L, 4, bVal) ;
sPar2 = ( bVal ? "1" : "0") ;
} break ;
case LUA_TNUMBER :
if ( lua_isinteger( L, 4)) {
nPar = 2 ;
int nVal ;
LuaGetParam( L, 4, nVal) ;
sPar2 = ToString( nVal) ;
}
else {
nPar = 3 ;
double dVal ;
LuaGetParam( L, 4, dVal) ;
sPar2 = ToString( dVal, 9) ;
}
break ;
case LUA_TSTRING :
{ nPar = 4 ;
LuaGetParam( L, 4, sPar2) ;
} break ;
default :
return luaL_error( L, " Unknown Type") ;
}
}
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// salvo il comando
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimSaveCmd( nType, nPar, sPar, sPar2)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
} }
+30 -494
View File
@@ -15,20 +15,14 @@
#include "stdafx.h" #include "stdafx.h"
#include "MachMgr.h" #include "MachMgr.h"
#include "DllMain.h" #include "DllMain.h"
#include "CamData.h"
#include "Operation.h"
#include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h" #include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkCurveLine.h" #include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h" #include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkIntersLineCylinder.h"
#include "/EgtDev/Include/EGkGeomDB.h" #include "/EgtDev/Include/EGkGeomDB.h"
#include "/EgtDev/Include/EGkLuaAux.h" #include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGnStringUtils.h" #include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/ENkPolynomialRoots.h"
#include "/EgtDev/Include/EgtPointerOwner.h" #include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ; using namespace std ;
@@ -37,7 +31,7 @@ using namespace std ;
int int
Machine::LuaEmtAddRapidStart( lua_State* L) Machine::LuaEmtAddRapidStart( lua_State* L)
{ {
// 6, 7 o 8 parametri : nPathId, ptP, vtTool, vtCorr, vtAux, nFlag [, nFlag2] [, bToolShow] // 6 o 7 parametri : nPathId, ptP, vtTool, vtCorr, vtAux, nFlag [, bToolShow]
int nPathId ; int nPathId ;
LuaCheckParam( L, 1, nPathId) LuaCheckParam( L, 1, nPathId)
Point3d ptP ; Point3d ptP ;
@@ -50,12 +44,8 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
LuaCheckParam( L, 5, vtAux) LuaCheckParam( L, 5, vtAux)
int nFlag ; int nFlag ;
LuaCheckParam( L, 6, nFlag) LuaCheckParam( L, 6, nFlag)
int nFlag2 = 0 ;
bool bToolShow = false ; bool bToolShow = false ;
if ( LuaGetParam( L, 7, nFlag2)) LuaGetParam( L, 7, bToolShow) ;
LuaGetParam( L, 8, bToolShow) ;
else
LuaGetParam( L, 7, bToolShow) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida // verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr || if ( m_pMchLua == nullptr ||
@@ -81,7 +71,6 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
pCam->SetEndPoint( ptP) ; pCam->SetEndPoint( ptP) ;
pCam->SetFeed( 0) ; pCam->SetFeed( 0) ;
pCam->SetFlag( nFlag) ; pCam->SetFlag( nFlag) ;
pCam->SetFlag2( nFlag2) ;
pCam->SetToolShow( bToolShow) ; pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico // associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ; m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
@@ -98,7 +87,7 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
int int
Machine::LuaEmtAddRapidMove( lua_State* L) Machine::LuaEmtAddRapidMove( lua_State* L)
{ {
// 7, 8 o 9 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, nFlag [, nFlag2] [, bToolShow] // 7 o 8 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, nFlag [, bToolShow]
int nPathId ; int nPathId ;
LuaCheckParam( L, 1, nPathId) LuaCheckParam( L, 1, nPathId)
Point3d ptIni ; Point3d ptIni ;
@@ -113,12 +102,8 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
LuaCheckParam( L, 6, vtAux) LuaCheckParam( L, 6, vtAux)
int nFlag ; int nFlag ;
LuaCheckParam( L, 7, nFlag) LuaCheckParam( L, 7, nFlag)
int nFlag2 = 0 ;
bool bToolShow = false ; bool bToolShow = false ;
if ( LuaGetParam( L, 8, nFlag2)) LuaGetParam( L, 8, bToolShow) ;
LuaGetParam( L, 9, bToolShow) ;
else
LuaGetParam( L, 8, bToolShow) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida // verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr || if ( m_pMchLua == nullptr ||
@@ -144,7 +129,6 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
pCam->SetEndPoint( ptFin) ; pCam->SetEndPoint( ptFin) ;
pCam->SetFeed( 0) ; pCam->SetFeed( 0) ;
pCam->SetFlag( nFlag) ; pCam->SetFlag( nFlag) ;
pCam->SetFlag2( nFlag2) ;
pCam->SetToolShow( bToolShow) ; pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico // associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ; m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
@@ -157,46 +141,11 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
int
AddLinearMove( const Point3d& ptIni, const Point3d& ptFin, IGeomDB* pGeomDB , int nPathId, const Vector3d& vtTool,
const Vector3d& vtCorr, const Vector3d& vtAux, double dFeed, int nFlag, int nFlag2, bool bToolShow, int nRefId = GDB_ID_NULL)
{
// creo oggetto linea per DB geometrico
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
bool bOk = ! IsNull( pLine) ;
// assegno gli estremi della linea
bOk = bOk && pLine->Set( ptIni, ptFin) ;
// inserisco l'oggetto nel DB geometrico
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pLine)) : GDB_ID_NULL) ;
bOk = bOk && ( nId != GDB_ID_NULL) ;
if ( bOk && nRefId != GDB_ID_NULL)
pGeomDB->RelocateGlob( nId, nRefId, GDB_AFTER) ;
// creo oggetto dati Cam
PtrOwner<CamData> pCam( new( nothrow) CamData) ;
bOk = bOk && ! IsNull( pCam) ;
if ( bOk) {
// assegno valori
pCam->SetMoveType( 1) ;
pCam->SetToolDir( vtTool) ;
pCam->SetCorrDir( vtCorr) ;
pCam->SetAuxDir( vtAux) ;
pCam->SetEndPoint( ptFin) ;
pCam->SetFeed( dFeed) ;
pCam->SetFlag( nFlag) ;
pCam->SetFlag2( nFlag2) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico
pGeomDB->SetUserObj( nId, Release( pCam)) ;
}
return nId ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
Machine::LuaEmtAddLinearMove( lua_State* L) Machine::LuaEmtAddLinearMove( lua_State* L)
{ {
// 8, 9 o 10 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, dFeed, nFlag [, nFlag2] [, bToolShow] // 8 o 9 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, dFeed, nFlag [, bToolShow]
int nPathId ; int nPathId ;
LuaCheckParam( L, 1, nPathId) LuaCheckParam( L, 1, nPathId)
Point3d ptIni ; Point3d ptIni ;
@@ -213,19 +162,37 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
LuaCheckParam( L, 7, dFeed) LuaCheckParam( L, 7, dFeed)
int nFlag ; int nFlag ;
LuaCheckParam( L, 8, nFlag) LuaCheckParam( L, 8, nFlag)
int nFlag2 = 0 ;
bool bToolShow = false ; bool bToolShow = false ;
if ( LuaGetParam( L, 9, nFlag2)) LuaGetParam( L, 9, bToolShow) ;
LuaGetParam( L, 10, bToolShow) ;
else
LuaGetParam( L, 9, bToolShow) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida // verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr || if ( m_pMchLua == nullptr ||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr) m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
return luaL_error( L, " Unknown Machine") ; return luaL_error( L, " Unknown Machine") ;
int nId = AddLinearMove( ptIni, ptFin, m_pMchLua->m_pGeomDB, nPathId, vtTool, vtCorr, vtAux, dFeed, nFlag, nFlag2, bToolShow) ; // creo oggetto linea per DB geometrico
bool bOk = nId != GDB_ID_NULL ; PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
bool bOk = ! IsNull( pLine) ;
// assegno gli estremi della linea
bOk = bOk && pLine->Set( ptIni, ptFin) ;
// inserisco l'oggetto nel DB geometrico
int nId = ( bOk ? m_pMchLua->m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pLine)) : GDB_ID_NULL) ;
bOk = bOk && ( nId != GDB_ID_NULL) ;
// creo oggetto dati Cam
PtrOwner<CamData> pCam( new( nothrow) CamData) ;
bOk = bOk && ! IsNull( pCam) ;
if ( bOk) {
// assegno valori
pCam->SetMoveType( 1) ;
pCam->SetToolDir( vtTool) ;
pCam->SetCorrDir( vtCorr) ;
pCam->SetAuxDir( vtAux) ;
pCam->SetEndPoint( ptFin) ;
pCam->SetFeed( dFeed) ;
pCam->SetFlag( nFlag) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
}
// assegno risultato // assegno risultato
if ( bOk) if ( bOk)
LuaSetParam( L, nId) ; LuaSetParam( L, nId) ;
@@ -308,219 +275,6 @@ Machine::LuaEmtAddArcMove( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
int
Machine::LuaEmtAddClimb( lua_State* L)
{
// 5 o 6 o 7 parametri : nMachId [, sMain], vAxVal, nMask, nFlag, nFlag2 [, sInfo]
int nMachId ;
LuaCheckParam( L, 1, nMachId)
string sMain = MCH_CL ;
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
DBLVECTOR vAxVal ;
LuaCheckParam( L, 2 + nOffs, vAxVal)
int nMask ;
LuaCheckParam( L, 3 + nOffs, nMask)
int nFlag ;
LuaCheckParam( L, 4 + nOffs, nFlag)
int nFlag2 ;
LuaCheckParam( L, 5 + nOffs, nFlag2)
string sInfo = "" ;
LuaGetParam( L, 6 + nOffs, sInfo) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
return luaL_error( L, " Unknown Machine") ;
// verifica "Main" e "Double"
if ( ! EqualNoCase( sMain, MCH_CL) && ! EqualNoCase( sMain, MCH_DBL))
return luaL_error( L, ( " Error in EmtAddClimb : " + sMain).c_str()) ;
// recupero l'operazione
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
// imposto la discesa (primo movimento del primo percorso della lavorazione)
bool bOk = ( pOper != nullptr && pOper->AddSpecialClimb( vAxVal, ( nMask >= 0), GDB_ID_NULL, bMain, nFlag, nFlag2, nMask, sInfo, false)) ;
if ( ! bOk)
return luaL_error( L, " Error in EmtAddClimb") ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtRemoveClimb( lua_State* L)
{
// 1 o 2 parametri : nMachId [, sMain]
int nMachId ;
LuaCheckParam( L, 1, nMachId)
string sMain = MCH_CL ;
LuaGetParam( L, 2, sMain) ;
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
return luaL_error( L, " Unknown Machine") ;
// verifica "Main" e "Double"
if ( ! EqualNoCase( sMain, MCH_CL) && ! EqualNoCase( sMain, MCH_DBL))
return luaL_error( L, ( " Error in EmtAddClimb : " + sMain).c_str()) ;
// recupero l'operazione
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
// elimino le discese (primi movimenti "CLIMB" del primo percorso della lavorazione)
bool bOk = ( pOper != nullptr && pOper->RemoveClimb( GDB_ID_NULL, bMain)) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtAddRise( lua_State* L)
{
// 5 o 6 o 7 parametri : nMachId [, sMain], vAxVal, nMask, nFlag, nFlag2 [, sInfo]
int nMachId ;
LuaCheckParam( L, 1, nMachId)
string sMain = MCH_CL ;
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
DBLVECTOR vAxVal ;
LuaCheckParam( L, 2 + nOffs, vAxVal)
int nMask ;
LuaCheckParam( L, 3 + nOffs, nMask)
int nFlag ;
LuaCheckParam( L, 4 + nOffs, nFlag)
int nFlag2 ;
LuaCheckParam( L, 5 + nOffs, nFlag2)
string sInfo = "" ;
LuaGetParam( L, 6 + nOffs, sInfo) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
return luaL_error( L, " Unknown Machine") ;
// verifica "Main" e "Double"
if ( ! EqualNoCase( sMain, MCH_CL) && ! EqualNoCase( sMain, MCH_DBL))
return luaL_error( L, ( " Error in EmtAddClimb : " + sMain).c_str()) ;
// recupero l'operazione
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
// aggiungo la risalita (ultimo movimento dell'ultimo percorso della lavorazione)
bool bOk = ( pOper != nullptr && pOper->AddSpecialRise( vAxVal, ( nMask >= 0), GDB_ID_NULL, bMain, nFlag, nFlag2, nMask, sInfo)) ;
if ( ! bOk)
return luaL_error( L, " Error in EmtAddRise") ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtRemoveRise( lua_State* L)
{
// 1 o 2 parametri : nMachId [, bMain]
int nMachId ;
LuaCheckParam( L, 1, nMachId)
string sMain = MCH_CL ;
LuaGetParam( L, 2, sMain) ;
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
return luaL_error( L, " Unknown Machine") ;
// verifica "Main" e "Double"
if ( ! EqualNoCase( sMain, MCH_CL) && ! EqualNoCase( sMain, MCH_DBL))
return luaL_error( L, ( " Error in EmtAddClimb : " + sMain).c_str()) ;
// recupero l'operazione
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
// elimino le risalite (ultimi movimenti "RISE" dell'ultimo percorso della lavorazione)
bool bOk = ( pOper != nullptr && pOper->RemoveRise( GDB_ID_NULL, bMain)) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtGetInitialAxesPos( lua_State* L)
{
// 1 o 2 o 3 parametri : nMachId [, sMain] [, bSkipClimb]
int nMachId ;
LuaCheckParam( L, 1, nMachId)
string sMain = MCH_CL ;
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
bool bSkipClimb = true ;
LuaGetParam( L, 2 + nOffs, bSkipClimb) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
return luaL_error( L, " Unknown Machine") ;
// recupero l'operazione
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
// acquisico il valore iniziale degli assi macchina
DBLVECTOR vAxesVal ;
bool bOk = ( pOper != nullptr && pOper->GetInitialAxesValues( bSkipClimb, bMain, vAxesVal)) ;
if ( bOk)
LuaSetParam( L, vAxesVal) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtGetFinalAxesPos( lua_State* L)
{
// 1 o 2 o 3 parametri : nMachId [, sMain] [, bSkipRise]
int nMachId ;
LuaCheckParam( L, 1, nMachId)
bool bSkipRise = true ;
string sMain = MCH_CL ;
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
LuaGetParam( L, 2 + nOffs, bSkipRise) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
return luaL_error( L, " Unknown Machine") ;
// recupero l'operazione
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
// acquisico il valore finale degli assi macchina
DBLVECTOR vAxesVal ;
bool bOk = ( pOper != nullptr && pOper->GetFinalAxesValues( bSkipRise, bMain, vAxesVal)) ;
if ( bOk)
LuaSetParam( L, vAxesVal) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtGetCurrAxesHomePos( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
return luaL_error( L, " Unknown Machine") ;
// acquisisco la posizione di home degli assi della catena cinematica corrente
DBLVECTOR vAxHomeVal ;
bool bOk = m_pMchLua->GetAllCurrAxesHomePos( vAxHomeVal) ;
if ( bOk)
LuaSetParam( L, vAxHomeVal) ;
else
LuaSetParam( L) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
Machine::LuaEmtGetMoveType( lua_State* L) Machine::LuaEmtGetMoveType( lua_State* L)
@@ -597,221 +351,3 @@ Machine::LuaEmtGetBackAuxDir( lua_State* L)
return 1 ; return 1 ;
} }
struct Cyl {
Cyl( void): frCyl( GLOB_FRM), dH( 0.), dRad( 0.) {;} ;
Cyl( const Frame3d& _frCyl, double _dH, double _dRad, double _dLinTol) :
frCyl( _frCyl), dH( _dH), dRad( _dRad) { ;}
Cyl( const Point3d& _ptBase, const Vector3d& vtZ, double _dH, double _dRad, double _dLinTol) :
dH( _dH), dRad( _dRad){
frCyl.Set( _ptBase, vtZ); }
public :
Frame3d frCyl ;
public:
double dH ;
double dRad ;
};
typedef vector<Cyl> OFFSETCYLVECT ;
//----------------------------------------------------------------------------
bool
IsPointInsideCylinder( const Point3d& ptTest, const Cyl& offCyl)
{
Point3d ptTestLoc = ptTest ; ptTestLoc.ToLoc( offCyl.frCyl) ;
if ( ptTestLoc.z > offCyl.dH || ptTestLoc.z < 0)
return false ;
double dDist = ptTestLoc.x * ptTestLoc.x + ptTestLoc.y * ptTestLoc.y ;
double dRadSq = offCyl.dRad * offCyl.dRad ;
if ( dDist > dRadSq)
return false ;
return true ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtAdjustConcavePartsInPath( lua_State* L)
{
bool bOk = true ;
// 3 parametri : nPathId, nAuxPathId, dRad
int nPathId ;
LuaCheckParam( L, 1, nPathId)
int nAuxPathId ;
LuaCheckParam( L, 2, nAuxPathId)
double dRad ;
LuaCheckParam( L, 3, dRad)
LuaClearStack( L) ;
IGeomDB* pGeomDB = m_pMchLua->m_pGeomDB ;
int nId = pGeomDB->GetFirstInGroup( nPathId) ;
int nIdCrvAux = pGeomDB->GetFirstInGroup( nAuxPathId) ;
const ICurve* pCrvAux = GetCurve( pGeomDB->GetGeoObj(nIdCrvAux)) ;
const double dLinTol = 5 * EPS_SMALL ;
while ( nId != GDB_ID_NULL) {
if ( pGeomDB->GetGeoType( nId) == CRV_LINE) {
int nFlag = 0 ; pGeomDB->GetInfo( nId, "Flg2", nFlag) ;
if ( nFlag == 1) {
// scorro i prossimi finchè trovo la fine della zona concava
INTINTVECTOR vLines ;
while ( nFlag == 1 && nId != GDB_ID_NULL) {
nId = pGeomDB->GetNext( nId) ;
if ( nId != GDB_ID_NULL && pGeomDB->GetGeoType( nId) == CRV_LINE) {
int nDerivedFromId = GDB_ID_NULL ;
if ( pGeomDB->GetInfo( nId, "DerivFrom", nDerivedFromId)) {
pGeomDB->GetInfo( nId, "Flg2", nFlag) ;
vLines.emplace_back( nId, nDerivedFromId) ;
}
}
}
OFFSETCYLVECT vCyl ;
// creo un cilindro della dimensione del raggio
for ( int i = 0 ; i < ssize( vLines) ; ++i) {
const IGeoVector3d* pGV = GetGeoVector3d( pGeomDB->GetGeoObj( vLines[i].second)) ;
if ( pGV == nullptr)
return false ;
Point3d ptBase = pGV->GetBase() ;
double dPar = 0 ;
if ( ! pCrvAux->GetParamAtPoint( ptBase, dPar))
return false ;
dPar = round( dPar) ;
if ( dPar > 0) {
Point3d ptStart, ptEnd ;
Vector3d vtHeight ;
pCrvAux->GetPointD1D2( dPar, ICurve::FROM_MINUS, ptEnd, &vtHeight) ;
pCrvAux->GetPointD1D2( dPar - 1, ICurve::FROM_MINUS, ptStart) ;
vtHeight = ptEnd - ptStart ;
double dHeight = vtHeight.Len() ;
// questa altezza dovrebbe coincidere con quella precedentemente calcolata come direzione della linea
vtHeight.Normalize() ;
vCyl.emplace_back( ptStart, vtHeight, dHeight, dRad, dLinTol) ;
}
}
// controllo l'end di ogni linea per verificare se sta nel cilindro definito da uno degli altri tratti
// controllo tutto i punti
bool bErasedSomePart = false ;
bool bErasedPrev = false ;
INTINTVECTOR vInters ;
for ( int i = 0 ; i < ssize( vLines) ; ++i) {
Point3d ptStart, ptEnd ;
const ICurveLine* pCL = GetCurveLine( pGeomDB->GetGeoObj( vLines[i].first)) ;
if ( pCL == nullptr)
return false ;
pCL->GetEndPoint( ptEnd) ;
pCL->GetStartPoint( ptStart) ;
// se stanno in uno dei cilindri degli altri tratti della zona concava
for ( int j = 0 ; j < ssize( vLines) ; ++j) {
if ( i == j)
continue ;
bool bToErase = IsPointInsideCylinder( ptEnd, vCyl[j]) ;
if ( bErasedPrev && ! bToErase)
bToErase = bToErase || IsPointInsideCylinder( ptStart, vCyl[j]) ;
if ( bToErase) {
bErasedSomePart = true ;
bErasedPrev = true ;
vInters.emplace_back(vLines[i].first,i) ;
vInters.emplace_back(vLines[i+1].first,i+1) ;
++i ;
break ;
}
else
bErasedPrev = false ;
}
}
if ( bErasedSomePart) {
// calcolo le intersezioni effettive del primo e ultimo tratto cancellati con i cilindri che li hanno cancellati
// controllo che effettivamente tutti i tratti cancellati siano consecutivi
for ( int i = 1 ; i < ssize( vInters) ; ++i) {
if ( vInters[i].first != vInters[i-1].first + 1)
return false ;
}
for ( int i = 0 ; i < ssize( vInters) ; ++i) {
// cancello i tratti intermedi
if ( i > 0 && i < ssize( vInters) - 1) {
pGeomDB->Erase( vInters[i].first) ;
continue ;
}
// per il primo e ultimo controllo le intersezioni con tutti i cilindri
ICurveLine* pCL = GetCurveLine( pGeomDB->GetGeoObj( vInters[i].first)) ;
Point3d ptStart = pCL->GetStart() ;
Vector3d vtStart ; pCL->GetStartDir( vtStart) ;
double dLen ; pCL->GetLength( dLen) ;
double dUTrim = ( i == 0 ? INFINITO : 0) ;
Point3d ptTrim = P_INVALID ;
for ( int j = 0 ; j < ssize( vCyl) ; ++j) {
if ( vInters[i].second == j)
continue ;
Point3d ptInt1 = P_INVALID, ptInt2 = P_INVALID ;
double dU1, dU2 ;
Vector3d vtN1, vtN2 ;
if ( IntersLineCyl( ptStart, vtStart * dLen, vCyl[j].frCyl, vCyl[j].dH, vCyl[j].dRad, dU1, ptInt1, vtN1, dU2, ptInt2, vtN2)) {
bool bUpdate = ( i == 0 ? dU1 < dUTrim : dU1 > dUTrim) ;
bUpdate = bUpdate && ptInt1.IsValid() && dU1 > 0 && dU1 < 1 ;
bUpdate = bUpdate && vtN1 * vtStart < 0 ;
if ( bUpdate) {
dUTrim = dU1 ;
ptTrim = ptInt1 ;
}
bUpdate = ( i == 0 ? dU2 < dUTrim : dU2 > dUTrim) ;
bUpdate = bUpdate && ptInt2.IsValid() && dU2 > 0 && dU2 < 1 ;
bUpdate = bUpdate && vtN2 * vtStart > 0 ;
if ( bUpdate) {
dUTrim = dU2 ;
ptTrim = ptInt2 ;
}
}
}
if ( ptTrim.IsValid()) {
if ( i == 0) {
pCL->ModifyEnd( ptTrim) ;
double dNewLen ; pCL->GetLength( dNewLen) ;
if ( dNewLen < 0.1) {
int nPrev = pGeomDB->GetPrev( vInters[0].first) ;
pGeomDB->Erase( vInters[0].first) ;
vInters[0].first = nPrev ;
ICurveLine* pCLPrev = GetCurveLine( pGeomDB->GetGeoObj( nPrev)) ;
pCLPrev->ModifyEnd( ptTrim) ;
}
CamData* camData = GetCamData( pGeomDB->GetUserObj( vInters[0].first)) ;
camData->SetEndPoint( ptTrim) ;
}
else {
pCL->ModifyStart( ptTrim) ;
double dNewLen ; pCL->GetLength( dNewLen) ;
if ( dNewLen < 0.1) {
int nNext = pGeomDB->GetNext( vInters[i].first) ;
pGeomDB->Erase( vInters[i].first) ;
vInters[i].first = nNext ;
ICurveLine* pCLNext = GetCurveLine( pGeomDB->GetGeoObj( nNext)) ;
pCLNext->ModifyStart( ptTrim) ;
}
}
}
}
// giunto questi due punti
ICurveLine* pCLprev = GetCurveLine( pGeomDB->GetGeoObj( vInters[0].first)) ;
Point3d ptIni = pCLprev->GetEnd() ;
ICurveLine* pCLnext = GetCurveLine( pGeomDB->GetGeoObj( vInters.back().first)) ;
Point3d ptFin = pCLnext->GetStart() ;
const CamData* camDataPrev = GetCamData( pGeomDB->GetUserObj( vInters[0].first)) ;
const CamData* camDataNext = GetCamData( pGeomDB->GetUserObj( vInters.back().first)) ;
Vector3d vtTool = Media( camDataPrev->GetToolDir(), camDataNext->GetToolDir()) ;
Vector3d vtCorr = Media( camDataPrev->GetCorrDir(), camDataNext->GetCorrDir()) ;
Vector3d vtAux = Media( camDataPrev->GetAuxDir(), camDataNext->GetAuxDir()) ;
double dFeed = camDataPrev->GetFeed() ;
int nFlag = camDataPrev->GetFlag() ;
int nFlag2 = camDataPrev->GetFlag2() ;
bool bToolShow = camDataPrev->GetToolShow() ;
AddLinearMove( ptIni, ptFin, pGeomDB, nPathId, vtTool, vtCorr, vtAux, dFeed, nFlag, nFlag2, bToolShow, vInters[0].first) ;
}
nId = vLines.back().first ;
}
}
nId = m_pMchLua->m_pGeomDB->GetNext( nId) ;
}
LuaSetParam( L, bOk) ;
return 1 ;
}
+1 -12
View File
@@ -81,13 +81,6 @@ enum MchAxisType { MCH_AT_NONE = 0,
MCH_AT_LINEAR = 1, MCH_AT_LINEAR = 1,
MCH_AT_ROTARY = 2} ; MCH_AT_ROTARY = 2} ;
//----------------------------------------------------------------------------
// Uso di assi della macchina
enum MchAxisUse { MCH_AU_NONE = 0,
MCH_AU_GENERAL = 1,
MCH_AU_DISPOSITION = 2,
MCH_AU_AUXILIAR = 3} ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Tipo di testa della macchina // Tipo di testa della macchina
enum MchHeadType { MCH_HT_NONE = 0, enum MchHeadType { MCH_HT_NONE = 0,
@@ -104,7 +97,7 @@ enum MchSelType { MCH_SLT_FIXEDEXITS = 0,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Tipo della catena cinematica // Tipo della catena cinematica
enum KinChainType { KIN_CHAIN_NONE = 0, enum KinChainType { KIN_CHAIN_NONE = 0,
KIN_CHAIN_MCENT = 1, KIN_CHAIN_CENTER = 1,
KIN_CHAIN_ROBOT = 2} ; KIN_CHAIN_ROBOT = 2} ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -160,7 +153,3 @@ const std::string MCH_AGB_ENCV = "AGB_ENCV" ;
// Info in rinvio rotante da sotto per definire la direzione di approccio preferenziale (consentito delta max di 95deg) // Info in rinvio rotante da sotto per definire la direzione di approccio preferenziale (consentito delta max di 95deg)
const std::string MCH_AGB_MDIR = "AGB_MDIR" ; const std::string MCH_AGB_MDIR = "AGB_MDIR" ;
const double MCH_AGB_DELTAMAX_MDIR = cos( 95 * DEGTORAD) ; const double MCH_AGB_DELTAMAX_MDIR = cos( 95 * DEGTORAD) ;
//----------------------------------------------------------------------------
// Info di uscita per indicare quanto mossa lungo la sua Z locale
const std::string MCH_EXIT_VAL = "Val" ;
+142 -1178
View File
File diff suppressed because it is too large Load Diff
+4 -38
View File
@@ -8,7 +8,6 @@
// //
// //
// Modifiche : 07.06.15 DS Creazione modulo. // Modifiche : 07.06.15 DS Creazione modulo.
// 24.02.26 RE Aggiunta Gestione Preview per Utensile e Testa
// //
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -26,7 +25,6 @@ class Machining : public Operation
int GetExitNbr( void) const override ; int GetExitNbr( void) const override ;
const std::string& GetToolTcPos( void) const override ; const std::string& GetToolTcPos( void) const override ;
bool NeedPrevHome( void) const override ; bool NeedPrevHome( void) const override ;
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const override ;
public : public :
virtual bool Prepare( const std::string& sMchName) = 0 ; virtual bool Prepare( const std::string& sMchName) = 0 ;
@@ -42,52 +40,20 @@ class Machining : public Operation
virtual bool GetParam( int nType, int& nVal) const = 0 ; virtual bool GetParam( int nType, int& nVal) const = 0 ;
virtual bool GetParam( int nType, double& dVal) const = 0 ; virtual bool GetParam( int nType, double& dVal) const = 0 ;
virtual bool GetParam( int nType, std::string& sVal) const = 0 ; virtual bool GetParam( int nType, std::string& sVal) const = 0 ;
virtual bool UpdateToolData( void) = 0 ; virtual bool UpdateToolData( bool* pbChanged = nullptr) = 0 ;
virtual const ToolData& GetToolData( void) const = 0 ; virtual const ToolData& GetToolData( void) const = 0 ;
virtual bool GetGeometry( SELVECTOR& vIds) const = 0 ; virtual bool GetGeometry( SELVECTOR& vIds) const = 0 ;
virtual bool GetSkippedGeometry( SELVECTOR& vIds) const
{ vIds.clear() ; return false ; }
public : public :
bool GetStartPoint( Point3d& ptStart) const ; bool GetStartPoint( Point3d& ptStart) const ;
bool GetEndPoint( Point3d& ptEnd) const ; bool GetEndPoint( Point3d& ptEnd) const ;
bool ChangeToolPreviewShow( int nFlag) ; bool PrepareToolPreview( void) const ;
bool PrepareToolPreview( void) ; int ToolPreview( int nEntId, int nFlag) const ;
bool RemoveToolPreview( void) ; bool RemoveToolPreview( void) const ;
int GetToolPreviewStepCount( void) const ;
int ToolPreview( int nEntId, int nStep) const ;
protected : protected :
Machining( void) ; Machining( void) ;
~Machining( void) ;
bool SpecialApply( std::string& sErr) ;
bool PostApply( std::string& sErr) ; bool PostApply( std::string& sErr) ;
int GetDoubleType( const std::string& sUserNotes) const ;
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit, double& dDblLen) const ;
bool CalcMirrorPlaneByDouble( int nDouble, const std::string& sUserNotes, Point3d& ptOn, Vector3d& vtNorm) const ;
bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) const ;
bool ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const ;
private :
int GetToolPreviewNext( int nEntId, int nParentId, int nStId) const ;
int GetToolPreviewPrev( int nEntId, int nParentId, int nStId) const ;
bool MyPrepareToolPreview( bool bDouble) ;
bool MyChangeToolPreviewShow( int nLookFlag, bool bDouble) ;
bool MyToolPreview( int nEntId, bool bDouble) const ;
bool MyShowMultiDrillingTool( const INTVECTOR& vActExit) const ;
private :
int m_nLookFlag ; // flag di Visualizzazione per Preview
// lavorazione singola
int m_nPreviewHeadId ; // Id del gruppo della testa di Preview
int m_nPreviewExitId ; // Id del gruppo dell'uscita di Preview
int m_nPreviewToolTip ; // Id del gruppo contenente il punto ToolTip
INTVECTOR m_vPreviewAxisIds ; // indici degli assi di Preview
// lavorazione in doppio
int m_nPreviewHeadIdDBL ; // Id del gruppo della testa di Preview
int m_nPreviewExitIdDBL ; // Id del gruppo dell'uscita di Preview
int m_nPreviewToolTipDBL ; // Id del gruppo contenente il punto di ToolTip
INTVECTOR m_vPreviewAxisIdsDBL ; // indici degli assi di Preview
} ; } ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
+3 -4
View File
@@ -107,8 +107,7 @@ GetMachiningTitle( int nMchType)
"SurfRoughing", "SurfRoughing",
"SurfFinishing", "SurfFinishing",
"Waterjetting", "Waterjetting",
"5AxisMilling", "5axMachining"} ;
"Probing"} ;
switch ( nMchType) { switch ( nMchType) {
case MT_DRILLING : return MchTitle[1] ; case MT_DRILLING : return MchTitle[1] ;
case MT_SAWING : return MchTitle[2] ; case MT_SAWING : return MchTitle[2] ;
@@ -122,8 +121,8 @@ GetMachiningTitle( int nMchType)
case MT_SURFROUGHING : return MchTitle[10] ; case MT_SURFROUGHING : return MchTitle[10] ;
case MT_SURFFINISHING : return MchTitle[11] ; case MT_SURFFINISHING : return MchTitle[11] ;
case MT_WATERJETTING : return MchTitle[12] ; case MT_WATERJETTING : return MchTitle[12] ;
case MT_FIVEAXISMILLING : return MchTitle[13] ; case MT_5AXMACHINING : return MchTitle[13] ;
case MT_PROBING : return MchTitle[14] ;
} }
return MchTitle[0] ; return MchTitle[0] ;
} }
+31 -31
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2025 // EgalTech 2015-2015
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : MachiningDataFactory.h Data : 31.10.25 Versione : 2.7k1 // File : MachiningDataFactory.h Data : 05.06.15 Versione : 1.6f1
// Contenuto : Factory della classe MachiningData. // Contenuto : Factory della classe MachiningData.
// //
// //
@@ -26,6 +26,35 @@
#define MCHDATA_CREATE( nType) MachiningDataFactory::Create( nType) #define MCHDATA_CREATE( nType) MachiningDataFactory::Create( nType)
#define MCHDATA_GETLIST( vsList) MachiningDataFactory::GetList( vsList) #define MCHDATA_GETLIST( vsList) MachiningDataFactory::GetList( vsList)
//----------------------------------------------------------------------------
template <typename T>
class MachiningDataRegister
{
public :
static bool DoRegister( int nType, const std::string& sName)
{ if ( ! MachiningDataFactory::Register( nType, sName, Create))
return false ;
GetTypePrivate() = nType ;
GetNamePrivate() = sName ;
return true ; }
static MachiningData* Create( void)
{ return new(nothrow) T ; }
static int GetType( void)
{ return GetTypePrivate() ; }
static const std::string& GetName( void)
{ return GetNamePrivate() ; }
private :
MachiningDataRegister( void) {}
~MachiningDataRegister( void) {}
static int& GetTypePrivate( void)
{ static int s_nType ;
return s_nType ; }
static std::string& GetNamePrivate( void)
{ static std::string s_sName ;
return s_sName ; }
} ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class MachiningDataFactory class MachiningDataFactory
{ {
@@ -79,32 +108,3 @@ class MachiningDataFactory
return s_CreatorMap ; return s_CreatorMap ;
} }
} ; } ;
//----------------------------------------------------------------------------
template <typename T>
class MachiningDataRegister
{
public :
static bool DoRegister( int nType, const std::string& sName)
{ if ( ! MachiningDataFactory::Register( nType, sName, Create))
return false ;
GetTypePrivate() = nType ;
GetNamePrivate() = sName ;
return true ; }
static MachiningData* Create( void)
{ return new( std::nothrow) T ; }
static int GetType( void)
{ return GetTypePrivate() ; }
static const std::string& GetName( void)
{ return GetNamePrivate() ; }
private :
MachiningDataRegister( void) {}
~MachiningDataRegister( void) {}
static int& GetTypePrivate( void)
{ static int s_nType ;
return s_nType ; }
static std::string& GetNamePrivate( void)
{ static std::string s_sName ;
return s_sName ; }
} ;
-43
View File
@@ -1,43 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : MachiningRegister.h Data : 02.05.25 Versione : 2.7e1
// Contenuto : Funzioni per registrazione dinamica oggetti delle lavorazioni
// (per decidere tra versioni diverse di una lavorazione).
//
//
// Modifiche : 02.05.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "OperationConst.h"
#include "Pocketing.h"
#include "PocketingNT.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EgtIniFile.h"
//----------------------------------------------------------------------------
// Registrazione dinamica delle svuotature da parametro nel file Ini dell'eseguibile
inline bool
RegisterPocketing( void)
{
const char* SEC_MACH = "Mach" ;
const char* KEY_POCKETING = "Pocketing" ;
static bool bFirst = true ;
if ( bFirst) {
std::string sIniPath ;
ExeGetIniFile( sIniPath) ;
int nPockType = GetPrivateProfileInt( SEC_MACH, KEY_POCKETING, 2, sIniPath.c_str()) ;
if ( nPockType == 2)
UserObjRegister<PocketingNT>::DoRegister( GetOperationClass( OPER_POCKETING)) ;
else
UserObjRegister<Pocketing>::DoRegister( GetOperationClass( OPER_POCKETING)) ;
std::string sInfo = "Mach-Pocketing=" + ToString( nPockType) ;
LOG_INFO( GetEMkLogger(), sInfo.c_str())
bFirst = false ;
}
return true ;
}
+12 -20
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2025 // EgalTech 2015-2024
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : MachiningsMgr.cpp Data : 09.06.25 Versione : 2.7f2 // File : MachiningsMgr.cpp Data : 29.03.24 Versione : 2.6d1
// Contenuto : Implementazione gestore database lavorazioni. // Contenuto : Implementazione gestore database lavorazioni.
// //
// //
@@ -17,7 +17,6 @@
// 09.11.20 DS Agg. per nuovi parametri tagli di lama (MF_CURR_VER = 1011). // 09.11.20 DS Agg. per nuovi parametri tagli di lama (MF_CURR_VER = 1011).
// 04.02.22 DS Agg. per nuovi parametri svuotature con epicicli (MF_CURR_VER = 1012). // 04.02.22 DS Agg. per nuovi parametri svuotature con epicicli (MF_CURR_VER = 1012).
// 29.03.24 DS Agg. parametro APPROX_LINTOL (MF_CURR_VER = 1013). // 29.03.24 DS Agg. parametro APPROX_LINTOL (MF_CURR_VER = 1013).
// 29.03.24 DS Agg. tastatura (MF_CURR_VER = 1014).
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -44,7 +43,7 @@ const string MF_HEADER = "[HEADER]" ;
const string MF_VERSION = "VERSION" ; const string MF_VERSION = "VERSION" ;
const string MF_TOTAL = "TOTAL" ; const string MF_TOTAL = "TOTAL" ;
const string MF_SIZE = "SIZE" ; const string MF_SIZE = "SIZE" ;
const int MF_CURR_VER = 1014 ; const int MF_CURR_VER = 1013 ;
const string MF_GENERAL = "[GENERAL]" ; const string MF_GENERAL = "[GENERAL]" ;
const string MF_3AXCOMP = "3AXCOMP" ; const string MF_3AXCOMP = "3AXCOMP" ;
const bool MF_CURR_3AXCOMP = false ; const bool MF_CURR_3AXCOMP = false ;
@@ -126,12 +125,11 @@ MachiningsMgr::Clear( bool bReset)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachiningsMgr::Load( const string& sMachsDir, const string& sMachsFile, const ToolsMgr* pTsMgr) MachiningsMgr::Load( const string& sMachsFile, const ToolsMgr* pTsMgr)
{ {
// Salvo la path del file con i dati // Salvo la path del file con i dati
m_sMachsDir = sMachsDir ; m_sMachsFile = sMachsFile ;
m_sMachsPath = m_sMachsDir + "\\" + sMachsFile ; string sOut = "MachiningsMgr Init : " + m_sMachsFile ;
string sOut = "MachiningsMgr Init : " + m_sMachsPath ;
LOG_INFO( GetEMkLogger(), sOut.c_str()) LOG_INFO( GetEMkLogger(), sOut.c_str())
// Verifico il gestore degli utensili // Verifico il gestore degli utensili
@@ -160,15 +158,9 @@ MachiningsMgr::Reload( void)
// Inizializzo lo scanner // Inizializzo lo scanner
Scanner TheScanner ; Scanner TheScanner ;
if ( ! TheScanner.Init( m_sMachsPath, ";")) { if ( ! TheScanner.Init( m_sMachsFile, ";")) {
LOG_ERROR( GetEMkLogger(), "ReloadMachinings : Error on Init") LOG_ERROR( GetEMkLogger(), "ReloadMachinings : Error on Init")
if ( ExistsDirectory( m_sMachsDir) && ! ExistsFile( m_sMachsPath)) { return false ;
m_nDbVer = MF_CURR_VER ;
m_bModified = true ;
return true ;
}
else
return false ;
} }
// variabili di stato della lettura // variabili di stato della lettura
@@ -407,17 +399,17 @@ MachiningsMgr::Save( bool bCompressed) const
return true ; return true ;
// Faccio copia di backup del file originale // Faccio copia di backup del file originale
CopyFileEgt( m_sMachsPath, m_sMachsPath + ".bak") ; CopyFileEgt( m_sMachsFile, m_sMachsFile + ".bak") ;
// Inizializzo il writer // Inizializzo il writer
Writer TheWriter ; Writer TheWriter ;
if ( ! TheWriter.Init( m_sMachsPath, bCompressed)) { if ( ! TheWriter.Init( m_sMachsFile, bCompressed)) {
LOG_ERROR( GetEMkLogger(), "SaveMachinings : Error on Init") LOG_ERROR( GetEMkLogger(), "SaveMachinings : Error on Init")
return false ; return false ;
} }
// Scrivo linea di inizio file // Scrivo linea di inizio file
string sOut = "; --- " + m_sMachsPath + " " + CurrDateTime() + " ---" ; string sOut = "; --- " + m_sMachsFile + " " + CurrDateTime() + " ---" ;
if ( ! TheWriter.OutText( sOut)) { if ( ! TheWriter.OutText( sOut)) {
LOG_ERROR( GetEMkLogger(), "SaveMachinings : Error on Start") LOG_ERROR( GetEMkLogger(), "SaveMachinings : Error on Start")
return false ; return false ;
@@ -856,7 +848,7 @@ MachiningsMgr::SetCurrMachiningParam( int nType, double dVal)
} }
// se feed // se feed
else if ( nType == MPA_FEED || nType == MPA_STARTFEED || nType == MPA_ENDFEED || else if ( nType == MPA_FEED || nType == MPA_STARTFEED || nType == MPA_ENDFEED ||
nType == MPA_TIPFEED || nType == MPA_VERTFEED || nType == MPA_BACKFEED || nType == MPA_SIDEANGFEED) { nType == MPA_TIPFEED || nType == MPA_VERTFEED || nType == MPA_BACKFEED) {
// recupero valore da utensile // recupero valore da utensile
const ToolData* pTdata ; const ToolData* pTdata ;
if ( ! m_pCurrMach->GetTool( m_pTsMgr, pTdata)) if ( ! m_pCurrMach->GetTool( m_pTsMgr, pTdata))
+3 -4
View File
@@ -27,7 +27,7 @@ class MachiningsMgr
public : public :
MachiningsMgr( void) ; MachiningsMgr( void) ;
~MachiningsMgr( void) ; ~MachiningsMgr( void) ;
bool Load( const std::string& sMachsDir, const std::string& sMachsFile, const ToolsMgr* pTsMgr) ; bool Load( const std::string& sMachsFile, const ToolsMgr* pTsMgr) ;
bool Reload( void) ; bool Reload( void) ;
bool Save( bool bCompressed = true) const ; bool Save( bool bCompressed = true) const ;
bool GetMachiningNewName( std::string& sName) const ; bool GetMachiningNewName( std::string& sName) const ;
@@ -108,9 +108,8 @@ class MachiningsMgr
typedef STRUUID_MAP::const_iterator STRUUID_CITER ; typedef STRUUID_MAP::const_iterator STRUUID_CITER ;
private : private :
// dir e path file lavorazioni // path file lavorazioni
std::string m_sMachsDir ; std::string m_sMachsFile ;
std::string m_sMachsPath ;
// flag di dati modificati // flag di dati modificati
mutable bool m_bModified ; mutable bool m_bModified ;
// versione DB caricato // versione DB caricato
+406 -1423
View File
File diff suppressed because it is too large Load Diff
+9 -29
View File
@@ -37,14 +37,8 @@ class Milling : public Machining
public : // Operation public : // Operation
int GetType( void) const override int GetType( void) const override
{ return OPER_MILLING ; } { return OPER_MILLING ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override bool IsEmpty( void) const override
{ if ( m_nMills == 0) { return ( m_nMills == 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 bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; } { m_nStatus |= nModif ; return true ; }
@@ -68,7 +62,7 @@ class Milling : public Machining
bool GetParam( int nType, int& nVal) const override ; bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ; bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ; bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( void) override ; bool UpdateToolData( bool* pbChanged = nullptr) override ;
const ToolData& GetToolData( void) const override ; const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ; bool GetGeometry( SELVECTOR& vIds) const override ;
@@ -81,7 +75,6 @@ class Milling : public Machining
double m_dRampLen ; double m_dRampLen ;
double m_dTopLen ; double m_dTopLen ;
} ; } ;
enum ToolCorrEntity { TOOL_CORR_PATH = 0, TOOL_CORR_IN = 1, TOOL_CORR_OUT = 2 } ;
private : private :
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ; bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
@@ -116,7 +109,7 @@ class Milling : public Machining
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, const Vector3d& vtTool, bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, const Vector3d& vtTool,
double dSafeZ, double dSawEndElev, double dEndElev, double dAppr, bool bAddExtract = false) ; double dSafeZ, double dSawEndElev, double dEndElev, double dAppr, bool bAddExtract = false) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool, bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool,
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1) ; double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1) const ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
const Vector3d& vtTool, double dStElev, bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs) ; const Vector3d& vtTool, double dStElev, bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs) ;
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool,
@@ -131,17 +124,14 @@ class Milling : public Machining
bool AddTabsLine( const ICurveLine* pLine, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ; bool AddTabsLine( const ICurveLine* pLine, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ;
bool AddTabsArc( const ICurveArc* pArc, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ; bool AddTabsArc( const ICurveArc* pArc, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ;
double GetRadiusForStartEndElevation( bool bExtra = true) const ; double GetRadiusForStartEndElevation( bool bExtra = true) const ;
bool GetSimplePointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtRetr) const ; bool GetSimplePointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtCorr) const ;
bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtRetr, double dSafeZ) const ; bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, double dSafeZ) const ;
bool GetPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool) const ; bool GetPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
bool GetPointBelowRaw( const Point3d& ptP, const Vector3d& vtTool) const ; bool GetPointBelowRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false, bool bSawSpecial = false) ; bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false, bool bSawSpecial = false) ;
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false, bool bSawSpecial = false) const ; Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false, bool bSawSpecial = false) ;
bool CalcAndSetCorrAuxDir( const Vector3d& vtCorr) ; bool CalcOffset( ICurveComposite* pCompo, double dSignOffs) ;
bool AdjustAllCorrAuxDirToSide( int nId, bool bCcwRot) ;
bool CalcOffset( ICurveComposite* pCompo, double dSignOffs, double dExtraOffs = 0) const ;
bool TrimExtendCurveToClosedStm( ICurveComposite* pCompo, int nCstmId, bool bInvert) ; bool TrimExtendCurveToClosedStm( ICurveComposite* pCompo, int nCstmId, bool bInvert) ;
int GetCorrType( int nToolCompEntity, bool bInvert) const ;
private : private :
double GetSpeed() const double GetSpeed() const
@@ -173,13 +163,7 @@ class Milling : public Machining
return true ; return true ;
return ( IsLeadInHelixOrZigzag() && return ( IsLeadInHelixOrZigzag() &&
m_Params.m_dLiTang >= 0.9 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; } m_Params.m_dLiTang >= 0.9 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
double GetLeadInOutToler( void) const friend class LeadIOStatus ;
{ return ( m_bTHoldFloating ? LIO_ELEV_FLOAT : LIO_ELEV_TOL) ; }
inline double GetToolCompMinRadOffset() const
{ return 100. * EPS_SMALL ; }
inline double GetToolCompPerpLen() const
{ return 2.0 ; }
friend class LeadIOStatus ;
private : private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
@@ -188,7 +172,6 @@ class Milling : public Machining
double m_dTHoldBase ; // posizione base del porta-utensile double m_dTHoldBase ; // posizione base del porta-utensile
double m_dTHoldLen ; // lunghezza del porta-utensile double m_dTHoldLen ; // lunghezza del porta-utensile
double m_dTHoldDiam ; // diametro del porta-utensile double m_dTHoldDiam ; // diametro del porta-utensile
bool m_bTHoldFloating ; // flag di portautensili flottante
int m_nStatus ; // stato di aggiornamento della lavorazione int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nMills ; // numero di percorsi di lavoro generati int m_nMills ; // numero di percorsi di lavoro generati
bool m_bStepOn ; // flag per indicare che effettivamente si lavora a step bool m_bStepOn ; // flag per indicare che effettivamente si lavora a step
@@ -202,9 +185,6 @@ class Milling : public Machining
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
double m_dCurrOscillLen ; // lunghezza corrente lungo il percorso per l'oscillazione double m_dCurrOscillLen ; // lunghezza corrente lungo il percorso per l'oscillazione
double m_dCurrTabsLen ; // lunghezza corrente lungo il percorso per tabs double m_dCurrTabsLen ; // lunghezza corrente lungo il percorso per tabs
bool m_bToolComp ; // correzione raggio utensile abilitata dai dati
Vector3d m_vtLieCorr ; // versore correzione da applicare a fine attacco
Vector3d m_vtLieAux ; // versore ausiliario da applicare a fine attacco
bool m_bStartOutRaw ; // flag forzatura inizio fuori dal grezzo bool m_bStartOutRaw ; // flag forzatura inizio fuori dal grezzo
bool m_bEndOutRaw ; // flag forzatura fine fuori dal grezzo bool m_bEndOutRaw ; // flag forzatura fine fuori dal grezzo
Vector3d m_vtStartDir ; // direzione iniziale del percorso in elaborazione Vector3d m_vtStartDir ; // direzione iniziale del percorso in elaborazione
+93 -127
View File
@@ -17,7 +17,6 @@
#include "DllMain.h" #include "DllMain.h"
#include "Mortising.h" #include "Mortising.h"
#include "OperationConst.h" #include "OperationConst.h"
#include "OperUserNotesConst.h"
#include "/EgtDev/Include/EGkCurveLine.h" #include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h" #include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h" #include "/EgtDev/Include/EGkCurveComposite.h"
@@ -46,7 +45,6 @@ using namespace std ;
// 2511 = "Error in Mortising : post apply not calculable" // 2511 = "Error in Mortising : post apply not calculable"
// 2512 = "Error in Mortising : Tool MaxMaterial too small (xx)" // 2512 = "Error in Mortising : Tool MaxMaterial too small (xx)"
// 2513 = "Error in Mortising : Closed path not allowed" // 2513 = "Error in Mortising : Closed path not allowed"
// 2514 = "Error in Mortising : special apply not calculable"
// 2551 = "Warning in Mortising : Skipped entity (xx)" // 2551 = "Warning in Mortising : Skipped entity (xx)"
// 2552 = "Warning in Mortising : Plunges not found" // 2552 = "Warning in Mortising : Plunges not found"
// 2553 = "Warning in Mortising : Tool name changed (xx)" // 2553 = "Warning in Mortising : Tool name changed (xx)"
@@ -275,7 +273,7 @@ Mortising::SetParam( int nType, int nVal)
if ( ! m_Params.VerifyFaceUse( nVal)) if ( ! m_Params.VerifyFaceUse( nVal))
return false ; return false ;
if ( nVal != m_Params.m_nFaceUse) if ( nVal != m_Params.m_nFaceUse)
m_nStatus |= ( MCH_ST_PARAM_MODIF | MCH_ST_GEO_MODIF) ; m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_nFaceUse = nVal ; m_Params.m_nFaceUse = nVal ;
return true ; return true ;
} }
@@ -416,16 +414,15 @@ Mortising::SetParam( int nType, const string& sVal)
bool bool
Mortising::SetGeometry( const SELVECTOR& vIds) Mortising::SetGeometry( const SELVECTOR& vIds)
{ {
// verifico validità gestore DB geometrico // verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// copia temporanea e reset della geometria corrente // reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ; m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce) // verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
int nType = GEO_NONE ; int nType = GEO_NONE ;
for ( const auto& Id : vIds) { for ( const auto& Id : vIds) {
// test sull'entità // test sull'entità
int nSubs ; int nSubs ;
if ( ! VerifyGeometry( Id, nSubs, nType)) { if ( ! VerifyGeometry( Id, nSubs, nType)) {
string sInfo = "Warning in Mortising : Skipped entity " + ToString( Id) ; string sInfo = "Warning in Mortising : Skipped entity " + ToString( Id) ;
@@ -436,8 +433,7 @@ Mortising::SetGeometry( const SELVECTOR& vIds)
m_vId.emplace_back( Id) ; m_vId.emplace_back( Id) ;
} }
// aggiorno lo stato // aggiorno lo stato
if ( m_vId != vOldId) m_nStatus |= MCH_ST_GEO_MODIF ;
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare // restituisco presenza geometria da lavorare
return ( ! m_vId.empty() || vIds.empty()) ; return ( ! m_vId.empty() || vIds.empty()) ;
} }
@@ -449,14 +445,14 @@ Mortising::Preview( bool bRecalc)
// reset numero percorsi di lavoro generati // reset numero percorsi di lavoro generati
m_nMortises = 0 ; m_nMortises = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo // verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId)) if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ; return false ;
// recupero gruppo per geometria ausiliaria // recupero gruppo per geometria ausiliaria
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ; int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
bool bChain = false ; bool bChain = false ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
if ( nAuxId == GDB_ID_NULL) { if ( nAuxId == GDB_ID_NULL) {
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ; nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxId == GDB_ID_NULL) if ( nAuxId == GDB_ID_NULL)
@@ -484,7 +480,7 @@ Mortising::Preview( bool bRecalc)
} }
// recupero gruppo per geometria di Preview // recupero gruppo per geometria di Preview
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ; int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
if ( nPvId == GDB_ID_NULL) { if ( nPvId == GDB_ID_NULL) {
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ; nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nPvId == GDB_ID_NULL) if ( nPvId == GDB_ID_NULL)
@@ -514,30 +510,26 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
int nCurrMortises = m_nMortises ; int nCurrMortises = m_nMortises ;
m_nMortises = 0 ; m_nMortises = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo // verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId)) if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ; return false ;
// aggiorno dati geometrici dell'utensile // aggiorno dati geometrici dell'utensile
if ( ! UpdateToolData()) { bool bToolChanged = true ;
if ( ! UpdateToolData( &bToolChanged)) {
m_pMchMgr->SetLastError( 2501, "Error in Mortising : UpdateToolData failed") ; m_pMchMgr->SetLastError( 2501, "Error in Mortising : UpdateToolData failed") ;
return false ; return false ;
} }
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento // verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) { if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione // confermo i percorsi di lavorazione
m_nMortises = nCurrMortises ; m_nMortises = nCurrMortises ;
string sLog = string( "Mortising apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ; LOG_DBG_INFO( GetEMkLogger(), "Mortising apply skipped : status already ok") ;
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente // eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply)) if ( ! Update( bPostApply))
return false ; return false ;
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ; LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo // esco con successo
return true ; return true ;
@@ -547,7 +539,7 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per geometria ausiliaria // recupero gruppo per geometria ausiliaria
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ; int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
bool bChain = false ; bool bChain = false ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
if ( nAuxId == GDB_ID_NULL) { if ( nAuxId == GDB_ID_NULL) {
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ; nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxId == GDB_ID_NULL) if ( nAuxId == GDB_ID_NULL)
@@ -564,7 +556,7 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per vista ausiliaria // recupero gruppo per vista ausiliaria
int nAuxViewId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUXVIEW) ; int nAuxViewId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUXVIEW) ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
if ( nAuxViewId == GDB_ID_NULL) { if ( nAuxViewId == GDB_ID_NULL) {
nAuxViewId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ; nAuxViewId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxViewId == GDB_ID_NULL) if ( nAuxViewId == GDB_ID_NULL)
@@ -580,7 +572,7 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per geometria di lavorazione (Cutter Location) // recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ; int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
if ( nClId == GDB_ID_NULL) { if ( nClId == GDB_ID_NULL) {
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ; nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nClId == GDB_ID_NULL) if ( nClId == GDB_ID_NULL)
@@ -632,7 +624,7 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
bool bool
Mortising::Update( bool bPostApply) Mortising::Update( bool bPostApply)
{ {
// verifico validità gestore DB geometrico e Id del gruppo // verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId)) if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ; return false ;
@@ -642,7 +634,7 @@ Mortising::Update( bool bPostApply)
return true ; return true ;
} }
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo) // elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ; RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione // imposto eventuale asse bloccato da lavorazione
@@ -652,7 +644,7 @@ Mortising::Update( bool bPostApply)
string sHint = ExtractHint( m_Params.m_sUserNotes) ; string sHint = ExtractHint( m_Params.m_sUserNotes) ;
if ( ! m_Params.m_sInitAngs.empty()) if ( ! m_Params.m_sInitAngs.empty())
sHint = m_Params.m_sInitAngs ; sHint = m_Params.m_sInitAngs ;
if ( ! CalculateAxesValues( sHint, true)) { if ( ! CalculateAxesValues( sHint, true, true)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ; string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty()) if ( sInfo.empty())
m_pMchMgr->SetLastError( 2507, "Error in Mortising : axes values not calculable") ; m_pMchMgr->SetLastError( 2507, "Error in Mortising : axes values not calculable") ;
@@ -661,19 +653,6 @@ Mortising::Update( bool bPostApply)
return false ; return false ;
} }
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni speciali
string sSpecErr ;
if ( bPostApply && ! SpecialApply( sSpecErr)) {
if ( ! IsEmptyOrSpaces( sSpecErr))
m_pMchMgr->SetLastError( 2514, sSpecErr) ;
else
m_pMchMgr->SetLastError( 2514, "Error in Mortising : special apply not calculable") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione // gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) { if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ; string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
@@ -684,11 +663,14 @@ Mortising::Update( bool bPostApply)
return false ; return false ;
} }
// esecuzione eventuali personalizzazioni finali // assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
string sPostErr ; CalcAndSetAxesBBox() ;
if ( bPostApply && ! PostApply( sPostErr)) {
if ( ! IsEmptyOrSpaces( sPostErr)) // esecuzione eventuali personalizzazioni
m_pMchMgr->SetLastError( 2511, sPostErr) ; string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2511, sErr) ;
else else
m_pMchMgr->SetLastError( 2511, "Error in Mortising : post apply not calculable") ; m_pMchMgr->SetLastError( 2511, "Error in Mortising : post apply not calculable") ;
return false ; return false ;
@@ -827,20 +809,16 @@ Mortising::GetToolData( void) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Mortising::UpdateToolData( void) Mortising::UpdateToolData( bool* pbChanged)
{ {
// recupero il gestore DB utensili della macchina corrente // recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ; ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr) if ( pTMgr == nullptr)
return false ; return false ;
// recupero l'utensile nel DB utensili (se fallisce con UUID provo con il nome) // recupero l'utensile nel DB utensili
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) { if ( pTdata == nullptr)
pTdata = pTMgr->GetTool( m_Params.m_sToolName) ; return false ;
if ( pTdata == nullptr)
return false ;
m_Params.m_ToolUuid = m_TParams.m_Uuid ;
}
// salvo posizione TC, testa e uscita originali // salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ; string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ; string sOrigHead = m_TParams.m_sHead ;
@@ -878,9 +856,9 @@ Mortising::UpdateToolData( void)
m_Params.m_sToolName + ")" ; m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 2554, sInfo) ; m_pMchMgr->SetWarning( 2554, sInfo) ;
} }
// se modificato, aggiusto lo stato // se definito parametro di ritorno, lo assegno
if ( bChanged) if ( pbChanged != nullptr)
m_nStatus = MCH_ST_TO_VERIFY ; *pbChanged = bChanged ;
return true ; return true ;
} }
@@ -888,7 +866,7 @@ Mortising::UpdateToolData( void)
bool bool
Mortising::GetGeometry( SELVECTOR& vIds) const Mortising::GetGeometry( SELVECTOR& vIds) const
{ {
// restituisco l'elenco delle entità // restituisco l'elenco delle entità
vIds = m_vId ; vIds = m_vId ;
return true ; return true ;
} }
@@ -901,7 +879,7 @@ Mortising::VerifyGeometry( SelData Id, int& nSubs, int& nType)
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ; const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
if ( pGObj == nullptr) if ( pGObj == nullptr)
return false ; return false ;
// se ammesse curve ed è tale // se ammesse curve ed è tale
if ( nType != GEO_SURF && ( pGObj->GetType() & GEO_CURVE) != 0) { if ( nType != GEO_SURF && ( pGObj->GetType() & GEO_CURVE) != 0) {
const ICurve* pCurve = nullptr ; const ICurve* pCurve = nullptr ;
// se direttamente la curva // se direttamente la curva
@@ -923,7 +901,7 @@ Mortising::VerifyGeometry( SelData Id, int& nSubs, int& nType)
} }
return ( pCurve != nullptr) ; return ( pCurve != nullptr) ;
} }
// se altrimenti ammesse superfici trimesh ed è tale // se altrimenti ammesse superfici trimesh ed è tale
else if ( nType != GEO_CURVE && ( pGObj->GetType() & GEO_SURF) != 0) { else if ( nType != GEO_CURVE && ( pGObj->GetType() & GEO_SURF) != 0) {
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ; const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
if ( pSurf == nullptr) if ( pSurf == nullptr)
@@ -1038,7 +1016,7 @@ Mortising::GetCurve( SelData Id)
else else
nToolDir = TOOL_PAR_SLANT ; nToolDir = TOOL_PAR_SLANT ;
int nFaceUse = ( m_Params.m_nFaceUse & 31) ; int nFaceUse = ( m_Params.m_nFaceUse & 31) ;
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, V_NULL, {}, m_TParams.m_dThick, 2) ; AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, m_TParams.m_dThick, 2) ;
// la restituisco // la restituisco
return Release( pCrvCompo) ; return Release( pCrvCompo) ;
} }
@@ -1058,7 +1036,7 @@ Mortising::Chain( int nGrpDestId)
for ( const auto& Id : m_vId) { for ( const auto& Id : m_vId) {
// prendo curva // prendo curva
vpCrvs.emplace_back( GetCurve( Id)) ; vpCrvs.emplace_back( GetCurve( Id)) ;
// ne verifico la validità // ne verifico la validità
if ( IsNull( vpCrvs.back())) { if ( IsNull( vpCrvs.back())) {
string sInfo = "Warning in Mortising : Skipped entity " + ToString( Id) ; string sInfo = "Warning in Mortising : Skipped entity " + ToString( Id) ;
m_pMchMgr->SetWarning( 2551, sInfo) ; m_pMchMgr->SetWarning( 2551, sInfo) ;
@@ -1177,7 +1155,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
// recupero gruppo per geometria temporanea // recupero gruppo per geometria temporanea
const string GRP_TEMP = "Temp" ; const string GRP_TEMP = "Temp" ;
int nTempId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, GRP_TEMP) ; int nTempId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, GRP_TEMP) ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
if ( nTempId == GDB_ID_NULL) { if ( nTempId == GDB_ID_NULL) {
nTempId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ; nTempId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nTempId == GDB_ID_NULL) if ( nTempId == GDB_ID_NULL)
@@ -1241,7 +1219,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
m_pMchMgr->SetWarning( 2555, "Warning in Mortising : skipped Path too short") ; m_pMchMgr->SetWarning( 2555, "Warning in Mortising : skipped Path too short") ;
return true ; return true ;
} }
// se una sola entità circonferenza completa, la divido in due per poterla allungare // se una sola entità circonferenza completa, la divido in due per poterla allungare
if ( pCompo->GetCurveCount() == 1 && pCompo->IsClosed()) if ( pCompo->GetCurveCount() == 1 && pCompo->IsClosed())
pCompo->AddJoint( 0.5) ; pCompo->AddJoint( 0.5) ;
// eventuali allungamenti // eventuali allungamenti
@@ -1250,7 +1228,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
return false ; return false ;
dLen += dStartAddLen ; dLen += dStartAddLen ;
} }
if ( dEndAddLen > EPS_SMALL) { if (dEndAddLen > EPS_SMALL) {
if ( ! pCompo->ExtendEndByLen( dEndAddLen)) if ( ! pCompo->ExtendEndByLen( dEndAddLen))
return false ; return false ;
dLen += dEndAddLen ; dLen += dEndAddLen ;
@@ -1330,7 +1308,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
// calcolo l'elevazione massima // calcolo l'elevazione massima
double dElev ; double dElev ;
if ( CalcPathElevation( pCompo, vtTool, vtAux, dDepth, GetRadiusForStartEndElevation(), m_TParams.m_dThick, dElev)) { if ( CalcPathElevation( pCompo, vtTool, dDepth, GetRadiusForStartEndElevation(), m_TParams.m_dThick, dElev)) {
if ( dElev < EPS_SMALL && AreSameVectorApprox( vtExtr, Z_AX)) { if ( dElev < EPS_SMALL && AreSameVectorApprox( vtExtr, Z_AX)) {
BBox3d b3Crv ; BBox3d b3Crv ;
pCompo->GetLocalBBox( b3Crv) ; pCompo->GetLocalBBox( b3Crv) ;
@@ -1341,7 +1319,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
return false ; return false ;
// eventuale imposizione massima elevazione da note utente // eventuale imposizione massima elevazione da note utente
double dMaxElev ; double dMaxElev ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MAXELEV, dMaxElev) && dElev > dMaxElev) if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxElev="), dMaxElev) && dElev > dMaxElev)
dElev = dMaxElev ; dElev = dMaxElev ;
// ingombro aggiuntivo da larghezza sega a catena quando inclinata rispetto al movimento // ingombro aggiuntivo da larghezza sega a catena quando inclinata rispetto al movimento
@@ -1350,12 +1328,12 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
double dCosAng = min( abs( vtTg * vtExtr), cos( 30 * DEGTORAD)) ; double dCosAng = min( abs( vtTg * vtExtr), cos( 30 * DEGTORAD)) ;
double dAddEnc = m_TParams.m_dDiam / 2 * dCosAng / dSinAng ; double dAddEnc = m_TParams.m_dDiam / 2 * dCosAng / dSinAng ;
// affondamento speciale da note utente // affondamento speciale da note utente (!!! da trasformare in parametro come gli altri !!!)
int nPlunge = 0 ; int nPlunge = 0 ;
GetValInNotes( m_Params.m_sUserNotes, UN_PLUNGE, nPlunge) ; FromString( ExtractInfo( m_Params.m_sUserNotes, "Plunge="), nPlunge) ;
// verifico che lo step dell'utensile sia sensato // verifico che lo step dell'utensile sia sensato
double dOkStep = ( nPlunge == MORTISE_PLUNGE_STEP || nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ ? m_Params.m_dStep : 0) ; double dOkStep = ( nPlunge == MORTISE_PLUNGE_STEP ? m_Params.m_dStep : 0) ;
const double MIN_ZSTEP = 1.0 ; const double MIN_ZSTEP = 1.0 ;
if ( dOkStep >= EPS_SMALL && dOkStep < MIN_ZSTEP) { if ( dOkStep >= EPS_SMALL && dOkStep < MIN_ZSTEP) {
dOkStep = MIN_ZSTEP ; dOkStep = MIN_ZSTEP ;
@@ -1373,7 +1351,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
return false ; return false ;
} }
// se lo step supera la capacità dell'utensile // se lo step supera la capacità dell'utensile
if ( dOkStep > m_TParams.m_dMaxMat + EPS_SMALL) { if ( dOkStep > m_TParams.m_dMaxMat + EPS_SMALL) {
dOkStep = m_TParams.m_dMaxMat ; dOkStep = m_TParams.m_dMaxMat ;
string sInfo = "Warning in Mortising : machining step (" + ToString( m_Params.m_dStep, 1) + string sInfo = "Warning in Mortising : machining step (" + ToString( m_Params.m_dStep, 1) +
@@ -1437,12 +1415,12 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Mortising::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtAux, Mortising::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dThick,
double dDepth, double dRad, double dThick, double& dElev) const double& dElev) const
{ {
dElev = 0 ; dElev = 0 ;
const double DELTA_ELEV_RAD = 20.0 ; int nMaxInd = pCompo->GetCurveCount() - 1 ;
for ( int i = 0 ; i < pCompo->GetCurveCount() ; ++ i) { for ( int i = 0 ; i <= nMaxInd ; ++ i) {
// curva corrente // curva corrente
const ICurve* pCrvC = pCompo->GetCurve( i) ; const ICurve* pCrvC = pCompo->GetCurve( i) ;
// calcolo elevazione // calcolo elevazione
@@ -1451,16 +1429,17 @@ Mortising::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtT
pCrvC->GetStartPoint( ptStart) ; pCrvC->GetStartPoint( ptStart) ;
pCrvC->GetMidPoint( ptMid) ; pCrvC->GetMidPoint( ptMid) ;
pCrvC->GetEndPoint( ptEnd) ; pCrvC->GetEndPoint( ptEnd) ;
Vector3d vtStart, vtEnd ; Vector3d vtStartPerp, vtEndPerp ;
pCrvC->GetStartDir( vtStart) ; pCrvC->GetStartDir( vtStartPerp) ;
pCrvC->GetEndDir( vtEnd) ; vtStartPerp *= -dRad ;
ptStart += -dRad * vtStart + 0.5 * dThick * vtAux ; pCrvC->GetEndDir( vtEndPerp) ;
ptMid += 0.5 * dThick * vtAux ; vtEndPerp *= dRad ;
ptEnd += dRad * vtEnd + 0.5 * dThick * vtAux ; Vector3d vtTg ; pCrvC->GetMidDir( vtTg) ;
Vector3d vtOrtho = vtAux ; Vector3d vtOrtho = vtTool ^ vtTg ;
vtOrtho *= 0.5 * dThick + DELTA_ELEV_RAD ; vtOrtho.Normalize() ;
vtOrtho *= dThick ;
Vector3d vtDepth = -vtTool * dDepth ; Vector3d vtDepth = -vtTool * dDepth ;
// in centro utensile // linea centro utensile
if ( GetElevation( m_nPhase, ptStart + vtDepth, ptMid + vtDepth, ptEnd + vtDepth, vtTool, dCurrElev)) { if ( GetElevation( m_nPhase, ptStart + vtDepth, ptMid + vtDepth, ptEnd + vtDepth, vtTool, dCurrElev)) {
if ( dCurrElev > dElev) if ( dCurrElev > dElev)
dElev = dCurrElev ; dElev = dCurrElev ;
@@ -1478,8 +1457,19 @@ Mortising::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtT
m_pMchMgr->SetLastError( 2505, "Error in Mortising : Entity GetElevation") ; m_pMchMgr->SetLastError( 2505, "Error in Mortising : Entity GetElevation") ;
return false ; return false ;
} }
// sotto centro utensile // da una parte
if ( GetElevation( m_nPhase, ptStart + vtDepth - vtOrtho, ptMid + vtDepth - vtOrtho, ptEnd + vtDepth - vtOrtho, vtTool, dCurrElev)) { if ( GetElevation( m_nPhase, ptStart + vtStartPerp + vtDepth, ptMid + vtDepth,
ptEnd + vtEndPerp + vtDepth, vtTool, dCurrElev)) {
if ( dCurrElev > dElev)
dElev = dCurrElev ;
}
else {
m_pMchMgr->SetLastError( 2505, "Error in Mortising : Entity GetElevation") ;
return false ;
}
// dall'altra parte
if ( GetElevation( m_nPhase, ptStart + vtStartPerp + vtDepth, ptMid + vtDepth,
ptEnd + vtEndPerp + vtDepth, vtTool, dCurrElev)) {
if ( dCurrElev > dElev) if ( dCurrElev > dElev)
dElev = dCurrElev ; dElev = dCurrElev ;
} }
@@ -1509,7 +1499,7 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ; Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ; Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
// verifico se affondamento ripetuto è veramente tale // verifico se affondamento ripetuto è veramente tale
if ( ( nPlunge == MORTISE_PLUNGE_START_END || nPlunge == MORTISE_PLUNGE_START_TO_END) && Dist( ptStart, ptEnd) < 10 * EPS_SMALL) if ( ( nPlunge == MORTISE_PLUNGE_START_END || nPlunge == MORTISE_PLUNGE_START_TO_END) && Dist( ptStart, ptEnd) < 10 * EPS_SMALL)
nPlunge = MORTISE_PLUNGE_START ; nPlunge = MORTISE_PLUNGE_START ;
@@ -1523,7 +1513,7 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
return false ; return false ;
} }
// se altrimenti affondamenti ripetuti da inizio a fine con ritorno basso // se alrimenti affondamenti ripetuti da inizio a fine con ritorno basso
else if ( nPlunge == MORTISE_PLUNGE_START_TO_END) { else if ( nPlunge == MORTISE_PLUNGE_START_TO_END) {
// distanza e vettore spostamento laterale // distanza e vettore spostamento laterale
Vector3d vtDir = ptEnd - ptStart ; Vector3d vtDir = ptEnd - ptStart ;
@@ -1533,7 +1523,7 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
int kMax = ( int) floor( dLen / m_TParams.m_dDiam) ; int kMax = ( int) floor( dLen / m_TParams.m_dDiam) ;
for ( int k = 0 ; k <= kMax ; ++ k) { for ( int k = 0 ; k <= kMax ; ++ k) {
Point3d ptNewStart = ptStart + vtDir * k * m_TParams.m_dDiam ; Point3d ptNewStart = ptStart + vtDir * k * m_TParams.m_dDiam ;
// se non è finale // se non è finale
if ( k != kMax || ! AreSamePointEpsilon( ptNewStart, ptEnd, 10 * EPS_SMALL)) { if ( k != kMax || ! AreSamePointEpsilon( ptNewStart, ptEnd, 10 * EPS_SMALL)) {
if ( ! GenerateOnePlungeCl( ptNewStart, ptEnd, vtTool, dDepth, dElev, dOkStep, MORTISE_PLUNGE_START, k == 0)) if ( ! GenerateOnePlungeCl( ptNewStart, ptEnd, vtTool, dDepth, dElev, dOkStep, MORTISE_PLUNGE_START, k == 0))
return false ; return false ;
@@ -1565,18 +1555,9 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
{ {
// compensazione elevazione/affondamento // compensazione elevazione/affondamento
double dDelta = dElev - dDepth ; double dDelta = dElev - dDepth ;
// pre-calcolo step per modalità con step
int nStep = 1 ;
double dStep = dElev ;
if ( nPlunge == MORTISE_PLUNGE_STEP || nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ) {
if ( dOkStep < EPS_SMALL)
dOkStep = dElev ;
nStep = max( 1, static_cast<int>( ceil( ( dElev - 10 * EPS_SMALL) / dOkStep))) ;
dStep = dElev / nStep ;
}
// determino se l'inizio dell'attacco è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione // determino se l'inizio dell'attacco è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
double dSafeZ = GetSafeZ() + GetDeltaSafeZ( vtTool) ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() + m_pMchMgr->GetDeltaSafeZ( m_TParams.m_sHead) ;
double dStartElev = 0 ; double dStartElev = 0 ;
Point3d ptLi = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * dDelta ; Point3d ptLi = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * dDelta ;
bool bUnderStart = GetAhPointUnderRaw( ptLi, vtTool, 0, bool bUnderStart = GetAhPointUnderRaw( ptLi, vtTool, 0,
@@ -1585,26 +1566,17 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
if ( ! bUnderStart) if ( ! bUnderStart)
GetElevation( m_nPhase, ptLi, vtTool, GetRadiusForStartEndElevation(), vtTool, dStartElev) ; GetElevation( m_nPhase, ptLi, vtTool, GetRadiusForStartEndElevation(), vtTool, dStartElev) ;
// sicurezza su punto iniziale
double dAppr = dStartElev + dSafeZ ;
if ( nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ) {
double dStartDownElev ;
if ( ! GetElevation( m_nPhase, ptStart, vtTool, GetRadiusForStartEndElevation(), vtTool, dStartDownElev))
dStartDownElev = dDelta ;
if ( dStartDownElev < EPS_SMALL)
dAppr = -dStep ;
}
// 1 -> punto approccio // 1 -> punto approccio
int nFirstFlag = ( bFirst ? 1 : 0) ; int nFirstFlag = ( bFirst ? 1 : 0) ;
SetFlag( nFirstFlag) ; SetFlag( nFirstFlag) ;
Point3d ptP1 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + dAppr) ; Point3d ptP1 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + dStartElev + dSafeZ) ;
if ( AddRapidStartOrMove( ptP1, bFirst) == GDB_ID_NULL) int nStart = AddRapidStartOrMove( ptP1, bFirst) ;
if ( nStart == GDB_ID_NULL)
return false ; return false ;
SetFlag( 0) ; SetFlag( 0) ;
// 2 -> punto fuori (se diverso dal precedente) // 2 -> punto fuori (se diverso dal precedente)
if ( m_Params.m_dStartPos < dAppr - 10 * EPS_SMALL) { if ( m_Params.m_dStartPos < dSafeZ - 10 * EPS_SMALL) {
Point3d ptP2 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + m_Params.m_dStartPos) ; Point3d ptP2 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + m_Params.m_dStartPos) ;
if ( AddRapidMove( ptP2) == GDB_ID_NULL) if ( AddRapidMove( ptP2) == GDB_ID_NULL)
return false ; return false ;
@@ -1632,6 +1604,10 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
} }
else { else {
// determino numero e affondamento degli step // determino numero e affondamento degli step
if ( dOkStep < EPS_SMALL)
dOkStep = dElev ;
int nStep = max( 1, static_cast<int>( ceil( ( dElev - 10 * EPS_SMALL) / dOkStep))) ;
double dStep = dElev / nStep ;
const double RETURN_DIST = 10 ; const double RETURN_DIST = 10 ;
// a seconda del tipo // a seconda del tipo
switch ( m_Params.m_nStepType) { switch ( m_Params.m_nStepType) {
@@ -1641,7 +1617,7 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
SetFeed( GetStartFeed()) ; SetFeed( GetStartFeed()) ;
SetFlag( 0) ; SetFlag( 0) ;
Point3d ptP3 = (( i % 2 == 1) ? ptStart : ptEnd) + ( dDelta - i * dStep) * vtTool ; Point3d ptP3 = (( i % 2 == 1) ? ptStart : ptEnd) + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL && ! ( i == 1 && nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ)) if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ; return false ;
// 4 -> punto termine // 4 -> punto termine
SetFeed( GetFeed()) ; SetFeed( GetFeed()) ;
@@ -1687,7 +1663,7 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
} }
} }
// determino se la fine dell'uscita è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione // determino se la fine dell'uscita è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
double dEndElev = 0 ; double dEndElev = 0 ;
Point3d ptLo = ptLast + vtTool * dDelta ; Point3d ptLo = ptLast + vtTool * dDelta ;
bool bUnderEnd = GetAhPointUnderRaw( ptLo, vtTool, 0, bool bUnderEnd = GetAhPointUnderRaw( ptLo, vtTool, 0,
@@ -1696,20 +1672,10 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
if ( ! bUnderEnd) if ( ! bUnderEnd)
GetElevation( m_nPhase, ptLo, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndElev) ; GetElevation( m_nPhase, ptLo, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndElev) ;
// sicurezza su punto finale
double dRetr = dEndElev + dSafeZ ;
if ( nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ) {
double dEndDownElev ;
if ( ! GetElevation( m_nPhase, ptStart, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndDownElev))
dEndDownElev = dDelta ;
if ( dEndDownElev < EPS_SMALL)
dRetr = dEndElev - dStep ;
}
// 6 -> ritorno all'approccio // 6 -> ritorno all'approccio
SetFeed( GetEndFeed()) ; SetFeed( GetEndFeed()) ;
SetFlag( 104) ; // risalita sopra la fine SetFlag( 104) ; // risalita sopra la fine
Point3d ptP6 = ptLast + vtTool * ( dDelta + dRetr) ; Point3d ptP6 = ptLast + vtTool * ( dDelta + dEndElev + dSafeZ) ;
if ( AddLinearMove( ptP6) == GDB_ID_NULL) if ( AddLinearMove( ptP6) == GDB_ID_NULL)
return false ; return false ;
+4 -10
View File
@@ -36,14 +36,8 @@ class Mortising : public Machining
public : // Operation public : // Operation
int GetType( void) const override int GetType( void) const override
{ return OPER_MORTISING ; } { return OPER_MORTISING ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override bool IsEmpty( void) const override
{ if ( m_nMortises == 0) { return ( m_nMortises == 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 bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; } { m_nStatus |= nModif ; return true ; }
@@ -65,7 +59,7 @@ class Mortising : public Machining
bool GetParam( int nType, int& nVal) const override ; bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ; bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ; bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( void) override ; bool UpdateToolData( bool* pbChanged = nullptr) override ;
const ToolData& GetToolData( void) const override ; const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ; bool GetGeometry( SELVECTOR& vIds) const override ;
@@ -78,7 +72,7 @@ class Mortising : public Machining
bool Chain( int nGrpDestId) ; bool Chain( int nGrpDestId) ;
bool CalcSurfAuxView( int nAuxId, int nAuxViewId) ; bool CalcSurfAuxView( int nAuxId, int nAuxViewId) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ; bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtAux, double dDepth, double dRad, double dThick, double& dElev) const ; bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dThick, double& dElev) const ;
bool GenerateMortisingPv( int nPathId, const ICurveComposite* pCompo) ; bool GenerateMortisingPv( int nPathId, const ICurveComposite* pCompo) ;
bool GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep, int nPlunge) ; bool GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep, int nPlunge) ;
bool GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep, bool GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep,
-83
View File
@@ -1,83 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : OperUserNotesConst.h Data : 10.11.25 Versione : 2.7k3
// Contenuto : Costanti per le note utente delle operazioni.
//
//
//
// Modifiche : 10.11.25 DS Creazione modulo.
//
//
//
//----------------------------------------------------------------------------
#pragma once
#include <string>
//----------------------------------------------------------------------------
// Generali
static const std::string UN_MAXELEV = "MaxElev" ;
static const std::string UN_TRIMEXT = "TrimExt" ;
static const std::string UN_OPEN = "Open" ;
static const std::string UN_LINTOL = "LinTol" ;
static const std::string UN_DOUBLE = "DOUBLE" ;
static const std::string UN_MIRRORAX = "MirrorAx" ;
static const std::string UN_DELTAZ = "DeltaZ" ;
static const std::string UN_VTAUXDIR = "VtAuxDir" ;
static const std::string UN_STARTZMAX = "StartZmax" ;
// Solo per Drilling
static const std::string UN_LASTSTEP = "LastStep" ;
// Solo per FiveAxisMilling
static const std::string UN_SINGCONEANG = "SingConeAng" ;
// Solo per GenMachining
static const std::string UN_VPL_COLON = "Vpl:" ;
// Solo per Milling
static const std::string UN_OUTRAW = "OutRaw" ;
static const std::string UN_SIDEELEV = "SideElev" ;
static const std::string UN_VTFACEUSE = "VtFaceUse" ;
static const std::string UN_EDGESFACEUSE = "EdgesFaceUse" ;
// Solo per Mortising
static const std::string UN_PLUNGE = "Plunge" ;
// Solo per Pocketing o PocketingNT
static const std::string UN_OPENOUTRAW = "OpenOutRaw" ;
static const std::string UN_OPENMINSAFE = "OpenMinSafe" ;
static const std::string UN_MAXOPTSIZE = "MaxOptSize" ;
static const std::string UN_PROJEXT = "ExtProj" ;
static const std::string UN_ADJUSTFEED = "AdjustFeed" ;
static const std::string UN_MINFEED = "MinFeed" ;
static const std::string UN_TOOL_COMPENSATION = "ToolCompensation" ;
static const std::string UN_START_PNT = "StartPoint" ;
// Solo per Sawing
static const std::string UN_DOWNSE = "DownSE" ;
static const std::string UN_FSTA = "Fsta" ;
static const std::string UN_FEND = "Fend" ;
static const std::string UN_SWE = "SWE" ;
static const std::string UN_EWE = "EWE" ;
// Solo per SurfFinishing
static const std::string UN_SKIPMAXDOWN = "SkipMaxDown" ;
static const std::string UN_SPLITANGLE = "SplitAngle" ;
static const std::string UN_TYPE = "Type" ;
static const std::string UN_STEPNUMBER = "StepNumber" ;
static const std::string UN_BITANGANG = "BiTangAng" ;
static const std::string UN_OPTIMALTYPE = "OptimalType" ;
static const std::string UN_ANGLETOL = "AngleTol" ;
static const std::string UN_TILT_ANGS = "Tilt" ;
// Solo per SurfRoughing
static const std::string UN_PLANEZ = "PlaneZ" ;
static const std::string UN_ORDER = "Order" ;
static const std::string UN_SUPP_RAD_OFFS = "SuppRadOffs" ;
// come per PocketingNT, viene usato il parametro UN_MINFEED
// Solo per Waterjetting
static const std::string UN_START = "START" ;
+873 -2759
View File
File diff suppressed because it is too large Load Diff
+44 -152
View File
@@ -1,14 +1,14 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2016-2025 // EgalTech 2016-2019
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : Operation.h Data : 09.05.25 Versione : 2.7e2 // File : Operation.h Data : 17.06.19 Versione : 2.1f2
// Contenuto : Dichiarazione della classe Operation da cui derivano // Contenuto : Dichiarazione della classe Operation da cui derivano
// Disposition e Machining. // Disposition e Machining.
// //
// //
// //
// Modifiche : 29.04.16 DS Creazione modulo. // Modifiche : 29.04.16 DS Creazione modulo.
// 09.05.25 DS Generalizzazionee funzione IsEmpty con tipo (EMPTY_*). //
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -17,7 +17,6 @@
#include "MachMgr.h" #include "MachMgr.h"
#include "MachConst.h" #include "MachConst.h"
#include "MachineStruConst.h" #include "MachineStruConst.h"
#include "CamData.h"
#include "/EgtDev/Include/EGkPoint3d.h" #include "/EgtDev/Include/EGkPoint3d.h"
#include "/EgtDev/Include/EGkUserObj.h" #include "/EgtDev/Include/EGkUserObj.h"
#include "/EgtDev/Include/EGkSelection.h" #include "/EgtDev/Include/EGkSelection.h"
@@ -30,8 +29,6 @@ class ICurveComposite ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class Operation : public IUserObj class Operation : public IUserObj
{ {
friend class Machine ;
public : // IUserObj public : // IUserObj
bool SetOwner( int nId, IGeomDB* pGDB) override ; bool SetOwner( int nId, IGeomDB* pGDB) override ;
int GetOwner( void) const override ; int GetOwner( void) const override ;
@@ -45,25 +42,20 @@ class Operation : public IUserObj
{ m_nPhase = nPhase ; return true ; } { m_nPhase = nPhase ; return true ; }
virtual int GetPhase( void) const virtual int GetPhase( void) const
{ return m_nPhase ; } { return m_nPhase ; }
virtual bool RemoveHome( bool bMain = true) ; virtual bool RemoveHome( void) ;
std::string GetName( void) const ; std::string GetName( void) const ;
public : public :
virtual int GetType( void) const = 0 ; virtual int GetType( void) const = 0 ;
virtual bool IsEmpty( int nEmptyType = 0) const = 0 ; virtual bool IsEmpty( void) const = 0 ;
virtual bool UpdateStatus( int nModif) = 0 ; virtual bool UpdateStatus( int nModif) = 0 ;
public :
bool GetInitialAxesValues( bool bSkipClimb, bool bMain, DBLVECTOR& vAxVal) const ;
bool GetFinalAxesValues( bool bSkipRise, bool bMain, DBLVECTOR& vAxVal) const ;
protected : protected :
virtual const std::string& GetToolName( void) const = 0 ; virtual const std::string& GetToolName( void) const = 0 ;
virtual const std::string& GetHeadName( void) const = 0 ; virtual const std::string& GetHeadName( void) const = 0 ;
virtual int GetExitNbr( void) const = 0 ; virtual int GetExitNbr( void) const = 0 ;
virtual int GetSolCh( void) const = 0 ; virtual int GetSolCh( void) const = 0 ;
virtual const std::string& GetToolTcPos( void) const = 0 ; virtual const std::string& GetToolTcPos( void) const = 0 ;
virtual bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const = 0 ;
virtual bool NeedPrevHome( void) const = 0 ; virtual bool NeedPrevHome( void) const = 0 ;
virtual bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const virtual bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
{ return true ; } { return true ; }
@@ -73,62 +65,22 @@ class Operation : public IUserObj
{ return ( bSplit && ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot())) ; } { return ( bSplit && ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot())) ; }
virtual double GetMaxSplitLen( bool bSplit = true, bool bFeed = true) const virtual double GetMaxSplitLen( bool bSplit = true, bool bFeed = true) const
{ return ( bSplit && ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot()) ? ( bFeed ? 5 : 50) : 0) ; } { return ( bSplit && ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot()) ? ( bFeed ? 5 : 50) : 0) ; }
virtual double GetSafeZ( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 100 ; // MF_CURR_SAFEZ in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ; }
virtual double GetSafeAggrBottZ( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 10 ; // MF_CURR_SAFEAGGRBOTTZ in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ; }
virtual double GetExtraLOnCutRegion( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 0 ; // MF_CURR_EXTRALCR in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ; }
virtual double GetExtraROnDrillRegion( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 0 ; // MF_CURR_EXTRARDR in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetExtraROnDrillRegion() ; }
virtual double GetHoleDiamToler( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 10 * EPS_SMALL ; // MF_CURR_HOLEDTOL in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ; }
virtual double GetExtSawArcMinRad( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 200 ; // MF_CURR_EXTSAWARCMINRAD in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetExtSawArcMinRad() ; }
virtual double GetIntSawArcMaxSideAng( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 45 ; // MF_CURR_INTSAWARCMAXSIDEANG in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetIntSawArcMaxSideAng() ; }
virtual bool GetSplitArcs( const Vector3d& vtTool) const virtual bool GetSplitArcs( const Vector3d& vtTool) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot() || { if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot())
m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return true ; return true ;
int nSplitArcs = m_pMchMgr->GetCurrMachiningsMgr()->GetSplitArcs() ; int nSplitArcs = m_pMchMgr->GetCurrMachiningsMgr()->GetSplitArcs() ;
return ( nSplitArcs == SPLAR_ALWAYS || return ( nSplitArcs == SPLAR_ALWAYS ||
( nSplitArcs == SPLAR_NO_XY_PLANE && ! vtTool.IsZplus()) || ( nSplitArcs == SPLAR_NO_XY_PLANE && ! vtTool.IsZplus()) ||
( nSplitArcs == SPLAR_GEN_PLANE && vtTool.IsGeneric())) ; } ( nSplitArcs == SPLAR_GEN_PLANE && vtTool.IsGeneric())) ; }
virtual double GetApproxLinTol( void) const virtual double GetApproxLinTol( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr) { if ( m_pMchMgr == nullptr)
return 50 * EPS_SMALL ; // MF_APPROX_LINTOL in MachiningsMgr return 50 * EPS_SMALL ;
return m_pMchMgr->GetCurrMachiningsMgr()->GetApproxLinTol() ; } return m_pMchMgr->GetCurrMachiningsMgr()->GetApproxLinTol() ; }
virtual double GetMaxDepthSafe( void) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachiningsMgr() == nullptr)
return 2 ; // MF_CURR_MAXDEPTHSAFE in MachiningsMgr
return m_pMchMgr->GetCurrMachiningsMgr()->GetMaxDepthSafe() ; }
protected : protected :
Operation( void) ; Operation( void) ;
protected : protected :
bool IsAtLeastOnePathOk( void) const ;
bool AreAllPathsOk( void) const ;
bool GetToolpathsStatus( int& nCnt, int& nEmpty) const ;
int GetFirstFullToolpath( bool bMain = true) const ;
int GetNextFullToolpath( int nClPathId, bool bMain = true) const ;
int GetLastFullToolpath( bool bMain = true) const ;
int GetPrevFullToolpath( int nClPathId, bool bMain = true) const ;
bool UpdateFollowingOperationsStatus( int nModif) ; bool UpdateFollowingOperationsStatus( int nModif) ;
bool GetElevation( int nPhase, const Point3d& ptP, bool GetElevation( int nPhase, const Point3d& ptP,
const Vector3d& vtDir, double& dElev) const ; const Vector3d& vtDir, double& dElev) const ;
@@ -146,8 +98,6 @@ class Operation : public IUserObj
const Vector3d& vtDir, double& dElev) const ; const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, double dLen, bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, double dLen,
const Vector3d& vtDir, double& dElev) const ; const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, double dLen, double dSafeDist,
const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtTool, double dRad, double dLen, bool GetElevation( int nPhase, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtTool, double dRad, double dLen,
const Vector3d& vtDir, double& dElev) const ; const Vector3d& vtDir, double& dElev) const ;
bool GetAhPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev, bool GetAhPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
@@ -155,7 +105,6 @@ class Operation : public IUserObj
bool GetUhPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev, bool GetUhPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const ; double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const ;
bool GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist) const ; bool GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist) const ;
bool GetAggrBottDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double dEncSafeH, double& dDist) const ;
bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand, bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand,
double& dDist, Vector3d& vtDir) const ; double& dDist, Vector3d& vtDir) const ;
bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand, bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand,
@@ -169,8 +118,7 @@ class Operation : public IUserObj
bool GetRawGlobBox( int nPhase, const BBox3d& b3Test, double dToler, BBox3d& b3Raw) const ; bool GetRawGlobBox( int nPhase, const BBox3d& b3Test, double dToler, BBox3d& b3Raw) const ;
bool GetCurrRawsGlobBox( BBox3d& b3Raw) const ; bool GetCurrRawsGlobBox( BBox3d& b3Raw) const ;
bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, const Vector3d& vtFaceUse, bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, double dToolThick, int nGrade = 3) ;
const INTVECTOR& vnEdgesFaceUse, double dToolThick, int nGrade = 3) ;
bool ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp = false) const ; bool ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp = false) const ;
bool ApproxWithLines( ICurveComposite* pCompo, bool bFeed = true) const ; bool ApproxWithLines( ICurveComposite* pCompo, bool bFeed = true) const ;
bool VerifyArcs( ICurveComposite* pCompo, double dMaxAngCen = MAX_ANG_CEN) const ; bool VerifyArcs( ICurveComposite* pCompo, double dMaxAngCen = MAX_ANG_CEN) const ;
@@ -178,89 +126,43 @@ class Operation : public IUserObj
bool CalcAndSetBBox( int nClId) ; bool CalcAndSetBBox( int nClId) ;
bool CalcAndSetAxesBBox( void) ; bool CalcAndSetAxesBBox( void) ;
std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ; bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) ;
std::string ExtractHint( const std::string& sNotes) const ;
bool SetBlockedRotAxis( const std::string& sBlockedAxis, bool bToolSetOk = false) const ;
bool CalculateAxesValues( const std::string& sHint, bool bSolChExact = false, double dSingConeAng = SING_CONE_ANG_DFLT) ;
bool CalculateDoubleAxesValues( const std::string& sHint, bool bSolChExact = false, double dSingConeAng = SING_CONE_ANG_DFLT) ;
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
bool RemoveClimbRiseHome( bool bMain = true) ;
double GetDeltaSafeZ( const Vector3d& vtTool) const ;
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, double dStartOffsX, const DBLVECTOR& vAxEnd, int* pnLKAMO = nullptr) const ;
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
bool IsAggrBottom( const std::string& sHead) const ;
private : bool GetInitialAxesValues( bool bSkipClimb, DBLVECTOR& vAxVal) const ;
struct Position {
int nSide ;
DBLVECTOR vAxis ;
int nFlag ;
int nFlag2 ;
int nMask ;
std::string sInfo ;
Position() : nSide( 0), nFlag( 0), nFlag2( 0), nMask( -1) {}
} ;
typedef std::vector<Position> POSVECTOR ;
private :
bool GetClPathInitialAxesValues( int nClPathId, bool bSkipClimb, DBLVECTOR& vAxVal) const ; bool GetClPathInitialAxesValues( int nClPathId, bool bSkipClimb, DBLVECTOR& vAxVal) const ;
bool GetFinalAxesValues( bool bSkipRise, DBLVECTOR& vAxVal) const ;
bool GetClPathFinalAxesValues( int nClPathId, bool bSkipRise, DBLVECTOR& vAxVal) const ; bool GetClPathFinalAxesValues( int nClPathId, bool bSkipRise, DBLVECTOR& vAxVal) const ;
bool GetInitialToolDir( bool bSkipClimb, Vector3d& vtTool) const ; bool GetInitialToolDir( bool bSkipClimb, Vector3d& vtTool) const ;
bool GetClPathInitialToolDir( int nClPathId, bool bSkipClimb, Vector3d& vtTool) const ; bool GetClPathInitialToolDir( int nClPathId, bool bSkipClimb, Vector3d& vtTool) const ;
bool GetFinalToolDir( bool bSkipRise, Vector3d& vtTool) const ; bool GetFinalToolDir( bool bSkipRise, Vector3d& vtTool) const ;
bool GetClPathFinalToolDir( int nClPathId, bool bSkipRise, Vector3d& vtTool) const ; bool GetClPathFinalToolDir( int nClPathId, bool bSkipRise, Vector3d& vtTool) const ;
const CamData* GetInitialCamData( bool bSkipClimb, bool bMain = true) const ; const CamData* GetInitialCamData( bool bSkipClimb) const ;
const CamData* GetClPathInitialCamData( int nClPathId, bool bSkipClimb) const ; const CamData* GetClPathInitialCamData( int nClPathId, bool bSkipClimb) const ;
const CamData* GetFinalCamData( bool bSkipRise, bool bMain = true) const ; const CamData* GetFinalCamData( bool bSkipRise) const ;
const CamData* GetClPathFinalCamData( int nClPathId, bool bSkipRise) const ; const CamData* GetClPathFinalCamData( int nClPathId, bool bSkipRise) const ;
bool ApplyHintToPrevAxRot( const std::string& sHint, const Machine* pMch, DBLVECTOR& vAxRotPrec) ; std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ;
bool CalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, std::string ExtractHint( const std::string& sNotes) const ;
DBLVECTOR& vAxRotPrec) ; bool SetBlockedRotAxis( const std::string& sBlockedAxis) const ;
bool EraseAddedPoints( int nClPathId) ; bool CalculateAxesValues( const std::string& sHint, bool bRotContOnNext = true, bool bSolChExact = false) ;
bool MyCalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, bool CalculateClPathCenterAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
DBLVECTOR& vAxRotPrec, bool bFirstTry, int& nOutStrC) ; bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
bool CalculateMcentRotAxesValues( bool bFirst, const Vector3d& vtTool, const Vector3d& vtAux, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec, bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
DBLVECTOR& vAxRot) ; bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
bool VerifyMcentLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal, bool CalculateClPathRobotAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
int nCnt, int nEntId, int nMoveType, bool bToolShow, bool& bAdded, bool& bAxError) ; bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
bool CalculateClPathRobotAxesValues( int nClPathId, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
DBLVECTOR& vAxRotPrec) ; bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
bool CalculateRobotAxesValues( bool bFirst, const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtAux, bool AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec, bool ToolChangeNeeded( const Operation& Op1, const Operation& Op2) const ;
DBLVECTOR& vAxRot) ; bool RemoveClimb( int nClPathId) ;
bool VerifyRobotLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec, bool AddRise( DBLVECTOR& vAxVal, double dDelta = - 1, int nClPathId = GDB_ID_NULL, bool bZHomeDown = false) ;
const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal, bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, int nFlag = 0) ;
int nCnt, int nEntId, int nMoveType, bool bToolShow, bool& bAdded, bool& bAxError) ; bool RemoveRise( int nClPathId = GDB_ID_NULL) ;
bool GetAxisMidForTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nAxisOrder, Machine* pMch, bool AddHome( void) ;
DBLVECTOR& vAxMid) const ; bool RemoveClimbRiseHome( void) ;
bool OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, bool AddRobotClimb( int nEntId, double dDeltaZ) ;
Machine* pMch, const INTVECTOR& vRawId, const INTVECTOR& vFxtId) const ;
bool AdjustStartEndMovementsStd( bool bVerifyPreviousLink) ;
bool AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOpe, const DBLVECTOR& vAxPrev, double dPrevOffsX, bool bMaxZ) ;
bool AdjustStartEndMovementsNew( void) ;
bool MoveHeadFromHomeToMach( bool bMain, const std::string& sToolName, const std::string& sHeadName, int nExitNbr, int nStartZMax,
int nOtherLinkType) ;
bool MoveHeadFromMachToMach( Operation* pPrevOpe,
bool bPrevMain, const std::string& sPrevToolName, const std::string& sPrevHeadName, int nPrevExitNbr,
bool bCurrMain, const std::string& sCurrToolName, const std::string& sCurrHeadName, int nCurrExitNbr,
bool bToolChange, int nStartZMax, int nOtherLinkType, int nOtherLinkType1) ;
bool MoveHeadFromMachToHome( Operation* pPrevOpe, bool bCurrMain, const std::string& sCurrToolName, const std::string& sCurrHeadName, int nCurrExitNbr,
int nStartZMax, int nOtherLinkType) ;
bool ManageDoubleOperNew( Operation* pPrevOpe) ;
bool ManageSpecialLink( Operation* pPrevOpe, int nPrevClPathId, bool bPrevMain, Operation* pNextOpe, int nNextClPathId, bool bNextMain,
int nStartZMax, int nOtherLinkType = LINK_NULL) ;
bool ToolChangeNeeded( const Operation& Ope1, bool bMain1, const Operation& Ope2, bool bMain2) const ;
bool AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, bool bMain = true,
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "", bool bFirst = true) ;
bool RemoveClimb( int nClPathId = GDB_ID_NULL, bool bMain = true) ;
bool AddRise( DBLVECTOR& vAxVal, double dDelta = NAN, int nClPathId = GDB_ID_NULL, bool bMain = true, int nToMinMaxZ = 0) ;
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, bool bMain = true,
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "") ;
bool RemoveRise( int nClPathId = GDB_ID_NULL, bool bMain = true) ;
bool AddHome( bool bMain = true) ;
bool AddRobotClimb( int nEntId, double dDeltaZ = NAN) ;
bool CalcRobotAxesAbovePos( const Point3d& ptP, const Vector3d& vtT, const Vector3d& vtA, double dDeltaZ, bool CalcRobotAxesAbovePos( const Point3d& ptP, const Vector3d& vtT, const Vector3d& vtA, double dDeltaZ,
DBLVECTOR& vAx, double* pdNewDeltaZ = nullptr) const ; DBLVECTOR& vAx, double* pdNewDeltaZ = nullptr) const ;
bool CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const ; bool CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const ;
@@ -274,13 +176,13 @@ class Operation : public IUserObj
bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, const BBox3d& b3Raws) const ; bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, const BBox3d& b3Raws) const ;
int GetUserNotesZmax( void) const ; int GetUserNotesZmax( void) const ;
bool GetZHomeDown( void) const ; bool GetZHomeDown( void) const ;
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
int SpecialTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ; int SpecialTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ; bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ;
bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, DBLVECTOR& vAxNew, bool& bModif) ; bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, DBLVECTOR& vAxNew, bool& bModif) ;
bool SpecialLink( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nLinkType,
const Operation* pPrevOpe, bool bPrevMain, const Operation* pNextOpe, bool bNextMain, bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
int nStartZMax, int nOtherLinkType = LINK_NULL) ; bool IsAggrBottom( const std::string& sHead) const ;
bool SpecialPrevMachiningOffset( const Operation* pPrevOpe, double& dOffsetX) ;
protected : protected :
int m_nOwnerId ; // identificativo dell'oggetto geometrico possessore int m_nOwnerId ; // identificativo dell'oggetto geometrico possessore
@@ -325,16 +227,12 @@ class Operation : public IUserObj
int AddLinearMove( const Point3d& ptP, const std::string& sName) ; int AddLinearMove( const Point3d& ptP, const std::string& sName) ;
int AddLinearMove( const Point3d& ptP, bool bSplit) ; int AddLinearMove( const Point3d& ptP, bool bSplit) ;
int AddLinearMove( const Point3d& ptP, bool bSplit, const std::string& sName) ; int AddLinearMove( const Point3d& ptP, bool bSplit, const std::string& sName) ;
int AddLinearMove( const Point3d& ptP, bool bSplit, int nCorrType, const std::string* sName = nullptr, const Color* pColor = nullptr) ;
int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN) ; int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN) ;
int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN, const std::string& sName) ; int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN, const std::string& sName) ;
int AddArcMove ( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN, int nCorrType,
const std::string* psName = nullptr, const Color* pColor = nullptr) ;
int AddCurveMove( const ICurve* pCrv) ; int AddCurveMove( const ICurve* pCrv) ;
int AddCurveMove( const ICurve* pCrv, const std::string& sName) ; int AddCurveMove( const ICurve* pCrv, const std::string& sName) ;
int AddCurveMove( const ICurve* pCrv, bool bSplit) ; int AddCurveMove( const ICurve* pCrv, bool bSplit) ;
int AddCurveMove( const ICurve* pCrv, bool bSplit, const std::string& sName) ; int AddCurveMove( const ICurve* pCrv, bool bSplit, const std::string& sName) ;
int AddCurveMove( const ICurve* pCrv, bool bSplit, int nCorrType, const std::string* psName = nullptr, const Color* pColor = nullptr) ;
bool ResetMoveData( void) ; bool ResetMoveData( void) ;
protected : protected :
@@ -357,15 +255,9 @@ inline Operation* GetOperation( IUserObj* pUserObj)
{ return dynamic_cast< Operation*>( pUserObj) ; } { return dynamic_cast< Operation*>( pUserObj) ; }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Tipo di controllo per lavorazione vuota
enum { NEED_GEOM = 0, NEED_ONE_TP_OK = 1, NEED_ALL_TP_OK = 2} ;
// tipo posizione utensile // tipo posizione utensile
enum { TOOL_PARAL = 1, TOOL_ORTHO = 2, TOOL_ORTUP = 3, TOOL_PAR_SLANT= 4} ; enum { TOOL_PARAL = 1, TOOL_ORTHO = 2, TOOL_ORTUP = 3, TOOL_PAR_SLANT= 4} ;
// tipo di utilizzo contorno faccia // tipo di utilizzo contorno faccia
enum { FACE_DOWN = 1, FACE_TOP = 2, FACE_FRONT = 3, FACE_BACK = 4, FACE_LEFT = 5, FACE_RIGHT = 6, enum { FACE_DOWN = 1, FACE_TOP = 2, FACE_FRONT = 3, FACE_BACK = 4, FACE_LEFT = 5, FACE_RIGHT = 6, FACE_CONT = 7} ;
FACE_CONT = 7, FACE_VERSOR = 8, FACE_EDGES = 9} ;
// risultato di SpecialTestCollisionAvoid // risultato di SpecialTestCollisionAvoid
enum { SCAV_ERROR = -1, SCAV_COLLIDE = 0, SCAV_AVOID = 1, SCAV_TOTEST = 2} ; enum { SCAV_ERROR = -1, SCAV_COLLIDE = 0, SCAV_AVOID = 1, SCAV_TOTEST = 2};
// ordine di movimento assi nei link
enum { LKAMO_INTERP = 0, LKAMO_HEAD_BEFORE = -1, LKAMO_HEAD_AFTER = +1,
LKAMO_HEAD_BEFORE_IF_SAME_ANG = -2, LKAMO_HEAD_AFTER_IF_SAME_ANG = +2} ;
+1 -57
View File
@@ -323,7 +323,7 @@ Operation::AddLinearMove( const Point3d& ptP, bool bSplit)
return GDB_ID_NULL ; return GDB_ID_NULL ;
double dLen = Dist( ptS, ptP) ; double dLen = Dist( ptS, ptP) ;
double dStep = GetMaxSplitLen( true, true) ; double dStep = GetMaxSplitLen( true, true) ;
int nStep = int( ceil( ( dLen - EPS_ZERO) / dStep)) ; int nStep = int( dLen / dStep + 0.999) ;
int nFirstId = GDB_ID_NULL ; int nFirstId = GDB_ID_NULL ;
for ( int i = 1 ; i <= nStep ; ++ i) { for ( int i = 1 ; i <= nStep ; ++ i) {
int nId = AddLinearMove( Media( ptS, ptP, i * 1.0 / nStep)) ; int nId = AddLinearMove( Media( ptS, ptP, i * 1.0 / nStep)) ;
@@ -348,25 +348,6 @@ Operation::AddLinearMove( const Point3d& ptP, bool bSplit, const string& sName)
return nFirstId ; return nFirstId ;
} }
//----------------------------------------------------------------------------
int
Operation::AddLinearMove( const Point3d& ptP, bool bSplit, int nCorrType, const string* psName, const Color* pColor)
{
int nFirstId = AddLinearMove( ptP, bSplit) ;
int nId = nFirstId ;
while ( nId != GDB_ID_NULL) {
if ( psName != nullptr)
m_pGeomDB->SetName( nId, *psName) ;
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
if ( pCamData == nullptr || ! pCamData->SetCorrType( nCorrType))
return GDB_ID_NULL ;
if ( pColor != nullptr)
m_pGeomDB->SetMaterial( nId, *pColor) ;
nId = m_pGeomDB->GetNext( nId) ;
}
return nFirstId ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN) Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN)
@@ -441,24 +422,6 @@ Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen,
return nId ; return nId ;
} }
//----------------------------------------------------------------------------
int
Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN, int nCorrType,
const string* psName, const Color* pColor)
{
int nId = AddArcMove( ptP, ptCen, dAngCen, vtN) ;
if ( nId != GDB_ID_NULL) {
if ( psName != nullptr)
m_pGeomDB->SetName( nId, *psName) ;
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
if ( pCamData == nullptr || ! pCamData->SetCorrType( nCorrType))
return GDB_ID_NULL ;
if ( pColor != nullptr)
m_pGeomDB->SetMaterial( nId, *pColor) ;
}
return nId ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
Operation::AddCurveMove( const ICurve* pCrv) Operation::AddCurveMove( const ICurve* pCrv)
@@ -567,25 +530,6 @@ Operation::AddCurveMove( const ICurve* pCrv, bool bSplit, const string& sName)
return nFirstId ; return nFirstId ;
} }
//----------------------------------------------------------------------------
int
Operation::AddCurveMove( const ICurve* pCrv, bool bSplit, int nCorrType, const string* psName, const Color* pColor)
{
int nFirstId = AddCurveMove( pCrv, bSplit) ;
int nId = nFirstId ;
while ( nId != GDB_ID_NULL) {
if ( psName != nullptr)
m_pGeomDB->SetName( nId, *psName) ;
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nId)) ;
if ( pCamData == nullptr || ! pCamData->SetCorrType( nCorrType))
return GDB_ID_NULL ;
if ( pColor != nullptr)
m_pGeomDB->SetMaterial( nId, *pColor) ;
nId = m_pGeomDB->GetNext( nId) ;
}
return nFirstId ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Operation::ResetMoveData( void) Operation::ResetMoveData( void)
+4 -12
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2017-2024 // EgalTech 2017-2019
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : OperationConst.h Data : 22.05.24 Versione : 2.6e5 // File : OperationConst.h Data : 08.07.19 Versione : 2.1g2
// Contenuto : Costanti per le operazioni. // Contenuto : Costanti per le operazioni.
// //
// //
@@ -9,7 +9,6 @@
// Modifiche : 17.08.17 DS Creazione modulo. // Modifiche : 17.08.17 DS Creazione modulo.
// 25.05.19 DS Aggiunte SurfRoughing e SurfFinishing. // 25.05.19 DS Aggiunte SurfRoughing e SurfFinishing.
// 25.05.19 DS Aggiunta WaterJetting. // 25.05.19 DS Aggiunta WaterJetting.
// 22.05.24 DS Aggiunta FiveAxisMilling.
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -18,6 +17,7 @@
#include "/EgtDev/Include/EMkOperationConst.h" #include "/EgtDev/Include/EMkOperationConst.h"
#include <string> #include <string>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static const std::string s_OpeClass[] = {"", static const std::string s_OpeClass[] = {"",
"EMkDisposition", "EMkDisposition",
@@ -32,9 +32,7 @@ static const std::string s_OpeClass[] = {"",
"EMkChiseling", "EMkChiseling",
"EMkSurfRoughing", "EMkSurfRoughing",
"EMkSurfFinishing", "EMkSurfFinishing",
"EMkWaterJetting", "EMkWaterJetting"} ;
"EMkFiveAxisMilling",
"EMkProbing"} ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Dal tipo numerico restituisce la classe della operazione // Dal tipo numerico restituisce la classe della operazione
@@ -55,8 +53,6 @@ GetOperationClass( int nOpeType)
case OPER_SURFROUGHING : return s_OpeClass[11] ; case OPER_SURFROUGHING : return s_OpeClass[11] ;
case OPER_SURFFINISHING : return s_OpeClass[12] ; case OPER_SURFFINISHING : return s_OpeClass[12] ;
case OPER_WATERJETTING : return s_OpeClass[13] ; case OPER_WATERJETTING : return s_OpeClass[13] ;
case OPER_FIVEAXISMILLING : return s_OpeClass[14] ;
case OPER_PROBING : return s_OpeClass[15] ;
} }
return s_OpeClass[0] ; return s_OpeClass[0] ;
} }
@@ -92,10 +88,6 @@ GetOperationType( const std::string& sOpeClass)
return OPER_SURFFINISHING ; return OPER_SURFFINISHING ;
else if ( sOpeClass == s_OpeClass[13]) else if ( sOpeClass == s_OpeClass[13])
return OPER_WATERJETTING ; return OPER_WATERJETTING ;
else if ( sOpeClass == s_OpeClass[14])
return OPER_FIVEAXISMILLING ;
else if ( sOpeClass == s_OpeClass[15])
return OPER_PROBING ;
else else
return OPER_NULL ; return OPER_NULL ;
} }
-57
View File
@@ -45,17 +45,12 @@ static const std::string GVAR_EMPTY = ".EMPTY" ; // (bool) flag disp
static const std::string GVAR_SBH = ".SBH" ; // (bool) flag disposizione con operazioni manuali static const std::string GVAR_SBH = ".SBH" ; // (bool) flag disposizione con operazioni manuali
static const std::string GVAR_TABNAME = ".TABNAME" ; // (string) nome tavola static const std::string GVAR_TABNAME = ".TABNAME" ; // (string) nome tavola
static const std::string GVAR_TABORI1 = ".TABORI1" ; // (Point3d) prima origine di tavola static const std::string GVAR_TABORI1 = ".TABORI1" ; // (Point3d) prima origine di tavola
static const std::string GVAR_TAIND = ".TAIND" ; // (int) indice asse tavola
static const std::string GVAR_TANAME = ".TANAME" ; // (string) nome asse tavola
static const std::string GVAR_TAPOS = ".TAPOS" ; // (double) posizione asse tavola
static const std::string GVAR_TAMOVED = ".TAMOVED" ; // (bool) flag asse tavola con movimento
static const std::string GVAR_FIXID = ".FIXID" ; // (int) identificativo bloccaggio (fixture) static const std::string GVAR_FIXID = ".FIXID" ; // (int) identificativo bloccaggio (fixture)
static const std::string GVAR_FIXIND = ".FIXIND" ; // (int) indice bloccaggio static const std::string GVAR_FIXIND = ".FIXIND" ; // (int) indice bloccaggio
static const std::string GVAR_FIXNAME = ".FIXNAME" ; // (string) nome bloccaggio static const std::string GVAR_FIXNAME = ".FIXNAME" ; // (string) nome bloccaggio
static const std::string GVAR_FIXPOS = ".FIXPOS" ; // (Point3d) posizione bloccaggio 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_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_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_RAWID = ".RAWID" ; // (int) identificativo grezzo
static const std::string GVAR_RAWIND = ".RAWIND" ; // (int) indice movimento del 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 static const std::string GVAR_RAWTYPE = ".RAWTYPE" ; // (int) tipo di movimento del grezzo
@@ -66,7 +61,6 @@ static const std::string GVAR_HEAD = ".HEAD" ; // (string) nome test
static const std::string GVAR_EXIT = ".EXIT" ; // (int) indice uscita static const std::string GVAR_EXIT = ".EXIT" ; // (int) indice uscita
static const std::string GVAR_TCPOS = ".TCPOS" ; // (string) eventuale posizione utensile nel TC static const std::string GVAR_TCPOS = ".TCPOS" ; // (string) eventuale posizione utensile nel TC
static const std::string GVAR_TTYPE = ".TTYPE" ; // (int) tipo utensile static const std::string GVAR_TTYPE = ".TTYPE" ; // (int) tipo utensile
static const std::string GVAR_TFLOAT = ".TFLOAT" ; // (bool) flag per utensile flottante
static const std::string GVAR_TCOMP = ".TCOMP" ; // (int) numero correttore utensile static const std::string GVAR_TCOMP = ".TCOMP" ; // (int) numero correttore utensile
static const std::string GVAR_TDIAM = ".TDIAM" ; // (num) diametro utensile static const std::string GVAR_TDIAM = ".TDIAM" ; // (num) diametro utensile
static const std::string GVAR_TTOTDIAM = ".TTOTDIAM" ; // (num) diametro totale utensile static const std::string GVAR_TTOTDIAM = ".TTOTDIAM" ; // (num) diametro totale utensile
@@ -88,7 +82,6 @@ static const std::string GVAR_MAXMIN = ".MAXMIN" ; // (double/s) minimo di
static const std::string GVAR_MAXMAX = ".MAXMAX" ; // (double/s) massimo di ingombro degli assi della lavorazione static const std::string GVAR_MAXMAX = ".MAXMAX" ; // (double/s) massimo di ingombro degli assi della lavorazione
static const std::string GVAR_PATHID = ".PATHID" ; // (int) identificativo percorso di lavorazione static const std::string GVAR_PATHID = ".PATHID" ; // (int) identificativo percorso di lavorazione
static const std::string GVAR_PATHIND = ".PATHIND" ; // (int) indice percorso di lavorazione static const std::string GVAR_PATHIND = ".PATHIND" ; // (int) indice percorso di lavorazione
static const std::string GVAR_DBLPATHID = ".DBLPATHID" ; // (int) identificativo eventuale percorso di lavorazione in doppio
static const std::string GVAR_START = ".START" ; // (Point3d) punto iniziale del percorso originale static const std::string GVAR_START = ".START" ; // (Point3d) punto iniziale del percorso originale
static const std::string GVAR_END = ".END" ; // (Point3d) punto finale del percorso originale static const std::string GVAR_END = ".END" ; // (Point3d) punto finale del percorso originale
static const std::string GVAR_EXTR = ".EXTR" ; // (Vector3d) versore estrusione static const std::string GVAR_EXTR = ".EXTR" ; // (Vector3d) versore estrusione
@@ -97,7 +90,6 @@ static const std::string GVAR_PMAX = ".PMAX" ; // (Point3d) punto mas
static const std::string GVAR_PAXMIN = ".PAXMIN" ; // (double/s) minimo di ingombro degli assi del percorso di lavorazione static const std::string GVAR_PAXMIN = ".PAXMIN" ; // (double/s) minimo di ingombro degli assi del percorso di lavorazione
static const std::string GVAR_PAXMAX = ".PAXMAX" ; // (double/s) massimo di ingombro degli assi del percorso di lavorazione static const std::string GVAR_PAXMAX = ".PAXMAX" ; // (double/s) massimo di ingombro degli assi del percorso di lavorazione
static const std::string GVAR_ELEV = ".ELEV" ; // (double) massima elevazione static const std::string GVAR_ELEV = ".ELEV" ; // (double) massima elevazione
static const std::string GVAR_DRACEX = ".DRACEX" ; // (int/s) vettore delle uscite selezionate (per gruppi a forare)
static const std::string GVAR_AUXTOT = ".AUXTOT" ; // (int) numero totale dati ausiliari inizio/fine percorso di lavorazione static const std::string GVAR_AUXTOT = ".AUXTOT" ; // (int) numero totale dati ausiliari inizio/fine percorso di lavorazione
static const std::string GVAR_AUXIND = ".AUXIND" ; // (int) indice dato ausiliario inizio/fine percorso di lavorazione static const std::string GVAR_AUXIND = ".AUXIND" ; // (int) indice dato ausiliario inizio/fine percorso di lavorazione
static const std::string GVAR_AUX = ".AUX" ; // (string) dato ausiliario inizio/fine percorso di lavorazione static const std::string GVAR_AUX = ".AUX" ; // (string) dato ausiliario inizio/fine percorso di lavorazione
@@ -132,17 +124,6 @@ static const std::string GVAR_R4P = ".R4p" ; // (num) valore pr
static const std::string GVAR_R5P = ".R5p" ; // (num) valore precedente del quinto asse rotante static const std::string GVAR_R5P = ".R5p" ; // (num) valore precedente del quinto asse rotante
static const std::string GVAR_R6P = ".R6p" ; // (num) valore precedente del sesto asse rotante static const std::string GVAR_R6P = ".R6p" ; // (num) valore precedente del sesto asse rotante
static const std::string GVAR_R7P = ".R7p" ; // (num) valore precedente del settimo asse rotante static const std::string GVAR_R7P = ".R7p" ; // (num) valore precedente del settimo asse rotante
static const std::string GVAR_MOVESUCC = ".MOVESUCC" ; // (int) tipo del movimento successivo (0,1,2,3)
static const std::string GVAR_L1S = ".L1s" ; // (num) valore successivo del primo asse lineare
static const std::string GVAR_L2S = ".L2s" ; // (num) valore successivo del secondo asse lineare
static const std::string GVAR_L3S = ".L3s" ; // (num) valore successivo del terzo asse lineare
static const std::string GVAR_R1S = ".R1s" ; // (num) valore successivo del primo asse rotante
static const std::string GVAR_R2S = ".R2s" ; // (num) valore successivo del secondo asse rotante
static const std::string GVAR_R3S = ".R3s" ; // (num) valore successivo del terzo asse rotante
static const std::string GVAR_R4S = ".R4s" ; // (num) valore successivo del quarto asse rotante
static const std::string GVAR_R5S = ".R5s" ; // (num) valore successivo del quinto asse rotante
static const std::string GVAR_R6S = ".R6s" ; // (num) valore successivo del sesto asse rotante
static const std::string GVAR_R7S = ".R7s" ; // (num) valore successivo del settimo asse rotante
static const std::string GVAR_L1T = ".L1t" ; // (string) token del primo asse lineare static const std::string GVAR_L1T = ".L1t" ; // (string) token del primo asse lineare
static const std::string GVAR_L2T = ".L2t" ; // (string) token del secondo asse lineare static const std::string GVAR_L2T = ".L2t" ; // (string) token del secondo asse lineare
static const std::string GVAR_L3T = ".L3t" ; // (string) token del terzo asse lineare static const std::string GVAR_L3T = ".L3t" ; // (string) token del terzo asse lineare
@@ -174,7 +155,6 @@ static const std::string GVAR_MASK = ".MASK" ; // (int) mask asso
static const std::string GVAR_FLAG = ".FLAG" ; // (int) flag associato ad ogni movimento static const std::string GVAR_FLAG = ".FLAG" ; // (int) flag associato ad ogni movimento
static const std::string GVAR_FLAG2 = ".FLAG2" ; // (int) secondo flag associato ad ogni movimento static const std::string GVAR_FLAG2 = ".FLAG2" ; // (int) secondo flag associato ad ogni movimento
static const std::string GVAR_INDEX = ".IDX" ; // (int) indice associato ad ogni movimento static const std::string GVAR_INDEX = ".IDX" ; // (int) indice associato ad ogni movimento
static const std::string GVAR_CORR = ".CORR" ; // (int) tipo di correzione (0=no,41=sn,42=dx,140=out,141=in_sn,142=in_dx)
static const std::string GVAR_TDIR = ".TDIR" ; // (Vector3d) versore utensile nel riferimento pezzo static const std::string GVAR_TDIR = ".TDIR" ; // (Vector3d) versore utensile nel riferimento pezzo
static const std::string GVAR_CDIR = ".CDIR" ; // (Vector3d) versore correzione nel riferimento pezzo static const std::string GVAR_CDIR = ".CDIR" ; // (Vector3d) versore correzione nel riferimento pezzo
static const std::string GVAR_ADIR = ".ADIR" ; // (Vector3d) versore ausiliario nel riferimento pezzo static const std::string GVAR_ADIR = ".ADIR" ; // (Vector3d) versore ausiliario nel riferimento pezzo
@@ -193,11 +173,6 @@ static const std::string GVAR_SIMUISTAT = ".SIMUISTAT" ; // (num) stato sim
static const std::string GVAR_SAFEDIST = ".SAFEDIST" ; // (num) distanza di sicurezza per verifica di collisione static const std::string GVAR_SAFEDIST = ".SAFEDIST" ; // (num) distanza di sicurezza per verifica di collisione
static const std::string GVAR_SIMVMID = ".SIMVMID" ; // (int) identificativo grezzo Vmill in collisione static const std::string GVAR_SIMVMID = ".SIMVMID" ; // (int) identificativo grezzo Vmill in collisione
static const std::string GVAR_SIMCOBIND = ".SIMCOBIND" ; // (int) indice oggetto in collisione static const std::string GVAR_SIMCOBIND = ".SIMCOBIND" ; // (int) indice oggetto in collisione
static const std::string GVAR_TOOLTRACE = ".TOOLTRACE" ; // (int) identificativo gruppo di tracciatura utensile
static const std::string GVAR_MPSIM = ".MPSIM" ; // (bool) flag simulazione multiprocesso
static const std::string GVAR_MPSEST = ".MPSEST" ; // (string) path del file di stima speciale per simulazione multiprocesso
static const std::string GVAR_RECORD = ".RECORD" ; // (bool) flag modalità registrazione comandi in simulazione
static const std::string GVAR_OPERID = ".OPERID" ; // (int/s) identificativi ordinati operazioni per simulazione multiprocesso
// Funzioni generazione // Funzioni generazione
static const std::string ON_START = "OnStart" ; static const std::string ON_START = "OnStart" ;
static const std::string ON_END = "OnEnd" ; static const std::string ON_END = "OnEnd" ;
@@ -207,7 +182,6 @@ static const std::string ON_TOOL_DATA = "OnToolData" ;
static const std::string ON_DISPOSITION_START = "OnDispositionStart" ; static const std::string ON_DISPOSITION_START = "OnDispositionStart" ;
static const std::string ON_DISPOSITION_END = "OnDispositionEnd" ; static const std::string ON_DISPOSITION_END = "OnDispositionEnd" ;
static const std::string ON_TABLE_DATA = "OnTableData" ; static const std::string ON_TABLE_DATA = "OnTableData" ;
static const std::string ON_TABLE_AXIS_DATA = "OnTableAxisData" ;
static const std::string ON_FIXTURE_DATA = "OnFixtureData" ; static const std::string ON_FIXTURE_DATA = "OnFixtureData" ;
static const std::string ON_RAWMOVE_DATA = "OnRawMoveData" ; static const std::string ON_RAWMOVE_DATA = "OnRawMoveData" ;
static const std::string ON_TOOL_SELECT = "OnToolSelect" ; static const std::string ON_TOOL_SELECT = "OnToolSelect" ;
@@ -230,7 +204,6 @@ static const std::string ON_ESTIM_TOOL_DATA = "OnEstimToolData" ;
static const std::string ON_ESTIM_DISPOSITION_START = "OnEstimDispositionStart" ; static const std::string ON_ESTIM_DISPOSITION_START = "OnEstimDispositionStart" ;
static const std::string ON_ESTIM_DISPOSITION_END = "OnEstimDispositionEnd" ; static const std::string ON_ESTIM_DISPOSITION_END = "OnEstimDispositionEnd" ;
static const std::string ON_ESTIM_TABLE_DATA = "OnEstimTableData" ; static const std::string ON_ESTIM_TABLE_DATA = "OnEstimTableData" ;
static const std::string ON_ESTIM_TABLE_AXIS_DATA = "OnEstimTableAxisData" ;
static const std::string ON_ESTIM_FIXTURE_DATA = "OnEstimFixtureData" ; static const std::string ON_ESTIM_FIXTURE_DATA = "OnEstimFixtureData" ;
static const std::string ON_ESTIM_RAWMOVE_DATA = "OnEstimRawMoveData" ; static const std::string ON_ESTIM_RAWMOVE_DATA = "OnEstimRawMoveData" ;
static const std::string ON_ESTIM_TOOL_SELECT = "OnEstimToolSelect" ; static const std::string ON_ESTIM_TOOL_SELECT = "OnEstimToolSelect" ;
@@ -326,36 +299,6 @@ GetGlobVarAxisPrev( int nAx, const std::string& sVar = GLOB_VAR, bool bIsRobot =
} }
} }
//----------------------------------------------------------------------------
inline std::string
GetGlobVarAxisNext( int nAx, const std::string& sVar = GLOB_VAR, bool bIsRobot = false)
{
if ( ! bIsRobot) {
switch ( nAx) {
case 1 : return ( sVar + GVAR_L1S) ;
case 2 : return ( sVar + GVAR_L2S) ;
case 3 : return ( sVar + GVAR_L3S) ;
case 4 : return ( sVar + GVAR_R1S) ;
case 5 : return ( sVar + GVAR_R2S) ;
case 6 : return ( sVar + GVAR_R3S) ;
case 7 : return ( sVar + GVAR_R4S) ;
default : return "" ;
}
}
else {
switch ( nAx) {
case 1 : return ( sVar + GVAR_R1S) ;
case 2 : return ( sVar + GVAR_R2S) ;
case 3 : return ( sVar + GVAR_R3S) ;
case 4 : return ( sVar + GVAR_R4S) ;
case 5 : return ( sVar + GVAR_R5S) ;
case 6 : return ( sVar + GVAR_R6S) ;
case 7 : return ( sVar + GVAR_R7S) ;
default : return "" ;
}
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline std::string inline std::string
GetGlobVarAxisToken( int nAx, bool bIsRobot = false) GetGlobVarAxisToken( int nAx, bool bIsRobot = false)
+179 -291
View File
File diff suppressed because it is too large Load Diff
+3 -9
View File
@@ -35,14 +35,8 @@ class Pocketing : public Machining
public : // Operation public : // Operation
int GetType( void) const override int GetType( void) const override
{ return OPER_POCKETING ; } { return OPER_POCKETING ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override bool IsEmpty( void) const override
{ if ( m_nPockets == 0) { return ( m_nPockets == 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 bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; } { m_nStatus |= nModif ; return true ; }
@@ -64,7 +58,7 @@ class Pocketing : public Machining
bool GetParam( int nType, int& nVal) const override ; bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ; bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ; bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( void) override ; bool UpdateToolData( bool* pbChanged = nullptr) override ;
const ToolData& GetToolData( void) const override ; const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ; bool GetGeometry( SELVECTOR& vIds) const override ;
+3 -20
View File
@@ -115,7 +115,7 @@ PocketingData::Clone( void) const
bool bool
PocketingData::CopyFrom( const MachiningData* pMdata) PocketingData::CopyFrom( const MachiningData* pMdata)
{ {
// è inutile copiare se sorgente coincide con destinazione // è inutile copiare se sorgente coincide con destinazione
if ( pMdata == this) if ( pMdata == this)
return true ; return true ;
// la sorgente deve essere dello stesso tipo // la sorgente deve essere dello stesso tipo
@@ -150,8 +150,6 @@ PocketingData::CopyFrom( const MachiningData* pMdata)
m_dLiElev = pSdata->m_dLiElev ; m_dLiElev = pSdata->m_dLiElev ;
m_nLeadOutType = pSdata->m_nLeadOutType ; m_nLeadOutType = pSdata->m_nLeadOutType ;
m_dLoTang = pSdata->m_dLoTang ; m_dLoTang = pSdata->m_dLoTang ;
m_dEpicyclesDist = pSdata->m_dEpicyclesDist ;
m_dEpicyclesRad = pSdata->m_dEpicyclesRad ;
m_sSysNotes = pSdata->m_sSysNotes ; m_sSysNotes = pSdata->m_sSysNotes ;
m_sUserNotes = pSdata->m_sUserNotes ; m_sUserNotes = pSdata->m_sUserNotes ;
return true ; return true ;
@@ -196,8 +194,6 @@ PocketingData::SameAs(const MachiningData* pMdata) const
abs( m_dLiElev - pSdata->m_dLiElev) < EPS_MACH_LEN_PAR && abs( m_dLiElev - pSdata->m_dLiElev) < EPS_MACH_LEN_PAR &&
m_nLeadOutType == pSdata->m_nLeadOutType && m_nLeadOutType == pSdata->m_nLeadOutType &&
abs( m_dLoTang - pSdata->m_dLoTang) < EPS_MACH_LEN_PAR && abs( m_dLoTang - pSdata->m_dLoTang) < EPS_MACH_LEN_PAR &&
abs( m_dEpicyclesDist - pSdata->m_dEpicyclesDist) < EPS_MACH_LEN_PAR &&
abs( m_dEpicyclesRad - pSdata->m_dEpicyclesRad) < EPS_MACH_LEN_PAR &&
m_sSysNotes == pSdata->m_sSysNotes && m_sSysNotes == pSdata->m_sSysNotes &&
m_sUserNotes == pSdata->m_sUserNotes) ; m_sUserNotes == pSdata->m_sUserNotes) ;
} }
@@ -206,7 +202,7 @@ PocketingData::SameAs(const MachiningData* pMdata) const
int int
PocketingData::GetSize( void) const PocketingData::GetSize( void) const
{ {
// in debug verifico validità ultimo campo // in debug verifico validità ultimo campo
assert( sPocketingKey[KEY_UUID] == "UUID") ; assert( sPocketingKey[KEY_UUID] == "UUID") ;
return KEY_ZZZ ; return KEY_ZZZ ;
} }
@@ -401,8 +397,7 @@ bool
PocketingData::VerifySubType( int nVal) const PocketingData::VerifySubType( int nVal) const
{ {
return ( nVal == POCKET_SUB_ZIGZAG || nVal == POCKET_SUB_ONEWAY || return ( nVal == POCKET_SUB_ZIGZAG || nVal == POCKET_SUB_ONEWAY ||
nVal == POCKET_SUB_SPIRALIN || nVal == POCKET_SUB_SPIRALOUT || nVal == POCKET_SUB_SPIRALIN || nVal == POCKET_SUB_SPIRALOUT) ;
nVal == POCKET_SUB_CONFORMAL_ZIGZAG || nVal == POCKET_SUB_CONFORMAL_ONEWAY) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -538,12 +533,6 @@ PocketingData::SetParam( int nType, double dVal)
case MPA_LOTANG : case MPA_LOTANG :
m_dLoTang = dVal ; m_dLoTang = dVal ;
return true ; return true ;
case MPA_EPICYCLESDIST :
m_dEpicyclesDist = dVal ;
return true ;
case MPA_EPICYCLESRAD :
m_dEpicyclesRad = dVal ;
return true ;
} }
return false ; return false ;
} }
@@ -679,12 +668,6 @@ PocketingData::GetParam( int nType, double& dVal) const
case MPA_LOTANG : case MPA_LOTANG :
dVal = m_dLoTang ; dVal = m_dLoTang ;
return true ; return true ;
case MPA_EPICYCLESDIST :
dVal = m_dEpicyclesDist ;
return true ;
case MPA_EPICYCLESRAD :
dVal = m_dEpicyclesRad ;
return true ;
} }
dVal = 0 ; dVal = 0 ;
return false ; return false ;
-7487
View File
File diff suppressed because it is too large Load Diff
-257
View File
@@ -1,257 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2017-2017
//----------------------------------------------------------------------------
// File :Pocketing.h Data : 04.02.17 Versione : 1.8b1
// Contenuto : Dichiarazione della classe Pocketing.
//
//
//
// Modifiche : 04.02.17 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Machining.h"
#include "PocketingData.h"
#include "ToolData.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EGkIntersPlaneSurfTm.h"
#include "/EgtDev/Include/EGkCAvSilhouetteSurfTm.h"
// struttura informazioni sui singoli percorsi
struct PathInfoPO {
bool bOutStart ; // flag per entrata da fuori
bool bOutEnd ; // flag per uscita da fuori
bool bSingleCrv ; // se percorso formato da una curva singola ( in generale per SubSteps)
bool bOptTrap ; // flag per casi ottimizzati a trapezio ( per Spiral)
bool bOptCirle ; // flag per casi ottimizzati a Spirale ( per Spiral)
bool bIsZigZagOneWayBorder ; // curve di bordo dei lati chiusi ( per ZigZag e OneWay)
bool bToolCompensation ; // curva di bordo per compensazione utensile
PtrOwner<ICurveComposite> pCrvPath ; // percorso del centro utensile
PtrOwner<ICurveComposite> pCrvGlideIn ; // curva per LeadIn a guida
PtrOwner<ICurveComposite> pCrvGlideOut ; // curva per LeadOut a guida
PtrOwner<ICurveComposite> pCrvZigZagIn ; // curva per LeadIn a ZigZag ( caso speciale)
PtrOwner<ICurveComposite> pCrvRet ; // curva di ritorno ( per ora solo caso fori)
} ;
// tipo percorso
typedef std::vector<PathInfoPO> PATHINFOPOVECTOR ;
// struttura informazioni per Step/SubSteps complessivi
struct StepInfoPO {
double dDepth ; // profondità dello step attuale
double dRelativeDepth ; // profondità relativa allo step al di sopra
PtrOwner<ISurfFlatRegion> pSfrPock ; // regione piana di svuotatura
PtrOwner<ISurfFlatRegion> pSfrLimit ; // regione piana da non svuotare
PATHINFOPOVECTOR vPaths ; // percorsi di Pocketing
} ;
// tipo step
typedef std::vector<StepInfoPO> STEPINFOPOVECTOR ;
//----------------------------------------------------------------------------
class PocketingNT : public Machining
{
public : // IUserObj
PocketingNT* 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_POCKETING ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nPockets == 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
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
public : // Machining
bool Prepare( const std::string& sMillName) override ;
bool SetParam( int nType, bool bVal) override ;
bool SetParam( int nType, int nVal) override ;
bool SetParam( int nType, double dVal) override ;
bool SetParam( int nType, const std::string& sVal) override ;
bool SetGeometry( const SELVECTOR& vIds) override ;
bool Preview( bool bRecalc) override ;
bool Apply( bool bRecalc, bool bPostApply) override ;
bool Update( bool bPostApply) override ;
bool GetParam( int nType, bool& bVal) const override ;
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
public :
PocketingNT( void) ;
private :
bool MyApply( bool bRecalc, bool bPostApply) ;
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
bool AdjustCurvesByStmTopology( const ISurfTriMesh* pSurf, const Frame3d& frGlob, const ISurfTriMesh* pStmTrim, ICURVEPLIST& lstPC) ;
bool GetCurves( const SelData& Id, const ISurfTriMesh* pStmRaw, const ISurfTriMesh* pStmTrim, ICURVEPLIST& lstPC) ;
bool SetCurveAllTempProp( int nCrvId, bool bForcedClose, ICurve* pCurve, bool* pbSomeOpen = nullptr) ;
bool SetSfrLoopsAllTempProp( int nSfrId, ISurfFlatRegion* pSfr) ;
bool ResetCurveAllTempProp( ICurve* pCurve, bool bClose = true) ;
bool Chain( int nGrpDestId) ;
ISurfTriMesh* GetRaw( void) ;
ISurfTriMesh* GetStmTrim( void) ;
ISurfTriMesh* GetExtrusionStm( const ISurfFlatRegion* pSfr, const Vector3d& vtExtr) ;
ISurfFlatRegion* GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs = 0) ;
ISurfFlatRegion* GetSfrRawProjection( const ISurfTriMesh* pStmRaw, const ISurfFlatRegion* pSfr, const Vector3d& vtTool,
const Frame3d& frAtTop, ICAvParSilhouettesSurfTm** ppCavParSil = nullptr) ;
Point3d GetStartPointByUser( const ISurfFlatRegion* pSfr) const ;
Point3d GetStartPointsByHead( const STEPINFOPOVECTOR& vStepInfo) const ;
Point3d GetStartPointsBySteps( const STEPINFOPOVECTOR& vStepInfo, int nCrvType) const ;
bool ChooseRawPart( const ISurfFlatRegion* pSfrChunk, ISurfTriMesh* pStm) const ;
bool ManageOpenEdges( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmPart) ;
bool GetHomogeneousParts( const ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) const ;
bool ExtendOpenEdges( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStm) ;
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmExtrusion) ;
bool CheckMaxDepth( const ISurfFlatRegion* pSfr, double dDepth, const Vector3d& vtTool,
const ISurfTriMesh* pStmRaw, const ISurfTriMesh* pStmExtrusion,
const IntersParPlanesSurfTm& IPPStm, bool& bSkipMaxDepth) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool CalcRegionElevation( const ISurfFlatRegion* pSfr, const Vector3d& vtTool, double dDepth,
double dRad, double dLen, double& dElev) ;
bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ;
bool GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo) ;
bool CalcGeoExtSurfFr( const ISurfFlatRegion* pSfrPock, const Vector3d& vtTool, double dDepth, const ISurfTriMesh* pStmRaw,
const SELVECTOR& vGeoSel, ISURFFRPOVECTOR& vSfrGeoExt) ;
bool CalcLimitRegion( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrRaw, ISurfFlatRegion* pSfrLimit) ;
bool CalcPaths( STEPINFOPOVECTOR& vStepInfo, bool& bEmpty) ;
bool CalcRetCurve( PathInfoPO& PathInfo, const StepInfoPO& StepInfo, const ICurveComposite* pCrvPath,
const Vector3d& vtTool, bool bHolePocketing, const Point3d& ptHoleDest, bool bToolComp, bool bInVsOut, ICurveComposite* pCrvGlide) ;
bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dStep, bool bSplitArcs, Point3d& ptPockStart, Point3d& ptPockEnd,
bool& bEmpty) ;
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
double GetRightStartFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ;
bool AddEpicycles( ICurveComposite * pCompo, ICurveComposite * pCrv, ICurveComposite * pCrvBound = nullptr) ;
bool CalcBoundedLinkWithBiArcs( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd,
const ICurve* pCrvBound, ICurveComposite* pCrvLink) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bSplitArcs, bool bOutStart) ;
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bSplitArcs, bool bOutStart = false) ;
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bSplitArcs) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bSplitArcs) ;
bool CalcFirstElevation( const Point3d& ptP1, const Vector3d& vtTool,
const StepInfoPO& currStep, double dSafeZ, double dStep, double& dCurrElev,
double& dEscapeElev, Vector3d& vtEscape) const ;
bool CalcLastElevation( const Point3d& ptP1, const Vector3d& vtTool,
const StepInfoPO& currStep, double dSafeZ, double dStep, double& dCurrElev,
double& dEscapeElev, Vector3d& vtEscape) const ;
bool CalcLeadInStart( Point3d& ptStart, const Vector3d& vtTool, const ICurveComposite* pCrvPath, Point3d& ptP1) ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
const ISurfFlatRegion* pSfr, const ICurveComposite* pRCrv, const ICurveComposite* pRZigZag,
bool bAtLeft, bool bSplitArcs, bool bNoneForced, bool bSkipControl) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN, const ISurfFlatRegion* pSfr,
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1) ;
double GetRadiusForStartEndElevation( void) const ;
bool GetForcedClosed( void) ;
bool ManageSmoothLink( const PathInfoPO& currPath, const PathInfoPO& nextPath, bool bSamePlane,
bool& bSmoothEnd, bool& bForceLinear) ;
bool CheckSafetyLink( const Point3d& ptCurr, const Vector3d& vtCurr,
const Point3d& ptDest, const Vector3d& vtDest,
const ISurfFlatRegion* pSfrLimit, const Vector3d& vtTool,
bool bSmoothEnd, bool& bSafeLimit, ICurveComposite* pCrvSafeLink) ;
bool VerifyLeadInHelix( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptCen, double dHelixRad) ;
bool VerifyLeadInZigZag( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptPa, const Point3d& ptPb) ;
bool VerifyLeadInOutGlide( const ISurfFlatRegion* pSfr, ICurveComposite* pCrvGlide) ;
bool AddSpecialLeadInZigZag( const ICurveComposite* pCompoPath, const Point3d& ptStart, const Vector3d& vtTool, int nStep, double dStep) ;
bool CalcDistanceFromRawSurface( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist, Vector3d& vtNorm) ;
bool VerifyParallelPocketing( int nDouble, const STEPINFOPOVECTOR& vStepInfo) const ;
bool CalcDoubleParallelPenultimateStep( int nDouble, int nIdDblS, double dStep, double dLastStep, const Point3d& ptNeatEnd, const Vector3d& vtEnd,
const INTVECTOR& vLeadOutId, const ISurfFlatRegion* pSfrLimit, const Vector3d& vtTool,
bool bSplitArcs, double dMinFeed) ;
double GetDoubleLastStep( void) ;
bool AddTangentLinesForToolCompensation( ICurveComposite* pCompoPath, const Vector3d& vtTool, const ISurfFlatRegion* pSfrLimit,
bool bWithEndGuide) const ;
bool AssignPropsToCamDataForToolCompensation( int nId, bool bLineIn, bool bLineOut, bool bToolAtLeft) ;
bool CalcLinkByStartUserPoint( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrLimit, const Point3d& ptStart,
const Point3d& ptEnd, ICurveComposite* pCompoLink) const ;
// debug
void DebugDrawSfr( const ISurfFlatRegion* pSfr, bool bUniform, int nlayer = GDB_ID_ROOT) ;
void DebugDrawLoop( const ICurveComposite* pCrvCompo, int nLayer, bool bUniform) ;
void DebugDrawBox( const BBox3d& BBox, const Frame3d& FrBox, int nlayer) ;
void DebugDrawOpenEdgesInRaw( const ICRVCOMPOPOVECTOR& vpCrvsm, int nlayer) ;
void DebugDrawFeed( const ICurve* pCrv, double dFeed, int nlayer) ;
private :
double GetSpeed( void) const
{ return ( IsNullAngValue( m_Params.m_dSpeed) ? m_TParams.m_dSpeed : m_Params.m_dSpeed) ; }
double GetFeed( void) const
{ return ( IsNullLenValue( m_Params.m_dFeed) ? m_TParams.m_dFeed : m_Params.m_dFeed) ; }
double GetStartFeed( void) const
{ return ( IsNullLenValue( m_Params.m_dStartFeed) ? m_TParams.m_dStartFeed : m_Params.m_dStartFeed) ; }
double GetEndFeed( void) const
{ return ( IsNullLenValue( m_Params.m_dEndFeed) ? m_TParams.m_dEndFeed : m_Params.m_dEndFeed) ; }
double GetTipFeed( void) const
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
double GetOffsL( void) const
{ return ( IsUnknownValue( m_Params.m_dOffsL) ? m_TParams.m_dOffsL : m_Params.m_dOffsL) ; }
double GetOffsR( void) const
{ return ( IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; }
double GetSideStep( void) const
{ return Clamp( m_Params.m_dSideStep, std::min( 0.1 * m_TParams.m_dDiam, 1.0), m_TParams.m_dDiam) ; }
int GetLeadInType( void) const
{ if ( m_Params.m_dLiTang < std::min( 0.1 * m_TParams.m_dDiam, 1.0))
return POCKET_LI_NONE ;
if ( m_Params.m_nLeadInType != POCKET_LI_GLIDE && m_Params.m_dLiElev < 10 * EPS_SMALL)
return POCKET_LI_NONE ;
return m_Params.m_nLeadInType ; }
bool LeadInRawIsOk( void) const
{ if ( m_TParams.m_nType != TT_MILL_NOTIP)
return true ;
return (( GetLeadInType() == POCKET_LI_ZIGZAG || GetLeadInType() == POCKET_LI_HELIX) &&
m_Params.m_dLiTang >= 0.9 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
int GetLeadOutType( void) const
{ if ( m_Params.m_dLoTang < std::min( 0.1 * m_TParams.m_dDiam, 1.0))
return POCKET_LO_NONE ;
return m_Params.m_nLeadOutType ; }
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
PocketingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
double m_dTHoldBase ; // posizione base del porta-utensile
double m_dTHoldLen ; // lunghezza del porta-utensile
double m_dTHoldDiam ; // diametro del porta-utensile
double m_dMaxHelixRad ; // raggio massimo attacco ad elica nel caso di cerchi
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nPockets ; // numero di percorsi di svuotatura generati
bool m_bTiltingTab ; // flag utilizzo tavola basculante
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
bool m_bAboveHead ; // flag utilizzo testa da sopra
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
bool m_bOpenOutRaw ; // flag forzatura lati aperti sempre fuori dal grezzo
double m_dOpenMinSafe ; // minima distanza di sicurezza di attacco su lato aperto
double m_dOpenInRawExtension ; // estensione dei tratti aperti dentro al grezzo
bool m_bAllClose ; // flag per forzare i lati come tutti chiusi
bool m_bRunning ; // flag di calcoli in corso
} ;
-955
View File
@@ -1,955 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : Probing.cpp Data : 10.06.25 Versione : 2.7f2
// Contenuto : Implementazione gestione tastatura.
//
//
//
// Modifiche : 10.06.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "MachMgr.h"
#include "DllMain.h"
#include "Probing.h"
#include "OperationConst.h"
#include "OperUserNotesConst.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkArcSpecial.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EGnStringKeyVal.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EgtIniFile.h"
using namespace std ;
//------------------------------ Errors --------------------------------------
// 3401 = "Error in Probing : UpdateToolData failed"
// 3402 = "Error in Probing : missing Script (xxx)"
// 3403 = "Error in Probing : Error in xxx (nnn)"
// 3404 = "Error in Probing : axes values not calculable"
// 3405 = "Error in Probing : outstroke xx"
// 3406 = "Error in Probing : link movements not calculable"
// 3407 = "Error in Probing : link outstroke xx"
// 3408 = "Error in Probing : post apply not calculable"
// 3409 = "Error in Probing : Tool loading failed"
// 3410 = "Error in Probing : special apply not calculable"
// 3451 = "Warning in Probing : Skipped entity (xx)"
// 3452 = "Warning in Probing : No machinable path"
// 3453 = "Warning in Probing : Tool name changed (xx)"
// 3454 = "Warning in Probing : Tool data changed (xx)"
//------------------------------ Constants -----------------------------------
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
static const string EVAR_MACHID = ".MACHID" ; // IN (int) identificativo della lavorazione
static const string EVAR_GEOM = ".GEOM" ; // IN (table) tabella delle entità da lavorare
static const string EVAR_DEPTH = ".DEPTH" ; // IN (string) affondamento (espressione numerica)
static const string EVAR_TINVERT = ".TOOLINVERT" ; // IN (bool) flag di inversione direzione utensile
static const string EVAR_INVERT = ".INVERT" ; // IN (bool) flag di inversione direzione lavorazione
static const string EVAR_STARTPOS = ".STARTPOS" ; // IN (num) quota di inizio lavorazione (sempre >= 0)
static const string EVAR_SYSNOTES = ".SYSNOTES" ; // IN (string) note interne
static const string EVAR_USERNOTES = ".USERNOTES" ;// IN (string) note dell'utente
static const string EVAR_TOOL = ".TOOL" ; // IN (string) nome dell'utensile
static const string EVAR_HEAD = ".HEAD" ; // IN (string) nome testa
static const string EVAR_EXIT = ".EXIT" ; // IN (int) indice uscita
static const string EVAR_TTYPE = ".TTYPE" ; // IN (int) tipo utensile
static const string EVAR_TDIAM = ".TDIAM" ; // IN (num) diametro utensile
static const string EVAR_TTOTDIAM = ".TTOTDIAM" ; // IN (num) diametro totale utensile
static const string EVAR_TLEN = ".TLEN" ; // IN (num) lunghezza utensile
static const string EVAR_TTOTLEN = ".TTOTLEN" ; // IN (num) lunghezza totale utensile
static const string EVAR_TTHICK = ".THICK" ; // IN (num) spessore per lame o altezza taglienti
static const string EVAR_TCORNRAD = ".TCORNRAD" ; // IN (num) raggio corner
static const string EVAR_FEED = ".FEED" ; // IN (num) feed dell'utensile
static const string EVAR_STARTFEED = ".STARTFEED" ;// IN (num) feed di inizio dell'utensile
static const string EVAR_ENDFEED = ".ENDFEED" ; // IN (num) feed di fine dell'utensile
static const string EVAR_TIPFEED = ".TIPFEED" ; // IN (num) feed di punta dell'utensile
static const string EVAR_ISROBOT = ".ISROBOT" ; // IN (bool) flag per indicare che la cinematica è di tipo robot
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
static const string EVAR_MILLS = ".MILLS" ; // OUT (int) numero di percorsi di lavoro
static const string ON_PREVIEW = "OnPreview_" ;
static const string ON_APPLY = "OnApply_" ;
//----------------------------------------------------------------------------
USEROBJ_REGISTER( GetOperationClass( OPER_PROBING), Probing) ;
//----------------------------------------------------------------------------
const string&
Probing::GetClassName( void) const
{
return USEROBJ_GETNAME( Probing) ;
}
//----------------------------------------------------------------------------
Probing*
Probing::Clone( void) const
{
// alloco oggetto
Probing* pGenM = new(nothrow) Probing ;
// eseguo copia dei dati
if ( pGenM != nullptr) {
try {
pGenM->m_vId = m_vId ;
pGenM->m_pMchMgr = m_pMchMgr ;
pGenM->m_nPhase = m_nPhase ;
pGenM->m_Params = m_Params ;
pGenM->m_TParams = m_TParams ;
pGenM->m_nStatus = m_nStatus ;
pGenM->m_nMills = m_nMills ;
}
catch( ...) {
delete pGenM ;
return nullptr ;
}
}
// ritorno l'oggetto
return pGenM ;
}
//----------------------------------------------------------------------------
bool
Probing::Dump( string& sOut, bool bMM, const char* szNewLine) const
{
sOut += GetClassName() + "[mm]" + szNewLine ;
sOut += KEY_PHASE + EQUAL + ToString( m_nPhase) + szNewLine ;
sOut += KEY_IDS + EQUAL + ToString( m_vId) + szNewLine ;
for ( int i = 0 ; i < m_Params.GetSize() ; ++ i)
sOut += m_Params.ToString( i) + szNewLine ;
for ( int i = 0 ; i < m_TParams.GetSize() ; ++ i)
sOut += m_TParams.ToString( i) + szNewLine ;
sOut += KEY_NUM + EQUAL + ToString( m_nMills) + szNewLine ;
sOut += KEY_STAT + EQUAL + ToString( m_nStatus) + szNewLine ;
return true ;
}
//----------------------------------------------------------------------------
bool
Probing::Save( int nBaseId, STRVECTOR& vString) const
{
try {
int nSize = 1 + m_Params.GetSize() + m_TParams.GetSize() + 3 ;
vString.insert( vString.begin(), nSize, "") ;
int k = - 1 ;
if ( ! SetVal( KEY_IDS, m_vId, vString[++k]))
return false ;
for ( int i = 0 ; i < m_Params.GetSize() ; ++ i)
vString[++k] = m_Params.ToString( i) ;
for ( int i = 0 ; i < m_TParams.GetSize() ; ++ i)
vString[++k] = m_TParams.ToString( i) ;
if ( ! SetVal( KEY_PHASE, m_nPhase, vString[++k]))
return false ;
if ( ! SetVal( KEY_NUM, m_nMills, vString[++k]))
return false ;
if ( ! SetVal( KEY_STAT, m_nStatus, vString[++k]))
return false ;
}
catch( ...) {
return false ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Probing::Load( const STRVECTOR& vString, int nBaseGdbId)
{
int nSize = int( vString.size()) ;
// lista identificativi geometrie da lavorare
int k = - 1 ;
if ( k >= nSize - 1 || ! GetVal( vString[++k], KEY_IDS, m_vId))
return false ;
for ( auto& Sel : m_vId)
Sel.nId += nBaseGdbId ;
// parametri lavorazione
for ( int i = 0 ; i < m_Params.GetSize() ; ++ i) {
int nKey ;
if ( k >= nSize - 1 || ! m_Params.FromString( vString[++k], nKey) || nKey != i) {
if ( m_Params.IsOptional( i))
-- k ;
else
return false ;
}
}
// parametri utensile
for ( int i = 0 ; i < m_TParams.GetSize() ; ++ i) {
int nKey ;
if ( k >= nSize - 1 || ! m_TParams.FromString( vString[++k], nKey) || nKey != i)
return false ;
}
// parametri di stato
while ( k < nSize - 1) {
// separo chiave da valore
string sKey, sVal ;
SplitFirst( vString[++k], "=", sKey, sVal) ;
// leggo
if ( sKey == KEY_PHASE) {
if ( ! FromString( sVal, m_nPhase))
return false ;
}
else if ( sKey == KEY_NUM) {
if ( ! FromString( sVal, m_nMills))
return false ;
}
else if ( sKey == KEY_STAT) {
if ( ! FromString( sVal, m_nStatus))
return false ;
}
}
return true ;
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
Probing::Probing( void)
{
m_Params.m_sName = "*" ;
m_Params.m_sToolName = "*" ;
m_TParams.m_sName = "*" ;
m_TParams.m_sHead = "*" ;
m_nStatus = MCH_ST_TO_VERIFY ;
m_nMills = 0 ;
}
//----------------------------------------------------------------------------
bool
Probing::Prepare( const string& sGenMchName)
{
// verifico il gestore lavorazioni
if ( m_pMchMgr == nullptr)
return false ;
// recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr)
return false ;
// recupero il gestore DB lavorazioni della macchina corrente
MachiningsMgr* pMMgr = m_pMchMgr->GetCurrMachiningsMgr() ;
if ( pMMgr == nullptr)
return false ;
// ricerca della lavorazione di libreria con il nome indicato
const ProbingData* pDdata = GetProbingData( pMMgr->GetMachining( sGenMchName)) ;
if ( pDdata == nullptr)
return false ;
m_Params = *pDdata ;
// ricerca dell'utensile usato dalla lavorazione
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
m_TParams = *pTdata ;
m_Params.m_sToolName = m_TParams.m_sName ;
return true ;
}
//----------------------------------------------------------------------------
bool
Probing::SetParam( int nType, bool bVal)
{
switch ( nType) {
case MPA_INVERT :
if ( bVal != m_Params.m_bInvert)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_bInvert = bVal ;
return true ;
case MPA_TOOLINVERT :
if ( bVal != m_Params.m_bToolInvert)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_bToolInvert = bVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
Probing::SetParam( int nType, int nVal)
{
switch ( nType) {
case MPA_SCC :
if ( ! m_Params.VerifySolCh( nVal))
return false ;
if ( nVal != m_Params.m_nSolCh)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_nSolCh = nVal ;
return true ;
case MPA_SUBTYPE :
if ( nVal != m_Params.m_nSubType)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_nSubType = nVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
Probing::SetParam( int nType, double dVal)
{
switch ( nType) {
case MPA_FEED :
if ( abs( m_TParams.m_dFeed - dVal) < EPS_MACH_LEN_PAR)
dVal = 0 ;
if ( abs( dVal - m_Params.m_dFeed) > EPS_MACH_LEN_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dFeed = dVal ;
return true ;
case MPA_STARTFEED :
if ( abs( m_TParams.m_dStartFeed - dVal) < EPS_MACH_LEN_PAR)
dVal = 0 ;
if ( abs( dVal - m_Params.m_dStartFeed) > EPS_MACH_LEN_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dStartFeed = dVal ;
return true ;
case MPA_ENDFEED :
if ( abs( m_TParams.m_dEndFeed - dVal) < EPS_MACH_LEN_PAR)
dVal = 0 ;
if ( abs( dVal - m_Params.m_dEndFeed) > EPS_MACH_LEN_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dEndFeed = dVal ;
return true ;
case MPA_TIPFEED :
if ( abs( m_TParams.m_dTipFeed - dVal) < EPS_MACH_LEN_PAR)
dVal = 0 ;
if ( abs( dVal - m_Params.m_dTipFeed) > EPS_MACH_LEN_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dTipFeed = dVal ;
return true ;
case MPA_DEPTH: {
string sVal = ToString( dVal) ;
if ( sVal != m_Params.m_sDepth)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sDepth = sVal ;
} return true ;
case MPA_STARTPOS :
if ( abs( dVal - m_Params.m_dStartPos) > EPS_MACH_LEN_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dStartPos = dVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
Probing::SetParam( int nType, const string& sVal)
{
switch ( nType) {
case MPA_TOOL : {
const ToolData* pTdata ;
if ( ! m_Params.VerifyTool( m_pMchMgr->GetCurrToolsMgr(), sVal, pTdata))
return false ;
if ( ! SameTool( m_TParams, *pTdata))
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sToolName = sVal ;
m_Params.m_ToolUuid = pTdata->m_Uuid ;
m_TParams = *pTdata ;
} return true ;
case MPA_DEPTH_STR :
if ( sVal != m_Params.m_sDepth)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sDepth = sVal ;
return true ;
case MPA_SYSNOTES :
if ( sVal != m_Params.m_sSysNotes)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sSysNotes = sVal ;
return true ;
case MPA_USERNOTES :
if ( sVal != m_Params.m_sUserNotes)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sUserNotes = sVal ;
return true ;
case MPA_INITANGS :
if ( sVal != m_Params.m_sInitAngs)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sInitAngs = sVal ;
return true ;
case MPA_BLOCKEDAXIS :
if ( sVal != m_Params.m_sBlockedAxis)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sBlockedAxis = sVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
Probing::SetGeometry( const SELVECTOR& vIds)
{
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// copia temporanea e reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
int nType = GEO_NONE ;
for ( const auto& Id : vIds) {
// test sull'entità
int nSubs ;
if ( ! VerifyGeometry( Id, nSubs, nType)) {
string sInfo = "Warning in Probing : Skipped entity " + ToString( Id) ;
m_pMchMgr->SetWarning( 3451, sInfo) ;
continue ;
}
// posso aggiungere alla lista
m_vId.emplace_back( Id) ;
}
// aggiorno lo stato
if ( m_vId != vOldId)
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare
return ( ! m_vId.empty() || vIds.empty()) ;
}
//----------------------------------------------------------------------------
bool
Probing::Preview( bool bRecalc)
{
// reset numero percorsi di lavoro generati
m_nMills = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
// aggiorno dati geometrici dell'utensile
if ( ! UpdateToolData()) {
m_pMchMgr->SetLastError( 3401, "Error in Probing : UpdateToolData failed") ;
return false ;
}
// rendo corrente l'utensile usato nella lavorazione
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
m_pMchMgr->SetLastError( 3409, "Error in Probing : Tool loading failed") ;
return false ;
}
// recupero gruppo per geometria di Preview
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
// se non c'è, lo aggiungo
if ( nPvId == GDB_ID_NULL) {
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nPvId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nPvId, MCH_PV) ;
}
// altrimenti lo svuoto
else
m_pGeomDB->EmptyGroup( nPvId) ;
// recupero la macchina corrente
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// nome della funzione lua da Ini della macchina
string sMachIni = pMch->GetMachineDir() + "\\" + pMch->GetMachineName() + ".ini" ;
string sKey = PROBING_SCRIPT_KEY + ToString( m_Params.m_nSubType) ;
string sName = GetPrivateProfileStringUtf8( PROBING_SEC.c_str(), sKey.c_str(), "", sMachIni.c_str()) ;
string sPreview = ON_PREVIEW + sName ;
// verifico esistenza funzione
if ( ! pMch->LuaExistsFunction( sPreview)) {
string sErr = "Error in Probing : missing Script " + sPreview ;
m_pMchMgr->SetLastError( 3402, sErr) ;
return false ;
}
// imposto stato
bool bOk = true ;
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_MACHID, m_nOwnerId) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_GEOM, m_vId) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_DEPTH, m_Params.m_sDepth) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TINVERT, m_Params.m_bToolInvert) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_INVERT, m_Params.m_bInvert) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTYPE, m_TParams.m_nType) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TDIAM, m_TParams.m_dDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTDIAM, m_TParams.m_dTDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TLEN, m_TParams.m_dLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTLEN, m_TParams.m_dTLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTHICK, m_TParams.m_dThick) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TCORNRAD, m_TParams.m_dCornRad) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_FEED, GetFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ISROBOT, m_pMchMgr->GetCurrIsRobot()) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( sPreview, false) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MILLS, m_nMills) ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori
if ( ! bOk || nErr != 0) {
m_nMills = 0 ;
string sErr = "Error in Probing : Error in " + sPreview + " (" + ToString( nErr) + ")" ;
m_pMchMgr->SetLastError( 3403, sErr) ;
return false ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Probing::Apply( bool bRecalc, bool bPostApply)
{
// reset numero percorsi di lavoro generati
int nCurrMills = m_nMills ;
m_nMills = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
// aggiorno dati geometrici dell'utensile
if ( ! UpdateToolData()) {
m_pMchMgr->SetLastError( 3401, "Error in Probing : UpdateToolData failed") ;
return false ;
}
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
// confermo i percorsi di lavorazione
m_nMills = nCurrMills ;
string sLog = string( "Probing apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo
return true ;
}
m_nStatus = MCH_ST_TO_VERIFY ;
// rendo corrente l'utensile usato nella lavorazione
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
m_pMchMgr->SetLastError( 3409, "Error in Probing : Tool loading failed") ;
return false ;
}
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo
if ( nClId == GDB_ID_NULL) {
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nClId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nClId, MCH_CL) ;
}
// altrimenti lo svuoto
else
m_pGeomDB->EmptyGroup( nClId) ;
// recupero la macchina corrente
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// nome della funzione lua da Ini della macchina
string sMachIni = pMch->GetMachineDir() + "\\" + pMch->GetMachineName() + ".ini" ;
string sKey = PROBING_SCRIPT_KEY + ToString( m_Params.m_nSubType) ;
string sName = GetPrivateProfileStringUtf8( PROBING_SEC.c_str(), sKey.c_str(), "", sMachIni.c_str()) ;
string sApply = ON_APPLY + sName ;
// verifico esistenza funzione
if ( ! pMch->LuaExistsFunction( sApply)) {
string sErr = "Error in Probing : missing Script " + sApply ;
m_pMchMgr->SetLastError( 3402, sErr) ;
return false ;
}
// imposto stato
bool bOk = true ;
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_MACHID, m_nOwnerId) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_GEOM, m_vId) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_DEPTH, m_Params.m_sDepth) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TINVERT, m_Params.m_bToolInvert) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_INVERT, m_Params.m_bInvert) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTYPE, m_TParams.m_nType) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TDIAM, m_TParams.m_dDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTDIAM, m_TParams.m_dTDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TLEN, m_TParams.m_dLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTLEN, m_TParams.m_dTLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTHICK, m_TParams.m_dThick) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TCORNRAD, m_TParams.m_dCornRad) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_FEED, GetFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ISROBOT, m_pMchMgr->GetCurrIsRobot()) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( sApply, false) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MILLS, m_nMills) ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori
if ( ! bOk || nErr != 0) {
m_nMills = 0 ;
string sErr = "Error in Probing : Error in " + sApply + " (" + ToString( nErr) + ")" ;
m_pMchMgr->SetLastError( 3403, sErr) ;
return false ;
}
// assegno ingombri dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetBBox( nClId) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
// aggiorno stato della lavorazione
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "Probing apply done") ;
return true ;
}
//----------------------------------------------------------------------------
bool
Probing::Update( bool bPostApply)
{
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
// se lavorazione vuota, esco
if ( m_nMills == 0) {
m_pMchMgr->SetWarning( 3452, "Warning in Probing : No machinable path") ;
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
if ( ! m_Params.m_sInitAngs.empty())
sHint = m_Params.m_sInitAngs ;
if ( ! CalculateAxesValues( sHint)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 3404, "Error in Probing : axes values not calculable") ;
else
m_pMchMgr->SetLastError( 3405, "Error in Probing : outstroke ") ;
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni speciali
string sSpecErr ;
if ( bPostApply && ! SpecialApply( sSpecErr)) {
if ( ! IsEmptyOrSpaces( sSpecErr))
m_pMchMgr->SetLastError( 3410, sSpecErr) ;
else
m_pMchMgr->SetLastError( 3410, "Error in Probing : special apply not calculable") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 3406, "Error in Probing : link movements not calculable") ;
else
m_pMchMgr->SetLastError( 3407, "Error in Probing : link outstroke ") ;
return false ;
}
// esecuzione eventuali personalizzazioni finali
string sPostErr ;
if ( bPostApply && ! PostApply( sPostErr)) {
if ( ! IsEmptyOrSpaces( sPostErr))
m_pMchMgr->SetLastError( 3408, sPostErr) ;
else
m_pMchMgr->SetLastError( 3408, "Error in Probing : post apply not calculable") ;
return false ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Probing::GetParam( int nType, bool& bVal) const
{
switch ( nType) {
case MPA_INVERT :
bVal = m_Params.m_bInvert ;
return true ;
case MPA_TOOLINVERT :
bVal = m_Params.m_bToolInvert ;
return true ;
}
bVal = false ;
return false ;
}
//----------------------------------------------------------------------------
bool
Probing::GetParam( int nType, int& nVal) const
{
switch ( nType) {
case MPA_TYPE :
nVal = MT_PROBING ;
return true ;
case MPA_SCC :
nVal = m_Params.m_nSolCh ;
return true ;
case MPA_SUBTYPE :
nVal = m_Params.m_nSubType ;
return true ;
}
nVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
Probing::GetParam( int nType, double& dVal) const
{
switch ( nType) {
case MPA_SPEED :
dVal = 0 ;
return true ;
case MPA_FEED :
dVal = GetFeed() ;
return true ;
case MPA_STARTFEED :
dVal = GetStartFeed() ;
return true ;
case MPA_ENDFEED :
dVal = GetEndFeed() ;
return true ;
case MPA_TIPFEED :
dVal = GetTipFeed() ;
return true ;
case MPA_STARTPOS :
dVal = m_Params.m_dStartPos ;
return true ;
}
dVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
Probing::GetParam( int nType, string& sVal) const
{
switch ( nType) {
case MPA_NAME :
sVal = m_Params.m_sName ;
return true ;
case MPA_TOOL :
sVal = m_Params.m_sToolName ;
return true ;
case MPA_DEPTH_STR :
sVal = m_Params.m_sDepth ;
return true ;
case MPA_TUUID :
sVal = ToString( m_Params.m_ToolUuid) ;
return true ;
case MPA_UUID :
sVal = ToString( m_Params.m_Uuid) ;
return true ;
case MPA_SYSNOTES :
sVal = m_Params.m_sSysNotes ;
return true ;
case MPA_USERNOTES :
sVal = m_Params.m_sUserNotes ;
return true ;
case MPA_INITANGS :
sVal = m_Params.m_sInitAngs ;
return true ;
case MPA_BLOCKEDAXIS :
sVal = m_Params.m_sBlockedAxis ;
return true ;
}
sVal = "" ;
return false ;
}
//----------------------------------------------------------------------------
const ToolData&
Probing::GetToolData( void) const
{
return m_TParams ;
}
//----------------------------------------------------------------------------
bool
Probing::UpdateToolData( void)
{
// recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr)
return false ;
// recupero l'utensile nel DB utensili (se fallisce con UUID provo con il nome)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) {
pTdata = pTMgr->GetTool( m_Params.m_sToolName) ;
if ( pTdata == nullptr)
return false ;
m_Params.m_ToolUuid = m_TParams.m_Uuid ;
}
// salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ;
int nOrigExit = m_TParams.m_nExit ;
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
// aggiorno comunque i parametri
m_TParams = *pTdata ;
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
string sTcPos ; string sHead ; int nExit ;
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
if ( sOrigTcPos != sTcPos ||
sOrigHead != sHead ||
nOrigExit != nExit)
bChanged = true ;
m_TParams.m_sTcPos = sTcPos ;
m_TParams.m_sHead = sHead ;
m_TParams.m_nExit = nExit ;
}
else {
if ( sOrigTcPos != pTdata->m_sTcPos ||
sOrigHead != pTdata->m_sHead ||
nOrigExit != pTdata->m_nExit)
bChanged = true ;
}
// eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in Probing : tool name changed (" +
m_Params.m_sToolName + "->" + m_TParams.m_sName + ")" ;
m_pMchMgr->SetWarning( 3453, sInfo) ;
m_Params.m_sToolName = m_TParams.m_sName ;
}
if ( bChanged) {
string sInfo = "Warning in Probing : tool data changed (" +
m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 3454, sInfo) ;
}
// se modificato, aggiusto lo stato
if ( bChanged)
m_nStatus = MCH_ST_TO_VERIFY ;
return true ;
}
//----------------------------------------------------------------------------
bool
Probing::GetGeometry( SELVECTOR& vIds) const
{
// restituisco l'elenco delle entità
vIds = m_vId ;
return true ;
}
//----------------------------------------------------------------------------
bool
Probing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
{
// ammessi : tutte curve o tutte facce di trimesh
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
if ( pGObj == nullptr)
return false ;
// se ammesse curve ed è tale
if ( nType != GEO_SURF && ( pGObj->GetType() & GEO_CURVE) != 0) {
const ICurve* pCurve = nullptr ;
// se direttamente la curva
if ( Id.nSub == SEL_SUB_ALL) {
pCurve = ::GetCurve( pGObj) ;
if ( pCurve != nullptr) {
if ( pCurve->GetType() == CRV_COMPO)
nSubs = ::GetCurveComposite( pCurve)->GetCurveCount() ;
else
nSubs = 0 ;
}
}
// altrimenti sottocurva di composita
else {
const ICurveComposite* pCompo = GetCurveComposite( pGObj) ;
if ( pCompo != nullptr)
pCurve = pCompo->GetCurve( Id.nSub) ;
nSubs = 0 ;
}
return ( pCurve != nullptr) ;
}
// se altrimenti ammesse superfici trimesh ed è tale
else if ( nType != GEO_CURVE && ( pGObj->GetType() & GEO_SURF) != 0) {
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
if ( pSurf == nullptr)
return false ;
// se direttamente la superficie
if ( Id.nSub == SEL_SUB_ALL) {
nSubs = pSurf->GetFacetCount() ;
return true ;
}
// altrimenti faccia di superficie trimesh
else {
// se faccia non esistente
if ( Id.nSub > pSurf->GetFacetCount())
return false ;
// tutto bene
nSubs = 0 ;
return true ;
}
}
// altrimenti errore
else
return false ;
}
//----------------------------------------------------------------------------
double
Probing::GetApproxLinTol( void) const
{
double dLinTol ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_LINTOL, dLinTol))
return dLinTol ;
else
return Operation::GetApproxLinTol() ;
}
-94
View File
@@ -1,94 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : Probing.h Data : 10.06.25 Versione : 2.7f2
// Contenuto : Dichiarazione della classe Probing.
//
//
//
// Modifiche : 10.06.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Machining.h"
#include "ProbingData.h"
#include "ToolData.h"
class ICurve ;
class ICurveComposite ;
//----------------------------------------------------------------------------
class Probing : public Machining
{
public : // IUserObj
Probing* 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_PROBING ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nMills == 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
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
public : // Machining
bool Prepare( const std::string& sMillName) override ;
bool SetParam( int nType, bool bVal) override ;
bool SetParam( int nType, int nVal) override ;
bool SetParam( int nType, double dVal) override ;
bool SetParam( int nType, const std::string& sVal) override ;
bool SetGeometry( const SELVECTOR& vIds) override ;
bool Preview( bool bRecalc) override ;
bool Apply( bool bRecalc, bool bPostApply) override ;
bool Update( bool bPostApply) override ;
bool GetParam( int nType, bool& bVal) const override ;
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
public :
Probing( void) ;
private :
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
double GetApproxLinTol( void) const override ;
private :
double GetFeed() const
{ return ( IsNullLenValue( m_Params.m_dFeed) ? m_TParams.m_dFeed : m_Params.m_dFeed) ; }
double GetStartFeed() const
{ return ( IsNullLenValue( m_Params.m_dStartFeed) ? m_TParams.m_dStartFeed : m_Params.m_dStartFeed) ; }
double GetEndFeed() const
{ return ( IsNullLenValue( m_Params.m_dEndFeed) ? m_TParams.m_dEndFeed : m_Params.m_dEndFeed) ; }
double GetTipFeed() const
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
ProbingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nMills ; // numero di percorsi di lavoro generati
} ;
-515
View File
@@ -1,515 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : ProbingData.cpp Data : 09.06.25 Versione : 2.7f2
// Contenuto : Implementazione struttura dati tastatura.
//
//
//
// Modifiche : 09.06.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "ProbingData.h"
#include "MachiningDataFactory.h"
#include "MachiningConst.h"
#include "/EgtDev/Include/EmkToolConst.h"
#include "/EgtDev/Include/EmkSimuGenConst.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include <array>
#include <cassert>
using namespace std ;
//----------------------------------------------------------------------------
enum nProbingKey {
KEY_AB = 0,
KEY_AI,
KEY_DH,
KEY_F,
KEY_FE,
KEY_FS,
KEY_FT,
KEY_INV,
KEY_NAME,
KEY_NNS,
KEY_NNU,
KEY_PS,
KEY_SCC,
KEY_SUBTYPE,
KEY_TI,
KEY_TNAME,
KEY_TUUID,
KEY_UUID,
KEY_ZZZ} ; // rappresenta il numero di elementi
static const array<string,KEY_ZZZ> sProbingKey = {
"AB",
"AI",
"DH",
"F",
"FE",
"FS",
"FT",
"INV",
"NAME",
"NNS",
"NNU",
"PS",
"SCC",
"SUB",
"TI",
"TN",
"TU",
"UUID"} ;
//----------------------------------------------------------------------------
MCHDATA_REGISTER( MT_PROBING, "PROBING", ProbingData) ;
//----------------------------------------------------------------------------
ProbingData*
ProbingData::Clone( void) const
{
// alloco oggetto
ProbingData* pDdata = new(nothrow) ProbingData ;
// copio i dati
if ( pDdata != nullptr) {
if ( ! pDdata->CopyFrom( this)) {
delete pDdata ;
return nullptr ;
}
}
return pDdata ;
}
//----------------------------------------------------------------------------
bool
ProbingData::CopyFrom( const MachiningData* pMdata)
{
// è inutile copiare se sorgente coincide con destinazione
if ( pMdata == this)
return true ;
// la sorgente deve essere dello stesso tipo
const ProbingData* pGdata = GetProbingData( pMdata) ;
if ( pGdata == nullptr)
return false ;
// eseguo copia
m_Uuid = pGdata->m_Uuid ;
m_sName = pGdata->m_sName ;
m_ToolUuid = pGdata->m_ToolUuid ;
m_sToolName = pGdata->m_sToolName ;
m_sBlockedAxis = pGdata->m_sBlockedAxis ;
m_sInitAngs = pGdata->m_sInitAngs ;
m_nSolCh = pGdata->m_nSolCh ;
m_dFeed = pGdata->m_dFeed ;
m_dStartFeed = pGdata->m_dStartFeed ;
m_dEndFeed = pGdata->m_dEndFeed ;
m_dTipFeed = pGdata->m_dTipFeed ;
m_bToolInvert = pGdata->m_bToolInvert ;
m_bInvert = pGdata->m_bInvert ;
m_sDepth = pGdata->m_sDepth ;
m_dStartPos = pGdata->m_dStartPos ;
m_nSubType = pGdata->m_nSubType ;
m_sSysNotes = pGdata->m_sSysNotes ;
m_sUserNotes = pGdata->m_sUserNotes ;
return true ;
}
//----------------------------------------------------------------------------
bool
ProbingData::SameAs(const MachiningData* pMdata) const
{
// se coincide con altro -> uguali
if ( pMdata == this)
return true ;
// se sono di tipo diverso -> diversi
const ProbingData* pGdata = GetProbingData( pMdata) ;
if ( pGdata == nullptr)
return false ;
// confronto termine a termine
return ( m_Uuid == pGdata->m_Uuid &&
m_sName == pGdata->m_sName &&
m_ToolUuid == pGdata->m_ToolUuid &&
m_sToolName == pGdata->m_sToolName &&
m_sBlockedAxis == pGdata->m_sBlockedAxis &&
m_sInitAngs == pGdata->m_sInitAngs &&
m_nSolCh == pGdata->m_nSolCh &&
abs( m_dFeed - pGdata->m_dFeed) < EPS_MACH_LEN_PAR &&
abs( m_dStartFeed - pGdata->m_dStartFeed) < EPS_MACH_LEN_PAR &&
abs( m_dEndFeed - pGdata->m_dEndFeed) < EPS_MACH_LEN_PAR &&
abs( m_dTipFeed - pGdata->m_dTipFeed) < EPS_MACH_LEN_PAR &&
m_bToolInvert == pGdata->m_bToolInvert &&
m_bInvert == pGdata->m_bInvert &&
m_sDepth == pGdata->m_sDepth &&
abs( m_dStartPos - pGdata->m_dStartPos) < EPS_MACH_LEN_PAR &&
m_nSubType == pGdata->m_nSubType &&
m_sSysNotes == pGdata->m_sSysNotes &&
m_sUserNotes == pGdata->m_sUserNotes) ;
}
//----------------------------------------------------------------------------
int
ProbingData::GetSize( void) const
{
// in debug verifico validità ultimo campo
assert( sProbingKey[KEY_UUID] == "UUID") ;
return KEY_ZZZ ;
}
//----------------------------------------------------------------------------
string
ProbingData::GetTitle( void) const
{
return MCHDATA_GETNAME( ProbingData) ;
}
//----------------------------------------------------------------------------
static int
FindProbingKey( const string& sKey)
{
auto TheRange = equal_range( sProbingKey.cbegin(), sProbingKey.cend(), sKey) ;
if ( TheRange.first == TheRange.second)
return - 1 ;
return int( TheRange.first - sProbingKey.cbegin()) ;
}
//----------------------------------------------------------------------------
bool
ProbingData::FromString( const string& sString, int& nKey)
{
// separo chiave da valore
string sKey, sVal ;
SplitFirst( sString, "=", sKey, sVal) ;
// riconosco la chiave
nKey = FindProbingKey( ToUpper( sKey)) ;
bool bOk = ( nKey >= 0) ;
switch ( nKey) {
case KEY_AB :
m_sBlockedAxis = sVal ;
break ;
case KEY_AI :
m_sInitAngs = sVal ;
break ;
case KEY_DH :
m_sDepth = sVal ;
if ( m_sDepth.empty())
m_sDepth = "0" ;
break ;
case KEY_F :
bOk = ::FromString( sVal, m_dFeed) ;
break ;
case KEY_FE :
bOk = ::FromString( sVal, m_dEndFeed) ;
break ;
case KEY_FS :
bOk = ::FromString( sVal, m_dStartFeed) ;
break ;
case KEY_FT :
bOk = ::FromString( sVal, m_dTipFeed) ;
break ;
case KEY_INV :
bOk = ::FromString( sVal, m_bInvert) ;
break ;
case KEY_NAME :
m_sName = sVal ;
bOk = ! m_sName.empty() ;
break ;
case KEY_NNS :
m_sSysNotes = sVal ;
break ;
case KEY_NNU :
m_sUserNotes = sVal ;
break ;
case KEY_PS :
bOk = ::FromString( sVal, m_dStartPos) ;
break ;
case KEY_SCC :
bOk = ::FromString( sVal, m_nSolCh) ;
break ;
case KEY_SUBTYPE :
bOk = ::FromString( sVal, m_nSubType) ;
break ;
case KEY_TNAME :
m_sToolName = sVal ;
break ;
case KEY_TI :
bOk = ::FromString( sVal, m_bToolInvert) ;
break ;
case KEY_TUUID :
bOk = ::FromString( sVal, m_ToolUuid) ;
break ;
case KEY_UUID :
bOk = ::FromString( sVal, m_Uuid) ;
break ;
default :
bOk = false ;
break ;
}
return bOk ;
}
//----------------------------------------------------------------------------
string
ProbingData::ToString( int nKey) const
{
switch ( nKey) {
case KEY_AB : return ( sProbingKey[KEY_AB] + "=" + m_sBlockedAxis) ;
case KEY_AI : return ( sProbingKey[KEY_AI] + "=" + m_sInitAngs) ;
case KEY_DH : return ( sProbingKey[KEY_DH] + "=" + m_sDepth) ;
case KEY_F : return ( sProbingKey[KEY_F] + "=" + ::ToString( m_dFeed)) ;
case KEY_FE : return ( sProbingKey[KEY_FE] + "=" + ::ToString( m_dEndFeed)) ;
case KEY_FS : return ( sProbingKey[KEY_FS] + "=" + ::ToString( m_dStartFeed)) ;
case KEY_FT : return ( sProbingKey[KEY_FT] + "=" + ::ToString( m_dTipFeed)) ;
case KEY_INV : return ( sProbingKey[KEY_INV] + "=" + ::ToString( m_bInvert)) ;
case KEY_NAME : return ( sProbingKey[KEY_NAME] + "=" + m_sName) ;
case KEY_NNS : return ( sProbingKey[KEY_NNS] + "=" + m_sSysNotes) ;
case KEY_NNU : return ( sProbingKey[KEY_NNU] + "=" + m_sUserNotes) ;
case KEY_PS : return ( sProbingKey[KEY_PS] + "=" + ::ToString( m_dStartPos)) ;
case KEY_SCC : return ( sProbingKey[KEY_SCC] + "=" + ::ToString( m_nSolCh)) ;
case KEY_SUBTYPE : return ( sProbingKey[KEY_SUBTYPE] + "=" + ::ToString( m_nSubType)) ;
case KEY_TI : return ( sProbingKey[KEY_TI] + "=" + ::ToString( m_bToolInvert)) ;
case KEY_TNAME : return ( sProbingKey[KEY_TNAME] + "=" + m_sToolName) ;
case KEY_TUUID : return ( sProbingKey[KEY_TUUID] + "=" + ::ToString( m_ToolUuid)) ;
case KEY_UUID : return ( sProbingKey[KEY_UUID] + "=" + ::ToString( m_Uuid)) ;
default : return "" ;
}
}
//----------------------------------------------------------------------------
bool
ProbingData::IsOptional( int nKey) const
{
return ( nKey == KEY_AB || nKey == KEY_AI || nKey == KEY_TI) ;
}
//----------------------------------------------------------------------------
bool
ProbingData::VerifySolCh( int nVal) const
{
return IsValidOperationScc( nVal) ;
}
//----------------------------------------------------------------------------
bool
ProbingData::VerifyTool( const ToolsMgr* pToolsMgr, const string& sVal, const ToolData*& pTdata) const
{
if ( pToolsMgr == nullptr)
return false ;
pTdata = pToolsMgr->GetTool( sVal) ;
if ( pTdata == nullptr)
return false ;
if ( ( pTdata->m_nType & TF_PROBE) == 0)
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
ProbingData::GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const
{
if ( pToolsMgr == nullptr)
return false ;
pTdata = pToolsMgr->GetTool( m_ToolUuid) ;
return ( pTdata != nullptr) ;
}
//----------------------------------------------------------------------------
bool
ProbingData::SetParam( int nType, bool bVal)
{
switch ( nType) {
case MPA_INVERT :
m_bInvert = bVal ;
return true ;
case MPA_TOOLINVERT :
m_bToolInvert = bVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
ProbingData::SetParam( int nType, int nVal)
{
switch ( nType) {
case MPA_SCC :
if ( ! VerifySolCh( nVal))
return false ;
m_nSolCh = nVal ;
return true ;
case MPA_SUBTYPE :
m_nSubType = nVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
ProbingData::SetParam( int nType, double dVal)
{
switch ( nType) {
case MPA_FEED :
m_dFeed = dVal ;
return true ;
case MPA_STARTFEED :
m_dStartFeed = dVal ;
return true ;
case MPA_ENDFEED :
m_dEndFeed = dVal ;
return true ;
case MPA_TIPFEED :
m_dTipFeed = dVal ;
return true ;
case MPA_DEPTH :
m_sDepth = ::ToString( dVal) ;
return true ;
case MPA_STARTPOS :
m_dStartPos = dVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
ProbingData::SetParam( int nType, const string& sVal)
{
switch ( nType) {
case MPA_NAME :
m_sName = sVal ;
return true ;
case MPA_TOOL :
m_sToolName = sVal ;
return true ;
case MPA_DEPTH_STR :
m_sDepth = sVal ;
return true ;
case MPA_TUUID :
return ::FromString( sVal, m_ToolUuid) ;
case MPA_UUID :
return ::FromString( sVal, m_Uuid) ;
case MPA_SYSNOTES :
m_sSysNotes = sVal ;
return true ;
case MPA_USERNOTES :
m_sUserNotes = sVal ;
return true ;
case MPA_INITANGS :
m_sInitAngs = sVal ;
return true ;
case MPA_BLOCKEDAXIS :
m_sBlockedAxis = sVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
ProbingData::ResetTool( void)
{
m_sToolName.clear() ;
m_ToolUuid.Clear() ;
return true ;
}
//----------------------------------------------------------------------------
bool
ProbingData::GetParam( int nType, bool& bVal) const
{
switch ( nType) {
case MPA_INVERT :
bVal = m_bInvert ;
return true ;
case MPA_TOOLINVERT :
bVal = m_bToolInvert ;
return true ;
}
bVal = false ;
return false ;
}
//----------------------------------------------------------------------------
bool
ProbingData::GetParam( int nType, int& nVal) const
{
switch ( nType) {
case MPA_TYPE :
nVal = MT_PROBING ;
return true ;
case MPA_SCC :
nVal = m_nSolCh ;
return true ;
case MPA_SUBTYPE :
nVal = m_nSubType ;
return true ;
}
nVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
ProbingData::GetParam( int nType, double& dVal) const
{
switch ( nType) {
case MPA_FEED :
dVal = m_dFeed ;
return true ;
case MPA_STARTFEED :
dVal = m_dStartFeed ;
return true ;
case MPA_ENDFEED :
dVal = m_dEndFeed ;
return true ;
case MPA_TIPFEED :
dVal = m_dTipFeed ;
return true ;
case MPA_STARTPOS :
dVal = m_dStartPos ;
return true ;
}
dVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
ProbingData::GetParam( int nType, string& sVal) const
{
switch ( nType) {
case MPA_NAME :
sVal = m_sName ;
return true ;
case MPA_TOOL :
sVal = m_sToolName ;
return true ;
case MPA_DEPTH_STR :
sVal = m_sDepth ;
return true ;
case MPA_TUUID :
sVal = ::ToString( m_ToolUuid) ;
return true ;
case MPA_UUID :
sVal = ::ToString( m_Uuid) ;
return true ;
case MPA_SYSNOTES :
sVal = m_sSysNotes ;
return true ;
case MPA_USERNOTES :
sVal = m_sUserNotes ;
return true ;
case MPA_INITANGS :
sVal = m_sInitAngs ;
return true ;
case MPA_BLOCKEDAXIS :
sVal = m_sBlockedAxis ;
return true ;
}
sVal = "" ;
return false ;
}
-73
View File
@@ -1,73 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : ProbingData.h Data : 09.06.25 Versione : 2.7f2
// Contenuto : Dichiarazione della struct ProbingData e costanti associate.
//
//
//
// Modifiche : 09.06.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "MachiningData.h"
//----------------------------------------------------------------------------
struct ProbingData : public MachiningData
{
EgtUUID m_ToolUuid ; // identificativo universale dell'utensile
std::string m_sToolName ; // nome dell'utensile
std::string m_sInitAngs ; // angoli iniziali suggeriti (Nome1=val1,Nome2=val2)
std::string m_sBlockedAxis ; // eventuale asse rotante bloccato (Nome=val)
int m_nSolCh ; // criterio scelta soluzione (quando possibili molteplici)
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
double m_dTipFeed ; // velocità di lavorazione di sfondamento ( se 0 da utensile)
bool m_bToolInvert ; // flag per inversione direzione utensile da geometria
bool m_bInvert ; // flag di inversione direzione lavorazione
std::string m_sDepth ; // affondamento (espressione numerica)
double m_dStartPos ; // quota di inizio lavorazione (sempre >= 0)
int m_nSubType ; // da [Probing] di Ini di macchina
std::string m_sSysNotes ; // note interne
std::string m_sUserNotes ; // note dell'utente
ProbingData( void)
: m_ToolUuid(), m_nSolCh( 0), m_dFeed( 0), m_dStartFeed( 0), m_dEndFeed( 0), m_dTipFeed( 0),
m_bToolInvert( false), m_bInvert( false), m_dStartPos( 0), m_nSubType( 0) {}
ProbingData* Clone( void) const override ;
bool CopyFrom( const MachiningData* pMdata) override ;
bool SameAs(const MachiningData* pMdata) const override ;
int GetType( void) const override
{ return MT_PROBING ; }
int GetSize( void) const override ;
std::string GetTitle( void) const override ;
bool FromString( const std::string& sString, int& nKey) override ;
std::string ToString( int nKey) const override ;
bool IsOptional( int nKey) const override ;
bool SetParam( int nType, bool bVal) override ;
bool SetParam( int nType, int nVal) override ;
bool SetParam( int nType, double dVal) override ;
bool SetParam( int nType, const std::string& sVal) override ;
bool ResetTool( void) override ;
bool GetParam( int nType, bool& bVal) const override ;
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const override ;
bool VerifyTool( const ToolsMgr* pToolsMgr, const std::string& sVal, const ToolData*& pTdata) const override ;
bool VerifySolCh( int nVal) const ;
} ;
//----------------------------------------------------------------------------
inline const ProbingData* GetProbingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_PROBING)
return nullptr ;
return ( static_cast<const ProbingData*>( pMdata)) ; }
inline ProbingData* GetProbingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_PROBING)
return nullptr ;
return ( static_cast<ProbingData*>( pMdata)) ; }
+28 -154
View File
@@ -29,8 +29,11 @@
using namespace std ; using namespace std ;
//------------------------------ Errors -------------------------------------- //------------------------------ Errors --------------------------------------
// 1002 = "Error with setup : xxx" // 1001 = "Error with setup : xxx"
// 1003 = "Error opening Cnc file" // 1002 = "Error opening Cnc file"
//----------------------------------------------------------------------------
static const string ERR_EXT = ".err" ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
Processor::Processor( void) Processor::Processor( void)
@@ -168,7 +171,7 @@ Processor::VerifySetup( void)
string sErr = "Error with setup :" ; string sErr = "Error with setup :" ;
for ( const auto& sTmp : vsErr) for ( const auto& sTmp : vsErr)
sErr += " " + sTmp ; sErr += " " + sTmp ;
m_pMchMgr->SetLastError( 1002, sErr) ; m_pMchMgr->SetLastError( 1001, sErr) ;
return false ; return false ;
} }
@@ -204,7 +207,7 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
return false ; return false ;
// Se utensile non definito o cambiato, emetto selezione nuovo utensile // Se utensile non definito o cambiato, emetto selezione nuovo utensile
if ( m_sTool.empty() || m_sTool != m_sPrevTool) { if ( m_sTool.empty() || m_sTool != m_sPrevTool) {
if ( ! OnToolSelect( sTool, sHead, nExit, sTcPos, false)) if ( ! OnToolSelect( sTool, sHead, nExit, sTcPos))
return false ; return false ;
} }
} }
@@ -221,38 +224,6 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
if ( ! OnTableData( sTable, ptOri1)) if ( ! OnTableData( sTable, ptOri1))
return false ; return false ;
// Recupero assi tavola mossi nella disposizione
INTVECTOR vMovAxId ;
for ( int i = 0 ; ; ++ i) {
string sName ;
double dPos ;
if ( pDisp->GetMoveAxisData( i, sName, dPos)) {
int nAxId = m_pMachine->GetAxisId( sName) ;
if ( nAxId != GDB_ID_NULL)
vMovAxId.emplace_back( nAxId) ;
}
else
break ;
}
// Emetto posizioni assi di tavola
INTVECTOR vAxisId ;
m_pMachine->GetAllAxesIds( vAxisId) ;
int nTableId = m_pMachine->GetTableId( sTable) ;
int nInd = 0 ;
for ( int nAxId : vAxisId) {
string sName ;
double dPos ;
if ( m_pMachine->IsDispositionAxis( nAxId, nTableId) &&
m_pMachine->GetAxisName( nAxId, sName) &&
m_pMachine->GetAxisPos( sName, dPos)) {
++ nInd ;
bool bMoved = ( std::find( vMovAxId.begin(), vMovAxId.end(), nAxId) != vMovAxId.end()) ;
if ( ! OnTableAxisData( nInd, sName, dPos, bMoved))
return false ;
}
}
// Emetto dati bloccaggi // Emetto dati bloccaggi
for ( int i = 0 ; ; ++ i) { for ( int i = 0 ; ; ++ i) {
string sName ; string sName ;
@@ -260,9 +231,8 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
Point3d ptPos ; Point3d ptPos ;
double dAngDeg ; double dAngDeg ;
double dMov ; double dMov ;
string sTaLink ; if ( pDisp->GetFixtureData( i, sName, nId, ptPos, dAngDeg, dMov)) {
if ( pDisp->GetFixtureData( i, sName, nId, ptPos, dAngDeg, dMov, sTaLink)) { if ( ! OnFixtureData( nId, i + 1, sName, ptPos, dAngDeg, dMov))
if ( ! OnFixtureData( nId, i + 1, sName, ptPos, dAngDeg, dMov, sTaLink))
return false ; return false ;
} }
else else
@@ -276,7 +246,7 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
Point3d ptPos ; Point3d ptPos ;
int nFlag ; int nFlag ;
if ( pDisp->GetMoveRawData( i, nRawId, nType, ptPos, nFlag)) { if ( pDisp->GetMoveRawData( i, nRawId, nType, ptPos, nFlag)) {
if ( ! OnRawMoveData( nRawId, i + 1, nType, ptPos, nFlag)) if ( ! OnRawMoveData( nRawId, i + 1, nType, ptPos, nFlag))
return false ; return false ;
} }
else else
@@ -315,7 +285,7 @@ Processor::ProcessMachining( int nOpId, int nOpInd)
return false ; return false ;
// Verifico non sia vuota // Verifico non sia vuota
if ( m_pMchMgr->IsMachiningEmpty( NEED_ONE_TP_OK)) if ( m_pMchMgr->IsMachiningEmpty())
return true ; return true ;
// Recupero l'utensile della lavorazione corrente // Recupero l'utensile della lavorazione corrente
@@ -352,8 +322,7 @@ Processor::ProcessMachining( int nOpId, int nOpInd)
m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, nExit) ; m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, nExit) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TCPOS, sTcPos) ; m_pMchMgr->TdbGetCurrToolParam( TPA_TCPOS, sTcPos) ;
} }
bool bFloating = m_pMachine->IsCurrToolFloating() ; if ( ! OnToolSelect( sTool, sHead, nExit, sTcPos))
if ( ! OnToolSelect( sTool, sHead, nExit, sTcPos, bFloating))
return false ; return false ;
} }
@@ -398,13 +367,6 @@ Processor::ProcessMachining( int nOpId, int nOpInd)
bool bool
Processor::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd) Processor::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd)
{ {
// verifico se Path in doppio
int nDblPathId = GDB_ID_NULL ;
int nDblId = m_pGeomDB->GetFirstNameInGroup( nOpId, MCH_DBL) ;
if ( nDblId != GDB_ID_NULL) {
string sCLPathName ; m_pGeomDB->GetName( nClPathId, sCLPathName) ;
nDblPathId = m_pGeomDB->GetFirstNameInGroup( nDblId, sCLPathName) ;
}
// Recupero punti di inizio e fine del percorso // Recupero punti di inizio e fine del percorso
Point3d ptStart ; Point3d ptStart ;
m_pGeomDB->GetInfo( nClPathId, KEY_START, ptStart) ; m_pGeomDB->GetInfo( nClPathId, KEY_START, ptStart) ;
@@ -424,15 +386,11 @@ Processor::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd)
// Recupero massima elevazione // Recupero massima elevazione
double dElev = 0 ; double dElev = 0 ;
m_pGeomDB->GetInfo( nClPathId, KEY_ELEV, dElev) ; m_pGeomDB->GetInfo( nClPathId, KEY_ELEV, dElev) ;
// recupero eventuale attivazione uscite (gruppi a forare)
INTVECTOR vActiveExit ;
m_pGeomDB->GetInfo( nClPathId, KEY_DRACEX, vActiveExit) ;
// Recupero il numero di eventi ausiliari iniziali // Recupero il numero di eventi ausiliari iniziali
int nAS = 0 ; int nAS = 0 ;
m_pGeomDB->GetInfo( nClPathId, KEY_AS_TOT, nAS) ; m_pGeomDB->GetInfo( nClPathId, KEY_AS_TOT, nAS) ;
// Emetto inizio percorso di lavoro // Emetto inizio percorso di lavoro
if ( ! OnPathStart( nClPathId, nClPathInd, nDblPathId, nAS, ptStart, ptEnd, vtExtr, if ( ! OnPathStart( nClPathId, nClPathInd, nAS, ptStart, ptEnd, vtExtr, ptMin, ptMax, vAxMin, vAxMax, dElev))
ptMin, ptMax, vAxMin, vAxMax, dElev, vActiveExit))
return false ; return false ;
// Emissione eventuali dati ausiliari di inizio // Emissione eventuali dati ausiliari di inizio
@@ -456,7 +414,7 @@ Processor::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd)
// processo l'entità // processo l'entità
if ( ! ProcessClEnt( nEntId, nEntInd, nClPathId, nClPathInd, nOpId, nOpInd)) if ( ! ProcessClEnt( nEntId, nEntInd, nClPathId, nClPathInd, nOpId, nOpInd))
bOk = false ; bOk = false ;
// passo all'entità successiva // passo all'entità successivo
nEntId = m_pGeomDB->GetNext( nEntId) ; nEntId = m_pGeomDB->GetNext( nEntId) ;
} }
@@ -491,25 +449,19 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
if ( pCamData == nullptr || pCamData->GetAxesStatus() != CamData::AS_OK) if ( pCamData == nullptr || pCamData->GetAxesStatus() != CamData::AS_OK)
return false ; return false ;
const DBLVECTOR& AxesEnd = pCamData->GetAxesVal() ; const DBLVECTOR& AxesEnd = pCamData->GetAxesVal() ;
int nMove = pCamData->GetMoveType() ;
// Recupero i dati Cam del movimento successivo del percorso (se esiste)
CamData* pNextCamData = GetCamData( m_pGeomDB->GetUserObj( m_pGeomDB->GetNext( nEntId))) ;
int nMoveNext = ( pNextCamData != nullptr ? pNextCamData->GetMoveType() : -1) ;
DBLVECTOR AxesNull ;
const DBLVECTOR& AxesNext = ( pNextCamData != nullptr ? pNextCamData->GetAxesVal() : AxesNull) ;
// Emetto movimento // Emetto movimento
int nMove = pCamData->GetMoveType() ;
switch ( nMove) { switch ( nMove) {
case 0 : // rapido case 0 : // rapido
if ( ! OnRapid( nEntId, nEntInd, nMove, AxesEnd, pCamData->GetAxesMask(), if ( ! OnRapid( nEntId, nEntInd, nMove, AxesEnd, pCamData->GetAxesMask(),
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(), pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), nMoveNext, AxesNext)) pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex()))
return false ; return false ;
break ; break ;
case 1 : // linea case 1 : // linea
if ( ! OnLinear( nEntId, nEntInd, nMove, AxesEnd, if ( ! OnLinear( nEntId, nEntInd, nMove, AxesEnd,
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(), pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex()))
pCamData->GetCorrType(), nMoveNext, AxesNext))
return false ; return false ;
break ; break ;
case 2 : // arco CW case 2 : // arco CW
@@ -519,8 +471,7 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
if ( ! OnArc( nEntId, nEntInd, nMove, AxesEnd, if ( ! OnArc( nEntId, nEntInd, nMove, AxesEnd,
pCamData->GetAxesCen(), ptMid, pCamData->GetAxesRad(), pCamData->GetAxesAngCen(), pCamData->GetAxesCen(), ptMid, pCamData->GetAxesRad(), pCamData->GetAxesAngCen(),
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(), pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex(), pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex()))
pCamData->GetCorrType(), nMoveNext, AxesNext))
return false ; return false ;
break ; break ;
} }
@@ -625,7 +576,7 @@ Processor::OnProgramStart( const string& sMachName, const string& sCncFile, cons
// apro il file di output // apro il file di output
bool bOk = m_pMachine->WriterOpen( sCncFile) ; bool bOk = m_pMachine->WriterOpen( sCncFile) ;
if ( ! bOk) if ( ! bOk)
m_pMchMgr->SetLastError( 1003, "Error opening Cnc file") ; m_pMchMgr->SetLastError( 1002, "Error opening Cnc file") ;
// assegno nome macchina // assegno nome macchina
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MACHNAME, sMachName) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MACHNAME, sMachName) ;
// assegno nome file // assegno nome file
@@ -850,24 +801,10 @@ Processor::OnTableData( const string& sName, const Point3d& ptOri1)
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------
bool
Processor::OnTableAxisData( int nAxisInd, const string& sName, double dPos, bool bMoved)
{
// assegno dati movimento asse di tavola
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TAIND, nAxisInd) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TANAME, sName) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TAPOS, dPos) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TAMOVED, bMoved) ;
// chiamo la funzione di gestione dati movimento asse di tavola
bOk = bOk && CallOnTableAxisData() ;
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Processor::OnFixtureData( int nFixId, int nFixInd, const string& sName, const Point3d& ptPos, Processor::OnFixtureData( int nFixId, int nFixInd, const string& sName, const Point3d& ptPos,
double dAngDeg, double dMov, const string& sTaLink) double dAngDeg, double dMov)
{ {
// assegno dati bloccaggio // assegno dati bloccaggio
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXID, nFixId) ; bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXID, nFixId) ;
@@ -876,10 +813,6 @@ 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_FIXPOS, ptPos) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXANG, dAngDeg) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXANG, dAngDeg) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FIXMOB, dMov) ; 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 // chiamo la funzione di gestione dati bloccaggio
bOk = bOk && CallOnFixtureData() ; bOk = bOk && CallOnFixtureData() ;
return bOk ; return bOk ;
@@ -887,11 +820,11 @@ Processor::OnFixtureData( int nFixId, int nFixInd, const string& sName, const Po
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Processor::OnRawMoveData( int nRawId, int nRawMoveInd, int nType, const Point3d& ptPos, int nFlag) Processor::OnRawMoveData( int nRawId, int RawMoveInd, int nType, const Point3d& ptPos, int nFlag)
{ {
// assegno dati bloccaggio // assegno dati bloccaggio
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWID, nRawId) ; bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWID, nRawId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWIND, nRawMoveInd) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWIND, RawMoveInd) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWTYPE, nType) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWTYPE, nType) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWPOS, ptPos) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWPOS, ptPos) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWFLAG, nFlag) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RAWFLAG, nFlag) ;
@@ -902,14 +835,13 @@ Processor::OnRawMoveData( int nRawId, int nRawMoveInd, int nType, const Point3d&
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Processor::OnToolSelect( const string& sTool, const string& sHead, int nExit, const string& sTcPos, bool bFloating) Processor::OnToolSelect( const string& sTool, const string& sHead, int nExit, const string& sTcPos)
{ {
// assegno il nome dell'utensile, la testa, l'uscita e l'eventuale posizione nel toolchanger // assegno il nome dell'utensile, la testa, l'uscita e l'eventuale posizione nel toolchanger
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TOOL, sTool) ; bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TOOL, sTool) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_HEAD, sHead) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_HEAD, sHead) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, nExit) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, nExit) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, sTcPos) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, sTcPos) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TFLOAT, bFloating) ;
// assegno il token e il nome degli assi // assegno il token e il nome degli assi
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ; bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
int nNumAxes = int( m_AxesName.size()) ; int nNumAxes = int( m_AxesName.size()) ;
@@ -972,25 +904,18 @@ Processor::OnMachiningEnd( void)
{ {
// chiamo la funzione di fine lavorazione // chiamo la funzione di fine lavorazione
bool bOk = CallOnMachiningEnd() ; bool bOk = CallOnMachiningEnd() ;
// reset eventuale Path in double
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
return bOk ; return bOk ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Processor::OnPathStart( int nClPathId, int nClPathInd, int nDblPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd, Processor::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax, const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev)
{ {
// assegno identificativo e indice percorso di lavorazione // assegno identificativo e indice percorso di lavorazione
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ; bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHIND, nClPathInd) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHIND, nClPathInd) ;
// assegno identificativo eventuale percorso in doppio
if ( nDblPathId == GDB_ID_NULL)
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
else
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DBLPATHID, nDblPathId) ;
// assegno numero di dati ausiliari iniziali // assegno numero di dati ausiliari iniziali
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUXTOT, nAS) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUXTOT, nAS) ;
// assegno punti iniziale e finale e versore estrusione del percorso originale // assegno punti iniziale e finale e versore estrusione del percorso originale
@@ -1005,8 +930,6 @@ Processor::OnPathStart( int nClPathId, int nClPathInd, int nDblPathId, int nAS,
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PAXMAX, vAxMax) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PAXMAX, vAxMax) ;
// assegno la massima elevazione // assegno la massima elevazione
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ELEV, dElev) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ELEV, dElev) ;
// assegno uscite attive per gruppi a forare
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DRACEX, vActiveExit) ;
// chiamo la funzione di inizio percorso di lavorazione // chiamo la funzione di inizio percorso di lavorazione
bOk = bOk && CallOnPathStart() ; bOk = bOk && CallOnPathStart() ;
return bOk ; return bOk ;
@@ -1051,7 +974,7 @@ Processor::OnPathEndAux( int nInd, const string& sAE)
bool bool
Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, int nAxesMask, Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) int nFlag, int nFlag2, int nIndex)
{ {
// cancello variabili estranee // cancello variabili estranee
ResetArcData() ; ResetArcData() ;
@@ -1083,21 +1006,6 @@ Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ;
// assegno il valore dell'indice // assegno il valore dell'indice
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
// anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso
if ( nMoveNext != -1) {
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
if ( i <= nNumAxes)
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot), AxesNext[i-1]) ;
else
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
}
else {
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_MOVESUCC) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i)
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
// chiamo la funzione di movimento in rapido // chiamo la funzione di movimento in rapido
bOk = bOk && CallOnRapid() ; bOk = bOk && CallOnRapid() ;
return bOk ; return bOk ;
@@ -1107,7 +1015,7 @@ Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd
bool bool
Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex, int nCorr, int nMoveNext, const DBLVECTOR& AxesNext) double dFeed, int nFlag, int nFlag2, int nIndex)
{ {
// cancello variabili estranee // cancello variabili estranee
ResetArcData() ; ResetArcData() ;
@@ -1139,23 +1047,6 @@ Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEn
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ;
// assegno il valore dell'indice // assegno il valore dell'indice
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
// assegno il tipo di correzione
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_CORR, nCorr) ;
// anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso
if ( nMoveNext != -1) {
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
if ( i <= nNumAxes)
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot), AxesNext[i-1]) ;
else
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
}
else {
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_MOVESUCC) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i)
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
// chiamo la funzione di movimento in rapido // chiamo la funzione di movimento in rapido
bOk = bOk && CallOnLinear() ; bOk = bOk && CallOnLinear() ;
return bOk ; return bOk ;
@@ -1166,7 +1057,7 @@ bool
Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen, const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex, int nCorr, int nMoveNext, const DBLVECTOR& AxesNext) double dFeed, int nFlag, int nFlag2, int nIndex)
{ {
// assegno Id e indice entità di movimento // assegno Id e indice entità di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ; bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ;
@@ -1208,23 +1099,6 @@ Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, nFlag2) ;
// assegno il valore dell'indice // assegno il valore dell'indice
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
// assegno il tipo di correzione
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_CORR, nCorr) ;
// anticipazione di alcuni dati dell'eventuale movimento successivo dello stesso percorso
if ( nMoveNext != -1) {
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVESUCC, nMoveNext) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
if ( i <= nNumAxes)
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot), AxesNext[i-1]) ;
else
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
}
else {
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_MOVESUCC) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i)
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisNext( i, GLOB_VAR, bIsRobot)) ;
}
// chiamo la funzione di movimento in rapido // chiamo la funzione di movimento in rapido
bOk = bOk && CallOnArc() ; bOk = bOk && CallOnArc() ;
return bOk ; return bOk ;
+8 -10
View File
@@ -42,34 +42,33 @@ class Processor
bool OnProgramStart( const std::string& sMachName, const std::string& sCncFile, const std::string& sInfo, bool bSetup) ; bool OnProgramStart( const std::string& sMachName, const std::string& sCncFile, const std::string& sInfo, bool bSetup) ;
bool OnProgramEnd( void) ; bool OnProgramEnd( void) ;
bool ProcessToolData( void) ; bool ProcessToolData( void) ;
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos, bool bFloating) ; bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos) ;
bool OnToolDeselect( const std::string& sNextTool, const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos) ; bool OnToolDeselect( const std::string& sNextTool, const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos) ;
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase, bool bEmpty, bool bSomeByHand) ; bool OnDispositionStart( int nOpId, int nOpInd, int nPhase, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionEnd( void) ; bool OnDispositionEnd( void) ;
bool OnTableData( const std::string& sName, const Point3d& ptOri1) ; 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, bool OnFixtureData( int nFixId, int nFixInd, const std::string& sName,
const Point3d& ptPos, double dAngDeg, double dMov, const std::string& sTaLink) ; const Point3d& ptPos, double dAngDeg, double dMov) ;
bool OnRawMoveData( int nRawId, int nRawMoveInd, int nType, const Point3d& ptPos, int nFlag) ; bool OnRawMoveData( int nRawId, int RawMoveInd, int nType, const Point3d& ptPos, int nFlag) ;
bool OnMachiningStart( int nOpId, int nOpInd, double dSpeed, const Point3d& ptMin, const Point3d& ptMax, bool OnMachiningStart( int nOpId, int nOpInd, double dSpeed, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ; const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ;
bool OnMachiningEnd( void) ; bool OnMachiningEnd( void) ;
bool OnPathStart( int nClPathId, int nClPathInd, int nDblPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd, bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax, const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ; const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev) ;
bool OnPathEnd( int nAE) ; bool OnPathEnd( int nAE) ;
bool OnPathStartAux( int nInd, const std::string& sAS) ; bool OnPathStartAux( int nInd, const std::string& sAS) ;
bool OnPathEndAux( int nInd, const std::string& sAE) ; bool OnPathEndAux( int nInd, const std::string& sAE) ;
bool OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, int nAxesMask, bool OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
int nFlag, int nFlag2, int nIndex, int nMoveNext, const DBLVECTOR& AxesNext) ; int nFlag, int nFlag2, int nIndex) ;
bool OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, bool OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex, int nCorr, int nMoveNext, const DBLVECTOR& AxesNext) ; double dFeed, int nFlag, int nFlag2, int nIndex) ;
bool OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, bool OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen, const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex, int nCorr, int nMoveNext, const DBLVECTOR& AxesNext) ; double dFeed, int nFlag, int nFlag2, int nIndex) ;
bool ResetArcData( void) ; bool ResetArcData( void) ;
protected : protected :
@@ -81,7 +80,6 @@ class Processor
virtual bool CallOnDispositionStart( void) = 0 ; virtual bool CallOnDispositionStart( void) = 0 ;
virtual bool CallOnDispositionEnd( void) = 0 ; virtual bool CallOnDispositionEnd( void) = 0 ;
virtual bool CallOnTableData( void) = 0 ; virtual bool CallOnTableData( void) = 0 ;
virtual bool CallOnTableAxisData( void) = 0 ;
virtual bool CallOnFixtureData( void) = 0 ; virtual bool CallOnFixtureData( void) = 0 ;
virtual bool CallOnRawMoveData( void) = 0 ; virtual bool CallOnRawMoveData( void) = 0 ;
virtual bool CallOnToolSelect( void) = 0 ; virtual bool CallOnToolSelect( void) = 0 ;
+65 -96
View File
@@ -4,7 +4,7 @@
// File : SawFinishing.cpp Data : 23.04.19 Versione : 2.1d3 // File : SawFinishing.cpp Data : 23.04.19 Versione : 2.1d3
// Contenuto : Implementazione gestione finitura superficie con lama. // Contenuto : Implementazione gestione finitura superficie con lama.
// //
// Note : Questa lavorazione è sempre espressa nel riferimento globale. // Note : Questa lavorazione è sempre espressa nel riferimento globale.
// //
// Modifiche : 05.04.16 DS Creazione modulo. // Modifiche : 05.04.16 DS Creazione modulo.
// 23.04.19 DS Aggiunte cornici curve. // 23.04.19 DS Aggiunte cornici curve.
@@ -51,7 +51,6 @@ using namespace std ;
// 2713 = "Error in SawFinishing : link movements not calculable" // 2713 = "Error in SawFinishing : link movements not calculable"
// 2714 = "Error in SawFinishing : link outstroke xx" // 2714 = "Error in SawFinishing : link outstroke xx"
// 2715 = "Error in SawFinishing : post apply not calculable" // 2715 = "Error in SawFinishing : post apply not calculable"
// 2716 = "Error in SawFinishing : special apply not calculable"
// 2751 = "Warning in SawFinishing : Skipped entity (xx)" // 2751 = "Warning in SawFinishing : Skipped entity (xx)"
// 2752 = "Warning in SawFinishing : No machinable path" // 2752 = "Warning in SawFinishing : No machinable path"
// 2753 = "Warning in SawFinishing : Tool name changed (xx)" // 2753 = "Warning in SawFinishing : Tool name changed (xx)"
@@ -447,15 +446,14 @@ SawFinishing::SetParam( int nType, const string& sVal)
bool bool
SawFinishing::SetGeometry( const SELVECTOR& vIds) SawFinishing::SetGeometry( const SELVECTOR& vIds)
{ {
// verifico validità gestore DB geometrico // verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// copia temporanea e reset della geometria corrente // reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ; m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili // verifico che gli identificativi rappresentino delle entità ammissibili
for ( const auto& Id : vIds) { for ( const auto& Id : vIds) {
// test sull'entità // test sull'entità
int nSubs ; int nSubs ;
if ( ! VerifyGeometry( Id, nSubs)) { if ( ! VerifyGeometry( Id, nSubs)) {
string sInfo = "Warning in SawFinishing : Skipped entity " + ToString( Id) ; string sInfo = "Warning in SawFinishing : Skipped entity " + ToString( Id) ;
@@ -466,8 +464,7 @@ SawFinishing::SetGeometry( const SELVECTOR& vIds)
m_vId.emplace_back( Id) ; m_vId.emplace_back( Id) ;
} }
// aggiorno lo stato // aggiorno lo stato
if ( m_vId != vOldId) m_nStatus |= MCH_ST_GEO_MODIF ;
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare // restituisco presenza geometria da lavorare
return ( ! m_vId.empty()) ; return ( ! m_vId.empty()) ;
} }
@@ -488,30 +485,26 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
int nCurrCuts = m_nCuts ; int nCurrCuts = m_nCuts ;
m_nCuts = 0 ; m_nCuts = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo // verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId)) if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ; return false ;
// aggiorno dati geometrici dell'utensile // aggiorno dati geometrici dell'utensile
if ( ! UpdateToolData()) { bool bToolChanged = true ;
if ( ! UpdateToolData( &bToolChanged)) {
m_pMchMgr->SetLastError( 2701, "Error in SawFinishing : UpdateToolData failed") ; m_pMchMgr->SetLastError( 2701, "Error in SawFinishing : UpdateToolData failed") ;
return false ; return false ;
} }
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento // verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) { if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione // confermo i percorsi di lavorazione
m_nCuts = nCurrCuts ; m_nCuts = nCurrCuts ;
string sLog = string( "SawFinishing apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ; LOG_DBG_INFO( GetEMkLogger(), "SawFinishing apply skipped : status already ok") ;
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente // eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply)) if ( ! Update( bPostApply))
return false ; return false ;
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ; LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo // esco con successo
return true ; return true ;
@@ -520,7 +513,7 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per geometria ausiliaria // recupero gruppo per geometria ausiliaria
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ; int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
if ( nAuxId == GDB_ID_NULL) { if ( nAuxId == GDB_ID_NULL) {
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ; nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxId == GDB_ID_NULL) if ( nAuxId == GDB_ID_NULL)
@@ -542,7 +535,7 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per geometria di lavorazione (Cutter Location) // recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ; int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
if ( nClId == GDB_ID_NULL) { if ( nClId == GDB_ID_NULL) {
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ; nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nClId == GDB_ID_NULL) if ( nClId == GDB_ID_NULL)
@@ -604,7 +597,7 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
bool bool
SawFinishing::Update( bool bPostApply) SawFinishing::Update( bool bPostApply)
{ {
// verifico validità gestore DB geometrico e Id del gruppo // verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId)) if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ; return false ;
@@ -614,7 +607,7 @@ SawFinishing::Update( bool bPostApply)
return true ; return true ;
} }
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo) // elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ; RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione // imposto eventuale asse bloccato da lavorazione
@@ -633,19 +626,6 @@ SawFinishing::Update( bool bPostApply)
return false ; return false ;
} }
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni speciali
string sSpecErr ;
if ( bPostApply && ! SpecialApply( sSpecErr)) {
if ( ! IsEmptyOrSpaces( sSpecErr))
m_pMchMgr->SetLastError( 2716, sSpecErr) ;
else
m_pMchMgr->SetLastError( 2716, "Error in SawFinishing : special apply not calculable") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione // gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) { if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ; string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
@@ -656,11 +636,14 @@ SawFinishing::Update( bool bPostApply)
return false ; return false ;
} }
// esecuzione eventuali personalizzazioni finali // assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
string sPostErr ; CalcAndSetAxesBBox() ;
if ( bPostApply && ! PostApply( sPostErr)) {
if ( ! IsEmptyOrSpaces( sPostErr)) // esecuzione eventuali personalizzazioni
m_pMchMgr->SetLastError( 2715, sPostErr) ; string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2715, sErr) ;
else else
m_pMchMgr->SetLastError( 2715, "Error in SawFinishing : post apply not calculable") ; m_pMchMgr->SetLastError( 2715, "Error in SawFinishing : post apply not calculable") ;
return false ; return false ;
@@ -805,20 +788,16 @@ SawFinishing::GetToolData( void) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
SawFinishing::UpdateToolData( void) SawFinishing::UpdateToolData( bool* pbChanged)
{ {
// recupero il gestore DB utensili della macchina corrente // recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ; ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr) if ( pTMgr == nullptr)
return false ; return false ;
// recupero l'utensile nel DB utensili (se fallisce con UUID provo con il nome) // recupero l'utensile nel DB utensili
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) { if ( pTdata == nullptr)
pTdata = pTMgr->GetTool( m_Params.m_sToolName) ; return false ;
if ( pTdata == nullptr)
return false ;
m_Params.m_ToolUuid = m_TParams.m_Uuid ;
}
// salvo posizione TC, testa e uscita originali // salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ; string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ; string sOrigHead = m_TParams.m_sHead ;
@@ -856,9 +835,9 @@ SawFinishing::UpdateToolData( void)
m_Params.m_sToolName + ")" ; m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 2754, sInfo) ; m_pMchMgr->SetWarning( 2754, sInfo) ;
} }
// se modificato, aggiusto lo stato // se definito parametro di ritorno, lo assegno
if ( bChanged) if ( pbChanged != nullptr)
m_nStatus = MCH_ST_TO_VERIFY ; *pbChanged = bChanged ;
return true ; return true ;
} }
@@ -866,7 +845,7 @@ SawFinishing::UpdateToolData( void)
bool bool
SawFinishing::GetGeometry( SELVECTOR& vIds) const SawFinishing::GetGeometry( SELVECTOR& vIds) const
{ {
// restituisco l'elenco delle entità // restituisco l'elenco delle entità
vIds = m_vId ; vIds = m_vId ;
return true ; return true ;
} }
@@ -961,7 +940,7 @@ SawFinishing::GetCurve( SelData Id)
bool bool
SawFinishing::AdjustGeometry( int nAuxId) SawFinishing::AdjustGeometry( int nAuxId)
{ {
// sgrossatura di cornici diritte : due o più curve (sezioni e guida rettilinea) // sgrossatura di cornici diritte : due o più curve (sezioni e guida rettilinea)
// sgrossatura di cornici curve : due curve (sezione e guida curva) // sgrossatura di cornici curve : due curve (sezione e guida curva)
size_t nCrvCount = m_vId.size() ; size_t nCrvCount = m_vId.size() ;
if ( nCrvCount >= 2) { if ( nCrvCount >= 2) {
@@ -985,7 +964,7 @@ SawFinishing::AdjustGeometry( int nAuxId)
return false ; return false ;
} }
} }
// l'ultima curva è la guida // l'ultima curva è la guida
PtrOwner<ICurve> pGuide( GetCurve( m_vId[nCrvCount-1])) ; PtrOwner<ICurve> pGuide( GetCurve( m_vId[nCrvCount-1])) ;
if ( IsNull( pGuide)) if ( IsNull( pGuide))
return false ; return false ;
@@ -1124,9 +1103,6 @@ SawFinishing::CalculateStraightAlongToolPath( int nAuxId, int nClId)
SetToolDir( vtTool) ; SetToolDir( vtTool) ;
SetCorrAuxDir( vtCorr) ; SetCorrAuxDir( vtCorr) ;
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
// Classifico i tratti a seconda della pendenza (salita, discesa, verticale, orizzontale) // Classifico i tratti a seconda della pendenza (salita, discesa, verticale, orizzontale)
INTVECTOR vnClass ; INTVECTOR vnClass ;
ClassifySection( pCrv, vnClass) ; ClassifySection( pCrv, vnClass) ;
@@ -1202,7 +1178,7 @@ SawFinishing::CalculateStraightAlongToolPath( int nAuxId, int nClId)
} }
} }
} }
// se c'è qualcosa in sospeso // se c'è qualcosa in sospeso
if ( nStatus != CCL_VERT) { if ( nStatus != CCL_VERT) {
bSkipMax = false ; bSkipMax = false ;
bool bInvert = ( nStatus == CCL_RISE) ; bool bInvert = ( nStatus == CCL_RISE) ;
@@ -1323,9 +1299,6 @@ SawFinishing::CalculateStraightAcrossToolPath( int nAuxId, int nClId)
SetToolDir( vtTool) ; SetToolDir( vtTool) ;
SetCorrAuxDir( vtCorr) ; SetCorrAuxDir( vtCorr) ;
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
// Inizializzo contatore tagli // Inizializzo contatore tagli
m_nCuts = 0 ; m_nCuts = 0 ;
@@ -1352,7 +1325,7 @@ SawFinishing::CalculateStraightAcrossToolPath( int nAuxId, int nClId)
// se ZigZag aggiungo risalita // se ZigZag aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG) { if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG) {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
// aggiungo retrazione // aggiungo retrazione
@@ -1398,7 +1371,7 @@ SawFinishing::CalculateCurvedAlongToolPath( int nAuxId, int nClId)
// recupero il suo riferimento // recupero il suo riferimento
Frame3d frGdL ; Frame3d frGdL ;
m_pGeomDB->GetGlobFrame( nGuideId, frGdL) ; m_pGeomDB->GetGlobFrame( nGuideId, frGdL) ;
// porto la curva in globale (dovrebbe già avere riferimento globale) // porto la curva in globale (dovrebbe già avere riferimento globale)
pGuide->ToGlob( frGdL) ; pGuide->ToGlob( frGdL) ;
// recupero il box globale della linea guida // recupero il box globale della linea guida
BBox3d b3Guide ; BBox3d b3Guide ;
@@ -1437,9 +1410,6 @@ SawFinishing::CalculateCurvedAlongToolPath( int nAuxId, int nClId)
SetPathId( nPxId) ; SetPathId( nPxId) ;
SetToolDir( vtTool) ; SetToolDir( vtTool) ;
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
// Classifico i tratti a seconda della pendenza (salita, discesa, verticale, orizzontale) // Classifico i tratti a seconda della pendenza (salita, discesa, verticale, orizzontale)
INTVECTOR vnClass ; INTVECTOR vnClass ;
ClassifySection( pCrv, vnClass) ; ClassifySection( pCrv, vnClass) ;
@@ -1516,7 +1486,7 @@ SawFinishing::CalculateCurvedAlongToolPath( int nAuxId, int nClId)
} }
} }
} }
// se c'è qualcosa in sospeso // se c'è qualcosa in sospeso
if ( nStatus != CCL_VERT) { if ( nStatus != CCL_VERT) {
bSkipMax = false ; bSkipMax = false ;
bool bInvert = ( nStatus == CCL_RISE) ; bool bInvert = ( nStatus == CCL_RISE) ;
@@ -1560,7 +1530,7 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
// recupero il suo riferimento // recupero il suo riferimento
Frame3d frGdL ; Frame3d frGdL ;
m_pGeomDB->GetGlobFrame( nGuideId, frGdL) ; m_pGeomDB->GetGlobFrame( nGuideId, frGdL) ;
// porto la curva in globale (dovrebbe già avere riferimento globale) // porto la curva in globale (dovrebbe già avere riferimento globale)
pGuide->ToGlob( frGdL) ; pGuide->ToGlob( frGdL) ;
// recupero il box globale della linea guida // recupero il box globale della linea guida
BBox3d b3Guide ; BBox3d b3Guide ;
@@ -1636,9 +1606,6 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
SetPathId( nPxId) ; SetPathId( nPxId) ;
SetToolDir( vtTool) ; SetToolDir( vtTool) ;
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
// Inizializzo contatore tagli // Inizializzo contatore tagli
m_nCuts = 0 ; m_nCuts = 0 ;
@@ -1666,7 +1633,7 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
vtCorr.Rotate( Z_AX, dAngRotDeg - 90) ; vtCorr.Rotate( Z_AX, dAngRotDeg - 90) ;
// flag di inizio // flag di inizio
bool bFirst = ( dLen < EPS_SMALL) ; bool bFirst = ( dLen < EPS_SMALL) ;
// se non è inizio // se non è inizio
bool bCorner = false ; bool bCorner = false ;
Vector3d vtPrev ; Vector3d vtPrev ;
if ( ! bFirst) { if ( ! bFirst) {
@@ -1679,7 +1646,7 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
double dEndElev = 0 ; double dEndElev = 0 ;
GetElevation( m_nPhase, ptPrev, vtPrev, dEndElev) ; GetElevation( m_nPhase, ptPrev, vtPrev, dEndElev) ;
// aggiungo retrazione // aggiungo retrazione
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
if ( ! AddRetract( ptPrev, vtPrev, dSafeZ, dEndElev, dAppr)) if ( ! AddRetract( ptPrev, vtPrev, dSafeZ, dEndElev, dAppr))
return false ; return false ;
@@ -1703,7 +1670,7 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
// se ZigZag aggiungo risalita // se ZigZag aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG) { if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG) {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
// recupero punto e versore correzione finali // recupero punto e versore correzione finali
@@ -1807,7 +1774,7 @@ SawFinishing::CalculateSection( int nSectGrpId, ICurve*& pSect)
bool bool
SawFinishing::TrimSection( ICurve* pCrv) SawFinishing::TrimSection( ICurve* pCrv)
{ {
// se parametri di accorciamento iniziale e finale sono nulli, non faccio alcunché // se parametri di accorciamento iniziale e finale sono nulli, non faccio alcunché
if ( m_Params.m_dStartAddLen > - EPS_SMALL && m_Params.m_dEndAddLen > -EPS_SMALL) if ( m_Params.m_dStartAddLen > - EPS_SMALL && m_Params.m_dEndAddLen > -EPS_SMALL)
return true ; return true ;
@@ -1860,7 +1827,7 @@ SawFinishing::CalculateGuideLine( int nGuideId, const BBox3d& b3Sect,
// recupero il suo riferimento // recupero il suo riferimento
Frame3d frGdL ; Frame3d frGdL ;
m_pGeomDB->GetGlobFrame( nGuideId, frGdL) ; m_pGeomDB->GetGlobFrame( nGuideId, frGdL) ;
// porto la curva in globale (dovrebbe già avere riferimento globale) // porto la curva in globale (dovrebbe già avere riferimento globale)
pGuide->ToGlob( frGdL) ; pGuide->ToGlob( frGdL) ;
// recupero gli estremi della linea guida // recupero gli estremi della linea guida
pGuide->GetStartPoint( ptGdStart) ; pGuide->GetStartPoint( ptGdStart) ;
@@ -1913,6 +1880,7 @@ SawFinishing::ClassifySection( ICurve* pCrv, INTVECTOR& vnClass)
{ {
const ICurveComposite* pCompo = GetCurveComposite( pCrv) ; const ICurveComposite* pCompo = GetCurveComposite( pCrv) ;
if ( pCompo != nullptr) { if ( pCompo != nullptr) {
int Ind = 0 ;
const ICurve* pSimpCrv = pCompo->GetFirstCurve() ; const ICurve* pSimpCrv = pCompo->GetFirstCurve() ;
while ( pSimpCrv != nullptr) { while ( pSimpCrv != nullptr) {
// analizzo la curva // analizzo la curva
@@ -1930,6 +1898,7 @@ SawFinishing::ClassifySection( ICurve* pCrv, INTVECTOR& vnClass)
else else
vnClass.push_back( CCL_FALL) ; vnClass.push_back( CCL_FALL) ;
// passo alla curva successiva // passo alla curva successiva
++ Ind ;
pSimpCrv = pCompo->GetNextCurve() ; pSimpCrv = pCompo->GetNextCurve() ;
} }
} }
@@ -2022,7 +1991,7 @@ SawFinishing::CalcAlongVerticalCuts( ICurve* pSect, int nUmin, int nUmax, const
// se ZigZag e non centrato aggiungo risalita // se ZigZag e non centrato aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) { if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
// aggiungo retrazione // aggiungo retrazione
@@ -2109,7 +2078,7 @@ SawFinishing::CalcAlongStdCuts( ICurve* pSect, double dUmin, double dUmax,
// se ZigZag e non centrato aggiungo risalita // se ZigZag e non centrato aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) { if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
// aggiungo retrazione // aggiungo retrazione
@@ -2127,7 +2096,7 @@ SawFinishing::CalcAlongOneWayCut( const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bVert) const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bVert)
{ {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
@@ -2176,7 +2145,7 @@ SawFinishing::CalcAlongZigZagCut( const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bVert, bool bFirst) const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bVert, bool bFirst)
{ {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
@@ -2243,14 +2212,14 @@ SawFinishing::CalcAlongZigZagCut( const Point3d& ptStart, const Point3d& ptEnd,
if ( AddLinearMove( ptNewStart) == GDB_ID_NULL) if ( AddLinearMove( ptNewStart) == GDB_ID_NULL)
return false ; return false ;
} }
// se il precedente è più fuori // se il precedente è più fuori
else if ( dDiff > 0) { else if ( dDiff > 0) {
// allungo nuova passata // allungo nuova passata
SetFeed( ( bVert ? GetVertFeed() : GetFeed())) ; SetFeed( ( bVert ? GetVertFeed() : GetFeed())) ;
if ( AddLinearMove( ptNewStart - dDiff * vtNewDir) == GDB_ID_NULL) if ( AddLinearMove( ptNewStart - dDiff * vtNewDir) == GDB_ID_NULL)
return false ; return false ;
} }
// se il corrente è più fuori // se il corrente è più fuori
else { else {
// allungo passata precedente // allungo passata precedente
if ( AddLinearMove( ptLast + dDiff * vtNewDir) == GDB_ID_NULL) if ( AddLinearMove( ptLast + dDiff * vtNewDir) == GDB_ID_NULL)
@@ -2293,7 +2262,7 @@ SawFinishing::CalcAcrossOneWayCut( const PolyLine& PL, const Vector3d& vtMove,
const Vector3d& vtTool, const Vector3d& vtCorr, double dRawZ, double dDepth) const Vector3d& vtTool, const Vector3d& vtCorr, double dRawZ, double dDepth)
{ {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
@@ -2350,7 +2319,7 @@ SawFinishing::CalcAcrossZigZagCut( const PolyLine& PL, const Vector3d& vtMove,
const Vector3d& vtTool, const Vector3d& vtCorr, double dRawZ, double dDepth, bool bFirst) const Vector3d& vtTool, const Vector3d& vtCorr, double dRawZ, double dDepth, bool bFirst)
{ {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
@@ -2458,7 +2427,7 @@ SawFinishing::CalcCurvedAlongVerticalCuts( ICurve* pSect, int nUmin, int nUmax,
// se ZigZag e non centrato aggiungo risalita // se ZigZag e non centrato aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) { if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
// aggiungo retrazione // aggiungo retrazione
@@ -2533,7 +2502,7 @@ SawFinishing::CalcCurvedAlongStdCuts( ICurve* pSect, double dUmin, double dUmax,
// se ZigZag e non centrato aggiungo risalita // se ZigZag e non centrato aggiungo risalita
if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) { if ( m_Params.m_nStepType == SAWFIN_ST_ZIGZAG && m_Params.m_nLeadLinkType != SAWFIN_LL_CENT) {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
// aggiungo retrazione // aggiungo retrazione
@@ -2551,7 +2520,7 @@ bool
SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTool, bool bVert, bool bFirst, double& dEndElev) SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTool, bool bVert, bool bFirst, double& dEndElev)
{ {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
// verifico se passata da invertire (indice dispari) // verifico se passata da invertire (indice dispari)
@@ -2619,7 +2588,7 @@ SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTo
GetCurrPos( ptCurr) ; GetCurrPos( ptCurr) ;
// differenza tra corrente e nuovo lungo direzione ortogonale // differenza tra corrente e nuovo lungo direzione ortogonale
double dOrtStartDiff = ( ptNewStart - ptCurr) * vtOrtStart ; double dOrtStartDiff = ( ptNewStart - ptCurr) * vtOrtStart ;
// se punto corrente più fuori, aggiungo punto fuori allo stesso modo sul nuovo // se punto corrente più fuori, aggiungo punto fuori allo stesso modo sul nuovo
if ( dOrtStartDiff < - 10 * EPS_SMALL) { if ( dOrtStartDiff < - 10 * EPS_SMALL) {
Point3d ptOut = ptNewStart + ( - dOrtStartDiff * vtOrtStart) ; Point3d ptOut = ptNewStart + ( - dOrtStartDiff * vtOrtStart) ;
SetFlag( 0) ; SetFlag( 0) ;
@@ -2627,7 +2596,7 @@ SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTo
if ( ! SameAsCurrPos( ptOut) && AddLinearMove( ptOut) == GDB_ID_NULL) if ( ! SameAsCurrPos( ptOut) && AddLinearMove( ptOut) == GDB_ID_NULL)
return false ; return false ;
} }
// se altrimenti più dentro, aggiungo punto fuori allo stesso modo sul corrente // se altrimenti più dentro, aggiungo punto fuori allo stesso modo sul corrente
else if ( dOrtStartDiff > 10 * EPS_SMALL) { else if ( dOrtStartDiff > 10 * EPS_SMALL) {
Point3d ptOut = ptCurr + ( dOrtStartDiff * vtOrtStart) ; Point3d ptOut = ptCurr + ( dOrtStartDiff * vtOrtStart) ;
SetFlag( 0) ; SetFlag( 0) ;
@@ -2662,14 +2631,14 @@ SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTo
if ( AddLinearMove( ptNewStart) == GDB_ID_NULL) if ( AddLinearMove( ptNewStart) == GDB_ID_NULL)
return false ; return false ;
} }
// se il precedente è più fuori // se il precedente è più fuori
else if ( dDiff > 0) { else if ( dDiff > 0) {
// allungo nuova passata // allungo nuova passata
SetFeed( ( bVert ? GetVertFeed() : GetFeed())) ; SetFeed( ( bVert ? GetVertFeed() : GetFeed())) ;
if ( AddLinearMove( ptNewStart - dDiff * vtDirStart) == GDB_ID_NULL) if ( AddLinearMove( ptNewStart - dDiff * vtDirStart) == GDB_ID_NULL)
return false ; return false ;
} }
// se il corrente è più fuori // se il corrente è più fuori
else { else {
// allungo passata precedente // allungo passata precedente
if ( AddLinearMove( ptLast + dDiff * vtDirStart) == GDB_ID_NULL) if ( AddLinearMove( ptLast + dDiff * vtDirStart) == GDB_ID_NULL)
@@ -2681,7 +2650,7 @@ SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTo
} }
} }
} }
// se non ci sono già, vado all'inizio dell'arco // se non ci sono già, vado all'inizio dell'arco
if ( ! SameAsCurrPos( ptStart) && AddLinearMove( ptStart) == GDB_ID_NULL) if ( ! SameAsCurrPos( ptStart) && AddLinearMove( ptStart) == GDB_ID_NULL)
return false ; return false ;
// 3 -> movimento di lato al punto finale // 3 -> movimento di lato al punto finale
@@ -2727,7 +2696,7 @@ SawFinishing::CalcCurvedAcrossZigZagCut( const PolyLine& PL, const Vector3d& vtM
bool bFirst, bool bCorner) bool bFirst, bool bCorner)
{ {
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
@@ -2843,7 +2812,7 @@ SawFinishing::AddCornerApproach( const Point3d& ptP, const Vector3d& vtCorr, con
{ {
// impongo minima distanza di approccio // impongo minima distanza di approccio
dAppr = max( dAppr, 1.0) ; dAppr = max( dAppr, 1.0) ;
// recupero posizione precedente (correzione precedente è passata perchè già impostata la nuova) // recupero posizione precedente (correzione precedente è passata perchè già impostata la nuova)
Point3d ptPrev ; Point3d ptPrev ;
if ( ! GetCurrPos( ptPrev)) if ( ! GetCurrPos( ptPrev))
return false ; return false ;
@@ -2954,7 +2923,7 @@ SawFinishing::GetHeightOnSection( const ICurve* pSect, double dX, double dYmin,
dY = aInfo.IciA[0].ptI.y ; dY = aInfo.IciA[0].ptI.y ;
return true ; return true ;
} }
// se non c'è intersezione assegno il minimo // se non c'è intersezione assegno il minimo
dY = dYmin ; dY = dYmin ;
return true ; return true ;
} }
+3 -9
View File
@@ -38,14 +38,8 @@ class SawFinishing : public Machining
public : // Operation public : // Operation
int GetType( void) const override int GetType( void) const override
{ return OPER_SAWFINISHING ; } { return OPER_SAWFINISHING ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override bool IsEmpty( void) const override
{ if ( m_nCuts == 0) { return ( m_nCuts == 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 bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; } { m_nStatus |= nModif ; return true ; }
@@ -68,7 +62,7 @@ class SawFinishing : public Machining
bool GetParam( int nType, int& nVal) const override ; bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ; bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ; bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( void) override ; bool UpdateToolData( bool* pbChanged = nullptr) override ;
const ToolData& GetToolData( void) const override ; const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ; bool GetGeometry( SELVECTOR& vIds) const override ;
+220 -911
View File
File diff suppressed because it is too large Load Diff
+9 -20
View File
@@ -38,14 +38,8 @@ class SawRoughing : public Machining
public : // Operation public : // Operation
int GetType( void) const override int GetType( void) const override
{ return OPER_SAWROUGHING ; } { return OPER_SAWROUGHING ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override bool IsEmpty( void) const override
{ if ( m_nCuts == 0) { return ( m_nCuts == 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 bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; } { m_nStatus |= nModif ; return true ; }
@@ -68,7 +62,7 @@ class SawRoughing : public Machining
bool GetParam( int nType, int& nVal) const override ; bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ; bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ; bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( void) override ; bool UpdateToolData( bool* pbChanged = nullptr) override ;
const ToolData& GetToolData( void) const override ; const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ; bool GetGeometry( SELVECTOR& vIds) const override ;
@@ -79,22 +73,17 @@ class SawRoughing : public Machining
bool VerifyGeometry( SelData Id, int& nSubs) ; bool VerifyGeometry( SelData Id, int& nSubs) ;
ICurve* GetCurve( SelData Id) ; ICurve* GetCurve( SelData Id) ;
bool AdjustGeometry( int nAuxId) ; bool AdjustGeometry( int nAuxId) ;
bool CalculateToolPath( int nAuxId, int nPvId, int nClId) ; bool CalculateToolPath( int nAuxId, int nClId) ;
bool CalculateCurvedToolPath( int nAuxId, int nClId) ; bool CalculateCurvedToolPath( int nAuxId, int nClId) ;
bool GeneratePreView( int nPathId, const ICurve* pSect, const Frame3d& frSect, double dGuideLen,
const Vector3d& vtGdDir, const BBox3d& b3Raw) ;
bool CalculateSection( int nSectGrpId, ICurve*& pSect) ; bool CalculateSection( int nSectGrpId, ICurve*& pSect) ;
bool TrimSection( ICurve* pCrv) ; bool TrimSection( ICurve* pCrv) ;
bool CalculateGuideLine( int nGuideId, const BBox3d& b3Sect, Point3d& ptGdStart, Point3d& ptGdEnd, Vector3d& vtGdDir) ; bool CalculateGuideLine( int nGuideId, const BBox3d& b3Sect,
bool AdaptGuideLineToRaw( Point3d& ptGdStart, Point3d& ptGdEnd, const Vector3d& vtGdDir, const BBox3d& b3Raw) const ; Point3d& ptGdStart, Point3d& ptGdEnd, Vector3d& vtGdDir) ;
bool CalculateOneWayCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir, bool CalculateOneWayCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir,
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast, const BBox3d& b3Raw) ; const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast) ;
bool CalculateZigZagCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir, bool CalculateZigZagCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir,
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast, const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast,
int& nCount, const BBox3d& b3Raw) ; int& nCount) ;
bool CalculateZConstCut( const ICurve* pCrv, double dXmin, double dXmax, bool bIncludeMax, bool bIncludeMin,
const Point3d& ptGdStart, const Point3d& ptGdEnd, const Vector3d& vtGdDir, const Frame3d& frSect,
const BBox3d& b3Raw, double dDepth, bool bFirstInterval, bool bLastInterval, int& nCount) ;
bool CalculateCurvedZigZagCut( const ICurve* pCut, const Vector3d& vtTool, double dElev, bool bFirst, bool bLast, bool CalculateCurvedZigZagCut( const ICurve* pCut, const Vector3d& vtTool, double dElev, bool bFirst, bool bLast,
int& nCount) ; int& nCount) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtCorr, bool bFirst, bool AddApproach( const Point3d& ptP, const Vector3d& vtCorr, bool bFirst,
@@ -123,7 +112,7 @@ class SawRoughing : public Machining
{ return ( IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; } { return ( IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; }
private : private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
bool m_bStraight ; // flag per cornici diritte/curve bool m_bStraight ; // flag per cornici diritte/curve
SawRoughingData m_Params ; // parametri lavorazione SawRoughingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile ToolData m_TParams ; // parametri utensile
+74 -209
View File
@@ -16,9 +16,7 @@
#include "MachMgr.h" #include "MachMgr.h"
#include "DllMain.h" #include "DllMain.h"
#include "Sawing.h" #include "Sawing.h"
#include "GeoConst.h"
#include "OperationConst.h" #include "OperationConst.h"
#include "OperUserNotesConst.h"
#include "/EgtDev/Include/EXeCmdLogOff.h" #include "/EgtDev/Include/EXeCmdLogOff.h"
#include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkCurveLine.h" #include "/EgtDev/Include/EGkCurveLine.h"
@@ -57,7 +55,6 @@ using namespace std ;
// 2217 = "Error in Sawing : link movements not calculable" // 2217 = "Error in Sawing : link movements not calculable"
// 2218 = "Error in Sawing : link outstroke xxx" // 2218 = "Error in Sawing : link outstroke xxx"
// 2219 = "Error in Sawing : post apply not calculable" // 2219 = "Error in Sawing : post apply not calculable"
// 2220 = "Error in Sawing : special apply not calculable"
// 2251 = "Warning in Sawing : Skipped entity xxx" // 2251 = "Warning in Sawing : Skipped entity xxx"
// 2252 = "Warning in Sawing : No machinable path" // 2252 = "Warning in Sawing : No machinable path"
// 2253 = "Warning in Sawing : Tool name changed (xx)" // 2253 = "Warning in Sawing : Tool name changed (xx)"
@@ -101,7 +98,6 @@ Sawing::Clone( void) const
pSaw->m_nPhase = m_nPhase ; pSaw->m_nPhase = m_nPhase ;
pSaw->m_Params = m_Params ; pSaw->m_Params = m_Params ;
pSaw->m_TParams = m_TParams ; pSaw->m_TParams = m_TParams ;
pSaw->m_bDownSE = m_bDownSE ;
pSaw->m_nStatus = m_nStatus ; pSaw->m_nStatus = m_nStatus ;
pSaw->m_nCuts = m_nCuts ; pSaw->m_nCuts = m_nCuts ;
} }
@@ -215,7 +211,6 @@ Sawing::Sawing( void)
m_Params.m_sToolName = "*" ; m_Params.m_sToolName = "*" ;
m_TParams.m_sName = "*" ; m_TParams.m_sName = "*" ;
m_TParams.m_sHead = "*" ; m_TParams.m_sHead = "*" ;
m_bDownSE = false ;
m_nStatus = MCH_ST_TO_VERIFY ; m_nStatus = MCH_ST_TO_VERIFY ;
m_nCuts = 0 ; m_nCuts = 0 ;
} }
@@ -540,8 +535,7 @@ Sawing::SetGeometry( const SELVECTOR& vIds)
// verifico validità gestore DB geometrico // verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
// copia temporanea e reset della geometria corrente // reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ; m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili // verifico che gli identificativi rappresentino delle entità ammissibili
int nType = GEO_NONE ; int nType = GEO_NONE ;
@@ -557,8 +551,7 @@ Sawing::SetGeometry( const SELVECTOR& vIds)
m_vId.emplace_back( Id) ; m_vId.emplace_back( Id) ;
} }
// aggiorno lo stato // aggiorno lo stato
if ( m_vId != vOldId) m_nStatus |= MCH_ST_GEO_MODIF ;
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare // restituisco presenza geometria da lavorare
return ( ! m_vId.empty() || vIds.empty()) ; return ( ! m_vId.empty() || vIds.empty()) ;
} }
@@ -645,25 +638,21 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
return false ; return false ;
// aggiorno dati geometrici dell'utensile // aggiorno dati geometrici dell'utensile
if ( ! UpdateToolData()) { bool bToolChanged = true ;
if ( ! UpdateToolData( &bToolChanged)) {
m_pMchMgr->SetLastError( 2201, "Error in Sawing : UpdateToolData failed") ; m_pMchMgr->SetLastError( 2201, "Error in Sawing : UpdateToolData failed") ;
return false ; return false ;
} }
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento // verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) { if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione // confermo i percorsi di lavorazione
m_nCuts = nCurrCuts ; m_nCuts = nCurrCuts ;
string sLog = string( "Sawing apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ; LOG_DBG_INFO( GetEMkLogger(), "Sawing apply skipped : status already ok") ;
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente // eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply)) if ( ! Update( bPostApply))
return false ; return false ;
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ; LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo // esco con successo
return true ; return true ;
@@ -698,11 +687,6 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
if ( ! VerifySideAngle()) if ( ! VerifySideAngle())
return false ; return false ;
// verifiche per attacchi/uscite senza approcci e retrazioni
int nDownSE = 0 ;
GetValInNotes( m_Params.m_sUserNotes, UN_DOWNSE, nDownSE) ;
m_bDownSE = ( nDownSE != 0 && m_Params.m_nStepType == SAW_ST_TOANDFROM) ;
// recupero gruppo per geometria di lavorazione (Cutter Location) // recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ; int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo // se non c'è, lo aggiungo
@@ -783,16 +767,6 @@ Sawing::Update( bool bPostApply)
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso // assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ; CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni speciali
string sSpecErr ;
if ( bPostApply && ! SpecialApply( sSpecErr)) {
if ( ! IsEmptyOrSpaces( sSpecErr))
m_pMchMgr->SetLastError( 2220, sSpecErr) ;
else
m_pMchMgr->SetLastError( 2220, "Error in Sawing : special apply not calculable") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione // gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) { if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ; string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
@@ -803,11 +777,11 @@ Sawing::Update( bool bPostApply)
return false ; return false ;
} }
// esecuzione eventuali personalizzazioni finali // esecuzione eventuali personalizzazioni
string sPostErr ; string sErr ;
if ( bPostApply && ! PostApply( sPostErr)) { if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sPostErr)) if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2219, sPostErr) ; m_pMchMgr->SetLastError( 2219, sErr) ;
else else
m_pMchMgr->SetLastError( 2219, "Error in Sawing : post apply not calculable") ; m_pMchMgr->SetLastError( 2219, "Error in Sawing : post apply not calculable") ;
return false ; return false ;
@@ -1044,7 +1018,7 @@ Sawing::GetToolData( void) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Sawing::UpdateToolData( void) Sawing::UpdateToolData( bool* pbChanged)
{ {
// recupero il gestore DB utensili della macchina corrente // recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ; ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
@@ -1091,9 +1065,9 @@ Sawing::UpdateToolData( void)
m_Params.m_sToolName + ")" ; m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 2254, sInfo) ; m_pMchMgr->SetWarning( 2254, sInfo) ;
} }
// se modificato, aggiusto lo stato // se definito parametro di ritorno, lo assegno
if ( bChanged) if ( pbChanged != nullptr)
m_nStatus = MCH_ST_TO_VERIFY ; *pbChanged = bChanged ;
return true ; return true ;
} }
@@ -1271,7 +1245,7 @@ Sawing::GetCurve( SelData Id)
pCrvCompo->ToGlob( frGlob) ; pCrvCompo->ToGlob( frGlob) ;
vtN.ToGlob( frGlob) ; vtN.ToGlob( frGlob) ;
// sistemazioni varie // sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, V_NULL, {}, 0, 1) ; AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, 0, 1) ;
// aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino // aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino
if ( m_Params.m_nWorkSide == SAW_WS_CENTER) if ( m_Params.m_nWorkSide == SAW_WS_CENTER)
m_Params.m_nWorkSide = SAW_WS_RIGHT ; m_Params.m_nWorkSide = SAW_WS_RIGHT ;
@@ -1320,7 +1294,7 @@ Sawing::GetCurve( SelData Id)
pCrvCompo->ToGlob( frGlob) ; pCrvCompo->ToGlob( frGlob) ;
vtN.ToGlob( frGlob) ; vtN.ToGlob( frGlob) ;
// sistemazioni varie // sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, V_NULL, {}, 0, 1) ; AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, 0, 1) ;
// aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino // aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino
if ( m_Params.m_nWorkSide == SAW_WS_CENTER) if ( m_Params.m_nWorkSide == SAW_WS_CENTER)
m_Params.m_nWorkSide = SAW_WS_RIGHT ; m_Params.m_nWorkSide = SAW_WS_RIGHT ;
@@ -1603,15 +1577,6 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
double dThick ; double dThick ;
pCompo->GetThickness( dThick) ; pCompo->GetThickness( dThick) ;
// aggiusto eventuali normali inverse di archi rispetto ad estrusione
const ICurve* pCrv = pCompo->GetFirstCurve() ;
while ( pCrv != nullptr) {
const ICurveArc* pArc = GetCurveArc( pCrv) ;
if ( pArc != nullptr && pArc->GetNormVersor() * vtExtr < 0)
const_cast<ICurveArc*>(pArc)->InvertN() ;
pCrv = pCompo->GetNextCurve() ;
}
// recupero distanza da fondo dei grezzi interessati dal percorso // recupero distanza da fondo dei grezzi interessati dal percorso
double dRbDist, dAllRbDist ; double dRbDist, dAllRbDist ;
double dToler = 2 * m_TParams.m_dThick + tan( abs( m_Params.m_dSideAngle) * DEGTORAD) * m_TParams.m_dMaxMat ; double dToler = 2 * m_TParams.m_dThick + tan( abs( m_Params.m_dSideAngle) * DEGTORAD) * m_TParams.m_dMaxMat ;
@@ -1889,35 +1854,35 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
// Eventuale variazioni di velocità all'inizio e alla fine del percorso // Eventuale variazioni di velocità all'inizio e alla fine del percorso
FseVar FvVar ; FseVar FvVar ;
if ( pCrvP == nullptr) { if ( pCrvP == nullptr) {
string sFsta ; string sFsta = ExtractInfo( m_Params.m_sUserNotes, "Fsta=") ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_FSTA, sFsta)) { if ( ! sFsta.empty()) {
string sLen, sPu ; string sLen, sPu ;
SplitFirst( sFsta, ",", sLen, sPu) ; SplitFirst( sFsta, ",", sLen, sPu) ;
if ( FromString( sLen, FvVar.dLenStart)) FromString( sLen, FvVar.dLenStart) ;
FvVar.dLenStart = max( FvVar.dLenStart, 0.) ; FvVar.dLenStart = max( FvVar.dLenStart, 0.) ;
if ( FromString( sPu, FvVar.dPuStart)) FromString( sPu, FvVar.dPuStart) ;
FvVar.dPuStart = max( FvVar.dPuStart, 0.) ; FvVar.dPuStart = max( FvVar.dPuStart, 0.) ;
} }
} }
if ( pCrvN == nullptr) { if ( pCrvN == nullptr) {
string sFend ; string sFend = ExtractInfo( m_Params.m_sUserNotes, "Fend=") ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_FEND, sFend)) { if ( ! sFend.empty()) {
string sLen, sPu ; string sLen, sPu ;
SplitFirst( sFend, ",", sLen, sPu) ; SplitFirst( sFend, ",", sLen, sPu) ;
if ( FromString( sLen, FvVar.dLenEnd)) FromString( sLen, FvVar.dLenEnd) ;
FvVar.dLenEnd = max( FvVar.dLenEnd, 0.) ; FvVar.dLenEnd = max( FvVar.dLenEnd, 0.) ;
if ( FromString( sPu, FvVar.dPuEnd)) FromString( sPu, FvVar.dPuEnd) ;
FvVar.dPuEnd = max( FvVar.dPuEnd, 0.) ; FvVar.dPuEnd = max( FvVar.dPuEnd, 0.) ;
} }
} }
// recupero eventuali estensioni dei baffi (whiskers) // recupero eventuali estensioni dei baffi (whiskers)
double dStartWhiskExt = 0 ; double dStartWhiskExt = 0 ;
if ( m_Params.m_nLeadInType == SAW_LI_CENT) if ( m_Params.m_nLeadInType == SAW_LI_CENT)
GetValInNotes( m_Params.m_sUserNotes, UN_SWE, dStartWhiskExt) ; FromString( ExtractInfo( m_Params.m_sUserNotes, "SWE="), dStartWhiskExt) ;
double dEndWhiskExt = 0 ; double dEndWhiskExt = 0 ;
if ( m_Params.m_nLeadOutType == SAW_LO_CENT) if ( m_Params.m_nLeadOutType == SAW_LO_CENT)
GetValInNotes( m_Params.m_sUserNotes, UN_EWE, dEndWhiskExt) ; FromString( ExtractInfo( m_Params.m_sUserNotes, "EWE="), dEndWhiskExt) ;
// Se richiesto Preview // Se richiesto Preview
if ( nPvId != GDB_ID_NULL) { if ( nPvId != GDB_ID_NULL) {
@@ -1953,14 +1918,6 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
return false ; return false ;
m_pGeomDB->SetName( nPxId, sName) ; m_pGeomDB->SetName( nPxId, sName) ;
m_pGeomDB->SetMaterial( nPxId, BLUE) ; m_pGeomDB->SetMaterial( nPxId, BLUE) ;
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
// assegno i punti di inizio e fine al gruppo del percorso (tenendo conto degli allungamenti in vera lavorazione)
Vector3d vtMidDir ; pLine->GetMidDir( vtMidDir) ;
m_pGeomDB->SetInfo( nPxId, KEY_START, pLine->GetStart() - dStartWhiskExt * vtMidDir) ;
m_pGeomDB->SetInfo( nPxId, KEY_END, pLine->GetEnd() + dEndWhiskExt * vtMidDir) ;
// assegno l'elevazione massima
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
// punti notevoli // punti notevoli
Point3d ptIni = pLine->GetStart() + dElev * vtCorr ; Point3d ptIni = pLine->GetStart() + dElev * vtCorr ;
@@ -2005,7 +1962,7 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
m_pGeomDB->SetMaterial( nId3, BLUE) ; m_pGeomDB->SetMaterial( nId3, BLUE) ;
// valore di allungamento // valore di allungamento
double dExtraL = GetExtraLOnCutRegion() ; double dExtraL = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ;
// punti notevoli per regioni // punti notevoli per regioni
Point3d ptRIni = ptIni ; Point3d ptRIni = ptIni ;
@@ -2141,7 +2098,7 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
m_pGeomDB->SetName( nPxId, sName) ; m_pGeomDB->SetName( nPxId, sName) ;
m_pGeomDB->SetMaterial( nPxId, BLUE) ; m_pGeomDB->SetMaterial( nPxId, BLUE) ;
// assegno il vettore estrazione al gruppo del percorso // assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ; m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Vector3d( 0, 0, 1)) ;
// assegno i punti di inizio e fine al gruppo del percorso // assegno i punti di inizio e fine al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_START, pLine->GetStart()) ; m_pGeomDB->SetInfo( nPxId, KEY_START, pLine->GetStart()) ;
m_pGeomDB->SetInfo( nPxId, KEY_END, pLine->GetEnd()) ; m_pGeomDB->SetInfo( nPxId, KEY_END, pLine->GetEnd()) ;
@@ -2155,7 +2112,7 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
SetToolDir( vtTool) ; SetToolDir( vtTool) ;
SetCorrAuxDir( vtCorr) ; SetCorrAuxDir( vtCorr) ;
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// distanza di approccio/retrazione // distanza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
// flag di taglio inclinato // flag di taglio inclinato
@@ -2171,23 +2128,12 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
} }
if ( dActBstep < EPS_SMALL) if ( dActBstep < EPS_SMALL)
dActBstep = dActStep ; dActBstep = dActStep ;
double dActLstep = GetStepLast() ;
// direzione della linea // direzione della linea
Vector3d vtDir ; pLine->GetStartDir( vtDir) ; Vector3d vtDir ; pLine->GetStartDir( vtDir) ;
// parametri per partenza/arrivo a feed ridotta
double dCutLen ; pLine->GetLength( dCutLen) ;
double dStartFraz = FvVar.dLenStart / dCutLen ;
double dEndFraz = FvVar.dLenEnd / dCutLen ;
if ( dStartFraz + dEndFraz > 1) {
dStartFraz /= ( dStartFraz + dEndFraz) ;
dEndFraz = 1 - dStartFraz ;
}
double dMidFraz = 1 - dEndFraz ;
// Se una sola passata // Se una sola passata
if ( m_Params.m_nStepType != SAW_ST_TOANDFROM && if ( dActStep < EPS_SMALL || ( dElev - dExtraCut) <= dActStep ||
( dActStep < EPS_SMALL || ( dElev - dExtraCut) <= dActStep || ( ! bSideAng && m_Params.m_dStepLast > EPS_SMALL && ( dElev - dExtraCut) <= m_Params.m_dStepLast)) {
( ! bSideAng && dActLstep > EPS_SMALL && ( dElev - dExtraCut) <= dActLstep))) {
// 1 -> approccio // 1 -> approccio
Point3d ptP1 = pLine->GetStart() - vtDir * m_Params.m_dLiTang ; Point3d ptP1 = pLine->GetStart() - vtDir * m_Params.m_dLiTang ;
if ( ! AddApproach( ptP1, vtCorr, dSafeZ, dElev, dAppr)) if ( ! AddApproach( ptP1, vtCorr, dSafeZ, dElev, dAppr))
@@ -2231,6 +2177,16 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
} }
// 3 -> movimento di lato al punto finale // 3 -> movimento di lato al punto finale
if ( FvVar.dLenStart > EPS_SMALL || FvVar.dLenEnd > EPS_SMALL) { if ( FvVar.dLenStart > EPS_SMALL || FvVar.dLenEnd > EPS_SMALL) {
// lunghezza del taglio
double dCutLen ; pLine->GetLength( dCutLen) ;
double dStartFraz = FvVar.dLenStart / dCutLen ;
double dEndFraz = FvVar.dLenEnd / dCutLen ;
double dMidFraz = 1 - dEndFraz ;
if ( dStartFraz + dEndFraz > 1) {
dStartFraz /= ( dStartFraz + dEndFraz) ;
dEndFraz = 1 - dStartFraz ;
dMidFraz = dStartFraz ;
}
// punto finale // punto finale
Point3d ptP3 = pLine->GetEnd() ; Point3d ptP3 = pLine->GetEnd() ;
// 3a -> eventuale movimento di lato a feed ridotta di inizio percorso // 3a -> eventuale movimento di lato a feed ridotta di inizio percorso
@@ -2274,17 +2230,11 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
int nStep = 2 ; int nStep = 2 ;
if ( m_Params.m_nStepType == SAW_ST_ZIGZAG) if ( m_Params.m_nStepType == SAW_ST_ZIGZAG)
nStep = 2 * static_cast<int>( ceil( dCutH / ( dActStep + dActBstep + EPS_SMALL))) ; nStep = 2 * static_cast<int>( ceil( dCutH / ( dActStep + dActBstep + EPS_SMALL))) ;
else {
if ( dActStep < EPS_SMALL)
dActStep = dCutH / nStep ;
if ( dActBstep < EPS_SMALL)
dActBstep = dCutH / nStep ;
}
double dMeanStep = dCutH / nStep ; double dMeanStep = dCutH / nStep ;
double dBstep = dActBstep * 2 * dMeanStep / ( dActStep + dActBstep) ; double dBstep = dActBstep * 2 * dMeanStep / ( dActStep + dActBstep) ;
double dLastStep = dBstep ; double dLastStep = dBstep ;
if ( ! bSideAng && dActLstep > EPS_SMALL) { if ( ! bSideAng && m_Params.m_dStepLast > EPS_SMALL) {
dLastStep = dActLstep ; dLastStep = m_Params.m_dStepLast ;
double dCoeff = ( dCutH - dLastStep) / ( nStep / 2 * dActStep + ( nStep / 2 - 1) * dActBstep) ; double dCoeff = ( dCutH - dLastStep) / ( nStep / 2 * dActStep + ( nStep / 2 - 1) * dActBstep) ;
dMeanStep = dCoeff * ( dActStep + dActBstep) / 2 ; dMeanStep = dCoeff * ( dActStep + dActBstep) / 2 ;
dBstep = dCoeff * dActBstep ; dBstep = dCoeff * dActBstep ;
@@ -2306,38 +2256,9 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
if ( AddLinearMove( ptP2) == GDB_ID_NULL) if ( AddLinearMove( ptP2) == GDB_ID_NULL)
return false ; return false ;
// movimento di lato // movimento di lato
double dCurrFeed = ( ! bSideAng ? ( i == 0 ? GetBackFeed() : GetFeed()) : GetSideAngFeed()) ; SetFeed( ( ! bSideAng ? ( i == 0 ? GetBackFeed() : GetFeed()) : GetSideAngFeed())) ;
if ( FvVar.dLenStart > EPS_SMALL || FvVar.dLenEnd > EPS_SMALL) { if ( AddLinearMove( ptP3) == GDB_ID_NULL)
// scambio opportunamente le frazioni (dispari vanno, pari tornano) return false ;
double dCurrStartFraz = dStartFraz ;
double dCurrEndFraz = dEndFraz ;
if ( IsEven( i))
swap( dCurrStartFraz, dCurrEndFraz) ;
double dCurrMidFraz = 1 - dCurrEndFraz ;
// 3a -> eventuale movimento di lato a feed ridotta di inizio percorso
if ( dCurrStartFraz * dCutLen > EPS_SMALL) {
SetFeed( FvVar.dPuStart * dCurrFeed) ;
if ( AddLinearMove( Media( ptP2, ptP3, dCurrStartFraz)) == GDB_ID_NULL)
return false ;
}
// 3b -> eventuale movimento di lato a feed normale
if ( ( dCurrMidFraz - dCurrStartFraz) * dCutLen > EPS_SMALL) {
SetFeed( dCurrFeed) ;
if ( AddLinearMove( Media( ptP2, ptP3, dCurrMidFraz)) == GDB_ID_NULL)
return false ;
}
// 3c -> eventuale movimento di lato a feed ridotta di fine percorso
if ( dCurrEndFraz * dCutLen > EPS_SMALL) {
SetFeed( FvVar.dPuEnd * dCurrFeed) ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
}
}
else {
SetFeed( dCurrFeed) ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
}
} }
// 4 -> retrazione // 4 -> retrazione
if ( ! AddRetract( pLine->GetStart(), vtCorr, dSafeZ, dElev, dAppr)) if ( ! AddRetract( pLine->GetStart(), vtCorr, dSafeZ, dElev, dAppr))
@@ -2355,8 +2276,8 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
int nStep = static_cast<int>( ceil( dCutH / ( dActStep + EPS_SMALL))) ; int nStep = static_cast<int>( ceil( dCutH / ( dActStep + EPS_SMALL))) ;
double dStep = dCutH / nStep ; double dStep = dCutH / nStep ;
double dLastStep = dStep ; double dLastStep = dStep ;
if ( ! bSideAng && dActLstep > EPS_SMALL) { if ( ! bSideAng && m_Params.m_dStepLast > EPS_SMALL) {
dLastStep = dActLstep ; dLastStep = m_Params.m_dStepLast ;
nStep = static_cast<int>( ceil( ( dCutH - dLastStep) / ( dActStep + EPS_SMALL))) + 1 ; nStep = static_cast<int>( ceil( ( dCutH - dLastStep) / ( dActStep + EPS_SMALL))) + 1 ;
dStep = ( dCutH - dLastStep) / ( nStep - 1) ; dStep = ( dCutH - dLastStep) / ( nStep - 1) ;
} }
@@ -2371,33 +2292,10 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
if ( AddLinearMove( ptP2) == GDB_ID_NULL) if ( AddLinearMove( ptP2) == GDB_ID_NULL)
return false ; return false ;
// movimento di lato al punto finale // movimento di lato al punto finale
double dCurrFeed = ( ! bSideAng ? GetFeed() : GetSideAngFeed()) ; SetFeed( ( ! bSideAng ? GetFeed() : GetSideAngFeed())) ;
Point3d ptP3 = pLine->GetEnd() + vtCorr * dDelta ; Point3d ptP3 = pLine->GetEnd() + vtCorr * dDelta ;
if ( FvVar.dLenStart > EPS_SMALL || FvVar.dLenEnd > EPS_SMALL) { if ( AddLinearMove( ptP3) == GDB_ID_NULL)
// 3a -> eventuale movimento di lato a feed ridotta di inizio percorso return false ;
if ( dStartFraz * dCutLen > EPS_SMALL) {
SetFeed( FvVar.dPuStart * dCurrFeed) ;
if ( AddLinearMove( Media( ptP2, ptP3, dStartFraz)) == GDB_ID_NULL)
return false ;
}
// 3b -> eventuale movimento di lato a feed normale
if ( ( dMidFraz - dStartFraz) * dCutLen > EPS_SMALL) {
SetFeed( dCurrFeed) ;
if ( AddLinearMove( Media( ptP2, ptP3, dMidFraz)) == GDB_ID_NULL)
return false ;
}
// 3c -> eventuale movimento di lato a feed ridotta di fine percorso
if ( dEndFraz * dCutLen > EPS_SMALL) {
SetFeed( FvVar.dPuEnd * dCurrFeed) ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
}
}
else {
SetFeed( dCurrFeed) ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
}
// se non è ultimo passo // se non è ultimo passo
if ( i != 0) { if ( i != 0) {
// movimento di risalita sopra il punto finale // movimento di risalita sopra il punto finale
@@ -2405,9 +2303,10 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
Point3d ptP4 = pLine->GetEnd() + vtCorr * ( dElev + dAppr / vtCorr.z) ; Point3d ptP4 = pLine->GetEnd() + vtCorr * ( dElev + dAppr / vtCorr.z) ;
if ( AddLinearMove( ptP4) == GDB_ID_NULL) if ( AddLinearMove( ptP4) == GDB_ID_NULL)
return false ; return false ;
// movimento di ritorno in rapido sopra il punto iniziale // movimento di ritorno spora il punto iniziale
SetFeed( GetEndFeed()) ;
Point3d ptP5 = pLine->GetStart() + vtCorr * ( dElev + dAppr / vtCorr.z) ; Point3d ptP5 = pLine->GetStart() + vtCorr * ( dElev + dAppr / vtCorr.z) ;
if ( AddRapidMove( ptP5) == GDB_ID_NULL) if ( AddLinearMove( ptP5) == GDB_ID_NULL)
return false ; return false ;
} }
} }
@@ -2440,7 +2339,7 @@ Sawing::ProcessExtCurve( const ICurve* pCrvP, const ICurveComposite* pCrvC, cons
dMinRad = dRad ; dMinRad = dRad ;
} }
} }
if ( dMinRad < GetExtSawArcMinRad()) { if ( dMinRad < m_pMchMgr->GetCurrMachiningsMgr()->GetExtSawArcMinRad()) {
m_pMchMgr->SetWarning( 2258, "Warning in Sawing : Radius too small in ExtSawArc") ; m_pMchMgr->SetWarning( 2258, "Warning in Sawing : Radius too small in ExtSawArc") ;
return true ; return true ;
} }
@@ -2584,15 +2483,6 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv, double dOffs,
return false ; return false ;
m_pGeomDB->SetName( nPxId, sName) ; m_pGeomDB->SetName( nPxId, sName) ;
m_pGeomDB->SetMaterial( nPxId, BLUE) ; m_pGeomDB->SetMaterial( nPxId, BLUE) ;
// assegno il vettore estrusione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
// assegno i punti di inizio e fine al gruppo del percorso
Point3d ptStart ; pCrv->GetStartPoint( ptStart) ;
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
Point3d ptEnd ; pCrv->GetEndPoint( ptEnd) ;
m_pGeomDB->SetInfo( nPxId, KEY_END, ptEnd) ;
// assegno l'elevazione massima
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
// disabilito eventuale registrazione comandi EXE (riabilitazione automatica) // disabilito eventuale registrazione comandi EXE (riabilitazione automatica)
CmdLogOff cmdLogOff ; CmdLogOff cmdLogOff ;
@@ -2603,7 +2493,7 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv, double dOffs,
colCut = FUCHSIA ; colCut = FUCHSIA ;
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata // dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
double dExtraL = GetExtraLOnCutRegion() ; double dExtraL = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ;
// lunghezza taglio parziale // lunghezza taglio parziale
double dDeltaT = (( dElev < 0.5 * m_TParams.m_dDiam) ? sqrt( dElev * m_TParams.m_dDiam - dElev * dElev) : 0) ; double dDeltaT = (( dElev < 0.5 * m_TParams.m_dDiam) ? sqrt( dElev * m_TParams.m_dDiam - dElev * dElev) : 0) ;
@@ -2975,7 +2865,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
SetPathId( nPxId) ; SetPathId( nPxId) ;
SetCorrAuxDir( vtStaCorr) ; SetCorrAuxDir( vtStaCorr) ;
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
@@ -3235,7 +3125,7 @@ Sawing::ProcessIntArc( const ICurve* pCrvP, const ICurveArc* pArcC, const ICurve
if ( IsNull( pArc)) if ( IsNull( pArc))
return false ; return false ;
// determino l'inclinazione per ottenere il raggio e ne verifico il limite // determino l'inclinazione per ottenere il raggio e ne verifico il limite
double dMaxSideAng = GetIntSawArcMaxSideAng() + EPS_ANG_SMALL ; double dMaxSideAng = m_pMchMgr->GetCurrMachiningsMgr()->GetIntSawArcMaxSideAng()+ EPS_ANG_SMALL ;
double dSawRad = m_TParams.m_dDiam / 2 ; double dSawRad = m_TParams.m_dDiam / 2 ;
double dRad = pArc->GetRadius() ; double dRad = pArc->GetRadius() ;
double dSinA = dSawRad / dRad ; double dSinA = dSawRad / dRad ;
@@ -3375,15 +3265,6 @@ Sawing::GenerateIntArcPv( const ICurveArc* pArc,
return false ; return false ;
m_pGeomDB->SetName( nPxId, sName) ; m_pGeomDB->SetName( nPxId, sName) ;
m_pGeomDB->SetMaterial( nPxId, BLUE) ; m_pGeomDB->SetMaterial( nPxId, BLUE) ;
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
// assegno i punti di inizio e fine al gruppo del percorso
Point3d ptStart ; pArc->GetStartPoint( ptStart) ;
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
Point3d ptEnd ; pArc->GetEndPoint( ptEnd) ;
m_pGeomDB->SetInfo( nPxId, KEY_END, ptEnd) ;
// assegno l'elevazione massima
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
// disabilito eventuale registrazione comandi EXE (riabilitazione automatica) // disabilito eventuale registrazione comandi EXE (riabilitazione automatica)
CmdLogOff cmdLogOff ; CmdLogOff cmdLogOff ;
@@ -3433,7 +3314,7 @@ Sawing::GenerateIntArcPv( const ICurveArc* pArc,
m_pGeomDB->SetMaterial( nId3, BLUE) ; m_pGeomDB->SetMaterial( nId3, BLUE) ;
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata // dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
double dExtraL = GetExtraLOnCutRegion() ; double dExtraL = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ;
// regione ridotta di taglio per nesting (escluse parti iniziali e finali) // regione ridotta di taglio per nesting (escluse parti iniziali e finali)
PtrOwner<ICurveComposite> pCmpRr( GenerateIntArcPvTrueCut( pArc, dDeltaInt, dDeltaExt, dExtraL)) ; PtrOwner<ICurveComposite> pCmpRr( GenerateIntArcPvTrueCut( pArc, dDeltaInt, dDeltaExt, dExtraL)) ;
@@ -3691,7 +3572,7 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
// Imposto dati comuni // Imposto dati comuni
SetPathId( nPxId) ; SetPathId( nPxId) ;
// recupero distanza di sicurezza // recupero distanza di sicurezza
double dSafeZ = GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// lunghezza di approccio/retrazione // lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ; double dAppr = m_Params.m_dStartPos ;
@@ -3940,16 +3821,8 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
bool bool
Sawing::AddApproach( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr) Sawing::AddApproach( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr)
{ {
// se abilitato approccio diretto fuori dal grezzo (solo per lavorazione ToAndFrom) // se distanza di sicurezza minore di distanza di inizio
if ( m_bDownSE) { if ( dSafeZ < m_Params.m_dStartPos + 10 * EPS_SMALL) {
// 1 -> punto sopra inizio
SetFlag( 1) ;
Point3d ptP1 = ptP + vtCorr * ( dElev / 2 + dAppr / vtCorr.z) ;
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
return false ;
}
// se distanza di sicurezza minore di distanza di inizio
else if ( dSafeZ < m_Params.m_dStartPos + 10 * EPS_SMALL) {
// 1 -> punto sopra inizio // 1 -> punto sopra inizio
SetFlag( 1) ; SetFlag( 1) ;
Point3d ptP1 = ptP + vtCorr * ( dElev + dAppr / vtCorr.z) ; Point3d ptP1 = ptP + vtCorr * ( dElev + dAppr / vtCorr.z) ;
@@ -3975,15 +3848,7 @@ Sawing::AddApproach( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ,
bool bool
Sawing::AddRetract( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr) Sawing::AddRetract( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr)
{ {
// se abilitato retrazione diretta fuori dal grezzo (solo per lavorazione ToAndFrom) if ( dSafeZ < m_Params.m_dStartPos + 10 * EPS_SMALL) {
if ( m_bDownSE) {
// 4 -> movimento di risalita sopra il punto finale
SetFeed( GetEndFeed()) ;
Point3d ptP4 = ptP + vtCorr * ( dElev / 2 + dAppr / vtCorr.z) ;
if ( AddRapidMove( ptP4) == GDB_ID_NULL)
return false ;
}
else if ( dSafeZ < m_Params.m_dStartPos + 10 * EPS_SMALL) {
// 4 -> movimento di risalita sopra il punto finale // 4 -> movimento di risalita sopra il punto finale
SetFeed( GetEndFeed()) ; SetFeed( GetEndFeed()) ;
Point3d ptP4 = ptP + vtCorr * ( dElev + dAppr / vtCorr.z) ; Point3d ptP4 = ptP + vtCorr * ( dElev + dAppr / vtCorr.z) ;
@@ -4098,7 +3963,7 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
bool& bToSkip, double& dDeltaLiExt, double& dDeltaLoExt) bool& bToSkip, double& dDeltaLiExt, double& dDeltaLoExt)
{ {
// distanza XY tra centro e bordo taglio // distanza XY tra centro e bordo taglio
double dDeltaT = (( dElev < 0.5 * m_TParams.m_dDiam) ? sqrt( dElev * m_TParams.m_dDiam - dElev * dElev) : 0.5 * m_TParams.m_dDiam) ; double dDeltaT = (( dElev < 0.5 * m_TParams.m_dDiam) ? sqrt( dElev * m_TParams.m_dDiam - dElev * dElev) : 0) ;
// lunghezza aggiuntiva per attacco speciale a zigzag // lunghezza aggiuntiva per attacco speciale a zigzag
double dDeltaLi = 0 ; double dDeltaLi = 0 ;
if ( dLiElev > EPS_SMALL) if ( dLiElev > EPS_SMALL)
@@ -4134,7 +3999,7 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
for ( int i = 0 ; i < 4 ; ++i) for ( int i = 0 ; i < 4 ; ++i)
dDeltaI = max( dDeltaI, dDist[i]) ; dDeltaI = max( dDeltaI, dDist[i]) ;
if ( m_Params.m_nLeadInType == SAW_LI_EXT_OUT) if ( m_Params.m_nLeadInType == SAW_LI_EXT_OUT)
dDeltaI += dDeltaT + ( m_bDownSE ? MIN_SAFEDIST : 0) ; dDeltaI += dDeltaT ;
dDeltaLiExt = dDeltaI ; dDeltaLiExt = dDeltaI ;
} }
} }
@@ -4158,7 +4023,7 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
for ( int i = 0 ; i < 4 ; ++i) for ( int i = 0 ; i < 4 ; ++i)
dDeltaI = max( dDeltaI, dDist[i]) ; dDeltaI = max( dDeltaI, dDist[i]) ;
if ( m_Params.m_nLeadInType == SAW_LI_EXT_OUT) if ( m_Params.m_nLeadInType == SAW_LI_EXT_OUT)
dDeltaI += dDeltaT + ( m_bDownSE ? MIN_SAFEDIST : 0) ; dDeltaI += dDeltaT ;
dDeltaLiExt = dDeltaI ; dDeltaLiExt = dDeltaI ;
} }
} }
@@ -4193,7 +4058,7 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
for ( int i = 0 ; i < 4 ; ++i) for ( int i = 0 ; i < 4 ; ++i)
dDeltaF = max( dDeltaF, dDist[i]) ; dDeltaF = max( dDeltaF, dDist[i]) ;
if ( m_Params.m_nLeadOutType == SAW_LO_EXT_OUT) if ( m_Params.m_nLeadOutType == SAW_LO_EXT_OUT)
dDeltaF += dDeltaT + ( m_bDownSE ? MIN_SAFEDIST : 0) ; dDeltaF += dDeltaT ;
dDeltaLoExt = dDeltaF ; dDeltaLoExt = dDeltaF ;
} }
} }
@@ -4218,7 +4083,7 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
dDeltaF = max( dDeltaF, dDist[i]) ; dDeltaF = max( dDeltaF, dDist[i]) ;
// se LeadOut EXT_OUT vado all'esterno // se LeadOut EXT_OUT vado all'esterno
if ( m_Params.m_nLeadOutType == SAW_LO_EXT_OUT) if ( m_Params.m_nLeadOutType == SAW_LO_EXT_OUT)
dDeltaF += dDeltaT + ( m_bDownSE ? MIN_SAFEDIST : 0) ; dDeltaF += dDeltaT ;
dDeltaLoExt = dDeltaF ; dDeltaLoExt = dDeltaF ;
} }
} }
+3 -10
View File
@@ -39,14 +39,8 @@ class Sawing : public Machining
public : // Operation public : // Operation
int GetType( void) const override int GetType( void) const override
{ return OPER_SAWING ; } { return OPER_SAWING ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override bool IsEmpty( void) const override
{ if ( m_nCuts == 0) { return ( m_nCuts == 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 bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; } { m_nStatus |= nModif ; return true ; }
@@ -69,7 +63,7 @@ class Sawing : public Machining
bool GetParam( int nType, int& nVal) const override ; bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ; bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ; bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( void) override ; bool UpdateToolData( bool* pbChanged = nullptr) override ;
const ToolData& GetToolData( void) const override ; const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ; bool GetGeometry( SELVECTOR& vIds) const override ;
@@ -170,7 +164,6 @@ class Sawing : public Machining
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
SawingData m_Params ; // parametri lavorazione SawingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile ToolData m_TParams ; // parametri utensile
bool m_bDownSE ; // flag per attacco/uscita senza risalite se fuori dal grezzo
int m_nStatus ; // stato di aggiornamento della lavorazione int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nCuts ; // numero di tagli generati int m_nCuts ; // numero di tagli generati
} ; } ;
File diff suppressed because it is too large Load Diff
+156 -32
View File
@@ -1,24 +1,25 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2024 // EgalTech 2015-2023
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : Simulator.h Data : 01.09.24 Versione : 2.6i1 // File : Simulator.h Data : 16.01.23 Versione : 2.5a2
// Contenuto : Dichiarazione della classe interfaccia ISimulator. // Contenuto : Dichiarazione della classe Simulator.
// //
// //
// //
// Modifiche : 01.09.24 DS Creazione modulo. // Modifiche : 19.10.15 DS Creazione modulo.
// //
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
#pragma once #pragma once
#include "/EgtDev/Include/EGkVector3d.h" #include "CamData.h"
#include "/EgtDev/Include/EMkSimuGenConst.h" #include "/EgtDev/Include/EMkSimuGenConst.h"
#include "/EgtDev/Include/EgtNumCollection.h"
#include <string>
class MachMgr ; class MachMgr ;
class IGeomDB ;
class Machine ;
class PerformanceCounter ;
//------------------------ Struttura per movimento esterno assi -------------- //------------------------ Struttura per movimento esterno assi --------------
struct SimAxMv struct SimAxMv
@@ -37,31 +38,154 @@ enum SimAxMvRes { SIM_AXMV_RES_STOP = -1,
SIM_AXMV_RES_OK = 1} ; SIM_AXMV_RES_OK = 1} ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class __declspec( novtable) ISimulator class Simulator
{ {
public : public :
virtual ~ISimulator( void) {} Simulator( void) ;
virtual bool Init( MachMgr* pMchMgr) = 0 ; ~Simulator( void) ;
virtual bool Start( bool bFirst) = 0 ; bool Init( MachMgr* pMchMgr) ;
virtual bool Move( int& nStatus) = 0 ; bool Start( bool bFirst) ;
virtual bool GoHome( void) = 0 ; bool Move( int& nStatus) ;
virtual bool SetStep( double dStep) = 0 ; bool GoHome( void) ;
virtual bool SetUiStatus( int nUiStatus) = 0 ; bool SetStep( double dStep) ;
virtual bool GetAxisInfoPos( int nI, std::string& sName, std::string& sToken, bool& bLinear, double& dVal) const = 0 ; bool SetUiStatus( int nUiStatus) ;
virtual bool GetToolInfo( std::string& sName, double& dSpeed) const = 0 ; bool GetAxisInfoPos( int nI, std::string& sName, std::string& sToken, bool& bLinear, double& dVal) const ;
virtual bool GetOperationInfo( std::string& sName, int& nType) const = 0 ; bool GetToolInfo( std::string& sName, double& dSpeed) const ;
virtual bool GetMoveInfo( int& nGmove, double& dFeed) const = 0 ; bool GetOperationInfo( std::string& sName, int& nType) const ;
virtual bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, bool GetMoveInfo( int& nGmove, double& dFeed) const ;
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) = 0 ; bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
virtual bool RemoveCollisionObj( int nFrameId) = 0 ; bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
virtual bool GetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType, bool OnCollision( int nCdInd, int nObjInd, int& nErr) ;
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) = 0 ; bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst) ;
virtual bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) = 0 ; int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ;
virtual bool OnCollision( int nCdInd, int nObjInd, int& nErr) = 0 ;
virtual bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag, private :
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) = 0 ; bool UpdateTool( bool bFirst, int& nErr) ;
virtual bool EnableToolsForVmill( bool bEnable) = 0 ; bool UpdateAxes( void) ;
virtual bool EnableToolTipTrace( bool bEnable) = 0 ; bool UpdateAxesPos( void) ;
virtual int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) = 0 ; bool ResetInterpolation( void) ;
virtual bool SaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) = 0 ; bool ResetAxes( void) ;
bool ResetAuxAxes( void) ;
private :
bool VerifySetup( void) ;
bool FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus) ;
bool ManageOperationEnd( int& nStatus) ;
bool FindAndManagePathStart( int& nStatus) ;
bool ManagePathEnd( int& nStatus) ;
bool ManagePathStartAux( int& nStatus) ;
bool ManagePathEndAux( int& nStatus) ;
bool ManageMove( int& nStatus) ;
bool ManageSingleMove( int& nStatus, double& dMove) ;
int CalcStatusOnError( int nErr) ;
bool GetHeadCurrPosDirAux( const std::string& sHead, int nExit, Point3d& ptH, Vector3d& vtH, Vector3d& vtA) ;
bool ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVmAdOffs,
const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF) ;
bool NeedCollisionCheck( void) const
{ return ( ! m_CollObj.empty() && ! m_CdId.empty()) ; }
bool Stopped( void)
{ return ( m_nUiStatus == MCH_UISIM_STOP) ; }
bool OnInit( void) ;
bool OnExit( void) ;
bool OnProgramStart( bool bFirst) ;
bool OnProgramEnd( void) ;
bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionEnd( void) ;
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos, bool bFirst, int& nErr) ;
bool OnToolDeselect( const std::string& sNextTool, const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos, int& nErr) ;
bool OnMachiningStart( int nOpId, int nOpInd, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ;
bool OnMachiningEnd( void) ;
bool OnPathStartAux( int nInd, const std::string& sAS, int& nErr) ;
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev) ;
bool OnPathEnd( int nAE) ;
bool OnMoveStart( const CamData* pCamData, int& nErr) ;
bool OnMoveEnd( int& nErr) ;
bool OnResetMachine( void) ;
private :
struct CollObj {
int nInd ;
bool bToolOn ;
int nFrameId ;
int nType ;
Vector3d vtMove ;
double dPar1 ;
double dPar2 ;
double dPar3 ;
CollObj( void) : nInd( 0), bToolOn( false), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
CollObj( int nI, bool bTOn, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
: nInd( nI), bToolOn( bTOn), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
} ;
typedef std::vector<CollObj> COBVECTOR ;
struct VmTool
{
std::string sName ;
std::string sHead ;
int nExit ;
double dTdOffs ;
double dAdOffs ;
VmTool( void) : nExit( 0), dTdOffs( 0), dAdOffs( 0) {}
VmTool( std::string sN, std::string sH, int nE, double dT, double dA)
: sName( sN), sHead( sH), nExit( nE), dTdOffs( dT), dAdOffs( dA) {}
} ;
typedef std::vector<VmTool> VMTVECTOR ;
enum { SIS_CREATED = 0,
SIS_INITIALIZED = 1,
SIS_READYTOSTART = 2,
SIS_READYTORUN = 3} ;
private :
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
Machine* m_pMachine ; // puntatore alla macchina
PerformanceCounter* m_pPerfCnt ; // timer per calcolo FPS
int m_nStatus ; // stato interno del simulatore (creato, inizializzato, pronto al movimento)
double m_dStep ; // lunghezza di riferimento per la velocità di simulazione
int m_nUiStatus ; // stato simulazione a livello utente
int m_nOpId ; // identificativo della operazione (lavoraz.) corrente
int m_nOpInd ; // contatore della operazione (lavoraz.) corrente
int m_nCLPathId ; // identificativo del percorso di lavoro corrente
int m_nCLPathInd ; // contatore del percorso di lavoro corrente nell'operazione
int m_nEntId ; // identificativo dell'entità corrente
int m_nEntInd ; // contatore dell'entità corrente nel percorso di lavoro
double m_dCoeff ; // coefficiente di esecuzione del movimento corrente (0...1)
int m_nAuxSTot ; // numero totale movimenti ausiliari di inizio percorso
int m_nAuxSInd ; // indice del movimento ausiliario di inizio percorso corrente
int m_nAuxETot ; // numero totale movimenti ausiliari di fine percorso
int m_nAuxEInd ; // indice del movimento ausiliario di fine percorso corrente
std::string m_sTool ; // nome dell'utensile corrente
std::string m_sHead ; // nome della testa corrente
int m_nExit ; // indice dell'uscita corrente
double m_dTDiam ; // diametro dell'utensile corrente
bool m_bCutOnTip ; // flag capacità di lavorare di testa dell'utensile corrente
INTVECTOR m_VmId ; // vettore identificativi Zmap per Virtual Milling
INTVECTOR m_CdId ; // vettore identificativi Zmap per Collision Detection
VMTVECTOR m_VmTool ; // vettore utensili attivi per virtual milling
COBVECTOR m_CollObj ; // vettore oggetti da testare per collisione con grezzo
double m_dSafeDist ; // distanza di sicurezza per verifica collisioni
int m_nAxesMask ; // maschera a bit di abilitazione movimento assi (solo se rapido)
bool m_bEnabAxes ; // flag abilitazione movimento assi attivi
bool m_bShowAxes ; // flag visualizzazione assi attivi
STRVECTOR m_AxesName ; // nomi degli assi macchina attivi
STRVECTOR m_AxesToken ; // token degli assi macchina attivi
BOOLVECTOR m_AxesInvert ; // flag di asse con verso invertito degli assi macchina attivi
DBLVECTOR m_AxesOffset ; // valore di offset delgli assi macchina ttivi
BOOLVECTOR m_AxesLinear ; // flag di lineare degli assi macchina attivi
DBLVECTOR m_AxesVal ; // valori degli assi macchina all'inizio del movimento corrente
STRVECTOR m_AuxAxesName ; // nomi degli assi macchina ausiliari abilitati
STRVECTOR m_AuxAxesToken ; // token degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesInvert ; // flag di asse con verso invertito degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesOffset ; // valore di offset degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesLinear ; // flag di lineare degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesVal ; // valori degli assi macchina ausiliari all'inizio del movimento corrente
DBLVECTOR m_AuxAxesEnd ; // valori degli assi macchina ausiliari alla fine del movimento corrente
INTVECTOR m_AuxAxesLink ; // indice + 1 asse principale di aggancio (negativo valore opposto, 0 nessuno)
} ; } ;
-2768
View File
File diff suppressed because it is too large Load Diff
-220
View File
@@ -1,220 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : SimulatorMP.h Data : 01.09.24 Versione : 2.6i1
// Contenuto : Dichiarazione della classe SimulatorMP.
// Simulatore multi-processo.
//
//
// Modifiche : 01.09.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Simulator.h"
#include "CamData.h"
class IGeomDB ;
class Machine ;
class PerformanceCounter ;
//----------------------------------------------------------------------------
ISimulator* CreateSimulatorMP( void) ;
//----------------------------------------------------------------------------
class SimulatorMP : public ISimulator
{
public : // ISimulator
~SimulatorMP( void) override ;
bool Init( MachMgr* pMchMgr) override ;
bool Start( bool bFirst) override ;
bool Move( int& nStatus) override ;
bool GoHome( void) override ;
bool SetStep( double dStep) override ;
bool SetUiStatus( int nUiStatus) override ;
bool GetAxisInfoPos( int nI, std::string& sName, std::string& sToken, bool& bLinear, double& dVal) const override ;
bool GetToolInfo( std::string& sName, double& dSpeed) const override ;
bool GetOperationInfo( std::string& sName, int& nType) const override ;
bool GetMoveInfo( int& nGmove, double& dFeed) const override ;
bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) override ;
bool RemoveCollisionObj( int nFrameId) override ;
bool GetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) override ;
bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) override ;
bool OnCollision( int nCdInd, int nObjInd, int& nErr) override ;
bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) override ;
bool EnableToolsForVmill( bool bEnable) override ;
bool EnableToolTipTrace( bool bEnable) override
{ return false ; }
int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) override ;
bool SaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) override ;
public :
SimulatorMP( void) ;
private :
bool UpdateMachiningTool( bool bFirst, int& nChangeTool, int& nErr) ;
bool UpdateDispositionTool( bool bFirst, int& nErr) ;
bool UpdateAxes( void) ;
bool UpdateAxesPos( void) ;
bool ResetInterpolation( void) ;
bool ResetAxes( void) ;
bool ResetAuxAxes( void) ;
private :
bool VerifySetup( void) ;
bool FindAndManageOperationStart( bool bStart, bool bFirst, int& nChangeTool, int& nStatus) ;
bool ManageOperationEnd( int& nStatus) ;
bool FindAndManagePathStart( int& nStatus) ;
bool ManagePathEnd( int& nStatus) ;
bool ManagePathStartAux( int& nStatus) ;
bool ManagePathEndAux( int& nStatus) ;
bool ManageMove( int& nStatus) ;
bool ManageSingleMove( int& nStatus, double& dMove) ;
int CalcStatusOnError( int nErr) ;
bool GetHeadCurrPosDirAux( const std::string& sHead, int nExit, Point3d& ptH, Vector3d& vtH, Vector3d& vtA) ;
bool ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVmAdOffs,
const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF) ;
bool NeedCollisionCheck( void) const
{ return ( ! m_CollObj.empty() && ! m_CdId.empty()) ; }
bool Stopped( void)
{ return ( m_nUiStatus == MCH_UISIM_STOP) ; }
bool SetCollisionMark( int nCdInd, int nObjInd) ;
bool ResetCollisionMark( void) ;
bool CallFunction( const std::string& sFun, bool bSetRecord = false, bool bSetModifiedOff = true) ;
bool OnInit( void) ;
bool OnExit( void) ;
bool OnProgramStart( bool bFirst) ;
bool OnProgramEnd( void) ;
bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionEnd( void) ;
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos,
bool bFirst, bool bFloating, int& nErr) ;
bool OnToolDeselect( const std::string& sNextTool, const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos, int& nErr) ;
bool OnMachiningStart( int nOpId, int nOpInd, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ;
bool OnMachiningEnd( void) ;
bool OnPathStartAux( int nInd, const std::string& sAS, int& nErr) ;
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
bool OnPathStart( int nClPathId, int nClPathInd, int nDBLPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ;
bool OnPathEnd( int nAE) ;
bool OnMoveStart( const CamData* pCamData, const CamData* pNextCamData, int& nErr) ;
bool OnMoveEnd( int& nErr) ;
bool OnResetMachine( void) ;
bool ReadAuxAxesData( int& nErr) ;
bool ExecCmdData( int& nStatus) ;
bool ExecAllCmdData( int& nStatus) ;
private :
struct CollObj {
int nInd ;
bool bToolOn ;
int nFrameId ;
int nType ;
Vector3d vtMove ;
double dPar1 ;
double dPar2 ;
double dPar3 ;
CollObj( void) : nInd( 0), bToolOn( false), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
CollObj( int nI, bool bTOn, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
: nInd( nI), bToolOn( bTOn), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
} ;
typedef std::vector<CollObj> COBVECTOR ;
struct VmTool
{
std::string sName ;
std::string sHead ;
int nExit ;
double dTdOffs ;
double dAdOffs ;
VmTool( void) : nExit( 0), dTdOffs( 0), dAdOffs( 0) {}
VmTool( std::string sN, std::string sH, int nE, double dT, double dA)
: sName( sN), sHead( sH), nExit( nE), dTdOffs( dT), dAdOffs( dA) {}
} ;
typedef std::vector<VmTool> VMTVECTOR ;
enum { SIS_CREATED = 0,
SIS_INITIALIZED = 1,
SIS_READYTOSTART = 2,
SIS_READYTORUN = 3} ;
private :
struct CmdData {
int nType ;
int nMoveType ;
SAMVECTOR vAxNaEpSt ;
int nPar ;
std::string sPar ;
std::string sPar2 ;
CmdData( void) : nType(0) {}
CmdData( int nM, const SAMVECTOR& vAx)
: nType( 1), nMoveType( nM), vAxNaEpSt( vAx) {}
CmdData( int nT, int nP, const std::string& sP, const std::string& sP2)
: nType( nT), nPar( nP), sPar( sP), sPar2( sP2) {}
} ;
typedef std::vector<CmdData> CMDVECTOR ;
private :
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
Machine* m_pMachine ; // puntatore alla macchina
PerformanceCounter* m_pPerfCnt ; // timer per calcolo FPS
std::string m_sSpecEstim ; // path del file con i dati della stima speciale
int m_nStatus ; // stato interno del simulatore (creato, inizializzato, pronto al movimento)
double m_dStep ; // lunghezza di riferimento per la velocità di simulazione
int m_nUiStatus ; // stato simulazione a livello utente
INTVECTOR m_vOperId ; // vettore identificativi operazioni ordinate per simulazione
int m_nOpId ; // identificativo della operazione (lavoraz.) corrente
int m_nOpInd ; // contatore della operazione (lavoraz.) corrente
int m_nCLPathId ; // identificativo del percorso di lavoro corrente
int m_nCLPathInd ; // contatore del percorso di lavoro corrente nell'operazione
int m_nEntId ; // identificativo dell'entità corrente
int m_nEntInd ; // contatore dell'entità corrente nel percorso di lavoro
double m_dCoeff ; // coefficiente di esecuzione del movimento corrente (0...1)
int m_nChangeTool ; // stato di carico e scarico dell'utensile
int m_nAuxSTot ; // numero totale movimenti ausiliari di inizio percorso
int m_nAuxSInd ; // indice del movimento ausiliario di inizio percorso corrente
int m_nAuxETot ; // numero totale movimenti ausiliari di fine percorso
int m_nAuxEInd ; // indice del movimento ausiliario di fine percorso corrente
std::string m_sTool ; // nome dell'utensile corrente
std::string m_sHead ; // nome della testa corrente
int m_nExit ; // indice dell'uscita corrente
double m_dTDiam ; // diametro dell'utensile corrente
bool m_bCutOnTip ; // flag capacità di lavorare di testa dell'utensile corrente
bool m_bEnableVm ; // flag abilitazione Virtual Milling
INTVECTOR m_VmId ; // vettore identificativi Zmap per Virtual Milling
INTVECTOR m_CdId ; // vettore identificativi Zmap per Collision Detection
VMTVECTOR m_VmTool ; // vettore utensili attivi per virtual milling
COBVECTOR m_CollObj ; // vettore oggetti da testare per collisione con grezzo
double m_dSafeDist ; // distanza di sicurezza per verifica collisioni
INTVECTOR m_nCollMarkId ; // elenco oggetti marcati per visualizzare meglio la collisione rilevata
int m_nAxesMask ; // maschera a bit di abilitazione movimento assi (solo se rapido)
bool m_bEnabAxes ; // flag abilitazione movimento assi attivi
bool m_bShowAxes ; // flag visualizzazione assi attivi
STRVECTOR m_AxesName ; // nomi degli assi macchina attivi
STRVECTOR m_AxesToken ; // token degli assi macchina attivi
BOOLVECTOR m_AxesInvert ; // flag di asse con verso invertito degli assi macchina attivi
DBLVECTOR m_AxesOffset ; // valore di offset delgli assi macchina ttivi
BOOLVECTOR m_AxesLinear ; // flag di lineare degli assi macchina attivi
DBLVECTOR m_AxesVal ; // valori degli assi macchina all'inizio del movimento corrente
STRVECTOR m_AuxAxesName ; // nomi degli assi macchina ausiliari abilitati
STRVECTOR m_AuxAxesToken ; // token degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesInvert ; // flag di asse con verso invertito degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesOffset ; // valore di offset degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesLinear ; // flag di lineare degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesVal ; // valori degli assi macchina ausiliari all'inizio del movimento corrente
DBLVECTOR m_AuxAxesEnd ; // valori degli assi macchina ausiliari alla fine del movimento corrente
INTVECTOR m_AuxAxesLink ; // indice + 1 asse principale di aggancio (negativo valore opposto, 0 nessuno)
CMDVECTOR m_CmdData ; // vettore comandi in attesa di esecuzione
int m_nCmdInd ; // indice prossimo comando da eseguire
double m_dCmdCoeff ; // coefficiente di movimento nel comando
} ;
-198
View File
@@ -1,198 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2024
//----------------------------------------------------------------------------
// File : SimulatorSP.h Data : 16.01.23 Versione : 2.5a2
// Contenuto : Dichiarazione della classe Simulator.
//
//
//
// Modifiche : 19.10.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Simulator.h"
#include "CamData.h"
class IGeomDB ;
class Machine ;
class PerformanceCounter ;
//----------------------------------------------------------------------------
ISimulator* CreateSimulatorSP( void) ;
//----------------------------------------------------------------------------
class SimulatorSP : public ISimulator
{
public :
~SimulatorSP( void) override ;
bool Init( MachMgr* pMchMgr) override ;
bool Start( bool bFirst) override ;
bool Move( int& nStatus) override ;
bool GoHome( void) override ;
bool SetStep( double dStep) override ;
bool SetUiStatus( int nUiStatus) override ;
bool GetAxisInfoPos( int nI, std::string& sName, std::string& sToken, bool& bLinear, double& dVal) const override ;
bool GetToolInfo( std::string& sName, double& dSpeed) const override ;
bool GetOperationInfo( std::string& sName, int& nType) const override ;
bool GetMoveInfo( int& nGmove, double& dFeed) const override ;
bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) override ;
bool RemoveCollisionObj( int nFrameId) override ;
bool GetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) override ;
bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) override ;
bool OnCollision( int nCdInd, int nObjInd, int& nErr) override ;
bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) override ;
bool EnableToolsForVmill( bool bEnable) override ;
bool EnableToolTipTrace( bool bEnable) override ;
int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) override ;
bool SaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) override
{ return false ; }
public :
SimulatorSP( void) ;
private :
bool UpdateTool( bool bFirst, int& nErr) ;
bool UpdateAxes( void) ;
bool UpdateAxesPos( void) ;
bool ResetInterpolation( void) ;
bool ResetAxes( void) ;
bool ResetAuxAxes( void) ;
private :
bool VerifySetup( void) ;
bool FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus) ;
bool ManageOperationEnd( int& nStatus) ;
bool FindAndManagePathStart( int& nStatus) ;
bool ManagePathEnd( int& nStatus) ;
bool ManagePathStartAux( int& nStatus) ;
bool ManagePathEndAux( int& nStatus) ;
bool ManageMove( int& nStatus) ;
bool ManageSingleMove( int& nStatus, double& dMove) ;
int CalcStatusOnError( int nErr) ;
bool GetHeadCurrPosDirAux( const std::string& sHead, int nExit, Point3d& ptH, Vector3d& vtH, Vector3d& vtA) ;
bool ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVmAdOffs,
const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF) ;
bool NeedCollisionCheck( void) const
{ return ( ! m_CollObj.empty() && ! m_CdId.empty()) ; }
bool Stopped( void)
{ return ( m_nUiStatus == MCH_UISIM_STOP) ; }
bool SetCollisionMark( int nCdInd, int nObjInd) ;
bool ResetCollisionMark( void) ;
bool TraceToolTipMove( int nMoveType) ;
bool OnInit( void) ;
bool OnExit( void) ;
bool OnProgramStart( bool bFirst) ;
bool OnProgramEnd( void) ;
bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionEnd( void) ;
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos,
bool bFirst, bool bFloating, int& nErr) ;
bool OnToolDeselect( const std::string& sNextTool, const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos, int& nErr) ;
bool OnMachiningStart( int nOpId, int nOpInd, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax) ;
bool OnMachiningEnd( void) ;
bool OnPathStartAux( int nInd, const std::string& sAS, int& nErr) ;
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
bool OnPathStart( int nClPathId, int nClPathInd, int nDBLPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ;
bool OnPathEnd( int nAE) ;
bool OnMoveStart( const CamData* pCamData, const CamData* pNextCamData, int& nErr) ;
bool OnMoveEnd( int& nErr) ;
bool OnResetMachine( void) ;
private :
struct CollObj {
int nInd ;
bool bToolOn ;
int nFrameId ;
int nType ;
Vector3d vtMove ;
double dPar1 ;
double dPar2 ;
double dPar3 ;
CollObj( void) : nInd( 0), bToolOn( false), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
CollObj( int nI, bool bTOn, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
: nInd( nI), bToolOn( bTOn), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
} ;
typedef std::vector<CollObj> COBVECTOR ;
struct VmTool
{
std::string sName ;
std::string sHead ;
int nExit ;
double dTdOffs ;
double dAdOffs ;
VmTool( void) : nExit( 0), dTdOffs( 0), dAdOffs( 0) {}
VmTool( std::string sN, std::string sH, int nE, double dT, double dA)
: sName( sN), sHead( sH), nExit( nE), dTdOffs( dT), dAdOffs( dA) {}
} ;
typedef std::vector<VmTool> VMTVECTOR ;
enum { SIS_CREATED = 0,
SIS_INITIALIZED = 1,
SIS_READYTOSTART = 2,
SIS_READYTORUN = 3} ;
private :
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
Machine* m_pMachine ; // puntatore alla macchina
PerformanceCounter* m_pPerfCnt ; // timer per calcolo FPS
int m_nStatus ; // stato interno del simulatore (creato, inizializzato, pronto al movimento)
double m_dStep ; // lunghezza di riferimento per la velocità di simulazione
int m_nUiStatus ; // stato simulazione a livello utente
int m_nOpId ; // identificativo della operazione (lavoraz.) corrente
int m_nOpInd ; // contatore della operazione (lavoraz.) corrente
int m_nCLPathId ; // identificativo del percorso di lavoro corrente
int m_nCLPathInd ; // contatore del percorso di lavoro corrente nell'operazione
int m_nEntId ; // identificativo dell'entità corrente
int m_nEntInd ; // contatore dell'entità corrente nel percorso di lavoro
double m_dCoeff ; // coefficiente di esecuzione del movimento corrente (0...1)
int m_nAuxSTot ; // numero totale movimenti ausiliari di inizio percorso
int m_nAuxSInd ; // indice del movimento ausiliario di inizio percorso corrente
int m_nAuxETot ; // numero totale movimenti ausiliari di fine percorso
int m_nAuxEInd ; // indice del movimento ausiliario di fine percorso corrente
std::string m_sTool ; // nome dell'utensile corrente
std::string m_sHead ; // nome della testa corrente
int m_nExit ; // indice dell'uscita corrente
double m_dTDiam ; // diametro dell'utensile corrente
double m_dTLen ; // lunghezza dell'utensile corrente
bool m_bCutOnTip ; // flag capacità di lavorare di testa dell'utensile corrente
bool m_bEnableVm ; // flag abilitazione Virtual Milling
INTVECTOR m_VmId ; // vettore identificativi Zmap per Virtual Milling
INTVECTOR m_CdId ; // vettore identificativi Zmap per Collision Detection
VMTVECTOR m_VmTool ; // vettore utensili attivi per virtual milling
COBVECTOR m_CollObj ; // vettore oggetti da testare per collisione con grezzo
double m_dSafeDist ; // distanza di sicurezza per verifica collisioni
INTVECTOR m_nCollMarkId ; // elenco oggetti marcati per visualizzare meglio la collisione rilevata
bool m_bEnableTrace ; // flag abilitazione tool tip trace
int m_nTraceGroup ; // Id del gruppo in cui si inceriscono le curve di tracciatura
int m_nCurrTrace ; // Id della curva composita corrente di trace
int m_nAxesMask ; // maschera a bit di abilitazione movimento assi (solo se rapido)
bool m_bEnabAxes ; // flag abilitazione movimento assi attivi
bool m_bShowAxes ; // flag visualizzazione assi attivi
STRVECTOR m_AxesName ; // nomi degli assi macchina attivi
STRVECTOR m_AxesToken ; // token degli assi macchina attivi
BOOLVECTOR m_AxesInvert ; // flag di asse con verso invertito degli assi macchina attivi
DBLVECTOR m_AxesOffset ; // valore di offset delgli assi macchina ttivi
BOOLVECTOR m_AxesLinear ; // flag di lineare degli assi macchina attivi
DBLVECTOR m_AxesVal ; // valori degli assi macchina all'inizio del movimento corrente
STRVECTOR m_AuxAxesName ; // nomi degli assi macchina ausiliari abilitati
STRVECTOR m_AuxAxesToken ; // token degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesInvert ; // flag di asse con verso invertito degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesOffset ; // valore di offset degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesLinear ; // flag di lineare degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesVal ; // valori degli assi macchina ausiliari all'inizio del movimento corrente
DBLVECTOR m_AuxAxesEnd ; // valori degli assi macchina ausiliari alla fine del movimento corrente
INTVECTOR m_AuxAxesLink ; // indice + 1 asse principale di aggancio (negativo valore opposto, 0 nessuno)
} ;
+763 -5887
View File
File diff suppressed because it is too large Load Diff
+18 -160
View File
@@ -13,41 +13,14 @@
#pragma once #pragma once
#include "set"
#include "Machining.h" #include "Machining.h"
#include "SurfFinishingData.h" #include "SurfFinishingData.h"
#include "ToolData.h" #include "ToolData.h"
#include "MachiningConst.h" #include "MachiningConst.h"
#include "GeoConst.h"
#include "/EgtDev/Include/EGkCurveComposite.h" #include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EgtNumUtils.h" #include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
class ICAvToolSurfTm ; class ICAvToolSurfTm ;
class ISurfFlatRegion ;
class ISurfTriMesh ;
class ICAvParSilhouettesSurfTm ;
class StmFromTriangleSoup ;
// struttura percorsi da calcolare per finiture ottimizzate
struct PATH {
PtrOwner<ICurveComposite> pCrvPath ;
int nType ;
} ;
// vettore associato
typedef std::vector<PATH> VECTORPATHS ;
// struttura per collisioni per finiture ottimizzate
struct CollisionSfr {
PNTUVVECT CollisionInfo ;
bool bInSpiral ;
bool bInZConst ;
bool bOnBorder ;
} ;
// vettore associato
typedef std::vector<CollisionSfr> VECTORCOLLISIONSFR ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class SurfFinishing : public Machining class SurfFinishing : public Machining
@@ -64,14 +37,8 @@ class SurfFinishing : public Machining
public : // Operation public : // Operation
int GetType( void) const override int GetType( void) const override
{ return OPER_SAWFINISHING ; } { return OPER_SAWFINISHING ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override bool IsEmpty( void) const override
{ if ( m_nPaths == 0) { return ( m_nPaths == 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 bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; } { m_nStatus |= nModif ; return true ; }
@@ -94,139 +61,37 @@ class SurfFinishing : public Machining
bool GetParam( int nType, int& nVal) const override ; bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ; bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ; bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( void) override ; bool UpdateToolData( bool* pbChanged = nullptr) override ;
const ToolData& GetToolData( void) const override ; const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ; bool GetGeometry( SELVECTOR& vIds) const override ;
public : public :
SurfFinishing( void) ; SurfFinishing( void) ;
Frame3d GetFrame() const { return m_Frame ; } ; // spostare in Machining se tutto ok
Frame3d& GetFrame() { return m_Frame ; } ; // spostare in Machining se tutto ok
void SetFrame( const Frame3d& frFinishing) { m_Frame = frFinishing ; } ; // spostare in Machining se tutto ok
private : private :
bool MyApply( bool bRecalc, bool bPostApply) ;
bool VerifyGeometry( SelData Id, int& nSubs) ; bool VerifyGeometry( SelData Id, int& nSubs) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ; bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool Chain( int nGrpDestId) ; bool Chain( int nGrpDestId) ;
bool UpdateFrameAndToolDir( int nAuxId, bool& bRecalc) ; bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool GetSurfacesByIds( SURFLOCALVECTOR& vSrfLoc, SURFLOCALVECTOR& vSrfSuppLoc, Frame3d& frSurf) ; bool AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
bool CalcRegionElevation( const ISurfFlatRegion* pSfr, const Vector3d& vtTool, double dRad, double dLen, double& dElev) const ; const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
bool SetCAvTlStmForSurfaces( ICAvToolSurfTm* pCAvTlStm, const ISurfFlatRegion* pSfrCnt, double dDepth, double dDepth, double dElev) ;
double dToolLen, double dToolDiam, double dToolCornRad, bool CalcZigZag( const ICurveComposite* pOffs, ICRVCOMPOPOVECTOR& vpCrvs) ;
double dToolSideAng, double dToolMaxMat, double dMachOffsR, bool AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
const SURFLOCALVECTOR& vSurfLoc, const SURFLOCALVECTOR& vSurfSuppLoc) ; const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
bool EraseMaxDownSurf( const SURFLOCALVECTOR& vSurfLoc, const Frame3d& frSurf, const Vector3d& vtMove, double dDepth, double dElev, bool bInVsOut) ;
double dDepth, ISurfFlatRegion* pSfrCnt) ; bool CalcSpiral( const ICurveComposite* pCompo, bool bSplitArcs,
bool ProcessCrv( int nPathId, int nPvId, int nClId) ; ICurveComposite* pMCrv, ICurveComposite* pRCrv) ;
bool ProcessSfr( int nPathId, int nPvId, int nClId) ;
bool SimplifyCurve( ICurveComposite* pCompo, const Frame3d& frLocXY,
double dMergeLinTol = 200. * EPS_SMALL, double dMergeAndTolDeg = 200. * EPS_ANG_SMALL,
double dSmallDefLinTol = 150. * EPS_SMALL, double dSmallDefAngTolDeg = 2. * ANG_TOL_STD_DEG,
double dArcApproxLinTol = 50. * EPS_SMALL, double dArcApproxAngTolDeg = ANG_TOL_STD_DEG) const ;
bool CalcZConstProjectedLink( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frPocket,
const Frame3d& frSurf, const Vector3d& vtTool, double dDepth,
const Point3d ptStart_forced, const Point3d ptEnd_forced,
ICurveComposite* pCrv) const ;
// lavorazioni per superfici
bool AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
const Vector3d& vtTool, const Vector3d& vtMove, double dDepth, double dElev, bool bSplitArcs) ;
bool AddOneWay( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
const Vector3d& vtTool, const Vector3d& vtMove, double dDepth, double dElev, bool bSplitArcs) ;
bool AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
const Vector3d& vtTool, const Vector3d& vtMove, double dDepth, double dElev, bool bSplitArcs, bool bInVsOut) ;
bool AddZConst( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
const ISurfFlatRegion* pSfrCnt, const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
bool AddOptimal( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
const ISurfFlatRegion* pSfrCntZigZag, const ISurfFlatRegion* pSfrCntZConst, const Vector3d& vtTool,
const Vector3d& vtMove, double dDepth, double dElev, bool bSplitArcs) ;
bool AddPencil( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
const ISurfFlatRegion* pSfrCnt, const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
// lavorazioni per curve
bool AddProjection( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ICurveComposite* pCompo,
const Vector3d& vtTool, const Vector3d& vtMove, double dDepth, double dElev, bool bSplitArcs) ;
// creazione del percorso finale di lavorazione
bool AddFinishing( const ISurfFlatRegion* pSfrCnt, ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ICRVCOMPOPOVECTOR& vCrvCompo,
const Vector3d& vtTool, const Vector3d& vtMove, double dElev, double dDepth, bool bSplitArcs) ;
// collisione con i percorsi di lavorazione
bool CorrectPathByCollision( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const Vector3d& vtTool, const Vector3d& vtMove,
double dDepth, ICRVCOMPOPOVECTOR& vpCrvs) ;
bool WorkPencilCurves( const ICRVCOMPOPOVECTOR& vCrvCompo, const ISurfFlatRegion* pSfrCnt, int nPencilType, double dOffs, int nOffs,
double dDepth, double dElev, double dLinTol, const Vector3d& vtTool, const SURFLOCALVECTOR& vSrfLoc,
const Frame3d& frSurf, ICAvToolSurfTm* pCAvTlStm, bool bSplitArcs) ;
bool OrderAndConnectPencilCurves( ICRVCOMPOPOVECTOR& vCrvCompo, double dLinkTol) const ;
bool GetOffsetCurvesFromPencilProjection( const ICRVCOMPOPOVECTOR& vCrvCompo, const ISurfFlatRegion* pSfrClass,
double dOffs, int nPencilType, ICRVCOMPOPOVECTOR& vCrvCompoRes) const ;
bool ProjectExposedPencilCurvesOnPlane( ICAvToolSurfTm* pCAvTlStm, const ICRVCOMPOPOVECTOR& vCrvCompo,
const Plane3d& plProj, const Vector3d& vtAxL, const Vector3d& vtMoveL,
double dOffs, double dDepth, ICRVCOMPOPOVECTOR& vCrvCompoProj) const ;
bool ChainPencilCurves( ICRVCOMPOPOVECTOR& vCrvCompo, double dLinTol, bool bAllowInvert = true) const ;
bool GetSurfTriMeshFromOffset( const SURFLOCALVECTOR& vSrfLoc, double dOffs, double dLinTol, ISurfTriMesh* pStmOffs) const ;
bool GetCurvesFromSurfTriMeshesOffset( const ISurfTriMesh * pStmOffs, double dBiTanAng, double dLinTol,
int nOffs, const ISurfFlatRegion* pSfrCnt, ICRVCOMPOPOVECTOR& vCrvCompo ) ;
bool ChooseFinishingForOptimal( const ISurfFlatRegion* pSfr, int nChunk, bool& bSpiral, double& dSideAng) ;
bool OrderOptimalPathsByZLoc( const ISurfFlatRegion* pSfrCntZConst, const ISurfFlatRegion* pSfrCntZigZag, VECTORPATHS& vCrvPaths) const ;
bool GetSfrBySilhouette( ICAvParSilhouettesSurfTm* pCavParSilh, double dDepth, double dSilTolSamp,
double dSilTolLin, double dSilTolAng, ISurfFlatRegion* pSfrSil) ;
bool ApproxSilhouetteClosedPLForOptimal( PolyLine& PL, double dSampleTol, double dMaxLinTol, double dAngTol, double dLinFeaTol, ICurveComposite* pCompoPL) ;
bool SplitStmTrianglesByClippingAngle( const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
const Vector3d& vtTool, double dDepth, double dClippingAngle, double dTolerAngle,
ISURFTMPOVECTOR& vpStm1, ISURFTMPOVECTOR& vpStm2, double& dMaxFrontTriaRad) const ;
bool GetZConstQuotesInsideSfrParallelToTool( const SURFLOCALVECTOR&, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
const Vector3d& vtTool, std::set<double>& setZAmbiguos) const ;
ISurfFlatRegion* GetSfrSilhouette( const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frLvl0, double dDepth) const ;
ISurfFlatRegion* GetSfrProjectedStmLoops( const ISURFTMPOVECTOR& vStm, const ISurfFlatRegion* pSfrContour,
const DBLVECTOR& vdLinFeaTol, const DBLVECTOR& vdAngTol, const DBLVECTOR& vdMaxLinTol) const ;
ISurfTriMesh* SplitStmTriaUnderClippingAngle( const SurfLocal SrfLoc, const Vector3d& vtTest, double dClippingAngle,
double dFrontTriaTolerAng, double& dMaxFrontTriaRad) const ;
bool CalcOptimalZConstCurves( const ISurfFlatRegion* pSfrLoc, const SURFLOCALVECTOR& vSrfLoc,
const Frame3d& frSurf, const Vector3d& vtTool, double dAngDegSplit,
double dAngDegTol, double dDepth, ICAvToolSurfTm* pCAvTlStm, VECTORPATHS& vPaths,
ISurfFlatRegion* pSfrToolColl) const ;
bool CalcOptimalZigZagSfrByZConstCrv( const ISurfFlatRegion* pSfrLoc, const CISURFTMPVECTOR& vpStm, const Vector3d& vtToolLoc,
double dExtraCollOffs, ICurveComposite* pCompoSil, ISurfFlatRegion* pSfrZigZag) const ;
bool CalcOptimalZigZagCurves( ISURFFRPOVECTOR& vSfrZigZagProj, const Frame3d& frSurf,
const Vector3d& vtTool, double dDepth, ICAvToolSurfTm* pCAvTlStm, VECTORPATHS& vPaths) const ;
bool GetOptimalSfr( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfrLoc, const Vector3d& vtTool,
double dDepth, double dElev, ISurfFlatRegion* pSfrSpiral, ISurfFlatRegion* pSfrZConst) const ;
bool CalcZConstSilCrv( ICAvParSilhouettesSurfTm* pCavParSilh, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
const ISurfFlatRegion* pSfrClass, const Vector3d& vtTool, double dDepth, std::vector<ICRVCOMPOPOVECTOR>& vCrvCompo) const ;
bool CreateZConstPaths( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, std::vector<ICRVCOMPOPOVECTOR>& vCrvCompo, const Vector3d& vtTool,
const ISurfFlatRegion* pSfr, double dDepth, ICRVCOMPOPOVECTOR& vCrvPath) const ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ; bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ; bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ; bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ; bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool, const Vector3d& vtNorm, Point3d& ptP1) const ; bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN, Point3d& ptP1) const ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool, bool bSplitArcs) ; bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN) ;
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, const Vector3d& vtNorm, Point3d& ptP1) const ; bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN, Point3d& ptP1) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Point3d& ptP1, const Vector3d& vtTool, bool bSplitArcs) ; bool GetActiveSurfaces( INTVECTOR& vSurfId) const ;
bool GetLastGoodPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtInit, const Vector3d& vtTool, const Vector3d& vtMove, bool bLeadInVsOut, Point3d& ptP1) const ;
bool GetLinkFromPaths( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, const Vector3d& vtMove, const ISurfFlatRegion* pSfrCnt,
double dDepth, double dSafeZ, ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, ICurveComposite* pCrvLink) const ;
bool GetSurfaceNormalAtPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
const Point3d& ptTool, const Vector3d& vtTool, const Vector3d& vtMove, Vector3d& vtNorm) const ;
bool GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) const ;
int ProcessSquare( int nFlag, double dLevel, double dQPt0, double dQpt1, double dQpt2, double dQpt3,
int& nI1s, int& nI1e, int& nI2s, int& nI2e) const ;
Point3d CalcShapedPoint( const PNTUVVECT& myInfoStart, const PNTUVVECT& myInfoEnd, int nType, const Vector3d& vtAxL,
const Vector3d& vtMoveL, double dCosSplitAngle, double dLimInfCosSplitAng,
double dLimSupCosSplitAng, ICAvToolSurfTm* pCAvTlStm, int _nInd_debug) const ;
bool TestSubEdges( std::unordered_map<int, Point3d>& umEdgePnt, const INTVECTOR& vEdgeInd, int nType, int nFirst, int nLast,
const VECTORCOLLISIONSFR& vPntM, int nStepX, const Vector3d vtAxL, const Vector3d& vtMoveL,
double dCosSplitAng, double dLimInfCosSplitAng, double dLimSupCosSplitAng, ICAvToolSurfTm* pCAvTlStm, int _nInd_debug) const ;
bool MarchingSquares( const VECTORCOLLISIONSFR& vPntM, int nType, double dOffsTol, int nStepX, int nStepY, double dClippingAngle,
double dLimInfClippingAng, double dLimSupClippingAng, const Vector3d& vtAxL, const Vector3d& vtMoveL, ICAvToolSurfTm* pCAvTlStm,
ICRVCOMPOPOVECTOR& vCrvCompo) const ;
bool AreSameSfrChunkEpsilon( const ISurfFlatRegion* pSfrChunkA, const ISurfFlatRegion* pSfrChunkB, double dMaxDist) const ;
bool CalcOptimalZigZagRegion( const ISurfFlatRegion* pSfrCntLoc, const ISurfFlatRegion* pSfrZLevelColl, const SURFLOCALVECTOR& vSrfLoc,
const Frame3d& frSurf, const Vector3d& vtTool, double dDepth, double dSplitAngDeg, ISURFFRPOVECTOR& vpSfrZigZagProj) const ;
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ; double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
double GetRadiusForStartEndElevation( void) const ; double GetRadiusForStartEndElevation( void) const ;
double GetLocalSideAngle() const ;
bool GetLocalToolDir( Vector3d& vtToolLoc) const ;
private : private :
double GetSpeed() const double GetSpeed() const
@@ -244,20 +109,13 @@ class SurfFinishing : public Machining
double GetSideStep( void) const double GetSideStep( void) const
{ return Clamp( m_Params.m_dSideStep, 0.1, m_TParams.m_dTDiam) ; } { return Clamp( m_Params.m_dSideStep, 0.1, m_TParams.m_dTDiam) ; }
int GetLeadInType( void) const ;
int GetLeadOutType( void) const ;
private : private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
SurfFinishingData m_Params ; // parametri lavorazione SurfFinishingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile ToolData m_TParams ; // parametri utensile
Frame3d m_Frame ; // terna per orientamento finitura ZigZag/OneWay
double m_dTheta ; // orientamento verticale utensile rispetto a m_Frame
double m_dPhi ; // orientamento orizzontale utesnile rispetto a m_Frame
double m_dTHoldBase ; // posizione base del porta-utensile double m_dTHoldBase ; // posizione base del porta-utensile
double m_dTHoldLen ; // lunghezza del porta-utensile double m_dTHoldLen ; // lunghezza del porta-utensile
double m_dTHoldDiam ; // diametro del porta-utensile double m_dTHoldDiam ; // diametro del porta-utensile
int m_nStatus ; // stato di aggiornamento della lavorazione int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nPaths ; // numero di percorsi di lavoro generati int m_nPaths ; // numero di percorsi di lavoro generati
bool m_bRunning ; // flag di calcoli in corso
} ; } ;
+20 -5
View File
@@ -147,6 +147,7 @@ SurfFinishingData::CopyFrom( const MachiningData* pMdata)
m_nLeadOutType = pSdata->m_nLeadOutType ; m_nLeadOutType = pSdata->m_nLeadOutType ;
m_dLoTang = pSdata->m_dLoTang ; m_dLoTang = pSdata->m_dLoTang ;
m_dLoPerp = pSdata->m_dLoPerp ; m_dLoPerp = pSdata->m_dLoPerp ;
m_nLeadLinkType = pSdata->m_nLeadLinkType ;
m_dApprox = pSdata->m_dApprox ; m_dApprox = pSdata->m_dApprox ;
m_sSysNotes = pSdata->m_sSysNotes ; m_sSysNotes = pSdata->m_sSysNotes ;
m_sUserNotes = pSdata->m_sUserNotes ; m_sUserNotes = pSdata->m_sUserNotes ;
@@ -191,6 +192,7 @@ SurfFinishingData::SameAs(const MachiningData* pMdata) const
m_nLeadOutType == pSdata->m_nLeadOutType && m_nLeadOutType == pSdata->m_nLeadOutType &&
abs( m_dLoTang - pSdata->m_dLoTang) < EPS_MACH_LEN_PAR && abs( m_dLoTang - pSdata->m_dLoTang) < EPS_MACH_LEN_PAR &&
abs( m_dLoPerp - pSdata->m_dLoPerp) < EPS_MACH_LEN_PAR && abs( m_dLoPerp - pSdata->m_dLoPerp) < EPS_MACH_LEN_PAR &&
m_nLeadLinkType == pSdata->m_nLeadLinkType &&
abs( m_dApprox - pSdata->m_dApprox) < EPS_MACH_LEN_PAR && abs( m_dApprox - pSdata->m_dApprox) < EPS_MACH_LEN_PAR &&
m_sSysNotes == pSdata->m_sSysNotes && m_sSysNotes == pSdata->m_sSysNotes &&
m_sUserNotes == pSdata->m_sUserNotes) ; m_sUserNotes == pSdata->m_sUserNotes) ;
@@ -271,7 +273,7 @@ SurfFinishingData::FromString( const string& sString, int& nKey)
bOk = ::FromString( sVal, m_nLeadInType) ; bOk = ::FromString( sVal, m_nLeadInType) ;
break ; break ;
case KEY_LLTY : case KEY_LLTY :
// campo non più usato bOk = ::FromString( sVal, m_nLeadLinkType) ;
break ; break ;
case KEY_LOPR : case KEY_LOPR :
bOk = ::FromString( sVal, m_dLoPerp) ; bOk = ::FromString( sVal, m_dLoPerp) ;
@@ -349,7 +351,7 @@ SurfFinishingData::ToString( int nInd) const
case KEY_LIPR : return ( sSurfFinishingKey[KEY_LIPR] + "=" + ::ToString( m_dLiPerp)) ; case KEY_LIPR : return ( sSurfFinishingKey[KEY_LIPR] + "=" + ::ToString( m_dLiPerp)) ;
case KEY_LITG : return ( sSurfFinishingKey[KEY_LITG] + "=" + ::ToString( m_dLiTang)) ; case KEY_LITG : return ( sSurfFinishingKey[KEY_LITG] + "=" + ::ToString( m_dLiTang)) ;
case KEY_LITY : return ( sSurfFinishingKey[KEY_LITY] + "=" + ::ToString( m_nLeadInType)) ; case KEY_LITY : return ( sSurfFinishingKey[KEY_LITY] + "=" + ::ToString( m_nLeadInType)) ;
case KEY_LLTY : return ( sSurfFinishingKey[KEY_LLTY] + "=" + ::ToString( 0)) ; case KEY_LLTY : return ( sSurfFinishingKey[KEY_LLTY] + "=" + ::ToString( m_nLeadLinkType)) ;
case KEY_LOPR : return ( sSurfFinishingKey[KEY_LOPR] + "=" + ::ToString( m_dLoPerp)) ; case KEY_LOPR : return ( sSurfFinishingKey[KEY_LOPR] + "=" + ::ToString( m_dLoPerp)) ;
case KEY_LOTG : return ( sSurfFinishingKey[KEY_LOTG] + "=" + ::ToString( m_dLoTang)) ; case KEY_LOTG : return ( sSurfFinishingKey[KEY_LOTG] + "=" + ::ToString( m_dLoTang)) ;
case KEY_LOTY : return ( sSurfFinishingKey[KEY_LOTY] + "=" + ::ToString( m_nLeadOutType)) ; case KEY_LOTY : return ( sSurfFinishingKey[KEY_LOTY] + "=" + ::ToString( m_nLeadOutType)) ;
@@ -390,9 +392,7 @@ bool
SurfFinishingData::VerifySubType( int nVal) const SurfFinishingData::VerifySubType( int nVal) const
{ {
return ( nVal == SURFFIN_SUB_ZIGZAG || nVal == SURFFIN_SUB_ONEWAY || return ( nVal == SURFFIN_SUB_ZIGZAG || nVal == SURFFIN_SUB_ONEWAY ||
nVal == SURFFIN_SUB_SPIRALIN || nVal == SURFFIN_SUB_SPIRALOUT || nVal == SURFFIN_SUB_SPIRALIN || nVal == SURFFIN_SUB_SPIRALOUT) ;
nVal == SURFFIN_SUB_Z_CONST || nVal == SURFFIN_SUB_OPTIMAL ||
nVal == SURFFIN_SUB_PROJECT || nVal == SURFFIN_SUB_PENCIL) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -403,6 +403,13 @@ SurfFinishingData::VerifyLeadInType( int nVal) const
nVal == SURFFIN_LI_TANGENT) ; nVal == SURFFIN_LI_TANGENT) ;
} }
//----------------------------------------------------------------------------
bool
SurfFinishingData::VerifyLeadLinkType( int nVal) const
{
return ( nVal == SURFFIN_LL_STD || nVal == SURFFIN_LL_CENT) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
SurfFinishingData::VerifyLeadOutType( int nVal) const SurfFinishingData::VerifyLeadOutType( int nVal) const
@@ -457,6 +464,11 @@ SurfFinishingData::SetParam( int nType, int nVal)
return false ; return false ;
m_nLeadInType = nVal ; m_nLeadInType = nVal ;
return true ; return true ;
case MPA_LEADLINKTYPE :
if ( ! VerifyLeadInType( nVal))
return false ;
m_nLeadLinkType = nVal ;
return true ;
case MPA_LEADOUTTYPE : case MPA_LEADOUTTYPE :
if ( ! VerifyLeadOutType( nVal)) if ( ! VerifyLeadOutType( nVal))
return false ; return false ;
@@ -603,6 +615,9 @@ SurfFinishingData::GetParam( int nType, int& nVal) const
case MPA_LEADINTYPE : case MPA_LEADINTYPE :
nVal = m_nLeadInType ; nVal = m_nLeadInType ;
return true ; return true ;
case MPA_LEADLINKTYPE :
nVal = m_nLeadLinkType ;
return true ;
case MPA_LEADOUTTYPE : case MPA_LEADOUTTYPE :
nVal = m_nLeadOutType ; nVal = m_nLeadOutType ;
return true ; return true ;
+3 -1
View File
@@ -42,6 +42,7 @@ struct SurfFinishingData : public MachiningData
int m_nLeadOutType ; // tipo di uscita (come attacco, nessuno, lineare, tangente, inseguimento) int m_nLeadOutType ; // tipo di uscita (come attacco, nessuno, lineare, tangente, inseguimento)
double m_dLoTang ; // distanza tangente verso fine uscita double m_dLoTang ; // distanza tangente verso fine uscita
double m_dLoPerp ; // distanza perpendicolare verso fine uscita double m_dLoPerp ; // distanza perpendicolare verso fine uscita
int m_nLeadLinkType ; // tipo di collegamento ( centro, fuori)
double m_dApprox ; // valore di approssimazione per superfici double m_dApprox ; // valore di approssimazione per superfici
std::string m_sSysNotes ; // note interne std::string m_sSysNotes ; // note interne
std::string m_sUserNotes ; // note dell'utente std::string m_sUserNotes ; // note dell'utente
@@ -51,7 +52,7 @@ struct SurfFinishingData : public MachiningData
m_dOffsR( UNKNOWN_PAR), m_bInvert( false), m_dOffsR( UNKNOWN_PAR), m_bInvert( false),
m_dStartPos( 0), m_dOverlap(0), m_dSideStep( 0), m_nSubType( 0), m_dSideAngle( 0), m_dStartPos( 0), m_dOverlap(0), m_dSideStep( 0), m_nSubType( 0), m_dSideAngle( 0),
m_nLeadInType( 0), m_dLiTang( 0), m_dLiPerp( 0), m_nLeadInType( 0), m_dLiTang( 0), m_dLiPerp( 0),
m_nLeadOutType( 0), m_dLoTang( 0), m_dLoPerp( 0), m_dApprox( 0) {} m_nLeadOutType( 0), m_dLoTang( 0), m_dLoPerp( 0), m_nLeadLinkType( 0), m_dApprox( 0) {}
SurfFinishingData* Clone( void) const override ; SurfFinishingData* Clone( void) const override ;
bool CopyFrom( const MachiningData* pMdata) override ; bool CopyFrom( const MachiningData* pMdata) override ;
bool SameAs(const MachiningData* pMdata) const override ; bool SameAs(const MachiningData* pMdata) const override ;
@@ -76,6 +77,7 @@ struct SurfFinishingData : public MachiningData
bool VerifySolCh( int nVal) const ; bool VerifySolCh( int nVal) const ;
bool VerifySubType( int nVal) const ; bool VerifySubType( int nVal) const ;
bool VerifyLeadInType( int nVal) const ; bool VerifyLeadInType( int nVal) const ;
bool VerifyLeadLinkType( int nVal) const ;
bool VerifyLeadOutType( int nVal) const ; bool VerifyLeadOutType( int nVal) const ;
} ; } ;
-5030
View File
File diff suppressed because it is too large Load Diff
-293
View File
@@ -1,293 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : SurfRoughing.h Data : 24.05.24 Versione : 2.6e5
// Contenuto : Dichiarazione della classe SurfRoughing.
//
//
//
// Modifiche : 24.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Machining.h"
#include "SurfRoughingData.h"
#include "ToolData.h"
#include "MachiningConst.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkIntersPlaneSurfTm.h"
class ICAvParSilhouettesSurfTm ;
// struttura informazioni sui singoli percorsi
struct PathInfoSR {
bool bOutStart ; // flag per entrata da fuori
bool bSingleCrv ; // se percorso formato da una curva singola ( in generale per SubSteps)
bool bOptTrap ; // flag per casi ottimizzati a trapezio ( per Spiral)
bool bIsZigZagOneWayBorder ; // curve di bordo dei lati chiusi ( per ZigZag e OneWay)
PtrOwner<ICurveComposite> pCrvPath ; // percorso del centro utensile
PtrOwner<ICurveComposite> pCvrRet ; // curva di ritorno per LeadIn/Out a guida
} ;
// tipo percorso
typedef std::vector<PathInfoSR> PATHINFOSRVECTOR ;
// struttura informazioni per Step/SubSteps durante la loro creazione [quindi temporanei]
struct StepInfoSRTmp {
StepInfoSRTmp( void)
: nIndRef( -1), dDepth( 0), bSubStep( false), bPlaneZStep( false), dPercFeed( 0.),
pSfrRemoved( nullptr), pSfrPlaneZ( nullptr) {}
StepInfoSRTmp( int nIR, double dD, bool bSS, bool bPZ, double dPF, ISurfFlatRegion* pSR, ISurfFlatRegion* pSPZ)
: nIndRef( nIR), dDepth( dD), bSubStep( bSS), bPlaneZStep( bPZ), dPercFeed( dPF),
pSfrRemoved( pSR), pSfrPlaneZ( pSPZ) {}
~StepInfoSRTmp() {
delete( pSfrRemoved) ;
delete( pSfrPlaneZ) ;
}
int nIndRef ; // ( usato solo per step intermedi ) posizione step precedente
double dDepth ; // profondità posizione piano di svuotatura ( in negativo)
bool bSubStep ; // flag per indicare se lo Step è un SubStep
bool bPlaneZStep ; // flag per indicare se lo Step è un planeZ
double dPercFeed ; // percentuale degli extra steps relativa agli step base ( per Feed ZLoc)
ISurfFlatRegion* pSfrRemoved ; // regione PROGRESSIVA rimossa attuale
ISurfFlatRegion* pSfrPlaneZ ; // regione individuata da PlaneZDetection
} ;
// vettore associato
typedef std::vector<StepInfoSRTmp> STEPINFOTMPSRVECTOR ;
// struttura per salvataggio Sfr con parametri nel GeomDB
struct SfrGeoDBInfo {
SfrGeoDBInfo( ISurfFlatRegion* pMySfr, ISurfFlatRegion* pMySfrLimit, ISurfFlatRegion* pMySfrRemoved,
bool bMySubSubStep, double dMyDepth, double dMyRelativeDepth, double dMyZLocCoefFeed)
: bSubStep( bMySubSubStep), dDepth( dMyDepth), dRelativeDepth( dMyRelativeDepth), dZLocCoefFeed( dMyZLocCoefFeed) {
pSfr.Set( pMySfr) ;
pSfrLimit.Set( pMySfrLimit) ;
pSfrRemoved.Set( pMySfrRemoved) ;
}
SfrGeoDBInfo()
: bSubStep( true), dDepth( 0.), dRelativeDepth( 0.), dZLocCoefFeed( 1.) {
pSfr.Set( nullptr) ;
pSfrLimit.Set( nullptr) ;
pSfrRemoved.Set( nullptr) ;
}
PtrOwner<ISurfFlatRegion> pSfr ; // superficie di Sgrossatura ( allo step corrente)
PtrOwner<ISurfFlatRegion> pSfrLimit ; // superficie Limite ( allo step corrente)
PtrOwner<ISurfFlatRegion> pSfrRemoved ; // supericie Rimossa ( allo step corrente)
bool bSubStep ; // flag per indicare se Step semplice o meno ( Extra/PlaneZ)
double dDepth ; // profondità
double dRelativeDepth ; // profondità relativa
double dZLocCoefFeed ; // coefficiente di riduzione della Feed complessivo
} ;
// vettore associato
typedef std::vector<SfrGeoDBInfo> SFRGEODBINFOVECTOR ;
// struttura informazioni per Step/SubSteps complessivi
struct StepInfoSR {
double dDepth ; // profondità dello step attuale
double dRelativeDepth ; // profondità relativa allo step al di sopra
double dZlocCoeffFeed ; // coefficiente riduzione Feed lungo Zloc
int nSubType ; // tipo di lavorazione dello Step corrente
bool bIsExtraStep ; // flag per SubStep o PlaneZStep
bool bInverted ; // se percorsi invertiti
PtrOwner<ISurfFlatRegion> pSfrPock ; // regione piana di sgrossatura
PtrOwner<ISurfFlatRegion> pSfrLimit ; // regione piana da non rovinare
PATHINFOSRVECTOR vPaths ; // percorsi di Pocketing
} ;
// vettore associato
typedef std::vector<StepInfoSR> STEPINFOSRVECTOR ;
// planeZ detection <SfrFace, dDepth>
typedef std::pair<PtrOwner<ISurfFlatRegion>, double> PLANEZFACE ;
typedef std::vector<PLANEZFACE> PLANEZFACEVECTOR ;
// posizione reciproca tra Step/SubStep/PlaneZ
enum { DOWN = 0, PLANAR = 1, ABOVE = 2} ;
// struttura per ordinamento mediante ZChunk
struct StepData {
PtrOwner<ISurfFlatRegion> pSfrChunk ; // regione piana di sgrossatura
PtrOwner<ISurfFlatRegion> pSfrLimit ; // regione piana da non rovinare
PtrOwner<ISurfFlatRegion> pSfrRemoved ; // regione piana rimossa alla Depth corrente
bool bIsSubStep ; // Flag per Step base o Extra ( SubStep/PlaneZ)
double dDepth ; // profondità
double dRelativeDepth ; // profondità relativa
double dZLocCoeffFeed ; // coefficiente di riduzione della Feed
} ;
// vettore di StepData
typedef std::vector<StepData> STEPDATAVECTOR ;
// Matrice di StepData
typedef std::vector<STEPDATAVECTOR> STEPDATAMATRIX ;
// ordine <Ind, ZMin, ZMax>
typedef std::pair<int, std::pair<double, double>> INTDBLDBL ;
// vettore associato
typedef std::vector<INTDBLDBL> INTDBLDBLVECTOR ;
//----------------------------------------------------------------------------
class SurfRoughing : public Machining
{
public : // IUserObj
SurfRoughing* 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_SURFROUGHING ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nPaths == 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
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ;
public : // Machining
bool Prepare( const std::string& sSawName) override ;
bool SetParam( int nType, bool bVal) override ;
bool SetParam( int nType, int nVal) override ;
bool SetParam( int nType, double dVal) override ;
bool SetParam( int nType, const std::string& sVal) override ;
bool SetGeometry( const SELVECTOR& vIds) override ;
bool Preview( bool bRecalc) override ;
bool Apply( bool bRecalc, bool bPostApply) override ;
bool Update( bool bPostApply) override ;
bool GetParam( int nType, bool& bVal) const override ;
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
public :
SurfRoughing( void) ;
private :
bool MyApply( bool bRecalc, bool bPostApply) ;
bool VerifyGeometry( SelData Id, int& nSubs) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool Chain( int nGrpDestId) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool DetectPlaneZ( const CISURFTMPVECTOR& vpStm, const Frame3d& frCompo, const Vector3d& vtTool, PLANEZFACEVECTOR& vPlaneZ,
double dMinDepth, double dMaxDepth) const ;
bool CalcPaths( const INTINTVECTOR& vPocket, STEPINFOSRVECTOR& vStepInfo) const ;
bool OrderByZChunk( SFRGEODBINFOVECTOR& vInfoSfrGeomDB, int nTempInd, const ISurfFlatRegion* pSfrSgro) const ;
bool OrderZChunkSteps( STEPDATAMATRIX& vvDataSteps, STEPDATAMATRIX& vIndepChunkGroup,
INTDBLDBLVECTOR& vMapGrpZLoc) const ;
bool GetLinkFromPaths( STEPINFOSRVECTOR& vStepInfo, int i, int j, const Point3d& ptStart,
const Vector3d& vtTool, double dSafeZ, double dExtraElev, double& dEndElev,
ICurveComposite* pCrvLink) const ;
bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dLen, double& dElev) const ;
bool AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool, double dElev, double dStep,
double dSubStep, bool bSplitArcs) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr, bool bOutStart, bool bAbsFirst) ;
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr, bool bOutMove) ;
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtTool, const ICurveComposite* pCrvPath, Point3d& ptP1) const ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
const ISurfFlatRegion* pSfr, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
bool bNoneForced, bool bSkipControl) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1) ;
ISurfTriMesh* GetRaw( void) const ;
ISurfTriMesh* GetStmOutSideSfr( const ISurfFlatRegion* pSfr, double dDepth, const ISurfTriMesh* pStmRaw, const Vector3d& vtExtr) const ;
ISurfFlatRegion* GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs = 0) const ;
ISurfFlatRegion* GetSfrSilhouette( ICAvParSilhouettesSurfTm* pCavParSilh, double dDepth, double Sil_tol, bool& bOk) const ;
ISurfFlatRegion* GetSfrCornerColl( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pSfrLimit,
const ISurfFlatRegion* pSfrColl, const ISurfFlatRegion* pSfrSearchCorners) const ;
bool GetToolCollisionRegion( const ISurfFlatRegion* pSfrSgro, double& dDepth, ISurfFlatRegion* pSfrColl,
ISurfFlatRegion* pSfrSearchCorners) const ;
bool GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) const ;
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
double GetRightStartFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
double GetRadiusForStartEndElevation( void) const ;
bool ResetCurveAllTempProp( ICurve* pCurve) const ;
bool RemoveChunksUnderTolerance( ISurfFlatRegion* pSfr, double dTol, ISurfFlatRegion* pSfrLimit,
ISurfFlatRegion* pSfrToUpdate = nullptr) const ;
bool CloseOpenEdgesUnderTolerance( ISurfFlatRegion* pSfr, double dToler) ;
bool ModifySurfForOpenCloseEdges( ISurfFlatRegion* pSfr, const Vector3d& vtTool, const ICurveComposite* pCrvCompo) const ;
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pSfrRef) const ;
bool SimplifyCurve( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvCheck, const Frame3d& frLocXY) const ;
bool SimplyfySfr( ISurfFlatRegion* pSfr) const ;
bool CheckSafetyLinearLink( const Point3d& ptCurr, const Point3d& ptDest, const ISurfFlatRegion* pSfrCheck, const Vector3d& vtTool,
bool& bSafe) const ;
bool GetHomogeneousParts( const ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) const ;
bool VerifyLeadInHelix( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptCen, double dHelixRad) const ;
bool VerifyLeadInZigZag( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptPa, const Point3d& ptPb) const ;
private :
double GetSpeed() const
{ return ( IsNullAngValue( m_Params.m_dSpeed) ? m_TParams.m_dSpeed : m_Params.m_dSpeed) ; }
double GetFeed() const
{ return ( IsNullLenValue( m_Params.m_dFeed) ? m_TParams.m_dFeed : m_Params.m_dFeed) ; }
double GetAdaptedCoeffFeed( bool bExtraStep, double dDepth, double dStep) const
{ if ( ! bExtraStep || dStep < 10 * EPS_SMALL)
return 1. ;
return ( 1. + ( - dDepth / dStep) - std::floor( - dDepth / dStep)) ; } ;
double GetStartFeed() const
{ return ( IsNullLenValue( m_Params.m_dStartFeed) ? m_TParams.m_dStartFeed : m_Params.m_dStartFeed) ; }
double GetEndFeed() const
{ return ( IsNullLenValue( m_Params.m_dEndFeed) ? m_TParams.m_dEndFeed : m_Params.m_dEndFeed) ; }
double GetTipFeed() const
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
double GetOffsR() const
{ double dCurrOffsR = IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR ;
return std::max( 0.1, dCurrOffsR) ; }
double GetOffsL() const
{ return ( IsUnknownValue( m_Params.m_dOffsL) ? m_TParams.m_dOffsL : m_Params.m_dOffsL) ; }
double GetSideStep( void) const
{ return Clamp( m_Params.m_dSideStep, 0.1, m_TParams.m_dTDiam) ; }
int GetLeadInType( void) const
{ if ( m_Params.m_dLiTang < std::min( 0.1 * m_TParams.m_dDiam, 1.0))
return SURFROU_LI_NONE ;
if ( m_Params.m_nLeadInType != SURFROU_LI_GLIDE && m_Params.m_dLiElev < 10 * EPS_SMALL)
return SURFROU_LI_NONE ;
return m_Params.m_nLeadInType ; }
bool LeadInRawIsOk( void) const
{ if ( m_TParams.m_nType != TT_MILL_NOTIP)
return true ;
return (( GetLeadInType() == SURFROU_LI_ZIGZAG || GetLeadInType() == SURFROU_LI_HELIX) &&
m_Params.m_dLiTang >= 0.9 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
int GetLeadOutType( void) const
{ if ( m_Params.m_dLoTang < std::min( 0.1 * m_TParams.m_dDiam, 1.0))
return SURFROU_LO_NONE ;
return m_Params.m_nLeadOutType ; }
/* debug functions */
void DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf, Color Col, bool bAlphaCoverage, std::string sName) const ;
void DrawFeed( const ICurve* pCrv, double dFeed, int nLay) const ;
void DrawNormalShaderSurfTm( const ISurfTriMesh* pStm, std::string sName) const ;
/* end debug functions */
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
SurfRoughingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
double m_dTHoldBase ; // posizione base del porta-utensile
double m_dTHoldLen ; // lunghezza del porta-utensile
double m_dTHoldDiam ; // diametro del porta-utensile
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nPaths ; // numero di percorsi di lavoro generati
double m_dMaxHelixRad ; // raggio massimo attacco ad elica nel caso di cerchi
double m_dStepToler ; // tolleranza di rimozione chunk per Steps
double m_dSubStepToler ; // tolleranza di rimozione chunk per SubSteps
bool m_bDetectPlaneZ ; // flag per calcolo piani in Zloc di Pocketing
bool m_bOrderZ ; // flag per ordinamento Chunks secondo vtTool
bool m_bRunning ; // flag di calcoli in corso
} ;
-727
View File
@@ -1,727 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : SurfRoughingData.cpp Data : 24.05.24 Versione : 2.6e5
// Contenuto : Implementazione struttura dati lavorazione sgrossatura superfici.
//
//
//
// Modifiche : 24.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "SurfRoughingData.h"
#include "MachiningDataFactory.h"
#include "MachiningConst.h"
#include "/EgtDev/Include/EmkToolConst.h"
#include "/EgtDev/Include/EmkSimuGenConst.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include <array>
#include <cassert>
using namespace std ;
//----------------------------------------------------------------------------
enum nSurfRoughingKey {
KEY_AB = 0,
KEY_AI,
KEY_APPR,
KEY_DH,
KEY_F,
KEY_FE,
KEY_FS,
KEY_FT,
KEY_INV,
KEY_LIEL,
KEY_LITG,
KEY_LITY,
KEY_LOTG,
KEY_LOTY,
KEY_NAME,
KEY_NNS,
KEY_NNU,
KEY_OL,
KEY_OR,
KEY_OVL,
KEY_PS,
KEY_S,
KEY_SA,
KEY_SCC,
KEY_SS,
KEY_SST,
KEY_ST,
KEY_SUBTYPE,
KEY_TNAME,
KEY_TUUID,
KEY_UUID,
KEY_ZZZ} ; // rappresenta il numero di elementi
static const array<string,KEY_ZZZ> sSurfRoughingKey = {
"AB",
"AI",
"APPR",
"DH",
"F",
"FE",
"FS",
"FT",
"INV",
"LIEL",
"LITG",
"LITY",
"LOTG",
"LOTY",
"NAME",
"NNS",
"NNU",
"OL",
"OR",
"OVL",
"PS",
"S",
"SA",
"SCC",
"SS",
"SST",
"ST",
"SUB",
"TN",
"TU",
"UUID"} ;
//----------------------------------------------------------------------------
MCHDATA_REGISTER( MT_SURFROUGHING, "SURFROUGHING", SurfRoughingData) ;
//----------------------------------------------------------------------------
SurfRoughingData*
SurfRoughingData::Clone( void) const
{
// alloco oggetto
SurfRoughingData* pMdata = new(nothrow) SurfRoughingData ;
// copio i dati
if ( pMdata != nullptr) {
if ( ! pMdata->CopyFrom( this)) {
delete pMdata ;
return nullptr ;
}
}
return pMdata ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::CopyFrom( const MachiningData* pMdata)
{
// è inutile copiare se sorgente coincide con destinazione
if ( pMdata == this)
return true ;
// la sorgente deve essere dello stesso tipo
const SurfRoughingData* pSdata = GetSurfRoughingData( pMdata) ;
if ( pSdata == nullptr)
return false ;
// eseguo copia
m_Uuid = pSdata->m_Uuid ;
m_sName = pSdata->m_sName ;
m_ToolUuid = pSdata->m_ToolUuid ;
m_sToolName = pSdata->m_sToolName ;
m_sBlockedAxis = pSdata->m_sBlockedAxis ;
m_sInitAngs = pSdata->m_sInitAngs ;
m_nSolCh = pSdata->m_nSolCh ;
m_dSpeed = pSdata->m_dSpeed ;
m_dFeed = pSdata->m_dFeed ;
m_dEndFeed = pSdata->m_dEndFeed ;
m_dStartFeed = pSdata->m_dStartFeed ;
m_dTipFeed = pSdata->m_dTipFeed ;
m_dOffsR = pSdata->m_dOffsR ;
m_dOffsL = pSdata->m_dOffsL ;
m_bInvert = pSdata->m_bInvert ;
m_sDepth = pSdata->m_sDepth ;
m_dStartPos = pSdata->m_dStartPos ;
m_dOverlap = pSdata->m_dOverlap ;
m_dStep = pSdata->m_dStep ;
m_dSubStep = pSdata->m_dSubStep ;
m_dSideStep = pSdata->m_dSideStep ;
m_nSubType = pSdata->m_nSubType ;
m_dSideAngle = pSdata->m_dSideAngle ;
m_nLeadInType = pSdata->m_nLeadInType ;
m_dLiElev = pSdata->m_dLiElev ;
m_dLiTang = pSdata->m_dLiTang ;
m_nLeadOutType = pSdata->m_nLeadOutType ;
m_dLoTang = pSdata->m_dLoTang ;
m_dApprox = pSdata->m_dApprox ;
m_sSysNotes = pSdata->m_sSysNotes ;
m_sUserNotes = pSdata->m_sUserNotes ;
return true ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::SameAs(const MachiningData* pMdata) const
{
// se coincide con altro -> uguali
if ( pMdata == this)
return true ;
// se sono di tipo diverso -> diversi
const SurfRoughingData* pSdata = GetSurfRoughingData( pMdata) ;
if ( pSdata == nullptr)
return false ;
// confronto termine a termine
return ( m_Uuid == pSdata->m_Uuid &&
m_sName == pSdata->m_sName &&
m_ToolUuid == pSdata->m_ToolUuid &&
m_sToolName == pSdata->m_sToolName &&
m_sBlockedAxis == pSdata->m_sBlockedAxis &&
m_sInitAngs == pSdata->m_sInitAngs &&
m_nSolCh == pSdata->m_nSolCh &&
abs( m_dSpeed - pSdata->m_dSpeed) < EPS_MACH_ANG_PAR &&
abs( m_dFeed - pSdata->m_dFeed) < EPS_MACH_LEN_PAR &&
abs( m_dEndFeed - pSdata->m_dEndFeed) < EPS_MACH_LEN_PAR &&
abs( m_dStartFeed - pSdata->m_dStartFeed) < EPS_MACH_LEN_PAR &&
abs( m_dTipFeed - pSdata->m_dTipFeed) < EPS_MACH_LEN_PAR &&
abs( m_dOffsR - pSdata->m_dOffsR) < EPS_MACH_LEN_PAR &&
abs( m_dOffsL - pSdata->m_dOffsL) < EPS_MACH_LEN_PAR &&
m_bInvert == pSdata->m_bInvert &&
m_sDepth == pSdata->m_sDepth &&
abs( m_dStartPos - pSdata->m_dStartPos) < EPS_MACH_LEN_PAR &&
abs( m_dOverlap - pSdata->m_dOverlap) < EPS_MACH_LEN_PAR &&
abs( m_dStep - pSdata->m_dStep) < EPS_MACH_LEN_PAR &&
abs( m_dSubStep - pSdata->m_dSubStep) < EPS_MACH_LEN_PAR &&
abs( m_dSideStep - pSdata->m_dSideStep) < EPS_MACH_LEN_PAR &&
m_nSubType == pSdata->m_nSubType &&
abs( m_dSideAngle - pSdata->m_dSideAngle) < EPS_MACH_ANG_PAR &&
m_nLeadInType == pSdata->m_nLeadInType &&
abs( m_dLiElev - pSdata->m_dLiElev) < EPS_MACH_LEN_PAR &&
abs( m_dLiTang - pSdata->m_dLiTang) < EPS_MACH_LEN_PAR &&
m_nLeadOutType == pSdata->m_nLeadOutType &&
abs( m_dLoTang - pSdata->m_dLoTang) < EPS_MACH_LEN_PAR &&
abs( m_dApprox - pSdata->m_dApprox) < EPS_MACH_LEN_PAR &&
m_sSysNotes == pSdata->m_sSysNotes &&
m_sUserNotes == pSdata->m_sUserNotes) ;
}
//----------------------------------------------------------------------------
int
SurfRoughingData::GetSize( void) const
{
// in debug verifico validità ultimo campo
assert( sSurfRoughingKey[KEY_UUID] == "UUID") ;
return KEY_ZZZ ;
}
//----------------------------------------------------------------------------
string
SurfRoughingData::GetTitle( void) const
{
return MCHDATA_GETNAME( SurfRoughingData) ;
}
//----------------------------------------------------------------------------
int
FindSurfRoughingKey( const string& sKey)
{
auto TheRange = equal_range( sSurfRoughingKey.cbegin(), sSurfRoughingKey.cend(), sKey) ;
if ( TheRange.first == TheRange.second)
return -1 ;
return int( TheRange.first - sSurfRoughingKey.cbegin()) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::FromString( const string& sString, int& nKey)
{
// separo chiave da valore
string sKey, sVal ;
SplitFirst( sString, "=", sKey, sVal) ;
// riconosco la chiave
nKey = FindSurfRoughingKey( ToUpper( sKey)) ;
bool bOk = ( nKey >= 0) ;
switch ( nKey) {
case KEY_AB :
m_sBlockedAxis = sVal ;
break ;
case KEY_AI :
m_sInitAngs = sVal ;
break ;
case KEY_APPR :
bOk = ::FromString( sVal, m_dApprox) ;
break ;
case KEY_DH :
m_sDepth = sVal ;
if ( m_sDepth.empty())
m_sDepth = "0" ;
break ;
case KEY_F :
bOk = ::FromString( sVal, m_dFeed) ;
break ;
case KEY_FE :
bOk = ::FromString( sVal, m_dEndFeed) ;
break ;
case KEY_FS :
bOk = ::FromString( sVal, m_dStartFeed) ;
break ;
case KEY_FT :
bOk = ::FromString( sVal, m_dTipFeed) ;
break ;
case KEY_INV :
bOk = ::FromString( sVal, m_bInvert) ;
break ;
case KEY_LIEL :
bOk = ::FromString( sVal, m_dLiElev) ;
break ;
case KEY_LITG :
bOk = ::FromString( sVal, m_dLiTang) ;
break ;
case KEY_LITY :
bOk = ::FromString( sVal, m_nLeadInType) ;
break ;
case KEY_LOTG :
bOk = ::FromString( sVal, m_dLoTang) ;
break ;
case KEY_LOTY :
bOk = ::FromString( sVal, m_nLeadOutType) ;
break ;
case KEY_NAME :
m_sName = sVal ;
bOk = ! m_sName.empty() ;
break ;
case KEY_NNS :
m_sSysNotes = sVal ;
break ;
case KEY_NNU :
m_sUserNotes = sVal ;
break ;
case KEY_OR :
bOk = ::FromString( sVal, m_dOffsR) ;
break ;
case KEY_OL :
bOk = ::FromString( sVal, m_dOffsL) ;
break ;
case KEY_OVL :
bOk = ::FromString( sVal, m_dOverlap) ;
break ;
case KEY_PS :
bOk = ::FromString( sVal, m_dStartPos) ;
break ;
case KEY_S :
bOk = ::FromString( sVal, m_dSpeed) ;
break ;
case KEY_SA :
bOk = ::FromString( sVal, m_dSideAngle) ;
break ;
case KEY_SCC :
bOk = ::FromString( sVal, m_nSolCh) ;
break ;
case KEY_SST :
bOk = ::FromString( sVal, m_dSubStep) ;
break ;
case KEY_SS :
bOk = ::FromString( sVal, m_dSideStep) ;
break ;
case KEY_ST :
bOk = ::FromString( sVal, m_dStep) ;
break ;
case KEY_SUBTYPE :
bOk = ::FromString( sVal, m_nSubType) ;
break ;
case KEY_TNAME :
m_sToolName = sVal ;
break ;
case KEY_TUUID :
bOk = ::FromString( sVal, m_ToolUuid) ;
break ;
case KEY_UUID :
bOk = ::FromString( sVal, m_Uuid) ;
break ;
default :
bOk = false ;
break ;
}
return bOk ;
}
//----------------------------------------------------------------------------
string
SurfRoughingData::ToString( int nInd) const
{
switch ( nInd) {
case KEY_AB : return ( sSurfRoughingKey[KEY_AB] + "=" + m_sBlockedAxis) ;
case KEY_AI : return ( sSurfRoughingKey[KEY_AI] + "=" + m_sInitAngs) ;
case KEY_APPR : return ( sSurfRoughingKey[KEY_APPR] + "=" + ::ToString(m_dApprox)) ;
case KEY_DH : return ( sSurfRoughingKey[KEY_DH] + "=" + m_sDepth) ;
case KEY_F : return ( sSurfRoughingKey[KEY_F] + "=" + ::ToString( m_dFeed)) ;
case KEY_FE : return ( sSurfRoughingKey[KEY_FE] + "=" + ::ToString( m_dEndFeed)) ;
case KEY_FS : return ( sSurfRoughingKey[KEY_FS] + "=" + ::ToString( m_dStartFeed)) ;
case KEY_FT : return ( sSurfRoughingKey[KEY_FT] + "=" + ::ToString( m_dTipFeed)) ;
case KEY_INV : return ( sSurfRoughingKey[KEY_INV] + "=" + ::ToString( m_bInvert)) ;
case KEY_LIEL : return ( sSurfRoughingKey[KEY_LIEL] + "=" + ::ToString( m_dLiElev)) ;
case KEY_LITG : return ( sSurfRoughingKey[KEY_LITG] + "=" + ::ToString( m_dLiTang)) ;
case KEY_LITY : return ( sSurfRoughingKey[KEY_LITY] + "=" + ::ToString( m_nLeadInType)) ;
case KEY_LOTG : return ( sSurfRoughingKey[KEY_LOTG] + "=" + ::ToString( m_dLoTang)) ;
case KEY_LOTY : return ( sSurfRoughingKey[KEY_LOTY] + "=" + ::ToString( m_nLeadOutType)) ;
case KEY_NAME : return ( sSurfRoughingKey[KEY_NAME] + "=" + m_sName) ;
case KEY_NNS : return ( sSurfRoughingKey[KEY_NNS] + "=" + m_sSysNotes) ;
case KEY_NNU : return ( sSurfRoughingKey[KEY_NNU] + "=" + m_sUserNotes) ;
case KEY_OL : return ( sSurfRoughingKey[KEY_OL] + "=" + ::ToString( m_dOffsL)) ;
case KEY_OR : return ( sSurfRoughingKey[KEY_OR] + "=" + ::ToString( m_dOffsR)) ;
case KEY_OVL : return ( sSurfRoughingKey[KEY_OVL] + "=" + ::ToString( m_dOverlap)) ;
case KEY_PS : return ( sSurfRoughingKey[KEY_PS] + "=" + ::ToString( m_dStartPos)) ;
case KEY_S : return ( sSurfRoughingKey[KEY_S] + "=" + ::ToString( m_dSpeed)) ;
case KEY_SA : return ( sSurfRoughingKey[KEY_SA] + "=" + ::ToString( m_dSideAngle)) ;
case KEY_SCC : return ( sSurfRoughingKey[KEY_SCC] + "=" + ::ToString( m_nSolCh)) ;
case KEY_SST : return ( sSurfRoughingKey[KEY_SST] + "=" + ::ToString( m_dSubStep)) ;
case KEY_SS : return ( sSurfRoughingKey[KEY_SS] + "=" + ::ToString( m_dSideStep)) ;
case KEY_ST : return ( sSurfRoughingKey[KEY_ST] + "=" + ::ToString( m_dStep)) ;
case KEY_SUBTYPE : return ( sSurfRoughingKey[KEY_SUBTYPE] + "=" + ::ToString( m_nSubType)) ;
case KEY_TNAME : return ( sSurfRoughingKey[KEY_TNAME] + "=" + m_sToolName) ;
case KEY_TUUID : return ( sSurfRoughingKey[KEY_TUUID] + "=" + ::ToString( m_ToolUuid)) ;
case KEY_UUID : return ( sSurfRoughingKey[KEY_UUID] + "=" + ::ToString( m_Uuid)) ;
default : return "" ;
}
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::IsOptional( int nKey) const
{
return ( nKey == KEY_LIEL || nKey == KEY_SST || nKey == KEY_OVL) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::VerifySolCh( int nVal) const
{
return IsValidOperationScc( nVal) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::VerifySubType( int nVal) const
{
return ( nVal == SURFROU_SUB_ZIGZAG || nVal == SURFROU_SUB_ONEWAY ||
nVal == SURFROU_SUB_SPIRALIN || nVal == SURFROU_SUB_SPIRALOUT ||
nVal == SURFROU_SUB_CONFORMAL_ZIGZAG || nVal == SURFROU_SUB_CONFORMAL_ONEWAY) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::VerifyLeadInType( int nVal) const
{
return ( nVal == SURFROU_LI_NONE || nVal == SURFROU_LI_GLIDE ||
nVal == SURFROU_LI_ZIGZAG || nVal == SURFROU_LI_HELIX) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::VerifyLeadOutType( int nVal) const
{
return ( nVal == SURFROU_LO_NONE || nVal == SURFROU_LO_GLIDE) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::VerifyTool( const ToolsMgr* pToolsMgr, const string& sVal, const ToolData*& pTdata) const
{
if ( pToolsMgr == nullptr)
return false ;
pTdata = pToolsMgr->GetTool( sVal) ;
if ( pTdata == nullptr)
return false ;
if ( ( pTdata->m_nType & TF_MILL) == 0)
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const
{
if ( pToolsMgr == nullptr)
return false ;
pTdata = pToolsMgr->GetTool( m_ToolUuid) ;
return ( pTdata != nullptr) ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::SetParam( int nType, bool bVal)
{
switch ( nType) {
case MPA_INVERT :
m_bInvert = bVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::SetParam( int nType, int nVal)
{
switch ( nType) {
case MPA_LEADINTYPE :
if ( ! VerifyLeadInType( nVal))
return false ;
m_nLeadInType = nVal ;
return true ;
case MPA_LEADOUTTYPE :
if ( ! VerifyLeadOutType( nVal))
return false ;
m_nLeadOutType = nVal ;
return true ;
case MPA_SCC :
if ( ! VerifySolCh( nVal))
return false ;
m_nSolCh = nVal ;
return true ;
case MPA_SUBTYPE :
if ( ! VerifySubType( nVal))
return false ;
m_nSubType = nVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::SetParam( int nType, double dVal)
{
switch ( nType) {
case MPA_SPEED :
m_dSpeed = dVal ;
return true ;
case MPA_FEED :
m_dFeed = dVal ;
return true ;
case MPA_STARTFEED :
m_dStartFeed = dVal ;
return true ;
case MPA_ENDFEED :
m_dEndFeed = dVal ;
return true ;
case MPA_TIPFEED :
m_dTipFeed = dVal ;
return true ;
case MPA_OFFSR :
m_dOffsR = dVal ;
return true ;
case MPA_OFFSL :
m_dOffsL = dVal ;
return true ;
case MPA_OVERL :
m_dOverlap = dVal ;
return true ;
case MPA_DEPTH :
m_sDepth = ::ToString( dVal) ;
return true ;
case MPA_STARTPOS :
m_dStartPos = dVal ;
return true ;
case MPA_STEP :
m_dStep = dVal ;
return true ;
case MPA_SUBSTEP :
m_dSubStep = dVal ;
return true ;
case MPA_SIDESTEP :
m_dSideStep = dVal ;
return true ;
case MPA_SIDEANGLE :
m_dSideAngle = dVal ;
return true ;
case MPA_LIELEV :
m_dLiElev = dVal ;
return true ;
case MPA_LITANG :
m_dLiTang = dVal ;
return true ;
case MPA_LOTANG :
m_dLoTang = dVal ;
return true ;
case MPA_APPROX :
m_dApprox = dVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::SetParam( int nType, const string& sVal)
{
switch ( nType) {
case MPA_NAME :
m_sName = sVal ;
return true ;
case MPA_TOOL :
m_sToolName = sVal ;
return true ;
case MPA_DEPTH_STR :
m_sDepth = sVal ;
return true ;
case MPA_TUUID :
return ::FromString( sVal, m_ToolUuid) ;
case MPA_UUID :
return ::FromString( sVal, m_Uuid) ;
case MPA_SYSNOTES :
m_sSysNotes = sVal ;
return true ;
case MPA_USERNOTES :
m_sUserNotes = sVal ;
return true ;
case MPA_INITANGS :
m_sInitAngs = sVal ;
return true ;
case MPA_BLOCKEDAXIS :
m_sBlockedAxis = sVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::ResetTool( void)
{
m_sToolName.clear() ;
m_ToolUuid.Clear() ;
return true ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::GetParam( int nType, bool& bVal) const
{
switch ( nType) {
case MPA_INVERT :
bVal = m_bInvert ;
return true ;
}
bVal = false ;
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::GetParam( int nType, int& nVal) const
{
switch ( nType) {
case MPA_TYPE :
nVal = MT_SURFROUGHING ;
return true ;
case MPA_SUBTYPE :
nVal = m_nSubType ;
return true ;
case MPA_LEADINTYPE :
nVal = m_nLeadInType ;
return true ;
case MPA_LEADOUTTYPE :
nVal = m_nLeadOutType ;
return true ;
case MPA_SCC :
nVal = m_nSolCh ;
return true ;
}
nVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::GetParam( int nType, double& dVal) const
{
switch ( nType) {
case MPA_SPEED :
dVal = m_dSpeed ;
return true ;
case MPA_FEED :
dVal = m_dFeed ;
return true ;
case MPA_STARTFEED :
dVal = m_dStartFeed ;
return true ;
case MPA_ENDFEED :
dVal = m_dEndFeed ;
return true ;
case MPA_TIPFEED :
dVal = m_dTipFeed ;
return true ;
case MPA_OFFSR :
dVal = m_dOffsR ;
return true ;
case MPA_OFFSL :
dVal = m_dOffsL ;
return true ;
case MPA_OVERL :
dVal = m_dOverlap ;
return true ;
case MPA_STARTPOS :
dVal = m_dStartPos ;
return true ;
case MPA_STEP :
dVal = m_dStep ;
return true ;
case MPA_SUBSTEP :
dVal = m_dSubStep ;
return true ;
case MPA_SIDESTEP :
dVal = m_dSideStep ;
return true ;
case MPA_SIDEANGLE :
dVal = m_dSideAngle ;
return true ;
case MPA_LIELEV :
dVal = m_dLiElev ;
return true ;
case MPA_LITANG :
dVal = m_dLiTang ;
return true ;
case MPA_LOTANG :
dVal = m_dLoTang ;
return true ;
case MPA_APPROX :
dVal = m_dApprox ;
return true ;
}
dVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
SurfRoughingData::GetParam( int nType, string& sVal) const
{
switch ( nType) {
case MPA_NAME :
sVal = m_sName ;
return true ;
case MPA_TOOL :
sVal = m_sToolName ;
return true ;
case MPA_DEPTH_STR :
sVal = m_sDepth ;
return true ;
case MPA_TUUID :
sVal = ::ToString( m_ToolUuid) ;
return true ;
case MPA_UUID :
sVal = ::ToString( m_Uuid) ;
return true ;
case MPA_SYSNOTES :
sVal = m_sSysNotes ;
return true ;
case MPA_USERNOTES :
sVal = m_sUserNotes ;
return true ;
case MPA_INITANGS :
sVal = m_sInitAngs ;
return true ;
case MPA_BLOCKEDAXIS :
sVal = m_sBlockedAxis ;
return true ;
}
sVal = "" ;
return false ;
}
-93
View File
@@ -1,93 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : SurfRoughingData.h Data : 24.05.24 Versione : 2.6e5
// Contenuto : Dichiarazione della struct SurfRoughingData e costanti associate.
//
//
//
// Modifiche : 24.05.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "MachiningData.h"
//----------------------------------------------------------------------------
struct SurfRoughingData : public MachiningData
{
EgtUUID m_ToolUuid ; // identificativo universale dell'utensile
std::string m_sToolName ; // nome dell'utensile
std::string m_sInitAngs ; // angoli iniziali suggeriti (Nome1=val1,Nome2=val2)
std::string m_sBlockedAxis ; // eventuale asse rotante bloccato (Nome=val)
int m_nSolCh ; // criterio scelta soluzione (quando possibili molteplici)
double m_dSpeed ; // velocità di rotazione (+ se CCW, - se CW) ( se 0 da utensile)
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
double m_dTipFeed ; // velocità di lavorazione di testa ( se 0 da utensile)
double m_dOffsR ; // offset radiale ( se UNKNOWN_PAR da utensile)
double m_dOffsL ; // offset longitudinale ( se UNKNOWN_PAR da utensile)
bool m_bInvert ; // flag di inversione direzione lavorazione
std::string m_sDepth ; // affondamento massimo (espressione numerica)
double m_dStartPos ; // quota di inizio lavorazione (sempre >= 0)
double m_dOverlap ; // distanza di sovrapposizione con il contorno
double m_dStep ; // passo di affondamento (0=nessun passo)
double m_dSideStep ; // distanza tra le passate
double m_dSubStep ; // distanza tra le passate intermedie
int m_nSubType ; // tipo di lavorazione ( ZigZag, OneWay, SpiralIn, SpiralOut)
double m_dSideAngle ; // angolo dello ZigZag da X+ locale
int m_nLeadInType ; // tipo di attacco (nessuno, lineare, tangente, inseguimento)
double m_dLiTang ; // distanza tangente da inizio attacco
double m_dLiElev ; // elevazione di uno step di attacco
int m_nLeadOutType ; // tipo di uscita (come attacco, nessuno, lineare, tangente, inseguimento)
double m_dLoTang ; // distanza tangente verso fine uscita
double m_dApprox ; // valore di approssimazione per superfici
std::string m_sSysNotes ; // note interne
std::string m_sUserNotes ; // note dell'utente
SurfRoughingData( void)
: m_ToolUuid(), m_nSolCh( 0), m_dSpeed( 0), m_dFeed( 0), m_dStartFeed( 0), m_dEndFeed( 0), m_dTipFeed( 0),
m_dOffsR( UNKNOWN_PAR), m_dOffsL( UNKNOWN_PAR), m_bInvert( false),
m_dStartPos( 0), m_dOverlap( 0), m_dStep( 0), m_dSideStep( 0), m_dSubStep( 0), m_nSubType( 0), m_dSideAngle( 0),
m_nLeadInType( 0), m_dLiTang( 0), m_dLiElev( 0),
m_nLeadOutType( 0), m_dLoTang( 0), m_dApprox( 0) {}
SurfRoughingData* Clone( void) const override ;
bool CopyFrom( const MachiningData* pMdata) override ;
bool SameAs(const MachiningData* pMdata) const override ;
int GetType( void) const override
{ return MT_SURFROUGHING ; }
int GetSize( void) const override ;
std::string GetTitle( void) const override ;
bool FromString( const std::string& sString, int& nKey) override ;
std::string ToString( int nInd) const override ;
bool IsOptional( int nKey) const override ;
bool SetParam( int nType, bool bVal) override ;
bool SetParam( int nType, int nVal) override ;
bool SetParam( int nType, double dVal) override ;
bool SetParam( int nType, const std::string& sVal) override ;
bool ResetTool( void) override ;
bool GetParam( int nType, bool& bVal) const override;
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const override ;
bool VerifyTool( const ToolsMgr* pToolsMgr, const std::string& sVal, const ToolData*& pTdata) const override ;
bool VerifySolCh( int nVal) const ;
bool VerifySubType( int nVal) const ;
bool VerifyLeadInType( int nVal) const ;
bool VerifyLeadLinkType( int nVal) const ;
bool VerifyLeadOutType( int nVal) const ;
} ;
//----------------------------------------------------------------------------
inline const SurfRoughingData* GetSurfRoughingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SURFROUGHING)
return nullptr ;
return ( static_cast<const SurfRoughingData*>( pMdata)) ; }
inline SurfRoughingData* GetSurfRoughingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SURFROUGHING)
return nullptr ;
return ( static_cast<SurfRoughingData*>( pMdata)) ; }
-22
View File
@@ -1,22 +0,0 @@
//----------------------------------------------------------------------------
// EgalTech 2026-2026
//----------------------------------------------------------------------------
// File : ToolUserNotesConst.h Data : 09.04.26 Versione : 3.1d3
// Contenuto : Costanti per le note utente degli utensili.
//
//
//
// Modifiche : 10.11.25 DS Creazione modulo.
//
//
//
//----------------------------------------------------------------------------
#pragma once
#include <string>
//----------------------------------------------------------------------------
// Generali
static const std::string TUN_TH = "TH" ;
static const std::string TUN_DOUBLE = "DOUBLE" ;
+1 -11
View File
@@ -85,12 +85,7 @@ ToolsMgr::Reload( void)
Scanner TheScanner ; Scanner TheScanner ;
if ( ! TheScanner.Init( m_sToolsPath, ";")) { if ( ! TheScanner.Init( m_sToolsPath, ";")) {
LOG_ERROR( GetEMkLogger(), "ReloadTools : Error on Init") LOG_ERROR( GetEMkLogger(), "ReloadTools : Error on Init")
if ( ExistsDirectory( m_sToolsDir) && ! ExistsFile( m_sToolsPath)) { return false ;
m_bModified = true ;
return true ;
}
else
return false ;
} }
// variabili di stato della lettura // variabili di stato della lettura
@@ -556,11 +551,6 @@ ToolsMgr::SaveCurrTool( void)
m_suData.emplace( m_tdCurrTool.m_sName, m_tdCurrTool.m_Uuid) ; m_suData.emplace( m_tdCurrTool.m_sName, m_tdCurrTool.m_Uuid) ;
} }
} }
// se fresa adatto sottotipo a seconda della capacità di lavorare di testa
if ( m_tdCurrTool.m_nType == TT_MILL_STD && m_tdCurrTool.m_dTipFeed < EPS_SMALL)
m_tdCurrTool.m_nType = TT_MILL_NOTIP ;
else if ( m_tdCurrTool.m_nType == TT_MILL_NOTIP && m_tdCurrTool.m_dTipFeed > EPS_SMALL)
m_tdCurrTool.m_nType = TT_MILL_STD ;
// eseguo salvataggio // eseguo salvataggio
m_bModified = true ; m_bModified = true ;
if ( find( m_utModified.begin(), m_utModified.end(), m_tdCurrTool.m_Uuid) == m_utModified.end()) if ( find( m_utModified.begin(), m_utModified.end(), m_tdCurrTool.m_Uuid) == m_utModified.end())
+312 -495
View File
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More