Compare commits
135 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 38b61c5676 | |||
| 7a62031eb4 | |||
| 593545bc54 | |||
| c6903e1cad | |||
| ff4df06a3a | |||
| dbbbfb67fc | |||
| e39fbd8707 | |||
| db7defa9ce | |||
| 2ed88f66e9 | |||
| 3283f1780f | |||
| 3d31988979 | |||
| aa431b341e | |||
| 0c3e6c83d2 | |||
| d7fadcb596 | |||
| 407cbaccfa | |||
| 10bdf80b2a | |||
| 3d6567fbce | |||
| 4a53f3522e | |||
| e99822f53e | |||
| de3dcb2985 | |||
| 30f164badf | |||
| ba9bf97372 | |||
| 478a23c3fe | |||
| e560a513fe | |||
| 0ef8c7f046 | |||
| 44193063e1 | |||
| 9475e732e6 | |||
| 36eeb042a1 | |||
| 30f73c9bf4 | |||
| 1178e479e3 | |||
| a48fa50c85 | |||
| 124c9dbcbc | |||
| b156731e1e | |||
| f80d776b79 | |||
| 1347f472bc | |||
| c6dea02b61 | |||
| b8fb4336cb | |||
| 29214d1d1a | |||
| 24f1a214e2 | |||
| 2a81e2e663 | |||
| 1e3d46cab2 | |||
| 2a98f7bb19 | |||
| 4e26f19263 | |||
| cdd9e14432 | |||
| b52a8a1961 | |||
| 9b33939103 | |||
| d26fcbc23d | |||
| 50912975bd | |||
| f8280502c4 | |||
| 8c2edb8f82 | |||
| 7827558a75 | |||
| a9235ea92c | |||
| 30ab372cf7 | |||
| cd853756aa | |||
| b35086ab6d | |||
| 322336174b | |||
| 040ac8c333 | |||
| 348ecd74bd | |||
| 7e36ba12ec | |||
| f813db1bc7 | |||
| b20cd3b6d8 | |||
| ddfa249469 | |||
| 1a15584126 | |||
| f4c8541922 | |||
| 82e21c419f | |||
| 47b251d0e9 | |||
| e4e9ac66c9 | |||
| 950d54f486 | |||
| 180c635752 | |||
| 76ef5453b0 | |||
| 4f629ea069 | |||
| 2d217b307b | |||
| 11076fde17 | |||
| 0146a0023d | |||
| a6a40e2973 | |||
| ba539e0c51 | |||
| f6d62372df | |||
| 581a606740 | |||
| 662241c8e1 | |||
| 39a03c7b93 | |||
| 15a8df7f30 | |||
| 785e9d8518 | |||
| 5f2c853d42 | |||
| 2d00e94965 | |||
| 7c1ce50238 | |||
| 46aac18715 | |||
| 6c63817dbc | |||
| 9b5995a073 | |||
| b102e9ea67 | |||
| 16970fff3c | |||
| cd37b8282d | |||
| 1569653150 | |||
| b8a47c00ef | |||
| 77bd37f9f7 | |||
| 29a34528ce | |||
| 57acbc93b4 | |||
| 5104da23b0 | |||
| 3b93e47fe7 | |||
| 939ca329a8 | |||
| af5522547c | |||
| 2dee4d8ded | |||
| 34e96d1f06 | |||
| fc03d2f737 | |||
| b33463117f | |||
| 1951c517fa | |||
| f8258883ab | |||
| 6bd14f9948 | |||
| ddef3e7654 | |||
| 848701033b | |||
| ef28db40e1 | |||
| c944dd9893 | |||
| bf968abc1c | |||
| 029ed15541 | |||
| a8c366693e | |||
| 474a645e20 | |||
| 01fbdd9a50 | |||
| a127db39f0 | |||
| 689cea1156 | |||
| 866c4dde45 | |||
| c513cd7440 | |||
| 6e6050ab13 | |||
| 546855a519 | |||
| 78ab2c2a52 | |||
| 09fd122b30 | |||
| 156302009f | |||
| 094bc252fe | |||
| 9e5f78a549 | |||
| ca9b827a18 | |||
| fef634f7e8 | |||
| ba3330edca | |||
| aa74f23c63 | |||
| 727025d231 | |||
| f1cb57e084 | |||
| 9859428de5 | |||
| 22fe666cc1 |
@@ -50,6 +50,7 @@ Axis::Clone( void) const
|
||||
pAx->m_bInvert = m_bInvert ;
|
||||
pAx->m_dOffset = m_dOffset ;
|
||||
pAx->m_nType = m_nType ;
|
||||
pAx->m_nUse = m_nUse ;
|
||||
pAx->m_ptPos = m_ptPos ;
|
||||
pAx->m_vtDir = m_vtDir ;
|
||||
pAx->m_Stroke = m_Stroke ;
|
||||
@@ -74,6 +75,7 @@ Axis::Dump( string& sOut, bool bMM, const char* szNewLine) const
|
||||
sOut += "Name=" + m_sName + szNewLine ;
|
||||
sOut += "Token=" + m_sToken + szNewLine ;
|
||||
sOut += "Type=" + ToString( m_nType) + szNewLine ;
|
||||
sOut += "Use=" + ToString( m_nUse) + szNewLine ;
|
||||
sOut += "Pos=" + ToString( GetInUiUnits( m_ptPos, bMM), 4) + szNewLine ;
|
||||
sOut += "Dir=" + ToString( m_vtDir) + szNewLine ;
|
||||
if ( m_nType == MCH_AT_LINEAR)
|
||||
@@ -113,20 +115,21 @@ Axis::GetGeomDB( void) const
|
||||
//----------------------------------------------------------------------------
|
||||
Axis::Axis( void)
|
||||
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_bInvert( false), m_dOffset( 0),
|
||||
m_nType( MCH_AT_NONE), m_Stroke( {{0,0}}), m_dHomeVal( 0), m_dCurrVal( 0)
|
||||
m_nType( MCH_AT_NONE), m_nUse( MCH_AU_NONE), m_Stroke( {{0,0}}), m_dHomeVal( 0), m_dCurrVal( 0)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Axis::Set( const string& sName, const string& sToken, bool bInvert, double dOffset,
|
||||
int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome)
|
||||
int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome)
|
||||
{
|
||||
m_sName = sName ;
|
||||
m_sToken = sToken ;
|
||||
m_bInvert = bInvert ;
|
||||
m_dOffset = dOffset ;
|
||||
m_nType = nType ;
|
||||
m_nType = ( nType == MCH_AT_ROTARY ? MCH_AT_ROTARY : MCH_AT_LINEAR) ;
|
||||
m_nUse = (( nUse == MCH_AU_DISPOSITION || nUse == MCH_AU_AUXILIAR) ? nUse : MCH_AU_GENERAL) ;
|
||||
m_ptPos = ptPos ;
|
||||
m_vtDir = vtDir ;
|
||||
m_Stroke = Stroke ;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2022
|
||||
// EgalTech 2015-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : Axis.h Data : 21.09.22 Versione : 2.4i
|
||||
// File : Axis.h Data : 17.04.25 Versione : 2.7d2
|
||||
// Contenuto : Dichiarazione della classe Axis.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 24.05.15 DS Creazione modulo.
|
||||
//
|
||||
// 17.04.25 DS Aggiunto campo Use.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -31,7 +31,7 @@ class Axis : public IUserObj
|
||||
public :
|
||||
Axis( void) ;
|
||||
bool Set( const std::string& sName, const std::string& sToken, bool bInvert, double dOffset,
|
||||
int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) ;
|
||||
int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) ;
|
||||
bool Modify( const Point3d& ptPos, double dAxisMaxAdjust) ;
|
||||
bool Modify( const Vector3d& vtDir, double dAxisMaxRotAdj) ;
|
||||
bool Modify( const STROKE& Stroke) ;
|
||||
@@ -48,6 +48,8 @@ class Axis : public IUserObj
|
||||
{ return m_dOffset ; }
|
||||
int GetType( void) const
|
||||
{ return m_nType ; }
|
||||
int GetUse( void) const
|
||||
{ return m_nUse ; }
|
||||
const Point3d& GetPos( void) const
|
||||
{ return m_ptPos ; }
|
||||
const Vector3d& GetDir( void) const
|
||||
@@ -67,6 +69,7 @@ class Axis : public IUserObj
|
||||
bool m_bInvert ;
|
||||
double m_dOffset ;
|
||||
int m_nType ;
|
||||
int m_nUse ;
|
||||
Point3d m_ptPos ;
|
||||
Vector3d m_vtDir ;
|
||||
STROKE m_Stroke ;
|
||||
|
||||
+13
-7
@@ -397,7 +397,8 @@ Chiseling::SetGeometry( const SELVECTOR& vIds)
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
// 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 ;
|
||||
@@ -413,7 +414,8 @@ Chiseling::SetGeometry( const SELVECTOR& vIds)
|
||||
m_vId.emplace_back( Id) ;
|
||||
}
|
||||
// aggiorno lo stato
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty() || vIds.empty()) ;
|
||||
}
|
||||
@@ -501,6 +503,10 @@ Chiseling::Apply( bool bRecalc, bool bPostApply)
|
||||
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 && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
@@ -616,6 +622,9 @@ Chiseling::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -626,9 +635,6 @@ Chiseling::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
@@ -1016,7 +1022,7 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
// la porto in globale
|
||||
pCrvCompo->ToGlob( frGlob) ;
|
||||
// sistemazioni varie
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, 0) ;
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, {}, 0) ;
|
||||
// la restituisco
|
||||
lstPC.emplace_back( Release( pCrvCompo)) ;
|
||||
return true ;
|
||||
@@ -1052,7 +1058,7 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
// la porto in globale
|
||||
pCrvCompo->ToGlob( frGlob) ;
|
||||
// sistemazioni varie
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, 0) ;
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, {}, 0) ;
|
||||
// la restituisco
|
||||
lstPC.emplace_back( Release( pCrvCompo)) ;
|
||||
}
|
||||
|
||||
+8
-2
@@ -37,8 +37,14 @@ class Chiseling : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_CHISELING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nChisels == 0) ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( 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
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ class Disposition : public Operation
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_DISP ; }
|
||||
bool IsEmpty( void) const override
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ return ( m_nShifts == 0) ; }
|
||||
bool UpdateStatus( int nModif) override
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
+17
-10
@@ -519,7 +519,8 @@ Drilling::SetGeometry( const SELVECTOR& vIds)
|
||||
// verifico validità gestore generale e gestore DB geometrico
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
// copia temporanea e reset della geometria corrente
|
||||
SELVECTOR vOldId = m_vId ;
|
||||
m_vId.clear() ;
|
||||
// se lavorazione standard
|
||||
if ( m_Params.m_nSubType == DRI_SUB_STD) {
|
||||
@@ -550,7 +551,8 @@ Drilling::SetGeometry( const SELVECTOR& vIds)
|
||||
}
|
||||
}
|
||||
// aggiorno lo stato
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty()) ;
|
||||
}
|
||||
@@ -618,6 +620,10 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
|
||||
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 && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
@@ -662,6 +668,12 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// verifico se tavola basculante
|
||||
bool bTiltTab = false ;
|
||||
m_bTiltingTab = ( m_pMchMgr->GetCurrMachine()->GetCurrTableIsTilting( bTiltTab, m_vtTiltingAx) && bTiltTab) ;
|
||||
// verifico se testa da sopra (Z+)
|
||||
m_bAboveHead = m_pMchMgr->GetHeadAbove( m_TParams.m_sHead) ;
|
||||
|
||||
// se lavorazione standard
|
||||
if ( m_Params.m_nSubType == DRI_SUB_STD) {
|
||||
if ( ! StandardProcess( bRecalc, GDB_ID_NULL, nClId))
|
||||
@@ -732,6 +744,9 @@ Drilling::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -742,9 +757,6 @@ Drilling::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
@@ -2717,11 +2729,6 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
|
||||
m_pMchMgr->SetWarning( 2155, sInfo) ;
|
||||
}
|
||||
}
|
||||
// verifico se tavola basculante
|
||||
bool bTiltTab = false ;
|
||||
m_bTiltingTab = ( m_pMchMgr->GetCurrMachine()->GetCurrTableIsTilting( bTiltTab, m_vtTiltingAx) && bTiltTab) ;
|
||||
// verifico se testa da sopra (Z+)
|
||||
m_bAboveHead = m_pMchMgr->GetHeadAbove( currToolData.m_sHead) ;
|
||||
// verifiche per foro verso il basso
|
||||
m_bAggrBottom = false ;
|
||||
if ( ! VerifyHoleFromBottom( hole, nCircId))
|
||||
|
||||
+8
-2
@@ -51,8 +51,14 @@ class Drilling : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_DRILLING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nDrillings == 0) ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( 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
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
|
||||
Binary file not shown.
@@ -276,6 +276,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="Pocketing.cpp" />
|
||||
<ClCompile Include="PocketingData.cpp" />
|
||||
<ClCompile Include="PocketingNT.cpp" />
|
||||
<ClCompile Include="Probing.cpp" />
|
||||
<ClCompile Include="ProbingData.cpp" />
|
||||
<ClCompile Include="Processor.cpp" />
|
||||
<ClCompile Include="SawFinishing.cpp" />
|
||||
<ClCompile Include="SawFinishingData.cpp" />
|
||||
@@ -438,6 +440,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="MachiningData.h" />
|
||||
<ClInclude Include="MachiningDataFactory.h" />
|
||||
<ClInclude Include="MachiningCreate.h" />
|
||||
<ClInclude Include="MachiningRegister.h" />
|
||||
<ClInclude Include="MachiningsMgr.h" />
|
||||
<ClInclude Include="MachMgr.h" />
|
||||
<ClInclude Include="Milling.h" />
|
||||
@@ -450,6 +453,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="Pocketing.h" />
|
||||
<ClInclude Include="PocketingData.h" />
|
||||
<ClInclude Include="PocketingNT.h" />
|
||||
<ClInclude Include="Probing.h" />
|
||||
<ClInclude Include="ProbingData.h" />
|
||||
<ClInclude Include="Processor.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="SawFinishing.h" />
|
||||
|
||||
@@ -252,6 +252,12 @@
|
||||
<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>
|
||||
<ClInclude Include="DllMain.h">
|
||||
@@ -767,6 +773,15 @@
|
||||
<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>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtMachKernel.rc">
|
||||
|
||||
+13
-9
@@ -219,6 +219,7 @@ FiveAxisMilling::FiveAxisMilling( void)
|
||||
m_TParams.m_sHead = "*" ;
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
m_nMills = 0 ;
|
||||
m_bRunning = false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -412,7 +413,8 @@ FiveAxisMilling::SetGeometry( const SELVECTOR& vIds)
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
// 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 ;
|
||||
@@ -428,7 +430,8 @@ FiveAxisMilling::SetGeometry( const SELVECTOR& vIds)
|
||||
m_vId.emplace_back( Id) ;
|
||||
}
|
||||
// aggiorno lo stato
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty() || vIds.empty()) ;
|
||||
}
|
||||
@@ -577,6 +580,10 @@ FiveAxisMilling::MyApply( bool bRecalc, bool bPostApply)
|
||||
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 && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
@@ -732,11 +739,11 @@ FiveAxisMilling::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
bool bVpl ;
|
||||
if ( ! FromString( ExtractInfo( m_Params.m_sUserNotes, "Vpl:"), bVpl))
|
||||
bVpl = true ;
|
||||
if ( ! AdjustStartEndMovements( bVpl)) {
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
if ( sInfo.empty())
|
||||
m_pMchMgr->SetLastError( 3306, "Error in FiveAxisMilling : link movements not calculable") ;
|
||||
@@ -745,9 +752,6 @@ FiveAxisMilling::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
|
||||
+8
-2
@@ -35,8 +35,14 @@ class FiveAxisMilling : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_FIVEAXISMILLING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nMills == 0) ; }
|
||||
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 ; }
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ FiveAxisMillingData::GetTitle( void) const
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
static int
|
||||
FindFiveAxisMillingKey( const string& sKey)
|
||||
{
|
||||
auto TheRange = equal_range( sFiveAxisMillingKey.cbegin(), sFiveAxisMillingKey.cend(), sKey) ;
|
||||
|
||||
+11
-5
@@ -411,7 +411,8 @@ GenMachining::SetGeometry( const SELVECTOR& vIds)
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
// 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 ;
|
||||
@@ -427,7 +428,8 @@ GenMachining::SetGeometry( const SELVECTOR& vIds)
|
||||
m_vId.emplace_back( Id) ;
|
||||
}
|
||||
// aggiorno lo stato
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty() || vIds.empty()) ;
|
||||
}
|
||||
@@ -555,6 +557,10 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
|
||||
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 && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
@@ -706,6 +712,9 @@ GenMachining::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
bool bVpl ;
|
||||
if ( ! FromString( ExtractInfo( m_Params.m_sUserNotes, "Vpl:"), bVpl))
|
||||
@@ -719,9 +728,6 @@ GenMachining::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
|
||||
+8
-2
@@ -35,8 +35,14 @@ class GenMachining : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_GENMACHINING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nMills == 0) ; }
|
||||
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 ; }
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ GenMachiningData::GetTitle( void) const
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
static int
|
||||
FindGenMachiningKey( const string& sKey)
|
||||
{
|
||||
auto TheRange = equal_range( sGenMachiningKey.cbegin(), sGenMachiningKey.cend(), sKey) ;
|
||||
|
||||
@@ -78,6 +78,12 @@ const std::string MACHININGS_DIR = "Machinings" ;
|
||||
// Nome file delle lavorazioni
|
||||
const std::string MACHININGS_FILE = "Machinings.data" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// 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
|
||||
const std::string GENMACHINING_SEC = "GenMachining" ;
|
||||
@@ -111,6 +117,8 @@ const std::string MORTISEMAKER_KEY = "MortiseMaker" ;
|
||||
const std::string CHISELMAKER_KEY = "ChiselMaker" ;
|
||||
// Chiave per generatore disegno waterjet
|
||||
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)
|
||||
const std::string DRILLHOLDER_KEY = "DrillHolder" ;
|
||||
// Chiave per porta utensili lame (marmo)
|
||||
|
||||
@@ -125,7 +125,7 @@ class MachMgr : public IMachMgr
|
||||
int AddRawPart( const Point3d& ptOrig, double dLen, double dWidth, double dHeight, Color cCol) override ;
|
||||
int AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color cCol) override ;
|
||||
bool ModifyRawPart( int nRawId, const Point3d& ptOrig, double dLen, double dWidth, double dHeight, Color cCol) override ;
|
||||
bool ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol) override ;
|
||||
bool ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dHeight, Color cCol) override ;
|
||||
bool ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dHeight) override ;
|
||||
bool ModifyRawPartHeight( int nRawId, double dHeight) override ;
|
||||
bool KeepRawPart( int nRawId, int nSouPhase) override ;
|
||||
@@ -258,16 +258,16 @@ class MachMgr : public IMachMgr
|
||||
int GetNextOperation( int nId) const override ;
|
||||
int GetLastOperation( void) const override ;
|
||||
int GetPrevOperation( int nId) const override ;
|
||||
int GetFirstActiveOperation( void) const override ;
|
||||
int GetNextActiveOperation( int nId) const override ;
|
||||
int GetLastActiveOperation( void) const override ;
|
||||
int GetPrevActiveOperation( int nId) const override ;
|
||||
int GetFirstActiveOperation( bool bNeedMachNotEmpty = false) const override ;
|
||||
int GetNextActiveOperation( int nId, bool bNeedMachNotEmpty = false) const override ;
|
||||
int GetLastActiveOperation( bool bNeedMachNotEmpty = false) const override ;
|
||||
int GetPrevActiveOperation( int nId, bool bNeedMachNotEmpty = false) const override ;
|
||||
int GetOperationType( int nId) const override ;
|
||||
int GetOperationPhase( int nId) const override ;
|
||||
bool SetOperationName( int nId, const std::string& sName) override ;
|
||||
std::string GetOperationName( int nId) const override ;
|
||||
int GetOperationId( const std::string& sName) const override ;
|
||||
bool IsOperationEmpty( int nId) const override ;
|
||||
bool IsOperationEmpty( int nId, int nEmptyType = 0) const override ;
|
||||
bool RemoveOperation( int nId) override ;
|
||||
bool RemoveAllPhaseOperations( int nPhase) override ;
|
||||
bool RemoveAllOperations( void) override ;
|
||||
@@ -313,7 +313,7 @@ class MachMgr : public IMachMgr
|
||||
bool GetMachiningParam( int nType, std::string& sVal) 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 GetMachiningEndPoint( Point3d& ptEnd) const override ;
|
||||
// CL Entities Interrogations
|
||||
@@ -333,6 +333,7 @@ class MachMgr : public IMachMgr
|
||||
bool SimGetMoveInfo( int& nGmove, double& dFeed) const override ;
|
||||
bool SimSetStep( double dStep) override ;
|
||||
bool SimSetUiStatus( int nUiStatus) override ;
|
||||
bool SimEnableToolTipTrace( bool bEnable) override ;
|
||||
bool SimGoHome( void) override ;
|
||||
bool SimExit( void) override ;
|
||||
// Generation
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "MachMgr.h"
|
||||
#include "MachConst.h"
|
||||
#include "DllMain.h"
|
||||
#include "MachiningRegister.h"
|
||||
#include "/EgtDev/Include/EMkDllMain.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
@@ -32,6 +33,8 @@ CreateMachMgr( void)
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! GetEMkNetHwKey() && ! TestKeyForEMk( GetEMkKey(), 0, GetEMkLogger()))
|
||||
return nullptr ;
|
||||
// registro classe operazione per pocketing
|
||||
RegisterPocketing() ;
|
||||
// creo il MachMgr
|
||||
return static_cast<IMachMgr*> ( new(nothrow) MachMgr) ;
|
||||
}
|
||||
|
||||
@@ -651,6 +651,8 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
|
||||
pTdata->GetParam( TPA_TIPFEED, dTipFeed) ;
|
||||
string sUserNotes ;
|
||||
pTdata->GetParam( TPA_USERNOTES, sUserNotes) ;
|
||||
string sSysNotes ;
|
||||
pTdata->GetParam( TPA_SYSNOTES, sSysNotes) ;
|
||||
// Recupero la path dell'eventuale portautensile
|
||||
string sThPath = GetToolHolderPath( sHeadName, nExit, nType, sUserNotes) ;
|
||||
// Carico generatore disegno utensile
|
||||
@@ -668,6 +670,7 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TIPFEED", dTipFeed) ;
|
||||
bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.USERNOTES", sUserNotes) ;
|
||||
bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.SYSNOTES", sSysNotes) ;
|
||||
switch ( nType) {
|
||||
case TT_DRILL_STD :
|
||||
case TT_DRILL_LONG :
|
||||
@@ -712,6 +715,15 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.THICK", dThick) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.CORNRAD", dCornRad) ;
|
||||
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 :
|
||||
return TD_INT_ERR ;
|
||||
}
|
||||
@@ -808,6 +820,8 @@ MachMgr::GetToolMakerKeyFromType( int nType) const
|
||||
return WATERJETMAKER_KEY ;
|
||||
case TT_COMPO :
|
||||
return "" ;
|
||||
case TT_PROBE :
|
||||
return PROBEMAKER_KEY ;
|
||||
}
|
||||
return "" ;
|
||||
}
|
||||
@@ -849,6 +863,10 @@ MachMgr::GetToolHolderPath( const string& sHeadName, int nExit, int nType, const
|
||||
string sKey2 = sKey + ":MILL_POLISHING" ;
|
||||
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())
|
||||
sToolHolder = GetPrivateProfileStringUtf8( TOOLHOLDER_SEC.c_str(), sKey.c_str(), "", sMachIni.c_str()) ;
|
||||
// Se non trovato, provo da sezione Tools di Ini di macchina
|
||||
|
||||
@@ -387,8 +387,10 @@ MachMgr::SetCurrMachGroup( int nId)
|
||||
// aggiorno attrezzaggio attivo
|
||||
UpdateCurrSetup() ;
|
||||
// imposto la prima fase come corrente
|
||||
if ( ! SetCurrPhase( 1))
|
||||
if ( ! SetCurrPhase( 1)) {
|
||||
ResetCurrMachGroup() ;
|
||||
return false ;
|
||||
}
|
||||
// nascondo i pezzi rimasti sotto la radice
|
||||
ShowRootParts( false) ;
|
||||
// rendo visibile il nuovo gruppo corrente e la relativa macchina
|
||||
|
||||
+2
-2
@@ -210,8 +210,8 @@ MachMgr::GetCurrMachiningsMgr( void) const
|
||||
// se DB lavorazioni non esiste, provo a crearlo e caricarlo
|
||||
if ( m_vMachines[m_nCurrMch].pMsMgr == nullptr) {
|
||||
PtrOwner<MachiningsMgr> pMsMgr( new( nothrow) MachiningsMgr) ;
|
||||
string sMachsFile = m_vMachines[m_nCurrMch].sDir + "\\" + MACHININGS_DIR + "\\" + MACHININGS_FILE ;
|
||||
if ( IsNull( pMsMgr) || ! pMsMgr->Load( sMachsFile, GetCurrToolsMgr()))
|
||||
string sMachsDir = m_vMachines[m_nCurrMch].sDir + "\\" + MACHININGS_DIR ;
|
||||
if ( IsNull( pMsMgr) || ! pMsMgr->Load( sMachsDir, MACHININGS_FILE, GetCurrToolsMgr()))
|
||||
return nullptr ;
|
||||
// salvo nel vettore
|
||||
const_cast<MachineData&>( m_vMachines[m_nCurrMch]).pMsMgr = Release( pMsMgr) ;
|
||||
|
||||
+16
-12
@@ -100,48 +100,52 @@ MachMgr::GetPrevOperation( int nId) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetFirstActiveOperation( void) const
|
||||
MachMgr::GetFirstActiveOperation( bool bNeedMachNotEmpty) const
|
||||
{
|
||||
int nId = GetFirstOperation() ;
|
||||
int nMode ;
|
||||
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) ;
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetNextActiveOperation( int nId) const
|
||||
MachMgr::GetNextActiveOperation( int nId, bool bNeedMachNotEmpty) const
|
||||
{
|
||||
int nNextId = GetNextOperation( nId) ;
|
||||
int nMode ;
|
||||
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) ;
|
||||
return nNextId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetLastActiveOperation( void) const
|
||||
MachMgr::GetLastActiveOperation( bool bNeedMachNotEmpty) const
|
||||
{
|
||||
int nId = GetLastOperation() ;
|
||||
int nMode ;
|
||||
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) ;
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetPrevActiveOperation( int nId) const
|
||||
MachMgr::GetPrevActiveOperation( int nId, bool bNeedMachNotEmpty) const
|
||||
{
|
||||
int nPrevId = GetPrevOperation( nId) ;
|
||||
int nMode ;
|
||||
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) ;
|
||||
return nPrevId ;
|
||||
}
|
||||
@@ -263,7 +267,7 @@ MachMgr::GetOperationId( const string& sName) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::IsOperationEmpty( int nId) const
|
||||
MachMgr::IsOperationEmpty( int nId, int nEmptyType) const
|
||||
{
|
||||
// verifiche
|
||||
if ( m_pGeomDB == nullptr || m_pGeomDB->GetParentId( nId) != GetCurrOperId())
|
||||
@@ -273,7 +277,7 @@ MachMgr::IsOperationEmpty( int nId) const
|
||||
if ( pOpe == nullptr)
|
||||
return true ;
|
||||
// restituisco se vuota
|
||||
return pOpe->IsEmpty() ;
|
||||
return pOpe->IsEmpty( nEmptyType) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1279,7 +1283,7 @@ MachMgr::GetMachiningSkippedGeometry( SELVECTOR& vIds) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::IsMachiningEmpty( void) const
|
||||
MachMgr::IsMachiningEmpty( int nEmptyType) const
|
||||
{
|
||||
// recupero la lavorazione corrente
|
||||
int nCurrMchId = GetCurrMachining() ;
|
||||
@@ -1290,7 +1294,7 @@ MachMgr::IsMachiningEmpty( void) const
|
||||
if ( pMch == nullptr)
|
||||
return true ;
|
||||
// restituisco lo stato
|
||||
return pMch->IsEmpty() ;
|
||||
return pMch->IsEmpty( nEmptyType) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+61
-25
@@ -28,6 +28,7 @@
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
#include "/EgtDev/Include/EGkStmStandard.h"
|
||||
#include "/EgtDev/Include/EGkStmFromCurves.h"
|
||||
#include "/EgtDev/Include/EGkCAvSilhouetteSurfTm.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
|
||||
@@ -284,7 +285,7 @@ MachMgr::AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight,
|
||||
// assegno la fase al gruppo
|
||||
m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
|
||||
// creo solido e outline
|
||||
bOk = bOk && ModifyRawPart( nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol) ;
|
||||
bOk = bOk && ModifyRawPart( nRawId, nCrvId, dOverMat, dHeight, cCol) ;
|
||||
// se qualcosa è andato storto, cancello tutto
|
||||
if ( ! bOk) {
|
||||
m_pGeomDB->Erase( nRawId) ;
|
||||
@@ -296,7 +297,7 @@ MachMgr::AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight,
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol)
|
||||
MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dHeight, Color cCol)
|
||||
{
|
||||
// verifica validità grezzo
|
||||
if ( ! VerifyRawPart( nRawId))
|
||||
@@ -337,7 +338,7 @@ MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, d
|
||||
if ( IsNull( pOffsCrv))
|
||||
return false ;
|
||||
// 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))
|
||||
return false ;
|
||||
// cancello eventuali vecchi solidi e curve di outline
|
||||
@@ -413,30 +414,63 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
|
||||
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 ;
|
||||
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 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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)) ;
|
||||
}
|
||||
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
|
||||
@@ -450,7 +484,9 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
|
||||
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))
|
||||
if ( pCrvCompo->FromPolyLine( PL))
|
||||
pCrvCompo->SetExtrusion( Z_AX) ;
|
||||
else
|
||||
bOk = false ;
|
||||
}
|
||||
// inserisco la curva composita nel DB
|
||||
|
||||
@@ -130,6 +130,17 @@ MachMgr::SimSetUiStatus( int 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
|
||||
MachMgr::SimGoHome( void)
|
||||
|
||||
+5
-3
@@ -42,6 +42,7 @@ Machine::Machine( void)
|
||||
m_dExitMaxRotAdj = 10 * EPS_ANG_SMALL ;
|
||||
m_dAngDeltaMinForHome = INFINITO ;
|
||||
m_nMultiProcess = 0 ;
|
||||
m_nLinkAxesMoveOrder = 0 ;
|
||||
m_nNewLinkMgr = 0 ;
|
||||
m_nCalcTabId = GDB_ID_NULL ;
|
||||
m_nCalcHeadId = GDB_ID_NULL ;
|
||||
@@ -50,6 +51,7 @@ Machine::Machine( void)
|
||||
m_dCalcRot1W = 1 ;
|
||||
m_bCalcMaxDeltaR2On1 = true ;
|
||||
m_nCalcSolCh = MCH_SCC_NONE ;
|
||||
m_bSolChExact = false ;
|
||||
m_dCalcTLen = 0 ;
|
||||
m_dCalcTRad = 0 ;
|
||||
m_dCalcTOvLen = 0 ;
|
||||
@@ -293,8 +295,8 @@ Machine::AdjustTable( int nLay, const Point3d& ptRef1)
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::LoadMachineAxis( const string& sName, const string& sParent, const string& sToken, bool bInvert,
|
||||
double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
|
||||
double dHome, bool bAdjustAux, const string& sGeo, const STRVECTOR& vsAux)
|
||||
double dOffset, int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir,
|
||||
const STROKE& Stroke, double dHome, bool bAdjustAux, const string& sGeo, const STRVECTOR& vsAux)
|
||||
{
|
||||
// verifico sia di tipo ammesso
|
||||
if ( nType != MCH_AT_LINEAR && nType != MCH_AT_ROTARY) {
|
||||
@@ -334,7 +336,7 @@ Machine::LoadMachineAxis( const string& sName, const string& sParent, const stri
|
||||
Axis* pAxis = new(nothrow) Axis ;
|
||||
if ( pAxis == nullptr)
|
||||
return false ;
|
||||
pAxis->Set( sName, sToken, bInvert, dOffset, nType, ptPos, vtDir, Stroke, dHome) ;
|
||||
pAxis->Set( sName, sToken, bInvert, dOffset, nType, nUse, ptPos, vtDir, Stroke, dHome) ;
|
||||
m_pGeomDB->SetUserObj( nLay, pAxis) ;
|
||||
// verifico il vettore rappresentativo dell'asse
|
||||
if ( ! AdjustAxis( nLay, sPart, sName, nType, ptPos, vtDir, bAdjustAux))
|
||||
|
||||
@@ -88,8 +88,10 @@ class Machine
|
||||
{ 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) ; }
|
||||
{ return ( m_nNewLinkMgr >= nOpt || m_nCalcChainType == KIN_CHAIN_ROBOT) ; }
|
||||
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 UnloadTool( const std::string& sHead, int nExit) ;
|
||||
@@ -182,7 +184,7 @@ class Machine
|
||||
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 VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR& vAng, int nLinkType, int& nStat) ;
|
||||
bool VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat) ;
|
||||
bool VerifyOutstroke( const std::string& sAxName, double dVal) const ;
|
||||
std::string GetOutstrokeInfo( bool bMM = true) const ;
|
||||
void ResetOutstrokeInfo( void) const
|
||||
@@ -226,8 +228,8 @@ class Machine
|
||||
const STRVECTOR& vsColl, 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, bool bInvert,
|
||||
double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
|
||||
double dHome, bool bAdjustAux, const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
double dOffset, int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir,
|
||||
const STROKE& Stroke, double dHome, bool bAdjustAux, const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
bool AdjustAxis( int nLay, const std::string& sPart, const std::string& sName,
|
||||
int nType, const Point3d& ptPos, const Vector3d& vtDir, bool bAdjustAux) ;
|
||||
bool ModifyMachineAxisPosition( const std::string& sName, const Point3d& ptPos) ;
|
||||
@@ -303,6 +305,7 @@ class Machine
|
||||
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
|
||||
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_vLinkedFixtures ; // elenco dei bloccaggi agganciati a gruppi della macchina
|
||||
@@ -365,9 +368,16 @@ class Machine
|
||||
static int LuaEmtAddRapidMove( lua_State* L) ;
|
||||
static int LuaEmtAddLinearMove( 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 LuaEmtGetMoveType( lua_State* L) ;
|
||||
static int LuaEmtGetAxesPos( 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 LuaEmtGetAllLinkedRawParts( lua_State* L) ;
|
||||
static int LuaEmtUnlinkRawPartFromGroup( lua_State* L) ;
|
||||
|
||||
@@ -266,6 +266,14 @@ Machine::GetAxisHomePos( const string& sAxis, double& dHomeVal) const
|
||||
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))
|
||||
|
||||
+33
-38
@@ -48,7 +48,6 @@ static const string EVAR_R1 = ".R1" ; // (num) valore del pri
|
||||
static const string EVAR_R2 = ".R2" ; // (num) valore del secondo asse rotante
|
||||
static const string EVAR_R3 = ".R3" ; // (num) valore del terzo asse rotante
|
||||
static const string EVAR_R4 = ".R4" ; // (num) valore del quarto asse rotante
|
||||
static const string EVAR_LINKTYPE = ".LINKTYPE" ; // (int) tipo collegamento (0=No, 1=Inizio, 2=Fine, 3=Link))
|
||||
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
|
||||
static const string EVAR_STAT = ".STAT" ; // OUT (int) codice di stato ( 0 = ok)
|
||||
static const string EVAR_AUXINFO = ".AUXINFO" ; // OUT (string) stringa con info ausiliarie
|
||||
@@ -76,7 +75,7 @@ Machine::SetCurrTable( const string& sTable)
|
||||
m_pGeomDB->SetStatus( m_nCalcTabId, GDB_ST_ON) ;
|
||||
// lancio eventuale funzione lua di personalizzazione
|
||||
if ( LuaExistsFunction( ON_SET_TABLE)) {
|
||||
// salvo eventuale variabile EMC_VAR già presente
|
||||
// salvo eventuale variabile EMC_VAR già presente
|
||||
bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ;
|
||||
// definisco variabili
|
||||
bool bOk = LuaCreateGlobTable( EMC_VAR) ;
|
||||
@@ -86,7 +85,7 @@ Machine::SetCurrTable( const string& sTable)
|
||||
bOk = bOk && LuaCallFunction( ON_SET_TABLE) ;
|
||||
// reset variabili
|
||||
bOk = bOk && LuaResetGlobVar( EMC_VAR) ;
|
||||
// ripristino eventuale variabile EMC_VAR già presente
|
||||
// ripristino eventuale variabile EMC_VAR già presente
|
||||
if ( bOldEMC)
|
||||
LuaChangeNameGlobVar( EMC_VAR_BACKUP, EMC_VAR) ;
|
||||
// restituisco risultato
|
||||
@@ -283,7 +282,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
|
||||
if ( ! sTool.empty()) {
|
||||
// carico anche gli utensili su eventuali altre uscite della testa
|
||||
LoadTools( sHead, nExit) ;
|
||||
// carico l'utensile (si sostituisce ad altro già presente sulla stessa uscita)
|
||||
// carico l'utensile (si sostituisce ad altro già presente sulla stessa uscita)
|
||||
if ( ! LoadTool( sHead, nExit, sTool)) {
|
||||
string sOut = "Missing tool " + sTool ;
|
||||
LOG_ERROR( GetEMkLogger(), sOut.c_str())
|
||||
@@ -333,7 +332,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
|
||||
m_dCalcTOvRad = dTOvDiam / 2 ;
|
||||
// lancio eventuale funzione lua di personalizzazione
|
||||
if ( LuaExistsFunction( ON_SET_HEAD)) {
|
||||
// salvo eventuale variabile EMC_VAR già presente
|
||||
// salvo eventuale variabile EMC_VAR già presente
|
||||
bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ;
|
||||
// definisco variabili
|
||||
bool bOk = LuaCreateGlobTable( EMC_VAR) ;
|
||||
@@ -351,7 +350,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
|
||||
bOk = bOk && LuaCallFunction( ON_SET_HEAD) ;
|
||||
// reset variabili
|
||||
bOk = bOk && LuaResetGlobVar( EMC_VAR) ;
|
||||
// ripristino eventuale variabile EMC_VAR già presente
|
||||
// ripristino eventuale variabile EMC_VAR già presente
|
||||
if ( bOldEMC)
|
||||
LuaChangeNameGlobVar( EMC_VAR_BACKUP, EMC_VAR) ;
|
||||
// in caso di errore esco
|
||||
@@ -541,7 +540,7 @@ Machine::CalculateKinematicChain( void)
|
||||
nHParId = m_pGeomDB->GetParentId( nHParId) ;
|
||||
}
|
||||
|
||||
// se non ci sono assi, né lineari né rotanti, sicuramente errore
|
||||
// se non ci sono assi, né lineari né rotanti, sicuramente errore
|
||||
if ( m_nTabLinAxes == 0 && m_nHeadLinAxes == 0 &&
|
||||
m_nTabRotAxes == 0 && m_nHeadRotAxes == 0) {
|
||||
LOG_ERROR( GetEMkLogger(), "Errors in Axes : none have been found")
|
||||
@@ -666,7 +665,7 @@ Machine::CalculateKinematicChain( void)
|
||||
}
|
||||
}
|
||||
}
|
||||
// se 3 va bene ( uno dovrà poi avere valore assegnato)
|
||||
// se 3 va bene ( uno dovrà poi avere valore assegnato)
|
||||
else if ( m_vCalcRotAx.size() == 3) {
|
||||
int n2ndHeadRotAx = - 1 ;
|
||||
// se tutti e tre di testa, devo invertire il primo con il terzo
|
||||
@@ -688,7 +687,7 @@ Machine::CalculateKinematicChain( void)
|
||||
}
|
||||
}
|
||||
}
|
||||
// se più di 3
|
||||
// se più di 3
|
||||
else {
|
||||
// altrimenti non ancora gestito, quindi errore
|
||||
LOG_ERROR( GetEMkLogger(), "Rotary Axes not manageable")
|
||||
@@ -705,7 +704,7 @@ Machine::CalculateKinematicChain( void)
|
||||
// non sono ammessi due assi di questo tipo
|
||||
if ( m_nHeadSpecRotAxis != -1)
|
||||
return false ;
|
||||
// la tavola non deve avere più di un asse lineare
|
||||
// la tavola non deve avere più di un asse lineare
|
||||
if ( m_nTabLinAxes > 1)
|
||||
return false ;
|
||||
// se ha un asse lineare deve essere allineato con il rotante speciale
|
||||
@@ -754,7 +753,7 @@ Machine::AddKinematicAxis( bool bOnHead, int nId)
|
||||
kAx.vtDir = pAx->GetDir() ;
|
||||
kAx.stroke = pAx->GetStroke() ;
|
||||
kAx.dHomeVal = pAx->GetHomeVal() ;
|
||||
// ne determino l'indice di posizione nella sua catena cinematica (assegno valore negato perchè provvisorio)
|
||||
// ne determino l'indice di posizione nella sua catena cinematica (assegno valore negato perchè provvisorio)
|
||||
if ( kAx.bHead) {
|
||||
( kAx.bLinear ? ++ m_nHeadLinAxes : ++ m_nHeadRotAxes) ;
|
||||
kAx.nInd = - ( m_nHeadLinAxes + m_nHeadRotAxes) ;
|
||||
@@ -977,7 +976,7 @@ Machine::GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
// aggiorno direzioni utensile e ausiliaria richieste
|
||||
vtDirTm.Rotate( m_vCalcRotAx[i].vtDir, m_vCalcRotAx[i].dFixVal) ;
|
||||
vtDirAm.Rotate( m_vCalcRotAx[i].vtDir, m_vCalcRotAx[i].dFixVal) ;
|
||||
// aggiorno eventuali assi già inseriti (sicuramente di tavola)
|
||||
// aggiorno eventuali assi già inseriti (sicuramente di tavola)
|
||||
for ( size_t j = 0 ; int( j) < nNumRotAx ; ++ j) {
|
||||
RotAx[j].ptPos.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, m_vCalcRotAx[i].dFixVal) ;
|
||||
RotAx[j].vtDir.Rotate( m_vCalcRotAx[i].vtDir, m_vCalcRotAx[i].dFixVal) ;
|
||||
@@ -1066,7 +1065,7 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
// componente versore fresa desiderato su direzione primo asse rotante
|
||||
double dCompTSuAxR1 = vtDirTn * vtAx1 ;
|
||||
|
||||
// se c'è secondo asse rotante, si calcola angolo per avere il componente appena calcolato
|
||||
// se c'è secondo asse rotante, si calcola angolo per avere il componente appena calcolato
|
||||
bool bDet = true ;
|
||||
Vector3d vtDirH1, vtDirH2 ;
|
||||
Vector3d vtDirI1, vtDirI2 ;
|
||||
@@ -1221,7 +1220,7 @@ Machine::GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
|
||||
int& nStat, double& dX, double& dY, double& dZ) const
|
||||
{
|
||||
// la posizione deve essere espressa rispetto allo ZERO MACCHINA
|
||||
// il punto è dato rispetto alla posizione home della tavola
|
||||
// il punto è dato rispetto alla posizione home della tavola
|
||||
|
||||
// verifico che siano stati assegnati gli angoli necessari, altrimenti errore
|
||||
if ( vAng.size() < m_vCalcRotAx.size())
|
||||
@@ -1263,7 +1262,7 @@ Machine::GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
|
||||
// assegno l'offset testa
|
||||
Vector3d vtDtHe = ORIG - m_ptCalcPos ;
|
||||
|
||||
// calcolo il recupero degli assi : è l'opposto dello spostamento della posizione
|
||||
// calcolo il recupero degli assi : è l'opposto dello spostamento della posizione
|
||||
Vector3d vtDtAx = m_ptCalcPos - ptPosH ;
|
||||
|
||||
// calcolo il recupero di lunghezza utensile
|
||||
@@ -1287,7 +1286,7 @@ Machine::GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
|
||||
bool
|
||||
Machine::GetDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const
|
||||
{
|
||||
// è espressa nel riferimento di macchina (tiene conto delle sole rotazioni di testa)
|
||||
// è espressa nel riferimento di macchina (tiene conto delle sole rotazioni di testa)
|
||||
|
||||
// verifico dimensione vettore angoli rispetto al numero di assi rotanti
|
||||
if ( vAng.size() < m_vCalcRotAx.size())
|
||||
@@ -1314,7 +1313,7 @@ Machine::GetDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& v
|
||||
bool
|
||||
Machine::GetBackDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const
|
||||
{
|
||||
// è espressa nel riferimento del pezzo (tiene conto delle rotazioni di testa e al contrario di quelle di tavola)
|
||||
// è espressa nel riferimento del pezzo (tiene conto delle rotazioni di testa e al contrario di quelle di tavola)
|
||||
|
||||
// verifico dimensione vettore angoli rispetto al numero di assi rotanti
|
||||
if ( vAng.size() < m_vCalcRotAx.size())
|
||||
@@ -1342,7 +1341,7 @@ Machine::GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
|
||||
Point3d& ptNose) const
|
||||
{
|
||||
// la posizione deve essere espressa rispetto allo ZERO MACCHINA
|
||||
// è espressa nel riferimento di macchina (tiene conto delle sole traslazioni e rotazioni di testa)
|
||||
// è espressa nel riferimento di macchina (tiene conto delle sole traslazioni e rotazioni di testa)
|
||||
|
||||
// verifico dimensione vettore angoli rispetto al numero di assi rotanti
|
||||
if ( vAng.size() < m_vCalcRotAx.size())
|
||||
@@ -1394,8 +1393,8 @@ Machine::GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
|
||||
bool bOverall, bool bBottom, bool bBack, Point3d& ptTip) const
|
||||
{
|
||||
// la posizione deve essere espressa rispetto allo ZERO MACCHINA
|
||||
// è espressa nel riferimento di macchina (tiene conto delle sole rotazioni di testa)
|
||||
// se bBack vero, allora è nel riferimento pezzo
|
||||
// è espressa nel riferimento di macchina (tiene conto delle sole rotazioni di testa)
|
||||
// se bBack vero, allora è nel riferimento pezzo
|
||||
|
||||
// verifico dimensione vettore angoli rispetto al numero di assi rotanti
|
||||
if ( vAng.size() < m_vCalcRotAx.size())
|
||||
@@ -1472,9 +1471,9 @@ Machine::GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
|
||||
// se richiesto ingombro totale
|
||||
if ( bOverall)
|
||||
ptTip -= vtDirT * max( m_dCalcTOvLen - m_dCalcTLen, 0.) ;
|
||||
// se richiesto punto più basso e direzione fresa non esattamente verticale
|
||||
// se richiesto punto più basso e direzione fresa non esattamente verticale
|
||||
if ( bBottom && ! vtDirT.IsZplus() && ! vtDirT.IsZminus()) {
|
||||
// calcolo la direzione perpendicolare più verticale possibile
|
||||
// calcolo la direzione perpendicolare più verticale possibile
|
||||
Vector3d vtCorr = FromUprightOrtho( vtDirT) ;
|
||||
// correggo il tip
|
||||
if ( bOverall)
|
||||
@@ -1505,7 +1504,7 @@ Machine::GetAuxDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const
|
||||
bool
|
||||
Machine::GetPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const
|
||||
{
|
||||
// è espressa nel riferimento di macchina (tiene conto delle sole rotazioni di tavola e asse rotante speciale di testa)
|
||||
// è espressa nel riferimento di macchina (tiene conto delle sole rotazioni di tavola e asse rotante speciale di testa)
|
||||
|
||||
// verifico dimensione vettore angoli rispetto al numero di assi rotanti
|
||||
if ( vAng.size() < m_vCalcRotAx.size())
|
||||
@@ -1651,10 +1650,10 @@ Machine::AdjustAngleInStroke( const STROKE& Stroke, double& dAng) const
|
||||
bool
|
||||
Machine::GetNearestAngleInStroke( int nInd, double dAngRef, double& dAng) const
|
||||
{
|
||||
// se angolo fittizio (non esiste l'asse rotante corrispondente), non c'è alcunchè da fare
|
||||
// se angolo fittizio (non esiste l'asse rotante corrispondente), non c'è alcunchè da fare
|
||||
if ( nInd < 0 || nInd >= int( m_vCalcRotAx.size()))
|
||||
return true ;
|
||||
// cerco l'angolo più vicino stando nella corsa
|
||||
// cerco l'angolo più vicino stando nella corsa
|
||||
while ( dAng - dAngRef > ANG_STRAIGHT + EPS_ANG_ZERO && dAng - ANG_FULL >= m_vCalcRotAx[nInd].stroke.Min)
|
||||
dAng -= ANG_FULL ;
|
||||
while ( dAng - dAngRef < -ANG_STRAIGHT + EPS_ANG_ZERO && dAng + ANG_FULL <= m_vCalcRotAx[nInd].stroke.Max)
|
||||
@@ -1667,10 +1666,10 @@ Machine::GetNearestAngleInStroke( int nInd, double dAngRef, double& dAng) const
|
||||
bool
|
||||
Machine::LimitAngleToStroke( int nInd, double& dAng) const
|
||||
{
|
||||
// se angolo fittizio (non esiste l'asse rotante corrispondente), non c'è alcunchè da fare
|
||||
// se angolo fittizio (non esiste l'asse rotante corrispondente), non c'è alcunchè da fare
|
||||
if ( nInd < 0 || nInd >= int( m_vCalcRotAx.size()))
|
||||
return true ;
|
||||
// se angolo fuori corsa, lo porto all'estremo più vicino
|
||||
// se angolo fuori corsa, lo porto all'estremo più vicino
|
||||
dAng = Clamp( dAng, m_vCalcRotAx[nInd].stroke.Min, m_vCalcRotAx[nInd].stroke.Max) ;
|
||||
return true ;
|
||||
}
|
||||
@@ -1740,7 +1739,7 @@ Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng
|
||||
}
|
||||
// verifica delle aree protette
|
||||
if ( nStat == 0)
|
||||
return const_cast<Machine*>( this)->VerifyProtectedAreas( dX, dY, dZ, vAng, 0, nStat) ;
|
||||
return const_cast<Machine*>( this)->VerifyProtectedAreas( dX, dY, dZ, vAng, nStat) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -1754,20 +1753,17 @@ Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR& vAng, int nLinkType, int& nStat)
|
||||
Machine::VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat)
|
||||
{
|
||||
// se non esiste funzione gestione aree protette, non devo fare alcunchè
|
||||
// se non esiste funzione gestione aree protette, non devo fare alcunchè
|
||||
if ( ! LuaExistsFunction( ON_VERIFY_PROTECTEDAREAS))
|
||||
return true ;
|
||||
// se non è collegamento e aree protette solo per questi, non devo fare alcunchè
|
||||
if ( nLinkType == 0 && m_nNewLinkMgr == 1)
|
||||
return true ;
|
||||
// default
|
||||
bool bOk = true ;
|
||||
int nErr = 99 ;
|
||||
// salvo eventuale variabile EMC_VAR già presente
|
||||
// salvo eventuale variabile EMC_VAR già presente
|
||||
bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ;
|
||||
// definisco variabili (nelle disposizioni l'utensile non è definito e non ha nome)
|
||||
// definisco variabili (nelle disposizioni l'utensile non è definito e non ha nome)
|
||||
string sTool, sHead ; int nExit ;
|
||||
bOk = bOk && LuaCreateGlobTable( EMC_VAR) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_VER, GetEMkVer()) ;
|
||||
@@ -1785,7 +1781,6 @@ Machine::VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR&
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_R3, vAng[2]) ;
|
||||
if ( vAng.size() >= 4)
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_R4, vAng[3]) ;
|
||||
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_LINKTYPE, nLinkType) ;
|
||||
// chiamo funzione
|
||||
bOk = bOk && LuaCallFunction( ON_VERIFY_PROTECTEDAREAS) ;
|
||||
// recupero il risultato
|
||||
@@ -1807,7 +1802,7 @@ Machine::VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR&
|
||||
}
|
||||
// reset variabili
|
||||
bOk = LuaResetGlobVar( EMC_VAR) && bOk ;
|
||||
// ripristino eventuale variabile EMC_VAR già presente
|
||||
// ripristino eventuale variabile EMC_VAR già presente
|
||||
if ( bOldEMC)
|
||||
LuaChangeNameGlobVar( EMC_VAR_BACKUP, EMC_VAR) ;
|
||||
// esco
|
||||
@@ -1854,7 +1849,7 @@ Machine::VerifyOutstroke( const string& sAxName, double dVal) const
|
||||
string
|
||||
Machine::GetOutstrokeInfo( bool bMM) const
|
||||
{
|
||||
// se non c'è extracorsa, ritorno stringa vuota
|
||||
// se non c'è extracorsa, ritorno stringa vuota
|
||||
if ( m_OutstrokeInfo.sAxName.empty())
|
||||
return "" ;
|
||||
// creo stringa con info opportune
|
||||
|
||||
+18
-1
@@ -37,6 +37,7 @@ static const string FLD_EXITMAXADJUST = "ExitMaxAdjust" ;
|
||||
static const string FLD_EXITMAXROTADJ = "ExitMaxRotAdj" ;
|
||||
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_PARENT = "Parent" ;
|
||||
@@ -44,6 +45,7 @@ static const string FLD_GEO = "Geo" ;
|
||||
static const string FLD_AUX = "Aux" ;
|
||||
static const string FLD_TOKEN = "Token" ;
|
||||
static const string FLD_TYPE = "Type" ;
|
||||
static const string FLD_USE = "Use" ;
|
||||
static const string FLD_INVERT = "Invert" ;
|
||||
static const string FLD_AXIS_OFFSET = "Offset" ;
|
||||
static const string FLD_REF1 = "Ref1" ;
|
||||
@@ -119,6 +121,13 @@ Machine::LuaInit( const string& sMachineName)
|
||||
m_LuaMgr.RegisterFunction( "EmtAddRapidMove", Machine::LuaEmtAddRapidMove) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtAddLinearMove", Machine::LuaEmtAddLinearMove) ;
|
||||
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) ;
|
||||
// registro le funzioni di lettura entità CL per lua
|
||||
m_LuaMgr.RegisterFunction( "EmtGetMoveType", Machine::LuaEmtGetMoveType) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtGetAxesPos", Machine::LuaEmtGetAxesPos) ;
|
||||
@@ -351,6 +360,9 @@ Machine::LuaEmtGeneral( lua_State* L)
|
||||
// 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) ;
|
||||
@@ -406,6 +418,8 @@ Machine::LuaEmtGeneral( lua_State* L)
|
||||
|
||||
// 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 ;
|
||||
|
||||
@@ -530,6 +544,9 @@ Machine::LuaEmtAxis( lua_State* L)
|
||||
// lettura campo 'Type' dalla tabella
|
||||
int 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
|
||||
Point3d ptPos ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_POS, ptPos)
|
||||
@@ -563,7 +580,7 @@ Machine::LuaEmtAxis( lua_State* L)
|
||||
|
||||
// carico i dati dell'asse
|
||||
if ( ! m_pMchLua->LoadMachineAxis( sName, sParent, sToken, bInvert, dOffset,
|
||||
nType, ptPos, vtDir, Stroke, dHome, bAdjustAux, sGeo, vsAux))
|
||||
nType, nUse, ptPos, vtDir, Stroke, dHome, bAdjustAux, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Axis failed") ;
|
||||
|
||||
// restituisco l'indice dell'asse
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "MachMgr.h"
|
||||
#include "DllMain.h"
|
||||
#include "CamData.h"
|
||||
#include "Operation.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
@@ -276,6 +277,185 @@ Machine::LuaEmtAddArcMove( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtAddClimb( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : nMachId, vAxVal, nMask, nFlag, nFlag2 [, sInfo]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
DBLVECTOR vAxVal ;
|
||||
LuaCheckParam( L, 2, vAxVal)
|
||||
int nMask ;
|
||||
LuaCheckParam( L, 3, nMask)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 4, nFlag)
|
||||
int nFlag2 ;
|
||||
LuaCheckParam( L, 5, nFlag2)
|
||||
string sInfo = "" ;
|
||||
LuaGetParam( L, 6, 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") ;
|
||||
// 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, nFlag, nFlag2, nMask, sInfo, false)) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtRemoveClimb( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nMachId
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
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)) ;
|
||||
// elimino le discese (primi movimenti "CLIMB" del primo percorso della lavorazione)
|
||||
bool bOk = ( pOper != nullptr && pOper->RemoveClimb()) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtAddRise( lua_State* L)
|
||||
{
|
||||
// 5 o 6 parametri : nMachId, vAxVal, nMask, nFlag, nFlag2 [, sInfo]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
DBLVECTOR vAxVal ;
|
||||
LuaCheckParam( L, 2, vAxVal)
|
||||
int nMask ;
|
||||
LuaCheckParam( L, 3, nMask)
|
||||
int nFlag ;
|
||||
LuaCheckParam( L, 4, nFlag)
|
||||
int nFlag2 ;
|
||||
LuaCheckParam( L, 5, nFlag2)
|
||||
string sInfo = "" ;
|
||||
LuaGetParam( L, 6, 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") ;
|
||||
// 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, nFlag, nFlag2, nMask, sInfo)) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtRemoveRise( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nMachId
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
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)) ;
|
||||
// elimino le risalite (ultimi movimenti "RISE" dell'ultimo percorso della lavorazione)
|
||||
bool bOk = ( pOper != nullptr && pOper->RemoveRise()) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtGetInitialAxesPos( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nMachId [, bSkipClimb]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
bool bSkipClimb = true ;
|
||||
LuaGetParam( L, 2, 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, vAxesVal)) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, vAxesVal) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtGetFinalAxesPos( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nMachId [, bSkipRise]
|
||||
int nMachId ;
|
||||
LuaCheckParam( L, 1, nMachId)
|
||||
bool bSkipRise = true ;
|
||||
LuaGetParam( L, 2, 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, 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
|
||||
Machine::LuaEmtGetMoveType( lua_State* L)
|
||||
|
||||
@@ -81,6 +81,13 @@ enum MchAxisType { MCH_AT_NONE = 0,
|
||||
MCH_AT_LINEAR = 1,
|
||||
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
|
||||
enum MchHeadType { MCH_HT_NONE = 0,
|
||||
|
||||
+4
-4
@@ -439,10 +439,10 @@ Machining::PostApply( string& sErr)
|
||||
return false ;
|
||||
// costanti
|
||||
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
|
||||
static const string EVAR_PHASE = ".PHASE" ; // IN (int) indice fase
|
||||
static const string EVAR_MCHID = ".MCHID" ; // IN (int) identificativo della lavorazione
|
||||
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok, > 0 errore, < 0 warning)
|
||||
static const string EVAR_MSG = ".MSG" ; // OUT (string) stringa di errore ( opzionale)
|
||||
static const string EVAR_PHASE = ".PHASE" ; // IN (int) indice fase
|
||||
static const string EVAR_MCHID = ".MCHID" ; // IN (int) identificativo della lavorazione
|
||||
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok, > 0 errore, < 0 warning)
|
||||
static const string EVAR_MSG = ".MSG" ; // OUT (string) stringa di errore ( opzionale)
|
||||
static const string ON_POST_APPLY = "OnPostApplyMachining" ;
|
||||
|
||||
// se non esiste la funzione, esco
|
||||
|
||||
+3
-2
@@ -107,7 +107,8 @@ GetMachiningTitle( int nMchType)
|
||||
"SurfRoughing",
|
||||
"SurfFinishing",
|
||||
"Waterjetting",
|
||||
"5AxisMilling"} ;
|
||||
"5AxisMilling",
|
||||
"Probing"} ;
|
||||
switch ( nMchType) {
|
||||
case MT_DRILLING : return MchTitle[1] ;
|
||||
case MT_SAWING : return MchTitle[2] ;
|
||||
@@ -122,7 +123,7 @@ GetMachiningTitle( int nMchType)
|
||||
case MT_SURFFINISHING : return MchTitle[11] ;
|
||||
case MT_WATERJETTING : return MchTitle[12] ;
|
||||
case MT_FIVEAXISMILLING : return MchTitle[13] ;
|
||||
|
||||
case MT_PROBING : return MchTitle[14] ;
|
||||
}
|
||||
return MchTitle[0] ;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// 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) ;
|
||||
if ( GetPrivateProfileInt( SEC_MACH, KEY_POCKETING, 1, sIniPath.c_str()) == 2)
|
||||
UserObjRegister<PocketingNT>::DoRegister( GetOperationClass( OPER_POCKETING)) ;
|
||||
else
|
||||
UserObjRegister<Pocketing>::DoRegister( GetOperationClass( OPER_POCKETING)) ;
|
||||
bFirst = false ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
+20
-12
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2024
|
||||
// EgalTech 2015-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachiningsMgr.cpp Data : 29.03.24 Versione : 2.6d1
|
||||
// File : MachiningsMgr.cpp Data : 09.06.25 Versione : 2.7f2
|
||||
// Contenuto : Implementazione gestore database lavorazioni.
|
||||
//
|
||||
//
|
||||
@@ -17,6 +17,7 @@
|
||||
// 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).
|
||||
// 29.03.24 DS Agg. parametro APPROX_LINTOL (MF_CURR_VER = 1013).
|
||||
// 29.03.24 DS Agg. tastatura (MF_CURR_VER = 1014).
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -43,7 +44,7 @@ const string MF_HEADER = "[HEADER]" ;
|
||||
const string MF_VERSION = "VERSION" ;
|
||||
const string MF_TOTAL = "TOTAL" ;
|
||||
const string MF_SIZE = "SIZE" ;
|
||||
const int MF_CURR_VER = 1013 ;
|
||||
const int MF_CURR_VER = 1014 ;
|
||||
const string MF_GENERAL = "[GENERAL]" ;
|
||||
const string MF_3AXCOMP = "3AXCOMP" ;
|
||||
const bool MF_CURR_3AXCOMP = false ;
|
||||
@@ -125,11 +126,12 @@ MachiningsMgr::Clear( bool bReset)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachiningsMgr::Load( const string& sMachsFile, const ToolsMgr* pTsMgr)
|
||||
MachiningsMgr::Load( const string& sMachsDir, const string& sMachsFile, const ToolsMgr* pTsMgr)
|
||||
{
|
||||
// Salvo la path del file con i dati
|
||||
m_sMachsFile = sMachsFile ;
|
||||
string sOut = "MachiningsMgr Init : " + m_sMachsFile ;
|
||||
m_sMachsDir = sMachsDir ;
|
||||
m_sMachsPath = m_sMachsDir + "\\" + sMachsFile ;
|
||||
string sOut = "MachiningsMgr Init : " + m_sMachsPath ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
|
||||
// Verifico il gestore degli utensili
|
||||
@@ -158,9 +160,15 @@ MachiningsMgr::Reload( void)
|
||||
|
||||
// Inizializzo lo scanner
|
||||
Scanner TheScanner ;
|
||||
if ( ! TheScanner.Init( m_sMachsFile, ";")) {
|
||||
if ( ! TheScanner.Init( m_sMachsPath, ";")) {
|
||||
LOG_ERROR( GetEMkLogger(), "ReloadMachinings : Error on Init")
|
||||
return false ;
|
||||
if ( ExistsDirectory( m_sMachsDir) && ! ExistsFile( m_sMachsPath)) {
|
||||
m_nDbVer = MF_CURR_VER ;
|
||||
m_bModified = true ;
|
||||
return true ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
// variabili di stato della lettura
|
||||
@@ -399,17 +407,17 @@ MachiningsMgr::Save( bool bCompressed) const
|
||||
return true ;
|
||||
|
||||
// Faccio copia di backup del file originale
|
||||
CopyFileEgt( m_sMachsFile, m_sMachsFile + ".bak") ;
|
||||
CopyFileEgt( m_sMachsPath, m_sMachsPath + ".bak") ;
|
||||
|
||||
// Inizializzo il writer
|
||||
Writer TheWriter ;
|
||||
if ( ! TheWriter.Init( m_sMachsFile, bCompressed)) {
|
||||
if ( ! TheWriter.Init( m_sMachsPath, bCompressed)) {
|
||||
LOG_ERROR( GetEMkLogger(), "SaveMachinings : Error on Init")
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Scrivo linea di inizio file
|
||||
string sOut = "; --- " + m_sMachsFile + " " + CurrDateTime() + " ---" ;
|
||||
string sOut = "; --- " + m_sMachsPath + " " + CurrDateTime() + " ---" ;
|
||||
if ( ! TheWriter.OutText( sOut)) {
|
||||
LOG_ERROR( GetEMkLogger(), "SaveMachinings : Error on Start")
|
||||
return false ;
|
||||
@@ -848,7 +856,7 @@ MachiningsMgr::SetCurrMachiningParam( int nType, double dVal)
|
||||
}
|
||||
// se feed
|
||||
else if ( nType == MPA_FEED || nType == MPA_STARTFEED || nType == MPA_ENDFEED ||
|
||||
nType == MPA_TIPFEED || nType == MPA_VERTFEED || nType == MPA_BACKFEED) {
|
||||
nType == MPA_TIPFEED || nType == MPA_VERTFEED || nType == MPA_BACKFEED || nType == MPA_SIDEANGFEED) {
|
||||
// recupero valore da utensile
|
||||
const ToolData* pTdata ;
|
||||
if ( ! m_pCurrMach->GetTool( m_pTsMgr, pTdata))
|
||||
|
||||
+4
-3
@@ -27,7 +27,7 @@ class MachiningsMgr
|
||||
public :
|
||||
MachiningsMgr( void) ;
|
||||
~MachiningsMgr( void) ;
|
||||
bool Load( const std::string& sMachsFile, const ToolsMgr* pTsMgr) ;
|
||||
bool Load( const std::string& sMachsDir, const std::string& sMachsFile, const ToolsMgr* pTsMgr) ;
|
||||
bool Reload( void) ;
|
||||
bool Save( bool bCompressed = true) const ;
|
||||
bool GetMachiningNewName( std::string& sName) const ;
|
||||
@@ -108,8 +108,9 @@ class MachiningsMgr
|
||||
typedef STRUUID_MAP::const_iterator STRUUID_CITER ;
|
||||
|
||||
private :
|
||||
// path file lavorazioni
|
||||
std::string m_sMachsFile ;
|
||||
// dir e path file lavorazioni
|
||||
std::string m_sMachsDir ;
|
||||
std::string m_sMachsPath ;
|
||||
// flag di dati modificati
|
||||
mutable bool m_bModified ;
|
||||
// versione DB caricato
|
||||
|
||||
+105
-31
@@ -49,6 +49,13 @@ const double OSC_MIN_LEN = 0.1 ;
|
||||
const double LIM_DOWN_APPRZ = -0.5 ;
|
||||
const double DELTA_ELEV_RAD = 4.0 ;
|
||||
const double LIM_SIN_DIFF_DIR = 0.175 ;
|
||||
// Parametri avanzati da UserNotes
|
||||
const string UN_MAXELEV = "MaxElev" ;
|
||||
const string UN_OUTRAW = "OutRaw" ;
|
||||
const string UN_SIDEELEV = "SideElev" ;
|
||||
const string UN_TRIMEXT = "TrimExt" ;
|
||||
const string UN_VTFACEUSE = "VtFaceUse" ;
|
||||
const string UN_EDGESFACEUSE = "EdgesFaceUse" ;
|
||||
|
||||
//------------------------------ Errors --------------------------------------
|
||||
// 2301 = "Error in Milling : UpdateToolData failed"
|
||||
@@ -377,7 +384,7 @@ Milling::SetParam( int nType, int nVal)
|
||||
if ( ! m_Params.VerifyFaceUse( nVal))
|
||||
return false ;
|
||||
if ( nVal != m_Params.m_nFaceUse)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_nStatus |= ( MCH_ST_PARAM_MODIF | MCH_ST_GEO_MODIF) ;
|
||||
m_Params.m_nFaceUse = nVal ;
|
||||
return true ;
|
||||
}
|
||||
@@ -576,8 +583,17 @@ Milling::SetParam( int nType, const string& sVal)
|
||||
m_Params.m_sSysNotes = sVal ;
|
||||
return true ;
|
||||
case MPA_USERNOTES :
|
||||
if ( sVal != m_Params.m_sUserNotes)
|
||||
if ( sVal != m_Params.m_sUserNotes) {
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
Vector3d vtNew ; GetValInNotes( sVal, UN_VTFACEUSE, vtNew) ;
|
||||
Vector3d vtOri ; GetValInNotes( m_Params.m_sUserNotes, UN_VTFACEUSE, vtOri) ;
|
||||
if ( ! AreSameVectorApprox( vtNew, vtOri))
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
INTVECTOR vnNew ; GetValInNotes( sVal, UN_EDGESFACEUSE, vnNew) ;
|
||||
INTVECTOR vnOri ; GetValInNotes( m_Params.m_sUserNotes, UN_EDGESFACEUSE, vnOri) ;
|
||||
if ( vnNew != vnOri)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
}
|
||||
m_Params.m_sUserNotes = sVal ;
|
||||
return true ;
|
||||
case MPA_INITANGS :
|
||||
@@ -601,7 +617,8 @@ Milling::SetGeometry( const SELVECTOR& vIds)
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
// copia temporanea e reset della geometria corrente
|
||||
SELVECTOR vOldId = m_vId ;
|
||||
m_vId.clear() ;
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve, tutti testi o tutte facce)
|
||||
int nType = GEO_NONE ;
|
||||
@@ -617,7 +634,8 @@ Milling::SetGeometry( const SELVECTOR& vIds)
|
||||
m_vId.emplace_back( Id) ;
|
||||
}
|
||||
// aggiorno lo stato
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty() || vIds.empty()) ;
|
||||
}
|
||||
@@ -725,6 +743,10 @@ Milling::Apply( bool bRecalc, bool bPostApply)
|
||||
}
|
||||
m_nHeadSolCh = m_pMchMgr->GetCurrMachine()->GetHeadSolCh( m_TParams.m_sHead) ;
|
||||
|
||||
// se modificata geometria, necessario ricalcolo
|
||||
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
@@ -887,7 +909,10 @@ Milling::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// gestione movimenti all'inizio e fine di ogni singolo percorso di lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
if ( sInfo.empty())
|
||||
@@ -897,9 +922,6 @@ Milling::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
@@ -1376,10 +1398,14 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
nToolDir = TOOL_PARAL ;
|
||||
int nFaceUse = ( m_Params.m_nFaceUse & 31) ;
|
||||
Vector3d vtFaceUse ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, "VtFaceUse", vtFaceUse) && ! vtFaceUse.IsSmall())
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTFACEUSE, vtFaceUse) && ! vtFaceUse.IsSmall())
|
||||
nFaceUse = FACE_VERSOR ;
|
||||
INTVECTOR vnEdgesFaceUse ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_EDGESFACEUSE, vnEdgesFaceUse) && ! vnEdgesFaceUse.empty())
|
||||
nFaceUse = FACE_EDGES ;
|
||||
double dSawThick = ( ( m_TParams.m_nType & TF_SAWBLADE) != 0 ? m_TParams.m_dThick : 0) ;
|
||||
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, vtFaceUse, dSawThick) ;
|
||||
if ( ! AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, vtFaceUse, vnEdgesFaceUse, dSawThick))
|
||||
return false ;
|
||||
// la restituisco
|
||||
lstPC.emplace_back( Release( pCrvCompo)) ;
|
||||
return true ;
|
||||
@@ -1404,8 +1430,11 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
nToolDir = TOOL_PARAL ;
|
||||
int nFaceUse = ( m_Params.m_nFaceUse & 31) ;
|
||||
Vector3d vtFaceUse ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, "VtFaceUse", vtFaceUse) && ! vtFaceUse.IsSmall())
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTFACEUSE, vtFaceUse) && ! vtFaceUse.IsSmall())
|
||||
nFaceUse = FACE_VERSOR ;
|
||||
INTVECTOR vnEdgesFaceUse ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_EDGESFACEUSE, vnEdgesFaceUse) && ! vnEdgesFaceUse.empty())
|
||||
nFaceUse = FACE_EDGES ;
|
||||
double dSawThick = ( ( m_TParams.m_nType & TF_SAWBLADE) != 0 ? m_TParams.m_dThick : 0) ;
|
||||
// determino intervallo di chunk
|
||||
int nCstart = 0 ;
|
||||
@@ -1414,6 +1443,10 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
nCstart = Id.nSub ;
|
||||
nCend = nCstart + 1 ;
|
||||
}
|
||||
else if ( nFaceUse == FACE_EDGES) {
|
||||
nCstart = 0 ;
|
||||
nCend = nCstart + 1 ;
|
||||
}
|
||||
// ciclo sui chunk
|
||||
for ( int nC = nCstart ; nC < nCend ; ++ nC) {
|
||||
// recupero i contorni del chunk
|
||||
@@ -1428,7 +1461,8 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
// la porto in globale
|
||||
pCrvCompo->ToGlob( frGlob) ;
|
||||
// sistemazioni varie
|
||||
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, vtFaceUse, dSawThick) ;
|
||||
if ( ! AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, vtFaceUse, vnEdgesFaceUse, dSawThick))
|
||||
return false ;
|
||||
// la restituisco
|
||||
lstPC.emplace_back( Release( pCrvCompo)) ;
|
||||
}
|
||||
@@ -1834,13 +1868,13 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
return false ;
|
||||
// eventuale imposizione massima elevazione da note utente
|
||||
double dMaxElev ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, "MaxElev", dMaxElev) && dElev > dMaxElev)
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MAXELEV, dMaxElev) && dElev > dMaxElev)
|
||||
dElev = dMaxElev ;
|
||||
// eventuale aggiuntivo all'elevazione per l'oscillazione
|
||||
double dAddElev = ( bPathOscEnable ? abs( m_Params.m_dOscHeight) : 0) ;
|
||||
// eventuale elevazione di fianco (solo per lama)
|
||||
double dSideElev = 0 ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, "SideElev", dSideElev) ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, UN_SIDEELEV, dSideElev) ;
|
||||
|
||||
// verifico che lo step dell'utensile sia sensato
|
||||
double dOkStep = 0 ;
|
||||
@@ -1960,7 +1994,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
|
||||
// recupero eventuale flag di inizio forzato fuori dal grezzo
|
||||
int nStartOutRaw = 0 ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, "OutRaw", nStartOutRaw) ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, UN_OUTRAW, nStartOutRaw) ;
|
||||
m_bStartOutRaw = (( nStartOutRaw & 1) != 0) ;
|
||||
m_bEndOutRaw = (( nStartOutRaw & 2) != 0) ;
|
||||
|
||||
@@ -2841,11 +2875,11 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
return false ;
|
||||
Vector3d vtToolOrt = OrthoCompo( ptP1 - ptCurr, vtTool) ;
|
||||
if ( vtToolOrt.Len() > 100 * EPS_SMALL) {
|
||||
if ( AddLinearMove( ptP1 - vtToolOrt, bSplitArcs) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP1 - vtToolOrt, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// movimento standard
|
||||
if ( AddLinearMove( ptP1, bSplitArcs) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se attacco a zigzag o a spirale, non affondo
|
||||
@@ -2857,7 +2891,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
else {
|
||||
bool bStartFeed = ( bOutStart || m_TParams.m_nType == TT_MILL_POLISHING) ;
|
||||
SetFeed( bStartFeed ? GetStartFeed() : GetTipFeed()) ;
|
||||
if ( ! SameAsCurrPos( ptP1) && AddLinearMove( ptP1, bSplitArcs) == GDB_ID_NULL)
|
||||
if ( ! SameAsCurrPos( ptP1) && AddLinearMove( ptP1, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -3936,7 +3970,7 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
// recupero eventuale superficie trimesh chiusa per trim/extend
|
||||
int nTriExtCstm = GDB_ID_NULL ;
|
||||
int nTesId ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, "TrimExt", nTesId)) {
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_TRIMEXT, nTesId)) {
|
||||
const ISurfTriMesh* pTes = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nTesId)) ;
|
||||
if ( pTes != nullptr && pTes->IsClosed())
|
||||
nTriExtCstm = nTesId ;
|
||||
@@ -4034,7 +4068,7 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
else {
|
||||
bool bStartFeed = ( bOutStart || m_TParams.m_nType == TT_MILL_NOTIP || m_TParams.m_nType == TT_MILL_POLISHING) ;
|
||||
SetFeed( bStartFeed ? GetStartFeed() : GetTipFeed()) ;
|
||||
if ( AddLinearMove( ptP1, bSplitArcs) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// aggiungo attacco
|
||||
@@ -4112,7 +4146,7 @@ Milling::AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
// recupero eventuale superficie trimesh chiusa per trim/extend
|
||||
int nTriExtCstm = GDB_ID_NULL ;
|
||||
int nTesId ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, "TrimExt", nTesId)) {
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_TRIMEXT, nTesId)) {
|
||||
const ISurfTriMesh* pTes = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nTesId)) ;
|
||||
if ( pTes != nullptr && pTes->IsClosed())
|
||||
nTriExtCstm = nTesId ;
|
||||
@@ -4213,7 +4247,7 @@ Milling::AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
else {
|
||||
bool bStartFeed = ( bOutStart || m_TParams.m_nType == TT_MILL_NOTIP || m_TParams.m_nType == TT_MILL_POLISHING) ;
|
||||
SetFeed( bReturn ? GetEndFeed() : ( bStartFeed ? GetStartFeed() : GetTipFeed())) ;
|
||||
if ( AddLinearMove( ptP1, bSplitArcs) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// aggiungo attacco
|
||||
@@ -4381,7 +4415,7 @@ Milling::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
|
||||
SetFlag( 0) ;
|
||||
bool bStartFeed = ( bOutStart || m_TParams.m_nType == TT_MILL_NOTIP || m_TParams.m_nType == TT_MILL_POLISHING) ;
|
||||
SetFeed( bStartFeed ? GetStartFeed() : GetTipFeed()) ;
|
||||
if ( ! AreSamePointApprox( ptP1, ptP) && AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
|
||||
if ( ! AreSamePointApprox( ptP1, ptP) && AddLinearMove( ptP, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// sono sopra il pezzo ma non abbastanza
|
||||
@@ -4394,7 +4428,7 @@ Milling::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
|
||||
SetFlag( 0) ;
|
||||
bool bStartFeed = ( bOutStart || m_TParams.m_nType == TT_MILL_NOTIP || m_TParams.m_nType == TT_MILL_POLISHING) ;
|
||||
SetFeed( bStartFeed ? GetStartFeed() : GetTipFeed()) ;
|
||||
if ( AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// altrimenti
|
||||
@@ -4498,7 +4532,7 @@ Milling::AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, co
|
||||
}
|
||||
// affondo al punto iniziale in feed
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
@@ -4511,7 +4545,7 @@ Milling::AddDirectApproach( const Point3d& ptP, bool bSplitArcs)
|
||||
// affondo diretto al punto iniziale
|
||||
SetFlag( 0) ;
|
||||
SetFeed( GetStartFeed()) ;
|
||||
if ( AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
@@ -4545,7 +4579,7 @@ Milling::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
|
||||
// 4 -> movimento di risalita sopra il punto finale
|
||||
SetFeed( GetEndFeed()) ;
|
||||
Point3d ptP4 = ptP + vtAppr * ( dElev + dAppr) ;
|
||||
if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP4, bSplitArcs, MCH_CL_SAFEOUT) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
@@ -4553,7 +4587,7 @@ Milling::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
|
||||
Point3d ptP4a = ptP + vtAppr * ( dElev + dAppr) ;
|
||||
if ( dElev + dAppr > EPS_SMALL) {
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( AddLinearMove( ptP4a, bSplitArcs) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP4a, bSplitArcs, MCH_CL_SAFEOUT) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 4b -> movimento di risalita sopra il punto finale
|
||||
@@ -4568,7 +4602,7 @@ Milling::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
|
||||
// 4 -> movimento di risalita sopra il punto finale
|
||||
SetFeed( GetEndFeed()) ;
|
||||
Point3d ptP4 = ptP + Z_AX * ( min( dElevZ, 0.) + dAppr) ;
|
||||
if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP4, bSplitArcs, MCH_CL_SAFEOUT) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
@@ -4576,7 +4610,7 @@ Milling::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
|
||||
Point3d ptP4a = ptP + Z_AX * ( min( dElevZ, 0.) + dAppr) ;
|
||||
if ( dElev + dAppr > EPS_SMALL) {
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( AddLinearMove( ptP4a, bSplitArcs) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP4a, bSplitArcs, MCH_CL_SAFEOUT) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 4b -> movimento di risalita sopra il punto finale
|
||||
@@ -4624,7 +4658,7 @@ Milling::AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, con
|
||||
if ( dSawEndElev + dAppr > 10 * EPS_SMALL) {
|
||||
SetFeed( GetEndFeed()) ;
|
||||
ptP4 = ptP + vtRetr * ( dSawEndElev + dAppr) ;
|
||||
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP4, MCH_CL_SAFEOUT) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se sopra uscita c'è spazio per sicurezza
|
||||
@@ -6543,6 +6577,46 @@ Milling::CalcOffset( ICurveComposite* pCompo, double dSignOffs) const
|
||||
pCompo->ArcsBezierCurvesToArcsPerpExtr( LIN_TOL_MID, ANG_TOL_STD_DEG) ;
|
||||
return true ;
|
||||
}
|
||||
else {
|
||||
Point3d ptOffs ;
|
||||
Vector3d vtOut ;
|
||||
if ( OffsCrv.GetPointOffset( ptOffs, vtOut)) {
|
||||
const double MIN_MOVE = 1 ;
|
||||
Vector3d vtStart = vtOut ;
|
||||
double dStaLen = 10 ;
|
||||
Point3d ptStart ;
|
||||
if ( pCompo->GetStartPoint( ptStart)) {
|
||||
Vector3d vtTmp = ptOffs - ptStart ;
|
||||
if ( vtTmp.Normalize()) {
|
||||
double dCosA = abs( vtTmp * vtOut) ;
|
||||
dStaLen = max( m_TParams.m_dDiam / 2 * sqrt( ( 1 - dCosA) / ( 1 + dCosA)), MIN_MOVE) ;
|
||||
vtTmp.Rotate( vtExtr, 0, 1) ;
|
||||
if ( vtTmp * vtOut < 0)
|
||||
vtTmp.Invert() ;
|
||||
vtStart = vtTmp ;
|
||||
}
|
||||
}
|
||||
Vector3d vtEnd = vtOut ;
|
||||
double dEndLen = 10 ;
|
||||
Point3d ptEnd ;
|
||||
if ( pCompo->GetEndPoint( ptEnd)) {
|
||||
Vector3d vtTmp = ptOffs - ptEnd ;
|
||||
if ( vtTmp.Normalize()) {
|
||||
double dCosA = abs( vtTmp * vtOut) ;
|
||||
dEndLen = max( m_TParams.m_dDiam / 2 * sqrt( ( 1 - dCosA) / ( 1 + dCosA)), MIN_MOVE) ;
|
||||
vtTmp.Rotate( vtExtr, 0, 1) ;
|
||||
if ( vtTmp * vtOut < 0)
|
||||
vtTmp.Invert() ;
|
||||
vtEnd = vtTmp ;
|
||||
}
|
||||
}
|
||||
pCompo->Clear() ;
|
||||
pCompo->AddPoint( ptOffs) ;
|
||||
pCompo->AddLine( ptOffs + dStaLen * vtStart, false) ;
|
||||
pCompo->AddLine( ptOffs + dEndLen * vtEnd) ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false ;
|
||||
|
||||
@@ -37,8 +37,14 @@ class Milling : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_MILLING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nMills == 0) ; }
|
||||
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 ; }
|
||||
|
||||
|
||||
+48
-18
@@ -273,7 +273,7 @@ Mortising::SetParam( int nType, int nVal)
|
||||
if ( ! m_Params.VerifyFaceUse( nVal))
|
||||
return false ;
|
||||
if ( nVal != m_Params.m_nFaceUse)
|
||||
m_nStatus |= MCH_ST_PARAM_MODIF ;
|
||||
m_nStatus |= ( MCH_ST_PARAM_MODIF | MCH_ST_GEO_MODIF) ;
|
||||
m_Params.m_nFaceUse = nVal ;
|
||||
return true ;
|
||||
}
|
||||
@@ -417,7 +417,8 @@ Mortising::SetGeometry( const SELVECTOR& vIds)
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
// 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 ;
|
||||
@@ -433,7 +434,8 @@ Mortising::SetGeometry( const SELVECTOR& vIds)
|
||||
m_vId.emplace_back( Id) ;
|
||||
}
|
||||
// aggiorno lo stato
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty() || vIds.empty()) ;
|
||||
}
|
||||
@@ -521,6 +523,10 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
|
||||
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 && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
@@ -655,6 +661,9 @@ Mortising::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -665,9 +674,6 @@ Mortising::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
@@ -1022,7 +1028,7 @@ Mortising::GetCurve( SelData Id)
|
||||
else
|
||||
nToolDir = TOOL_PAR_SLANT ;
|
||||
int nFaceUse = ( m_Params.m_nFaceUse & 31) ;
|
||||
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, V_NULL, m_TParams.m_dThick, 2) ;
|
||||
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, V_NULL, {}, m_TParams.m_dThick, 2) ;
|
||||
// la restituisco
|
||||
return Release( pCrvCompo) ;
|
||||
}
|
||||
@@ -1339,7 +1345,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
GetValInNotes( m_Params.m_sUserNotes, "Plunge", nPlunge) ;
|
||||
|
||||
// verifico che lo step dell'utensile sia sensato
|
||||
double dOkStep = ( nPlunge == MORTISE_PLUNGE_STEP ? m_Params.m_dStep : 0) ;
|
||||
double dOkStep = ( nPlunge == MORTISE_PLUNGE_STEP || nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ ? m_Params.m_dStep : 0) ;
|
||||
const double MIN_ZSTEP = 1.0 ;
|
||||
if ( dOkStep >= EPS_SMALL && dOkStep < MIN_ZSTEP) {
|
||||
dOkStep = MIN_ZSTEP ;
|
||||
@@ -1561,6 +1567,15 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
{
|
||||
// compensazione elevazione/affondamento
|
||||
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
|
||||
double dSafeZ = GetSafeZ() + GetDeltaSafeZ( vtTool) ;
|
||||
@@ -1572,17 +1587,26 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
if ( ! bUnderStart)
|
||||
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
|
||||
int nFirstFlag = ( bFirst ? 1 : 0) ;
|
||||
SetFlag( nFirstFlag) ;
|
||||
Point3d ptP1 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + dStartElev + dSafeZ) ;
|
||||
int nStart = AddRapidStartOrMove( ptP1, bFirst) ;
|
||||
if ( nStart == GDB_ID_NULL)
|
||||
Point3d ptP1 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + dAppr) ;
|
||||
if ( AddRapidStartOrMove( ptP1, bFirst) == GDB_ID_NULL)
|
||||
return false ;
|
||||
SetFlag( 0) ;
|
||||
|
||||
// 2 -> punto fuori (se diverso dal precedente)
|
||||
if ( m_Params.m_dStartPos < dSafeZ - 10 * EPS_SMALL) {
|
||||
if ( m_Params.m_dStartPos < dAppr - 10 * EPS_SMALL) {
|
||||
Point3d ptP2 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + m_Params.m_dStartPos) ;
|
||||
if ( AddRapidMove( ptP2) == GDB_ID_NULL)
|
||||
return false ;
|
||||
@@ -1610,10 +1634,6 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
}
|
||||
else {
|
||||
// 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 ;
|
||||
// a seconda del tipo
|
||||
switch ( m_Params.m_nStepType) {
|
||||
@@ -1623,7 +1643,7 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
SetFeed( GetStartFeed()) ;
|
||||
SetFlag( 0) ;
|
||||
Point3d ptP3 = (( i % 2 == 1) ? ptStart : ptEnd) + ( dDelta - i * dStep) * vtTool ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL && ! ( i == 1 && nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ))
|
||||
return false ;
|
||||
// 4 -> punto termine
|
||||
SetFeed( GetFeed()) ;
|
||||
@@ -1677,11 +1697,21 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
// altrimenti ridetermino elevazione su fine percorso di lavoro
|
||||
if ( ! bUnderEnd)
|
||||
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
|
||||
SetFeed( GetEndFeed()) ;
|
||||
SetFlag( 104) ; // risalita sopra la fine
|
||||
Point3d ptP6 = ptLast + vtTool * ( dDelta + dEndElev + dSafeZ) ;
|
||||
Point3d ptP6 = ptLast + vtTool * ( dDelta + dRetr) ;
|
||||
if ( AddLinearMove( ptP6) == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
|
||||
+8
-2
@@ -36,8 +36,14 @@ class Mortising : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_MORTISING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nMortises == 0) ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( 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
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
|
||||
+754
-523
File diff suppressed because it is too large
Load Diff
+59
-43
@@ -1,14 +1,14 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2016-2019
|
||||
// EgalTech 2016-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : Operation.h Data : 17.06.19 Versione : 2.1f2
|
||||
// File : Operation.h Data : 09.05.25 Versione : 2.7e2
|
||||
// Contenuto : Dichiarazione della classe Operation da cui derivano
|
||||
// Disposition e Machining.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 29.04.16 DS Creazione modulo.
|
||||
//
|
||||
// 09.05.25 DS Generalizzazionee funzione IsEmpty con tipo (EMPTY_*).
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -30,6 +30,8 @@ class ICurveComposite ;
|
||||
//----------------------------------------------------------------------------
|
||||
class Operation : public IUserObj
|
||||
{
|
||||
friend class Machine ;
|
||||
|
||||
public : // IUserObj
|
||||
bool SetOwner( int nId, IGeomDB* pGDB) override ;
|
||||
int GetOwner( void) const override ;
|
||||
@@ -48,7 +50,7 @@ class Operation : public IUserObj
|
||||
|
||||
public :
|
||||
virtual int GetType( void) const = 0 ;
|
||||
virtual bool IsEmpty( void) const = 0 ;
|
||||
virtual bool IsEmpty( int nEmptyType = 0) const = 0 ;
|
||||
virtual bool UpdateStatus( int nModif) = 0 ;
|
||||
|
||||
protected :
|
||||
@@ -115,18 +117,13 @@ class Operation : public IUserObj
|
||||
Operation( void) ;
|
||||
|
||||
protected :
|
||||
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 ;
|
||||
|
||||
protected :
|
||||
bool IsAtLeastOnePathOk( void) const ;
|
||||
bool AreAllPathsOk( void) const ;
|
||||
bool GetToolpathsStatus( int& nCnt, int& nEmpty) const ;
|
||||
int GetFirstFullToolpath( void) const ;
|
||||
int GetNextFullToolpath( int nClPathId) const ;
|
||||
int GetLastFullToolpath( void) const ;
|
||||
int GetPrevFullToolpath( int nClPathId) const ;
|
||||
bool UpdateFollowingOperationsStatus( int nModif) ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP,
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
@@ -168,7 +165,7 @@ class Operation : public IUserObj
|
||||
bool GetCurrRawsGlobBox( BBox3d& b3Raw) const ;
|
||||
|
||||
bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, const Vector3d& vtFaceUse,
|
||||
double dToolThick, int nGrade = 3) ;
|
||||
const INTVECTOR& vnEdgesFaceUse, double dToolThick, int nGrade = 3) ;
|
||||
bool ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp = false) const ;
|
||||
bool ApproxWithLines( ICurveComposite* pCompo, bool bFeed = true) const ;
|
||||
bool VerifyArcs( ICurveComposite* pCompo, double dMaxAngCen = MAX_ANG_CEN) const ;
|
||||
@@ -178,6 +175,30 @@ class Operation : public IUserObj
|
||||
|
||||
bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) ;
|
||||
|
||||
std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ;
|
||||
std::string ExtractHint( const std::string& sNotes) const ;
|
||||
bool SetBlockedRotAxis( const std::string& sBlockedAxis) const ;
|
||||
bool CalculateAxesValues( const std::string& sHint, bool bRotContOnNext = true, bool bSolChExact = false) ;
|
||||
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
|
||||
bool RemoveClimbRiseHome( void) ;
|
||||
double GetDeltaSafeZ( const Vector3d& vtTool) const ;
|
||||
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int* pnLKAMO = nullptr) const ;
|
||||
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
|
||||
bool IsAggrBottom( const std::string& sHead) const ;
|
||||
|
||||
private :
|
||||
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 GetInitialAxesValues( bool bSkipClimb, DBLVECTOR& vAxVal) const ;
|
||||
bool GetClPathInitialAxesValues( int nClPathId, bool bSkipClimb, DBLVECTOR& vAxVal) const ;
|
||||
bool GetFinalAxesValues( bool bSkipRise, DBLVECTOR& vAxVal) const ;
|
||||
@@ -190,13 +211,10 @@ class Operation : public IUserObj
|
||||
const CamData* GetClPathInitialCamData( int nClPathId, bool bSkipClimb) const ;
|
||||
const CamData* GetFinalCamData( bool bSkipRise) const ;
|
||||
const CamData* GetClPathFinalCamData( int nClPathId, bool bSkipRise) const ;
|
||||
std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ;
|
||||
std::string ExtractHint( const std::string& sNotes) const ;
|
||||
bool SetBlockedRotAxis( const std::string& sBlockedAxis) const ;
|
||||
bool CalculateAxesValues( const std::string& sHint, bool bRotContOnNext = true, bool bSolChExact = false) ;
|
||||
bool CalculateClPathCenterAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
|
||||
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
|
||||
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
|
||||
bool EraseAddedPoints( int nClPathId) ;
|
||||
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
|
||||
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
|
||||
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
|
||||
@@ -205,23 +223,27 @@ class Operation : public IUserObj
|
||||
const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec, DBLVECTOR& vAxRot) ;
|
||||
bool VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec,
|
||||
const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal,
|
||||
int nCnt, int nEntId, double dRot1W, int nMoveType, bool& bAdded, bool& bAxError) ;
|
||||
int nCnt, int nEntId, double dRot1W, int nMoveType, bool bToolShow, bool& bAdded, bool& bAxError) ;
|
||||
bool CalculateClPathRobotAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
|
||||
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
|
||||
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
|
||||
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
|
||||
bool ManageProtectedAreas( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, Operation* pPrevOp, Operation* pNextOp, bool& bClimbDone) ;
|
||||
bool AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
|
||||
bool ToolChangeNeeded( const Operation& Op1, const Operation& Op2) const ;
|
||||
bool GetAxisMidForTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nAxisOrder, Machine* pMch,
|
||||
DBLVECTOR& vAxMid) const ;
|
||||
bool OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
|
||||
Machine* pMch, const INTVECTOR& vRawId, const INTVECTOR& vFxtId) const ;
|
||||
bool AdjustStartEndMovementsStd( bool bVerifyPreviousLink) ;
|
||||
bool AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOpe, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
|
||||
bool AdjustStartEndMovementsNew( void) ;
|
||||
bool ManageSpecialLink( Operation* pPrevOpe, int nPrevClPathId, Operation* pNextOpe, int nNextClPathId) ;
|
||||
bool ToolChangeNeeded( const Operation& Ope1, const Operation& Ope2) const ;
|
||||
bool AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL,
|
||||
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "") ;
|
||||
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "", bool bFirst = true) ;
|
||||
bool RemoveClimb( int nClPathId = GDB_ID_NULL) ;
|
||||
bool AddRise( DBLVECTOR& vAxVal, double dDelta = NAN, int nClPathId = GDB_ID_NULL, int nToMinMaxZ = 0) ;
|
||||
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL,
|
||||
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "") ;
|
||||
bool RemoveRise( int nClPathId = GDB_ID_NULL) ;
|
||||
bool AddHome( void) ;
|
||||
bool RemoveClimbRiseHome( void) ;
|
||||
bool AddRobotClimb( int nEntId, double dDeltaZ = NAN) ;
|
||||
bool CalcRobotAxesAbovePos( const Point3d& ptP, const Vector3d& vtT, const Vector3d& vtA, double dDeltaZ,
|
||||
DBLVECTOR& vAx, double* pdNewDeltaZ = nullptr) const ;
|
||||
@@ -235,22 +257,12 @@ class Operation : public IUserObj
|
||||
bool GetRotationAtZmax( void) const ;
|
||||
bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, const BBox3d& b3Raws) const ;
|
||||
int GetUserNotesZmax( void) const ;
|
||||
double GetDeltaSafeZ( const Vector3d& vtTool) const ;
|
||||
bool GetZHomeDown( void) const ;
|
||||
bool TestCollisionAvoid( 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 SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nOutstroke, int nLinkType,
|
||||
POSVECTOR& vNewPos) ;
|
||||
|
||||
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
|
||||
bool IsAggrBottom( const std::string& sHead) const ;
|
||||
|
||||
private :
|
||||
bool GetAxisMidForTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nAxisOrder, Machine* pMch,
|
||||
DBLVECTOR& vAxMid) const ;
|
||||
bool OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
|
||||
Machine* pMch, const INTVECTOR& vRawId, const INTVECTOR& vFxtId) const ;
|
||||
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, const Operation* pNextOpe) ;
|
||||
|
||||
protected :
|
||||
int m_nOwnerId ; // identificativo dell'oggetto geometrico possessore
|
||||
@@ -323,11 +335,15 @@ inline Operation* GetOperation( IUserObj* 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
|
||||
enum { TOOL_PARAL = 1, TOOL_ORTHO = 2, TOOL_ORTUP = 3, TOOL_PAR_SLANT= 4} ;
|
||||
// tipo di utilizzo contorno faccia
|
||||
enum { FACE_DOWN = 1, FACE_TOP = 2, FACE_FRONT = 3, FACE_BACK = 4, FACE_LEFT = 5, FACE_RIGHT = 6, FACE_CONT = 7, FACE_VERSOR = 8} ;
|
||||
enum { FACE_DOWN = 1, FACE_TOP = 2, FACE_FRONT = 3, FACE_BACK = 4, FACE_LEFT = 5, FACE_RIGHT = 6,
|
||||
FACE_CONT = 7, FACE_VERSOR = 8, FACE_EDGES = 9} ;
|
||||
// risultato di SpecialTestCollisionAvoid
|
||||
enum { SCAV_ERROR = -1, SCAV_COLLIDE = 0, SCAV_AVOID = 1, SCAV_TOTEST = 2} ;
|
||||
// ordine di movimento assi nei link
|
||||
enum { LKAO_INTERP = 0, LKAO_HEAD_BEFORE = -1, LKAO_HEAD_AFTER = +1, LKAO_HEAD_BOTH = 11} ;
|
||||
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
-1
@@ -323,7 +323,7 @@ Operation::AddLinearMove( const Point3d& ptP, bool bSplit)
|
||||
return GDB_ID_NULL ;
|
||||
double dLen = Dist( ptS, ptP) ;
|
||||
double dStep = GetMaxSplitLen( true, true) ;
|
||||
int nStep = int( dLen / dStep + 0.999) ;
|
||||
int nStep = int( ceil( ( dLen - EPS_ZERO) / dStep)) ;
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||
int nId = AddLinearMove( Media( ptS, ptP, i * 1.0 / nStep)) ;
|
||||
|
||||
+5
-3
@@ -18,8 +18,6 @@
|
||||
#include "/EgtDev/Include/EMkOperationConst.h"
|
||||
#include <string>
|
||||
|
||||
#define POCKETING_NT 0
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static const std::string s_OpeClass[] = {"",
|
||||
"EMkDisposition",
|
||||
@@ -35,7 +33,8 @@ static const std::string s_OpeClass[] = {"",
|
||||
"EMkSurfRoughing",
|
||||
"EMkSurfFinishing",
|
||||
"EMkWaterJetting",
|
||||
"EMkFiveAxisMilling"} ;
|
||||
"EMkFiveAxisMilling",
|
||||
"EMkProbing"} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Dal tipo numerico restituisce la classe della operazione
|
||||
@@ -57,6 +56,7 @@ GetOperationClass( int nOpeType)
|
||||
case OPER_SURFFINISHING : return s_OpeClass[12] ;
|
||||
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] ;
|
||||
}
|
||||
@@ -94,6 +94,8 @@ GetOperationType( const std::string& sOpeClass)
|
||||
return OPER_WATERJETTING ;
|
||||
else if ( sOpeClass == s_OpeClass[14])
|
||||
return OPER_FIVEAXISMILLING ;
|
||||
else if ( sOpeClass == s_OpeClass[15])
|
||||
return OPER_PROBING ;
|
||||
else
|
||||
return OPER_NULL ;
|
||||
}
|
||||
|
||||
@@ -191,6 +191,7 @@ 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_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_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
|
||||
|
||||
+33
-27
@@ -43,6 +43,16 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//------------------------------ Constants ------------------------------------
|
||||
static int LINK_CURVE_PROP = -3 ;
|
||||
static string KEY_OPEN = "OPEN" ;
|
||||
// Parametri avanzati da UserNotes
|
||||
const string UN_MAXELEV = "MaxElev" ;
|
||||
const string UN_OPEN = "Open" ;
|
||||
const string UN_OPENOUTRAW = "OpenOutRaw" ;
|
||||
const string UN_OPENMINSAFE = "OpenMinSafe" ;
|
||||
const string UN_MAXOPTSIZE = "MaxOptSize" ;
|
||||
|
||||
//------------------------------ Errors --------------------------------------
|
||||
// 2401 = "Error in Pocketing : UpdateToolData failed"
|
||||
// 2402 = "Error in Pocketing : Open Contour"
|
||||
@@ -79,19 +89,12 @@ using namespace std ;
|
||||
// 2452 = "Warning in Pocketing : No machinable pocket"
|
||||
// 2453 = "Warning in Pocketing : Tool name changed (xx)"
|
||||
// 2454 = "Warning in Pocketing : Tool data changed (xx)"
|
||||
// 2455 = "Warning in Pocketing : skipped Path too short"
|
||||
// 2456 = "Warning in Pocketing : machining step too small (xx)"
|
||||
// 2457 = "Warning in Pocketing : machining step (xxx) bigger than MaxMaterial (yyy)"
|
||||
// 2458 = "Warning in Pocketing : machining depth (xxx) bigger than MaxMaterial (yyy)"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static string KEY_OPEN = "OPEN" ;
|
||||
static int LINK_CURVE_PROP = -3 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
#if POCKETING_NT != 1
|
||||
USEROBJ_REGISTER( GetOperationClass( OPER_POCKETING), Pocketing) ;
|
||||
#endif
|
||||
// USEROBJ_REGISTER( GetOperationClass( OPER_POCKETING), Pocketing) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const string&
|
||||
@@ -506,7 +509,8 @@ Pocketing::SetGeometry( const SELVECTOR& vIds)
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
// 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 ;
|
||||
@@ -522,7 +526,8 @@ Pocketing::SetGeometry( const SELVECTOR& vIds)
|
||||
m_vId.emplace_back( Id) ;
|
||||
}
|
||||
// aggiorno lo stato
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty() || vIds.empty()) ;
|
||||
}
|
||||
@@ -628,6 +633,10 @@ Pocketing::Apply( bool bRecalc, bool bPostApply)
|
||||
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 && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
@@ -770,6 +779,9 @@ Pocketing::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -780,9 +792,6 @@ Pocketing::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
@@ -1229,7 +1238,7 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
// la porto in globale
|
||||
pCrvCompo->ToGlob( frGlob) ;
|
||||
// sistemazioni varie
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, 0) ;
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, {}, 0) ;
|
||||
// la restituisco
|
||||
lstPC.emplace_back( Release( pCrvCompo)) ;
|
||||
return true ;
|
||||
@@ -1267,7 +1276,7 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
||||
// la porto in globale
|
||||
pCrvCompo->ToGlob( frGlob) ;
|
||||
// sistemazioni varie
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, 0) ;
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, {}, 0) ;
|
||||
// la restituisco
|
||||
lstPC.emplace_back( Release( pCrvCompo)) ;
|
||||
}
|
||||
@@ -1549,7 +1558,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
|
||||
// sposto l'inizio a metà del tratto più lungo ( o aperto più lungo)
|
||||
if ( bMidOpen) {
|
||||
const double LEN_OUT = 5 ;
|
||||
const double LEN_OUT = 5. + ( m_TParams.m_dDiam / 2.) ;
|
||||
double dPar ; int nFlag ;
|
||||
bMidOpen = ( DistPointCurve( ptMidOpen + LEN_OUT * vtMidOut, *pCompo).GetParamAtMinDistPoint( 0, dPar, nFlag) && pCompo->ChangeStartPoint( dPar)) ;
|
||||
}
|
||||
@@ -1608,7 +1617,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
return false ;
|
||||
// eventuale imposizione massima elevazione da note utente
|
||||
double dMaxElev ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, "MaxElev", dMaxElev) && dElev > dMaxElev)
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MAXELEV, dMaxElev) && dElev > dMaxElev)
|
||||
dElev = dMaxElev ;
|
||||
|
||||
// verifico che lo step dell'utensile sia sensato
|
||||
@@ -1679,11 +1688,11 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
|
||||
// recupero eventuale flag di lato aperto forzato fuori dal grezzo
|
||||
int nOpenOutRaw ;
|
||||
m_bOpenOutRaw = ( GetValInNotes( m_Params.m_sUserNotes, "OpenOutRaw", nOpenOutRaw) && nOpenOutRaw != 0) ;
|
||||
m_bOpenOutRaw = ( GetValInNotes( m_Params.m_sUserNotes, UN_OPENOUTRAW, nOpenOutRaw) && nOpenOutRaw != 0) ;
|
||||
|
||||
// recupero eventuale minima lunghezza di attacco su lato aperto
|
||||
m_dOpenMinSafe = 0 ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, "OpenMinSafe", m_dOpenMinSafe) ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, UN_OPENMINSAFE, m_dOpenMinSafe) ;
|
||||
|
||||
// se richiesta anteprima
|
||||
if ( nPvId != GDB_ID_NULL) {
|
||||
@@ -3881,7 +3890,7 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
|
||||
Vector3d vtOrtho = OrthoCompo( vtOtherDir, vtDir) ;
|
||||
double dPocketSize = vtOrtho.Len() ;
|
||||
double dMaxOptSize = m_Params.m_dSideStep ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, "MaxOptSize", dMaxOptSize) ;
|
||||
GetValInNotes( m_Params.m_sUserNotes, UN_MAXOPTSIZE, dMaxOptSize) ;
|
||||
if ( ( ( bSomeOpen && dPocketSize < m_TParams.m_dDiam + EPS_SMALL) || abs( dPocketSize - m_TParams.m_dDiam) < EPS_SMALL) &&
|
||||
dPocketSize < dMaxOptSize + 10 * EPS_SMALL) {
|
||||
if ( nReg == 0) {
|
||||
@@ -5145,7 +5154,7 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
|
||||
SetFlag( 0) ;
|
||||
bool bStartFeed = ( bOutStart || m_TParams.m_nType == TT_MILL_NOTIP) ;
|
||||
SetFeed( bStartFeed ? GetStartFeed() : GetTipFeed()) ;
|
||||
if ( ! AreSamePointApprox( ptP1, ptP) && AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
|
||||
if ( ! AreSamePointApprox( ptP1, ptP) && AddLinearMove( ptP, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
@@ -5223,7 +5232,7 @@ Pocketing::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ
|
||||
// 4 -> movimento di risalita sopra il punto finale
|
||||
SetFeed( GetEndFeed()) ;
|
||||
Point3d ptP4 = ptP + vtTool * ( dElev + dAppr) ;
|
||||
if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP4, bSplitArcs, MCH_CL_SAFEOUT) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
@@ -5231,7 +5240,7 @@ Pocketing::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ
|
||||
Point3d ptP4a = ptP + vtTool * ( dElev + dAppr) ;
|
||||
if ( dElev + dAppr > EPS_SMALL) {
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( AddLinearMove( ptP4a, bSplitArcs) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP4a, bSplitArcs, MCH_CL_SAFEOUT) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// 4b -> movimento di risalita sopra il punto finale
|
||||
@@ -5507,10 +5516,7 @@ bool
|
||||
Pocketing::GetForcedClosed( void)
|
||||
{
|
||||
int nOpen ;
|
||||
if ( GetValInNotes( m_Params.m_sUserNotes, "Open", nOpen) && nOpen == 0)
|
||||
return true ;
|
||||
else
|
||||
return false ;
|
||||
return ( GetValInNotes( m_Params.m_sUserNotes, UN_OPEN, nOpen) && nOpen == 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+8
-2
@@ -35,8 +35,14 @@ class Pocketing : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_POCKETING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nPockets == 0) ; }
|
||||
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 ; }
|
||||
|
||||
|
||||
+1900
-462
File diff suppressed because it is too large
Load Diff
+65
-31
@@ -25,11 +25,15 @@
|
||||
// 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)
|
||||
PtrOwner<ICurveComposite> pCrvPath ; // percorso del centro utensile
|
||||
PtrOwner<ICurveComposite> pCrvRet ; // curva di ritorno per LeadIn/Out a guida
|
||||
PtrOwner<ICurveComposite> pCrvGlideIn ; // curva per LeadIn a guida
|
||||
PtrOwner<ICurveComposite> pCrvGlideOut ; // curva per LeadOut a guida
|
||||
PtrOwner<ICurveComposite> pCrvRet ; // curva di ritorno ( per ora solo caso fori)
|
||||
} ;
|
||||
// tipo percorso
|
||||
typedef std::vector<PathInfoPO> PATHINFOPOVECTOR ;
|
||||
@@ -60,8 +64,14 @@ class PocketingNT : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_POCKETING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nPockets == 0) ; }
|
||||
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 ; }
|
||||
|
||||
@@ -91,6 +101,7 @@ class PocketingNT : public Machining
|
||||
PocketingNT( void) ;
|
||||
|
||||
private :
|
||||
bool MyApply( bool bRecalc, bool bPostApply) ;
|
||||
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
|
||||
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
|
||||
bool SetCurveAllTempProp( int nCrvId, bool bForcedClose, ICurve* pCurve, bool* pbSomeOpen = nullptr) ;
|
||||
@@ -98,15 +109,27 @@ class PocketingNT : public Machining
|
||||
bool ResetCurveAllTempProp( ICurve* pCurve) ;
|
||||
bool Chain( int nGrpDestId) ;
|
||||
ISurfTriMesh* GetRaw( void) ;
|
||||
ISurfTriMesh* GetExtrusionStm( const ISurfFlatRegion* pSfr, const Vector3d& vtTrasl, const Vector3d& vtExtr) ;
|
||||
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) ;
|
||||
Point3d GetStartPointsFromSteps( const STEPINFOPOVECTOR& vStepInfo, int nCrvType) ;
|
||||
bool ManageOpenEdges( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmPart) ;
|
||||
bool ManageLeadInLeadOutGlideCrvs( STEPINFOPOVECTOR& vStepInfo) ;
|
||||
bool GetHomogeneousParts( const ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) const ;
|
||||
bool ExtendOpenEdges( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStm) ;
|
||||
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmExtrusion) ;
|
||||
bool CalcLimitRegion( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrRaw, ISurfFlatRegion* pSfrLimit) ;
|
||||
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 ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dLen, double& dElev) ;
|
||||
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 CalcLimitRegion( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrRaw, ISurfFlatRegion* pSfrLimit) ;
|
||||
bool CalcPaths( STEPINFOPOVECTOR& vStepInfo) ;
|
||||
bool CalcRetCurve( PathInfoPO& PathInfo, const StepInfoPO& StepInfo, const ICurveComposite* pCrvPath,
|
||||
const Vector3d& vtTool, bool bHolePocketing, bool bInVsOut, ICurveComposite* pCrvGlide) ;
|
||||
bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dElev, double dStep, bool bSplitArcs) ;
|
||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) ;
|
||||
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
|
||||
@@ -122,25 +145,35 @@ class PocketingNT : public Machining
|
||||
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 CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtTool, const ICurveComposite* pCrvPath, Point3d& ptP1) ;
|
||||
bool CalcFirstElevation( const Point3d& ptStart, const Point3d& ptP1, const Vector3d& vtTool, const StepInfoPO& currStep,
|
||||
double dSafeZ, double dStep, double& dCurrElev) ;
|
||||
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, bool bAtLeft, bool bSplitArcs,
|
||||
bool bNoneForced, bool bSkipControl) ;
|
||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
|
||||
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) ;
|
||||
bool GetForcedClosed( void) ;
|
||||
bool GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOut) ;
|
||||
bool AdjustContourWithOpenEdges( ICurveComposite* pCompo) ;
|
||||
bool AdjustContourStart( ICurveComposite* pCompo) ;
|
||||
bool CheckSafetyLinearLink( const Point3d& ptCurr, const ISurfFlatRegion* pSfrLimit, const Vector3d& vtTool,
|
||||
const Point3d& ptDest, bool& bSafe) ;
|
||||
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 CalcDistanceFromRawSurface( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist, Vector3d& vtNorm) ;
|
||||
// debug
|
||||
void _debug_draw_sfr( const ISurfFlatRegion* pSfr, bool bUniform) ;
|
||||
void _debug_draw_loop( const ICurveComposite* pCrvCompo, bool bUniform) ;
|
||||
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
|
||||
@@ -176,23 +209,24 @@ class PocketingNT : public Machining
|
||||
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
|
||||
|
||||
bool _m_Debug = false ; // _debug
|
||||
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
|
||||
} ;
|
||||
+945
@@ -0,0 +1,945 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// 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 "/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"
|
||||
// 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
|
||||
bool bToolChanged = true ;
|
||||
if ( ! UpdateToolData( &bToolChanged)) {
|
||||
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 && ! bToolChanged &&
|
||||
( 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() ;
|
||||
|
||||
// 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
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
if ( ! IsEmptyOrSpaces( sErr))
|
||||
m_pMchMgr->SetLastError( 3408, sErr) ;
|
||||
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( bool* pbChanged)
|
||||
{
|
||||
// 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 definito parametro di ritorno, lo assegno
|
||||
if ( pbChanged != nullptr)
|
||||
*pbChanged = bChanged ;
|
||||
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, "LinTol", dLinTol))
|
||||
return dLinTol ;
|
||||
else
|
||||
return Operation::GetApproxLinTol() ;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// 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( bool* pbChanged = nullptr) 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
@@ -0,0 +1,515 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// 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 ;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// 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)) ; }
|
||||
+1
-1
@@ -318,7 +318,7 @@ Processor::ProcessMachining( int nOpId, int nOpInd)
|
||||
return false ;
|
||||
|
||||
// Verifico non sia vuota
|
||||
if ( m_pMchMgr->IsMachiningEmpty())
|
||||
if ( m_pMchMgr->IsMachiningEmpty( NEED_ONE_TP_OK))
|
||||
return true ;
|
||||
|
||||
// Recupero l'utensile della lavorazione corrente
|
||||
|
||||
+11
-5
@@ -449,7 +449,8 @@ SawFinishing::SetGeometry( const SELVECTOR& vIds)
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
// copia temporanea e reset della geometria corrente
|
||||
SELVECTOR vOldId = m_vId ;
|
||||
m_vId.clear() ;
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili
|
||||
for ( const auto& Id : vIds) {
|
||||
@@ -464,7 +465,8 @@ SawFinishing::SetGeometry( const SELVECTOR& vIds)
|
||||
m_vId.emplace_back( Id) ;
|
||||
}
|
||||
// aggiorno lo stato
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty()) ;
|
||||
}
|
||||
@@ -496,6 +498,10 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
|
||||
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 && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
@@ -628,6 +634,9 @@ SawFinishing::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -638,9 +647,6 @@ SawFinishing::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
|
||||
+8
-2
@@ -38,8 +38,14 @@ class SawFinishing : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_SAWFINISHING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nCuts == 0) ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( 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
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
|
||||
+11
-5
@@ -432,7 +432,8 @@ SawRoughing::SetGeometry( const SELVECTOR& vIds)
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
// copia temporanea e reset della geometria corrente
|
||||
SELVECTOR vOldId = m_vId ;
|
||||
m_vId.clear() ;
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili
|
||||
for ( const auto& Id : vIds) {
|
||||
@@ -447,7 +448,8 @@ SawRoughing::SetGeometry( const SELVECTOR& vIds)
|
||||
m_vId.emplace_back( Id) ;
|
||||
}
|
||||
// aggiorno lo stato
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty()) ;
|
||||
}
|
||||
@@ -479,6 +481,10 @@ SawRoughing::Apply( bool bRecalc, bool bPostApply)
|
||||
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 && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
@@ -592,6 +598,9 @@ SawRoughing::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -602,9 +611,6 @@ SawRoughing::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
|
||||
+8
-2
@@ -38,8 +38,14 @@ class SawRoughing : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_SAWROUGHING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nCuts == 0) ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( 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
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
|
||||
+10
-4
@@ -538,7 +538,8 @@ Sawing::SetGeometry( const SELVECTOR& vIds)
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
// copia temporanea e reset della geometria corrente
|
||||
SELVECTOR vOldId = m_vId ;
|
||||
m_vId.clear() ;
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili
|
||||
int nType = GEO_NONE ;
|
||||
@@ -554,7 +555,8 @@ Sawing::SetGeometry( const SELVECTOR& vIds)
|
||||
m_vId.emplace_back( Id) ;
|
||||
}
|
||||
// aggiorno lo stato
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty() || vIds.empty()) ;
|
||||
}
|
||||
@@ -647,6 +649,10 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
|
||||
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 && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
@@ -1255,7 +1261,7 @@ Sawing::GetCurve( SelData Id)
|
||||
pCrvCompo->ToGlob( frGlob) ;
|
||||
vtN.ToGlob( frGlob) ;
|
||||
// sistemazioni varie
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, V_NULL, 0, 1) ;
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, V_NULL, {}, 0, 1) ;
|
||||
// aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino
|
||||
if ( m_Params.m_nWorkSide == SAW_WS_CENTER)
|
||||
m_Params.m_nWorkSide = SAW_WS_RIGHT ;
|
||||
@@ -1304,7 +1310,7 @@ Sawing::GetCurve( SelData Id)
|
||||
pCrvCompo->ToGlob( frGlob) ;
|
||||
vtN.ToGlob( frGlob) ;
|
||||
// sistemazioni varie
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, V_NULL, 0, 1) ;
|
||||
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, V_NULL, {}, 0, 1) ;
|
||||
// aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino
|
||||
if ( m_Params.m_nWorkSide == SAW_WS_CENTER)
|
||||
m_Params.m_nWorkSide = SAW_WS_RIGHT ;
|
||||
|
||||
@@ -39,8 +39,14 @@ class Sawing : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_SAWING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nCuts == 0) ; }
|
||||
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
|
||||
{ if ( 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
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ class __declspec( novtable) ISimulator
|
||||
virtual bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
|
||||
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) = 0 ;
|
||||
virtual bool EnableToolsForVmill( bool bEnable) = 0 ;
|
||||
virtual bool EnableToolTipTrace( bool bEnable) = 0 ;
|
||||
virtual int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) = 0 ;
|
||||
virtual bool SaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) = 0 ;
|
||||
} ;
|
||||
|
||||
@@ -792,12 +792,10 @@ SimulatorMP::FindAndManageOperationStart( bool bStart, bool bFirst, int& nChange
|
||||
// recupero la nuova operazione
|
||||
if ( nChangeTool == 0) {
|
||||
if ( bStart) {
|
||||
//m_nOpId = m_pMchMgr->GetFirstActiveOperation() ;
|
||||
m_nOpInd = 0 ;
|
||||
m_nOpId = ( m_nOpInd < int( m_vOperId.size()) ? m_vOperId[m_nOpInd] : GDB_ID_NULL) ;
|
||||
}
|
||||
else {
|
||||
// m_nOpId = m_pMchMgr->GetNextActiveOperation( m_nOpId) ;
|
||||
++ m_nOpInd ;
|
||||
m_nOpId = ( m_nOpInd < int( m_vOperId.size()) ? m_vOperId[m_nOpInd] : GDB_ID_NULL) ;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@ class SimulatorMP : public ISimulator
|
||||
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 ;
|
||||
|
||||
|
||||
+92
-2
@@ -29,9 +29,11 @@
|
||||
#include "/EgtDev/Include/EGkCDeClosedSurfTmClosedSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkVolZmap.h"
|
||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkSurfLocal.h"
|
||||
#include "/EgtDev/Include/EXeCmdLogOff.h"
|
||||
#include "/EgtDev/Include/EXeSetModifiedOff.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EMkToolConst.h"
|
||||
#include "/EgtDev/Include/EMkOperationConst.h"
|
||||
@@ -88,9 +90,12 @@ SimulatorSP::SimulatorSP( void)
|
||||
m_nAuxEInd = 0 ;
|
||||
m_nExit = 0 ;
|
||||
m_dTDiam = 0 ;
|
||||
m_dTLen = 0 ;
|
||||
m_bCutOnTip = false ;
|
||||
m_bEnableVm = false ;
|
||||
m_dSafeDist = SAFEDIST_STD ;
|
||||
m_bEnableTrace = false ;
|
||||
m_nCurrTrace = GDB_ID_NULL ;
|
||||
m_nAxesMask = 0 ;
|
||||
m_bEnabAxes = true ;
|
||||
m_bShowAxes = true ;
|
||||
@@ -207,7 +212,9 @@ SimulatorSP::Start( bool bFirst)
|
||||
m_sHead.clear() ;
|
||||
m_nExit = 0 ;
|
||||
m_dTDiam = 0 ;
|
||||
m_dTLen = 0 ;
|
||||
m_bCutOnTip = false ;
|
||||
m_nCurrTrace = GDB_ID_NULL ;
|
||||
ResetInterpolation() ;
|
||||
ResetAxes() ;
|
||||
ResetAuxAxes() ;
|
||||
@@ -573,6 +580,7 @@ SimulatorSP::UpdateTool( bool bFirst, int& nErr)
|
||||
m_sHead = sHead ;
|
||||
m_nExit = nExit ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, m_dTDiam) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_LEN, m_dTLen) ;
|
||||
double dTipFeed = 0 ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_TIPFEED, dTipFeed) ;
|
||||
m_bCutOnTip = ( dTipFeed > EPS_MACH_LEN_PAR) ;
|
||||
@@ -616,6 +624,7 @@ SimulatorSP::UpdateTool( bool bFirst, int& nErr)
|
||||
m_sHead = sHead ;
|
||||
m_nExit = nExit ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, m_dTDiam) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_LEN, m_dTLen) ;
|
||||
double dTipFeed = 0 ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_TIPFEED, dTipFeed) ;
|
||||
m_bCutOnTip = ( dTipFeed > EPS_MACH_LEN_PAR) ;
|
||||
@@ -725,11 +734,11 @@ SimulatorSP::FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus
|
||||
bFirst = false ;
|
||||
// recupero la nuova operazione
|
||||
if ( bStart) {
|
||||
m_nOpId = m_pMchMgr->GetFirstActiveOperation() ;
|
||||
m_nOpId = m_pMchMgr->GetFirstActiveOperation( true) ;
|
||||
m_nOpInd = 0 ;
|
||||
}
|
||||
else
|
||||
m_nOpId = m_pMchMgr->GetNextActiveOperation( m_nOpId) ;
|
||||
m_nOpId = m_pMchMgr->GetNextActiveOperation( m_nOpId, true) ;
|
||||
// ciclo sulle successive operazioni
|
||||
while ( m_nOpId != GDB_ID_NULL) {
|
||||
// se lavorazione valida
|
||||
@@ -888,6 +897,8 @@ SimulatorSP::FindAndManagePathStart( int& nStatus)
|
||||
m_dCoeff = 0 ;
|
||||
}
|
||||
}
|
||||
// reset eventuale curva di TipTrace
|
||||
m_nCurrTrace = GDB_ID_NULL ;
|
||||
// se trovato nuovo CLpath con entità, gestisco inizio percorso di lavoro
|
||||
if ( m_nEntId != GDB_ID_NULL) {
|
||||
++ m_nCLPathInd ;
|
||||
@@ -955,6 +966,8 @@ SimulatorSP::ManagePathEnd( int& nStatus)
|
||||
// gestione stato
|
||||
if ( ! bOk)
|
||||
nStatus = CalcStatusOnError( 0) ;
|
||||
// reset eventuale curva di TipTrace
|
||||
m_nCurrTrace = GDB_ID_NULL ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -1098,6 +1111,10 @@ SimulatorSP::ManageSingleMove( int& nStatus, double& dMove)
|
||||
for ( int i = 0 ; i < int( m_VmId.size()) ; ++ i)
|
||||
bOkI = m_pGeomDB->GetGlobFrame( m_VmId[i], vFrVzmI[i]) && bOkI ;
|
||||
|
||||
// Eventuale primo tracciamento punto tip utensile
|
||||
if ( m_nCurrTrace == GDB_ID_NULL)
|
||||
TraceToolTipMove( nMoveType) ;
|
||||
|
||||
// Dati per eventuale verifica di collisione
|
||||
int nCdInd, nObjInd ;
|
||||
bool bCollCheck = true ;
|
||||
@@ -1194,6 +1211,8 @@ SimulatorSP::ManageSingleMove( int& nStatus, double& dMove)
|
||||
}
|
||||
// eseguo eventuale collision check
|
||||
bCollCheck = bCollCheck && ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
|
||||
// eventuale tracciamento punto tip utensile
|
||||
TraceToolTipMove( nMoveType) ;
|
||||
}
|
||||
}
|
||||
// Eseguo movimento su arco
|
||||
@@ -1278,6 +1297,8 @@ SimulatorSP::ManageSingleMove( int& nStatus, double& dMove)
|
||||
}
|
||||
// eseguo eventuale collision check
|
||||
bCollCheck = bCollCheck && ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
|
||||
// eventuale tracciamento punto tip utensile
|
||||
TraceToolTipMove( nMoveType) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1338,6 +1359,8 @@ SimulatorSP::ManageSingleMove( int& nStatus, double& dMove)
|
||||
}
|
||||
// eseguo eventuale collision check
|
||||
bCollCheck = bCollCheck && ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
|
||||
// eventuale tracciamento punto tip utensile
|
||||
TraceToolTipMove( nMoveType) ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1626,6 +1649,70 @@ SimulatorSP::ResetCollisionMark( void)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SimulatorSP::EnableToolTipTrace( bool bEnable)
|
||||
{
|
||||
if ( bEnable != m_bEnableTrace) {
|
||||
if ( bEnable) {
|
||||
|
||||
}
|
||||
else {
|
||||
int nTraceCrvId = m_nCurrTrace ;
|
||||
while ( nTraceCrvId != GDB_ID_NULL) {
|
||||
m_pGeomDB->SetStatus( nTraceCrvId, GDB_ST_OFF) ;
|
||||
nTraceCrvId = m_pGeomDB->GetPrev( nTraceCrvId) ;
|
||||
}
|
||||
m_nCurrTrace = GDB_ID_NULL ;
|
||||
}
|
||||
}
|
||||
m_bEnableTrace = bEnable ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SimulatorSP::TraceToolTipMove( int nMoveType)
|
||||
{
|
||||
// verifico che la tracciatura sia abilitata
|
||||
if ( ! m_bEnableTrace)
|
||||
return true ;
|
||||
// recupero il gruppo per le curve di traccia
|
||||
int nTraceGrpId ;
|
||||
if ( ! m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_TOOLTRACE, nTraceGrpId))
|
||||
return false ;
|
||||
// recupero posizione utensile corrente
|
||||
int nExitId = m_pMachine->GetExitId( m_sHead, m_nExit) ;
|
||||
Frame3d frExit ;
|
||||
if ( ! m_pGeomDB->GetGroupGlobFrame( nExitId, frExit))
|
||||
return false ;
|
||||
Point3d ptTip = frExit.Orig() - m_dTLen * frExit.VersZ() ;
|
||||
// disabilito gestione segnalazione modifiche progetto
|
||||
SetModifiedOff modOff ;
|
||||
// eseguo tracciatura
|
||||
static string TRACE_MOVE = "Move" ;
|
||||
if ( m_nCurrTrace == GDB_ID_NULL) {
|
||||
m_nCurrTrace = ExeCreateGeoPoint( nTraceGrpId, ptTip, GDB_ID_ROOT) ;
|
||||
m_pGeomDB->SetInfo( m_nCurrTrace, TRACE_MOVE, nMoveType) ;
|
||||
m_pGeomDB->SetStipple( m_nCurrTrace, ( nMoveType == 0 ? 3 : 0), 0x8C8C) ;
|
||||
}
|
||||
else {
|
||||
int nTraMove ;
|
||||
m_pGeomDB->GetInfo( m_nCurrTrace, TRACE_MOVE, nTraMove) ;
|
||||
if ( ( nMoveType == 0) == ( nTraMove == 0))
|
||||
ExeAddCurveCompoLine( m_nCurrTrace, ptTip, true, GDB_ID_ROOT) ;
|
||||
else {
|
||||
Point3d ptPrev ; ExeEndPoint( m_nCurrTrace, GDB_ID_ROOT, ptPrev) ;
|
||||
m_nCurrTrace = ExeCreateGeoPoint( nTraceGrpId, ptPrev, GDB_ID_ROOT) ;
|
||||
ExeAddCurveCompoLine( m_nCurrTrace, ptTip, true, GDB_ID_ROOT) ;
|
||||
m_pGeomDB->SetInfo( m_nCurrTrace, TRACE_MOVE, nMoveType) ;
|
||||
m_pGeomDB->SetStipple( m_nCurrTrace, ( nMoveType == 0 ? 3 : 0), 0x8C8C) ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SimulatorSP::OnInit( void)
|
||||
@@ -2472,6 +2559,9 @@ SimulatorSP::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
|
||||
// Verifico collisioni
|
||||
int nCdInd, nObjInd ;
|
||||
bool bCollCheck = ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
|
||||
// eventuale tracciamento punto tip utensile
|
||||
TraceToolTipMove( nMoveType) ;
|
||||
// Se riscontrata collisione
|
||||
if ( ! bCollCheck) {
|
||||
// Richiamo funzione di convalida collisione
|
||||
int nPrevErr ;
|
||||
|
||||
@@ -45,6 +45,7 @@ class SimulatorSP : public ISimulator
|
||||
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 ; }
|
||||
@@ -81,6 +82,7 @@ class SimulatorSP : public ISimulator
|
||||
{ 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) ;
|
||||
@@ -161,6 +163,7 @@ class SimulatorSP : public ISimulator
|
||||
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
|
||||
@@ -169,6 +172,8 @@ class SimulatorSP : public ISimulator
|
||||
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_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
|
||||
|
||||
+1776
-666
File diff suppressed because it is too large
Load Diff
+54
-13
@@ -18,6 +18,7 @@
|
||||
#include "SurfFinishingData.h"
|
||||
#include "ToolData.h"
|
||||
#include "MachiningConst.h"
|
||||
#include "GeoConst.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
@@ -62,8 +63,14 @@ class SurfFinishing : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_SAWFINISHING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nPaths == 0) ; }
|
||||
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 ; }
|
||||
|
||||
@@ -98,13 +105,23 @@ class SurfFinishing : public Machining
|
||||
bool VerifyGeometry( SelData Id, int& nSubs) ;
|
||||
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
|
||||
bool Chain( int nGrpDestId) ;
|
||||
bool ProcessSfr( int nPathId, int nPvId, int nClId) ;
|
||||
bool GetSurfacesByIds( SURFLOCALVECTOR& vSrfLoc, SURFLOCALVECTOR& vSrfSuppLoc, Frame3d& frSurf) ;
|
||||
bool SetCAvTlStmForSurfaces( ICAvToolSurfTm* pCAvTlStm, const ISurfFlatRegion* pSfrCnt, double dDepth,
|
||||
double dToolLen, double dToolDiam, double dToolCornRad,
|
||||
double dToolSideAng, double dToolMaxMat, double dMachOffsR,
|
||||
const SURFLOCALVECTOR& vSurfLoc, const SURFLOCALVECTOR& vSurfSuppLoc) ;
|
||||
bool EraseMaxDownSurf( const SURFLOCALVECTOR& vSurfLoc, const Frame3d& frSurf, const Vector3d& vtTool,
|
||||
double dDepth, ISurfFlatRegion* pSfrCnt) ;
|
||||
bool ProcessCrvCompo( int nPathId, int nPvId, int nClId) ;
|
||||
bool SimplifyCurve( ICurveComposite* pCompo) const ;
|
||||
bool ProcessSfr( int nPathId, int nPvId, int nClId) ;
|
||||
bool SimplifyCurve( ICurveComposite* pCompo,
|
||||
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) ;
|
||||
ICurveComposite* pCrv) const ;
|
||||
// lavorazioni per superfici
|
||||
bool AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrPock,
|
||||
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
||||
@@ -115,10 +132,25 @@ class SurfFinishing : public Machining
|
||||
bool AddZConst( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
|
||||
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
||||
bool AddOptimal( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
|
||||
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
||||
bool AddPencil( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
|
||||
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, double dDepth, double dElev, bool bSplitArcs) ;
|
||||
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* pSfr, VECTORPATHS& vCrvPaths) ;
|
||||
bool GetSfrBySilhouette( ICAvParSilhouettesSurfTm* pCavParSilh, double dDepth, double dSilTolSamp,
|
||||
@@ -128,19 +160,23 @@ class SurfFinishing : public Machining
|
||||
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) ;
|
||||
ICAvParSilhouettesSurfTm* GetParSilhouettesForZConst( const ISURFTMPOVECTOR& vStm, const ISurfFlatRegion* pSfr) const ;
|
||||
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* pSfrZConst, const ISurfFlatRegion* pSfrCnt,
|
||||
const Frame3d& frSurf, const Vector3d& vtTool, double dDepth,
|
||||
const SURFLOCALVECTOR& vSrfLoc, ICAvToolSurfTm* pCAvTlStm, VECTORPATHS& vPaths) const ;
|
||||
bool CalcOptimalSpiralCurves( const ISurfFlatRegion* pSfrSpiral, const ISurfFlatRegion* pSfrCnt, 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 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 ISurfFlatRegion* pSfr, double dDepth, ICRVCOMPOPOVECTOR& vCrvPath) const ;
|
||||
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 AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
|
||||
@@ -153,12 +189,17 @@ class SurfFinishing : public Machining
|
||||
const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, Point3d& ptP1) const ;
|
||||
bool GetSurfaceNormalAtPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
const Point3d& ptTool, const Vector3d& vtTool, Vector3d& vtNorm) const ;
|
||||
bool GetActiveSurfaces( INTVECTOR& vSurfId) const ;
|
||||
bool MarchingSquares( const VECTORCOLLISIONSFR& vPntM, bool bSpiral, int nStepX, int nStepY, double dClippingAngle,
|
||||
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, bool bSpiral, const Vector3d& vtAxL,
|
||||
const Vector3d& vtMoveL, double dCosSplitAngle, ICAvToolSurfTm* pCAvTlStm, int _nInd_debug) const ;
|
||||
bool TestSubEdges( std::unordered_map<int, Point3d>& umEdgePnt, const INTVECTOR& vEdgeInd, bool bSpiral, int nFirst, int nLast,
|
||||
const VECTORCOLLISIONSFR& vPntM, int nStepX, const Vector3d vtAxL, const Vector3d& vtMoveL,
|
||||
double dCosSplitAng, ICAvToolSurfTm* pCAvTlStm, int _nInd_debug) const ;
|
||||
bool MarchingSquares( const VECTORCOLLISIONSFR& vPntM, bool bSpiral, double dOffsTol, int nStepX, int nStepY, double dClippingAngle,
|
||||
const Vector3d& vtAxL, const Vector3d& vtMoveL, ICAvToolSurfTm* pCAvTlStm,
|
||||
ICRVCOMPOPOVECTOR& vCrvCompo) const ;
|
||||
bool CalcShapedPoint( const PNTUVVECT& myInfoStart, const PNTUVVECT& myInfoEnd, bool bSpiral, const Vector3d& vtAxL,
|
||||
const Vector3d& vtMoveL, double dClippingAngle, ICAvToolSurfTm* pCAvTlStm, Point3d& ptShaped, int _debug_ind = -1) const ;
|
||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
|
||||
|
||||
@@ -392,7 +392,7 @@ SurfFinishingData::VerifySubType( int nVal) const
|
||||
return ( nVal == SURFFIN_SUB_ZIGZAG || nVal == SURFFIN_SUB_ONEWAY ||
|
||||
nVal == SURFFIN_SUB_SPIRALIN || nVal == SURFFIN_SUB_SPIRALOUT ||
|
||||
nVal == SURFFIN_SUB_Z_CONST || nVal == SURFFIN_SUB_OPTIMAL ||
|
||||
nVal == SURFFIN_SUB_PROJECT) ;
|
||||
nVal == SURFFIN_SUB_PROJECT || nVal == SURFFIN_SUB_PENCIL) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+188
-102
@@ -95,6 +95,7 @@ static string KEY_SURF_POCK = "SurfPock_" ;
|
||||
static string KEY_SURF_LIMIT = "SurfLimit_" ;
|
||||
static string KEY_OPEN = "OPEN" ;
|
||||
static string KEY_THICK = "THICK" ;
|
||||
static string SRF_SUPP_LAYER_NAME = "SUPP" ;
|
||||
|
||||
#define ENABLE_DEBUG_SFR 0
|
||||
#define ENABLE_DEBUG_STM_NORMAL_SHADER 0
|
||||
@@ -109,6 +110,7 @@ static string KEY_THICK = "THICK" ;
|
||||
const double STEP_TOL = 10. * EPS_SMALL ;
|
||||
const double SIL_DEPTH_TOL = 100. * EPS_SMALL ;
|
||||
const double OFFS_CORR_OPEN_EDGES = 25. * EPS_SMALL ;
|
||||
const double SUPP_SURF_RADIAL_OFFS = 5. ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
USEROBJ_REGISTER( GetOperationClass( OPER_SURFROUGHING), SurfRoughing) ;
|
||||
@@ -503,7 +505,8 @@ SurfRoughing::SetGeometry( const SELVECTOR& vIds)
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
// copia temporanea e reset della geometria corrente
|
||||
SELVECTOR vOldId = m_vId ;
|
||||
m_vId.clear() ;
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili
|
||||
for ( const auto& Id : vIds) {
|
||||
@@ -518,7 +521,8 @@ SurfRoughing::SetGeometry( const SELVECTOR& vIds)
|
||||
m_vId.emplace_back( Id) ;
|
||||
}
|
||||
// aggiorno lo stato
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty()) ;
|
||||
}
|
||||
@@ -571,6 +575,10 @@ SurfRoughing::MyApply( bool bRecalc, bool bPostApply)
|
||||
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 && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
@@ -706,6 +714,9 @@ SurfRoughing::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -716,9 +727,6 @@ SurfRoughing::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
@@ -1389,8 +1397,9 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// assegno il versore fresa
|
||||
Vector3d vtTool = vtExtr ;
|
||||
|
||||
// calcolo l'elevazione al di sopra di tale regione
|
||||
// calcolo l'elevazione al di sopra di tale regione e l'affondamento al di sotto
|
||||
double dSfrMaxElev = 0. ;
|
||||
double dSfrMaxDepth = 0. ;
|
||||
for ( int nC = 0 ; nC < pSfrSgro->GetChunkCount() ; ++ nC) {
|
||||
for ( int nL = 0 ; nL < pSfrSgro->GetLoopCount( nC) ; ++ nL) {
|
||||
// recupero la curva
|
||||
@@ -1406,8 +1415,17 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
m_pMchMgr->SetLastError( 3033, "Error in SurfRoughing : Calc Region elevation failed") ;
|
||||
return false ;
|
||||
}
|
||||
// l'elevazione finale è la massima trovata
|
||||
// aggiorno l'elevazione massima
|
||||
dSfrMaxElev = max( dSfrElev, dSfrMaxElev) ;
|
||||
// determino l'affondamento
|
||||
pCrvLoop->Invert() ;
|
||||
double dSfrDepth = 0. ;
|
||||
if ( ! CalcRegionElevation( pCrvLoop, vtTool, 0., 0.5 * m_TParams.m_dDiam, m_TParams.m_dLen, dSfrDepth)) {
|
||||
m_pMchMgr->SetLastError( 3033, "Error in SurfRoughing : Calc Region elevation failed") ;
|
||||
return false ;
|
||||
}
|
||||
// aggiorno l'affondamento massimo
|
||||
dSfrMaxDepth = max( dSfrDepth, dSfrMaxDepth) ;
|
||||
}
|
||||
}
|
||||
// se la regione interseca il grezzo
|
||||
@@ -1420,7 +1438,11 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
pSfrSgro->Translate( dSfrMaxElev * vtTool) ;
|
||||
// la Depth viene incrementata del valore di traslazione
|
||||
dDepth += dSfrMaxElev ;
|
||||
dSfrMaxDepth += dSfrMaxElev ;
|
||||
}
|
||||
// aggiustiamo l'affondamento se eccesivo
|
||||
const double MAX_DEPTH_EXTRA = 3 ;
|
||||
dDepth = min( dDepth, dSfrMaxDepth + MAX_DEPTH_EXTRA) ;
|
||||
|
||||
// controllo se richiesto PlaneZDetection
|
||||
bool bPlaneZDetection = false ;
|
||||
@@ -1446,9 +1468,10 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// verifico se archi vanno approssimati con segmenti di retta
|
||||
bool bSplitArcs = GetSplitArcs( vtTool) ;
|
||||
|
||||
// recupero le superfici attive
|
||||
// recupero le superfici attive e le superfici di supporto
|
||||
INTVECTOR vSurfId ;
|
||||
GetActiveSurfaces( vSurfId) ;
|
||||
INTVECTOR vSurfSuppId ;
|
||||
GetActiveSurfaces( vSurfId, vSurfSuppId) ;
|
||||
if ( vSurfId.empty()) {
|
||||
m_pMchMgr->SetLastError( 3023, "Error in SurfRoughing : missing surfaces") ;
|
||||
return false ;
|
||||
@@ -1468,16 +1491,16 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
|
||||
// costruisco una superficie di estrusione della curva (devo determinare parte della regione limite)
|
||||
Vector3d vtLimitExtr = - vtTool * 1.5 * max( b3Raw.GetDimX(), max( b3Raw.GetDimY(), b3Raw.GetDimZ())) ;
|
||||
PtrOwner<ISurfTriMesh> pStmLimit( GetStmOutSideSfr( pSfrSgro, pStmRaw, vtLimitExtr)) ;
|
||||
PtrOwner<ISurfTriMesh> pStmLimit( GetStmOutSideSfr( pSfrSgro, dDepth, pStmRaw, vtLimitExtr)) ;
|
||||
if ( IsNull( pStmLimit))
|
||||
return false ;
|
||||
|
||||
// inizializzo la classe di intersezione tra la superficie trimesh limite e piani paralleli ( quelli di lavoro)
|
||||
IntersParPlanesSurfTm IPPStm1( frSfr, *pStmLimit) ;
|
||||
|
||||
// inizializzo la classe di calcolo delle silhouette nei piani come sopra
|
||||
// inizializzo la classe di calcolo delle silhouette per le superfici attive nei piani come sopra
|
||||
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vSurfId.size()) ;
|
||||
CISURFTMPVECTOR vpStm ; vpStm.reserve( vSurfId.size()) ;
|
||||
CISURFTMPVECTOR vpStm ; vpStm.reserve( vSurfId.size()) ;
|
||||
for ( int i = 0 ; i < int( vSurfId.size()) ; ++ i) {
|
||||
vSurfL.emplace_back( m_pGeomDB, vSurfId[i], GLOB_FRM) ;
|
||||
if ( vSurfL[i].Get() == nullptr)
|
||||
@@ -1495,6 +1518,27 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
if ( IsNull( pCavParSilh) || ! pCavParSilh->SetData( vpStm, frSfr, SILH_TOL))
|
||||
return false ;
|
||||
|
||||
// inizializzo la classe di calcolo delle silhouette per le superfici di supporto nei piani come sopra
|
||||
SURFLOCALVECTOR vSurfL_supp ;
|
||||
CISURFTMPVECTOR vpStm_supp ;
|
||||
PtrOwner<ICAvParSilhouettesSurfTm> pCavParSilh_supp( CreateCAvParSilhouettesSurfTm()) ;
|
||||
if ( IsNull( pCavParSilh_supp))
|
||||
return false ;
|
||||
if ( ! vSurfSuppId.empty()) {
|
||||
vSurfL_supp.reserve( vSurfSuppId.size()) ;
|
||||
vpStm.reserve( vSurfSuppId.size()) ;
|
||||
for ( int i = 0 ; i < int( vSurfSuppId.size()) ; ++ i) {
|
||||
vSurfL_supp.emplace_back( m_pGeomDB, vSurfSuppId[i], GLOB_FRM) ;
|
||||
if ( vSurfL_supp[i].Get() == nullptr)
|
||||
return false ;
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( vSurfL_supp[i].Get()) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0)
|
||||
vpStm_supp.emplace_back( pStm) ;
|
||||
}
|
||||
if ( ! pCavParSilh_supp->SetData( vpStm_supp, frSfr, SILH_TOL))
|
||||
return false ;
|
||||
}
|
||||
|
||||
// vettore Id salvati nel gruppo Temp
|
||||
INTINTVECTOR vPocket ;
|
||||
// vettore delle curve composite con proprietà Aperto/Chiuso riferite ai vari step della curva originale
|
||||
@@ -1606,6 +1650,14 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// aggiorno step per progressBar
|
||||
++ nProgressBarStep ;
|
||||
|
||||
// affondamento per calcolo regioni (limito poco sotto il grezzo)
|
||||
double dSfrDepth = it->dDepth ;
|
||||
double dSfrDeltaDepth = 0 ;
|
||||
if ( dSfrDepth < -dSfrMaxDepth) {
|
||||
dSfrDeltaDepth = dSfrDepth + dSfrMaxDepth ;
|
||||
dSfrDepth = -dSfrMaxDepth ;
|
||||
}
|
||||
|
||||
/* ******************** Regione estesa di lavoro ******************** */
|
||||
// regione di lavoro allo step corrente ( definita dalla curva di lavoro )
|
||||
PtrOwner<ISurfFlatRegion> pSfr( CloneSurfFlatRegion( pSfrSgro)) ;
|
||||
@@ -1613,12 +1665,12 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
m_pMchMgr->SetLastError( 3024, "Error in SurfRoughing : region not computable") ;
|
||||
return false ;
|
||||
}
|
||||
pSfr->Translate( ( it->dDepth + GetOffsL()) * vtTool) ;
|
||||
pSfr->Translate( ( dSfrDepth + GetOffsL()) * vtTool) ;
|
||||
|
||||
/* ******************** Regione adattata al grezzo ******************** */
|
||||
// questa regione bisogna ridurla basandosi sulla geometria del grezzo, in modo da non lavorare
|
||||
// parti in eccesso ; taglio il grezzo sul piano corrente e interseco con questa regione
|
||||
PtrOwner<ISurfFlatRegion> pSfrRaw( GetSfrByStmIntersection( IPPStm, it->dDepth + GetOffsL(), 0)) ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrRaw( GetSfrByStmIntersection( IPPStm, dSfrDepth + GetOffsL(), 0)) ;
|
||||
if ( IsNull( pSfrRaw)) {
|
||||
m_pMchMgr->SetLastError( 3027, "Error in SurfRoughing : Slicing Raw failed") ;
|
||||
return false ;
|
||||
@@ -1638,8 +1690,8 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
if ( IsNull( pSfrOutCompo))
|
||||
return false ;
|
||||
if ( pStmLimit->IsValid() && pStmLimit->GetTriangleCount() > 0) {
|
||||
pSfrOutCompo.Set( GetSfrByStmIntersection( IPPStm1, it->dDepth + GetOffsL(), 0)) ;
|
||||
if ( IsNull( pSfrRaw)) {
|
||||
pSfrOutCompo.Set( GetSfrByStmIntersection( IPPStm1, dSfrDepth + GetOffsL(), 0)) ;
|
||||
if ( IsNull( pSfrOutCompo)) {
|
||||
m_pMchMgr->SetLastError( 3027, "Error in SurfRoughing : Slicing Raw failed") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1647,7 +1699,7 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
|
||||
/* *************************** Silhouette **************************** */
|
||||
// determino la regione da non lavorare e la sottraggo
|
||||
double dSilDepth = it->dDepth - ( it->bPlaneZStep ? SIL_DEPTH_TOL : 0.) ;
|
||||
double dSilDepth = dSfrDepth - ( it->bPlaneZStep ? SIL_DEPTH_TOL : 0.) ;
|
||||
bool bOkSil = false ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrSil_Hypothetical( CreateSurfFlatRegion()) ;
|
||||
if ( IsNull( pSfrSil_Hypothetical))
|
||||
@@ -1658,13 +1710,42 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
return false ;
|
||||
}
|
||||
if ( ! IsNull( pSfrSil) && ! it->bPlaneZStep) {
|
||||
pSfrSil->Offset( GetOffsR(), ICurve::OFF_CHAMFER) ; // offset radiale sulla Silhouette
|
||||
pSfrSil_Hypothetical.Set( CloneSurfFlatRegion( pSfrSil)) ; // regione di silhouette ipotetica
|
||||
pSfr->Subtract( *pSfrSil) ; // sottraggo le parti da non lavorare
|
||||
// provo prima con un Offset Chamfer, se non funziona provo con il Fillet ( pezza da sistemare ! )
|
||||
PtrOwner<ISurfFlatRegion> pSfrSilCheck( pSfrSil->CreateOffsetSurf( GetOffsR(), ICurve::OFF_CHAMFER)) ;
|
||||
if ( IsNull( pSfrSilCheck) || ! pSfrSilCheck->IsValid()) {
|
||||
m_pMchMgr->SetLastError( 3024, "Error in SurfRoughing : region not computable") ;
|
||||
return false ;
|
||||
}
|
||||
pSfrSil_Hypothetical.Set( CloneSurfFlatRegion( pSfrSilCheck)) ; // regione di silhouette ipotetica
|
||||
// sottraggo le parti da non lavorare
|
||||
if ( ! pSfr->Subtract( *pSfrSilCheck)) {
|
||||
// se non riesco, provo con un Offset di tipo Fillet
|
||||
pSfrSil->Offset( GetOffsR(), ICurve::OFF_FILLET) ;
|
||||
pSfrSil_Hypothetical.Set( CloneSurfFlatRegion( pSfrSil)) ; // regione di silhouette ipotetica
|
||||
if ( ! pSfr->Subtract( *pSfrSil))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
if ( ! pSfr->IsValid() || pSfr->GetChunkCount() == 0) // se superficie non valida
|
||||
continue ; // passo allo step successivo ( la silhouette coincide con il grezzo )
|
||||
|
||||
/* ************************** superfici di supporto ************************ */
|
||||
if ( ! vSurfL_supp.empty()) {
|
||||
bool bOkSil_supp = false ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrSil_supp( GetSfrSilhouette( pCavParSilh_supp, dSilDepth, SILH_TOL, bOkSil_supp)) ;
|
||||
if ( ! bOkSil_supp) {
|
||||
m_pMchMgr->SetLastError( 3024, "Error in SurfRoughing : region not computable") ;
|
||||
return false ;
|
||||
}
|
||||
if ( ! IsNull( pSfrSil_supp)) {
|
||||
pSfrSil_supp->Offset( SUPP_SURF_RADIAL_OFFS, ICurve::OFF_CHAMFER) ; // offset radiale sulla Silhouette
|
||||
pSfr->Subtract( *pSfrSil_supp) ; // sottraggo le parti da non lavorare
|
||||
pSfrSil->Add( *pSfrSil_supp) ; // aggiungo la regione alla Silhouette
|
||||
}
|
||||
if ( ! pSfr->IsValid() || pSfr->GetChunkCount() == 0) // se superficie non valida
|
||||
continue ; // passo allo step successivo
|
||||
}
|
||||
|
||||
// salvo la superficie rimossa
|
||||
delete( it->pSfrRemoved) ;
|
||||
it->pSfrRemoved = CloneSurfFlatRegion( pSfrRemoved_tmp) ;
|
||||
@@ -1802,12 +1883,12 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
}
|
||||
}
|
||||
|
||||
// se si tratta di un SottoStep, chiudo tutti i lati aperti troppo corti
|
||||
// chiudo tutti i lati aperti troppo corti
|
||||
if ( ! CloseOpenEdgesUnderTolerance( pSfr, m_TParams.m_dDiam - 200 * EPS_SMALL)) {
|
||||
m_pMchMgr->SetLastError( 3029, "Error in SurfRoughing : Simplify Chunks for SubSteps failed") ;
|
||||
return false ;
|
||||
}
|
||||
if ( it->bSubStep) {
|
||||
if ( ! CloseOpenEdgesUnderTolerance( pSfr, m_TParams.m_dDiam - 200 * EPS_SMALL)) {
|
||||
m_pMchMgr->SetLastError( 3029, "Error in SurfRoughing : Simplify Chunks for SubSteps failed") ;
|
||||
return false ;
|
||||
}
|
||||
// rimuovo tutti i Chunk snelli
|
||||
RemoveChunksUnderTolerance( pSfr, m_dSubStepToler, pSfrLimit) ;
|
||||
// se dopo la semplificazione non rimane nulla, allora passo allo step successivo
|
||||
@@ -1834,6 +1915,10 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
DrawLoopsSurf( pSfr, false, Color( .0, 1., 0., .5), it->bSubStep, ToString( it->dDepth)) ;
|
||||
#endif
|
||||
|
||||
// eventuale traslazione per ultima passata appena sotto il grezzo
|
||||
if ( dSfrDeltaDepth < -EPS_SMALL)
|
||||
pSfr->Translate( dSfrDeltaDepth * vtTool) ;
|
||||
|
||||
// la salvo nel gruppo temporaneo
|
||||
int nNew_SfrPock_Id = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nTempId, Release( pSfr)) ;
|
||||
if ( nNew_SfrPock_Id == GDB_ID_NULL) {
|
||||
@@ -2010,19 +2095,22 @@ SurfRoughing::GetRaw( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ISurfTriMesh*
|
||||
SurfRoughing::GetStmOutSideSfr( const ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmRaw, const Vector3d& vtExtr) const
|
||||
SurfRoughing::GetStmOutSideSfr( const ISurfFlatRegion* pSfr, double dDepth, const ISurfTriMesh* pStmRaw, const Vector3d& vtExtr) const
|
||||
{
|
||||
// controllo dei parametri
|
||||
if ( pSfr == nullptr || ! pSfr->IsValid() ||
|
||||
pStmRaw == nullptr || ! pStmRaw->IsValid())
|
||||
return nullptr ;
|
||||
|
||||
double dTol = 100 * EPS_SMALL ;
|
||||
|
||||
// creo una copia della pSfr mediante un piccolo offset correttivo (per problemi con archi)
|
||||
PtrOwner<ISurfFlatRegion> pSfrOffs( pSfr->CreateOffsetSurf( 100 * EPS_SMALL, ICurve::OFF_FILLET)) ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrOffs( pSfr->CreateOffsetSurf( dTol, ICurve::OFF_FILLET)) ;
|
||||
if ( IsNull( pSfrOffs) || ! pSfrOffs->IsValid())
|
||||
return nullptr ;
|
||||
pSfrOffs->Translate( dTol * pSfr->GetNormVersor()) ;
|
||||
|
||||
// definisco il vettore delle curve dei i bordi della regione
|
||||
// definisco il vettore delle curve dei bordi della regione
|
||||
CICURVEPVECTOR vpCrv ;
|
||||
bool bOk = true ;
|
||||
|
||||
@@ -2038,13 +2126,34 @@ SurfRoughing::GetStmOutSideSfr( const ISurfFlatRegion* pSfr, const ISurfTriMesh*
|
||||
}
|
||||
}
|
||||
|
||||
// definisco la TrimMesh limite (inizialmente vuota)
|
||||
// definisco la TrimMesh limite ( inizialmente come copia del grezzo)
|
||||
PtrOwner<ISurfTriMesh> pStmLimit( CloneSurfTriMesh( pStmRaw)) ;
|
||||
bOk = bOk && ( ! IsNull( pStmLimit) && pStmLimit->IsValid()) ;
|
||||
|
||||
// tengo solo le parti di superficie che sono effettivamente vicine alla regione di sgrossatura
|
||||
// box della superficie piana
|
||||
BBox3d BBoxSfr ;
|
||||
bOk = bOk && pSfrOffs->GetLocalBBox( BBoxSfr) ;
|
||||
double dExtraX = abs( dDepth * ( pSfrOffs->GetNormVersor() * X_AX)) ;
|
||||
double dExtraY = abs( dDepth * ( pSfrOffs->GetNormVersor() * Y_AX)) ;
|
||||
double dExtraZ = abs( dDepth * ( pSfrOffs->GetNormVersor() * Z_AX)) ;
|
||||
BBoxSfr.Expand( dExtraX, dExtraY, dExtraZ) ;
|
||||
// scorro le parts
|
||||
for ( int nPart = 0 ; nPart < pStmLimit->GetPartCount() && bOk ; ++ nPart) {
|
||||
// calcolo il box della part corrente
|
||||
BBox3d BBoxPart ;
|
||||
bOk = bOk && pStmLimit->GetPartLocalBBox( nPart, BBoxPart) ;
|
||||
// se non c'è intersezione con i Box, elimino la parte corrente
|
||||
BBox3d BBoxInt ;
|
||||
if ( ! BBoxSfr.FindIntersection( BBoxPart, BBoxInt)) {
|
||||
bOk = pStmLimit->RemovePart( nPart) ;
|
||||
-- nPart ;
|
||||
}
|
||||
}
|
||||
|
||||
// definisco la superficie di estrusione
|
||||
if ( bOk) {
|
||||
PtrOwner<ISurfTriMesh> pStmExtr( GetSurfTriMeshByRegionExtrusion( vpCrv, vtExtr)) ;
|
||||
PtrOwner<ISurfTriMesh> pStmExtr( GetSurfTriMeshByRegionExtrusion( vpCrv, ( 1 + 2. * dTol) * vtExtr)) ;
|
||||
bOk = ( ! IsNull( pStmExtr) && pStmExtr->IsValid()) ;
|
||||
// la superficie deve definire un volume
|
||||
double dVol = 0. ;
|
||||
@@ -2173,7 +2282,8 @@ SurfRoughing::GetSfrSilhouette( ICAvParSilhouettesSurfTm* pCavParSilh, double dD
|
||||
if ( ! IsNull( pTempCrv) &&
|
||||
pTempCrv->FromPolyArc( PA) &&
|
||||
pTempCrv->RemoveSmallDefects( SILH_ARC_TOL / 2, ANG_TOL_STD_DEG) &&
|
||||
pTempCrv->MergeCurves( SILH_ARC_TOL / 2, ANG_TOL_STD_DEG))
|
||||
pTempCrv->MergeCurves( SILH_ARC_TOL / 2, ANG_TOL_STD_DEG) &&
|
||||
pTempCrv->IsValid())
|
||||
pSilCrv.Set( pTempCrv) ;
|
||||
}
|
||||
// aggiungo per regione
|
||||
@@ -2186,10 +2296,17 @@ SurfRoughing::GetSfrSilhouette( ICAvParSilhouettesSurfTm* pCavParSilh, double dD
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfRoughing::GetActiveSurfaces( INTVECTOR& vSurfId) const
|
||||
SurfRoughing::GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) const
|
||||
{
|
||||
// NB.
|
||||
// - vSrufInd contiene gli Id delle superfici selezionate ( nel caso non ci siano superfici
|
||||
// seleionate, allora vengono considerate tutte le superfici presenti nei grezzi attivi della fase
|
||||
// - vSurfSupp contiene gli Id delle superfici di supporto, quindi quelle superici da cui si vuole
|
||||
// mantenere una certa distanza con l'utensile ( senza che siano selezionate)
|
||||
|
||||
// pulisco vettore superfici
|
||||
vSurfId.clear() ;
|
||||
vSurfSuppId.clear() ;
|
||||
// verifiche
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
@@ -2199,13 +2316,12 @@ SurfRoughing::GetActiveSurfaces( INTVECTOR& vSurfId) const
|
||||
if ( m_pGeomDB->GetGeoType( nEntId) == SRF_TRIMESH)
|
||||
vSurfId.emplace_back( nEntId) ;
|
||||
}
|
||||
// se trovate superfici, considero solo queste ed esco
|
||||
if ( ! vSurfId.empty())
|
||||
return true ;
|
||||
// altrimenti considero tutte le superfici dei pezzi nei grezzi attivi della fase
|
||||
// controllo se sono state trovate delle superfici
|
||||
bool bNoSurfId = ( vSurfId.empty()) ;
|
||||
// scorro tutte le superfici dei pezzi nei grezzi attivi della fase
|
||||
int nRawId = m_pMchMgr->GetFirstRawPart() ;
|
||||
while ( nRawId != GDB_ID_NULL) {
|
||||
if ( m_pMchMgr->VerifyRawPartPhase(nRawId, m_nPhase)) {
|
||||
if ( m_pMchMgr->VerifyRawPartPhase( nRawId, m_nPhase)) {
|
||||
// ciclo sui pezzi del grezzo
|
||||
int nPartId = m_pMchMgr->GetFirstPartInRawPart( nRawId) ;
|
||||
while ( nPartId != GDB_ID_NULL) {
|
||||
@@ -2218,8 +2334,15 @@ SurfRoughing::GetActiveSurfaces( INTVECTOR& vSurfId) const
|
||||
// se entità superficie e visibile, la aggiungo
|
||||
int nStat ;
|
||||
if ( m_pGeomDB->GetGeoType( nEntId) == SRF_TRIMESH &&
|
||||
m_pGeomDB->GetCalcStatus( nEntId, nStat) && nStat != GDB_ST_OFF)
|
||||
vSurfId.emplace_back( nEntId) ;
|
||||
m_pGeomDB->GetCalcStatus( nEntId, nStat) && nStat != GDB_ST_OFF) {
|
||||
// se non sono state selezionate superfici precedentemente, memorizzo tale id
|
||||
if ( bNoSurfId)
|
||||
vSurfId.emplace_back( nEntId) ;
|
||||
// verifico se è presente una superficie di controllo
|
||||
string sLayIdName ;
|
||||
if ( m_pGeomDB->GetName( nLayId, sLayIdName) && EqualNoCase( sLayIdName, SRF_SUPP_LAYER_NAME))
|
||||
vSurfSuppId.emplace_back( nEntId) ;
|
||||
}
|
||||
// passo alla entità successiva
|
||||
nEntId = m_pGeomDB->GetNext( nEntId) ;
|
||||
}
|
||||
@@ -2230,6 +2353,7 @@ SurfRoughing::GetActiveSurfaces( INTVECTOR& vSurfId) const
|
||||
}
|
||||
nRawId = m_pMchMgr->GetNextRawPart( nRawId) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -2308,8 +2432,9 @@ SurfRoughing::CalcPaths( const INTINTVECTOR& vPocket, STEPINFOSRVECTOR& vStepInf
|
||||
// calcolo i percorsi di Pocketing
|
||||
ICRVCOMPOPOVECTOR vCrvPaths ;
|
||||
if ( ! CalcPocketing( vStepInfo[nInd].pSfrPock, m_TParams.m_dDiam / 2, 0., m_Params.m_dSideStep,
|
||||
m_Params.m_dSideAngle, vStepInfo[nInd].nSubType, true, vStepInfo[nInd].bInverted,
|
||||
false, true, ptEndLastPath, vStepInfo[nInd].pSfrLimit, false, vCrvPaths)) {
|
||||
m_Params.m_dSideAngle, 5., vStepInfo[nInd].nSubType, true, true, vStepInfo[nInd].bInverted,
|
||||
false, true, true, ptEndLastPath, vStepInfo[nInd].pSfrLimit, false, m_Params.m_dSideStep,
|
||||
m_Params.m_dLiTang, GetLeadInType(), vCrvPaths)) {
|
||||
if ( vStepInfo[nInd].bIsExtraStep) {
|
||||
string sWarn = "Warning in SurfRoughing : CalcPocketing failed with substep (" + ToString( vStepInfo[nInd].dDepth, 1) + ")" ;
|
||||
m_pMchMgr->SetWarning( 3055, sWarn) ;
|
||||
@@ -2510,21 +2635,16 @@ SurfRoughing::AddPocket( const INTINTVECTOR& vPocket, const Vector3d& vtTool, do
|
||||
DrawFeed( pLine, dCoeffFeed * GetRightFeed( vtMove, vtTool)) ;
|
||||
#endif
|
||||
SetFeed( dCoeffFeed * GetRightFeed( vtMove, vtTool)) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
ICurveArc* pArc = GetCurveArc( pCurve) ;
|
||||
Point3d ptCen = pArc->GetCenter() ;
|
||||
double dAngCen = pArc->GetAngCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
Point3d ptP3 ;
|
||||
pArc->GetEndPoint( ptP3) ;
|
||||
#if ENABLE_DEBUG_FEEDS
|
||||
DrawFeed( pArc, dCoeffFeed * GetFeed()) ;
|
||||
#endif
|
||||
SetFeed( dCoeffFeed * GetFeed()) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
|
||||
if ( AddCurveMove( pArc, bSplitArcs) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -2599,9 +2719,9 @@ SurfRoughing::AddPocket( const INTINTVECTOR& vPocket, const Vector3d& vtTool, do
|
||||
}
|
||||
// tratto lineare sopra al punto corrente
|
||||
SetFeed( GetEndFeed()) ;
|
||||
AddLinearMove( ptEnd + vtTool * dCurrElev) ;
|
||||
AddLinearMove( ptEnd + vtTool * dCurrElev, bSplitArcs) ;
|
||||
// tratto lineare sopra a ptDest
|
||||
AddLinearMove( ptDest + vtTool * dNextElev) ;
|
||||
AddLinearMove( ptDest + vtTool * dNextElev, bSplitArcs) ;
|
||||
// aggiorno le elevazioni
|
||||
dCurrElev = dNextElev ;
|
||||
}
|
||||
@@ -3093,7 +3213,7 @@ SurfRoughing::RemoveChunksUnderTolerance( ISurfFlatRegion* pSfr, double dTol,
|
||||
// rimuovo il Chunk c-esimo se l'Offset massimo è minore della tolleranza
|
||||
if ( dMaxOffs < dTol) {
|
||||
// devo evitare di rimuovere le isole aperte (queste, se rimosse, lasciano delle
|
||||
// punte di materiale che non vengono rimossein quanto sempre scartate)
|
||||
// punte di materiale che non vengono rimosse in quanto sempre scartate)
|
||||
// piccolo Offset alla regione limite
|
||||
double dOffs = m_TParams.m_dDiam / 2. + GetOffsR() + 30 * EPS_SMALL ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrLimitOffs( pSfrLimit->CreateOffsetSurf( dOffs, ICurve::OFF_FILLET)) ;
|
||||
@@ -3157,74 +3277,36 @@ SurfRoughing::CloseOpenEdgesUnderTolerance( ISurfFlatRegion* pSfr, double dToler
|
||||
PtrOwner<ICurveComposite> pCrvLoop( ConvertCurveToComposite( pSfr->GetLoop( nC, nL))) ;
|
||||
if ( IsNull( pCrvLoop) || ! pCrvLoop->IsValid())
|
||||
return false ;
|
||||
// ------------- ricavo tratti di proprietà uniformi -------------
|
||||
ICRVCOMPOPOVECTOR vpCrvs ; // vettore tratti aperti e chiusi alternati tra gli indici
|
||||
int nCurrTempProp ;
|
||||
int nParStart = 0 ;
|
||||
for ( int i = 0 ; i < pCrvLoop->GetCurveCount() ; ++ i) { // per ogni curva del loop
|
||||
int nTempProp ;
|
||||
pCrvLoop->GetCurveTempProp( i, nTempProp) ;
|
||||
if ( i == 0) {
|
||||
nCurrTempProp = nTempProp ;
|
||||
nParStart = i ;
|
||||
}
|
||||
else if ( nCurrTempProp != nTempProp) { // se TempProp0 differente dalla curva precedente
|
||||
// ricavo il tratto di curva
|
||||
PtrOwner<ICurveComposite> pCrv( ConvertCurveToComposite( pCrvLoop->CopyParamRange( nParStart, i))) ;
|
||||
if ( IsNull( pCrv))
|
||||
return false ;
|
||||
pCrv->SetTempProp( nCurrTempProp) ;
|
||||
vpCrvs.emplace_back( Release( pCrv)) ;
|
||||
nCurrTempProp = nTempProp ;
|
||||
nParStart = i ;
|
||||
}
|
||||
}
|
||||
// ultima curva ( se esiste)
|
||||
if ( nParStart < pCrvLoop->GetCurveCount()) {
|
||||
PtrOwner<ICurveComposite> pCrvLast( ConvertCurveToComposite( pCrvLoop->CopyParamRange( nParStart, pCrvLoop->GetCurveCount()))) ;
|
||||
if ( IsNull( pCrvLast) || ! pCrvLast->IsValid())
|
||||
return false ;
|
||||
pCrvLast->SetTempProp( nCurrTempProp) ;
|
||||
if ( vpCrvs.empty())
|
||||
vpCrvs.emplace_back( Release( pCrvLast)) ; // la curva originale aveva tutte propietà uniformi
|
||||
else {
|
||||
if ( vpCrvs[0]->GetTempProp( 0) == nCurrTempProp)
|
||||
vpCrvs[0]->AddCurve( Release( pCrvLast), false) ;
|
||||
else
|
||||
vpCrvs.emplace_back( Release( pCrvLast)) ;
|
||||
}
|
||||
}
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// ricavo tratti di proprietà uniformi -------------
|
||||
ICRVCOMPOPOVECTOR vpCrvs ;
|
||||
GetHomogeneousParts( pCrvLoop, vpCrvs) ;
|
||||
// memorizzo i tratti Closed
|
||||
ICRVCOMPOPOVECTOR vCrvClose ;
|
||||
for ( int i = 0 ; i < int( vpCrvs.size()) ; ++ i) {
|
||||
if ( vpCrvs[i]->GetTempProp( 0) == TEMP_PROP_CLOSE_EDGE)
|
||||
vCrvClose.emplace_back( CloneCurveComposite( vpCrvs[i])) ;
|
||||
}
|
||||
|
||||
// scorro tutti i tratti aperti e riconcateno il loop
|
||||
PtrOwner<ICurveComposite> pCrvNewLoop( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvNewLoop))
|
||||
return false ;
|
||||
|
||||
for ( int i = 0 ; i < int( vpCrvs.size()) ; ++ i) {
|
||||
// se tratto aperto e non coincidente con tutta la curva
|
||||
if ( vpCrvs[i]->GetTempProp( 0) == TEMP_PROP_OPEN_EDGE && int( vpCrvs.size()) != 1) {
|
||||
// semplifico il loop per avere curve più uniformi
|
||||
SimplifyCurve( vpCrvs[i], vCrvClose) ;
|
||||
// riporto le proprietà
|
||||
vpCrvs[i]->SetTempProp( 1) ;
|
||||
vpCrvs[i]->SetTempProp( TEMP_PROP_OPEN_EDGE) ;
|
||||
for ( int j = 0 ; j < vpCrvs[i]->GetCurveCount() ; ++ j)
|
||||
vpCrvs[i]->SetCurveTempProp( j, 1, 0) ;
|
||||
vpCrvs[i]->SetCurveTempProp( j, TEMP_PROP_OPEN_EDGE, 0) ;
|
||||
// controllo la lunghezza delle curve
|
||||
double dLen = EPS_SMALL ;
|
||||
vpCrvs[i]->GetLength( dLen) ;
|
||||
// se più corto della tolleranza
|
||||
if ( dLen < dToler) {
|
||||
vpCrvs[i]->SetTempProp( 0, 0) ;
|
||||
vpCrvs[i]->SetTempProp( TEMP_PROP_CLOSE_EDGE, 0) ;
|
||||
for ( int j = 0 ; j < vpCrvs[i]->GetCurveCount() ; ++ j)
|
||||
vpCrvs[i]->SetCurveTempProp( j, 0, 0) ;
|
||||
vpCrvs[i]->SetCurveTempProp( j, TEMP_PROP_CLOSE_EDGE, 0) ;
|
||||
}
|
||||
}
|
||||
pCrvNewLoop->AddCurve( Release( vpCrvs[i])) ;
|
||||
@@ -3236,10 +3318,15 @@ SurfRoughing::CloseOpenEdgesUnderTolerance( ISurfFlatRegion* pSfr, double dToler
|
||||
bOk = bOk && pSfrTest->AddIntLoop( Release( pCrvNewLoop)) ;
|
||||
}
|
||||
// se il chunk è stato creato correttamente, allora lo aggiungo
|
||||
if ( bOk) {
|
||||
if ( bOk && pSfrTest->IsValid()) {
|
||||
if ( pSfrRegular->IsValid() && pSfrRegular->GetChunkCount() > 0) {
|
||||
if ( ! pSfrRegular->Add( *pSfrTest))
|
||||
return false ;
|
||||
if ( ! pSfrRegular->Add( *pSfrTest)) {
|
||||
PtrOwner<ISurfFlatRegion> pSfrChunkCL( CloneSurfFlatRegion( pSfr->CloneChunk( nC))) ;
|
||||
if ( IsNull( pSfrChunkCL) || ! pSfrChunkCL->IsValid())
|
||||
return false ;
|
||||
if ( ! pSfrRegular->Add( *pSfrChunkCL))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( ! pSfrRegular.Set( pSfrTest))
|
||||
@@ -3252,11 +3339,11 @@ SurfRoughing::CloseOpenEdgesUnderTolerance( ISurfFlatRegion* pSfr, double dToler
|
||||
if ( IsNull( pSfrChunkCL) || ! pSfrChunkCL->IsValid())
|
||||
return false ;
|
||||
if ( pSfrRegular->IsValid() && pSfrRegular->GetChunkCount() > 0) {
|
||||
if ( ! pSfrRegular->Add( *pSfrTest))
|
||||
if ( ! pSfrRegular->Add( *pSfrChunkCL))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( ! pSfrRegular.Set( pSfrTest))
|
||||
if ( ! pSfrRegular.Set( pSfrChunkCL))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -3558,7 +3645,6 @@ SurfRoughing::GetHomogeneousParts( const ICurveComposite* pCrvCompo, ICRVCOMPOPO
|
||||
}
|
||||
|
||||
return true ;
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+10
-4
@@ -71,8 +71,14 @@ class SurfRoughing : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_SURFROUGHING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nPaths == 0) ; }
|
||||
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 ; }
|
||||
|
||||
@@ -124,10 +130,10 @@ class SurfRoughing : public Machining
|
||||
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, const ISurfTriMesh* pStmRaw, const Vector3d& vtExtr) 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 ;
|
||||
bool GetActiveSurfaces( INTVECTOR& vSurfId) const ;
|
||||
bool GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) const ;
|
||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
bool ResetCurveAllTempProp( ICurve* pCurve) const ;
|
||||
|
||||
+6
-1
@@ -85,7 +85,12 @@ ToolsMgr::Reload( void)
|
||||
Scanner TheScanner ;
|
||||
if ( ! TheScanner.Init( m_sToolsPath, ";")) {
|
||||
LOG_ERROR( GetEMkLogger(), "ReloadTools : Error on Init")
|
||||
return false ;
|
||||
if ( ExistsDirectory( m_sToolsDir) && ! ExistsFile( m_sToolsPath)) {
|
||||
m_bModified = true ;
|
||||
return true ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
// variabili di stato della lettura
|
||||
|
||||
+21
-8
@@ -501,7 +501,8 @@ WaterJetting::SetGeometry( const SELVECTOR& vIds)
|
||||
// verifico validità gestore DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// reset della geometria corrente
|
||||
// copia temporanea e reset della geometria corrente
|
||||
SELVECTOR vOldId = m_vId ;
|
||||
m_vId.clear() ;
|
||||
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve, tutti testi o tutte facce)
|
||||
int nType = GEO_NONE ;
|
||||
@@ -517,7 +518,8 @@ WaterJetting::SetGeometry( const SELVECTOR& vIds)
|
||||
m_vId.emplace_back( Id) ;
|
||||
}
|
||||
// aggiorno lo stato
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
if ( m_vId != vOldId)
|
||||
m_nStatus |= MCH_ST_GEO_MODIF ;
|
||||
// restituisco presenza geometria da lavorare
|
||||
return ( ! m_vId.empty() || vIds.empty()) ;
|
||||
}
|
||||
@@ -628,6 +630,10 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
|
||||
}
|
||||
m_nHeadSolCh = m_pMchMgr->GetCurrMachine()->GetHeadSolCh( m_TParams.m_sHead) ;
|
||||
|
||||
// se modificata geometria, necessario ricalcolo
|
||||
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
|
||||
bRecalc = true ;
|
||||
|
||||
// verifico se necessario continuare nell'aggiornamento
|
||||
if ( ! bRecalc && ! bToolChanged &&
|
||||
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||
@@ -761,6 +767,9 @@ WaterJetting::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
|
||||
if ( ! AdjustStartEndMovements()) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
@@ -771,9 +780,6 @@ WaterJetting::Update( bool bPostApply)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
|
||||
CalcAndSetAxesBBox() ;
|
||||
|
||||
// esecuzione eventuali personalizzazioni
|
||||
string sErr ;
|
||||
if ( bPostApply && ! PostApply( sErr)) {
|
||||
@@ -2428,7 +2434,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
}
|
||||
}
|
||||
if ( ! bSlowFull) {
|
||||
dAccLen = min( dFreeLen - EXTRA_ACC_LEN, ( bReduceFeed ? m_Params.m_dCornerSlowLen : INTANG_ROT_LEN)) ;
|
||||
dAccLen = min( dFreeLen / 2 - EXTRA_ACC_LEN, ( bReduceFeed ? m_Params.m_dCornerSlowLen : INTANG_ROT_LEN)) ;
|
||||
if ( m_Params.m_dSideAngle > 0) {
|
||||
double dW = m_dElev * sin( m_Params.m_dSideAngle * DEGTORAD) ;
|
||||
double dSlowLen = dW / tan( ( 180 - abs( dAng)) / 2 * DEGTORAD) ;
|
||||
@@ -2452,6 +2458,8 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
double dCoeff = j / double( ACC_PNT_NUM) ;
|
||||
double dU ; pCrvC->GetParamAtLength( dCoeff * dAccLen, dU) ;
|
||||
PtrOwner<ICurve> pCrvT( pCrvC->Clone()) ;
|
||||
if ( abs( dUprev - dU) < EPS_SMALL)
|
||||
continue ;
|
||||
if ( IsNull( pCrvT) || ! pCrvT->TrimStartEndAtParam( dUprev, dU))
|
||||
return false ;
|
||||
Vector3d vtTool = ( 1 - dCoeff) * vtTp + dCoeff * vtTn ;
|
||||
@@ -2862,9 +2870,11 @@ WaterJetting::CalcAndSetToolCorrAuxDir( const ICurveComposite* pCompo, double dU
|
||||
// verifico curva
|
||||
if ( pCompo == nullptr)
|
||||
return false ;
|
||||
// se utensile centrato, direzione di correzione nulla
|
||||
if ( m_Params.m_nWorkSide == WJET_WS_CENTER)
|
||||
// se utensile centrato, direzione di correzione nulla e direzione utensile sempre Z+
|
||||
if ( m_Params.m_nWorkSide == WJET_WS_CENTER) {
|
||||
SetToolDir( Z_AX) ;
|
||||
return true ;
|
||||
}
|
||||
// calcolo del versore fresa
|
||||
Vector3d vtTool = CalcToolDir( pCompo, dU) ;
|
||||
// calcolo del versore correzione
|
||||
@@ -3027,8 +3037,11 @@ WaterJetting::CalcOffset( ICurveComposite* pCompo, double dSignOffs)
|
||||
if ( OffsCrv.Make( pCompo, dSignOffs, nFlag)) {
|
||||
ICurve* pOffs = OffsCrv.GetLongerCurve() ;
|
||||
if ( pOffs != nullptr) {
|
||||
Vector3d vtExtr ; pCompo->GetExtrusion( vtExtr) ;
|
||||
pCompo->Clear() ;
|
||||
pCompo->AddCurve( pOffs) ;
|
||||
// ripristino estrusione della curva compo ( rimossa dal Clear)
|
||||
pCompo->SetExtrusion( vtExtr) ;
|
||||
bOk = true ;
|
||||
}
|
||||
}
|
||||
|
||||
+8
-2
@@ -36,8 +36,14 @@ class WaterJetting : public Machining
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_WATERJETTING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nMills == 0) ; }
|
||||
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 ; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user