EgtExchange 1.8j2 :

- correzione in lettura STL ASCII con più spazi
- correzioni e migliorie varie in lettura BTL.
This commit is contained in:
Dario Sassi
2017-10-10 07:48:03 +00:00
parent 17f288ca3a
commit 07c3fedfe5
4 changed files with 68 additions and 14 deletions
+2 -1
View File
@@ -76,7 +76,8 @@ class BtlGeom
int GetFaceRegion( int nSide) ;
ICurveComposite* GetFaceContour( int nSide) ;
bool IsPointOnFaceContour( const Point3d& ptP, bool bPtLocal, int nSide) ;
bool IsPointOnOrNearFaceContour( const Point3d& ptP, bool bPtLocal, int nSide) ;
bool IsPointNearFaceContour( const Point3d& ptP, bool bPtLocal, int nSide) ;
bool SetPointOnFaceContour( Point3d& ptP, bool bPtLocal, int nSide) ;
private : // Proc
bool AddCut( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
+52 -10
View File
@@ -235,7 +235,7 @@ BtlGeom::TrimOutline( int nProcSurfId)
-- i ;
}
}
// elimino tratti allineati
// unisco tratti allineati
for ( int i = 0 ; i < int( vPL.size()) ; ++ i)
vPL[i].RemoveAlignedPoints( EPS_SMALL) ;
// Divido le curve sulle varie facce del box del pezzo
@@ -519,9 +519,10 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPVECTOR& vCrvP)
}
// se curva aperta, la completo con il contorno della faccia
if ( ! pCrvCompo->IsClosed()) {
const double EXTRA_LEN = 5 * EPS_SMALL ;
// per sicurezza allungo gli estremi
pCrvCompo->ExtendStartByLen( 5 * EPS_SMALL) ;
pCrvCompo->ExtendEndByLen( 5 * EPS_SMALL) ;
pCrvCompo->ExtendStartByLen( EXTRA_LEN) ;
pCrvCompo->ExtendEndByLen( EXTRA_LEN) ;
// intersezione della curva col contorno
IntersCurveCurve intCC( *pCrvCompo, *pFaceCnt) ;
int nIntCount = intCC.GetIntersCount() ;
@@ -642,18 +643,59 @@ BtlGeom::IsPointOnFaceContour( const Point3d& ptP, bool bPtLocal, int nSide)
//----------------------------------------------------------------------------
bool
BtlGeom::IsPointOnOrNearFaceContour( const Point3d& ptP, bool bPtLocal, int nSide)
BtlGeom::IsPointNearFaceContour( const Point3d& ptP, bool bPtLocal, int nSide)
{
// Punto in riferimento faccia
Point3d ptPl = ptP ;
if ( ! bPtLocal)
ptPl.ToLoc( GetSideFrame( nSide)) ;
// Verifico se sta sul contorno o fuori
const double EPS_NEAR = 1.0 ;
// Verifico se sta vicino al contorno o fuori
const double EPS_IN_NEAR = 0.2 ;
const double EPS_OUT_NEAR = 1.0 ;
double dL = GetSideLength( nSide) ;
double dW = GetSideWidth( nSide) ;
return ( ( ptPl.x > - EPS_NEAR && ptPl.x < EPS_SMALL) ||
( ptPl.x > dL - EPS_SMALL && ptPl.x < dL + EPS_NEAR) ||
( ptPl.y > - EPS_NEAR && ptPl.y < EPS_SMALL) ||
( ptPl.y > dW - EPS_SMALL && ptPl.y < dW + EPS_NEAR)) ;
return ( ( ptPl.x > - EPS_OUT_NEAR && ptPl.x < EPS_IN_NEAR) ||
( ptPl.x > dL - EPS_IN_NEAR && ptPl.x < dL + EPS_OUT_NEAR) ||
( ptPl.y > - EPS_OUT_NEAR && ptPl.y < EPS_IN_NEAR) ||
( ptPl.y > dW - EPS_IN_NEAR && ptPl.y < dW + EPS_OUT_NEAR)) ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::SetPointOnFaceContour( Point3d& ptP, bool bPtLocal, int nSide)
{
// Punto in riferimento faccia
Point3d ptPl = ptP ;
if ( ! bPtLocal)
ptPl.ToLoc( GetSideFrame( nSide)) ;
// Dimensioni della faccia
double dL = GetSideLength( nSide) ;
double dW = GetSideWidth( nSide) ;
// Sistemazioni per punto esterno
if ( ptPl.x < 0)
ptPl.x = 0 ;
else if ( ptPl.x > dL)
ptPl.x = dL ;
if ( ptPl.y < 0)
ptPl.y = 0 ;
else if ( ptPl.y > dW)
ptPl.y = dW ;
// Sistemazioni per punto interno
double vDist[4] = { abs( ptPl.x), abs( ptPl.x - dL), abs( ptPl.y), abs( ptPl.y - dW)} ;
int nMinDistSide = 0 ;
for ( int i = 1 ; i < 4 ; ++i) {
if ( vDist[i] < vDist[nMinDistSide])
nMinDistSide = i ;
}
switch ( nMinDistSide) {
case 0 : ptPl.x = 0 ; break ;
case 1 : ptPl.x = dL ; break ;
case 2 : ptPl.y = 0 ; break ;
case 3 : ptPl.y = dW ; break ;
}
// Riporto punto nel suo riferimento
if ( ! bPtLocal)
ptPl.ToGlob( GetSideFrame( nSide)) ;
ptP = ptPl ;
return true ;
}
+14 -3
View File
@@ -3863,8 +3863,19 @@ BtlGeom::AddFreeContour( int nGroup, int nProc, int nSide, const string& sDes, i
// verifico se gli estremi sono sul bordo della faccia
Point3d ptStart ; pCrvCompo->GetStartPoint( ptStart) ;
Point3d ptEnd ; pCrvCompo->GetEndPoint( ptEnd) ;
bool bEndsOnCont = IsPointOnOrNearFaceContour( ptStart, true, nSide) &&
IsPointOnOrNearFaceContour( ptEnd, true, nSide) ;
bool bEndsOnCont = IsPointNearFaceContour( ptStart, true, nSide) &&
IsPointNearFaceContour( ptEnd, true, nSide) ;
bool bStartOnCont = IsPointNearFaceContour( ptStart, true, nSide) ;
if ( ! bClosed && bEndsOnCont) {
if ( ! IsPointOnFaceContour( ptStart, true, nSide)) {
SetPointOnFaceContour( ptStart, true, nSide) ;
pCrvCompo->ModifyStart( ptStart) ;
}
if ( ! IsPointOnFaceContour( ptEnd, true, nSide)) {
SetPointOnFaceContour( ptEnd, true, nSide) ;
pCrvCompo->ModifyEnd( ptEnd) ;
}
}
// verifico se interessa tutto lo spessore della trave perpendicolarmente alla faccia
BBox3d b3Crv ; pCrvCompo->GetLocalBBox( b3Crv) ;
bool bHCross = ( ! b3Crv.IsEmpty() &&
@@ -3910,7 +3921,7 @@ BtlGeom::AddFreeContour( int nGroup, int nProc, int nSide, const string& sDes, i
// identificativi di geometrie ausiliarie
SetAuxId( nId, {nTId}) ;
// aggiusto l'outline se spessore come trave
if ( UseProcessToTrimOutline( nId) && (( bEndsOnCont && bHCross) || ( bClosed && m_bFcPocket)))
if ( UseProcessToTrimOutline( nId) && ((( bEndsOnCont || bClosed) && bHCross) || ( bClosed && m_bFcPocket)))
TrimOutline( nId) ;
return true ;
BIN
View File
Binary file not shown.