EgtMachKernel 1.9k1 :

- nel generatore e estimatore aggiunta variabile EMT.SPLITARCS con info spezzatura archi
- in svuotature migliorata gestione lati aperti con pulizia transizioni chiuso-aperto.
This commit is contained in:
Dario Sassi
2018-11-15 18:38:27 +00:00
parent a111ddbd7f
commit 9c33e2f4fc
6 changed files with 86 additions and 10 deletions
BIN
View File
Binary file not shown.
+1
View File
@@ -216,6 +216,7 @@ class MachMgr : public IMachMgr
int GetPrevActiveOperation( int nId) const override ;
int GetOperationType( int nId) const override ;
int GetOperationPhase( int nId) const override ;
bool SetOperationName( int nId, const std::string& sName) override ;
std::string GetOperationName( int nId) const override ;
int GetOperationId( const std::string& sName) const override ;
bool IsOperationEmpty( int nId) const override ;
+20 -2
View File
@@ -204,14 +204,32 @@ MachMgr::GetOperationNewName( string& sName) const
}
//----------------------------------------------------------------------------
std::string
bool
MachMgr::SetOperationName( int nId, const string& sName)
{
// recupero l'operazione
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
if ( IsNull( pIter) || ! pIter->GoTo( nId))
return false ;
// verifico che faccia parte del gruppo delle operazioni
if ( pIter->GetParentId() != GetCurrOperId())
return false ;
// verifico che il nome non sia già usato da una operazione
if ( GetOperationId( sName) != GDB_ID_NULL)
return false ;
// assegno il nome
return pIter->SetName( sName) ;
}
//----------------------------------------------------------------------------
string
MachMgr::GetOperationName( int nId) const
{
// recupero l'operazione
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
if ( IsNull( pIter) || ! pIter->GoTo( nId))
return 0 ;
// verifico che il gruppo ricevuto sia corretto
// verifico che faccia parte del gruppo delle operazioni
if ( pIter->GetParentId() != GetCurrOperId())
return 0 ;
// recupero il nome dell'operazione riferita
+1
View File
@@ -25,6 +25,7 @@ static const std::string GVAR_ERR = ".ERR" ; // (int) codice di
static const std::string GVAR_USETO1 = ".USETO1" ; // (bool) flag per utilizzo origine tavola
static const std::string GVAR_MODAL = ".MODAL" ; // (bool) flag per emissione modale dei valori
static const std::string GVAR_INCHES = ".INCHES" ; // (bool) flag unità di misura (true=inches, false=mm)
static const std::string GVAR_SPLITARCS = ".SPLITARCS" ; // (int) flag spezzatura archi (0=mai, 1=piani generici, 2=piani diversi da XY, 3=sempre)
static const std::string GVAR_NUM = ".NUM" ; // (bool) flag numerazione
static const std::string GVAR_NUMTOK = ".Nt" ; // (string) token per numerazione
static const std::string GVAR_LINENBR = ".LINENBR" ; // (int) numero progressivo di linea
+61 -8
View File
@@ -1274,10 +1274,13 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
if ( plPlane.GetVersN() * vtExtr * dArea < 0)
pCompo->Invert() ;
// sposto l'inizio a metà del tratto più lungo
AdjustContourStart( pCompo) ;
// sistemazioni per eventuali lati aperti
if ( bSomeOpen) {
// raggio di riferimento
double dRad = 0.5 * m_TParams.m_dDiam + GetOffsR() ;
// raggio di riferimento per offset
double dRad = 0.25 * m_TParams.m_dDiam + GetOffsR() ;
// estraggo tutte le curve in un vettore
ICURVEPOVECTOR vpCrvs ;
vpCrvs.reserve( pCompo->GetCurveCount()) ;
@@ -1289,13 +1292,66 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
vpCrvs[i]->SimpleOffset( dRad) ;
}
// reinserisco le curve, chiudendo eventuali gap
bool bOpenCurr = false ;
double dDiam = m_TParams.m_dDiam + 2.0 + 2 * GetOffsR() ;
for ( int i = 0 ; i < int( vpCrvs.size()) ; ++ i) {
// stato curve
bool bOpenPrev = bOpenCurr ;
bOpenCurr = ( vpCrvs[i]->GetTempProp() != 0) ;
// 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) ;
if ( ! AreSamePointEpsilon( ptEnd, ptStart, 10 * EPS_SMALL)) {
if ( ! bOpenPrev && bOpenCurr) {
Vector3d vtTg ; pCompo->GetEndDir( vtTg) ;
Vector3d vtOrt = vtTg ; vtOrt.Rotate( vtExtr, 0, 1) ;
Point3d ptArc = ptEnd + dDiam * vtOrt ;
Point3d ptLine = ptArc - 5 * dDiam * vtTg ;
PtrOwner<ICurveComposite> pJCrv( CreateCurveComposite()) ;
if ( IsNull( pJCrv))
return false ;
pJCrv->SetExtrusion( vtExtr) ;
pJCrv->AddPoint( ptLine) ;
pJCrv->AddLine( ptArc, false) ;
pJCrv->AddArcTg( ptEnd, false) ;
IntersCurveCurve intCC( *pJCrv, *vpCrvs[i]) ;
IntCrvCrvInfo aInfo ;
if ( intCC.GetIntCrvCrvInfo( intCC.GetIntersCount() - 1, aInfo)) {
pJCrv->TrimEndAtParam( aInfo.IciA[0].dU) ;
vpCrvs[i]->TrimStartAtParam( aInfo.IciB[0].dU) ;
pCompo->AddCurve( ::Release( pJCrv), true, 10 * EPS_SMALL) ;
}
else
pCompo->AddLine( ptStart) ;
}
else if ( bOpenPrev && ! bOpenCurr) {
Vector3d vtTg ; vpCrvs[i]->GetStartDir( vtTg) ;
Vector3d vtOrt = vtTg ; vtOrt.Rotate( vtExtr, 0, 1) ;
Point3d ptArc = ptStart + dDiam * vtOrt ;
Point3d ptLine = ptArc + 5 * dDiam * vtTg ;
PtrOwner<ICurveComposite> pJCrv( CreateCurveComposite()) ;
if ( IsNull( pJCrv))
return false ;
pJCrv->SetExtrusion( vtExtr) ;
pJCrv->AddPoint( ptLine) ;
pJCrv->AddLine( ptArc) ;
pJCrv->AddArcTg( ptStart) ;
const ICurve* pLCrv = pCompo->GetLastCurve() ;
IntersCurveCurve intCC( *pJCrv, *pLCrv) ;
IntCrvCrvInfo aInfo ;
if ( intCC.GetIntCrvCrvInfo( 0, aInfo)) {
double dUs, dUe ; pCompo->GetDomain( dUs, dUe) ;
pCompo->TrimEndAtParam( dUe - 1 + aInfo.IciB[0].dU) ;
pJCrv->TrimStartAtParam( aInfo.IciA[0].dU) ;
pCompo->AddCurve( ::Release( pJCrv), true, 10 * EPS_SMALL) ;
}
else
pCompo->AddLine( ptStart) ;
}
else
pCompo->AddLine( ptStart) ;
}
}
// aggiungo la curva
pCompo->AddCurve( ::Release( vpCrvs[i]), true, 10 * EPS_SMALL) ;
@@ -1303,7 +1359,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
pCompo->Close() ;
}
// unisco le parti allineate (tranne inizio-fine se chiusa)
// unisco le parti allineate (tranne inizio-fine)
if ( ! pCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL, false))
return false ;
@@ -1461,9 +1517,6 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
m_pGeomDB->SetName( nPxId, sPathName) ;
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
// sposto l'inizio a metà del tratto più lungo
AdjustContourStart( pCompo) ;
// verifico se archi vanno approssimati con segmenti di retta
int nSplitArcs = m_pMchMgr->GetCurrMachiningsMgr()->GetSplitArcs() ;
bool bSplitArcs = ( nSplitArcs == SPLAR_ALWAYS ||
+3
View File
@@ -533,6 +533,9 @@ Processor::OnStart( void)
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_RRT, "R") ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FT, "F") ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ST, "S") ;
// variabili di sola lettura
int nSplitArcs = 0 ; m_pMchMgr->MdbGetGeneralParam( MGP_SPLITARCS, nSplitArcs) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SPLITARCS, nSplitArcs) ;
// chiamo la funzione
bOk = bOk && CallOnStart() ;
return bOk ;