EgtExchange 2.5j3 :

- in Export3MF aggiunta esportazione delle info come metadata.
This commit is contained in:
SaraP
2023-10-20 10:06:55 +02:00
parent 7786be93d0
commit ef92d58ac1
3 changed files with 33 additions and 17 deletions
BIN
View File
Binary file not shown.
+29 -13
View File
@@ -30,6 +30,9 @@
using namespace std ;
using namespace Lib3MF ;
//----------------------------------------------------------------------------
static string sInfoNamespace = "CustomInfo" ;
//----------------------------------------------------------------------------
IExport3MF*
CreateExport3MF( void)
@@ -87,6 +90,17 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
if ( IsNull( pIter))
return false ;
pIter->GoTo( 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 ;
+4 -4
View File
@@ -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) ;