EgtMachKernel :

- aggiunte AuxView in Milling e Mortising (per indicare il lato di riferimento della eventuale faccia lavorata).
This commit is contained in:
Dario Sassi
2020-11-28 18:53:38 +00:00
parent 4fb95bd5e3
commit ea786599a4
4 changed files with 94 additions and 6 deletions
+46 -3
View File
@@ -730,6 +730,22 @@ Milling::Apply( bool bRecalc, bool bPostApply)
bChain = true ;
}
// recupero gruppo per vista ausiliaria
int nAuxViewId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUXVIEW) ;
// se non c'è, lo aggiungo
if ( nAuxViewId == GDB_ID_NULL) {
nAuxViewId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxViewId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nAuxViewId, MCH_AUXVIEW) ;
m_pGeomDB->SetMaterial( nAuxViewId, Color( 64, 0, 0)) ;
m_pGeomDB->SetStatus( nAuxViewId, GDB_ST_OFF) ;
}
// altrimenti, se necessario chain, lo svuoto
else if ( bChain) {
m_pGeomDB->EmptyGroup( nAuxViewId) ;
}
// rendo corrente l'utensile usato nella lavorazione
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
m_pMchMgr->SetLastError( 2322, "Error in Milling : Tool loading failed") ;
@@ -756,9 +772,12 @@ Milling::Apply( bool bRecalc, bool bPostApply)
m_pGeomDB->EmptyGroup( nClId) ;
// se necessario, eseguo concatenamento ed inserisco i percorsi sotto la geometria ausiliaria
if ( bChain && ! Chain( nAuxId)) {
m_pMchMgr->SetLastError( 2315, "Error in Milling : Chaining failed") ;
return false ;
if ( bChain) {
if ( ! Chain( nAuxId)) {
m_pMchMgr->SetLastError( 2315, "Error in Milling : Chaining failed") ;
return false ;
}
CalcSurfAuxView( nAuxId, nAuxViewId) ;
}
// lavoro ogni singola catena
@@ -1485,6 +1504,30 @@ Milling::AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCen) co
return true ;
}
//----------------------------------------------------------------------------
bool
Milling::CalcSurfAuxView( int nAuxId, int nAuxViewId)
{
const double FAT_RAD = 0.5 ;
if ( m_Params.m_nFaceUse != MILL_FU_NONE) {
int nPathId = m_pGeomDB->GetFirstGroupInGroup( nAuxId) ;
while ( nPathId != GDB_ID_NULL) {
int nCrvId = m_pGeomDB->GetFirstInGroup( nPathId) ;
const ICurve* pCrv = ::GetCurve( m_pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCrv == nullptr)
continue ;
ISurfFlatRegion* pSfr = GetSurfFlatRegionFromFatCurve( pCrv->Clone(), FAT_RAD, false, false) ;
if ( pSfr == nullptr)
continue ;
int nSfrId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nAuxViewId, pSfr) ;
if ( nSfrId == GDB_ID_NULL)
continue ;
nPathId = m_pGeomDB->GetNextGroup( nPathId) ;
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
Milling::ProcessPath( int nPathId, int nPvId, int nClId)
+1
View File
@@ -80,6 +80,7 @@ class Milling : public Machining
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool Chain( int nGrpDestId) ;
bool CalcSurfAuxView( int nAuxId, int nAuxViewId) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool AdjustPathDrawForSaw( int nClPathId) ;
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double& dElev) const ;
+46 -3
View File
@@ -548,6 +548,22 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
bChain = true ;
}
// recupero gruppo per vista ausiliaria
int nAuxViewId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUXVIEW) ;
// se non c'è, lo aggiungo
if ( nAuxViewId == GDB_ID_NULL) {
nAuxViewId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxViewId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nAuxViewId, MCH_AUXVIEW) ;
m_pGeomDB->SetMaterial( nAuxViewId, Color( 64, 0, 0)) ;
m_pGeomDB->SetStatus( nAuxViewId, GDB_ST_OFF) ;
}
// altrimenti, se necessario chain, lo svuoto
else if ( bChain) {
m_pGeomDB->EmptyGroup( nAuxViewId) ;
}
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo
@@ -562,9 +578,12 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
m_pGeomDB->EmptyGroup( nClId) ;
// se necessario, eseguo concatenamento ed inserisco i percorsi sotto la geometria ausiliaria
if ( bChain && ! Chain( nAuxId)) {
m_pMchMgr->SetLastError( 2506, "Error in Mortising : Chaining failed") ;
return false ;
if ( bChain) {
if ( ! Chain( nAuxId)) {
m_pMchMgr->SetLastError( 2506, "Error in Mortising : Chaining failed") ;
return false ;
}
CalcSurfAuxView( nAuxId, nAuxViewId) ;
}
// lavoro ogni singola catena
@@ -1080,6 +1099,30 @@ Mortising::Chain( int nGrpDestId)
return true ;
}
//----------------------------------------------------------------------------
bool
Mortising::CalcSurfAuxView( int nAuxId, int nAuxViewId)
{
const double FAT_RAD = 0.5 ;
if ( m_Params.m_nFaceUse != MILL_FU_NONE) {
int nPathId = m_pGeomDB->GetFirstGroupInGroup( nAuxId) ;
while ( nPathId != GDB_ID_NULL) {
int nCrvId = m_pGeomDB->GetFirstInGroup( nPathId) ;
const ICurve* pCrv = ::GetCurve( m_pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCrv == nullptr)
continue ;
ISurfFlatRegion* pSfr = GetSurfFlatRegionFromFatCurve( pCrv->Clone(), FAT_RAD, false, false) ;
if ( pSfr == nullptr)
continue ;
int nSfrId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nAuxViewId, pSfr) ;
if ( nSfrId == GDB_ID_NULL)
continue ;
nPathId = m_pGeomDB->GetNextGroup( nPathId) ;
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
+1
View File
@@ -70,6 +70,7 @@ class Mortising : public Machining
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
ICurve* GetCurve( SelData Id) ;
bool Chain( int nGrpDestId) ;
bool CalcSurfAuxView( int nAuxId, int nAuxViewId) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dThick, double& dElev) const ;
bool GenerateMortisingPv( int nPathId, const ICurveComposite* pCompo) ;