EgtMachKernel 1.6l3 :
- aggiunta prima gestione preview tagli con lama.
This commit is contained in:
+8
-1
@@ -277,7 +277,14 @@ Drilling::SetGeometry( const SELVECTOR& vIds)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::Apply( void)
|
||||
Drilling::Preview( bool bRecalc)
|
||||
{
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::Apply( bool bRecalc)
|
||||
{
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
|
||||
+2
-1
@@ -37,7 +37,8 @@ class Drilling : public Machining
|
||||
virtual bool SetParam( int nType, double dVal) ;
|
||||
virtual bool SetParam( int nType, const std::string& sVal) ;
|
||||
virtual bool SetGeometry( const SELVECTOR& vIds) ;
|
||||
virtual bool Apply( void) ;
|
||||
virtual bool Preview( bool bRecalc) ;
|
||||
virtual bool Apply( bool bRecalc) ;
|
||||
virtual bool GetParam( int nType, bool& bVal) const ;
|
||||
virtual bool GetParam( int nType, int& nVal) const ;
|
||||
virtual bool GetParam( int nType, double& dVal) const ;
|
||||
|
||||
Binary file not shown.
@@ -166,7 +166,8 @@ class MachMgr : public IMachMgr
|
||||
virtual bool SetMachiningParam( int nType, double dVal) ;
|
||||
virtual bool SetMachiningParam( int nType, const std::string& sVal) ;
|
||||
virtual bool SetMachiningGeometry( const SELVECTOR& vIds) ;
|
||||
virtual bool MachiningApply( void) ;
|
||||
virtual bool MachiningPreview( bool bRecalc) ;
|
||||
virtual bool MachiningApply( bool bRecalc) ;
|
||||
virtual bool GetMachiningParam( int nType, bool& bVal) const ;
|
||||
virtual bool GetMachiningParam( int nType, int& dVal) const ;
|
||||
virtual bool GetMachiningParam( int nType, double& dVal) const ;
|
||||
|
||||
+19
-3
@@ -434,7 +434,7 @@ MachMgr::SetMachiningGeometry( const SELVECTOR& vIds)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::MachiningApply( void)
|
||||
MachMgr::MachiningPreview( bool bRecalc)
|
||||
{
|
||||
// recupero la lavorazione corrente
|
||||
int nCurrMchId = GetCurrMachining() ;
|
||||
@@ -444,8 +444,24 @@ MachMgr::MachiningApply( void)
|
||||
Machining* pMch = dynamic_cast<Machining*>( m_pGeomDB->GetUserObj( nCurrMchId)) ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// imposto la geometria
|
||||
return pMch->Apply() ;
|
||||
// calcolo l'anteprima della lavorazione
|
||||
return pMch->Preview( bRecalc) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::MachiningApply( bool bRecalc)
|
||||
{
|
||||
// recupero la lavorazione corrente
|
||||
int nCurrMchId = GetCurrMachining() ;
|
||||
if ( nCurrMchId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// ne recupero il gestore
|
||||
Machining* pMch = dynamic_cast<Machining*>( m_pGeomDB->GetUserObj( nCurrMchId)) ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// calcolo la lavorazione
|
||||
return pMch->Apply( bRecalc) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+2
-1
@@ -39,7 +39,8 @@ class Machining : public IUserObj
|
||||
virtual bool SetParam( int nType, double dVal) = 0 ;
|
||||
virtual bool SetParam( int nType, const std::string& sVal) = 0 ;
|
||||
virtual bool SetGeometry( const SELVECTOR& vIds) = 0 ;
|
||||
virtual bool Apply( void) = 0 ;
|
||||
virtual bool Preview( bool bRecalc) = 0 ;
|
||||
virtual bool Apply( bool bRecalc) = 0 ;
|
||||
virtual bool GetParam( int nType, bool& bVal) const = 0 ;
|
||||
virtual bool GetParam( int nType, int& nVal) const = 0 ;
|
||||
virtual bool GetParam( int nType, double& dVal) const = 0 ;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
static std::string KEY_IDS = "IDS" ;
|
||||
// Sottogruppi delle lavorazioni
|
||||
static std::string MCH_AUX = "AUX" ;
|
||||
static std::string MCH_PV = "PV" ;
|
||||
static std::string MCH_CL = "CL" ;
|
||||
static std::string MCH_PATH = "P" ;
|
||||
// Nomi di entità speciali
|
||||
|
||||
+8
-1
@@ -191,7 +191,14 @@ Milling::SetGeometry( const SELVECTOR& vIds)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Milling::Apply( void)
|
||||
Milling::Preview( bool bRecalc)
|
||||
{
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Milling::Apply( bool bRecalc)
|
||||
{
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,8 @@ class Milling : public Machining
|
||||
virtual bool SetParam( int nType, double dVal) ;
|
||||
virtual bool SetParam( int nType, const std::string& sVal) ;
|
||||
virtual bool SetGeometry( const SELVECTOR& vIds) ;
|
||||
virtual bool Apply( void) ;
|
||||
virtual bool Preview( bool bRecalc) ;
|
||||
virtual bool Apply( bool bRecalc) ;
|
||||
virtual bool GetParam( int nType, bool& bVal) const ;
|
||||
virtual bool GetParam( int nType, int& nVal) const ;
|
||||
virtual bool GetParam( int nType, double& dVal) const ;
|
||||
|
||||
+141
-17
@@ -19,6 +19,7 @@
|
||||
#include "MachiningConst.h"
|
||||
#include "CamData.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EgkChainCurves.h"
|
||||
@@ -314,7 +315,7 @@ Sawing::SetGeometry( const SELVECTOR& vIds)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Sawing::Apply( void)
|
||||
Sawing::Preview( bool bRecalc)
|
||||
{
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
@@ -322,23 +323,84 @@ Sawing::Apply( void)
|
||||
|
||||
// recupero gruppo per geometria ausiliaria
|
||||
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
|
||||
bool bChain = false ;
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nAuxId == GDB_ID_NULL) {
|
||||
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nAuxId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nAuxId, MCH_AUX) ;
|
||||
bChain = true ;
|
||||
}
|
||||
// altrimenti lo svuoto
|
||||
else
|
||||
// altrimenti, se chiesto ricalcolo, lo svuoto
|
||||
else if ( bRecalc) {
|
||||
m_pGeomDB->EmptyGroup( nAuxId) ;
|
||||
bChain = true ;
|
||||
}
|
||||
|
||||
// se necessario, eseguo concatenamento ed inserisco i percorsi sotto la geometria ausiliaria
|
||||
if ( bChain && ! Chain( nAuxId))
|
||||
return false ;
|
||||
|
||||
// verifiche per angolo di sbandamento
|
||||
if ( ! VerifySideAngle())
|
||||
return false ;
|
||||
|
||||
// eseguo concatenamento, inserisco i percorsi sotto la geometria ausiliaria
|
||||
if ( ! Chain( nAuxId))
|
||||
// recupero gruppo per anteprima di lavorazione (PreView)
|
||||
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nPvId == GDB_ID_NULL) {
|
||||
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nPvId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPvId, MCH_PV) ;
|
||||
}
|
||||
// altrimenti lo svuoto
|
||||
else
|
||||
m_pGeomDB->EmptyGroup( nPvId) ;
|
||||
|
||||
// calcolo anteprima di ogni singola catena
|
||||
int nPathId = m_pGeomDB->GetFirstGroupInGroup( nAuxId) ;
|
||||
while ( nPathId != GDB_ID_NULL) {
|
||||
if ( ! ProcessPath( nPathId, nPvId, GDB_ID_NULL))
|
||||
return false ;
|
||||
nPathId = m_pGeomDB->GetNextGroup( nPathId) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Sawing::Apply( bool bRecalc)
|
||||
{
|
||||
// verifico validità gestore DB geometrico e Id del gruppo
|
||||
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
|
||||
return false ;
|
||||
|
||||
// recupero gruppo per geometria ausiliaria
|
||||
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
|
||||
bool bChain = false ;
|
||||
// se non c'è, lo aggiungo
|
||||
if ( nAuxId == GDB_ID_NULL) {
|
||||
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
|
||||
if ( nAuxId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nAuxId, MCH_AUX) ;
|
||||
bChain = true ;
|
||||
}
|
||||
// altrimenti, se chiesto ricalcolo, lo svuoto
|
||||
else if ( bRecalc) {
|
||||
m_pGeomDB->EmptyGroup( nAuxId) ;
|
||||
bChain = true ;
|
||||
}
|
||||
|
||||
// se necessario, eseguo concatenamento ed inserisco i percorsi sotto la geometria ausiliaria
|
||||
if ( bChain && ! Chain( nAuxId))
|
||||
return false ;
|
||||
|
||||
// verifiche per angolo di sbandamento
|
||||
if ( ! VerifySideAngle())
|
||||
return false ;
|
||||
|
||||
// recupero gruppo per geometria di lavorazione (Cutter Location)
|
||||
@@ -357,7 +419,7 @@ Sawing::Apply( void)
|
||||
// lavoro ogni singola catena
|
||||
int nPathId = m_pGeomDB->GetFirstGroupInGroup( nAuxId) ;
|
||||
while ( nPathId != GDB_ID_NULL) {
|
||||
if ( ! PathApply( nPathId, nClId))
|
||||
if ( ! ProcessPath( nPathId, GDB_ID_NULL, nClId))
|
||||
return false ;
|
||||
nPathId = m_pGeomDB->GetNextGroup( nPathId) ;
|
||||
}
|
||||
@@ -722,7 +784,7 @@ Sawing::Chain( int nGrpDestId)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Sawing::PathApply( int nPathId, int nClId)
|
||||
Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
{
|
||||
// recupero gruppo per geometria temporanea
|
||||
const string GRP_TEMP = "Temp" ;
|
||||
@@ -846,7 +908,7 @@ Sawing::PathApply( int nPathId, int nClId)
|
||||
const ICurve* pCrvN = pCompo->GetCurve( k) ;
|
||||
// elaborazioni sulla curva corrente
|
||||
string sName = sPathName + "_" + ToString( i) ;
|
||||
if ( ! EntityApply( pCrvP, pCrvC, pCrvN, dDepth, dExtraCut, i == 0, i == nMaxInd, sName, nClId))
|
||||
if ( ! ProcessEntity( pCrvP, pCrvC, pCrvN, dDepth, dExtraCut, i == 0, i == nMaxInd, sName, nPvId, nClId))
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -855,19 +917,13 @@ Sawing::PathApply( int nPathId, int nClId)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Sawing::EntityApply( const ICurve* pCrvP, const ICurve* pCrvC, const ICurve* pCrvN,
|
||||
double dDepth, double dExtraCut, bool bIsFirst, bool bIsLast,
|
||||
const string& sName, int nClId)
|
||||
Sawing::ProcessEntity( const ICurve* pCrvP, const ICurve* pCrvC, const ICurve* pCrvN,
|
||||
double dDepth, double dExtraCut, bool bIsFirst, bool bIsLast,
|
||||
const string& sName, int nPvId, int nClId)
|
||||
{
|
||||
// se non è una linea, la salto
|
||||
if ( pCrvC->GetType() != CRV_LINE)
|
||||
return true ;
|
||||
// creo gruppo per geometria di lavorazione della linea
|
||||
int nPxId = m_pGeomDB->AddGroup( GDB_ID_NULL, nClId, Frame3d()) ;
|
||||
if ( nPxId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPxId, sName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
|
||||
// copio la curva
|
||||
PtrOwner<ICurveLine> pLine( GetCurveLine( pCrvC->Clone())) ;
|
||||
// calcolo i versori fresa e correzione
|
||||
@@ -928,6 +984,74 @@ Sawing::EntityApply( const ICurve* pCrvP, const ICurve* pCrvC, const ICurve* pCr
|
||||
return true ;
|
||||
}
|
||||
|
||||
// Se richiesto Preview
|
||||
if ( nPvId != GDB_ID_NULL) {
|
||||
if ( ! GenerateEntityPv( Get( pLine), vtTool, vtCorr, dElev, dExtraCut, sName, nPvId))
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Se richiesta geometria di lavorazione
|
||||
if ( nClId != GDB_ID_NULL) {
|
||||
if ( ! GenerateEntityCl( Get( pLine), vtTool, vtCorr, dElev, dExtraCut, sName, nClId))
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Sawing::GenerateEntityPv( const ICurveLine* pLine, const Vector3d& vtTool, const Vector3d& vtCorr,
|
||||
double dElev, double dExtraCut, const string& sName, int nPvId)
|
||||
{
|
||||
// creo gruppo per anteprima di lavorazione della linea
|
||||
int nPxId = m_pGeomDB->AddGroup( GDB_ID_NULL, nPvId, Frame3d()) ;
|
||||
if ( nPxId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPxId, sName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
|
||||
|
||||
// rettangolo per parte di taglio completo
|
||||
Point3d ptIni = pLine->GetStart() + dElev * vtCorr ;
|
||||
Point3d ptEnd = pLine->GetEnd() + dElev * vtCorr ;
|
||||
Vector3d vtToolH( vtTool.x, vtTool.y, 0) ;
|
||||
vtToolH *= m_TParams.m_dThick / vtToolH.SqLen() ;
|
||||
Point3d ptCross = ptEnd + vtToolH ;
|
||||
Vector3d vtDZ( 0, 0, 0.1) ;
|
||||
int nId = ExeCreateRectangle3P( nPxId, ptIni + vtDZ, ptCross + vtDZ, ptEnd + vtDZ, RTY_LOC) ;
|
||||
// assegno colore
|
||||
m_pGeomDB->SetMaterial( nId, LIME) ;
|
||||
|
||||
// distanza XY tra centro e bordo taglio
|
||||
double dDeltaT = (( dElev < 0.5 * m_TParams.m_dDiam) ? sqrt( dElev * m_TParams.m_dDiam - dElev * dElev) : 0) ;
|
||||
// direzione del taglio
|
||||
Vector3d vtDir ;
|
||||
pLine->GetStartDir( vtDir) ;
|
||||
|
||||
// rettangolo per parte parziale iniziale
|
||||
int nId2 = ExeCreateRectangle3P( nPxId, ptIni - vtDir * dDeltaT, ptIni + vtToolH, ptIni, RTY_LOC) ;
|
||||
// assegno colore
|
||||
m_pGeomDB->SetMaterial( nId2, FUCHSIA) ;
|
||||
|
||||
// rettangolo per parte parziale finale
|
||||
int nId3 = ExeCreateRectangle3P( nPxId, ptEnd, ptCross + vtDir * dDeltaT, ptEnd + vtDir * dDeltaT, RTY_LOC) ;
|
||||
// assegno colore
|
||||
m_pGeomDB->SetMaterial( nId3, FUCHSIA) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Sawing::GenerateEntityCl( const ICurveLine* pLine, const Vector3d& vtTool, const Vector3d& vtCorr,
|
||||
double dElev, double dExtraCut, const string& sName, int nClId)
|
||||
{
|
||||
// creo gruppo per geometria di lavorazione della linea
|
||||
int nPxId = m_pGeomDB->AddGroup( GDB_ID_NULL, nClId, Frame3d()) ;
|
||||
if ( nPxId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nPxId, sName) ;
|
||||
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
|
||||
// Imposto dati comuni
|
||||
SetPathId( nPxId) ;
|
||||
SetToolDir( vtTool) ;
|
||||
|
||||
@@ -38,7 +38,8 @@ class Sawing : public Machining
|
||||
virtual bool SetParam( int nType, double dVal) ;
|
||||
virtual bool SetParam( int nType, const std::string& sVal) ;
|
||||
virtual bool SetGeometry( const SELVECTOR& vIds) ;
|
||||
virtual bool Apply( void) ;
|
||||
virtual bool Preview( bool bRecalc) ;
|
||||
virtual bool Apply( bool bRecalc) ;
|
||||
virtual bool GetParam( int nType, bool& bVal) const ;
|
||||
virtual bool GetParam( int nType, int& nVal) const ;
|
||||
virtual bool GetParam( int nType, double& dVal) const ;
|
||||
@@ -54,10 +55,14 @@ class Sawing : public Machining
|
||||
ICurve* GetCurve( SelData Id) ;
|
||||
bool VerifySideAngle( void) ;
|
||||
bool Chain( int nGrpDestId) ;
|
||||
bool PathApply( int nPathId, int nClId) ;
|
||||
bool EntityApply( const ICurve* pCrvP, const ICurve* pCrvC, const ICurve* pCrvN,
|
||||
double dDepth, double dExtraCut, bool bIsFirst, bool bIsLast,
|
||||
const std::string& sName, int nClId) ;
|
||||
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
|
||||
bool ProcessEntity( const ICurve* pCrvP, const ICurve* pCrvC, const ICurve* pCrvN,
|
||||
double dDepth, double dExtraCut, bool bIsFirst, bool bIsLast,
|
||||
const std::string& sName, int nPvId, int nClId) ;
|
||||
bool GenerateEntityPv( const ICurveLine* pLine, const Vector3d& vtTool, const Vector3d& vtCorr,
|
||||
double dElev, double dExtraCut, const string& sName, int nPvId) ;
|
||||
bool GenerateEntityCl( const ICurveLine* pLine, const Vector3d& vtTool, const Vector3d& vtCorr,
|
||||
double dElev, double dExtraCut, const string& sName, int nClId) ;
|
||||
bool CalculateToolAndCorrVersors( const ICurve* pCurve, Vector3d& vtTool, Vector3d& vtCorr) ;
|
||||
bool AdjustForSide( ICurve* pCurve) ;
|
||||
bool AdjustForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtThick,
|
||||
|
||||
Reference in New Issue
Block a user