8 Commits

Author SHA1 Message Date
Dario Sassi 3877e9e258 EgtConverter 3.1d2 :
- ricompilazione con cambio versione.
2026-04-22 18:58:20 +02:00
Daniele Bariletti 43655cedb6 EgtConverter :
- aggiunto controllo
- reso il log globale.
2026-04-10 10:32:09 +02:00
Daniele Bariletti 9e50fd2e0b EgtConverter :
- piccola correzione.
2026-04-02 15:20:15 +02:00
Daniele Bariletti a44928f84f EgtGeomKernel :
- piccola correzione.
2026-04-01 12:57:15 +02:00
Daniele Bariletti 74dd3298da EgtConverter :
- correzioni all'importazione dei contorni di trim.
2026-03-23 17:21:05 +01:00
Daniele Bariletti 8ebf8f27a6 EgtConverter 3.1c2 :
- correzioni varie.
- cambio versione.
2026-03-16 16:58:20 +01:00
Daniele Bariletti 6493d84a5f EgtConverter 3.1c1 :
- cambio versione.
2026-03-10 09:14:22 +01:00
Daniele Bariletti 996fd4d75c Merge branch 'NewMakeUniform' 2026-03-10 09:13:08 +01:00
2 changed files with 173 additions and 95 deletions
+163 -85
View File
@@ -70,7 +70,9 @@
#include "/EgtDev/Extern/C3d/Include/cur_contour_on_surface.h"
#define SAVETRIMLOOPS 0
#if SAVETRIMLOOPS
#define SAVECONTOUR 0
#if SAVETRIMLOOPS || SAVECONTOUR
std::vector<IGeoObj*> vGeo ;
#include "/EgtDev/Include/EGkGeoObjSave.h"
#endif
@@ -102,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) ;
@@ -130,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
@@ -177,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 ;
@@ -292,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") ;
@@ -403,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) {
@@ -598,13 +601,13 @@ LimitLoop( double u0, double u1, double v0, double v1, ICurveComposite* pCrv, IC
CRVCVECTOR vCrvClass1 ;
#if SAVETRIMLOOPS
vector<IGeoObj*> vGeo ;
vGeo.clear() ;
vGeo.push_back( pCrv->Clone()) ;
vGeo.push_back( pCCEdge->Clone()) ;
SaveGeoObj( vGeo, "D:\\Temp\\bezier\\import\\trim_loops_during_limiting.nge") ;
#endif
if ( ! icc.GetCurveClassification( 0, 0.01, vCrvClass0) || ! icc.GetCurveClassification( 1, 0.01, vCrvClass1))
if ( ! icc.GetCurveClassification( 0, EPS_SMALL, vCrvClass0) || ( ! bOpenOrClosed && ! icc.GetCurveClassification( 1, EPS_SMALL, vCrvClass1)))
return false ;
int nInters = icc.GetIntersCount() ;
@@ -616,6 +619,9 @@ LimitLoop( double u0, double u1, double v0, double v1, ICurveComposite* pCrv, IC
double dLastParam0 = 0 ;
double dLastParam1 = 0 ;
double dStartA, dEndA ;
pCrv->GetDomain( dStartA, dEndA) ;
double dEndB = 4 ;
for ( int i = 0 ; i < ssize( vCrvClass0) ; ++i) {
if ( vCrvClass0[i].nClass == CRVC_IN || vCrvClass0[i].nClass == CRVC_ON_P) {
// se continua la curva precedente allora la giunta
@@ -630,6 +636,8 @@ LimitLoop( double u0, double u1, double v0, double v1, ICurveComposite* pCrv, IC
int k = vICCI[j].bOverlap ? 1 : 0 ;
if ( abs( vICCI[j].IciA[k].dU - vCrvClass0[i].dParE) < EPS_PARAM) {
dLastParam1 = vICCI[j].IciB[k].dU ;
if ( dEndB - dLastParam1 < EPS_ZERO)
dLastParam1 = 0 ;
break ;
}
}
@@ -641,8 +649,12 @@ LimitLoop( double u0, double u1, double v0, double v1, ICurveComposite* pCrv, IC
double dPar0 = vCrvClass0[i].dParS ;
for ( int j = 0 ; j < ssize( vICCI) ; ++j) {
int k = vICCI[j].bOverlap ? 1 : 0 ;
if ( abs(vICCI[j].IciA[k].dU - dPar0) < EPS_PARAM) {
dLastParam1 = vICCI[j].IciB[k].dU ;
if ( abs(vICCI[j].IciA[k].dU - dPar0) < EPS_PARAM ||
( ! bOpenOrClosed && abs( dEndA - vICCI[j].IciA[k].dU - dPar0) < EPS_PARAM)) {
if ( abs( dEndB - vICCI[j].IciB[k].dU) < EPS_PARAM)
dLastParam1 = 0 ;
else
dLastParam1 = vICCI[j].IciB[k].dU ;
break ;
}
}
@@ -657,6 +669,13 @@ LimitLoop( double u0, double u1, double v0, double v1, ICurveComposite* pCrv, IC
else
vCC.back()->AddCurve( pCCEdge->CopyParamRange( vCrvClass1[c].dParS, vCrvClass1[c].dParE)) ;
dLastParam1 = vCrvClass1[c].dParE ;
// se sono alla fine curva verifico se devo aggiungere anche un pezzo di inizio
if ( dLastParam1 == dEndB && vCrvClass1[0].nClass == CRVC_IN) {
c = 0 ;
vCC.back()->AddCurve( pCCEdge->CopyParamRange( vCrvClass1[c].dParS, vCrvClass1[c].dParE)) ;
dLastParam1 = vCrvClass1[c].dParE ;
}
for ( int j = 0 ; j < ssize( vICCI) ; ++j) {
int k = vICCI[j].bOverlap ? 1 : 0 ;
if ( abs(vICCI[j].IciB[k].dU - dLastParam1) < EPS_PARAM) {
@@ -675,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)) ;
@@ -720,6 +739,11 @@ ConvertFace( const MbFace* mbF, Logger* pGenLog) {
LOG_ERROR( pGenLog, "Error converting the contour of a face of a Solid") ;
goto exit ;
}
#if SAVECONTOUR
vGeo.clear() ;
vGeo.push_back( pCrv->Clone()) ;
SaveGeoObj( vGeo, "D:\\Temp\\bezier\\import\\contour.nge") ;
#endif
if ( ! pCrv->IsClosed()){
// controllo se Start e End distano meno di 1 allora chiudo la curva a mano.
@@ -816,7 +840,7 @@ ConvertFace( const MbFace* mbF, Logger* pGenLog) {
pCrv->GetBBox( GLOB_FRM, bbCrv) ;
const Point3d& ptMin = bbCrv.GetMin() ;
const Point3d& ptMax = bbCrv.GetMax() ;
if ( ptMin.x < u0 || ptMin.y < v0 || ptMax.x > u1 || ptMax.y > v1) {
if ( ptMin.x < u0 - EPS_ZERO || ptMin.y < v0 - EPS_ZERO || ptMax.x > u1 + EPS_ZERO || ptMax.y > v1 + EPS_ZERO) {
ICRVCOMPOPOVECTOR vCC ;
if ( ! LimitLoop( u0, u1, v0, v1, pCrv, vCC, false)) {
LOG_ERROR( pGenLog, "Error 1 limiting closed curve") ;
@@ -836,15 +860,17 @@ ConvertFace( const MbFace* mbF, Logger* pGenLog) {
#endif
//devo fare la chain di queste curve prima di metterele nella SFR
GetChainedCurves( vCC) ;
#if SAVETRIMLOOPS
vGeo.clear() ;
vGeo.push_back( vCC[0]) ;
SaveGeoObj( vGeo, "D:\\Temp\\bezier\\import\\trim_loops_after_chain.nge") ;
#endif
GetChainedCurves( vCC) ;
for( int i = 0 ; i < ssize(vCC) ; ++i)
for( int i = 0 ; i < ssize(vCC) ; ++i){
vCC[i]->Close() ;
SfrCntr.AddCurve( Release(vCC[i])) ;
}
}
else {
// queste curve dovrebbero essere gi nel parametrico
@@ -999,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) {
@@ -1018,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) ;
@@ -1030,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 ;
@@ -1079,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) {
@@ -1093,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 ;
}
@@ -1102,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) {
@@ -1114,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 ;
}
@@ -1123,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)
@@ -1139,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 ;
@@ -1166,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)
@@ -1185,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) {
@@ -1254,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() ;
@@ -1306,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() ;
@@ -1338,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 ;
}
@@ -1358,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 ;
}
@@ -1370,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()) {
@@ -1420,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) {
@@ -1443,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) {
@@ -1452,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) {
@@ -1461,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 ;
@@ -1469,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() ;
@@ -1640,7 +1666,7 @@ ConvertCurve( const MbCurve& pCurve, Point3d& ptDegen, double dScale)
{
MbePlaneType mbCrvType = pCurve.IsA() ;
// Polyline
if ( pCurve.IsA() == pt_Polyline) {
if ( mbCrvType == pt_Polyline) {
const MbPolyline* pPolyline = static_cast<const MbPolyline*>( &pCurve) ;
if ( pPolyline == nullptr)
return nullptr ;
@@ -1685,7 +1711,7 @@ ConvertCurve( const MbCurve& pCurve, Point3d& ptDegen, double dScale)
}
// LineSegment
else if ( pCurve.IsA() == pt_LineSegment ){
else if ( mbCrvType == pt_LineSegment ){
const MbLineSegment * pSegment = static_cast<const MbLineSegment*>( &pCurve) ;
if ( pSegment == nullptr)
return nullptr ;
@@ -1714,7 +1740,7 @@ ConvertCurve( const MbCurve& pCurve, Point3d& ptDegen, double dScale)
}
// Arc
else if ( pCurve.IsA() == pt_Arc) {
else if ( mbCrvType == pt_Arc) {
const MbArc * pArc = static_cast<const MbArc*>( &pCurve) ;
if ( pArc == nullptr)
return nullptr ;
@@ -1741,6 +1767,17 @@ ConvertCurve( const MbCurve& pCurve, Point3d& ptDegen, double dScale)
}
bArcOk = pCurveArc->Set( Point3d( mbPlacement.GetOrigin().x, mbPlacement.GetOrigin().y, 0) * dScale, Z_AX, dRad * dScale) ;
double dUStart ;
if ( pCurveArc->GetParamAtPoint( Point3d( start.x * dScale, start.y * dScale), dUStart, EPS_SMALL * dScale)) {
pCurveArc->ChangeStartPoint( dUStart) ;
Vector3d vtStartDir ; pCurveArc->GetStartDir( vtStartDir) ;
double dStart = 0 ;
MbDirection mbStartDir = pArc->Tangent( dStart) ;
Vector3d vtStartOrig( mbStartDir.ax, mbStartDir.ay) ;
bool bSameDir = vtStartDir * vtStartOrig > 0 ;
if ( ! bSameDir)
pCurveArc->Invert() ;
}
}
// arco generico
else {
@@ -1759,13 +1796,13 @@ ConvertCurve( const MbCurve& pCurve, Point3d& ptDegen, double dScale)
}
// Nurbs
else if ( pCurve.IsA() == pt_Nurbs) {
else if ( mbCrvType == pt_Nurbs) {
const MbNurbs * pNurbs = static_cast<const MbNurbs*>( &pCurve) ;
return ConvertNurbs( pNurbs, dScale, false) ;
}
// curve di contorno
else if ( pCurve.IsA() == pt_Contour) {
else if ( mbCrvType == pt_Contour) {
double dJoinTol = 20 * EPS_SMALL * dScale ;
const MbContour* pContour = static_cast<const MbContour*>( &pCurve) ;
PtrOwner<ICurveComposite> pCC( CreateCurveComposite()) ;
@@ -1773,12 +1810,53 @@ ConvertCurve( const MbCurve& pCurve, Point3d& ptDegen, double dScale)
const MbCurve* pSubCrv = pContour->GetSegment( nS) ;
Point3d ptDegen = P_INVALID ;
PtrOwner<ICurve> pCrvConv( ConvertCurve( *pSubCrv, ptDegen, dScale)) ;
#if SAVECONTOUR
vGeo.clear() ;
if ( pCC->IsValid())
vGeo.push_back( pCC->Clone()) ;
if ( pCrvConv->IsValid())
vGeo.push_back( pCrvConv->Clone()) ;
SaveGeoObj( vGeo, "D:\\Temp\\bezier\\import\\contour.nge") ;
#endif
if ( ptDegen.IsValid())
continue ;
if ( ! pCC->AddCurve( Release( pCrvConv), true, dJoinTol))
return nullptr ;
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) {
if ( ! pCC->AddCurve( Release( pCrvConv), true, dJoinTol))
return nullptr ;
}
else {
PtrOwner<ICurveLine> pCL( CreateCurveLine()) ;
pCL->Set( ptEndCurr, ptStartNext) ;
if ( ! pCC->AddCurve( Release( pCL), true, dJoinTol) || ! pCC->AddCurve( Release( pCrvConv), true, dJoinTol))
return nullptr ;
}
}
else {
if ( ! pCC->AddCurve( Release( pCrvConv), true, dJoinTol))
return nullptr ;
}
}
return Release( pCC) ;
////////// conversione in NURBS
// MbNurbs* pNurbs = pCurve.NurbsCurve() ;
// PtrOwner<ICurve> pCrv( ConvertNurbs( pNurbs, dScale, true)) ;
//#if SAVECONTOUR
// vGeo.clear() ;
// vGeo.push_back( pCrv->Clone()) ;
// SaveGeoObj( vGeo, "D:\\Temp\\bezier\\import\\contour.nge") ;
//#endif
// return Release(pCrv) ;
}
// Generic curve
@@ -1793,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) {
@@ -1804,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) ;
@@ -1830,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) ;
@@ -1859,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) ;
@@ -1879,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
@@ -1890,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 ;
@@ -1984,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) {
@@ -2072,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) {
@@ -2083,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 ;
}
+10 -10
View File
@@ -13,7 +13,7 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Italiano (Italia) resources
// Italian (Italy) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
@@ -56,7 +56,7 @@ VS_VERSION_INFO$(_DEB32) VERSIONINFO
#else
VS_VERSION_INFO VERSIONINFO
#endif
FILEVERSION 3,1,2,1
FILEVERSION 3,1,4,2
PRODUCTVERSION 3,1,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
@@ -74,7 +74,7 @@ BEGIN
BEGIN
VALUE "CompanyName", "Egalware s.r.l."
VALUE "FileDescription", "Advanced Converter Debug Version"
VALUE "FileVersion", "3.1b1"
VALUE "FileVersion", "3.1d2"
VALUE "InternalName", "EgtConverter"
VALUE "LegalCopyright", "Copyright (C) 2020-2026 by Egalware s.r.l."
VALUE "OriginalFilename", "EgtConverterD32.exe"
@@ -95,7 +95,7 @@ VS_VERSION_INFO$(NDEB32) VERSIONINFO
#else
VS_VERSION_INFO VERSIONINFO
#endif
FILEVERSION 3,1,2,1
FILEVERSION 3,1,4,2
PRODUCTVERSION 3,1,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
@@ -113,7 +113,7 @@ BEGIN
BEGIN
VALUE "CompanyName", "Egalware s.r.l."
VALUE "FileDescription", "Advanced Converter"
VALUE "FileVersion", "3.1b1"
VALUE "FileVersion", "3.1d2"
VALUE "InternalName", "EgtConverter"
VALUE "LegalCopyright", "Copyright (C) 2020-2026 by Egalware s.r.l."
VALUE "OriginalFilename", "EgtConverterR32.exe"
@@ -134,7 +134,7 @@ VS_VERSION_INFO$(_DEB64) VERSIONINFO
#else
VS_VERSION_INFO VERSIONINFO
#endif
FILEVERSION 3,1,2,1
FILEVERSION 3,1,4,2
PRODUCTVERSION 3,1,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
@@ -152,7 +152,7 @@ BEGIN
BEGIN
VALUE "CompanyName", "Egalware s.r.l."
VALUE "FileDescription", "Advanced Converter Debug Version"
VALUE "FileVersion", "3.1b1"
VALUE "FileVersion", "3.1d2"
VALUE "InternalName", "EgtConverter"
VALUE "LegalCopyright", "Copyright (C) 2020-2026 by Egalware s.r.l."
VALUE "OriginalFilename", "EgtConverterD64.exe"
@@ -173,7 +173,7 @@ VS_VERSION_INFO$(NDEB64) VERSIONINFO
#else
VS_VERSION_INFO VERSIONINFO
#endif
FILEVERSION 3,1,2,1
FILEVERSION 3,1,4,2
PRODUCTVERSION 3,1,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
@@ -191,7 +191,7 @@ BEGIN
BEGIN
VALUE "CompanyName", "Egalware s.r.l."
VALUE "FileDescription", "Advanced Converter"
VALUE "FileVersion", "3.1b1"
VALUE "FileVersion", "3.1d2"
VALUE "InternalName", "EgtConverter"
VALUE "LegalCopyright", "Copyright (C) 2020-2026 by Egalware s.r.l."
VALUE "OriginalFilename", "EgtConverterR64.exe"
@@ -206,7 +206,7 @@ BEGIN
END
#endif
#endif // Italiano (Italia) resources
#endif // Italian (Italy) resources
/////////////////////////////////////////////////////////////////////////////