From 85b76f68ffbc40c29b621730d27700bd6e3cd58d Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 22 Jul 2025 08:32:42 +0200 Subject: [PATCH] EgtMachKernel : - modifiche a AddRawPart per gestire anche le superfici di Bezier. --- MachMgrRawParts.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/MachMgrRawParts.cpp b/MachMgrRawParts.cpp index 2cc14ac..811e762 100644 --- a/MachMgrRawParts.cpp +++ b/MachMgrRawParts.cpp @@ -28,6 +28,7 @@ #include "/EgtDev/Include/EGkSfrCreate.h" #include "/EgtDev/Include/EGkStmStandard.h" #include "/EgtDev/Include/EGkStmFromCurves.h" +#include "/EgtDev/Include/EGkSurfBezier.h" #include "/EgtDev/Include/EGkCAvSilhouetteSurfTm.h" #include "/EgtDev/Include/EgtPointerOwner.h" #include "/EgtDev/Include/EXeConst.h" @@ -393,8 +394,18 @@ MachMgr::AddRawPart( int nSurfId, Color cCol) bool bOk = m_pGeomDB->SetName( nRawId, MACH_RAW_PART) ; // assegno la fase al gruppo m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ; - // copio la superficie nel gruppo - int nId = m_pGeomDB->CopyGlob( nSurfId, GDB_ID_NULL, nRawId) ; + // creo il grezzo + int nId = GDB_ID_NULL ; + // partendo da superficie Trimesh copio + if ( pSurf->GetType() == SRF_TRIMESH) + nId = m_pGeomDB->CopyGlob( nSurfId, GDB_ID_NULL, nRawId) ; + // partendo da superficie Bezier devo recuperare la Trimesh ausiliaria e copiarla + else if ( pSurf->GetType() == SRF_BEZIER) { + const ISurfBezier* pSbez = GetSurfBezier( pSurf) ; + const ISurfTriMesh* pAuxStm = ( pSbez != nullptr ? pSbez->GetAuxSurf() : nullptr) ; + PtrOwner pStm( pAuxStm != nullptr ? pAuxStm->Clone() : nullptr) ; + nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pStm)) ; + } bOk = bOk && ( nId != GDB_ID_NULL) ; // assegno il nome al solido bOk = bOk && m_pGeomDB->SetName( nId, MACH_RAW_SOLID) ;