EgtMachKernel :
- aggiunta lavorazione di mortasatura - aggiunt agestione angolo indeterminato su secondo asse rotante.
This commit is contained in:
+12
-15
@@ -847,23 +847,20 @@ Chiseling::GetCurve( SelData Id)
|
||||
bool
|
||||
Chiseling::AdjustCurveFromSurf( ICurveComposite* pCrvCompo)
|
||||
{
|
||||
// prendo il contorno
|
||||
if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
|
||||
// cerco l'estremo più alto e lo imposto come inizio
|
||||
double dU = 0 ;
|
||||
double dUmax = 0 ;
|
||||
double dZmax = - INFINITO ;
|
||||
Point3d ptP ;
|
||||
while ( pCrvCompo->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP)) {
|
||||
if ( ptP.z > dZmax + EPS_SMALL) {
|
||||
dZmax = ptP.z ;
|
||||
dUmax = dU ;
|
||||
}
|
||||
dU += 1 ;
|
||||
// cerco l'estremo più alto del contorno e lo imposto come inizio
|
||||
double dU = 0 ;
|
||||
double dUmax = 0 ;
|
||||
double dZmax = - INFINITO ;
|
||||
Point3d ptP ;
|
||||
while ( pCrvCompo->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP)) {
|
||||
if ( ptP.z > dZmax + EPS_SMALL) {
|
||||
dZmax = ptP.z ;
|
||||
dUmax = dU ;
|
||||
}
|
||||
if ( dU != 0)
|
||||
pCrvCompo->ChangeStartPoint( dUmax) ;
|
||||
dU += 1 ;
|
||||
}
|
||||
if ( dU != 0)
|
||||
pCrvCompo->ChangeStartPoint( dUmax) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
@@ -251,6 +251,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="MachMgrDBTools.cpp" />
|
||||
<ClCompile Include="Milling.cpp" />
|
||||
<ClCompile Include="MillingData.cpp" />
|
||||
<ClCompile Include="Mortising.cpp" />
|
||||
<ClCompile Include="MortisingData.cpp" />
|
||||
<ClCompile Include="Operation.cpp" />
|
||||
<ClCompile Include="OperationCL.cpp" />
|
||||
<ClCompile Include="Pocketing.cpp" />
|
||||
@@ -305,6 +307,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="MachMgr.h" />
|
||||
<ClInclude Include="Milling.h" />
|
||||
<ClInclude Include="MillingData.h" />
|
||||
<ClInclude Include="Mortising.h" />
|
||||
<ClInclude Include="MortisingData.h" />
|
||||
<ClInclude Include="Operation.h" />
|
||||
<ClInclude Include="OperationConst.h" />
|
||||
<ClInclude Include="OutputConst.h" />
|
||||
|
||||
@@ -204,6 +204,12 @@
|
||||
<ClCompile Include="MachineTables.cpp">
|
||||
<Filter>Source Files\Machine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MortisingData.cpp">
|
||||
<Filter>Source Files\Machinings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Mortising.cpp">
|
||||
<Filter>Source Files\Operations</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="DllMain.h">
|
||||
@@ -359,6 +365,12 @@
|
||||
<ClInclude Include="OperationConst.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MortisingData.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Mortising.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtMachKernel.rc">
|
||||
|
||||
@@ -380,7 +380,7 @@ class MachMgr : public IMachMgr
|
||||
{ m_vAxisBlock.clear() ; }
|
||||
bool IsKinematicRotAxisBlocked( int nInd) const ;
|
||||
double GetCalcRot1W( void) const ;
|
||||
bool SetCalcSolCh( int nScc) ;
|
||||
bool SetCalcSolCh( int nScc, bool bExact) ;
|
||||
bool VerifyAngleOutstroke( int nInd, double dAng) const ;
|
||||
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const ;
|
||||
// Operations
|
||||
|
||||
+2
-2
@@ -428,13 +428,13 @@ MachMgr::IsKinematicRotAxisBlocked( int nInd) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SetCalcSolCh( int nScc)
|
||||
MachMgr::SetCalcSolCh( int nScc, bool bExact)
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// imposto il criterio di scelta della soluzione
|
||||
return pMch->SetSolCh( nScc) ;
|
||||
return pMch->SetSolCh( nScc, bExact) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -95,7 +95,7 @@ class Machine
|
||||
bool FreeKinematicRotAxis( int nId) ;
|
||||
bool IsKinematicRotAxisBlocked( int nInd) const ;
|
||||
bool GetKinematicRotAxisBlocked( int nInd, std::string& sName, double& dVal) const ;
|
||||
bool SetSolCh( int nScc) ;
|
||||
bool SetSolCh( int nScc, bool bExact) ;
|
||||
int GetCurrLinAxes( void) const ;
|
||||
int GetCurrRotAxes( void) const ;
|
||||
bool GetCurrAxisName( int nInd, std::string& sAxName) const ;
|
||||
@@ -215,7 +215,7 @@ class Machine
|
||||
bool GetDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const ;
|
||||
bool GetBackDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const ;
|
||||
bool GetSccDir( int nSolCh, const Vector3d& vtDirA, Vector3d& vtDirScc) const ;
|
||||
bool VerifyScc( const Vector3d& vtDirI, const Vector3d& vtDirA, int nSolCh) const ;
|
||||
bool VerifyScc( const Vector3d& vtDirI, const Vector3d& vtDirA, int nSolCh, bool bExact) const ;
|
||||
bool AdjustAngleInStroke( const STROKE& Stroke, double& dAng) const ;
|
||||
bool LuaInit( const std::string& sMachineName) ;
|
||||
bool LuaExit( void) ;
|
||||
@@ -249,6 +249,7 @@ class Machine
|
||||
int m_nCalcToolId ; // utensile corrente per calcoli
|
||||
double m_dCalcRot1W ; // peso del primo asse rotante per i confronti
|
||||
int m_nCalcSolCh ; // criterio di scelta della soluzione
|
||||
bool m_bSolChExact ; // flag per scelta soluzione da soddisfare esattamente
|
||||
Point3d m_ptCalcPos ; // posizione utensile a riposo per calcoli
|
||||
Vector3d m_vtCalcDir ; // direzione utensile a riposo per calcoli
|
||||
Vector3d m_vtCalcADir ; // direzione ausiliaria a riposo per calcoli
|
||||
|
||||
+48
-12
@@ -577,8 +577,10 @@ Machine::GetKinematicRotAxisBlocked( int nInd, string& sName, double& dVal) cons
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::SetSolCh( int nScc)
|
||||
Machine::SetSolCh( int nScc, bool bExact)
|
||||
{
|
||||
// imposto se richiesta verifica esatta
|
||||
m_bSolChExact = bExact ;
|
||||
// se standard o nullo o suo opposto
|
||||
if ( nScc == MCH_SCC_STD || nScc == MCH_SCC_NONE || nScc == MCH_SCC_OPPOSITE) {
|
||||
// recupero i dati della testa
|
||||
@@ -781,6 +783,16 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
vtAx2.Invert() ;
|
||||
// calcolo secondo angolo di rotazione
|
||||
nStat = GetRotationComponent( vtDirHn, dCompTSuAxR1, vtAx1, vtAx2, dAngB1, dAngB2, bDet) ;
|
||||
// se indeterminato con richiesta direzione ausiliaria esatta, ricalcolo con direzione aux
|
||||
if ( nStat >= 1 && ! bDet && m_bSolChExact) {
|
||||
// componente versore ausiliario desiderato su direzione primo asse rotante
|
||||
Vector3d vtSccDir ;
|
||||
if ( GetSccDir( m_nCalcSolCh, vtDirAn, vtSccDir)) {
|
||||
double dCompASuAxR1 = vtSccDir * vtAx1 ;
|
||||
// ricalcolo secondo angolo di rotazione
|
||||
nStat = GetRotationComponent( vtDirIn, dCompASuAxR1, vtAx1, vtAx2, dAngB1, dAngB2, bDet) ;
|
||||
}
|
||||
}
|
||||
// aggiornamento direzioni fresa e ausiliaria su testa
|
||||
if ( nStat >= 1) {
|
||||
// se indeterminato lo azzero
|
||||
@@ -867,11 +879,11 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
|
||||
// verifiche per criterio scelta soluzione
|
||||
if ( nStat >= 2) {
|
||||
if ( ! VerifyScc( vtDirI2, vtDirAn, m_nCalcSolCh))
|
||||
if ( ! VerifyScc( vtDirI2, vtDirAn, m_nCalcSolCh, m_bSolChExact))
|
||||
-- nStat ;
|
||||
}
|
||||
if ( nStat >= 1) {
|
||||
if ( ! VerifyScc( vtDirI1, vtDirAn, m_nCalcSolCh)) {
|
||||
if ( ! VerifyScc( vtDirI1, vtDirAn, m_nCalcSolCh, m_bSolChExact)) {
|
||||
-- nStat ;
|
||||
// riloco eventuale soluzione rimasta
|
||||
if ( nStat >= 1) {
|
||||
@@ -1165,27 +1177,51 @@ Machine::GetSccDir( int nSolCh, const Vector3d& vtDirA, Vector3d& vtDirScc) cons
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::VerifyScc( const Vector3d& vtDirI, const Vector3d& vtDirA, int nSolCh) const
|
||||
Machine::VerifyScc( const Vector3d& vtDirI, const Vector3d& vtDirA, int nSolCh, bool bExact) const
|
||||
{
|
||||
switch ( nSolCh) {
|
||||
default :
|
||||
return true ;
|
||||
case MCH_SCC_ADIR_XP :
|
||||
return ( vtDirI.x > - EPS_ZERO) ;
|
||||
if ( bExact)
|
||||
return vtDirI.IsXplus() ;
|
||||
else
|
||||
return ( vtDirI.x > - EPS_ZERO) ;
|
||||
case MCH_SCC_ADIR_XM :
|
||||
return ( vtDirI.x < EPS_ZERO) ;
|
||||
if ( bExact)
|
||||
return vtDirI.IsXminus() ;
|
||||
else
|
||||
return ( vtDirI.x < EPS_ZERO) ;
|
||||
case MCH_SCC_ADIR_YP :
|
||||
return ( vtDirI.y > - EPS_ZERO) ;
|
||||
if ( bExact)
|
||||
return vtDirI.IsYplus() ;
|
||||
else
|
||||
return ( vtDirI.y > - EPS_ZERO) ;
|
||||
case MCH_SCC_ADIR_YM :
|
||||
return ( vtDirI.y < EPS_ZERO) ;
|
||||
if ( bExact)
|
||||
return vtDirI.IsYminus() ;
|
||||
else
|
||||
return ( vtDirI.y < EPS_ZERO) ;
|
||||
case MCH_SCC_ADIR_ZP :
|
||||
return ( vtDirI.z > - EPS_ZERO) ;
|
||||
if ( bExact)
|
||||
return vtDirI.IsZplus() ;
|
||||
else
|
||||
return ( vtDirI.z > - EPS_ZERO) ;
|
||||
case MCH_SCC_ADIR_ZM :
|
||||
return ( vtDirI.z < EPS_ZERO) ;
|
||||
if ( bExact)
|
||||
return vtDirI.IsZminus() ;
|
||||
else
|
||||
return ( vtDirI.z < EPS_ZERO) ;
|
||||
case MCH_SCC_ADIR_NEAR :
|
||||
return ( vtDirA.IsSmall() || ( vtDirI * vtDirA) > cos( 60 * DEGTORAD)) ;
|
||||
if ( bExact)
|
||||
return ( ! vtDirA.IsSmall() && ( vtDirI * vtDirA) > cos( 0.1 * DEGTORAD)) ;
|
||||
else
|
||||
return ( vtDirA.IsSmall() || ( vtDirI * vtDirA) > cos( 60 * DEGTORAD)) ;
|
||||
case MCH_SCC_ADIR_FAR :
|
||||
return ( vtDirA.IsSmall() || ( vtDirI * vtDirA) < cos( 120 * DEGTORAD)) ;
|
||||
if ( bExact)
|
||||
return ( ! vtDirA.IsSmall() && ( vtDirI * vtDirA) < cos( 179.1 * DEGTORAD)) ;
|
||||
else
|
||||
return ( vtDirA.IsSmall() || ( vtDirI * vtDirA) < cos( 120 * DEGTORAD)) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,6 +136,10 @@ Machine::LoadTool( Exit* pExit, const string& sTool)
|
||||
if ( nT == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->Rotate( nT, ORIG, X_AX, 90) ;
|
||||
// se mortasa, lo ruoto 90 deg attorno a Z
|
||||
int nType ;
|
||||
if ( m_pMchMgr->TdbGetCurrToolParam( TPA_TYPE, nType) && nType == TT_MORTISE_STD)
|
||||
m_pGeomDB->Rotate( nT, ORIG, Z_AX, 90) ;
|
||||
pExit->SetTool( sTool) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1377,7 +1377,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
if ( ! pCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL, false))
|
||||
return false ;
|
||||
|
||||
// recupero i punti di inizio e fine (per poi salvarlo nelle info di CL path)
|
||||
// recupero i punti di inizio e fine (per poi salvarli nelle info di CL path)
|
||||
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
|
||||
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
|
||||
|
||||
@@ -1497,7 +1497,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
|
||||
// se richiesta anteprima
|
||||
if ( nPvId != GDB_ID_NULL) {
|
||||
// creo gruppo per geometria di lavorazione del percorso
|
||||
// creo gruppo per geometria di anteprima del percorso
|
||||
int nPxId = m_pGeomDB->AddGroup( GDB_ID_NULL, nPvId, Frame3d()) ;
|
||||
if ( nPxId == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
+1549
File diff suppressed because it is too large
Load Diff
+100
@@ -0,0 +1,100 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2018-2018
|
||||
//----------------------------------------------------------------------------
|
||||
// File : Mortising.h Data : 25.02.18 Versione : 1.9c1
|
||||
// Contenuto : Dichiarazione della classe Mortising.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 25.02.18 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Machining.h"
|
||||
#include "MortisingData.h"
|
||||
#include "ToolData.h"
|
||||
|
||||
struct SqHole ;
|
||||
class ICurve ;
|
||||
class ICurveComposite ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Mortising : public Machining
|
||||
{
|
||||
public : // IUserObj
|
||||
Mortising* Clone( void) const override ;
|
||||
const std::string& GetClassName( void) const override ;
|
||||
bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;
|
||||
bool ToSave( void) const override
|
||||
{ return true ; }
|
||||
bool Save( int nBaseId, STRVECTOR& vString) const override ;
|
||||
bool Load( const STRVECTOR& vString, int nBaseGdbId) override ;
|
||||
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_MORTISING ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nMortises == 0) ; }
|
||||
|
||||
protected : // Operation
|
||||
int GetSolCh( void) const override
|
||||
{ return m_Params.m_nSolCh ; }
|
||||
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ;
|
||||
|
||||
public : // Machining
|
||||
bool Prepare( const std::string& sMillName) override ;
|
||||
bool SetParam( int nType, bool bVal) override ;
|
||||
bool SetParam( int nType, int nVal) override ;
|
||||
bool SetParam( int nType, double dVal) override ;
|
||||
bool SetParam( int nType, const std::string& sVal) override ;
|
||||
bool SetGeometry( const SELVECTOR& vIds) override ;
|
||||
bool Preview( bool bRecalc) override ;
|
||||
bool Apply( bool bRecalc, bool bPostApply) override ;
|
||||
bool Update( bool bPostApply) override ;
|
||||
bool GetParam( int nType, bool& bVal) const override ;
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
const ToolData& GetToolData( void) const ;
|
||||
bool GetGeometry( SELVECTOR& vIds) const override ;
|
||||
|
||||
public :
|
||||
Mortising( void) ;
|
||||
|
||||
private :
|
||||
bool UpdateToolData( void) ;
|
||||
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
|
||||
ICurve* GetCurve( SelData Id) ;
|
||||
bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo) ;
|
||||
bool Chain( int nGrpDestId) ;
|
||||
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
|
||||
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double& dElev) ;
|
||||
bool GenerateMortisingPv( int nPathId, const ICurveComposite* pCompo) ;
|
||||
bool GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep) ;
|
||||
double GetRadiusForStartEndElevation( void) ;
|
||||
|
||||
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
|
||||
MortisingData m_Params ; // parametri lavorazione
|
||||
ToolData m_TParams ; // parametri utensile
|
||||
int m_nMortises ; // numero di mortasature generate
|
||||
} ;
|
||||
@@ -0,0 +1,632 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2018-2018
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MortisingData.cpp Data : 25.02.18 Versione : 1.9cb1
|
||||
// Contenuto : Implementazione struttura dati lavorazione di mortasatura.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 25.02.18 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "MortisingData.h"
|
||||
#include "MachiningDataFactory.h"
|
||||
#include "MachiningConst.h"
|
||||
#include "/EgtDev/Include/EmkToolConst.h"
|
||||
#include "/EgtDev/Include/EmkSimuGenConst.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
enum nMortisingKey {
|
||||
KEY_AB = 0,
|
||||
KEY_AI,
|
||||
KEY_DH,
|
||||
KEY_EAL,
|
||||
KEY_F,
|
||||
KEY_FE,
|
||||
KEY_FS,
|
||||
KEY_FT,
|
||||
KEY_FU,
|
||||
KEY_INV,
|
||||
KEY_NAME,
|
||||
KEY_NNS,
|
||||
KEY_NNU,
|
||||
KEY_OL,
|
||||
KEY_OR,
|
||||
KEY_PS,
|
||||
KEY_S,
|
||||
KEY_SAL,
|
||||
KEY_SCC,
|
||||
KEY_ST,
|
||||
KEY_TI,
|
||||
KEY_TNAME,
|
||||
KEY_TUUID,
|
||||
KEY_UUID,
|
||||
KEY_WS,
|
||||
KEY_ZZZ} ; // rappresenta il numero di elementi
|
||||
|
||||
static const std::array<std::string,KEY_ZZZ> sMortisingKey = {
|
||||
"AB",
|
||||
"AI",
|
||||
"DH",
|
||||
"EAL",
|
||||
"F",
|
||||
"FE",
|
||||
"FS",
|
||||
"FT",
|
||||
"FU",
|
||||
"INV",
|
||||
"NAME",
|
||||
"NNS",
|
||||
"NNU",
|
||||
"OL",
|
||||
"OR",
|
||||
"PS",
|
||||
"S",
|
||||
"SAL",
|
||||
"SCC",
|
||||
"ST",
|
||||
"TI",
|
||||
"TN",
|
||||
"TU",
|
||||
"UUID",
|
||||
"WS"} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
MCHDATA_REGISTER( MT_MORTISING, "MORTISING", MortisingData) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
MortisingData*
|
||||
MortisingData::Clone( void) const
|
||||
{
|
||||
// alloco oggetto
|
||||
MortisingData* pDdata = new(nothrow) MortisingData ;
|
||||
// copio i dati
|
||||
if ( pDdata != nullptr) {
|
||||
if ( ! pDdata->CopyFrom( this)) {
|
||||
delete pDdata ;
|
||||
return nullptr ;
|
||||
}
|
||||
}
|
||||
return pDdata ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::CopyFrom( const MachiningData* pMdata)
|
||||
{
|
||||
// è inutile copiare se sorgente coincide con destinazione
|
||||
if ( pMdata == this)
|
||||
return true ;
|
||||
// la sorgente deve essere dello stesso tipo
|
||||
const MortisingData* pDdata = GetMortisingData( pMdata) ;
|
||||
if ( pDdata == nullptr)
|
||||
return false ;
|
||||
// eseguo copia
|
||||
m_Uuid = pDdata->m_Uuid ;
|
||||
m_sName = pDdata->m_sName ;
|
||||
m_ToolUuid = pDdata->m_ToolUuid ;
|
||||
m_sToolName = pDdata->m_sToolName ;
|
||||
m_sBlockedAxis = pDdata->m_sBlockedAxis ;
|
||||
m_sInitAngs = pDdata->m_sInitAngs ;
|
||||
m_nSolCh = pDdata->m_nSolCh ;
|
||||
m_dSpeed = pDdata->m_dSpeed ;
|
||||
m_dFeed = pDdata->m_dFeed ;
|
||||
m_dStartFeed = pDdata->m_dStartFeed ;
|
||||
m_dEndFeed = pDdata->m_dEndFeed ;
|
||||
m_dTipFeed = pDdata->m_dTipFeed ;
|
||||
m_dOffsL = pDdata->m_dOffsL ;
|
||||
m_dOffsR = pDdata->m_dOffsR ;
|
||||
m_nWorkSide = pDdata->m_nWorkSide ;
|
||||
m_bToolInvert = pDdata->m_bToolInvert ;
|
||||
m_nFaceUse = pDdata->m_nFaceUse ;
|
||||
m_bInvert = pDdata->m_bInvert ;
|
||||
m_sDepth = pDdata->m_sDepth ;
|
||||
m_dStartPos = pDdata->m_dStartPos ;
|
||||
m_dStep = pDdata->m_dStep ;
|
||||
m_dStartAddLen = pDdata->m_dStartAddLen ;
|
||||
m_dEndAddLen = pDdata->m_dEndAddLen ;
|
||||
m_sSysNotes = pDdata->m_sSysNotes ;
|
||||
m_sUserNotes = pDdata->m_sUserNotes ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::SameAs(const MachiningData* pMdata) const
|
||||
{
|
||||
// se coincide con altro -> uguali
|
||||
if ( pMdata == this)
|
||||
return true ;
|
||||
// se sono di tipo diverso -> diversi
|
||||
const MortisingData* pDdata = GetMortisingData( pMdata) ;
|
||||
if ( pDdata == nullptr)
|
||||
return false ;
|
||||
// confronto termine a termine
|
||||
return ( m_Uuid == pDdata->m_Uuid &&
|
||||
m_sName == pDdata->m_sName &&
|
||||
m_ToolUuid == pDdata->m_ToolUuid &&
|
||||
m_sToolName == pDdata->m_sToolName &&
|
||||
m_sBlockedAxis == pDdata->m_sBlockedAxis &&
|
||||
m_sInitAngs == pDdata->m_sInitAngs &&
|
||||
m_nSolCh == pDdata->m_nSolCh &&
|
||||
abs( m_dSpeed - pDdata->m_dSpeed) < EPS_MACH_ANG_PAR &&
|
||||
abs( m_dFeed - pDdata->m_dFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dStartFeed - pDdata->m_dStartFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dEndFeed - pDdata->m_dEndFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dTipFeed - pDdata->m_dTipFeed) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dOffsL - pDdata->m_dOffsL) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dOffsR - pDdata->m_dOffsR) < EPS_MACH_LEN_PAR &&
|
||||
m_nWorkSide == pDdata->m_nWorkSide &&
|
||||
m_bToolInvert == pDdata->m_bToolInvert &&
|
||||
m_nFaceUse == pDdata->m_nFaceUse &&
|
||||
m_bInvert == pDdata->m_bInvert &&
|
||||
m_sDepth == pDdata->m_sDepth &&
|
||||
abs( m_dStartPos - pDdata->m_dStartPos) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dStep - pDdata->m_dStep) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dStartAddLen - pDdata->m_dStartAddLen) < EPS_MACH_LEN_PAR &&
|
||||
abs( m_dEndAddLen - pDdata->m_dEndAddLen) < EPS_MACH_LEN_PAR &&
|
||||
m_sSysNotes == pDdata->m_sSysNotes &&
|
||||
m_sUserNotes == pDdata->m_sUserNotes) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MortisingData::GetSize( void) const
|
||||
{
|
||||
// in debug verifico validità ultimo campo
|
||||
assert( sMortisingKey[KEY_UUID] == "UUID") ;
|
||||
return KEY_ZZZ ;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
string
|
||||
MortisingData::GetTitle( void) const
|
||||
{
|
||||
return MCHDATA_GETNAME( MortisingData) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
FindMortisingKey( const string& sKey)
|
||||
{
|
||||
auto TheRange = equal_range( sMortisingKey.cbegin(), sMortisingKey.cend(), sKey) ;
|
||||
if ( TheRange.first == TheRange.second)
|
||||
return - 1 ;
|
||||
return int( TheRange.first - sMortisingKey.cbegin()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::FromString( const string& sString, int& nKey)
|
||||
{
|
||||
// separo chiave da valore
|
||||
string sKey, sVal ;
|
||||
SplitFirst( sString, "=", sKey, sVal) ;
|
||||
// riconosco la chiave
|
||||
nKey = FindMortisingKey( ToUpper( sKey)) ;
|
||||
bool bOk = ( nKey >= 0) ;
|
||||
switch ( nKey) {
|
||||
case KEY_AB :
|
||||
m_sBlockedAxis = sVal ;
|
||||
break ;
|
||||
case KEY_AI :
|
||||
m_sInitAngs = sVal ;
|
||||
break ;
|
||||
case KEY_DH :
|
||||
m_sDepth = sVal ;
|
||||
if ( m_sDepth.empty())
|
||||
m_sDepth = "TH" ;
|
||||
break ;
|
||||
case KEY_EAL :
|
||||
bOk = ::FromString( sVal, m_dEndAddLen) ;
|
||||
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_FU :
|
||||
bOk = ::FromString( sVal, m_nFaceUse) ;
|
||||
break ;
|
||||
case KEY_INV :
|
||||
bOk = ::FromString( sVal, m_bInvert) ;
|
||||
break ;
|
||||
case KEY_NAME :
|
||||
m_sName = sVal ;
|
||||
bOk = ! m_sName.empty() ;
|
||||
break ;
|
||||
case KEY_NNS :
|
||||
m_sSysNotes = sVal ;
|
||||
break ;
|
||||
case KEY_NNU :
|
||||
m_sUserNotes = sVal ;
|
||||
break ;
|
||||
case KEY_OL :
|
||||
bOk = ::FromString( sVal, m_dOffsL) ;
|
||||
break ;
|
||||
case KEY_OR :
|
||||
bOk = ::FromString( sVal, m_dOffsR) ;
|
||||
break ;
|
||||
case KEY_PS :
|
||||
bOk = ::FromString( sVal, m_dStartPos) ;
|
||||
break ;
|
||||
case KEY_S :
|
||||
bOk = ::FromString( sVal, m_dSpeed) ;
|
||||
break ;
|
||||
case KEY_SAL :
|
||||
bOk = ::FromString( sVal, m_dStartAddLen) ;
|
||||
break ;
|
||||
case KEY_SCC :
|
||||
bOk = ::FromString( sVal, m_nSolCh) ;
|
||||
break ;
|
||||
case KEY_ST :
|
||||
bOk = ::FromString( sVal, m_dStep) ;
|
||||
break ;
|
||||
case KEY_TI :
|
||||
bOk = ::FromString( sVal, m_bToolInvert) ;
|
||||
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 ;
|
||||
case KEY_WS :
|
||||
bOk = ::FromString( sVal, m_nWorkSide) ;
|
||||
break ;
|
||||
default :
|
||||
bOk = false ;
|
||||
break ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
string
|
||||
MortisingData::ToString( int nKey) const
|
||||
{
|
||||
switch ( nKey) {
|
||||
case KEY_AB : return ( sMortisingKey[KEY_AB] + "=" + m_sBlockedAxis) ;
|
||||
case KEY_AI : return ( sMortisingKey[KEY_AI] + "=" + m_sInitAngs) ;
|
||||
case KEY_DH : return ( sMortisingKey[KEY_DH] + "=" + m_sDepth) ;
|
||||
case KEY_EAL : return ( sMortisingKey[KEY_EAL] + "=" + ::ToString( m_dEndAddLen)) ;
|
||||
case KEY_F : return ( sMortisingKey[KEY_F] + "=" + ::ToString( m_dFeed)) ;
|
||||
case KEY_FE : return ( sMortisingKey[KEY_FE] + "=" + ::ToString( m_dEndFeed)) ;
|
||||
case KEY_FS : return ( sMortisingKey[KEY_FS] + "=" + ::ToString( m_dStartFeed)) ;
|
||||
case KEY_FT : return ( sMortisingKey[KEY_FT] + "=" + ::ToString( m_dTipFeed)) ;
|
||||
case KEY_FU : return ( sMortisingKey[KEY_FU] + "=" + ::ToString( m_nFaceUse)) ;
|
||||
case KEY_INV : return ( sMortisingKey[KEY_INV] + "=" + ::ToString( m_bInvert)) ;
|
||||
case KEY_NAME : return ( sMortisingKey[KEY_NAME] + "=" + m_sName) ;
|
||||
case KEY_NNS : return ( sMortisingKey[KEY_NNS] + "=" + m_sSysNotes) ;
|
||||
case KEY_NNU : return ( sMortisingKey[KEY_NNU] + "=" + m_sUserNotes) ;
|
||||
case KEY_OL : return ( sMortisingKey[KEY_OL] + "=" + ::ToString( m_dOffsL)) ;
|
||||
case KEY_OR : return ( sMortisingKey[KEY_OR] + "=" + ::ToString( m_dOffsR)) ;
|
||||
case KEY_PS : return ( sMortisingKey[KEY_PS] + "=" + ::ToString( m_dStartPos)) ;
|
||||
case KEY_S : return ( sMortisingKey[KEY_S] + "=" + ::ToString( m_dSpeed)) ;
|
||||
case KEY_SAL : return ( sMortisingKey[KEY_SAL] + "=" + ::ToString( m_dStartAddLen)) ;
|
||||
case KEY_SCC : return ( sMortisingKey[KEY_SCC] + "=" + ::ToString( m_nSolCh)) ;
|
||||
case KEY_ST : return ( sMortisingKey[KEY_ST] + "=" + ::ToString( m_dStep)) ;
|
||||
case KEY_TI : return ( sMortisingKey[KEY_TI] + "=" + ::ToString( m_bToolInvert)) ;
|
||||
case KEY_TNAME : return ( sMortisingKey[KEY_TNAME] + "=" + m_sToolName) ;
|
||||
case KEY_TUUID : return ( sMortisingKey[KEY_TUUID] + "=" + ::ToString( m_ToolUuid)) ;
|
||||
case KEY_UUID : return ( sMortisingKey[KEY_UUID] + "=" + ::ToString( m_Uuid)) ;
|
||||
case KEY_WS : return ( sMortisingKey[KEY_WS] + "=" + ::ToString( m_nWorkSide)) ;
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::IsOptional( int nKey) const
|
||||
{
|
||||
return ( nKey == KEY_ST) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::VerifySolCh( int nVal) const
|
||||
{
|
||||
return IsValidOperationScc( nVal) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::VerifyFaceUse( int nVal) const
|
||||
{
|
||||
return ( nVal == MILL_FU_NONE ||
|
||||
( nVal >= MORTISE_FU_PARAL_DOWN && nVal <= MORTISE_FU_PARAL_RIGHT)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::VerifyWorkSide( int nVal) const
|
||||
{
|
||||
return ( nVal == MORTISE_WS_LEFT || nVal == MORTISE_WS_RIGHT) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::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 != TT_MORTISE_STD)
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const
|
||||
{
|
||||
if ( pToolsMgr == nullptr)
|
||||
return false ;
|
||||
pTdata = pToolsMgr->GetTool( m_ToolUuid) ;
|
||||
return ( pTdata != nullptr) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::SetParam( int nType, bool bVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_INVERT :
|
||||
m_bInvert = bVal ;
|
||||
return true ;
|
||||
case MPA_TOOLINVERT :
|
||||
m_bToolInvert = bVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::SetParam( int nType, int nVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_WORKSIDE :
|
||||
if ( ! VerifyWorkSide( nVal))
|
||||
return false ;
|
||||
m_nWorkSide = nVal ;
|
||||
return true ;
|
||||
case MPA_SCC :
|
||||
if ( ! VerifySolCh( nVal))
|
||||
return false ;
|
||||
m_nSolCh = nVal ;
|
||||
return true ;
|
||||
case MPA_FACEUSE :
|
||||
if ( ! VerifyFaceUse( nVal))
|
||||
return false ;
|
||||
m_nFaceUse = nVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::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_STEP :
|
||||
m_dStep = dVal ;
|
||||
return true ;
|
||||
case MPA_STARTADDLEN :
|
||||
m_dStartAddLen = dVal ;
|
||||
return true ;
|
||||
case MPA_ENDADDLEN :
|
||||
m_dEndAddLen = dVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::SetParam( int nType, const string& sVal)
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_NAME :
|
||||
m_sName = sVal ;
|
||||
return true ;
|
||||
case MPA_TOOL :
|
||||
m_sToolName = sVal ;
|
||||
return true ;
|
||||
case MPA_DEPTH_STR :
|
||||
m_sDepth = sVal ;
|
||||
return true ;
|
||||
case MPA_TUUID :
|
||||
return ::FromString( sVal, m_ToolUuid) ;
|
||||
case MPA_UUID :
|
||||
return ::FromString( sVal, m_Uuid) ;
|
||||
case MPA_SYSNOTES :
|
||||
m_sSysNotes = sVal ;
|
||||
return true ;
|
||||
case MPA_USERNOTES :
|
||||
m_sUserNotes = sVal ;
|
||||
return true ;
|
||||
case MPA_INITANGS :
|
||||
m_sInitAngs = sVal ;
|
||||
return true ;
|
||||
case MPA_BLOCKEDAXIS :
|
||||
m_sBlockedAxis = sVal ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::ResetTool( void)
|
||||
{
|
||||
m_sToolName.clear() ;
|
||||
m_ToolUuid.Clear() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::GetParam( int nType, bool& bVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_INVERT :
|
||||
bVal = m_bInvert ;
|
||||
return true ;
|
||||
case MPA_TOOLINVERT :
|
||||
bVal = m_bToolInvert ;
|
||||
return true ;
|
||||
}
|
||||
bVal = false ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::GetParam( int nType, int& nVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_TYPE :
|
||||
nVal = MT_MORTISING ;
|
||||
return true ;
|
||||
case MPA_WORKSIDE :
|
||||
nVal = m_nWorkSide ;
|
||||
return true ;
|
||||
case MPA_SCC :
|
||||
nVal = m_nSolCh ;
|
||||
return true ;
|
||||
case MPA_FACEUSE :
|
||||
nVal = m_nFaceUse ;
|
||||
return true ;
|
||||
}
|
||||
nVal = 0 ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::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_STEP :
|
||||
dVal = m_dStep ;
|
||||
return true ;
|
||||
case MPA_STARTADDLEN :
|
||||
dVal = m_dStartAddLen ;
|
||||
return true ;
|
||||
case MPA_ENDADDLEN :
|
||||
dVal = m_dEndAddLen ;
|
||||
return true ;
|
||||
}
|
||||
dVal = 0 ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MortisingData::GetParam( int nType, string& sVal) const
|
||||
{
|
||||
switch ( nType) {
|
||||
case MPA_NAME :
|
||||
sVal = m_sName ;
|
||||
return true ;
|
||||
case MPA_TOOL :
|
||||
sVal = m_sToolName ;
|
||||
return true ;
|
||||
case MPA_DEPTH_STR :
|
||||
sVal = m_sDepth ;
|
||||
return true ;
|
||||
case MPA_TUUID :
|
||||
sVal = ::ToString( m_ToolUuid) ;
|
||||
return true ;
|
||||
case MPA_UUID :
|
||||
sVal = ::ToString( m_Uuid) ;
|
||||
return true ;
|
||||
case MPA_SYSNOTES :
|
||||
sVal = m_sSysNotes ;
|
||||
return true ;
|
||||
case MPA_USERNOTES :
|
||||
sVal = m_sUserNotes ;
|
||||
return true ;
|
||||
case MPA_INITANGS :
|
||||
sVal = m_sInitAngs ;
|
||||
return true ;
|
||||
case MPA_BLOCKEDAXIS :
|
||||
sVal = m_sBlockedAxis ;
|
||||
return true ;
|
||||
}
|
||||
sVal = "" ;
|
||||
return false ;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2018-2018
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MortisingData.h Data : 25.02.18 Versione : 1.9c1
|
||||
// Contenuto : Dichiarazione della struct MortisingData e costanti associate.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 25.02.18 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MachiningData.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
struct MortisingData : public MachiningData
|
||||
{
|
||||
EgtUUID m_ToolUuid ; // identificativo universale dell'utensile
|
||||
std::string m_sToolName ; // nome dell'utensile
|
||||
std::string m_sInitAngs ; // angoli iniziali suggeriti (Nome1=val1,Nome2=val2)
|
||||
std::string m_sBlockedAxis ; // eventuale asse rotante bloccato (Nome=val)
|
||||
int m_nSolCh ; // criterio scelta soluzione (quando possibili molteplici)
|
||||
double m_dSpeed ; // velocità di rotazione (+ se CCW, - se CW) ( se 0 da utensile)
|
||||
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
|
||||
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
|
||||
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
|
||||
double m_dTipFeed ; // velocità di lavorazione di sfondamento ( se 0 da utensile)
|
||||
double m_dOffsR ; // offset radiale ( se UNKNOWN_PAR da utensile)
|
||||
double m_dOffsL ; // offset longitudinale ( se UNKNOWN_PAR da utensile)
|
||||
bool m_bToolInvert ; // flag per inversione direzione utensile da geometria
|
||||
int m_nFaceUse ; // metodo di utilizzo della faccia per lavorare
|
||||
bool m_bInvert ; // flag di inversione direzione lavorazione
|
||||
int m_nWorkSide ; // lato di lavoro (destra, sinistra)
|
||||
std::string m_sDepth ; // affondamento (espressione numerica)
|
||||
double m_dStartPos ; // quota di inizio lavorazione (sempre >= 0)
|
||||
double m_dStep ; // passo di affondamento (0=nessun passo)
|
||||
double m_dStartAddLen ; // lunghezza da aggiungere/togliere all'inizio
|
||||
double m_dEndAddLen ; // lunghezza da aggiungere/togliere alla fine
|
||||
std::string m_sSysNotes ; // note interne
|
||||
std::string m_sUserNotes ; // note dell'utente
|
||||
|
||||
MortisingData( void)
|
||||
: m_ToolUuid(), m_nSolCh( 0), m_dSpeed( 0), m_dFeed( 0), m_dStartFeed( 0), m_dEndFeed( 0), m_dTipFeed( 0),
|
||||
m_dOffsR( UNKNOWN_PAR), m_dOffsL( UNKNOWN_PAR),
|
||||
m_bToolInvert( false), m_nFaceUse( 0), m_bInvert( false), m_nWorkSide( 0), m_dStartPos( 0),
|
||||
m_dStep( 0), m_dStartAddLen( 0), m_dEndAddLen( 0) {}
|
||||
MortisingData* Clone( void) const override ;
|
||||
bool CopyFrom( const MachiningData* pMdata) override ;
|
||||
bool SameAs(const MachiningData* pMdata) const override ;
|
||||
int GetType( void) const override
|
||||
{ return MT_MORTISING ; }
|
||||
int GetSize( void) const override ;
|
||||
std::string GetTitle( void) const override ;
|
||||
bool FromString( const std::string& sString, int& nKey) override ;
|
||||
std::string ToString( int nKey) const override ;
|
||||
bool IsOptional( int nKey) const override ;
|
||||
bool SetParam( int nType, bool bVal) override ;
|
||||
bool SetParam( int nType, int nVal) override ;
|
||||
bool SetParam( int nType, double dVal) override ;
|
||||
bool SetParam( int nType, const std::string& sVal) override ;
|
||||
bool ResetTool( void) override ;
|
||||
bool GetParam( int nType, bool& bVal) const override ;
|
||||
bool GetParam( int nType, int& nVal) const override ;
|
||||
bool GetParam( int nType, double& dVal) const override ;
|
||||
bool GetParam( int nType, std::string& sVal) const override ;
|
||||
bool GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const override ;
|
||||
bool VerifyTool( const ToolsMgr* pToolsMgr, const std::string& sVal, const ToolData*& pTdata) const override ;
|
||||
bool VerifySolCh( int nVal) const ;
|
||||
bool VerifyFaceUse( int nVal) const ;
|
||||
bool VerifyWorkSide( int nVal) const ;
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline const MortisingData* GetMortisingData( const MachiningData* pMdata)
|
||||
{ return (dynamic_cast<const MortisingData*>( pMdata)) ; }
|
||||
inline MortisingData* GetMortisingData( MachiningData* pMdata)
|
||||
{ return (dynamic_cast<MortisingData*>( pMdata)) ; }
|
||||
+2
-2
@@ -640,7 +640,7 @@ Operation::ExtractHint( const string& sNotes)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::CalculateAxesValues( const string& sHint)
|
||||
Operation::CalculateAxesValues( const string& sHint, bool bSolChExact)
|
||||
{
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
@@ -722,7 +722,7 @@ Operation::CalculateAxesValues( const string& sHint)
|
||||
m_pMchMgr->ApplyRotAxisBlock() ;
|
||||
|
||||
// applico il criterio di scelta della soluzione quando molteplici
|
||||
m_pMchMgr->SetCalcSolCh( GetSolCh()) ;
|
||||
m_pMchMgr->SetCalcSolCh( GetSolCh(), bSolChExact) ;
|
||||
|
||||
// recupero gruppo della geometria di lavorazione (Cutter Location)
|
||||
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ class Operation : public IUserObj
|
||||
bool GetClPathFinalAxesValues( int nClPathId, DBLVECTOR& vAxVal) ;
|
||||
std::string Operation::ExtractInfo( const std::string& sNotes, const std::string& sKey) ;
|
||||
std::string ExtractHint( const std::string& sNotes) ;
|
||||
bool CalculateAxesValues( const std::string& sHint) ;
|
||||
bool CalculateAxesValues( const std::string& sHint, bool bSolChExact = false) ;
|
||||
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
|
||||
double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
|
||||
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
|
||||
|
||||
+45
-19
@@ -51,6 +51,8 @@ Simulator::Simulator( void)
|
||||
m_nAuxETot = 0 ;
|
||||
m_nAuxEInd = 0 ;
|
||||
m_nVmId = GDB_ID_NULL ;
|
||||
m_dVmTdOffs = 0 ;
|
||||
m_dVmAdOffs = 0 ;
|
||||
m_bEnabAxes = true ;
|
||||
m_AxesName.reserve( 8) ;
|
||||
m_AxesToken.reserve( 8) ;
|
||||
@@ -401,6 +403,23 @@ Simulator::UpdateTool( bool bFirst)
|
||||
// aggiorno gli assi macchina
|
||||
if ( ! UpdateAxes())
|
||||
return false ;
|
||||
// eventuali offset per Vmill (per adattare lo ZeroT macchina con quello di Zmap)
|
||||
int nToolType ; m_pMchMgr->TdbGetCurrToolParam( TPA_TYPE, nToolType) ;
|
||||
if ( nToolType == TT_MORTISE_STD) {
|
||||
double dThick ; m_pMchMgr->TdbGetCurrToolParam( TPA_THICK, dThick) ;
|
||||
m_dVmTdOffs = 0 ;
|
||||
m_dVmAdOffs = 0.5 * dThick ;
|
||||
}
|
||||
else if ( nToolType == TT_SAW_STD || nToolType == TT_SAW_FLAT) {
|
||||
double dLen ; m_pMchMgr->TdbGetCurrToolParam( TPA_LEN, dLen) ;
|
||||
double dThick ; m_pMchMgr->TdbGetCurrToolParam( TPA_THICK, dThick) ;
|
||||
m_dVmTdOffs = - dLen + dThick ;
|
||||
m_dVmAdOffs = 0 ;
|
||||
}
|
||||
else {
|
||||
m_dVmTdOffs = 0 ;
|
||||
m_dVmAdOffs = 0 ;
|
||||
}
|
||||
// eventuale lancio script
|
||||
if ( ! OnToolSelect( m_sTool, sHead, nExit, sTcPos, bFirst))
|
||||
return false ;
|
||||
@@ -598,9 +617,11 @@ Simulator::FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus)
|
||||
nStatus = MCH_SIM_ERR ;
|
||||
return false ;
|
||||
}
|
||||
// aggiorno visualizzazione e breve pausa (200 ms)
|
||||
ExeDraw() ;
|
||||
Sleep( 200) ;
|
||||
// se non è inizio, aggiorno visualizzazione e breve pausa (200 ms)
|
||||
if ( nPhase != 1) {
|
||||
ExeDraw() ;
|
||||
Sleep( 200) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// passo alla operazione successiva
|
||||
@@ -830,8 +851,8 @@ Simulator::ManageMove( int& nStatus)
|
||||
m_dCoeff = 1 ;
|
||||
|
||||
// Posizione e direzione attuali dell'utensile e riferimento attuale del pezzo (per Vmill)
|
||||
Point3d ptNoseI ; Vector3d vtDirI ; Frame3d frVzmI ;
|
||||
bool bOkI = GetHeadCurrPosDir( ptNoseI, vtDirI) && m_pGeomDB->GetGlobFrame( m_nVmId, frVzmI) ;
|
||||
Point3d ptNoseI ; Vector3d vtDirI ; Vector3d vtAuxI ; Frame3d frVzmI ;
|
||||
bool bOkI = GetHeadCurrPosDirAux( ptNoseI, vtDirI, vtAuxI) && m_pGeomDB->GetGlobFrame( m_nVmId, frVzmI) ;
|
||||
|
||||
// Eseguo movimento rapido o lineare
|
||||
if ( nMoveType != 2 && nMoveType != 3) {
|
||||
@@ -842,9 +863,9 @@ Simulator::ManageMove( int& nStatus)
|
||||
}
|
||||
// eseguo eventuale Vmill
|
||||
if ( m_nVmId != GDB_ID_NULL) {
|
||||
Point3d ptNoseF ; Vector3d vtDirF ; Frame3d frVzmF ;
|
||||
bool bOkF = GetHeadCurrPosDir( ptNoseF, vtDirF) && m_pGeomDB->GetGlobFrame( m_nVmId, frVzmF) ; ;
|
||||
ExecVmillOnLine( ptNoseI, vtDirI, frVzmI, ptNoseF, vtDirF, frVzmF) ;
|
||||
Point3d ptNoseF ; Vector3d vtDirF ; Vector3d vtAuxF ; Frame3d frVzmF ;
|
||||
bool bOkF = GetHeadCurrPosDirAux( ptNoseF, vtDirF, vtAuxF) && m_pGeomDB->GetGlobFrame( m_nVmId, frVzmF) ; ;
|
||||
ExecVmillOnLine( ptNoseI, vtDirI, vtAuxI, frVzmI, ptNoseF, vtDirF, vtAuxF, frVzmF) ;
|
||||
}
|
||||
}
|
||||
// Eseguo movimento su arco
|
||||
@@ -876,9 +897,9 @@ Simulator::ManageMove( int& nStatus)
|
||||
}
|
||||
// eseguo eventuale Vmill
|
||||
if ( m_nVmId != GDB_ID_NULL) {
|
||||
Point3d ptNoseF ; Vector3d vtDirF ; Frame3d frVzmF ;
|
||||
bool bOkF = GetHeadCurrPosDir( ptNoseF, vtDirF) && m_pGeomDB->GetGlobFrame( m_nVmId, frVzmF) ;
|
||||
ExecVmillOnLine( ptNoseI, vtDirI, frVzmI, ptNoseF, vtDirF, frVzmF) ;
|
||||
Point3d ptNoseF ; Vector3d vtDirF ; Vector3d vtAuxF ; Frame3d frVzmF ;
|
||||
bool bOkF = GetHeadCurrPosDirAux( ptNoseF, vtDirF, vtAuxF) && m_pGeomDB->GetGlobFrame( m_nVmId, frVzmF) ;
|
||||
ExecVmillOnLine( ptNoseI, vtDirI, vtAuxI, frVzmI, ptNoseF, vtDirF, vtAuxF, frVzmF) ;
|
||||
// aggiorno prossimo inizio
|
||||
ptNoseI = ptNoseF ;
|
||||
vtDirI = vtDirF ;
|
||||
@@ -934,7 +955,7 @@ Simulator::ManageMove( int& nStatus)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::GetHeadCurrPosDir( Point3d& ptH, Vector3d& vtH)
|
||||
Simulator::GetHeadCurrPosDirAux( Point3d& ptH, Vector3d& vtH, Vector3d& vtA)
|
||||
{
|
||||
// ci devono essere almeno i tre assi lineari
|
||||
if ( m_AxesName.size() < 3)
|
||||
@@ -950,13 +971,14 @@ Simulator::GetHeadCurrPosDir( Point3d& ptH, Vector3d& vtH)
|
||||
// determino posizione e orientamento della testa
|
||||
m_pMachine->GetNoseFromPositions( vLinAx[0], vLinAx[1], vLinAx[2], vRotAx, ptH) ;
|
||||
m_pMachine->GetToolDirFromAngles( vRotAx, vtH) ;
|
||||
m_pMachine->GetAuxDirFromAngles( vRotAx, vtA) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::ExecVmillOnLine( const Point3d& ptHi, const Vector3d& vtHi, const Frame3d& frVzmI,
|
||||
const Point3d& ptHf, const Vector3d& vtHf, const Frame3d& frVzmF)
|
||||
Simulator::ExecVmillOnLine( const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
|
||||
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF)
|
||||
{
|
||||
// Recupero Zmap
|
||||
IVolZmap* pVZM = GetVolZmap( m_pGeomDB->GetGeoObj( m_nVmId)) ;
|
||||
@@ -965,13 +987,19 @@ Simulator::ExecVmillOnLine( const Point3d& ptHi, const Vector3d& vtHi, const Fra
|
||||
// Porto gli estremi nel riferimento opportuno dello Zmap
|
||||
Point3d ptHiL = ptHi ; ptHiL.ToLoc( frVzmI) ;
|
||||
Vector3d vtHiL = vtHi ; vtHiL.ToLoc( frVzmI) ;
|
||||
Vector3d vtAiL = vtAi ; vtAiL.ToLoc( frVzmI) ;
|
||||
Point3d ptHfL = ptHf ; ptHfL.ToLoc( frVzmF) ;
|
||||
Vector3d vtHfL = vtHf ; vtHfL.ToLoc( frVzmF) ;
|
||||
Vector3d vtAfL = vtAf ; vtAfL.ToLoc( frVzmI) ;
|
||||
// Eventuali offset
|
||||
ptHiL += m_dVmTdOffs * vtHiL + m_dVmAdOffs * vtAiL ;
|
||||
ptHfL += m_dVmTdOffs * vtHfL + m_dVmAdOffs * vtAfL ;
|
||||
// Log per debug
|
||||
//string sOut = "Pi=(" + ToString( ptHiL) + ") Vi=(" + ToString( vtHiL) + ") Pf=(" + ToString( ptHfL) + ") Vf=(" + ToString( vtHfL) + ")" ;
|
||||
//string sOut = "Pi=(" + ToString( ptHiL) + ") Vi=(" + ToString( vtHiL) + ") Ai=(" + ToString( vtAiL) +
|
||||
// ") Pf=(" + ToString( ptHfL) + ") Vf=(" + ToString( vtHfL) + ") Af=(" + ToString( vtAfL) + ")" ;
|
||||
//LOG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
// Eseguo
|
||||
return pVZM->MillingStep( ptHiL, vtHiL, ptHfL, vtHfL) ;
|
||||
return pVZM->MillingStep( ptHiL, vtHiL, vtAiL, ptHfL, vtHfL, vtAfL) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1085,10 +1113,8 @@ Simulator::OnToolSelect( const string& sTool, const string& sHead, int nExit, co
|
||||
bool bOk = m_pMachine->LuaCallFunction( ON_SIMUL_TOOL_SELECT) ;
|
||||
// forzo aggiornamento posizione assi (possono essere stati mossi nello script)
|
||||
UpdateAxesPos() ;
|
||||
|
||||
// reset assi ausiliari
|
||||
// recupero i dati di ritorno per assi ausiliari
|
||||
ResetAuxAxes() ;
|
||||
// recupero i dati di ritorno
|
||||
int nNumAuxAxes = 0 ;
|
||||
if ( ! m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_AUXAXES, nNumAuxAxes) || nNumAuxAxes == 0)
|
||||
return true ;
|
||||
|
||||
+5
-3
@@ -53,9 +53,9 @@ class Simulator
|
||||
bool ManagePathStartAux( int& nStatus) ;
|
||||
bool ManagePathEndAux( int& nStatus) ;
|
||||
bool ManageMove( int& nStatus) ;
|
||||
bool GetHeadCurrPosDir( Point3d& ptH, Vector3d& vtH) ;
|
||||
bool ExecVmillOnLine( const Point3d& ptHi, const Vector3d& vtHi, const Frame3d& frVzmI,
|
||||
const Point3d& ptHf, const Vector3d& vtHf, const Frame3d& frVzmF) ;
|
||||
bool GetHeadCurrPosDirAux( Point3d& ptH, Vector3d& vtH, Vector3d& vtA) ;
|
||||
bool ExecVmillOnLine( const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
|
||||
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF) ;
|
||||
bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
|
||||
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
|
||||
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase,
|
||||
@@ -92,6 +92,8 @@ class Simulator
|
||||
int m_nAuxEInd ; // indice del movimento ausiliario di fine percorso corrente
|
||||
std::string m_sTool ; // nome dell'utensile corrente
|
||||
int m_nVmId ; // identificativo dell'oggetto Zmap per Virtual Milling
|
||||
double m_dVmTdOffs ; // offset utensile in direzione principale per VM
|
||||
double m_dVmAdOffs ; // offset utensile in direzione ausiliaria per VM
|
||||
bool m_bEnabAxes ; // flag abilitazione movimento assi attivi
|
||||
STRVECTOR m_AxesName ; // nomi degli assi macchina attivi
|
||||
STRVECTOR m_AxesToken ; // token degli assi macchina attivi
|
||||
|
||||
Reference in New Issue
Block a user