EgtMachKernel 1.9j6 :

- prima versione gestione lati aperti di svuotature
- corrette Clone di lavorazioni per Copia
- migliorata gestione visualizzazione Anteprima utensile in lavorazione.
This commit is contained in:
Dario Sassi
2018-10-29 07:37:47 +00:00
parent 712ead789f
commit 10fface7d0
11 changed files with 105 additions and 8 deletions
+2
View File
@@ -79,10 +79,12 @@ Chiseling::Clone( void) const
// eseguo copia dei dati
if ( pChisel != nullptr) {
try {
pChisel->m_vId = m_vId ;
pChisel->m_pMchMgr = m_pMchMgr ;
pChisel->m_nPhase = m_nPhase ;
pChisel->m_Params = m_Params ;
pChisel->m_TParams = m_TParams ;
pChisel->m_nChisels = m_nChisels ;
}
catch( ...) {
delete pChisel ;
+2
View File
@@ -79,10 +79,12 @@ Drilling::Clone( void) const
// eseguo copia dei dati
if ( pDri != nullptr) {
try {
pDri->m_vId = m_vId ;
pDri->m_pMchMgr = m_pMchMgr ;
pDri->m_nPhase = m_nPhase ;
pDri->m_Params = m_Params ;
pDri->m_TParams = m_TParams ;
pDri->m_nDrillings = m_nDrillings ;
}
catch( ...) {
delete pDri ;
BIN
View File
Binary file not shown.
+11 -7
View File
@@ -224,14 +224,20 @@ Machining::ToolPreview( int nEntId, int nFlag) const
// verifico validità gestori DB geometrico e CAM
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
return GDB_ID_NULL ;
// recupero la testa nel gruppo per anteprima utensile
int nId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST)) ;
if ( nId == GDB_ID_NULL)
return GDB_ID_NULL ;
m_pGeomDB->SetStatus( nId, GDB_ST_OFF) ;
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
if ( nClId == GDB_ID_NULL)
return GDB_ID_NULL ;
int nParentId ;
// se entità nulla
if ( nEntId == GDB_ID_NULL || ! m_pGeomDB->ExistsObj( nEntId)) {
// recupero il gruppo di appartenenza
int nParentId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
nParentId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
// se richiesta successiva
if ( nFlag == MCH_TPM_AFTER)
nEntId = GetToolPreviewNext( m_pGeomDB, nEntId, nParentId) ;
@@ -245,7 +251,7 @@ Machining::ToolPreview( int nEntId, int nFlag) const
// altrimenti
else {
// verifico che l'entità stia in un sottogruppo di CL
int nParentId = m_pGeomDB->GetParentId( nEntId) ;
nParentId = m_pGeomDB->GetParentId( nEntId) ;
if ( m_pGeomDB->GetParentId( nParentId) == nClId) {
// se richiesta successiva
if ( nFlag == MCH_TPM_AFTER)
@@ -257,6 +263,9 @@ Machining::ToolPreview( int nEntId, int nFlag) const
else
nEntId = GDB_ID_NULL ;
}
// se esiste il gruppo genitore, visualizzo testa preview
if ( nParentId != GDB_ID_NULL)
m_pGeomDB->SetStatus( nId, GDB_ST_ON) ;
// recupero i dati di questa entità
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
@@ -265,11 +274,6 @@ Machining::ToolPreview( int nEntId, int nFlag) const
AdjustEndPointForAxesCalc( pCamData, ptEnd) ;
Vector3d vtTool = pCamData->GetToolDir() ;
Vector3d vtBAux = pCamData->GetBackAuxDir() ;
// recupero la testa nel gruppo per anteprima utensile
int nId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST)) ;
if ( nId == GDB_ID_NULL)
return GDB_ID_NULL ;
m_pGeomDB->SetStatus( nId, GDB_ST_ON) ;
// dati correnti testa/uscita
int nExitId = m_pGeomDB->GetFirstNameInGroup( nId, MCH_EXIT + ToString( GetExitNbr())) ;
Frame3d frExit ;
+2
View File
@@ -77,10 +77,12 @@ Milling::Clone( void) const
// eseguo copia dei dati
if ( pMill != nullptr) {
try {
pMill->m_vId = m_vId ;
pMill->m_pMchMgr = m_pMchMgr ;
pMill->m_nPhase = m_nPhase ;
pMill->m_Params = m_Params ;
pMill->m_TParams = m_TParams ;
pMill->m_nMills = m_nMills ;
}
catch( ...) {
delete pMill ;
+2
View File
@@ -66,10 +66,12 @@ Mortising::Clone( void) const
// eseguo copia dei dati
if ( pMort != nullptr) {
try {
pMort->m_vId = m_vId ;
pMort->m_pMchMgr = m_pMchMgr ;
pMort->m_nPhase = m_nPhase ;
pMort->m_Params = m_Params ;
pMort->m_TParams = m_TParams ;
pMort->m_nMortises = m_nMortises ;
}
catch( ...) {
delete pMort ;
+1 -1
View File
@@ -679,7 +679,7 @@ Operation::ApproxWithArcsIfUseful( ICurveComposite* pCompo)
double dLen = 0 ;
pCompo->GetLength( dLen) ;
int nCrvs = pCompo->GetCurveCount() ;
if ( nCrvs < 5 || dLen > nCrvs * LIN_FEA_STD)
if ( nCrvs < 10 || dLen > nCrvs * LIN_FEA_STD)
return true ;
// limito l'approssimazione alle curve piane
Frame3d frRef ;
+79
View File
@@ -68,6 +68,9 @@ using namespace std ;
// 2428 = "Error in Pocketing : Tool loading failed"
// 2429 = "Error in Pocketing : machining depth (xxx) bigger than MaxDepth (yyy)"
//----------------------------------------------------------------------------
static std::string KEY_OPEN = "OPEN" ;
//----------------------------------------------------------------------------
USEROBJ_REGISTER( GetOperationClass( OPER_POCKETING), Pocketing) ;
@@ -87,10 +90,12 @@ Pocketing::Clone( void) const
// eseguo copia dei dati
if ( pPock != nullptr) {
try {
pPock->m_vId = m_vId ;
pPock->m_pMchMgr = m_pMchMgr ;
pPock->m_nPhase = m_nPhase ;
pPock->m_Params = m_Params ;
pPock->m_TParams = m_TParams ;
pPock->m_nPockets = m_nPockets ;
}
catch( ...) {
delete pPock ;
@@ -993,6 +998,30 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
pCrvCompo->FromPolyLine( vPL[0]) ;
if ( ! pCrvCompo->IsValid())
return false ;
// determino eventuali lati aperti e aggiorno proprietà del contorno
int nInd = 0 ;
double dPar ;
bool bFound = vPL[0].GetFirstU( dPar, true) ;
while ( bFound) {
// recupero il flag
int nFlag = int( dPar) ;
// se non c'è nulla di adiacente, lato aperto
if ( nFlag == SVT_NULL)
pCrvCompo->SetCurveTempProp( nInd, 1) ;
// altrimenti verifico se la faccia adiacente forma diedro convesso o concavo
else {
bool bAdjac ;
Point3d ptP1, ptP2 ;
double dAng ;
if ( ! pSurf->GetFacetsContact( nFacet, nFlag, bAdjac, ptP1, ptP2, dAng))
dAng = - ANG_RIGHT ;
if ( dAng > - EPS_ANG_SMALL)
pCrvCompo->SetCurveTempProp( nInd, 1) ;
}
// passo al successivo
++ nInd ;
bFound = vPL[0].GetNextU( dPar, true) ;
}
// recupero la normale esterna della faccia
Vector3d vtN ;
if ( ! pSurf->GetFacetNormal( nFacet, vtN))
@@ -1146,6 +1175,13 @@ Pocketing::Chain( int nGrpDestId)
// se utile, approssimo con archi
if ( ! ApproxWithArcsIfUseful( pCrvCompo))
return false ;
// recupero eventuali lati aperti
INTVECTOR vOpen ;
for ( int i = 0 ; i < int( pCrvCompo->GetCurveCount()) ; ++ i) {
int nProp = 0 ;
if ( pCrvCompo->GetCurveTempProp( i, nProp) && nProp == 1)
vOpen.emplace_back( i) ;
}
// creo nuovo gruppo
int nPathId = m_pGeomDB->AddGroup( GDB_ID_NULL, nGrpDestId, Frame3d()) ;
if ( nPathId == GDB_ID_NULL)
@@ -1156,6 +1192,9 @@ Pocketing::Chain( int nGrpDestId)
int nNewId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, ::Release( pCrvCompo)) ;
if ( nNewId == GDB_ID_NULL)
return false ;
// salvo info con eventuali lati aperti
if ( ! vOpen.empty())
m_pGeomDB->SetInfo( nNewId, KEY_OPEN, vOpen) ;
}
return true ;
}
@@ -1197,6 +1236,17 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
return false ;
ICurveComposite* pCompo = GetCurveComposite( m_pGeomDB->GetGeoObj( nCopyId)) ;
// aggiorno flag per lati aperti
bool bSomeOpen = m_pGeomDB->ExistsInfo( nCrvId, KEY_OPEN) ;
if ( bSomeOpen) {
for ( int i = 0 ; i < int( pCompo->GetCurveCount()) ; ++ i)
pCompo->SetCurveTempProp( i, 0) ;
INTVECTOR vOpen ;
m_pGeomDB->GetInfo( nCrvId, KEY_OPEN, vOpen) ;
for ( int j : vOpen)
pCompo->SetCurveTempProp( j, 1) ;
}
// recupero estrusione e spessore
Vector3d vtExtr = Z_AX ;
pCompo->GetExtrusion( vtExtr) ;
@@ -1224,6 +1274,35 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
if ( plPlane.GetVersN() * vtExtr * dArea < 0)
pCompo->Invert() ;
// sistemazioni per eventuali lati aperti
if ( bSomeOpen) {
// raggio di riferimento
double dRad = 0.5 * m_TParams.m_dDiam + GetOffsR() ;
// estraggo tutte le curve in un vettore
ICURVEPOVECTOR vpCrvs ;
vpCrvs.reserve( pCompo->GetCurveCount()) ;
while ( pCompo->GetCurveCount() > 0)
vpCrvs.emplace_back( pCompo->RemoveFirstOrLastCurve( false)) ;
// offsetto del raggio le curve aperte
for ( int i = 0 ; i < int( vpCrvs.size()) ; ++ i) {
if ( vpCrvs[i]->GetTempProp() == 1)
vpCrvs[i]->SimpleOffset( dRad) ;
}
// reinserisco le curve, chiudendo eventuali gap
for ( int i = 0 ; i < int( vpCrvs.size()) ; ++ i) {
// chiudo eventuale gap
if ( i > 0) {
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
Point3d ptStart ; vpCrvs[i]->GetStartPoint( ptStart) ;
if ( ! AreSamePointEpsilon( ptEnd, ptStart, 10 * EPS_SMALL))
pCompo->AddLine( ptStart) ;
}
// aggiungo la curva
pCompo->AddCurve( ::Release( vpCrvs[i]), true, 10 * EPS_SMALL) ;
}
pCompo->Close() ;
}
// unisco le parti allineate (tranne inizio-fine se chiusa)
if ( ! pCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL, false))
return false ;
+2
View File
@@ -80,10 +80,12 @@ SawFinishing::Clone( void) const
// eseguo copia dei dati
if ( pSaw != nullptr) {
try {
pSaw->m_vId = m_vId ;
pSaw->m_pMchMgr = m_pMchMgr ;
pSaw->m_nPhase = m_nPhase ;
pSaw->m_Params = m_Params ;
pSaw->m_TParams = m_TParams ;
pSaw->m_nCuts = m_nCuts ;
}
catch( ...) {
delete pSaw ;
+2
View File
@@ -73,10 +73,12 @@ SawRoughing::Clone( void) const
// eseguo copia dei dati
if ( pSaw != nullptr) {
try {
pSaw->m_vId = m_vId ;
pSaw->m_pMchMgr = m_pMchMgr ;
pSaw->m_nPhase = m_nPhase ;
pSaw->m_Params = m_Params ;
pSaw->m_TParams = m_TParams ;
pSaw->m_nCuts = m_nCuts ;
}
catch( ...) {
delete pSaw ;
+2
View File
@@ -84,10 +84,12 @@ Sawing::Clone( void) const
// eseguo copia dei dati
if ( pSaw != nullptr) {
try {
pSaw->m_vId = m_vId ;
pSaw->m_pMchMgr = m_pMchMgr ;
pSaw->m_nPhase = m_nPhase ;
pSaw->m_Params = m_Params ;
pSaw->m_TParams = m_TParams ;
pSaw->m_nCuts = m_nCuts ;
}
catch( ...) {
delete pSaw ;