EgtMachKernel 1.6o4 :
- aggiunte lavorazioni di sgrossatura e finitura con lama di cornici lineari - al caricamento, se gruppo macchinata errato, lo sposto in un gruppo di errore anzichè cancellarlo - aggiunta GetRawGlobBox.
This commit is contained in:
Binary file not shown.
@@ -244,8 +244,12 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="MachMgrDBTools.cpp" />
|
||||
<ClCompile Include="Milling.cpp" />
|
||||
<ClCompile Include="MillingData.cpp" />
|
||||
<ClCompile Include="SawFinishing.cpp" />
|
||||
<ClCompile Include="SawFinishingData.cpp" />
|
||||
<ClCompile Include="Sawing.cpp" />
|
||||
<ClCompile Include="SawingData.cpp" />
|
||||
<ClCompile Include="SawRoughing.cpp" />
|
||||
<ClCompile Include="SawRoughingData.cpp" />
|
||||
<ClCompile Include="Simulator.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
@@ -280,13 +284,18 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="MachiningConst.h" />
|
||||
<ClInclude Include="MachiningData.h" />
|
||||
<ClInclude Include="MachiningDataFactory.h" />
|
||||
<ClInclude Include="MachiningCreate.h" />
|
||||
<ClInclude Include="MachiningsMgr.h" />
|
||||
<ClInclude Include="MachMgr.h" />
|
||||
<ClInclude Include="Milling.h" />
|
||||
<ClInclude Include="MillingData.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="SawFinishing.h" />
|
||||
<ClInclude Include="SawFinishingData.h" />
|
||||
<ClInclude Include="Sawing.h" />
|
||||
<ClInclude Include="SawingData.h" />
|
||||
<ClInclude Include="SawRoughing.h" />
|
||||
<ClInclude Include="SawRoughingData.h" />
|
||||
<ClInclude Include="Simulator.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="Head.h" />
|
||||
|
||||
@@ -156,6 +156,18 @@
|
||||
<ClCompile Include="MachMgrPhases.cpp">
|
||||
<Filter>Source Files\MachMgr</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SawRoughingData.cpp">
|
||||
<Filter>Source Files\Machinings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SawRoughing.cpp">
|
||||
<Filter>Source Files\Operations</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SawFinishingData.cpp">
|
||||
<Filter>Source Files\Machinings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SawFinishing.cpp">
|
||||
<Filter>Source Files\Operations</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="DllMain.h">
|
||||
@@ -260,6 +272,21 @@
|
||||
<ClInclude Include="Generator.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SawRoughingData.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SawRoughing.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MachiningCreate.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SawFinishingData.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SawFinishing.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtMachKernel.rc">
|
||||
|
||||
+4
-9
@@ -187,19 +187,14 @@ Generator::Run( const string& sCncFile, const std::string& sInfo)
|
||||
}
|
||||
}
|
||||
// processo l'operazione
|
||||
switch ( m_pMchMgr->GetOperationType( nOpId)) {
|
||||
case OPER_DISP :
|
||||
int nType = m_pMchMgr->GetOperationType( nOpId) ;
|
||||
if ( IsValidDispositionType( nType)) {
|
||||
if ( ! ProcessDisposition( nOpId, nInd))
|
||||
bOk = false ;
|
||||
break ;
|
||||
case OPER_DRILLING :
|
||||
case OPER_SAWING :
|
||||
case OPER_MILLING :
|
||||
}
|
||||
else if ( IsValidMachiningType( nType)) {
|
||||
if ( ! ProcessMachining( nOpId, nInd))
|
||||
bOk = false ;
|
||||
break ;
|
||||
default :
|
||||
break ;
|
||||
}
|
||||
// passo alla operazione successiva
|
||||
nOpId = m_pMchMgr->GetNextActiveOperation( nOpId) ;
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
const std::string MACH_BASE = "MachBase" ;
|
||||
// Direttorio ausiliario per la gestione delle lavorazioni
|
||||
const std::string MACH_AUX = "MachAux" ;
|
||||
// Direttorio ove spostare altri gruppi con errori
|
||||
const std::string MACH_ERR = "MachErr" ;
|
||||
// Chiave per nome macchina in macchinata
|
||||
const std::string MACH_MACHINE_KEY = "Machine" ;
|
||||
// Gruppo delle fixtures in una macchinata
|
||||
|
||||
@@ -184,6 +184,7 @@ class MachMgr : public IMachMgr
|
||||
int GetPhaseDisposition( int nPhase) const override ;
|
||||
// Operations : machinings
|
||||
int AddMachining( const std::string& sName, const std::string& sMachining) override ;
|
||||
int AddMachining( const std::string& sName, int nMchType, const std::string& sTool) override ;
|
||||
bool SetCurrMachining( int nId) override ;
|
||||
bool ResetCurrMachining( void) override ;
|
||||
int GetCurrMachining( void) const override ;
|
||||
|
||||
+14
-3
@@ -108,15 +108,26 @@ MachMgr::Update( void)
|
||||
m_nMachBaseId = FindMachBase( GDB_ID_ROOT) ;
|
||||
// imposto gruppo di lavorazione corrente a nessuno
|
||||
m_nCurrMGrpId = GDB_ID_NULL ;
|
||||
// recupero indice di gruppo dove spostare i gruppi di lavoro con errori
|
||||
int nMachErrId = m_pGeomDB->GetFirstNameInGroup( GDB_ID_ROOT, MACH_ERR) ;
|
||||
// verifico i gruppi di lavorazione
|
||||
int nId = m_pGeomDB->GetFirstGroupInGroup( m_nMachBaseId) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// recupero successivo
|
||||
int nNextId = m_pGeomDB->GetNextGroup( nId) ;
|
||||
// se non è gruppo di lavoro, lo elimino
|
||||
// se non è gruppo di lavoro, lo sposto in apposito gruppo per gli errori
|
||||
MachGrp mgData ;
|
||||
if ( ! VerifyMachGroup( nId, mgData))
|
||||
m_pGeomDB->Erase( nId) ;
|
||||
if ( ! VerifyMachGroup( nId, mgData)) {
|
||||
// se non esiste gruppo per gli errori, lo creo
|
||||
if ( nMachErrId == GDB_ID_NULL) {
|
||||
nMachErrId = m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
|
||||
m_pGeomDB->SetName( nMachErrId, MACH_ERR) ;
|
||||
m_pGeomDB->SetLevel( nMachErrId, GDB_LV_SYSTEM) ;
|
||||
}
|
||||
// se non riesco a rilocare il gruppo errato, lo cancello
|
||||
if ( ! m_pGeomDB->Relocate( nId, nMachErrId))
|
||||
m_pGeomDB->Erase( nId) ;
|
||||
}
|
||||
// passo al successivo
|
||||
nId = nNextId ;
|
||||
}
|
||||
|
||||
+46
-10
@@ -17,9 +17,7 @@
|
||||
#include "MachMgr.h"
|
||||
#include "MachConst.h"
|
||||
#include "Disposition.h"
|
||||
#include "Drilling.h"
|
||||
#include "Sawing.h"
|
||||
#include "Milling.h"
|
||||
#include "MachiningCreate.h"
|
||||
#include "/EgtDev/Include/EMkOperationConst.h"
|
||||
#include "/EgtDev/Include/EGkUserObjFactory.h"
|
||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||
@@ -172,6 +170,10 @@ MachMgr::GetOperationType( int nId) const
|
||||
return OPER_SAWING ;
|
||||
else if ( sUserObj == USEROBJ_GETNAME( Milling))
|
||||
return OPER_MILLING ;
|
||||
else if ( sUserObj == USEROBJ_GETNAME( SawRoughing))
|
||||
return OPER_SAWROUGHING ;
|
||||
else if ( sUserObj == USEROBJ_GETNAME( SawFinishing))
|
||||
return OPER_SAWFINISHING ;
|
||||
else
|
||||
return OPER_NULL ;
|
||||
}
|
||||
@@ -562,7 +564,7 @@ MachMgr::GetCurrMachining( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::AddMachining( const string& sName, const std::string& sMachining)
|
||||
MachMgr::AddMachining( const string& sName, const string& sMachining)
|
||||
{
|
||||
// nessuna lavorazione corrente
|
||||
m_nCurrMachiningId = GDB_ID_NULL ;
|
||||
@@ -593,12 +595,7 @@ MachMgr::AddMachining( const string& sName, const std::string& sMachining)
|
||||
// assegno il nome
|
||||
m_pGeomDB->SetName( nId, sNewName) ;
|
||||
// installo il gestore della lavorazione
|
||||
Machining* pMch = nullptr ;
|
||||
switch ( nMchType) {
|
||||
case MT_DRILLING : pMch = new( nothrow) Drilling ; break ;
|
||||
case MT_SAWING : pMch = new( nothrow) Sawing ; break ;
|
||||
case MT_MILLING : pMch = new( nothrow) Milling ; break ;
|
||||
}
|
||||
Machining* pMch = CreateMachining( nMchType) ;
|
||||
m_pGeomDB->SetUserObj( nId, pMch) ;
|
||||
if ( pMch == nullptr || ! pMch->Init( this) ||
|
||||
! pMch->SetPhase( m_nCurrPhase) || ! pMch->Prepare( sMachining)) {
|
||||
@@ -612,6 +609,45 @@ MachMgr::AddMachining( const string& sName, const std::string& sMachining)
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::AddMachining( const string& sName, int nMchType, const string& sTool)
|
||||
{
|
||||
// nessuna lavorazione corrente
|
||||
m_nCurrMachiningId = GDB_ID_NULL ;
|
||||
// recupero il gestore delle lavorazioni della macchina corrente
|
||||
MachiningsMgr* pMMgr = GetCurrMachiningsMgr() ;
|
||||
if ( pMMgr == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il gruppo delle operazioni nella macchinata corrente
|
||||
int nOperGrpId = GetCurrOperId() ;
|
||||
if ( nOperGrpId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// recupero nome originale, partendo da quello proposto
|
||||
string sNewName = sName ;
|
||||
if ( ! GetOperationNewName( sNewName))
|
||||
return GDB_ID_NULL ;
|
||||
// inserisco il gruppo
|
||||
int nId = m_pGeomDB->AddGroup( GDB_ID_NULL, nOperGrpId, GLOB_FRM) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// assegno il nome
|
||||
m_pGeomDB->SetName( nId, sNewName) ;
|
||||
// installo il gestore della lavorazione
|
||||
Machining* pMch = CreateMachining( nMchType) ;
|
||||
m_pGeomDB->SetUserObj( nId, pMch) ;
|
||||
if ( pMch == nullptr || ! pMch->Init( this) ||
|
||||
! pMch->SetPhase( m_nCurrPhase) || ! pMch->SetParam( MPA_TOOL, sTool)) {
|
||||
string sOut = "AddMachining error : " + GetMachiningTitle( nMchType) + "/" + sTool + " on " + sName ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
m_pGeomDB->Erase( nId) ;
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// la dichiaro lavorazione corrente
|
||||
m_nCurrMachiningId = nId ;
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SetMachiningParam( int nType, bool bVal)
|
||||
|
||||
@@ -325,6 +325,35 @@ Machining::GetDistanceFromRawBottom( int nPhase, int nPathId, double dToler, dou
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machining::GetRawGlobBox( int nPhase, int nPathId, BBox3d& b3Raw)
|
||||
{
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// inizializzo box
|
||||
b3Raw.Reset() ;
|
||||
// ricerco grezzi interessati dal percorso
|
||||
BBox3d b3Compo ;
|
||||
if ( ! m_pGeomDB->GetGlobalBBox( nPathId, b3Compo))
|
||||
return false ;
|
||||
b3Compo.Expand( 10 * EPS_SMALL, 10 * EPS_SMALL, 0) ;
|
||||
int nRawId = m_pMchMgr->GetFirstRawPart() ;
|
||||
while ( nRawId != GDB_ID_NULL) {
|
||||
// verifico che il grezzo compaia nella fase
|
||||
if ( m_pMchMgr->VerifyRawPartPhase( nRawId, nPhase)) {
|
||||
BBox3d b3OneRaw ;
|
||||
int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
|
||||
if ( m_pGeomDB->GetGlobalBBox( nRawSolidId, b3OneRaw) && b3Compo.OverlapsXY( b3OneRaw)) {
|
||||
b3Raw.Add( b3OneRaw) ;
|
||||
}
|
||||
}
|
||||
// passo al grezzo successivo
|
||||
nRawId = m_pMchMgr->GetNextRawPart( nRawId) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
|
||||
+3
-1
@@ -66,6 +66,7 @@ class Machining : public IUserObj
|
||||
const Vector3d& vtDir, double& dElev) ;
|
||||
bool GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist) ;
|
||||
bool GetDistanceFromRawBottom( int nPhase, int nPathId, double dToler, double& dRbDist) ;
|
||||
bool GetRawGlobBox( int nPhase, int nPathId, BBox3d& b3Raw) ;
|
||||
bool GetInitialAxesValues( DBLVECTOR& vAxVal) ;
|
||||
bool GetClPathInitialAxesValues( int nClPathId, DBLVECTOR& vAxVal) ;
|
||||
bool GetFinalAxesValues( DBLVECTOR& vAxVal) ;
|
||||
@@ -89,6 +90,8 @@ class Machining : public IUserObj
|
||||
bool SetAuxDir( const Vector3d& vtDir) ;
|
||||
bool SetFeed( double dFeed) ;
|
||||
bool SetFlag( int nFlag) ;
|
||||
bool GetCurrPos( Point3d& ptCurr)
|
||||
{ if ( ! m_bCurr) return false ; ptCurr = m_ptCurr ; return true ; }
|
||||
int AddRapidStart( const Point3d& ptP) ;
|
||||
int AddRapidMove( const Point3d& ptP) ;
|
||||
int AddLinearMove( const Point3d& ptP) ;
|
||||
@@ -115,4 +118,3 @@ inline const Machining* GetMachining( const IUserObj* pUserObj)
|
||||
{ return dynamic_cast<const Machining*>( pUserObj) ; }
|
||||
inline Machining* GetMachining( IUserObj* pUserObj)
|
||||
{ return dynamic_cast< Machining*>( pUserObj) ; }
|
||||
|
||||
|
||||
@@ -41,3 +41,26 @@ MPA2TPA( int nType)
|
||||
}
|
||||
return TPA_NONE ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Dal tipo numerico restituisce il nome della lavorazione
|
||||
inline const std::string&
|
||||
GetMachiningTitle( int nMchType)
|
||||
{
|
||||
static std::string MchTitle[] = {"Unknown",
|
||||
"Drilling",
|
||||
"Sawing",
|
||||
"Milling",
|
||||
"Pocketing",
|
||||
"Mortising",
|
||||
"SawRoughing"} ;
|
||||
switch ( nMchType) {
|
||||
case MT_DRILLING : return MchTitle[1] ;
|
||||
case MT_SAWING : return MchTitle[2] ;
|
||||
case MT_MILLING : return MchTitle[3] ;
|
||||
case MT_POCKETING : return MchTitle[4] ;
|
||||
case MT_MORTISING : return MchTitle[5] ;
|
||||
case MT_SAWROUGHING : return MchTitle[6] ;
|
||||
}
|
||||
return MchTitle[0] ;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2016-2016
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachiningCreate.h Data : 30.03.16 Versione : 1.6o4
|
||||
// Contenuto : Funzione per creazione oggetti delle lavorazioni.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 30.03.16 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Drilling.h"
|
||||
#include "Sawing.h"
|
||||
#include "Milling.h"
|
||||
#include "SawRoughing.h"
|
||||
#include "SawFinishing.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Dal tipo numerico crea una istanza della classe
|
||||
inline Machining*
|
||||
CreateMachining( int nMchType)
|
||||
{
|
||||
switch ( nMchType) {
|
||||
case MT_DRILLING : return new( std::nothrow) Drilling ;
|
||||
case MT_SAWING : return new( std::nothrow) Sawing ;
|
||||
case MT_MILLING : return new( std::nothrow) Milling ;
|
||||
case MT_SAWROUGHING : return new( std::nothrow) SawRoughing ;
|
||||
case MT_SAWFINISHING : return new( std::nothrow) SawFinishing ;
|
||||
}
|
||||
return nullptr ;
|
||||
}
|
||||
+1137
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,96 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2016-2016
|
||||
//----------------------------------------------------------------------------
|
||||
// File : SawFinishing.h Data : 05.04.16 Versione : 1.6o4
|
||||
// Contenuto : Dichiarazione della classe SawFinishing.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 05.04.16 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Machining.h"
|
||||
#include "SawFinishingData.h"
|
||||
#include "ToolData.h"
|
||||
#include "MachiningConst.h"
|
||||
|
||||
class ICurve ;
|
||||
class ICurveLine ;
|
||||
class ICurveArc ;
|
||||
class ICurveComposite ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class SawFinishing : public Machining
|
||||
{
|
||||
public : // IUserObj
|
||||
SawFinishing* 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( STRVECTOR& vString) const override ;
|
||||
bool Load( const STRVECTOR& vString) override ;
|
||||
|
||||
public : // Machining
|
||||
bool Prepare( const std::string& sSawName) override ;
|
||||
bool SetParam( int nType, bool bVal) override ;
|
||||
bool SetParam( int nType, int nVal) override ;
|
||||
bool SetParam( int nType, double dVal) override ;
|
||||
bool SetParam( int nType, const std::string& sVal) override ;
|
||||
bool SetGeometry( const SELVECTOR& vIds) override ;
|
||||
bool Preview( bool bRecalc) override ;
|
||||
bool Apply( bool bRecalc) 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 ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) override ;
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nCuts == 0) ; }
|
||||
|
||||
public :
|
||||
SawFinishing( void) ;
|
||||
|
||||
private :
|
||||
bool VerifyGeometry( SelData Id, int& nSubs) ;
|
||||
ICurve* GetCurve( SelData Id) ;
|
||||
bool AdjustGeometry( int nAuxId) ;
|
||||
bool CalculateToolPath( int nAuxId, int nClId) ;
|
||||
bool CalculateOneWayCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast) ;
|
||||
bool CalculateZigZagCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast,
|
||||
int& nCount) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtCorr, bool bFirst,
|
||||
double dSafeZ, double dElev, double dAppr) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr) ;
|
||||
bool CalculateToolAndCorrVersors( const Vector3d& vtTang, int nHeadSide,
|
||||
Vector3d& vtTool, Vector3d& vtCorr) ;
|
||||
bool GetHeightOnSection( const ICurve* pSect, double dX, double dYmin, double dYmax, double& dY) ;
|
||||
|
||||
private :
|
||||
double GetSpeed() const
|
||||
{ return ( abs( m_Params.m_dSpeed) < EPS_MACH_ANG_PAR ? m_TParams.m_dSpeed : m_Params.m_dSpeed) ; }
|
||||
double GetFeed() const
|
||||
{ return ( abs( m_Params.m_dFeed) < EPS_MACH_LEN_PAR ? m_TParams.m_dFeed : m_Params.m_dFeed) ; }
|
||||
double GetStartFeed() const
|
||||
{ return ( abs( m_Params.m_dStartFeed) < EPS_MACH_LEN_PAR ? m_TParams.m_dStartFeed : m_Params.m_dStartFeed) ; }
|
||||
double GetEndFeed() const
|
||||
{ return ( abs( m_Params.m_dEndFeed) < EPS_MACH_LEN_PAR ? m_TParams.m_dEndFeed : m_Params.m_dEndFeed) ; }
|
||||
double GetTipFeed() const
|
||||
{ return ( abs( m_Params.m_dTipFeed) < EPS_MACH_LEN_PAR ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
|
||||
double GetOffsR() const
|
||||
{ return ( abs( m_Params.m_dOffsR - UNKNOWN_PAR) < EPS_MACH_LEN_PAR ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; }
|
||||
|
||||
private :
|
||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||
SawFinishingData m_Params ; // parametri lavorazione
|
||||
ToolData m_TParams ; // parametri utensile
|
||||
int m_nCuts ; // numero di tagli generati
|
||||
} ;
|
||||
@@ -0,0 +1,542 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2016-2016
|
||||
//----------------------------------------------------------------------------
|
||||
// File : SawFinishingData.cpp Data : 05.04.16 Versione : 1.6o4
|
||||
// Contenuto : Implementazione struttura dati lavorazione di finitura
|
||||
// di superficie con lama.
|
||||
//
|
||||
//
|
||||
// Modifiche : 05.04.16 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "SawFinishingData.h"
|
||||
#include "MachiningDataFactory.h"
|
||||
#include "MachiningConst.h"
|
||||
#include "/EgtDev/Include/EmkToolConst.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
enum nSawFinishingKey {
|
||||
KEY_APPR = 0,
|
||||
KEY_DH,
|
||||
KEY_F,
|
||||
KEY_FE,
|
||||
KEY_FS,
|
||||
KEY_FT,
|
||||
KEY_HS,
|
||||
KEY_LLTY,
|
||||
KEY_NAME,
|
||||
KEY_NNS,
|
||||
KEY_NNU,
|
||||
KEY_OR,
|
||||
KEY_PS,
|
||||
KEY_S,
|
||||
KEY_SS,
|
||||
KEY_STY,
|
||||
KEY_TNAME,
|
||||
KEY_TUUID,
|
||||
KEY_UUID,
|
||||
KEY_ZZZ} ; // rappresenta il numero di elementi
|
||||
|
||||
static const std::array<std::string,KEY_ZZZ> sSawFinishingKey = {
|
||||
"APPR",
|
||||
"DH",
|
||||
"F",
|
||||
"FE",
|
||||
"FS",
|
||||
"FT",
|
||||
"HS",
|
||||
"LLTY",
|
||||
"NAME",
|
||||
"NNS",
|
||||
"NNU",
|
||||
"OR",
|
||||
"PS",
|
||||
"S",
|
||||
"SS",
|
||||
"STY",
|
||||
"TN",
|
||||
"TU",
|
||||
"UUID"} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
MCHDATA_REGISTER( MT_SAWFINISHING, "SAWFINISHING", SawFinishingData) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
SawFinishingData*
|
||||
SawFinishingData::Clone( void) const
|
||||
{
|
||||
// alloco oggetto
|
||||
SawFinishingData* pSdata = new(nothrow) SawFinishingData ;
|
||||
// copio i dati
|
||||
if ( pSdata != nullptr) {
|
||||
if ( ! pSdata->CopyFrom( this)) {
|
||||
delete pSdata ;
|
||||
return nullptr ;
|
||||
}
|
||||
}
|
||||
return pSdata ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::CopyFrom( const MachiningData* pMdata)
|
||||
{
|
||||
// è inutile copiare se sorgente coincide con destinazione
|
||||
if ( pMdata == this)
|
||||
return true ;
|
||||
// la sorgente deve essere dello stesso tipo
|
||||
const SawFinishingData* pSdata = GetSawFinishingData( pMdata) ;
|
||||
if ( pSdata == nullptr)
|
||||
return false ;
|
||||
// eseguo copia
|
||||
m_Uuid = pSdata->m_Uuid ;
|
||||
m_sName = pSdata->m_sName ;
|
||||
m_ToolUuid = pSdata->m_ToolUuid ;
|
||||
m_sToolName = pSdata->m_sToolName ;
|
||||
m_dSpeed = pSdata->m_dSpeed ;
|
||||
m_dFeed = pSdata->m_dFeed ;
|
||||
m_dEndFeed = pSdata->m_dEndFeed ;
|
||||
m_dStartFeed = pSdata->m_dStartFeed ;
|
||||
m_dTipFeed = pSdata->m_dTipFeed ;
|
||||
m_dOffsR = pSdata->m_dOffsR ;
|
||||
m_nHeadSide = pSdata->m_nHeadSide ;
|
||||
m_sDepth = pSdata->m_sDepth ;
|
||||
m_dStartPos = pSdata->m_dStartPos ;
|
||||
m_dSideStep = pSdata->m_dSideStep ;
|
||||
m_nStepType = pSdata->m_nStepType ;
|
||||
m_nLeadLinkType = pSdata->m_nLeadLinkType ;
|
||||
m_dApprox = pSdata->m_dApprox ;
|
||||
m_sSysNotes = pSdata->m_sSysNotes ;
|
||||
m_sUserNotes = pSdata->m_sUserNotes ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::SameAs(const MachiningData* pMdata) const
|
||||
{
|
||||
// se coincide con altro -> uguali
|
||||
if ( pMdata == this)
|
||||
return true ;
|
||||
// se sono di tipo diverso -> diversi
|
||||
const SawFinishingData* pSdata = GetSawFinishingData( pMdata) ;
|
||||
if ( pSdata == nullptr)
|
||||
return false ;
|
||||
// confronto termine a termine
|
||||
return ( m_Uuid == pSdata->m_Uuid &&
|
||||
m_sName == pSdata->m_sName &&
|
||||
m_ToolUuid == pSdata->m_ToolUuid &&
|
||||
m_sToolName == pSdata->m_sToolName &&
|
||||
abs( m_dSpeed - pSdata->m_dSpeed) < EPS_MACH_ANG_PAR &&
|
||||
abs( m_dFeed - pSdata->m_dFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dEndFeed - pSdata->m_dEndFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dStartFeed - pSdata->m_dStartFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dTipFeed - pSdata->m_dTipFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dOffsR - pSdata->m_dOffsR) < EPS_MACH_LEN_PAR &&
|
||||
m_nHeadSide == pSdata->m_nHeadSide &&
|
||||
m_sDepth == pSdata->m_sDepth &&
|
||||
abs( m_dStartPos - pSdata->m_dStartPos) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dSideStep - pSdata->m_dSideStep) < EPS_MACH_LEN_PAR &&
|
||||
m_nStepType == pSdata->m_nStepType &&
|
||||
m_nLeadLinkType == pSdata->m_nLeadLinkType &&
|
||||
abs( m_dApprox - pSdata->m_dApprox) < EPS_MACH_LEN_PAR &&
|
||||
m_sSysNotes == pSdata->m_sSysNotes &&
|
||||
m_sUserNotes == pSdata->m_sUserNotes) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
SawFinishingData::GetSize( void) const
|
||||
{
|
||||
// in debug verifico validità ultimo campo
|
||||
assert( sSawFinishingKey[KEY_UUID] == "UUID") ;
|
||||
return KEY_ZZZ ;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
string
|
||||
SawFinishingData::GetTitle( void) const
|
||||
{
|
||||
return MCHDATA_GETNAME( SawFinishingData) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
FindSawFinishingKey( const string& sKey)
|
||||
{
|
||||
auto TheRange = equal_range( sSawFinishingKey.cbegin(), sSawFinishingKey.cend(), sKey) ;
|
||||
if ( TheRange.first == TheRange.second)
|
||||
return - 1 ;
|
||||
return int( TheRange.first - sSawFinishingKey.cbegin()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::FromString( const string& sString, int& nKey)
|
||||
{
|
||||
// separo chiave da valore
|
||||
string sKey, sVal ;
|
||||
SplitFirst( sString, "=", sKey, sVal) ;
|
||||
// riconosco la chiave
|
||||
nKey = FindSawFinishingKey( ToUpper( sKey)) ;
|
||||
bool bOk = ( nKey >= 0) ;
|
||||
switch ( nKey) {
|
||||
case KEY_APPR :
|
||||
bOk = ::FromString( sVal, m_dApprox) ;
|
||||
break ;
|
||||
case KEY_DH :
|
||||
m_sDepth = sVal ;
|
||||
if ( m_sDepth.empty())
|
||||
m_sDepth = "0" ;
|
||||
break ;
|
||||
case KEY_F :
|
||||
bOk = ::FromString( sVal, m_dFeed) ;
|
||||
break ;
|
||||
case KEY_FE :
|
||||
bOk = ::FromString( sVal, m_dEndFeed) ;
|
||||
break ;
|
||||
case KEY_FS :
|
||||
bOk = ::FromString( sVal, m_dStartFeed) ;
|
||||
break ;
|
||||
case KEY_FT :
|
||||
bOk = ::FromString( sVal, m_dTipFeed) ;
|
||||
break ;
|
||||
case KEY_HS :
|
||||
bOk = ::FromString( sVal, m_nHeadSide) ;
|
||||
break ;
|
||||
case KEY_LLTY :
|
||||
bOk = ::FromString( sVal, m_nLeadLinkType) ;
|
||||
break ;
|
||||
case KEY_NAME :
|
||||
m_sName = sVal ;
|
||||
bOk = ! m_sName.empty() ;
|
||||
break ;
|
||||
case KEY_NNS :
|
||||
m_sSysNotes = sVal ;
|
||||
break ;
|
||||
case KEY_NNU :
|
||||
m_sUserNotes = sVal ;
|
||||
break ;
|
||||
case KEY_OR :
|
||||
bOk = ::FromString( sVal, m_dOffsR) ;
|
||||
break ;
|
||||
case KEY_PS :
|
||||
bOk = ::FromString( sVal, m_dStartPos) ;
|
||||
break ;
|
||||
case KEY_S :
|
||||
bOk = ::FromString( sVal, m_dSpeed) ;
|
||||
break ;
|
||||
case KEY_SS :
|
||||
bOk = ::FromString( sVal, m_dSideStep) ;
|
||||
break ;
|
||||
case KEY_STY :
|
||||
bOk = ::FromString( sVal, m_nStepType) ;
|
||||
break ;
|
||||
case KEY_TNAME :
|
||||
m_sToolName = sVal ;
|
||||
break ;
|
||||
case KEY_TUUID :
|
||||
bOk = ::FromString( sVal, m_ToolUuid) ;
|
||||
break ;
|
||||
case KEY_UUID :
|
||||
bOk = ::FromString( sVal, m_Uuid) ;
|
||||
break ;
|
||||
default :
|
||||
bOk = false ;
|
||||
break ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
string
|
||||
SawFinishingData::ToString( int nInd) const
|
||||
{
|
||||
switch ( nInd) {
|
||||
case KEY_APPR : return ( sSawFinishingKey[KEY_APPR] + "=" + ::ToString( m_dApprox)) ;
|
||||
case KEY_DH : return ( sSawFinishingKey[KEY_DH] + "=" + m_sDepth) ;
|
||||
case KEY_F : return ( sSawFinishingKey[KEY_F] + "=" + ::ToString( m_dFeed)) ;
|
||||
case KEY_FE : return ( sSawFinishingKey[KEY_FE] + "=" + ::ToString( m_dEndFeed)) ;
|
||||
case KEY_FS : return ( sSawFinishingKey[KEY_FS] + "=" + ::ToString( m_dStartFeed)) ;
|
||||
case KEY_FT : return ( sSawFinishingKey[KEY_FT] + "=" + ::ToString( m_dTipFeed)) ;
|
||||
case KEY_HS : return ( sSawFinishingKey[KEY_HS] + "=" + ::ToString( m_nHeadSide)) ;
|
||||
case KEY_LLTY : return ( sSawFinishingKey[KEY_LLTY] + "=" + ::ToString( m_nLeadLinkType)) ;
|
||||
case KEY_NAME : return ( sSawFinishingKey[KEY_NAME] + "=" + m_sName) ;
|
||||
case KEY_NNS : return ( sSawFinishingKey[KEY_NNS] + "=" + m_sSysNotes) ;
|
||||
case KEY_NNU : return ( sSawFinishingKey[KEY_NNU] + "=" + m_sUserNotes) ;
|
||||
case KEY_OR : return ( sSawFinishingKey[KEY_OR] + "=" + ::ToString( m_dOffsR)) ;
|
||||
case KEY_PS : return ( sSawFinishingKey[KEY_PS] + "=" + ::ToString( m_dStartPos)) ;
|
||||
case KEY_S : return ( sSawFinishingKey[KEY_S] + "=" + ::ToString( m_dSpeed)) ;
|
||||
case KEY_SS : return ( sSawFinishingKey[KEY_SS] + "=" + ::ToString( m_dSideStep)) ;
|
||||
case KEY_STY : return ( sSawFinishingKey[KEY_STY] + "=" + ::ToString( m_nStepType)) ;
|
||||
case KEY_TNAME : return ( sSawFinishingKey[KEY_TNAME] + "=" + m_sToolName) ;
|
||||
case KEY_TUUID : return ( sSawFinishingKey[KEY_TUUID] + "=" + ::ToString( m_ToolUuid)) ;
|
||||
case KEY_UUID : return ( sSawFinishingKey[KEY_UUID] + "=" + ::ToString( m_Uuid)) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::IsOptional( int nKey) const
|
||||
{
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::VerifyHeadSide( int nVal) const
|
||||
{
|
||||
return ( nVal == SAWFIN_HS_LEFT || nVal == SAWFIN_HS_RIGHT) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::VerifyStepType( int nVal) const
|
||||
{
|
||||
return ( nVal == SAWFIN_ST_ZIGZAG || nVal == SAWFIN_ST_ONEWAY) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::VerifyLeadLinkType( int nVal) const
|
||||
{
|
||||
return ( nVal == SAWFIN_LL_STD || nVal == SAWFIN_LL_CENT || nVal == SAWFIN_LL_OUT) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::VerifyTool( const ToolsMgr* pToolsMgr, const std::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_SAWBLADE) == 0)
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const
|
||||
{
|
||||
if ( pToolsMgr == nullptr)
|
||||
return false ;
|
||||
pTdata = pToolsMgr->GetTool( m_ToolUuid) ;
|
||||
return ( pTdata != nullptr) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::SetParam( int nType, bool bVal)
|
||||
{
|
||||
//switch ( nType) {
|
||||
//}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::SetParam( int nType, int nVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_HEADSIDE :
|
||||
if ( ! VerifyHeadSide( nVal))
|
||||
return false ;
|
||||
m_nHeadSide = nVal ;
|
||||
return true ;
|
||||
case MPA_STEPTYPE :
|
||||
if ( ! VerifyStepType( nVal))
|
||||
return false ;
|
||||
m_nStepType = nVal ;
|
||||
return true ;
|
||||
case MPA_LEADLINKTYPE :
|
||||
if ( ! VerifyLeadLinkType( nVal))
|
||||
return false ;
|
||||
m_nLeadLinkType = nVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::SetParam( int nType, double dVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_SPEED :
|
||||
m_dSpeed = dVal ;
|
||||
return true ;
|
||||
case MPA_FEED :
|
||||
m_dFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_STARTFEED :
|
||||
m_dStartFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_ENDFEED :
|
||||
m_dEndFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_TIPFEED :
|
||||
m_dTipFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_OFFSR :
|
||||
m_dOffsR = dVal ;
|
||||
return true ;
|
||||
case MPA_DEPTH :
|
||||
m_sDepth = ::ToString( dVal) ;
|
||||
return true ;
|
||||
case MPA_STARTPOS :
|
||||
m_dStartPos = dVal ;
|
||||
return true ;
|
||||
case MPA_SIDESTEP :
|
||||
m_dSideStep = dVal ;
|
||||
return true ;
|
||||
case MPA_APPROX :
|
||||
m_dApprox = dVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::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 ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::ResetTool( void)
|
||||
{
|
||||
m_sToolName.clear() ;
|
||||
m_ToolUuid.Clear() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::GetParam( int nType, bool& bVal) const
|
||||
{
|
||||
//switch ( nType) {
|
||||
//}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::GetParam( int nType, int& nVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_TYPE :
|
||||
nVal = MT_SAWFINISHING ;
|
||||
return true ;
|
||||
case MPA_HEADSIDE :
|
||||
nVal = m_nHeadSide ;
|
||||
return true ;
|
||||
case MPA_STEPTYPE :
|
||||
nVal = m_nStepType ;
|
||||
return true ;
|
||||
case MPA_LEADLINKTYPE :
|
||||
nVal = m_nLeadLinkType ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::GetParam( int nType, double& dVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_SPEED :
|
||||
dVal = m_dSpeed ;
|
||||
return true ;
|
||||
case MPA_FEED :
|
||||
dVal = m_dFeed ;
|
||||
return true ;
|
||||
case MPA_STARTFEED :
|
||||
dVal = m_dStartFeed ;
|
||||
return true ;
|
||||
case MPA_ENDFEED :
|
||||
dVal = m_dEndFeed ;
|
||||
return true ;
|
||||
case MPA_TIPFEED :
|
||||
dVal = m_dTipFeed ;
|
||||
return true ;
|
||||
case MPA_OFFSR :
|
||||
dVal = m_dOffsR ;
|
||||
return true ;
|
||||
case MPA_STARTPOS :
|
||||
dVal = m_dStartPos ;
|
||||
return true ;
|
||||
case MPA_SIDESTEP :
|
||||
dVal = m_dSideStep ;
|
||||
return true ;
|
||||
case MPA_APPROX :
|
||||
dVal = m_dApprox ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawFinishingData::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 ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2016-2016
|
||||
//----------------------------------------------------------------------------
|
||||
// File : SawFinishingData.h Data : 05.04.16 Versione : 1.6o4
|
||||
// Contenuto : Dichiarazione della struct SawFinisghingData e costanti associate.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 05.04.16 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MachiningData.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
struct SawFinishingData : public MachiningData
|
||||
{
|
||||
EgtUUID m_ToolUuid ; // identificativo universale dell'utensile
|
||||
std::string m_sToolName ; // nome dell'utensile
|
||||
double m_dSpeed ; // velocità di rotazione (+ se CCW, - se CW) ( se 0 da utensile)
|
||||
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
|
||||
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
|
||||
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
|
||||
double m_dTipFeed ; // velocità di lavorazione di testa ( se 0 da utensile)
|
||||
double m_dOffsR ; // offset radiale ( se UNKNOWN_PAR da utensile)
|
||||
int m_nHeadSide ; // lato di posizionamento del mandrino ( destra o sinistra)
|
||||
std::string m_sDepth ; // affondamento massimo (espressione numerica)
|
||||
double m_dStartPos ; // quota di inizio lavorazione (sempre >= 0)
|
||||
double m_dSideStep ; // distanza tra le passate (0=spessore lama)
|
||||
int m_nStepType ; // tipo di lavorazione a step (una via, va e vieni)
|
||||
int m_nLeadLinkType ; // tipo di attacco/uscita/collegamento ( centro, fuori)
|
||||
double m_dApprox ; // valore di approssimazione per superfici
|
||||
std::string m_sSysNotes ; // note interne
|
||||
std::string m_sUserNotes ; // note dell'utente
|
||||
|
||||
SawFinishingData( void)
|
||||
: m_ToolUuid(), m_dSpeed( 0), m_dFeed( 0), m_dStartFeed( 0), m_dEndFeed( 0), m_dTipFeed( 0),
|
||||
m_dOffsR( UNKNOWN_PAR),
|
||||
m_nHeadSide(0), m_dStartPos( 0), m_dSideStep( 0),
|
||||
m_nStepType( 0), m_nLeadLinkType( 0), m_dApprox( 0) {}
|
||||
SawFinishingData* Clone( void) const override ;
|
||||
bool CopyFrom( const MachiningData* pMdata) override ;
|
||||
bool SameAs(const MachiningData* pMdata) const override ;
|
||||
int GetType( void) const override
|
||||
{ return MT_SAWFINISHING ; }
|
||||
int GetSize( void) const override ;
|
||||
std::string GetTitle( void) const override ;
|
||||
bool FromString( const std::string& sString, int& nKey) override ;
|
||||
std::string ToString( int nInd) const override ;
|
||||
bool IsOptional( int nKey) const override ;
|
||||
bool SetParam( int nType, bool bVal) override ;
|
||||
bool SetParam( int nType, int nVal) override ;
|
||||
bool SetParam( int nType, double dVal) override ;
|
||||
bool SetParam( int nType, const std::string& sVal) override ;
|
||||
bool ResetTool( void) override ;
|
||||
bool GetParam( int nType, bool& bVal) const override ;
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const override ;
|
||||
bool VerifyTool( const ToolsMgr* pToolsMgr, const std::string& sVal, const ToolData*& pTdata) const override ;
|
||||
bool VerifyHeadSide( int nVal) const ;
|
||||
bool VerifyStepType( int nVal) const ;
|
||||
bool VerifyLeadLinkType( int nVal) const ;
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const SawFinishingData* GetSawFinishingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const SawFinishingData*>( pMdata)) ; }
|
||||
inline SawFinishingData* GetSawFinishingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<SawFinishingData*>( pMdata)) ; }
|
||||
+1285
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,98 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2016-2016
|
||||
//----------------------------------------------------------------------------
|
||||
// File : SawRoughing.h Data : 30.03.16 Versione : 1.6o4
|
||||
// Contenuto : Dichiarazione della classe SawRoughing.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 30.03.16 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Machining.h"
|
||||
#include "SawRoughingData.h"
|
||||
#include "ToolData.h"
|
||||
#include "MachiningConst.h"
|
||||
|
||||
class ICurve ;
|
||||
class ICurveLine ;
|
||||
class ICurveArc ;
|
||||
class ICurveComposite ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class SawRoughing : public Machining
|
||||
{
|
||||
public : // IUserObj
|
||||
SawRoughing* 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( STRVECTOR& vString) const override ;
|
||||
bool Load( const STRVECTOR& vString) override ;
|
||||
|
||||
public : // Machining
|
||||
bool Prepare( const std::string& sSawName) override ;
|
||||
bool SetParam( int nType, bool bVal) override ;
|
||||
bool SetParam( int nType, int nVal) override ;
|
||||
bool SetParam( int nType, double dVal) override ;
|
||||
bool SetParam( int nType, const std::string& sVal) override ;
|
||||
bool SetGeometry( const SELVECTOR& vIds) override ;
|
||||
bool Preview( bool bRecalc) override ;
|
||||
bool Apply( bool bRecalc) 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 ;
|
||||
const ToolData& GetToolData( void) const override ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) override ;
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nCuts == 0) ; }
|
||||
|
||||
public :
|
||||
SawRoughing( void) ;
|
||||
|
||||
private :
|
||||
bool VerifyGeometry( SelData Id, int& nSubs) ;
|
||||
ICurve* GetCurve( SelData Id) ;
|
||||
bool AdjustGeometry( int nAuxId) ;
|
||||
bool CalculateToolPath( int nAuxId, int nClId) ;
|
||||
bool CalculateOneWayCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast) ;
|
||||
bool CalculateZigZagCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir,
|
||||
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast,
|
||||
int& nCount) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtCorr, bool bFirst,
|
||||
double dSafeZ, double dElev, double dAppr) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr) ;
|
||||
bool CalculateToolAndCorrVersors( const Vector3d& vtTang, int nHeadSide,
|
||||
Vector3d& vtTool, Vector3d& vtCorr) ;
|
||||
bool GetHeightOnSection( const ICurve* pSect, double dX, double dYmin, double dYmax, double& dY) ;
|
||||
|
||||
private :
|
||||
double GetSpeed() const
|
||||
{ return ( abs( m_Params.m_dSpeed) < EPS_MACH_ANG_PAR ? m_TParams.m_dSpeed : m_Params.m_dSpeed) ; }
|
||||
double GetFeed() const
|
||||
{ return ( abs( m_Params.m_dFeed) < EPS_MACH_LEN_PAR ? m_TParams.m_dFeed : m_Params.m_dFeed) ; }
|
||||
double GetStartFeed() const
|
||||
{ return ( abs( m_Params.m_dStartFeed) < EPS_MACH_LEN_PAR ? m_TParams.m_dStartFeed : m_Params.m_dStartFeed) ; }
|
||||
double GetEndFeed() const
|
||||
{ return ( abs( m_Params.m_dEndFeed) < EPS_MACH_LEN_PAR ? m_TParams.m_dEndFeed : m_Params.m_dEndFeed) ; }
|
||||
double GetTipFeed() const
|
||||
{ return ( abs( m_Params.m_dTipFeed) < EPS_MACH_LEN_PAR ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
|
||||
double GetOffsL() const
|
||||
{ return ( abs( m_Params.m_dOffsL - UNKNOWN_PAR) < EPS_MACH_LEN_PAR ? m_TParams.m_dOffsL : m_Params.m_dOffsL) ; }
|
||||
double GetOffsR() const
|
||||
{ return ( abs( m_Params.m_dOffsR - UNKNOWN_PAR) < EPS_MACH_LEN_PAR ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; }
|
||||
|
||||
private :
|
||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||
SawRoughingData m_Params ; // parametri lavorazione
|
||||
ToolData m_TParams ; // parametri utensile
|
||||
int m_nCuts ; // numero di tagli generati
|
||||
} ;
|
||||
@@ -0,0 +1,570 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2016-2016
|
||||
//----------------------------------------------------------------------------
|
||||
// File : SawRoughingData.cpp Data : 30.03.16 Versione : 1.6o4
|
||||
// Contenuto : Implementazione struttura dati lavorazione di sgrossatura
|
||||
// di superficie con lama.
|
||||
//
|
||||
//
|
||||
// Modifiche : 30.03.16 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "SawRoughingData.h"
|
||||
#include "MachiningDataFactory.h"
|
||||
#include "MachiningConst.h"
|
||||
#include "/EgtDev/Include/EmkToolConst.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
enum nSawRoughingKey {
|
||||
KEY_APPR = 0,
|
||||
KEY_DH,
|
||||
KEY_F,
|
||||
KEY_FE,
|
||||
KEY_FS,
|
||||
KEY_FT,
|
||||
KEY_HS,
|
||||
KEY_LLTY,
|
||||
KEY_NAME,
|
||||
KEY_NNS,
|
||||
KEY_NNU,
|
||||
KEY_OL,
|
||||
KEY_OR,
|
||||
KEY_PS,
|
||||
KEY_S,
|
||||
KEY_SS,
|
||||
KEY_ST,
|
||||
KEY_STY,
|
||||
KEY_TNAME,
|
||||
KEY_TUUID,
|
||||
KEY_UUID,
|
||||
KEY_ZZZ} ; // rappresenta il numero di elementi
|
||||
|
||||
static const std::array<std::string,KEY_ZZZ> sSawRoughingKey = {
|
||||
"APPR",
|
||||
"DH",
|
||||
"F",
|
||||
"FE",
|
||||
"FS",
|
||||
"FT",
|
||||
"HS",
|
||||
"LLTY",
|
||||
"NAME",
|
||||
"NNS",
|
||||
"NNU",
|
||||
"OL",
|
||||
"OR",
|
||||
"PS",
|
||||
"S",
|
||||
"SS",
|
||||
"ST",
|
||||
"STY",
|
||||
"TN",
|
||||
"TU",
|
||||
"UUID"} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
MCHDATA_REGISTER( MT_SAWROUGHING, "SAWROUGHING", SawRoughingData) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
SawRoughingData*
|
||||
SawRoughingData::Clone( void) const
|
||||
{
|
||||
// alloco oggetto
|
||||
SawRoughingData* pSdata = new(nothrow) SawRoughingData ;
|
||||
// copio i dati
|
||||
if ( pSdata != nullptr) {
|
||||
if ( ! pSdata->CopyFrom( this)) {
|
||||
delete pSdata ;
|
||||
return nullptr ;
|
||||
}
|
||||
}
|
||||
return pSdata ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::CopyFrom( const MachiningData* pMdata)
|
||||
{
|
||||
// è inutile copiare se sorgente coincide con destinazione
|
||||
if ( pMdata == this)
|
||||
return true ;
|
||||
// la sorgente deve essere dello stesso tipo
|
||||
const SawRoughingData* pSdata = GetSawRoughingData( pMdata) ;
|
||||
if ( pSdata == nullptr)
|
||||
return false ;
|
||||
// eseguo copia
|
||||
m_Uuid = pSdata->m_Uuid ;
|
||||
m_sName = pSdata->m_sName ;
|
||||
m_ToolUuid = pSdata->m_ToolUuid ;
|
||||
m_sToolName = pSdata->m_sToolName ;
|
||||
m_dSpeed = pSdata->m_dSpeed ;
|
||||
m_dFeed = pSdata->m_dFeed ;
|
||||
m_dEndFeed = pSdata->m_dEndFeed ;
|
||||
m_dStartFeed = pSdata->m_dStartFeed ;
|
||||
m_dTipFeed = pSdata->m_dTipFeed ;
|
||||
m_dOffsL = pSdata->m_dOffsL ;
|
||||
m_dOffsR = pSdata->m_dOffsR ;
|
||||
m_nHeadSide = pSdata->m_nHeadSide ;
|
||||
m_sDepth = pSdata->m_sDepth ;
|
||||
m_dStartPos = pSdata->m_dStartPos ;
|
||||
m_dSideStep = pSdata->m_dSideStep ;
|
||||
m_dStep = pSdata->m_dStep ;
|
||||
m_nStepType = pSdata->m_nStepType ;
|
||||
m_nLeadLinkType = pSdata->m_nLeadLinkType ;
|
||||
m_dApprox = pSdata->m_dApprox ;
|
||||
m_sSysNotes = pSdata->m_sSysNotes ;
|
||||
m_sUserNotes = pSdata->m_sUserNotes ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::SameAs(const MachiningData* pMdata) const
|
||||
{
|
||||
// se coincide con altro -> uguali
|
||||
if ( pMdata == this)
|
||||
return true ;
|
||||
// se sono di tipo diverso -> diversi
|
||||
const SawRoughingData* pSdata = GetSawRoughingData( pMdata) ;
|
||||
if ( pSdata == nullptr)
|
||||
return false ;
|
||||
// confronto termine a termine
|
||||
return ( m_Uuid == pSdata->m_Uuid &&
|
||||
m_sName == pSdata->m_sName &&
|
||||
m_ToolUuid == pSdata->m_ToolUuid &&
|
||||
m_sToolName == pSdata->m_sToolName &&
|
||||
abs( m_dSpeed - pSdata->m_dSpeed) < EPS_MACH_ANG_PAR &&
|
||||
abs( m_dFeed - pSdata->m_dFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dEndFeed - pSdata->m_dEndFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dStartFeed - pSdata->m_dStartFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dTipFeed - pSdata->m_dTipFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dOffsL - pSdata->m_dOffsL) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dOffsR - pSdata->m_dOffsR) < EPS_MACH_LEN_PAR &&
|
||||
m_nHeadSide == pSdata->m_nHeadSide &&
|
||||
m_sDepth == pSdata->m_sDepth &&
|
||||
abs( m_dStartPos - pSdata->m_dStartPos) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dSideStep - pSdata->m_dSideStep) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dStep - pSdata->m_dStep) < EPS_MACH_LEN_PAR &&
|
||||
m_nStepType == pSdata->m_nStepType &&
|
||||
m_nLeadLinkType == pSdata->m_nLeadLinkType &&
|
||||
abs( m_dApprox - pSdata->m_dApprox) < EPS_MACH_LEN_PAR &&
|
||||
m_sSysNotes == pSdata->m_sSysNotes &&
|
||||
m_sUserNotes == pSdata->m_sUserNotes) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
SawRoughingData::GetSize( void) const
|
||||
{
|
||||
// in debug verifico validità ultimo campo
|
||||
assert( sSawRoughingKey[KEY_UUID] == "UUID") ;
|
||||
return KEY_ZZZ ;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
string
|
||||
SawRoughingData::GetTitle( void) const
|
||||
{
|
||||
return MCHDATA_GETNAME( SawRoughingData) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
FindSawRoughingKey( const string& sKey)
|
||||
{
|
||||
auto TheRange = equal_range( sSawRoughingKey.cbegin(), sSawRoughingKey.cend(), sKey) ;
|
||||
if ( TheRange.first == TheRange.second)
|
||||
return - 1 ;
|
||||
return int( TheRange.first - sSawRoughingKey.cbegin()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::FromString( const string& sString, int& nKey)
|
||||
{
|
||||
// separo chiave da valore
|
||||
string sKey, sVal ;
|
||||
SplitFirst( sString, "=", sKey, sVal) ;
|
||||
// riconosco la chiave
|
||||
nKey = FindSawRoughingKey( ToUpper( sKey)) ;
|
||||
bool bOk = ( nKey >= 0) ;
|
||||
switch ( nKey) {
|
||||
case KEY_APPR :
|
||||
bOk = ::FromString( sVal, m_dApprox) ;
|
||||
break ;
|
||||
case KEY_DH :
|
||||
m_sDepth = sVal ;
|
||||
if ( m_sDepth.empty())
|
||||
m_sDepth = "0" ;
|
||||
break ;
|
||||
case KEY_F :
|
||||
bOk = ::FromString( sVal, m_dFeed) ;
|
||||
break ;
|
||||
case KEY_FE :
|
||||
bOk = ::FromString( sVal, m_dEndFeed) ;
|
||||
break ;
|
||||
case KEY_FS :
|
||||
bOk = ::FromString( sVal, m_dStartFeed) ;
|
||||
break ;
|
||||
case KEY_FT :
|
||||
bOk = ::FromString( sVal, m_dTipFeed) ;
|
||||
break ;
|
||||
case KEY_HS :
|
||||
bOk = ::FromString( sVal, m_nHeadSide) ;
|
||||
break ;
|
||||
case KEY_LLTY :
|
||||
bOk = ::FromString( sVal, m_nLeadLinkType) ;
|
||||
break ;
|
||||
case KEY_NAME :
|
||||
m_sName = sVal ;
|
||||
bOk = ! m_sName.empty() ;
|
||||
break ;
|
||||
case KEY_NNS :
|
||||
m_sSysNotes = sVal ;
|
||||
break ;
|
||||
case KEY_NNU :
|
||||
m_sUserNotes = sVal ;
|
||||
break ;
|
||||
case KEY_OL :
|
||||
bOk = ::FromString( sVal, m_dOffsL) ;
|
||||
break ;
|
||||
case KEY_OR :
|
||||
bOk = ::FromString( sVal, m_dOffsR) ;
|
||||
break ;
|
||||
case KEY_PS :
|
||||
bOk = ::FromString( sVal, m_dStartPos) ;
|
||||
break ;
|
||||
case KEY_S :
|
||||
bOk = ::FromString( sVal, m_dSpeed) ;
|
||||
break ;
|
||||
case KEY_SS :
|
||||
bOk = ::FromString( sVal, m_dSideStep) ;
|
||||
break ;
|
||||
case KEY_ST :
|
||||
bOk = ::FromString( sVal, m_dStep) ;
|
||||
break ;
|
||||
case KEY_STY :
|
||||
bOk = ::FromString( sVal, m_nStepType) ;
|
||||
break ;
|
||||
case KEY_TNAME :
|
||||
m_sToolName = sVal ;
|
||||
break ;
|
||||
case KEY_TUUID :
|
||||
bOk = ::FromString( sVal, m_ToolUuid) ;
|
||||
break ;
|
||||
case KEY_UUID :
|
||||
bOk = ::FromString( sVal, m_Uuid) ;
|
||||
break ;
|
||||
default :
|
||||
bOk = false ;
|
||||
break ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
string
|
||||
SawRoughingData::ToString( int nInd) const
|
||||
{
|
||||
switch ( nInd) {
|
||||
case KEY_APPR : return ( sSawRoughingKey[KEY_APPR] + "=" + ::ToString( m_dApprox)) ;
|
||||
case KEY_DH : return ( sSawRoughingKey[KEY_DH] + "=" + m_sDepth) ;
|
||||
case KEY_F : return ( sSawRoughingKey[KEY_F] + "=" + ::ToString( m_dFeed)) ;
|
||||
case KEY_FE : return ( sSawRoughingKey[KEY_FE] + "=" + ::ToString( m_dEndFeed)) ;
|
||||
case KEY_FS : return ( sSawRoughingKey[KEY_FS] + "=" + ::ToString( m_dStartFeed)) ;
|
||||
case KEY_FT : return ( sSawRoughingKey[KEY_FT] + "=" + ::ToString( m_dTipFeed)) ;
|
||||
case KEY_HS : return ( sSawRoughingKey[KEY_HS] + "=" + ::ToString( m_nHeadSide)) ;
|
||||
case KEY_LLTY : return ( sSawRoughingKey[KEY_LLTY] + "=" + ::ToString( m_nLeadLinkType)) ;
|
||||
case KEY_NAME : return ( sSawRoughingKey[KEY_NAME] + "=" + m_sName) ;
|
||||
case KEY_NNS : return ( sSawRoughingKey[KEY_NNS] + "=" + m_sSysNotes) ;
|
||||
case KEY_NNU : return ( sSawRoughingKey[KEY_NNU] + "=" + m_sUserNotes) ;
|
||||
case KEY_OL : return ( sSawRoughingKey[KEY_OL] + "=" + ::ToString( m_dOffsL)) ;
|
||||
case KEY_OR : return ( sSawRoughingKey[KEY_OR] + "=" + ::ToString( m_dOffsR)) ;
|
||||
case KEY_PS : return ( sSawRoughingKey[KEY_PS] + "=" + ::ToString( m_dStartPos)) ;
|
||||
case KEY_S : return ( sSawRoughingKey[KEY_S] + "=" + ::ToString( m_dSpeed)) ;
|
||||
case KEY_SS : return ( sSawRoughingKey[KEY_SS] + "=" + ::ToString( m_dSideStep)) ;
|
||||
case KEY_ST : return ( sSawRoughingKey[KEY_ST] + "=" + ::ToString( m_dStep)) ;
|
||||
case KEY_STY : return ( sSawRoughingKey[KEY_STY] + "=" + ::ToString( m_nStepType)) ;
|
||||
case KEY_TNAME : return ( sSawRoughingKey[KEY_TNAME] + "=" + m_sToolName) ;
|
||||
case KEY_TUUID : return ( sSawRoughingKey[KEY_TUUID] + "=" + ::ToString( m_ToolUuid)) ;
|
||||
case KEY_UUID : return ( sSawRoughingKey[KEY_UUID] + "=" + ::ToString( m_Uuid)) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::IsOptional( int nKey) const
|
||||
{
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::VerifyHeadSide( int nVal) const
|
||||
{
|
||||
return ( nVal == SAWROU_HS_LEFT || nVal == SAWROU_HS_RIGHT) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::VerifyStepType( int nVal) const
|
||||
{
|
||||
return ( nVal == SAWROU_ST_ZIGZAG || nVal == SAWROU_ST_ONEWAY) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::VerifyLeadLinkType( int nVal) const
|
||||
{
|
||||
return ( nVal == SAWROU_LL_CENT || nVal == SAWROU_LL_OUT) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::VerifyTool( const ToolsMgr* pToolsMgr, const std::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_SAWBLADE) == 0)
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const
|
||||
{
|
||||
if ( pToolsMgr == nullptr)
|
||||
return false ;
|
||||
pTdata = pToolsMgr->GetTool( m_ToolUuid) ;
|
||||
return ( pTdata != nullptr) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::SetParam( int nType, bool bVal)
|
||||
{
|
||||
//switch ( nType) {
|
||||
//}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::SetParam( int nType, int nVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_HEADSIDE :
|
||||
if ( ! VerifyHeadSide( nVal))
|
||||
return false ;
|
||||
m_nHeadSide = nVal ;
|
||||
return true ;
|
||||
case MPA_STEPTYPE :
|
||||
if ( ! VerifyStepType( nVal))
|
||||
return false ;
|
||||
m_nStepType = nVal ;
|
||||
return true ;
|
||||
case MPA_LEADLINKTYPE :
|
||||
if ( ! VerifyLeadLinkType( nVal))
|
||||
return false ;
|
||||
m_nLeadLinkType = nVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::SetParam( int nType, double dVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_SPEED :
|
||||
m_dSpeed = dVal ;
|
||||
return true ;
|
||||
case MPA_FEED :
|
||||
m_dFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_STARTFEED :
|
||||
m_dStartFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_ENDFEED :
|
||||
m_dEndFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_TIPFEED :
|
||||
m_dTipFeed = dVal ;
|
||||
return true ;
|
||||
case MPA_OFFSL :
|
||||
m_dOffsL = dVal ;
|
||||
return true ;
|
||||
case MPA_OFFSR :
|
||||
m_dOffsR = dVal ;
|
||||
return true ;
|
||||
case MPA_DEPTH :
|
||||
m_sDepth = ::ToString( dVal) ;
|
||||
return true ;
|
||||
case MPA_STARTPOS :
|
||||
m_dStartPos = dVal ;
|
||||
return true ;
|
||||
case MPA_SIDESTEP :
|
||||
m_dSideStep = dVal ;
|
||||
return true ;
|
||||
case MPA_STEP :
|
||||
m_dStep = dVal ;
|
||||
return true ;
|
||||
case MPA_APPROX :
|
||||
m_dApprox = dVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::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 ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::ResetTool( void)
|
||||
{
|
||||
m_sToolName.clear() ;
|
||||
m_ToolUuid.Clear() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::GetParam( int nType, bool& bVal) const
|
||||
{
|
||||
//switch ( nType) {
|
||||
//}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::GetParam( int nType, int& nVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_TYPE :
|
||||
nVal = MT_SAWROUGHING ;
|
||||
return true ;
|
||||
case MPA_HEADSIDE :
|
||||
nVal = m_nHeadSide ;
|
||||
return true ;
|
||||
case MPA_STEPTYPE :
|
||||
nVal = m_nStepType ;
|
||||
return true ;
|
||||
case MPA_LEADLINKTYPE :
|
||||
nVal = m_nLeadLinkType ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::GetParam( int nType, double& dVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_SPEED :
|
||||
dVal = m_dSpeed ;
|
||||
return true ;
|
||||
case MPA_FEED :
|
||||
dVal = m_dFeed ;
|
||||
return true ;
|
||||
case MPA_STARTFEED :
|
||||
dVal = m_dStartFeed ;
|
||||
return true ;
|
||||
case MPA_ENDFEED :
|
||||
dVal = m_dEndFeed ;
|
||||
return true ;
|
||||
case MPA_TIPFEED :
|
||||
dVal = m_dTipFeed ;
|
||||
return true ;
|
||||
case MPA_OFFSL :
|
||||
dVal = m_dOffsL ;
|
||||
return true ;
|
||||
case MPA_OFFSR :
|
||||
dVal = m_dOffsR ;
|
||||
return true ;
|
||||
case MPA_STARTPOS :
|
||||
dVal = m_dStartPos ;
|
||||
return true ;
|
||||
case MPA_SIDESTEP :
|
||||
dVal = m_dSideStep ;
|
||||
return true ;
|
||||
case MPA_STEP :
|
||||
dVal = m_dStep ;
|
||||
return true ;
|
||||
case MPA_APPROX :
|
||||
dVal = m_dApprox ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SawRoughingData::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 ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2016-2016
|
||||
//----------------------------------------------------------------------------
|
||||
// File : SawRoughingData.h Data : 30.03.16 Versione : 1.6o4
|
||||
// Contenuto : Dichiarazione della struct SawRoughingData e costanti associate.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 30.03.16 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MachiningData.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
struct SawRoughingData : public MachiningData
|
||||
{
|
||||
EgtUUID m_ToolUuid ; // identificativo universale dell'utensile
|
||||
std::string m_sToolName ; // nome dell'utensile
|
||||
double m_dSpeed ; // velocità di rotazione (+ se CCW, - se CW) ( se 0 da utensile)
|
||||
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
|
||||
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
|
||||
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
|
||||
double m_dTipFeed ; // velocità di lavorazione di testa ( se 0 da utensile)
|
||||
double m_dOffsR ; // offset radiale ( se UNKNOWN_PAR da utensile)
|
||||
double m_dOffsL ; // offset longitudinale ( se UNKNOWN_PAR da utensile)
|
||||
int m_nHeadSide ; // lato di posizionamento del mandrino ( destra o sinistra)
|
||||
std::string m_sDepth ; // affondamento massimo (espressione numerica)
|
||||
double m_dStartPos ; // quota di inizio lavorazione (sempre >= 0)
|
||||
double m_dSideStep ; // distanza tra le passate (0=spessore lama)
|
||||
double m_dStep ; // passo di affondamento (0=nessun passo)
|
||||
int m_nStepType ; // tipo di lavorazione a step (una via, va e vieni)
|
||||
int m_nLeadLinkType ; // tipo di attacco/uscita/collegamento ( centro, fuori)
|
||||
double m_dApprox ; // valore di approssimazione per superfici
|
||||
std::string m_sSysNotes ; // note interne
|
||||
std::string m_sUserNotes ; // note dell'utente
|
||||
|
||||
SawRoughingData( void)
|
||||
: m_ToolUuid(), m_dSpeed( 0), m_dFeed( 0), m_dStartFeed( 0), m_dEndFeed( 0), m_dTipFeed( 0),
|
||||
m_dOffsR( UNKNOWN_PAR), m_dOffsL( UNKNOWN_PAR),
|
||||
m_nHeadSide(0), m_dStartPos( 0), m_dSideStep( 0), m_dStep( 0),
|
||||
m_nStepType( 0), m_nLeadLinkType( 0), m_dApprox( 0) {}
|
||||
SawRoughingData* Clone( void) const override ;
|
||||
bool CopyFrom( const MachiningData* pMdata) override ;
|
||||
bool SameAs(const MachiningData* pMdata) const override ;
|
||||
int GetType( void) const override
|
||||
{ return MT_SAWROUGHING ; }
|
||||
int GetSize( void) const override ;
|
||||
std::string GetTitle( void) const override ;
|
||||
bool FromString( const std::string& sString, int& nKey) override ;
|
||||
std::string ToString( int nInd) const override ;
|
||||
bool IsOptional( int nKey) const override ;
|
||||
bool SetParam( int nType, bool bVal) override ;
|
||||
bool SetParam( int nType, int nVal) override ;
|
||||
bool SetParam( int nType, double dVal) override ;
|
||||
bool SetParam( int nType, const std::string& sVal) override ;
|
||||
bool ResetTool( void) override ;
|
||||
bool GetParam( int nType, bool& bVal) const override ;
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const override ;
|
||||
bool VerifyTool( const ToolsMgr* pToolsMgr, const std::string& sVal, const ToolData*& pTdata) const override ;
|
||||
bool VerifyHeadSide( int nVal) const ;
|
||||
bool VerifyStepType( int nVal) const ;
|
||||
bool VerifyLeadLinkType( int nVal) const ;
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const SawRoughingData* GetSawRoughingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const SawRoughingData*>( pMdata)) ; }
|
||||
inline SawRoughingData* GetSawRoughingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<SawRoughingData*>( pMdata)) ; }
|
||||
+1
-2
@@ -1026,7 +1026,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
m_pGeomDB->GetName( nPathId, sPathName) ;
|
||||
|
||||
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
|
||||
const double MAX_ANG_CEN = 181 ;
|
||||
const double MAX_ANG_CEN = 180 + EPS_ANG_SMALL ;
|
||||
int nMaxInd = pCompo->GetCurveCount() - 1 ;
|
||||
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
|
||||
// se arco con angolo al centro oltre il limite, lo divido a metà
|
||||
@@ -2726,7 +2726,6 @@ Sawing::AddApproach( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ,
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Sawing::AddRetract( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr)
|
||||
|
||||
Reference in New Issue
Block a user