EgtMachKernel 2.1j4 :

- modifiche e migliorie a WaterJetting
- aggiunte funzioni in interfaccia per conoscere i dati delle entità CamData
- aggiunto a Camdata Index e gestito anche in Postproc.
This commit is contained in:
Dario Sassi
2019-10-16 06:38:12 +00:00
parent 378678b149
commit 5c5e445524
17 changed files with 408 additions and 48 deletions
+24 -1
View File
@@ -47,7 +47,9 @@ static int CAM_PARAM_V4 = 19 ;
static std::string CAM_NDLT = "NDlt" ;
static int CAM_PARAM_V5 = 20 ;
static std::string CAM_BDIR = "BDir" ;
static int CAM_TOTPARAM =CAM_PARAM_V5 ;
static int CAM_PARAM_V6 = 21 ;
static std::string CAM_INDEX = "Idx" ;
static int CAM_TOTPARAM =CAM_PARAM_V6 ;
//----------------------------------------------------------------------------
USEROBJ_REGISTER( "EMkCamData", CamData) ;
@@ -82,6 +84,7 @@ CamData::Clone( void) const
pCam->m_dDeltaN = m_dDeltaN ;
pCam->m_dFeed = m_dFeed ;
pCam->m_nFlag = m_nFlag ;
pCam->m_nIndex = m_nIndex ;
pCam->m_nAxesStatus = m_nAxesStatus ;
pCam->m_nAxesMask = m_nAxesMask ;
pCam->m_vMachAxes = m_vMachAxes ;
@@ -116,6 +119,7 @@ CamData::Dump( string& sOut, bool bMM, const char* szNewLine) const
sOut += CAM_NDIR + "=" + ToString( m_vtN) + szNewLine ;
sOut += CAM_FEED + "=" + ToString( m_dFeed) + szNewLine ;
sOut += CAM_FLAG + "=" + ToString( m_nFlag) + szNewLine ;
sOut += CAM_INDEX + "=" + ToString( m_nIndex) + szNewLine ;
sOut += CAM_AXSTS + "=" + ToString( m_nAxesStatus) + szNewLine ;
sOut += CAM_AXMSK + "=" + ToString( m_nAxesMask) + szNewLine ;
sOut += CAM_AXVAL + "=" + ToString( m_vMachAxes) + szNewLine ;
@@ -183,6 +187,8 @@ CamData::Save( int nBaseId, STRVECTOR& vString) const
vString[++k] = CAM_NDLT + "=" + ToString( m_dDeltaN) ;
// parametri aggiunti V5
vString[++k] = CAM_BDIR + "=" + ToString( m_vtBackAux) ;
// parametri aggiunti V6
vString[++k] = CAM_INDEX + "=" + ToString( m_nIndex) ;
}
catch( ...) {
return false ;
@@ -251,6 +257,14 @@ CamData::Load( const STRVECTOR& vString, int nBaseGdbId)
else {
m_vtBackAux = V_NULL ;
}
// parametri aggiunti V6
if ( int( vString.size()) >= CAM_PARAM_V6) {
if ( ! GetVal( vString[++k], CAM_INDEX, m_nIndex))
return false ;
}
else {
m_vtBackAux = V_NULL ;
}
return true ;
}
@@ -506,6 +520,7 @@ CamData::CamData( void)
m_dDeltaN = 0 ;
m_dFeed = 0 ;
m_nFlag = 0 ;
m_nIndex = 0 ;
m_nAxesStatus = AS_NONE ;
m_nAxesMask = 0x00 ;
m_vMachAxes.reserve( 8) ;
@@ -610,6 +625,14 @@ CamData::SetFlag( int nFlag)
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetIndex( int nIndex)
{
m_nIndex = nIndex ;
return true ;
}
//----------------------------------------------------------------------------
bool
CamData::SetAxes( int nStatus, const DBLVECTOR& vAxVal)
+4
View File
@@ -56,6 +56,7 @@ class CamData : public IUserObj
bool SetDeltaN( double dDeltaN) ;
bool SetFeed( double dFeed) ;
bool SetFlag( int nFlag) ;
bool SetIndex( int nIndex) ;
bool SetAxes( int nStatus, const DBLVECTOR& vAxVal) ;
bool ChangeAxesMask( int nMask) ;
bool ResetAxes( void)
@@ -91,6 +92,8 @@ class CamData : public IUserObj
{ return m_dFeed ; }
int GetFlag( void) const
{ return m_nFlag ; }
int GetIndex( void) const
{ return m_nIndex ; }
int GetAxesStatus( void) const
{ return m_nAxesStatus ; }
int GetAxesMask( void) const
@@ -140,6 +143,7 @@ class CamData : public IUserObj
double m_dDeltaN ; // delta fine rispetto a inizio su normale
double m_dFeed ; // velocità di avanzamento in lavorazione
int m_nFlag ; // flag per usi vari
int m_nIndex ; // indice per usi vari
int m_nAxesStatus ; // stato dei valori degli assi
int m_nAxesMask ; // mask di emissione degli assi (bit a bit)
DBLVECTOR m_vMachAxes ; // valori degli assi macchina
BIN
View File
Binary file not shown.
+1
View File
@@ -246,6 +246,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="Machining.cpp" />
<ClCompile Include="MachiningsMgr.cpp" />
<ClCompile Include="MachMgrBasic.cpp" />
<ClCompile Include="MachMgrClEntities.cpp" />
<ClCompile Include="MachMgrDBMachinings.cpp" />
<ClCompile Include="MachMgrFixtures.cpp" />
<ClCompile Include="MachMgrGeneration.cpp" />
+3
View File
@@ -228,6 +228,9 @@
<ClCompile Include="WaterJetting.cpp">
<Filter>Source Files\Operations</Filter>
</ClCompile>
<ClCompile Include="MachMgrClEntities.cpp">
<Filter>Source Files\MachMgr</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="DllMain.h">
+4
View File
@@ -271,6 +271,10 @@ class MachMgr : public IMachMgr
bool IsMachiningEmpty( void) const override ;
bool GetMachiningStartPoint( Point3d& ptStart) const override ;
bool GetMachiningEndPoint( Point3d& ptEnd) const override ;
// CL Entities Interrogations
bool GetClEntMove( int nEntId, int& nMove) const override ;
bool GetClEntFlag( int nEntId, int& nFlag) const override ;
bool GetClEntIndex( int nEntId, int& nIndex) const override ;
// Simulation
bool SimInit( void) override ;
bool SimStart( bool bFirst) override ;
+74
View File
@@ -0,0 +1,74 @@
//----------------------------------------------------------------------------
// EgalTech 2019-2019
//----------------------------------------------------------------------------
// File : MachMgrClEntities.cpp Data : 15.10.19 Versione : 2.1j4
// Contenuto : Implementazione interrogazione entità CL della classe MachMgr.
//
//
//
// Modifiche : 15.10.19 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "DllMain.h"
#include "MachMgr.h"
#include "MachConst.h"
using namespace std ;
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntMove( int nEntId, int& nMove) const
{
// default
nMove = 0 ;
// verifico validita GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero l'oggetto CamData
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero il tipo di movimento
nMove = pCamData->GetMoveType() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntFlag( int nEntId, int& nFlag) const
{
// default
nFlag = 0 ;
// verifico validita GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero l'oggetto CamData
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero il flag
nFlag = pCamData->GetFlag() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntIndex( int nEntId, int& nIndex) const
{
// default
nIndex = 0 ;
// verifico validita GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero l'oggetto CamData
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero l'indice
nIndex = pCamData->GetIndex() ;
return true ;
}
+1 -1
View File
@@ -128,7 +128,7 @@ Operation::Init( MachMgr* pMchMgr)
Operation::Operation( void)
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_pMchMgr( nullptr), m_nPhase( 1),
m_nPathId( GDB_ID_NULL), m_bCurr( false), m_ptCurr(),
m_vtTool(), m_vtCorr(), m_vtAux(), m_dFeed( 0), m_nFlag( 0)
m_vtTool(), m_vtCorr(), m_vtAux(), m_dFeed( 0), m_nFlag( 0), m_nIndex( 0)
{
}
+2
View File
@@ -127,6 +127,7 @@ class Operation : public IUserObj
bool SetCorrAuxDir( const Vector3d& vtDir) ;
bool SetFeed( double dFeed) ;
bool SetFlag( int nFlag) ;
bool SetIndex( int nIndex) ;
bool GetCurrPos( Point3d& ptCurr) const
{ if ( ! m_bCurr) return false ; ptCurr = m_ptCurr ; return true ; }
bool SameAsCurrPos( const Point3d& ptP) const
@@ -156,6 +157,7 @@ class Operation : public IUserObj
Vector3d m_vtAux ; // direzione ausiliaria corrente
double m_dFeed ; // feed corrente
int m_nFlag ; // flag corrente
int m_nIndex ; // indice corrente
} ;
//----------------------------------------------------------------------------
+13
View File
@@ -82,6 +82,14 @@ Operation::SetFlag( int nFlag)
return true ;
}
//----------------------------------------------------------------------------
bool
Operation::SetIndex( int nIndex)
{
m_nIndex = nIndex ;
return true ;
}
//----------------------------------------------------------------------------
int
Operation::AddRapidStart( const Point3d& ptP)
@@ -113,6 +121,7 @@ Operation::AddRapidStart( const Point3d& ptP)
pCam->SetEndPoint( ptP) ;
pCam->SetFeed( 0) ;
pCam->SetFlag( m_nFlag) ;
pCam->SetIndex( m_nIndex) ;
// associo questo oggetto a quello geometrico
m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
// salvo la posizione corrente
@@ -163,6 +172,7 @@ Operation::AddRapidMove( const Point3d& ptP)
pCam->SetEndPoint( ptP) ;
pCam->SetFeed( 0) ;
pCam->SetFlag( m_nFlag) ;
pCam->SetIndex( m_nIndex) ;
// associo questo oggetto a quello geometrico
m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
// salvo la posizione corrente
@@ -219,6 +229,7 @@ Operation::AddLinearMove( const Point3d& ptP)
pCam->SetEndPoint( ptP) ;
pCam->SetFeed( m_dFeed) ;
pCam->SetFlag( m_nFlag) ;
pCam->SetIndex( m_nIndex) ;
// associo questo oggetto a quello geometrico
m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
// salvo la posizione corrente
@@ -291,6 +302,7 @@ Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen,
pCam->SetNormDir( vtMyN) ;
pCam->SetFeed( m_dFeed) ;
pCam->SetFlag( m_nFlag) ;
pCam->SetIndex( m_nIndex) ;
// associo questo oggetto a quello geometrico
m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
// salvo la posizione corrente
@@ -400,5 +412,6 @@ Operation::ResetMoveData( void)
m_vtAux = V_NULL ;
m_dFeed = 0 ;
m_nFlag = 0 ;
m_nIndex = 0 ;
return true ;
}
+1
View File
@@ -134,6 +134,7 @@ static const std::string GVAR_R3N = ".R3n" ; // (string) nome del t
static const std::string GVAR_R4N = ".R4n" ; // (string) nome del quarto asse rotante
static const std::string GVAR_MASK = ".MASK" ; // (int) mask associato ai movimenti in rapido
static const std::string GVAR_FLAG = ".FLAG" ; // (int) flag associato ad ogni movimento
static const std::string GVAR_INDEX = ".IDX" ; // (int) indice associato ad ogni movimento
static const std::string GVAR_TDIR = ".TDIR" ; // (Vector3d)versore utensile
static const std::string GVAR_ENABAXES = ".EnabAxes" ; // (bool) flag abilitazione assi attivi per simulazione
static const std::string GVAR_AUXAXES = ".AuxAxes" ; // (int) numero assi ausiliari per simulazione
+12 -6
View File
@@ -440,11 +440,11 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
int nMove = pCamData->GetMoveType() ;
switch ( nMove) {
case 0 : // rapido
if ( ! OnRapid( nMove, AxesEnd, pCamData->GetAxesMask(), pCamData->GetFlag()))
if ( ! OnRapid( nMove, AxesEnd, pCamData->GetAxesMask(), pCamData->GetFlag(), pCamData->GetIndex()))
return false ;
break ;
case 1 : // linea
if ( ! OnLinear( nMove, AxesEnd, pCamData->GetFeed(), pCamData->GetFlag()))
if ( ! OnLinear( nMove, AxesEnd, pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetIndex()))
return false ;
break ;
case 2 : // arco CW
@@ -452,7 +452,7 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
Point3d ptMid( AxesEnd[0], AxesEnd[1], AxesEnd[2]) ;
ptMid.Rotate( pCamData->GetAxesCen(), pCamData->GetAxesNormDir(), - pCamData->GetAxesAngCen() / 2) ;
if ( ! OnArc( nMove, AxesEnd, pCamData->GetAxesCen(), ptMid, pCamData->GetAxesRad(), pCamData->GetAxesAngCen(),
pCamData->GetFeed(), pCamData->GetFlag()))
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetIndex()))
return false ;
break ;
}
@@ -928,7 +928,7 @@ Processor::OnPathEndAux( int nInd, const string& sAE)
//----------------------------------------------------------------------------
bool
Processor::OnRapid( int nMove, const DBLVECTOR& AxesEnd, int nAxesMask, int nFlag)
Processor::OnRapid( int nMove, const DBLVECTOR& AxesEnd, int nAxesMask, int nFlag, int nIndex)
{
// cancello variabili estranee
ResetArcData() ;
@@ -946,6 +946,8 @@ Processor::OnRapid( int nMove, const DBLVECTOR& AxesEnd, int nAxesMask, int nFla
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MASK, nAxesMask) ;
// assegno il valore del flag
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG, nFlag) ;
// assegno il valore dell'indice
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
// chiamo la funzione di movimento in rapido
bOk = bOk && CallOnRapid() ;
return bOk ;
@@ -953,7 +955,7 @@ Processor::OnRapid( int nMove, const DBLVECTOR& AxesEnd, int nAxesMask, int nFla
//----------------------------------------------------------------------------
bool
Processor::OnLinear( int nMove, const DBLVECTOR& AxesEnd, double dFeed, int nFlag)
Processor::OnLinear( int nMove, const DBLVECTOR& AxesEnd, double dFeed, int nFlag, int nIndex)
{
// cancello variabili estranee
ResetArcData() ;
@@ -971,6 +973,8 @@ Processor::OnLinear( int nMove, const DBLVECTOR& AxesEnd, double dFeed, int nFla
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_F, dFeed) ;
// assegno il valore del flag
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG, nFlag) ;
// assegno il valore dell'indice
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
// chiamo la funzione di movimento in rapido
bOk = bOk && CallOnLinear() ;
return bOk ;
@@ -979,7 +983,7 @@ Processor::OnLinear( int nMove, const DBLVECTOR& AxesEnd, double dFeed, int nFla
//----------------------------------------------------------------------------
bool
Processor::OnArc( int nMove, const DBLVECTOR& AxesEnd, const Point3d& ptCen, const Point3d& ptMid,
double dRad, double dAngCen, double dFeed, int nFlag)
double dRad, double dAngCen, double dFeed, int nFlag, int nIndex)
{
// assegno il tipo di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
@@ -1007,6 +1011,8 @@ Processor::OnArc( int nMove, const DBLVECTOR& AxesEnd, const Point3d& ptCen, con
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_F, dFeed) ;
// assegno il valore del flag
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG, nFlag) ;
// assegno il valore dell'indice
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, nIndex) ;
// chiamo la funzione di movimento in rapido
bOk = bOk && CallOnArc() ;
return bOk ;
+3 -3
View File
@@ -57,10 +57,10 @@ class Processor
bool OnPathEnd( int nAE) ;
bool OnPathStartAux( int nInd, const std::string& sAS) ;
bool OnPathEndAux( int nInd, const std::string& sAE) ;
bool OnRapid( int nMove, const DBLVECTOR& AxesEnd, int nAxesMask, int nFlag) ;
bool OnLinear( int nMove, const DBLVECTOR& AxesEnd, double dFeed, int nFlag) ;
bool OnRapid( int nMove, const DBLVECTOR& AxesEnd, int nAxesMask, int nFlag, int nIndex) ;
bool OnLinear( int nMove, const DBLVECTOR& AxesEnd, double dFeed, int nFlag, int nIndex) ;
bool OnArc( int nMove, const DBLVECTOR& AxesEnd, const Point3d& ptCen, const Point3d& ptMid,
double dRad, double dAngCen, double dFeed, int nFlag) ;
double dRad, double dAngCen, double dFeed, int nFlag, int nIndex) ;
bool ResetArcData( void) ;
protected :
+1
View File
@@ -1481,6 +1481,7 @@ Simulator::OnMoveStart( const CamData* pCamData, int& nErr)
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEIND, m_nEntInd) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, pCamData->GetMoveType()) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG, pCamData->GetFlag()) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, pCamData->GetIndex()) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ERR, nErr) ;
// valore degli assi all'inizio e alla fine del movimento
int nNumAxes = int( m_AxesName.size()) ;
+253 -27
View File
@@ -1485,7 +1485,7 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
m_pGeomDB->SetName( nPxId, sPathName) ;
m_pGeomDB->SetMaterial( nPxId, GREEN) ;
// creo l'anteprima del percorso
if ( ! GenerateMillingPv( nPxId, pCompo))
if ( ! GeneratePreView( nPxId, pCompo, dAddedOverlap))
return false ;
}
@@ -1508,10 +1508,9 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
// Imposto dati comuni
SetPathId( nPxId) ;
//SetToolDir( vtTool) ;
// Inserisco la lavorazione
if ( ! AddStandardMilling( pCompo, vtTool, dDepth, dElev, bSplitArcs))
if ( ! AddStandardWj( pCompo, vtTool, dDepth, dElev, bSplitArcs))
return false ;
}
@@ -1586,12 +1585,18 @@ WaterJetting::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d&
//----------------------------------------------------------------------------
bool
WaterJetting::GenerateMillingPv( int nPathId, const ICurveComposite* pCompo)
WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, double dAddedOverlap)
{
// creo copia della curva composita
PtrOwner< ICurve> pCrv( pCompo->Clone()) ;
if ( IsNull( pCrv))
return false ;
// rimuovo eventuale overlap
if ( dAddedOverlap > EPS_SMALL) {
pCrv->Invert() ;
pCrv->TrimStartAtLen( dAddedOverlap) ;
pCrv->Invert() ;
}
// calcolo la regione
PtrOwner<ISurfFlatRegion> pSfr ;
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
@@ -1599,6 +1604,15 @@ WaterJetting::GenerateMillingPv( int nPathId, const ICurveComposite* pCompo)
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), Rad, false, false)) ;
if ( IsNull( pSfr))
return false ;
// aggiungo eventuale attacco
if ( ! AddLeadInPreview( pCompo, pSfr))
return false ;
// aggiungo eventuale uscita
if ( ! AddLeadOutPreview( pCompo, pSfr))
return false ;
// aggiungo eventuali anelli su angoli esterni
if ( ! AddLoopsPreview( pCompo, pSfr))
return false ;
// ne recupero il contorno
PtrOwner< ICurve> pCrv2 ;
pCrv2.Set( pSfr->GetLoop( 0, 0)) ;
@@ -1643,8 +1657,180 @@ WaterJetting::GenerateMillingPv( int nPathId, const ICurveComposite* pCompo)
//----------------------------------------------------------------------------
bool
WaterJetting::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, bool bSplitArcs)
WaterJetting::AddLeadInPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV)
{
// Assegno il tipo
int nType = GetLeadInType() ;
if ( nType == WJET_LI_NONE)
return true ;
// Recupero punto e direzione iniziali del percorso
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
Vector3d vtStart ; pCompo->GetStartDir( vtStart) ;
// Recupero versore estrusione
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
// Calcolo punto iniziale dell'attacco
Point3d ptP1 ;
if ( ! CalcLeadInStart( ptStart, vtStart, vtN, 0, false, pCompo, ptP1))
return false ;
// calcolo la curva di attacco
PtrOwner<ICurve> pCrv ;
switch ( nType) {
case WJET_LI_LINEAR :
{ PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
if ( IsNull( pLine) || ! pLine->Set( ptP1, ptStart))
return false ;
pCrv.Set( Release( pLine)) ;
} break ;
case WJET_LI_TANGENT :
pCrv.Set( GetArc2PVN( ptStart, ptP1, - vtStart, vtN)) ;
if ( IsNull( pCrv))
return false ;
pCrv->Invert() ;
break ;
default :
return false ;
}
// calcolo la regione
PtrOwner<ISurfFlatRegion> pSfr ;
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
double Rad = 0.499 * m_TParams.m_dDiam * dSideCoeff ; // non 0.5 per evitare problemi di coincidenza
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), Rad, false, false)) ;
// Unisco le due regioni
return ( ! IsNull( pSfr) && pSPV->Add( *pSfr)) ;
}
//----------------------------------------------------------------------------
bool
WaterJetting::AddLeadOutPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV)
{
// Assegno il tipo
int nType = GetLeadOutType() ;
// Recupero i parametri
double dTang = m_Params.m_dLoTang ;
double dPerp = m_Params.m_dLoPerp ;
// se uscita come ingresso
if ( nType == WJET_LO_AS_LI) {
int nLiType = GetLeadInType() ;
switch ( nLiType) {
case WJET_LI_LINEAR : nType = WJET_LO_LINEAR ; break ;
case WJET_LI_TANGENT : nType = WJET_LO_TANGENT ; break ;
default : nType = WJET_LO_NONE ; break ;
}
dTang = m_Params.m_dLiTang ;
dPerp = m_Params.m_dLiPerp ;
}
if ( nType == WJET_LO_NONE)
return true ;
// Senso di rotazione da dir tg a dir esterna
bool bCcwRot = ( m_Params.m_nWorkSide == WJET_WS_LEFT) ;
// Recupero punto e direzione iniziali del percorso
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
Vector3d vtEnd ; pCompo->GetEndDir( vtEnd) ;
// Recupero versore estrusione
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
// Calcolo la curva di uscita
PtrOwner<ICurve> pCrv ;
switch ( nType) {
case WJET_LO_LINEAR :
{ PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
Vector3d vtPerp = vtEnd ;
vtPerp.Rotate( vtN, 0, ( bCcwRot ? 1 : - 1)) ;
Point3d ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp ;
if ( IsNull( pLine) || ! pLine->Set( ptEnd, ptP1))
return nullptr ;
pCrv.Set( Release( pLine)) ;
} break ;
case WJET_LO_TANGENT :
{ // calcolo punto finale dell'uscita
Vector3d vtPerp = vtEnd ;
vtPerp.Rotate( vtN, 0, ( bCcwRot ? 1 : - 1)) ;
Point3d ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp ;
// inserisco uscita
pCrv.Set( GetArc2PVN( ptEnd, ptP1, vtEnd, vtN)) ;
if ( IsNull( pCrv))
return false ;
} break ;
default :
return false ;
}
// calcolo la regione
PtrOwner<ISurfFlatRegion> pSfr ;
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
double Rad = 0.499 * m_TParams.m_dDiam * dSideCoeff ; // non 0.5 per evitare problemi di coincidenza
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), Rad, false, false)) ;
// Unisco le due regioni
return ( ! IsNull( pSfr) && pSPV->Add( *pSfr)) ;
}
//----------------------------------------------------------------------------
bool
WaterJetting::AddLoopsPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV)
{
// ciclo sulle curve elementari
int nMaxInd = pCompo->GetCurveCount() - 1 ;
for ( int i = 1 ; i <= nMaxInd ; ++ i) {
// curva corrente
const ICurve* pCrvC = pCompo->GetCurve( i) ;
// Recupero versore estrusione
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
// direzione finale precedente
const ICurve* pCrvP = pCompo->GetCurve( i - 1) ;
Vector3d vtEnd ; pCrvP->GetEndDir( vtEnd) ;
// direzione iniziale corrente
Vector3d vtStart ; pCrvC->GetStartDir( vtStart) ;
// angolo tra le direzioni
double dAng ; vtEnd.GetAngleXY( vtStart, dAng) ;
// se deviazione esterna superiore a 30deg, si aggiunge l'anello
const double ANG_CORNER = 30 ;
if ( ( dAng > ANG_CORNER && m_Params.m_nWorkSide == WJET_WS_RIGHT) ||
( dAng < -ANG_CORNER && m_Params.m_nWorkSide == WJET_WS_LEFT)) {
// curva dell'anello
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( IsNull( pCompo))
return false ;
// lunghezza tratti lineari e loro punti estremi
double dTgLen = 0.5 * m_TParams.m_dDiam * tan( 0.5 * dAng * DEGTORAD) ;
Point3d ptP ; pCrvC->GetStartPoint( ptP) ;
Point3d ptPe = ptP + vtEnd * dTgLen ;
Point3d ptPs = ptP - vtStart * dTgLen ;
// tratto prima dell'anello
if ( ! pCompo->AddPoint( ptP) || ! pCompo->AddLine( ptPe))
return false ;
// anello
if ( ! pCompo->AddArcTg( ptPs))
return false ;
// tratto dopo l'anello
if ( ! pCompo->AddLine( ptP))
return false ;
// lo porto in antiorario
double dArea ;
if ( ! pCompo->GetAreaXY( dArea))
return false ;
if ( dArea < 0)
pCompo->Invert() ;
// ne eseguo l'offset
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
double Rad = 0.499 * m_TParams.m_dDiam * dSideCoeff ; // non 0.5 per evitare problemi di coincidenza
if ( ! pCompo->SimpleOffset( Rad, ICurve::OFF_FILLET))
return false ;
// calcolo la regione
PtrOwner<ISurfFlatRegion> pSfr ;
SurfFlatRegionByContours SfrCntr ;
SfrCntr.AddCurve( Release( pCompo)) ;
pSfr.Set( SfrCntr.GetSurf()) ;
// Unisco le due regioni
if ( IsNull( pSfr) || ! pSPV->Add( *pSfr))
return false ;
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, bool bSplitArcs)
{
// recupero distanze di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
@@ -1653,7 +1839,6 @@ WaterJetting::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d&
double dAppr = m_Params.m_dStartPos ;
// ciclo sulle curve elementari
bool bClosed = pCompo->IsClosed() ;
int nMaxInd = pCompo->GetCurveCount() - 1 ;
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
// curva corrente
@@ -1666,6 +1851,8 @@ WaterJetting::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d&
pCurve->Translate( - vtTool * dDepth) ;
// se prima entità, approccio e affondo
if ( i == 0) {
// imposto indice dei punti precedenti la partenza
SetIndex( -1) ;
// dati inizio entità
Point3d ptStart ;
pCurve->GetStartPoint( ptStart) ;
@@ -1698,13 +1885,56 @@ WaterJetting::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d&
}
// aggiungo attacco
SetFeed( GetStartFeed()) ;
SetIndex( 0) ;
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtTool, false, pCompo, bSplitArcs)) {
m_pMchMgr->SetLastError( 3208, "Error in WaterJetting : LeadIn not computable") ;
return false ;
}
}
// imposto versore correzione e ausiliario sul punto di arrivo
// altrimenti verifico se forma un angolo esterno con l'entità precedente
else {
// Recupero versore estrusione
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
// direzione finale precedente
const ICurve* pCrvP = pCompo->GetCurve( i - 1) ;
Vector3d vtEnd ; pCrvP->GetEndDir( vtEnd) ;
// direzione iniziale corrente
Vector3d vtStart ; pCrvC->GetStartDir( vtStart) ;
// angolo tra le direzioni
double dAng ; vtEnd.GetAngleXY( vtStart, dAng) ;
// se deviazione esterna superiore a 30deg, aggiungo anello
const double ANG_CORNER = 30 ;
if ( ( dAng > ANG_CORNER && m_Params.m_nWorkSide == WJET_WS_RIGHT) ||
( dAng < -ANG_CORNER && m_Params.m_nWorkSide == WJET_WS_LEFT)) {
// lunghezza tratti lineari e loro punti estremi
double dTgLen = 0.5 * m_TParams.m_dDiam * tan( 0.5 * dAng * DEGTORAD) ;
Point3d ptP ; pCrvC->GetStartPoint( ptP) ;
Point3d ptPe = ptP + vtEnd * dTgLen ;
Point3d ptPs = ptP - vtStart * dTgLen ;
// tratto prima dell'anello
SetFeed( GetFeed()) ;
if ( AddLinearMove( ptPe) == GDB_ID_NULL)
return false ;
// anello
PtrOwner<ICurve> pCrvA( GetArc2PVN( ptPe, ptPs, vtEnd, vtN)) ;
if ( ! IsNull( pCrvA) && pCrvA->GetType() == CRV_ARC) {
ICurveArc* pArc = GetCurveArc( pCrvA) ;
if ( ! AddArcMove( ptPs, pArc->GetCenter(), pArc->GetAngCenter(), vtN))
return false ;
}
else {
if ( AddLinearMove( ptPs) == GDB_ID_NULL)
return false ;
}
// tratto dopo l'anello
if ( AddLinearMove( ptP) == GDB_ID_NULL)
return false ;
}
}
// imposto versore correzione e ausiliario del punto di arrivo
CalcAndSetToolCorrAuxDir( pCompo, i+1) ;
// imposto indice del punto di arrivo
SetIndex( i + 1) ;
// elaborazioni sulla curva corrente
if ( pCurve->GetType() == CRV_LINE) {
ICurveLine* pLine = GetCurveLine( pCurve) ;
@@ -1741,22 +1971,18 @@ WaterJetting::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d&
m_pMchMgr->SetLastError( 3209, "Error in WaterJetting : LeadOut not computable") ;
return false ;
}
// aggiungo retrazione per frese normali
if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
// correggo elevazione finale per punto fine uscita (se testa da sopra senza aggregato approccio mai Z-)
if ( vtTool.z < - EPS_SMALL)
dEndElev -= ScalarXY( (ptP1 - ptEnd), vtTool) ;
else
dEndElev -= ( ptP1 - ptEnd) * vtTool ;
// determino se la fine dell'uscita è sopra il grezzo
bool bAboveEnd = GetPointAboveRaw( ptP1) ;
// aggiungo retrazione
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bAboveEnd)) {
m_pMchMgr->SetLastError( 3210, "Error in WaterJetting : Retract not computable") ;
return false ;
}
// correggo elevazione finale per punto fine uscita (se testa da sopra senza aggregato approccio mai Z-)
if ( vtTool.z < - EPS_SMALL)
dEndElev -= ScalarXY( (ptP1 - ptEnd), vtTool) ;
else
dEndElev -= ( ptP1 - ptEnd) * vtTool ;
// determino se la fine dell'uscita è sopra il grezzo
bool bAboveEnd = GetPointAboveRaw( ptP1) ;
// aggiungo retrazione
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bAboveEnd)) {
m_pMchMgr->SetLastError( 3210, "Error in WaterJetting : Retract not computable") ;
return false ;
}
// per lame non è necessario
}
}
return true ;
@@ -1923,7 +2149,7 @@ WaterJetting::GetLeadInType( void) const
//----------------------------------------------------------------------------
bool
WaterJetting::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) const
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) const
{
// Assegno tipo e parametri
int nType = GetLeadInType() ;
@@ -1967,7 +2193,7 @@ WaterJetting::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart,
//----------------------------------------------------------------------------
bool
WaterJetting::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
const Vector3d& vtN, bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs)
const Vector3d& vtN, bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs)
{
// Assegno il tipo
int nType = GetLeadInType() ;
@@ -2017,7 +2243,7 @@ WaterJetting::GetLeadOutType( void) const
{
if ( abs( m_Params.m_dLoTang) < min( 0.1 * m_TParams.m_dDiam, 0.1) &&
abs( m_Params.m_dLoPerp) < min( 0.1 * m_TParams.m_dDiam, 0.1) &&
m_Params.m_nLeadOutType != WJET_LO_AS_LI)
m_Params.m_nLeadOutType != WJET_LO_AS_LI)
return WJET_LO_NONE ;
return m_Params.m_nLeadOutType ;
}
@@ -2025,7 +2251,7 @@ WaterJetting::GetLeadOutType( void) const
//----------------------------------------------------------------------------
bool
WaterJetting::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN, double dEndElev,
bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs, Point3d& ptP1)
bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs, Point3d& ptP1)
{
// assegno i parametri
int nType = GetLeadOutType() ;
+7 -3
View File
@@ -19,6 +19,7 @@
#include "/EgtDev/Include/EGkCurve.h"
class ICurveComposite ;
class ISurfFlatRegion ;
//----------------------------------------------------------------------------
class WaterJetting : public Machining
@@ -74,9 +75,12 @@ class WaterJetting : public Machining
bool VerifySideAngle( void) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double& dElev) const ;
bool GenerateMillingPv( int nPathId, const ICurveComposite* pCompo) ;
bool AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, bool bSplitArcs) ;
bool GeneratePreView( int nPathId, const ICurveComposite* pCompo, double dAddedOverlap) ;
bool AddLeadInPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
bool AddLeadOutPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
bool AddLoopsPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
bool AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, bool bSplitArcs) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bOutStart, bool bAboveStart) ;
bool AddDirectApproach( const Point3d& ptP) ;
+5 -7
View File
@@ -423,25 +423,23 @@ WaterJettingData::VerifySolCh( int nVal) const
bool
WaterJettingData::VerifyWorkSide( int nVal) const
{
return ( nVal == MILL_WS_CENTER || nVal == MILL_WS_LEFT || nVal == MILL_WS_RIGHT) ;
return ( nVal == WJET_WS_CENTER || nVal == WJET_WS_LEFT || nVal == WJET_WS_RIGHT) ;
}
//----------------------------------------------------------------------------
bool
WaterJettingData::VerifyLeadInType( int nVal) const
{
return ( nVal == MILL_LI_NONE || nVal == MILL_LI_LINEAR ||
nVal == MILL_LI_TANGENT || nVal == MILL_LI_GLIDE ||
nVal == MILL_LI_ZIGZAG || nVal == MILL_LI_HELIX) ;
return ( nVal == WJET_LI_NONE || nVal == WJET_LI_LINEAR ||
nVal == WJET_LI_TANGENT) ;
}
//----------------------------------------------------------------------------
bool
WaterJettingData::VerifyLeadOutType( int nVal) const
{
return ( nVal == MILL_LO_NONE || nVal == MILL_LO_LINEAR ||
nVal == MILL_LO_TANGENT || nVal == MILL_LO_GLIDE ||
nVal == MILL_LO_AS_LI) ;
return ( nVal == WJET_LO_NONE || nVal == WJET_LO_LINEAR ||
nVal == WJET_LO_TANGENT || nVal == WJET_LO_AS_LI) ;
}
//----------------------------------------------------------------------------