From ef92d58ac1633d56f4e07b4e60a4cf0cb45d7395 Mon Sep 17 00:00:00 2001 From: SaraP Date: Fri, 20 Oct 2023 10:06:55 +0200 Subject: [PATCH] EgtExchange 2.5j3 : - in Export3MF aggiunta esportazione delle info come metadata. --- EgtExchange.rc | Bin 11678 -> 11678 bytes Export3MF.cpp | 42 +++++++++++++++++++++++++++++------------- Export3MF.h | 8 ++++---- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/EgtExchange.rc b/EgtExchange.rc index 7f8d8c1bc24ceb3aea88a353f888ff0ba2a4cbe0..4e9bb646f8e891d906393941a1eb2317044aafb2 100644 GIT binary patch delta 246 zcmbOiJuiC0I%aiGhCGIJh8%`ehGHOAV9;O)W+-7u1ma8}FBB-731Uxvt=76Zj%6Mb zqw(g4d7Cnz;G3+D2wf;mO&m2RCPFn=kc1_cHUhESkLCPN8BDnkm89}HwAf_cT0S87Rb z{=m$^%xJXvF5f|>$-6jn7>y=RoB8AZCGoTo( nId) ; + + // assegno le info dell'oggetto al modello + PMetaDataGroup metaDataGrp = m_model->GetMetaDataGroup() ; + STRVECTOR vInfo ; + pIter->GetAllInfo( vInfo) ; + for ( const string& sInfo : vInfo) { + string sKey, sVal ; + SplitFirst( sInfo, "=", sKey, sVal) ; + metaDataGrp->AddMetaData( sInfoNamespace, sKey, sVal, "xs:string", 0) ; + } + // esporto l'oggetto e i suoi eventuali figli if ( ! ExportObject( *pIter)) return false ; @@ -143,16 +157,16 @@ Export3MF::ExportObject( const IGdbIterator& iIter) Color cCol ; bool bCol = GetColor( cCol, iIter.GetGDB(), iIter.GetId()) ; // recupero le proprietà - string sSliceNbr ; - iIter.GetInfo( "SliceNbr", sSliceNbr) ; + STRVECTOR vInfo ; + iIter.GetAllInfo( vInfo) ; // emetto l'oggetto switch ( pGeoObj->GetType()) { case SRF_TRIMESH : - if ( ! ExportSTM( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr, sSliceNbr)) + if ( ! ExportSTM( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr, vInfo)) return false ; break ; case SRF_FLATRGN : - if ( ! ExportSFR( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr, sSliceNbr)) + if ( ! ExportSFR( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr, vInfo)) return false ; break ; default : @@ -191,8 +205,7 @@ Export3MF::TestFilter( int nLev, int nMode, int nStat) //---------------------------------------------------------------------------- bool -Export3MF::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, - const string& sSliceNbr) +Export3MF::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, const STRVECTOR& vInfo) { // verifico oggetto const ISurfFlatRegion* pSFR = GetSurfFlatRegion( pGeoObj) ; @@ -200,13 +213,12 @@ Export3MF::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d return false ; // ricavo la trimesh equivalente const ISurfTriMesh* pStm = pSFR->GetAuxSurf() ; - return ExportSTM( sName, pStm, frFrame, pCol, sSliceNbr) ; + return ExportSTM( sName, pStm, frFrame, pCol, vInfo) ; } //---------------------------------------------------------------------------- bool -Export3MF::ExportSTM( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, - const string& sSliceNbr) +Export3MF::ExportSTM( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, const STRVECTOR& vInfo) { // verifico oggetto const ISurfTriMesh* pSTM = GetSurfTriMesh( pGeoObj) ; @@ -258,10 +270,14 @@ Export3MF::ExportSTM( const string& sName, const IGeoObj* pGeoObj, const Frame3d Lib3MF_uint32 nColId = ColorHandler3MF( pCol) ; meshObject->SetObjectLevelProperty( 1, nColId) ; } - - // assegno il layer - if ( ! sSliceNbr.empty()) - meshObject->SetPartNumber( sSliceNbr) ; + + // assegno le info + PMetaDataGroup metaDataGrp = meshObject->GetMetaDataGroup() ; + for ( const string& sInfo : vInfo) { + string sKey, sVal ; + SplitFirst( sInfo, "=", sKey, sVal) ; + metaDataGrp->AddMetaData( sInfoNamespace, sKey, sVal, "xs:string", 0) ; + } m_model->AddBuildItem( meshObject.get(), m_wrapper->GetIdentityTransform()) ; return true ; diff --git a/Export3MF.h b/Export3MF.h index 11d4691..56cb3bf 100644 --- a/Export3MF.h +++ b/Export3MF.h @@ -33,10 +33,10 @@ class Export3MF : public IExport3MF bool ExportObject( const IGdbIterator& iIter) ; bool ScanGroup( const IGdbIterator& iIter) ; bool TestFilter( int nLev, int nMode, int nStat) ; - bool ExportSFR( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, - const std::string& sSliceNbr) ; - bool ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, - const std::string& sSliceNbr) ; + bool ExportSFR( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, + const STRVECTOR& vInfo) ; + bool ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, + const STRVECTOR& vInfo) ; Lib3MF_uint32 ColorHandler3MF( const Color* pCol) ; bool GetColor( Color& pCol, const IGeomDB * pGBD, const int& nId) ;