EgtExchange :

- aggiunti oggetti all'import3dm e corretti alcuni bug.
This commit is contained in:
Daniele Bariletti
2023-09-01 17:22:03 +02:00
parent 549f3d47bd
commit c5503427cb
4 changed files with 742 additions and 250 deletions
+35 -33
View File
@@ -44,7 +44,7 @@ ExcExecutor::ExcExecutor( void)
m_ExecMgr.Insert( "IMPORTCNC", &ExcExecutor::ExecuteImportCnc) ;
m_ExecMgr.Insert( "IMPORTDXF", &ExcExecutor::ExecuteImportDxf) ;
m_ExecMgr.Insert( "IMPORTSTL", &ExcExecutor::ExecuteImportStl) ;
m_ExecMgr.Insert( "IMPORT3DM", &ExcExecutor::ExecuteImport3dm) ;
//m_ExecMgr.Insert( "IMPORT3DM", &ExcExecutor::ExecuteImport3dm) ;
}
//----------------------------------------------------------------------------
@@ -237,35 +237,37 @@ ExcExecutor::ExecuteImportStl( const string& sCmd2, const STRVECTOR& vsParams)
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExcExecutor::ExecuteImport3dm( const string& sCmd2, const STRVECTOR& vsParams)
{
// 2 o 3 parametri : nome del file, Id del gruppo[, ScaleFactor]
if ( vsParams.size() != 2 && vsParams.size() != 3)
return false ;
// eventuale conversione di token nel nome file
string sFile = vsParams[0] ;
m_pParser->DirReplace( sFile) ;
// recupero l'Id
int nId = m_pParser->GetIdParam( vsParams[1]) ;
if ( nId == CMD_ID_ERROR)
return false ;
// gestisco ScaleFactor
double dScaleFactor = 1 ;
if ( vsParams.size() >= 3)
FromString( vsParams[2], dScaleFactor) ;
// preparo l'importatore
IImport3dm* pImp3dm = CreateImport3dm() ;
if ( pImp3dm == nullptr) {
LOG_ERROR( GetEExLogger(), "Error : CreateImportStl")
return false ;
}
// eseguo l'importazione
bool bOk = pImp3dm->Import( sFile, m_pGDB, nId, dScaleFactor) ;
// cancello l'importatore
delete pImp3dm ;
return bOk ;
}
////----------------------------------------------------------------------------
//bool
//ExcExecutor::ExecuteImport3dm( const string& sCmd2, const STRVECTOR& vsParams)
//{
// // 2 o 3 parametri : nome del file, Id del gruppo[, ScaleFactor]
// if ( vsParams.size() != 2 && vsParams.size() != 3)
// return false ;
// // eventuale conversione di token nel nome file
// string sFile = vsParams[0] ;
// m_pParser->DirReplace( sFile) ;
// // recupero l'Id
// int nId = m_pParser->GetIdParam( vsParams[1]) ;
// if ( nId == CMD_ID_ERROR)
// return false ;
// // gestisco ScaleFactor
// double dScaleFactor = 1 ;
// if ( vsParams.size() >= 3)
// FromString( vsParams[2], dScaleFactor) ;
//
// // preparo l'importatore
// IImport3dm* pImp3dm = CreateImport3dm() ;
// if ( pImp3dm == nullptr) {
// LOG_ERROR( GetEExLogger(), "Error : CreateImportStl")
// return false ;
// }
// // eseguo l'importazione
// //bool bOk = pImp3dm->Import( sFile, m_pGDB, nId, dScaleFactor) ;
// // cancello l'importatore
// delete pImp3dm ;
//
// //return bOk ;
//
// //return true ;
//}
+1 -1
View File
@@ -40,7 +40,7 @@ class ExcExecutor : public IExcExecutor
bool ExecuteImportDxf( const std::string& sCmd2, const STRVECTOR& vsParams) ;
bool ExecuteImportCnc( const std::string& sCmd2, const STRVECTOR& vsParams) ;
bool ExecuteImportStl( const std::string& sCmd2, const STRVECTOR& vsParams) ;
bool ExecuteImport3dm( const std::string& sCmd2, const STRVECTOR& vsParams) ;
//bool ExecuteImport3dm( const std::string& sCmd2, const STRVECTOR& vsParams) ;
private :
IGeomDB* m_pGDB ;
+689 -211
View File
File diff suppressed because it is too large Load Diff
+17 -5
View File
@@ -14,27 +14,39 @@
#pragma once
#include "/EgtDev/Include/EExImport3dm.h"
#include "/EgtDev/Include/EGkSurf.h"
//#include "/EgtDev/opennurbs/opennurbs.h"
class ON_Point ;
class ON_4dPoint ;
class ON_3fPoint ;
class ON_Object ;
class ON_3dPoint ;
class ON_Curve ;
class ON_Surface ;
class ON_Brep ;
class ON_BrepLoop ;
class ICurve ;
class ICurveArc ;
class ICurveLine ;
class ISurf ;
class ISurfTriMesh ;
//----------------------------------------------------------------------------
class Import3dm : public IImport3dm
{
public :
virtual bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup, double dScaleFactor = 1) ;
bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup, double dScaleFactor = 1) override ;
private :
bool ConvertPoint( const ON_Point& onPoint, Point3d& pt) ;
bool ConvertPoint( const ON_3dPoint* on3dPoint, Point3d& pt) ;
bool ConvertCurve( const ON_Curve* onCurve, ICurve* pCurve, PolyLine* pPL = nullptr) ;
bool ConvertSurface( const ON_Surface* onSurface, ISurf* pSurf) ;
Point3d ConvertPoint( const ON_Point& onPoint) ;
Point3d ConvertPoint( const ON_3dPoint& on3dPoint) ;
Point3d ConvertPoint( const ON_4dPoint& on4dPoint) ;
Point3d ConvertPoint( const ON_3fPoint& on3fPoint) ;
ICurve* ConvertCurve( const ON_Curve* onCurve) ;
ISurf* ConvertSurface( const ON_Surface* onSurf) ;
ISURFPVECTOR ConvertBrep( const ON_Brep* onBrep, const bool bForceTriMesh) ;
ICurve* ConvertBrepLoop( const ON_BrepLoop* onBrepLoop) ;
private :
IGeomDB* m_pGDB ;