Compare commits
112 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 |
+178
-11
@@ -18,6 +18,7 @@
|
||||
#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"
|
||||
@@ -29,7 +30,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) ;
|
||||
@@ -130,7 +131,10 @@ BeamMgr::SetPartProdNbr( int nProdNbr)
|
||||
// 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) ;
|
||||
}
|
||||
|
||||
@@ -141,7 +145,7 @@ BeamMgr::SetPartName( const string& sName)
|
||||
// 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) ;
|
||||
}
|
||||
|
||||
@@ -152,7 +156,7 @@ BeamMgr::SetPartCount( int nCount)
|
||||
// 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) ;
|
||||
}
|
||||
|
||||
@@ -163,9 +167,12 @@ BeamMgr::SetPartBox( double dLength, double dHeight, double dWidth, bool bUpdate
|
||||
// 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() ;
|
||||
@@ -199,6 +206,157 @@ 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,
|
||||
@@ -218,7 +376,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 ;
|
||||
@@ -455,7 +613,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
|
||||
@@ -553,11 +711,17 @@ 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) {
|
||||
// recupero eventuale superficie originale
|
||||
int nProcSurfId = nProcId ;
|
||||
int nOrigId = 0 ;
|
||||
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_ORIGID, nOrigId))
|
||||
nProcSurfId += nOrigId ;
|
||||
// se da utilizzare anche suerfici ausiliarie
|
||||
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 ( m_pGDB->GetInfo( nProcSurfId, IKEY_AUXID, nAux)) {
|
||||
const ISurfTriMesh* pStmProc = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId)) ;
|
||||
const ISurfTriMesh* pAux = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId + nAux)) ;
|
||||
if ( pStmProc != nullptr && pAux != nullptr) {
|
||||
PtrOwner<ISurfTriMesh> pTrim ;
|
||||
pTrim.Set( pAux->Clone()) ;
|
||||
@@ -570,8 +734,9 @@ BeamMgr::CalcSolid( int nPartId, bool bRecalc)
|
||||
}
|
||||
}
|
||||
}
|
||||
// caso standard
|
||||
else {
|
||||
const ISurfTriMesh* pStmProc = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcId)) ;
|
||||
const ISurfTriMesh* pStmProc = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId)) ;
|
||||
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pStmProc, dStep)) ;
|
||||
if ( ! IsNull( pStmTmp))
|
||||
pStmProc = Get( pStmTmp) ;
|
||||
@@ -618,6 +783,8 @@ 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 ;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 ;
|
||||
@@ -49,6 +51,8 @@ class BeamMgr : public IBeamMgr
|
||||
BeamMgr( void) ;
|
||||
|
||||
private :
|
||||
bool UpdateFacesName( void) ;
|
||||
bool UpdateLoadingSide( void) ;
|
||||
|
||||
private :
|
||||
IGeomDB* m_pGDB ;
|
||||
|
||||
+78
-3
@@ -42,7 +42,7 @@ BtlGeom::BtlGeom( void)
|
||||
m_BoxCol = Color( 255, 128, 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 ;
|
||||
@@ -272,7 +272,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 +302,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 +323,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
|
||||
@@ -797,6 +833,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)
|
||||
|
||||
@@ -36,16 +36,17 @@ 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 AdjustPartFlatOrVertPos( void) ;
|
||||
@@ -53,6 +54,7 @@ class BtlGeom
|
||||
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 +129,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 +144,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 +176,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) ;
|
||||
@@ -219,7 +222,7 @@ class BtlGeom
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
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,
|
||||
@@ -253,7 +256,7 @@ 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) ;
|
||||
|
||||
|
||||
@@ -26,12 +26,15 @@ 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" ;
|
||||
@@ -40,11 +43,13 @@ 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 +85,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 ;
|
||||
|
||||
+77
-33
@@ -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,17 @@ BtlGeom::UpdateOutLine( void)
|
||||
// taglio con tutte le features
|
||||
TrimOutlineWithProcesses() ;
|
||||
|
||||
// se presente Shape, nascondo Outline
|
||||
int nShapeId = m_pGDB->GetFirstNameInGroup( m_nOutsId, OL_SHAPE_NAME) ;
|
||||
if ( nShapeId != GDB_ID_NULL) {
|
||||
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 +573,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 +762,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 +787,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 ;
|
||||
@@ -1130,7 +1146,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 +1157,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 +1226,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 +1237,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 +1370,28 @@ 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) {
|
||||
@@ -1368,26 +1405,33 @@ BtlGeom::AddShapeBTLX( const INTMATRIX& vFacesVertices, const PNTVECTOR& vPoints
|
||||
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 ;
|
||||
}
|
||||
PtrOwner<ISurfTriMesh> pSurf( GetSurfTriMeshByFlatContour( pCurveCompo)) ;
|
||||
if ( ! IsNull( pSurf)) {
|
||||
// recupero tutti i triangoli
|
||||
Triangle3d Tria ;
|
||||
int nT = pSurf->GetFirstTriangle( Tria) ;
|
||||
while ( nT != SVT_NULL) {
|
||||
// inserisco il triangolo nella nuova superficie
|
||||
StmFts.AddTriangle( Tria) ;
|
||||
// passo al triangolo successivo
|
||||
nT = pSurf->GetNextTriangle( nT, Tria) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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_nPartId + 3, Release( pShape)) ; // salvo in outline
|
||||
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_ON) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
+294
-145
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.
+94
-13
@@ -22,7 +22,7 @@
|
||||
<ProjectGuid>{80FCBEA4-1883-4542-939D-8582E66D8D51}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>EgtExchange</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
@@ -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>stdcpp17</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>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
||||
<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>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -191,13 +191,12 @@ 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>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
||||
</ClCompile>
|
||||
@@ -217,19 +216,101 @@ 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\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" />
|
||||
|
||||
@@ -129,6 +129,252 @@
|
||||
<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>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
+114
-55
@@ -28,14 +28,17 @@
|
||||
#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 +49,7 @@ bool
|
||||
Export3MF::SetOptions( int nFilter)
|
||||
{
|
||||
m_nFilter = nFilter ;
|
||||
CalcGroupFilter() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -65,7 +69,7 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// libreria 3MF
|
||||
// libreria 3MF
|
||||
m_wrapper = CWrapper::loadLibrary() ;
|
||||
if ( ! m_wrapper) {
|
||||
LOG_ERROR( GetEExLogger(), "Export3MF : Error on lib3mf Wrapper")
|
||||
@@ -87,6 +91,17 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
pIter->GoTo( nId) ;
|
||||
|
||||
// assegno le info dell'oggetto al modello
|
||||
PMetaDataGroup metaDataGrp = m_model->GetMetaDataGroup() ;
|
||||
STRVECTOR vInfo ;
|
||||
pIter->GetAllInfo( vInfo) ;
|
||||
for ( const string& sInfo : vInfo) {
|
||||
string sKey, sVal ;
|
||||
SplitFirst( sInfo, "=", sKey, sVal) ;
|
||||
metaDataGrp->AddMetaData( sInfoNamespace, sKey, sVal, "xs:string", 0) ;
|
||||
}
|
||||
|
||||
// esporto l'oggetto e i suoi eventuali figli
|
||||
if ( ! ExportObject( *pIter))
|
||||
return false ;
|
||||
@@ -110,77 +125,83 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
||||
bool
|
||||
Export3MF::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 ;
|
||||
// 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 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 ( 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 eventuale nome
|
||||
string sName ;
|
||||
if ( ! iIter.GetName( sName))
|
||||
sName = ToString( iIter.GetId()) ;
|
||||
// recupero il colore
|
||||
// recupero il colore
|
||||
Color cCol ;
|
||||
bool bCol = GetColor( cCol, iIter.GetGDB(), iIter.GetId()) ;
|
||||
// recupero le proprietà
|
||||
STRVECTOR vInfo ;
|
||||
iIter.GetAllInfo( vInfo) ;
|
||||
// emetto l'oggetto
|
||||
switch ( pGeoObj->GetType()) {
|
||||
case SRF_TRIMESH :
|
||||
if ( ! ExportSTM( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr))
|
||||
if ( ! ExportSTM( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr, vInfo))
|
||||
return false ;
|
||||
break ;
|
||||
case SRF_FLATRGN :
|
||||
if ( ! ExportSFR( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr))
|
||||
if ( ! ExportSFR( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr, vInfo))
|
||||
return false ;
|
||||
break ;
|
||||
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
|
||||
Export3MF::TestFilter( int nLev, int nMode, int nStat)
|
||||
Export3MF::TestFilter( int nLev, int nMode, int nStat, bool bGroup)
|
||||
{
|
||||
if ( ( nLev == GDB_LV_USER && ( m_nFilter & EEXFLT_LEVUSER) == 0) ||
|
||||
( 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 +209,37 @@ 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 string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, const STRVECTOR& vInfo)
|
||||
{
|
||||
// verifico oggetto
|
||||
const ISurfFlatRegion* pSFR = GetSurfFlatRegion( pGeoObj) ;
|
||||
@@ -196,12 +247,12 @@ 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( sName, pStm, frFrame, pCol, vInfo) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol)
|
||||
Export3MF::ExportSTM( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, const STRVECTOR& vInfo)
|
||||
{
|
||||
// verifico oggetto
|
||||
const ISurfTriMesh* pSTM = GetSurfTriMesh( pGeoObj) ;
|
||||
@@ -224,7 +275,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
|
||||
@@ -248,11 +299,19 @@ Export3MF::ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Fr
|
||||
meshObject->SetName( sName) ;
|
||||
meshObject->SetGeometry( vVertices, vTriangles) ;
|
||||
|
||||
// assegno il colore
|
||||
// assegno il colore
|
||||
if ( pCol != nullptr) {
|
||||
Lib3MF_uint32 nColId = ColorHandler3MF( pCol) ;
|
||||
meshObject->SetObjectLevelProperty( 1, nColId) ;
|
||||
}
|
||||
|
||||
// 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) ;
|
||||
}
|
||||
|
||||
m_model->AddBuildItem( meshObject.get(), m_wrapper->GetIdentityTransform()) ;
|
||||
return true ;
|
||||
@@ -300,7 +359,7 @@ Export3MF::ColorHandler3MF( const Color* pCol)
|
||||
// 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
|
||||
// verifico se il colore � gi� presente nel colorgroup
|
||||
UINTVECTOR vColorIdx ;
|
||||
pColorGrp->GetAllPropertyIDs( vColorIdx) ;
|
||||
for ( Lib3MF_uint32 i : vColorIdx) {
|
||||
|
||||
+12
-6
@@ -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) ;
|
||||
bool ScanGroup( const IGdbIterator& iIter) ;
|
||||
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup) ;
|
||||
bool CalcGroupFilter( void) ;
|
||||
bool ExportSFR( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol,
|
||||
const STRVECTOR& vInfo) ;
|
||||
bool ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol,
|
||||
const STRVECTOR& vInfo) ;
|
||||
Lib3MF_uint32 ColorHandler3MF( const Color* pCol) ;
|
||||
bool GetColor( Color& pCol, const IGeomDB * pGBD, const int& nId) ;
|
||||
|
||||
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
-78
@@ -46,7 +46,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 +57,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 +101,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 +603,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 +617,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 +635,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 +721,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 +919,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 +933,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 +944,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 +1018,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 +1080,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 +1092,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 +1165,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 +1176,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 +1199,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 +1219,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 +1242,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 +1258,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 +1314,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 +1357,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 +1399,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 +1433,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 +1484,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 +1496,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 +1535,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 +1547,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 +1599,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 +1640,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 +1672,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 +1691,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 +1704,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 +1729,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 +1745,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 +1761,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 +1774,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 +1814,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
-43
@@ -34,7 +34,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 +45,7 @@ bool
|
||||
ExportStl::SetOptions( int nFilter)
|
||||
{
|
||||
m_nFilter = nFilter ;
|
||||
CalcGroupFilter() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -89,34 +90,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 +130,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
-6
@@ -41,7 +41,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 +93,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 +189,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 +336,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 +361,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 +401,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 +429,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 +478,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 +511,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 +537,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 +554,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 +587,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 +630,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 +647,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 +706,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 +774,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
|
||||
} ;
|
||||
|
||||
+1
-3
@@ -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"
|
||||
|
||||
using namespace std ;
|
||||
using namespace Lib3MF ;
|
||||
@@ -30,7 +28,7 @@ IImport3MF*
|
||||
CreateImport3MF( 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<IImport3MF*> ( new( nothrow) Import3MF) ;
|
||||
|
||||
+13
-1
@@ -39,7 +39,7 @@ 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) ;
|
||||
@@ -156,6 +156,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) {
|
||||
@@ -1230,6 +1233,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 +1249,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 +1262,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
|
||||
|
||||
+85
-182
@@ -20,6 +20,7 @@
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -42,7 +43,7 @@ IImportBtlx*
|
||||
CreateImportBtlx( 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<IImportBtlx*> ( new(nothrow) ImportBtlx) ;
|
||||
@@ -83,7 +84,7 @@ ImportBtlx::Import( const string& sFile, IGeomDB* pGDB, int nFlag)
|
||||
|
||||
// inizializzo il documento
|
||||
pugi::xml_document doc ;
|
||||
pugi::xml_parse_result ParseResult = doc.load_file( sFile.c_str()) ;
|
||||
pugi::xml_parse_result ParseResult = doc.load_file( stringtoW( sFile)) ;
|
||||
if ( ! ParseResult) {
|
||||
string sError = " Error parsing file : " ;
|
||||
sError += ParseResult.description() ;
|
||||
@@ -514,7 +515,6 @@ ImportBtlx::ReadPart( pugi::xml_node node)
|
||||
}
|
||||
|
||||
// Outline
|
||||
|
||||
bool bOutLineOk = m_BtlGeom.UpdateOutLine() ;
|
||||
if ( ! bOutLineOk ){
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : BtlGeom.UpdateOutLine error") ;
|
||||
@@ -1085,15 +1085,15 @@ ImportBtlx::ReadUserReferencePlane( pugi::xml_node node)
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part ReferencePlane : ID missing") ;
|
||||
return false ;
|
||||
}
|
||||
int id = node.attribute( "ID").as_int() ;
|
||||
int nId = node.attribute( "ID").as_int() ;
|
||||
|
||||
if ( node.child( "Position") == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part ReferencePlane : Position missing") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
Point3d Origin ;
|
||||
Vector3d VectX, VectY ;
|
||||
Point3d ptOrig ;
|
||||
Vector3d vX, vY ;
|
||||
|
||||
// Origin
|
||||
if ( node.child( "Position").child( "ReferencePoint") == nullptr ||
|
||||
@@ -1104,9 +1104,9 @@ ImportBtlx::ReadUserReferencePlane( pugi::xml_node node)
|
||||
return false ;
|
||||
}
|
||||
|
||||
Origin.x = node.child( "Position").child( "ReferencePoint").attribute( "X").as_double() ;
|
||||
Origin.y = node.child( "Position").child( "ReferencePoint").attribute( "Y").as_double() ;
|
||||
Origin.z = node.child( "Position").child( "ReferencePoint").attribute( "Z").as_double() ;
|
||||
ptOrig.x = node.child( "Position").child( "ReferencePoint").attribute( "X").as_double() ;
|
||||
ptOrig.y = node.child( "Position").child( "ReferencePoint").attribute( "Y").as_double() ;
|
||||
ptOrig.z = node.child( "Position").child( "ReferencePoint").attribute( "Z").as_double() ;
|
||||
|
||||
// VectX
|
||||
if ( node.child( "Position").child( "XVector") == nullptr ||
|
||||
@@ -1116,9 +1116,9 @@ ImportBtlx::ReadUserReferencePlane( pugi::xml_node node)
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part ReferencePlane : VectorX error") ;
|
||||
return false ;
|
||||
}
|
||||
VectX.x = node.child( "Position").child( "XVector").attribute( "X").as_double() ;
|
||||
VectX.y = node.child( "Position").child( "XVector").attribute( "Y").as_double() ;
|
||||
VectX.z = node.child( "Position").child( "XVector").attribute( "Z").as_double() ;
|
||||
vX.x = node.child( "Position").child( "XVector").attribute( "X").as_double() ;
|
||||
vX.y = node.child( "Position").child( "XVector").attribute( "Y").as_double() ;
|
||||
vX.z = node.child( "Position").child( "XVector").attribute( "Z").as_double() ;
|
||||
|
||||
// VectY
|
||||
if ( node.child( "Position").child( "YVector") == nullptr ||
|
||||
@@ -1128,26 +1128,28 @@ ImportBtlx::ReadUserReferencePlane( pugi::xml_node node)
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part ReferencePlane : VectorY error") ;
|
||||
return false ;
|
||||
}
|
||||
VectY.x = node.child( "Position").child( "YVector").attribute( "X").as_double() ;
|
||||
VectY.y = node.child( "Position").child( "YVector").attribute( "Y").as_double() ;
|
||||
VectY.z = node.child( "Position").child( "YVector").attribute( "Z").as_double() ;
|
||||
vY.x = node.child( "Position").child( "YVector").attribute( "X").as_double() ;
|
||||
vY.y = node.child( "Position").child( "YVector").attribute( "Y").as_double() ;
|
||||
vY.z = node.child( "Position").child( "YVector").attribute( "Z").as_double() ;
|
||||
|
||||
Point3d ptOnX = Origin + 100 * VectX ;
|
||||
Point3d ptOnY = Origin + 100 * VectY ;
|
||||
Point3d ptOnX = ptOrig + 100 * vX ;
|
||||
Point3d ptOnY = ptOrig + 100 * vY ;
|
||||
|
||||
Frame3d FrRef ;
|
||||
FrRef.Set( Origin, ptOnX, ptOnY) ;
|
||||
|
||||
MapURefPlanes.emplace( id, FrRef) ;
|
||||
Frame3d frRef ;
|
||||
frRef.Set( ptOrig, ptOnX, ptOnY) ;
|
||||
if ( ! frRef.IsValid()) {
|
||||
LOG_ERROR( GetEExLogger(), ( " Error reading Part Process: User Reference Plane " + to_string( nId) + " is not valid").c_str()) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
m_mapRefPlanes.emplace( nId, frRef) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtlx::ReadProcessings( pugi::xml_node node)
|
||||
{
|
||||
int curve_counter = 1 ; // serve per free contour
|
||||
{
|
||||
int nProcId = 0 ; // conto le lavorazioni
|
||||
|
||||
// Scorro tutte le lavorazioni
|
||||
@@ -1174,7 +1176,6 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing name") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
sDes = it->attribute( "Name").value() ;
|
||||
|
||||
// Attributi comuni a tutti i processi:
|
||||
@@ -1210,101 +1211,53 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
|
||||
return false ;
|
||||
}
|
||||
// JackRafterCut
|
||||
else if ( sProcessName == "JackRafterCut") {
|
||||
else if ( sProcessName == "JackRafterCut")
|
||||
bProcessOk = ReadJackRafterCutParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// LongitudinalCut
|
||||
else if ( sProcessName == "LongitudinalCut") {
|
||||
else if ( sProcessName == "LongitudinalCut")
|
||||
bProcessOk = ReadLongitudinalCutParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// DoubleCut
|
||||
else if ( sProcessName == "DoubleCut") {
|
||||
else if ( sProcessName == "DoubleCut")
|
||||
bProcessOk = ReadDoubleCutParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// RidgeValleyCut
|
||||
else if ( sProcessName == "RidgeValleyCut") {
|
||||
else if ( sProcessName == "RidgeValleyCut")
|
||||
bProcessOk = ReadRidgeValleyCutParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// SawCut
|
||||
else if ( sProcessName == "SawCut") {
|
||||
else if ( sProcessName == "SawCut")
|
||||
bProcessOk = ReadSawCutParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// Slot
|
||||
else if ( sProcessName == "Slot") {
|
||||
else if ( sProcessName == "Slot")
|
||||
bProcessOk = ReadSlotParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// BirdsMouth
|
||||
else if ( sProcessName == "BirdsMouth") {
|
||||
else if ( sProcessName == "BirdsMouth")
|
||||
bProcessOk = ReadBirdsMouthParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// HipValleyRafterNotch
|
||||
else if ( sProcessName == "HipValleyRafterNotch") {
|
||||
else if ( sProcessName == "HipValleyRafterNotch")
|
||||
bProcessOk = ReadHipValleyRafterNotchParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// Lap
|
||||
else if ( sProcessName == "Lap") {
|
||||
else if ( sProcessName == "Lap")
|
||||
bProcessOk = ReadLapParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// LogHouseHalfLap
|
||||
else if ( sProcessName == "LogHouseHalfLap") {
|
||||
else if ( sProcessName == "LogHouseHalfLap")
|
||||
bProcessOk = ReadLogHouseHalfLapParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// FrenchRidgeLap
|
||||
else if ( sProcessName == "FrenchRidgeLap") {
|
||||
else if ( sProcessName == "FrenchRidgeLap")
|
||||
bProcessOk = ReadFrenchRidgeLapParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// Chamfer
|
||||
else if ( sProcessName == "Chamfer") {
|
||||
else if ( sProcessName == "Chamfer")
|
||||
bProcessOk = ReadChamferParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// LogHouseJoint
|
||||
else if ( sProcessName == "LogHouseJoint") {
|
||||
else if ( sProcessName == "LogHouseJoint")
|
||||
bProcessOk = ReadLogHouseJointParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// LogHouseFront
|
||||
else if ( sProcessName == "LogHouseFront") {
|
||||
else if ( sProcessName == "LogHouseFront")
|
||||
bProcessOk = ReadLogHouseFrontParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// Pocket
|
||||
else if ( sProcessName == "Pocket") {
|
||||
else if ( sProcessName == "Pocket")
|
||||
bProcessOk = ReadPocketParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// Drilling
|
||||
else if ( sProcessName == "Drilling") {
|
||||
else if ( sProcessName == "Drilling")
|
||||
bProcessOk = ReadDrillingParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// Tenon
|
||||
else if ( sProcessName == "Tenon") {
|
||||
bProcessOk = ReadTenonParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
@@ -1312,17 +1265,15 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
|
||||
return false ;
|
||||
bProcessOk = m_BtlGeom.AddTenonBTLX( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
|
||||
bAdd = false ; // non devo aggiungere il processo una volta terminati questi if
|
||||
if ( ! bProcessOk ){
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddTenonBTLX error")
|
||||
return false ;
|
||||
if ( ! bProcessOk) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddTenonBTLX error") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// Moritse
|
||||
else if ( sProcessName == "Mortise") {
|
||||
else if ( sProcessName == "Mortise")
|
||||
bProcessOk = ReadMortiseParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// House
|
||||
else if ( sProcessName == "House") {
|
||||
// I parametri sono quasi gli stessi di Tenon, quindi chiamo la stessa funzione
|
||||
@@ -1335,7 +1286,7 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
|
||||
|
||||
bProcessOk = m_BtlGeom.AddTenonBTLX( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
|
||||
bAdd = false ;
|
||||
if ( ! bProcessOk ) {
|
||||
if ( ! bProcessOk) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddHouseBTLX error") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1343,7 +1294,7 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
|
||||
// House contiene un tenon o un dovetailtenon :
|
||||
pugi::xml_node housetenon = it->child( "Tenon") ;
|
||||
pugi::xml_node housedtenon = it->child( "DovetailTenon") ;
|
||||
if ( housetenon != nullptr){
|
||||
if ( housetenon != nullptr) {
|
||||
// Con GetProcessParamInfos viene fatto emplace_back sul vettore dei parametri quindi devono essere vuoti
|
||||
vnDPar.clear() ; vdPar.clear() ; nSPar = 0 ; sPar.clear() ; vsUAtt.clear() ;
|
||||
bProcessOk = ReadTenonParams( housetenon, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
@@ -1355,14 +1306,13 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
if ( housedtenon != nullptr) {
|
||||
vnDPar.clear() ; vdPar.clear() ; nSPar = 0 ; sPar.clear() ; vsUAtt.clear() ;
|
||||
bProcessOk = ReadDovetailTenonParams( housedtenon, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
bProcessOk = m_BtlGeom.AddDovetailTenonBTLX( nGroup, nProc, nSide, "DovetailTenon", nProcId, vnDPar, vdPar, vsUAtt) ;
|
||||
if ( ! bProcessOk ){
|
||||
if ( ! bProcessOk) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddHouseBTLX error") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1380,7 +1330,7 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
|
||||
|
||||
bProcessOk = m_BtlGeom.AddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, nSPar, vdPar, sPar, vsUAtt, 0) ;
|
||||
bAdd = false ;
|
||||
if ( ! bProcessOk ){
|
||||
if ( ! bProcessOk) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddMortiseBTLX error") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1389,7 +1339,7 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
|
||||
// House contiene una mortise/dovetailmortise :
|
||||
pugi::xml_node housemortise = it->child( "Mortise") ;
|
||||
pugi::xml_node housedtmortise = it->child( "DovetailMortise") ;
|
||||
if ( housemortise != nullptr){
|
||||
if ( housemortise != nullptr) {
|
||||
vnDPar.clear() ; vdPar.clear() ; nSPar = 0 ; sPar.clear() ; vsUAtt.clear() ;
|
||||
bProcessOk = ReadMortiseParams( housemortise, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
@@ -1406,20 +1356,17 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
bProcessOk = m_BtlGeom.AddProcess( nGroup, nProc, nSide, "DovetailMortise", nProcId, frRef, vnDPar, nSPar, vdPar, sPar, vsUAtt, 0) ;
|
||||
if ( ! bProcessOk ){
|
||||
if ( ! bProcessOk) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddMortiseBTLX error") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// DovetailTenon
|
||||
else if ( sProcessName == "DovetailTenon") {
|
||||
// I parametri sono quasi gli stessi di Mortise, quindi chiamo la stessa funzione
|
||||
bProcessOk = ReadDovetailTenonParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
|
||||
bProcessOk = m_BtlGeom.AddDovetailTenonBTLX( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
|
||||
bAdd = false ; // non devo aggiungere il processo una volta terminati questi if
|
||||
if ( ! bProcessOk ){
|
||||
@@ -1428,128 +1375,84 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
|
||||
}
|
||||
}
|
||||
// DovetailMortise
|
||||
else if ( sProcessName == "DovetailMortise") {
|
||||
// I parametri sono quasi gli stessi di Mortise, quindi chiamo la stessa funzione
|
||||
else if ( sProcessName == "DovetailMortise")
|
||||
bProcessOk = ReadDovetailMortiseParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
|
||||
bProcessOk = m_BtlGeom.AddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, nSPar, vdPar, sPar, vsUAtt, 0) ;
|
||||
bAdd = false ; // non devo aggiungere il processo una volta terminati questi if
|
||||
if ( ! bProcessOk ){
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddDovetailMortiseBTLX error") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// Marking
|
||||
else if ( sProcessName == "Marking") {
|
||||
bProcessOk = ReadMarkingParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
else if ( sProcessName == "Marking")
|
||||
bProcessOk = ReadMarkingParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
// Text
|
||||
else if ( sProcessName == "Text") {
|
||||
else if ( sProcessName == "Text")
|
||||
bProcessOk = ReadTextParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// SimpleScarf
|
||||
else if ( sProcessName == "SimpleScarf") {
|
||||
else if ( sProcessName == "SimpleScarf")
|
||||
bProcessOk = ReadSimpleScarfParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// ScarfJoint
|
||||
else if ( sProcessName == "ScarfJoint") {
|
||||
else if ( sProcessName == "ScarfJoint")
|
||||
bProcessOk = ReadScarfJointParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// StepJoint
|
||||
else if ( sProcessName == "StepJoint") {
|
||||
else if ( sProcessName == "StepJoint")
|
||||
bProcessOk = ReadStepJointParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// StepJointNotch
|
||||
else if ( sProcessName == "StepJointNotch") {
|
||||
else if ( sProcessName == "StepJointNotch")
|
||||
bProcessOk = ReadStepJointNotchParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// Planing
|
||||
else if ( sProcessName == "Planing") {
|
||||
LOG_ERROR( GetEExLogger(), " Warning reading Part Process: Planing ignored") ;
|
||||
//bProcessOk = ReadPlaningParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
//if ( ! bProcessOk)
|
||||
// return false ;
|
||||
}
|
||||
// ProfileFront
|
||||
else if ( sProcessName == "ProfileFront") {
|
||||
else if ( sProcessName == "ProfileFront")
|
||||
bProcessOk = ReadProfileFrontParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// ProfileCambered
|
||||
else if ( sProcessName == "ProfileCambered") {
|
||||
else if ( sProcessName == "ProfileCambered")
|
||||
bProcessOk = ReadProfileCamberedParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// RoundArch
|
||||
else if ( sProcessName == "RoundArch") {
|
||||
else if ( sProcessName == "RoundArch")
|
||||
bProcessOk = ReadRoundArchParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// ProfileHead
|
||||
else if ( sProcessName == "ProfileHead") {
|
||||
else if ( sProcessName == "ProfileHead")
|
||||
bProcessOk = ReadProfileHeadParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// Sphere
|
||||
else if ( sProcessName == "Sphere") {
|
||||
LOG_ERROR( GetEExLogger(), " Warning reading Part Process: Sphere ignored") ;
|
||||
//bProcessOk = ReadSphereParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
//if ( ! bProcessOk)
|
||||
// return false ;
|
||||
// bProcessOk = ReadSphereParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
}
|
||||
// TriangleCut
|
||||
else if ( sProcessName == "TriangleCut") {
|
||||
else if ( sProcessName == "TriangleCut")
|
||||
bProcessOk = ReadTriangleCutParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// TyroleanDovetail
|
||||
else if ( sProcessName == "TyroleanDovetail") {
|
||||
else if ( sProcessName == "TyroleanDovetail")
|
||||
bProcessOk = ReadTyroleanDovetailParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// Dovetail
|
||||
else if ( sProcessName == "Dovetail") {
|
||||
else if ( sProcessName == "Dovetail")
|
||||
bProcessOk = ReadDovetailParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// FreeContour
|
||||
else if ( sProcessName == "FreeContour") {
|
||||
bProcessOk = ReadFreeContourParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar, curve_counter, vsUAtt) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
bProcessOk = ReadFreeContourParams( *it, vsUAtt) ;
|
||||
bAdd = false ;
|
||||
}
|
||||
|
||||
// Aggiungo il processo
|
||||
if ( bProcessOk && bAdd) {
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
|
||||
// aggiungo il processo
|
||||
if ( bAdd) {
|
||||
// se riferimento non è una delle facce, lo recupero da UserReferencePlanes
|
||||
if ( nSide < BTL_SIDE_FRONT || nSide > BTL_SIDE_RIGHT) {
|
||||
// se non esiste, errore
|
||||
if ( m_mapRefPlanes.find( nSide) == m_mapRefPlanes.end()) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Process: Reference Plane unknown") ;
|
||||
return false ;
|
||||
}
|
||||
frRef = m_mapRefPlanes[nSide] ;
|
||||
}
|
||||
|
||||
bProcessOk = m_BtlGeom.AddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, nSPar, vdPar, sPar, vsUAtt, 0) ;
|
||||
if ( ! bProcessOk ) {
|
||||
if ( ! bProcessOk) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddProcess error") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
nProcId ++ ;
|
||||
} // end sui sottonodi di Processings
|
||||
|
||||
|
||||
+6
-7
@@ -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 ;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
+95
-102
@@ -990,8 +990,8 @@ ImportBtlx::ReadDovetailTenonParams( pugi::xml_node process, int& nGroup, int& n
|
||||
vdPar[9] *= 2 ;
|
||||
vdPar[6] = dWidth - vdPar[9] * ( 1 - sin( vdPar[7] * DEGTORAD)) / cos( vdPar[7] * DEGTORAD) ; // P09
|
||||
if ( vdPar[6] < 0 ) {
|
||||
LOG_ERROR( GetEExLogger(), " Error : Dovetail tenon width")
|
||||
return false ;
|
||||
LOG_ERROR( GetEExLogger(), " Error : Dovetail tenon width") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1029,19 +1029,17 @@ ImportBtlx::ReadDovetailMortiseParams( pugi::xml_node process, int& nGroup, int&
|
||||
return false ;
|
||||
}
|
||||
|
||||
|
||||
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
||||
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
||||
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
||||
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // P02
|
||||
vdPar[2] = Clamp( ReadProcessChild( process, "StartDepth", vdPar[2]), 0.0, 50000.0) ; // P03
|
||||
vdPar[3] = ReadProcessChildBool( process, "LengthLimitedBottom", 0, true) ; // P04
|
||||
vdPar[5] = Clamp( ReadProcessChild( process, "Angle", vdPar[5]), -180.0, 180.0) ; // P06
|
||||
double dWidth = Clamp( ReadProcessChild( process, "Width", 40.0), 0.0, 1000.0) ;
|
||||
vdPar[8] = Clamp( ReadProcessChild( process, "ConeAngle", vdPar[8]), 0.1, 179.9) ; // P16
|
||||
vdPar[8] = Clamp( ReadProcessChild( process, "ConeAngle", vdPar[8]), 0.1, 179.9) ; // P10
|
||||
vdPar[9] = Clamp( ReadProcessChild( process, "Depth", vdPar[9]), 0.0, 1000.0) ; // P11
|
||||
vdPar[10] = Clamp( ReadProcessChild( process, "ShapeRadius", vdPar[10]), 0.0, 1000.0) ; // P10
|
||||
vdPar[10] = Clamp( ReadProcessChild( process, "ShapeRadius", vdPar[10]), 0.0, 1000.0) ; // P12
|
||||
vdPar[11] = Clamp( ReadProcessChild( process, "Length", vdPar[11]), 0.0, 50000.0) ; // P13
|
||||
// P04
|
||||
|
||||
string sLimitationTop = process.child( "LimitationTop").text().get() ; // P05
|
||||
if ( sLimitationTop == "unlimited")
|
||||
@@ -1063,10 +1061,10 @@ ImportBtlx::ReadDovetailMortiseParams( pugi::xml_node process, int& nGroup, int&
|
||||
vdPar[10] = MILL_DEF_RAD ;
|
||||
vdPar[10] *= 2 ; // P12
|
||||
vdPar[7] = dWidth - vdPar[10] * ( 1 - sin( vdPar[8] * DEGTORAD)) / cos( vdPar[8] * DEGTORAD) ; // P09
|
||||
if ( vdPar[7] < 0 ) {
|
||||
if ( vdPar[7] < - EPS_SMALL) {
|
||||
LOG_ERROR( GetEExLogger(), " Error : Dovetail mortise width") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Dovetail mortise Shape is unknown") ;
|
||||
@@ -1952,60 +1950,47 @@ ImportBtlx::ReadDovetailParams( pugi::xml_node process, int& nGroup, int& nProc,
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtlx::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)
|
||||
ImportBtlx::ReadFreeContourParams( pugi::xml_node process, const STRVECTOR& vsUAtt)
|
||||
{
|
||||
// Identifico il processo con sigle usate nel btl
|
||||
nProc = 250 ;
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
// identifico il processo con sigle usate nel btl
|
||||
int nProc = 250 ;
|
||||
int nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
string sToolPosition = process.attribute( "ToolPosition").value() ;
|
||||
|
||||
int nGroup = 0 ;
|
||||
if ( sToolPosition == "left")
|
||||
nGroup = 3 ;
|
||||
else if (sToolPosition == "center")
|
||||
nGroup = 0 ;
|
||||
else if (sToolPosition == "right")
|
||||
else if ( sToolPosition == "right")
|
||||
nGroup = 4 ;
|
||||
else {
|
||||
else if ( sToolPosition != "center") {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Free Contour group not defined") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Inizializzo i vettori dei parametri
|
||||
for ( pugi::xml_node_iterator it = process.begin() ; it != process.end() ; it ++ ) {
|
||||
// recupero parametri del free contour
|
||||
bool bCounterSink = false ;
|
||||
string sCounterSink = process.attribute( "CounterSink").value() ;
|
||||
if ( sCounterSink == "yes")
|
||||
bCounterSink = true ;
|
||||
else if ( sCounterSink == "no")
|
||||
bCounterSink = false ;
|
||||
else {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: FreeContour CounterSink is wrong") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Reinizializzo i contenitori dei parametri
|
||||
vnDPar.clear() ; nSPar = 0 ; vdPar.clear() ; sPar.clear() ;
|
||||
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bParamsInfoOk) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
||||
return false ;
|
||||
}
|
||||
if ( vdPar.size() != 14) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: FreeContour number of parameters is wrong") ;
|
||||
return false ;
|
||||
}
|
||||
int nCrvCnt = 1 ;
|
||||
// scrorro i contours
|
||||
for ( pugi::xml_node_iterator it = process.begin() ; it != process.end() ; it ++) {
|
||||
|
||||
string sCounterSink = process.attribute( "CounterSink").value() ;
|
||||
if ( sCounterSink == "yes")
|
||||
vdPar[5] = 1 ;
|
||||
else if ( sCounterSink == "no")
|
||||
vdPar[5] = 0 ;
|
||||
else {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: FreeContour CounterSink is wrong") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Studio i nodi
|
||||
string itName = it->name() ;
|
||||
bool bContOk = true ;
|
||||
if ( itName == "Contour") {
|
||||
bContOk = ReadSContourParams( *it, 0, 0, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar, curve_counter, vsUAtt) ;
|
||||
bContOk = ReadSContourParams( *it, 0, 0, nGroup, nProc, nSide, bCounterSink, nCrvCnt, vsUAtt) ;
|
||||
if ( ! bContOk)
|
||||
return false ;
|
||||
}
|
||||
else if ( itName == "DualContour") {
|
||||
bContOk = ReadDContourParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar, curve_counter, vsUAtt) ;
|
||||
bContOk = ReadDContourParams( *it, nGroup, nProc, nSide, bCounterSink, nCrvCnt, vsUAtt) ;
|
||||
if ( ! bContOk)
|
||||
return false ;
|
||||
}
|
||||
@@ -2020,45 +2005,73 @@ ImportBtlx::ReadFreeContourParams( pugi::xml_node process, int& nGroup, int& nPr
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtlx::ReadSContourParams( pugi::xml_node process, int nType, int nOtherId, int& nGroup, int& nProc, int& nSide,
|
||||
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, string& sPar, int& curve_counter, STRVECTOR& vsUAtt)
|
||||
ImportBtlx::ReadSContourParams( pugi::xml_node process, int nType, int nOtherId, const int nGroup, const int nProc, const int nSide,
|
||||
bool bCounterSink, int& nCrvCnt, const STRVECTOR& vsUAtt)
|
||||
{
|
||||
// Parametri propri del contour che non cambiano
|
||||
// recupero eventuale riferimento da UserReferencePlanes
|
||||
Frame3d frRef ;
|
||||
if ( nSide < BTL_SIDE_FRONT || nSide > BTL_SIDE_RIGHT) {
|
||||
// se non esiste, errore
|
||||
if ( m_mapRefPlanes.find( nSide) == m_mapRefPlanes.end()) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Process: FreeContour Contour Reference Plane unknown") ;
|
||||
return false ;
|
||||
}
|
||||
frRef = m_mapRefPlanes[nSide] ;
|
||||
if ( ! frRef.IsValid()) {
|
||||
LOG_ERROR( GetEExLogger(), (" Error reading Part Process: FreeContour User Reference Plane " + to_string( nSide) + " is not valid").c_str()) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
// inizializzo i parametri
|
||||
INTVECTOR vnDPar ;
|
||||
int nSPar ;
|
||||
DBLVECTOR vdPar ;
|
||||
string sPar ;
|
||||
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bParamsInfoOk) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
||||
return false ;
|
||||
}
|
||||
if ( vdPar.size() != 14) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: FreeContour number of parameters is wrong") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// parametri propri del contour che non cambiano
|
||||
vdPar[5] = bCounterSink ? 1 : 0 ;
|
||||
string sDepthBounded = process.attribute( "DepthBounded").value() ;
|
||||
if ( sDepthBounded == "no")
|
||||
vdPar[3] = 0 ;
|
||||
else
|
||||
vdPar[3] = process.attribute( "Depth").as_double() ;
|
||||
|
||||
int contour_counter = 0 ;
|
||||
vdPar[3] = process.attribute( "Depth").as_double() ;
|
||||
|
||||
int nContourCnt = 0 ;
|
||||
for ( pugi::xml_node_iterator it = process.begin() ; it != process.end() ; it++)
|
||||
contour_counter ++ ;
|
||||
nContourCnt ++ ;
|
||||
|
||||
int i = 0 ;
|
||||
|
||||
for ( pugi::xml_node_iterator it = process.begin() ; it != process.end() ; it++) {
|
||||
|
||||
// Reinizializzo i parametri
|
||||
// reinizializzo i parametri
|
||||
vdPar[0] = 0.0 ; vdPar[1] = 0.0 ; vdPar[2] = 0.0 ; vdPar[6] = 0.0 ; vdPar[8] = 0.0 ; vdPar[9] = 0.0 ; vdPar[10] = 0.0 ;
|
||||
vdPar[4] = process.attribute( "Inclination").as_double() ;
|
||||
vdPar[4] = it->attribute( "Inclination").as_double() ;
|
||||
|
||||
i++ ;
|
||||
if ( i != contour_counter)
|
||||
vdPar[7] = curve_counter + 1 ;
|
||||
if ( i != nContourCnt)
|
||||
vdPar[7] = nCrvCnt + 1 ;
|
||||
else
|
||||
vdPar[7] = 0 ;
|
||||
|
||||
string sName = it->name() ;
|
||||
|
||||
// START POINT
|
||||
// Start Point
|
||||
if ( sName == "StartPoint") {
|
||||
vdPar[6] = nType ;
|
||||
|
||||
if ( nType == 100 || nType == 101) { // salvo id del contour associato
|
||||
if ( nType == 100 || nType == 101) // salvo id del contour associato
|
||||
vdPar[4] = nOtherId ;
|
||||
}
|
||||
|
||||
if ( it->attribute( "X") == nullptr || it->attribute( "Y") == nullptr || it->attribute( "Z") == nullptr){
|
||||
if ( it->attribute( "X") == nullptr || it->attribute( "Y") == nullptr || it->attribute( "Z") == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Process: FreeContour Contour StartPoint component missing") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2067,16 +2080,16 @@ ImportBtlx::ReadSContourParams( pugi::xml_node process, int nType, int nOtherId,
|
||||
vdPar[2] = it->attribute( "Z").as_double() ;
|
||||
}
|
||||
|
||||
// LINE
|
||||
// Line
|
||||
else if ( sName == "Line") {
|
||||
vdPar[6] = 1 ;
|
||||
|
||||
if ( it->child( "EndPoint") == nullptr){
|
||||
if ( it->child( "EndPoint") == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Process: FreeContour Contour Line EndPoint missing") ;
|
||||
return false ;
|
||||
}
|
||||
if ( it->child( "EndPoint").attribute( "X") == nullptr ||it->child( "EndPoint").attribute( "Y") == nullptr ||
|
||||
it->child( "EndPoint").attribute( "Z") == nullptr){
|
||||
if ( it->child( "EndPoint").attribute( "X") == nullptr || it->child( "EndPoint").attribute( "Y") == nullptr ||
|
||||
it->child( "EndPoint").attribute( "Z") == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Process: FreeContour Contour Line EndPoint component missing") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2085,7 +2098,7 @@ ImportBtlx::ReadSContourParams( pugi::xml_node process, int nType, int nOtherId,
|
||||
vdPar[2] = it->child( "EndPoint").attribute( "Z").as_double() ;
|
||||
}
|
||||
|
||||
// ARC
|
||||
// Arc
|
||||
else if ( sName == "Arc") {
|
||||
vdPar[6] = 2 ;
|
||||
|
||||
@@ -2112,36 +2125,19 @@ ImportBtlx::ReadSContourParams( pugi::xml_node process, int nType, int nOtherId,
|
||||
vdPar[8] = it->child( "PointOnArc").attribute( "X").as_double() ;
|
||||
vdPar[9] = it->child( "PointOnArc").attribute( "Y").as_double() ;
|
||||
vdPar[10] = it->child( "PointOnArc").attribute( "Z").as_double() ;
|
||||
|
||||
}
|
||||
else {
|
||||
LOG_ERROR ( GetEExLogger(), " Error reading Part Process: FreeContour Contour element unknown") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
Frame3d frRef ;
|
||||
// Se riferimento non è una delle facce, lo cerco fra UserReferencePlanes
|
||||
if ( nSide < BTL_SIDE_FRONT || nSide > BTL_SIDE_RIGHT) {
|
||||
// se non esiste, errore
|
||||
if ( MapURefPlanes.find( nSide) == MapURefPlanes.end()) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Process: FreeContour Contour Reference Plane unknown") ;
|
||||
return false ;
|
||||
}
|
||||
frRef = MapURefPlanes[nSide] ;
|
||||
if ( ! frRef.IsValid()) {
|
||||
LOG_ERROR( GetEExLogger(), (" Error reading Part Process: FreeContour User Reference Plane " + to_string( nSide) + " is not valid").c_str()) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
string sDes ;
|
||||
|
||||
bool bProcessOk = m_BtlGeom.AddProcess( nGroup, nProc, nSide, sDes, curve_counter, frRef, vnDPar, nSPar, vdPar, sPar, vsUAtt, 0) ;
|
||||
bool bProcessOk = m_BtlGeom.AddProcess( nGroup, nProc, nSide, sDes, nCrvCnt, frRef, vnDPar, nSPar, vdPar, sPar, vsUAtt, 0) ;
|
||||
if ( ! bProcessOk) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddProcess error") ;
|
||||
return false ;
|
||||
}
|
||||
curve_counter ++ ;
|
||||
nCrvCnt ++ ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
@@ -2149,39 +2145,36 @@ ImportBtlx::ReadSContourParams( pugi::xml_node process, int nType, int nOtherId,
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtlx::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)
|
||||
ImportBtlx::ReadDContourParams( pugi::xml_node process, const int nGroup, const int nProc, const int nSide, bool bCounterSink,
|
||||
int& nCrvCnt, const STRVECTOR& vsUAtt)
|
||||
{
|
||||
if ( process.child( "PrincipalContour") == nullptr || process.child( "AssociatedContour") == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Process: DualContour contour missing") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Principal Contour
|
||||
int nPrincipalId = curve_counter + 1 ;
|
||||
int nPrincipalContCurves = 0 ;
|
||||
|
||||
// conto il numero di curve nel PrincipalContour
|
||||
// principal contour
|
||||
int nPrincipalId = nCrvCnt + 1 ;
|
||||
int nPrincipalCrvCnt = 0 ;
|
||||
// numero di curve nel principal contour
|
||||
for ( pugi::xml_node_iterator it = process.child( "PrincipalContour").child( "Contour").begin() ;
|
||||
it != process.child( "PrincipalContour").child( "Contour").end() ; it ++)
|
||||
nPrincipalContCurves ++ ;
|
||||
it != process.child( "PrincipalContour").child( "Contour").end() ; it ++)
|
||||
nPrincipalCrvCnt ++ ;
|
||||
|
||||
bool bContourOk = ReadSContourParams( process.child( "PrincipalContour"), 100, curve_counter + nPrincipalContCurves,
|
||||
nGroup, nProc, nSide, vnDPar, nSPar,vdPar, sPar, curve_counter, vsUAtt) ;
|
||||
bool bContourOk = ReadSContourParams( process.child( "PrincipalContour"), 100, nCrvCnt + nPrincipalCrvCnt,
|
||||
nGroup, nProc, nSide, bCounterSink, nCrvCnt, vsUAtt) ;
|
||||
if ( ! bContourOk)
|
||||
return false ;
|
||||
|
||||
// Associated Contour
|
||||
// associated Contour
|
||||
bContourOk = ReadSContourParams( process.child( "AssociatedContour"), 101, nPrincipalId,
|
||||
nGroup, nProc, nSide, vnDPar, nSPar,vdPar, sPar, curve_counter, vsUAtt) ;
|
||||
nGroup, nProc, nSide, bCounterSink, nCrvCnt, vsUAtt) ;
|
||||
if ( ! bContourOk)
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------
|
||||
// ------------------------- Funzioni ausiliarie ----------------------------------------------------------------
|
||||
// -------------------------------------------------------------------------------------------------------------
|
||||
@@ -2249,7 +2242,7 @@ ReadProcessChildBool( const pugi::xml_node& process, const string& sChild, const
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
// se sValue fosse empty o valore non ammesso restituisco valore di default
|
||||
// se sValue fosse empty o valore non ammesso restituisco valore di default
|
||||
return nDefaultVal ;
|
||||
}
|
||||
|
||||
|
||||
+13
-4
@@ -23,6 +23,7 @@
|
||||
#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"
|
||||
@@ -52,7 +53,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) ;
|
||||
@@ -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[0] == 'M' && sLine[1] == 'S' && sLine[2] == 'G'))
|
||||
return true ;
|
||||
|
||||
// eliminazione di commenti intermedi o finali
|
||||
@@ -498,6 +499,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 ;
|
||||
}
|
||||
|
||||
@@ -995,7 +1002,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) ||
|
||||
@@ -1323,7 +1331,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
|
||||
|
||||
+1
-1
@@ -62,7 +62,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) ;
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ 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) ;
|
||||
|
||||
+4
-3
@@ -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)) ;
|
||||
@@ -2253,8 +2253,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)
|
||||
|
||||
+1
-1
@@ -28,7 +28,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) ;
|
||||
|
||||
+1
-1
@@ -34,7 +34,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) ;
|
||||
|
||||
Reference in New Issue
Block a user