EgtMachKernel :

- aggiunta possibilità di scalare la tavola
- migliorata NewName (se si propone Nome_1 ora se già esiste prova con Nome_2, Nome_3 e non Nome_1_1, ...) 
- in milling curve composite gestite come entità atomiche per sequenziamento
- in milling gestito offset longitudinale
- in milling migliorato calcolo elevazione per attacchi/uscite
- in simulazione tolto reset iniziale utensili.
This commit is contained in:
Dario Sassi
2016-06-28 13:34:31 +00:00
parent e03c692b64
commit 2dccb76184
10 changed files with 45 additions and 19 deletions
+2
View File
@@ -225,6 +225,8 @@ MachMgr::GetOperationNewName( string& sName) const
// verifico che il nome sia unico
int nCount = 0 ;
string sOrigName = sName ;
if ( sOrigName.rfind( "_1") == sOrigName.length() - 2)
sOrigName.erase( sOrigName.length() - 2) ;
while ( GetOperationId( sName) != GDB_ID_NULL) {
++ nCount ;
sName = sOrigName + "_" + ToString( nCount) ;
+9 -1
View File
@@ -192,7 +192,8 @@ Machine::AdjustAuxGeometry( const STRVECTOR& vsAux, int nLay)
//----------------------------------------------------------------------------
bool
Machine::LoadMachineTable( const string& sName, const string& sParent, int nType,
const Point3d& ptRef1, const string& sGeo, const STRVECTOR& vsAux)
const Point3d& ptRef1, double dCoeffX, double dCoeffY, double dCoeffZ,
const string& sGeo, const STRVECTOR& vsAux)
{
// recupero pezzo e layer della geometria originale della tavola
string sPart, sLay ;
@@ -215,6 +216,13 @@ Machine::LoadMachineTable( const string& sName, const string& sParent, int nType
// aggiusto la posizione della tavola
if ( ! AdjustTable( nLay, ptRef1))
return false ;
// eseguo eventuale scalatura
if ( abs( dCoeffX - 1.0) > EPS_ZERO ||
abs( dCoeffY - 1.0) > EPS_ZERO ||
abs( dCoeffZ - 1.0) > EPS_ZERO) {
if ( ! m_pGeomDB->ScaleGlob( nLay, Frame3d( ptRef1), dCoeffX, dCoeffY, dCoeffZ))
return false ;
}
// recupero l'area valida
int nAreaId = m_pGeomDB->GetFirstNameInGroup( nLay, MCH_TAREA + "1") ;
BBox3d b3Area1 ;
+2 -1
View File
@@ -125,7 +125,8 @@ class Machine
bool LoadMachineBase( const std::string& sName, const std::string& sGeo, const STRVECTOR& vsAux) ;
bool AdjustAuxGeometry( const STRVECTOR& vsAux, int nLay) ;
bool LoadMachineTable( const std::string& sName, const std::string& sParent, int nType,
const Point3d& ptRef1, const std::string& sGeo, const STRVECTOR& vsAux) ;
const Point3d& ptRef1, double dCoeffX, double dCoeffY, double dCoeffZ,
const std::string& sGeo, const STRVECTOR& vsAux) ;
bool AdjustTable( int nLay, const Point3d& ptRef1) ;
bool LoadMachineAxis( const std::string& sName, const std::string& sParent, const std::string& sToken,
int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
+5 -1
View File
@@ -37,6 +37,7 @@ static const string FLD_AUX = "Aux" ;
static const string FLD_TOKEN = "Token" ;
static const string FLD_TYPE = "Type" ;
static const string FLD_REF1 = "Ref1" ;
static const string FLD_SCALE = "Scale" ;
static const string FLD_POS = "Pos" ;
static const string FLD_DIR = "Dir" ;
static const string FLD_STROKE = "Stroke" ;
@@ -344,6 +345,9 @@ Machine::LuaEmtTable( lua_State* L)
// lettura campo 'Ref1' dalla tabella
Point3d Ref1 ;
LuaCheckTabFieldParam( L, 1, FLD_REF1, Ref1)
// lettura eventuale campo 'Scale' dalla tabella
double vScale[3] = {1.0, 1.0, 1.0} ;
LuaGetTabFieldParam( L, 1, FLD_SCALE, vScale) ;
// lettura campo 'Geo' dalla tabella
string sGeo ;
LuaCheckTabFieldParam( L, 1, FLD_GEO, sGeo)
@@ -361,7 +365,7 @@ Machine::LuaEmtTable( lua_State* L)
return luaL_error( L, " Unknown Machine") ;
// carico i dati della tavola
if ( ! m_pMchLua->LoadMachineTable( sName, sParent, nType, Ref1, sGeo, vsAux))
if ( ! m_pMchLua->LoadMachineTable( sName, sParent, nType, Ref1, vScale[0], vScale[1], vScale[2], sGeo, vsAux))
return luaL_error( L, " Load Machine Table failed") ;
// restituisco l'indice della tavola
+3 -1
View File
@@ -460,9 +460,11 @@ MachiningsMgr::GetMachiningNewName( string& sName) const
// verifico che il nome sia unico
int nCount = 0 ;
string sOrigName = sName ;
if ( sOrigName.rfind( "_1") == sOrigName.length() - 2)
sOrigName.erase( sOrigName.length() - 2) ;
while ( GetMachining( sName) != nullptr) {
++ nCount ;
sName = sOrigName + "-" + ToString( nCount) ;
sName = sOrigName + "_" + ToString( nCount) ;
}
return true ;
}
+15 -7
View File
@@ -373,12 +373,12 @@ Milling::SetGeometry( const SELVECTOR& vIds)
continue ;
}
// posso aggiungere alla lista
if ( nSubs == 0)
//if ( nSubs == 0)
m_vId.emplace_back( Id) ;
else {
for ( int i = 0 ; i < nSubs ; ++ i)
m_vId.emplace_back( Id.nId, i) ;
}
//else {
// for ( int i = 0 ; i < nSubs ; ++ i)
// m_vId.emplace_back( Id.nId, i) ;
//}
}
return ( ! m_vId.empty()) ;
}
@@ -931,6 +931,8 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
LOG_INFO( GetEMkLogger(), "Error in Milling : Depth not computable") ;
return false ;
}
// sottraggo eventuale offset longitudinale
dDepth -= GetOffsL() ;
// verifico di non superare il massimo materiale
if ( dDepth > m_TParams.m_dMaxMat) {
LOG_INFO( GetEMkLogger(), "Error in Milling : Depth bigger than MaxMaterial") ;
@@ -1019,7 +1021,10 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
return false ;
// aggiungo approccio per frese normali
if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dElev, dAppr))
double dStElev ;
if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, dStElev))
dStElev = dElev ;
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dStElev, dAppr))
return false ;
// affondo al punto iniziale
SetFlag( 0) ;
@@ -1076,8 +1081,11 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
}
// aggiungo retrazione per frese normali
if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
double dEndElev ;
if ( ! GetElevation( m_nPhase, ptEnd - 10 * EPS_SMALL * vtTool, vtTool, dEndElev))
dEndElev = dElev ;
// aggiungo retrazione
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dElev, dAppr))
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dEndElev, dAppr))
return false ;
}
// per lame non è necessario
+1 -1
View File
@@ -113,7 +113,7 @@ Simulator::Start( void)
return false ;
// aggiornamenti legati al cambio di lavorazione (utensile e assi conseguenti)
if ( ! UpdateTool( true))
if ( ! UpdateTool())
return false ;
// richiamo gestione evento inizio lavorazione
-1
View File
@@ -107,4 +107,3 @@ Table::Set( const string& sName, int nType, const Point3d& ptRef1, const BBox3d&
m_b3Area1 = b3Area1 ;
return true ;
}
+6 -6
View File
@@ -21,12 +21,12 @@
class Table : public IUserObj
{
public : // IUserObj
virtual Table* Clone( void) const ;
virtual const std::string& GetClassName( void) const ;
virtual bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const ;
virtual bool SetOwner( int nId, IGeomDB* pGDB) ;
virtual int GetOwner( void) const ;
virtual IGeomDB* GetGeomDB( void) const ;
Table* 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 SetOwner( int nId, IGeomDB* pGDB) override ;
int GetOwner( void) const override ;
IGeomDB* GetGeomDB( void) const override ;
public :
Table( void) ;
+2
View File
@@ -312,6 +312,8 @@ ToolsMgr::GetToolNewName( string& sName) const
// verifico che il nome sia unico
int nCount = 0 ;
string sOrigName = sName ;
if ( sOrigName.rfind( "_1") == sOrigName.length() - 2)
sOrigName.erase( sOrigName.length() - 2) ;
while ( GetTool( sName) != nullptr) {
++ nCount ;
sName = sOrigName + "-" + ToString( nCount) ;