From 8c65fb33dbf12c8b8aac9e29f95929bc52c9fbd0 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 28 Jan 2019 06:54:24 +0000 Subject: [PATCH] EgtMachKernel : - corretta definizione grezzi da superfici chiuse con buchi. --- MachMgrRawParts.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/MachMgrRawParts.cpp b/MachMgrRawParts.cpp index 7257355..7a3b617 100644 --- a/MachMgrRawParts.cpp +++ b/MachMgrRawParts.cpp @@ -414,9 +414,22 @@ MachMgr::AddRawPart( int nSurfId, Color cCol) // ne calcolo la silhouette secondo Z+ POLYLINEVECTOR vPL ; bool bSilh = false ; - if ( pStm->GetSilhouette( Z_AX, vPL) && vPL.size() == 1) { + if ( pStm->GetSilhouette( Z_AX, vPL) && vPL.size() > 0) { + // cerco il contorno esterno + int nInd = - 1 ; + double dMaxArea = 0 ; + for ( int i = 0 ; i < int( vPL.size()) ; ++ i) { + double dArea ; + if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) { + if ( dArea < 0) + vPL[i].Invert() ; + dMaxArea = abs( dArea) ; + nInd = i ; + } + } + // ne deduco la curva PtrOwner pCrvSilh( CreateCurveComposite()) ; - if ( pCrvSilh->FromPolyLine( vPL[0]) && pCrvSilh->IsClosed()) { + if ( nInd >= 0 && pCrvSilh->FromPolyLine( vPL[nInd])) { pCrvSilh->SetExtrusion( Z_AX) ; Plane3d plProj ; plProj.Set( b3Srf.GetMin(), Z_AX) ;