EgtMachKernel 1.6v8 :
- gestita posizione Tavola Home diversa da posizione 0 Macchina in disposizione - in generazione si assegna il nome macchina - nel confronto attrezzaggio utensili si tiene conto della posizione in ToolChanger - se angoli indeterminati ma si determinano con asse ausiliario, li rendo tali direttamente - aggiunto comando per ricaricare DB utensili e lavorazioni - aggiunta funzione GetPhaseLastOperation - ora inserimento lavorazione avviene alla fine della fase corrente - migliorato split di grezzo con lavorazioni - in taglio di lama e fresatura irrobustito allungamenti/accorciamenti percorso.
This commit is contained in:
+28
-7
@@ -461,8 +461,13 @@ Disposition::AddFixture( const string& sName, const Point3d& ptPos, double dAngD
|
||||
// resetto il riferimento del gruppo
|
||||
Frame3d* pfrFixt = m_pGeomDB->GetGroupFrame( nFixtId) ;
|
||||
pfrFixt->Reset() ;
|
||||
// recupero eventuale spostamento corrente della tavola
|
||||
Vector3d vtDelta1 ;
|
||||
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
|
||||
if ( pMch == nullptr || ! pMch->GetCurrTableDeltaRef1( vtDelta1))
|
||||
return false ;
|
||||
// la muovo nella posizione voluta
|
||||
Vector3d vtMove = ( m_ptRef1 + ptPos) - ORIG ;
|
||||
Vector3d vtMove = ( m_ptRef1 + vtDelta1 + ptPos) - ORIG ;
|
||||
m_pGeomDB->TranslateGlob( nFixtId, vtMove) ;
|
||||
// la ruoto
|
||||
if ( fabs( dAngDeg) > EPS_ANG_SMALL)
|
||||
@@ -529,10 +534,15 @@ Disposition::MoveFixture( int nId, const Vector3d& vtMove)
|
||||
// verifico aggiornamento tavola
|
||||
if ( ! m_bTabOk && ! SetTable( m_sTabName))
|
||||
return false ;
|
||||
// verifico che la posizione finale sia nell'area della tavola
|
||||
// recupero eventuale spostamento corrente della tavola
|
||||
Vector3d vtDelta1 ;
|
||||
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
|
||||
if ( pMch == nullptr || ! pMch->GetCurrTableDeltaRef1( vtDelta1))
|
||||
return false ;
|
||||
// verifico che la posizione finale sia nell'area della tavola (espressa in posizione 0)
|
||||
Frame3d frFixt ;
|
||||
if ( ! m_pGeomDB->GetGroupFrame( nId, frFixt) ||
|
||||
! m_b3Area1.EnclosesXY( frFixt.Orig() + vtMove))
|
||||
! m_b3Area1.EnclosesXY( frFixt.Orig() - vtDelta1 + vtMove))
|
||||
return false ;
|
||||
// muovo l'oggetto
|
||||
m_pGeomDB->TranslateGlob( nId, vtMove) ;
|
||||
@@ -616,8 +626,13 @@ Disposition::PlaceFixture( int nId, const Point3d& ptPos, double dAngDeg, double
|
||||
// resetto il riferimento del gruppo
|
||||
Frame3d* pfrFixt = m_pGeomDB->GetGroupFrame( nId) ;
|
||||
pfrFixt->Reset() ;
|
||||
// recupero eventuale spostamento corrente della tavola
|
||||
Vector3d vtDelta1 ;
|
||||
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
|
||||
if ( pMch == nullptr || ! pMch->GetCurrTableDeltaRef1( vtDelta1))
|
||||
return false ;
|
||||
// lo muovo nella posizione voluta
|
||||
Vector3d vtMove = ( m_ptRef1 + ptPos) - ORIG ;
|
||||
Vector3d vtMove = ( m_ptRef1 + vtDelta1 + ptPos) - ORIG ;
|
||||
m_pGeomDB->TranslateGlob( nId, vtMove) ;
|
||||
// lo ruoto
|
||||
if ( fabs( dAngDeg) > EPS_ANG_SMALL)
|
||||
@@ -771,9 +786,15 @@ Disposition::MoveToCenterRawPart( int nRawId, const Point3d& ptP, int nFlag, boo
|
||||
b3Raw.Translate( vtMove) ;
|
||||
if ( ! m_b3Area1.EnclosesXY( b3Raw))
|
||||
return false ;
|
||||
// recupero eventuale spostamento corrente della tavola
|
||||
Vector3d vtDelta1 ;
|
||||
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
|
||||
if ( pMch == nullptr || ! pMch->GetCurrTableDeltaRef1( vtDelta1))
|
||||
return false ;
|
||||
// eseguo traslazione in globale
|
||||
if ( ! vtMove.IsSmall())
|
||||
m_pGeomDB->TranslateGlob( nRawId, vtMove) ;
|
||||
Vector3d vtTotMove = vtMove + vtDelta1 ;
|
||||
if ( ! vtTotMove.IsSmall())
|
||||
m_pGeomDB->TranslateGlob( nRawId, vtTotMove) ;
|
||||
// se da aggiungere alla lista
|
||||
if ( bAddToList) {
|
||||
auto iIter = find_if( m_vMvrData.begin(), m_vMvrData.end(),
|
||||
@@ -816,7 +837,7 @@ Disposition::MoveRawPart( int nRawId, const Vector3d& vtMove)
|
||||
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
|
||||
if ( pMch == nullptr || ! pMch->GetCurrTableDeltaRef1( vtDelta1))
|
||||
return false ;
|
||||
// verifico se il grezzo nella posizione finale sarà nella tavola
|
||||
// verifico se il grezzo nella posizione finale sarà nella tavola (espressa in posizione 0)
|
||||
b3Raw.Translate( vtMove - vtDelta1) ;
|
||||
if ( ! m_b3Area1.EnclosesXY( b3Raw))
|
||||
return false ;
|
||||
|
||||
Binary file not shown.
+9
-5
@@ -90,7 +90,7 @@ Generator::Run( const string& sCncFile, const std::string& sInfo)
|
||||
}
|
||||
|
||||
// apertura file di output ed evento inizio programma
|
||||
if ( bOk && ! OnProgramStart( sCncFile, sInfo)) {
|
||||
if ( bOk && ! OnProgramStart( m_pMachine->GetMachineName(), sCncFile, sInfo)) {
|
||||
bOk = false ;
|
||||
LOG_INFO( GetEMkLogger(), "OnProgramStart error") ;
|
||||
}
|
||||
@@ -466,12 +466,14 @@ Generator::OnEnd( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Generator::OnProgramStart( const string& sCncFile, const string& sInfo)
|
||||
Generator::OnProgramStart( const string& sMachName, const string& sCncFile, const string& sInfo)
|
||||
{
|
||||
// apro il file di output
|
||||
bool bOk = m_pMachine->WriterOpen( sCncFile) ;
|
||||
if ( ! bOk)
|
||||
LOG_INFO( GetEMkLogger(), "Error opening Cnc file") ;
|
||||
// assegno nome macchina
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MACHNAME, sMachName) ;
|
||||
// assegno nome file
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FILE, sCncFile) ;
|
||||
// assegno info
|
||||
@@ -545,10 +547,11 @@ Generator::ProcessToolData( void)
|
||||
return a.sHead < b.sHead ; }) ;
|
||||
// emetto l'elenco degli utensili
|
||||
bool bOk = true ;
|
||||
string sPrevHead ; int nPrevExit = 0 ; string sPrevTool ;
|
||||
string sPrevHead ; int nPrevExit = 0 ; string sPrevTcPos ; string sPrevTool ;
|
||||
for ( size_t i = 0 ; i < vTdata.size() ; ++ i) {
|
||||
// se posizione diversa
|
||||
if ( vTdata[i].sHead != sPrevHead || vTdata[i].nExit != nPrevExit) {
|
||||
// se posizione diversa (testa o uscita o toolchanger)
|
||||
if ( vTdata[i].sHead != sPrevHead || vTdata[i].nExit != nPrevExit ||
|
||||
vTdata[i].sTcPos != sPrevTcPos) {
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TOOL, vTdata[i].sName) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_HEAD, vTdata[i].sHead) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, vTdata[i].nExit) ;
|
||||
@@ -563,6 +566,7 @@ Generator::ProcessToolData( void)
|
||||
sPrevHead = vTdata[i].sHead ;
|
||||
nPrevExit = vTdata[i].nExit ;
|
||||
sPrevTool = vTdata[i].sName ;
|
||||
sPrevTcPos = vTdata[i].sTcPos ;
|
||||
}
|
||||
// altrimenti
|
||||
else {
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ class Generator
|
||||
bool UpdateAxes( void) ;
|
||||
bool OnStart( void) ;
|
||||
bool OnEnd( void) ;
|
||||
bool OnProgramStart( const std::string& sCncFile, const std::string& sInfo) ;
|
||||
bool OnProgramStart( const std::string& sMachName, const std::string& sCncFile, const std::string& sInfo) ;
|
||||
bool OnProgramEnd( void) ;
|
||||
bool ProcessToolData( void) ;
|
||||
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit) ;
|
||||
|
||||
@@ -150,6 +150,7 @@ class MachMgr : public IMachMgr
|
||||
bool TdbGetCurrToolParam( int nType, int& nVal) const override ;
|
||||
bool TdbGetCurrToolParam( int nType, double& dVal) const override ;
|
||||
bool TdbGetCurrToolParam( int nType, std::string& sVal) const override ;
|
||||
bool TdbReload( void) override ;
|
||||
bool TdbSave( void) const override ;
|
||||
bool TdbGetToolDir( std::string& sToolDir) const override ;
|
||||
bool TdbGetToolHolderDir( std::string& sTHolderDir) const override ;
|
||||
@@ -176,6 +177,7 @@ class MachMgr : public IMachMgr
|
||||
bool MdbSetGeneralParam( int nType, double dVal) override ;
|
||||
bool MdbGetGeneralParam( int nType, bool& bVal) const override ;
|
||||
bool MdbGetGeneralParam( int nType, double& dVal) const override ;
|
||||
bool MdbReload( void) override ;
|
||||
bool MdbSave( void) const override ;
|
||||
bool MdbGetMachiningDir( std::string& sMchDir) const override ;
|
||||
// Operations : general
|
||||
@@ -203,6 +205,7 @@ class MachMgr : public IMachMgr
|
||||
bool GetOperationStatus( int nId, bool& bShow) const override ;
|
||||
bool SetAllOperationsStatus(bool bExceptFirstDisp, bool bShow) override ;
|
||||
bool ChangeOperationPhase( int nMchId, int nNewPhase) override ;
|
||||
int GetPhaseLastOperation( int nPhase) const override ;
|
||||
bool RemoveOperationHome( int nId) override ;
|
||||
// Operations : dispositions
|
||||
int GetPhaseDisposition( int nPhase) const override ;
|
||||
|
||||
@@ -334,6 +334,18 @@ MachMgr::MdbGetGeneralParam( int nType, double& dVal) const
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::MdbReload( void)
|
||||
{
|
||||
// recupero il gestore di lavorazioni della macchina corrente
|
||||
MachiningsMgr* pMsMgr = GetCurrMachiningsMgr() ;
|
||||
if ( pMsMgr == nullptr)
|
||||
return false ;
|
||||
// ricarico il DB lavorazioni
|
||||
return pMsMgr->Reload() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::MdbSave( void) const
|
||||
|
||||
@@ -243,6 +243,18 @@ MachMgr::TdbGetCurrToolParam( int nType, string& sVal) const
|
||||
return pTsMgr->GetCurrToolParam( nType, sVal) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::TdbReload( void)
|
||||
{
|
||||
// recupero il gestore di utensili della macchina corrente
|
||||
ToolsMgr* pTsMgr = GetCurrToolsMgr() ;
|
||||
if ( pTsMgr == nullptr)
|
||||
return nullptr ;
|
||||
// ricarico il db utensili
|
||||
return pTsMgr->Reload() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::TdbSave( void) const
|
||||
|
||||
+33
-15
@@ -470,22 +470,13 @@ MachMgr::ChangeOperationPhase( int nMchId, int nNewPhase)
|
||||
if ( nType == OPER_NULL || nType == OPER_DISP)
|
||||
return false ;
|
||||
// verifico che la nuova fase esista
|
||||
if ( nNewPhase > m_nPhasesCount)
|
||||
if ( nNewPhase <= 0 || nNewPhase > m_nPhasesCount)
|
||||
return false ;
|
||||
// se la fase dell'operazione è già giusta, esco subito con successo
|
||||
if ( GetOperationPhase( nMchId) == nNewPhase)
|
||||
return true ;
|
||||
// cerco l'ultima operazione della nuova fase
|
||||
int nRefId = GDB_ID_NULL ;
|
||||
int nCurrId = GetFirstOperation() ;
|
||||
while ( nCurrId != GDB_ID_NULL) {
|
||||
int nPhase = GetOperationPhase( nCurrId) ;
|
||||
if ( nPhase == nNewPhase)
|
||||
nRefId = nCurrId ;
|
||||
else if ( nPhase > nNewPhase)
|
||||
break ;
|
||||
nCurrId = GetNextOperation( nCurrId) ;
|
||||
}
|
||||
int nRefId = GetPhaseLastOperation( nNewPhase) ;
|
||||
if ( nRefId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// recupero la lavorazione
|
||||
@@ -499,6 +490,27 @@ MachMgr::ChangeOperationPhase( int nMchId, int nNewPhase)
|
||||
return pMch->SetPhase( nNewPhase) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::GetPhaseLastOperation( int nPhase) const
|
||||
{
|
||||
// verifico esistenza fase
|
||||
if ( nPhase <= 0 || nPhase > m_nPhasesCount)
|
||||
return GDB_ID_NULL ;
|
||||
// cerco l'ultima operazione della fase
|
||||
int nOperId = GDB_ID_NULL ;
|
||||
int nCurrId = GetFirstOperation() ;
|
||||
while ( nCurrId != GDB_ID_NULL) {
|
||||
int nOperPhase = GetOperationPhase( nCurrId) ;
|
||||
if ( nPhase == nOperPhase)
|
||||
nOperId = nCurrId ;
|
||||
else if ( nPhase < nOperPhase)
|
||||
break ;
|
||||
nCurrId = GetNextOperation( nCurrId) ;
|
||||
}
|
||||
return nOperId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::RemoveOperationHome( int nId)
|
||||
@@ -652,8 +664,11 @@ MachMgr::AddMachining( const string& sName, const string& sMachining)
|
||||
string sNewName = sName ;
|
||||
if ( ! GetOperationNewName( sNewName))
|
||||
return GDB_ID_NULL ;
|
||||
// inserisco il gruppo
|
||||
int nId = m_pGeomDB->AddGroup( GDB_ID_NULL, nOperGrpId, GLOB_FRM) ;
|
||||
// inserisco il gruppo della lavorazione alla fine della fase corrente
|
||||
int nRefId = GetPhaseLastOperation( m_nCurrPhase) ;
|
||||
if ( nRefId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
int nId = m_pGeomDB->InsertGroup( GDB_ID_NULL, nRefId, GDB_AFTER, GLOB_FRM) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// assegno il nome
|
||||
@@ -696,8 +711,11 @@ MachMgr::AddMachining( const string& sName, int nMchType, const string& sTool)
|
||||
string sNewName = sName ;
|
||||
if ( ! GetOperationNewName( sNewName))
|
||||
return GDB_ID_NULL ;
|
||||
// inserisco il gruppo
|
||||
int nId = m_pGeomDB->AddGroup( GDB_ID_NULL, nOperGrpId, GLOB_FRM) ;
|
||||
// inserisco il gruppo della lavorazione alla fine della fase corrente
|
||||
int nRefId = GetPhaseLastOperation( m_nCurrPhase) ;
|
||||
if ( nRefId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
int nId = m_pGeomDB->InsertGroup( GDB_ID_NULL, nRefId, GDB_AFTER, GLOB_FRM) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// assegno il nome
|
||||
|
||||
+27
-11
@@ -17,6 +17,8 @@
|
||||
#include "MachMgr.h"
|
||||
#include "MachConst.h"
|
||||
#include "Disposition.h"
|
||||
#include "/EgtDev/Include/EMkMachiningGeoConst.h"
|
||||
#include "/EgtDev/Include/EXeCmdLogOff.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
@@ -26,7 +28,6 @@
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
#include "/EgtDev/Include/EGkStmStandard.h"
|
||||
#include "/EgtDev/Include/EGkStmFromCurves.h"
|
||||
#include "/EgtDev/Include/EmkMachiningGeoConst.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
@@ -825,6 +826,9 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
if ( ! VerifyRawPart( nRawId) || VerifyRawPartPhase( nRawId, m_nCurrPhase))
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// disabilito eventuale registrazione comandi EXE (riabilitazione automatica)
|
||||
CmdLogOff cmdLogOff ;
|
||||
|
||||
// recupero alcuni dati del grezzo
|
||||
// il solido del grezzo
|
||||
int nRawSolId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
|
||||
@@ -902,9 +906,15 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
// creo i grezzi risultanti
|
||||
// creo i nuovi grezzi
|
||||
INTVECTOR vNewIds ;
|
||||
int nCount ;
|
||||
int nChunk = 0 ;
|
||||
int nFirstLoopId = ExeExtractSurfFrChunkLoops( nSfrId, nChunk, nRawId, nullptr) ;
|
||||
int nFirstLoopId = ExeExtractSurfFrChunkLoops( nSfrId, nChunk, nRawId, &nCount) ;
|
||||
while ( nFirstLoopId != GDB_ID_NULL) {
|
||||
// !!! in attesa di gestire i grezzi con i buchi !!!
|
||||
// cancello le eventuali curve successive (sono i loop interni ovvero i buchi)
|
||||
for ( int i = 1 ; i < nCount ; ++ i) {
|
||||
m_pGeomDB->Erase( nFirstLoopId + i) ;
|
||||
}
|
||||
// dichiaro temporanea la curva
|
||||
m_pGeomDB->SetLevel( nFirstLoopId, GDB_LV_TEMP) ;
|
||||
// creo il grezzo
|
||||
@@ -953,7 +963,7 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
m_pGeomDB->Erase( nFirstLoopId) ;
|
||||
// passo alla prossima curva
|
||||
++ nChunk ;
|
||||
nFirstLoopId = ExeExtractSurfFrChunkLoops( nSfrId, nChunk, nRawId, nullptr) ;
|
||||
nFirstLoopId = ExeExtractSurfFrChunkLoops( nSfrId, nChunk, nRawId, &nCount) ;
|
||||
}
|
||||
// cancello la regione
|
||||
m_pGeomDB->Erase( nSfrId) ;
|
||||
@@ -977,14 +987,20 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
|
||||
if ( ( ( nEntGeoType & GEO_CURVE) != 0 && ExeMidPoint( nEntId, nNewId, ptTest)) ||
|
||||
( ( nEntGeoType & GEO_CURVE) == 0 && ExeCenterPoint( nEntId, nNewId, ptTest))) {
|
||||
int nOutCrvId = m_pGeomDB->GetFirstNameInGroup( nNewId, MACH_RAW_OUTLINE) ;
|
||||
ICurve* pCurve = GetCurve( m_pGeomDB->GetGeoObj( nOutCrvId)) ;
|
||||
if ( pCurve != nullptr) {
|
||||
int nSide ;
|
||||
double dDist ;
|
||||
DistPointCurve distPC( ptTest, *pCurve) ;
|
||||
if ( distPC.GetDist( dDist) && dDist < 100 * EPS_SMALL ||
|
||||
(distPC.GetSideAtMinDistPoint( 0, Z_AX, nSide) && nSide != MDS_RIGHT))
|
||||
break ;
|
||||
BBox3d b3Raw ; m_pGeomDB->GetGlobalBBox( nOutCrvId, b3Raw) ;
|
||||
double dRawDiam = 0 ; b3Raw.GetDiameter( dRawDiam) ;
|
||||
BBox3d b3Part ; m_pGeomDB->GetGlobalBBox( nEntId, b3Part) ;
|
||||
double dPartDiam = 0 ; b3Part.GetDiameter( dPartDiam) ;
|
||||
if ( dRawDiam > 0.9 * dPartDiam) {
|
||||
ICurve* pCurve = GetCurve( m_pGeomDB->GetGeoObj( nOutCrvId)) ;
|
||||
if ( pCurve != nullptr) {
|
||||
int nSide ;
|
||||
double dDist ;
|
||||
DistPointCurve distPC( ptTest, *pCurve) ;
|
||||
if ( distPC.GetDist( dDist) && dDist < 100 * EPS_SMALL ||
|
||||
(distPC.GetSideAtMinDistPoint( 0, Z_AX, nSide) && nSide != MDS_RIGHT))
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// altrimenti scambio pezzo ed elimino gruppo
|
||||
|
||||
+6
-2
@@ -742,7 +742,9 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
if ( ! bDet2) {
|
||||
bool bDetX ;
|
||||
vtDirI2.GetRotation( vtDirAn, vtAx1, dAngA2, bDetX) ;
|
||||
if ( ! bDetX)
|
||||
if ( bDetX)
|
||||
bDet2 = true ;
|
||||
else
|
||||
dAngA2 = 0 ;
|
||||
}
|
||||
}
|
||||
@@ -761,7 +763,9 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
if ( ! bDet1) {
|
||||
bool bDetX ;
|
||||
vtDirI1.GetRotation( vtDirAn, vtAx1, dAngA1, bDetX) ;
|
||||
if ( ! bDetX)
|
||||
if ( bDetX)
|
||||
bDet1 = true ;
|
||||
else
|
||||
dAngA1 = 0 ;
|
||||
}
|
||||
}
|
||||
|
||||
+28
-13
@@ -75,12 +75,12 @@ MachiningsMgr::MachiningsMgr( void)
|
||||
//----------------------------------------------------------------------------
|
||||
MachiningsMgr::~MachiningsMgr( void)
|
||||
{
|
||||
Clear() ;
|
||||
Clear( true) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachiningsMgr::Clear( void)
|
||||
MachiningsMgr::Clear( bool bReset)
|
||||
{
|
||||
// libero la memoria dalle lavorazioni
|
||||
for ( auto iIter = m_umData.begin() ; iIter != m_umData.end() ; ++ iIter) {
|
||||
@@ -88,7 +88,8 @@ MachiningsMgr::Clear( void)
|
||||
delete iIter->second ;
|
||||
}
|
||||
// reset puntatore a gestore utensili
|
||||
m_pTsMgr = nullptr ;
|
||||
if ( bReset)
|
||||
m_pTsMgr = nullptr ;
|
||||
// pulisco le tabelle
|
||||
m_umData.clear() ;
|
||||
m_suData.clear() ;
|
||||
@@ -106,13 +107,10 @@ MachiningsMgr::Clear( void)
|
||||
bool
|
||||
MachiningsMgr::Load( const string& sMachsFile, const ToolsMgr* pTsMgr)
|
||||
{
|
||||
// Pulisco
|
||||
Clear() ;
|
||||
|
||||
// Salvo la path del file con i dati
|
||||
m_sMachsFile = sMachsFile ;
|
||||
{ string sOut = "MachiningsMgr Init : " + m_sMachsFile ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str()) }
|
||||
string sOut = "MachiningsMgr Init : " + m_sMachsFile ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
|
||||
// Verifico il gestore degli utensili
|
||||
if ( pTsMgr == nullptr) {
|
||||
@@ -121,10 +119,27 @@ MachiningsMgr::Load( const string& sMachsFile, const ToolsMgr* pTsMgr)
|
||||
}
|
||||
m_pTsMgr = pTsMgr ;
|
||||
|
||||
// carico
|
||||
return Reload() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachiningsMgr::Reload( void)
|
||||
{
|
||||
// Pulisco
|
||||
Clear( false) ;
|
||||
|
||||
// Verifico il gestore degli utensili
|
||||
if ( m_pTsMgr == nullptr) {
|
||||
LOG_ERROR( GetEMkLogger(), "ReloadMachinings : Error on ToolsMgr")
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Inizializzo lo scanner
|
||||
Scanner TheScanner ;
|
||||
if ( ! TheScanner.Init( m_sMachsFile, ";")) {
|
||||
LOG_ERROR( GetEMkLogger(), "LoadMachinings : Error on Init")
|
||||
LOG_ERROR( GetEMkLogger(), "ReloadMachinings : Error on Init")
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -137,18 +152,18 @@ MachiningsMgr::Load( const string& sMachsFile, const ToolsMgr* pTsMgr)
|
||||
int nTotal = 0 ;
|
||||
if ( ! LoadHeader( TheScanner, nVersion, nTotal, bEnd)) {
|
||||
bOk = false ;
|
||||
string sOut = "LoadMachinings : Error on Header" ;
|
||||
string sOut = "ReloadMachinings : Error on Header" ;
|
||||
LOG_ERROR( GetEMkLogger(), sOut.c_str())
|
||||
}
|
||||
{
|
||||
string sOut = "LoadMachinings : FileVer = " + ToString( nVersion) + " CurrVer = " + ToString( MF_CURR_VER) ;
|
||||
string sOut = "ReloadMachinings : FileVer = " + ToString( nVersion) + " CurrVer = " + ToString( MF_CURR_VER) ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
}
|
||||
|
||||
// Leggo i dati generali (da versione 1002)
|
||||
if ( nVersion >= 1002 && ! LoadGeneral( TheScanner, bEnd)) {
|
||||
bOk = false ;
|
||||
string sOut = "LoadMachinings : Error on General" ;
|
||||
string sOut = "ReloadMachinings : Error on General" ;
|
||||
LOG_ERROR( GetEMkLogger(), sOut.c_str())
|
||||
}
|
||||
|
||||
@@ -160,7 +175,7 @@ MachiningsMgr::Load( const string& sMachsFile, const ToolsMgr* pTsMgr)
|
||||
do {
|
||||
if ( ! LoadOneMachining( TheScanner, bEnd)) {
|
||||
bOk = false ;
|
||||
string sOut = "LoadMachinings : Error on line " + ToString( TheScanner.GetCurrLineNbr()) ;
|
||||
string sOut = "ReloadMachinings : Error on line " + ToString( TheScanner.GetCurrLineNbr()) ;
|
||||
LOG_ERROR( GetEMkLogger(), sOut.c_str())
|
||||
}
|
||||
} while ( bOk && ! bEnd) ;
|
||||
|
||||
+2
-1
@@ -27,6 +27,7 @@ class MachiningsMgr
|
||||
MachiningsMgr( void) ;
|
||||
~MachiningsMgr( void) ;
|
||||
bool Load( const std::string& sMachsFile, const ToolsMgr* pTsMgr) ;
|
||||
bool Reload( void) ;
|
||||
bool Save( bool bCompressed = true) const ;
|
||||
bool GetMachiningNewName( std::string& sName) const ;
|
||||
bool AddMachining( const std::string& sName, int nType) ;
|
||||
@@ -73,7 +74,7 @@ class MachiningsMgr
|
||||
{ return m_nSplitArcs ; }
|
||||
|
||||
private :
|
||||
bool Clear( void) ;
|
||||
bool Clear( bool bReset) ;
|
||||
bool LoadHeader( Scanner& TheScanner, int& nVersion, int& nTotal, bool& bEnd) ;
|
||||
bool LoadGeneral( Scanner& TheScanner, bool& bEnd) ;
|
||||
bool LoadOneMachining( Scanner& TheScanner, bool& bEnd) ;
|
||||
|
||||
+24
-22
@@ -951,31 +951,33 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
}
|
||||
}
|
||||
|
||||
// eventuali allungamenti per percorso aperto
|
||||
// eventuali allungamenti/accorciamenti per percorso aperto
|
||||
bool bOverlapOn = false ;
|
||||
if ( ! pCompo->IsClosed()) {
|
||||
// eventuale allungamento/accorciamento dell'inizio
|
||||
if ( abs( m_Params.m_dStartAddLen) > EPS_SMALL) {
|
||||
if ( m_Params.m_dStartAddLen > 0) {
|
||||
if ( ! pCompo->ExtendStartByLen( m_Params.m_dStartAddLen))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( ! pCompo->TrimStartAtLen( - m_Params.m_dStartAddLen))
|
||||
return false ;
|
||||
}
|
||||
// verifico che il percorso sia abbastanza lungo
|
||||
double dLen ; pCompo->GetLength( dLen) ;
|
||||
if ( dLen + m_Params.m_dStartAddLen + m_Params.m_dEndAddLen < 10 * EPS_SMALL) {
|
||||
LOG_INFO( GetEMkLogger(), "Warning in Milling : skipped Path too small") ;
|
||||
return true ;
|
||||
}
|
||||
// eventuale allungamento/accorciamento della fine
|
||||
if ( abs( m_Params.m_dEndAddLen) > EPS_SMALL) {
|
||||
if ( m_Params.m_dEndAddLen > 0) {
|
||||
if ( ! pCompo->ExtendEndByLen( m_Params.m_dEndAddLen))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
double dLen ;
|
||||
if ( ! pCompo->GetLength( dLen) || ! pCompo->TrimEndAtLen( dLen + m_Params.m_dEndAddLen))
|
||||
return false ;
|
||||
}
|
||||
// eventuali allungamenti
|
||||
if ( m_Params.m_dStartAddLen > EPS_SMALL) {
|
||||
if ( ! pCompo->ExtendStartByLen( m_Params.m_dStartAddLen))
|
||||
return false ;
|
||||
}
|
||||
if ( m_Params.m_dEndAddLen > EPS_SMALL) {
|
||||
if ( ! pCompo->ExtendEndByLen( m_Params.m_dEndAddLen))
|
||||
return false ;
|
||||
}
|
||||
// eventuale accorciamenti (da fare dopo tutti gli allungamenti)
|
||||
if ( m_Params.m_dStartAddLen < - EPS_SMALL) {
|
||||
if ( ! pCompo->TrimStartAtLen( - m_Params.m_dStartAddLen))
|
||||
return false ;
|
||||
}
|
||||
if ( m_Params.m_dEndAddLen < - EPS_SMALL) {
|
||||
double dLen ;
|
||||
if ( ! pCompo->GetLength( dLen) || ! pCompo->TrimEndAtLen( dLen + m_Params.m_dEndAddLen))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// eventuale sovrapposizione per percorso chiuso
|
||||
|
||||
@@ -30,6 +30,7 @@ static const std::string GVAR_F = ".F" ; // (num) valore del
|
||||
static const std::string GVAR_FT = ".Ft" ; // (string) token per feed
|
||||
static const std::string GVAR_S = ".S" ; // (num) valore della speed
|
||||
static const std::string GVAR_ST = ".St" ; // (string) token per speed
|
||||
static const std::string GVAR_MACHNAME = ".MACHNAME" ; // (string) nome macchina
|
||||
static const std::string GVAR_FILE = ".FILE" ; // (string) path file di output
|
||||
static const std::string GVAR_INFO = ".INFO" ; // (string) informazioni iniziali
|
||||
static const std::string GVAR_DISPID = ".DISPID" ; // (int) identificativo disposizione
|
||||
|
||||
+24
-21
@@ -989,29 +989,32 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
if ( m_Params.m_bInvert)
|
||||
pCompo->Invert() ;
|
||||
|
||||
// eventuale allungamento/accorciamento dell'inizio
|
||||
if ( abs( m_Params.m_dStartAddLen) > EPS_SMALL) {
|
||||
if ( m_Params.m_dStartAddLen > 0) {
|
||||
if ( ! pCompo->ExtendStartByLen( m_Params.m_dStartAddLen))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( ! pCompo->TrimStartAtLen( - m_Params.m_dStartAddLen))
|
||||
return false ;
|
||||
}
|
||||
// verifico che il percorso sia abbastanza lungo
|
||||
double dLen ; pCompo->GetLength( dLen) ;
|
||||
if ( dLen + m_Params.m_dStartAddLen + m_Params.m_dEndAddLen < 10 * EPS_SMALL) {
|
||||
LOG_INFO( GetEMkLogger(), "Warning in Sawing : skipped Path too small") ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
// eventuale allungamento/accorciamento della fine
|
||||
if ( abs( m_Params.m_dEndAddLen) > EPS_SMALL) {
|
||||
if ( m_Params.m_dEndAddLen > 0) {
|
||||
if ( ! pCompo->ExtendEndByLen( m_Params.m_dEndAddLen))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
double dLen ;
|
||||
if ( ! pCompo->GetLength( dLen) || ! pCompo->TrimEndAtLen( dLen + m_Params.m_dEndAddLen))
|
||||
return false ;
|
||||
}
|
||||
// eventuali allungamenti
|
||||
if ( m_Params.m_dStartAddLen > EPS_SMALL) {
|
||||
if ( ! pCompo->ExtendStartByLen( m_Params.m_dStartAddLen))
|
||||
return false ;
|
||||
}
|
||||
if ( m_Params.m_dEndAddLen > EPS_SMALL) {
|
||||
if ( ! pCompo->ExtendEndByLen( m_Params.m_dEndAddLen))
|
||||
return false ;
|
||||
}
|
||||
|
||||
// eventuale accorciamenti (da fare dopo tutti gli allungamenti)
|
||||
if ( m_Params.m_dStartAddLen < - EPS_SMALL) {
|
||||
if ( ! pCompo->TrimStartAtLen( - m_Params.m_dStartAddLen))
|
||||
return false ;
|
||||
}
|
||||
if ( m_Params.m_dEndAddLen < - EPS_SMALL) {
|
||||
double dLen ;
|
||||
if ( ! pCompo->GetLength( dLen) || ! pCompo->TrimEndAtLen( dLen + m_Params.m_dEndAddLen))
|
||||
return false ;
|
||||
}
|
||||
|
||||
// elaboro la curva composita e la esplodo nelle curve componenti
|
||||
|
||||
+18
-10
@@ -59,18 +59,26 @@ ToolsMgr::Clear( void)
|
||||
bool
|
||||
ToolsMgr::Load( const string& sToolsFile)
|
||||
{
|
||||
// pulisco
|
||||
Clear() ;
|
||||
|
||||
// salvo la path del file con i dati
|
||||
m_sToolsFile = sToolsFile ;
|
||||
{ string sOut = "ToolsMgr Init : " + m_sToolsFile ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str()) }
|
||||
string sOut = "ToolsMgr Init : " + m_sToolsFile ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
|
||||
// carico
|
||||
return Reload() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ToolsMgr::Reload( void)
|
||||
{
|
||||
// pulisco
|
||||
Clear() ;
|
||||
|
||||
// inizializzo lo scanner
|
||||
Scanner TheScanner ;
|
||||
if ( ! TheScanner.Init( m_sToolsFile, ";")) {
|
||||
LOG_ERROR( GetEMkLogger(), "LoadTools : Error on Init")
|
||||
LOG_ERROR( GetEMkLogger(), "ReloadTools : Error on Init")
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -84,11 +92,11 @@ ToolsMgr::Load( const string& sToolsFile)
|
||||
int nTotal = 0 ;
|
||||
if ( ! LoadHeader( TheScanner, nVersion, nToolSize, nTotal, bEnd)) {
|
||||
bOk = false ;
|
||||
string sOut = "LoadTools : Error on Header" ;
|
||||
string sOut = "ReloadTools : Error on Header" ;
|
||||
LOG_ERROR( GetEMkLogger(), sOut.c_str())
|
||||
}
|
||||
{
|
||||
string sOut = "LoadTools : FileVer = " + ToString( nVersion) + " CurrVer = " + ToString( TF_CURR_VER) ;
|
||||
string sOut = "ReloadTools : FileVer = " + ToString( nVersion) + " CurrVer = " + ToString( TF_CURR_VER) ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
}
|
||||
|
||||
@@ -100,7 +108,7 @@ ToolsMgr::Load( const string& sToolsFile)
|
||||
do {
|
||||
if ( ! LoadOneTool( TheScanner, nToolSize, bEnd)) {
|
||||
bOk = false ;
|
||||
string sOut = "LoadTools : Error on line " + ToString( TheScanner.GetCurrLineNbr()) ;
|
||||
string sOut = "ReloadTools : Error on line " + ToString( TheScanner.GetCurrLineNbr()) ;
|
||||
LOG_ERROR( GetEMkLogger(), sOut.c_str())
|
||||
}
|
||||
} while ( bOk && ! bEnd) ;
|
||||
@@ -111,7 +119,7 @@ ToolsMgr::Load( const string& sToolsFile)
|
||||
// verifico di aver letto il numero di utensili indicato in header
|
||||
if ( m_utData.size() != nTotal) {
|
||||
bOk = false ;
|
||||
LOG_ERROR( GetEMkLogger(), "LoadTools : Tools number wrong")
|
||||
LOG_ERROR( GetEMkLogger(), "ReloadTools : Tools number wrong")
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
|
||||
@@ -26,6 +26,7 @@ class ToolsMgr
|
||||
public :
|
||||
ToolsMgr( void) ;
|
||||
bool Load( const std::string& sToolsFile) ;
|
||||
bool Reload( void) ;
|
||||
bool Save( bool bCompressed = true) const ;
|
||||
bool GetToolNewName( std::string& sName) const ;
|
||||
bool AddTool( const std::string& sName, int nType) ;
|
||||
|
||||
Reference in New Issue
Block a user