EgtConverter :
- aggiunto controllo - reso il log globale.
This commit is contained in:
+75
-70
@@ -104,27 +104,27 @@ uint32 GetSolidColor( MbSolid* pSolid) ;
|
||||
bool CreateMeshData( MbStepData& stepData, MbFormNote& note) ;
|
||||
Point3d ConvertPoint( MbCartPoint3D& mbCPoint) ;
|
||||
Point3d ConvertPoint( MbPoint3D& mbCPoint) ;
|
||||
bool point_handler( const MbPoint3D* pPoint, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog) ;
|
||||
bool point_handler( const MbPoint3D* pPoint, int nLayId, IGeomDB* pGeomDB) ;
|
||||
ICurveComposite* ConvertLoop( MbLoop* mbLoop) ;
|
||||
ICurve* ConvertCurve( const MbCurve& pCurve, Point3d& ptDegen, double dScale = 1.) ;
|
||||
ICurve* ConvertCurve3D( const MbCurve3D& pCurve, Point3d& ptDegen) ;
|
||||
ICurveComposite* ConvertContour( const MbContour& mbContour) ;
|
||||
bool curve_handler( const MbCurve3D* pCurve, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog) ;
|
||||
bool curve_handler( const MbCurve3D* pCurve, int nLayId, IGeomDB* pGeomDB) ;
|
||||
ISurfBezier* ConvertSurface( const MbSurface* mbSurface, DBLVECTOR& vU, DBLVECTOR& vV) ;
|
||||
bool surface_handler( const MbSurface* pSurface, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, uint32 color, int nFlag = 0) ;
|
||||
bool nurbs2D_handler( MbNurbs* pNurbs, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog) ;
|
||||
bool surface_handler( const MbSurface* pSurface, int nLayId, IGeomDB* pGeomDB, uint32 color, int nFlag = 0) ;
|
||||
bool nurbs2D_handler( MbNurbs* pNurbs, int nLayId, IGeomDB* pGeomDB) ;
|
||||
ICurve* ConvertNurbs( const MbNurbs* pNurbs, double dScale, bool bEraseSrc) ;
|
||||
ICurve* ConvertNurbs3D( const MbNurbs3D* pNurbs, bool bEraseSrc) ;
|
||||
bool nurbs3D_handler( const MbNurbs3D* pNurbs, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog) ;
|
||||
bool mesh_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, bool bColor = true) ;
|
||||
ISurfBezier* ConvertFace( const MbFace* mbF, Logger* pGenLog) ;
|
||||
bool solid_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, const int nFlag = 0) ;
|
||||
bool pointframe_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog) ;
|
||||
bool wireframe_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog) ;
|
||||
bool spaceinstance_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, int nFlag = 0) ;
|
||||
bool planeinstance_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog) ;
|
||||
bool assembly_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, int nFlag = 0) ;
|
||||
bool instance_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, int nFlag = 0) ;
|
||||
bool nurbs3D_handler( const MbNurbs3D* pNurbs, int nLayId, IGeomDB* pGeomDB) ;
|
||||
bool mesh_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, bool bColor = true) ;
|
||||
ISurfBezier* ConvertFace( const MbFace* mbF) ;
|
||||
bool solid_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, const int nFlag = 0) ;
|
||||
bool pointframe_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB) ;
|
||||
bool wireframe_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB) ;
|
||||
bool spaceinstance_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, int nFlag = 0) ;
|
||||
bool planeinstance_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB) ;
|
||||
bool assembly_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, int nFlag = 0) ;
|
||||
bool instance_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, int nFlag = 0) ;
|
||||
bool SimplifyCurve( ICurveComposite*& pCrv) ;
|
||||
bool LimitLoop( double u0, double u1, double v0, double v1, ICurveComposite* pCrv, ICRVCOMPOPOVECTOR& vCC, bool bOpenOrClosed) ;
|
||||
|
||||
@@ -132,6 +132,7 @@ bool LimitLoop( double u0, double u1, double v0, double v1, ICurveComposite* pCr
|
||||
static double s_dLinToler = 0.1 ;
|
||||
|
||||
int nObject = 0 ;
|
||||
PtrOwner<Logger> pGenLog ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
@@ -179,7 +180,7 @@ wmain( int argc, wchar_t* argv[])
|
||||
FromString( sFlag, nFlag) ;
|
||||
|
||||
// Creo il logger
|
||||
PtrOwner<Logger> pGenLog( new( nothrow) Logger( ( nDebugLev > 0 ? LL_DEBUG : LL_INFO), "EgtConverter")) ;
|
||||
pGenLog.Set( new( nothrow) Logger( ( nDebugLev > 0 ? LL_DEBUG : LL_INFO), "EgtConverter")) ;
|
||||
if ( IsNull( pGenLog)) {
|
||||
cout << "Error creating logger" ;
|
||||
return 4 ;
|
||||
@@ -294,21 +295,21 @@ wmain( int argc, wchar_t* argv[])
|
||||
|
||||
bool bSolOk = true ;
|
||||
if ( ( *it)->IsA() == st_Assembly)
|
||||
bSolOk = assembly_handler( *it, nLayId, pGeomDB, pGenLog, nFlag) ;
|
||||
bSolOk = assembly_handler( *it, nLayId, pGeomDB, nFlag) ;
|
||||
else if ( ( *it )->IsA() == st_Solid )
|
||||
bSolOk = solid_handler( *it, nLayId, pGeomDB, pGenLog, nFlag) ;
|
||||
bSolOk = solid_handler( *it, nLayId, pGeomDB, nFlag) ;
|
||||
else if ( ( *it)->IsA() == st_Instance)
|
||||
bSolOk = instance_handler(*it, nLayId, pGeomDB, pGenLog, nFlag) ;
|
||||
bSolOk = instance_handler(*it, nLayId, pGeomDB, nFlag) ;
|
||||
else if ( ( *it)->IsA() == st_PointFrame)
|
||||
bSolOk = pointframe_handler(*it, nLayId, pGeomDB, pGenLog) ;
|
||||
bSolOk = pointframe_handler(*it, nLayId, pGeomDB) ;
|
||||
else if ( ( *it)->IsA() == st_WireFrame)
|
||||
bSolOk = wireframe_handler(*it, nLayId, pGeomDB, pGenLog) ;
|
||||
bSolOk = wireframe_handler(*it, nLayId, pGeomDB) ;
|
||||
else if ( ( *it)->IsA() == st_SpaceInstance)
|
||||
bSolOk = spaceinstance_handler(*it, nLayId, pGeomDB, pGenLog, nFlag) ;
|
||||
bSolOk = spaceinstance_handler(*it, nLayId, pGeomDB, nFlag) ;
|
||||
else if ( ( *it)->IsA() == st_Mesh)
|
||||
bSolOk = mesh_handler(*it, nLayId, pGeomDB, pGenLog) ;
|
||||
bSolOk = mesh_handler(*it, nLayId, pGeomDB) ;
|
||||
else if ( ( *it)->IsA() == st_PlaneInstance)
|
||||
bSolOk = planeinstance_handler(*it, nLayId, pGeomDB, pGenLog) ;
|
||||
bSolOk = planeinstance_handler(*it, nLayId, pGeomDB) ;
|
||||
|
||||
if ( ! bSolOk) {
|
||||
PrepareExit( pGenLog, "Error on model") ;
|
||||
@@ -405,7 +406,7 @@ PrepareExit( Logger* pLog, const char* szOut)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
mesh_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, bool bColor)
|
||||
mesh_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, bool bColor)
|
||||
{
|
||||
MbMesh * pMesh = static_cast<MbMesh*>( pIt) ;
|
||||
if ( pMesh == nullptr) {
|
||||
@@ -693,7 +694,7 @@ LimitLoop( double u0, double u1, double v0, double v1, ICurveComposite* pCrv, IC
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ISurfBezier*
|
||||
ConvertFace( const MbFace* mbF, Logger* pGenLog) {
|
||||
ConvertFace( const MbFace* mbF) {
|
||||
bool bSameSense = mbF->IsSameSense() ;
|
||||
std::vector<SPtr<MbContour> > vMbContours ;
|
||||
SurfaceSPtr mbSurf ( mbF->GetSurfaceCurvesData( vMbContours)) ;
|
||||
@@ -1024,7 +1025,7 @@ int nAssObj = 0 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
solid_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, int nFlag)
|
||||
solid_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, int nFlag)
|
||||
{
|
||||
MbSolid* pSolid = static_cast<MbSolid*>( pIt) ;
|
||||
if ( pSolid == nullptr) {
|
||||
@@ -1043,7 +1044,7 @@ solid_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, int n
|
||||
// conversione in mesh
|
||||
MbMesh mesh ;
|
||||
pSolid->CalculateMesh( stepdata, note, mesh) ;
|
||||
if ( ! mesh_handler( & mesh, nLayId, pGeomDB, pGenLog, false))
|
||||
if ( ! mesh_handler( & mesh, nLayId, pGeomDB, false))
|
||||
return false ;
|
||||
int nId = pGeomDB->GetLastInGroup( nLayId) ; // recupero id dell'oggetto appena aggiunto
|
||||
vIds.push_back( nId) ;
|
||||
@@ -1055,7 +1056,7 @@ solid_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, int n
|
||||
int nFaces = int( FaceShell->GetFacesCount()) ;
|
||||
for ( int f = 0 ; f < nFaces ; ++ f) {
|
||||
MbFace* mbF = FaceShell->GetFace(f) ;
|
||||
PtrOwner<ISurf> pSurf( ConvertFace( mbF, pGenLog)) ;
|
||||
PtrOwner<ISurf> pSurf( ConvertFace( mbF)) ;
|
||||
if ( IsNull(pSurf) || ! pSurf->IsValid()) {
|
||||
LOG_ERROR( pGenLog, "Error converting a face of a solid") ;
|
||||
continue ;
|
||||
@@ -1104,7 +1105,7 @@ solid_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, int n
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
pointframe_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog)
|
||||
pointframe_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB)
|
||||
{
|
||||
MbPointFrame* pPointFr = static_cast<MbPointFrame*>( pIt) ;
|
||||
if ( pPointFr == nullptr) {
|
||||
@@ -1118,7 +1119,7 @@ pointframe_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog)
|
||||
pPointFr->GetCartPoint( i, pt) ;
|
||||
|
||||
MbPoint3D ptP( pt) ;
|
||||
bool bPointOk = point_handler( &ptP, nLayId, pGeomDB, pGenLog) ;
|
||||
bool bPointOk = point_handler( &ptP, nLayId, pGeomDB) ;
|
||||
if ( ! bPointOk)
|
||||
return false ;
|
||||
}
|
||||
@@ -1127,7 +1128,7 @@ pointframe_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
wireframe_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog)
|
||||
wireframe_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB)
|
||||
{
|
||||
MbWireFrame* pWireFr = static_cast<MbWireFrame*>( pIt) ;
|
||||
if ( pWireFr == nullptr) {
|
||||
@@ -1139,7 +1140,7 @@ wireframe_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog)
|
||||
pWireFr->GetCurves(curves) ;
|
||||
|
||||
for ( size_t i =0 ; i < curves.size() ; i++) { // scorro tutte le curve del WireFrame
|
||||
bool bCurveOk = curve_handler( curves[i], nLayId, pGeomDB, pGenLog) ;
|
||||
bool bCurveOk = curve_handler( curves[i], nLayId, pGeomDB) ;
|
||||
if ( ! bCurveOk)
|
||||
return false ;
|
||||
}
|
||||
@@ -1148,7 +1149,7 @@ wireframe_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
assembly_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, int nFlag)
|
||||
assembly_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, int nFlag)
|
||||
{
|
||||
MbAssembly* pAss = static_cast<MbAssembly*>( pIt) ;
|
||||
if ( pAss == nullptr)
|
||||
@@ -1164,21 +1165,21 @@ assembly_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, in
|
||||
|
||||
bool bSolOk = true ;
|
||||
if ( (*it)->IsA() == st_Assembly)
|
||||
bSolOk = assembly_handler( *it, nLayId, pGeomDB, pGenLog, nFlag) ;
|
||||
bSolOk = assembly_handler( *it, nLayId, pGeomDB, nFlag) ;
|
||||
else if ( (*it)->IsA() == st_Solid)
|
||||
bSolOk = solid_handler( *it, nLayId, pGeomDB, pGenLog, nFlag) ;
|
||||
bSolOk = solid_handler( *it, nLayId, pGeomDB, nFlag) ;
|
||||
else if ( (*it)->IsA() == st_Instance)
|
||||
bSolOk = instance_handler( *it, nLayId, pGeomDB, pGenLog, nFlag) ;
|
||||
bSolOk = instance_handler( *it, nLayId, pGeomDB, nFlag) ;
|
||||
else if ( (*it)->IsA() == st_PointFrame)
|
||||
bSolOk = pointframe_handler( *it, nLayId, pGeomDB, pGenLog) ;
|
||||
bSolOk = pointframe_handler( *it, nLayId, pGeomDB) ;
|
||||
else if ( (*it)->IsA() == st_WireFrame)
|
||||
bSolOk = wireframe_handler( *it, nLayId, pGeomDB, pGenLog) ;
|
||||
bSolOk = wireframe_handler( *it, nLayId, pGeomDB) ;
|
||||
else if ( (*it)->IsA() == st_SpaceInstance)
|
||||
bSolOk = spaceinstance_handler( *it, nLayId, pGeomDB, pGenLog, nFlag) ;
|
||||
bSolOk = spaceinstance_handler( *it, nLayId, pGeomDB, nFlag) ;
|
||||
else if ( (*it)->IsA() == st_Mesh)
|
||||
bSolOk = mesh_handler( *it, nLayId, pGeomDB, pGenLog) ;
|
||||
bSolOk = mesh_handler( *it, nLayId, pGeomDB) ;
|
||||
else if ( (*it)->IsA() == st_PlaneInstance)
|
||||
bSolOk = planeinstance_handler( *it, nLayId, pGeomDB, pGenLog) ;
|
||||
bSolOk = planeinstance_handler( *it, nLayId, pGeomDB) ;
|
||||
|
||||
++ nAssObj ;
|
||||
|
||||
@@ -1191,7 +1192,7 @@ assembly_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, in
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
instance_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, int nFlag)
|
||||
instance_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, int nFlag)
|
||||
{
|
||||
MbInstance* pInst = static_cast<MbInstance*>( pIt) ;
|
||||
if ( pInst == nullptr)
|
||||
@@ -1210,26 +1211,26 @@ instance_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, in
|
||||
|
||||
// Analizzo l'item dell'instance
|
||||
if ( pInstItem->IsA() == st_Solid)
|
||||
return solid_handler( pItem, nLayId, pGeomDB, pGenLog, nFlag) ;
|
||||
return solid_handler( pItem, nLayId, pGeomDB, nFlag) ;
|
||||
else if ( pInstItem->IsA() == st_Assembly)
|
||||
return assembly_handler( pItem, nLayId, pGeomDB, pGenLog, nFlag) ;
|
||||
return assembly_handler( pItem, nLayId, pGeomDB, nFlag) ;
|
||||
else if ( (pInstItem)->IsA() == st_PointFrame)
|
||||
return pointframe_handler( pItem, nLayId, pGeomDB, pGenLog) ;
|
||||
return pointframe_handler( pItem, nLayId, pGeomDB) ;
|
||||
else if ( (pInstItem)->IsA() == st_WireFrame)
|
||||
return wireframe_handler( pItem, nLayId, pGeomDB, pGenLog) ;
|
||||
return wireframe_handler( pItem, nLayId, pGeomDB) ;
|
||||
else if ( (pInstItem)->IsA() == st_SpaceInstance)
|
||||
return spaceinstance_handler( pItem, nLayId, pGeomDB, pGenLog, nFlag) ;
|
||||
return spaceinstance_handler( pItem, nLayId, pGeomDB, nFlag) ;
|
||||
else if ( (pInstItem)->IsA() == st_Mesh)
|
||||
return mesh_handler( pItem, nLayId, pGeomDB, pGenLog) ;
|
||||
return mesh_handler( pItem, nLayId, pGeomDB) ;
|
||||
else if ( (pInstItem)->IsA() == st_PlaneInstance)
|
||||
return planeinstance_handler( pItem, nLayId, pGeomDB, pGenLog) ;
|
||||
return planeinstance_handler( pItem, nLayId, pGeomDB) ;
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
planeinstance_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog)
|
||||
planeinstance_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB)
|
||||
{
|
||||
MbPlaneInstance * pPlaneInstance = static_cast<MbPlaneInstance*> (pIt) ;
|
||||
if ( pPlaneInstance == nullptr) {
|
||||
@@ -1279,7 +1280,7 @@ planeinstance_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLo
|
||||
if ( points.size() == 1) {
|
||||
LOG_ERROR( pGenLog, "Warining : curve degenerated in one point") ;
|
||||
const MbPoint3D point( MbCartPoint3D( points[0].x, points[0].y, 0)) ;
|
||||
return point_handler( &point, nLayId, pGeomDB, pGenLog) ;
|
||||
return point_handler( &point, nLayId, pGeomDB) ;
|
||||
}
|
||||
|
||||
ICurveComposite* pCurveCompo = CreateCurveComposite() ;
|
||||
@@ -1331,7 +1332,7 @@ planeinstance_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLo
|
||||
if ( abs( start.x - end.x) < TOL_STD && abs( start.y - end.y) < TOL_STD) {
|
||||
LOG_ERROR( pGenLog, "Warining : CurveLine 2D degenerated in one point") ;
|
||||
const MbPoint3D point( MbCartPoint3D( start.x, start.y, 0)) ;
|
||||
return point_handler( &point, nLayId, pGeomDB, pGenLog) ;
|
||||
return point_handler( &point, nLayId, pGeomDB) ;
|
||||
}
|
||||
|
||||
ICurveLine* pLine = CreateCurveLine() ;
|
||||
@@ -1363,7 +1364,7 @@ planeinstance_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLo
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool bNurbsOk = nurbs2D_handler( pNurbs, nLayId, pGeomDB, pGenLog) ;
|
||||
bool bNurbsOk = nurbs2D_handler( pNurbs, nLayId, pGeomDB) ;
|
||||
if ( ! bNurbsOk)
|
||||
return false ;
|
||||
}
|
||||
@@ -1383,7 +1384,7 @@ planeinstance_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLo
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool bNurbsOk = nurbs2D_handler( pNurbs, nLayId, pGeomDB, pGenLog) ;
|
||||
bool bNurbsOk = nurbs2D_handler( pNurbs, nLayId, pGeomDB) ;
|
||||
if ( ! bNurbsOk)
|
||||
return false ;
|
||||
}
|
||||
@@ -1395,7 +1396,7 @@ planeinstance_handler( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLo
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
nurbs2D_handler( MbNurbs* pNurbs, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog)
|
||||
nurbs2D_handler( MbNurbs* pNurbs, int nLayId, IGeomDB* pGeomDB)
|
||||
{
|
||||
// se la Nurbs è periodica non la considero e passo all'item successivo
|
||||
if ( pNurbs->IsPeriodic()) {
|
||||
@@ -1445,7 +1446,7 @@ nurbs2D_handler( MbNurbs* pNurbs, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
spaceinstance_handler ( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, int nFlag)
|
||||
spaceinstance_handler ( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, int nFlag)
|
||||
{
|
||||
MbSpaceInstance* pSpaceInst = static_cast<MbSpaceInstance*>( pIt) ;
|
||||
if ( pSpaceInst == nullptr) {
|
||||
@@ -1468,7 +1469,7 @@ spaceinstance_handler ( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenL
|
||||
LOG_ERROR( pGenLog, "Error : Point pointer null") ;
|
||||
return false ;
|
||||
}
|
||||
return point_handler( pPoint, nLayId, pGeomDB, pGenLog) ;
|
||||
return point_handler( pPoint, nLayId, pGeomDB) ;
|
||||
}
|
||||
// curve
|
||||
else if ( pSpaceIt->Family() == st_Curve3D) {
|
||||
@@ -1477,7 +1478,7 @@ spaceinstance_handler ( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenL
|
||||
LOG_ERROR( pGenLog, "Error : Curve pointer null") ;
|
||||
return false ;
|
||||
}
|
||||
return curve_handler( pCurve, nLayId, pGeomDB, pGenLog) ;
|
||||
return curve_handler( pCurve, nLayId, pGeomDB) ;
|
||||
}
|
||||
// surface
|
||||
else if ( pSpaceIt->Family() == st_Surface) {
|
||||
@@ -1486,7 +1487,7 @@ spaceinstance_handler ( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenL
|
||||
LOG_ERROR( pGenLog, "Error : Surface pointer null") ;
|
||||
return false ;
|
||||
}
|
||||
return surface_handler( pSurface, nLayId, pGeomDB, pGenLog, color, nFlag) ;
|
||||
return surface_handler( pSurface, nLayId, pGeomDB, color, nFlag) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
@@ -1494,7 +1495,7 @@ spaceinstance_handler ( MbItem* pIt, int nLayId, IGeomDB* pGeomDB, Logger* pGenL
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
point_handler( const MbPoint3D* pPoint, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog)
|
||||
point_handler( const MbPoint3D* pPoint, int nLayId, IGeomDB* pGeomDB)
|
||||
{
|
||||
MbCartPoint3D pt = pPoint->GetCartPoint() ;
|
||||
|
||||
@@ -1822,6 +1823,10 @@ ConvertCurve( const MbCurve& pCurve, Point3d& ptDegen, double dScale)
|
||||
continue ;
|
||||
Point3d ptEndCurr, ptStartNext ;
|
||||
if ( pCC->IsValid()) {
|
||||
if ( pCrvConv == nullptr) {
|
||||
LOG_ERROR( pGenLog, "Error : failed conversion of contour") ;
|
||||
return nullptr ;
|
||||
}
|
||||
pCC->GetEndPoint( ptEndCurr) ;
|
||||
pCrvConv->GetStartPoint( ptStartNext) ;
|
||||
if ( Dist( ptEndCurr, ptStartNext) < dJoinTol) {
|
||||
@@ -1866,7 +1871,7 @@ ConvertCurve( const MbCurve& pCurve, Point3d& ptDegen, double dScale)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
curve_handler( const MbCurve3D* pCurve, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog)
|
||||
curve_handler( const MbCurve3D* pCurve, int nLayId, IGeomDB* pGeomDB)
|
||||
{
|
||||
// Polyline
|
||||
if ( pCurve->IsA() == st_Polyline3D) {
|
||||
@@ -1877,9 +1882,9 @@ curve_handler( const MbCurve3D* pCurve, int nLayId, IGeomDB* pGeomDB, Logger* pG
|
||||
LOG_ERROR( pGenLog, "Error : creating CurveComposite") ;
|
||||
return false ;
|
||||
}
|
||||
LOG_ERROR( pGenLog, "Warining : curve degenerated in one point") ;
|
||||
LOG_ERROR( pGenLog, "Warning : curve degenerated in one point") ;
|
||||
MbPoint3D mbCPt( ptDegen.x, ptDegen.y, ptDegen.z) ;
|
||||
return point_handler( &mbCPt, nLayId, pGeomDB, pGenLog) ;
|
||||
return point_handler( &mbCPt, nLayId, pGeomDB) ;
|
||||
}
|
||||
|
||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nLayId, pCurveCompo) ;
|
||||
@@ -1903,7 +1908,7 @@ curve_handler( const MbCurve3D* pCurve, int nLayId, IGeomDB* pGeomDB, Logger* pG
|
||||
}
|
||||
LOG_ERROR( pGenLog, "Warning : CurveLine degenerated in one point") ;
|
||||
MbPoint3D mbCPt( ptDegen.x, ptDegen.y, ptDegen.z) ;
|
||||
return point_handler( &mbCPt, nLayId, pGeomDB, pGenLog) ;
|
||||
return point_handler( &mbCPt, nLayId, pGeomDB) ;
|
||||
}
|
||||
|
||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nLayId, pLine) ;
|
||||
@@ -1932,7 +1937,7 @@ curve_handler( const MbCurve3D* pCurve, int nLayId, IGeomDB* pGeomDB, Logger* pG
|
||||
}
|
||||
LOG_ERROR( pGenLog, "Warning : CurveArc degenerated in one point") ;
|
||||
MbPoint3D mbCPt( ptDegen.x, ptDegen.y, ptDegen.z) ;
|
||||
return point_handler( &mbCPt, nLayId, pGeomDB, pGenLog) ;
|
||||
return point_handler( &mbCPt, nLayId, pGeomDB) ;
|
||||
}
|
||||
|
||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nLayId, pCurveArc) ;
|
||||
@@ -1952,7 +1957,7 @@ curve_handler( const MbCurve3D* pCurve, int nLayId, IGeomDB* pGeomDB, Logger* pG
|
||||
return false ;
|
||||
}
|
||||
|
||||
return nurbs3D_handler( pNurbs, nLayId, pGeomDB, pGenLog) ;
|
||||
return nurbs3D_handler( pNurbs, nLayId, pGeomDB) ;
|
||||
}
|
||||
|
||||
// Generic curve
|
||||
@@ -1963,7 +1968,7 @@ curve_handler( const MbCurve3D* pCurve, int nLayId, IGeomDB* pGeomDB, Logger* pG
|
||||
LOG_ERROR( pGenLog, "Error : converting the curve to a NURBS") ;
|
||||
return false ;
|
||||
}
|
||||
return nurbs3D_handler( pNurbs, nLayId, pGeomDB, pGenLog) ;
|
||||
return nurbs3D_handler( pNurbs, nLayId, pGeomDB) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
@@ -2057,7 +2062,7 @@ ConvertNurbs3D( const MbNurbs3D* pNurbs, bool bEraseSrc)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
nurbs3D_handler( const MbNurbs3D* pNurbs, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog)
|
||||
nurbs3D_handler( const MbNurbs3D* pNurbs, int nLayId, IGeomDB* pGeomDB)
|
||||
{
|
||||
ICurve* pBezierCurve = ConvertNurbs3D( pNurbs, false) ;
|
||||
if ( pBezierCurve == nullptr) {
|
||||
@@ -2145,7 +2150,7 @@ ConvertSurface(const MbSurface* pSurface, DBLVECTOR& vU, DBLVECTOR& vV) {
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
surface_handler( const MbSurface* pSurface, int nLayId, IGeomDB* pGeomDB, Logger* pGenLog, uint32 color, int nFlag)
|
||||
surface_handler( const MbSurface* pSurface, int nLayId, IGeomDB* pGeomDB, uint32 color, int nFlag)
|
||||
{
|
||||
// conversione diretta in trimesh
|
||||
if ( nFlag == 0) {
|
||||
@@ -2156,7 +2161,7 @@ surface_handler( const MbSurface* pSurface, int nLayId, IGeomDB* pGeomDB, Logger
|
||||
|
||||
MbMesh mesh ;
|
||||
pSurface->CalculateMesh( stepdata, note, mesh) ;
|
||||
bool bMeshOk = mesh_handler( & mesh, nLayId, pGeomDB, pGenLog, false) ;
|
||||
bool bMeshOk = mesh_handler( & mesh, nLayId, pGeomDB, false) ;
|
||||
if ( ! bMeshOk)
|
||||
return false ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user