Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0dd44e569a | |||
| ba8a4c8914 | |||
| 55fb88d85b | |||
| b8fb6d9a07 | |||
| f25473dfd2 | |||
| 977fe9f016 | |||
| d38beed861 | |||
| 55a02dc387 | |||
| e18833d837 | |||
| 7d25e262c2 | |||
| e32c603647 | |||
| b6847a3da7 | |||
| 0316c32afb | |||
| 0db5c4aa91 | |||
| 4399074418 | |||
| e0dcd3f3ac | |||
| 7a78c4e832 | |||
| 77447763b3 | |||
| 1636f8c0b4 | |||
| 281e7183bd |
@@ -91,6 +91,7 @@ static const std::string IKEY_LSIDE = "LSIDE" ;
|
|||||||
const double PART_OFFSET = 300 ;
|
const double PART_OFFSET = 300 ;
|
||||||
// costanti di approssimazione per curve
|
// costanti di approssimazione per curve
|
||||||
const double CRV_LIN_APPROX = 0.05 ;
|
const double CRV_LIN_APPROX = 0.05 ;
|
||||||
|
const double CRV_LIN_FINE_APPROX = 0.01 ;
|
||||||
const double CRV_ANG_APPROX_DEG = 22.5 ;
|
const double CRV_ANG_APPROX_DEG = 22.5 ;
|
||||||
// costante di compattazione di superfici
|
// costante di compattazione di superfici
|
||||||
const double STM_COMPACT_APPROX = 0.01 ;
|
const double STM_COMPACT_APPROX = 0.01 ;
|
||||||
|
|||||||
+65
-19
@@ -801,9 +801,14 @@ BtlGeom::GetProcessParamInfos( int nGroup, int nProc, int nSide,
|
|||||||
}
|
}
|
||||||
// se variante
|
// se variante
|
||||||
if ( IS_VARIANT( nGroup, nProc)) {
|
if ( IS_VARIANT( nGroup, nProc)) {
|
||||||
vnDPar.reserve( 2) ; vdPar.reserve( 2) ;
|
vnDPar.reserve( 7) ; vdPar.reserve( 7) ;
|
||||||
vnDPar.emplace_back( 1) ; vdPar.emplace_back( 0) ;
|
vnDPar.emplace_back( 1) ; vdPar.emplace_back( 0) ;
|
||||||
vnDPar.emplace_back( 2) ; vdPar.emplace_back( 0) ;
|
vnDPar.emplace_back( 2) ; vdPar.emplace_back( 0) ;
|
||||||
|
vnDPar.emplace_back( 3) ; vdPar.emplace_back( 0) ;
|
||||||
|
vnDPar.emplace_back( 6) ; vdPar.emplace_back( 0) ;
|
||||||
|
vnDPar.emplace_back( 10) ; vdPar.emplace_back( 1) ;
|
||||||
|
vnDPar.emplace_back( 11) ; vdPar.emplace_back( 1) ;
|
||||||
|
vnDPar.emplace_back( 12) ; vdPar.emplace_back( 1) ;
|
||||||
nSPar = 0 ; sPar.clear() ;
|
nSPar = 0 ; sPar.clear() ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
@@ -1671,22 +1676,38 @@ BtlGeom::AddFrontSlot( int nGroup, int nProc, int nSide, const string& sDes, int
|
|||||||
if ( ! bSave)
|
if ( ! bSave)
|
||||||
pCut.Reset() ;
|
pCut.Reset() ;
|
||||||
}
|
}
|
||||||
// definisco la superficie della mortasa
|
// Facce della mortasa
|
||||||
|
Polygon3d plyFaceF ;
|
||||||
|
if ( ! CreatePolygonInBox( GetToGlob( Point3d( 0, 0, -dMortD), frMort), frMort.VersZ(), BTL_SIDE_NONE, plyFaceF))
|
||||||
|
return false ;
|
||||||
|
Polygon3d plyFace1 ;
|
||||||
|
if ( ! CreatePolygonInBox( GetToGlob( Point3d( -dMortHW, 0, 0), frMort), frMort.VersX(), BTL_SIDE_NONE, plyFace1))
|
||||||
|
return false ;
|
||||||
|
Polygon3d plyFace2 ;
|
||||||
|
if ( ! CreatePolygonInBox( GetToGlob( Point3d( 0, -dMortHL, 0), frMort), frMort.VersY(), BTL_SIDE_NONE, plyFace2))
|
||||||
|
return false ;
|
||||||
|
Polygon3d plyFace3 ;
|
||||||
|
if ( ! CreatePolygonInBox( GetToGlob( Point3d( dMortHW, 0, 0), frMort), -frMort.VersX(), BTL_SIDE_NONE, plyFace3))
|
||||||
|
return false ;
|
||||||
|
Polygon3d plyFace4 ;
|
||||||
|
if ( ! CreatePolygonInBox( GetToGlob( Point3d( 0, dMortHL, 0), frMort), -frMort.VersY(), BTL_SIDE_NONE, plyFace4))
|
||||||
|
return false ;
|
||||||
|
// trimmo tra loro le facce
|
||||||
|
POLYGVECTOR vPolyg{ plyFaceF, plyFace1, plyFace2, plyFace3, plyFace4} ;
|
||||||
|
INTMATRIX vAdjac{ { 1, 2, 3, 4}, { 0, 2, 4}, { 0, 1, 3}, { 0, 2, 4}, { 0, 1, 3}} ;
|
||||||
|
if ( ! TrimConcaveFaces( vPolyg, vAdjac))
|
||||||
|
return false ;
|
||||||
|
// creo la trimesh dalle facce
|
||||||
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
||||||
// creo la superficie trimesh laterale della mortasa (un poco più lunga in alto, per evitare problemi con solidi)
|
if ( IsNull( pStm))
|
||||||
if ( IsNull( pStm) || ! pStm->CreateByExtrusion( PL, - frMort.VersZ() * ( dMortD + ( IsNull( pCut) ? 100 * EPS_SMALL : 0))))
|
|
||||||
return false ;
|
return false ;
|
||||||
if ( IsNull( pCut))
|
for ( int i = 0 ; i < int( vPolyg.size()) ; ++ i)
|
||||||
pStm->Translate( frMort.VersZ() * 100 * EPS_SMALL) ;
|
DoSewing( pStm, vPolyg[i]) ;
|
||||||
// creo la superficie trimesh di fondo della mortasa
|
|
||||||
PtrOwner<ISurfTriMesh> pStmCap( CreateSurfTriMesh()) ;
|
|
||||||
if ( IsNull( pStmCap) || ! pStmCap->CreateByFlatContour( PL))
|
|
||||||
return false ;
|
|
||||||
pStmCap->Translate( - frMort.VersZ() * dMortD) ;
|
|
||||||
pStm->DoSewing( *pStmCap) ;
|
|
||||||
// eseguo trim con le facce della trave
|
|
||||||
TrimSurfTmWithBox( pStm) ;
|
|
||||||
pStm->DoCompacting( STM_COMPACT_APPROX) ;
|
pStm->DoCompacting( STM_COMPACT_APPROX) ;
|
||||||
|
// la limito con il piano di taglio (un poco più alto, per evitare problemi con solidi)
|
||||||
|
Plane3d plCut ;
|
||||||
|
plCut.Set( GetToGlob( Point3d( 0, 0, 100 * EPS_SMALL), frMort), frMort.VersZ()) ;
|
||||||
|
pStm->Cut( plCut, false) ;
|
||||||
// inserisco la superficie trimesh della mortasa nel DB geometrico
|
// inserisco la superficie trimesh della mortasa nel DB geometrico
|
||||||
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pStm)) ;
|
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pStm)) ;
|
||||||
if ( nId == GDB_ID_NULL)
|
if ( nId == GDB_ID_NULL)
|
||||||
@@ -2094,7 +2115,14 @@ BtlGeom::AddLapJoint( int nGroup, int nProc, int nSide, const string& sDes, int
|
|||||||
double dChAng = Clamp( vdPar[11], 0., 89.) ; // P13
|
double dChAng = Clamp( vdPar[11], 0., 89.) ; // P13
|
||||||
double dWidth = ( ( vdPar[12] > EPS_SMALL) ? vdPar[12] : GetSideWidth( nSide) - dStartY) ; // P14
|
double dWidth = ( ( vdPar[12] > EPS_SMALL) ? vdPar[12] : GetSideWidth( nSide) - dStartY) ; // P14
|
||||||
Point3d ptP( dStartX, dStartY, dStartZ) ;
|
Point3d ptP( dStartX, dStartY, dStartZ) ;
|
||||||
// verifiche dei dati
|
// verifiche dei dati (il primo è una correzione di un errore di Dietrich's)
|
||||||
|
if ( nFlag < 0 || nFlag >= 63) {
|
||||||
|
// messaggio di warning in log
|
||||||
|
string sOut = " Warning : All Faces Open On Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
|
||||||
|
") on line " + ToString( m_nBtlLine) ;
|
||||||
|
LOG_WARN( GetEExLogger(), sOut.c_str())
|
||||||
|
nFlag = 0 ;
|
||||||
|
}
|
||||||
if ( dDepth < 10 * EPS_SMALL && abs( dSlope) < EPS_ANG_SMALL && abs( dInclination - ANG_RIGHT) < EPS_ANG_SMALL)
|
if ( dDepth < 10 * EPS_SMALL && abs( dSlope) < EPS_ANG_SMALL && abs( dInclination - ANG_RIGHT) < EPS_ANG_SMALL)
|
||||||
dDepth = GetSideHeight( nSide) ;
|
dDepth = GetSideHeight( nSide) ;
|
||||||
// faccia di inizio
|
// faccia di inizio
|
||||||
@@ -6890,10 +6918,14 @@ BtlGeom::AddVariant( int nGroup, int nProc, int nSide, const string& sDes, int n
|
|||||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt)
|
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt)
|
||||||
{
|
{
|
||||||
// verifica dei parametri
|
// verifica dei parametri
|
||||||
if ( vdPar.size() < 2)
|
if ( vdPar.size() < 7)
|
||||||
return false ;
|
return false ;
|
||||||
// assegnazione parametri
|
// assegnazione parametri
|
||||||
Vector3d vtMove( vdPar[0], vdPar[1], 0) ; // P01, P02
|
Vector3d vtMove( vdPar[0], vdPar[1], -vdPar[2]) ; // P01, P02, P03
|
||||||
|
double dAngRot = Clamp( vdPar[3], -180.0, 180.0) ; // P06
|
||||||
|
double dXScale = Clamp( vdPar[4], 0.01, 100.0) ; // P10
|
||||||
|
double dYScale = Clamp( vdPar[5], 0.01, 100.0) ; // P11
|
||||||
|
double dZScale = Clamp( vdPar[6], 0.01, 100.0) ; // P12
|
||||||
// recupero il codice identificativo
|
// recupero il codice identificativo
|
||||||
int nCode = 0 ;
|
int nCode = 0 ;
|
||||||
FromString( sDes, nCode) ;
|
FromString( sDes, nCode) ;
|
||||||
@@ -6911,6 +6943,20 @@ BtlGeom::AddVariant( int nGroup, int nProc, int nSide, const string& sDes, int n
|
|||||||
while ( nEnt != GDB_ID_NULL) {
|
while ( nEnt != GDB_ID_NULL) {
|
||||||
// recupero il successivo
|
// recupero il successivo
|
||||||
int nNextEnt = m_pGDB->GetNext( nEnt) ;
|
int nNextEnt = m_pGDB->GetNext( nEnt) ;
|
||||||
|
// eventuale scalatura
|
||||||
|
if ( abs( dXScale - 1) > EPS_ZERO || abs( dYScale - 1) > EPS_ZERO || abs( dZScale -1) > EPS_ZERO)
|
||||||
|
m_pGDB->Scale( nEnt, Frame3d(), dXScale, dYScale, dZScale) ;
|
||||||
|
// eventuale rotazione
|
||||||
|
if ( abs( dAngRot) > EPS_ANG_ZERO)
|
||||||
|
m_pGDB->Rotate( nEnt, ORIG, Z_AX, dAngRot) ;
|
||||||
|
// eventuale aggiustamento dell'orientamento
|
||||||
|
if ( abs( vtMove.z) > EPS_SMALL && nGroup != 0) {
|
||||||
|
m_pGDB->Rotate( nEnt, ORIG, X_AX, ANG_RIGHT) ;
|
||||||
|
if ( nGroup == 4)
|
||||||
|
m_pGDB->Rotate( nEnt, ORIG, Z_AX, -ANG_RIGHT) ;
|
||||||
|
else
|
||||||
|
m_pGDB->Rotate( nEnt, ORIG, Z_AX, ANG_RIGHT) ;
|
||||||
|
}
|
||||||
// aggiusto la posizione
|
// aggiusto la posizione
|
||||||
m_pGDB->TranslateGlob( nEnt, vtMove) ;
|
m_pGDB->TranslateGlob( nEnt, vtMove) ;
|
||||||
m_pGDB->Relocate( nEnt, m_nProcsId) ;
|
m_pGDB->Relocate( nEnt, m_nProcsId) ;
|
||||||
@@ -7377,8 +7423,8 @@ BtlGeom::CreateFreeContours( void)
|
|||||||
pCrvCompo2->ToGlob( GetSideFrame( nSide)) ;
|
pCrvCompo2->ToGlob( GetSideFrame( nSide)) ;
|
||||||
// ricavo le spezzate che li approssima
|
// ricavo le spezzate che li approssima
|
||||||
PolyLine PL, PL2 ;
|
PolyLine PL, PL2 ;
|
||||||
if ( ! pCrvCompo->ApproxWithLines( CRV_LIN_APPROX, CRV_ANG_APPROX_DEG, ICurve::APL_SPECIAL, PL) ||
|
if ( ! pCrvCompo->ApproxWithLines( CRV_LIN_FINE_APPROX, CRV_ANG_APPROX_DEG, ICurve::APL_SPECIAL, PL) ||
|
||||||
! pCrvCompo2->ApproxWithLines( CRV_LIN_APPROX, CRV_ANG_APPROX_DEG, ICurve::APL_SPECIAL, PL2))
|
! pCrvCompo2->ApproxWithLines( CRV_LIN_FINE_APPROX, CRV_ANG_APPROX_DEG, ICurve::APL_SPECIAL, PL2))
|
||||||
continue ;
|
continue ;
|
||||||
// verifico se le due curve sono una la traslata dell'altra e ne setto l'estrusione di conseguenza
|
// verifico se le due curve sono una la traslata dell'altra e ne setto l'estrusione di conseguenza
|
||||||
double dS1, dE1 ; pCrvCompo->GetDomain( dS1, dE1) ;
|
double dS1, dE1 ; pCrvCompo->GetDomain( dS1, dE1) ;
|
||||||
|
|||||||
Binary file not shown.
+1
-5
@@ -101,7 +101,7 @@
|
|||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;I_AM_EEX;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;I_AM_EEX;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<OpenMPSupport>true</OpenMPSupport>
|
<OpenMPSupport>false</OpenMPSupport>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
@@ -318,13 +318,11 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClInclude Include="DxfColors.h" />
|
<ClInclude Include="DxfColors.h" />
|
||||||
<ClInclude Include="DxfConst.h" />
|
<ClInclude Include="DxfConst.h" />
|
||||||
<ClInclude Include="ExcExecutor.h" />
|
<ClInclude Include="ExcExecutor.h" />
|
||||||
<ClInclude Include="Export3dm.h" />
|
|
||||||
<ClInclude Include="Export3MF.h" />
|
<ClInclude Include="Export3MF.h" />
|
||||||
<ClInclude Include="ExportDxf.h" />
|
<ClInclude Include="ExportDxf.h" />
|
||||||
<ClInclude Include="ExportStl.h" />
|
<ClInclude Include="ExportStl.h" />
|
||||||
<ClInclude Include="ExportSvg.h" />
|
<ClInclude Include="ExportSvg.h" />
|
||||||
<ClInclude Include="ExportThreeJS.h" />
|
<ClInclude Include="ExportThreeJS.h" />
|
||||||
<ClInclude Include="Import3dm.h" />
|
|
||||||
<ClInclude Include="Import3MF.h" />
|
<ClInclude Include="Import3MF.h" />
|
||||||
<ClInclude Include="ImportBtl.h" />
|
<ClInclude Include="ImportBtl.h" />
|
||||||
<ClInclude Include="BtlGeomCoStru.h" />
|
<ClInclude Include="BtlGeomCoStru.h" />
|
||||||
@@ -357,13 +355,11 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="ExcExecutor.cpp" />
|
<ClCompile Include="ExcExecutor.cpp" />
|
||||||
<ClCompile Include="Export3dm.cpp" />
|
|
||||||
<ClCompile Include="Export3MF.cpp" />
|
<ClCompile Include="Export3MF.cpp" />
|
||||||
<ClCompile Include="ExportDxf.cpp" />
|
<ClCompile Include="ExportDxf.cpp" />
|
||||||
<ClCompile Include="ExportStl.cpp" />
|
<ClCompile Include="ExportStl.cpp" />
|
||||||
<ClCompile Include="ExportSvg.cpp" />
|
<ClCompile Include="ExportSvg.cpp" />
|
||||||
<ClCompile Include="ExportThreeJS.cpp" />
|
<ClCompile Include="ExportThreeJS.cpp" />
|
||||||
<ClCompile Include="Import3dm.cpp" />
|
|
||||||
<ClCompile Include="Import3MF.cpp" />
|
<ClCompile Include="Import3MF.cpp" />
|
||||||
<ClCompile Include="ImportBtl.cpp" />
|
<ClCompile Include="ImportBtl.cpp" />
|
||||||
<ClCompile Include="BtlGeom.cpp" />
|
<ClCompile Include="BtlGeom.cpp" />
|
||||||
|
|||||||
@@ -375,12 +375,6 @@
|
|||||||
<ClInclude Include="..\Include\SELkKeyProc.h">
|
<ClInclude Include="..\Include\SELkKeyProc.h">
|
||||||
<Filter>File di intestazione\Include</Filter>
|
<Filter>File di intestazione\Include</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Import3dm.h">
|
|
||||||
<Filter>File di intestazione</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Export3dm.h">
|
|
||||||
<Filter>File di intestazione</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="stdafx.cpp">
|
||||||
@@ -461,12 +455,6 @@
|
|||||||
<ClCompile Include="ExportThreeJS.cpp">
|
<ClCompile Include="ExportThreeJS.cpp">
|
||||||
<Filter>File di origine</Filter>
|
<Filter>File di origine</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Import3dm.cpp">
|
|
||||||
<Filter>File di origine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Export3dm.cpp">
|
|
||||||
<Filter>File di origine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="EgtExchange.rc">
|
<ResourceCompile Include="EgtExchange.rc">
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
#include "/EgtDev/Include/EExImportCnc.h"
|
#include "/EgtDev/Include/EExImportCnc.h"
|
||||||
#include "/EgtDev/Include/EExImportDxf.h"
|
#include "/EgtDev/Include/EExImportDxf.h"
|
||||||
#include "/EgtDev/Include/EExImportStl.h"
|
#include "/EgtDev/Include/EExImportStl.h"
|
||||||
#include "/EgtDev/Include/EExImport3dm.h"
|
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
|
|||||||
+80
-46
@@ -49,6 +49,7 @@ bool
|
|||||||
Export3MF::SetOptions( int nFilter)
|
Export3MF::SetOptions( int nFilter)
|
||||||
{
|
{
|
||||||
m_nFilter = nFilter ;
|
m_nFilter = nFilter ;
|
||||||
|
CalcGroupFilter() ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,31 +125,32 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
|||||||
bool
|
bool
|
||||||
Export3MF::ExportObject( const IGdbIterator& iIter)
|
Export3MF::ExportObject( const IGdbIterator& iIter)
|
||||||
{
|
{
|
||||||
switch ( iIter.GetGdbType()) {
|
// recupero il livello dell'oggetto
|
||||||
case GDB_TY_GEO :
|
int nLev = GDB_LV_USER ;
|
||||||
{
|
iIter.GetCalcLevel( nLev) ;
|
||||||
// recupero l'oggetto geometrico
|
// recupero il modo dell'oggetto
|
||||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
int nMode = GDB_MD_STD ;
|
||||||
if ( pGeoObj == nullptr)
|
iIter.GetCalcMode( nMode) ;
|
||||||
return true ;
|
// recupero lo stato dell'oggetto
|
||||||
// se non è una superficie esco
|
int nStat = GDB_ST_ON ;
|
||||||
if ( pGeoObj->GetType() != SRF_TRIMESH && pGeoObj->GetType() != SRF_FLATRGN)
|
iIter.GetCalcStatus( nStat) ;
|
||||||
return true ;
|
int nType = iIter.GetGdbType() ;
|
||||||
// recupero il riferimento globale dell'oggetto
|
// se il filtro lo abilita
|
||||||
Frame3d frFrame ;
|
if ( TestFilter( nLev, nMode, nStat, nType == GDB_TY_GROUP)) {
|
||||||
if ( ! iIter.GetGlobFrame( frFrame))
|
switch ( iIter.GetGdbType()) {
|
||||||
return false ;
|
case GDB_TY_GEO :
|
||||||
// recupero il livello dell'oggetto
|
{
|
||||||
int nLev = GDB_LV_USER ;
|
// recupero l'oggetto geometrico
|
||||||
iIter.GetCalcLevel( nLev) ;
|
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||||
// recupero il modo dell'oggetto
|
if ( pGeoObj == nullptr)
|
||||||
int nMode = GDB_MD_STD ;
|
return true ;
|
||||||
iIter.GetCalcMode( nMode) ;
|
// se non è una superficie esco
|
||||||
// recupero lo stato dell'oggetto
|
if ( pGeoObj->GetType() != SRF_TRIMESH && pGeoObj->GetType() != SRF_FLATRGN)
|
||||||
int nStat = GDB_ST_ON ;
|
return true ;
|
||||||
iIter.GetCalcStatus( nStat) ;
|
// recupero il riferimento globale dell'oggetto
|
||||||
// se il filtro lo abilita
|
Frame3d frFrame ;
|
||||||
if ( TestFilter( nLev, nMode, nStat)) {
|
if ( ! iIter.GetGlobFrame( frFrame))
|
||||||
|
return false ;
|
||||||
// recupero eventuale nome
|
// recupero eventuale nome
|
||||||
string sName ;
|
string sName ;
|
||||||
if ( ! iIter.GetName( sName))
|
if ( ! iIter.GetName( sName))
|
||||||
@@ -156,7 +158,7 @@ Export3MF::ExportObject( const IGdbIterator& iIter)
|
|||||||
// recupero il colore
|
// recupero il colore
|
||||||
Color cCol ;
|
Color cCol ;
|
||||||
bool bCol = GetColor( cCol, iIter.GetGDB(), iIter.GetId()) ;
|
bool bCol = GetColor( cCol, iIter.GetGDB(), iIter.GetId()) ;
|
||||||
// recupero le proprietà
|
// recupero le proprietà
|
||||||
STRVECTOR vInfo ;
|
STRVECTOR vInfo ;
|
||||||
iIter.GetAllInfo( vInfo) ;
|
iIter.GetAllInfo( vInfo) ;
|
||||||
// emetto l'oggetto
|
// emetto l'oggetto
|
||||||
@@ -172,37 +174,69 @@ Export3MF::ExportObject( const IGdbIterator& iIter)
|
|||||||
default :
|
default :
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return true ;
|
||||||
return true ;
|
case GDB_TY_GROUP :
|
||||||
case GDB_TY_GROUP :
|
// esploro il gruppo
|
||||||
// esploro il gruppo
|
return ScanGroup( iIter) ;
|
||||||
return ScanGroup( iIter) ;
|
default :
|
||||||
default :
|
return false ;
|
||||||
return false ;
|
}
|
||||||
}
|
}
|
||||||
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
Export3MF::TestFilter( int nLev, int nMode, int nStat)
|
Export3MF::TestFilter( int nLev, int nMode, int nStat, bool bGroup)
|
||||||
{
|
{
|
||||||
if ( ( nLev == GDB_LV_USER && ( m_nFilter & EEXFLT_LEVUSER) == 0) ||
|
int nFilter = bGroup ? m_nGroupFilter : m_nFilter ;
|
||||||
( nLev == GDB_LV_SYSTEM && ( m_nFilter & EEXFLT_LEVSYSTEM) == 0) ||
|
if ( ( nLev == GDB_LV_USER && ( nFilter & EEXFLT_LEVUSER) == 0) ||
|
||||||
( nLev == GDB_LV_TEMP && ( m_nFilter & EEXFLT_LEVTEMP) == 0))
|
( nLev == GDB_LV_SYSTEM && ( nFilter & EEXFLT_LEVSYSTEM) == 0) ||
|
||||||
|
( nLev == GDB_LV_TEMP && ( nFilter & EEXFLT_LEVTEMP) == 0))
|
||||||
return false ;
|
return false ;
|
||||||
if ( ( nMode == GDB_MD_STD && ( m_nFilter & EEXFLT_MODESTD) == 0) ||
|
if ( ( nMode == GDB_MD_STD && ( nFilter & EEXFLT_MODESTD) == 0) ||
|
||||||
( nMode == GDB_MD_LOCKED && ( m_nFilter & EEXFLT_MODELOCKED) == 0) ||
|
( nMode == GDB_MD_LOCKED && ( nFilter & EEXFLT_MODELOCKED) == 0) ||
|
||||||
( nMode == GDB_MD_HIDDEN && ( m_nFilter & EEXFLT_MODEHIDDEN) == 0))
|
( nMode == GDB_MD_HIDDEN && ( nFilter & EEXFLT_MODEHIDDEN) == 0))
|
||||||
return false ;
|
return false ;
|
||||||
if ( ( nStat == GDB_ST_OFF && ( m_nFilter & EEXFLT_STAOFF) == 0) ||
|
if ( ( nStat == GDB_ST_OFF && ( nFilter & EEXFLT_STAOFF) == 0) ||
|
||||||
( nStat == GDB_ST_ON && ( m_nFilter & EEXFLT_STAON) == 0) ||
|
( nStat == GDB_ST_ON && ( nFilter & EEXFLT_STAON) == 0) ||
|
||||||
( nStat == GDB_ST_SEL && ( m_nFilter & EEXFLT_STASEL) == 0))
|
( nStat == GDB_ST_SEL && ( nFilter & EEXFLT_STASEL) == 0))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
Export3MF::CalcGroupFilter( void)
|
||||||
|
{
|
||||||
|
m_nGroupFilter = 0 ;
|
||||||
|
// Status
|
||||||
|
if ( ( m_nFilter & EEXFLT_STASEL) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_STASEL + EEXFLT_STAOFF + EEXFLT_STAON ;
|
||||||
|
else if ( ( m_nFilter & EEXFLT_STAOFF) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_STAOFF + EEXFLT_STAON ;
|
||||||
|
else
|
||||||
|
m_nGroupFilter += EEXFLT_STAON ;
|
||||||
|
// Mode
|
||||||
|
if ( ( m_nFilter & EEXFLT_MODELOCKED) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_MODELOCKED + EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
|
||||||
|
else if ( ( m_nFilter & EEXFLT_MODEHIDDEN) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
|
||||||
|
else
|
||||||
|
m_nGroupFilter += EEXFLT_MODESTD ;
|
||||||
|
// Level
|
||||||
|
if ( ( m_nFilter & EEXFLT_LEVSYSTEM) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_LEVSYSTEM + EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
|
||||||
|
else if ( ( m_nFilter & EEXFLT_LEVTEMP) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
|
||||||
|
else
|
||||||
|
m_nGroupFilter += EEXFLT_LEVUSER ;
|
||||||
|
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
Export3MF::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, const STRVECTOR& vInfo)
|
Export3MF::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, const STRVECTOR& vInfo)
|
||||||
@@ -241,7 +275,7 @@ Export3MF::ExportSTM( const string& sName, const IGeoObj* pGeoObj, const Frame3d
|
|||||||
int k = 0 ;
|
int k = 0 ;
|
||||||
for ( int i = 0 ; i < pSTM->GetTriangleSize() ; i++) {
|
for ( int i = 0 ; i < pSTM->GetTriangleSize() ; i++) {
|
||||||
int nIdVert[3] ;
|
int nIdVert[3] ;
|
||||||
// se il triangolo non è valido passo al successivo
|
// se il triangolo non è valido passo al successivo
|
||||||
if ( ! pSTM->GetTriangle( i, nIdVert))
|
if ( ! pSTM->GetTriangle( i, nIdVert))
|
||||||
continue ;
|
continue ;
|
||||||
// assegno gli indici dei vertici
|
// assegno gli indici dei vertici
|
||||||
@@ -325,7 +359,7 @@ Export3MF::ColorHandler3MF( const Color* pCol)
|
|||||||
// converto il colore nel formato usato da 3MF
|
// converto il colore nel formato usato da 3MF
|
||||||
Lib3MF_uint8 nAlpha = ( int)( pCol->GetIntAlpha() * 2.55 + 0.5) ;
|
Lib3MF_uint8 nAlpha = ( int)( pCol->GetIntAlpha() * 2.55 + 0.5) ;
|
||||||
sColor cCol3mf = m_wrapper->RGBAToColor( pCol->GetIntRed(), pCol->GetIntGreen(), pCol->GetIntBlue(), nAlpha) ;
|
sColor cCol3mf = m_wrapper->RGBAToColor( pCol->GetIntRed(), pCol->GetIntGreen(), pCol->GetIntBlue(), nAlpha) ;
|
||||||
// verifico se il colore è già presente nel colorgroup
|
// verifico se il colore � gi� presente nel colorgroup
|
||||||
UINTVECTOR vColorIdx ;
|
UINTVECTOR vColorIdx ;
|
||||||
pColorGrp->GetAllPropertyIDs( vColorIdx) ;
|
pColorGrp->GetAllPropertyIDs( vColorIdx) ;
|
||||||
for ( Lib3MF_uint32 i : vColorIdx) {
|
for ( Lib3MF_uint32 i : vColorIdx) {
|
||||||
|
|||||||
+8
-4
@@ -27,12 +27,15 @@ class Export3MF : public IExport3MF
|
|||||||
virtual bool Export( IGeomDB* pGDB, int nId, const std::string& sFile) ;
|
virtual bool Export( IGeomDB* pGDB, int nId, const std::string& sFile) ;
|
||||||
|
|
||||||
public :
|
public :
|
||||||
Export3MF( void) : m_nFilter( EEXFLT_DEFAULT) {}
|
Export3MF( void) : m_nFilter( EEXFLT_DEFAULT) {
|
||||||
|
CalcGroupFilter() ;
|
||||||
|
}
|
||||||
|
|
||||||
private :
|
private :
|
||||||
bool ExportObject( const IGdbIterator& iIter) ;
|
bool ExportObject( const IGdbIterator& iIter) ;
|
||||||
bool ScanGroup( const IGdbIterator& iIter) ;
|
bool ScanGroup( const IGdbIterator& iIter) ;
|
||||||
bool TestFilter( int nLev, int nMode, int nStat) ;
|
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup) ;
|
||||||
|
bool CalcGroupFilter( void) ;
|
||||||
bool ExportSFR( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol,
|
bool ExportSFR( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol,
|
||||||
const STRVECTOR& vInfo) ;
|
const STRVECTOR& vInfo) ;
|
||||||
bool ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol,
|
bool ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol,
|
||||||
@@ -41,7 +44,8 @@ class Export3MF : public IExport3MF
|
|||||||
bool GetColor( Color& pCol, const IGeomDB * pGBD, const int& nId) ;
|
bool GetColor( Color& pCol, const IGeomDB * pGBD, const int& nId) ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
int m_nFilter ; // filtro su livello, modo e stato
|
int m_nFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare � un oggetto geometrico
|
||||||
|
int m_nGroupFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare � un gruppo
|
||||||
Lib3MF::PWrapper m_wrapper ; // lib3mf wrapper
|
Lib3MF::PWrapper m_wrapper ; // lib3mf wrapper
|
||||||
Lib3MF::PModel m_model ; // lib3mf model
|
Lib3MF::PModel m_model ; // lib3mf model
|
||||||
} ;
|
} ;
|
||||||
-732
@@ -1,732 +0,0 @@
|
|||||||
//----------------------------------------------------------------------------
|
|
||||||
// EgalTech 2023
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// File : Export3dm.cpp Data : 21.09.23 Versione :
|
|
||||||
// Contenuto : Implementazione della classe per l'esportazione in formato 3dm.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Modifiche : 21.09.23 DB Creazione modulo.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//--------------------------- Include ----------------------------------------
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "Export3dm.h"
|
|
||||||
#include "DllMain.h"
|
|
||||||
#include "/EgtDev/Include/EExDllMain.h"
|
|
||||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
|
||||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
|
||||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
|
||||||
#include "/EgtDev/Include/EGkSurfBezier.h"
|
|
||||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
|
||||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
|
||||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
|
||||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
|
||||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
|
||||||
#include "/EgtDev/Include/EGkGeoObjType.h"
|
|
||||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
|
||||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
|
||||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
|
||||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
|
||||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
|
||||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
|
||||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
|
||||||
#include "/EgtDev/Extern/opennurbs/Include/opennurbs.h"
|
|
||||||
#include <fstream>
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
|
|
||||||
using namespace std ;
|
|
||||||
//N.B.:
|
|
||||||
// se si vuole richiamare qualche variabile di default definita in una classe come statica e a cui viene assegnato un valore
|
|
||||||
// nel file opennurbs_statics.cpp bisogna richiamarla in questo elenco per evitare problemi di compilazione ( errore di LINK)
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
IExport3dm*
|
|
||||||
CreateExport3dm( void)
|
|
||||||
{
|
|
||||||
// verifico la chiave e le opzioni
|
|
||||||
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
|
|
||||||
return nullptr ;
|
|
||||||
// creo l'oggetto
|
|
||||||
return static_cast<IExport3dm*> ( new( nothrow) Export3dm) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
Export3dm::SetOptions( int nFilter)
|
|
||||||
{
|
|
||||||
m_nFilter = nFilter ;
|
|
||||||
CalcGroupFilter() ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static void
|
|
||||||
Internal_SetExampleModelProperties( ONX_Model& model, const char* source_file_name)
|
|
||||||
{
|
|
||||||
const bool bHaveFileName = ( nullptr != source_file_name && 0 != source_file_name[0]) ;
|
|
||||||
if ( ! bHaveFileName)
|
|
||||||
source_file_name = "" ;
|
|
||||||
|
|
||||||
model.m_sStartSectionComments = "This file was created using openNURBS to convert an .nge into .3dm" ;
|
|
||||||
|
|
||||||
// set application information
|
|
||||||
const ON_wString wide_source_file_name( source_file_name) ;
|
|
||||||
|
|
||||||
model.m_properties.m_Application.m_application_URL = L"http://www.opennurbs.org" ;
|
|
||||||
|
|
||||||
// set revision history information
|
|
||||||
model.m_properties.m_RevisionHistory.NewRevision() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
Export3dm::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
|
||||||
{
|
|
||||||
Internal_SetExampleModelProperties( m_model, sFile.c_str()) ;
|
|
||||||
ON::Begin() ;
|
|
||||||
// verifico il DB geometrico
|
|
||||||
if ( pGDB == nullptr) {
|
|
||||||
LOG_ERROR( GetEExLogger(), "Export3dm : Error on GeomDB")
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// verifico l'Id dell'oggetto da esportare
|
|
||||||
if ( ! pGDB->ExistsObj( nId)) {
|
|
||||||
LOG_ERROR( GetEExLogger(), "Export3dm : Error on Id")
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//// file settings ( units, tolerances, views, ...)
|
|
||||||
//// OPTIONAL - change values from defaults
|
|
||||||
m_model.m_settings.m_ModelUnitsAndTolerances.m_unit_system = ON::LengthUnitSystem::Millimeters ;
|
|
||||||
m_model.m_settings.m_ModelUnitsAndTolerances.m_absolute_tolerance = 0.01 ;
|
|
||||||
m_model.m_settings.m_ModelUnitsAndTolerances.m_angle_tolerance = ON_PI/180.0 ;// radians
|
|
||||||
m_model.m_settings.m_ModelUnitsAndTolerances.m_relative_tolerance = 0.01 ;// 1%
|
|
||||||
m_model.m_settings.m_current_material_source = ON::object_material_source::material_from_object ;
|
|
||||||
m_model.m_settings.m_RenderSettings.m_bFlatShade = true ;
|
|
||||||
|
|
||||||
// creo un iteratore
|
|
||||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( pGDB)) ;
|
|
||||||
if ( IsNull( pIter))
|
|
||||||
return false ;
|
|
||||||
pIter->GoTo( nId) ;
|
|
||||||
// esporto l'oggetto e i suoi eventuali figli
|
|
||||||
bool bOk = ExportObject( *pIter, 0) ;
|
|
||||||
|
|
||||||
// stampo il file
|
|
||||||
int version = 7 ;
|
|
||||||
// errors printed to stdout
|
|
||||||
ON_TextLog error_log ;
|
|
||||||
// writes model to archive
|
|
||||||
bOk = bOk && m_model.Write( ConvertString( sFile).c_str(), version, &error_log) ;
|
|
||||||
|
|
||||||
ON::End() ;
|
|
||||||
|
|
||||||
return bOk ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
Export3dm::ExportObject( const IGdbIterator& iIter, const int& nLayer)
|
|
||||||
{
|
|
||||||
// recupero il livello dell'oggetto
|
|
||||||
int nLev = GDB_LV_USER ;
|
|
||||||
iIter.GetCalcLevel( nLev) ;
|
|
||||||
// recupero il modo dell'oggetto
|
|
||||||
int nMode = GDB_MD_STD ;
|
|
||||||
iIter.GetCalcMode( nMode) ;
|
|
||||||
// recupero lo stato dell'oggetto
|
|
||||||
int nStat = GDB_ST_ON ;
|
|
||||||
iIter.GetCalcStatus( nStat) ;
|
|
||||||
int nType = iIter.GetGdbType() ;
|
|
||||||
// se il filtro lo abilita
|
|
||||||
if ( TestFilter( nLev, nMode, nStat, nType == GDB_TY_GROUP)) {
|
|
||||||
switch ( nType) {
|
|
||||||
case GDB_TY_GEO :
|
|
||||||
{
|
|
||||||
// recupero il riferimento globale dell'oggetto
|
|
||||||
Frame3d frFrame ;
|
|
||||||
if ( ! iIter.GetGlobFrame( frFrame))
|
|
||||||
return false ;
|
|
||||||
//recupero il colore dell'oggetto
|
|
||||||
Color cCol ;
|
|
||||||
iIter.GetCalcMaterial( cCol) ;
|
|
||||||
// recupero eventuale nome
|
|
||||||
string sName ;
|
|
||||||
if ( ! iIter.GetName( sName))
|
|
||||||
sName = ToString( iIter.GetId()) ;
|
|
||||||
// emetto l'oggetto
|
|
||||||
switch ( iIter.GetGeoType()) {
|
|
||||||
case GEO_PNT3D: {
|
|
||||||
if ( ! ExportPnt( sName, iIter, frFrame, cCol, nLayer))
|
|
||||||
return false ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
case SRF_BEZIER: {
|
|
||||||
if ( ! ExportSrfBz( sName, iIter, frFrame, cCol, nLayer))
|
|
||||||
return false ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
case SRF_FLATRGN :
|
|
||||||
case SRF_TRIMESH :
|
|
||||||
if ( ! ExportSTM( sName, iIter, frFrame, cCol, nLayer))
|
|
||||||
return false ;
|
|
||||||
break ;
|
|
||||||
case CRV_ARC : {
|
|
||||||
if ( ! ExportCrvArc( sName, iIter, frFrame, cCol, nLayer))
|
|
||||||
return false ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
case CRV_BEZIER : {
|
|
||||||
if ( ! ExportCrvBezier( sName, iIter, frFrame, cCol, nLayer))
|
|
||||||
return false ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
case CRV_COMPO : {
|
|
||||||
if ( ! ExportCrvCompo( sName, iIter, frFrame, cCol, nLayer))
|
|
||||||
return false ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
case CRV_LINE : {
|
|
||||||
if ( ! ExportCrvLine( sName, iIter, frFrame, cCol, nLayer))
|
|
||||||
return false ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
default :
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true ;
|
|
||||||
case GDB_TY_GROUP: {
|
|
||||||
int nLayer = iIter.GetId() ;
|
|
||||||
if ( nLayer == 0) {
|
|
||||||
m_model.RemoveModelComponent( ON_ModelComponent::Type::Layer, m_model.LayerFromIndex( 0).ModelComponentId()) ;
|
|
||||||
return ScanGroup( iIter, nLayer) ;
|
|
||||||
}
|
|
||||||
// creo il layer e setto le proprietà
|
|
||||||
ON_Layer* layer = new ON_Layer() ;
|
|
||||||
std::string sLayName ;
|
|
||||||
iIter.GetName( sLayName) ;
|
|
||||||
if ( sLayName == "" ) {
|
|
||||||
sLayName = "Layer " + ToString( nLayer) ;
|
|
||||||
}
|
|
||||||
layer->SetName( ConvertString( sLayName).c_str()) ;
|
|
||||||
layer->SetIndex( nLayer) ;
|
|
||||||
ON_Color onCol( 0, 0, 0) ; // black
|
|
||||||
layer->SetColor( onCol) ;
|
|
||||||
layer->SetVisible( true) ;
|
|
||||||
layer->SetLocked( false) ;
|
|
||||||
int nParent = iIter.GetParentId() ;
|
|
||||||
if ( nParent != 0) {
|
|
||||||
// setto il parent
|
|
||||||
const ON_Layer* onParLay = ON_Layer::Cast( m_model.LayerFromIndex( m_mLayer[nParent]).ModelComponent()) ;
|
|
||||||
layer->SetParentLayerId( onParLay->Id()) ;
|
|
||||||
}
|
|
||||||
// copio le info
|
|
||||||
STRVECTOR vStrInfo, vStrInfo_split ;
|
|
||||||
iIter.GetAllInfo( vStrInfo) ;
|
|
||||||
for ( string sInfo : vStrInfo) {
|
|
||||||
Tokenize( sInfo, "=", vStrInfo_split) ;
|
|
||||||
layer->SetUserString( ConvertString( vStrInfo_split[0]).c_str(), ConvertString( vStrInfo_split[1]).c_str()) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// aggiungo il layer
|
|
||||||
ON_ModelComponentReference mcr = m_model.AddManagedModelComponent( layer) ;
|
|
||||||
int nIndex = mcr.ModelComponentIndex() ;
|
|
||||||
m_mLayer.insert( pair< int, int>( nLayer, nIndex)) ;
|
|
||||||
|
|
||||||
// esploro il gruppo
|
|
||||||
return ScanGroup( iIter, nIndex) ;
|
|
||||||
}
|
|
||||||
default :
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
Export3dm::AddObjectToModel( const IGdbIterator& iIter, ON_Object* onObject, const int& nLayer, const std::string& sName, const Color& cCol,
|
|
||||||
ON_3dmObjectAttributes* pOnAttr)
|
|
||||||
{
|
|
||||||
if ( pOnAttr == nullptr)
|
|
||||||
pOnAttr = new ON_3dmObjectAttributes() ;
|
|
||||||
pOnAttr->m_layer_index = nLayer ;
|
|
||||||
pOnAttr->m_name = ConvertString( sName).c_str() ;
|
|
||||||
pOnAttr->SetColorSource( ON::color_from_object) ;
|
|
||||||
//N.B. RHINO ha i valori di Alpha invertiti rispetto ai nostri, oltre che su una scala diversa! per loro 0 = opaco e 255 = trasparente
|
|
||||||
// per noi invece 0 = trasparente, 100 = opaco
|
|
||||||
ON_Color onCol( cCol.GetIntRed(), cCol.GetIntGreen(), cCol.GetIntBlue(), abs( int( cCol.GetIntAlpha() * 2.55) - 255)) ;
|
|
||||||
pOnAttr->m_color = onCol ;
|
|
||||||
// se è una mesh aggiungo il materiale
|
|
||||||
if ( const ON_Mesh* onMesh = ON_Mesh::Cast( onObject)) {
|
|
||||||
// aggiungo il materiale al modello se necessario
|
|
||||||
std::string sCol = ToString(cCol.GetIntRed()) + "," + ToString( cCol.GetIntGreen()) + "," + ToString( cCol.GetIntBlue()) ;
|
|
||||||
if ( m_mMaterial.find( sCol) == m_mMaterial.end()) {
|
|
||||||
ON_Material* onMat = new ON_Material ;
|
|
||||||
ON_Color onCAmb( 126, 126, 126) ; // gray126
|
|
||||||
onMat->m_reflection_glossiness = 0.0 ;
|
|
||||||
onMat->SetEmission( onCol) ;
|
|
||||||
onMat->SetDiffuse( onCol) ;
|
|
||||||
onMat->SetAmbient( onCAmb) ;
|
|
||||||
onMat->SetReflectivity( 0) ;
|
|
||||||
ON_ModelComponentReference mcr = m_model.AddManagedModelComponent( onMat) ;
|
|
||||||
int nIndex = mcr.ModelComponentIndex() ;
|
|
||||||
m_mMaterial.insert( pair< std::string, int>( sCol, nIndex)) ;
|
|
||||||
pOnAttr->SetMaterialSource( ON::object_material_source::material_from_object) ;
|
|
||||||
pOnAttr->m_material_index = nIndex ;
|
|
||||||
}
|
|
||||||
// sennò richiamo un materiale già definito
|
|
||||||
else {
|
|
||||||
pOnAttr->SetMaterialSource( ON::object_material_source::material_from_object) ;
|
|
||||||
pOnAttr->m_material_index = m_mMaterial[sCol] ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// copio le info
|
|
||||||
STRVECTOR vStrInfo, vStrInfo_split ;
|
|
||||||
iIter.GetAllInfo(vStrInfo) ;
|
|
||||||
for ( string sInfo : vStrInfo) {
|
|
||||||
Tokenize( sInfo, "=", vStrInfo_split) ;
|
|
||||||
pOnAttr->SetUserString( ConvertString( vStrInfo_split[0]).c_str(), ConvertString( vStrInfo_split[1]).c_str()) ;
|
|
||||||
}
|
|
||||||
// aggiungo al modello
|
|
||||||
ON_ModelComponentReference mcr = m_model.AddManagedModelGeometryComponent( onObject, pOnAttr) ;
|
|
||||||
return ! mcr.IsEmpty() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
Export3dm::AddInfoToObject( const IGdbIterator& iIter, ON_Object* onObject)
|
|
||||||
{
|
|
||||||
// copio le info
|
|
||||||
STRVECTOR vStrInfo, vStrInfo_split ;
|
|
||||||
iIter.GetAllInfo( vStrInfo) ;
|
|
||||||
for ( string sInfo : vStrInfo) {
|
|
||||||
Tokenize( sInfo, "=", vStrInfo_split) ;
|
|
||||||
onObject->SetUserString( ConvertString( vStrInfo_split[0]).c_str(), ConvertString( vStrInfo_split[1]).c_str()) ;
|
|
||||||
}
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
wstring
|
|
||||||
Export3dm::ConvertString( const std::string& sName)
|
|
||||||
{
|
|
||||||
wstring ws = wstring( sName.begin(), sName.end()) ;
|
|
||||||
return ws ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
ON_3dPoint
|
|
||||||
Export3dm::ConvertPoint( const Point3d& pt)
|
|
||||||
{
|
|
||||||
ON_3dPoint onPt( pt.x, pt.y, pt.z) ;
|
|
||||||
return onPt ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
ON_3dVector
|
|
||||||
Export3dm::ConvertVector( const Vector3d& vt)
|
|
||||||
{
|
|
||||||
ON_3dVector onVt( vt.x, vt.y, vt.z) ;
|
|
||||||
return onVt ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
Export3dm::TestFilter( int nLev, int nMode, int nStat, bool bGroup)
|
|
||||||
{
|
|
||||||
int nFilter = bGroup ? m_nGroupFilter : m_nFilter ;
|
|
||||||
if ( ( nLev == GDB_LV_USER && ( nFilter & EEXFLT_LEVUSER) == 0) ||
|
|
||||||
( nLev == GDB_LV_SYSTEM && ( nFilter & EEXFLT_LEVSYSTEM) == 0) ||
|
|
||||||
( nLev == GDB_LV_TEMP && ( nFilter & EEXFLT_LEVTEMP) == 0))
|
|
||||||
return false ;
|
|
||||||
if ( ( nMode == GDB_MD_STD && ( nFilter & EEXFLT_MODESTD) == 0) ||
|
|
||||||
( nMode == GDB_MD_LOCKED && ( nFilter & EEXFLT_MODELOCKED) == 0) ||
|
|
||||||
( nMode == GDB_MD_HIDDEN && ( nFilter & EEXFLT_MODEHIDDEN) == 0))
|
|
||||||
return false ;
|
|
||||||
if ( ( nStat == GDB_ST_OFF && ( nFilter & EEXFLT_STAOFF) == 0) ||
|
|
||||||
( nStat == GDB_ST_ON && ( nFilter & EEXFLT_STAON) == 0) ||
|
|
||||||
( nStat == GDB_ST_SEL && ( nFilter & EEXFLT_STASEL) == 0))
|
|
||||||
return false ;
|
|
||||||
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
Export3dm::CalcGroupFilter( void)
|
|
||||||
{
|
|
||||||
m_nGroupFilter = 0 ;
|
|
||||||
// Status
|
|
||||||
if ( ( m_nFilter & EEXFLT_STASEL) != 0)
|
|
||||||
m_nGroupFilter += EEXFLT_STASEL + EEXFLT_STAOFF + EEXFLT_STAON ;
|
|
||||||
else if ( ( m_nFilter & EEXFLT_STAOFF) != 0)
|
|
||||||
m_nGroupFilter += EEXFLT_STAOFF + EEXFLT_STAON ;
|
|
||||||
else
|
|
||||||
m_nGroupFilter += EEXFLT_STAON ;
|
|
||||||
// Mode
|
|
||||||
if ( ( m_nFilter & EEXFLT_MODELOCKED) != 0)
|
|
||||||
m_nGroupFilter += EEXFLT_MODELOCKED + EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
|
|
||||||
else if ( ( m_nFilter & EEXFLT_MODEHIDDEN) != 0)
|
|
||||||
m_nGroupFilter += EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
|
|
||||||
else
|
|
||||||
m_nGroupFilter += EEXFLT_MODESTD ;
|
|
||||||
// Level
|
|
||||||
if ( ( m_nFilter & EEXFLT_LEVSYSTEM) != 0)
|
|
||||||
m_nGroupFilter += EEXFLT_LEVSYSTEM + EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
|
|
||||||
else if ( ( m_nFilter & EEXFLT_LEVTEMP) != 0)
|
|
||||||
m_nGroupFilter += EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
|
|
||||||
else
|
|
||||||
m_nGroupFilter += EEXFLT_LEVUSER ;
|
|
||||||
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
Export3dm::ExportPnt(const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
|
|
||||||
{
|
|
||||||
// recupero l'oggetto geometrico
|
|
||||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
|
||||||
if ( pGeoObj == nullptr)
|
|
||||||
return false ;
|
|
||||||
// verifico oggetto
|
|
||||||
PtrOwner<IGeoPoint3d> pGeoPnt( GetGeoPoint3d( pGeoObj->Clone())) ;
|
|
||||||
if ( IsNull( pGeoPnt))
|
|
||||||
return false ;
|
|
||||||
// lo porto nel riferimento globale
|
|
||||||
pGeoPnt->ToGlob( frFrame) ;
|
|
||||||
Point3d pt = pGeoPnt->GetPoint() ;
|
|
||||||
ON_Point* onPt = new ON_Point( ConvertPoint( pt)) ;
|
|
||||||
// aggiungo l'oggetto al modello
|
|
||||||
return AddObjectToModel( iIter, onPt, nLayer, sName, cCol) ; ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
Export3dm::ExportSrfBz( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
|
|
||||||
{
|
|
||||||
|
|
||||||
//MANCA DA IMPLEMENTARE IL TRIM DELLE SUPERFICI!!/////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// recupero l'oggetto geometrico
|
|
||||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
|
||||||
if ( pGeoObj == nullptr)
|
|
||||||
return false ;
|
|
||||||
// verifico oggetto
|
|
||||||
PtrOwner<ISurfBezier> pSrfBz( GetSurfBezier( pGeoObj->Clone())) ;
|
|
||||||
if ( IsNull( pSrfBz))
|
|
||||||
return false ;
|
|
||||||
// lo porto nel riferimento globale
|
|
||||||
pSrfBz->ToGlob( frFrame) ;
|
|
||||||
bool bOk = true ;
|
|
||||||
int nDegU, nDegV, nSpanU, nSpanV ;
|
|
||||||
bool bRat = false ;
|
|
||||||
bool bTrimmed = false ;
|
|
||||||
pSrfBz->GetInfo( nDegU, nDegV, nSpanU, nSpanV, bRat, bTrimmed) ;
|
|
||||||
int nCPU = nDegU * nSpanU + 1 ;
|
|
||||||
int nCPV = nDegV * nSpanV + 1 ;
|
|
||||||
ON_NurbsSurface* onNurbsSurf = new ON_NurbsSurface( 3, bRat, nDegU + 1, nDegV + 1, nCPU, nCPV) ;
|
|
||||||
for ( int u = 0 ; u < nCPU ; ++u) {
|
|
||||||
for ( int v = 0 ; v < nCPV ; ++v) {
|
|
||||||
Point3d ptCV = pSrfBz->GetControlPoint( u, v, &bOk) ;
|
|
||||||
if ( ! bRat) {
|
|
||||||
onNurbsSurf->SetCV( u, v, ConvertPoint( ptCV)) ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
double dW = pSrfBz->GetControlWeight( u, v, &bOk) ;
|
|
||||||
onNurbsSurf->SetCV( u, v, ConvertPoint( ptCV * dW)) ;
|
|
||||||
onNurbsSurf->SetWeight( u, v, dW) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// imposto il vettore dei nodi in U
|
|
||||||
int nKnotCountU = nDegU + nCPU - 1 ;
|
|
||||||
double dKnot = 0 ;
|
|
||||||
// per costruzione nKnotCount é un multiplo di nDegU
|
|
||||||
for ( int u = 0 ; u < int ( nKnotCountU / nDegU) ; ++u) {
|
|
||||||
for ( int p = 0 ; p < nDegU ; ++p)
|
|
||||||
onNurbsSurf->SetKnot( 0, u * nDegU + p, dKnot) ;
|
|
||||||
++dKnot ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// imposto il vettore dei nodi in V
|
|
||||||
int nKnotCountV = nDegV + nCPV - 1 ;
|
|
||||||
dKnot = 0 ;
|
|
||||||
// per costruzione nKnotCount é un multiplo di nDegU
|
|
||||||
for ( int v = 0 ; v < int ( nKnotCountV / nDegV) ; ++v) {
|
|
||||||
for ( int p = 0 ; p < nDegV ; ++p)
|
|
||||||
onNurbsSurf->SetKnot( 0, v * nDegV + p, dKnot) ;
|
|
||||||
++dKnot ;
|
|
||||||
}
|
|
||||||
// aggiungo l'oggetto al modello
|
|
||||||
return AddObjectToModel( iIter, onNurbsSurf, nLayer, sName, cCol) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
Export3dm::ExportSTM( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
|
|
||||||
{
|
|
||||||
// recupero l'oggetto geometrico
|
|
||||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
|
||||||
if ( pGeoObj == nullptr)
|
|
||||||
return false ;
|
|
||||||
// verifico oggetto
|
|
||||||
PtrOwner<ISurfTriMesh> pSrfTm ;
|
|
||||||
if ( pGeoObj->GetType() == SRF_TRIMESH)
|
|
||||||
pSrfTm.Set( GetSurfTriMesh( pGeoObj->Clone())) ;
|
|
||||||
else {
|
|
||||||
const ISurfFlatRegion* pSrfFr = GetSurfFlatRegion( pGeoObj) ;
|
|
||||||
const ISurfTriMesh* pSrfTm_ = pSrfFr->GetAuxSurf() ;
|
|
||||||
if ( pSrfTm_ == nullptr){
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
pSrfTm.Set( pSrfTm_->Clone()) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( IsNull( pSrfTm))
|
|
||||||
return false ;
|
|
||||||
|
|
||||||
// lo porto nel frame globale
|
|
||||||
pSrfTm->ToGlob( frFrame) ;
|
|
||||||
|
|
||||||
int nVertices = pSrfTm->GetVertexCount() ;
|
|
||||||
int nTriangles = pSrfTm->GetTriangleCount() ;
|
|
||||||
ON_Mesh* onMesh = new ON_Mesh ;
|
|
||||||
for ( int v = 0 ; v < nVertices ; ++v) {
|
|
||||||
Point3d pt ; pSrfTm->GetVertex( v, pt) ;
|
|
||||||
onMesh->SetVertex( v, ConvertPoint( pt)) ;
|
|
||||||
}
|
|
||||||
for ( int t = 0 ; t < nTriangles ; ++t) {
|
|
||||||
int nIdVert[3] ; pSrfTm->GetTriangle( t, nIdVert) ;
|
|
||||||
onMesh->SetTriangle( t, nIdVert[0], nIdVert[1], nIdVert[2]) ;
|
|
||||||
}
|
|
||||||
// aggiungo l'oggetto al modello
|
|
||||||
return AddObjectToModel( iIter, onMesh, nLayer, sName, cCol) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
ON_ArcCurve*
|
|
||||||
Export3dm::ConvertCrvArc( const ICurveArc* pCrvArc)
|
|
||||||
{
|
|
||||||
double dRad = pCrvArc->GetRadius() ;
|
|
||||||
Point3d ptCen ;
|
|
||||||
pCrvArc->GetCenterPoint( ptCen) ;
|
|
||||||
PtrOwner<ON_ArcCurve> onArcCrv( new ON_ArcCurve()) ;
|
|
||||||
if ( ! pCrvArc->IsACircle()) {
|
|
||||||
Vector3d vtZ = pCrvArc->GetNormVersor() ;
|
|
||||||
Vector3d vtX, vtY ;
|
|
||||||
vtX = pCrvArc->GetStartVersor() ;
|
|
||||||
vtY = vtZ ^ vtX ;
|
|
||||||
double dAngDeg = pCrvArc->GetAngCenter() ;
|
|
||||||
ON_Plane onPlane( ConvertPoint( ptCen), ConvertVector( vtX), ConvertVector( vtY)) ;
|
|
||||||
onArcCrv.Set( new ON_ArcCurve( ON_Arc( onPlane, dRad, dAngDeg * DEGTORAD))) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
onArcCrv.Set( new ON_ArcCurve ( ON_Circle( ConvertPoint( ptCen), dRad))) ;
|
|
||||||
return Release( onArcCrv) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
Export3dm::ExportCrvArc( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
|
|
||||||
{
|
|
||||||
// recupero l'oggetto geometrico
|
|
||||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
|
||||||
if ( pGeoObj == nullptr)
|
|
||||||
return false ;
|
|
||||||
// verifico oggetto
|
|
||||||
PtrOwner<ICurveArc> pCrvArc( GetCurveArc( pGeoObj->Clone())) ;
|
|
||||||
if ( IsNull( pCrvArc))
|
|
||||||
return false ;
|
|
||||||
// lo porto nel fram globale
|
|
||||||
pCrvArc->ToGlob( frFrame) ;
|
|
||||||
ON_ArcCurve* onArcCrv = ConvertCrvArc( pCrvArc) ;
|
|
||||||
if ( onArcCrv == nullptr)
|
|
||||||
return false ;
|
|
||||||
// aggiungo l'oggetto al modello
|
|
||||||
return AddObjectToModel( iIter, onArcCrv, nLayer, sName, cCol) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
ON_NurbsCurve*
|
|
||||||
Export3dm::ConvertCrvBezier( const ICurveBezier* pCrvBz)
|
|
||||||
{
|
|
||||||
// creo l'oggetto da esportare
|
|
||||||
int nDeg = pCrvBz->GetDegree() ;
|
|
||||||
int nCV = nDeg + 1 ;
|
|
||||||
PtrOwner<ON_NurbsCurve> onNurbsCrv( new ON_NurbsCurve( 3, // dim
|
|
||||||
pCrvBz->IsRational(), // bRat
|
|
||||||
nDeg + 1, // order = deg + 1
|
|
||||||
nCV)) ; // numero di CP
|
|
||||||
// imposto i punti di controllo con gli eventuali pesi
|
|
||||||
if ( ! pCrvBz->IsRational()) {
|
|
||||||
bool bOk = true ;
|
|
||||||
for ( int i = 0 ; i < nCV ; ++i) {
|
|
||||||
ON_3dPoint onPt = ConvertPoint( pCrvBz->GetControlPoint( i, &bOk)) ;
|
|
||||||
onNurbsCrv->SetCV( i, onPt) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bool bOk = true ;
|
|
||||||
for ( int i = 0 ; i < nCV ; ++i) {
|
|
||||||
ON_3dPoint onPt = ConvertPoint( pCrvBz->GetControlPoint( i, &bOk)) ;
|
|
||||||
double dWeight = pCrvBz->GetControlWeight( i, &bOk) ;
|
|
||||||
onNurbsCrv->SetCV( i, onPt * dWeight) ;
|
|
||||||
onNurbsCrv->SetWeight( i, dWeight) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// imposto il vettore dei nodi
|
|
||||||
int nKnotCount = nDeg + nCV - 1 ;
|
|
||||||
double dKnot = 0 ;
|
|
||||||
for ( int u = 0 ; u < int ( nKnotCount / nDeg) ; ++u) {
|
|
||||||
for ( int p = 0 ; p < nDeg ; ++p)
|
|
||||||
onNurbsCrv->SetKnot( u * nDeg + p, dKnot) ;
|
|
||||||
++dKnot ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Release( onNurbsCrv) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
Export3dm::ExportCrvBezier( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
|
|
||||||
{
|
|
||||||
// recupero l'oggetto geometrico
|
|
||||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
|
||||||
if ( pGeoObj == nullptr)
|
|
||||||
return false ;
|
|
||||||
// verifico oggetto
|
|
||||||
PtrOwner<ICurveBezier> pCrvBz( GetCurveBezier( pGeoObj->Clone())) ;
|
|
||||||
if ( IsNull( pCrvBz))
|
|
||||||
return false ;
|
|
||||||
// lo porto nel riferimento globale
|
|
||||||
pCrvBz->ToGlob( frFrame) ;
|
|
||||||
ON_NurbsCurve* onNurbsCrv = ConvertCrvBezier( pCrvBz) ;
|
|
||||||
if ( onNurbsCrv == nullptr)
|
|
||||||
return false ;
|
|
||||||
// aggiungo l'oggetto al modello
|
|
||||||
return AddObjectToModel( iIter, onNurbsCrv, nLayer, sName, cCol) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
Export3dm::ExportCrvCompo( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
|
|
||||||
{
|
|
||||||
// recupero l'oggetto geometrico
|
|
||||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
|
||||||
if ( pGeoObj == nullptr)
|
|
||||||
return false ;
|
|
||||||
// verifico oggetto
|
|
||||||
PtrOwner<ICurveComposite> pCrvCompo( GetCurveComposite( pGeoObj->Clone())) ;
|
|
||||||
if ( IsNull( pCrvCompo))
|
|
||||||
return false ;
|
|
||||||
// lo porto nel riferimento globale
|
|
||||||
pCrvCompo->ToGlob( frFrame) ;
|
|
||||||
ON_PolyCurve* onPolyCrv = new ON_PolyCurve ;
|
|
||||||
for ( const ICurve* pCrv = pCrvCompo->GetFirstCurve() ; pCrv != nullptr ; pCrv = pCrvCompo->GetNextCurve()) {
|
|
||||||
GeoObjType type = pCrv->GetType() ;
|
|
||||||
switch ( type) {
|
|
||||||
case CRV_LINE : {
|
|
||||||
PtrOwner<ICurveLine> pCrvL( GetCurveLine( pCrv->Clone())) ;
|
|
||||||
if ( IsNull( pCrvL)) {
|
|
||||||
delete onPolyCrv ;
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
ON_LineCurve* onLine = ConvertCrvLine( pCrvL) ;
|
|
||||||
if ( onLine == nullptr) {
|
|
||||||
delete onPolyCrv ;
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
onPolyCrv->Append( onLine) ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
case CRV_ARC : {
|
|
||||||
PtrOwner<ICurveArc> pCrvArc( GetCurveArc( pCrv->Clone())) ;
|
|
||||||
if ( IsNull( pCrvArc)) {
|
|
||||||
delete onPolyCrv ;
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
ON_ArcCurve* onArcCrv = ConvertCrvArc( pCrvArc) ;
|
|
||||||
if ( onArcCrv == nullptr) {
|
|
||||||
delete onPolyCrv ;
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
onPolyCrv->Append( onArcCrv) ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
case CRV_BEZIER : {
|
|
||||||
PtrOwner<ICurveBezier> pCrvBz( GetCurveBezier( pCrv->Clone())) ;
|
|
||||||
if ( IsNull( pCrvBz)) {
|
|
||||||
delete onPolyCrv ;
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
ON_NurbsCurve* onNurbsCrv = ConvertCrvBezier( pCrvBz) ;
|
|
||||||
if ( onNurbsCrv == nullptr) {
|
|
||||||
delete onPolyCrv ;
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
onPolyCrv->Append( onNurbsCrv) ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
default : break ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// aggiungo l'oggetto al modello
|
|
||||||
return AddObjectToModel( iIter, onPolyCrv, nLayer, sName, cCol) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
ON_LineCurve*
|
|
||||||
Export3dm::ConvertCrvLine( const ICurveLine* pCrvL)
|
|
||||||
{
|
|
||||||
Point3d ptStart, ptEnd ;
|
|
||||||
pCrvL->GetStartPoint( ptStart) ;
|
|
||||||
pCrvL->GetEndPoint( ptEnd) ;
|
|
||||||
PtrOwner<ON_LineCurve> onCrvLine( new ON_LineCurve( ON_Line( ConvertPoint( ptStart), ConvertPoint( ptEnd)))) ;
|
|
||||||
return Release( onCrvLine) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
Export3dm::ExportCrvLine( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
|
|
||||||
{
|
|
||||||
// recupero l'oggetto geometrico
|
|
||||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
|
||||||
if ( pGeoObj == nullptr)
|
|
||||||
return false ;
|
|
||||||
// verifico oggetto
|
|
||||||
PtrOwner<ICurveLine> pCrvL( GetCurveLine( pGeoObj->Clone())) ;
|
|
||||||
if ( IsNull( pCrvL))
|
|
||||||
return false ;
|
|
||||||
// lo porto nel frame globale
|
|
||||||
pCrvL->ToGlob( frFrame) ;
|
|
||||||
ON_LineCurve* onCrvLine = ConvertCrvLine( pCrvL) ;
|
|
||||||
// aggiungo l'oggetto al modello
|
|
||||||
return AddObjectToModel( iIter, onCrvLine, nLayer, sName, cCol) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
Export3dm::ScanGroup( const IGdbIterator& iIter, const int& nLayer)
|
|
||||||
{
|
|
||||||
// creo un iteratore
|
|
||||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( iIter.GetGDB())) ;
|
|
||||||
if ( IsNull( pIter))
|
|
||||||
return false ;
|
|
||||||
// scandisco il gruppo
|
|
||||||
bool bOk = true ;
|
|
||||||
for ( bool bNext = pIter->GoToFirstInGroup( iIter) ;
|
|
||||||
bNext ;
|
|
||||||
bNext = pIter->GoToNext()) {
|
|
||||||
if ( ! ExportObject( *pIter, nLayer))
|
|
||||||
bOk = false ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bOk ;
|
|
||||||
}
|
|
||||||
-79
@@ -1,79 +0,0 @@
|
|||||||
//----------------------------------------------------------------------------
|
|
||||||
// EgalTech 2023
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// File : Export3dm.cpp Data : 21.09.23 Versione :
|
|
||||||
// Contenuto : Dichiarazione della classe ExportStl.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Modifiche : 21.09.23 DB Creazione modulo.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#define NOMINMAX
|
|
||||||
|
|
||||||
#include "/EgtDev/Include/EExExport3dm.h"
|
|
||||||
#include "/EgtDev/Include/EGnWriter.h"
|
|
||||||
#include "/EgtDev/Extern/opennurbs/Include/opennurbs.h"
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
class IGdbIterator ;
|
|
||||||
class IGeoObj ;
|
|
||||||
class Frame3d ;
|
|
||||||
class Point3d ;
|
|
||||||
class ICurveBezier ;
|
|
||||||
class ICurveArc ;
|
|
||||||
class ICurveLine ;
|
|
||||||
class ISurfFlatRegion ;
|
|
||||||
class ON_3dPoint ;
|
|
||||||
class ON_3dVector ;
|
|
||||||
class ON_Object ;
|
|
||||||
class ON_NurbsCurve ;
|
|
||||||
class ON_ArcCurve ;
|
|
||||||
class ON_LineCurve ;
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
class Export3dm : public IExport3dm
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
virtual bool SetOptions( int nFilter) ;
|
|
||||||
virtual bool Export( IGeomDB* pGDB, int nId, const std::string& sFile) ;
|
|
||||||
|
|
||||||
public :
|
|
||||||
Export3dm(void) : m_nFilter(EEXFLT_DEFAULT) {
|
|
||||||
CalcGroupFilter() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
private :
|
|
||||||
bool ExportObject( const IGdbIterator& iIter, const int& nLayer) ;
|
|
||||||
bool AddObjectToModel( const IGdbIterator& iIter, ON_Object* onObject, const int& nLayer, const std::string& sName, const Color& cCol,
|
|
||||||
ON_3dmObjectAttributes* pOnAttr = nullptr) ;
|
|
||||||
bool AddInfoToObject( const IGdbIterator& iIter, ON_Object* onObject) ;
|
|
||||||
bool ScanGroup( const IGdbIterator& iIter, const int& nLayer) ;
|
|
||||||
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup = false) ;
|
|
||||||
std::wstring ConvertString( const std::string& sName) ;
|
|
||||||
ON_3dPoint ConvertPoint( const Point3d& pt) ;
|
|
||||||
ON_3dVector ConvertVector( const Vector3d& vt) ;
|
|
||||||
ON_NurbsCurve* ConvertCrvBezier( const ICurveBezier* pCrvBz) ;
|
|
||||||
ON_ArcCurve* ConvertCrvArc( const ICurveArc* pCrvArc) ;
|
|
||||||
ON_LineCurve* ConvertCrvLine( const ICurveLine* pCrvL) ;
|
|
||||||
bool ExportPnt( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
|
|
||||||
bool ExportSrfBz( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
|
|
||||||
bool ExportSTM( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
|
|
||||||
bool ExportCrvArc( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
|
|
||||||
bool ExportCrvBezier( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
|
|
||||||
bool ExportCrvCompo( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
|
|
||||||
bool ExportCrvLine( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
|
|
||||||
bool CalcGroupFilter( void) ;
|
|
||||||
|
|
||||||
private :
|
|
||||||
int m_nFilter ; // filtro su livello, modo e stato, se l'oggeto da valutare è un oggetto geometrico
|
|
||||||
int m_nGroupFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare è un gruppo
|
|
||||||
Writer m_Writer ; // scrittore di file di testo
|
|
||||||
ONX_Model m_model ; // modello opennurbs
|
|
||||||
std::map<int,int> m_mLayer ; // mappa dei layer <indice layer nge, indice del componente layer nel modello 3dm>
|
|
||||||
std::map<std::string,int> m_mMaterial ; // mappa dei materiali <stringa del colore ( R,G,B), indice del componente material nel modello 3dm>
|
|
||||||
} ;
|
|
||||||
+111
-77
@@ -57,6 +57,7 @@ bool
|
|||||||
ExportDxf::SetOptions( int nFilter, int nFlag)
|
ExportDxf::SetOptions( int nFilter, int nFlag)
|
||||||
{
|
{
|
||||||
m_nFilter = nFilter ;
|
m_nFilter = nFilter ;
|
||||||
|
CalcGroupFilter() ;
|
||||||
m_bCompoundLayer = (( nFlag & EEXFLAG_COMP_LAYER) != 0) ;
|
m_bCompoundLayer = (( nFlag & EEXFLAG_COMP_LAYER) != 0) ;
|
||||||
m_bColorByLayer = (( nFlag & EEXFLAG_COL_BY_LAYER) != 0) ;
|
m_bColorByLayer = (( nFlag & EEXFLAG_COL_BY_LAYER) != 0) ;
|
||||||
m_bAdvancedNames = (( nFlag & EEXFLAG_ADV_NAMES) != 0) ;
|
m_bAdvancedNames = (( nFlag & EEXFLAG_ADV_NAMES) != 0) ;
|
||||||
@@ -100,7 +101,7 @@ ExportDxf::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
|||||||
if ( ! ExportBlocks( pGDB, nId))
|
if ( ! ExportBlocks( pGDB, nId))
|
||||||
bOk = false ;
|
bOk = false ;
|
||||||
|
|
||||||
// scrivo la sezione entità
|
// scrivo la sezione entit�
|
||||||
if ( ! ExportEntities( pGDB, nId))
|
if ( ! ExportEntities( pGDB, nId))
|
||||||
bOk = false ;
|
bOk = false ;
|
||||||
|
|
||||||
@@ -602,7 +603,7 @@ ExportDxf::WriteLayersTable( IGeomDB* pGDB, int nId)
|
|||||||
bool
|
bool
|
||||||
ExportDxf::FindLayers( const IGdbIterator& iIter, const string& sLay, LAYDATVECTOR& vLayDat)
|
ExportDxf::FindLayers( const IGdbIterator& iIter, const string& sLay, LAYDATVECTOR& vLayDat)
|
||||||
{
|
{
|
||||||
// se non è un gruppo, esco subito
|
// se non � un gruppo, esco subito
|
||||||
if ( iIter.GetGdbType() != GDB_TY_GROUP)
|
if ( iIter.GetGdbType() != GDB_TY_GROUP)
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
@@ -616,7 +617,7 @@ ExportDxf::FindLayers( const IGdbIterator& iIter, const string& sLay, LAYDATVECT
|
|||||||
int nStat = GDB_ST_ON ;
|
int nStat = GDB_ST_ON ;
|
||||||
iIter.GetCalcStatus( nStat) ;
|
iIter.GetCalcStatus( nStat) ;
|
||||||
// se il filtro non lo abilita, esco subito
|
// se il filtro non lo abilita, esco subito
|
||||||
if ( ! TestFilter( nLev, nMode, nStat))
|
if ( ! TestFilter( nLev, nMode, nStat, true))
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
// aggiorno nome layer
|
// aggiorno nome layer
|
||||||
@@ -634,7 +635,7 @@ ExportDxf::FindLayers( const IGdbIterator& iIter, const string& sLay, LAYDATVECT
|
|||||||
string s2 = sNewLay ;
|
string s2 = sNewLay ;
|
||||||
if ( ToUpper( s1) == ToUpper( s2)) {
|
if ( ToUpper( s1) == ToUpper( s2)) {
|
||||||
bFound = true ;
|
bFound = true ;
|
||||||
// se è il nome esatto, aggiorno il colore
|
// se � il nome esatto, aggiorno il colore
|
||||||
if ( bExactLay)
|
if ( bExactLay)
|
||||||
vLayDat[i].second = nCol ;
|
vLayDat[i].second = nCol ;
|
||||||
}
|
}
|
||||||
@@ -720,9 +721,9 @@ ExportDxf::WriteStylesTable( IGeomDB* pGDB, int nId)
|
|||||||
bool
|
bool
|
||||||
ExportDxf::FindTextStyles( const IGdbIterator& iIter, STRVECTOR& vFontName)
|
ExportDxf::FindTextStyles( const IGdbIterator& iIter, STRVECTOR& vFontName)
|
||||||
{
|
{
|
||||||
// se è una entità geometrica
|
// se � una entit� geometrica
|
||||||
if ( iIter.GetGdbType() == GDB_TY_GEO) {
|
if ( iIter.GetGdbType() == GDB_TY_GEO) {
|
||||||
// se è un testo
|
// se � un testo
|
||||||
if ( const IExtText* pTXT = GetExtText( iIter.GetGeoObj())) {
|
if ( const IExtText* pTXT = GetExtText( iIter.GetGeoObj())) {
|
||||||
// se font non presente, lo aggiungo al vettore dei font
|
// se font non presente, lo aggiungo al vettore dei font
|
||||||
bool bFound = false ;
|
bool bFound = false ;
|
||||||
@@ -918,7 +919,7 @@ ExportDxf::ExportBlocks( IGeomDB* pGDB, int nId)
|
|||||||
bool
|
bool
|
||||||
ExportDxf::ExportEntities( IGeomDB* pGDB, int nId)
|
ExportDxf::ExportEntities( IGeomDB* pGDB, int nId)
|
||||||
{
|
{
|
||||||
// intestazione sezione entità
|
// intestazione sezione entit�
|
||||||
if ( ! WriteItem( 0, "SECTION") ||
|
if ( ! WriteItem( 0, "SECTION") ||
|
||||||
! WriteItem( 2, "ENTITIES"))
|
! WriteItem( 2, "ENTITIES"))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -932,7 +933,7 @@ ExportDxf::ExportEntities( IGeomDB* pGDB, int nId)
|
|||||||
if ( ! ExportGdbObject( *pIter, LAY_DEFAULT))
|
if ( ! ExportGdbObject( *pIter, LAY_DEFAULT))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// terminazione sezione entità
|
// terminazione sezione entit�
|
||||||
if ( ! WriteItem( 0, "ENDSEC"))
|
if ( ! WriteItem( 0, "ENDSEC"))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
@@ -943,35 +944,36 @@ ExportDxf::ExportEntities( IGeomDB* pGDB, int nId)
|
|||||||
bool
|
bool
|
||||||
ExportDxf::ExportGdbObject( const IGdbIterator& iIter, const string& sLay)
|
ExportDxf::ExportGdbObject( const IGdbIterator& iIter, const string& sLay)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// recupero il livello dell'oggetto
|
||||||
|
int nLev = GDB_LV_USER ;
|
||||||
|
iIter.GetCalcLevel( nLev) ;
|
||||||
|
// recupero il modo dell'oggetto
|
||||||
|
int nMode = GDB_MD_STD ;
|
||||||
|
iIter.GetCalcMode( nMode) ;
|
||||||
|
// recupero lo stato dell'oggetto
|
||||||
|
int nStat = GDB_ST_ON ;
|
||||||
|
iIter.GetCalcStatus( nStat) ;
|
||||||
// recupero il tipo dell'oggetto
|
// recupero il tipo dell'oggetto
|
||||||
int nGdbType = iIter.GetGdbType() ;
|
int nGdbType = iIter.GetGdbType() ;
|
||||||
// se gruppo di oggetti
|
// se il filtro lo abilita
|
||||||
if ( nGdbType == GDB_TY_GROUP) {
|
if ( TestFilter( nLev, nMode, nStat, nGdbType == GDB_TY_GROUP)) {
|
||||||
// esporto il gruppo
|
// se gruppo di oggetti
|
||||||
return ExportGdbGroup( iIter, sLay) ;
|
if ( nGdbType == GDB_TY_GROUP) {
|
||||||
}
|
// esporto il gruppo
|
||||||
// se oggetto geometrico
|
return ExportGdbGroup( iIter, sLay) ;
|
||||||
else if ( nGdbType == GDB_TY_GEO) {
|
}
|
||||||
// recupero l'oggetto geometrico
|
// se oggetto geometrico
|
||||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
else if ( nGdbType == GDB_TY_GEO) {
|
||||||
if ( pGeoObj == nullptr)
|
// recupero l'oggetto geometrico
|
||||||
return true ;
|
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||||
// recupero il riferimento globale dell'oggetto
|
if ( pGeoObj == nullptr)
|
||||||
Frame3d frFrame ;
|
return true ;
|
||||||
if ( ! iIter.GetGlobFrame( frFrame))
|
// recupero il riferimento globale dell'oggetto
|
||||||
return false ;
|
Frame3d frFrame ;
|
||||||
// recupero il livello dell'oggetto
|
if ( ! iIter.GetGlobFrame( frFrame))
|
||||||
int nLev = GDB_LV_USER ;
|
return false ;
|
||||||
iIter.GetCalcLevel( nLev) ;
|
// recupero colore (trasformato in formato ACI)
|
||||||
// recupero il modo dell'oggetto
|
|
||||||
int nMode = GDB_MD_STD ;
|
|
||||||
iIter.GetCalcMode( nMode) ;
|
|
||||||
// recupero lo stato dell'oggetto
|
|
||||||
int nStat = GDB_ST_ON ;
|
|
||||||
iIter.GetCalcStatus( nStat) ;
|
|
||||||
// se il filtro lo abilita
|
|
||||||
if ( TestFilter( nLev, nMode, nStat)) {
|
|
||||||
// recupero colore (trasformato in formato ACI)
|
|
||||||
int nCol = COL_DEFAULT ;
|
int nCol = COL_DEFAULT ;
|
||||||
Color cCol ;
|
Color cCol ;
|
||||||
if ( ( m_bColorByLayer && iIter.GetMaterial( cCol)) ||
|
if ( ( m_bColorByLayer && iIter.GetMaterial( cCol)) ||
|
||||||
@@ -1016,11 +1018,12 @@ ExportDxf::ExportGdbObject( const IGdbIterator& iIter, const string& sLay)
|
|||||||
return false ;
|
return false ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
return true ;
|
||||||
return true ;
|
}
|
||||||
}
|
else
|
||||||
else
|
return false ;
|
||||||
return false ;
|
}
|
||||||
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -1077,7 +1080,7 @@ ExportDxf::ExportLine( const string& sLay, int nCol, const IGeoObj* pGeoObj, con
|
|||||||
const ICurveLine* pLine = GetCurveLine( pGeoObj) ;
|
const ICurveLine* pLine = GetCurveLine( pGeoObj) ;
|
||||||
if ( pLine == nullptr)
|
if ( pLine == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
// scrivo l'entità
|
// scrivo l'entit�
|
||||||
return WriteLine( sLay, nCol, pLine, frFrame) ;
|
return WriteLine( sLay, nCol, pLine, frFrame) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1089,7 +1092,7 @@ ExportDxf::ExportArc( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
|
|||||||
const ICurveArc* pArc = GetCurveArc( pGeoObj) ;
|
const ICurveArc* pArc = GetCurveArc( pGeoObj) ;
|
||||||
if ( pArc == nullptr)
|
if ( pArc == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
// se è un'elica o con estrusione non parallela a N
|
// se � un'elica o con estrusione non parallela a N
|
||||||
if ( ! pArc->IsPlane()) {
|
if ( ! pArc->IsPlane()) {
|
||||||
// esporto come polilinea 3d
|
// esporto come polilinea 3d
|
||||||
return WriteCurve3d( sLay, nCol, pArc, frFrame) ;
|
return WriteCurve3d( sLay, nCol, pArc, frFrame) ;
|
||||||
@@ -1162,9 +1165,9 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
|
|||||||
const ISurfTriMesh* pSTM = GetSurfTriMesh( pGeoObj) ;
|
const ISurfTriMesh* pSTM = GetSurfTriMesh( pGeoObj) ;
|
||||||
if ( pSTM == nullptr)
|
if ( pSTM == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
// posso esportare come unica polymesh solo se il numero dei vertici e dei triangoli è inferiore a 32767
|
// posso esportare come unica polymesh solo se il numero dei vertici e dei triangoli � inferiore a 32767
|
||||||
if ( pSTM->GetVertexCount() < SHRT_MAX && pSTM->GetTriangleCount() < SHRT_MAX) {
|
if ( pSTM->GetVertexCount() < SHRT_MAX && pSTM->GetTriangleCount() < SHRT_MAX) {
|
||||||
// identificativo entità
|
// identificativo entit�
|
||||||
if ( ! WriteItem( 0, "POLYLINE"))
|
if ( ! WriteItem( 0, "POLYLINE"))
|
||||||
return false ;
|
return false ;
|
||||||
// layer
|
// layer
|
||||||
@@ -1173,7 +1176,7 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
|
|||||||
// colore
|
// colore
|
||||||
if ( ! WriteItem( 62, nCol))
|
if ( ! WriteItem( 62, nCol))
|
||||||
return false ;
|
return false ;
|
||||||
// flag segnalazione entità successive dipendenti (vertex)
|
// flag segnalazione entit� successive dipendenti (vertex)
|
||||||
if ( ! WriteItem( 66, 1))
|
if ( ! WriteItem( 66, 1))
|
||||||
return false ;
|
return false ;
|
||||||
// punto inutile ma obbligatorio
|
// punto inutile ma obbligatorio
|
||||||
@@ -1196,7 +1199,7 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
|
|||||||
nId != SVT_NULL ;
|
nId != SVT_NULL ;
|
||||||
nId = pSTM->GetNextVertex( nId, ptP)) {
|
nId = pSTM->GetNextVertex( nId, ptP)) {
|
||||||
ptP.ToGlob( frFrame) ;
|
ptP.ToGlob( frFrame) ;
|
||||||
// entità vertice
|
// entit� vertice
|
||||||
if ( ! WriteItem( 0, "VERTEX"))
|
if ( ! WriteItem( 0, "VERTEX"))
|
||||||
return false ;
|
return false ;
|
||||||
// layer
|
// layer
|
||||||
@@ -1216,7 +1219,7 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
|
|||||||
for ( int nId = pSTM->GetFirstTriangle( nIdVert) ;
|
for ( int nId = pSTM->GetFirstTriangle( nIdVert) ;
|
||||||
nId != SVT_NULL ;
|
nId != SVT_NULL ;
|
||||||
nId = pSTM->GetNextTriangle( nId, nIdVert)) {
|
nId = pSTM->GetNextTriangle( nId, nIdVert)) {
|
||||||
// entità vertice
|
// entit� vertice
|
||||||
if ( ! WriteItem( 0, "VERTEX"))
|
if ( ! WriteItem( 0, "VERTEX"))
|
||||||
return false ;
|
return false ;
|
||||||
// layer
|
// layer
|
||||||
@@ -1239,7 +1242,7 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
|
|||||||
! WriteItem( 73, nIdVert[2] + 1))
|
! WriteItem( 73, nIdVert[2] + 1))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
// entità termine dei vertici
|
// entit� termine dei vertici
|
||||||
if ( ! WriteItem( 0, "SEQEND"))
|
if ( ! WriteItem( 0, "SEQEND"))
|
||||||
return false ;
|
return false ;
|
||||||
// layer
|
// layer
|
||||||
@@ -1255,7 +1258,7 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
|
|||||||
nId != SVT_NULL ;
|
nId != SVT_NULL ;
|
||||||
nId = pSTM->GetNextTriangle( nId, Tria)) {
|
nId = pSTM->GetNextTriangle( nId, Tria)) {
|
||||||
Tria.ToGlob( frFrame) ;
|
Tria.ToGlob( frFrame) ;
|
||||||
// entità 3dface
|
// entit� 3dface
|
||||||
if ( ! WriteItem( 0, "3DFACE"))
|
if ( ! WriteItem( 0, "3DFACE"))
|
||||||
return false ;
|
return false ;
|
||||||
// layer
|
// layer
|
||||||
@@ -1311,7 +1314,7 @@ ExportDxf::ExportText( const string& sLay, int nCol, const IGeoObj* pGeoObj, con
|
|||||||
// ciclo sui diversi testi semplici
|
// ciclo sui diversi testi semplici
|
||||||
bool bOk = true ;
|
bool bOk = true ;
|
||||||
for ( int i = 0 ; i < int( vTxt.size()) ; ++ i) {
|
for ( int i = 0 ; i < int( vTxt.size()) ; ++ i) {
|
||||||
// identificativo entità
|
// identificativo entit�
|
||||||
if ( ! WriteItem( 0, "TEXT"))
|
if ( ! WriteItem( 0, "TEXT"))
|
||||||
return false ;
|
return false ;
|
||||||
// layer
|
// layer
|
||||||
@@ -1354,7 +1357,7 @@ ExportDxf::ExportText( const string& sLay, int nCol, const IGeoObj* pGeoObj, con
|
|||||||
! WriteItem( 220, vtN.y) ||
|
! WriteItem( 220, vtN.y) ||
|
||||||
! WriteItem( 230, vtN.z))
|
! WriteItem( 230, vtN.z))
|
||||||
return false ;
|
return false ;
|
||||||
// libero l'entità
|
// libero l'entit�
|
||||||
delete vTxt[i] ;
|
delete vTxt[i] ;
|
||||||
}
|
}
|
||||||
return bOk ;
|
return bOk ;
|
||||||
@@ -1396,7 +1399,7 @@ ExportDxf::AdjustText( string& sText)
|
|||||||
bool
|
bool
|
||||||
ExportDxf::WritePoint( const string& sLay, int nCol, const Point3d& ptP, const Vector3d& vtV, const Frame3d& frFrame)
|
ExportDxf::WritePoint( const string& sLay, int nCol, const Point3d& ptP, const Vector3d& vtV, const Frame3d& frFrame)
|
||||||
{
|
{
|
||||||
// identificativo entità
|
// identificativo entit�
|
||||||
if ( ! WriteItem( 0, "POINT"))
|
if ( ! WriteItem( 0, "POINT"))
|
||||||
return false ;
|
return false ;
|
||||||
// layer
|
// layer
|
||||||
@@ -1430,10 +1433,10 @@ ExportDxf::WritePoint( const string& sLay, int nCol, const Point3d& ptP, const V
|
|||||||
bool
|
bool
|
||||||
ExportDxf::WriteLine( const string& sLay, int nCol, const ICurveLine* pLine, const Frame3d& frFrame)
|
ExportDxf::WriteLine( const string& sLay, int nCol, const ICurveLine* pLine, const Frame3d& frFrame)
|
||||||
{
|
{
|
||||||
// verifico validità linea
|
// verifico validit� linea
|
||||||
if ( pLine == nullptr)
|
if ( pLine == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
// identificativo entità
|
// identificativo entit�
|
||||||
if ( ! WriteItem( 0, "LINE"))
|
if ( ! WriteItem( 0, "LINE"))
|
||||||
return false ;
|
return false ;
|
||||||
// layer
|
// layer
|
||||||
@@ -1481,7 +1484,7 @@ ExportDxf::WriteLine( const string& sLay, int nCol, const ICurveLine* pLine, con
|
|||||||
bool
|
bool
|
||||||
ExportDxf::WriteCircle( const string& sLay, int nCol, const ICurveArc* pArc, const Frame3d& frFrame)
|
ExportDxf::WriteCircle( const string& sLay, int nCol, const ICurveArc* pArc, const Frame3d& frFrame)
|
||||||
{
|
{
|
||||||
// verifico validità arco
|
// verifico validit� arco
|
||||||
if ( pArc == nullptr)
|
if ( pArc == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
// verifico verso eventuale estrusione
|
// verifico verso eventuale estrusione
|
||||||
@@ -1493,7 +1496,7 @@ ExportDxf::WriteCircle( const string& sLay, int nCol, const ICurveArc* pArc, con
|
|||||||
vtN.ToGlob( frFrame) ;
|
vtN.ToGlob( frFrame) ;
|
||||||
Frame3d frOCS ;
|
Frame3d frOCS ;
|
||||||
frOCS.Set( ORIG, vtN) ;
|
frOCS.Set( ORIG, vtN) ;
|
||||||
// identificativo entità
|
// identificativo entit�
|
||||||
if ( ! WriteItem( 0, "CIRCLE"))
|
if ( ! WriteItem( 0, "CIRCLE"))
|
||||||
return false ;
|
return false ;
|
||||||
// layer
|
// layer
|
||||||
@@ -1532,7 +1535,7 @@ ExportDxf::WriteCircle( const string& sLay, int nCol, const ICurveArc* pArc, con
|
|||||||
bool
|
bool
|
||||||
ExportDxf::WriteArc( const string& sLay, int nCol, const ICurveArc* pArc, const Frame3d& frFrame)
|
ExportDxf::WriteArc( const string& sLay, int nCol, const ICurveArc* pArc, const Frame3d& frFrame)
|
||||||
{
|
{
|
||||||
// verifico validità arco
|
// verifico validit� arco
|
||||||
if ( pArc == nullptr)
|
if ( pArc == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
// verifico verso eventuale estrusione
|
// verifico verso eventuale estrusione
|
||||||
@@ -1544,7 +1547,7 @@ ExportDxf::WriteArc( const string& sLay, int nCol, const ICurveArc* pArc, const
|
|||||||
vtN.ToGlob( frFrame) ;
|
vtN.ToGlob( frFrame) ;
|
||||||
Frame3d frOCS ;
|
Frame3d frOCS ;
|
||||||
frOCS.Set( ORIG, vtN) ;
|
frOCS.Set( ORIG, vtN) ;
|
||||||
// identificativo entità
|
// identificativo entit�
|
||||||
if ( ! WriteItem( 0, "ARC"))
|
if ( ! WriteItem( 0, "ARC"))
|
||||||
return false ;
|
return false ;
|
||||||
// layer
|
// layer
|
||||||
@@ -1596,7 +1599,7 @@ bool
|
|||||||
ExportDxf::WriteCurve2d( const string& sLay, int nCol, const ICurve* pCrv,
|
ExportDxf::WriteCurve2d( const string& sLay, int nCol, const ICurve* pCrv,
|
||||||
const Frame3d& frPlane, const Frame3d& frFrame)
|
const Frame3d& frPlane, const Frame3d& frFrame)
|
||||||
{
|
{
|
||||||
// verifico validità curva
|
// verifico validit� curva
|
||||||
if ( pCrv == nullptr)
|
if ( pCrv == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
// trasformo in poliarco
|
// trasformo in poliarco
|
||||||
@@ -1637,7 +1640,7 @@ ExportDxf::WriteCurve2d( const string& sLay, int nCol, const ICurve* pCrv,
|
|||||||
// colore
|
// colore
|
||||||
if ( ! WriteItem( 62, nCol))
|
if ( ! WriteItem( 62, nCol))
|
||||||
return false ;
|
return false ;
|
||||||
// flag segnalazione entità successive dipendenti (vertex)
|
// flag segnalazione entit� successive dipendenti (vertex)
|
||||||
if ( ! WriteItem( 66, 1))
|
if ( ! WriteItem( 66, 1))
|
||||||
return false ;
|
return false ;
|
||||||
// punto per sola elevazione : X,Y inutili Z elevazione
|
// punto per sola elevazione : X,Y inutili Z elevazione
|
||||||
@@ -1669,7 +1672,7 @@ ExportDxf::WriteCurve2d( const string& sLay, int nCol, const ICurve* pCrv,
|
|||||||
for ( bool bPnt = PA.GetFirstPoint( ptP, dBulge) ;
|
for ( bool bPnt = PA.GetFirstPoint( ptP, dBulge) ;
|
||||||
bPnt ;
|
bPnt ;
|
||||||
bPnt = PA.GetNextPoint( ptP, dBulge, bClosed)) {
|
bPnt = PA.GetNextPoint( ptP, dBulge, bClosed)) {
|
||||||
// entità vertice
|
// entit� vertice
|
||||||
if ( ! WriteItem( 0, "VERTEX"))
|
if ( ! WriteItem( 0, "VERTEX"))
|
||||||
return false ;
|
return false ;
|
||||||
// layer
|
// layer
|
||||||
@@ -1688,7 +1691,7 @@ ExportDxf::WriteCurve2d( const string& sLay, int nCol, const ICurve* pCrv,
|
|||||||
if ( ! WriteItem( 70, 0))
|
if ( ! WriteItem( 70, 0))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
// entità termine dei vertici
|
// entit� termine dei vertici
|
||||||
if ( ! WriteItem( 0, "SEQEND"))
|
if ( ! WriteItem( 0, "SEQEND"))
|
||||||
return false ;
|
return false ;
|
||||||
// layer
|
// layer
|
||||||
@@ -1701,7 +1704,7 @@ ExportDxf::WriteCurve2d( const string& sLay, int nCol, const ICurve* pCrv,
|
|||||||
bool
|
bool
|
||||||
ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const Frame3d& frFrame)
|
ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const Frame3d& frFrame)
|
||||||
{
|
{
|
||||||
// verifico validità curva
|
// verifico validit� curva
|
||||||
if ( pCrv == nullptr)
|
if ( pCrv == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
// trasformo in polilinea
|
// trasformo in polilinea
|
||||||
@@ -1726,7 +1729,7 @@ ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const
|
|||||||
// colore
|
// colore
|
||||||
if ( ! WriteItem( 62, nCol))
|
if ( ! WriteItem( 62, nCol))
|
||||||
return false ;
|
return false ;
|
||||||
// flag segnalazione entità successive dipendenti (vertex)
|
// flag segnalazione entit� successive dipendenti (vertex)
|
||||||
if ( ! WriteItem( 66, 1))
|
if ( ! WriteItem( 66, 1))
|
||||||
return false ;
|
return false ;
|
||||||
// punto inutile ma obbligatorio
|
// punto inutile ma obbligatorio
|
||||||
@@ -1742,7 +1745,7 @@ ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const
|
|||||||
for ( bool bPnt = PL.GetFirstPoint( ptP) ;
|
for ( bool bPnt = PL.GetFirstPoint( ptP) ;
|
||||||
bPnt ;
|
bPnt ;
|
||||||
bPnt = PL.GetNextPoint( ptP)) {
|
bPnt = PL.GetNextPoint( ptP)) {
|
||||||
// entità vertice
|
// entit� vertice
|
||||||
if ( ! WriteItem( 0, "VERTEX"))
|
if ( ! WriteItem( 0, "VERTEX"))
|
||||||
return false ;
|
return false ;
|
||||||
// layer
|
// layer
|
||||||
@@ -1758,7 +1761,7 @@ ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const
|
|||||||
if ( ! WriteItem( 70, 32))
|
if ( ! WriteItem( 70, 32))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
// entità termine dei vertici
|
// entit� termine dei vertici
|
||||||
if ( ! WriteItem( 0, "SEQEND"))
|
if ( ! WriteItem( 0, "SEQEND"))
|
||||||
return false ;
|
return false ;
|
||||||
// layer
|
// layer
|
||||||
@@ -1771,7 +1774,7 @@ ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const
|
|||||||
for ( bool bPnt = PL.GetFirstLine( ptStart, ptEnd) ;
|
for ( bool bPnt = PL.GetFirstLine( ptStart, ptEnd) ;
|
||||||
bPnt ;
|
bPnt ;
|
||||||
bPnt = PL.GetNextLine( ptStart, ptEnd)) {
|
bPnt = PL.GetNextLine( ptStart, ptEnd)) {
|
||||||
// identificativo entità
|
// identificativo entit�
|
||||||
if ( ! WriteItem( 0, "LINE"))
|
if ( ! WriteItem( 0, "LINE"))
|
||||||
return false ;
|
return false ;
|
||||||
// layer
|
// layer
|
||||||
@@ -1811,24 +1814,55 @@ ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExportDxf::TestFilter( int nLev, int nMode, int nStat)
|
ExportDxf::TestFilter( int nLev, int nMode, int nStat, bool bGroup)
|
||||||
{
|
{
|
||||||
if ( ( nLev == GDB_LV_USER && ( m_nFilter & EEXFLT_LEVUSER) == 0) ||
|
int nFilter = bGroup ? m_nGroupFilter : m_nFilter ;
|
||||||
( nLev == GDB_LV_SYSTEM && ( m_nFilter & EEXFLT_LEVSYSTEM) == 0) ||
|
if ( ( nLev == GDB_LV_USER && ( nFilter & EEXFLT_LEVUSER) == 0) ||
|
||||||
( nLev == GDB_LV_TEMP && ( m_nFilter & EEXFLT_LEVTEMP) == 0))
|
( nLev == GDB_LV_SYSTEM && ( nFilter & EEXFLT_LEVSYSTEM) == 0) ||
|
||||||
|
( nLev == GDB_LV_TEMP && ( nFilter & EEXFLT_LEVTEMP) == 0))
|
||||||
return false ;
|
return false ;
|
||||||
if ( ( nMode == GDB_MD_STD && ( m_nFilter & EEXFLT_MODESTD) == 0) ||
|
if ( ( nMode == GDB_MD_STD && ( nFilter & EEXFLT_MODESTD) == 0) ||
|
||||||
( nMode == GDB_MD_LOCKED && ( m_nFilter & EEXFLT_MODELOCKED) == 0) ||
|
( nMode == GDB_MD_LOCKED && ( nFilter & EEXFLT_MODELOCKED) == 0) ||
|
||||||
( nMode == GDB_MD_HIDDEN && ( m_nFilter & EEXFLT_MODEHIDDEN) == 0))
|
( nMode == GDB_MD_HIDDEN && ( nFilter & EEXFLT_MODEHIDDEN) == 0))
|
||||||
return false ;
|
return false ;
|
||||||
if ( ( nStat == GDB_ST_OFF && ( m_nFilter & EEXFLT_STAOFF) == 0) ||
|
if ( ( nStat == GDB_ST_OFF && ( nFilter & EEXFLT_STAOFF) == 0) ||
|
||||||
( nStat == GDB_ST_ON && ( m_nFilter & EEXFLT_STAON) == 0) ||
|
( nStat == GDB_ST_ON && ( nFilter & EEXFLT_STAON) == 0) ||
|
||||||
( nStat == GDB_ST_SEL && ( m_nFilter & EEXFLT_STASEL) == 0))
|
( nStat == GDB_ST_SEL && ( nFilter & EEXFLT_STASEL) == 0))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
ExportDxf::CalcGroupFilter( void)
|
||||||
|
{
|
||||||
|
m_nGroupFilter = 0 ;
|
||||||
|
// Status
|
||||||
|
if ( ( m_nFilter & EEXFLT_STASEL) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_STASEL + EEXFLT_STAOFF + EEXFLT_STAON ;
|
||||||
|
else if ( ( m_nFilter & EEXFLT_STAOFF) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_STAOFF + EEXFLT_STAON ;
|
||||||
|
else
|
||||||
|
m_nGroupFilter += EEXFLT_STAON ;
|
||||||
|
// Mode
|
||||||
|
if ( ( m_nFilter & EEXFLT_MODELOCKED) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_MODELOCKED + EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
|
||||||
|
else if ( ( m_nFilter & EEXFLT_MODEHIDDEN) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
|
||||||
|
else
|
||||||
|
m_nGroupFilter += EEXFLT_MODESTD ;
|
||||||
|
// Level
|
||||||
|
if ( ( m_nFilter & EEXFLT_LEVSYSTEM) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_LEVSYSTEM + EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
|
||||||
|
else if ( ( m_nFilter & EEXFLT_LEVTEMP) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
|
||||||
|
else
|
||||||
|
m_nGroupFilter += EEXFLT_LEVUSER ;
|
||||||
|
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExportDxf::WriteItem( int nCode, int nVal)
|
ExportDxf::WriteItem( int nCode, int nVal)
|
||||||
|
|||||||
+4
-2
@@ -71,7 +71,8 @@ class ExportDxf : public IExportDxf
|
|||||||
bool WriteCurve2d( const std::string& sLay, int nCol, const ICurve* pCrv,
|
bool WriteCurve2d( const std::string& sLay, int nCol, const ICurve* pCrv,
|
||||||
const Frame3d& frPlane, const Frame3d& frFrame) ;
|
const Frame3d& frPlane, const Frame3d& frFrame) ;
|
||||||
bool WriteCurve3d( const std::string& sLay, int nCol, const ICurve* pCrv, const Frame3d& frFrame) ;
|
bool WriteCurve3d( const std::string& sLay, int nCol, const ICurve* pCrv, const Frame3d& frFrame) ;
|
||||||
bool TestFilter( int nLev, int nMode, int nStat) ;
|
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup) ;
|
||||||
|
bool CalcGroupFilter( void) ;
|
||||||
bool WriteItem( int nCode, int nVal) ;
|
bool WriteItem( int nCode, int nVal) ;
|
||||||
bool WriteItem( int nCode, double dVal, int nPrec = 6) ;
|
bool WriteItem( int nCode, double dVal, int nPrec = 6) ;
|
||||||
bool WriteItem( int nCode, const std::string& sVal) ;
|
bool WriteItem( int nCode, const std::string& sVal) ;
|
||||||
@@ -81,7 +82,8 @@ class ExportDxf : public IExportDxf
|
|||||||
std::string AdjustFontName( const std::string& sFontName) ;
|
std::string AdjustFontName( const std::string& sFontName) ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
int m_nFilter ; // filtro su livello, modo e stato
|
int m_nFilter ; // filtro su livello, modo e stato, se l'oggeto da valutare è un oggetto geometrico
|
||||||
|
int m_nGroupFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare è un gruppo
|
||||||
bool m_bCompoundLayer ;
|
bool m_bCompoundLayer ;
|
||||||
bool m_bColorByLayer ;
|
bool m_bColorByLayer ;
|
||||||
bool m_bAdvancedNames ;
|
bool m_bAdvancedNames ;
|
||||||
|
|||||||
+76
-42
@@ -45,6 +45,7 @@ bool
|
|||||||
ExportStl::SetOptions( int nFilter)
|
ExportStl::SetOptions( int nFilter)
|
||||||
{
|
{
|
||||||
m_nFilter = nFilter ;
|
m_nFilter = nFilter ;
|
||||||
|
CalcGroupFilter() ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,34 +90,35 @@ ExportStl::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
|||||||
bool
|
bool
|
||||||
ExportStl::ExportObject( const IGdbIterator& iIter)
|
ExportStl::ExportObject( const IGdbIterator& iIter)
|
||||||
{
|
{
|
||||||
switch ( iIter.GetGdbType()) {
|
// recupero il livello dell'oggetto
|
||||||
case GDB_TY_GEO :
|
int nLev = GDB_LV_USER ;
|
||||||
{
|
iIter.GetCalcLevel( nLev) ;
|
||||||
// recupero l'oggetto geometrico
|
// recupero il modo dell'oggetto
|
||||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
int nMode = GDB_MD_STD ;
|
||||||
if ( pGeoObj == nullptr)
|
iIter.GetCalcMode( nMode) ;
|
||||||
return true ;
|
// recupero lo stato dell'oggetto
|
||||||
// recupero il riferimento globale dell'oggetto
|
int nStat = GDB_ST_ON ;
|
||||||
Frame3d frFrame ;
|
iIter.GetCalcStatus( nStat) ;
|
||||||
if ( ! iIter.GetGlobFrame( frFrame))
|
int nType = iIter.GetGdbType() ;
|
||||||
return false ;
|
// se il filtro lo abilita
|
||||||
// recupero il livello dell'oggetto
|
if ( TestFilter( nLev, nMode, nStat, nType == GDB_TY_GROUP)) {
|
||||||
int nLev = GDB_LV_USER ;
|
switch ( nType) {
|
||||||
iIter.GetCalcLevel( nLev) ;
|
case GDB_TY_GEO :
|
||||||
// recupero il modo dell'oggetto
|
{
|
||||||
int nMode = GDB_MD_STD ;
|
// recupero l'oggetto geometrico
|
||||||
iIter.GetCalcMode( nMode) ;
|
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||||
// recupero lo stato dell'oggetto
|
if ( pGeoObj == nullptr)
|
||||||
int nStat = GDB_ST_ON ;
|
return true ;
|
||||||
iIter.GetCalcStatus( nStat) ;
|
// recupero il riferimento globale dell'oggetto
|
||||||
// se il filtro lo abilita
|
Frame3d frFrame ;
|
||||||
if ( TestFilter( nLev, nMode, nStat)) {
|
if ( ! iIter.GetGlobFrame( frFrame))
|
||||||
// recupero eventuale nome
|
return false ;
|
||||||
|
// recupero eventuale nome
|
||||||
string sName ;
|
string sName ;
|
||||||
if ( ! iIter.GetName( sName))
|
if ( ! iIter.GetName( sName))
|
||||||
sName = ToString( iIter.GetId()) ;
|
sName = ToString( iIter.GetId()) ;
|
||||||
// emetto l'oggetto
|
// emetto l'oggetto
|
||||||
switch ( pGeoObj->GetType()) {
|
switch ( pGeoObj->GetType()) {
|
||||||
case SRF_TRIMESH :
|
case SRF_TRIMESH :
|
||||||
if ( ! ExportSTM( sName, pGeoObj, frFrame))
|
if ( ! ExportSTM( sName, pGeoObj, frFrame))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -128,37 +130,69 @@ ExportStl::ExportObject( const IGdbIterator& iIter)
|
|||||||
default :
|
default :
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return true ;
|
||||||
return true ;
|
case GDB_TY_GROUP :
|
||||||
case GDB_TY_GROUP :
|
// esploro il gruppo
|
||||||
// esploro il gruppo
|
return ScanGroup( iIter) ;
|
||||||
return ScanGroup( iIter) ;
|
default :
|
||||||
default :
|
return false ;
|
||||||
return false ;
|
}
|
||||||
}
|
}
|
||||||
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExportStl::TestFilter( int nLev, int nMode, int nStat)
|
ExportStl::TestFilter( int nLev, int nMode, int nStat, bool bGroup)
|
||||||
{
|
{
|
||||||
if ( ( nLev == GDB_LV_USER && ( m_nFilter & EEXFLT_LEVUSER) == 0) ||
|
int nFilter = bGroup ? m_nGroupFilter : m_nFilter ;
|
||||||
( nLev == GDB_LV_SYSTEM && ( m_nFilter & EEXFLT_LEVSYSTEM) == 0) ||
|
if ( ( nLev == GDB_LV_USER && ( nFilter & EEXFLT_LEVUSER) == 0) ||
|
||||||
( nLev == GDB_LV_TEMP && ( m_nFilter & EEXFLT_LEVTEMP) == 0))
|
( nLev == GDB_LV_SYSTEM && ( nFilter & EEXFLT_LEVSYSTEM) == 0) ||
|
||||||
|
( nLev == GDB_LV_TEMP && ( nFilter & EEXFLT_LEVTEMP) == 0))
|
||||||
return false ;
|
return false ;
|
||||||
if ( ( nMode == GDB_MD_STD && ( m_nFilter & EEXFLT_MODESTD) == 0) ||
|
if ( ( nMode == GDB_MD_STD && ( nFilter & EEXFLT_MODESTD) == 0) ||
|
||||||
( nMode == GDB_MD_LOCKED && ( m_nFilter & EEXFLT_MODELOCKED) == 0) ||
|
( nMode == GDB_MD_LOCKED && ( nFilter & EEXFLT_MODELOCKED) == 0) ||
|
||||||
( nMode == GDB_MD_HIDDEN && ( m_nFilter & EEXFLT_MODEHIDDEN) == 0))
|
( nMode == GDB_MD_HIDDEN && ( nFilter & EEXFLT_MODEHIDDEN) == 0))
|
||||||
return false ;
|
return false ;
|
||||||
if ( ( nStat == GDB_ST_OFF && ( m_nFilter & EEXFLT_STAOFF) == 0) ||
|
if ( ( nStat == GDB_ST_OFF && ( nFilter & EEXFLT_STAOFF) == 0) ||
|
||||||
( nStat == GDB_ST_ON && ( m_nFilter & EEXFLT_STAON) == 0) ||
|
( nStat == GDB_ST_ON && ( nFilter & EEXFLT_STAON) == 0) ||
|
||||||
( nStat == GDB_ST_SEL && ( m_nFilter & EEXFLT_STASEL) == 0))
|
( nStat == GDB_ST_SEL && ( nFilter & EEXFLT_STASEL) == 0))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
ExportStl::CalcGroupFilter( void)
|
||||||
|
{
|
||||||
|
m_nGroupFilter = 0 ;
|
||||||
|
// Status
|
||||||
|
if ( ( m_nFilter & EEXFLT_STASEL) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_STASEL + EEXFLT_STAOFF + EEXFLT_STAON ;
|
||||||
|
else if ( ( m_nFilter & EEXFLT_STAOFF) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_STAOFF + EEXFLT_STAON ;
|
||||||
|
else
|
||||||
|
m_nGroupFilter += EEXFLT_STAON ;
|
||||||
|
// Mode
|
||||||
|
if ( ( m_nFilter & EEXFLT_MODELOCKED) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_MODELOCKED + EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
|
||||||
|
else if ( ( m_nFilter & EEXFLT_MODEHIDDEN) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
|
||||||
|
else
|
||||||
|
m_nGroupFilter += EEXFLT_MODESTD ;
|
||||||
|
// Level
|
||||||
|
if ( ( m_nFilter & EEXFLT_LEVSYSTEM) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_LEVSYSTEM + EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
|
||||||
|
else if ( ( m_nFilter & EEXFLT_LEVTEMP) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
|
||||||
|
else
|
||||||
|
m_nGroupFilter += EEXFLT_LEVUSER ;
|
||||||
|
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExportStl::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame)
|
ExportStl::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame)
|
||||||
|
|||||||
+7
-3
@@ -28,16 +28,20 @@ class ExportStl : public IExportStl
|
|||||||
virtual bool Export( IGeomDB* pGDB, int nId, const std::string& sFile) ;
|
virtual bool Export( IGeomDB* pGDB, int nId, const std::string& sFile) ;
|
||||||
|
|
||||||
public :
|
public :
|
||||||
ExportStl( void) : m_nFilter( EEXFLT_DEFAULT) {}
|
ExportStl( void) : m_nFilter( EEXFLT_DEFAULT) {
|
||||||
|
CalcGroupFilter() ;
|
||||||
|
}
|
||||||
|
|
||||||
private :
|
private :
|
||||||
bool ExportObject( const IGdbIterator& iIter) ;
|
bool ExportObject( const IGdbIterator& iIter) ;
|
||||||
bool ScanGroup( const IGdbIterator& iIter) ;
|
bool ScanGroup( const IGdbIterator& iIter) ;
|
||||||
bool TestFilter( int nLev, int nMode, int nStat) ;
|
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup) ;
|
||||||
|
bool CalcGroupFilter( void) ;
|
||||||
bool ExportSFR( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame) ;
|
bool ExportSFR( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame) ;
|
||||||
bool ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame) ;
|
bool ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame) ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
int m_nFilter ; // filtro su livello, modo e stato
|
int m_nFilter ; // filtro su livello, modo e stato, se l'oggeto da valutare è un oggetto geometrico
|
||||||
|
int m_nGroupFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare è un gruppo
|
||||||
Writer m_Writer ; // scrittore di file di testo
|
Writer m_Writer ; // scrittore di file di testo
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
+108
-90
@@ -71,6 +71,7 @@ bool
|
|||||||
ExportThreeJS::SetOptions( int nFilter)
|
ExportThreeJS::SetOptions( int nFilter)
|
||||||
{
|
{
|
||||||
m_nFilter = nFilter ;
|
m_nFilter = nFilter ;
|
||||||
|
CalcGroupFilter() ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2571,22 +2572,22 @@ ExportThreeJS::ExportObject( const IGdbIterator& iIter, IGeomDB* pGDB, const int
|
|||||||
// recupero lo stato dell'oggetto
|
// recupero lo stato dell'oggetto
|
||||||
int nStat = GDB_ST_ON ;
|
int nStat = GDB_ST_ON ;
|
||||||
iIter.GetCalcStatus( nStat) ;
|
iIter.GetCalcStatus( nStat) ;
|
||||||
|
int nType = iIter.GetGdbType() ;
|
||||||
|
// se il filtro lo abilita
|
||||||
|
if ( TestFilter( nLev, nMode, nStat, nType == GDB_TY_GROUP)) {
|
||||||
|
switch ( nType) {
|
||||||
|
case GDB_TY_GEO :
|
||||||
|
{
|
||||||
|
// recupero l'oggetto geometrico
|
||||||
|
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||||
|
if ( pGeoObj == nullptr)
|
||||||
|
return true ;
|
||||||
|
|
||||||
switch ( iIter.GetGdbType()) {
|
// recupero il riferimento globale dell'oggetto
|
||||||
case GDB_TY_GEO :
|
Frame3d frFrame ;
|
||||||
{
|
if ( ! iIter.GetGlobFrame( frFrame))
|
||||||
// recupero l'oggetto geometrico
|
return false ;
|
||||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
|
||||||
if ( pGeoObj == nullptr)
|
|
||||||
return true ;
|
|
||||||
|
|
||||||
// recupero il riferimento globale dell'oggetto
|
|
||||||
Frame3d frFrame ;
|
|
||||||
if ( ! iIter.GetGlobFrame( frFrame))
|
|
||||||
return false ;
|
|
||||||
|
|
||||||
// se il filtro lo abilita
|
|
||||||
if ( TestFilter( nLev, nMode, nStat)) {
|
|
||||||
// recupero eventuale nome
|
// recupero eventuale nome
|
||||||
string sName ;
|
string sName ;
|
||||||
if ( ! iIter.GetName( sName))
|
if ( ! iIter.GetName( sName))
|
||||||
@@ -2666,14 +2667,14 @@ ExportThreeJS::ExportObject( const IGdbIterator& iIter, IGeomDB* pGDB, const int
|
|||||||
default :
|
default :
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
return true ;
|
||||||
}
|
}
|
||||||
return true ;
|
case GDB_TY_GROUP :
|
||||||
|
// esploro il gruppo
|
||||||
|
return ScanGroup( iIter, pGDB, nGroupCount) ;
|
||||||
|
default :
|
||||||
|
return false ;
|
||||||
}
|
}
|
||||||
case GDB_TY_GROUP :
|
|
||||||
// esploro il gruppo
|
|
||||||
return ScanGroup( iIter, pGDB, nGroupCount) ;
|
|
||||||
default :
|
|
||||||
return false ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
@@ -3180,91 +3181,108 @@ ExportThreeJS::ScanGroup( const IGdbIterator& iIter, IGeomDB* pGDB, const int nG
|
|||||||
|
|
||||||
pIter->GoTo( iIter.GetId()) ;
|
pIter->GoTo( iIter.GetId()) ;
|
||||||
|
|
||||||
// recupero il livello dell'oggetto
|
m_nGroupCount ++ ;
|
||||||
int nLev = GDB_LV_USER ;
|
m_Writer.OutText( " const group" + ToString( m_nGroupCount) + " = new THREE.Group();") ;
|
||||||
iIter.GetCalcLevel( nLev) ;
|
|
||||||
// recupero il modo dell'oggetto
|
|
||||||
int nMode = GDB_MD_STD;
|
|
||||||
iIter.GetCalcMode( nMode) ;
|
|
||||||
// recupero lo stato dell'oggetto
|
|
||||||
int nStat = GDB_ST_ON ;
|
|
||||||
iIter.GetCalcStatus( nStat) ;
|
|
||||||
|
|
||||||
if ( TestFilter( nLev, nMode, nStat)) {
|
if ( nGroupCount != -1)
|
||||||
m_nGroupCount ++ ;
|
m_sCodMenu += "<ol class = 'list-group-item border-0 my-0 py-0 pe-0'>" ;
|
||||||
m_Writer.OutText( " const group" + ToString( m_nGroupCount) + " = new THREE.Group();") ;
|
|
||||||
|
|
||||||
if ( nGroupCount != -1)
|
|
||||||
m_sCodMenu += "<ol class = 'list-group-item border-0 my-0 py-0 pe-0'>" ;
|
|
||||||
|
|
||||||
string sName ;
|
string sName ;
|
||||||
pIter->GetName( sName) ;
|
pIter->GetName( sName) ;
|
||||||
string sId = ToString( pIter->GetId()) ;
|
string sId = ToString( pIter->GetId()) ;
|
||||||
|
|
||||||
m_Writer.OutText( " group" + ToString( m_nGroupCount) + ".name = '" + sId + "'") ;
|
m_Writer.OutText( " group" + ToString( m_nGroupCount) + ".name = '" + sId + "'") ;
|
||||||
// aggiungo l'EventListner per il menu laterale sinistro
|
// aggiungo l'EventListner per il menu laterale sinistro
|
||||||
//m_Writer.OutText( " document.getElementById('p_id_" + sId + "').addEventListener('click', function(){ if(!booked) { findGroupByNameAndId(groupRoot, " + sId + ", 1); }});") ;
|
//m_Writer.OutText( " document.getElementById('p_id_" + sId + "').addEventListener('click', function(){ if(!booked) { findGroupByNameAndId(groupRoot, " + sId + ", 1); }});") ;
|
||||||
//m_Writer.OutText( " document.getElementById('lb_" + sId + "').addEventListener('click', function(){ lightbulb('lb_" + sId + "', 0)});") ;
|
//m_Writer.OutText( " document.getElementById('lb_" + sId + "').addEventListener('click', function(){ lightbulb('lb_" + sId + "', 0)});") ;
|
||||||
|
|
||||||
if ( ! sId.compare( "0")) {
|
if ( ! sId.compare( "0")) {
|
||||||
|
|
||||||
//m_sCodMenu += "<div class = 'd-flex flex-row bd-highlight'>" ;
|
//m_sCodMenu += "<div class = 'd-flex flex-row bd-highlight'>" ;
|
||||||
//m_sCodMenu += "<i id = 'lb_0' name = 'lb_on' class = 'fa-solid fa-lightbulb m-0 py-1 visible' style = 'cursor: pointer; color: #f0ad4e'></i>" ;
|
//m_sCodMenu += "<i id = 'lb_0' name = 'lb_on' class = 'fa-solid fa-lightbulb m-0 py-1 visible' style = 'cursor: pointer; color: #f0ad4e'></i>" ;
|
||||||
//m_sCodMenu += "<button class = 'list-group-item list-group-item-action list-group-flush list-group-item-dark mb-0 border-0 ml-1 py-0 mx-1' name='btMenu' id = 'p_id_0'>" ;
|
//m_sCodMenu += "<button class = 'list-group-item list-group-item-action list-group-flush list-group-item-dark mb-0 border-0 ml-1 py-0 mx-1' name='btMenu' id = 'p_id_0'>" ;
|
||||||
//m_sCodMenu += "<span class = 'badge bg-dark float-end my-0' id = 's_id_0' name ='badgeMenu'></span>" ;
|
//m_sCodMenu += "<span class = 'badge bg-dark float-end my-0' id = 's_id_0' name ='badgeMenu'></span>" ;
|
||||||
//m_sCodMenu += "<span class = 'border-0' name = 's_col_ora' id = 's_col_0'> <i>(0)</i></span>" ;
|
//m_sCodMenu += "<span class = 'border-0' name = 's_col_ora' id = 's_col_0'> <i>(0)</i></span>" ;
|
||||||
//m_sCodMenu += "<span id = 'ss_id_0' name = 's_nb'> BASIC MODEL</span>" ;
|
//m_sCodMenu += "<span id = 'ss_id_0' name = 's_nb'> BASIC MODEL</span>" ;
|
||||||
//m_sCodMenu += "</button>" ;
|
//m_sCodMenu += "</button>" ;
|
||||||
//m_sCodMenu += "</div>" ;
|
//m_sCodMenu += "</div>" ;
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_Writer.OutText(" document.getElementById('p_id_" + sId + "').addEventListener('click', function(){ if(!booked) { findGroupByNameAndId(groupRoot, " + sId + ", 1); }});") ;
|
|
||||||
m_Writer.OutText(" document.getElementById('lb_" + sId + "').addEventListener('click', function(){ lightbulb('lb_" + sId + "', 0)});") ;
|
|
||||||
m_sCodMenu += "<div class = 'd-flex flex-row bd-highlight'>" ;
|
|
||||||
m_sCodMenu += "<i id = 'lb_" + sId + "' name = 'lb_on' class = 'fa-solid fa-lightbulb m-0 py-1 visible' style = 'cursor: pointer; color: #f0ad4e'></i>" ;
|
|
||||||
m_sCodMenu += "<button class = 'list-group-item list-group-item-action list-group-flush list-group-item-dark mb-0 border-0 ml-1 py-0 mx-1' name='btMenu' id = 'p_id_" + sId + "'>" ;
|
|
||||||
m_sCodMenu += "<span class='badge bg-dark float-end my-0' name ='badgeMenu' id = 's_id_" + sId + "'></span>" ;
|
|
||||||
m_sCodMenu += "<span name = 's_col_ora' id = 's_col_" + sId + "'><i>(" + sId + ")</i></span>" ;
|
|
||||||
m_sCodMenu += "<span id = 'ss_id_" + sId + "' name = 's_nb'> " + sName + "</span>" ; //Inserisco uno spazio !
|
|
||||||
m_sCodMenu += "</button>" ;
|
|
||||||
m_sCodMenu += "</div>" ;
|
|
||||||
}
|
|
||||||
|
|
||||||
int nCurrentGroup = m_nGroupCount ;
|
|
||||||
|
|
||||||
for ( bool bNext = pIter->GoToFirstInGroup(iIter) ; bNext ; bNext = pIter->GoToNext()) {
|
|
||||||
if ( ! ExportObject( *pIter, pGDB, nCurrentGroup))
|
|
||||||
bOk = false ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( nGroupCount != -1) {
|
|
||||||
m_Writer.OutText(" group" + ToString( nGroupCount) + ".add(group" + ToString( nCurrentGroup) + ")") ;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_sCodMenu += " </ol>" ;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
m_Writer.OutText(" document.getElementById('p_id_" + sId + "').addEventListener('click', function(){ if(!booked) { findGroupByNameAndId(groupRoot, " + sId + ", 1); }});") ;
|
||||||
|
m_Writer.OutText(" document.getElementById('lb_" + sId + "').addEventListener('click', function(){ lightbulb('lb_" + sId + "', 0)});") ;
|
||||||
|
m_sCodMenu += "<div class = 'd-flex flex-row bd-highlight'>" ;
|
||||||
|
m_sCodMenu += "<i id = 'lb_" + sId + "' name = 'lb_on' class = 'fa-solid fa-lightbulb m-0 py-1 visible' style = 'cursor: pointer; color: #f0ad4e'></i>" ;
|
||||||
|
m_sCodMenu += "<button class = 'list-group-item list-group-item-action list-group-flush list-group-item-dark mb-0 border-0 ml-1 py-0 mx-1' name='btMenu' id = 'p_id_" + sId + "'>" ;
|
||||||
|
m_sCodMenu += "<span class='badge bg-dark float-end my-0' name ='badgeMenu' id = 's_id_" + sId + "'></span>" ;
|
||||||
|
m_sCodMenu += "<span name = 's_col_ora' id = 's_col_" + sId + "'><i>(" + sId + ")</i></span>" ;
|
||||||
|
m_sCodMenu += "<span id = 'ss_id_" + sId + "' name = 's_nb'> " + sName + "</span>" ; //Inserisco uno spazio !
|
||||||
|
m_sCodMenu += "</button>" ;
|
||||||
|
m_sCodMenu += "</div>" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
int nCurrentGroup = m_nGroupCount ;
|
||||||
|
|
||||||
|
for ( bool bNext = pIter->GoToFirstInGroup(iIter) ; bNext ; bNext = pIter->GoToNext()) {
|
||||||
|
if ( ! ExportObject( *pIter, pGDB, nCurrentGroup))
|
||||||
|
bOk = false ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( nGroupCount != -1) {
|
||||||
|
m_Writer.OutText(" group" + ToString( nGroupCount) + ".add(group" + ToString( nCurrentGroup) + ")") ;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sCodMenu += " </ol>" ;
|
||||||
|
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExportThreeJS::TestFilter( int nLev, int nMode, int nStat)
|
ExportThreeJS::TestFilter( int nLev, int nMode, int nStat, bool bGroup)
|
||||||
{
|
{
|
||||||
// COMMENTO TEMPORANEO !
|
int nFilter = bGroup ? m_nGroupFilter : m_nFilter ;
|
||||||
/*
|
if ( ( nLev == GDB_LV_USER && ( nFilter & EEXFLT_LEVUSER) == 0) ||
|
||||||
if (( nLev == GDB_LV_USER && ( m_nFilter & EEXFLT_LEVUSER) == 0) ||
|
( nLev == GDB_LV_SYSTEM && ( nFilter & EEXFLT_LEVSYSTEM) == 0) ||
|
||||||
( nLev == GDB_LV_SYSTEM && ( m_nFilter & EEXFLT_LEVSYSTEM) == 0) ||
|
( nLev == GDB_LV_TEMP && ( nFilter & EEXFLT_LEVTEMP) == 0))
|
||||||
( nLev == GDB_LV_TEMP && ( m_nFilter & EEXFLT_LEVTEMP) == 0))
|
|
||||||
return false ;
|
return false ;
|
||||||
*/
|
if ( ( nMode == GDB_MD_STD && ( nFilter & EEXFLT_MODESTD) == 0) ||
|
||||||
if (( nMode == GDB_MD_STD && ( m_nFilter & EEXFLT_MODESTD) == 0) ||
|
( nMode == GDB_MD_LOCKED && ( nFilter & EEXFLT_MODELOCKED) == 0) ||
|
||||||
( nMode == GDB_MD_LOCKED && ( m_nFilter & EEXFLT_MODELOCKED) == 0) ||
|
( nMode == GDB_MD_HIDDEN && ( nFilter & EEXFLT_MODEHIDDEN) == 0))
|
||||||
( nMode == GDB_MD_HIDDEN && ( m_nFilter & EEXFLT_MODEHIDDEN) == 0))
|
|
||||||
return false ;
|
return false ;
|
||||||
if (( nStat == GDB_ST_OFF && ( m_nFilter & EEXFLT_STAOFF) == 0) ||
|
if ( ( nStat == GDB_ST_OFF && ( nFilter & EEXFLT_STAOFF) == 0) ||
|
||||||
( nStat == GDB_ST_ON && ( m_nFilter & EEXFLT_STAON) == 0) ||
|
( nStat == GDB_ST_ON && ( nFilter & EEXFLT_STAON) == 0) ||
|
||||||
( nStat == GDB_ST_SEL && ( m_nFilter & EEXFLT_STASEL) == 0))
|
( nStat == GDB_ST_SEL && ( nFilter & EEXFLT_STASEL) == 0))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
ExportThreeJS::CalcGroupFilter( void)
|
||||||
|
{
|
||||||
|
m_nGroupFilter = 0 ;
|
||||||
|
// Status
|
||||||
|
if ( ( m_nFilter & EEXFLT_STASEL) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_STASEL + EEXFLT_STAOFF + EEXFLT_STAON ;
|
||||||
|
else if ( ( m_nFilter & EEXFLT_STAOFF) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_STAOFF + EEXFLT_STAON ;
|
||||||
|
else
|
||||||
|
m_nGroupFilter += EEXFLT_STAON ;
|
||||||
|
// Mode
|
||||||
|
if ( ( m_nFilter & EEXFLT_MODELOCKED) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_MODELOCKED + EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
|
||||||
|
else if ( ( m_nFilter & EEXFLT_MODEHIDDEN) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
|
||||||
|
else
|
||||||
|
m_nGroupFilter += EEXFLT_MODESTD ;
|
||||||
|
// Level
|
||||||
|
if ( ( m_nFilter & EEXFLT_LEVSYSTEM) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_LEVSYSTEM + EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
|
||||||
|
else if ( ( m_nFilter & EEXFLT_LEVTEMP) != 0)
|
||||||
|
m_nGroupFilter += EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
|
||||||
|
else
|
||||||
|
m_nGroupFilter += EEXFLT_LEVUSER ;
|
||||||
|
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|||||||
+7
-3
@@ -38,7 +38,9 @@ class ExportThreeJS : public IExportThreeJS
|
|||||||
virtual bool Export( IGeomDB* pGDB, int nId, IEGrScene* pScene, bool bUdm, const std::string& sFile) ;
|
virtual bool Export( IGeomDB* pGDB, int nId, IEGrScene* pScene, bool bUdm, const std::string& sFile) ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ExportThreeJS( void) : m_nFilter( EEXFLT_DEFAULT), m_bShowGrid( true), m_nGroupCount( -1), m_nCont( 0) {}
|
ExportThreeJS( void) : m_nFilter( EEXFLT_DEFAULT), m_bShowGrid( true), m_nGroupCount( -1), m_nCont( 0) {
|
||||||
|
CalcGroupFilter() ;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool HeadAmbient( IEGrScene* pScene, IGeomDB* pGDB, int nId) ;
|
bool HeadAmbient( IEGrScene* pScene, IGeomDB* pGDB, int nId) ;
|
||||||
@@ -56,10 +58,12 @@ class ExportThreeJS : public IExportThreeJS
|
|||||||
bool ExportDimension( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
|
bool ExportDimension( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
|
||||||
bool ScanGroup( const IGdbIterator& iIter, IGeomDB* pGDB, const int nIdGroup) ;
|
bool ScanGroup( const IGdbIterator& iIter, IGeomDB* pGDB, const int nIdGroup) ;
|
||||||
bool ExportObject( const IGdbIterator& iIter, IGeomDB* pGDB, const int nIdGroup) ;
|
bool ExportObject( const IGdbIterator& iIter, IGeomDB* pGDB, const int nIdGroup) ;
|
||||||
bool TestFilter( int nLev, int nMode, int nStat) ;
|
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup) ;
|
||||||
|
bool CalcGroupFilter( void) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_nFilter ; // Filtro su livello, modo e stato
|
int m_nFilter ; // filtro su livello, modo e stato, se l'oggeto da valutare è un oggetto geometrico
|
||||||
|
int m_nGroupFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare è un gruppo
|
||||||
Point3d m_ptMin ; // Punto minimo del box3d
|
Point3d m_ptMin ; // Punto minimo del box3d
|
||||||
double m_dimX ; // DimX Box3d Global
|
double m_dimX ; // DimX Box3d Global
|
||||||
double m_dimY ; // DimY Box3d Global
|
double m_dimY ; // DimY Box3d Global
|
||||||
|
|||||||
-1401
File diff suppressed because it is too large
Load Diff
-64
@@ -1,64 +0,0 @@
|
|||||||
//----------------------------------------------------------------------------
|
|
||||||
// EgalTech 2023
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// File : Import3dm.h Data : 23.06.23 Versione : 2.5f1
|
|
||||||
// Contenuto : Dichiarazione della classe Import3dm.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Modifiche : 23.06.23 DB Creazione modulo.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#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 ON_3dVector ;
|
|
||||||
class ON_2dVector ;
|
|
||||||
class ON_NurbsSurface ;
|
|
||||||
class ICurve ;
|
|
||||||
class ICurveArc ;
|
|
||||||
class ICurveLine ;
|
|
||||||
class ISurf ;
|
|
||||||
class ISurfTriMesh ;
|
|
||||||
class ISurfFlatRegion ;
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
class Import3dm : public IImport3dm
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup, double dScaleFactor = 1,
|
|
||||||
double dTextHeight = 2.0, double dExtLine = 5.0, double dArrLen = 5.0, double dTextDist = 2.0,
|
|
||||||
bool bLenIsMM = true, int nDecDig = -2, std::string sFont = "ModernPropS.Nfe") override ;
|
|
||||||
|
|
||||||
private :
|
|
||||||
Point3d ConvertPoint( const ON_Point& onPoint) ;
|
|
||||||
Point3d ConvertPoint( const ON_3dPoint& on3dPoint) ;
|
|
||||||
Point3d ConvertPoint( const ON_4dPoint& on4dPoint) ;
|
|
||||||
Point3d ConvertPoint( const ON_3fPoint& on3fPoint) ;
|
|
||||||
Vector3d ConvertVector( const ON_3dVector& onVector) ;
|
|
||||||
Vector3d ConvertVector( const ON_2dVector& onVector) ;
|
|
||||||
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) ;
|
|
||||||
bool MakeUniform( ISurfFlatRegion** sfr, ON_NurbsSurface onNurbsSurface, double& dScaleU, double& dScaleV) ;
|
|
||||||
|
|
||||||
private :
|
|
||||||
IGeomDB* m_pGDB ;
|
|
||||||
int m_nIdGroup ;
|
|
||||||
double m_dScaleFactor ;
|
|
||||||
} ;
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
//----------------------------------------------------------------------------
|
|
||||||
// EgalTech 2023
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// File : Import3dmEnts.cpp Data : 27.06.23 Versione : 2.5f1
|
|
||||||
// Contenuto : Implementazione di Import3dm : gestione delle entità.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Modifiche : 27.06.23 DB Creazione modulo.
|
|
||||||
//
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//--------------------------- Include ----------------------------------------
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "Import3dm.h"
|
|
||||||
#include "DllMain.h"
|
|
||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
|
||||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
|
||||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
|
||||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
|
||||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
|
||||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
|
||||||
#include "/EgtDev/Include/EGkCurveAux.h"
|
|
||||||
#include "/EgtDev/Include/EGkCurveByInterp.h"
|
|
||||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
|
||||||
#include "/EgtDev/Include/EGkExtText.h"
|
|
||||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
|
||||||
#include "/EgtDev/Include/EGnStringKeyVal.h"
|
|
||||||
#include "/EgtDev/Include/EgtStringEncoder.h"
|
|
||||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
|
||||||
|
|
||||||
using namespace std ;
|
|
||||||
|
|
||||||
|
|
||||||
+2
-1
@@ -2253,8 +2253,9 @@ ImportDxf::ReadSpline( bool& bFileEnd)
|
|||||||
}
|
}
|
||||||
// assegnazione flag
|
// assegnazione flag
|
||||||
cnData.bRat = (( nFlag & SPL_RATIONAL) != 0) ;
|
cnData.bRat = (( nFlag & SPL_RATIONAL) != 0) ;
|
||||||
cnData.bPeriodic = (( nFlag & SPL_PERIODIC) != 0 && ( nKnotNbr != nCPntNbr + cnData.nDeg +1)) ;
|
cnData.bPeriodic = (( nFlag & SPL_PERIODIC) != 0 && ( nKnotNbr != nCPntNbr + cnData.nDeg + 1)) ;
|
||||||
cnData.bClosed = (( nFlag & SPL_CLOSED) != 0) ;
|
cnData.bClosed = (( nFlag & SPL_CLOSED) != 0) ;
|
||||||
|
cnData.bClamped = true ;
|
||||||
cnData.bExtraKnotes = true ;
|
cnData.bExtraKnotes = true ;
|
||||||
// Verifico il numero di nodi
|
// Verifico il numero di nodi
|
||||||
if ( cnData.vU.size() != nKnotNbr || nKnotNbr < 4)
|
if ( cnData.vU.size() != nKnotNbr || nKnotNbr < 4)
|
||||||
|
|||||||
@@ -34,6 +34,5 @@
|
|||||||
#pragma comment(lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")
|
#pragma comment(lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")
|
||||||
#pragma comment(lib, EGTEXTDIR "/libzip/Lib/zip" EGTLIBVER ".lib")
|
#pragma comment(lib, EGTEXTDIR "/libzip/Lib/zip" EGTLIBVER ".lib")
|
||||||
#pragma comment(lib, EGTEXTDIR "/lib3mf/Lib/lib3mf" EGTLIBVER ".lib")
|
#pragma comment(lib, EGTEXTDIR "/lib3mf/Lib/lib3mf" EGTLIBVER ".lib")
|
||||||
#pragma comment(lib, EGTEXTDIR "/opennurbs/Lib/opennurbs_public" EGTLIBVER ".lib")
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user