Compare commits
181 Commits
ThreeJS_Fiera
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 91d1260d8a | |||
| aead658f5d | |||
| 82a5161b07 | |||
| f923477b7e | |||
| 96a5f77b12 | |||
| c47b3ee4d3 | |||
| c1f32c6c59 | |||
| 30b1085ef5 | |||
| 9577795c73 | |||
| e7e7cb21bd | |||
| 5e74d640aa | |||
| 398f7d86a6 | |||
| 8eaf7c174f | |||
| 18c7c4601a | |||
| df864c93a8 | |||
| e16657f560 | |||
| 1f24ff1dfb | |||
| 8d70d31eff | |||
| a874068e7b | |||
| 15dfae1789 | |||
| 62aecf63eb | |||
| 2bb1767c9d | |||
| 798c23e42d | |||
| 13c2a1d9e5 | |||
| 83215059a5 | |||
| 120e341fb7 | |||
| b7c3dbc576 | |||
| 1e09cdff14 | |||
| 53962aa5c1 | |||
| c16fba2752 | |||
| 03eb6707ee | |||
| c8b4cd9bee | |||
| 9331803efc | |||
| 050d3acd60 | |||
| ac55ab01df | |||
| 4ab0d89e60 | |||
| b6d4d76783 | |||
| b366963eee | |||
| d1a19ed42f | |||
| ae950c0efa | |||
| aa80fb63af | |||
| 7778cf5027 | |||
| bb75d9c878 | |||
| f54f1f8969 | |||
| a71e1211d1 | |||
| 75d5fc367c | |||
| 6624da2a03 | |||
| 3d8c83f33c | |||
| 584cec6f1c | |||
| 7ed7f56415 | |||
| 22d47e551a | |||
| 6434dc6c89 | |||
| ca58abb125 | |||
| f7fb6d3435 | |||
| ad9acebd04 | |||
| 3543839299 | |||
| b5a3fb5543 | |||
| 80634b8fcd | |||
| 025336f011 | |||
| deaab1767f | |||
| ee8d0c8c21 | |||
| 1a7483b7c4 | |||
| 3205e80262 | |||
| 567a7ddba6 | |||
| f8dc7803b5 | |||
| d4fb909a0f | |||
| cf05547a38 | |||
| 926074db57 | |||
| 254d4792cf | |||
| 0dd44e569a | |||
| ba8a4c8914 | |||
| 55fb88d85b | |||
| b8fb6d9a07 | |||
| f25473dfd2 | |||
| 977fe9f016 | |||
| d38beed861 | |||
| 55a02dc387 | |||
| e18833d837 | |||
| 7d25e262c2 | |||
| e32c603647 | |||
| b6847a3da7 | |||
| 0316c32afb | |||
| 0db5c4aa91 | |||
| 4399074418 | |||
| e0dcd3f3ac | |||
| 7a78c4e832 | |||
| 77447763b3 | |||
| f50d5b7612 | |||
| 1636f8c0b4 | |||
| c08486acb7 | |||
| 281e7183bd | |||
| 8959255d29 | |||
| d3bf0a7839 | |||
| 2e385022f3 | |||
| de4b31b950 | |||
| 47e4b3c0a5 | |||
| 55f20bf4ec | |||
| 3557e2652e | |||
| c18d3e3163 | |||
| db76003aae | |||
| dcfc78e7ca | |||
| 966dfeabae | |||
| 3428e12cf6 | |||
| 0a3a4ce532 | |||
| 44e1517a59 | |||
| cc0c8e7ed8 | |||
| ef92d58ac1 | |||
| 7786be93d0 | |||
| 2804bf0b60 | |||
| 5e8e6aebb1 | |||
| 93ef6fe319 | |||
| 09c8aa2d66 | |||
| 2f5e2203c0 | |||
| 06b7d51b0a | |||
| a7a0157fed | |||
| 3bf1f66883 | |||
| 731c4d1b61 | |||
| 898d979e08 | |||
| e9dff179e0 | |||
| 9f7bdb2202 | |||
| 329646ca9d | |||
| 4c84f4adff | |||
| 2c9da3e14d | |||
| 39f9fd86e7 | |||
| 4cfdf2b872 | |||
| 2a0e7bed0b | |||
| 5c8a2974cb | |||
| 31eb6acb0b | |||
| def9225e61 | |||
| 306734dc97 | |||
| 9febfb8147 | |||
| de4d1fc711 | |||
| 8d11dc838a | |||
| 3ab1488fbb | |||
| c5503427cb | |||
| 1dc2992628 | |||
| 7453297954 | |||
| 549f3d47bd | |||
| 595452db1e | |||
| 1061fee7ef | |||
| f7f2921607 | |||
| dc7977d64e | |||
| edf44dd718 | |||
| ae559b3d58 | |||
| 4049b25d7d | |||
| 8c73d977f5 | |||
| b3d4c9909d | |||
| 8426092c6f | |||
| 48a590d27a | |||
| 69d368e15d | |||
| 29c62ecc94 | |||
| 3f03526fd5 | |||
| 3a47f8962b | |||
| d24d500a9e | |||
| cdb28104a9 | |||
| 26b1107e33 | |||
| 55449f3c3f | |||
| d4cc57e2f9 | |||
| a992b48201 | |||
| c2c0e7d246 | |||
| a75725dd05 | |||
| defa91177e | |||
| a9d52a5c49 | |||
| c9753c73f9 | |||
| fcbe6c2db1 | |||
| 49d3e03199 | |||
| 35b07c0814 | |||
| fa3e5c4709 | |||
| 1615636771 | |||
| 036fe2da43 | |||
| e3c681bfa2 | |||
| c9b38409ca | |||
| 91d13357f3 | |||
| d1f284c718 | |||
| 7fd08a5562 | |||
| 64fe515d8f | |||
| 0689e7df19 | |||
| 336c172eee | |||
| 4b051ea0ec | |||
| 3a66786af8 | |||
| b26b1ef2f9 |
+440
-88
@@ -18,9 +18,11 @@
|
||||
#include "/EgtDev/Include/EExDllMain.h"
|
||||
#include "/EgtDev/Include/EGkStmStandard.h"
|
||||
#include "/EgtDev/Include/EGkStmFromCurves.h"
|
||||
#include "/EgtDev/Include/EGkExtText.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtStringEncoder.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include <future>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -29,7 +31,7 @@ IBeamMgr*
|
||||
CreateBeamMgr( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPADV, GetEExLogger()))
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPADV))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IBeamMgr*> ( new(nothrow) BeamMgr) ;
|
||||
@@ -69,7 +71,8 @@ BeamMgr::SetFlag( int nFlag)
|
||||
bool bSpecialTrim = (( nFlag & EIBFLAG_SPECIAL_TRIM) != 0) ;
|
||||
bool bTrimWithOutline = (( nFlag & EIBFLAG_TRIM_WITH_OUTLINE) != 0) ;
|
||||
bool bUseUAttr = (( nFlag & EIBFLAG_USEUATTR) != 0) ;
|
||||
if ( ! m_BtlGeom.Init( m_pGDB, nFlatVertPos, bSpecialTrim, bTrimWithOutline, bUseUAttr)) {
|
||||
bool bPartOffset = (( nFlag & EIBFLAG_PARTOFFSET) != 0) ;
|
||||
if ( ! m_BtlGeom.Init( m_pGDB, nFlatVertPos, bSpecialTrim, bTrimWithOutline, bUseUAttr, bPartOffset, false)) {
|
||||
LOG_ERROR( GetEExLogger(), " Error on BtlGeom.Init")
|
||||
return false ;
|
||||
}
|
||||
@@ -81,7 +84,7 @@ BeamMgr::SetFlag( int nFlag)
|
||||
int
|
||||
BeamMgr::CreatePart( void)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// Aggiorno posizione
|
||||
@@ -94,7 +97,7 @@ BeamMgr::CreatePart( void)
|
||||
bool
|
||||
BeamMgr::SetPart( int nPartId)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Imposto il pezzo come corrente
|
||||
@@ -105,7 +108,7 @@ BeamMgr::SetPart( int nPartId)
|
||||
bool
|
||||
BeamMgr::ErasePart( void)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Cancello il pezzo corrente
|
||||
@@ -116,7 +119,7 @@ BeamMgr::ErasePart( void)
|
||||
bool
|
||||
BeamMgr::UpdatePart( void)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Forzo aggiornamento del pezzo corrente
|
||||
@@ -127,10 +130,13 @@ BeamMgr::UpdatePart( void)
|
||||
bool
|
||||
BeamMgr::SetPartProdNbr( int nProdNbr)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Imposto il numero di produzione al pezzo corrente
|
||||
// Verifico validità nuovo PDN
|
||||
if ( ! m_BtlGeom.VerifyNewPartProdNbr( nProdNbr))
|
||||
return false ;
|
||||
// Imposto il numero di produzione sul pezzo corrente
|
||||
return m_BtlGeom.SetPartProdNbr( nProdNbr) ;
|
||||
}
|
||||
|
||||
@@ -138,10 +144,10 @@ BeamMgr::SetPartProdNbr( int nProdNbr)
|
||||
bool
|
||||
BeamMgr::SetPartName( const string& sName)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Imposto il nome al pezzo corrente
|
||||
// Imposto il nome sul pezzo corrente
|
||||
return m_BtlGeom.SetPartName( sName) ;
|
||||
}
|
||||
|
||||
@@ -149,10 +155,10 @@ BeamMgr::SetPartName( const string& sName)
|
||||
bool
|
||||
BeamMgr::SetPartCount( int nCount)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Imposto il numero delle parti da produrre al pezzo corrente
|
||||
// Imposto il numero delle parti da produrre sul pezzo corrente
|
||||
return m_BtlGeom.SetPartCount( nCount) ;
|
||||
}
|
||||
|
||||
@@ -160,12 +166,15 @@ BeamMgr::SetPartCount( int nCount)
|
||||
bool
|
||||
BeamMgr::SetPartBox( double dLength, double dHeight, double dWidth, bool bUpdate)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Imposto le dimensioni al pezzo corrente
|
||||
// Imposto le dimensioni sul pezzo corrente
|
||||
if ( ! m_BtlGeom.AddPartBox( dLength, dHeight, dWidth))
|
||||
return false ;
|
||||
// Eventuale aggiornamento nomi facce e lato di carico
|
||||
UpdateFacesName() ;
|
||||
UpdateLoadingSide() ;
|
||||
// Se richiesto, aggiorno Outline e cancello Solido
|
||||
if ( bUpdate) {
|
||||
m_BtlGeom.UpdateOutLine() ;
|
||||
@@ -178,10 +187,10 @@ BeamMgr::SetPartBox( double dLength, double dHeight, double dWidth, bool bUpdate
|
||||
bool
|
||||
BeamMgr::GetSideData( int nSide, Frame3d& frRef, double& dLength, double& dWidth, double& dHeight)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Verifico validità identificativo di faccia
|
||||
// Verifico validità identificativo di faccia
|
||||
if ( nSide < BTL_SIDE_FRONT || nSide > BTL_SIDE_RIGHT)
|
||||
return false ;
|
||||
// Recupero riferimento del pezzo corrente
|
||||
@@ -199,13 +208,164 @@ BeamMgr::GetSideData( int nSide, Frame3d& frRef, double& dLength, double& dWidth
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::ShowFacesName( bool bShow)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Verifico esistenza del pezzo corrente
|
||||
int nPartId = m_BtlGeom.GetCurrPartId() ;
|
||||
if ( nPartId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// Verifico esistenza del gruppo nomi facce
|
||||
int nFcsNameLayId = m_pGDB->GetFirstNameInGroup( nPartId, FCSNAME_LAYER_NAME) ;
|
||||
// Se da visualizzare e non esiste il gruppo
|
||||
if ( bShow && nFcsNameLayId == GDB_ID_NULL) {
|
||||
// Creazione del gruppo
|
||||
nFcsNameLayId = m_pGDB->AddGroup( GDB_ID_NULL, nPartId, GLOB_FRM) ;
|
||||
m_pGDB->SetLevel( nFcsNameLayId, GDB_LV_TEMP) ;
|
||||
m_pGDB->SetName( nFcsNameLayId, FCSNAME_LAYER_NAME) ;
|
||||
m_pGDB->SetMaterial( nFcsNameLayId, NAVY) ;
|
||||
// Scrittura del nome delle facce come testi del layer ausiliario
|
||||
for ( int nS = BTL_SIDE_FRONT ; nS <= BTL_SIDE_RIGHT ; ++ nS) {
|
||||
string sFace ;
|
||||
if ( nS == BTL_SIDE_LEFT)
|
||||
sFace = "o" ;
|
||||
else if ( nS == BTL_SIDE_RIGHT)
|
||||
sFace = "+" ;
|
||||
else
|
||||
sFace = "F" + ToString( nS) ;
|
||||
PtrOwner<IExtText> pText( CreateExtText()) ;
|
||||
if ( IsNull( pText))
|
||||
return false ;
|
||||
double dSLen = m_BtlGeom.GetSideLength( nS) ;
|
||||
double dSWid = m_BtlGeom.GetSideWidth( nS) ;
|
||||
Point3d ptPos( 0.5 * dSLen, ( m_BtlGeom.IsTrueSide( nS) ? 10 : 0.5 * dSWid), 1) ;
|
||||
Vector3d vtDir = ( nS != BTL_SIDE_RIGHT ? X_AX : -X_AX) ;
|
||||
int nInsPos = ( m_BtlGeom.IsTrueSide( nS) ? ETXT_IPBC : ETXT_IPMC) ;
|
||||
double dPLen = m_BtlGeom.GetCurrPartLength() ;
|
||||
double dPHei = m_BtlGeom.GetCurrPartHeight() ;
|
||||
double dPWid = m_BtlGeom.GetCurrPartWidth() ;
|
||||
double dCoeff = ( abs( dPHei - dPWid) / abs( dPHei + dPWid) < 0.51 ? 0.1 : 0.2) ;
|
||||
double dTextHeight = dCoeff * min( { dPLen, dPHei, dPWid}) ;
|
||||
if ( ! pText->Set( ptPos, Z_AX, vtDir, sFace, "Arial", 100, false, 2 * dTextHeight, 1, 0, nInsPos))
|
||||
return false ;
|
||||
// porto il testo nel piano della faccia
|
||||
Frame3d frRef = m_BtlGeom.GetSideFrame( nS) ;
|
||||
pText->ToGlob( frRef) ;
|
||||
// recupero eventuale nome già presente
|
||||
int nOldTextId = m_pGDB->GetFirstNameInGroup( nFcsNameLayId, sFace) ;
|
||||
// se gia presente, lo rimpiazzo
|
||||
if ( nOldTextId != GDB_ID_NULL) {
|
||||
if ( ! m_pGDB->ReplaceGeoObj( nOldTextId, Release( pText)))
|
||||
return false ;
|
||||
}
|
||||
// altrimenti, lo inserisco
|
||||
else {
|
||||
int nTextId = m_pGDB->AddGeoObj( GDB_ID_NULL, nFcsNameLayId, Release( pText)) ;
|
||||
if ( nTextId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// assegno nome
|
||||
m_pGDB->SetName( nTextId, sFace) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// se altrimenti da eliminare ed esiste
|
||||
else if ( ! bShow && nFcsNameLayId != GDB_ID_NULL) {
|
||||
m_pGDB->Erase( nFcsNameLayId) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::UpdateFacesName( void)
|
||||
{
|
||||
int nFcsNameLayId = m_pGDB->GetFirstNameInGroup( m_BtlGeom.GetCurrPartId(), FCSNAME_LAYER_NAME) ;
|
||||
if ( nFcsNameLayId == GDB_ID_NULL)
|
||||
return true ;
|
||||
m_pGDB->Erase( nFcsNameLayId) ;
|
||||
return ShowFacesName( true) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::ShowLoadingSide( bool bShow, bool bFromLeft)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Verifico esistenza del pezzo corrente
|
||||
int nPartId = m_BtlGeom.GetCurrPartId() ;
|
||||
if ( nPartId == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
// Verifico esistenza del gruppo temporaneo lato di carico
|
||||
int nLsideGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, LOADINGSIDE_GROUP_NAME) ;
|
||||
// Se da visualizzare e non esiste il gruppo
|
||||
if ( bShow && nLsideGrpId == GDB_ID_NULL) {
|
||||
// Creazione del gruppo
|
||||
nLsideGrpId = m_pGDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, GLOB_FRM) ;
|
||||
m_pGDB->SetLevel( nLsideGrpId, GDB_LV_TEMP) ;
|
||||
m_pGDB->SetName( nLsideGrpId, LOADINGSIDE_GROUP_NAME) ;
|
||||
m_pGDB->SetMaterial( nLsideGrpId, NAVY) ;
|
||||
m_pGDB->SetInfo( nLsideGrpId, IKEY_LSIDE, bFromLeft) ;
|
||||
// Recupero dati del pezzo
|
||||
Frame3d frPart ;
|
||||
if ( ! m_pGDB->GetGroupGlobFrame( nPartId, frPart))
|
||||
return false ;
|
||||
BBox3d b3Part( 0, 0, 0, m_BtlGeom.GetCurrPartLength(), m_BtlGeom.GetCurrPartHeight(), m_BtlGeom.GetCurrPartWidth()) ;
|
||||
b3Part.ToGlob( frPart) ;
|
||||
// Disegno della freccia
|
||||
PolyLine PL ;
|
||||
PL.AddUPoint( 0, Point3d( 140, 0, 0)) ;
|
||||
PL.AddUPoint( 0, Point3d( 100, -40, 0)) ;
|
||||
PL.AddUPoint( 0, Point3d( 100, -20, 0)) ;
|
||||
PL.AddUPoint( 0, Point3d( 0, -20, 0)) ;
|
||||
PL.AddUPoint( 0, Point3d( 0, 20, 0)) ;
|
||||
PL.AddUPoint( 0, Point3d( 100, 20, 0)) ;
|
||||
PL.AddUPoint( 0, Point3d( 100, 40, 0)) ;
|
||||
PL.AddUPoint( 0, Point3d( 140, 0, 0)) ;
|
||||
Vector3d vtMove = b3Part.GetMin() + ( b3Part.GetDimX() + 50) * X_AX + b3Part.GetDimY() / 2 * Y_AX - ORIG ;
|
||||
PL.Translate( vtMove) ;
|
||||
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pStm) || ! pStm->CreateByFlatContour( PL))
|
||||
return false ;
|
||||
int nStmId = m_pGDB->AddGeoObj( GDB_ID_NULL, nLsideGrpId, Release( pStm)) ;
|
||||
if ( nStmId == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se altrimenti da eliminare ed esiste
|
||||
else if ( ! bShow && nLsideGrpId != GDB_ID_NULL) {
|
||||
m_pGDB->Erase( nLsideGrpId) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::UpdateLoadingSide( void)
|
||||
{
|
||||
int nLsideGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, LOADINGSIDE_GROUP_NAME) ;
|
||||
if ( nLsideGrpId == GDB_ID_NULL)
|
||||
return true ;
|
||||
bool bFromLeft = true ;
|
||||
m_pGDB->GetInfo( nLsideGrpId, IKEY_LSIDE, bFromLeft) ;
|
||||
m_pGDB->Erase( nLsideGrpId) ;
|
||||
return ShowLoadingSide( true, bFromLeft) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
BeamMgr::AddProcess( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
|
||||
const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar, const STRVECTOR& vsUAtt,
|
||||
int nCrvId, int nCrv2Id, bool bUpdate)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// Recupero i dati di default della feature
|
||||
@@ -218,7 +378,7 @@ BeamMgr::AddProcess( int nGroup, int nProc, int nSide, const string& sDes, int n
|
||||
// Imposto i dati della feature
|
||||
for ( int i = 0 ; i < int( vnDPar.size()) ; ++ i) {
|
||||
int j = vnDPar[i] ;
|
||||
if ( j - 1 < int( vdPar.size()))
|
||||
if ( j > 0 && j - 1 < int( vdPar.size()))
|
||||
vdBtlPar[i] = vdPar[j-1] ;
|
||||
}
|
||||
sBtlPar = sPar ;
|
||||
@@ -257,7 +417,7 @@ BeamMgr::ModifyProcess( int nGeomId, int nGroup, int nProc, int nSide, const str
|
||||
const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar, const STRVECTOR& vsUAtt,
|
||||
int nCrvId, int nCrv2Id, bool bUpdate)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// Recupero il pezzo di appartenenza
|
||||
@@ -306,7 +466,7 @@ BeamMgr::ModifyProcess( int nGeomId, int nGroup, int nProc, int nSide, const str
|
||||
bool
|
||||
BeamMgr::EraseProcess( int nGeomId, bool bUpdate)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Recupero il pezzo di appartenenza
|
||||
@@ -370,7 +530,7 @@ MyEnableProcess( IGeomDB* pGDB, BtlGeom& BtlG, int nGeomId, bool bEnable)
|
||||
bool
|
||||
BeamMgr::EnableProcess( int nGeomId, bool bEnable, bool bUpdate)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Recupero il pezzo di appartenenza
|
||||
@@ -402,6 +562,113 @@ BeamMgr::EnableProcess( int nGeomId, bool bEnable, bool bUpdate)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::CalcAllSolids( bool bShow, bool bRecalc, pcfProcEvents pFun)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
|
||||
// Recupero tutti i pezzi
|
||||
INTVECTOR vPartId ;
|
||||
int nPartId = m_pGDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
|
||||
while ( nPartId != GDB_ID_NULL) {
|
||||
int nLevel ;
|
||||
if ( m_pGDB->GetLevel( nPartId, nLevel) && nLevel == GDB_LV_USER &&
|
||||
m_pGDB->GetFirstNameInGroup( nPartId, BOX_LAYER_NAME) != GDB_ID_NULL) {
|
||||
vPartId.push_back( nPartId) ;
|
||||
// nascondo il layer del solido per non avere problemi con le visualizzazioni durante i calcoli in multithread
|
||||
m_pGDB->SetStatus( m_pGDB->GetFirstNameInGroup( nPartId, SOLID_LAYER_NAME), GDB_ST_OFF) ;
|
||||
}
|
||||
nPartId = m_pGDB->GetNextGroup( nPartId) ;
|
||||
}
|
||||
|
||||
// Calcolo i solidi
|
||||
bool bOk = true ;
|
||||
|
||||
constexpr bool MULTITHREAD = true ;
|
||||
if ( MULTITHREAD) {
|
||||
int nPartCnt = int( vPartId.size()) ;
|
||||
int nThreadMax = min( max( 1, int( thread::hardware_concurrency()) - 1), nPartCnt) ;
|
||||
vector< future<bool>> vRes( nPartCnt) ;
|
||||
INTVECTOR vInd( nThreadMax) ;
|
||||
// lancio tutto quanto possibile
|
||||
for ( int i = 0 ; i < nThreadMax ; ++ i) {
|
||||
vInd[i] = i ;
|
||||
vRes[vInd[i]] = async( launch::async, &BeamMgr::CalcSolid, this, vPartId[vInd[i]], bRecalc) ;
|
||||
}
|
||||
// attesa completamento e rilancio successivi (occupando sempre lo stesso numero di thread)
|
||||
int nNext = nThreadMax ;
|
||||
int nTerminated = 0 ;
|
||||
while ( nTerminated < nPartCnt) {
|
||||
for ( int i = 0 ; i < nThreadMax ; ++ i) {
|
||||
if ( vInd[i] >= 0 && vRes[vInd[i]].valid() && vRes[vInd[i]].wait_for( chrono::microseconds{ 1}) == future_status::ready) {
|
||||
++ nTerminated ;
|
||||
if ( ! vRes[vInd[i]].get())
|
||||
bOk = false ;
|
||||
ShowSolid( vPartId[vInd[i]], bShow) ;
|
||||
if ( pFun != nullptr)
|
||||
pFun( ( 100 * nTerminated) / nPartCnt, -1) ;
|
||||
if ( nNext < nPartCnt) {
|
||||
vInd[i] = nNext ;
|
||||
++ nNext ;
|
||||
vRes[vInd[i]] = async( launch::async, &BeamMgr::CalcSolid, this, vPartId[vInd[i]], bRecalc) ;
|
||||
}
|
||||
else
|
||||
vInd[i] = -1 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// non multithread solo per DEBUG
|
||||
else {
|
||||
int nPartCnt = int( vPartId.size()) ;
|
||||
for ( int i = 0 ; i < nPartCnt ; ++ i) {
|
||||
if ( ! CalcSolid( vPartId[i], bRecalc))
|
||||
bOk = false ;
|
||||
ShowSolid( vPartId[i], bShow) ;
|
||||
if ( pFun != nullptr)
|
||||
pFun( ( 100 * ( i + 1)) / nPartCnt, -1) ;
|
||||
}
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::ShowAllSolids( bool bShow, pcfProcEvents pFun)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
|
||||
// Recupero tutti i pezzi
|
||||
INTVECTOR vPartId ;
|
||||
int nPartId = m_pGDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
|
||||
while ( nPartId != GDB_ID_NULL) {
|
||||
int nLevel ;
|
||||
if ( m_pGDB->GetLevel( nPartId, nLevel) && nLevel == GDB_LV_USER &&
|
||||
m_pGDB->GetFirstNameInGroup( nPartId, BOX_LAYER_NAME) != GDB_ID_NULL)
|
||||
vPartId.push_back( nPartId) ;
|
||||
nPartId = m_pGDB->GetNextGroup( nPartId) ;
|
||||
}
|
||||
|
||||
// Aggiorno visualizzazione dei solidi
|
||||
bool bOk = true ;
|
||||
int nPartCnt = int( vPartId.size()) ;
|
||||
for ( int i = 0 ; i < nPartCnt ; ++ i) {
|
||||
if ( ! ShowSolid( vPartId[i], bShow))
|
||||
bOk = false ;
|
||||
if ( pFun != nullptr)
|
||||
pFun( ( 100 * ( i + 1)) / nPartCnt, -1) ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static ISurfTriMesh*
|
||||
RegularizeTriMesh( const ISurfTriMesh* pStm, double dStep)
|
||||
@@ -455,7 +722,7 @@ RegularizeTriMesh( const ISurfTriMesh* pStm, double dStep)
|
||||
if ( IsNull( pStmTmp))
|
||||
return nullptr ;
|
||||
if ( IsNull( pStmNew))
|
||||
pStmNew.Set( Release( pStmTmp)) ;
|
||||
pStmNew.Set( pStmTmp) ;
|
||||
else
|
||||
pStmNew->DoSewing( *pStmTmp) ;
|
||||
// recupero una nuova copia della faccetta originale
|
||||
@@ -469,11 +736,51 @@ RegularizeTriMesh( const ISurfTriMesh* pStm, double dStep)
|
||||
return Release( pStmNew) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
IntersectOneFeature( int nProcId, int nTrim, double dStep, IGeomDB* pGDB, ISurfTriMesh* pStm)
|
||||
{
|
||||
// recupero eventuale superficie originale
|
||||
int nProcSurfId = nProcId ;
|
||||
int nOrigId = 0 ;
|
||||
if ( pGDB->GetInfo( nProcSurfId, IKEY_ORIGID, nOrigId))
|
||||
nProcSurfId += nOrigId ;
|
||||
// se da utilizzare anche superfici ausiliarie
|
||||
if ( nTrim == 2) {
|
||||
int nAux ;
|
||||
if ( pGDB->GetInfo( nProcSurfId, IKEY_AUXID, nAux)) {
|
||||
const ISurfTriMesh* pStmProc = GetSurfTriMesh( pGDB->GetGeoObj( nProcSurfId)) ;
|
||||
const ISurfTriMesh* pAux = GetSurfTriMesh( pGDB->GetGeoObj( nProcSurfId + nAux)) ;
|
||||
if ( pStmProc != nullptr && ! pStmProc->IsEmpty() && pAux != nullptr && ! pAux->IsEmpty()) {
|
||||
PtrOwner<ISurfTriMesh> pTrim( pAux->Clone()) ;
|
||||
if ( IsNull( pTrim) || ! pTrim->DoSewing( *pStmProc))
|
||||
return false ;
|
||||
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pTrim, dStep)) ;
|
||||
const ISurfTriMesh* pStmTool = ( ! IsNull( pStmTmp) ? Get( pStmTmp) : Get( pTrim)) ;
|
||||
if ( pStmTool == nullptr || ! pStm->Intersect( *pStmTool))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// caso standard
|
||||
else {
|
||||
const ISurfTriMesh* pStmProc = GetSurfTriMesh( pGDB->GetGeoObj( nProcSurfId)) ;
|
||||
if ( ! pStmProc->IsEmpty()) {
|
||||
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pStmProc, dStep)) ;
|
||||
if ( ! IsNull( pStmTmp))
|
||||
pStmProc = Get( pStmTmp) ;
|
||||
if ( pStmProc == nullptr || ! pStm->Intersect( *pStmProc))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::CalcSolid( int nPartId, bool bRecalc)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Verifico esistenza del pezzo
|
||||
@@ -491,32 +798,34 @@ BeamMgr::CalcSolid( int nPartId, bool bRecalc)
|
||||
m_pGDB->SetMaterial( nSolLayId, Color(255, 160, 32)) ;
|
||||
}
|
||||
int nSolidId = m_pGDB->GetFirstNameInGroup( nSolLayId, SOLID_SOLID_NAME) ;
|
||||
const ISurfTriMesh* pOldStm = GetSurfTriMesh( m_pGDB->GetGeoObj( nSolidId)) ;
|
||||
if ( pOldStm == nullptr || pOldStm->GetFacetCount() == 0)
|
||||
if ( ! m_pGDB->ExistsInfo( nSolidId, IKEY_VALID))
|
||||
bRecalc = true ;
|
||||
if ( bRecalc) {
|
||||
BBox3d b3Box ;
|
||||
m_pGDB->GetLocalBBox( nBoxId, b3Box, BBF_STANDARD) ;
|
||||
Point3d ptMin ; double dDimX, dDimY, dDimz ;
|
||||
if ( ! b3Box.GetMinDim( ptMin, dDimX, dDimY, dDimz))
|
||||
const ISurfTriMesh* pOldStm = GetSurfTriMesh( m_pGDB->GetGeoObj( nSolidId)) ;
|
||||
if ( pOldStm == nullptr || pOldStm->IsEmpty())
|
||||
bRecalc = true ;
|
||||
// Se non necessario ricalcolo, esco con successo
|
||||
if ( ! bRecalc)
|
||||
return true ;
|
||||
|
||||
// Calcolo il solido senza feature
|
||||
BBox3d b3Box ;
|
||||
m_pGDB->GetLocalBBox( nBoxId, b3Box, BBF_STANDARD) ;
|
||||
Point3d ptMin ; double dDimX, dDimY, dDimZ ;
|
||||
if ( ! b3Box.GetMinDim( ptMin, dDimX, dDimY, dDimZ))
|
||||
return false ;
|
||||
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshBox( dDimX, dDimY, dDimZ, false)) ;
|
||||
if ( IsNull( pSTM))
|
||||
return false ;
|
||||
pSTM->Translate( ptMin - ORIG) ;
|
||||
if ( nSolidId != GDB_ID_NULL) {
|
||||
if ( ! m_pGDB->ReplaceGeoObj( nSolidId, Release( pSTM)))
|
||||
return false ;
|
||||
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshBox( dDimX, dDimY, dDimz, false)) ;
|
||||
if ( IsNull( pSTM))
|
||||
return false ;
|
||||
pSTM->Translate( ptMin - ORIG) ;
|
||||
if ( nSolidId != GDB_ID_NULL) {
|
||||
if ( ! m_pGDB->ReplaceGeoObj( nSolidId, Release( pSTM)))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
nSolidId = m_pGDB->AddGeoObj( GDB_ID_NULL, nSolLayId, Release( pSTM)) ;
|
||||
if ( nSolidId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGDB->SetName( nSolidId, SOLID_SOLID_NAME) ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return true ;
|
||||
nSolidId = m_pGDB->AddGeoObj( GDB_ID_NULL, nSolLayId, Release( pSTM)) ;
|
||||
if ( nSolidId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGDB->SetName( nSolidId, SOLID_SOLID_NAME) ;
|
||||
}
|
||||
BBox3d b3Solid ;
|
||||
m_pGDB->GetLocalBBox( nSolidId, b3Solid, BBF_STANDARD) ;
|
||||
@@ -535,17 +844,21 @@ BeamMgr::CalcSolid( int nPartId, bool bRecalc)
|
||||
int nDO = 1 ;
|
||||
m_pGDB->GetInfo( nOutId, IKEY_DO, nDO) ;
|
||||
if ( nDO != 0 && m_pGDB->GetGeoType( nOutId) == SRF_TRIMESH) {
|
||||
// sempre standard
|
||||
const ISurfTriMesh* pStmOut = GetSurfTriMesh( m_pGDB->GetGeoObj( nOutId)) ;
|
||||
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pStmOut, dStep)) ;
|
||||
if ( ! IsNull( pStmTmp))
|
||||
pStmOut = Get( pStmTmp) ;
|
||||
if ( pStmOut == nullptr || ! pStm->Intersect( *pStmOut))
|
||||
return false ;
|
||||
if ( ! pStmOut->IsEmpty()) {
|
||||
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pStmOut, dStep)) ;
|
||||
if ( ! IsNull( pStmTmp))
|
||||
pStmOut = Get( pStmTmp) ;
|
||||
if ( pStmOut == nullptr || ! pStm->Intersect( *pStmOut))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
nOutId = m_pGDB->GetNext( nOutId) ;
|
||||
}
|
||||
// ciclo sulle features
|
||||
// ciclo su feature troncanti (taglio di testa,..)
|
||||
int nProcLayId = m_pGDB->GetFirstNameInGroup( nPartId, PROCESSINGS_LAYER_NAME) ;
|
||||
INTVECTOR vUsedFea ;
|
||||
int nProcId = m_pGDB->GetFirstInGroup( nProcLayId) ;
|
||||
while ( nProcId != GDB_ID_NULL) {
|
||||
int nDO = 1 ;
|
||||
@@ -553,34 +866,36 @@ BeamMgr::CalcSolid( int nPartId, bool bRecalc)
|
||||
m_pGDB->GetInfo( nProcId, IKEY_DO, nDO) ;
|
||||
m_pGDB->GetInfo( nProcId, IKEY_TRIM, nTrim) ;
|
||||
if ( nDO != 0 && nTrim != 0 && m_pGDB->GetGeoType( nProcId) == SRF_TRIMESH) {
|
||||
if ( nTrim == 2) {
|
||||
int nAux ;
|
||||
if ( m_pGDB->GetInfo( nProcId, IKEY_AUXID, nAux)) {
|
||||
const ISurfTriMesh* pStmProc = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcId)) ;
|
||||
const ISurfTriMesh* pAux = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcId + nAux)) ;
|
||||
if ( pStmProc != nullptr && pAux != nullptr) {
|
||||
PtrOwner<ISurfTriMesh> pTrim ;
|
||||
pTrim.Set( pAux->Clone()) ;
|
||||
if ( IsNull( pTrim) || ! pTrim->DoSewing( *pStmProc))
|
||||
return false ;
|
||||
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pTrim, dStep)) ;
|
||||
const ISurfTriMesh* pStmTool = ( ! IsNull( pStmTmp) ? Get( pStmTmp) : Get( pTrim)) ;
|
||||
if ( pStmTool == nullptr || ! pStm->Intersect( *pStmTool))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const ISurfTriMesh* pStmProc = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcId)) ;
|
||||
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pStmProc, dStep)) ;
|
||||
if ( ! IsNull( pStmTmp))
|
||||
pStmProc = Get( pStmTmp) ;
|
||||
if ( pStmProc == nullptr || ! pStm->Intersect( *pStmProc))
|
||||
int nGroup = 0 ;
|
||||
int nProc = 0 ;
|
||||
m_pGDB->GetInfo( nProcId, IKEY_GROUP, nGroup) ;
|
||||
m_pGDB->GetInfo( nProcId, IKEY_PROC, nProc) ;
|
||||
if ( IS_CUT( nGroup, nProc) || IS_DOUBLE_CUT( nGroup, nProc) ||
|
||||
IS_TENON( nGroup, nProc) || IS_DOVETAIL_TENON( nGroup, nProc)) {
|
||||
if ( ! IntersectOneFeature( nProcId, nTrim, dStep, m_pGDB, pStm))
|
||||
return false ;
|
||||
vUsedFea.push_back( nProcId) ;
|
||||
}
|
||||
}
|
||||
nProcId = m_pGDB->GetNext( nProcId) ;
|
||||
}
|
||||
// ciclo sulle altre features
|
||||
nProcId = m_pGDB->GetFirstInGroup( nProcLayId) ;
|
||||
while ( nProcId != GDB_ID_NULL) {
|
||||
int nDO = 1 ;
|
||||
int nTrim = 1 ;
|
||||
m_pGDB->GetInfo( nProcId, IKEY_DO, nDO) ;
|
||||
m_pGDB->GetInfo( nProcId, IKEY_TRIM, nTrim) ;
|
||||
if ( find( vUsedFea.begin(), vUsedFea.end(), nProcId) == vUsedFea.end() &&
|
||||
nDO != 0 && nTrim != 0 && m_pGDB->GetGeoType( nProcId) == SRF_TRIMESH) {
|
||||
if ( ! IntersectOneFeature( nProcId, nTrim, dStep, m_pGDB, pStm))
|
||||
return false ;
|
||||
}
|
||||
nProcId = m_pGDB->GetNext( nProcId) ;
|
||||
}
|
||||
// imposto visualizzazione spigoli
|
||||
pStm->SetShowEdges( true) ;
|
||||
// dichiaro calcolato il solido
|
||||
m_pGDB->SetInfo( nSolidId, IKEY_VALID, 1) ;
|
||||
|
||||
return true ;
|
||||
@@ -590,7 +905,7 @@ BeamMgr::CalcSolid( int nPartId, bool bRecalc)
|
||||
int
|
||||
BeamMgr::GetSolid( int nPartId) const
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Recupero layer del solido e Id del solido
|
||||
@@ -603,7 +918,7 @@ BeamMgr::GetSolid( int nPartId) const
|
||||
bool
|
||||
BeamMgr::ShowSolid( int nPartId, bool bShow)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Verifico esistenza del pezzo
|
||||
@@ -618,35 +933,61 @@ BeamMgr::ShowSolid( int nPartId, bool bShow)
|
||||
m_pGDB->SetStatus( nOutlLayId, ( bShow ? GDB_ST_OFF : GDB_ST_ON)) ;
|
||||
int nProcsLayId = m_pGDB->GetFirstNameInGroup( nPartId, PROCESSINGS_LAYER_NAME) ;
|
||||
m_pGDB->SetStatus( nProcsLayId, ( bShow ? GDB_ST_OFF : GDB_ST_ON)) ;
|
||||
int nFcsNameLayId = m_pGDB->GetFirstNameInGroup( nPartId, FCSNAME_LAYER_NAME) ;
|
||||
m_pGDB->SetStatus( nFcsNameLayId, ( bShow ? GDB_ST_OFF : GDB_ST_ON)) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::GetBuildingIsOn( void) const
|
||||
BeamMgr::GetBuildingIsOn( int nAssGrpId) const
|
||||
{
|
||||
// verifico esistenza gruppo di assemblaggio
|
||||
int nAssGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME) ;
|
||||
if ( nAssGrpId == GDB_ID_NULL)
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
|
||||
// se gruppo di assemblaggio indicato lo verifico
|
||||
if ( nAssGrpId != GDB_ID_NULL) {
|
||||
string sAssName ;
|
||||
if ( ! m_pGDB->GetName( nAssGrpId, sAssName) || sAssName != ASSEMBLY_GROUP_NAME)
|
||||
return false ;
|
||||
}
|
||||
// altrimenti cerco il primo gruppo di assemblaggio
|
||||
else {
|
||||
nAssGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME) ;
|
||||
if ( nAssGrpId == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// recupero il primo oggetto nel gruppo
|
||||
int nAssId = m_pGDB->GetFirstInGroup( nAssGrpId) ;
|
||||
if ( nAssId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// se contiene oggetti, assemblaggio è On
|
||||
// se contiene oggetti, assemblaggio è On
|
||||
return ( m_pGDB->GetGroupObjs( nAssId) > 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::ShowBuilding( bool bShow)
|
||||
BeamMgr::ShowBuilding( int nAssGrpId, bool bShow)
|
||||
{
|
||||
// verifico esistenza gruppo di assemblaggio
|
||||
int nAssGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME) ;
|
||||
if ( nAssGrpId == GDB_ID_NULL)
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
|
||||
// se gruppo di assemblaggio indicato lo verifico
|
||||
if ( nAssGrpId != GDB_ID_NULL) {
|
||||
string sAssName ;
|
||||
if ( ! m_pGDB->GetName( nAssGrpId, sAssName) || sAssName != ASSEMBLY_GROUP_NAME)
|
||||
return false ;
|
||||
}
|
||||
// altrimenti cerco il primo gruppo di assemblaggio
|
||||
else {
|
||||
nAssGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME) ;
|
||||
if ( nAssGrpId == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// ciclo sul gruppo di assemblaggio
|
||||
int nAssId = m_pGDB->GetFirstInGroup( nAssGrpId) ;
|
||||
while ( nAssId != GDB_ID_NULL) {
|
||||
@@ -659,7 +1000,7 @@ BeamMgr::ShowBuilding( bool bShow)
|
||||
if ( m_pGDB->GetInfo( nAssId, GDB_SI_SOURCE, nSouId)) {
|
||||
m_pGDB->SetMode( nSouId, GDB_MD_STD) ;
|
||||
m_pGDB->SetStatus( nSouId, GDB_ST_ON) ;
|
||||
// se già utilizzato, ne faccio una copia
|
||||
// se già utilizzato, ne faccio una copia
|
||||
if ( m_pGDB->GetParentId( nSouId) != GDB_ID_ROOT) {
|
||||
int nCopyId = m_pGDB->Copy( nSouId, GDB_ID_NULL, GDB_ID_ROOT) ;
|
||||
if ( nCopyId != GDB_ID_NULL) {
|
||||
@@ -670,7 +1011,7 @@ BeamMgr::ShowBuilding( bool bShow)
|
||||
m_pGDB->SetInfo( nAssId, GDB_SI_SOURCE, nSouId) ;
|
||||
}
|
||||
}
|
||||
m_pGDB->SetStatus( m_pGDB->GetFirstNameInGroup( nSouId, BOX_LAYER_NAME), GDB_ST_OFF) ;
|
||||
m_pGDB->SetMode( m_pGDB->GetFirstNameInGroup( nSouId, BOX_LAYER_NAME), GDB_MD_HIDDEN) ;
|
||||
m_pGDB->GroupSwap( nSouId, nAssId, true, true) ;
|
||||
}
|
||||
}
|
||||
@@ -685,12 +1026,23 @@ BeamMgr::ShowBuilding( bool bShow)
|
||||
m_pGDB->SetInfo( nBaseId, GDB_SI_SOURCE, nCopyId) ;
|
||||
}
|
||||
else {
|
||||
m_pGDB->SetStatus( m_pGDB->GetFirstNameInGroup( nAssId, BOX_LAYER_NAME), GDB_ST_ON) ;
|
||||
m_pGDB->SetMode( m_pGDB->GetFirstNameInGroup( nAssId, BOX_LAYER_NAME), GDB_MD_STD) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// passo al successivo
|
||||
nAssId = nNextId ;
|
||||
}
|
||||
|
||||
// Nascondo o visualizzo tutti i pezzi sotto la radice
|
||||
int nPartId = m_pGDB->GetFirstInGroup( GDB_ID_ROOT) ;
|
||||
while ( nPartId != GDB_ID_NULL) {
|
||||
int nLevel ;
|
||||
if ( m_pGDB->GetLevel( nPartId, nLevel) && nLevel == GDB_LV_USER &&
|
||||
m_pGDB->GetFirstNameInGroup( nPartId, BOX_LAYER_NAME) != GDB_ID_NULL)
|
||||
m_pGDB->SetStatus( nPartId, ( bShow ? GDB_ST_OFF : GDB_ST_ON)) ;
|
||||
nPartId = m_pGDB->GetNext( nPartId) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ class BeamMgr : public IBeamMgr
|
||||
bool SetPartCount( int nCount) override ;
|
||||
bool SetPartBox( double dLength, double dHeight, double dWidth, bool bUpdate = true) override ;
|
||||
bool GetSideData( int nSide, Frame3d& frRef, double& dLength, double& dWidth, double& dHeight) override ;
|
||||
bool ShowFacesName( bool bShow) override ;
|
||||
bool ShowLoadingSide( bool bShow, bool bFromLeft) override ;
|
||||
int AddProcess( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const Frame3d& frRef, const DBLVECTOR& vdPar, const std::string& sPar, const STRVECTOR& vsUAtt,
|
||||
int nCrvId, int nCrv2Id, bool bUpdate = true) override ;
|
||||
@@ -39,16 +41,20 @@ class BeamMgr : public IBeamMgr
|
||||
int nCrvId, int nCrv2Id, bool bUpdate = true) override ;
|
||||
bool EraseProcess( int nGeomId, bool bUpdate = true) override ;
|
||||
bool EnableProcess( int nGeomId, bool bEnable, bool bUpdate = true) override ;
|
||||
bool CalcAllSolids( bool bShow, bool bRecalc, pcfProcEvents pFun = nullptr) override ;
|
||||
bool ShowAllSolids( bool bShow, pcfProcEvents pFun = nullptr) override ;
|
||||
bool CalcSolid( int nPartId, bool bRecalc = false) override ;
|
||||
int GetSolid( int nPartId) const override ;
|
||||
bool ShowSolid( int nPartId, bool bShow) override ;
|
||||
bool GetBuildingIsOn( void) const override ;
|
||||
bool ShowBuilding( bool bShow) override ;
|
||||
bool GetBuildingIsOn( int nAssGrpId) const override ;
|
||||
bool ShowBuilding( int nAssGrpId, bool bShow) override ;
|
||||
|
||||
public :
|
||||
BeamMgr( void) ;
|
||||
|
||||
private :
|
||||
bool UpdateFacesName( void) ;
|
||||
bool UpdateLoadingSide( void) ;
|
||||
|
||||
private :
|
||||
IGeomDB* m_pGDB ;
|
||||
|
||||
+182
-10
@@ -22,6 +22,7 @@
|
||||
#include "/EgtDev/Include/EGkStmStandard.h"
|
||||
#include "/EgtDev/Include/EGkStmFromCurves.h"
|
||||
#include "/EgtDev/Include/EGkExtText.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include <unordered_map>
|
||||
@@ -30,6 +31,8 @@ using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
string BtlGeom::m_sBtlAuxDir ;
|
||||
string BtlGeom::m_sBtlLuaLibsDir ;
|
||||
string BtlGeom::m_sBtlLuaLastRequire ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BtlGeom::BtlGeom( void)
|
||||
@@ -39,10 +42,12 @@ BtlGeom::BtlGeom( void)
|
||||
m_bSpecialTrim = false ;
|
||||
m_bTrimWithOutline = false ;
|
||||
m_bUseUAttr = false ;
|
||||
m_bPartOffset = false ;
|
||||
m_BoxCol = Color( 255, 128, 0, 15) ;
|
||||
m_OffsCol = Color( 255, 0, 0, 15) ;
|
||||
m_OutsCol = Color( 224, 128, 0, 50) ;
|
||||
m_ProcsCol = Color( 80, 160, 160, 100) ;
|
||||
m_ProcsOffCol = Color( 160, 160, 160, 15) ;
|
||||
m_ProcsOffCol = Color( 160, 160, 160, 30) ;
|
||||
m_MarkCol = Color( 96, 192, 192, 100) ;
|
||||
m_SolidCol = Color(255, 160, 32, 100) ;
|
||||
m_nInfoId = GDB_ID_NULL ;
|
||||
@@ -58,11 +63,24 @@ BtlGeom::BtlGeom( void)
|
||||
m_nSolidsId = GDB_ID_NULL ;
|
||||
m_vtDim = V_NULL ;
|
||||
m_nCount = 0 ;
|
||||
m_nProcId = GDB_ID_NULL ;
|
||||
m_nBtlLine = 0 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BtlGeom::~BtlGeom( void)
|
||||
{
|
||||
// chiudo lua ( se era aperto)
|
||||
if ( m_LuaMgr.Exit()) {
|
||||
string sLua = "Lua BtlGeom interpreter closed" ;
|
||||
LOG_INFO( GetEExLogger(), sLua.data())
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim, bool bTrimWithOutline, bool bUseUAttr)
|
||||
BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim,
|
||||
bool bTrimWithOutline, bool bUseUAttr, bool bPartOffset, bool bIsAdding)
|
||||
{
|
||||
// salvo puntatore a DB geometrico
|
||||
m_pGDB = pGDB ;
|
||||
@@ -73,17 +91,35 @@ BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim, bool bTrimWit
|
||||
m_bSpecialTrim = bSpecialTrim ;
|
||||
m_bTrimWithOutline = bTrimWithOutline ;
|
||||
m_bUseUAttr = bUseUAttr ;
|
||||
// se non esiste, creo gruppo per informazioni varie
|
||||
m_nInfoId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, INFO_GROUP_NAME) ;
|
||||
if ( m_nInfoId == GDB_ID_NULL && ! CreateInfoGroup())
|
||||
m_bPartOffset = bPartOffset ;
|
||||
// gruppo per informazioni varie, se in aggiunta lo creo sempre
|
||||
m_nInfoId = ( bIsAdding ? GDB_ID_NULL : m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, INFO_GROUP_NAME)) ;
|
||||
if ( bIsAdding && ! CreateInfoGroup())
|
||||
return false ;
|
||||
// se non esiste, creo gruppo per assemblaggio
|
||||
m_nAsseId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME) ;
|
||||
if ( m_nAsseId == GDB_ID_NULL && ! CreateAssemblyGroup())
|
||||
// gruppo per assemblaggio, se in aggiunta lo creo sempre
|
||||
m_nAsseId = ( bIsAdding ? GDB_ID_NULL : m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME)) ;
|
||||
if ( bIsAdding && ! CreateAssemblyGroup())
|
||||
return false ;
|
||||
// recupero eventuali riferimenti a gruppi per grezzi e compositi
|
||||
m_nRawPartsId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, RAWPARTS_GROUP_NAME) ;
|
||||
m_nCompositesId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, COMPOSITES_GROUP_NAME) ;
|
||||
// inizializzo interprete lua
|
||||
if ( ! m_LuaMgr.Init())
|
||||
return false ;
|
||||
// carico le funzioni speciali
|
||||
if ( ! LuaInstallEgtFunctions( m_LuaMgr))
|
||||
return false ;
|
||||
// recupero la versione di Lua
|
||||
string sLua ;
|
||||
if ( m_LuaMgr.GetVersion( sLua))
|
||||
sLua += " BtlGeom interpreter started" ;
|
||||
else
|
||||
sLua = "Lua *.* BtlGeom interpreter started" ;
|
||||
LOG_INFO( GetEExLogger(), sLua.data())
|
||||
// imposto il direttorio delle librerie
|
||||
m_LuaMgr.SetLuaLibsDir( m_sBtlLuaLibsDir) ;
|
||||
// carico la libreria standard
|
||||
m_LuaMgr.Require( m_sBtlLuaLastRequire) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -272,7 +308,29 @@ BtlGeom::ErasePart( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::SetPartProdNbr( int nProdNbr)
|
||||
BtlGeom::VerifyNewPartProdNbr( int nProdNbr)
|
||||
{
|
||||
// se non c'è il DB geometrico, errore
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// ciclo su tutti i pezzi
|
||||
int nPartId = m_pGDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
|
||||
while ( nPartId != GDB_ID_NULL) {
|
||||
int nLev ;
|
||||
if ( m_pGDB->GetCalcLevel( nPartId, nLev) && nLev == GDB_LV_USER) {
|
||||
int nSN = -1 ;
|
||||
// se SN richiesto già esiste, esco con errore
|
||||
if ( m_pGDB->GetInfo( nPartId, IKEY_PROD_NBR, nSN) && nSN >= 0 && nProdNbr == nSN)
|
||||
return false ;
|
||||
}
|
||||
nPartId = m_pGDB->GetNextGroup( nPartId) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::SetPartProdNbr( int nProdNbr, int nPdnErr)
|
||||
{
|
||||
// se non c'è il DB geometrico o il pezzo corrente, errore
|
||||
if ( m_pGDB == nullptr || m_nPartId == GDB_ID_NULL)
|
||||
@@ -280,7 +338,16 @@ BtlGeom::SetPartProdNbr( int nProdNbr)
|
||||
// assegno il numero di produzione del pezzo
|
||||
if ( ! m_pGDB->SetInfo( m_nPartId, IKEY_PROD_NBR, nProdNbr))
|
||||
return false ;
|
||||
// se è correzione
|
||||
if ( nPdnErr >= 0)
|
||||
m_pGDB->SetInfo( m_nPartId, IKEY_PDN_ERR, nPdnErr) ;
|
||||
// costruisco il nome del pezzo
|
||||
string sName = ToString( nProdNbr) ;
|
||||
if ( nPdnErr >= 0)
|
||||
sName += "-X" ;
|
||||
string sDes ;
|
||||
if ( m_pGDB->GetInfo( m_nPartId, IKEY_NAME, sDes))
|
||||
sName += "-" + sDes ;
|
||||
// assegnazione del nome al pezzo
|
||||
return m_pGDB->SetName( m_nPartId, sName) ;
|
||||
}
|
||||
@@ -292,12 +359,17 @@ BtlGeom::SetPartName( const string& sDes)
|
||||
// se non c'è il DB geometrico o il pezzo corrente, errore
|
||||
if ( m_pGDB == nullptr || m_nPartId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// assegno il nome del pezzo
|
||||
// assegno la descrizione
|
||||
if ( ! m_pGDB->SetInfo( m_nPartId, IKEY_NAME, sDes))
|
||||
return false ;
|
||||
// costruisco il nome del pezzo
|
||||
int nPdnErr = -1 ;
|
||||
m_pGDB->GetInfo( m_nPartId, IKEY_PDN_ERR, nPdnErr) ;
|
||||
int nProdNbr = 0 ;
|
||||
m_pGDB->GetInfo( m_nPartId, IKEY_PROD_NBR, nProdNbr) ;
|
||||
string sName = ToString( nProdNbr) ;
|
||||
if ( nPdnErr >= 0)
|
||||
sName += "-X" ;
|
||||
if ( ! sDes.empty())
|
||||
sName += "-" + sDes ;
|
||||
// assegnazione del nome al pezzo
|
||||
@@ -559,6 +631,67 @@ BtlGeom::AddObjectRef( const string& sUID, const Frame3d& frRef)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::AddPartOffset( const DBLVECTOR& vdPar)
|
||||
{
|
||||
// se non c'è il DB geometrico o il pezzo corrente, errore
|
||||
if ( m_pGDB == nullptr || m_nPartId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// recupero le dimensioni del pezzo corrente
|
||||
if ( m_vtDim.IsSmall())
|
||||
return false ;
|
||||
// se non abilitato, esco
|
||||
if ( ! m_bPartOffset)
|
||||
return true ;
|
||||
// aggiusto i solidi di rappresentazione dell'offset
|
||||
for ( int i = 1 ; i <= 4 ; ++ i) {
|
||||
string sOffsName = BOX_OFFSX_NAME + ToString( i) ;
|
||||
int nOffsId = m_pGDB->GetFirstNameInGroup( m_nBoxId, sOffsName) ;
|
||||
// se valore offset significativo, modifico o aggiungo nuovo solido
|
||||
if ( vdPar[i] > EPS_SMALL) {
|
||||
double dDimX = m_vtDim.x ;
|
||||
double dDimY = (( i == 1 || i == 3) ? vdPar[i] : m_vtDim.y) ;
|
||||
double dDimZ = (( i == 1 || i == 3) ? m_vtDim.z : vdPar[i]) ;
|
||||
// creo il solido (parallelepipedo)
|
||||
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshBox( dDimX, dDimY, dDimZ)) ;
|
||||
if ( IsNull( pStm))
|
||||
return false ;
|
||||
// lo traslo opportunamente
|
||||
Vector3d vtMove ;
|
||||
if ( i == 1)
|
||||
vtMove = Vector3d( 0, -vdPar[i], 0) ;
|
||||
else if ( i == 2)
|
||||
vtMove = Vector3d( 0, 0, -vdPar[i]) ;
|
||||
else if ( i == 3)
|
||||
vtMove = Vector3d( 0, m_vtDim.y, 0) ;
|
||||
else
|
||||
vtMove = Vector3d( 0, 0, m_vtDim.z) ;
|
||||
pStm->Translate( vtMove) ;
|
||||
// se gia presente, lo rimpiazzo
|
||||
if ( nOffsId != GDB_ID_NULL) {
|
||||
if ( ! m_pGDB->ReplaceGeoObj( nOffsId, Release( pStm)))
|
||||
return false ;
|
||||
}
|
||||
// altrimenti, lo inserisco nel layer box del pezzo
|
||||
else {
|
||||
nOffsId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nBoxId, Release( pStm)) ;
|
||||
if ( nOffsId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// assegno nome
|
||||
m_pGDB->SetName( nOffsId, sOffsName) ;
|
||||
}
|
||||
// assegno il colore
|
||||
m_pGDB->SetMaterial( nOffsId, m_OffsCol) ;
|
||||
}
|
||||
// elimino eventuale vecchio solido
|
||||
else {
|
||||
m_pGDB->Erase( nOffsId) ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::ResetPartSolid( void)
|
||||
@@ -797,6 +930,45 @@ BtlGeom::SetAlpha( int nId, int nAlpha)
|
||||
return m_pGDB->SetMaterial( nId, cCol) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::AdjustSnForParts( void)
|
||||
{
|
||||
// tabella Id-SN dei pezzi e massimo SN trovato
|
||||
INTINTVECTOR vIdSN ;
|
||||
int nMaxSN = 0 ;
|
||||
|
||||
// recupero il numero di serie di ogni singolo pezzo
|
||||
int nPartId = m_pGDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
|
||||
while ( nPartId != GDB_ID_NULL) {
|
||||
int nLev ;
|
||||
if ( m_pGDB->GetCalcLevel( nPartId, nLev) && nLev == GDB_LV_USER) {
|
||||
int nSN = 0 ;
|
||||
m_pGDB->GetInfo( nPartId, IKEY_PROD_NBR, nSN) ;
|
||||
if ( nSN <= 0)
|
||||
nSN = 0 ;
|
||||
else if ( find_if( vIdSN.begin(), vIdSN.end(),
|
||||
[&]( const INTINT& Data) { return Data.second == nSN ; }) != vIdSN.end())
|
||||
nSN = -abs( nSN) ;
|
||||
vIdSN.emplace_back( nPartId, nSN) ;
|
||||
nMaxSN = max( nMaxSN, nSN) ;
|
||||
}
|
||||
nPartId = m_pGDB->GetNextGroup( nPartId) ;
|
||||
}
|
||||
|
||||
// aggiusto tutti gli SN nulli o negativi (derivano da mancanti o ripetuti)
|
||||
for ( auto& Data : vIdSN) {
|
||||
if ( Data.second <= 0) {
|
||||
SetPart( Data.first) ;
|
||||
SetPartProdNbr( ++ nMaxSN, -Data.second) ;
|
||||
AddPartBox( GetCurrPartLength(), GetCurrPartHeight(), GetCurrPartWidth()) ;
|
||||
Data.second = nMaxSN ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::SortObjects( int nGroupId, Point3d& ptIns)
|
||||
|
||||
@@ -18,15 +18,16 @@
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkPolygon3d.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGnLuaMgr.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class BtlGeom
|
||||
{
|
||||
public :
|
||||
BtlGeom( void) ;
|
||||
|
||||
public :
|
||||
bool Init( IGeomDB* pGDB, int nFlatPos, bool bSpecialTrim, bool bTrimWithOutline, bool bUseUAttr) ;
|
||||
~BtlGeom( void) ;
|
||||
bool Init( IGeomDB* pGDB, int nFlatPos, bool bSpecialTrim,
|
||||
bool bTrimWithOutline, bool bUseUAttr, bool bPartOffset, bool bIsAdding) ;
|
||||
bool CreatePart( void) ;
|
||||
bool SetPart( int nPartId) ;
|
||||
bool ErasePart( void) ;
|
||||
@@ -36,23 +37,26 @@ class BtlGeom
|
||||
{ return m_nOutsId ; }
|
||||
int GetCurrProcsLayId( void)
|
||||
{ return m_nProcsId ; }
|
||||
bool SetPartProdNbr( int nProdNbr) ;
|
||||
bool VerifyNewPartProdNbr( int nProdNbr) ;
|
||||
bool SetPartProdNbr( int nProdNbr, int nPdnErr = -1) ;
|
||||
bool SetPartName( const std::string& sDes) ;
|
||||
bool SetPartCount( int nCount) ;
|
||||
bool AddPartBox( double dLength, double dHeight, double dWidth) ;
|
||||
double GetCurrPartLength( void)
|
||||
{ return ( m_nPartId != GDB_ID_NULL ? m_vtDim.x : 0) ;}
|
||||
double GetCurrPartHeight( void)
|
||||
{ return ( m_nPartId != GDB_ID_NULL ? m_vtDim.z : 0) ;}
|
||||
double GetCurrPartWidth( void)
|
||||
{ return ( m_nPartId != GDB_ID_NULL ? m_vtDim.y : 0) ;}
|
||||
double GetCurrPartWidth( void)
|
||||
{ return ( m_nPartId != GDB_ID_NULL ? m_vtDim.z : 0) ;}
|
||||
bool AddPartTransformation( const std::string& sUID, const Frame3d& frRef) ;
|
||||
bool AddObjectRef( const std::string& sUID, const Frame3d& frRef) ;
|
||||
bool AddPartOffset( const DBLVECTOR& vdPar) ;
|
||||
bool AdjustPartFlatOrVertPos( void) ;
|
||||
bool ResetPartSolid( void) ;
|
||||
std::string GetPartName( void) ;
|
||||
bool SetUserAttribute( int nUAttrDest, const std::string& sString) ;
|
||||
bool SetUserAttribute( int nUAttrDest, const std::string& sKey, const std::string& sVal) ;
|
||||
bool AdjustSnForParts( void) ;
|
||||
bool SortObjects( int nGroupId, Point3d& ptIns) ;
|
||||
bool UpdateNextOrigin( void) ;
|
||||
int GetRawPartsGroup( bool bCreate = false) ;
|
||||
@@ -127,6 +131,7 @@ class BtlGeom
|
||||
ICurve* GetFaceContour( int nSide) ;
|
||||
bool IsPointOnFaceContour( const Point3d& ptP, int nSide) ;
|
||||
bool IsPointNearFaceContour( const Point3d& ptP, int nSide) ;
|
||||
bool IsPointOutFaceContour( const Point3d& ptP, int nSide) ;
|
||||
bool SetPointOnFaceContour( Point3d& ptP, int nSide) ;
|
||||
bool TrimRayWithFaceContour( const Point3d& ptP, const Vector3d& vtDir, int nSide, Point3d& ptInt) ;
|
||||
|
||||
@@ -141,7 +146,7 @@ class BtlGeom
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddSawCut( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddSlot( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
bool AddSlot( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId, const Frame3d& frRef,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddFrontSlot( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
@@ -173,7 +178,7 @@ class BtlGeom
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddTenon( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddMortise( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
bool AddMortise( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId, const Frame3d& frRef,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddMortiseFront( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
@@ -207,6 +212,8 @@ class BtlGeom
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddRoundArch( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddSphere( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddTriangleCut( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddTyroleanDovetail( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
@@ -217,14 +224,18 @@ class BtlGeom
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddVariant( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddVariantLua( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt, const std::string& sLuaPath) ;
|
||||
bool AddVariantNge( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt, const std::string& sNgePath) ;
|
||||
ICurveComposite* GetFreeContourCurve( int nProcId, const Frame3d& frRef, bool bOnlyStartOk = false) ;
|
||||
ISurfTriMesh* CreateOneCurveFreeContour( const ICurveComposite* pCrvCompo) ;
|
||||
bool AdjustFreeContourCurve( ICurve* pCrv, int nSide, bool& bClosed, bool& bEndsOnCont) ;
|
||||
bool AdjustFreeContourCurve( ICurve* pCrv, int nSide, bool& bClosed, bool& bEndsOnOrOutCont) ;
|
||||
bool VerifyFreeContourCurveSideAng( const ICurveComposite* pCrvCompo) ;
|
||||
bool GetFreeContourCurveSideAngles( const ICurveComposite* pCrvCompo, DBLVECTOR& vSideAng) ;
|
||||
bool CreatePolygonInBox( const Point3d& ptP, const Vector3d& vtN, int nSide, Polygon3d& Polyg,
|
||||
double dMatMin = FACE_MIN_BACK_MAT, double dAreaMin = FACE_MIN_BACK_AREA) ;
|
||||
double GetPlaneElevation( const Plane3d& plPlane) ;
|
||||
double GetDistanceBeamPlane( const Plane3d& plPlane) ;
|
||||
bool TrimPolygons( Polygon3d& plyP1, Polygon3d& plyP2, bool bInVsOut, bool bOnEq) ;
|
||||
bool VerifyPolygonSize( Polygon3d& plyP, double dMinDim = FACE_MIN_CROSS_DIM) ;
|
||||
bool VerifyPolygonBackMat( Polygon3d& plyP, double dMatMin = FACE_MIN_BACK_MAT, double dAreaMin = FACE_MIN_BACK_AREA) ;
|
||||
@@ -253,17 +264,20 @@ class BtlGeom
|
||||
bool GetUserParam( const STRVECTOR& vsUAtt, const std::string& sKey, double& dVal) ;
|
||||
bool GetWaveLengths( int nWaves, double dLen, DBLVECTOR& vLen) ;
|
||||
bool GetWaveReductions( int nWaves, double dWidth, DBLVECTOR& vRed) ;
|
||||
bool InsertEmptySurface( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
bool InsertEmptySurface( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId, const Frame3d& frRef,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AdjustPointForPlaneNearBoxVertex( Point3d& ptP, const Vector3d& vtN, int nSide) ;
|
||||
|
||||
private :
|
||||
IGeomDB* m_pGDB ;
|
||||
LuaMgr m_LuaMgr ; // interprete per Variant parametrici
|
||||
int m_nFlatVertPos ; // flag per posizionamento pezzi (0=come sono, 1=di piatto, 2=in verticale, 3=ruotato 90deg, 4=da outline o piatto)
|
||||
bool m_bSpecialTrim ; // flag per trim speciale regioni per pareti (solo con feature passanti)
|
||||
bool m_bTrimWithOutline ; // flag per trim delle feature con l'outline (se presente)
|
||||
bool m_bUseUAttr ; // flag per utilizzo attributi utente per modificare geometria features
|
||||
bool m_bPartOffset ; // flag per gestione geometrica di PARTOFFSET
|
||||
Color m_BoxCol ; // colore per box pezzi
|
||||
Color m_OffsCol ; // colore per offset pezzi
|
||||
Color m_OutsCol ; // colore per outline pezzi
|
||||
Color m_ProcsCol ; // colore per lavorazioni pezzi
|
||||
Color m_ProcsOffCol ; // colore per lavorazioni pezzi disabilitate
|
||||
@@ -288,5 +302,7 @@ class BtlGeom
|
||||
FCEDEQUE m_FcData ; // dati per contorni liberi in definizione
|
||||
|
||||
public :
|
||||
static std::string m_sBtlAuxDir ; // direttorio in cui cercare i dati per le feature Variant
|
||||
static std::string m_sBtlAuxDir ; // direttorio in cui cercare i dati per le feature Variant
|
||||
static std::string m_sBtlLuaLibsDir ; // direttorio librerie lua per Variant
|
||||
static std::string m_sBtlLuaLastRequire ; // ultimo require lua per Variant
|
||||
} ;
|
||||
|
||||
+67
-1
@@ -17,6 +17,56 @@
|
||||
#include "/EgtDev/Include/EgtStringBase.h"
|
||||
#include <deque>
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Riconoscimento feature
|
||||
#define IS_CUT( nG, nP) ( ( nG == 1 || nG == 2) && nP == 10)
|
||||
#define IS_LONGIT_CUT( nG, nP) ( ( nG == 0 || nG == 3 || nG == 4) && nP == 10)
|
||||
#define IS_DOUBLE_CUT( nG, nP) ( ( nG == 1 || nG == 2) && nP == 11)
|
||||
#define IS_RIDGEVALLEY_CUT( nG, nP) ( ( nG == 0) && nP == 12)
|
||||
#define IS_SAW_CUT( nG, nP) ( ( nG == 0 || nG == 3 || nG == 4) && nP == 13)
|
||||
#define IS_SLOT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 16)
|
||||
#define IS_FRONT_SLOT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 17)
|
||||
#define IS_BIRDS_MOUTH( nG, nP) ( ( nG == 3 || nG == 4) && nP == 20)
|
||||
#define IS_RAFTER_NOTCH( nG, nP) ( ( nG == 3 || nG == 4) && nP == 25)
|
||||
#define IS_RIDGE_LAP( nG, nP) ( ( nG == 1 || nG == 2) && nP == 30)
|
||||
#define IS_LAP_JOINT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 30)
|
||||
#define IS_NOTCH( nG, nP) ( ( nG == 3 || nG == 4) && nP == 32)
|
||||
#define IS_LOGHOUSE_HL2( nG, nP) ( ( nG == 3 || nG == 4) && nP == 33)
|
||||
#define IS_SEATHING_CUT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 34)
|
||||
#define IS_FRENCH_RIDGELAP( nG, nP) ( ( nG == 1 || nG == 2) && nP == 35)
|
||||
#define IS_CHAMFER( nG, nP) ( ( nG == 3 || nG == 4) && nP == 36)
|
||||
#define IS_LOGHOUSE_HL4( nG, nP) ( ( nG == 4) && nP == 37)
|
||||
#define IS_LOGHOUSE_FRONT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 38)
|
||||
#define IS_POCKET( nG, nP) ( ( nG == 4) && nP == 39)
|
||||
#define IS_DRILL( nG, nP) ( ( nG == 3 || nG == 4) && nP == 40)
|
||||
#define IS_TENON( nG, nP) ( ( nG == 1 || nG == 2) && nP == 50)
|
||||
#define IS_MORTISE( nG, nP) ( ( nG == 3 || nG == 4) && nP == 50)
|
||||
#define IS_MORTISE_FRONT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 51)
|
||||
#define IS_HOUSE( nG, nP) ( ( nG == 1 || nG == 2 || nG == 3 || nG == 4) && nP == 52)
|
||||
#define IS_HOUSE_MORTISE( nG, nP) ( ( nG == 3 || nG == 4) && nP == 53)
|
||||
#define IS_DOVETAIL_TENON( nG, nP) ( ( nG == 1 || nG == 2) && nP == 55)
|
||||
#define IS_DOVETAIL_MORTISE( nG, nP) ( ( nG == 3 || nG == 4) && nP == 55)
|
||||
#define IS_DTMORTISE_FRONT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 56)
|
||||
#define IS_MARKING( nG, nP) ( ( nG == 3 || nG == 4) && nP == 60)
|
||||
#define IS_TEXT( nG, nP) ( ( nG == 4) && nP == 61)
|
||||
#define IS_SIMPLESCARF( nG, nP) ( ( nG == 1 || nG == 2) && nP == 70)
|
||||
#define IS_SCARFJOINT( nG, nP) ( ( nG == 1 || nG == 2) && nP == 71)
|
||||
#define IS_STEPJOINT( nG, nP) ( ( nG == 1 || nG == 2) && nP == 80)
|
||||
#define IS_STEPJOINTNOTCH( nG, nP) ( ( nG == 3 || nG == 4) && nP == 80)
|
||||
#define IS_PLANING( nG, nP) ( ( nG == 3 || nG == 4) && nP == 90)
|
||||
#define IS_PROF_FRONT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 100)
|
||||
#define IS_PROF_HEADCONCAVE( nG, nP) ( ( nG == 3 || nG == 4) && nP == 101)
|
||||
#define IS_PROF_HEADCONVEX( nG, nP) ( ( nG == 3 || nG == 4) && nP == 102)
|
||||
#define IS_PROF_HEADCAMBERED( nG, nP) ( ( nG == 3 || nG == 4) && nP == 103)
|
||||
#define IS_PROF_HEAD( nG, nP) ( ( nG == 3 || nG == 4) && nP == 106)
|
||||
#define IS_ROUND_ARCH( nG, nP) ( ( nG == 4) && nP == 104)
|
||||
#define IS_SPHERE( nG, nP) ( ( nG == 3 || nG == 4) && nP == 107)
|
||||
#define IS_TRIANGLE_CUT( nG, nP) ( ( nG == 4) && nP == 120)
|
||||
#define IS_TYROLEAN_DOVETAIL( nG, nP) ( ( nG == 1 || nG == 2 || nG == 3 || nG == 4) && nP == 136)
|
||||
#define IS_DOVETAIL( nG, nP) ( ( nG == 1 || nG == 2 || nG == 3 || nG == 4) && nP == 138)
|
||||
#define IS_FREE_CONTOUR( nG, nP) ( ( nG == 0 || nG == 3 || nG == 4) && (nP == 250 || nP == 251 || nP == 252))
|
||||
#define IS_VARIANT( nG, nP) ( ( nG == 0 || nG == 1 || nG == 2 || nG == 3 || nG == 4) && nP == 900)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// nome gruppo di sistema per informazioni varie
|
||||
static const std::string INFO_GROUP_NAME = "BtlInfo" ;
|
||||
@@ -26,25 +76,31 @@ static const std::string ASSEMBLY_GROUP_NAME = "AsseBase" ;
|
||||
static const std::string RAWPARTS_GROUP_NAME = "RawParts" ;
|
||||
// nome gruppo di sistema per compositi
|
||||
static const std::string COMPOSITES_GROUP_NAME = "Composites" ;
|
||||
// nome gruppo temporaneo per direzione di carico
|
||||
static const std::string LOADINGSIDE_GROUP_NAME = "LoadingSide" ;
|
||||
// nomi layer standard dei pezzi
|
||||
static const std::string AUX_LAYER_NAME = "Part" ;
|
||||
static const std::string BOX_LAYER_NAME = "Box" ;
|
||||
static const std::string OUTLINE_LAYER_NAME = "Outline" ;
|
||||
static const std::string PROCESSINGS_LAYER_NAME = "Processings" ;
|
||||
static const std::string SOLID_LAYER_NAME = "Solid" ;
|
||||
static const std::string FCSNAME_LAYER_NAME = "FcsName" ;
|
||||
// nomi entità standard dei pezzi
|
||||
static const std::string AUX_PART_NAME = "Name" ;
|
||||
static const std::string BOX_BOX_NAME = "Box" ;
|
||||
static const std::string BOX_OFFSX_NAME = "Offs" ;
|
||||
static const std::string OL_OUTSTM_NAME = "Out" ;
|
||||
static const std::string OL_APERTURESTM_NAME = "Ape" ;
|
||||
static const std::string OL_TOPREGION_NAME = "Top" ;
|
||||
static const std::string OL_BOTTOMREGION_NAME = "Bot" ;
|
||||
static const std::string OL_SUFFIX_REGION_NAME = "Region" ;
|
||||
static const std::string OL_SHAPE_NAME = "Shape" ;
|
||||
static const std::string SOLID_SOLID_NAME = "Solid" ;
|
||||
// chiavi di informazioni associate alle info varie
|
||||
static const std::string IKEY_BTL_PATH = "BTL" ;
|
||||
// chiavi di informazioni associate ai pezzi
|
||||
static const std::string IKEY_PROD_NBR = "PDN" ;
|
||||
static const std::string IKEY_PDN_ERR = "PDN_ERR" ;
|
||||
static const std::string IKEY_NAME = "NAM" ;
|
||||
static const std::string IKEY_COUNT = "CNT" ;
|
||||
static const std::string IKEY_LENGTH = "L" ;
|
||||
@@ -80,10 +136,13 @@ static const std::string IKEY_TRIM = "TRIM" ;
|
||||
static const std::string IKEY_COL_A = "COL_A" ;
|
||||
// chiavi di informazioni associate al solido
|
||||
static const std::string IKEY_VALID = "VALID" ;
|
||||
// chiavi di informazioni associate al lato di carico
|
||||
static const std::string IKEY_LSIDE = "LSIDE" ;
|
||||
// distanza tra pezzi nella disposizione standard lungo Y
|
||||
const double PART_OFFSET = 300 ;
|
||||
// costanti di approssimazione per curve
|
||||
const double CRV_LIN_APPROX = 0.05 ;
|
||||
const double CRV_LIN_FINE_APPROX = 0.01 ;
|
||||
const double CRV_ANG_APPROX_DEG = 22.5 ;
|
||||
// costante di compattazione di superfici
|
||||
const double STM_COMPACT_APPROX = 0.01 ;
|
||||
@@ -94,6 +153,8 @@ const double FACE_MIN_BACK_MAT = 2.0 ;
|
||||
const double FACE_MIN_BACK_AREA = 400.0 ;
|
||||
// minimo materiale dietro la faccia, limite assoluto
|
||||
const double FACE_ZERO_BACK_MAT = 0.5 ;
|
||||
// minima area di componente staccata
|
||||
const double FACE_DETACHED_MIN_AREA = 400.0 ;
|
||||
// minimo spostamento per vari tipi di Mortise
|
||||
const double MORTISE_DISPL_MIN = 0.5 ;
|
||||
// raggio fresa di default
|
||||
@@ -102,11 +163,12 @@ const double MILL_DEF_RAD = 12.5 ;
|
||||
const double DTMILL_DEF_RAD = 30.0 ;
|
||||
// angolo coda di rondine di default
|
||||
const double DOVETAIL_DEF_ANG = 15.0 ;
|
||||
// lunghezza extra per tenoni coda di rondine passanti
|
||||
const double DTTEN_EXTRA_LEN = 5.0 ;
|
||||
// lunghezza extra per mortase coda di rondine passanti
|
||||
const double DTMORT_EXTRA_LEN = 10.0 ;
|
||||
// minima e massima dimensione tasca per mortasa a coda di rondine
|
||||
const double MIN_DTMORT_POCKET = 70.0 ;
|
||||
const double MAX_DTMORT_POCKET = 200.0 ;
|
||||
const double MIN_DTMORT_AREA = 100.0 ;
|
||||
// tolleranza fuoriuscita curve di tasche di code di rondine
|
||||
const double DTMORT_OUT_CRV_TOL = 30.0 ;
|
||||
@@ -115,6 +177,10 @@ const double FC_SIDEANG_DEF = 0.0 ;
|
||||
const double FC_SIDEANG_NONE = 999.0 ;
|
||||
// tolleranza fuoriuscita curve di contorni liberi
|
||||
const double FC_OUT_CRV_TOL = 50.0 ;
|
||||
// dimensione massima di contorno libero
|
||||
const double FC_MAX_DIM = 200000.0 ;
|
||||
// distanza limite tra diagonali per quadrilatero con twist di freecontour
|
||||
const double FC_TWIST_DIAG_DIST = 2.0 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Numero processo speciale Riferimento ad altro oggetto
|
||||
|
||||
+77
-42
@@ -19,9 +19,11 @@
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EgkChainCurves.h"
|
||||
#include "/EgtDev/Include/EGkOffsetCurve.h"
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
#include "/EgtDev/Include/EGkStmStandard.h"
|
||||
#include "/EgtDev/Include/EGkStmFromCurves.h"
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
#include "/EgtDev/Include/EGkExtText.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
@@ -494,6 +496,18 @@ BtlGeom::UpdateOutLine( void)
|
||||
// taglio con tutte le features
|
||||
TrimOutlineWithProcesses() ;
|
||||
|
||||
// se presente Shape e abilitato, nascondo Outline
|
||||
int nDO ;
|
||||
int nShapeId = m_pGDB->GetFirstNameInGroup( m_nOutsId, OL_SHAPE_NAME) ;
|
||||
if ( nShapeId != GDB_ID_NULL && m_pGDB->GetInfo( nShapeId, IKEY_DO, nDO) && nDO != 0) {
|
||||
int nEntId = m_pGDB->GetFirstInGroup( m_nOutsId) ;
|
||||
while ( nEntId != GDB_ID_NULL) {
|
||||
if ( nEntId != nShapeId)
|
||||
m_pGDB->SetStatus( nEntId, GDB_ST_OFF) ;
|
||||
nEntId = m_pGDB->GetNext( nEntId) ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -560,12 +574,12 @@ BtlGeom::AddPartCustomOutline( void)
|
||||
bOk = ( bOk && ! IsNull( pLoop2) && ! IsNull( pMySfr2) && pLoop2->FromPolyLine( vPL[1]) && pMySfr2->AddExtLoop( Release( pLoop2))) ;
|
||||
bOk = bOk && pMySfr2->Invert() ;
|
||||
if ( AreSameVectorApprox( pMySfr1->GetNormVersor(), frRef.VersZ())) {
|
||||
pSfr1.Set( Release( pMySfr1)) ;
|
||||
pSfr2.Set( Release( pMySfr2)) ;
|
||||
pSfr1.Set( pMySfr1) ;
|
||||
pSfr2.Set( pMySfr2) ;
|
||||
}
|
||||
else {
|
||||
pSfr1.Set( Release( pMySfr2)) ;
|
||||
pSfr2.Set( Release( pMySfr1)) ;
|
||||
pSfr1.Set( pMySfr2) ;
|
||||
pSfr2.Set( pMySfr1) ;
|
||||
}
|
||||
}
|
||||
// se non riesce, li calcolo in modo approssimato
|
||||
@@ -749,13 +763,18 @@ BtlGeom::UseProcessToTrimOutline( int nProcId)
|
||||
bool
|
||||
BtlGeom::TrimOutline( int nProcSurfId)
|
||||
{
|
||||
// Recupero tipo di trim
|
||||
int nTrim = 0 ;
|
||||
m_pGDB->GetInfo( nProcSurfId, IKEY_TRIM, nTrim) ;
|
||||
|
||||
// Recupero eventuale superficie originale
|
||||
int nOrigId = 0 ;
|
||||
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_ORIGID, nOrigId))
|
||||
nProcSurfId += nOrigId ;
|
||||
|
||||
// Se processo con più superfici da usare insieme per trim, devo unirle
|
||||
int nTrim ;
|
||||
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_TRIM, nTrim) && nTrim == 2) {
|
||||
// Recupero le due superfici del processo di lavorazione (eventualmente le originali)
|
||||
int nOrigId = 0 ;
|
||||
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_ORIGID, nOrigId))
|
||||
nProcSurfId += nOrigId ;
|
||||
if ( nTrim == 2) {
|
||||
// Recupero le due superfici del processo di lavorazione
|
||||
int nAux ;
|
||||
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_AUXID, nAux) && nAux != 0) {
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId)) ;
|
||||
@@ -769,10 +788,8 @@ BtlGeom::TrimOutline( int nProcSurfId)
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
// Recupero la superficie del processo di lavorazione (eventualmente l'originale)
|
||||
int nOrigId = 0 ;
|
||||
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_ORIGID, nOrigId))
|
||||
nProcSurfId += nOrigId ;
|
||||
|
||||
// Trim con una sola superficie
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return false ;
|
||||
@@ -1057,8 +1074,8 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPOVECTOR& vCrvP)
|
||||
// concateno le linee senza invertirle
|
||||
const double TOLER = 10 * EPS_SMALL ;
|
||||
ChainCurves chainC ;
|
||||
chainC.Init( false, TOLER, int( vCrvP.size())) ;
|
||||
for ( size_t i = 0 ; i < vCrvP.size() ; ++ i) {
|
||||
chainC.Init( false, TOLER, ssize( vCrvP)) ;
|
||||
for ( int i = 0 ; i < ssize( vCrvP) ; ++ i) {
|
||||
Point3d ptStart, ptEnd ;
|
||||
Vector3d vtStart, vtEnd ;
|
||||
if ( ! vCrvP[i]->GetStartPoint( ptStart) || ! vCrvP[i]->GetStartDir( vtStart) ||
|
||||
@@ -1075,7 +1092,7 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPOVECTOR& vCrvP)
|
||||
if ( IsNull( pCrvCompo))
|
||||
return false ;
|
||||
// recupero le curve semplici e le inserisco nella curva composita
|
||||
for ( size_t i = 0 ; i < vId2s.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( vId2s) ; ++ i) {
|
||||
// indice della curva
|
||||
int j = vId2s[i] - 1 ;
|
||||
// la aggiungo alla curva composta
|
||||
@@ -1130,7 +1147,7 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPOVECTOR& vCrvP)
|
||||
}
|
||||
// se la regione sottrazione totale non esiste, la assegno
|
||||
if ( IsNull( pSubReg))
|
||||
pSubReg.Set( Release( pSfrReg)) ;
|
||||
pSubReg.Set( pSfrReg) ;
|
||||
// altrimenti la combino con la nuova
|
||||
else {
|
||||
// salvo una copia della regione sottrazione totale
|
||||
@@ -1141,7 +1158,7 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPOVECTOR& vCrvP)
|
||||
pSubReg->Intersect( *pSfrReg) ;
|
||||
// se non rimane alcunché, provo a unirle
|
||||
if ( ! pSubReg->IsValid()) {
|
||||
pSubReg.Set( Release( pSubCopy)) ;
|
||||
pSubReg.Set( pSubCopy) ;
|
||||
pSubReg->Add( *pSfrReg) ;
|
||||
}
|
||||
}
|
||||
@@ -1210,7 +1227,7 @@ bool
|
||||
BtlGeom::IsPointNearFaceContour( const Point3d& ptP, int nSide)
|
||||
{
|
||||
// Il punto è nel riferimento faccia
|
||||
// Verifico se sta vicino al contorno o fuori
|
||||
// Verifico se sta vicino al contorno o fuori entro il limite
|
||||
const double EPS_IN_NEAR = 0.2 ;
|
||||
const double EPS_OUT_NEAR = 5.0 ;
|
||||
double dL = GetSideLength( nSide) ;
|
||||
@@ -1221,6 +1238,16 @@ BtlGeom::IsPointNearFaceContour( const Point3d& ptP, int nSide)
|
||||
( ptP.y > dW - EPS_IN_NEAR && ptP.y < dW + EPS_OUT_NEAR)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::IsPointOutFaceContour( const Point3d& ptP, int nSide)
|
||||
{
|
||||
// Il punto è nel riferimento faccia
|
||||
// Verifico se sta all'esterno del contorno
|
||||
return ( ptP.x < -EPS_SMALL || ptP.x > GetSideLength( nSide) - EPS_SMALL ||
|
||||
ptP.y < -EPS_SMALL || ptP.y > GetSideWidth( nSide) - EPS_SMALL) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::SetPointOnFaceContour( Point3d& ptP, int nSide)
|
||||
@@ -1344,17 +1371,27 @@ BtlGeom::TrimProcessWithOutline( int nProcId)
|
||||
m_pGDB->SetInfo( nCopyId, IKEY_AUXID, sAuxId) ;
|
||||
m_pGDB->SetMode( nCopy2Id, GDB_MD_HIDDEN) ;
|
||||
}
|
||||
// eseguo piccolo offset della curva per evitare problemi di sovrapposizioni
|
||||
OffsetCurve OffsCrv ;
|
||||
if ( ! OffsCrv.Make( pCrv, -50 * EPS_SMALL, ICurve::OFF_EXTEND) || OffsCrv.GetCurveCount() == 0) {
|
||||
return false ;
|
||||
}
|
||||
PtrOwner<ICurve> pCopyCrv( OffsCrv.GetLongerCurve()) ;
|
||||
// eseguo il trim
|
||||
return ( pStm->GeneralizedCut( *pCrv, false) &&
|
||||
( pStm2 == nullptr || pStm2->GeneralizedCut( *pCrv, false))) ;
|
||||
return ( pStm->GeneralizedCut( *pCopyCrv, false) &&
|
||||
( pStm2 == nullptr || pStm2->GeneralizedCut( *pCopyCrv, false))) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::AddShapeBTLX( const INTMATRIX& vFacesVertices, const PNTVECTOR& vPoints)
|
||||
{
|
||||
PtrOwner<ISurfTriMesh> pShape( CreateSurfTriMesh()) ;
|
||||
|
||||
StmFromTriangleSoup StmFts ;
|
||||
if ( ! StmFts.Start()) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Shape: StmFts.Start error")
|
||||
return false ;
|
||||
}
|
||||
|
||||
for ( auto it = vFacesVertices.begin() ; it != vFacesVertices.end() ; it++) {
|
||||
INTVECTOR vVertices = *it ;
|
||||
if ( vVertices.size() < 3) {
|
||||
@@ -1364,30 +1401,28 @@ BtlGeom::AddShapeBTLX( const INTMATRIX& vFacesVertices, const PNTVECTOR& vPoints
|
||||
// creo il contorno della faccia
|
||||
PtrOwner<ICurveComposite> pCurveCompo( CreateCurveComposite()) ;
|
||||
pCurveCompo->AddPoint( vPoints[vVertices[0]]) ;
|
||||
for ( size_t i = 1 ; i != vVertices.size() ; i++)
|
||||
pCurveCompo->AddLine( vPoints[vVertices[i]]) ;
|
||||
for ( int i = 1 ; i < ssize( vVertices) ; i++)
|
||||
pCurveCompo->AddLine( vPoints[vVertices[i]]) ;
|
||||
pCurveCompo->AddLine( vPoints[vVertices[0]]) ;
|
||||
|
||||
if ( it == vFacesVertices.begin() || ! pShape->IsValid())
|
||||
pShape.Set( GetSurfTriMeshByFlatContour( pCurveCompo)) ;
|
||||
else {
|
||||
PtrOwner<ISurfTriMesh> pSurf( GetSurfTriMeshByFlatContour( pCurveCompo)) ;
|
||||
// controllo che pCurveCompo racchiuda veramente una superficie
|
||||
if ( ! IsNull( pSurf)) {
|
||||
if ( ! pShape->DoSewing( * pSurf)) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Shape: stm.DoSewing error")
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// creo la faccia e recupero i suoi triangoli
|
||||
PtrOwner<ISurfTriMesh> pSurf( GetSurfTriMeshByFlatContour( pCurveCompo)) ;
|
||||
if ( ! IsNull( pSurf))
|
||||
StmFts.AddSurfTriMesh( *pSurf) ;
|
||||
}
|
||||
|
||||
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nPartId + 3, Release( pShape)) ; // salvo in outline
|
||||
if ( ! StmFts.End()) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Shape: StmFts.End error")
|
||||
return false ;
|
||||
}
|
||||
|
||||
PtrOwner<ISurfTriMesh> pShape( StmFts.GetSurf()) ;
|
||||
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pShape)) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGDB->SetName( nId, "Shape") ;
|
||||
m_pGDB->SetName( nId, OL_SHAPE_NAME) ;
|
||||
m_pGDB->SetMaterial( nId, m_OutsCol) ;
|
||||
m_pGDB->SetStatus( nId, 0) ;
|
||||
m_pGDB->SetStatus( nId, GDB_ST_OFF) ;
|
||||
m_pGDB->SetInfo( nId, IKEY_DO, 0) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
+1010
-361
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
// EgalTech 2014-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DllMain.h Data : 04.04.14 Versione : 1.5d1
|
||||
// File : DllMain.h Data : 30.05.23 Versione : 2.5e5
|
||||
// Contenuto : Prototipi funzioni per uso locale della DLL.
|
||||
//
|
||||
//
|
||||
@@ -20,3 +20,4 @@
|
||||
ILogger* GetEExLogger( void) ;
|
||||
const std::string& GetEExKey( void) ;
|
||||
bool GetEExNetHwKey( void) ;
|
||||
bool VerifyKey( int nKeyOpt) ;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "DllMain.h"
|
||||
#include "/EgtDev/Include/EExDllMain.h"
|
||||
#include "/EgtDev/Include/EGnGetModuleVer.h"
|
||||
#include "/EgtDev/Include/EGnGetKeyData.h"
|
||||
#include "/EgtDev/Include/EgtTrace.h"
|
||||
|
||||
//--------------------------- Costanti ----------------------------------------
|
||||
@@ -118,3 +119,32 @@ GetEExNetHwKey( void)
|
||||
{
|
||||
return s_bNetHwKey ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
VerifyKey( int nKeyOpt)
|
||||
{
|
||||
// Controllo della licenza
|
||||
unsigned int nOpt1, nOpt2 ;
|
||||
int nOptExpDays ;
|
||||
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
|
||||
nOpt1, nOpt2, nOptExpDays) ;
|
||||
if ( ! GetEExNetHwKey())
|
||||
nRet = GetKeyOptions( GetEExKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
|
||||
nOpt1, nOpt2, nOptExpDays) ;
|
||||
if ( nRet != KEY_OK && ! EqualNoCase( GetEExKey(), "EExBase")) {
|
||||
if ( nRet != KEY_OK) {
|
||||
std::string sErr = "Error on Key (EXC/" + ToString( nRet) + ")" ;
|
||||
LOG_ERROR( GetEExLogger(), sErr.c_str()) ;
|
||||
return false ;
|
||||
}
|
||||
if ( ( nOpt1 & ( KEYOPT_EEX_INPBASE|KEYOPT_EEX_EXPBASE)) == 0 ||
|
||||
( nKeyOpt != 0 && ( nOpt1 & nKeyOpt) == 0) ||
|
||||
nOptExpDays < GetCurrDay()) {
|
||||
std::string sErr = "Warning on Key (EXC/OPT)" ;
|
||||
LOG_ERROR( GetEExLogger(), sErr.c_str()) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
Binary file not shown.
+2
-2
@@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28307.645
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.12.35521.163
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EgtExchange", "EgtExchange.vcxproj", "{80FCBEA4-1883-4542-939D-8582E66D8D51}"
|
||||
EndProject
|
||||
|
||||
+105
-17
@@ -22,14 +22,14 @@
|
||||
<ProjectGuid>{80FCBEA4-1883-4542-939D-8582E66D8D51}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>EgtExchange</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@@ -42,7 +42,7 @@
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@@ -101,10 +101,10 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;I_AM_EEX;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>
|
||||
</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -127,10 +127,10 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;I_AM_EEX;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
<AdditionalIncludeDirectories>
|
||||
</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -162,8 +162,8 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>
|
||||
</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -191,14 +191,13 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>
|
||||
</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@@ -217,19 +216,102 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Include\EExBeamConst.h" />
|
||||
<ClInclude Include="..\Include\EExBeamMgr.h" />
|
||||
<ClInclude Include="..\Include\EExDllMain.h" />
|
||||
<ClInclude Include="..\Include\EExExcExecutor.h" />
|
||||
<ClInclude Include="..\Include\EExExport3MF.h" />
|
||||
<ClInclude Include="..\Include\EExExportConst.h" />
|
||||
<ClInclude Include="..\Include\EExExportDxf.h" />
|
||||
<ClInclude Include="..\Include\EExExportStl.h" />
|
||||
<ClInclude Include="..\Include\EExExportSvg.h" />
|
||||
<ClInclude Include="..\Include\EExExportThreeJS.h" />
|
||||
<ClInclude Include="..\Include\EExImport3MF.h" />
|
||||
<ClInclude Include="..\Include\EExImportBtl.h" />
|
||||
<ClInclude Include="..\Include\EExImportBtlx.h" />
|
||||
<ClInclude Include="..\Include\EExImportCnc.h" />
|
||||
<ClInclude Include="..\Include\EExImportCsf.h" />
|
||||
<ClInclude Include="..\Include\EExImportDxf.h" />
|
||||
<ClInclude Include="..\Include\EExImportOff.h" />
|
||||
<ClInclude Include="..\Include\EExImportPnt.h" />
|
||||
<ClInclude Include="..\Include\EExImportStl.h" />
|
||||
<ClInclude Include="..\Include\EGkAngle.h" />
|
||||
<ClInclude Include="..\Include\EGkArcSpecial.h" />
|
||||
<ClInclude Include="..\Include\EGkBBox3d.h" />
|
||||
<ClInclude Include="..\Include\EGkChainCurves.h" />
|
||||
<ClInclude Include="..\Include\EGkColor.h" />
|
||||
<ClInclude Include="..\Include\EGkCurve.h" />
|
||||
<ClInclude Include="..\Include\EGkCurveArc.h" />
|
||||
<ClInclude Include="..\Include\EGkCurveAux.h" />
|
||||
<ClInclude Include="..\Include\EGkCurveBezier.h" />
|
||||
<ClInclude Include="..\Include\EGkCurveByInterp.h" />
|
||||
<ClInclude Include="..\Include\EGkCurveComposite.h" />
|
||||
<ClInclude Include="..\Include\EGkCurveLine.h" />
|
||||
<ClInclude Include="..\Include\EGkCurvePointDiffGeom.h" />
|
||||
<ClInclude Include="..\Include\EGkExtDimension.h" />
|
||||
<ClInclude Include="..\Include\EGkExtText.h" />
|
||||
<ClInclude Include="..\Include\EGkFrame3d.h" />
|
||||
<ClInclude Include="..\Include\EGkGdbConst.h" />
|
||||
<ClInclude Include="..\Include\EGkGdbIterator.h" />
|
||||
<ClInclude Include="..\Include\EGkGeoCollection.h" />
|
||||
<ClInclude Include="..\Include\EGkGeoConst.h" />
|
||||
<ClInclude Include="..\Include\EGkGeoFrame3d.h" />
|
||||
<ClInclude Include="..\Include\EGkGeomDB.h" />
|
||||
<ClInclude Include="..\Include\EGkGeoObj.h" />
|
||||
<ClInclude Include="..\Include\EGkGeoObjType.h" />
|
||||
<ClInclude Include="..\Include\EGkGeoPoint3d.h" />
|
||||
<ClInclude Include="..\Include\EGkGeoVector3d.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersCurves.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersLineBox.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersLinePlane.h" />
|
||||
<ClInclude Include="..\Include\EGkIntersSurfTmSurfTm.h" />
|
||||
<ClInclude Include="..\Include\EGkIntervals.h" />
|
||||
<ClInclude Include="..\Include\EGkMaterial.h" />
|
||||
<ClInclude Include="..\Include\EGkObjGraphics.h" />
|
||||
<ClInclude Include="..\Include\EGkOffsetCurve.h" />
|
||||
<ClInclude Include="..\Include\EGkPlane3d.h" />
|
||||
<ClInclude Include="..\Include\EGkPoint3d.h" />
|
||||
<ClInclude Include="..\Include\EGkPointGrid3d.h" />
|
||||
<ClInclude Include="..\Include\EGkPolyArc.h" />
|
||||
<ClInclude Include="..\Include\EGkPolygon3d.h" />
|
||||
<ClInclude Include="..\Include\EGkPolyLine.h" />
|
||||
<ClInclude Include="..\Include\EGkSfrCreate.h" />
|
||||
<ClInclude Include="..\Include\EGkStmFromCurves.h" />
|
||||
<ClInclude Include="..\Include\EGkStmFromTriangleSoup.h" />
|
||||
<ClInclude Include="..\Include\EGkStmStandard.h" />
|
||||
<ClInclude Include="..\Include\EGkStringUtils3d.h" />
|
||||
<ClInclude Include="..\Include\EGkSurf.h" />
|
||||
<ClInclude Include="..\Include\EGkSurfBezier.h" />
|
||||
<ClInclude Include="..\Include\EGkSurfFlatRegion.h" />
|
||||
<ClInclude Include="..\Include\EGkSurfTriMesh.h" />
|
||||
<ClInclude Include="..\Include\EGkTriangle3d.h" />
|
||||
<ClInclude Include="..\Include\EGkUserObj.h" />
|
||||
<ClInclude Include="..\Include\EGkVector3d.h" />
|
||||
<ClInclude Include="..\Include\EGnCmdExecutor.h" />
|
||||
<ClInclude Include="..\Include\EGnCmdParser.h" />
|
||||
<ClInclude Include="..\Include\EGnFileUtils.h" />
|
||||
<ClInclude Include="..\Include\EGnGetModuleVer.h" />
|
||||
<ClInclude Include="..\Include\EGnScanner.h" />
|
||||
<ClInclude Include="..\Include\EGnStringKeyVal.h" />
|
||||
<ClInclude Include="..\Include\EGnStringUtils.h" />
|
||||
<ClInclude Include="..\Include\EGnWriter.h" />
|
||||
<ClInclude Include="..\Include\EGrScene.h" />
|
||||
<ClInclude Include="..\Include\EgtExecMgr.h" />
|
||||
<ClInclude Include="..\Include\EgtILogger.h" />
|
||||
<ClInclude Include="..\Include\EgtKeyCodes.h" />
|
||||
<ClInclude Include="..\Include\EgtLibVer.h" />
|
||||
<ClInclude Include="..\Include\EgtNumCollection.h" />
|
||||
<ClInclude Include="..\Include\EgtNumUtils.h" />
|
||||
<ClInclude Include="..\Include\EgtPointerOwner.h" />
|
||||
<ClInclude Include="..\Include\EgtStringBase.h" />
|
||||
<ClInclude Include="..\Include\EgtStringConverter.h" />
|
||||
<ClInclude Include="..\Include\EgtStringDecoder.h" />
|
||||
<ClInclude Include="..\Include\EgtStringEncoder.h" />
|
||||
<ClInclude Include="..\Include\EgtTargetVer.h" />
|
||||
<ClInclude Include="..\Include\EgtTrace.h" />
|
||||
<ClInclude Include="..\Include\ENkCplxCollection.h" />
|
||||
<ClInclude Include="..\Include\ENkPolynomialRoots.h" />
|
||||
<ClInclude Include="..\Include\SELkKeyProc.h" />
|
||||
<ClInclude Include="BeamMgr.h" />
|
||||
<ClInclude Include="BtlConst.h" />
|
||||
<ClInclude Include="BtlGeom.h" />
|
||||
@@ -249,7 +331,10 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="ImportCnc.h" />
|
||||
<ClInclude Include="ImportCsf.h" />
|
||||
<ClInclude Include="ImportDxf.h" />
|
||||
<ClInclude Include="ImportOff.h" />
|
||||
<ClInclude Include="ImportPly.h" />
|
||||
<ClInclude Include="ImportStl.h" />
|
||||
<ClInclude Include="miniply.h" />
|
||||
<ClInclude Include="pugiconfig.hpp" />
|
||||
<ClInclude Include="pugixml.hpp" />
|
||||
<ClInclude Include="resource.h" />
|
||||
@@ -291,8 +376,11 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="ImportDxfEnts.cpp" />
|
||||
<ClCompile Include="ImportDxfHeader.cpp" />
|
||||
<ClCompile Include="ImportDxfTabs.cpp" />
|
||||
<ClCompile Include="ImportOff.cpp" />
|
||||
<ClCompile Include="ImportPly.cpp" />
|
||||
<ClCompile Include="ImportPnt.cpp" />
|
||||
<ClCompile Include="ImportStl.cpp" />
|
||||
<ClCompile Include="miniply.cpp" />
|
||||
<ClCompile Include="pugixml.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
|
||||
@@ -129,6 +129,264 @@
|
||||
<ClInclude Include="ExportThreeJS.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EExBeamConst.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EExExcExecutor.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EExExport3MF.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EExExportSvg.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EExExportThreeJS.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EExImport3MF.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EExImportPnt.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkAngle.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkArcSpecial.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkBBox3d.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkChainCurves.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkColor.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCurve.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCurveArc.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCurveAux.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCurveBezier.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCurveByInterp.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCurveComposite.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCurveLine.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCurvePointDiffGeom.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkExtDimension.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkExtText.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkFrame3d.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkGdbConst.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkGdbIterator.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkGeoCollection.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkGeoFrame3d.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkGeomDB.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkGeoObj.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkGeoObjType.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkGeoPoint3d.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkGeoVector3d.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkIntersCurves.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkIntersLineBox.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkIntersLinePlane.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkIntersSurfTmSurfTm.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkIntervals.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkMaterial.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkObjGraphics.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkOffsetCurve.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkPlane3d.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkPoint3d.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkPointGrid3d.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkPolyArc.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkPolygon3d.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkPolyLine.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkSfrCreate.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkStmFromCurves.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkStmFromTriangleSoup.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkStmStandard.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkStringUtils3d.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkSurf.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkSurfBezier.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkSurfFlatRegion.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkSurfTriMesh.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkTriangle3d.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkUserObj.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkVector3d.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGnCmdExecutor.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGnCmdParser.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGnFileUtils.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGnGetModuleVer.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGnStringKeyVal.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGnStringUtils.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGnWriter.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGrScene.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EgtExecMgr.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EgtILogger.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EgtKeyCodes.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EgtLibVer.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EgtNumCollection.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EgtNumUtils.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EgtPointerOwner.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EgtStringBase.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EgtStringConverter.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EgtStringDecoder.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EgtStringEncoder.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EgtTargetVer.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EgtTrace.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\ENkCplxCollection.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\ENkPolynomialRoots.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\SELkKeyProc.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ImportOff.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EExImportOff.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ImportPly.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="miniply.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
@@ -209,6 +467,15 @@
|
||||
<ClCompile Include="ExportThreeJS.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ImportOff.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ImportPly.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="miniply.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtExchange.rc">
|
||||
|
||||
@@ -43,6 +43,7 @@ ExcExecutor::ExcExecutor( void)
|
||||
m_ExecMgr.Insert( "IMPORTCNC", &ExcExecutor::ExecuteImportCnc) ;
|
||||
m_ExecMgr.Insert( "IMPORTDXF", &ExcExecutor::ExecuteImportDxf) ;
|
||||
m_ExecMgr.Insert( "IMPORTSTL", &ExcExecutor::ExecuteImportStl) ;
|
||||
//m_ExecMgr.Insert( "IMPORT3DM", &ExcExecutor::ExecuteImport3dm) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -234,3 +235,38 @@ ExcExecutor::ExecuteImportStl( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
////----------------------------------------------------------------------------
|
||||
//bool
|
||||
//ExcExecutor::ExecuteImport3dm( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
//{
|
||||
// // 2 o 3 parametri : nome del file, Id del gruppo[, ScaleFactor]
|
||||
// if ( vsParams.size() != 2 && vsParams.size() != 3)
|
||||
// return false ;
|
||||
// // eventuale conversione di token nel nome file
|
||||
// string sFile = vsParams[0] ;
|
||||
// m_pParser->DirReplace( sFile) ;
|
||||
// // recupero l'Id
|
||||
// int nId = m_pParser->GetIdParam( vsParams[1]) ;
|
||||
// if ( nId == CMD_ID_ERROR)
|
||||
// return false ;
|
||||
// // gestisco ScaleFactor
|
||||
// double dScaleFactor = 1 ;
|
||||
// if ( vsParams.size() >= 3)
|
||||
// FromString( vsParams[2], dScaleFactor) ;
|
||||
//
|
||||
// // preparo l'importatore
|
||||
// IImport3dm* pImp3dm = CreateImport3dm() ;
|
||||
// if ( pImp3dm == nullptr) {
|
||||
// LOG_ERROR( GetEExLogger(), "Error : CreateImportStl")
|
||||
// return false ;
|
||||
// }
|
||||
// // eseguo l'importazione
|
||||
// //bool bOk = pImp3dm->Import( sFile, m_pGDB, nId, dScaleFactor) ;
|
||||
// // cancello l'importatore
|
||||
// delete pImp3dm ;
|
||||
//
|
||||
// //return bOk ;
|
||||
//
|
||||
// //return true ;
|
||||
//}
|
||||
|
||||
@@ -40,6 +40,7 @@ class ExcExecutor : public IExcExecutor
|
||||
bool ExecuteImportDxf( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteImportCnc( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteImportStl( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
//bool ExecuteImport3dm( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
|
||||
private :
|
||||
IGeomDB* m_pGDB ;
|
||||
|
||||
+168
-113
@@ -17,25 +17,22 @@
|
||||
#include "Export3MF.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/EGkGdbIterator.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"
|
||||
|
||||
using namespace std ;
|
||||
using namespace Lib3MF ;
|
||||
using namespace Lib3MF ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static string sInfoNamespace = "CustomInfo" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IExport3MF*
|
||||
CreateExport3MF( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_EXPBASE, GetEExLogger()))
|
||||
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IExport3MF*> ( new(nothrow) Export3MF) ;
|
||||
@@ -46,6 +43,7 @@ bool
|
||||
Export3MF::SetOptions( int nFilter)
|
||||
{
|
||||
m_nFilter = nFilter ;
|
||||
CalcGroupFilter() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -65,15 +63,15 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// libreria 3MF
|
||||
// libreria 3MF
|
||||
m_wrapper = CWrapper::loadLibrary() ;
|
||||
if ( ! m_wrapper) {
|
||||
if ( m_wrapper == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), "Export3MF : Error on lib3mf Wrapper")
|
||||
return false ;
|
||||
}
|
||||
// creo model per 3MF
|
||||
m_model = m_wrapper->CreateModel() ;
|
||||
if ( ! m_model) {
|
||||
if ( m_model == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), "Export3MF : Error on lib3mf Model")
|
||||
return false ;
|
||||
}
|
||||
@@ -87,10 +85,11 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
pIter->GoTo( nId) ;
|
||||
|
||||
// esporto l'oggetto e i suoi eventuali figli
|
||||
if ( ! ExportObject( *pIter))
|
||||
return false ;
|
||||
|
||||
|
||||
// scrivo il file
|
||||
try {
|
||||
PWriter writer = m_model->QueryWriter( "3mf") ;
|
||||
@@ -108,79 +107,80 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::ExportObject( const IGdbIterator& iIter)
|
||||
Export3MF::ExportObject( const IGdbIterator& iIter, PComponentsObject pParent, bool bSaveGrpAsComponent)
|
||||
{
|
||||
switch ( iIter.GetGdbType()) {
|
||||
case GDB_TY_GEO :
|
||||
{
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return true ;
|
||||
// se non è una superficie esco
|
||||
if ( pGeoObj->GetType() != SRF_TRIMESH && pGeoObj->GetType() != SRF_FLATRGN)
|
||||
return true ;
|
||||
// recupero il riferimento globale dell'oggetto
|
||||
Frame3d frFrame ;
|
||||
if ( ! iIter.GetGlobFrame( frFrame))
|
||||
return false ;
|
||||
// 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) ;
|
||||
// se il filtro lo abilita
|
||||
if ( TestFilter( nLev, nMode, nStat)) {
|
||||
// recupero eventuale nome
|
||||
string sName ;
|
||||
if ( ! iIter.GetName( sName))
|
||||
sName = ToString( iIter.GetId()) ;
|
||||
// recupero il colore
|
||||
// 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)) {
|
||||
// se è un oggetto geometrico diverso da una superficie esco
|
||||
int nGeoType = iIter.GetGeoType() ;
|
||||
if ( nGeoType != GEO_NONE && nGeoType != SRF_TRIMESH && nGeoType != SRF_FLATRGN)
|
||||
return true ;
|
||||
// recupero nome
|
||||
string sName ;
|
||||
iIter.GetName( sName) ;
|
||||
// recupero info
|
||||
STRVECTOR vsInfo ;
|
||||
iIter.GetAllInfo( vsInfo) ;
|
||||
// esporto
|
||||
switch ( nType) {
|
||||
case GDB_TY_GEO :
|
||||
{
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return false ;
|
||||
// recupero il riferimento globale dell'oggetto
|
||||
Frame3d frFrame ;
|
||||
if ( ! iIter.GetGlobFrame( frFrame))
|
||||
return false ;
|
||||
// recupero il colore
|
||||
Color cCol ;
|
||||
bool bCol = GetColor( cCol, iIter.GetGDB(), iIter.GetId()) ;
|
||||
iIter.GetCalcMaterial( cCol) ;
|
||||
// emetto l'oggetto
|
||||
switch ( pGeoObj->GetType()) {
|
||||
switch ( nGeoType) {
|
||||
case SRF_TRIMESH :
|
||||
if ( ! ExportSTM( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr))
|
||||
return false ;
|
||||
break ;
|
||||
return ExportSTM( pGeoObj, frFrame, sName, vsInfo, cCol, pParent) ;
|
||||
case SRF_FLATRGN :
|
||||
if ( ! ExportSFR( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr))
|
||||
return false ;
|
||||
break ;
|
||||
return ExportSFR( pGeoObj, frFrame, sName, vsInfo, cCol, pParent) ;
|
||||
default :
|
||||
break ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
case GDB_TY_GROUP :
|
||||
// esploro il gruppo
|
||||
return ScanGroup( iIter) ;
|
||||
default :
|
||||
return false ;
|
||||
}
|
||||
case GDB_TY_GROUP :
|
||||
return ExportGroup( iIter, sName, vsInfo, pParent, bSaveGrpAsComponent) ;
|
||||
default :
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::TestFilter( int nLev, int nMode, int nStat)
|
||||
Export3MF::TestFilter( int nLev, int nMode, int nStat, bool bGroup) const
|
||||
{
|
||||
if ( ( nLev == GDB_LV_USER && ( m_nFilter & EEXFLT_LEVUSER) == 0) ||
|
||||
( nLev == GDB_LV_SYSTEM && ( m_nFilter & EEXFLT_LEVSYSTEM) == 0) ||
|
||||
( nLev == GDB_LV_TEMP && ( m_nFilter & EEXFLT_LEVTEMP) == 0))
|
||||
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 && ( m_nFilter & EEXFLT_MODESTD) == 0) ||
|
||||
( nMode == GDB_MD_LOCKED && ( m_nFilter & EEXFLT_MODELOCKED) == 0) ||
|
||||
( nMode == GDB_MD_HIDDEN && ( m_nFilter & EEXFLT_MODEHIDDEN) == 0))
|
||||
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 && ( m_nFilter & EEXFLT_STAOFF) == 0) ||
|
||||
( nStat == GDB_ST_ON && ( m_nFilter & EEXFLT_STAON) == 0) ||
|
||||
( nStat == GDB_ST_SEL && ( m_nFilter & EEXFLT_STASEL) == 0))
|
||||
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 ;
|
||||
@@ -188,7 +188,38 @@ Export3MF::TestFilter( int nLev, int nMode, int nStat)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol)
|
||||
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
|
||||
Export3MF::ExportSFR( const IGeoObj* pGeoObj, const Frame3d& frFrame, const string& sName, const STRVECTOR& vInfo,
|
||||
const Color& cCol, PComponentsObject pParent)
|
||||
{
|
||||
// verifico oggetto
|
||||
const ISurfFlatRegion* pSFR = GetSurfFlatRegion( pGeoObj) ;
|
||||
@@ -196,12 +227,13 @@ Export3MF::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d
|
||||
return false ;
|
||||
// ricavo la trimesh equivalente
|
||||
const ISurfTriMesh* pStm = pSFR->GetAuxSurf() ;
|
||||
return ExportSTM( sName, pStm, frFrame, pCol) ;
|
||||
return ExportSTM( pStm, frFrame, sName, vInfo, cCol, pParent) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol)
|
||||
Export3MF::ExportSTM( const IGeoObj* pGeoObj, const Frame3d& frFrame, const string& sName, const STRVECTOR& vInfo,
|
||||
const Color& cCol, PComponentsObject pParent)
|
||||
{
|
||||
// verifico oggetto
|
||||
const ISurfTriMesh* pSTM = GetSurfTriMesh( pGeoObj) ;
|
||||
@@ -224,7 +256,7 @@ Export3MF::ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Fr
|
||||
int k = 0 ;
|
||||
for ( int i = 0 ; i < pSTM->GetTriangleSize() ; i++) {
|
||||
int nIdVert[3] ;
|
||||
// se il triangolo non è valido passo al successivo
|
||||
// se il triangolo non è valido passo al successivo
|
||||
if ( ! pSTM->GetTriangle( i, nIdVert))
|
||||
continue ;
|
||||
// assegno gli indici dei vertici
|
||||
@@ -235,78 +267,101 @@ Export3MF::ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Fr
|
||||
}
|
||||
|
||||
if ( vVertices.size() == 0 || vTriangles.size() == 0) {
|
||||
LOG_ERROR( GetEExLogger(), ( "Export3MF : surface \"" + sName + "\" is empty. Ignored.").c_str()) ;
|
||||
LOG_ERROR( GetEExLogger(), "Export3MF : empty surface ignored") ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
// creo mesh 3MF
|
||||
PMeshObject meshObject = m_model->AddMeshObject() ;
|
||||
if ( ! meshObject) {
|
||||
if ( meshObject == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), "Export3MF : Error on lib3mf Mesh Object")
|
||||
return false ;
|
||||
}
|
||||
meshObject->SetName( sName) ;
|
||||
meshObject->SetGeometry( vVertices, vTriangles) ;
|
||||
|
||||
// assegno il colore
|
||||
if ( pCol != nullptr) {
|
||||
Lib3MF_uint32 nColId = ColorHandler3MF( pCol) ;
|
||||
meshObject->SetObjectLevelProperty( 1, nColId) ;
|
||||
|
||||
// assegno il nome
|
||||
if ( ! sName.empty())
|
||||
meshObject->SetName( sName) ;
|
||||
// assegno le info
|
||||
PMetaDataGroup metaDataGrp = meshObject->GetMetaDataGroup() ;
|
||||
for ( const string& sInfo : vInfo) {
|
||||
string sKey, sVal ;
|
||||
SplitFirst( sInfo, "=", sKey, sVal) ;
|
||||
metaDataGrp->AddMetaData( sInfoNamespace, sKey, sVal, "xs:string", 0) ;
|
||||
}
|
||||
// assegno il colore
|
||||
Lib3MF_uint32 nColId = ColorHandler3MF( cCol) ;
|
||||
meshObject->SetObjectLevelProperty( 1, nColId) ;
|
||||
|
||||
// aggiungo al modello
|
||||
if ( pParent == nullptr)
|
||||
m_model->AddBuildItem( meshObject.get(), m_wrapper->GetIdentityTransform()) ;
|
||||
else
|
||||
pParent->AddComponent( meshObject.get(), m_wrapper->GetIdentityTransform()) ;
|
||||
|
||||
m_model->AddBuildItem( meshObject.get(), m_wrapper->GetIdentityTransform()) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::ScanGroup( const IGdbIterator& iIter)
|
||||
Export3MF::ExportGroup( const IGdbIterator& iIter, const string& sName, const STRVECTOR& vsInfo, PComponentsObject pParent,
|
||||
bool bSaveAsComponent)
|
||||
{
|
||||
// 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))
|
||||
bOk = false ;
|
||||
PComponentsObject pComponent = pParent ;
|
||||
// se il layer va salvato come componente, la creo
|
||||
if ( bSaveAsComponent) {
|
||||
pComponent = m_model->AddComponentsObject() ;
|
||||
if ( ! sName.empty())
|
||||
pComponent->SetName( sName) ;
|
||||
}
|
||||
|
||||
// salvo le info sulla componente ( se il gruppo viene esportato come tale) o sul modello
|
||||
PMetaDataGroup metaDataGrp ;
|
||||
if ( bSaveAsComponent)
|
||||
metaDataGrp = pComponent->GetMetaDataGroup() ;
|
||||
else
|
||||
metaDataGrp = m_model->GetMetaDataGroup() ;
|
||||
for ( const string& sInfo : vsInfo) {
|
||||
string sKey, sVal ;
|
||||
SplitFirst( sInfo, "=", sKey, sVal) ;
|
||||
metaDataGrp->AddMetaData( sInfoNamespace, sKey, sVal, "xs:string", 0) ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
// scandisco il gruppo per inserire i suoi oggetti
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( iIter.GetGDB())) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
for ( bool bNext = pIter->GoToFirstInGroup( iIter) ; bNext ; bNext = pIter->GoToNext()) {
|
||||
if ( ! ExportObject( *pIter, pComponent, true))
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::GetColor( Color& pCol, const IGeomDB * pGDB, const int& nId)
|
||||
{
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
if ( ! pGDB->GetMaterial( nId, pCol))
|
||||
// se fallisce cerco il colore del parent
|
||||
return GetColor( pCol, pGDB, pGDB->GetParentId( nId)) ;
|
||||
// se il gruppo va salvato come componente, lo aggiungo al modello
|
||||
if ( bSaveAsComponent && pComponent->GetComponentCount() > 0) {
|
||||
if ( pParent == nullptr)
|
||||
m_model->AddBuildItem( pComponent.get(), m_wrapper->GetIdentityTransform()) ;
|
||||
else
|
||||
pParent->AddComponent( pComponent.get(), m_wrapper->GetIdentityTransform()) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Lib3MF_uint32
|
||||
Export3MF::ColorHandler3MF( const Color* pCol)
|
||||
Export3MF::ColorHandler3MF( const Color& cCol)
|
||||
{
|
||||
PColorGroup pColorGrp = m_model->GetColorGroupByID( 1) ;
|
||||
// converto il colore nel formato usato da 3MF
|
||||
Lib3MF_uint8 nAlpha = ( int)( pCol->GetIntAlpha() * 2.55 + 0.5) ;
|
||||
sColor cCol3mf = m_wrapper->RGBAToColor( pCol->GetIntRed(), pCol->GetIntGreen(), pCol->GetIntBlue(), nAlpha) ;
|
||||
// verifico se il colore è già presente nel colorgroup
|
||||
Lib3MF_uint8 nAlpha = ( int)( cCol.GetIntAlpha() * 2.55 + 0.5) ;
|
||||
sColor cCol3mf = m_wrapper->RGBAToColor( cCol.GetIntRed(), cCol.GetIntGreen(), cCol.GetIntBlue(), nAlpha) ;
|
||||
// verifico se il colore è già presente nel colorgroup
|
||||
UINTVECTOR vColorIdx ;
|
||||
pColorGrp->GetAllPropertyIDs( vColorIdx) ;
|
||||
for ( Lib3MF_uint32 i : vColorIdx) {
|
||||
sColor cColTmp = pColorGrp->GetColor( i) ;
|
||||
if ( cColTmp.m_Red == cCol3mf.m_Red && cColTmp.m_Green == cCol3mf.m_Green && cColTmp.m_Blue == cCol3mf.m_Blue
|
||||
&& cColTmp.m_Alpha == cCol3mf.m_Alpha)
|
||||
if ( cColTmp.m_Red == cCol3mf.m_Red && cColTmp.m_Green == cCol3mf.m_Green && cColTmp.m_Blue == cCol3mf.m_Blue &&
|
||||
cColTmp.m_Alpha == cCol3mf.m_Alpha)
|
||||
return i ;
|
||||
}
|
||||
// se non fosse presente, lo aggiungo
|
||||
|
||||
+16
-10
@@ -13,7 +13,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define NOMINMAX
|
||||
#define NOMINMAX
|
||||
#include "/EgtDev/Extern/Lib3MF/Include/lib3mf_implicit.hpp"
|
||||
#include "/EgtDev/Include/EExExport3MF.h"
|
||||
|
||||
@@ -27,19 +27,25 @@ class Export3MF : public IExport3MF
|
||||
virtual bool Export( IGeomDB* pGDB, int nId, const std::string& sFile) ;
|
||||
|
||||
public :
|
||||
Export3MF( void) : m_nFilter( EEXFLT_DEFAULT) {}
|
||||
Export3MF( void) : m_nFilter( EEXFLT_DEFAULT) {
|
||||
CalcGroupFilter() ;
|
||||
}
|
||||
|
||||
private :
|
||||
bool ExportObject( const IGdbIterator& iIter) ;
|
||||
bool ScanGroup( const IGdbIterator& iIter) ;
|
||||
bool TestFilter( int nLev, int nMode, int nStat) ;
|
||||
bool ExportSFR( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol) ;
|
||||
bool ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol) ;
|
||||
Lib3MF_uint32 ColorHandler3MF( const Color* pCol) ;
|
||||
bool GetColor( Color& pCol, const IGeomDB * pGBD, const int& nId) ;
|
||||
bool ExportObject( const IGdbIterator& iIter, Lib3MF::PComponentsObject pParent = nullptr, bool bSaveGrpAsComponent = false) ;
|
||||
bool ExportGroup( const IGdbIterator& iIter, const std::string& sName, const STRVECTOR& vsInfo, Lib3MF::PComponentsObject pParent,
|
||||
bool bSaveAsComponent) ;
|
||||
bool ExportSFR( const IGeoObj* pGeoObj, const Frame3d& frFrame, const std::string& sName, const STRVECTOR& vInfo,
|
||||
const Color& cCol, Lib3MF::PComponentsObject pParent) ;
|
||||
bool ExportSTM( const IGeoObj* pGeoObj, const Frame3d& frFrame, const std::string& sName, const STRVECTOR& vInfo,
|
||||
const Color& cCol, Lib3MF::PComponentsObject pParent) ;
|
||||
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup) const ;
|
||||
bool CalcGroupFilter( void) ;
|
||||
Lib3MF_uint32 ColorHandler3MF( const Color& cCol) ;
|
||||
|
||||
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::PModel m_model ; // lib3mf model
|
||||
} ;
|
||||
+112
-80
@@ -33,8 +33,6 @@
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtStringDecoder.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
@@ -46,7 +44,7 @@ IExportDxf*
|
||||
CreateExportDxf( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_EXPBASE, GetEExLogger()))
|
||||
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IExportDxf*> ( new(nothrow) ExportDxf) ;
|
||||
@@ -57,6 +55,7 @@ bool
|
||||
ExportDxf::SetOptions( int nFilter, int nFlag)
|
||||
{
|
||||
m_nFilter = nFilter ;
|
||||
CalcGroupFilter() ;
|
||||
m_bCompoundLayer = (( nFlag & EEXFLAG_COMP_LAYER) != 0) ;
|
||||
m_bColorByLayer = (( nFlag & EEXFLAG_COL_BY_LAYER) != 0) ;
|
||||
m_bAdvancedNames = (( nFlag & EEXFLAG_ADV_NAMES) != 0) ;
|
||||
@@ -100,7 +99,7 @@ ExportDxf::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
||||
if ( ! ExportBlocks( pGDB, nId))
|
||||
bOk = false ;
|
||||
|
||||
// scrivo la sezione entità
|
||||
// scrivo la sezione entit�
|
||||
if ( ! ExportEntities( pGDB, nId))
|
||||
bOk = false ;
|
||||
|
||||
@@ -602,7 +601,7 @@ ExportDxf::WriteLayersTable( IGeomDB* pGDB, int nId)
|
||||
bool
|
||||
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)
|
||||
return true ;
|
||||
|
||||
@@ -616,7 +615,7 @@ ExportDxf::FindLayers( const IGdbIterator& iIter, const string& sLay, LAYDATVECT
|
||||
int nStat = GDB_ST_ON ;
|
||||
iIter.GetCalcStatus( nStat) ;
|
||||
// se il filtro non lo abilita, esco subito
|
||||
if ( ! TestFilter( nLev, nMode, nStat))
|
||||
if ( ! TestFilter( nLev, nMode, nStat, true))
|
||||
return true ;
|
||||
|
||||
// aggiorno nome layer
|
||||
@@ -634,7 +633,7 @@ ExportDxf::FindLayers( const IGdbIterator& iIter, const string& sLay, LAYDATVECT
|
||||
string s2 = sNewLay ;
|
||||
if ( ToUpper( s1) == ToUpper( s2)) {
|
||||
bFound = true ;
|
||||
// se è il nome esatto, aggiorno il colore
|
||||
// se � il nome esatto, aggiorno il colore
|
||||
if ( bExactLay)
|
||||
vLayDat[i].second = nCol ;
|
||||
}
|
||||
@@ -720,9 +719,9 @@ ExportDxf::WriteStylesTable( IGeomDB* pGDB, int nId)
|
||||
bool
|
||||
ExportDxf::FindTextStyles( const IGdbIterator& iIter, STRVECTOR& vFontName)
|
||||
{
|
||||
// se è una entità geometrica
|
||||
// se � una entit� geometrica
|
||||
if ( iIter.GetGdbType() == GDB_TY_GEO) {
|
||||
// se è un testo
|
||||
// se � un testo
|
||||
if ( const IExtText* pTXT = GetExtText( iIter.GetGeoObj())) {
|
||||
// se font non presente, lo aggiungo al vettore dei font
|
||||
bool bFound = false ;
|
||||
@@ -918,7 +917,7 @@ ExportDxf::ExportBlocks( IGeomDB* pGDB, int nId)
|
||||
bool
|
||||
ExportDxf::ExportEntities( IGeomDB* pGDB, int nId)
|
||||
{
|
||||
// intestazione sezione entità
|
||||
// intestazione sezione entit�
|
||||
if ( ! WriteItem( 0, "SECTION") ||
|
||||
! WriteItem( 2, "ENTITIES"))
|
||||
return false ;
|
||||
@@ -932,7 +931,7 @@ ExportDxf::ExportEntities( IGeomDB* pGDB, int nId)
|
||||
if ( ! ExportGdbObject( *pIter, LAY_DEFAULT))
|
||||
return false ;
|
||||
|
||||
// terminazione sezione entità
|
||||
// terminazione sezione entit�
|
||||
if ( ! WriteItem( 0, "ENDSEC"))
|
||||
return false ;
|
||||
|
||||
@@ -943,35 +942,36 @@ ExportDxf::ExportEntities( IGeomDB* pGDB, int nId)
|
||||
bool
|
||||
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
|
||||
int nGdbType = iIter.GetGdbType() ;
|
||||
// se gruppo di oggetti
|
||||
if ( nGdbType == GDB_TY_GROUP) {
|
||||
// esporto il gruppo
|
||||
return ExportGdbGroup( iIter, sLay) ;
|
||||
}
|
||||
// se oggetto geometrico
|
||||
else if ( nGdbType == GDB_TY_GEO) {
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return true ;
|
||||
// recupero il riferimento globale dell'oggetto
|
||||
Frame3d frFrame ;
|
||||
if ( ! iIter.GetGlobFrame( frFrame))
|
||||
return false ;
|
||||
// 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) ;
|
||||
// se il filtro lo abilita
|
||||
if ( TestFilter( nLev, nMode, nStat)) {
|
||||
// recupero colore (trasformato in formato ACI)
|
||||
// se il filtro lo abilita
|
||||
if ( TestFilter( nLev, nMode, nStat, nGdbType == GDB_TY_GROUP)) {
|
||||
// se gruppo di oggetti
|
||||
if ( nGdbType == GDB_TY_GROUP) {
|
||||
// esporto il gruppo
|
||||
return ExportGdbGroup( iIter, sLay) ;
|
||||
}
|
||||
// se oggetto geometrico
|
||||
else if ( nGdbType == GDB_TY_GEO) {
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return true ;
|
||||
// recupero il riferimento globale dell'oggetto
|
||||
Frame3d frFrame ;
|
||||
if ( ! iIter.GetGlobFrame( frFrame))
|
||||
return false ;
|
||||
// recupero colore (trasformato in formato ACI)
|
||||
int nCol = COL_DEFAULT ;
|
||||
Color cCol ;
|
||||
if ( ( m_bColorByLayer && iIter.GetMaterial( cCol)) ||
|
||||
@@ -1016,11 +1016,12 @@ ExportDxf::ExportGdbObject( const IGdbIterator& iIter, const string& sLay)
|
||||
return false ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1077,7 +1078,7 @@ ExportDxf::ExportLine( const string& sLay, int nCol, const IGeoObj* pGeoObj, con
|
||||
const ICurveLine* pLine = GetCurveLine( pGeoObj) ;
|
||||
if ( pLine == nullptr)
|
||||
return false ;
|
||||
// scrivo l'entità
|
||||
// scrivo l'entit�
|
||||
return WriteLine( sLay, nCol, pLine, frFrame) ;
|
||||
}
|
||||
|
||||
@@ -1089,7 +1090,7 @@ ExportDxf::ExportArc( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
|
||||
const ICurveArc* pArc = GetCurveArc( pGeoObj) ;
|
||||
if ( pArc == nullptr)
|
||||
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()) {
|
||||
// esporto come polilinea 3d
|
||||
return WriteCurve3d( sLay, nCol, pArc, frFrame) ;
|
||||
@@ -1162,9 +1163,9 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
|
||||
const ISurfTriMesh* pSTM = GetSurfTriMesh( pGeoObj) ;
|
||||
if ( pSTM == nullptr)
|
||||
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) {
|
||||
// identificativo entità
|
||||
// identificativo entit�
|
||||
if ( ! WriteItem( 0, "POLYLINE"))
|
||||
return false ;
|
||||
// layer
|
||||
@@ -1173,7 +1174,7 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
|
||||
// colore
|
||||
if ( ! WriteItem( 62, nCol))
|
||||
return false ;
|
||||
// flag segnalazione entità successive dipendenti (vertex)
|
||||
// flag segnalazione entit� successive dipendenti (vertex)
|
||||
if ( ! WriteItem( 66, 1))
|
||||
return false ;
|
||||
// punto inutile ma obbligatorio
|
||||
@@ -1196,7 +1197,7 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
|
||||
nId != SVT_NULL ;
|
||||
nId = pSTM->GetNextVertex( nId, ptP)) {
|
||||
ptP.ToGlob( frFrame) ;
|
||||
// entità vertice
|
||||
// entit� vertice
|
||||
if ( ! WriteItem( 0, "VERTEX"))
|
||||
return false ;
|
||||
// layer
|
||||
@@ -1216,7 +1217,7 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
|
||||
for ( int nId = pSTM->GetFirstTriangle( nIdVert) ;
|
||||
nId != SVT_NULL ;
|
||||
nId = pSTM->GetNextTriangle( nId, nIdVert)) {
|
||||
// entità vertice
|
||||
// entit� vertice
|
||||
if ( ! WriteItem( 0, "VERTEX"))
|
||||
return false ;
|
||||
// layer
|
||||
@@ -1239,7 +1240,7 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
|
||||
! WriteItem( 73, nIdVert[2] + 1))
|
||||
return false ;
|
||||
}
|
||||
// entità termine dei vertici
|
||||
// entit� termine dei vertici
|
||||
if ( ! WriteItem( 0, "SEQEND"))
|
||||
return false ;
|
||||
// layer
|
||||
@@ -1255,7 +1256,7 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
|
||||
nId != SVT_NULL ;
|
||||
nId = pSTM->GetNextTriangle( nId, Tria)) {
|
||||
Tria.ToGlob( frFrame) ;
|
||||
// entità 3dface
|
||||
// entit� 3dface
|
||||
if ( ! WriteItem( 0, "3DFACE"))
|
||||
return false ;
|
||||
// layer
|
||||
@@ -1311,7 +1312,7 @@ ExportDxf::ExportText( const string& sLay, int nCol, const IGeoObj* pGeoObj, con
|
||||
// ciclo sui diversi testi semplici
|
||||
bool bOk = true ;
|
||||
for ( int i = 0 ; i < int( vTxt.size()) ; ++ i) {
|
||||
// identificativo entità
|
||||
// identificativo entit�
|
||||
if ( ! WriteItem( 0, "TEXT"))
|
||||
return false ;
|
||||
// layer
|
||||
@@ -1354,7 +1355,7 @@ ExportDxf::ExportText( const string& sLay, int nCol, const IGeoObj* pGeoObj, con
|
||||
! WriteItem( 220, vtN.y) ||
|
||||
! WriteItem( 230, vtN.z))
|
||||
return false ;
|
||||
// libero l'entità
|
||||
// libero l'entit�
|
||||
delete vTxt[i] ;
|
||||
}
|
||||
return bOk ;
|
||||
@@ -1396,7 +1397,7 @@ ExportDxf::AdjustText( string& sText)
|
||||
bool
|
||||
ExportDxf::WritePoint( const string& sLay, int nCol, const Point3d& ptP, const Vector3d& vtV, const Frame3d& frFrame)
|
||||
{
|
||||
// identificativo entità
|
||||
// identificativo entit�
|
||||
if ( ! WriteItem( 0, "POINT"))
|
||||
return false ;
|
||||
// layer
|
||||
@@ -1430,10 +1431,10 @@ ExportDxf::WritePoint( const string& sLay, int nCol, const Point3d& ptP, const V
|
||||
bool
|
||||
ExportDxf::WriteLine( const string& sLay, int nCol, const ICurveLine* pLine, const Frame3d& frFrame)
|
||||
{
|
||||
// verifico validità linea
|
||||
// verifico validit� linea
|
||||
if ( pLine == nullptr)
|
||||
return false ;
|
||||
// identificativo entità
|
||||
// identificativo entit�
|
||||
if ( ! WriteItem( 0, "LINE"))
|
||||
return false ;
|
||||
// layer
|
||||
@@ -1481,7 +1482,7 @@ ExportDxf::WriteLine( const string& sLay, int nCol, const ICurveLine* pLine, con
|
||||
bool
|
||||
ExportDxf::WriteCircle( const string& sLay, int nCol, const ICurveArc* pArc, const Frame3d& frFrame)
|
||||
{
|
||||
// verifico validità arco
|
||||
// verifico validit� arco
|
||||
if ( pArc == nullptr)
|
||||
return false ;
|
||||
// verifico verso eventuale estrusione
|
||||
@@ -1493,7 +1494,7 @@ ExportDxf::WriteCircle( const string& sLay, int nCol, const ICurveArc* pArc, con
|
||||
vtN.ToGlob( frFrame) ;
|
||||
Frame3d frOCS ;
|
||||
frOCS.Set( ORIG, vtN) ;
|
||||
// identificativo entità
|
||||
// identificativo entit�
|
||||
if ( ! WriteItem( 0, "CIRCLE"))
|
||||
return false ;
|
||||
// layer
|
||||
@@ -1532,7 +1533,7 @@ ExportDxf::WriteCircle( const string& sLay, int nCol, const ICurveArc* pArc, con
|
||||
bool
|
||||
ExportDxf::WriteArc( const string& sLay, int nCol, const ICurveArc* pArc, const Frame3d& frFrame)
|
||||
{
|
||||
// verifico validità arco
|
||||
// verifico validit� arco
|
||||
if ( pArc == nullptr)
|
||||
return false ;
|
||||
// verifico verso eventuale estrusione
|
||||
@@ -1544,7 +1545,7 @@ ExportDxf::WriteArc( const string& sLay, int nCol, const ICurveArc* pArc, const
|
||||
vtN.ToGlob( frFrame) ;
|
||||
Frame3d frOCS ;
|
||||
frOCS.Set( ORIG, vtN) ;
|
||||
// identificativo entità
|
||||
// identificativo entit�
|
||||
if ( ! WriteItem( 0, "ARC"))
|
||||
return false ;
|
||||
// layer
|
||||
@@ -1596,7 +1597,7 @@ bool
|
||||
ExportDxf::WriteCurve2d( const string& sLay, int nCol, const ICurve* pCrv,
|
||||
const Frame3d& frPlane, const Frame3d& frFrame)
|
||||
{
|
||||
// verifico validità curva
|
||||
// verifico validit� curva
|
||||
if ( pCrv == nullptr)
|
||||
return false ;
|
||||
// trasformo in poliarco
|
||||
@@ -1637,7 +1638,7 @@ ExportDxf::WriteCurve2d( const string& sLay, int nCol, const ICurve* pCrv,
|
||||
// colore
|
||||
if ( ! WriteItem( 62, nCol))
|
||||
return false ;
|
||||
// flag segnalazione entità successive dipendenti (vertex)
|
||||
// flag segnalazione entit� successive dipendenti (vertex)
|
||||
if ( ! WriteItem( 66, 1))
|
||||
return false ;
|
||||
// punto per sola elevazione : X,Y inutili Z elevazione
|
||||
@@ -1669,7 +1670,7 @@ ExportDxf::WriteCurve2d( const string& sLay, int nCol, const ICurve* pCrv,
|
||||
for ( bool bPnt = PA.GetFirstPoint( ptP, dBulge) ;
|
||||
bPnt ;
|
||||
bPnt = PA.GetNextPoint( ptP, dBulge, bClosed)) {
|
||||
// entità vertice
|
||||
// entit� vertice
|
||||
if ( ! WriteItem( 0, "VERTEX"))
|
||||
return false ;
|
||||
// layer
|
||||
@@ -1688,7 +1689,7 @@ ExportDxf::WriteCurve2d( const string& sLay, int nCol, const ICurve* pCrv,
|
||||
if ( ! WriteItem( 70, 0))
|
||||
return false ;
|
||||
}
|
||||
// entità termine dei vertici
|
||||
// entit� termine dei vertici
|
||||
if ( ! WriteItem( 0, "SEQEND"))
|
||||
return false ;
|
||||
// layer
|
||||
@@ -1701,7 +1702,7 @@ ExportDxf::WriteCurve2d( const string& sLay, int nCol, const ICurve* pCrv,
|
||||
bool
|
||||
ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const Frame3d& frFrame)
|
||||
{
|
||||
// verifico validità curva
|
||||
// verifico validit� curva
|
||||
if ( pCrv == nullptr)
|
||||
return false ;
|
||||
// trasformo in polilinea
|
||||
@@ -1726,7 +1727,7 @@ ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const
|
||||
// colore
|
||||
if ( ! WriteItem( 62, nCol))
|
||||
return false ;
|
||||
// flag segnalazione entità successive dipendenti (vertex)
|
||||
// flag segnalazione entit� successive dipendenti (vertex)
|
||||
if ( ! WriteItem( 66, 1))
|
||||
return false ;
|
||||
// punto inutile ma obbligatorio
|
||||
@@ -1742,7 +1743,7 @@ ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const
|
||||
for ( bool bPnt = PL.GetFirstPoint( ptP) ;
|
||||
bPnt ;
|
||||
bPnt = PL.GetNextPoint( ptP)) {
|
||||
// entità vertice
|
||||
// entit� vertice
|
||||
if ( ! WriteItem( 0, "VERTEX"))
|
||||
return false ;
|
||||
// layer
|
||||
@@ -1758,7 +1759,7 @@ ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const
|
||||
if ( ! WriteItem( 70, 32))
|
||||
return false ;
|
||||
}
|
||||
// entità termine dei vertici
|
||||
// entit� termine dei vertici
|
||||
if ( ! WriteItem( 0, "SEQEND"))
|
||||
return false ;
|
||||
// layer
|
||||
@@ -1771,7 +1772,7 @@ ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const
|
||||
for ( bool bPnt = PL.GetFirstLine( ptStart, ptEnd) ;
|
||||
bPnt ;
|
||||
bPnt = PL.GetNextLine( ptStart, ptEnd)) {
|
||||
// identificativo entità
|
||||
// identificativo entit�
|
||||
if ( ! WriteItem( 0, "LINE"))
|
||||
return false ;
|
||||
// layer
|
||||
@@ -1811,24 +1812,55 @@ ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
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) ||
|
||||
( nLev == GDB_LV_SYSTEM && ( m_nFilter & EEXFLT_LEVSYSTEM) == 0) ||
|
||||
( nLev == GDB_LV_TEMP && ( m_nFilter & EEXFLT_LEVTEMP) == 0))
|
||||
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 && ( m_nFilter & EEXFLT_MODESTD) == 0) ||
|
||||
( nMode == GDB_MD_LOCKED && ( m_nFilter & EEXFLT_MODELOCKED) == 0) ||
|
||||
( nMode == GDB_MD_HIDDEN && ( m_nFilter & EEXFLT_MODEHIDDEN) == 0))
|
||||
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 && ( m_nFilter & EEXFLT_STAOFF) == 0) ||
|
||||
( nStat == GDB_ST_ON && ( m_nFilter & EEXFLT_STAON) == 0) ||
|
||||
( nStat == GDB_ST_SEL && ( m_nFilter & EEXFLT_STASEL) == 0))
|
||||
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
|
||||
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
|
||||
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,
|
||||
const Frame3d& frPlane, 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, double dVal, int nPrec = 6) ;
|
||||
bool WriteItem( int nCode, const std::string& sVal) ;
|
||||
@@ -81,7 +82,8 @@ class ExportDxf : public IExportDxf
|
||||
std::string AdjustFontName( const std::string& sFontName) ;
|
||||
|
||||
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_bColorByLayer ;
|
||||
bool m_bAdvancedNames ;
|
||||
|
||||
+77
-45
@@ -21,8 +21,6 @@
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkGdbIterator.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 <fstream>
|
||||
@@ -34,7 +32,7 @@ IExportStl*
|
||||
CreateExportStl( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_EXPBASE, GetEExLogger()))
|
||||
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IExportStl*> ( new(nothrow) ExportStl) ;
|
||||
@@ -45,6 +43,7 @@ bool
|
||||
ExportStl::SetOptions( int nFilter)
|
||||
{
|
||||
m_nFilter = nFilter ;
|
||||
CalcGroupFilter() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -89,34 +88,35 @@ ExportStl::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
||||
bool
|
||||
ExportStl::ExportObject( const IGdbIterator& iIter)
|
||||
{
|
||||
switch ( iIter.GetGdbType()) {
|
||||
case GDB_TY_GEO :
|
||||
{
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return true ;
|
||||
// recupero il riferimento globale dell'oggetto
|
||||
Frame3d frFrame ;
|
||||
if ( ! iIter.GetGlobFrame( frFrame))
|
||||
return false ;
|
||||
// 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) ;
|
||||
// se il filtro lo abilita
|
||||
if ( TestFilter( nLev, nMode, nStat)) {
|
||||
// recupero eventuale nome
|
||||
// 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 l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return true ;
|
||||
// recupero il riferimento globale dell'oggetto
|
||||
Frame3d frFrame ;
|
||||
if ( ! iIter.GetGlobFrame( frFrame))
|
||||
return false ;
|
||||
// recupero eventuale nome
|
||||
string sName ;
|
||||
if ( ! iIter.GetName( sName))
|
||||
sName = ToString( iIter.GetId()) ;
|
||||
// emetto l'oggetto
|
||||
switch ( pGeoObj->GetType()) {
|
||||
switch ( pGeoObj->GetType()) {
|
||||
case SRF_TRIMESH :
|
||||
if ( ! ExportSTM( sName, pGeoObj, frFrame))
|
||||
return false ;
|
||||
@@ -128,37 +128,69 @@ ExportStl::ExportObject( const IGdbIterator& iIter)
|
||||
default :
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
case GDB_TY_GROUP :
|
||||
// esploro il gruppo
|
||||
return ScanGroup( iIter) ;
|
||||
default :
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
case GDB_TY_GROUP :
|
||||
// esploro il gruppo
|
||||
return ScanGroup( iIter) ;
|
||||
default :
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
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) ||
|
||||
( nLev == GDB_LV_SYSTEM && ( m_nFilter & EEXFLT_LEVSYSTEM) == 0) ||
|
||||
( nLev == GDB_LV_TEMP && ( m_nFilter & EEXFLT_LEVTEMP) == 0))
|
||||
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 && ( m_nFilter & EEXFLT_MODESTD) == 0) ||
|
||||
( nMode == GDB_MD_LOCKED && ( m_nFilter & EEXFLT_MODELOCKED) == 0) ||
|
||||
( nMode == GDB_MD_HIDDEN && ( m_nFilter & EEXFLT_MODEHIDDEN) == 0))
|
||||
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 && ( m_nFilter & EEXFLT_STAOFF) == 0) ||
|
||||
( nStat == GDB_ST_ON && ( m_nFilter & EEXFLT_STAON) == 0) ||
|
||||
( nStat == GDB_ST_SEL && ( m_nFilter & EEXFLT_STASEL) == 0))
|
||||
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
|
||||
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
|
||||
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) ;
|
||||
|
||||
public :
|
||||
ExportStl( void) : m_nFilter( EEXFLT_DEFAULT) {}
|
||||
ExportStl( void) : m_nFilter( EEXFLT_DEFAULT) {
|
||||
CalcGroupFilter() ;
|
||||
}
|
||||
|
||||
private :
|
||||
bool ExportObject( 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 ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame) ;
|
||||
|
||||
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
|
||||
} ;
|
||||
|
||||
+179
-8
@@ -28,8 +28,6 @@
|
||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.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 <fstream>
|
||||
@@ -41,7 +39,7 @@ IExportSvg*
|
||||
CreateExportSvg( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_EXPBASE, GetEExLogger()))
|
||||
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IExportSvg*> ( new(nothrow) ExportSvg) ;
|
||||
@@ -93,8 +91,8 @@ ExportSvg::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
||||
{ return a.second < b.second ; }) ;
|
||||
|
||||
// scrivo la sezione di intestazione
|
||||
double dDimX = b3All.GetMax().x - b3All.GetMin().x ;
|
||||
double dDimY = b3All.GetMax().y - b3All.GetMin().y ;
|
||||
double dDimX = b3All.GetDimX() ;
|
||||
double dDimY = b3All.GetDimY() ;
|
||||
if ( ! ExportHeader( dDimX, dDimY))
|
||||
bOk = false ;
|
||||
|
||||
@@ -189,6 +187,9 @@ ExportSvg::ExportHeader( double dDimX, double dDimY)
|
||||
{
|
||||
if ( ! m_Writer.OutText( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"))
|
||||
return false ;
|
||||
const double MIN_DIM = 10 ;
|
||||
dDimX = max( dDimX, MIN_DIM) ;
|
||||
dDimY = max( dDimY, MIN_DIM) ;
|
||||
const double COEFF = 0.05 ;
|
||||
double dExtraX = COEFF * dDimX ;
|
||||
double dExtraY = COEFF * dDimY ;
|
||||
@@ -333,6 +334,18 @@ ExportSvg::ExportPoint( const string& sName, const Color& colObj, const IGeoObj*
|
||||
return m_Writer.OutText( sOut) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
AddLink( const Point3d& ptStart, const Vector3d& vtDir, double dLen, const Frame3d& frFrame, ICRVLINEPOVECTOR& vLink)
|
||||
{
|
||||
if ( ! ptStart.IsValid() || vtDir.IsSmall() || abs( dLen) < 2 * EPS_SMALL)
|
||||
return false ;
|
||||
vLink.emplace_back( CreateCurveLine()) ;
|
||||
vLink.back()->SetPVL( ptStart, vtDir, dLen) ;
|
||||
vLink.back()->ToGlob( frFrame) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExportSvg::ExportLine( const string& sName, const Color& colObj, const IGeoObj* pGeoObj, const Frame3d& frFrame)
|
||||
@@ -346,9 +359,34 @@ ExportSvg::ExportLine( const string& sName, const Color& colObj, const IGeoObj*
|
||||
if ( IsNull( pMyLine))
|
||||
return false ;
|
||||
pMyLine->ToGlob( frFrame) ;
|
||||
// eventuali curve per spessore e collegamenti
|
||||
PtrOwner<ICurveLine> pMyLine2 ;
|
||||
ICRVLINEPOVECTOR vMyLink ;
|
||||
Vector3d vtExtr ; double dThick ;
|
||||
if ( pLine->GetExtrusion( vtExtr) && ! vtExtr.IsSmallXY() &&
|
||||
pLine->GetThickness( dThick) && abs( dThick) > EPS_SMALL) {
|
||||
// curva sullo spessore
|
||||
pMyLine2.Set( pLine->Clone()) ;
|
||||
if ( IsNull( pMyLine2))
|
||||
return false ;
|
||||
pMyLine2->Translate( dThick * vtExtr) ;
|
||||
pMyLine2->ToGlob( frFrame) ;
|
||||
// collegamenti
|
||||
for ( double dU = 0 ; dU < 1 + EPS_PARAM ; dU += 1) {
|
||||
Point3d ptP ;
|
||||
pLine->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP) ;
|
||||
AddLink( ptP, vtExtr, dThick, frFrame, vMyLink) ;
|
||||
}
|
||||
}
|
||||
// porto nel piano XY globale (se si riduce ad un punto la salto)
|
||||
if ( ! pMyLine->Scale( GLOB_FRM, 1, 1, 0))
|
||||
return true ;
|
||||
// trasformo anche l'eventuale copia
|
||||
if ( ! IsNull( pMyLine2))
|
||||
pMyLine2->Scale( GLOB_FRM, 1, 1, 0) ;
|
||||
// trasformo anche gli eventuali collegamenti
|
||||
for ( auto& pLink : vMyLink)
|
||||
pLink->Scale( GLOB_FRM, 1, 1, 0) ;
|
||||
// questo oggetto non può avere fill
|
||||
bool bFill = false ;
|
||||
// assegno tipo
|
||||
@@ -361,6 +399,16 @@ ExportSvg::ExportLine( const string& sName, const Color& colObj, const IGeoObj*
|
||||
sOut +=GetStartString( pMyLine) ;
|
||||
// arco
|
||||
sOut += GetCurveString( pMyLine) ;
|
||||
// eventuale curva copia per spessore
|
||||
if ( ! IsNull( pMyLine2)) {
|
||||
sOut += GetStartString( pMyLine2) ;
|
||||
sOut += GetCurveString( pMyLine2) ;
|
||||
}
|
||||
// eventuali collegamenti per spessore
|
||||
for ( const auto& pLink : vMyLink) {
|
||||
sOut += GetStartString( pLink) ;
|
||||
sOut += GetCurveString( pLink) ;
|
||||
}
|
||||
// termino i dati geometrici
|
||||
sOut += "\"" ;
|
||||
// colore e spessore
|
||||
@@ -379,18 +427,44 @@ ExportSvg::ExportArc( const string& sName, const Color& colObj, const IGeoObj* p
|
||||
const ICurveArc* pArc = GetCurveArc( pGeoObj) ;
|
||||
if ( pArc == nullptr)
|
||||
return false ;
|
||||
// lo inglobo in una curva composita e lo porto in globale
|
||||
// lo copio e lo porto in globale
|
||||
PtrOwner<ICurveComposite> pMyCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pMyCompo))
|
||||
return false ;
|
||||
pMyCompo->AddCurve( *pArc) ;
|
||||
pMyCompo->ToGlob( frFrame) ;
|
||||
// eventuali curve per spessore e collegamenti
|
||||
PtrOwner<ICurveComposite> pMyCompo2 ;
|
||||
ICRVLINEPOVECTOR vMyLink ;
|
||||
Vector3d vtExtr ; double dThick ;
|
||||
if ( pArc->GetExtrusion( vtExtr) && ! vtExtr.IsSmallXY() &&
|
||||
pArc->GetThickness( dThick) && abs( dThick) > EPS_SMALL) {
|
||||
// curva sullo spessore
|
||||
pMyCompo2.Set( CreateCurveComposite()) ;
|
||||
if ( IsNull( pMyCompo2))
|
||||
return false ;
|
||||
pMyCompo2->AddCurve( *pArc) ;
|
||||
pMyCompo2->Translate( dThick * vtExtr) ;
|
||||
pMyCompo2->ToGlob( frFrame) ;
|
||||
// collegamenti
|
||||
for ( double dU = 0 ; dU < 1 + EPS_PARAM ; dU += 0.25) {
|
||||
Point3d ptP ;
|
||||
pArc->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP) ;
|
||||
AddLink( ptP, vtExtr, dThick, frFrame, vMyLink) ;
|
||||
}
|
||||
}
|
||||
// verifico se la curva giace in un piano parallelo a XY globale
|
||||
Plane3d plPlane ;
|
||||
if ( ! pMyCompo->IsFlat( plPlane, false, 10 * EPS_SMALL) ||
|
||||
! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), Z_AX)) {
|
||||
// porto nel piano XY globale
|
||||
pMyCompo->Scale( GLOB_FRM, 1, 1, 0) ;
|
||||
// trasformo anche l'eventuale copia
|
||||
if ( ! IsNull( pMyCompo2))
|
||||
pMyCompo2->Scale( GLOB_FRM, 1, 1, 0) ;
|
||||
// trasformo anche gli eventuali collegamenti
|
||||
for ( auto& pLink : vMyLink)
|
||||
pLink->Scale( GLOB_FRM, 1, 1, 0) ;
|
||||
}
|
||||
// assegno tipo
|
||||
string sOut = " <path" ;
|
||||
@@ -402,6 +476,16 @@ ExportSvg::ExportArc( const string& sName, const Color& colObj, const IGeoObj* p
|
||||
sOut +=GetStartString( pMyCompo) ;
|
||||
// arco
|
||||
sOut += GetCurveString( pMyCompo) ;
|
||||
// eventuale curva copia per spessore
|
||||
if ( ! IsNull( pMyCompo2)) {
|
||||
sOut += GetStartString( pMyCompo2) ;
|
||||
sOut += GetCurveString( pMyCompo2) ;
|
||||
}
|
||||
// eventuali collegamenti per spessore
|
||||
for ( const auto& pLink : vMyLink) {
|
||||
sOut += GetStartString( pLink) ;
|
||||
sOut += GetCurveString( pLink) ;
|
||||
}
|
||||
// termino i dati geometrici
|
||||
sOut += "\"" ;
|
||||
// colore e spessore
|
||||
@@ -425,6 +509,25 @@ ExportSvg::ExportBezier( const string& sName, const Color& colObj, const IGeoObj
|
||||
if ( IsNull( pMyBez))
|
||||
return false ;
|
||||
pMyBez->ToGlob( frFrame) ;
|
||||
// eventuali curve per spessore e collegamenti
|
||||
PtrOwner<ICurveBezier> pMyBez2 ;
|
||||
ICRVLINEPOVECTOR vMyLink ;
|
||||
Vector3d vtExtr ; double dThick ;
|
||||
if ( pBez->GetExtrusion( vtExtr) && ! vtExtr.IsSmallXY() &&
|
||||
pBez->GetThickness( dThick) && abs( dThick) > EPS_SMALL) {
|
||||
// curva sullo spessore
|
||||
pMyBez2.Set( pBez->Clone()) ;
|
||||
if ( IsNull( pMyBez2))
|
||||
return false ;
|
||||
pMyBez2->Translate( dThick * vtExtr) ;
|
||||
pMyBez2->ToGlob( frFrame) ;
|
||||
// collegamenti
|
||||
for ( double dU = 0 ; dU < 1 + EPS_PARAM ; dU += 0.25) {
|
||||
Point3d ptP ;
|
||||
pBez->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP) ;
|
||||
AddLink( ptP, vtExtr, dThick, frFrame, vMyLink) ;
|
||||
}
|
||||
}
|
||||
// verifico se la curva giace in un piano parallelo a XY globale
|
||||
Plane3d plPlane ;
|
||||
if ( ! pMyBez->IsFlat( plPlane, false, 10 * EPS_SMALL) ||
|
||||
@@ -432,6 +535,12 @@ ExportSvg::ExportBezier( const string& sName, const Color& colObj, const IGeoObj
|
||||
// la porto nel piano XY globale (se si riduce ad un punto la salto)
|
||||
if ( ! pMyBez->Scale( GLOB_FRM, 1, 1, 0))
|
||||
return true ;
|
||||
// trasformo anche l'eventuale copia
|
||||
if ( ! IsNull( pMyBez2))
|
||||
pMyBez2->Scale( GLOB_FRM, 1, 1, 0) ;
|
||||
// trasformo anche gli eventuali collegamenti
|
||||
for ( auto& pLink : vMyLink)
|
||||
pLink->Scale( GLOB_FRM, 1, 1, 0) ;
|
||||
}
|
||||
// assegno tipo
|
||||
string sOut = " <path" ;
|
||||
@@ -443,6 +552,16 @@ ExportSvg::ExportBezier( const string& sName, const Color& colObj, const IGeoObj
|
||||
sOut +=GetStartString( pMyBez) ;
|
||||
// curva di Bezier
|
||||
sOut += GetCurveString( pMyBez) ;
|
||||
// eventuale curva copia per spessore
|
||||
if ( ! IsNull( pMyBez2)) {
|
||||
sOut += GetStartString( pMyBez2) ;
|
||||
sOut += GetCurveString( pMyBez2) ;
|
||||
}
|
||||
// eventuali collegamenti per spessore
|
||||
for ( const auto& pLink : vMyLink) {
|
||||
sOut += GetStartString( pLink) ;
|
||||
sOut += GetCurveString( pLink) ;
|
||||
}
|
||||
// termino i dati geometrici
|
||||
sOut += "\"" ;
|
||||
// colore e spessore
|
||||
@@ -466,6 +585,42 @@ ExportSvg::ExportComposite( const string& sName, const Color& colObj, const IGeo
|
||||
if ( IsNull( pMyCompo))
|
||||
return false ;
|
||||
pMyCompo->ToGlob( frFrame) ;
|
||||
// eventuali curve per spessore e collegamenti
|
||||
PtrOwner<ICurveComposite> pMyCompo2 ;
|
||||
ICRVLINEPOVECTOR vMyLink ;
|
||||
Vector3d vtExtr ; double dThick ;
|
||||
if ( pCompo->GetExtrusion( vtExtr) && ! vtExtr.IsSmallXY() &&
|
||||
pCompo->GetThickness( dThick) && abs( dThick) > EPS_SMALL) {
|
||||
// curva sullo spessore
|
||||
pMyCompo2.Set( pCompo->Clone()) ;
|
||||
if ( IsNull( pMyCompo2))
|
||||
return false ;
|
||||
pMyCompo2->Translate( dThick * vtExtr) ;
|
||||
pMyCompo2->ToGlob( frFrame) ;
|
||||
// collegamenti
|
||||
const ICurve* pSmpCrv = pCompo->GetFirstCurve() ;
|
||||
while ( pSmpCrv != nullptr) {
|
||||
// tipo di curva
|
||||
int nType = pSmpCrv->GetType() ;
|
||||
// step sui collegamenti a seconda del tipo
|
||||
double dDelta = 1 ;
|
||||
if ( nType == CRV_ARC)
|
||||
dDelta = 0.5 ;
|
||||
else if ( nType == CRV_BEZIER)
|
||||
dDelta = 0.25 ;
|
||||
// calcolo i collegamenti
|
||||
for ( double dU = 0 ; dU < 1 - EPS_PARAM ; dU += dDelta) {
|
||||
Point3d ptP ;
|
||||
pSmpCrv->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP) ;
|
||||
AddLink( ptP, vtExtr, dThick, frFrame, vMyLink) ;
|
||||
}
|
||||
// passo alla curva successiva
|
||||
pSmpCrv = pCompo->GetNextCurve() ;
|
||||
}
|
||||
Point3d ptEnd ;
|
||||
pCompo->GetEndPoint( ptEnd) ;
|
||||
AddLink( ptEnd, vtExtr, dThick, frFrame, vMyLink) ;
|
||||
}
|
||||
// verifico se la curva giace in un piano parallelo a XY globale
|
||||
Plane3d plPlane ;
|
||||
if ( ! pMyCompo->IsFlat( plPlane, false, 10 * EPS_SMALL) ||
|
||||
@@ -473,6 +628,12 @@ ExportSvg::ExportComposite( const string& sName, const Color& colObj, const IGeo
|
||||
// la porto nel piano XY globale (se si riduce ad un punto la salto)
|
||||
if ( ! pMyCompo->Scale( GLOB_FRM, 1, 1, 0))
|
||||
return true ;
|
||||
// trasformo anche l'eventuale copia
|
||||
if ( ! IsNull( pMyCompo2))
|
||||
pMyCompo2->Scale( GLOB_FRM, 1, 1, 0) ;
|
||||
// trasformo anche gli eventuali collegamenti
|
||||
for ( auto& pLink : vMyLink)
|
||||
pLink->Scale( GLOB_FRM, 1, 1, 0) ;
|
||||
}
|
||||
// assegno tipo
|
||||
string sOut = " <path" ;
|
||||
@@ -484,6 +645,16 @@ ExportSvg::ExportComposite( const string& sName, const Color& colObj, const IGeo
|
||||
sOut += GetStartString( pMyCompo) ;
|
||||
// curva composita
|
||||
sOut += GetCurveString( pMyCompo) ;
|
||||
// eventuale curva copia per spessore
|
||||
if ( ! IsNull( pMyCompo2)) {
|
||||
sOut += GetStartString( pMyCompo2) ;
|
||||
sOut += GetCurveString( pMyCompo2) ;
|
||||
}
|
||||
// eventuali collegamenti per spessore
|
||||
for ( const auto& pLink : vMyLink) {
|
||||
sOut += GetStartString( pLink) ;
|
||||
sOut += GetCurveString( pLink) ;
|
||||
}
|
||||
// termino i dati geometrici
|
||||
sOut += "\"" ;
|
||||
// colore e spessore
|
||||
@@ -533,7 +704,7 @@ ExportSvg::ExportFlatRegion( const string& sName, const Color& colObj, const IGe
|
||||
if ( IsNull( pMyCompo))
|
||||
return false ;
|
||||
pMyCompo->AddCurve( Release( pLoop)) ;
|
||||
pLoop.Set( Release( pMyCompo)) ;
|
||||
pLoop.Set( pMyCompo) ;
|
||||
}
|
||||
pLoop->Scale( GLOB_FRM, 1, 1, 0) ;
|
||||
}
|
||||
@@ -601,7 +772,7 @@ ExportSvg::ExportTriMesh( const string& sName, const Color& colObj, const IGeoOb
|
||||
continue ;
|
||||
POLYLINEVECTOR vPL ;
|
||||
if ( ! pStm->GetFacetLoops( nF, vPL))
|
||||
return false ;
|
||||
continue ;
|
||||
// ciclo sui loop di una faccia
|
||||
for ( int nL = 0 ; nL < int( vPL.size()) ; ++ nL) {
|
||||
PtrOwner<ICurveComposite> pLoop( CreateCurveComposite()) ;
|
||||
|
||||
+2929
-2937
File diff suppressed because it is too large
Load Diff
+33
-35
@@ -35,15 +35,16 @@ class ExportThreeJS : public IExportThreeJS
|
||||
{
|
||||
public:
|
||||
virtual bool SetOptions( int nFilter) ;
|
||||
virtual bool Export( IGeomDB* pGDB, int nId, const std::string& sFile, IEGrScene* pScene, bool bUdm) ;
|
||||
virtual bool Export( IGeomDB* pGDB, int nId, IEGrScene* pScene, bool bUdm, const std::string& sFile) ;
|
||||
|
||||
public:
|
||||
ExportThreeJS( void) : m_nFilter( EEXFLT_DEFAULT) {}
|
||||
ExportThreeJS( void) : m_nFilter( EEXFLT_DEFAULT), m_bShowGrid( true), m_nGroupCount( -1), m_nCont( 0) {
|
||||
CalcGroupFilter() ;
|
||||
}
|
||||
|
||||
private:
|
||||
bool CreateFolderSpace( const std::string& SFileName, const std::string& sUserPath, const std::string& sLibPath) ;
|
||||
bool HeadAmbient( IEGrScene* pScene, IGeomDB* pGDB, int nId) ;
|
||||
bool FinishAmbient() ;
|
||||
bool FinishAmbient( void) ;
|
||||
bool CompressAll( const std::string& sFile) ;
|
||||
bool ExportVector3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
|
||||
bool ExportPoint3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
|
||||
@@ -57,38 +58,35 @@ class ExportThreeJS : public IExportThreeJS
|
||||
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 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:
|
||||
int m_nFilter ; // filtro su livello, modo e stato
|
||||
Writer m_Writer ; // scrittore di file di testo oggetto
|
||||
std::string m_sUdm ; // udm della scena
|
||||
Point3d m_ptMin ; // punto minimo del box3d
|
||||
double m_dimX ; // dimX Box3d Global
|
||||
double m_dimY ; // dimY Box3d Global
|
||||
double m_dimZ ; // dimZ Box3d Global
|
||||
double m_dDistance ; // scala per pan e zoom
|
||||
int m_nCont = 0 ; // contatore per linee interne ai testi
|
||||
Point3d m_ptCamera ; // Camera look at
|
||||
Point3d m_ptCenter ; // Camera center
|
||||
double m_dHalfWidth ; // Lunghezza/2 piano di proiezione (culling)
|
||||
double m_dHalfHeight ; // Altezza/2 piano di proiezione (culling)
|
||||
double m_ZNear ; // Distanza (lungo Z) piano di proiezione da origine (culling)
|
||||
double m_ZFar ; // Distanza (lungo Z) piano di culling da origine (culling)
|
||||
double m_dCameraPhi ; // [0,180] angolo phi in coordinate polari della telecamera
|
||||
double m_dCameraTheta ; // [0, 360) angolo Theta in coordinate polari della telecamera
|
||||
int m_ANG_TOL_STD_DEG = 15 ; // Interpolazione testo
|
||||
Frame3d m_frTHREEJSFrame ; // frame di ThreeJS
|
||||
std::list< sSurfDist> m_lTranspSurf ; // Lista di superfici trasparenti
|
||||
int m_nGroupCount = -1 ; // Contatore del gruppo
|
||||
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
|
||||
double m_dimX ; // DimX Box3d Global
|
||||
double m_dimY ; // DimY Box3d Global
|
||||
double m_dimZ ; // DimZ Box3d Global
|
||||
double m_dDistance ; // Scala per pan e zoom
|
||||
Point3d m_ptCamera ; // Camera position
|
||||
Point3d m_ptCenter ; // Camera look at
|
||||
double m_dHalfWidth ; // Semilunghezza piano di proiezione (culling)
|
||||
double m_dHalfHeight ; // Semialtezza piano di proiezione (culling)
|
||||
double m_dZNear ; // Distanza (lungo Z) piano di proiezione da origine (culling)
|
||||
double m_dZFar ; // Distanza (lungo Z) piano di culling da origine (culling)
|
||||
double m_dCameraPhi ; // Angolo phi in coordinate polari della telecamera [0,180]
|
||||
double m_dCameraTheta ; // Angolo Theta in coordinate polari della telecamera [0, 360)
|
||||
Frame3d m_frTHREEJSFrame ; // Frame di ThreeJS
|
||||
bool m_bShowGrid ; // Flag di esportazione griglia di scena
|
||||
bool m_bUdm_mm ; // Flag unità di misura in mm
|
||||
std::string m_sUdm ; // Stringa per unità di misura della scena
|
||||
int m_nGroupCount ; // Contatore del gruppo
|
||||
int m_nCont ; // contatore per linee interne ai testi
|
||||
std::vector< sSurfDist> m_vTranspSurf ; // Vettore di superfici trasparenti
|
||||
std::string m_sCodMenu ; // Stringa per la creazione del menu laterale della scena
|
||||
Writer m_Writer ; // Scrittore di file di testo oggetto
|
||||
|
||||
// Parametri...
|
||||
bool m_bShowGrid = true ; // se esportare o meno la griglia dalla scena
|
||||
bool m_bUdm_mm ; // se l'unità di misura è in mm
|
||||
std::string m_sPath ; // Path aggiuntivo dove salvare il file (il vero path è nel LUA)
|
||||
|
||||
public:
|
||||
static std::string m_sThreeJSAuxDir ; // direttorio librerie
|
||||
|
||||
};
|
||||
public :
|
||||
static std::string m_sThreeJSLibDir ; // Direttorio librerie
|
||||
} ;
|
||||
|
||||
+105
-215
@@ -17,10 +17,8 @@
|
||||
#include "stdafx.h"
|
||||
#include "Import3MF.h"
|
||||
#include "DllMain.h"
|
||||
#include "pugixml.hpp"
|
||||
#include "/EgtDev/Include/EExDllMain.h"
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
#include "/EgtDev/Extern/libzip/Include/zip.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
|
||||
using namespace std ;
|
||||
using namespace Lib3MF ;
|
||||
@@ -29,16 +27,16 @@ using namespace Lib3MF ;
|
||||
IImport3MF*
|
||||
CreateImport3MF( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
// creo l'oggetto
|
||||
return static_cast<IImport3MF*> ( new( nothrow) Import3MF) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Import3MF::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup)
|
||||
Import3MF::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup, int nFlag)
|
||||
{
|
||||
LOG_INFO( GetEExLogger(), ( "Import3MF : " + sFile).c_str()) ;
|
||||
|
||||
@@ -55,7 +53,10 @@ Import3MF::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup)
|
||||
return false ;
|
||||
}
|
||||
m_nIdGroup = nIdGroup ;
|
||||
|
||||
|
||||
// imposto le opzioni di importazione
|
||||
m_nFlag = nFlag ;
|
||||
|
||||
try {
|
||||
if ( ! DoImport( sFile))
|
||||
return false ;
|
||||
@@ -73,15 +74,15 @@ bool
|
||||
Import3MF::DoImport( const string& sFile)
|
||||
{
|
||||
// libreria 3MF
|
||||
PWrapper m_wrapper = CWrapper::loadLibrary() ;
|
||||
if ( ! m_wrapper) {
|
||||
m_wrapper = CWrapper::loadLibrary() ;
|
||||
if ( m_wrapper == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Import3MF : Error on lib3mf Wrapper") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// creazione del 3MF model
|
||||
m_model = m_wrapper->CreateModel() ;
|
||||
if ( ! m_model) {
|
||||
if ( m_model == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Import3MF : Error on lib3mf Model") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -89,33 +90,34 @@ Import3MF::DoImport( const string& sFile)
|
||||
// lettura file
|
||||
PReader reader = m_model->QueryReader( "3mf") ;
|
||||
reader->ReadFromFile( sFile) ;
|
||||
for ( Lib3MF_uint32 iWarning = 0 ; iWarning < reader->GetWarningCount() ; iWarning ++) {
|
||||
for ( Lib3MF_uint32 nWarning = 0 ; nWarning < reader->GetWarningCount() ; nWarning ++) {
|
||||
Lib3MF_uint32 nErrorCode ;
|
||||
string sWarningMsg = reader->GetWarning( iWarning, nErrorCode) ;
|
||||
string sErrorMsg = " Reading 3MF file encountered warning # " + to_string( nErrorCode) + " : " + sWarningMsg ;
|
||||
string sWarningMsg = reader->GetWarning( nWarning, nErrorCode) ;
|
||||
string sErrorMsg = " Reading 3MF file encountered warning # " + to_string( nErrorCode) + " : " + sWarningMsg ;
|
||||
LOG_ERROR( GetEExLogger(), sErrorMsg.c_str()) ;
|
||||
}
|
||||
|
||||
switch ( m_model->GetUnit()) {
|
||||
case eModelUnit::MicroMeter :
|
||||
m_nScaleFactor = 0.001 ;
|
||||
m_dScaleFactor = 0.001 ;
|
||||
break ;
|
||||
case eModelUnit::MilliMeter :
|
||||
m_nScaleFactor = 1.0 ;
|
||||
m_dScaleFactor = 1.0 ;
|
||||
break ;
|
||||
case eModelUnit::CentiMeter :
|
||||
m_nScaleFactor = 10.0 ;
|
||||
m_dScaleFactor = 10.0 ;
|
||||
break ;
|
||||
case eModelUnit::Inch :
|
||||
m_nScaleFactor = 25.4 ;
|
||||
m_dScaleFactor = 25.4 ;
|
||||
break ;
|
||||
case eModelUnit::Foot :
|
||||
m_nScaleFactor = 304.8 ;
|
||||
m_dScaleFactor = 304.8 ;
|
||||
break ;
|
||||
case eModelUnit::Meter :
|
||||
m_nScaleFactor = 1000.0 ;
|
||||
m_dScaleFactor = 1000.0 ;
|
||||
break ;
|
||||
default:
|
||||
m_nScaleFactor = 1.0 ;
|
||||
m_dScaleFactor = 1.0 ;
|
||||
}
|
||||
|
||||
// analisi metadata
|
||||
@@ -123,83 +125,54 @@ Import3MF::DoImport( const string& sFile)
|
||||
Lib3MF_uint32 nMetaDataCount = metaDataGrp->GetMetaDataCount() ;
|
||||
for ( Lib3MF_uint32 i = 0 ; i < nMetaDataCount ; i ++) {
|
||||
PMetaData metaData = metaDataGrp->GetMetaData( i) ;
|
||||
string sMetaDataValue = metaData->GetValue() ;
|
||||
string sMetaDataName = metaData->GetName() ;
|
||||
if ( ! sMetaDataValue.empty() && ! sMetaDataName.empty())
|
||||
m_pGDB->SetInfo( m_nIdGroup, sMetaDataName, sMetaDataValue) ;
|
||||
string sName = metaData->GetName() ;
|
||||
string sValue = metaData->GetValue() ;
|
||||
if ( ! sName.empty() && ! sValue.empty())
|
||||
m_pGDB->SetInfo( m_nIdGroup, sName, sValue) ;
|
||||
}
|
||||
|
||||
// scorro gli items nel build node
|
||||
PBuildItemIterator pBuildItemsIter = m_model->GetBuildItems() ;
|
||||
while ( pBuildItemsIter->MoveNext()) {
|
||||
if ( ! ReadItem( pBuildItemsIter->GetCurrent()))
|
||||
return false ;
|
||||
PBuildItem pItem = pBuildItemsIter->GetCurrent() ;
|
||||
// ignoro i suoi attributes e i suoi metadata
|
||||
// recupero la sua trasformazione
|
||||
sTransform sTransf = pItem->GetObjectTransform() ;
|
||||
// lettura oggetto associato
|
||||
if ( ! ReadObject( pItem->GetObjectResource(), sTransf, m_nIdGroup))
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool
|
||||
Import3MF::ReadItem( const PBuildItem pItem)
|
||||
{
|
||||
if ( ! pItem)
|
||||
return false ;
|
||||
|
||||
// trasformazione
|
||||
sTransform sTransf = pItem->GetObjectTransform() ;
|
||||
|
||||
// attributes
|
||||
ATTRVECTOR vAttr ;
|
||||
string sProp = pItem->GetPartNumber() ;
|
||||
if ( ! sProp.empty())
|
||||
vAttr.push_back( make_pair( "Item partnumber", pItem->GetPartNumber())) ;
|
||||
bool bUUID ;
|
||||
sProp = pItem->GetUUID( bUUID) ;
|
||||
if ( bUUID)
|
||||
vAttr.push_back( make_pair( "Item UUID", sProp)) ;
|
||||
|
||||
// metadata
|
||||
PMetaDataGroup pMetaDataGrp = pItem->GetMetaDataGroup() ;
|
||||
if ( pMetaDataGrp)
|
||||
ReadMetaDataGroup( pMetaDataGrp, vAttr, Item) ;
|
||||
|
||||
// lettura oggetto associato
|
||||
return ReadObject( pItem->GetObjectResource(), vAttr, sTransf) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
bool
|
||||
Import3MF::ReadObject( const PObject pObj, ATTRVECTOR& vAttr, sTransform& sTransf)
|
||||
Import3MF::ReadObject( const PObject pObj, const sTransform& Transform, int nParentId)
|
||||
{
|
||||
if ( ! pObj)
|
||||
if ( pObj == nullptr)
|
||||
return false ;
|
||||
|
||||
bool bMeshObj = pObj->IsMeshObject() ;
|
||||
|
||||
// attributes
|
||||
string sProp = pObj->GetName() ;
|
||||
INFOVECTOR vInfo ;
|
||||
string sName = pObj->GetName() ;
|
||||
string sProp = pObj->GetPartNumber() ;
|
||||
if ( ! sProp.empty())
|
||||
vAttr.push_back( make_pair( "name", sProp)) ;
|
||||
sProp = pObj->GetPartNumber() ;
|
||||
if ( ! sProp.empty())
|
||||
vAttr.push_back( make_pair( "partnumber", sProp)) ;
|
||||
vInfo.emplace_back( "PartNumber", sProp) ;
|
||||
bool bUUID = false ;
|
||||
sProp = pObj->GetUUID( bUUID) ;
|
||||
if ( bUUID) {
|
||||
string sPropName = bMeshObj ? "UUID" : "object UUID" ;
|
||||
vAttr.push_back( make_pair( sPropName, sProp)) ;
|
||||
}
|
||||
if ( bUUID)
|
||||
vInfo.emplace_back( "UUID", sProp) ;
|
||||
|
||||
switch ( pObj->GetType()) {
|
||||
case eObjectType::Model :
|
||||
vAttr.push_back( make_pair( "type", "Model")) ;
|
||||
vInfo.emplace_back( "Type", "Model") ;
|
||||
break ;
|
||||
case eObjectType::Support :
|
||||
vAttr.push_back( make_pair( "type", "Support")) ;
|
||||
vInfo.emplace_back( "Type", "Support") ;
|
||||
break ;
|
||||
case eObjectType::SolidSupport :
|
||||
vAttr.push_back( make_pair( "type", "SolidSupport")) ;
|
||||
vInfo.emplace_back( "Type", "SolidSupport") ;
|
||||
break ;
|
||||
default :
|
||||
break ;
|
||||
@@ -207,29 +180,34 @@ Import3MF::ReadObject( const PObject pObj, ATTRVECTOR& vAttr, sTransform& sTrans
|
||||
|
||||
// metadata
|
||||
PMetaDataGroup pMetaDataGrp = pObj->GetMetaDataGroup() ;
|
||||
if ( pMetaDataGrp)
|
||||
ReadMetaDataGroup( pMetaDataGrp, vAttr, bMeshObj ? Mesh : Component) ;
|
||||
for ( Lib3MF_uint32 i = 0 ; i < pMetaDataGrp->GetMetaDataCount() ; i ++) {
|
||||
PMetaData metaData = pMetaDataGrp->GetMetaData( i) ;
|
||||
string sMetaDataName = metaData->GetName() ;
|
||||
string sMetaDataValue = metaData->GetValue() ;
|
||||
if ( ! sMetaDataName.empty() && ! sMetaDataValue.empty())
|
||||
vInfo.emplace_back( sMetaDataName, sMetaDataValue) ;
|
||||
}
|
||||
|
||||
if ( pObj->IsMeshObject())
|
||||
return ReadMesh( pObj->GetResourceID(), vAttr, sTransf) ;
|
||||
return ReadMesh( pObj->GetResourceID(), sName, vInfo, Transform, nParentId) ;
|
||||
else if ( pObj->IsComponentsObject())
|
||||
return ReadComponents( pObj->GetResourceID(), vAttr, sTransf) ;
|
||||
return ReadComponent( pObj->GetResourceID(), sName, vInfo, Transform, nParentId) ;
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
bool
|
||||
Import3MF::ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, sTransform& sTransf)
|
||||
Import3MF::ReadMesh( Lib3MF_uint32 nId, const string& sName, const INFOVECTOR& vInfo, const sTransform& Transform, int nParentId)
|
||||
{
|
||||
// Recupero puntatore alla mesh 3MF
|
||||
PMeshObject pMesh = m_model->GetMeshObjectByID( nId) ;
|
||||
if ( pMesh.get() == nullptr)
|
||||
if ( pMesh == nullptr)
|
||||
return false ;
|
||||
|
||||
// Creo e inizializzo trimesh
|
||||
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pStm) || ! pStm->Init( 3, 1)) {
|
||||
if ( IsNull( pStm) || ! pStm->Init( pMesh->GetVertexCount(), pMesh->GetTriangleCount())) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : ISurfTriMesh Create error") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -242,15 +220,15 @@ Import3MF::ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, sTransform& sT
|
||||
// applico la trasformazione
|
||||
double x = 0.0, y = 0.0, z = 0.0 ;
|
||||
for ( int k = 0 ; k < 3 ; k ++) {
|
||||
x += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][0] ;
|
||||
y += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][1] ;
|
||||
z += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][2] ;
|
||||
x += pVertex.m_Coordinates[k] * Transform.m_Fields[k][0] ;
|
||||
y += pVertex.m_Coordinates[k] * Transform.m_Fields[k][1] ;
|
||||
z += pVertex.m_Coordinates[k] * Transform.m_Fields[k][2] ;
|
||||
}
|
||||
x += sTransf.m_Fields[3][0] ;
|
||||
y += sTransf.m_Fields[3][1] ;
|
||||
z += sTransf.m_Fields[3][2] ;
|
||||
x += Transform.m_Fields[3][0] ;
|
||||
y += Transform.m_Fields[3][1] ;
|
||||
z += Transform.m_Fields[3][2] ;
|
||||
// inserisco il vertice nella trimesh
|
||||
if ( pStm->AddVertex( Point3d( x, y, z)) == SVT_NULL) {
|
||||
if ( pStm->AddVertex( Point3d( x, y, z) * m_dScaleFactor) == SVT_NULL) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : ISurfTriMesh AddVertex error") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -277,7 +255,7 @@ Import3MF::ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, sTransform& sT
|
||||
}
|
||||
|
||||
// Inserimento nel DB geometrico
|
||||
int nGeoId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, Release( pStm)) ;
|
||||
int nGeoId = m_pGDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) ;
|
||||
if ( nGeoId == GDB_ID_NULL) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : error adding GeoObject") ;
|
||||
return false ;
|
||||
@@ -292,125 +270,65 @@ Import3MF::ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, sTransform& sT
|
||||
}
|
||||
|
||||
// attributes
|
||||
for ( size_t i = 0 ; i < vAttr.size() ; i++) {
|
||||
if ( vAttr[i].first == "name")
|
||||
m_pGDB->SetName( nGeoId, vAttr[i].second) ;
|
||||
else
|
||||
m_pGDB->SetInfo( nGeoId, vAttr[i].first, vAttr[i].second) ;
|
||||
}
|
||||
if ( ! sName.empty())
|
||||
m_pGDB->SetName( nGeoId, sName) ;
|
||||
for ( int i = 0 ; i < int( vInfo.size()) ; i++)
|
||||
m_pGDB->SetInfo( nGeoId, vInfo[i].first, vInfo[i].second) ;
|
||||
|
||||
return true ;
|
||||
|
||||
#if 0
|
||||
PMeshObject pMesh = m_model->GetMeshObjectByID( nId) ;
|
||||
|
||||
StmFromTriangleSoup Stm ;
|
||||
if ( ! Stm.Start()) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : StmFromTriangleSoup error") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// vertici
|
||||
vector<Point3d> vVertices( pMesh->GetVertexCount()) ;
|
||||
for ( Lib3MF_uint32 i = 0 ; i < pMesh->GetVertexCount() ; i ++) {
|
||||
sPosition pVertex = pMesh->GetVertex( i) ;
|
||||
// applico la trasformazione
|
||||
double x = 0.0, y = 0.0, z = 0.0 ;
|
||||
for ( Lib3MF_uint32 k = 0 ; k < 3 ; k ++) {
|
||||
x += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][0] ;
|
||||
y += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][1] ;
|
||||
z += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][2] ;
|
||||
}
|
||||
x += sTransf.m_Fields[3][0] ;
|
||||
y += sTransf.m_Fields[3][1] ;
|
||||
z += sTransf.m_Fields[3][2] ;
|
||||
|
||||
Point3d pt( x, y, z) ;
|
||||
vVertices[i] = pt * m_nScaleFactor ;
|
||||
}
|
||||
|
||||
// triangoli
|
||||
for ( Lib3MF_uint32 i = 0 ; i < pMesh->GetTriangleCount() ; i ++) {
|
||||
sTriangle tTrg = pMesh->GetTriangle( i) ;
|
||||
if ( ! Stm.AddTriangle( vVertices[tTrg.m_Indices[0]], vVertices[tTrg.m_Indices[1]], vVertices[tTrg.m_Indices[2]])) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : StmFromTriangleSoup AddTriangle error") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! Stm.End()) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : StmFromTriangleSoup error") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
ISurfTriMesh* pSurf = Stm.GetSurf() ;
|
||||
if ( pSurf == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : StmFromTriangleSoup GetSurf error") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
int nGeoId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, pSurf) ;
|
||||
if ( nGeoId == GDB_ID_NULL) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : error adding GeoObject") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// colore
|
||||
Lib3MF_uint32 pid, pindex ;
|
||||
if ( pMesh->GetObjectLevelProperty( pid, pindex)) {
|
||||
Color cCol ;
|
||||
if ( FindColor( pid, pindex, cCol))
|
||||
m_pGDB->SetMaterial( nGeoId, cCol) ;
|
||||
}
|
||||
|
||||
// attributes
|
||||
for ( size_t i = 0 ; i < vAttr.size() ; i++) {
|
||||
if ( vAttr[i].first == "name")
|
||||
m_pGDB->SetName( nGeoId, vAttr[i].second) ;
|
||||
else
|
||||
m_pGDB->SetInfo( nGeoId, vAttr[i].first, vAttr[i].second) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
bool
|
||||
Import3MF::ReadComponents( const Lib3MF_uint32& nId, ATTRVECTOR& attributes, sTransform& sTransfItem)
|
||||
Import3MF::ReadComponent( Lib3MF_uint32 nId, const string& sName, const INFOVECTOR& vInfo, const sTransform& Transform, int nParentId)
|
||||
{
|
||||
PComponentsObject pComponents = m_model->GetComponentsObjectByID( nId) ;
|
||||
// se va conservata la gerarchia ogni componente corrisponde ad un layer, altrimenti gli elementi della componente vengono
|
||||
// inseriti direttamente in m_nIdGroup e i suoi attributes vengono ignorati
|
||||
|
||||
// Scorro tutte le componenti
|
||||
for ( Lib3MF_uint32 iC = 0 ; iC < pComponents->GetComponentCount() ; iC ++ ) {
|
||||
PComponentsObject pComponents = m_model->GetComponentsObjectByID( nId) ;
|
||||
if ( pComponents == nullptr)
|
||||
return false ;
|
||||
|
||||
int nLayerId = nParentId ;
|
||||
// se importo gerarchia creo il layer corrispondente alla componente
|
||||
if ( ( m_nFlag & EI3FLAG_KEEP_GROUPS) != 0) {
|
||||
nLayerId = m_pGDB->AddGroup( GDB_ID_NULL, nParentId, GLOB_FRM) ;
|
||||
// assegno nome e info
|
||||
if ( ! sName.empty())
|
||||
m_pGDB->SetName( nLayerId, sName) ;
|
||||
for ( int i = 0 ; i < int( vInfo.size()) ; i++)
|
||||
m_pGDB->SetInfo( nLayerId, vInfo[i].first, vInfo[i].second) ;
|
||||
}
|
||||
|
||||
// scorro tutti i suoi oggetti
|
||||
for ( Lib3MF_uint32 nC = 0 ; nC < pComponents->GetComponentCount() ; nC++) {
|
||||
|
||||
PComponent pComponent = pComponents->GetComponent( iC) ;
|
||||
|
||||
sTransform sTransfComp = pComponent->GetTransform() ;
|
||||
// combino le trasformazioni
|
||||
sTransform sTransfRes ;
|
||||
// inizializzo sTransfRes a zero
|
||||
PComponent pComponent = pComponents->GetComponent( nC) ;
|
||||
|
||||
// combino le trasformazioni
|
||||
sTransform TransfComp = pComponent->GetTransform() ;
|
||||
sTransform TransfRes ;
|
||||
// inizializzo TransfRes a zero
|
||||
for ( Lib3MF_uint32 i = 0 ; i < 4 ; i++)
|
||||
fill( sTransfRes.m_Fields[i], sTransfRes.m_Fields[i] + 3, ( Lib3MF_single)0.0) ;
|
||||
fill( TransfRes.m_Fields[i], TransfRes.m_Fields[i] + 3, ( Lib3MF_single) 0.0) ;
|
||||
|
||||
for ( Lib3MF_uint32 i = 0 ; i < 4 ; i ++)
|
||||
for ( Lib3MF_uint32 j = 0 ; j < 3 ; j++)
|
||||
for ( Lib3MF_uint32 k = 0 ; k < 3 ; k ++)
|
||||
sTransfRes.m_Fields[i][j] += sTransfComp.m_Fields[i][k] * sTransfItem.m_Fields[k][j] ; // prodotto fra matrici
|
||||
TransfRes.m_Fields[i][j] += TransfComp.m_Fields[i][k] * Transform.m_Fields[k][j] ; // prodotto fra matrici
|
||||
|
||||
for ( Lib3MF_uint32 j = 0 ; j < 3 ; j ++)
|
||||
sTransfRes.m_Fields[3][j] += sTransfItem.m_Fields[3][j] ;
|
||||
TransfRes.m_Fields[3][j] += Transform.m_Fields[3][j] ;
|
||||
|
||||
if ( ! ReadObject( pComponent->GetObjectResource(), attributes, sTransfRes))
|
||||
if ( ! ReadObject( pComponent->GetObjectResource(), TransfRes, nLayerId))
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
bool
|
||||
Import3MF::FindColor( const Lib3MF_uint32& pid, const Lib3MF_uint32& pindex, Color& cCol)
|
||||
Import3MF::FindColor( Lib3MF_uint32 pid, Lib3MF_uint32 pindex, Color& cCol) const
|
||||
{
|
||||
sColor sCol ;
|
||||
|
||||
@@ -433,12 +351,12 @@ Import3MF::FindColor( const Lib3MF_uint32& pid, const Lib3MF_uint32& pindex, Col
|
||||
// multiproperty corrispondente a pindex
|
||||
UINTVECTOR pindices ;
|
||||
pMultiPropGrp->GetMultiProperty( pindex, pindices) ;
|
||||
// analizzo i layers alla ricerca di una proprietà che definisca un colore
|
||||
// analizzo i layers alla ricerca di una proprietà che definisca un colore
|
||||
Lib3MF_uint32 nLayers = pMultiPropGrp->GetLayerCount() ;
|
||||
for ( Lib3MF_uint32 i = 0 ; i < nLayers ; i ++) {
|
||||
sMultiPropertyLayer layer = pMultiPropGrp->GetLayer( i) ;
|
||||
Lib3MF_uint32 pidLayer = layer.m_ResourceID ;
|
||||
// appena trovo una propietà che definisce un colore mi fermo
|
||||
// appena trovo una propietà che definisce un colore mi fermo
|
||||
if ( m_model->GetPropertyTypeByID( pidLayer) == ePropertyType::BaseMaterial ||
|
||||
m_model->GetPropertyTypeByID( pidLayer) == ePropertyType::Colors)
|
||||
return FindColor( pidLayer, pindices[i], cCol) ;
|
||||
@@ -455,19 +373,19 @@ Import3MF::FindColor( const Lib3MF_uint32& pid, const Lib3MF_uint32& pindex, Col
|
||||
|
||||
// check sui valori in vComposite
|
||||
double dMixSum = 0.0 ;
|
||||
for( size_t i = 0 ; i < vComposite.size(); i ++)
|
||||
for( int i = 0 ; i < int( vComposite.size()) ; i ++)
|
||||
dMixSum += vComposite[i].m_MixingRatio ;
|
||||
// se fossero tutti zero, considero proporzioni uguali per ogni colore
|
||||
if ( abs( dMixSum) < EPS_SMALL) {
|
||||
dMixSum = vComposite.size() ;
|
||||
for ( size_t i = 0 ; i < vComposite.size() ; i++)
|
||||
for ( int i = 0 ; i < int( vComposite.size()) ; i++)
|
||||
vComposite[i].m_MixingRatio = 1 ;
|
||||
}
|
||||
|
||||
double dRed = 0.0, dGreen = 0.0, dBlue = 0.0, dAlpha = 0.0 ; // colore finale
|
||||
Lib3MF_uint8 nRedTmp, nGreenTmp, nBlueTmp, nAlphaTmp ; // colore del BaseMaterial
|
||||
// per ogni elemento di composite aggiungo il suo colore con l'opportuno coefficiente
|
||||
for ( size_t i = 0 ; i < vComposite.size() ; i++) {
|
||||
for ( int i = 0 ; i < int( vComposite.size()) ; i++) {
|
||||
sCol = pBaseMatGrp->GetDisplayColor( vComposite[i].m_PropertyID) ;
|
||||
m_wrapper->ColorToRGBA( sCol, nRedTmp, nGreenTmp, nBlueTmp, nAlphaTmp) ;
|
||||
double dMixingRatio = vComposite[i].m_MixingRatio / dMixSum ;
|
||||
@@ -492,31 +410,3 @@ Import3MF::FindColor( const Lib3MF_uint32& pid, const Lib3MF_uint32& pindex, Col
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool
|
||||
Import3MF::ReadMetaDataGroup( const PMetaDataGroup pMetaDataGrp, ATTRVECTOR& vAttr, const MDGCaller& caller)
|
||||
{
|
||||
for ( Lib3MF_uint32 i = 0 ; i < pMetaDataGrp->GetMetaDataCount() ; i ++) {
|
||||
|
||||
PMetaData metaData = pMetaDataGrp->GetMetaData( i) ;
|
||||
string sMetaDataValue = metaData->GetValue() ;
|
||||
if ( sMetaDataValue.empty())
|
||||
continue ;
|
||||
string sMetaDataName ;
|
||||
switch ( caller) {
|
||||
case Item :
|
||||
sMetaDataName = "Item " ;
|
||||
break ;
|
||||
case Component :
|
||||
sMetaDataName = "Object " ;
|
||||
break ;
|
||||
case Mesh :
|
||||
sMetaDataName = "" ;
|
||||
}
|
||||
sMetaDataName += metaData->GetName() ;
|
||||
vAttr.push_back( make_pair( sMetaDataName, sMetaDataValue)) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
+16
-19
@@ -13,39 +13,36 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
#include "/EgtDev/Include/EExImport3MF.h"
|
||||
#include "pugixml.hpp"
|
||||
#include "/EgtDev/Extern/libzip/Include/zip.h"
|
||||
#define NOMINMAX
|
||||
#include "/EgtDev/Extern/Lib3MF/Include/lib3mf_implicit.hpp"
|
||||
|
||||
#include "/EgtDev/Include/EExImport3MF.h"
|
||||
#include "/EgtDev/Extern/lib3MF/Include/lib3mf_implicit.hpp"
|
||||
#include <unordered_map>
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Import3MF : public IImport3MF
|
||||
{
|
||||
private :
|
||||
typedef std::vector<std::pair<std::string, std::string>> ATTRVECTOR ;
|
||||
enum MDGCaller { Item = 0, Component = 1, Mesh = 2 } ;
|
||||
typedef std::vector<std::pair<std::string, std::string>> INFOVECTOR ;
|
||||
|
||||
public :
|
||||
virtual bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup) ;
|
||||
virtual bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup, int nFlag = 0) ;
|
||||
|
||||
private :
|
||||
bool DoImport( const std::string& sFile) ;
|
||||
bool ReadItem( const Lib3MF::PBuildItem item) ;
|
||||
bool ReadObject( const Lib3MF::PObject pObj, ATTRVECTOR& vAttr, Lib3MF::sTransform& sTransf) ;
|
||||
bool ReadComponents( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, Lib3MF::sTransform& sTransfItem) ;
|
||||
bool ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, Lib3MF::sTransform& sTransfr) ;
|
||||
bool ReadMetaDataGroup( const Lib3MF::PMetaDataGroup pMetaDataGrp, ATTRVECTOR& vAttr, const MDGCaller& caller) ;
|
||||
bool FindColor( const Lib3MF_uint32& pid, const Lib3MF_uint32& pindex, Color& cCol) ;
|
||||
bool ReadObject( const Lib3MF::PObject pObj, const Lib3MF::sTransform& Transform, int nParentId) ;
|
||||
bool ReadComponent( Lib3MF_uint32 nId, const std::string& sName, const INFOVECTOR& vInfo, const Lib3MF::sTransform& Transform,
|
||||
int nParentId) ;
|
||||
bool ReadMesh( Lib3MF_uint32 nId, const std::string& sName, const INFOVECTOR& vInfo, const Lib3MF::sTransform& Transfrorm,
|
||||
int nParentId) ;
|
||||
bool FindColor( Lib3MF_uint32 pid, Lib3MF_uint32 pindex, Color& cCol) const ;
|
||||
|
||||
private :
|
||||
double m_nScaleFactor ;
|
||||
private :
|
||||
double m_dScaleFactor ;
|
||||
IGeomDB* m_pGDB ;
|
||||
int m_nIdGroup ;
|
||||
int m_nFlag ;
|
||||
Lib3MF::PWrapper m_wrapper ;
|
||||
Lib3MF::PModel m_model ;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
+66
-14
@@ -20,9 +20,8 @@
|
||||
#include "/EgtDev/Include/EGkStmStandard.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtStringEncoder.h"
|
||||
#include "/EgtDev/Include/EgtStringEncoder.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -34,12 +33,21 @@ SetBtlAuxDir( const string& sBtlAuxDir)
|
||||
return ExistsDirectory( sBtlAuxDir) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SetBtlLuaData( const string& sLuaLibsDir, const string& sLuaLastRequire)
|
||||
{
|
||||
BtlGeom::m_sBtlLuaLibsDir = sLuaLibsDir ;
|
||||
BtlGeom::m_sBtlLuaLastRequire = sLuaLastRequire ;
|
||||
return ExistsDirectory( sLuaLibsDir) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IImportBtl*
|
||||
CreateImportBtl( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPADV, GetEExLogger()))
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPADV))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImportBtl*> ( new(nothrow) ImportBtl) ;
|
||||
@@ -49,6 +57,7 @@ CreateImportBtl( void)
|
||||
ImportBtl::ImportBtl( void)
|
||||
{
|
||||
m_nBuild = 10000 ;
|
||||
m_nEdition = 0 ;
|
||||
m_dScale = 1 ;
|
||||
}
|
||||
|
||||
@@ -78,7 +87,8 @@ ImportBtl::Import( const string& sFile, IGeomDB* pGDB, int nFlag)
|
||||
bool bSpecialTrim = (( nFlag & EIBFLAG_SPECIAL_TRIM) != 0) ;
|
||||
bool bTrimWithOutline = (( nFlag & EIBFLAG_TRIM_WITH_OUTLINE) != 0) ;
|
||||
bool bUseUAttr = (( nFlag & EIBFLAG_USEUATTR) != 0) ;
|
||||
if ( ! m_BtlGeom.Init( pGDB, nFlatVertPos, bSpecialTrim, bTrimWithOutline, bUseUAttr)) {
|
||||
bool bPartOffset = (( nFlag & EIBFLAG_PARTOFFSET) != 0) ;
|
||||
if ( ! m_BtlGeom.Init( pGDB, nFlatVertPos, bSpecialTrim, bTrimWithOutline, bUseUAttr, bPartOffset, true)) {
|
||||
LOG_ERROR( GetEExLogger(), " Error on BtlGeom.Init")
|
||||
return false ;
|
||||
}
|
||||
@@ -156,6 +166,9 @@ ImportBtl::Import( const string& sFile, IGeomDB* pGDB, int nFlag)
|
||||
m_BtlGeom.AdjustRefForRawParts() ;
|
||||
m_BtlGeom.AdjustRefForComposites() ;
|
||||
|
||||
// verifica definizione e unicità SN ed eventuale sistemazione
|
||||
m_BtlGeom.AdjustSnForParts() ;
|
||||
|
||||
// eventuale ordinamento degli oggetti secondo SN
|
||||
bool bSort = (( nFlag & EIBFLAG_SORT) != 0) ;
|
||||
if ( bSort) {
|
||||
@@ -296,7 +309,7 @@ ImportBtl::ReadGeneral( bool& bEnd)
|
||||
Trim( sVal, " \t\r\n\"") ;
|
||||
int nUnit ;
|
||||
if ( FromString( sVal, nUnit)) {
|
||||
m_dScale = pow( 10, - nUnit) ;
|
||||
m_dScale = Pow( 10, -nUnit) ;
|
||||
++ nRead ;
|
||||
}
|
||||
m_BtlGeom.SetUserAttribute( UATD_INFO, sKey, sVal) ;
|
||||
@@ -524,8 +537,14 @@ ImportBtl::ReadObject( ObjType nType, bool& bEnd)
|
||||
m_BtlGeom.SetUserAttribute( UATD_PART, sKey, sVal) ;
|
||||
break ;
|
||||
case KEY_PART_PARTOFFSET : // offset pezzo
|
||||
Trim( sVal, " \t\r\n\"") ;
|
||||
m_BtlGeom.SetUserAttribute( UATD_PART, sKey, sVal) ;
|
||||
{
|
||||
DBLVECTOR vdPar ;
|
||||
if ( ReadPartOffset( sVal, vdPar)) {
|
||||
m_BtlGeom.AddPartOffset( vdPar) ;
|
||||
string sVal = ToString( vdPar) ;
|
||||
m_BtlGeom.SetUserAttribute( UATD_PART, sPartKey[KEY_PART_PARTOFFSET], sVal) ;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
case KEY_PART_PROCESSINGQUALITY : // qualità di lavorazione
|
||||
Trim( sVal, " \t\r\n\"") ;
|
||||
@@ -673,6 +692,21 @@ ImportBtl::ReadTransformation( const string& sVal, Frame3d& frRef)
|
||||
return frRef.Set( ptO, ptO + vtX, ptO + vtY) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtl::ReadPartOffset( const string& sVal, DBLVECTOR& vdPar)
|
||||
{
|
||||
// assegno i valori di default
|
||||
vdPar = { 0, 0, 0, 0, 0} ;
|
||||
// leggo i valori
|
||||
GetParamP( sVal, 4, vdPar[0]) ;
|
||||
GetParamP( sVal, 11, vdPar[1]) ;
|
||||
GetParamP( sVal, 12, vdPar[2]) ;
|
||||
GetParamP( sVal, 13, vdPar[3]) ;
|
||||
GetParamP( sVal, 14, vdPar[4]) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtl::ReadOutline( void)
|
||||
@@ -701,6 +735,18 @@ ImportBtl::ReadOutline( void)
|
||||
break ;
|
||||
}
|
||||
// leggo i dati
|
||||
// leggo faccia di riferimento
|
||||
int nCurrSide ;
|
||||
if ( GetInfo( sVal, PAR_SIDE, nCurrSide)) {
|
||||
// se non ancora assegnata
|
||||
if ( nSide == BTL_SIDE_NONE)
|
||||
nSide = nCurrSide ;
|
||||
// altrimenti è un nuovo outline, si assegna questo e si esce
|
||||
else if ( nSide != nCurrSide) {
|
||||
m_theScanner.UngetLine( sLine) ;
|
||||
return m_BtlGeom.AddPartOutline( nSide, dqFce, nContType, nContData, dContPar, vsUAtt) ;
|
||||
}
|
||||
}
|
||||
// tipo
|
||||
int nFlag ;
|
||||
GetParamP( sVal, 8, nFlag) ;
|
||||
@@ -713,9 +759,6 @@ ImportBtl::ReadOutline( void)
|
||||
bProcFound = true ;
|
||||
}
|
||||
}
|
||||
// se non ancora assegnata, leggo faccia di riferimento
|
||||
if ( nSide == BTL_SIDE_NONE)
|
||||
GetInfo( sVal, PAR_SIDE, nSide) ;
|
||||
// punto principale
|
||||
Point3d ptP ;
|
||||
GetParamP( sVal, 1, ptP.x) ;
|
||||
@@ -834,13 +877,13 @@ ImportBtl::ReadColor( const string& sVal, Color& colRes)
|
||||
// leggo i valori
|
||||
string sRes ;
|
||||
GetParam( sVal, PAR_R, sRes) ;
|
||||
int nRed ; FromString( sRes, nRed) ;
|
||||
int nRed = 0 ; FromString( sRes, nRed) ;
|
||||
GetParam( sVal, PAR_G, sRes) ;
|
||||
int nGreen ; FromString( sRes, nGreen) ;
|
||||
int nGreen = 0 ; FromString( sRes, nGreen) ;
|
||||
GetParam( sVal, PAR_B, sRes) ;
|
||||
int nBlue ; FromString( sRes, nBlue) ;
|
||||
int nBlue = 0 ; FromString( sRes, nBlue) ;
|
||||
GetParam( sVal, PAR_A, sRes) ;
|
||||
int nAlpha ; FromString( sRes, nAlpha) ; nAlpha = nAlpha * 100 / 255 ;
|
||||
int nAlpha = 0 ; FromString( sRes, nAlpha) ; nAlpha = nAlpha * 100 / 255 ;
|
||||
colRes.Set( nRed, nGreen, nBlue, nAlpha) ;
|
||||
return true ;
|
||||
}
|
||||
@@ -1230,6 +1273,9 @@ ImportBtl::GetParam( const string& sText, const string& sPar, string& sVal)
|
||||
bool
|
||||
ImportBtl::GetParamP( const string& sText, int nInd, int& nVal)
|
||||
{
|
||||
// verifico se dummy
|
||||
if ( nInd < 0)
|
||||
return true ;
|
||||
// creo l'identificativo
|
||||
string sPar = PAR_P + ToString( nInd, 2) ;
|
||||
// leggo il parametro
|
||||
@@ -1243,6 +1289,9 @@ ImportBtl::GetParamP( const string& sText, int nInd, int& nVal)
|
||||
bool
|
||||
ImportBtl::GetParamP( const string& sText, int nInd, double& dVal)
|
||||
{
|
||||
// verifico se dummy
|
||||
if ( nInd < 0)
|
||||
return true ;
|
||||
// creo l'identificativo
|
||||
string sPar = PAR_P + ToString( nInd, 2) ;
|
||||
// leggo il parametro
|
||||
@@ -1253,6 +1302,9 @@ ImportBtl::GetParamP( const string& sText, int nInd, double& dVal)
|
||||
bool
|
||||
ImportBtl::GetParamP( const string& sText, int nInd, string& sVal)
|
||||
{
|
||||
// verifico se dummy
|
||||
if ( nInd < 0)
|
||||
return true ;
|
||||
// creo l'identificativo
|
||||
string sPar = PAR_P + ToString( nInd, 2) ;
|
||||
// leggo il parametro
|
||||
|
||||
@@ -34,6 +34,7 @@ class ImportBtl : public IImportBtl
|
||||
bool ReadGeneral( bool& bEnd) ;
|
||||
bool ReadObject( ObjType nType, bool& bEnd) ;
|
||||
bool ReadTransformation( const std::string& sVal, Frame3d& frRef) ;
|
||||
bool ReadPartOffset( const std::string& sVal, DBLVECTOR& vdPar) ;
|
||||
bool ReadOutline( void) ;
|
||||
bool ReadAperture( void) ;
|
||||
bool ReadColor( const std::string& sVal, Color& colRes) ;
|
||||
|
||||
+312
-443
File diff suppressed because it is too large
Load Diff
+8
-9
@@ -28,7 +28,7 @@ public :
|
||||
|
||||
bool ReadFileHistory( pugi::xml_node node) ;
|
||||
bool ReadProjectAttributes( pugi::xml_attribute attr) ;
|
||||
bool ReadUserAttributes( pugi::xml_node node, int caller, std::vector<std::string> * pvsAttr = nullptr) ;
|
||||
bool ReadUserAttributes( pugi::xml_node node, int caller, STRVECTOR* pvsAttr = nullptr) ;
|
||||
bool ReadPart( pugi::xml_node node) ;
|
||||
bool ReadPartAttributes( pugi::xml_attribute attr) ;
|
||||
bool ReadCamber( pugi::xml_node node) ;
|
||||
@@ -42,7 +42,7 @@ public :
|
||||
bool ReadAperture( pugi::xml_node node, int nSide) ;
|
||||
bool ReadUserReferencePlane( pugi::xml_node node) ;
|
||||
bool ReadShape( pugi::xml_node node) ;
|
||||
bool CheckGuid ( std::string s) ;
|
||||
bool CheckGuid( const std::string& s) ;
|
||||
|
||||
// processing
|
||||
bool ReadJackRafterCutParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide, INTVECTOR& vnDPar, int& nSPar,
|
||||
@@ -115,17 +115,16 @@ public :
|
||||
DBLVECTOR& vdPar, std::string& sPar) ;
|
||||
bool ReadDovetailParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide, INTVECTOR& vnDPar, int& nSPar,
|
||||
DBLVECTOR& vdPar, std::string& sPar) ;
|
||||
bool ReadFreeContourParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide, INTVECTOR& vnDPar, int& nSPar,
|
||||
DBLVECTOR& vdPar, std::string& sPar, int& curve_counter, STRVECTOR& vsUAtt) ;
|
||||
bool ReadSContourParams( pugi::xml_node process, int nType, int nOtherId, int& nGroup, int& nProc, int& nSide,
|
||||
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar, int& curve_counter, STRVECTOR& vsUAtt) ;
|
||||
bool ReadDContourParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
||||
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar, int& curve_counter, STRVECTOR& vsUAtt) ;
|
||||
bool ReadFreeContourParams( pugi::xml_node process, const STRVECTOR& vsUAtt) ;
|
||||
bool ReadSContourParams( pugi::xml_node process, int nType, int nOtherId, int nGroup, int nProc, int nSide, bool bCounterSink,
|
||||
int& nCrvCnt, const STRVECTOR& vsUAtt) ;
|
||||
bool ReadDContourParams( pugi::xml_node process, int nGroup, int nProc, int nSide, bool bCounterSink,
|
||||
int& nCrvCnt, const STRVECTOR& vsUAtt) ;
|
||||
|
||||
private :
|
||||
BtlGeom m_BtlGeom ; // gestore geometria pezzi Btl
|
||||
std::string m_sVersion ; // versione btlx
|
||||
std::unordered_map< int, Frame3d> MapURefPlanes ;
|
||||
std::unordered_map< int, Frame3d> m_mapRefPlanes ;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
+225
-223
File diff suppressed because it is too large
Load Diff
+68
-11
@@ -23,9 +23,8 @@
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkArcSpecial.h"
|
||||
#include "/EgtDEv/Include/EGnScanner.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
@@ -42,6 +41,7 @@ static const string KEY_EXIT = "EXIT" ;
|
||||
static const string KEY_TPOS = "TPOS" ;
|
||||
static const string KEY_TPOS2 = "TPOS2" ;
|
||||
static const string KEY_SPEED = "SPEED" ;
|
||||
static const string KEY_FEED = "FEED" ;
|
||||
static const string KEY_ROTAX_A = "A" ;
|
||||
static const string KEY_ROTAX_B = "B" ;
|
||||
static const string KEY_ROTAX_C = "C" ;
|
||||
@@ -52,7 +52,7 @@ IImportCnc*
|
||||
CreateImportCnc( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImportCnc*> ( new(nothrow) ImportCnc) ;
|
||||
@@ -124,6 +124,7 @@ ImportCnc::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup, int nFlag)
|
||||
m_colCurr = BLACK ;
|
||||
m_sToolName.clear() ;
|
||||
m_nExit = 1 ;
|
||||
m_dFeed = 0 ;
|
||||
|
||||
// se estensione xpi è NUM
|
||||
string sFileTitle, sFileExt ;
|
||||
@@ -170,7 +171,7 @@ ImportCnc::ProcessLine( const string& sLine)
|
||||
return ParseRemark( sLine) ;
|
||||
|
||||
// altre linee da saltare
|
||||
if ( sLine[0] == '$' || sLine[0] == '!')
|
||||
if ( sLine[0] == '$' || sLine[0] == '!' || sLine.starts_with( "MSG"))
|
||||
return true ;
|
||||
|
||||
// eliminazione di commenti intermedi o finali
|
||||
@@ -178,6 +179,8 @@ ImportCnc::ProcessLine( const string& sLine)
|
||||
// se controllo OSAI elimino le parti dopo ;
|
||||
if ( m_nCNC == CNC_OSAI) {
|
||||
size_t nStart = sMyLine.find( ';') ;
|
||||
if ( nStart == string::npos)
|
||||
nStart = sMyLine.find( "@") ;
|
||||
if ( nStart != string::npos)
|
||||
sMyLine.erase( nStart) ;
|
||||
}
|
||||
@@ -192,13 +195,21 @@ ImportCnc::ProcessLine( const string& sLine)
|
||||
sMyLine.erase( nStart) ;
|
||||
}
|
||||
}
|
||||
// se controllo SIEMENS elimino i cicli 800 e 832
|
||||
// se controllo SIEMENS elimino alcuni comandi speciali ed effettuo conversioni o salti
|
||||
else if ( m_nCNC == CNC_SIEMENS) {
|
||||
if ( sMyLine.starts_with( "ID"))
|
||||
return true ;
|
||||
if ( sMyLine.starts_with( "DYN"))
|
||||
return true ;
|
||||
size_t nStart = sMyLine.find( "CYCLE800") ;
|
||||
if ( nStart == string::npos)
|
||||
nStart = sMyLine.find( "CYCLE832") ;
|
||||
if ( nStart == string::npos)
|
||||
nStart = sMyLine.find( "/WHEN") ;
|
||||
if ( nStart != string::npos)
|
||||
sMyLine.erase( nStart) ;
|
||||
ReplaceString( sMyLine, "SUPA", "G79") ;
|
||||
ReplaceString( sMyLine, "AC(", "") ;
|
||||
}
|
||||
|
||||
// divido la linea in parti
|
||||
@@ -206,7 +217,7 @@ ImportCnc::ProcessLine( const string& sLine)
|
||||
TokenizePlus( sMyLine, "NGXYZIJKPQRUVWABCFTMHhDEL", vsTokens) ;
|
||||
|
||||
// analizzo ogni singola parte
|
||||
for ( size_t i = 0 ; i < vsTokens.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( vsTokens) ; ++ i) {
|
||||
// analizzo per categorie determinate dal primo carattere del token
|
||||
switch ( vsTokens[i][0]) {
|
||||
case 'G' :
|
||||
@@ -251,6 +262,9 @@ ImportCnc::ProcessLine( const string& sLine)
|
||||
case 'T' :
|
||||
ParseT( vsTokens[i]) ;
|
||||
break ;
|
||||
case 'F' :
|
||||
ParseF( vsTokens[i]) ;
|
||||
break ;
|
||||
case 'M' :
|
||||
ParseM( vsTokens[i]) ;
|
||||
break ;
|
||||
@@ -273,8 +287,11 @@ ImportCnc::ProcessLine( const string& sLine)
|
||||
// se utensile da caricare
|
||||
if ( m_bLoadTool)
|
||||
m_nTool = m_nNextTool ;
|
||||
// se comando da ignorare
|
||||
if ( m_nCommand == SKIP)
|
||||
;
|
||||
// se comando di movimento o riconosciuto movimento, lo eseguo
|
||||
if ( m_nCommand == MOVE || m_bToMove)
|
||||
else if ( m_nCommand == MOVE || m_bToMove)
|
||||
bOk = ExecMovement() ;
|
||||
// se comando di impostazione piano di interpolazione
|
||||
else if ( m_nCommand == IPL)
|
||||
@@ -362,7 +379,8 @@ ImportCnc::ParseRemark( const string& sLine)
|
||||
if ( iExit == string::npos)
|
||||
iExit = sLine.find( "EXIT=") ;
|
||||
if ( iExit != string::npos) {
|
||||
FromString( sLine.substr( iExit + 5), m_nExit) ;
|
||||
if ( ! FromString( sLine.substr( iExit + 5), m_nExit))
|
||||
m_nExit = 0 ;
|
||||
return true ;
|
||||
}
|
||||
// cerco indicazione posizione nel TC
|
||||
@@ -434,6 +452,9 @@ ImportCnc::ParseG( const string& sToken)
|
||||
m_nCommand = MOVE ;
|
||||
m_nMoveType = ARC_CCW ;
|
||||
break ;
|
||||
case 4 :
|
||||
m_nCommand = SKIP ;
|
||||
break ;
|
||||
case 14 :
|
||||
m_nCommand = MOVE ;
|
||||
m_nMoveType = ARC_MID_3D ;
|
||||
@@ -498,6 +519,12 @@ ImportCnc::ParseG( const string& sToken)
|
||||
m_bAbsCoord = false ;
|
||||
break ;
|
||||
}
|
||||
// per saltare le macro custom su NUM (tipo G101... di S3)
|
||||
if ( m_nCNC == CNC_NUM && nVal > 99) {
|
||||
m_nCommand = NO_CMD ;
|
||||
m_nMoveType = RAPID ;
|
||||
m_bZeroMach = true ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -516,6 +543,8 @@ ImportCnc::ParseX( const string& sToken)
|
||||
case OFFS :
|
||||
m_vtOffs.x = dVal ;
|
||||
break ;
|
||||
case SKIP :
|
||||
break ;
|
||||
default :
|
||||
if ( m_bZeroMach)
|
||||
m_ptNext.x = m_ptHome.x + dVal ;
|
||||
@@ -543,6 +572,8 @@ ImportCnc::ParseY( const string& sToken)
|
||||
case OFFS :
|
||||
m_vtOffs.y = dVal ;
|
||||
break ;
|
||||
case SKIP :
|
||||
break ;
|
||||
default :
|
||||
if ( m_bZeroMach)
|
||||
m_ptNext.y = m_ptHome.y + dVal ;
|
||||
@@ -570,6 +601,8 @@ ImportCnc::ParseZ( const string& sToken)
|
||||
case OFFS :
|
||||
m_vtOffs.z = dVal ;
|
||||
break ;
|
||||
case SKIP :
|
||||
break ;
|
||||
default :
|
||||
if ( m_bZeroMach)
|
||||
m_ptNext.z = m_ptHome.z + dVal ;
|
||||
@@ -623,7 +656,6 @@ ImportCnc::ParseJ( const string& sToken)
|
||||
case ZX : m_ptCen.x = dVal ; break ;
|
||||
}
|
||||
}
|
||||
|
||||
m_nArcType = CENTER ;
|
||||
m_bToMove = true ;
|
||||
return true ;
|
||||
@@ -764,6 +796,17 @@ ImportCnc::ParseT( const string& sToken)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportCnc::ParseF( const string& sToken)
|
||||
{
|
||||
double dVal ;
|
||||
int nStart = ( sToken[1] == '=' ? 2 : 1) ;
|
||||
if ( FromString( sToken.substr( nStart), dVal))
|
||||
m_dFeed = dVal ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportCnc::ParseM( const string& sToken)
|
||||
@@ -896,6 +939,9 @@ ImportCnc::AddPoint( int nPntType)
|
||||
m_pGDB->SetInfo( nId, KEY_ROTAX_B, m_dRotAxB) ;
|
||||
if ( ! isnan( m_dRotAxC))
|
||||
m_pGDB->SetInfo( nId, KEY_ROTAX_C, m_dRotAxC) ;
|
||||
// assegnazione eventuale Feed
|
||||
if ( nPntType == P_PNT && abs( m_dFeed) > 0.1)
|
||||
m_pGDB->SetInfo( nId, KEY_FEED, m_dFeed) ;
|
||||
// assegnazione eventuali info
|
||||
SetInfos( nId) ;
|
||||
m_vInfos.clear() ;
|
||||
@@ -955,6 +1001,9 @@ ImportCnc::AddLine( int nLineType)
|
||||
m_pGDB->SetInfo( nId, KEY_ROTAX_B, m_dRotAxB) ;
|
||||
if ( ! isnan( m_dRotAxC))
|
||||
m_pGDB->SetInfo( nId, KEY_ROTAX_C, m_dRotAxC) ;
|
||||
// assegnazione eventuale Feed
|
||||
if ( nLineType == L_LINE && abs( m_dFeed) > 0.1)
|
||||
m_pGDB->SetInfo( nId, KEY_FEED, m_dFeed) ;
|
||||
// assegnazione eventuali info
|
||||
SetInfos( nId) ;
|
||||
m_vInfos.clear() ;
|
||||
@@ -995,7 +1044,8 @@ ImportCnc::AddArc( bool bCCW)
|
||||
switch ( VerifyArcCenter( vtN)) {
|
||||
case A_ARC :
|
||||
// punti estremi e centro
|
||||
if ( ! pCrvArc->SetC2PN( m_ptCen, m_ptLast, m_ptNext, vtN))
|
||||
pCrvArc.Set( GetArc2PCN( m_ptLast, m_ptNext, m_ptCen, vtN)) ;
|
||||
if ( IsNull( pCrvArc))
|
||||
return false ;
|
||||
// verifico senso di rotazione
|
||||
if ( ( bCCW && pCrvArc->GetAngCenter() < 0) ||
|
||||
@@ -1045,6 +1095,9 @@ ImportCnc::AddArc( bool bCCW)
|
||||
m_pGDB->SetInfo( nId, KEY_ROTAX_B, m_dRotAxB) ;
|
||||
if ( ! isnan( m_dRotAxC))
|
||||
m_pGDB->SetInfo( nId, KEY_ROTAX_C, m_dRotAxC) ;
|
||||
// assegnazione eventuale Feed
|
||||
if ( abs( m_dFeed) > 0.1)
|
||||
m_pGDB->SetInfo( nId, KEY_FEED, m_dFeed) ;
|
||||
// assegnazione eventuali info
|
||||
SetInfos( nId) ;
|
||||
m_vInfos.clear() ;
|
||||
@@ -1111,6 +1164,9 @@ ImportCnc::AddArc3P( bool bIs2D)
|
||||
m_pGDB->SetInfo( nId, KEY_ROTAX_B, m_dRotAxB) ;
|
||||
if ( ! isnan( m_dRotAxC))
|
||||
m_pGDB->SetInfo( nId, KEY_ROTAX_C, m_dRotAxC) ;
|
||||
// assegnazione eventuale Feed
|
||||
if ( abs( m_dFeed) > 0.1)
|
||||
m_pGDB->SetInfo( nId, KEY_FEED, m_dFeed) ;
|
||||
// assegnazione eventuali info
|
||||
SetInfos( nId) ;
|
||||
m_vInfos.clear() ;
|
||||
@@ -1323,7 +1379,8 @@ ImportCnc::PostProcess( void)
|
||||
int nNextId = m_pGDB->GetNext( nId) ;
|
||||
// estraggo la curva e la accodo alla composita
|
||||
ICurve* pCrv = GetCurve( m_pGDB->RemoveGeoObjAndErase( nId)) ;
|
||||
pCompo->AddCurve( pCrv) ;
|
||||
if ( ! pCompo->AddCurve( pCrv, true, 10 * EPS_SMALL))
|
||||
return false ;
|
||||
// passo alla successiva
|
||||
nId = nNextId ;
|
||||
// se G40 termino la composita
|
||||
|
||||
+3
-1
@@ -42,6 +42,7 @@ class ImportCnc : public IImportCnc
|
||||
bool ParseB( const std::string& sToken) ;
|
||||
bool ParseC( const std::string& sToken) ;
|
||||
bool ParseT( const std::string& sToken) ;
|
||||
bool ParseF( const std::string& sToken) ;
|
||||
bool ParseM( const std::string& sToken) ;
|
||||
bool ParseH( const std::string& sToken) ;
|
||||
bool ExecSetIPL( void) ;
|
||||
@@ -73,7 +74,7 @@ class ImportCnc : public IImportCnc
|
||||
private :
|
||||
enum CncName { CNC_STD = 0, CNC_OSAI = 1, CNC_FANUC = 2, CNC_NUM = 3, CNC_SIEMENS = 4, CNC_TPA = 5, CNC_MAZAK = 6, CNC_FAGOR} ;
|
||||
enum InterpPl { XY = 1, YZ = 2, ZX = 3} ;
|
||||
enum Command { NO_CMD = 0, MOVE = 1, IPL = 2, OFFS = 3} ;
|
||||
enum Command { NO_CMD = 0, MOVE = 1, IPL = 2, OFFS = 3, SKIP = 4} ;
|
||||
enum MoveType { RAPID = 0, LINE = 1, ARC_CW = 2, ARC_CCW = 3, ARC_MID_2D = 4, ARC_MID_3D = 5} ;
|
||||
enum PntType { P_RAPID = 0, P_PNT = 1, P_ERROR = 2} ;
|
||||
enum LineType { L_RAPID = 0, L_LINE = 1, L_ERROR = 2} ;
|
||||
@@ -125,5 +126,6 @@ class ImportCnc : public IImportCnc
|
||||
std::string m_sToolPos ;
|
||||
std::string m_sToolPos2 ;
|
||||
std::string m_sSpeed ;
|
||||
double m_dFeed ;
|
||||
STRVECTOR m_vInfos ;
|
||||
} ;
|
||||
|
||||
+2
-4
@@ -25,8 +25,6 @@
|
||||
#include "/EgtDev/Include/EGkExtText.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include <fstream>
|
||||
@@ -62,7 +60,7 @@ IImportCsf*
|
||||
CreateImportCsf( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImportCsf*> ( new(nothrow) ImportCsf) ;
|
||||
@@ -599,7 +597,7 @@ ImportCsf::ProcessExtendedText( const CsfEnt& csfEnt)
|
||||
}
|
||||
// salvataggio testo con un punto di inserimento per ogni carattere
|
||||
else if ( etData.sText.size() == etData.vPnt.size()) {
|
||||
for ( size_t i = 0 ; i < etData.sText.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( etData.sText) ; ++ i) {
|
||||
// creo il testo
|
||||
PtrOwner<IExtText> pTxt( CreateExtText()) ;
|
||||
if ( IsNull( pTxt))
|
||||
|
||||
+1
-4
@@ -19,18 +19,15 @@
|
||||
#include "/EgtDev/Include/EExDllMain.h"
|
||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IImportDxf*
|
||||
CreateImportDxf( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImportDxf*> ( new(nothrow) ImportDxf) ;
|
||||
|
||||
+29
-20
@@ -398,9 +398,9 @@ bool
|
||||
ImportDxf::ReadArc( bool& bFileEnd)
|
||||
{
|
||||
Point3d ptCen ;
|
||||
double dRadius ;
|
||||
double dStartAng ;
|
||||
double dEndAng ;
|
||||
double dRadius = 0 ;
|
||||
double dStartAng = 0 ;
|
||||
double dEndAng = 0 ;
|
||||
Vector3d vtExtr = Z_AX ;
|
||||
double dThick = 0 ;
|
||||
string sLayer ;
|
||||
@@ -529,7 +529,7 @@ bool
|
||||
ImportDxf::ReadCircle( bool& bFileEnd)
|
||||
{
|
||||
Point3d ptCen ;
|
||||
double dRadius ;
|
||||
double dRadius = 0 ;
|
||||
Vector3d vtExtr = Z_AX ;
|
||||
double dThick = 0 ;
|
||||
string sLayer ;
|
||||
@@ -1378,7 +1378,7 @@ ImportDxf::ReadPoint( bool& bFileEnd)
|
||||
if ( ! pGeoPnt->Set( ptP))
|
||||
return false ;
|
||||
// lo passo all'oggetto geometrico generico
|
||||
pGeoObj.Set( Release( pGeoPnt)) ;
|
||||
pGeoObj.Set( pGeoPnt) ;
|
||||
}
|
||||
else {
|
||||
// creo il vettore con punto base
|
||||
@@ -1389,7 +1389,7 @@ ImportDxf::ReadPoint( bool& bFileEnd)
|
||||
if ( ! pGeoVect->Set( dThick * vtExtr, ptP))
|
||||
return false ;
|
||||
// lo passo all'oggetto geometrico generico
|
||||
pGeoObj.Set( Release( pGeoVect)) ;
|
||||
pGeoObj.Set( pGeoVect) ;
|
||||
}
|
||||
// inserisco l'entità nel DB
|
||||
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, GetGroupId( sLayer), Release( pGeoObj)) ;
|
||||
@@ -2146,47 +2146,55 @@ ImportDxf::ReadSpline( bool& bFileEnd)
|
||||
sLayer = m_sCurrItem ;
|
||||
break ;
|
||||
case 10 :
|
||||
FromString( m_sCurrItem, ptP.x) ;
|
||||
if ( ! FromString( m_sCurrItem, ptP.x))
|
||||
ptP.x = 0 ;
|
||||
++ nContX ;
|
||||
if ( nContX == nContY && nContY == nContZ)
|
||||
cnData.vCP.push_back( ptP) ;
|
||||
break ;
|
||||
case 20 :
|
||||
FromString( m_sCurrItem, ptP.y) ;
|
||||
if ( ! FromString( m_sCurrItem, ptP.y))
|
||||
ptP.y = 0 ;
|
||||
++ nContY ;
|
||||
if ( nContX == nContY && nContY == nContZ)
|
||||
cnData.vCP.push_back( ptP) ;
|
||||
break ;
|
||||
case 30 :
|
||||
FromString( m_sCurrItem, ptP.z) ;
|
||||
if ( ! FromString( m_sCurrItem, ptP.z))
|
||||
ptP.z = 0 ;
|
||||
++ nContZ ;
|
||||
if ( nContX == nContY && nContY == nContZ)
|
||||
cnData.vCP.push_back( ptP) ;
|
||||
break ;
|
||||
case 11 :
|
||||
FromString( m_sCurrItem, ptInt.x) ;
|
||||
if ( ! FromString( m_sCurrItem, ptInt.x))
|
||||
ptInt.x = 0 ;
|
||||
++ nIntX ;
|
||||
if ( nIntX == nIntY && nIntY == nIntZ)
|
||||
vIntPnt.push_back( ptInt) ;
|
||||
break ;
|
||||
case 21 :
|
||||
FromString( m_sCurrItem, ptInt.y) ;
|
||||
if ( ! FromString( m_sCurrItem, ptInt.y))
|
||||
ptInt.y = 0 ;
|
||||
++ nIntY ;
|
||||
if ( nIntX == nIntY && nIntY == nIntZ)
|
||||
vIntPnt.push_back( ptInt) ;
|
||||
break ;
|
||||
case 31 :
|
||||
FromString( m_sCurrItem, ptInt.z) ;
|
||||
if ( ! FromString( m_sCurrItem, ptInt.z))
|
||||
ptInt.z = 0 ;
|
||||
++ nIntZ ;
|
||||
if ( nIntX == nIntY && nIntY == nIntZ)
|
||||
vIntPnt.push_back( ptInt) ;
|
||||
break ;
|
||||
case 40 :
|
||||
FromString( m_sCurrItem, dTemp) ;
|
||||
if ( ! FromString( m_sCurrItem, dTemp))
|
||||
dTemp = 0 ;
|
||||
cnData.vU.push_back( dTemp) ;
|
||||
break;
|
||||
case 41 :
|
||||
FromString( m_sCurrItem, dTemp) ;
|
||||
if ( ! FromString( m_sCurrItem, dTemp))
|
||||
dTemp = 0 ;
|
||||
cnData.vW.push_back( dTemp) ;
|
||||
break;
|
||||
case 60 :
|
||||
@@ -2253,8 +2261,9 @@ ImportDxf::ReadSpline( bool& bFileEnd)
|
||||
}
|
||||
// assegnazione flag
|
||||
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.bClamped = true ;
|
||||
cnData.bExtraKnotes = true ;
|
||||
// Verifico il numero di nodi
|
||||
if ( cnData.vU.size() != nKnotNbr || nKnotNbr < 4)
|
||||
@@ -2301,7 +2310,7 @@ ImportDxf::ReadText( int nGroupId, bool& bFileEnd)
|
||||
string sText ;
|
||||
string sLayer ;
|
||||
string sStyle = "STANDARD" ;
|
||||
double dH ;
|
||||
double dH = 0 ;
|
||||
double dAngDeg = 0 ;
|
||||
double dRat = 1 ;
|
||||
int nSpace = ENT_MODELSPACE ;
|
||||
@@ -2499,7 +2508,7 @@ ImportDxf::ReadMText( bool& bFileEnd)
|
||||
string sText ;
|
||||
string sLayer ;
|
||||
string sStyle = "STANDARD" ;
|
||||
double dH ;
|
||||
double dH = 0 ;
|
||||
double dTextMaxWidth = 0 ;
|
||||
double dAngRad = 0 ;
|
||||
int nInsPos = ETXT_IPBL ;
|
||||
@@ -2686,16 +2695,16 @@ ImportDxf::AdjustMText( string& sText, double dTextMaxWidth, double dW)
|
||||
// coefficiente empirico che in generale migliora l'adattamento
|
||||
const double COEFF_LARGH = 1.2 ;
|
||||
// gestione max lunghezza riga di testo
|
||||
size_t nLastSp = - 1 ;
|
||||
int nLastSp = -1 ;
|
||||
double dCurrWidth = 0 ;
|
||||
for ( size_t i = 0 ; i < sText.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( sText) ; ++ i) {
|
||||
// posso dividere solo sugli spazi
|
||||
if ( sText[i] == ' ')
|
||||
nLastSp = i ;
|
||||
// se c'è già un a capo
|
||||
if ( sText[i] == '\n') {
|
||||
dCurrWidth = 0 ;
|
||||
nLastSp = - 1 ;
|
||||
nLastSp = -1 ;
|
||||
}
|
||||
// se supera il limite
|
||||
else if ( dCurrWidth > COEFF_LARGH * dTextMaxWidth) {
|
||||
|
||||
+206
@@ -0,0 +1,206 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2024-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ImportOff.cpp Data : 28.11.24 Versione : 2.6k2
|
||||
// Contenuto : Implementazione della classe per l'importazione di OFF.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 28.11.24 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "ImportOff.h"
|
||||
#include "DllMain.h"
|
||||
#include "/EgtDev/Include/EExDllMain.h"
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IImportOff*
|
||||
CreateImportOff( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImportOff*> ( new( nothrow) ImportOff) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportOff::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup, double dScaleFactor)
|
||||
{
|
||||
// verifico il DB geometrico
|
||||
if ( pGDB == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), "ImportOff : Error on GeomDB")
|
||||
return false ;
|
||||
}
|
||||
m_pGDB = pGDB ;
|
||||
|
||||
// verifico l'Id di gruppo
|
||||
if ( ! m_pGDB->ExistsObj( nIdGroup)) {
|
||||
LOG_ERROR( GetEExLogger(), "ImportOff : Error on IdGroup")
|
||||
return false ;
|
||||
}
|
||||
m_nIdGroup = nIdGroup ;
|
||||
|
||||
// verifico il fattore di scala
|
||||
if ( dScaleFactor < EPS_SMALL) {
|
||||
LOG_ERROR( GetEExLogger(), "ImportOff : Error on ScaleFactor too small (minimum 0.001).")
|
||||
return false ;
|
||||
}
|
||||
m_dScaleFactor = dScaleFactor ;
|
||||
|
||||
// inizializzo lo scanner
|
||||
if ( ! m_theScanner.Init( sFile, "#")) {
|
||||
LOG_ERROR( GetEExLogger(), "ImportOff : Error on Init")
|
||||
return false ;
|
||||
}
|
||||
|
||||
// lettura intestazione
|
||||
if ( ! ReadData()) {
|
||||
string sOut = " ImportOff : Error in ReadData on line " + ToString( m_theScanner.GetCurrLineNbr()) ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportOff::ReadData( void)
|
||||
{
|
||||
string sLine ;
|
||||
|
||||
// Intestazione opzionale OFF
|
||||
if ( ! m_theScanner.GetLine( sLine))
|
||||
return false ;
|
||||
bool bOFF = ( sLine.find( "OFF") != string::npos) ;
|
||||
|
||||
// Numero di vertici, di facce e di spigoli (ignorato)
|
||||
if ( bOFF && ! m_theScanner.GetLine( sLine))
|
||||
return false ;
|
||||
STRVECTOR vsTok ;
|
||||
Tokenize( sLine, " ", vsTok) ;
|
||||
if ( vsTok.size() < 3)
|
||||
return false ;
|
||||
int nVerts = 0, nFaces = 0 ;
|
||||
if ( ! FromString( vsTok[0], nVerts) || nVerts <= 0 ||
|
||||
! FromString( vsTok[1], nFaces) || nFaces <= 0)
|
||||
return false ;
|
||||
|
||||
// Vettore dei vertici
|
||||
PNTVECTOR vVert( nVerts) ;
|
||||
// lettura dei vertici
|
||||
for ( int i = 0 ; i < nVerts ; ++ i) {
|
||||
if ( ! m_theScanner.GetLine( sLine))
|
||||
return false ;
|
||||
STRVECTOR vsTok ;
|
||||
Tokenize( sLine, " ", vsTok) ;
|
||||
if ( vsTok.size() < 3)
|
||||
return false ;
|
||||
if ( ! FromString( vsTok[0], vVert[i].x) || ! FromString( vsTok[1],vVert[i].y) || ! FromString( vsTok[2], vVert[i].z))
|
||||
return false ;
|
||||
vVert[i] *= m_dScaleFactor ;
|
||||
}
|
||||
|
||||
// Costruttore di trimesh da insieme disordinato di triangoli
|
||||
StmFromTriangleSoup StmFts ;
|
||||
if ( ! StmFts.Start())
|
||||
return false ;
|
||||
// lettura delle facce
|
||||
int nBadFaces = 0 ;
|
||||
for ( int i = 0 ; i < nFaces ; ++ i) {
|
||||
if ( ! m_theScanner.GetLine( sLine))
|
||||
return false ;
|
||||
STRVECTOR vsTok ;
|
||||
Tokenize( sLine, " ", vsTok) ;
|
||||
if ( vsTok.empty())
|
||||
return false ;
|
||||
int nFVs = 0 ;
|
||||
if ( ! FromString( vsTok[0], nFVs) || int( vsTok.size()) < nFVs + 1)
|
||||
return false ;
|
||||
// se triangolo
|
||||
if ( nFVs == 3) {
|
||||
Triangle3d Tria ;
|
||||
for ( int j = 0 ; j < 3 ; ++ j) {
|
||||
int nV = -1 ;
|
||||
if ( ! FromString( vsTok[j+1], nV) || nV < 0 || nV >= nVerts)
|
||||
return false ;
|
||||
Tria.SetP( j, vVert[nV]) ;
|
||||
}
|
||||
if ( Tria.Validate( true)) {
|
||||
if ( ! StmFts.AddTriangle( Tria))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
++ nBadFaces ;
|
||||
}
|
||||
// se quadrilatero
|
||||
else if ( nFVs == 4) {
|
||||
Triangle3d TriaA, TriaB ;
|
||||
for ( int j = 0 ; j < 4 ; ++ j) {
|
||||
int nV = -1 ;
|
||||
if ( ! FromString( vsTok[j+1], nV) || nV < 0 || nV >= nVerts)
|
||||
return false ;
|
||||
if ( j != 3)
|
||||
TriaA.SetP( j, vVert[nV]) ;
|
||||
if ( j != 1)
|
||||
TriaB.SetP( ( j == 0 ? j : j - 1), vVert[nV]) ;
|
||||
}
|
||||
if ( TriaA.Validate( true)) {
|
||||
if ( ! StmFts.AddTriangle( TriaA))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
++ nBadFaces ;
|
||||
if ( TriaB.Validate( true)) {
|
||||
if ( ! StmFts.AddTriangle( TriaB))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
++ nBadFaces ;
|
||||
}
|
||||
// altrimenti poligono generico
|
||||
else {
|
||||
PolyLine PL ;
|
||||
for ( int j = 0 ; j < nFVs ; ++ j) {
|
||||
int nV = -1 ;
|
||||
if ( ! FromString( vsTok[j+1], nV) || nV < 0 || nV >= nVerts)
|
||||
return false ;
|
||||
PL.AddUPoint( j, vVert[nV]) ;
|
||||
}
|
||||
PL.Close() ;
|
||||
PL.FlattenInAutoPlane( 1.) ;
|
||||
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
||||
if ( ! IsNull( pStm) && pStm->CreateByFlatContour( PL)) {
|
||||
if ( ! StmFts.AddSurfTriMesh( *pStm))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
++ nBadFaces ;
|
||||
}
|
||||
}
|
||||
if ( nBadFaces > 0) {
|
||||
string sOut = " ImportOff : found " + ToString( nBadFaces) + " bad faces" ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
}
|
||||
|
||||
// Valido la superficie e calcolo le adiacenze
|
||||
if ( ! StmFts.End())
|
||||
return false ;
|
||||
// inserisco l'oggetto nel DB geometrico
|
||||
PtrOwner<ISurfTriMesh> pSTM( StmFts.GetSurf()) ;
|
||||
int nIdNew = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, Release( pSTM)) ;
|
||||
if ( nIdNew == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2024-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ImportOff.h Data : 28.11.24 Versione : 2.6k2
|
||||
// Contenuto : Dichiarazione della classe ImportOff.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 28.11.24 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EExImportOff.h"
|
||||
#include "/EgtDEv/Include/EGnScanner.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class ImportOff : public IImportOff
|
||||
{
|
||||
public :
|
||||
virtual bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup, double dScaleFactor = 1) ;
|
||||
|
||||
private :
|
||||
bool ReadData( void) ;
|
||||
|
||||
private :
|
||||
Scanner m_theScanner ;
|
||||
IGeomDB* m_pGDB ;
|
||||
int m_nIdGroup ;
|
||||
double m_dScaleFactor ;
|
||||
} ;
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2025-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ImportPLY.cpp Data : 28.02.25 Versione : 2.7b2
|
||||
// Contenuto : Implementazione della classe per l'importazione di PLY.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 28.02.25 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "ImportPly.h"
|
||||
#include "DllMain.h"
|
||||
#include "/EgtDev/Include/EExDllMain.h"
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IImportPly*
|
||||
CreateImportPly( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImportPly*> ( new( nothrow) ImportPly) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportPly::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup, double dScaleFactor)
|
||||
{
|
||||
// verifico il DB geometrico
|
||||
if ( pGDB == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), "ImportPly : Error on GeomDB")
|
||||
return false ;
|
||||
}
|
||||
m_pGDB = pGDB ;
|
||||
|
||||
// verifico l'Id di gruppo
|
||||
if ( ! m_pGDB->ExistsObj( nIdGroup)) {
|
||||
LOG_ERROR( GetEExLogger(), "ImportPly : Error on IdGroup")
|
||||
return false ;
|
||||
}
|
||||
m_nIdGroup = nIdGroup ;
|
||||
|
||||
// verifico il fattore di scala
|
||||
if ( dScaleFactor < EPS_SMALL) {
|
||||
LOG_ERROR( GetEExLogger(), "ImportPly : Error on ScaleFactor too small (minimum 0.001).")
|
||||
return false ;
|
||||
}
|
||||
m_dScaleFactor = dScaleFactor ;
|
||||
|
||||
// inizializzo il lettore
|
||||
miniply::PLYReader TheReader( sFile.data()) ;
|
||||
if ( ! TheReader.valid()) {
|
||||
LOG_ERROR( GetEExLogger(), "ImportPly : Error on Init")
|
||||
return false ;
|
||||
}
|
||||
|
||||
// lettura dati
|
||||
return ReadData( TheReader) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportPly::ReadData( miniply::PLYReader& TheReader)
|
||||
{
|
||||
typedef std::vector<float> FLTVECTOR ; // vettore di float
|
||||
|
||||
uint32_t propIdxs[3] ;
|
||||
bool bGotVerts = false, bGotFaces = false ;
|
||||
|
||||
int nVerts = 0 ;
|
||||
FLTVECTOR vVert ;
|
||||
int nTrias = 0 ;
|
||||
INTVECTOR vTria ;
|
||||
while ( TheReader.has_element() && ( ! bGotVerts || ! bGotFaces)) {
|
||||
// Recupero i vertici
|
||||
if ( TheReader.element_is( miniply::kPLYVertexElement) && TheReader.load_element() && TheReader.find_pos( propIdxs)) {
|
||||
nVerts = TheReader.num_rows() ;
|
||||
vVert.resize( 3 * nVerts) ;
|
||||
TheReader.extract_properties( propIdxs, 3, miniply::PLYPropertyType::Float, vVert.data()) ;
|
||||
bGotVerts = true ;
|
||||
}
|
||||
// Recupero gli indici dei vertici dei triangoli delle facce
|
||||
else if ( TheReader.element_is( miniply::kPLYFaceElement) && TheReader.load_element() && TheReader.find_indices( propIdxs)) {
|
||||
bool bPolys = TheReader.requires_triangulation( propIdxs[0]) ;
|
||||
if ( bPolys && ! bGotVerts) {
|
||||
string sOut = " ImportPly : need vertex positions to triangulate faces" ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
if ( bPolys) {
|
||||
nTrias = TheReader.num_triangles( propIdxs[0]) ;
|
||||
vTria.resize( 3 * nTrias) ;
|
||||
TheReader.extract_triangles( propIdxs[0], vVert.data(), nVerts, miniply::PLYPropertyType::Int, vTria.data()) ;
|
||||
}
|
||||
else {
|
||||
nTrias = TheReader.num_rows() ;
|
||||
vTria.resize( 3 * nTrias) ;
|
||||
TheReader.extract_list_property( propIdxs[0], miniply::PLYPropertyType::Int, vTria.data()) ;
|
||||
}
|
||||
bGotFaces = true ;
|
||||
}
|
||||
if ( bGotVerts && bGotFaces)
|
||||
break ;
|
||||
TheReader.next_element() ;
|
||||
}
|
||||
|
||||
// Controllo lettura effettiuata di vertici e facce
|
||||
if ( ! bGotVerts) {
|
||||
string sOut = " ImportPly : vertex positions not found" ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
if ( ! bGotFaces) {
|
||||
string sOut = " ImportPly : face indices not found" ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Costruttore di trimesh da insieme disordinato di triangoli
|
||||
StmFromTriangleSoup StmFts ;
|
||||
if ( ! StmFts.Start())
|
||||
return false ;
|
||||
// ciclo sui triangoli
|
||||
int nBadTrias = 0 ;
|
||||
for ( int i = 0 ; i < nTrias ; ++ i) {
|
||||
int nT = 3 * i ;
|
||||
Triangle3d Tria ;
|
||||
for ( int j = 0 ; j < 3 ; ++ j) {
|
||||
int nV = 3 * vTria[nT+j] ;
|
||||
Point3d ptP( vVert[nV], vVert[nV+1], vVert[nV+2]) ;
|
||||
ptP *= m_dScaleFactor ;
|
||||
Tria.SetP( j, ptP) ;
|
||||
}
|
||||
if ( Tria.Validate( true)) {
|
||||
if ( ! StmFts.AddTriangle( Tria)) {
|
||||
string sOut = " ImportPly : error adding triangle" ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
else
|
||||
++ nBadTrias ;
|
||||
}
|
||||
if ( nBadTrias > 0) {
|
||||
string sOut = " ImportPly : found " + ToString( nBadTrias) + " bad triangles" ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
}
|
||||
|
||||
// Valido la superficie e calcolo le adiacenze
|
||||
if ( ! StmFts.End())
|
||||
return false ;
|
||||
// inserisco l'oggetto nel DB geometrico
|
||||
PtrOwner<ISurfTriMesh> pSTM( StmFts.GetSurf()) ;
|
||||
int nIdNew = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, Release( pSTM)) ;
|
||||
if ( nIdNew == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2025-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ImportPly.h Data : 28.02.25 Versione : 2.7b2
|
||||
// Contenuto : Dichiarazione della classe ImportPly.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 28.02.25 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "miniply.h"
|
||||
#include "/EgtDev/Include/EExImportPly.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class ImportPly : public IImportPly
|
||||
{
|
||||
public :
|
||||
virtual bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup, double dScaleFactor = 1) ;
|
||||
|
||||
private :
|
||||
bool ReadData( miniply::PLYReader& TheReader) ;
|
||||
|
||||
private :
|
||||
IGeomDB* m_pGDB ;
|
||||
int m_nIdGroup ;
|
||||
double m_dScaleFactor ;
|
||||
} ;
|
||||
+1
-2
@@ -18,7 +18,6 @@
|
||||
#include "/EgtDev/Include/EExDllMain.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "/EgtDEv/Include/EGnScanner.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
@@ -28,7 +27,7 @@ IImportPnt*
|
||||
CreateImportPnt( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImportPnt*> ( new(nothrow) ImportPnt) ;
|
||||
|
||||
+8
-9
@@ -16,13 +16,10 @@
|
||||
#include "ImportStl.h"
|
||||
#include "DllMain.h"
|
||||
#include "/EgtDev/Include/EExDllMain.h"
|
||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
#include "/EgtDEv/Include/EGnScanner.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include <fstream>
|
||||
@@ -34,7 +31,7 @@ IImportStl*
|
||||
CreateImportStl( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImportStl*> ( new(nothrow) ImportStl) ;
|
||||
@@ -199,14 +196,16 @@ ImportStl::LoadSolid( Scanner& TheScanner, bool& bEnd)
|
||||
return false ;
|
||||
}
|
||||
// inserisco l'oggetto nel DB geometrico
|
||||
ISurfTriMesh* pSTM = StmFts.GetSurf() ;
|
||||
int nIdNew = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, pSTM) ;
|
||||
PtrOwner<ISurfTriMesh> pSTM( StmFts.GetSurf()) ;
|
||||
int nIdNew = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, Release( pSTM)) ;
|
||||
if ( nIdNew == GDB_ID_NULL)
|
||||
return false ;
|
||||
// se previsto il nome, lo assegno
|
||||
if ( ! sName.empty())
|
||||
m_pGDB->SetName( nIdNew, sName) ;
|
||||
|
||||
bEnd = false ;
|
||||
return ( nIdNew != GDB_ID_NULL) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+2058
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,317 @@
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Vilya Harvey
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MINIPLY_H
|
||||
#define MINIPLY_H
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
/// miniply - A simple and fast parser for PLY files
|
||||
/// ================================================
|
||||
///
|
||||
/// For details about the PLY format see:
|
||||
/// * http://paulbourke.net/dataformats/ply/
|
||||
/// * https://en.wikipedia.org/wiki/PLY_(file_format)
|
||||
|
||||
namespace miniply {
|
||||
|
||||
//
|
||||
// Constants
|
||||
//
|
||||
|
||||
static constexpr uint32_t kInvalidIndex = 0xFFFFFFFFu;
|
||||
|
||||
// Standard PLY element names
|
||||
extern const char* kPLYVertexElement; // "vertex"
|
||||
extern const char* kPLYFaceElement; // "face"
|
||||
|
||||
|
||||
//
|
||||
// PLY Parsing types
|
||||
//
|
||||
|
||||
enum class PLYFileType {
|
||||
ASCII,
|
||||
Binary,
|
||||
BinaryBigEndian,
|
||||
};
|
||||
|
||||
|
||||
enum class PLYPropertyType {
|
||||
Char,
|
||||
UChar,
|
||||
Short,
|
||||
UShort,
|
||||
Int,
|
||||
UInt,
|
||||
Float,
|
||||
Double,
|
||||
|
||||
None, //!< Special value used in Element::listCountType to indicate a non-list property.
|
||||
};
|
||||
|
||||
|
||||
struct PLYProperty {
|
||||
std::string name;
|
||||
PLYPropertyType type = PLYPropertyType::None; //!< Type of the data. Must be set to a value other than None.
|
||||
PLYPropertyType countType = PLYPropertyType::None; //!< None indicates this is not a list type, otherwise it's the type for the list count.
|
||||
uint32_t offset = 0; //!< Byte offset from the start of the row.
|
||||
uint32_t stride = 0;
|
||||
|
||||
std::vector<uint8_t> listData;
|
||||
std::vector<uint32_t> rowCount; // Entry `i` is the number of items (*not* the number of bytes) in row `i`.
|
||||
};
|
||||
|
||||
|
||||
struct PLYElement {
|
||||
std::string name; //!< Name of this element.
|
||||
std::vector<PLYProperty> properties;
|
||||
uint32_t count = 0; //!< The number of items in this element (e.g. the number of vertices if this is the vertex element).
|
||||
bool fixedSize = true; //!< `true` if there are only fixed-size properties in this element, i.e. no list properties.
|
||||
uint32_t rowStride = 0; //!< The number of bytes from the start of one row to the start of the next, for this element.
|
||||
|
||||
void calculate_offsets();
|
||||
|
||||
/// Returns the index for the named property in this element, or `kInvalidIndex`
|
||||
/// if it can't be found.
|
||||
uint32_t find_property(const char* propName) const;
|
||||
|
||||
/// Return the indices for several properties in one go. Use it like this:
|
||||
/// ```
|
||||
/// uint32_t indexes[3];
|
||||
/// if (elem.find_properties(indexes, 3, "foo", "bar", "baz")) { ... }
|
||||
/// ```
|
||||
/// `propIdxs` is where the property indexes will be stored. `numIdxs` is
|
||||
/// the number of properties we will look up. There must be exactly
|
||||
/// `numIdxs` parameters after `numIdxs`; each of the is a c-style string
|
||||
/// giving the name of a property.
|
||||
///
|
||||
/// The return value will be true if all properties were found. If it was
|
||||
/// not true, you should not use any values from propIdxs.
|
||||
bool find_properties(uint32_t propIdxs[], uint32_t numIdxs, ...) const;
|
||||
|
||||
/// Same as `find_properties`, for when you already have a `va_list`. This
|
||||
/// is called internally by both `PLYElement::find_properties` and
|
||||
/// `PLYReader::find_properties`.
|
||||
bool find_properties_va(uint32_t propIdxs[], uint32_t numIdxs, va_list names) const;
|
||||
|
||||
/// Call this on the element at some point before you load its data, when
|
||||
/// you know that every row's list will have the same length. It will
|
||||
/// replace the single variable-size property with a set of new fixed-size
|
||||
/// properties: one for the list count, followed by one for each of the
|
||||
/// list values. This will allow miniply to load and extract the property
|
||||
/// data a lot more efficiently, giving a big performance increase.
|
||||
///
|
||||
/// After you've called this, you must use PLYReader's `extract_columns`
|
||||
/// method to get the data, rather than `extract_list_column`.
|
||||
///
|
||||
/// The `newPropIdxs` parameter must be an array with at least `listSize`
|
||||
/// entries. If the function returns true, this will have been populated
|
||||
/// with the indices of the new properties that represent the list values
|
||||
/// (i.e. not including the list count property, which will have the same
|
||||
/// index as the old list property).
|
||||
///
|
||||
/// The function returns false if the property index is invalid, or the
|
||||
/// property it refers to is not a list property. In these cases it will
|
||||
/// not modify anything. Otherwise it will return true.
|
||||
bool convert_list_to_fixed_size(uint32_t listPropIdx, uint32_t listSize, uint32_t newPropIdxs[]);
|
||||
};
|
||||
|
||||
|
||||
class PLYReader {
|
||||
public:
|
||||
PLYReader(const char* filename);
|
||||
~PLYReader();
|
||||
|
||||
bool valid() const;
|
||||
bool has_element() const;
|
||||
const PLYElement* element() const;
|
||||
bool load_element();
|
||||
void next_element();
|
||||
|
||||
PLYFileType file_type() const;
|
||||
int version_major() const;
|
||||
int version_minor() const;
|
||||
uint32_t num_elements() const;
|
||||
uint32_t find_element(const char* name) const;
|
||||
PLYElement* get_element(uint32_t idx);
|
||||
|
||||
/// Check whether the current element has the given name.
|
||||
bool element_is(const char* name) const;
|
||||
|
||||
/// Number of rows in the current element.
|
||||
uint32_t num_rows() const;
|
||||
|
||||
/// Returns the index for the named property in the current element, or
|
||||
/// `kInvalidIndex` if it can't be found.
|
||||
uint32_t find_property(const char* name) const;
|
||||
|
||||
/// Equivalent to calling `find_properties` on the current element.
|
||||
bool find_properties(uint32_t propIdxs[], uint32_t numIdxs, ...) const;
|
||||
|
||||
/// Copy the data for the specified properties into `dest`, which must be
|
||||
/// an array with at least enough space to hold all of the extracted column
|
||||
/// data. `propIdxs` is an array containing the indexes of the properties
|
||||
/// to copy; it has `numProps` elements.
|
||||
///
|
||||
/// `destType` specifies the data type for values stored in `dest`. All
|
||||
/// property values will be converted to this type if necessary.
|
||||
///
|
||||
/// This function does some checks up front to pick the most efficient code
|
||||
/// path for extracting the data. It considers:
|
||||
/// (a) whether any data conversion is required.
|
||||
/// (b) whether all property values to be extracted are in contiguous
|
||||
/// memory locations for any given item.
|
||||
/// (c) whether the data for all rows is contiguous in memory.
|
||||
/// In the best case it reduces to a single memcpy call. In the worst case
|
||||
/// we must iterate over all values to be copied, applying type conversions
|
||||
/// as we go.
|
||||
///
|
||||
/// Note that this function does not handle list-valued properties. Use
|
||||
/// `extract_list_column()` for those instead.
|
||||
bool extract_properties(const uint32_t propIdxs[], uint32_t numProps, PLYPropertyType destType, void* dest) const;
|
||||
|
||||
/// The same as `extract_properties`, but does not require rows in the
|
||||
/// destination to be contiguous: `destStride` is the number of bytes
|
||||
/// between the start of one row and the start of the next row in the
|
||||
/// destination memory.
|
||||
///
|
||||
/// This is useful for when your destination is an array of structs where
|
||||
/// you cannot extract all of the properties with a single
|
||||
/// `extract_properties` call, e.g. when not all of the struct members
|
||||
/// have the same type, or when the data you're extracting is only a
|
||||
/// subset of the columns in each destination row.
|
||||
///
|
||||
/// This is a tiny bit slower than `extract_properties`. Wherever possible
|
||||
/// you should use `extract_properties` in preference to this method.
|
||||
bool extract_properties_with_stride(const uint32_t propIdxs[], uint32_t numProps, PLYPropertyType destType, void* dest, uint32_t destStride) const;
|
||||
|
||||
/// Get the array of item counts for a list property. Entry `i` in this
|
||||
/// array is the number of items in the `i`th list.
|
||||
const uint32_t* get_list_counts(uint32_t propIdx) const;
|
||||
|
||||
/// Get the sum of all item counts for a list property. This can be useful
|
||||
/// to determine how big a destination array you'll need for a call to
|
||||
/// `extract_list_property`. It's equivalent to summing up all the values
|
||||
/// in the array returned by `get_list_counts`, but faster.
|
||||
uint32_t sum_of_list_counts(uint32_t propIdx) const;
|
||||
|
||||
const uint8_t* get_list_data(uint32_t propIdx) const;
|
||||
bool extract_list_property(uint32_t propIdx, PLYPropertyType destType, void* dest) const;
|
||||
|
||||
uint32_t num_triangles(uint32_t propIdx) const;
|
||||
bool requires_triangulation(uint32_t propIdx) const;
|
||||
bool extract_triangles(uint32_t propIdx, const float pos[], uint32_t numVerts, PLYPropertyType destType, void* dest) const;
|
||||
|
||||
bool find_pos(uint32_t propIdxs[3]) const;
|
||||
bool find_normal(uint32_t propIdxs[3]) const;
|
||||
bool find_texcoord(uint32_t propIdxs[2]) const;
|
||||
bool find_color(uint32_t propIdxs[3]) const;
|
||||
bool find_indices(uint32_t propIdxs[1]) const;
|
||||
|
||||
private:
|
||||
bool refill_buffer();
|
||||
bool rewind_to_safe_char();
|
||||
bool accept();
|
||||
bool advance();
|
||||
bool next_line();
|
||||
bool match(const char* str);
|
||||
bool which(const char* values[], uint32_t* index);
|
||||
bool which_property_type(PLYPropertyType* type);
|
||||
bool keyword(const char* kw);
|
||||
bool identifier(char* dest, size_t destLen);
|
||||
|
||||
template <class T> // T must be a type compatible with uint32_t.
|
||||
bool typed_which(const char* values[], T* index) {
|
||||
return which(values, reinterpret_cast<uint32_t*>(index));
|
||||
}
|
||||
|
||||
bool int_literal(int* value);
|
||||
bool float_literal(float* value);
|
||||
bool double_literal(double* value);
|
||||
|
||||
bool parse_elements();
|
||||
bool parse_element();
|
||||
bool parse_property(std::vector<PLYProperty>& properties);
|
||||
|
||||
bool load_fixed_size_element(PLYElement& elem);
|
||||
bool load_variable_size_element(PLYElement& elem);
|
||||
|
||||
bool load_ascii_scalar_property(PLYProperty& prop, size_t& destIndex);
|
||||
bool load_ascii_list_property(PLYProperty& prop);
|
||||
bool load_binary_scalar_property(PLYProperty& prop, size_t& destIndex);
|
||||
bool load_binary_list_property(PLYProperty& prop);
|
||||
bool load_binary_scalar_property_big_endian(PLYProperty& prop, size_t& destIndex);
|
||||
bool load_binary_list_property_big_endian(PLYProperty& prop);
|
||||
|
||||
bool ascii_value(PLYPropertyType propType, uint8_t value[8]);
|
||||
|
||||
private:
|
||||
FILE* m_f = nullptr;
|
||||
char* m_buf = nullptr;
|
||||
const char* m_bufEnd = nullptr;
|
||||
const char* m_pos = nullptr;
|
||||
const char* m_end = nullptr;
|
||||
bool m_inDataSection = false;
|
||||
bool m_atEOF = false;
|
||||
int64_t m_bufOffset = 0;
|
||||
|
||||
bool m_valid = false;
|
||||
|
||||
PLYFileType m_fileType = PLYFileType::ASCII; //!< Whether the file was ascii, binary little-endian, or binary big-endian.
|
||||
int m_majorVersion = 0;
|
||||
int m_minorVersion = 0;
|
||||
std::vector<PLYElement> m_elements; //!< Element descriptors for this file.
|
||||
|
||||
size_t m_currentElement = 0;
|
||||
bool m_elementLoaded = false;
|
||||
std::vector<uint8_t> m_elementData;
|
||||
|
||||
char* m_tmpBuf = nullptr;
|
||||
};
|
||||
|
||||
|
||||
/// Given a polygon with `n` vertices, where `n` > 3, triangulate it and
|
||||
/// store the indices for the resulting triangles in `dst`. The `pos`
|
||||
/// parameter is the array of all vertex positions for the mesh; `indices` is
|
||||
/// the list of `n` indices for the polygon we're triangulating; and `dst` is
|
||||
/// where we write the new indices to.
|
||||
///
|
||||
/// The triangulation will always produce `n - 2` triangles, so `dst` must
|
||||
/// have enough space for `3 * (n - 2)` indices.
|
||||
///
|
||||
/// If `n == 3`, we simply copy the input indices to `dst`. If `n < 3`,
|
||||
/// nothing gets written to dst.
|
||||
///
|
||||
/// The return value is the number of triangles.
|
||||
uint32_t triangulate_polygon(uint32_t n, const float pos[], uint32_t numVerts, const int indices[], int dst[]);
|
||||
|
||||
} // namespace miniply
|
||||
|
||||
#endif // MINIPLY_H
|
||||
+38
-38
@@ -1,15 +1,15 @@
|
||||
/**
|
||||
* pugixml parser - version 1.11
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at https://pugixml.org/
|
||||
*
|
||||
* This library is distributed under the MIT License. See notice at the end
|
||||
* of this file.
|
||||
*
|
||||
* This work is based on the pugxml parser, which is:
|
||||
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
|
||||
*/
|
||||
* pugixml parser - version 1.15
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2025, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at https://pugixml.org/
|
||||
*
|
||||
* This library is distributed under the MIT License. See notice at the end
|
||||
* of this file.
|
||||
*
|
||||
* This work is based on the pugxml parser, which is:
|
||||
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
|
||||
*/
|
||||
|
||||
#ifndef HEADER_PUGICONFIG_HPP
|
||||
#define HEADER_PUGICONFIG_HPP
|
||||
@@ -46,35 +46,35 @@
|
||||
// Uncomment this to switch to header-only version
|
||||
// #define PUGIXML_HEADER_ONLY
|
||||
|
||||
// Uncomment this to enable long long support
|
||||
// Uncomment this to enable long long support (usually enabled automatically)
|
||||
// #define PUGIXML_HAS_LONG_LONG
|
||||
|
||||
// Uncomment this to enable support for std::string_view (usually enabled automatically)
|
||||
// #define PUGIXML_HAS_STRING_VIEW
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2020 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
* Copyright (c) 2006-2025 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
+9831
-9297
File diff suppressed because it is too large
Load Diff
+204
-119
@@ -1,20 +1,20 @@
|
||||
/**
|
||||
* pugixml parser - version 1.11
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at https://pugixml.org/
|
||||
*
|
||||
* This library is distributed under the MIT License. See notice at the end
|
||||
* of this file.
|
||||
*
|
||||
* This work is based on the pugxml parser, which is:
|
||||
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
|
||||
*/
|
||||
* pugixml parser - version 1.15
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2025, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at https://pugixml.org/
|
||||
*
|
||||
* This library is distributed under the MIT License. See notice at the end
|
||||
* of this file.
|
||||
*
|
||||
* This work is based on the pugxml parser, which is:
|
||||
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
|
||||
*/
|
||||
|
||||
#ifndef PUGIXML_VERSION
|
||||
// Define version macro; evaluates to major * 1000 + minor * 10 + patch so that it's safe to use in less-than comparisons
|
||||
// Note: pugixml used major * 100 + minor * 10 + patch format up until 1.9 (which had version identifier 190); starting from pugixml 1.10, the minor version number is two digits
|
||||
# define PUGIXML_VERSION 1110
|
||||
#ifndef PUGIXML_VERSION
|
||||
# define PUGIXML_VERSION 1150 // 1.15
|
||||
#endif
|
||||
|
||||
// Include user configuration file (this can define various configuration macros)
|
||||
@@ -38,6 +38,20 @@
|
||||
# include <string>
|
||||
#endif
|
||||
|
||||
// Check if std::string_view is available
|
||||
#if !defined(PUGIXML_HAS_STRING_VIEW) && !defined(PUGIXML_NO_STL)
|
||||
# if __cplusplus >= 201703L
|
||||
# define PUGIXML_HAS_STRING_VIEW
|
||||
# elif defined(_MSVC_LANG) && _MSVC_LANG >= 201703L
|
||||
# define PUGIXML_HAS_STRING_VIEW
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Include string_view if appropriate
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
# include <string_view>
|
||||
#endif
|
||||
|
||||
// Macro for deprecated features
|
||||
#ifndef PUGIXML_DEPRECATED
|
||||
# if defined(__GNUC__)
|
||||
@@ -82,14 +96,14 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// If C++ is 2011 or higher, add 'noexcept' specifiers
|
||||
// If C++ is 2011 or higher, use 'noexcept' specifiers
|
||||
#ifndef PUGIXML_NOEXCEPT
|
||||
# if __cplusplus >= 201103
|
||||
# define PUGIXML_NOEXCEPT noexcept
|
||||
# elif defined(_MSC_VER) && _MSC_VER >= 1900
|
||||
# define PUGIXML_NOEXCEPT noexcept
|
||||
# else
|
||||
# define PUGIXML_NOEXCEPT
|
||||
# define PUGIXML_NOEXCEPT throw()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -115,6 +129,8 @@
|
||||
#ifndef PUGIXML_NULL
|
||||
# if __cplusplus >= 201103
|
||||
# define PUGIXML_NULL nullptr
|
||||
# elif defined(_MSC_VER) && _MSC_VER >= 1600
|
||||
# define PUGIXML_NULL nullptr
|
||||
# else
|
||||
# define PUGIXML_NULL 0
|
||||
# endif
|
||||
@@ -136,7 +152,12 @@ namespace pugi
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// String type used for operations that work with STL string; depends on PUGIXML_WCHAR_MODE
|
||||
typedef std::basic_string<PUGIXML_CHAR, std::char_traits<PUGIXML_CHAR>, std::allocator<PUGIXML_CHAR> > string_t;
|
||||
typedef std::basic_string<PUGIXML_CHAR> string_t;
|
||||
#endif
|
||||
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
// String view type used for operations that can work with a length delimited string; depends on PUGIXML_WCHAR_MODE
|
||||
typedef std::basic_string_view<PUGIXML_CHAR> string_view_t;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -211,6 +232,10 @@ namespace pugi
|
||||
// This flag is off by default.
|
||||
const unsigned int parse_embed_pcdata = 0x2000;
|
||||
|
||||
// This flag determines whether determines whether the the two pcdata should be merged or not, if no intermediatory data are parsed in the document.
|
||||
// This flag is off by default.
|
||||
const unsigned int parse_merge_pcdata = 0x4000;
|
||||
|
||||
// The default parsing mode.
|
||||
// Elements, PCDATA and CDATA sections are added to the DOM tree, character/reference entities are expanded,
|
||||
// End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
|
||||
@@ -291,12 +316,12 @@ namespace pugi
|
||||
|
||||
class xml_text;
|
||||
|
||||
#ifndef PUGIXML_NO_XPATH
|
||||
#ifndef PUGIXML_NO_XPATH
|
||||
class xpath_node;
|
||||
class xpath_node_set;
|
||||
class xpath_query;
|
||||
class xpath_variable_set;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Range-based for loop support
|
||||
template <typename It> class xml_object_range
|
||||
@@ -312,6 +337,8 @@ namespace pugi
|
||||
It begin() const { return _begin; }
|
||||
It end() const { return _end; }
|
||||
|
||||
bool empty() const { return _begin == _end; }
|
||||
|
||||
private:
|
||||
It _begin, _end;
|
||||
};
|
||||
@@ -320,7 +347,7 @@ namespace pugi
|
||||
class PUGIXML_CLASS xml_writer
|
||||
{
|
||||
public:
|
||||
virtual ~xml_writer() {}
|
||||
virtual ~xml_writer();
|
||||
|
||||
// Write memory chunk into stream/file/whatever
|
||||
virtual void write(const void* data, size_t size) = 0;
|
||||
@@ -339,22 +366,22 @@ namespace pugi
|
||||
void* file;
|
||||
};
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// xml_writer implementation for streams
|
||||
class PUGIXML_CLASS xml_writer_stream: public xml_writer
|
||||
{
|
||||
public:
|
||||
// Construct writer from an output stream object
|
||||
xml_writer_stream(std::basic_ostream<char, std::char_traits<char> >& stream);
|
||||
xml_writer_stream(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream);
|
||||
xml_writer_stream(std::basic_ostream<char>& stream);
|
||||
xml_writer_stream(std::basic_ostream<wchar_t>& stream);
|
||||
|
||||
virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE;
|
||||
|
||||
private:
|
||||
std::basic_ostream<char, std::char_traits<char> >* narrow_stream;
|
||||
std::basic_ostream<wchar_t, std::char_traits<wchar_t> >* wide_stream;
|
||||
std::basic_ostream<char>* narrow_stream;
|
||||
std::basic_ostream<wchar_t>* wide_stream;
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// A light-weight handle for manipulating attributes in DOM tree
|
||||
class PUGIXML_CLASS xml_attribute
|
||||
@@ -388,7 +415,7 @@ namespace pugi
|
||||
bool operator<=(const xml_attribute& r) const;
|
||||
bool operator>=(const xml_attribute& r) const;
|
||||
|
||||
// Check if attribute is empty
|
||||
// Check if attribute is empty (null)
|
||||
bool empty() const;
|
||||
|
||||
// Get attribute name/value, or "" if attribute is empty
|
||||
@@ -404,17 +431,25 @@ namespace pugi
|
||||
double as_double(double def = 0) const;
|
||||
float as_float(float def = 0) const;
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
long long as_llong(long long def = 0) const;
|
||||
unsigned long long as_ullong(unsigned long long def = 0) const;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Get attribute value as bool (returns true if first character is in '1tTyY' set), or the default value if attribute is empty
|
||||
bool as_bool(bool def = false) const;
|
||||
|
||||
// Set attribute name/value (returns false if attribute is empty or there is not enough memory)
|
||||
bool set_name(const char_t* rhs);
|
||||
bool set_name(const char_t* rhs, size_t size);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
bool set_name(string_view_t rhs);
|
||||
#endif
|
||||
bool set_value(const char_t* rhs);
|
||||
bool set_value(const char_t* rhs, size_t size);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
bool set_value(string_view_t rhs);
|
||||
#endif
|
||||
|
||||
// Set attribute value with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
|
||||
bool set_value(int rhs);
|
||||
@@ -427,10 +462,10 @@ namespace pugi
|
||||
bool set_value(float rhs, int precision);
|
||||
bool set_value(bool rhs);
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
bool set_value(long long rhs);
|
||||
bool set_value(unsigned long long rhs);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Set attribute value (equivalent to set_value without error checking)
|
||||
xml_attribute& operator=(const char_t* rhs);
|
||||
@@ -442,10 +477,14 @@ namespace pugi
|
||||
xml_attribute& operator=(float rhs);
|
||||
xml_attribute& operator=(bool rhs);
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
xml_attribute& operator=(string_view_t rhs);
|
||||
#endif
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
xml_attribute& operator=(long long rhs);
|
||||
xml_attribute& operator=(unsigned long long rhs);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Get next/previous attribute in the attribute list of the parent node
|
||||
xml_attribute next_attribute() const;
|
||||
@@ -497,7 +536,7 @@ namespace pugi
|
||||
bool operator<=(const xml_node& r) const;
|
||||
bool operator>=(const xml_node& r) const;
|
||||
|
||||
// Check if node is empty.
|
||||
// Check if node is empty (null)
|
||||
bool empty() const;
|
||||
|
||||
// Get node type
|
||||
@@ -536,9 +575,18 @@ namespace pugi
|
||||
xml_attribute attribute(const char_t* name) const;
|
||||
xml_node next_sibling(const char_t* name) const;
|
||||
xml_node previous_sibling(const char_t* name) const;
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
xml_node child(string_view_t name) const;
|
||||
xml_attribute attribute(string_view_t name) const;
|
||||
xml_node next_sibling(string_view_t name) const;
|
||||
xml_node previous_sibling(string_view_t name) const;
|
||||
#endif
|
||||
|
||||
// Get attribute, starting the search from a hint (and updating hint so that searching for a sequence of attributes is fast)
|
||||
xml_attribute attribute(const char_t* name, xml_attribute& hint) const;
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
xml_attribute attribute(string_view_t name, xml_attribute& hint) const;
|
||||
#endif
|
||||
|
||||
// Get child value of current node; that is, value of the first child node of type PCDATA/CDATA
|
||||
const char_t* child_value() const;
|
||||
@@ -548,13 +596,27 @@ namespace pugi
|
||||
|
||||
// Set node name/value (returns false if node is empty, there is not enough memory, or node can not have name/value)
|
||||
bool set_name(const char_t* rhs);
|
||||
bool set_name(const char_t* rhs, size_t size);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
bool set_name(string_view_t rhs);
|
||||
#endif
|
||||
bool set_value(const char_t* rhs);
|
||||
bool set_value(const char_t* rhs, size_t size);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
bool set_value(string_view_t rhs);
|
||||
#endif
|
||||
|
||||
// Add attribute with specified name. Returns added attribute, or empty attribute on errors.
|
||||
xml_attribute append_attribute(const char_t* name);
|
||||
xml_attribute prepend_attribute(const char_t* name);
|
||||
xml_attribute insert_attribute_after(const char_t* name, const xml_attribute& attr);
|
||||
xml_attribute insert_attribute_before(const char_t* name, const xml_attribute& attr);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
xml_attribute append_attribute(string_view_t name);
|
||||
xml_attribute prepend_attribute(string_view_t name);
|
||||
xml_attribute insert_attribute_after(string_view_t name, const xml_attribute& attr);
|
||||
xml_attribute insert_attribute_before(string_view_t name, const xml_attribute& attr);
|
||||
#endif
|
||||
|
||||
// Add a copy of the specified attribute. Returns added attribute, or empty attribute on errors.
|
||||
xml_attribute append_copy(const xml_attribute& proto);
|
||||
@@ -573,6 +635,12 @@ namespace pugi
|
||||
xml_node prepend_child(const char_t* name);
|
||||
xml_node insert_child_after(const char_t* name, const xml_node& node);
|
||||
xml_node insert_child_before(const char_t* name, const xml_node& node);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
xml_node append_child(string_view_t name);
|
||||
xml_node prepend_child(string_view_t name);
|
||||
xml_node insert_child_after(string_view_t, const xml_node& node);
|
||||
xml_node insert_child_before(string_view_t name, const xml_node& node);
|
||||
#endif
|
||||
|
||||
// Add a copy of the specified node as a child. Returns added node, or empty node on errors.
|
||||
xml_node append_copy(const xml_node& proto);
|
||||
@@ -589,6 +657,9 @@ namespace pugi
|
||||
// Remove specified attribute
|
||||
bool remove_attribute(const xml_attribute& a);
|
||||
bool remove_attribute(const char_t* name);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
bool remove_attribute(string_view_t name);
|
||||
#endif
|
||||
|
||||
// Remove all attributes
|
||||
bool remove_attributes();
|
||||
@@ -596,6 +667,9 @@ namespace pugi
|
||||
// Remove specified child
|
||||
bool remove_child(const xml_node& n);
|
||||
bool remove_child(const char_t* name);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
bool remove_child(string_view_t name);
|
||||
#endif
|
||||
|
||||
// Remove all children
|
||||
bool remove_children();
|
||||
@@ -657,10 +731,10 @@ namespace pugi
|
||||
xml_node find_child_by_attribute(const char_t* name, const char_t* attr_name, const char_t* attr_value) const;
|
||||
xml_node find_child_by_attribute(const char_t* attr_name, const char_t* attr_value) const;
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// Get the absolute node path from root as a text string.
|
||||
string_t path(char_t delimiter = '/') const;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Search for a node by path consisting of node names and . or .. elements.
|
||||
xml_node first_element_by_path(const char_t* path, char_t delimiter = '/') const;
|
||||
@@ -668,7 +742,7 @@ namespace pugi
|
||||
// Recursively traverse subtree with xml_tree_walker
|
||||
bool traverse(xml_tree_walker& walker);
|
||||
|
||||
#ifndef PUGIXML_NO_XPATH
|
||||
#ifndef PUGIXML_NO_XPATH
|
||||
// Select single node by evaluating XPath query. Returns first node from the resulting node set.
|
||||
xpath_node select_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
|
||||
xpath_node select_node(const xpath_query& query) const;
|
||||
@@ -681,16 +755,16 @@ namespace pugi
|
||||
PUGIXML_DEPRECATED xpath_node select_single_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
|
||||
PUGIXML_DEPRECATED xpath_node select_single_node(const xpath_query& query) const;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Print subtree using a writer object
|
||||
void print(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// Print subtree to stream
|
||||
void print(std::basic_ostream<char, std::char_traits<char> >& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
|
||||
void print(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, unsigned int depth = 0) const;
|
||||
#endif
|
||||
void print(std::basic_ostream<char>& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
|
||||
void print(std::basic_ostream<wchar_t>& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, unsigned int depth = 0) const;
|
||||
#endif
|
||||
|
||||
// Child nodes iterators
|
||||
typedef xml_node_iterator iterator;
|
||||
@@ -706,9 +780,12 @@ namespace pugi
|
||||
|
||||
// Range-based for support
|
||||
xml_object_range<xml_node_iterator> children() const;
|
||||
xml_object_range<xml_named_node_iterator> children(const char_t* name) const;
|
||||
xml_object_range<xml_attribute_iterator> attributes() const;
|
||||
|
||||
// Range-based for support for all children with the specified name
|
||||
// Note: name pointer must have a longer lifetime than the returned object; be careful with passing temporaries!
|
||||
xml_object_range<xml_named_node_iterator> children(const char_t* name) const;
|
||||
|
||||
// Get node offset in parsed file/string (in char_t units) for debugging purposes
|
||||
ptrdiff_t offset_debug() const;
|
||||
|
||||
@@ -749,7 +826,7 @@ namespace pugi
|
||||
// Borland C++ workaround
|
||||
bool operator!() const;
|
||||
|
||||
// Check if text object is empty
|
||||
// Check if text object is empty (null)
|
||||
bool empty() const;
|
||||
|
||||
// Get text, or "" if object is empty
|
||||
@@ -764,16 +841,20 @@ namespace pugi
|
||||
double as_double(double def = 0) const;
|
||||
float as_float(float def = 0) const;
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
long long as_llong(long long def = 0) const;
|
||||
unsigned long long as_ullong(unsigned long long def = 0) const;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Get text as bool (returns true if first character is in '1tTyY' set), or the default value if object is empty
|
||||
bool as_bool(bool def = false) const;
|
||||
|
||||
// Set text (returns false if object is empty or there is not enough memory)
|
||||
bool set(const char_t* rhs);
|
||||
bool set(const char_t* rhs, size_t size);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
bool set(string_view_t rhs);
|
||||
#endif
|
||||
|
||||
// Set text with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
|
||||
bool set(int rhs);
|
||||
@@ -786,10 +867,10 @@ namespace pugi
|
||||
bool set(float rhs, int precision);
|
||||
bool set(bool rhs);
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
bool set(long long rhs);
|
||||
bool set(unsigned long long rhs);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Set text (equivalent to set without error checking)
|
||||
xml_text& operator=(const char_t* rhs);
|
||||
@@ -801,10 +882,14 @@ namespace pugi
|
||||
xml_text& operator=(float rhs);
|
||||
xml_text& operator=(bool rhs);
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
xml_text& operator=(string_view_t rhs);
|
||||
#endif
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
xml_text& operator=(long long rhs);
|
||||
xml_text& operator=(unsigned long long rhs);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Get the data node (node_pcdata or node_cdata) for this object
|
||||
xml_node data() const;
|
||||
@@ -834,9 +919,9 @@ namespace pugi
|
||||
typedef xml_node* pointer;
|
||||
typedef xml_node& reference;
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Default constructor
|
||||
xml_node_iterator();
|
||||
@@ -851,10 +936,10 @@ namespace pugi
|
||||
xml_node& operator*() const;
|
||||
xml_node* operator->() const;
|
||||
|
||||
const xml_node_iterator& operator++();
|
||||
xml_node_iterator& operator++();
|
||||
xml_node_iterator operator++(int);
|
||||
|
||||
const xml_node_iterator& operator--();
|
||||
xml_node_iterator& operator--();
|
||||
xml_node_iterator operator--(int);
|
||||
};
|
||||
|
||||
@@ -876,9 +961,9 @@ namespace pugi
|
||||
typedef xml_attribute* pointer;
|
||||
typedef xml_attribute& reference;
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Default constructor
|
||||
xml_attribute_iterator();
|
||||
@@ -893,10 +978,10 @@ namespace pugi
|
||||
xml_attribute& operator*() const;
|
||||
xml_attribute* operator->() const;
|
||||
|
||||
const xml_attribute_iterator& operator++();
|
||||
xml_attribute_iterator& operator++();
|
||||
xml_attribute_iterator operator++(int);
|
||||
|
||||
const xml_attribute_iterator& operator--();
|
||||
xml_attribute_iterator& operator--();
|
||||
xml_attribute_iterator operator--(int);
|
||||
};
|
||||
|
||||
@@ -912,14 +997,15 @@ namespace pugi
|
||||
typedef xml_node* pointer;
|
||||
typedef xml_node& reference;
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Default constructor
|
||||
xml_named_node_iterator();
|
||||
|
||||
// Construct an iterator which points to the specified node
|
||||
// Note: name pointer is stored in the iterator and must have a longer lifetime than iterator itself
|
||||
xml_named_node_iterator(const xml_node& node, const char_t* name);
|
||||
|
||||
// Iterator operators
|
||||
@@ -929,10 +1015,10 @@ namespace pugi
|
||||
xml_node& operator*() const;
|
||||
xml_node* operator->() const;
|
||||
|
||||
const xml_named_node_iterator& operator++();
|
||||
xml_named_node_iterator& operator++();
|
||||
xml_named_node_iterator operator++(int);
|
||||
|
||||
const xml_named_node_iterator& operator--();
|
||||
xml_named_node_iterator& operator--();
|
||||
xml_named_node_iterator operator--(int);
|
||||
|
||||
private:
|
||||
@@ -1041,11 +1127,11 @@ namespace pugi
|
||||
// Destructor, invalidates all node/attribute handles to this document
|
||||
~xml_document();
|
||||
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
// Move semantics support
|
||||
xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
|
||||
xml_document& operator=(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Removes all nodes, leaving the empty document
|
||||
void reset();
|
||||
@@ -1053,11 +1139,11 @@ namespace pugi
|
||||
// Removes all nodes, then copies the entire contents of the specified document
|
||||
void reset(const xml_document& proto);
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// Load document from stream.
|
||||
xml_parse_result load(std::basic_istream<char, std::char_traits<char> >& stream, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
|
||||
xml_parse_result load(std::basic_istream<wchar_t, std::char_traits<wchar_t> >& stream, unsigned int options = parse_default);
|
||||
#endif
|
||||
xml_parse_result load(std::basic_istream<char>& stream, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
|
||||
xml_parse_result load(std::basic_istream<wchar_t>& stream, unsigned int options = parse_default);
|
||||
#endif
|
||||
|
||||
// (deprecated: use load_string instead) Load document from zero-terminated string. No encoding conversions are applied.
|
||||
PUGIXML_DEPRECATED xml_parse_result load(const char_t* contents, unsigned int options = parse_default);
|
||||
@@ -1083,11 +1169,11 @@ namespace pugi
|
||||
// Save XML document to writer (semantics is slightly different from xml_node::print, see documentation for details).
|
||||
void save(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// Save XML document to stream (semantics is slightly different from xml_node::print, see documentation for details).
|
||||
void save(std::basic_ostream<char, std::char_traits<char> >& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
|
||||
void save(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default) const;
|
||||
#endif
|
||||
void save(std::basic_ostream<char>& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
|
||||
void save(std::basic_ostream<wchar_t>& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default) const;
|
||||
#endif
|
||||
|
||||
// Save XML to file
|
||||
bool save_file(const char* path, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
|
||||
@@ -1185,11 +1271,11 @@ namespace pugi
|
||||
xpath_variable_set(const xpath_variable_set& rhs);
|
||||
xpath_variable_set& operator=(const xpath_variable_set& rhs);
|
||||
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
// Move semantics support
|
||||
xpath_variable_set(xpath_variable_set&& rhs) PUGIXML_NOEXCEPT;
|
||||
xpath_variable_set& operator=(xpath_variable_set&& rhs) PUGIXML_NOEXCEPT;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Add a new variable or get the existing one, if the types match
|
||||
xpath_variable* add(const char_t* name, xpath_value_type type);
|
||||
@@ -1229,11 +1315,11 @@ namespace pugi
|
||||
// Destructor
|
||||
~xpath_query();
|
||||
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
// Move semantics support
|
||||
xpath_query(xpath_query&& rhs) PUGIXML_NOEXCEPT;
|
||||
xpath_query& operator=(xpath_query&& rhs) PUGIXML_NOEXCEPT;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Get query expression return type
|
||||
xpath_value_type return_type() const;
|
||||
@@ -1246,11 +1332,11 @@ namespace pugi
|
||||
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
|
||||
double evaluate_number(const xpath_node& n) const;
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// Evaluate expression as string value in the specified context; performs type conversion if necessary.
|
||||
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
|
||||
string_t evaluate_string(const xpath_node& n) const;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Evaluate expression as string value in the specified context; performs type conversion if necessary.
|
||||
// At most capacity characters are written to the destination buffer, full result size is returned (includes terminating zero).
|
||||
@@ -1279,13 +1365,13 @@ namespace pugi
|
||||
bool operator!() const;
|
||||
};
|
||||
|
||||
#ifndef PUGIXML_NO_EXCEPTIONS
|
||||
#if defined(_MSC_VER)
|
||||
// C4275 can be ignored in Visual C++ if you are deriving
|
||||
// from a type in the Standard C++ Library
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4275)
|
||||
#endif
|
||||
#ifndef PUGIXML_NO_EXCEPTIONS
|
||||
#if defined(_MSC_VER)
|
||||
// C4275 can be ignored in Visual C++ if you are deriving
|
||||
// from a type in the Standard C++ Library
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4275)
|
||||
#endif
|
||||
// XPath exception class
|
||||
class PUGIXML_CLASS xpath_exception: public std::exception
|
||||
{
|
||||
@@ -1297,15 +1383,15 @@ namespace pugi
|
||||
explicit xpath_exception(const xpath_parse_result& result);
|
||||
|
||||
// Get error message
|
||||
virtual const char* what() const throw() PUGIXML_OVERRIDE;
|
||||
virtual const char* what() const PUGIXML_NOEXCEPT PUGIXML_OVERRIDE;
|
||||
|
||||
// Get parse result
|
||||
const xpath_parse_result& result() const;
|
||||
};
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// XPath node class (either xml_node or xml_attribute)
|
||||
class PUGIXML_CLASS xpath_node
|
||||
@@ -1379,11 +1465,11 @@ namespace pugi
|
||||
xpath_node_set(const xpath_node_set& ns);
|
||||
xpath_node_set& operator=(const xpath_node_set& ns);
|
||||
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
// Move semantics support
|
||||
xpath_node_set(xpath_node_set&& rhs) PUGIXML_NOEXCEPT;
|
||||
xpath_node_set& operator=(xpath_node_set&& rhs) PUGIXML_NOEXCEPT;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Get collection type
|
||||
type_t type() const;
|
||||
@@ -1422,12 +1508,12 @@ namespace pugi
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// Convert wide string to UTF8
|
||||
std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(const wchar_t* str);
|
||||
std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(const std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >& str);
|
||||
std::basic_string<char> PUGIXML_FUNCTION as_utf8(const wchar_t* str);
|
||||
std::basic_string<char> PUGIXML_FUNCTION as_utf8(const std::basic_string<wchar_t>& str);
|
||||
|
||||
// Convert UTF8 to wide string
|
||||
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(const char* str);
|
||||
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(const std::basic_string<char, std::char_traits<char>, std::allocator<char> >& str);
|
||||
std::basic_string<wchar_t> PUGIXML_FUNCTION as_wide(const char* str);
|
||||
std::basic_string<wchar_t> PUGIXML_FUNCTION as_wide(const std::basic_string<char>& str);
|
||||
#endif
|
||||
|
||||
// Memory allocation function interface; returns pointer to allocated memory or NULL on failure
|
||||
@@ -1474,27 +1560,26 @@ namespace std
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2020 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
* Copyright (c) 2006-2025 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
@@ -31,8 +31,10 @@
|
||||
#pragma comment(lib, EGTLIBDIR "EgtGeneral" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTLIBDIR "EgtNumKernel" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTLIBDIR "EgtGeomKernel" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTLIBDIR "EgtExecutor" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTEXTDIR "/libzip/Lib/zip" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTEXTDIR "/lib3mf/Lib/lib3mf" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTEXTDIR "Lua/Lib/Lua54" EGTLIBVER ".lib")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user