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) ;