Merge commit '6f7adce5e22f8102ce4948e1e1be09cf386bbddd'

This commit is contained in:
Dario Sassi
2024-07-03 11:09:41 +02:00
2 changed files with 149 additions and 5 deletions
+136 -5
View File
@@ -41,6 +41,9 @@
#include "/EgtDev/Include/EGkDistPointSurfTm.h"
#include "/EgtDev/Include/EGkIntersPlaneSurfTm.h"
#include "/EgtDev/Include/EGkStmFromCurves.h"
#include <EgtDev/Include/EGkGeoPoint3d.h> // debug
#include <EgtDev/Include/EGkGeoVector3d.h> // debug
#include "/EgtDev/Include/EgtPerfCounter.h" // debug
// per far dimenticare macro di WinUser.h
#undef GetClassName
@@ -85,6 +88,127 @@ using namespace std ;
static string KEY_SURF_POCK = "SurfPock_" ;
static string KEY_SURF_LIMIT = "SurfLimit_" ;
/* start debug functions */
static PerformanceCounter s_Counter ;
/*
s_Counter.Start() ;
double dTime = s_Counter.Stop() ;
LOG_ERROR( GetEMkLogger(), ( "1) regione estesa :" + to_string( dTime)).c_str()) ;
*/
void
SurfRoughing::DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf, Color Col, bool bAlphaCoverage) {
if ( bWithSurf)
DrawSimpleSurf( pSfr, Col) ;
for ( int c = 0 ; c < pSfr->GetChunkCount() ; ++ c) {
for ( int l = 0 ; l < pSfr->GetLoopCount( c) ; ++ l) {
PtrOwner<ICurveComposite> pCrvCompo( GetCurveComposite( pSfr->GetLoop( c, l))) ;
for ( int u = 0 ; u < pCrvCompo->GetCurveCount() ; ++ u) {
int nProp0 ; pCrvCompo->GetCurveTempProp( u, nProp0, 0) ;
int nProp1 ; pCrvCompo->GetCurveTempProp( u, nProp1, 1) ;
int nInd = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pCrvCompo->GetCurve( u)->Clone()) ;
m_pGeomDB->SetMaterial( nInd, nProp0 == 0 ? ! bAlphaCoverage ? BLUE : AQUA : ! bAlphaCoverage ? RED : ORANGE) ;
}
}
}
return ;
}
void
SurfRoughing::DrawSimpleSurf( const ISurfFlatRegion* pSfr, Color Col)
{
int nInd = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pSfr->Clone()) ;
m_pGeomDB->SetMaterial( nInd, Col) ;
return ;
}
void
SurfRoughing::DrawVectorCurves( const ICRVCOMPOPOVECTOR& vCrv)
{
for ( int l = 0 ; l < int( vCrv.size()) ; ++ l) {
for ( int u = 0 ; u < vCrv[l]->GetCurveCount() ; ++ u) {
int nProp0 ; vCrv[l]->GetCurveTempProp( u, nProp0, 0) ;
int nProp1 ; vCrv[l]->GetCurveTempProp( u, nProp1, 1) ;
int nInd = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, vCrv[l]->GetCurve( u)->Clone()) ;
m_pGeomDB->SetMaterial( nInd, nProp0 == 0 ? BLUE : RED) ;
}
}
return ;
}
void
SurfRoughing::DrawSimpleCurve( const ICurveComposite* pCrv, bool bUniform, Color Col)
{
for ( int u = 0 ; u < pCrv->GetCurveCount() ; ++ u) {
int nProp0 ; pCrv->GetCurveTempProp( u, nProp0, 0) ;
int nInd = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pCrv->GetCurve( u)->Clone()) ;
m_pGeomDB->SetMaterial( nInd, ! bUniform ? nProp0 == 0 ? BLUE : nProp0 == 1 ? RED : WHITE : Col) ;
}
return ;
}
void
SurfRoughing::DrawCompoCurve( const ICurveComposite* pCrv, Color Col)
{
int nInd = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pCrv->Clone()) ;
m_pGeomDB->SetMaterial( nInd, Col) ;
return ;
}
void
SurfRoughing::DrawSimpleTriMesh( const ISurfTriMesh* pStm, Color Col)
{
int nInd = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pStm->Clone()) ;
m_pGeomDB->SetMaterial( nInd, Col) ;
return ;
}
void
SurfRoughing::DrawSimplePoint( const Point3d& pT, Color Col)
{
PtrOwner<IGeoPoint3d> ptGeo( CreateGeoPoint3d()) ;
ptGeo->Set( pT) ;
int nInd = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, ptGeo->Clone()) ;
m_pGeomDB->SetMaterial( nInd, Col) ;
return ;
}
void
SurfRoughing::DrawSimpleVector( const Vector3d& vT, Point3d ptPos, Color Col)
{
PtrOwner<IGeoVector3d> vtGeo( CreateGeoVector3d()) ;
vtGeo->Set( vT) ;
vtGeo->Translate( ptPos - ORIG) ;
int nInd = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, vtGeo->Clone()) ;
m_pGeomDB->SetMaterial( nInd, Col) ;
return ;
}
void
SurfRoughing::DrawFeed( const ICurveComposite* pCrv)
{
for ( int u = 0 ; u < pCrv->GetCurveCount() ; ++ u) {
double myAngle = 120 * ( pCrv->GetCurve( u)->GetTempParam( 0) / 1000.) ;
DrawCompoCurve( ConvertCurveToComposite( pCrv->GetCurve( u)->Clone()),
GetColorFromHSV( HSV( myAngle, 1., 1.))) ;
}
return ;
}
void
SurfRoughing::DrawSingleCurveFeed( const ICurve* pCrv)
{
double myAngle = 120 * ( pCrv->GetTempParam( 0) / 1000.) ;
int nInd = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pCrv->Clone()) ;
m_pGeomDB->SetMaterial( nInd, GetColorFromHSV( HSV( myAngle, 1., 1.))) ;
return ;
}
/* end debug functions */
//----------------------------------------------------------------------------
USEROBJ_REGISTER( GetOperationClass( OPER_SURFROUGHING), SurfRoughing) ;
@@ -1689,6 +1813,8 @@ SurfRoughing::AddPocket( const INTINTVECTOR& vPocket, const Vector3d& vtTool, co
if ( ! bIsSubStep)
++ nBasicStep ;
DrawLoopsSurf( pSfrPock, true, Color( 1., 1., 1., .1), bIsSubStep) ;
ICRVCOMPOPOVECTOR vpCrvs ; // percorso di svuotatura
// se si tratta di uno step base, allora lavoro l'intera superficie
if ( ! CalcPocketing( pSfrPock, m_TParams.m_dDiam / 2, 0., m_Params.m_dSideStep, m_Params.m_dSideAngle,
@@ -1703,7 +1829,7 @@ SurfRoughing::AddPocket( const INTINTVECTOR& vPocket, const Vector3d& vtTool, co
for ( int i = 0 ; i < int( vpCrvs.size()) ; ++ i)
VerifyArcs( vpCrvs[i]) ;
// salvo i loop esterni della superficie corrente come Polylinee ( per LeadIn/LeadOut)
// salvo i loop esterni della superficie corrente come Polyline ( per LeadIn/LeadOut)
ICURVEPOVECTOR vLoops ; vLoops.resize( pSfrPock->GetChunkCount()) ;
for ( int c = 0 ; c < int( vLoops.size()) ; ++ c)
vLoops[c].Set( pSfrPock->GetLoop( c, 0)) ;
@@ -1771,8 +1897,7 @@ SurfRoughing::AddPocket( const INTINTVECTOR& vPocket, const Vector3d& vtTool, co
ptP1 -= ( nBasicStep * dStep) * vtTool ;
SetFeed( GetTipFeed()) ;
SetFlag( 0) ;
if ( AddLinearMove( ptP1) == GDB_ID_NULL)
return false ;
AddLinearMove( ptP1) ;
}
}
// aggiungo attacco
@@ -1798,12 +1923,17 @@ SurfRoughing::AddPocket( const INTINTVECTOR& vPocket, const Vector3d& vtTool, co
return false ;
}
}
// ricavo la Feed e la imposto
double dPar0 = pCurve->GetTempParam( 0) ;
dPar0 /= 1000. ;
double dFeed = dPar0 * GetFeed() ;
SetFeed( dFeed) ;
// elaborazioni sulla curva corrente (sempre un segmento di retta)
if ( pCurve->GetType() == CRV_LINE) {
ICurveLine* pLine = GetCurveLine( pCurve) ;
Point3d ptP3 = pLine->GetEnd() ;
Vector3d vtMove ; pLine->GetStartDir( vtMove) ;
SetFeed( GetRightFeed( vtMove, vtTool)) ;
//SetFeed( GetRightFeed( vtMove, vtTool)) ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
}
@@ -1814,10 +1944,11 @@ SurfRoughing::AddPocket( const INTINTVECTOR& vPocket, const Vector3d& vtTool, co
Vector3d vtN = pArc->GetNormVersor() ;
Point3d ptP3 ;
pArc->GetEndPoint( ptP3) ;
SetFeed( GetFeed()) ;
//SetFeed( GetFeed()) ;
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
return false ;
}
DrawSingleCurveFeed( pCurve) ;
// se ultima entità
if ( i == nMaxInd) {
// dati fine entità
+13
View File
@@ -134,6 +134,19 @@ class SurfRoughing : public Machining
return SURFROU_LO_NONE ;
return m_Params.m_nLeadOutType ; }
/* debug functions */
void DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf, Color Col, bool bAlphaCoverage) ;
void DrawSimpleSurf( const ISurfFlatRegion* pSfr, Color Col) ;
void DrawVectorCurves( const ICRVCOMPOPOVECTOR& vCrv) ;
void DrawSimpleCurve( const ICurveComposite* pCrv, bool bUniform, Color Col) ;
void DrawCompoCurve( const ICurveComposite* pCrv, Color Col) ;
void DrawSimpleTriMesh( const ISurfTriMesh* pStm, Color Col) ;
void DrawSimplePoint( const Point3d& pT, Color Col) ;
void DrawSimpleVector( const Vector3d& vT, Point3d ptPos, Color Col) ;
void DrawFeed( const ICurveComposite* pCrv) ;
void DrawSingleCurveFeed( const ICurve* pCrv) ;
/* end debug functions */
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
SurfRoughingData m_Params ; // parametri lavorazione