Compare commits
175 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 | |||
| e5eb2e811f | |||
| 09bdbe99d6 | |||
| 30785bb31f | |||
| 6a72e287cc | |||
| 07cff78ff6 | |||
| 72f17b2605 | |||
| 3881a4bb21 | |||
| d96d99c5ae | |||
| 6bec469a58 | |||
| 11d89dfd14 | |||
| 49d0b6e9a9 | |||
| dc66bdc04e | |||
| aa0290e365 | |||
| e639b310dc | |||
| 0b7c6e1d29 | |||
| b2e6005700 | |||
| e09ee5537f | |||
| 1c8da69f63 | |||
| 62858b6972 | |||
| 609d911cf9 | |||
| 264b3318fe | |||
| 289744ca70 | |||
| b4ea91e637 | |||
| 70354dd798 | |||
| c59b85ba42 | |||
| 41b595d798 | |||
| 6a48bd6571 | |||
| 10e2c47a74 | |||
| 861837f0a6 | |||
| 531d8d8d86 | |||
| ef13501017 | |||
| bd3ebca16b | |||
| a75278074d | |||
| acab9e3d3a | |||
| ae463b4a12 | |||
| 700881d203 | |||
| 8adc82126a | |||
| 799e2713f4 | |||
| bc2f55efab | |||
| d3fd4bb971 | |||
| 7cd69e8e12 | |||
| bf05485e33 | |||
| 1b30112f73 | |||
| f75335f199 | |||
| 367a4d2b47 | |||
| 3f99541786 | |||
| f41ddb84f0 | |||
| 421206b316 | |||
| 50fb53d335 | |||
| f12f86ce64 | |||
| 630f81a755 | |||
| 9a9993bd5e | |||
| 3ea4693cbb | |||
| e71850dacc | |||
| c44e28fafb | |||
| cbd8863fc8 | |||
| f2b922088a | |||
| e67025ded7 | |||
| e4871ab7e8 | |||
| 2f2203466d | |||
| 63421ef658 | |||
| 48fe4050f7 | |||
| d9973d09fe |
+288
-27
@@ -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) ;
|
||||
@@ -45,21 +46,31 @@ BeamMgr::BeamMgr( void)
|
||||
bool
|
||||
BeamMgr::Init( IGeomDB* pGDB, int nFlag)
|
||||
{
|
||||
// assegno il gestore di DB geometrico
|
||||
if ( pGDB == nullptr)
|
||||
return false ;
|
||||
m_pGDB = pGDB ;
|
||||
return SetFlag( nFlag) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::SetFlag( int nFlag)
|
||||
{
|
||||
// verifico il gestore di DB geometrico
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// inizializzo il gestore geometria pezzi Btl
|
||||
int nFlatVertPos = 0 ;
|
||||
if (( nFlag & EIBFLAG_TS3_POS) != 0)
|
||||
if (( nFlag & EIBFLAG_OUTL_FLAT_POS) != 0)
|
||||
nFlatVertPos = 4 ;
|
||||
else if (( nFlag & EIBFLAG_TS3_POS) != 0)
|
||||
nFlatVertPos = 3 ;
|
||||
else if (( nFlag & EIBFLAG_FLAT_POS) != 0)
|
||||
nFlatVertPos = 1 ;
|
||||
else if (( nFlag & EIBFLAG_VERT_POS) != 0)
|
||||
nFlatVertPos = 2 ;
|
||||
bool bSpecialTrim = (( nFlag & EIBFLAG_SPECIAL_TRIM) != 0) ;
|
||||
bool bTrimWithOutline = (( nFlag & EIBFLAG_TRIM_WITH_OUTLINE) != 0) ;
|
||||
bool bUseUAttr = (( nFlag & EIBFLAG_USEUATTR) != 0) ;
|
||||
if ( ! m_BtlGeom.Init( pGDB, nFlatVertPos, bSpecialTrim, bUseUAttr)) {
|
||||
if ( ! m_BtlGeom.Init( m_pGDB, nFlatVertPos, bSpecialTrim, bTrimWithOutline, bUseUAttr)) {
|
||||
LOG_ERROR( GetEExLogger(), " Error on BtlGeom.Init")
|
||||
return false ;
|
||||
}
|
||||
@@ -120,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) ;
|
||||
}
|
||||
|
||||
@@ -131,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) ;
|
||||
}
|
||||
|
||||
@@ -142,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) ;
|
||||
}
|
||||
|
||||
@@ -153,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() ;
|
||||
@@ -164,10 +181,187 @@ BeamMgr::SetPartBox( double dLength, double dHeight, double dWidth, bool bUpdate
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::GetSideData( int nSide, Frame3d& frRef, double& dLength, double& dWidth, double& dHeight)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Verifico validità identificativo di faccia
|
||||
if ( nSide < BTL_SIDE_FRONT || nSide > BTL_SIDE_RIGHT)
|
||||
return false ;
|
||||
// Recupero riferimento del pezzo corrente
|
||||
int nPartId = m_BtlGeom.GetCurrPartId() ;
|
||||
Frame3d frPart ;
|
||||
if ( ! m_pGDB->GetGroupGlobFrame( nPartId, frPart))
|
||||
return false ;
|
||||
// Recupero i dati
|
||||
frRef = m_BtlGeom.GetSideFrame( nSide) ;
|
||||
frRef.ToGlob( frPart) ;
|
||||
dLength = m_BtlGeom.GetSideLength( nSide) ;
|
||||
dWidth = m_BtlGeom.GetSideWidth( nSide) ;
|
||||
dHeight = m_BtlGeom.GetSideHeight( nSide) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::ShowFacesName( bool bShow)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Verifico esistenza del pezzo corrente
|
||||
int nPartId = m_BtlGeom.GetCurrPartId() ;
|
||||
if ( nPartId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// Verifico esistenza del gruppo nomi facce
|
||||
int nFcsNameLayId = m_pGDB->GetFirstNameInGroup( nPartId, FCSNAME_LAYER_NAME) ;
|
||||
// Se da visualizzare e non esiste il gruppo
|
||||
if ( bShow && nFcsNameLayId == GDB_ID_NULL) {
|
||||
// Creazione del gruppo
|
||||
nFcsNameLayId = m_pGDB->AddGroup( GDB_ID_NULL, nPartId, GLOB_FRM) ;
|
||||
m_pGDB->SetLevel( nFcsNameLayId, GDB_LV_TEMP) ;
|
||||
m_pGDB->SetName( nFcsNameLayId, FCSNAME_LAYER_NAME) ;
|
||||
m_pGDB->SetMaterial( nFcsNameLayId, NAVY) ;
|
||||
// Scrittura del nome delle facce come testi del layer ausiliario
|
||||
for ( int nS = BTL_SIDE_FRONT ; nS <= BTL_SIDE_RIGHT ; ++ nS) {
|
||||
string sFace ;
|
||||
if ( nS == BTL_SIDE_LEFT)
|
||||
sFace = "o" ;
|
||||
else if ( nS == BTL_SIDE_RIGHT)
|
||||
sFace = "+" ;
|
||||
else
|
||||
sFace = "F" + ToString( nS) ;
|
||||
PtrOwner<IExtText> pText( CreateExtText()) ;
|
||||
if ( IsNull( pText))
|
||||
return false ;
|
||||
double dSLen = m_BtlGeom.GetSideLength( nS) ;
|
||||
double dSWid = m_BtlGeom.GetSideWidth( nS) ;
|
||||
Point3d ptPos( 0.5 * dSLen, ( m_BtlGeom.IsTrueSide( nS) ? 10 : 0.5 * dSWid), 1) ;
|
||||
Vector3d vtDir = ( nS != BTL_SIDE_RIGHT ? X_AX : -X_AX) ;
|
||||
int nInsPos = ( m_BtlGeom.IsTrueSide( nS) ? ETXT_IPBC : ETXT_IPMC) ;
|
||||
double dPLen = m_BtlGeom.GetCurrPartLength() ;
|
||||
double dPHei = m_BtlGeom.GetCurrPartHeight() ;
|
||||
double dPWid = m_BtlGeom.GetCurrPartWidth() ;
|
||||
double dCoeff = ( abs( dPHei - dPWid) / abs( dPHei + dPWid) < 0.51 ? 0.1 : 0.2) ;
|
||||
double dTextHeight = dCoeff * min( { dPLen, dPHei, dPWid}) ;
|
||||
if ( ! pText->Set( ptPos, Z_AX, vtDir, sFace, "Arial", 100, false, 2 * dTextHeight, 1, 0, nInsPos))
|
||||
return false ;
|
||||
// porto il testo nel piano della faccia
|
||||
Frame3d frRef = m_BtlGeom.GetSideFrame( nS) ;
|
||||
pText->ToGlob( frRef) ;
|
||||
// recupero eventuale nome già presente
|
||||
int nOldTextId = m_pGDB->GetFirstNameInGroup( nFcsNameLayId, sFace) ;
|
||||
// se gia presente, lo rimpiazzo
|
||||
if ( nOldTextId != GDB_ID_NULL) {
|
||||
if ( ! m_pGDB->ReplaceGeoObj( nOldTextId, Release( pText)))
|
||||
return false ;
|
||||
}
|
||||
// altrimenti, lo inserisco
|
||||
else {
|
||||
int nTextId = m_pGDB->AddGeoObj( GDB_ID_NULL, nFcsNameLayId, Release( pText)) ;
|
||||
if ( nTextId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// assegno nome
|
||||
m_pGDB->SetName( nTextId, sFace) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// se altrimenti da eliminare ed esiste
|
||||
else if ( ! bShow && nFcsNameLayId != GDB_ID_NULL) {
|
||||
m_pGDB->Erase( nFcsNameLayId) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::UpdateFacesName( void)
|
||||
{
|
||||
int nFcsNameLayId = m_pGDB->GetFirstNameInGroup( m_BtlGeom.GetCurrPartId(), FCSNAME_LAYER_NAME) ;
|
||||
if ( nFcsNameLayId == GDB_ID_NULL)
|
||||
return true ;
|
||||
m_pGDB->Erase( nFcsNameLayId) ;
|
||||
return ShowFacesName( true) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::ShowLoadingSide( bool bShow, bool bFromLeft)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Verifico esistenza del pezzo corrente
|
||||
int nPartId = m_BtlGeom.GetCurrPartId() ;
|
||||
if ( nPartId == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
// Verifico esistenza del gruppo temporaneo lato di carico
|
||||
int nLsideGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, LOADINGSIDE_GROUP_NAME) ;
|
||||
// Se da visualizzare e non esiste il gruppo
|
||||
if ( bShow && nLsideGrpId == GDB_ID_NULL) {
|
||||
// Creazione del gruppo
|
||||
nLsideGrpId = m_pGDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, GLOB_FRM) ;
|
||||
m_pGDB->SetLevel( nLsideGrpId, GDB_LV_TEMP) ;
|
||||
m_pGDB->SetName( nLsideGrpId, LOADINGSIDE_GROUP_NAME) ;
|
||||
m_pGDB->SetMaterial( nLsideGrpId, NAVY) ;
|
||||
m_pGDB->SetInfo( nLsideGrpId, IKEY_LSIDE, bFromLeft) ;
|
||||
// Recupero dati del pezzo
|
||||
Frame3d frPart ;
|
||||
if ( ! m_pGDB->GetGroupGlobFrame( nPartId, frPart))
|
||||
return false ;
|
||||
BBox3d b3Part( 0, 0, 0, m_BtlGeom.GetCurrPartLength(), m_BtlGeom.GetCurrPartHeight(), m_BtlGeom.GetCurrPartWidth()) ;
|
||||
b3Part.ToGlob( frPart) ;
|
||||
// Disegno della freccia
|
||||
PolyLine PL ;
|
||||
PL.AddUPoint( 0, Point3d( 140, 0, 0)) ;
|
||||
PL.AddUPoint( 0, Point3d( 100, -40, 0)) ;
|
||||
PL.AddUPoint( 0, Point3d( 100, -20, 0)) ;
|
||||
PL.AddUPoint( 0, Point3d( 0, -20, 0)) ;
|
||||
PL.AddUPoint( 0, Point3d( 0, 20, 0)) ;
|
||||
PL.AddUPoint( 0, Point3d( 100, 20, 0)) ;
|
||||
PL.AddUPoint( 0, Point3d( 100, 40, 0)) ;
|
||||
PL.AddUPoint( 0, Point3d( 140, 0, 0)) ;
|
||||
Vector3d vtMove = b3Part.GetMin() + ( b3Part.GetDimX() + 50) * X_AX + b3Part.GetDimY() / 2 * Y_AX - ORIG ;
|
||||
PL.Translate( vtMove) ;
|
||||
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pStm) || ! pStm->CreateByFlatContour( PL))
|
||||
return false ;
|
||||
int nStmId = m_pGDB->AddGeoObj( GDB_ID_NULL, nLsideGrpId, Release( pStm)) ;
|
||||
if ( nStmId == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// se altrimenti da eliminare ed esiste
|
||||
else if ( ! bShow && nLsideGrpId != GDB_ID_NULL) {
|
||||
m_pGDB->Erase( nLsideGrpId) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::UpdateLoadingSide( void)
|
||||
{
|
||||
int nLsideGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, LOADINGSIDE_GROUP_NAME) ;
|
||||
if ( nLsideGrpId == GDB_ID_NULL)
|
||||
return true ;
|
||||
bool bFromLeft = true ;
|
||||
m_pGDB->GetInfo( nLsideGrpId, IKEY_LSIDE, bFromLeft) ;
|
||||
m_pGDB->Erase( nLsideGrpId) ;
|
||||
return ShowLoadingSide( true, bFromLeft) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
BeamMgr::AddProcess( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
|
||||
const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar, const STRVECTOR& vsUAtt, bool bUpdate)
|
||||
const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar, const STRVECTOR& vsUAtt,
|
||||
int nCrvId, int nCrv2Id, bool bUpdate)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
@@ -182,13 +376,30 @@ 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 ;
|
||||
// Aggiungo la feature
|
||||
if ( ! m_BtlGeom.AddProcess( nGroup, nProc, nSide, sDes, nProcId,frRef, vnDPar, nSPar, vdBtlPar, sBtlPar, vsUAtt, 0))
|
||||
return GDB_ID_NULL ;
|
||||
// Gestione speciale per FreeContour
|
||||
if ( nProc == 250) {
|
||||
if ( ! m_BtlGeom.AddOneFreeContour( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, vdBtlPar, vsUAtt, nCrvId, nCrv2Id))
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// gestione speciale per Outline
|
||||
else if ( nProc == 251) {
|
||||
if ( ! m_BtlGeom.AddPartOutline( nSide, nCrvId, vdBtlPar, vsUAtt))
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// gestione speciale per Aperture
|
||||
else if ( nProc == 252) {
|
||||
if ( ! m_BtlGeom.AddPartAperture( nSide, nCrvId, vdBtlPar, vsUAtt))
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// altrimenti Add standard
|
||||
else {
|
||||
if ( ! m_BtlGeom.AddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, nSPar, vdBtlPar, sBtlPar, vsUAtt, 0))
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// Se richiesto, aggiorno Outline e cancello Solido
|
||||
if ( bUpdate) {
|
||||
m_BtlGeom.UpdateOutLine() ;
|
||||
@@ -201,7 +412,8 @@ BeamMgr::AddProcess( int nGroup, int nProc, int nSide, const string& sDes, int n
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
BeamMgr::ModifyProcess( int nGeomId, int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
|
||||
const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar, const STRVECTOR& vsUAtt, bool bUpdate)
|
||||
const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar, const STRVECTOR& vsUAtt,
|
||||
int nCrvId, int nCrv2Id, bool bUpdate)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
@@ -209,10 +421,11 @@ BeamMgr::ModifyProcess( int nGeomId, int nGroup, int nProc, int nSide, const str
|
||||
// Recupero il pezzo di appartenenza
|
||||
int nLayId = m_pGDB->GetParentId( nGeomId) ;
|
||||
int nPartId = m_pGDB->GetParentId( nLayId) ;
|
||||
if ( ! m_BtlGeom.SetPart( nPartId) || m_BtlGeom.GetCurrProcsLayId() != nLayId)
|
||||
// accetto feature normali e Outline/Aperture
|
||||
if ( ! m_BtlGeom.SetPart( nPartId) || ( m_BtlGeom.GetCurrProcsLayId() != nLayId && m_BtlGeom.GetCurrOutsLayId() != nLayId))
|
||||
return GDB_ID_NULL ;
|
||||
// Aggiungo il nuovo processo modificato
|
||||
int nNewId = AddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vdPar, sPar, vsUAtt, false) ;
|
||||
int nNewId = AddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vdPar, sPar, vsUAtt, nCrvId, nCrv2Id, false) ;
|
||||
if ( nNewId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// Sposto le geometrie inserite appena sopra le vecchie (mantenendo l'ordine relativo nel gruppo)
|
||||
@@ -257,7 +470,8 @@ BeamMgr::EraseProcess( int nGeomId, bool bUpdate)
|
||||
// Recupero il pezzo di appartenenza
|
||||
int nLayId = m_pGDB->GetParentId( nGeomId) ;
|
||||
int nPartId = m_pGDB->GetParentId( nLayId) ;
|
||||
if ( ! m_BtlGeom.SetPart( nPartId) || m_BtlGeom.GetCurrProcsLayId() != nLayId)
|
||||
// accetto feature normali e Outline/Aperture
|
||||
if ( ! m_BtlGeom.SetPart( nPartId) || ( m_BtlGeom.GetCurrProcsLayId() != nLayId && m_BtlGeom.GetCurrOutsLayId() != nLayId))
|
||||
return false ;
|
||||
// Cancello eventuali geometrie aggiuntive
|
||||
INTVECTOR vAdj ;
|
||||
@@ -271,6 +485,18 @@ BeamMgr::EraseProcess( int nGeomId, bool bUpdate)
|
||||
for ( auto nAux : vAux)
|
||||
m_pGDB->Erase( nGeomId + nAux) ;
|
||||
}
|
||||
// Cancello eventuali geometrie originali
|
||||
INTVECTOR vOrig ;
|
||||
if ( m_pGDB->GetInfo( nGeomId, IKEY_ORIGID, vOrig) && ! vOrig.empty()) {
|
||||
for ( auto nOrig : vOrig) {
|
||||
INTVECTOR vAux ;
|
||||
if ( m_pGDB->GetInfo( nOrig, IKEY_AUXID, vAux) && ! vAux.empty()) {
|
||||
for ( auto nAux : vAux)
|
||||
m_pGDB->Erase( nOrig + nAux) ;
|
||||
}
|
||||
m_pGDB->Erase( nGeomId + nOrig) ;
|
||||
}
|
||||
}
|
||||
m_pGDB->Erase( nGeomId) ;
|
||||
// Se richiesto, aggiorno Outline e cancello Solido
|
||||
if ( bUpdate) {
|
||||
@@ -319,6 +545,13 @@ BeamMgr::EnableProcess( int nGeomId, bool bEnable, bool bUpdate)
|
||||
for ( auto nAdj : vAdj)
|
||||
MyEnableProcess( m_pGDB, m_BtlGeom, nGeomId + nAdj, bEnable) ;
|
||||
}
|
||||
// Aggiorno eventuali geometrie originali
|
||||
INTVECTOR vOrig ;
|
||||
if ( m_pGDB->GetInfo( nGeomId, IKEY_ORIGID, vOrig) && ! vOrig.empty()) {
|
||||
for ( auto nOrig : vOrig) {
|
||||
MyEnableProcess( m_pGDB, m_BtlGeom, nGeomId + nOrig, bEnable) ;
|
||||
}
|
||||
}
|
||||
// Se richiesto, aggiorno Outline e cancello Solido
|
||||
if ( bUpdate) {
|
||||
m_BtlGeom.UpdateOutLine() ;
|
||||
@@ -380,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
|
||||
@@ -425,7 +658,7 @@ BeamMgr::CalcSolid( int nPartId, bool bRecalc)
|
||||
Point3d ptMin ; double dDimX, dDimY, dDimz ;
|
||||
if ( ! b3Box.GetMinDim( ptMin, dDimX, dDimY, dDimz))
|
||||
return false ;
|
||||
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshBox( dDimX, dDimY, dDimz, true)) ;
|
||||
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshBox( dDimX, dDimY, dDimz, false)) ;
|
||||
if ( IsNull( pSTM))
|
||||
return false ;
|
||||
pSTM->Translate( ptMin - ORIG) ;
|
||||
@@ -478,12 +711,38 @@ 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) {
|
||||
const ISurfTriMesh* pStmProc = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcId)) ;
|
||||
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pStmProc, dStep)) ;
|
||||
if ( ! IsNull( pStmTmp))
|
||||
pStmProc = Get( pStmTmp) ;
|
||||
if ( pStmProc == nullptr || ! pStm->Intersect( *pStmProc))
|
||||
return false ;
|
||||
// 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( 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()) ;
|
||||
if ( IsNull( pTrim) || ! pTrim->DoSewing( *pStmProc))
|
||||
return false ;
|
||||
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pTrim, dStep)) ;
|
||||
const ISurfTriMesh* pStmTool = ( ! IsNull( pStmTmp) ? Get( pStmTmp) : Get( pTrim)) ;
|
||||
if ( pStmTool == nullptr || ! pStm->Intersect( *pStmTool))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// caso standard
|
||||
else {
|
||||
const ISurfTriMesh* pStmProc = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId)) ;
|
||||
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pStmProc, dStep)) ;
|
||||
if ( ! IsNull( pStmTmp))
|
||||
pStmProc = Get( pStmTmp) ;
|
||||
if ( pStmProc == nullptr || ! pStm->Intersect( *pStmProc))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
nProcId = m_pGDB->GetNext( nProcId) ;
|
||||
}
|
||||
@@ -524,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 ;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ class BeamMgr : public IBeamMgr
|
||||
{
|
||||
public :
|
||||
bool Init( IGeomDB* pGDB, int nFlag = 0) override ;
|
||||
bool SetFlag( int nFlag) override ;
|
||||
int CreatePart( void) override ;
|
||||
bool SetPart( int nPartId) override ;
|
||||
bool ErasePart( void) override ;
|
||||
@@ -29,10 +30,15 @@ class BeamMgr : public IBeamMgr
|
||||
bool SetPartName( const std::string& sName) override ;
|
||||
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, bool bUpdate = true) override ;
|
||||
const Frame3d& frRef, const DBLVECTOR& vdPar, const std::string& sPar, const STRVECTOR& vsUAtt,
|
||||
int nCrvId, int nCrv2Id, bool bUpdate = true) override ;
|
||||
int ModifyProcess( int nGeomId, 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, bool bUpdate = true) override ;
|
||||
const Frame3d& frRef, const DBLVECTOR& vdPar, const std::string& sPar, const STRVECTOR& vsUAtt,
|
||||
int nCrvId, int nCrv2Id, bool bUpdate = true) override ;
|
||||
bool EraseProcess( int nGeomId, bool bUpdate = true) override ;
|
||||
bool EnableProcess( int nGeomId, bool bEnable, bool bUpdate = true) override ;
|
||||
bool CalcSolid( int nPartId, bool bRecalc = false) override ;
|
||||
@@ -45,6 +51,8 @@ class BeamMgr : public IBeamMgr
|
||||
BeamMgr( void) ;
|
||||
|
||||
private :
|
||||
bool UpdateFacesName( void) ;
|
||||
bool UpdateLoadingSide( void) ;
|
||||
|
||||
private :
|
||||
IGeomDB* m_pGDB ;
|
||||
|
||||
@@ -146,6 +146,7 @@ enum nPartKey {
|
||||
KEY_PART_STOREYTYPE,
|
||||
KEY_PART_TIMBERGRADE,
|
||||
KEY_PART_TRANSFORMATION,
|
||||
KEY_PART_TYPE,
|
||||
KEY_PART_UID,
|
||||
KEY_PART_USERATTRIBUTE,
|
||||
KEY_PART_WIDTH,
|
||||
@@ -186,6 +187,7 @@ static const std::array<std::string,KEY_PART_ZZZ> sPartKey = {
|
||||
"STOREYTYPE",
|
||||
"TIMBERGRADE",
|
||||
"TRANSFORMATION",
|
||||
"TYPE",
|
||||
"UID",
|
||||
"USERATTRIBUTE",
|
||||
"WIDTH"
|
||||
@@ -253,3 +255,4 @@ static const std::string PAR_YZ = "YZ" ;
|
||||
static const std::string PAR_PROCESS = "PROCESS" ;
|
||||
static const std::string PAR_SIDE = "SIDE" ;
|
||||
static const std::string PAR_P = "P" ;
|
||||
static const std::string PAR_UID = "UID" ;
|
||||
|
||||
+330
-13
@@ -24,6 +24,7 @@
|
||||
#include "/EgtDev/Include/EGkExtText.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -34,17 +35,20 @@ string BtlGeom::m_sBtlAuxDir ;
|
||||
BtlGeom::BtlGeom( void)
|
||||
{
|
||||
m_pGDB = nullptr ;
|
||||
m_nFlatVertPos = false ;
|
||||
m_nFlatVertPos = 0 ;
|
||||
m_bSpecialTrim = false ;
|
||||
m_bTrimWithOutline = false ;
|
||||
m_bUseUAttr = false ;
|
||||
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, 100) ;
|
||||
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 ;
|
||||
m_nAsseId = GDB_ID_NULL ;
|
||||
m_nRawPartsId = GDB_ID_NULL ;
|
||||
m_nCompositesId = GDB_ID_NULL ;
|
||||
m_ptOrig = ORIG ;
|
||||
m_nPartId = GDB_ID_NULL ;
|
||||
m_nAuxId = GDB_ID_NULL ;
|
||||
@@ -58,7 +62,7 @@ BtlGeom::BtlGeom( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim, bool bUseUAttr)
|
||||
BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim, bool bTrimWithOutline, bool bUseUAttr)
|
||||
{
|
||||
// salvo puntatore a DB geometrico
|
||||
m_pGDB = pGDB ;
|
||||
@@ -67,6 +71,7 @@ BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim, bool bUseUAtt
|
||||
// salvo i flag
|
||||
m_nFlatVertPos = nFlatVertPos ;
|
||||
m_bSpecialTrim = bSpecialTrim ;
|
||||
m_bTrimWithOutline = bTrimWithOutline ;
|
||||
m_bUseUAttr = bUseUAttr ;
|
||||
// se non esiste, creo gruppo per informazioni varie
|
||||
m_nInfoId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, INFO_GROUP_NAME) ;
|
||||
@@ -76,6 +81,9 @@ BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim, bool bUseUAtt
|
||||
m_nAsseId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME) ;
|
||||
if ( m_nAsseId == GDB_ID_NULL && ! CreateAssemblyGroup())
|
||||
return false ;
|
||||
// recupero eventuali riferimenti a gruppi per grezzi e compositi
|
||||
m_nRawPartsId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, RAWPARTS_GROUP_NAME) ;
|
||||
m_nCompositesId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, COMPOSITES_GROUP_NAME) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -239,6 +247,17 @@ BtlGeom::ErasePart( void)
|
||||
// se non c'è il DB geometrico o il pezzo corrente, errore
|
||||
if ( m_pGDB == nullptr || m_nPartId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// rimuovo eventuali riferimenti e copie nell'assemblato
|
||||
int nAsseBaseRefId = GDB_ID_NULL ;
|
||||
if ( m_pGDB->GetInfo( m_nPartId, GDB_SI_LIST, nAsseBaseRefId)) {
|
||||
m_pGDB->Erase( nAsseBaseRefId) ;
|
||||
int nInd = 1 ;
|
||||
int nSouPartId = GDB_ID_NULL ;
|
||||
while ( m_pGDB->GetInfo( nAsseBaseRefId + nInd, GDB_SI_SOURCE, nSouPartId) && nSouPartId == m_nPartId) {
|
||||
m_pGDB->Erase( nAsseBaseRefId + nInd) ;
|
||||
++ nInd ;
|
||||
}
|
||||
}
|
||||
// cancello il pezzo
|
||||
m_pGDB->Erase( m_nPartId) ;
|
||||
// annullo tutti gli identificativi del pezzo
|
||||
@@ -253,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)
|
||||
@@ -261,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) ;
|
||||
}
|
||||
@@ -273,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
|
||||
@@ -357,6 +412,7 @@ BtlGeom::AddPartBox( double dLength, double dHeight, double dWidth)
|
||||
m_ptOrig.y += dHeight + PART_OFFSET ;
|
||||
break ;
|
||||
case 1 :
|
||||
case 4 :
|
||||
m_ptOrig.y += max( dHeight, dWidth) + PART_OFFSET ;
|
||||
break ;
|
||||
case 2 :
|
||||
@@ -382,7 +438,7 @@ BtlGeom::AddPartBox( double dLength, double dHeight, double dWidth)
|
||||
if ( IsNull( pText))
|
||||
return false ;
|
||||
int nSide = BTL_SIDE_TOP ;
|
||||
if ( m_nFlatVertPos == 1 && m_vtDim.z > m_vtDim.y + EPS_SMALL)
|
||||
if (( m_nFlatVertPos == 1 || m_nFlatVertPos == 4) && m_vtDim.z > m_vtDim.y + EPS_SMALL)
|
||||
nSide = BTL_SIDE_FRONT ;
|
||||
else if ( m_nFlatVertPos == 2 && m_vtDim.y < m_vtDim.z + EPS_SMALL)
|
||||
nSide = BTL_SIDE_FRONT ;
|
||||
@@ -442,7 +498,7 @@ BtlGeom::AdjustPartFlatOrVertPos( void)
|
||||
// dimensioni pezzo
|
||||
Vector3d vtDim = b3Part.GetMax() - b3Part.GetMin() ;
|
||||
// se richiesto piatto ed è in verticale, ruoto
|
||||
if ( m_nFlatVertPos == 1 && vtDim.z > vtDim.y + EPS_SMALL) {
|
||||
if (( m_nFlatVertPos == 1 || m_nFlatVertPos == 4) && vtDim.z > vtDim.y + EPS_SMALL) {
|
||||
Point3d ptAx = b3Part.GetMin() + 0.5 * Vector3d( 0, vtDim.y, vtDim.y) ;
|
||||
m_pGDB->RotateGlob( m_nPartId, ptAx, X_AX, 0, -1) ;
|
||||
}
|
||||
@@ -515,7 +571,24 @@ BtlGeom::AddPartTransformation( const string& sUID, const Frame3d& frRef)
|
||||
// assegno Nome con UID
|
||||
m_pGDB->SetName( nId, "UID-" + sUID) ;
|
||||
// assegno Id pezzo istanziato
|
||||
m_pGDB->SetInfo( nId, "!SOU", m_nPartId) ;
|
||||
m_pGDB->SetInfo( nId, GDB_SI_SOURCE, m_nPartId) ;
|
||||
// nascondo e blocco
|
||||
m_pGDB->SetStatus( nId, GDB_ST_OFF) ;
|
||||
m_pGDB->SetMode( nId, GDB_MD_LOCKED) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::AddObjectRef( const string& sUID, const Frame3d& frRef)
|
||||
{
|
||||
// creo un nuovo gruppo nel pezzo
|
||||
int nId = m_pGDB->AddGroup( GDB_ID_NULL, m_nPartId, frRef) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// assegno Nome con UID
|
||||
m_pGDB->SetName( nId, "UID-" + sUID) ;
|
||||
// non posso ancora assegnare Id pezzo istanziato
|
||||
// nascondo e blocco
|
||||
m_pGDB->SetStatus( nId, GDB_ST_OFF) ;
|
||||
m_pGDB->SetMode( nId, GDB_MD_LOCKED) ;
|
||||
@@ -752,22 +825,69 @@ BtlGeom::SetAlpha( int nId, int nAlpha)
|
||||
Color cCol ;
|
||||
if ( ! m_pGDB->GetCalcMaterial( nId, cCol))
|
||||
return false ;
|
||||
if ( nAlpha < ALPHA_LIM)
|
||||
m_pGDB->SetInfo( nId, IKEY_COL_A, nAlpha) ;
|
||||
else
|
||||
m_pGDB->RemoveInfo( nId, IKEY_COL_A) ;
|
||||
cCol.SetAlpha( nAlpha) ;
|
||||
return m_pGDB->SetMaterial( nId, cCol) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::SortParts( void)
|
||||
BtlGeom::AdjustSnForParts( void)
|
||||
{
|
||||
// tabella Id-SN dei pezzi
|
||||
// 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)
|
||||
{
|
||||
// verifico gruppo
|
||||
if ( nGroupId == GDB_ID_NULL || ! m_pGDB->ExistsObj( nGroupId))
|
||||
return true ;
|
||||
|
||||
// tabella Id-SN dei pezzi
|
||||
INTINTVECTOR vIdSN ;
|
||||
|
||||
// recupero il numero di serie di ogni singolo pezzo
|
||||
int nPartId = m_pGDB->GetFirstGroupInGroup( nGroupId) ;
|
||||
while ( nPartId != GDB_ID_NULL) {
|
||||
int nLev ;
|
||||
if ( m_pGDB->GetCalcLevel( nPartId, nLev) && ( nLev == GDB_LV_USER || nGroupId != GDB_ID_ROOT)) {
|
||||
int nSN = 0 ;
|
||||
m_pGDB->GetInfo( nPartId, IKEY_PROD_NBR, nSN) ;
|
||||
vIdSN.emplace_back( nPartId, nSN) ;
|
||||
@@ -780,14 +900,13 @@ BtlGeom::SortParts( void)
|
||||
{ return a.second < b.second ; }) ;
|
||||
|
||||
// cambio posizione dei pezzi nel DB come da ordine in tabella
|
||||
Point3d ptIns ;
|
||||
for ( int i = 0 ; i < int( vIdSN.size()) ; ++ i) {
|
||||
m_pGDB->Relocate( vIdSN[i].first, GDB_ID_ROOT, GDB_LAST_SON) ;
|
||||
m_pGDB->Relocate( vIdSN[i].first, nGroupId, GDB_LAST_SON) ;
|
||||
BBox3d b3Part ;
|
||||
int nBoxId = m_pGDB->GetFirstNameInGroup( vIdSN[i].first, BOX_LAYER_NAME) ;
|
||||
m_pGDB->GetGlobalBBox( nBoxId, b3Part) ;
|
||||
m_pGDB->Translate( vIdSN[i].first, ptIns - b3Part.GetMin()) ;
|
||||
ptIns += Vector3d( 0, b3Part.GetMax().y - b3Part.GetMin().y + 300, 0) ;
|
||||
ptIns += Vector3d( 0, b3Part.GetMax().y - b3Part.GetMin().y + PART_OFFSET, 0) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
@@ -830,3 +949,201 @@ BtlGeom::UpdateNextOrigin( void)
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
BtlGeom::GetRawPartsGroup( bool bCreate)
|
||||
{
|
||||
// se non necessaria creazione ritorno quello che trovo
|
||||
if ( ! bCreate || m_nRawPartsId != GDB_ID_NULL)
|
||||
return m_nRawPartsId ;
|
||||
// creo il gruppo
|
||||
CreateRawPartsGroup() ;
|
||||
return m_nRawPartsId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::CreateRawPartsGroup( void)
|
||||
{
|
||||
// se già definito, non faccio alcunchè
|
||||
m_nRawPartsId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, RAWPARTS_GROUP_NAME) ;
|
||||
if ( m_nRawPartsId != GDB_ID_NULL)
|
||||
return true ;
|
||||
// creo il gruppo sotto la radice
|
||||
m_nRawPartsId = m_pGDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
|
||||
if ( m_nRawPartsId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// assegno livello di sistema
|
||||
m_pGDB->SetLevel( m_nRawPartsId, GDB_LV_SYSTEM) ;
|
||||
// assegno nome
|
||||
m_pGDB->SetName( m_nRawPartsId, RAWPARTS_GROUP_NAME) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::AdjustRawPart( int nRawPartId)
|
||||
{
|
||||
// verifico validità pezzo
|
||||
if ( nRawPartId == GDB_ID_NULL || ! m_pGDB->ExistsObj( nRawPartId))
|
||||
return false ;
|
||||
// cerco il gruppo dei grezzi in cui spostarlo
|
||||
int nRpsGroupId = GetRawPartsGroup( true) ;
|
||||
if ( nRpsGroupId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// lo sposto e lo nascondo
|
||||
return m_pGDB->Relocate( nRawPartId, nRpsGroupId) && m_pGDB->SetStatus( nRawPartId, GDB_ST_OFF) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::AdjustRefForRawParts( void)
|
||||
{
|
||||
// verifico esistenza gruppo dei grezzi
|
||||
int nRpsGroupId = GetRawPartsGroup() ;
|
||||
if ( nRpsGroupId == GDB_ID_NULL)
|
||||
return true ;
|
||||
|
||||
// tabella Id-UID dei pezzi
|
||||
std::unordered_map< int, int> umUIDId ;
|
||||
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) {
|
||||
for ( int i = 1 ; ; ++ i) {
|
||||
int nUID ;
|
||||
string sUIDKey = "UID" + ToString( i) ;
|
||||
if ( ! m_pGDB->GetInfo( nPartId, sUIDKey, nUID))
|
||||
break ;
|
||||
umUIDId.emplace( nUID, nPartId) ;
|
||||
}
|
||||
}
|
||||
nPartId = m_pGDB->GetNextGroup( nPartId) ;
|
||||
}
|
||||
|
||||
// assegno riferimenti nei grezzi
|
||||
int nRawPartId = m_pGDB->GetFirstGroupInGroup( nRpsGroupId) ;
|
||||
while ( nRawPartId != GDB_ID_NULL) {
|
||||
int nRefId = m_pGDB->GetFirstNameInGroup( nRawPartId, "UID-*") ;
|
||||
while ( nRefId != GDB_ID_NULL) {
|
||||
string sName ; m_pGDB->GetName( nRefId, sName) ;
|
||||
int nUID ;
|
||||
if ( FromString( sName.substr( 4), nUID)) {
|
||||
auto Iter = umUIDId.find( nUID) ;
|
||||
if ( Iter != umUIDId.end())
|
||||
m_pGDB->SetInfo( nRefId, GDB_SI_SOURCE, Iter->second) ;
|
||||
}
|
||||
nRefId = m_pGDB->GetNextName( nRefId, "UID-*") ;
|
||||
}
|
||||
nRawPartId = m_pGDB->GetNextGroup( nRawPartId) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
BtlGeom::GetCompositesGroup( bool bCreate)
|
||||
{
|
||||
// se non necessaria creazione ritorno quello che trovo
|
||||
if ( ! bCreate || m_nCompositesId != GDB_ID_NULL)
|
||||
return m_nCompositesId ;
|
||||
// creo il gruppo
|
||||
CreateCompositesGroup() ;
|
||||
return m_nCompositesId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::CreateCompositesGroup( void)
|
||||
{
|
||||
// se già definito, non faccio alcunchè
|
||||
m_nCompositesId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, COMPOSITES_GROUP_NAME) ;
|
||||
if ( m_nCompositesId != GDB_ID_NULL)
|
||||
return true ;
|
||||
// creo il gruppo sotto la radice
|
||||
m_nCompositesId = m_pGDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
|
||||
if ( m_nCompositesId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// assegno livello di sistema
|
||||
m_pGDB->SetLevel( m_nCompositesId, GDB_LV_SYSTEM) ;
|
||||
// assegno nome
|
||||
m_pGDB->SetName( m_nCompositesId, COMPOSITES_GROUP_NAME) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::AdjustComposite( int nCompositeId)
|
||||
{
|
||||
// verifico validità pezzo
|
||||
if ( nCompositeId == GDB_ID_NULL || ! m_pGDB->ExistsObj( nCompositeId))
|
||||
return false ;
|
||||
// cerco il gruppo dei compositi in cui spostarlo
|
||||
int nCmpGroupId = GetCompositesGroup( true) ;
|
||||
if ( nCmpGroupId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// lo sposto e lo nascondo
|
||||
return m_pGDB->Relocate( nCompositeId, nCmpGroupId) && m_pGDB->SetStatus( nCompositeId, GDB_ST_OFF) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::AdjustRefForComposites( void)
|
||||
{
|
||||
// verifico esistenza gruppo dei compositi
|
||||
int nCmpsGroupId = GetCompositesGroup() ;
|
||||
if ( nCmpsGroupId == GDB_ID_NULL)
|
||||
return true ;
|
||||
|
||||
// tabella Id-UID dei pezzi e dei compositi
|
||||
std::unordered_map< int, int> umUIDId ;
|
||||
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) {
|
||||
for ( int i = 1 ; ; ++ i) {
|
||||
int nUID ;
|
||||
string sUIDKey = "UID" + ToString( i) ;
|
||||
if ( ! m_pGDB->GetInfo( nPartId, sUIDKey, nUID))
|
||||
break ;
|
||||
umUIDId.emplace( nUID, nPartId) ;
|
||||
}
|
||||
}
|
||||
nPartId = m_pGDB->GetNextGroup( nPartId) ;
|
||||
}
|
||||
int nCompoId = m_pGDB->GetFirstGroupInGroup( nCmpsGroupId) ;
|
||||
while ( nCompoId != GDB_ID_NULL) {
|
||||
int nLev ;
|
||||
if ( m_pGDB->GetCalcLevel( nCompoId, nLev) && nLev != GDB_LV_USER) {
|
||||
for ( int i = 1 ; ; ++ i) {
|
||||
int nUID ;
|
||||
string sUIDKey = "UID" + ToString( i) ;
|
||||
if ( ! m_pGDB->GetInfo( nCompoId, sUIDKey, nUID))
|
||||
break ;
|
||||
umUIDId.emplace( nUID, nCompoId) ;
|
||||
}
|
||||
}
|
||||
nCompoId = m_pGDB->GetNextGroup( nCompoId) ;
|
||||
}
|
||||
|
||||
// assegno riferimenti nei compositi
|
||||
int nCompositeId = m_pGDB->GetFirstGroupInGroup( nCmpsGroupId) ;
|
||||
while ( nCompositeId != GDB_ID_NULL) {
|
||||
int nRefId = m_pGDB->GetFirstNameInGroup( nCompositeId, "UID-*") ;
|
||||
while ( nRefId != GDB_ID_NULL) {
|
||||
string sName ; m_pGDB->GetName( nRefId, sName) ;
|
||||
int nUID ;
|
||||
if ( FromString( sName.substr( 4), nUID)) {
|
||||
auto Iter = umUIDId.find( nUID) ;
|
||||
if ( Iter != umUIDId.end())
|
||||
m_pGDB->SetInfo( nRefId, GDB_SI_SOURCE, Iter->second) ;
|
||||
}
|
||||
nRefId = m_pGDB->GetNextName( nRefId, "UID-*") ;
|
||||
}
|
||||
nCompositeId = m_pGDB->GetNextGroup( nCompositeId) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
// EgalTech 2015-2022
|
||||
//----------------------------------------------------------------------------
|
||||
// File : BtlGeom.h Data : 26.08.15 Versione : 1.6h5
|
||||
// File : BtlGeom.h Data : 04.04.22 Versione : 2.4d25
|
||||
// Contenuto : Dichiarazione della classe BtlGeom.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 26.08.15 DS Creazione modulo.
|
||||
//
|
||||
// 04.04.22 DS Aggiunta gestione trim feature con outline.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -26,7 +26,7 @@ class BtlGeom
|
||||
BtlGeom( void) ;
|
||||
|
||||
public :
|
||||
bool Init( IGeomDB* pGDB, int nFlatPos, bool bSpecialTrim, bool bUseUAttr) ;
|
||||
bool Init( IGeomDB* pGDB, int nFlatPos, bool bSpecialTrim, bool bTrimWithOutline, bool bUseUAttr) ;
|
||||
bool CreatePart( void) ;
|
||||
bool SetPart( int nPartId) ;
|
||||
bool ErasePart( void) ;
|
||||
@@ -36,59 +36,66 @@ 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) ;
|
||||
bool ResetPartSolid( void) ;
|
||||
std::string GetPartName( void) ;
|
||||
bool SetUserAttribute( int nUAttrDest, const std::string& sString) ;
|
||||
bool SetUserAttribute( int nUAttrDest, const std::string& sKey, const std::string& sVal) ;
|
||||
bool SortParts( void) ;
|
||||
bool AdjustSnForParts( void) ;
|
||||
bool SortObjects( int nGroupId, Point3d& ptIns) ;
|
||||
bool UpdateNextOrigin( void) ;
|
||||
int GetRawPartsGroup( bool bCreate = false) ;
|
||||
bool AdjustRawPart( int nRawPartId) ;
|
||||
bool AdjustRefForRawParts( void) ;
|
||||
int GetCompositesGroup( bool bCreate = false) ;
|
||||
bool AdjustComposite( int nCompositeId) ;
|
||||
bool AdjustRefForComposites( void) ;
|
||||
|
||||
public : // Outline
|
||||
bool AddPartOutline( int nSide, const FCEDEQUE& dqFce, int nContType, int nContData, double dContPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddPartOutline( int nSide, int nCrvId, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddPartAperture( int nSide, const FCEDEQUE& dqFce, int nContType, int nContData, double dContPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddPartAperture( int nSide, int nCrvId, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool UpdateOutLine( void) ;
|
||||
bool AddPartStdOutline( void) ;
|
||||
bool AddPartCustomOutline( void) ;
|
||||
bool TrimOutlineWithApertures( void) ;
|
||||
bool TrimOutlineWithProcesses( void) ;
|
||||
bool TrimProcessWithOutline( int nProcId) ;
|
||||
|
||||
public : // Proc
|
||||
bool GetProcessParamInfos( int nGroup, int nProc, int nSide,
|
||||
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar) const ;
|
||||
bool AddProcess( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId, const Frame3d& frRef,
|
||||
const INTVECTOR& vnDPar, int nSPar, const DBLVECTOR& vdPar, const std::string& sPar, const STRVECTOR& vsUAtt, int nLine) ;
|
||||
bool AddOneFreeContour( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId, const Frame3d& frRef,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt, int nCrvId, int nCrv2Id) ;
|
||||
int GetLastProcessId( void) { return m_nProcId ; }
|
||||
bool CreateFreeContours( void) ;
|
||||
bool SetProcessColor( int nId, bool bEnable) ;
|
||||
|
||||
public : // Proc BTLx
|
||||
bool AddTenonBTLX( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
const INTVECTOR& vnDPar, DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddDovetailTenonBTLX( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddShapeBTLX( std::vector<INTVECTOR> vFacesVertices, std::vector<Point3d> vPoints) ;
|
||||
const INTVECTOR& vnDPar, DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddShapeBTLX( const INTMATRIX& vFacesVertices, const PNTVECTOR& vPoints) ;
|
||||
|
||||
private :
|
||||
bool CreateInfoGroup( void) ;
|
||||
bool CreateAssemblyGroup( void) ;
|
||||
bool ReadUserAttribute( const std::string& sString, std::string& sKey, std::string& sVal) ;
|
||||
public : // Data
|
||||
bool IsTrueSide( int nSide) const ; // esclude gli estremi (RIGHT e LEFT)
|
||||
std::string GetOutlineOutName( int nSide) const ;
|
||||
std::string GetOutlineApertureName( int nSide) const ;
|
||||
std::string GetOutlineTopName( int nSide) const ;
|
||||
std::string GetOutlineBottomName( int nSide) const ;
|
||||
double GetSideLength( int nSide) const ;
|
||||
double GetSideWidth( int nSide) const ;
|
||||
double GetSideHeight( int nSide) const ;
|
||||
@@ -96,6 +103,17 @@ class BtlGeom
|
||||
Plane3d GetSidePlane( int nSide) const ;
|
||||
Vector3d GetSideVersN( int nSide) const ;
|
||||
int GetOppositeSide( int nSide) const ;
|
||||
|
||||
private :
|
||||
bool CreateInfoGroup( void) ;
|
||||
bool CreateAssemblyGroup( void) ;
|
||||
bool CreateRawPartsGroup( void) ;
|
||||
bool CreateCompositesGroup( void) ;
|
||||
bool ReadUserAttribute( const std::string& sString, std::string& sKey, std::string& sVal) ;
|
||||
std::string GetOutlineOutName( int nSide) const ;
|
||||
std::string GetOutlineApertureName( int nSide) const ;
|
||||
std::string GetOutlineTopName( int nSide) const ;
|
||||
std::string GetOutlineBottomName( int nSide) const ;
|
||||
bool SetAlpha( int nId, int nAlpha) ;
|
||||
|
||||
private : // Outline
|
||||
@@ -111,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) ;
|
||||
|
||||
@@ -125,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) ;
|
||||
@@ -153,17 +172,17 @@ class BtlGeom
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddPocket( 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 AddDrill( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
bool AddDrill( 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 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) ;
|
||||
bool AddDovetailTenon( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddDovetailMortise( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
bool AddDovetailMortise( 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 AddDtMortiseFront( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
@@ -179,6 +198,8 @@ class BtlGeom
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddStepJointNotch( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddPlaning( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddProfileFront( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddProfileHeadCoCo( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
@@ -199,10 +220,11 @@ class BtlGeom
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddVariant( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
ICurveComposite* GetFreeContourCurve( int nProcId, const Frame3d& frRef) ;
|
||||
ICurveComposite* GetFreeContourCurve( int nProcId, const Frame3d& frRef, bool bOnlyStartOk = false) ;
|
||||
ISurfTriMesh* CreateOneCurveFreeContour( const ICurveComposite* pCrvCompo) ;
|
||||
bool AdjustFreeContourCurve( ICurve* pCrv, int nSide, bool& bClosed, bool& bEndsOnCont) ;
|
||||
bool AdjustFreeContourCurve( ICurve* pCrv, int nSide, bool& bClosed, bool& bEndsOnOrOutCont) ;
|
||||
bool VerifyFreeContourCurveSideAng( const ICurveComposite* pCrvCompo) ;
|
||||
bool GetFreeContourCurveSideAngles( const ICurveComposite* pCrvCompo, DBLVECTOR& vSideAng) ;
|
||||
bool CreatePolygonInBox( const Point3d& ptP, const Vector3d& vtN, int nSide, Polygon3d& Polyg,
|
||||
double dMatMin = FACE_MIN_BACK_MAT, double dAreaMin = FACE_MIN_BACK_AREA) ;
|
||||
double GetPlaneElevation( const Plane3d& plPlane) ;
|
||||
@@ -234,14 +256,15 @@ class BtlGeom
|
||||
bool GetUserParam( const STRVECTOR& vsUAtt, const std::string& sKey, double& dVal) ;
|
||||
bool GetWaveLengths( int nWaves, double dLen, DBLVECTOR& vLen) ;
|
||||
bool GetWaveReductions( int nWaves, double dWidth, DBLVECTOR& vRed) ;
|
||||
bool InsertEmptySurface( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
bool InsertEmptySurface( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId, const Frame3d& frRef,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AdjustPointForPlaneNearBoxVertex( Point3d& ptP, const Vector3d& vtN, int nSide) ;
|
||||
|
||||
private :
|
||||
IGeomDB* m_pGDB ;
|
||||
int m_nFlatVertPos ; // flag per posizionamento pezzi (0=come sono, 1=di piatto, 2=in verticale)
|
||||
int m_nFlatVertPos ; // flag per posizionamento pezzi (0=come sono, 1=di piatto, 2=in verticale, 3=ruotato 90deg, 4=da outline o piatto)
|
||||
bool m_bSpecialTrim ; // flag per trim speciale regioni per pareti (solo con feature passanti)
|
||||
bool m_bTrimWithOutline ; // flag per trim delle feature con l'outline (se presente)
|
||||
bool m_bUseUAttr ; // flag per utilizzo attributi utente per modificare geometria features
|
||||
Color m_BoxCol ; // colore per box pezzi
|
||||
Color m_OutsCol ; // colore per outline pezzi
|
||||
@@ -251,6 +274,8 @@ class BtlGeom
|
||||
Color m_SolidCol ; // colore per il solido
|
||||
int m_nInfoId ; // identificativo gruppo per informazioni varie
|
||||
int m_nAsseId ; // identificativo gruppo per trasformazioni di assemblaggio
|
||||
int m_nRawPartsId ; // identificativo gruppo dei grezzi
|
||||
int m_nCompositesId ; // identificativo gruppo dei compositi
|
||||
Point3d m_ptOrig ; // origine di inserimento del prossimo pezzo
|
||||
int m_nPartId ; // identificativo del pezzo corrente
|
||||
int m_nAuxId ; // identificativo del layer aux del pezzo corrente
|
||||
|
||||
+24
-2
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
// EgalTech 2015-2022
|
||||
//----------------------------------------------------------------------------
|
||||
// File : BtlGeomCoStru.h Data : 25.08.15 Versione : 1.6h5
|
||||
// File : BtlGeomCoStru.h Data : 27.02.22 Versione : 2.4b3
|
||||
// Contenuto : Costanti e strutture per la classe BtlGeom.
|
||||
//
|
||||
//
|
||||
@@ -22,12 +22,19 @@
|
||||
static const std::string INFO_GROUP_NAME = "BtlInfo" ;
|
||||
// nome gruppo di sistema per riferimenti di definizione assemblaggio
|
||||
static const std::string ASSEMBLY_GROUP_NAME = "AsseBase" ;
|
||||
// nome gruppo di sistema per grezzi
|
||||
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" ;
|
||||
@@ -36,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" ;
|
||||
@@ -60,8 +69,11 @@ static const std::string IKEY_FRAME = "FRAME" ;
|
||||
static const std::string IKEY_MAINID = "MAINID" ;
|
||||
static const std::string IKEY_ADJID = "ADJID" ;
|
||||
static const std::string IKEY_AUXID = "AUXID" ;
|
||||
static const std::string IKEY_ORIGID = "ORIGID" ;
|
||||
static const std::string IKEY_START_FACE = "FCS" ;
|
||||
static const std::string IKEY_END_FACE = "FCE" ;
|
||||
static const std::string IKEY_SIDEANGS = "SideAngs" ;
|
||||
static const std::string IKEY_DEPTH = "DEPTH" ;
|
||||
static const std::string IKEY_POCKET = "PCKT" ;
|
||||
static const std::string IKEY_RULED = "RULED" ;
|
||||
static const std::string IKEY_CNT_TYPE = "CNT_TYPE" ;
|
||||
@@ -70,12 +82,16 @@ static const std::string IKEY_CNT_PAR = "CNT_PAR" ;
|
||||
static const std::string IKEY_TASKID = "TASKID" ;
|
||||
static const std::string IKEY_DO = "DO" ;
|
||||
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 ;
|
||||
@@ -100,12 +116,18 @@ const double DTMORT_EXTRA_LEN = 10.0 ;
|
||||
const double MIN_DTMORT_POCKET = 70.0 ;
|
||||
const double MAX_DTMORT_POCKET = 200.0 ;
|
||||
const double MIN_DTMORT_AREA = 100.0 ;
|
||||
// tolleranza fuoriuscita curve di tasche di code di rondine
|
||||
const double DTMORT_OUT_CRV_TOL = 30.0 ;
|
||||
// angolo di fianco per contorno libero default e non definito
|
||||
const double FC_SIDEANG_DEF = 0.0 ;
|
||||
const double FC_SIDEANG_NONE = 999.0 ;
|
||||
// tolleranza fuoriuscita curve di contorni liberi
|
||||
const double FC_OUT_CRV_TOL = 50.0 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Numero processo speciale Riferimento ad altro oggetto
|
||||
const int BTL_OBJECT_REF = 300 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Base del nome file geometria varianti
|
||||
static const std::string VARIANT_BASENAME = "Variant_" ;
|
||||
|
||||
+495
-44
@@ -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"
|
||||
@@ -77,8 +79,164 @@ BtlGeom::AddPartOutline( int nSide, const FCEDEQUE& dqFce, int nContType, int nC
|
||||
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pStm)) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// recupero eventuali angoli di fianco
|
||||
DBLVECTOR vSideAng ;
|
||||
if ( VerifyFreeContourCurveSideAng( pCrvCompo))
|
||||
GetFreeContourCurveSideAngles( pCrvCompo, vSideAng) ;
|
||||
// inserisco la curva nel DB geometrico
|
||||
int nTId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pCrvCompo)) ;
|
||||
if ( nTId != GDB_ID_NULL && vSideAng.size() > 0)
|
||||
m_pGDB->SetInfo( nTId, IKEY_SIDEANGS, vSideAng) ;
|
||||
// colore
|
||||
Color cCol = m_ProcsCol ;
|
||||
m_pGDB->SetMaterial( nId, cCol) ;
|
||||
m_pGDB->SetMaterial( nTId, cCol) ;
|
||||
// nome
|
||||
m_pGDB->SetName( nId, GetOutlineOutName( nSide)) ;
|
||||
// info con tipo
|
||||
m_pGDB->SetInfo( nId, IKEY_GROUP, 4) ;
|
||||
m_pGDB->SetInfo( nId, IKEY_PROC, 251) ;
|
||||
m_pGDB->SetInfo( nId, IKEY_SIDE, nSide) ;
|
||||
// eventuali parametri del contorno
|
||||
if ( nContType > 0 || ( nContType >= 0 && nContData != 0))
|
||||
m_pGDB->SetInfo( nId, IKEY_CNT_TYPE, nContType) ;
|
||||
if ( nContData != 0)
|
||||
m_pGDB->SetInfo( nId, IKEY_CNT_DATA, nContData) ;
|
||||
if ( abs( dContPar) > EPS_SMALL)
|
||||
m_pGDB->SetInfo( nId, IKEY_CNT_PAR, dContPar) ;
|
||||
// eventuali attributi utente
|
||||
if ( ! SetUserAttributes( nId, vsUAtt))
|
||||
return false ;
|
||||
// identificativi di geometrie ausiliarie
|
||||
SetAuxId( nId, {nTId}) ;
|
||||
// se richiesto Outline nel piano XY verifico ed eventualmente ruoto il pezzo
|
||||
if ( m_nFlatVertPos == 4) {
|
||||
Frame3d frOutline ;
|
||||
if ( m_pGDB->GetGroupGlobFrame( m_nOutsId, frOutline)) {
|
||||
Vector3d vtNorm = GetSideVersN( nSide) ;
|
||||
vtNorm.ToGlob( frOutline) ;
|
||||
if ( ! AreSameOrOppositeVectorApprox( vtNorm, Z_AX)) {
|
||||
BBox3d b3Part ;
|
||||
if ( m_pGDB->GetGlobalBBox( m_nBoxId, b3Part)) {
|
||||
Vector3d vtDim = b3Part.GetMax() - b3Part.GetMin() ;
|
||||
Point3d ptAx = b3Part.GetMin() + 0.5 * Vector3d( 0, vtDim.y, vtDim.y) ;
|
||||
m_pGDB->RotateGlob( m_nPartId, ptAx, X_AX, 0, 1) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::AddPartOutline( int nSide, int nCrvId, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt)
|
||||
{
|
||||
// reset dell'identificativo della geometria principale della feature
|
||||
m_nProcId = GDB_ID_NULL ;
|
||||
// verifico esistenza pezzo
|
||||
if ( m_nBoxId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// verifico validità faccia
|
||||
if ( ! IsTrueSide( nSide))
|
||||
return false ;
|
||||
// verifica dei parametri
|
||||
if ( vdPar.size() < 14)
|
||||
return false ;
|
||||
// sistemo i dati
|
||||
int nContType = lround( vdPar[11]) ; // P13
|
||||
int nContData = lround( vdPar[12]) ; // P14
|
||||
double dContPar = vdPar[13] ; // P15
|
||||
// verifico esista il percorso di contorno
|
||||
if ( nCrvId == GDB_ID_NULL) {
|
||||
// inserisco superficie vuota come marcatore
|
||||
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pStm) || ! pStm->AdjustTopology())
|
||||
return false ;
|
||||
// la inserisco nel DB geometrico
|
||||
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pStm)) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// nome
|
||||
m_pGDB->SetName( nId, GetOutlineOutName( nSide)) ;
|
||||
// info con tipo
|
||||
m_pGDB->SetInfo( nId, IKEY_GROUP, 4) ;
|
||||
m_pGDB->SetInfo( nId, IKEY_PROC, 251) ;
|
||||
m_pGDB->SetInfo( nId, IKEY_SIDE, nSide) ;
|
||||
// eventuali parametri del contorno
|
||||
if ( nContType > 0 || ( nContType >= 0 && nContData != 0))
|
||||
m_pGDB->SetInfo( nId, IKEY_CNT_TYPE, nContType) ;
|
||||
if ( nContData != 0)
|
||||
m_pGDB->SetInfo( nId, IKEY_CNT_DATA, nContData) ;
|
||||
if ( abs( dContPar) > EPS_SMALL)
|
||||
m_pGDB->SetInfo( nId, IKEY_CNT_PAR, dContPar) ;
|
||||
// eventuali attributi utente
|
||||
if ( ! SetUserAttributes( nId, vsUAtt))
|
||||
return false ;
|
||||
m_nProcId = nId ;
|
||||
// messaggio di warning in log
|
||||
string sOut = " Warning : Empty Outline (" + ToString( nSide) +
|
||||
") on line " + ToString( m_nBtlLine) ;
|
||||
LOG_WARN( GetEExLogger(), sOut.c_str())
|
||||
return true ;
|
||||
}
|
||||
// copio il percorso di contorno
|
||||
PtrOwner<ICurveComposite> pCrvCompo ;
|
||||
if ( m_pGDB->GetGeoType( nCrvId) & GEO_CURVE) {
|
||||
pCrvCompo.Set( CreateCurveComposite()) ;
|
||||
if ( ! pCrvCompo->CopyFrom( m_pGDB->GetGeoObj( nCrvId)))
|
||||
pCrvCompo.Reset() ;
|
||||
}
|
||||
if ( IsNull( pCrvCompo))
|
||||
return false ;
|
||||
// verifico che sia chiuso
|
||||
if ( ! pCrvCompo->IsClosed())
|
||||
return false ;
|
||||
// assegno eventuali angoli di fianco
|
||||
{ DBLVECTOR vSideAng ;
|
||||
if ( m_pGDB->GetInfo( nCrvId, IKEY_SIDEANGS, vSideAng)) {
|
||||
for ( int i = 0 ; i < int( vSideAng.size()) ; ++ i)
|
||||
pCrvCompo->SetCurveTempProp( i, int( vSideAng[i] * 1000)) ;
|
||||
}
|
||||
}
|
||||
// Lo porto nel riferimento del lato e ve lo appiattisco
|
||||
Frame3d frRef = GetSideFrame( nSide) ;
|
||||
pCrvCompo->ToLoc( frRef) ;
|
||||
pCrvCompo->Scale( Frame3d(), 1, 1, 0) ;
|
||||
// aggiusto orientamento affinché sia antiorario (devo inoltre invertire il segno dell'angolo di fianco)
|
||||
double dArea ;
|
||||
pCrvCompo->GetAreaXY( dArea) ;
|
||||
if ( dArea < 0) {
|
||||
pCrvCompo->Invert() ;
|
||||
for ( int i = 0 ; i < pCrvCompo->GetCurveCount() ; ++ i) {
|
||||
int nAng ;
|
||||
if ( pCrvCompo->GetCurveTempProp( i, nAng) && abs( nAng) > 10)
|
||||
pCrvCompo->SetCurveTempProp( i, -nAng) ;
|
||||
}
|
||||
}
|
||||
// Porto il percorso sul piano corretto
|
||||
pCrvCompo->ToGlob( frRef) ;
|
||||
// Sistemazioni della curva
|
||||
pCrvCompo->SetExtrusion( frRef.VersZ()) ;
|
||||
pCrvCompo->SetThickness( -GetSideHeight( nSide)) ;
|
||||
// Creo la superficie
|
||||
PtrOwner<ISurfTriMesh> pStm ;
|
||||
pStm.Set( CreateOneCurveFreeContour( pCrvCompo)) ;
|
||||
if ( IsNull( pStm))
|
||||
return false ;
|
||||
// Inserisco la superficie nel layer Outline
|
||||
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pStm)) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// recupero eventuali angoli di fianco
|
||||
DBLVECTOR vSideAng ;
|
||||
if ( VerifyFreeContourCurveSideAng( pCrvCompo))
|
||||
GetFreeContourCurveSideAngles( pCrvCompo, vSideAng) ;
|
||||
// inserisco la curva nel DB geometrico
|
||||
int nTId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pCrvCompo)) ;
|
||||
if ( nTId != GDB_ID_NULL && vSideAng.size() > 0)
|
||||
m_pGDB->SetInfo( nTId, IKEY_SIDEANGS, vSideAng) ;
|
||||
// colore
|
||||
Color cCol = m_ProcsCol ;
|
||||
m_pGDB->SetMaterial( nId, cCol) ;
|
||||
@@ -102,6 +260,7 @@ BtlGeom::AddPartOutline( int nSide, const FCEDEQUE& dqFce, int nContType, int nC
|
||||
// identificativi di geometrie ausiliarie
|
||||
SetAuxId( nId, {nTId}) ;
|
||||
|
||||
m_nProcId = nId ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -148,8 +307,14 @@ BtlGeom::AddPartAperture( int nSide, const FCEDEQUE& dqFce, int nContType, int n
|
||||
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pStm)) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// recupero eventuali angoli di fianco
|
||||
DBLVECTOR vSideAng ;
|
||||
if ( VerifyFreeContourCurveSideAng( pCrvCompo))
|
||||
GetFreeContourCurveSideAngles( pCrvCompo, vSideAng) ;
|
||||
// inserisco la curva nel DB geometrico
|
||||
int nTId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pCrvCompo)) ;
|
||||
if ( nTId != GDB_ID_NULL && vSideAng.size() > 0)
|
||||
m_pGDB->SetInfo( nTId, IKEY_SIDEANGS, vSideAng) ;
|
||||
// colore
|
||||
Color cCol = m_ProcsCol ;
|
||||
m_pGDB->SetMaterial( nId, cCol) ;
|
||||
@@ -176,6 +341,135 @@ BtlGeom::AddPartAperture( int nSide, const FCEDEQUE& dqFce, int nContType, int n
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::AddPartAperture( int nSide, int nCrvId, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt)
|
||||
{
|
||||
// reset dell'identificativo della geometria principale della feature
|
||||
m_nProcId = GDB_ID_NULL ;
|
||||
// verifico esistenza pezzo
|
||||
if ( m_nBoxId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// verifico validità faccia
|
||||
if ( ! IsTrueSide( nSide))
|
||||
return false ;
|
||||
// verifica dei parametri
|
||||
if ( vdPar.size() < 14)
|
||||
return false ;
|
||||
// sistemo i dati
|
||||
int nContType = lround( vdPar[11]) ; // P13
|
||||
int nContData = lround( vdPar[12]) ; // P14
|
||||
double dContPar = vdPar[13] ; // P15
|
||||
// verifico esista il percorso di contorno
|
||||
if ( nCrvId == GDB_ID_NULL) {
|
||||
// inserisco superficie vuota come marcatore
|
||||
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pStm) || ! pStm->AdjustTopology())
|
||||
return false ;
|
||||
// la inserisco nel DB geometrico
|
||||
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pStm)) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// nome
|
||||
m_pGDB->SetName( nId, GetOutlineApertureName( nSide)) ;
|
||||
// info con tipo
|
||||
m_pGDB->SetInfo( nId, IKEY_GROUP, 4) ;
|
||||
m_pGDB->SetInfo( nId, IKEY_PROC, 252) ;
|
||||
m_pGDB->SetInfo( nId, IKEY_SIDE, nSide) ;
|
||||
// eventuali parametri del contorno
|
||||
if ( nContType > 0 || ( nContType >= 0 && nContData != 0))
|
||||
m_pGDB->SetInfo( nId, IKEY_CNT_TYPE, nContType) ;
|
||||
if ( nContData != 0)
|
||||
m_pGDB->SetInfo( nId, IKEY_CNT_DATA, nContData) ;
|
||||
if ( abs( dContPar) > EPS_SMALL)
|
||||
m_pGDB->SetInfo( nId, IKEY_CNT_PAR, dContPar) ;
|
||||
// eventuali attributi utente
|
||||
if ( ! SetUserAttributes( nId, vsUAtt))
|
||||
return false ;
|
||||
m_nProcId = nId ;
|
||||
// messaggio di warning in log
|
||||
string sOut = " Warning : Empty Aperture (" + ToString( nSide) +
|
||||
") on line " + ToString( m_nBtlLine) ;
|
||||
LOG_WARN( GetEExLogger(), sOut.c_str())
|
||||
return true ;
|
||||
}
|
||||
// copio il percorso di contorno
|
||||
PtrOwner<ICurveComposite> pCrvCompo ;
|
||||
if ( m_pGDB->GetGeoType( nCrvId) & GEO_CURVE) {
|
||||
pCrvCompo.Set( CreateCurveComposite()) ;
|
||||
if ( ! pCrvCompo->CopyFrom( m_pGDB->GetGeoObj( nCrvId)))
|
||||
pCrvCompo.Reset() ;
|
||||
}
|
||||
if ( IsNull( pCrvCompo))
|
||||
return false ;
|
||||
// verifico che sia chiuso
|
||||
if ( ! pCrvCompo->IsClosed())
|
||||
return false ;
|
||||
// assegno eventuali angoli di fianco
|
||||
{ DBLVECTOR vSideAng ;
|
||||
if ( m_pGDB->GetInfo( nCrvId, IKEY_SIDEANGS, vSideAng)) {
|
||||
for ( int i = 0 ; i < int( vSideAng.size()) ; ++ i)
|
||||
pCrvCompo->SetCurveTempProp( i, int( vSideAng[i] * 1000)) ;
|
||||
}
|
||||
}
|
||||
// Lo porto nel riferimento del lato e ve lo appiattisco
|
||||
Frame3d frRef = GetSideFrame( nSide) ;
|
||||
pCrvCompo->ToLoc( frRef) ;
|
||||
pCrvCompo->Scale( Frame3d(), 1, 1, 0) ;
|
||||
// aggiusto orientamento affinché sia orario
|
||||
double dArea ;
|
||||
pCrvCompo->GetAreaXY( dArea) ;
|
||||
if ( dArea > 0)
|
||||
pCrvCompo->Invert() ;
|
||||
// Porto il percorso sul piano corretto e ve lo appiattisco
|
||||
pCrvCompo->ToGlob( frRef) ;
|
||||
// Sistemazioni della curva
|
||||
pCrvCompo->SetExtrusion( frRef.VersZ()) ;
|
||||
pCrvCompo->SetThickness( -GetSideHeight( nSide)) ;
|
||||
// Creo la superficie
|
||||
PtrOwner<ISurfTriMesh> pStm ;
|
||||
pStm.Set( CreateOneCurveFreeContour( pCrvCompo)) ;
|
||||
if ( IsNull( pStm))
|
||||
return false ;
|
||||
// Inserisco la superficie nel layer Outline
|
||||
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pStm)) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// recupero eventuali angoli di fianco
|
||||
DBLVECTOR vSideAng ;
|
||||
if ( VerifyFreeContourCurveSideAng( pCrvCompo))
|
||||
GetFreeContourCurveSideAngles( pCrvCompo, vSideAng) ;
|
||||
// inserisco la curva nel DB geometrico
|
||||
int nTId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pCrvCompo)) ;
|
||||
if ( nTId != GDB_ID_NULL && vSideAng.size() > 0)
|
||||
m_pGDB->SetInfo( nTId, IKEY_SIDEANGS, vSideAng) ;
|
||||
// colore
|
||||
Color cCol = m_ProcsCol ;
|
||||
m_pGDB->SetMaterial( nId, cCol) ;
|
||||
m_pGDB->SetMaterial( nTId, cCol) ;
|
||||
// nome
|
||||
m_pGDB->SetName( nId, GetOutlineApertureName( nSide)) ;
|
||||
// info con tipo
|
||||
m_pGDB->SetInfo( nId, IKEY_GROUP, 4) ;
|
||||
m_pGDB->SetInfo( nId, IKEY_PROC, 252) ;
|
||||
m_pGDB->SetInfo( nId, IKEY_SIDE, nSide) ;
|
||||
// eventuali parametri del contorno
|
||||
if ( nContType > 0 || ( nContType >= 0 && nContData != 0))
|
||||
m_pGDB->SetInfo( nId, IKEY_CNT_TYPE, nContType) ;
|
||||
if ( nContData != 0)
|
||||
m_pGDB->SetInfo( nId, IKEY_CNT_DATA, nContData) ;
|
||||
if ( abs( dContPar) > EPS_SMALL)
|
||||
m_pGDB->SetInfo( nId, IKEY_CNT_PAR, dContPar) ;
|
||||
// eventuali attributi utente
|
||||
if ( ! SetUserAttributes( nId, vsUAtt))
|
||||
return false ;
|
||||
// identificativi di geometrie ausiliarie
|
||||
SetAuxId( nId, {nTId}) ;
|
||||
|
||||
m_nProcId = nId ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::UpdateOutLine( void)
|
||||
@@ -202,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 ;
|
||||
}
|
||||
|
||||
@@ -268,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
|
||||
@@ -380,18 +685,55 @@ BtlGeom::TrimOutlineWithApertures( void)
|
||||
bool
|
||||
BtlGeom::TrimOutlineWithProcesses( void)
|
||||
{
|
||||
int nProcId = m_pGDB->GetFirstInGroup( m_nProcsId) ;
|
||||
while ( nProcId != GDB_ID_NULL) {
|
||||
// calcolo il numero dei processi di trimming presenti
|
||||
int nProcCount = 0 ;
|
||||
for ( int nProcId = m_pGDB->GetFirstInGroup( m_nProcsId) ;
|
||||
nProcId != GDB_ID_NULL ;
|
||||
nProcId = m_pGDB->GetNext( nProcId)) {
|
||||
// deve essere una superficie
|
||||
if ( m_pGDB->GetGeoType( nProcId) != SRF_TRIMESH)
|
||||
continue ;
|
||||
// deve essere attiva
|
||||
int nDO = 1 ;
|
||||
int nTrim = 1 ;
|
||||
m_pGDB->GetInfo( nProcId, IKEY_DO, nDO) ;
|
||||
if ( nDO == 0)
|
||||
continue ;
|
||||
// deve essere abilitata al trimming
|
||||
int nTrim = 1 ;
|
||||
m_pGDB->GetInfo( nProcId, IKEY_TRIM, nTrim) ;
|
||||
// se necessario, aggiusto l'outline
|
||||
if ( nDO != 0 && nTrim != 0 &&
|
||||
m_pGDB->GetGeoType( nProcId) == SRF_TRIMESH &&
|
||||
UseProcessToTrimOutline( nProcId))
|
||||
TrimOutline( nProcId) ;
|
||||
nProcId = m_pGDB->GetNext( nProcId) ;
|
||||
if ( nTrim == 0 || ! UseProcessToTrimOutline( nProcId))
|
||||
continue ;
|
||||
// incremento il conteggio
|
||||
++ nProcCount ;
|
||||
}
|
||||
// se troppi, salto i fori
|
||||
bool bSkipDrills = ( nProcCount > 200) ;
|
||||
// eseguo il trim
|
||||
for ( int nProcId = m_pGDB->GetFirstInGroup( m_nProcsId) ;
|
||||
nProcId != GDB_ID_NULL ;
|
||||
nProcId = m_pGDB->GetNext( nProcId)) {
|
||||
// deve essere una superficie
|
||||
if ( m_pGDB->GetGeoType( nProcId) != SRF_TRIMESH)
|
||||
continue ;
|
||||
// deve essere attiva
|
||||
int nDO = 1 ;
|
||||
m_pGDB->GetInfo( nProcId, IKEY_DO, nDO) ;
|
||||
if ( nDO == 0)
|
||||
continue ;
|
||||
// deve essere abilitata al trimming
|
||||
int nTrim = 1 ;
|
||||
m_pGDB->GetInfo( nProcId, IKEY_TRIM, nTrim) ;
|
||||
if ( nTrim == 0 || ! UseProcessToTrimOutline( nProcId))
|
||||
continue ;
|
||||
// se fori da saltare, non deve essere un foro
|
||||
if ( bSkipDrills) {
|
||||
int nProc = 0 ;
|
||||
m_pGDB->GetInfo( nProcId, IKEY_PROC, nProc) ;
|
||||
if ( nProc == 40)
|
||||
continue ;
|
||||
}
|
||||
// eseguo il trim
|
||||
TrimOutline( nProcId) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
@@ -420,11 +762,20 @@ 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) {
|
||||
if ( nTrim == 2) {
|
||||
// Recupero le due superfici del processo di lavorazione
|
||||
int nAux ;
|
||||
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_AUXID, nAux)) {
|
||||
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_AUXID, nAux) && nAux != 0) {
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId)) ;
|
||||
const ISurfTriMesh* pAux = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId + nAux)) ;
|
||||
if ( pStm != nullptr && pAux != nullptr) {
|
||||
@@ -434,8 +785,10 @@ BtlGeom::TrimOutline( int nProcSurfId)
|
||||
return TrimOutline( pTrim) ;
|
||||
}
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
// Recupero la superficie del processo di lavorazione
|
||||
|
||||
// Trim con una sola superficie
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return false ;
|
||||
@@ -793,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
|
||||
@@ -804,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) ;
|
||||
}
|
||||
}
|
||||
@@ -873,9 +1226,9 @@ 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 = 1.0 ;
|
||||
const double EPS_OUT_NEAR = 5.0 ;
|
||||
double dL = GetSideLength( nSide) ;
|
||||
double dW = GetSideWidth( nSide) ;
|
||||
return ( ( ptP.x > - EPS_OUT_NEAR && ptP.x < EPS_IN_NEAR) ||
|
||||
@@ -884,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)
|
||||
@@ -941,46 +1304,134 @@ BtlGeom::TrimRayWithFaceContour( const Point3d& ptP, const Vector3d& vtDir, int
|
||||
return IntersCurveCurve( *pRay, *pCont).GetIntersPointNearTo( 0, ptP, ptInt) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::TrimProcessWithOutline( int nProcId)
|
||||
{
|
||||
// se non richiesto, esco subito
|
||||
if ( ! m_bTrimWithOutline)
|
||||
return true ;
|
||||
// verifico esistenza superficie della feature da trimmare
|
||||
ISurfTriMesh* pStm = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return false ;
|
||||
// se prevista anche una seconda superficie da trimmare
|
||||
ISurfTriMesh* pStm2 = nullptr ;
|
||||
int nTrim = 0 ;
|
||||
if ( m_pGDB->GetInfo( nProcId, IKEY_TRIM, nTrim) && nTrim == 2) {
|
||||
int nAux ;
|
||||
if ( m_pGDB->GetInfo( nProcId, IKEY_AUXID, nAux) && nAux != 0)
|
||||
pStm2 = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcId + nAux)) ;
|
||||
if ( pStm2 == nullptr)
|
||||
return false ;
|
||||
}
|
||||
// verifico esistenza superficie di outline
|
||||
int nOutId = GDB_ID_NULL ;
|
||||
int nEntId = m_pGDB->GetFirstInGroup( m_nOutsId) ;
|
||||
while ( nEntId != GDB_ID_NULL) {
|
||||
int nDO = 1 ;
|
||||
m_pGDB->GetInfo( nEntId, IKEY_DO, nDO) ;
|
||||
int nProc = 0 ;
|
||||
m_pGDB->GetInfo( nEntId, IKEY_PROC, nProc) ;
|
||||
int nSide = 0 ;
|
||||
m_pGDB->GetInfo( nEntId, IKEY_SIDE, nSide) ;
|
||||
if ( nDO != 0 && nProc == 251 && nSide != 0) {
|
||||
nOutId = nEntId ;
|
||||
break ;
|
||||
}
|
||||
nEntId = m_pGDB->GetNext( nEntId) ;
|
||||
}
|
||||
if ( nOutId == GDB_ID_NULL)
|
||||
return true ;
|
||||
// recupero la curva associata alla superficie di trim
|
||||
int nAuxId = 0 ;
|
||||
m_pGDB->GetInfo( nOutId, IKEY_AUXID, nAuxId) ;
|
||||
if ( nAuxId == 0)
|
||||
return true ;
|
||||
int nCrv = nOutId + nAuxId ;
|
||||
const ICurve* pCrv = GetCurve( m_pGDB->GetGeoObj( nCrv)) ;
|
||||
if ( pCrv == nullptr)
|
||||
return true ;
|
||||
// creo una copia della superficie come originale
|
||||
int nCopyId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, pStm->Clone()) ;
|
||||
if ( nCopyId == GDB_ID_NULL)
|
||||
return false ;
|
||||
string sOrigId = ( nCopyId - nProcId > 0 ? "+" : "") + ToString( nCopyId - nProcId) ;
|
||||
m_pGDB->SetInfo( nProcId, IKEY_ORIGID, sOrigId) ;
|
||||
string sMainId = ( nProcId - nCopyId > 0 ? "+" : "") + ToString( nProcId - nCopyId) ;
|
||||
m_pGDB->SetInfo( nCopyId, IKEY_MAINID, sMainId) ;
|
||||
m_pGDB->SetMode( nCopyId, GDB_MD_HIDDEN) ;
|
||||
// se esiste anche seconda superficie, copio anche questa
|
||||
if ( pStm2 != nullptr) {
|
||||
int nCopy2Id = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, pStm2->Clone()) ;
|
||||
if ( nCopy2Id == GDB_ID_NULL)
|
||||
return false ;
|
||||
string sAuxId = ( nCopy2Id - nCopyId > 0 ? "+" : "") + ToString( nCopy2Id - nCopyId) ;
|
||||
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( *pCopyCrv, false) &&
|
||||
( pStm2 == nullptr || pStm2->GeneralizedCut( *pCopyCrv, false))) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::AddShapeBTLX( vector<INTVECTOR> vFacesVertices, vector<Point3d> vPoints)
|
||||
BtlGeom::AddShapeBTLX( const INTMATRIX& vFacesVertices, const PNTVECTOR& vPoints)
|
||||
{
|
||||
ISurfTriMesh * Shape = CreateSurfTriMesh() ;
|
||||
|
||||
for ( auto it = vFacesVertices.begin() ; it != vFacesVertices.end() ; it++ ){
|
||||
|
||||
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){
|
||||
if ( vVertices.size() < 3) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Shape: Face not valid")
|
||||
return false ;
|
||||
}
|
||||
// Creo il contorno della faccia
|
||||
ICurveComposite* CurveCompo = CreateCurveComposite() ;
|
||||
CurveCompo->AddPoint( vPoints[vVertices[0]]) ;
|
||||
// creo il contorno della faccia
|
||||
PtrOwner<ICurveComposite> pCurveCompo( CreateCurveComposite()) ;
|
||||
pCurveCompo->AddPoint( vPoints[vVertices[0]]) ;
|
||||
for ( size_t i = 1 ; i != vVertices.size() ; i++)
|
||||
CurveCompo->AddLine( vPoints[vVertices[i]]) ;
|
||||
CurveCompo->AddLine( vPoints[vVertices[0]]) ;
|
||||
pCurveCompo->AddLine( vPoints[vVertices[i]]) ;
|
||||
pCurveCompo->AddLine( vPoints[vVertices[0]]) ;
|
||||
|
||||
if ( it == vFacesVertices.begin() || Shape == nullptr)
|
||||
Shape = GetSurfTriMeshByFlatContour( CurveCompo) ;
|
||||
else {
|
||||
ISurfTriMesh * surf = GetSurfTriMeshByFlatContour( CurveCompo) ;
|
||||
// controllo che CurveCompo racchiuda veramente una superficie
|
||||
if ( surf != nullptr) {
|
||||
if ( ! Shape->DoSewing( * surf)){
|
||||
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) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nPartId + 3, Shape) ; // salvo in outline
|
||||
if ( ! StmFts.End()) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Shape: StmFts.End error")
|
||||
return false ;
|
||||
}
|
||||
|
||||
PtrOwner<ISurfTriMesh> pShape( StmFts.GetSurf()) ;
|
||||
|
||||
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_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 ;
|
||||
}
|
||||
|
||||
+1052
-243
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.
|
||||
//
|
||||
//
|
||||
@@ -19,3 +19,5 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
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 ----------------------------------------
|
||||
@@ -89,6 +90,7 @@ GetEExLogger( void)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static std::string s_sKey ;
|
||||
static bool s_bNetHwKey = false ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
@@ -97,9 +99,52 @@ SetEExKey( const std::string& sKey)
|
||||
s_sKey = sKey ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
SetEExNetHwKey( bool bNetHwKey)
|
||||
{
|
||||
s_bNetHwKey = bNetHwKey ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
const std::string&
|
||||
GetEExKey( void)
|
||||
{
|
||||
return s_sKey ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
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.
+99
-14
@@ -22,14 +22,14 @@
|
||||
<ProjectGuid>{80FCBEA4-1883-4542-939D-8582E66D8D51}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>EgtExchange</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@@ -42,7 +42,7 @@
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@@ -101,10 +101,10 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;I_AM_EEX;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>
|
||||
</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -127,9 +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>
|
||||
</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -161,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>
|
||||
@@ -190,14 +191,14 @@ 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>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -215,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" />
|
||||
@@ -239,6 +322,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="ExportDxf.h" />
|
||||
<ClInclude Include="ExportStl.h" />
|
||||
<ClInclude Include="ExportSvg.h" />
|
||||
<ClInclude Include="ExportThreeJS.h" />
|
||||
<ClInclude Include="Import3MF.h" />
|
||||
<ClInclude Include="ImportBtl.h" />
|
||||
<ClInclude Include="BtlGeomCoStru.h" />
|
||||
@@ -275,6 +359,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="ExportDxf.cpp" />
|
||||
<ClCompile Include="ExportStl.cpp" />
|
||||
<ClCompile Include="ExportSvg.cpp" />
|
||||
<ClCompile Include="ExportThreeJS.cpp" />
|
||||
<ClCompile Include="Import3MF.cpp" />
|
||||
<ClCompile Include="ImportBtl.cpp" />
|
||||
<ClCompile Include="BtlGeom.cpp" />
|
||||
|
||||
@@ -126,6 +126,255 @@
|
||||
<ClInclude Include="Export3MF.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<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">
|
||||
@@ -203,6 +452,9 @@
|
||||
<ClCompile Include="Export3MF.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ExportThreeJS.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtExchange.rc">
|
||||
|
||||
@@ -43,6 +43,7 @@ ExcExecutor::ExcExecutor( void)
|
||||
m_ExecMgr.Insert( "IMPORTCNC", &ExcExecutor::ExecuteImportCnc) ;
|
||||
m_ExecMgr.Insert( "IMPORTDXF", &ExcExecutor::ExecuteImportDxf) ;
|
||||
m_ExecMgr.Insert( "IMPORTSTL", &ExcExecutor::ExecuteImportStl) ;
|
||||
//m_ExecMgr.Insert( "IMPORT3DM", &ExcExecutor::ExecuteImport3dm) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -234,3 +235,38 @@ ExcExecutor::ExecuteImportStl( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
////----------------------------------------------------------------------------
|
||||
//bool
|
||||
//ExcExecutor::ExecuteImport3dm( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
//{
|
||||
// // 2 o 3 parametri : nome del file, Id del gruppo[, ScaleFactor]
|
||||
// if ( vsParams.size() != 2 && vsParams.size() != 3)
|
||||
// return false ;
|
||||
// // eventuale conversione di token nel nome file
|
||||
// string sFile = vsParams[0] ;
|
||||
// m_pParser->DirReplace( sFile) ;
|
||||
// // recupero l'Id
|
||||
// int nId = m_pParser->GetIdParam( vsParams[1]) ;
|
||||
// if ( nId == CMD_ID_ERROR)
|
||||
// return false ;
|
||||
// // gestisco ScaleFactor
|
||||
// double dScaleFactor = 1 ;
|
||||
// if ( vsParams.size() >= 3)
|
||||
// FromString( vsParams[2], dScaleFactor) ;
|
||||
//
|
||||
// // preparo l'importatore
|
||||
// IImport3dm* pImp3dm = CreateImport3dm() ;
|
||||
// if ( pImp3dm == nullptr) {
|
||||
// LOG_ERROR( GetEExLogger(), "Error : CreateImportStl")
|
||||
// return false ;
|
||||
// }
|
||||
// // eseguo l'importazione
|
||||
// //bool bOk = pImp3dm->Import( sFile, m_pGDB, nId, dScaleFactor) ;
|
||||
// // cancello l'importatore
|
||||
// delete pImp3dm ;
|
||||
//
|
||||
// //return bOk ;
|
||||
//
|
||||
// //return true ;
|
||||
//}
|
||||
|
||||
@@ -40,6 +40,7 @@ class ExcExecutor : public IExcExecutor
|
||||
bool ExecuteImportDxf( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteImportCnc( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteImportStl( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
//bool ExecuteImport3dm( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
|
||||
private :
|
||||
IGeomDB* m_pGDB ;
|
||||
|
||||
+138
-79
@@ -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 ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_EXPBASE, GetEExLogger()))
|
||||
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IExport3MF*> ( new(nothrow) Export3MF) ;
|
||||
@@ -46,13 +49,14 @@ bool
|
||||
Export3MF::SetOptions( int nFilter)
|
||||
{
|
||||
m_nFilter = nFilter ;
|
||||
CalcGroupFilter() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
||||
{
|
||||
{
|
||||
// verifico il DB geometrico
|
||||
if ( pGDB == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), "Export3MF : Error on GeomDB")
|
||||
@@ -65,29 +69,39 @@ 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")
|
||||
return false ;
|
||||
return false ;
|
||||
}
|
||||
// creo model per 3MF
|
||||
m_model = m_wrapper->CreateModel() ;
|
||||
if ( ! m_model) {
|
||||
LOG_ERROR( GetEExLogger(), "Export3MF : Error on lib3mf Model")
|
||||
return false ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
if ( ! m_model->AddColorGroup()) {
|
||||
LOG_ERROR( GetEExLogger(), "Export3MF : Error on lib3mf Color Group")
|
||||
return false ;
|
||||
}
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
// creo un iteratore
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( pGDB)) ;
|
||||
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 ;
|
||||
@@ -111,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
|
||||
sName = ToString( iIter.GetId()) ;
|
||||
// recupero il colore
|
||||
Color cCol ;
|
||||
bool bCol = GetColor( cCol, iIter.GetGDB(), iIter.GetId()) ;
|
||||
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 ;
|
||||
@@ -189,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) ;
|
||||
@@ -197,27 +247,27 @@ 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) ;
|
||||
if ( pSTM == nullptr)
|
||||
return false ;
|
||||
return false ;
|
||||
|
||||
// ciclo sui vertici della trimesh
|
||||
vector<sLib3MFPosition> vVertices( pSTM->GetVertexSize()) ;
|
||||
vector<sLib3MFPosition> vVertices( pSTM->GetVertexSize()) ;
|
||||
for ( int i = 0 ; i < pSTM->GetVertexSize() ; i++) {
|
||||
Point3d pt ;
|
||||
pSTM->GetVertex( i, pt) ;
|
||||
pt.ToGlob( frFrame) ;
|
||||
vVertices[i].m_Coordinates[0] = Lib3MF_single( pt.x) ;
|
||||
vVertices[i].m_Coordinates[1] = Lib3MF_single( pt.y) ;
|
||||
vVertices[i].m_Coordinates[2] = Lib3MF_single( pt.z) ;
|
||||
vVertices[i].m_Coordinates[2] = Lib3MF_single( pt.z) ;
|
||||
}
|
||||
|
||||
// ciclo sui triangoli della trimesh
|
||||
@@ -225,36 +275,45 @@ 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] ;
|
||||
if ( ! pSTM->GetTriangle( i, nIdVert))
|
||||
continue ; // 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
|
||||
vTriangles[k].m_Indices[0] = nIdVert[0] ;
|
||||
vTriangles[k].m_Indices[1] = nIdVert[1] ;
|
||||
vTriangles[k].m_Indices[2] = nIdVert[2] ;
|
||||
k ++ ;
|
||||
}
|
||||
|
||||
if ( vVertices.size() == 0 || vTriangles.size() == 0) {
|
||||
LOG_ERROR( GetEExLogger(), ("Export3MF : surface \"" + sName + "\" is empty. Ignored.").c_str()) ;
|
||||
return true ;
|
||||
if ( vVertices.size() == 0 || vTriangles.size() == 0) {
|
||||
LOG_ERROR( GetEExLogger(), ( "Export3MF : surface \"" + sName + "\" is empty. Ignored.").c_str()) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
// creo mesh 3MF
|
||||
PMeshObject meshObject = m_model->AddMeshObject() ;
|
||||
if ( ! meshObject) {
|
||||
LOG_ERROR( GetEExLogger(), "Export3MF : Error on lib3mf Mesh Object")
|
||||
return false ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
meshObject->SetName( sName) ;
|
||||
meshObject->SetGeometry( vVertices, vTriangles) ;
|
||||
|
||||
// assegno il colore
|
||||
// assegno il colore
|
||||
if ( pCol != nullptr) {
|
||||
Lib3MF_uint32 nColId = ColorHandler3MF( pCol) ;
|
||||
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()) ;
|
||||
m_model->AddBuildItem( meshObject.get(), m_wrapper->GetIdentityTransform()) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -287,7 +346,7 @@ Export3MF::GetColor( Color& pCol, const IGeomDB * pGDB, const int& nId)
|
||||
|
||||
if ( ! pGDB->GetMaterial( nId, pCol))
|
||||
// se fallisce cerco il colore del parent
|
||||
return GetColor( pCol, pGDB, pGDB->GetParentId( nId)) ;
|
||||
return GetColor( pCol, pGDB, pGDB->GetParentId( nId)) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -300,15 +359,15 @@ 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) {
|
||||
sColor cColTmp = pColorGrp->GetColor( i) ;
|
||||
if ( cColTmp.m_Red == cCol3mf.m_Red && cColTmp.m_Green == cCol3mf.m_Green && cColTmp.m_Blue == cCol3mf.m_Blue
|
||||
&& cColTmp.m_Alpha == cCol3mf.m_Alpha)
|
||||
return i ;
|
||||
return i ;
|
||||
}
|
||||
// se non fosse presente, lo aggiungo
|
||||
return pColorGrp->AddColor( cCol3mf) ;
|
||||
}
|
||||
}
|
||||
|
||||
+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 ( ! 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 ( ! 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 ( ! 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()) ;
|
||||
|
||||
+3288
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,92 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalWare 2022-2022
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ExportThreeJS.h Data : 05.07.22 Versione : 2.4j1
|
||||
// Contenuto : Dichiarazione della classe ExportThreeJS.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 19.10.22
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EExExportThreeJS.h"
|
||||
#include "/EgtDev/Include/EGnWriter.h"
|
||||
#include "/EgtDev/Include/EGkColor.h"
|
||||
#include "/EgtDev/Include/EGkIntersSurfTmSurfTm.h"
|
||||
|
||||
class IGdbIterator ;
|
||||
class IGeoObj ;
|
||||
class Frame3d ;
|
||||
|
||||
|
||||
struct sSurfDist {
|
||||
const ISurfTriMesh* SurvAlpha ;
|
||||
double dDistance = 0 ;
|
||||
std::string sName ;
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class ExportThreeJS : public IExportThreeJS
|
||||
{
|
||||
public:
|
||||
virtual bool SetOptions( int nFilter) ;
|
||||
virtual bool Export( IGeomDB* pGDB, int nId, IEGrScene* pScene, bool bUdm, const std::string& sFile) ;
|
||||
|
||||
public:
|
||||
ExportThreeJS( void) : m_nFilter( EEXFLT_DEFAULT), m_bShowGrid( true), m_nGroupCount( -1), m_nCont( 0) {
|
||||
CalcGroupFilter() ;
|
||||
}
|
||||
|
||||
private:
|
||||
bool HeadAmbient( IEGrScene* pScene, IGeomDB* pGDB, int nId) ;
|
||||
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) ;
|
||||
bool ExportFrame3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
|
||||
bool ExportLine3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
|
||||
bool ExportCurveComp3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
|
||||
bool ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
|
||||
bool ExportSFR( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
|
||||
bool ExportSBezier(const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
|
||||
bool ExportText( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
|
||||
bool ExportDimension( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
|
||||
bool ScanGroup( const IGdbIterator& iIter, IGeomDB* pGDB, const int nIdGroup) ;
|
||||
bool ExportObject( const IGdbIterator& iIter, IGeomDB* pGDB, const int nIdGroup) ;
|
||||
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup) ;
|
||||
bool CalcGroupFilter( void) ;
|
||||
|
||||
private:
|
||||
int m_nFilter ; // filtro su livello, modo e stato, se l'oggeto da valutare è un oggetto geometrico
|
||||
int m_nGroupFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare è un gruppo
|
||||
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
|
||||
|
||||
public :
|
||||
static std::string m_sThreeJSLibDir ; // Direttorio librerie
|
||||
} ;
|
||||
+82
-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 ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImport3MF*> ( new( nothrow) Import3MF) ;
|
||||
@@ -222,6 +220,86 @@ Import3MF::ReadObject( const PObject pObj, ATTRVECTOR& vAttr, sTransform& sTrans
|
||||
bool
|
||||
Import3MF::ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, sTransform& sTransf)
|
||||
{
|
||||
// Recupero puntatore alla mesh 3MF
|
||||
PMeshObject pMesh = m_model->GetMeshObjectByID( nId) ;
|
||||
if ( pMesh.get() == nullptr)
|
||||
return false ;
|
||||
|
||||
// Creo e inizializzo trimesh
|
||||
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pStm) || ! pStm->Init( 3, 1)) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : ISurfTriMesh Create error") ;
|
||||
return false ;
|
||||
}
|
||||
pStm->SetLinearTolerance( 10 * EPS_SMALL) ;
|
||||
|
||||
// Ciclo sui vertici della mesh 3MF
|
||||
for ( Lib3MF_uint32 i = 0 ; i < pMesh->GetVertexCount() ; i ++) {
|
||||
// recupero le coordinate del vertice
|
||||
sPosition pVertex = pMesh->GetVertex( i) ;
|
||||
// applico la trasformazione
|
||||
double x = 0.0, y = 0.0, z = 0.0 ;
|
||||
for ( int k = 0 ; k < 3 ; k ++) {
|
||||
x += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][0] ;
|
||||
y += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][1] ;
|
||||
z += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][2] ;
|
||||
}
|
||||
x += sTransf.m_Fields[3][0] ;
|
||||
y += sTransf.m_Fields[3][1] ;
|
||||
z += sTransf.m_Fields[3][2] ;
|
||||
// inserisco il vertice nella trimesh
|
||||
if ( pStm->AddVertex( Point3d( x, y, z)) == SVT_NULL) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : ISurfTriMesh AddVertex error") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
// Ciclo sui triangoli della mesh 3MF
|
||||
for ( Lib3MF_uint32 i = 0 ; i < pMesh->GetTriangleCount() ; i ++) {
|
||||
// recupero gli indici dei vertici del triangolo
|
||||
sTriangle tTrg = pMesh->GetTriangle( i) ;
|
||||
int nIdV[3] = { int( tTrg.m_Indices[0]), int( tTrg.m_Indices[1]), int( tTrg.m_Indices[2])} ;
|
||||
// se i vertici sono tutti diversi tra loro, inserisco il triangolo
|
||||
if ( nIdV[0] != nIdV[1] && nIdV[0] != nIdV[2] && nIdV[1] != nIdV[2]) {
|
||||
if ( pStm->AddTriangle( nIdV) == SVT_NULL) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : ISurfTriMesh AddTriangle error") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Aggiustamenti finali
|
||||
if ( ! pStm->DoCompacting()) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : ISurfTriMesh DoCompacting error") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Inserimento nel DB geometrico
|
||||
int nGeoId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, Release( pStm)) ;
|
||||
if ( nGeoId == GDB_ID_NULL) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : error adding GeoObject") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// colore
|
||||
Lib3MF_uint32 pid, pindex ;
|
||||
if ( pMesh->GetObjectLevelProperty( pid, pindex)) {
|
||||
Color cCol ;
|
||||
if ( FindColor( pid, pindex, cCol))
|
||||
m_pGDB->SetMaterial( nGeoId, cCol) ;
|
||||
}
|
||||
|
||||
// attributes
|
||||
for ( size_t i = 0 ; i < vAttr.size() ; i++) {
|
||||
if ( vAttr[i].first == "name")
|
||||
m_pGDB->SetName( nGeoId, vAttr[i].second) ;
|
||||
else
|
||||
m_pGDB->SetInfo( nGeoId, vAttr[i].first, vAttr[i].second) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
|
||||
#if 0
|
||||
PMeshObject pMesh = m_model->GetMeshObjectByID( nId) ;
|
||||
|
||||
StmFromTriangleSoup Stm ;
|
||||
@@ -292,6 +370,7 @@ Import3MF::ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, sTransform& sT
|
||||
}
|
||||
|
||||
return true ;
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
|
||||
+120
-95
@@ -39,7 +39,7 @@ IImportBtl*
|
||||
CreateImportBtl( 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<IImportBtl*> ( new(nothrow) ImportBtl) ;
|
||||
@@ -67,15 +67,18 @@ ImportBtl::Import( const string& sFile, IGeomDB* pGDB, int nFlag)
|
||||
|
||||
// inizializzo il gestore geometria pezzi Btl
|
||||
int nFlatVertPos = 0 ;
|
||||
if (( nFlag & EIBFLAG_TS3_POS) != 0)
|
||||
if (( nFlag & EIBFLAG_OUTL_FLAT_POS) != 0)
|
||||
nFlatVertPos = 4 ;
|
||||
else if (( nFlag & EIBFLAG_TS3_POS) != 0)
|
||||
nFlatVertPos = 3 ;
|
||||
else if (( nFlag & EIBFLAG_FLAT_POS) != 0)
|
||||
nFlatVertPos = 1 ;
|
||||
else if (( nFlag & EIBFLAG_VERT_POS) != 0)
|
||||
nFlatVertPos = 2 ;
|
||||
bool bSpecialTrim = (( nFlag & EIBFLAG_SPECIAL_TRIM) != 0) ;
|
||||
bool bTrimWithOutline = (( nFlag & EIBFLAG_TRIM_WITH_OUTLINE) != 0) ;
|
||||
bool bUseUAttr = (( nFlag & EIBFLAG_USEUATTR) != 0) ;
|
||||
if ( ! m_BtlGeom.Init( pGDB, nFlatVertPos, bSpecialTrim, bUseUAttr)) {
|
||||
if ( ! m_BtlGeom.Init( pGDB, nFlatVertPos, bSpecialTrim, bTrimWithOutline, bUseUAttr)) {
|
||||
LOG_ERROR( GetEExLogger(), " Error on BtlGeom.Init")
|
||||
return false ;
|
||||
}
|
||||
@@ -91,25 +94,41 @@ ImportBtl::Import( const string& sFile, IGeomDB* pGDB, int nFlag)
|
||||
}
|
||||
|
||||
// lettura generalità
|
||||
if ( ! ReadGeneral()) {
|
||||
bool bEnd ;
|
||||
if ( ! ReadGeneral( bEnd)) {
|
||||
string sOut = " Error (ReadGeneral) on line " + ToString( m_theScanner.GetCurrLineNbr()) ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
else if ( bEnd) {
|
||||
string sOut = " Error No Parts in Btl file" ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
|
||||
// ciclo sui grezzi
|
||||
bool bOk = true ;
|
||||
for ( bool bEnd = false ; ! bEnd ;) {
|
||||
if ( ! ReadRawPart( bEnd)) {
|
||||
string sOut = " Error (ReadRawPart) on line " + ToString( m_theScanner.GetCurrLineNbr()) ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
// leggo un grezzo
|
||||
if ( ! ReadObject( RAWPART, bEnd)) {
|
||||
// i log di errore sono già gestiti nella funzione chiamata
|
||||
bOk = false ;
|
||||
}
|
||||
// se aggiunto un grezzo, lo sistemo
|
||||
if ( ! bEnd) {
|
||||
int nNewPart = m_BtlGeom.GetCurrPartId() ;
|
||||
if ( ! m_BtlGeom.AdjustRawPart( nNewPart)) {
|
||||
string sOut = " Error Adjusting RawPart on line " + ToString( m_theScanner.GetCurrLineNbr()) ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ciclo sui pezzi
|
||||
for ( bool bEnd = false ; ! bEnd ;) {
|
||||
if ( ! ReadPart( bEnd)) {
|
||||
// leggo un pezzo
|
||||
if ( ! ReadObject( PART, bEnd)) {
|
||||
// i log di errore sono già gestiti nella funzione chiamata
|
||||
bOk = false ;
|
||||
}
|
||||
@@ -117,17 +136,37 @@ ImportBtl::Import( const string& sFile, IGeomDB* pGDB, int nFlag)
|
||||
|
||||
// ciclo sui compositi
|
||||
for ( bool bEnd = false ; ! bEnd ;) {
|
||||
if ( ! ReadComposite( bEnd)) {
|
||||
string sOut = " Error on line " + ToString( m_theScanner.GetCurrLineNbr()) ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
// leggo un composito
|
||||
if ( ! ReadObject( COMPOSITE, bEnd)) {
|
||||
// i log di errore sono già gestiti nella funzione chiamata
|
||||
bOk = false ;
|
||||
}
|
||||
// se aggiunto un composito, lo sistemo
|
||||
if ( ! bEnd) {
|
||||
int nNewPart = m_BtlGeom.GetCurrPartId() ;
|
||||
if ( ! m_BtlGeom.AdjustComposite( nNewPart)) {
|
||||
string sOut = " Error Adjusting Composite on line " + ToString( m_theScanner.GetCurrLineNbr()) ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// eventuale ordinamento dei pezzi secondo SN
|
||||
// aggiusto riferimenti per grezzi e per compositi
|
||||
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)
|
||||
m_BtlGeom.SortParts() ;
|
||||
if ( bSort) {
|
||||
Point3d ptIns ;
|
||||
m_BtlGeom.SortObjects( GDB_ID_ROOT, ptIns) ;
|
||||
m_BtlGeom.SortObjects( m_BtlGeom.GetRawPartsGroup(), ptIns) ;
|
||||
m_BtlGeom.SortObjects( m_BtlGeom.GetCompositesGroup(), ptIns) ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
@@ -178,8 +217,10 @@ ImportBtl::ReadHeader( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtl::ReadGeneral( void)
|
||||
ImportBtl::ReadGeneral( bool& bEnd)
|
||||
{
|
||||
// default file non finito
|
||||
bEnd = false ;
|
||||
// conteggio campi utili letti
|
||||
int nRead = 0 ;
|
||||
// leggo la prossima linea e verifico sia la sezione GENERAL
|
||||
@@ -293,44 +334,14 @@ ImportBtl::ReadGeneral( void)
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtl::ReadRawPart( bool& bEnd)
|
||||
{
|
||||
string sLine ;
|
||||
// leggo la prossima linea e verifico sia la sezione RAWPART
|
||||
if ( ! m_theScanner.GetLine( sLine)) {
|
||||
bEnd = true ;
|
||||
return true ;
|
||||
}
|
||||
// verifico sia la sezione RAWPART
|
||||
if ( sLine != SEC_RAWPART) {
|
||||
m_theScanner.UngetLine( sLine) ;
|
||||
bEnd = true ;
|
||||
return true ;
|
||||
}
|
||||
// ciclo sulle linee
|
||||
while ( m_theScanner.GetLine( sLine)) {
|
||||
// se cambio sezione
|
||||
if ( sLine[0] == '[') {
|
||||
m_theScanner.UngetLine( sLine) ;
|
||||
bEnd = false ;
|
||||
return true ;
|
||||
}
|
||||
// ignoro tutto
|
||||
}
|
||||
|
||||
// fine del file
|
||||
bEnd = true ;
|
||||
return true ;
|
||||
return ( nRead > 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtl::ReadPart( bool& bEnd)
|
||||
ImportBtl::ReadObject( ObjType nType, bool& bEnd)
|
||||
{
|
||||
string sLine ;
|
||||
// leggo la prossima linea
|
||||
@@ -338,8 +349,10 @@ ImportBtl::ReadPart( bool& bEnd)
|
||||
bEnd = true ;
|
||||
return true ;
|
||||
}
|
||||
// verifico sia la sezione PART
|
||||
if ( sLine != SEC_PART) {
|
||||
// verifico sia la sezione opportuna (PART, RAWPART o COMPOSITE)
|
||||
if (( nType == PART && sLine != SEC_PART) ||
|
||||
( nType == RAWPART && sLine != SEC_RAWPART) ||
|
||||
( nType == COMPOSITE && sLine != SEC_COMPOSITE)) {
|
||||
m_theScanner.UngetLine( sLine) ;
|
||||
bEnd = true ;
|
||||
return true ;
|
||||
@@ -355,7 +368,8 @@ ImportBtl::ReadPart( bool& bEnd)
|
||||
// ciclo sulle linee con i dati generali del pezzo
|
||||
double dLength = 0, dHeight = 0, dWidth = 0 ;
|
||||
bool bLength = false, bHeight = false, bWidth = false, bBox = false ;
|
||||
int nTrasfCount = 0, nUID = 0 ;
|
||||
int nTrasfCount = 0 ;
|
||||
string sUID = "0" ;
|
||||
while ( m_theScanner.GetLine( sLine)) {
|
||||
// se cambio sezione
|
||||
if ( sLine[0] == '[') {
|
||||
@@ -368,6 +382,10 @@ ImportBtl::ReadPart( bool& bEnd)
|
||||
string sKey, sVal ;
|
||||
SplitFirst( sLine, ":", sKey, sVal) ;
|
||||
switch ( FindPartKey( sKey)) {
|
||||
case KEY_PART_TYPE : // tipo (solo per Compositi)
|
||||
Trim( sVal, " \t\r\n\"") ;
|
||||
m_BtlGeom.SetUserAttribute( UATD_PART, sKey, sVal) ;
|
||||
break ;
|
||||
case KEY_PART_SINGLEMEMBERNUMBER : // identificativo di produzione
|
||||
{
|
||||
int nProdNbr = 0 ;
|
||||
@@ -487,16 +505,18 @@ ImportBtl::ReadPart( bool& bEnd)
|
||||
}
|
||||
break ;
|
||||
case KEY_PART_UID : // UID istanza pezzo nella struttura
|
||||
FromString( sVal, nUID) ;
|
||||
Trim( sVal, " \t\r\n\"") ;
|
||||
sUID = sVal ;
|
||||
break ;
|
||||
case KEY_PART_TRANSFORMATION : // matrice di trasformazione istanza pezzo nella struttura
|
||||
{
|
||||
Frame3d frRef ;
|
||||
if ( ReadTransformation( sVal, frRef)) {
|
||||
++ nTrasfCount ;
|
||||
m_BtlGeom.AddPartTransformation( ToString( nUID), frRef) ;
|
||||
if ( nType == PART)
|
||||
m_BtlGeom.AddPartTransformation( sUID, frRef) ;
|
||||
string sUIDKey = sPartKey[KEY_PART_UID] + ToString( nTrasfCount) ;
|
||||
m_BtlGeom.SetUserAttribute( UATD_PART, sUIDKey, ToString( nUID)) ;
|
||||
m_BtlGeom.SetUserAttribute( UATD_PART, sUIDKey, sUID) ;
|
||||
string sTRFKey = sPartKey[KEY_PART_TRANSFORMATION] + ToString( nTrasfCount) ;
|
||||
m_BtlGeom.SetUserAttribute( UATD_PART, sTRFKey, ToString( frRef)) ;
|
||||
}
|
||||
@@ -610,7 +630,7 @@ ImportBtl::ReadPart( bool& bEnd)
|
||||
// interpreto le lavorazioni (processing)
|
||||
bool bOk = true ;
|
||||
for ( bool bProcEnd = false ; ! bProcEnd ;) {
|
||||
if ( ! ReadProcess( bProcEnd)) {
|
||||
if ( ! ReadProcess( nType != PART, bProcEnd)) {
|
||||
// i log di errore sono già gestiti nella funzione chiamata
|
||||
bOk = false ;
|
||||
}
|
||||
@@ -631,36 +651,6 @@ ImportBtl::ReadPart( bool& bEnd)
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtl::ReadComposite( bool& bEnd)
|
||||
{
|
||||
string sLine ;
|
||||
// leggo la prossima linea
|
||||
if ( ! m_theScanner.GetLine( sLine)) {
|
||||
bEnd = true ;
|
||||
return true ;
|
||||
}
|
||||
// verifico sia la sezione COMPOSITE
|
||||
if ( sLine != SEC_COMPOSITE) {
|
||||
bEnd = true ;
|
||||
return true ;
|
||||
}
|
||||
// ciclo sulle linee
|
||||
while ( m_theScanner.GetLine( sLine)) {
|
||||
// se cambio sezione
|
||||
if ( sLine[0] == '[') {
|
||||
m_theScanner.UngetLine( sLine) ;
|
||||
bEnd = false ;
|
||||
return true ;
|
||||
}
|
||||
// ignoro tutto
|
||||
}
|
||||
|
||||
bEnd = true ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtl::ReadTransformation( const string& sVal, Frame3d& frRef)
|
||||
@@ -915,7 +905,7 @@ ImportBtl::ReadReferenceSide( const string& sVal, int& nSide, bool& bAlign)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtl::ReadProcess( bool& bProcEnd)
|
||||
ImportBtl::ReadProcess( bool bObjRef, bool& bProcEnd)
|
||||
{
|
||||
bProcEnd = false ;
|
||||
string sLine ;
|
||||
@@ -952,16 +942,17 @@ ImportBtl::ReadProcess( bool& bProcEnd)
|
||||
FromString( vsItem[1], nProc) ;
|
||||
int nSide = 0 ;
|
||||
FromString( vsItem[2], nSide) ;
|
||||
if ( nSide < BTL_SIDE_FRONT || nSide > BTL_SIDE_TOP)
|
||||
if ( nGroup != BTL_OBJECT_REF && ( nSide < BTL_SIDE_FRONT || nSide > BTL_SIDE_TOP))
|
||||
nSide = BTL_SIDE_FRONT ;
|
||||
bool bParams = false ;
|
||||
INTVECTOR vnDPar ;
|
||||
int nSPar ;
|
||||
int nSPar = 0 ;
|
||||
DBLVECTOR vdPar ;
|
||||
string sPar ;
|
||||
int nProcId = 0 ;
|
||||
Frame3d frRef ;
|
||||
STRVECTOR vsUAtt ;
|
||||
string sUID ;
|
||||
// ciclo sulle linee
|
||||
while ( true) {
|
||||
// se fine file, concludo
|
||||
@@ -995,6 +986,17 @@ ImportBtl::ReadProcess( bool& bProcEnd)
|
||||
}
|
||||
break ;
|
||||
case KEY_PROC_PROCESSPARAMETERS : // parametri
|
||||
if ( nProc == BTL_OBJECT_REF) {
|
||||
if ( ! GetParam( sVal, PAR_UID, sUID)) {
|
||||
string sOut = " Error in GetProcessParams (" + sType + ") on line " + ToString( m_theScanner.GetCurrLineNbr()) ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
SkipCurrProcess() ;
|
||||
bProcEnd = false ;
|
||||
return false ;
|
||||
}
|
||||
bParams = true ;
|
||||
break ;
|
||||
}
|
||||
if ( ! m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar)) {
|
||||
string sOut = " Error : Unknown Process (" + sType + ") on line " + ToString( m_theScanner.GetCurrLineNbr()) ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
@@ -1036,13 +1038,27 @@ ImportBtl::ReadProcess( bool& bProcEnd)
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// inserimento della lavorazione nel pezzo
|
||||
if ( ! bParams ||
|
||||
! m_BtlGeom.AddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, nSPar, vdPar, sPar, vsUAtt, m_theScanner.GetCurrLineNbr())) {
|
||||
string sOut = " Error in AddProcess (" + sType + ") to Part " + m_BtlGeom.GetPartName() + " on line " + ToString( m_theScanner.GetCurrLineNbr()) ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
bProcEnd = false ;
|
||||
return false ;
|
||||
// se riferimento ad oggetto
|
||||
if ( nProc == BTL_OBJECT_REF) {
|
||||
// inserimento del riferimento nel pezzo
|
||||
if ( ! bParams ||
|
||||
! m_BtlGeom.AddObjectRef( sUID, frRef)) {
|
||||
string sOut = " Error in AddObjectRef (" + sType + ") to Part " + m_BtlGeom.GetPartName() + " on line " + ToString( m_theScanner.GetCurrLineNbr()) ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
bProcEnd = false ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti lavorazione
|
||||
else {
|
||||
// inserimento della lavorazione nel pezzo
|
||||
if ( ! bParams ||
|
||||
! m_BtlGeom.AddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, nSPar, vdPar, sPar, vsUAtt, m_theScanner.GetCurrLineNbr())) {
|
||||
string sOut = " Error in AddProcess (" + sType + ") to Part " + m_BtlGeom.GetPartName() + " on line " + ToString( m_theScanner.GetCurrLineNbr()) ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
bProcEnd = false ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
bProcEnd = false ;
|
||||
@@ -1217,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
|
||||
@@ -1230,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
|
||||
@@ -1240,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
|
||||
|
||||
+6
-5
@@ -26,19 +26,20 @@ class ImportBtl : public IImportBtl
|
||||
public :
|
||||
ImportBtl( void) ;
|
||||
|
||||
private :
|
||||
enum ObjType { PART = 1, RAWPART = 2, COMPOSITE = 3} ;
|
||||
|
||||
private :
|
||||
bool ReadHeader( void) ;
|
||||
bool ReadGeneral( void) ;
|
||||
bool ReadRawPart( bool& bEnd) ;
|
||||
bool ReadPart( bool& bEnd) ;
|
||||
bool ReadComposite( bool& bEnd) ;
|
||||
bool ReadGeneral( bool& bEnd) ;
|
||||
bool ReadObject( ObjType nType, bool& bEnd) ;
|
||||
bool ReadTransformation( const std::string& sVal, Frame3d& frRef) ;
|
||||
bool ReadOutline( void) ;
|
||||
bool ReadAperture( void) ;
|
||||
bool ReadColor( const std::string& sVal, Color& colRes) ;
|
||||
bool ReadGrainDirection( const std::string& sVal, Vector3d& vtDir, bool& bAlign) ;
|
||||
bool ReadReferenceSide( const std::string& sVal, int& nSide, bool& bAlign) ;
|
||||
bool ReadProcess( bool& bProcEnd) ;
|
||||
bool ReadProcess( bool bObjRef, bool& bProcEnd) ;
|
||||
bool SkipCurrSection( void) ;
|
||||
bool SkipCurrProcess( void) ;
|
||||
bool GetProcessParams( const std::string& sText, const std::string& sProcType,
|
||||
|
||||
+181
-275
@@ -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 ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPADV, GetEExLogger()))
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPADV))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImportBtlx*> ( new(nothrow) ImportBtlx) ;
|
||||
@@ -62,15 +63,18 @@ ImportBtlx::Import( const string& sFile, IGeomDB* pGDB, int nFlag)
|
||||
|
||||
// inizializzo il gestore geometria pezzi Btl
|
||||
int nFlatVertPos = 0 ;
|
||||
if (( nFlag & EIBFLAG_TS3_POS) != 0)
|
||||
if (( nFlag & EIBFLAG_OUTL_FLAT_POS) != 0)
|
||||
nFlatVertPos = 4 ;
|
||||
else if (( nFlag & EIBFLAG_TS3_POS) != 0)
|
||||
nFlatVertPos = 3 ;
|
||||
else if (( nFlag & EIBFLAG_FLAT_POS) != 0)
|
||||
nFlatVertPos = 1 ;
|
||||
else if (( nFlag & EIBFLAG_VERT_POS) != 0)
|
||||
nFlatVertPos = 2 ;
|
||||
bool bSpecialTrim = (( nFlag & EIBFLAG_SPECIAL_TRIM) != 0) ;
|
||||
bool bTrimWithOutline = (( nFlag & EIBFLAG_TRIM_WITH_OUTLINE) != 0) ;
|
||||
bool bUseUAttr = (( nFlag & EIBFLAG_USEUATTR) != 0) ;
|
||||
if ( ! m_BtlGeom.Init( pGDB, nFlatVertPos, bSpecialTrim, bUseUAttr)) {
|
||||
if ( ! m_BtlGeom.Init( pGDB, nFlatVertPos, bSpecialTrim, bTrimWithOutline, bUseUAttr)) {
|
||||
LOG_ERROR( GetEExLogger(), " Error on BtlGeom.Init") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -80,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() ;
|
||||
@@ -348,7 +352,7 @@ ImportBtlx::ReadPart( pugi::xml_node node)
|
||||
int nBlue = Clamp( it->attribute( "Blue").as_int(), 0, 255) ;
|
||||
int nAlpha = Clamp( it->attribute( "Transparency").as_int(), 0, 255) ;
|
||||
nAlpha = nAlpha * 100 / 255 ; // va scalato su 100 non su 255
|
||||
|
||||
|
||||
colRes.Set( nRed, nGreen, nBlue, nAlpha) ;
|
||||
bool bAddOk = m_BtlGeom.SetUserAttribute( UATD_PART, name, ToString( colRes)) ;
|
||||
if ( ! bAddOk){
|
||||
@@ -393,7 +397,7 @@ ImportBtlx::ReadPart( pugi::xml_node node)
|
||||
}
|
||||
// UserReferencePlane
|
||||
else if ( name == "UserReferencePlanes") {
|
||||
|
||||
|
||||
for ( pugi::xml_node_iterator itURefPlanes = it->begin() ; itURefPlanes != it->end() ; itURefPlanes ++ ) {
|
||||
string nameURefPlanes = itURefPlanes->name() ;
|
||||
if ( nameURefPlanes != "UserReferencePlane") {
|
||||
@@ -405,55 +409,55 @@ ImportBtlx::ReadPart( pugi::xml_node node)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// GrainDirection
|
||||
else if ( name == "GrainDirection") {
|
||||
Vector3d vtDir ;
|
||||
if ( it->attribute( "X") == nullptr || it->attribute( "Y") == nullptr || it->attribute( "Z") == nullptr
|
||||
|| it->attribute( "Align") == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : GrainDirection attribute missing") ;
|
||||
return false ;
|
||||
}
|
||||
vtDir.x = it->attribute( "X").as_double() ;
|
||||
vtDir.y = it->attribute( "Y").as_double() ;
|
||||
vtDir.z = it->attribute( "Z").as_double() ;
|
||||
string sAlign = it->attribute( "Align").value() ;
|
||||
if ( sAlign == "yes")
|
||||
sAlign = "1" ;
|
||||
else if ( sAlign == "no")
|
||||
sAlign = "0" ;
|
||||
else {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : GrainDirection align is unknown") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool bAddOk = m_BtlGeom.SetUserAttribute( UATD_PART, "GRAINDIRECTION", ToString( vtDir) + ";" + sAlign) ;
|
||||
if ( ! bAddOk){
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part GrainDirection : m_BtlGeom.SetUserAttribute error") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// MaterialClass
|
||||
else if ( name == "MaterialClass") {
|
||||
|
||||
string sMaterial = it->attribute( "Group").value() ;
|
||||
string sSpecification = it ->attribute( "Specification").value() ;
|
||||
if ( find( svMaterials.begin(), svMaterials.end(), sMaterial) == svMaterials.end()) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : MaterialClass group is unknown") ;
|
||||
return false ;
|
||||
}
|
||||
bool bAddOk = false ;
|
||||
if ( sSpecification != "")
|
||||
bAddOk = m_BtlGeom.SetUserAttribute( UATD_PART, "MATERIALTYPE", sMaterial + ": " + sSpecification) ;
|
||||
else
|
||||
bAddOk = m_BtlGeom.SetUserAttribute( UATD_PART, "MATERIALTYPE", sMaterial) ;
|
||||
if ( ! bAddOk){
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : m_BtlGeom.SetUserAttribute error") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// GrainDirection
|
||||
else if ( name == "GrainDirection") {
|
||||
Vector3d vtDir ;
|
||||
if ( it->attribute( "X") == nullptr || it->attribute( "Y") == nullptr || it->attribute( "Z") == nullptr
|
||||
|| it->attribute( "Align") == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : GrainDirection attribute missing") ;
|
||||
return false ;
|
||||
}
|
||||
vtDir.x = it->attribute( "X").as_double() ;
|
||||
vtDir.y = it->attribute( "Y").as_double() ;
|
||||
vtDir.z = it->attribute( "Z").as_double() ;
|
||||
string sAlign = it->attribute( "Align").value() ;
|
||||
if ( sAlign == "yes")
|
||||
sAlign = "1" ;
|
||||
else if ( sAlign == "no")
|
||||
sAlign = "0" ;
|
||||
else {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : GrainDirection align is unknown") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool bAddOk = m_BtlGeom.SetUserAttribute( UATD_PART, "GRAINDIRECTION", ToString( vtDir) + ";" + sAlign) ;
|
||||
if ( ! bAddOk){
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part GrainDirection : m_BtlGeom.SetUserAttribute error") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// MaterialClass
|
||||
else if ( name == "MaterialClass") {
|
||||
|
||||
string sMaterial = it->attribute( "Group").value() ;
|
||||
string sSpecification = it ->attribute( "Specification").value() ;
|
||||
if ( find( svMaterials.begin(), svMaterials.end(), sMaterial) == svMaterials.end()) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : MaterialClass group is unknown") ;
|
||||
return false ;
|
||||
}
|
||||
bool bAddOk = false ;
|
||||
if ( sSpecification != "")
|
||||
bAddOk = m_BtlGeom.SetUserAttribute( UATD_PART, "MATERIALTYPE", sMaterial + ": " + sSpecification) ;
|
||||
else
|
||||
bAddOk = m_BtlGeom.SetUserAttribute( UATD_PART, "MATERIALTYPE", sMaterial) ;
|
||||
if ( ! bAddOk){
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : m_BtlGeom.SetUserAttribute error") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// UserAttribute
|
||||
else if ( name == "UserAttribute") {
|
||||
|
||||
|
||||
if ( it->attribute( "Name") == nullptr || it->attribute( "")== nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : UserAttribute attribute missing") ;
|
||||
return false ;
|
||||
@@ -468,40 +472,40 @@ ImportBtlx::ReadPart( pugi::xml_node node)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// ReferenceSide
|
||||
else if ( name == "ReferenceSide") {
|
||||
// Controllo ci siano i required attributes
|
||||
if ( it->attribute( "Side") == nullptr || it->attribute( "Align") == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : ReferenceSide attribute missing") ;
|
||||
return false ;
|
||||
}
|
||||
// Controllo che i valori siano sensati
|
||||
int nSide = it->attribute( "Side").as_int() ;
|
||||
if ( nSide < 1 || nSide > 4){
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : ReferenceSide Side not valid") ;
|
||||
return false ;
|
||||
}
|
||||
string sAlign = it->attribute( "Align").value() ;
|
||||
if ( sAlign == "yes" )
|
||||
sAlign = "1" ;
|
||||
else if ( sAlign == "no")
|
||||
sAlign = "0" ;
|
||||
else {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : ReferenceSide Align not valid") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool bAddOk = m_BtlGeom.SetUserAttribute( UATD_PART, "REFERENCESIDE", to_string( nSide) + ";" + sAlign) ;
|
||||
if ( ! bAddOk) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : m_BtlGeom.SetUserAttribute error") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// Shape
|
||||
else if ( name == "Shape") {
|
||||
if ( ! ReadShape( *it))
|
||||
return false ;
|
||||
}
|
||||
// ReferenceSide
|
||||
else if ( name == "ReferenceSide") {
|
||||
// Controllo ci siano i required attributes
|
||||
if ( it->attribute( "Side") == nullptr || it->attribute( "Align") == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : ReferenceSide attribute missing") ;
|
||||
return false ;
|
||||
}
|
||||
// Controllo che i valori siano sensati
|
||||
int nSide = it->attribute( "Side").as_int() ;
|
||||
if ( nSide < 1 || nSide > 4){
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : ReferenceSide Side not valid") ;
|
||||
return false ;
|
||||
}
|
||||
string sAlign = it->attribute( "Align").value() ;
|
||||
if ( sAlign == "yes" )
|
||||
sAlign = "1" ;
|
||||
else if ( sAlign == "no")
|
||||
sAlign = "0" ;
|
||||
else {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : ReferenceSide Align not valid") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool bAddOk = m_BtlGeom.SetUserAttribute( UATD_PART, "REFERENCESIDE", to_string( nSide) + ";" + sAlign) ;
|
||||
if ( ! bAddOk) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : m_BtlGeom.SetUserAttribute error") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// Shape
|
||||
else if ( name == "Shape") {
|
||||
if ( ! ReadShape( *it))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
// inserisco eventuali contorni liberi
|
||||
@@ -511,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") ;
|
||||
@@ -1082,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 ||
|
||||
@@ -1101,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 ||
|
||||
@@ -1113,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 ||
|
||||
@@ -1125,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
|
||||
@@ -1171,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:
|
||||
@@ -1207,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) ;
|
||||
@@ -1309,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
|
||||
@@ -1332,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 ;
|
||||
}
|
||||
@@ -1340,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) ;
|
||||
@@ -1352,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 ;
|
||||
}
|
||||
@@ -1377,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 ;
|
||||
}
|
||||
@@ -1386,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)
|
||||
@@ -1403,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 ){
|
||||
@@ -1425,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
|
||||
|
||||
@@ -1558,7 +1464,7 @@ bool
|
||||
ImportBtlx::ReadShape( pugi::xml_node node)
|
||||
{
|
||||
pugi::xml_node FaceSet = node.child( "IndexedFaceSet") ;
|
||||
if ( FaceSet == nullptr){
|
||||
if ( FaceSet == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Shape: Indexed Face Set missing") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1578,8 +1484,8 @@ ImportBtlx::ReadShape( pugi::xml_node node)
|
||||
return false ;
|
||||
}
|
||||
|
||||
vector<INTVECTOR> vFacesVertices ;
|
||||
vector<Point3d> vPoints ;
|
||||
INTMATRIX vFacesVertices ;
|
||||
PNTVECTOR vPoints ;
|
||||
|
||||
size_t str_start = 0 ;
|
||||
size_t str_end ;
|
||||
@@ -1588,10 +1494,10 @@ ImportBtlx::ReadShape( pugi::xml_node node)
|
||||
INTVECTOR vAux ; // vettore per salvare i vertici di una faccia
|
||||
if ( sFacesVertices.back() != ' ')
|
||||
sFacesVertices += " " ;
|
||||
while( ( str_end = sFacesVertices.find( " ", str_start)) != string::npos ) {
|
||||
while ( ( str_end = sFacesVertices.find( " ", str_start)) != string::npos ) {
|
||||
int val = std::stoi( sFacesVertices.substr( str_start, str_end - str_start)) ;
|
||||
str_start = str_end + 1 ;
|
||||
if ( val == -1){ // delimiter -1 indica che una faccia è terminata
|
||||
if ( val == -1) { // delimiter -1 indica che una faccia è terminata
|
||||
vFacesVertices.push_back( vAux) ;
|
||||
vAux.clear() ;
|
||||
}
|
||||
@@ -1605,17 +1511,17 @@ ImportBtlx::ReadShape( pugi::xml_node node)
|
||||
DBLVECTOR vAux2 ; // vettore per salvare le coordinate di un punto
|
||||
if ( sCoordPoints.back() != ' ')
|
||||
sCoordPoints += " " ;
|
||||
while( ( str_end = sCoordPoints.find( " ", str_start)) != string::npos ){
|
||||
while( ( str_end = sCoordPoints.find( " ", str_start)) != string::npos ) {
|
||||
double val = std::stod( sCoordPoints.substr( str_start, str_end - str_start)) ;
|
||||
str_start = str_end + 1 ;
|
||||
vAux2.push_back( val) ;
|
||||
if ( vAux2.size() == 3){ // hai letto 3 coordinate quindi hai un punto
|
||||
if ( vAux2.size() == 3) { // hai letto 3 coordinate quindi hai un punto
|
||||
vPoints.push_back( Point3d( vAux2[0], vAux2[1], vAux2[2])) ;
|
||||
vAux2.clear() ;
|
||||
}
|
||||
}
|
||||
// se termino senza aver svuotato vAux2 significa che ho un punto con coordinate incomplete
|
||||
if ( vAux2.size() != 0){
|
||||
if ( vAux2.size() != 0) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Shape: Coordinates not defining a point") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
+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 ;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
+114
-117
@@ -818,7 +818,7 @@ ImportBtlx::ReadTenonParams( pugi::xml_node process, int& nGroup, int& nProc, in
|
||||
{
|
||||
// Identifico il processo con sigle usate nel btl
|
||||
nProc = 50 ;
|
||||
if ( process.attribute( "ReferencePlaneID") == nullptr){
|
||||
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -831,7 +831,7 @@ ImportBtlx::ReadTenonParams( pugi::xml_node process, int& nGroup, int& nProc, in
|
||||
|
||||
// Inizializzo i vettori dei parametri
|
||||
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bParamsInfoOk){
|
||||
if ( ! bParamsInfoOk) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -858,13 +858,13 @@ ImportBtlx::ReadTenonParams( pugi::xml_node process, int& nGroup, int& nProc, in
|
||||
if ( sShape == "automatic" || sShape.empty())
|
||||
vdPar[2] = 0 ;
|
||||
else if ( sShape == "square")
|
||||
vdPar[2] = 1;
|
||||
vdPar[2] = 1 ;
|
||||
else if ( sShape == "round")
|
||||
vdPar[2] = 2;
|
||||
vdPar[2] = 2 ;
|
||||
else if ( sShape == "rounded")
|
||||
vdPar[2] = 3;
|
||||
vdPar[2] = 3 ;
|
||||
else if ( sShape == "radius")
|
||||
vdPar[2] = 4;
|
||||
vdPar[2] = 4 ;
|
||||
else {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tenon Shape is unknown") ;
|
||||
return false ;
|
||||
@@ -924,7 +924,7 @@ ImportBtlx::ReadMortiseParams( pugi::xml_node process, int& nGroup, int& nProc,
|
||||
else if ( sShape == "radius")
|
||||
vdPar[3] = 4;
|
||||
else {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tenon Shape is unknown") ;
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Moritise Shape is unknown") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -980,20 +980,22 @@ ImportBtlx::ReadDovetailTenonParams( pugi::xml_node process, int& nGroup, int& n
|
||||
// vdPar[] = Clamp( ReadProcessChild( process, "FlankAngle", vdPar[]), 5.0, 35.0) ;
|
||||
|
||||
string sShape = process.child( "Shape").text().get() ; // ~P04
|
||||
if ( sShape == "round") {
|
||||
if ( sShape == "round") {
|
||||
vdPar[6] = 0.0 ; // P09
|
||||
vdPar[9] = dWidth * cos( vdPar[7] * DEGTORAD) / ( 1 - sin( vdPar[7] * DEGTORAD)) ; // P12
|
||||
}
|
||||
else if ( sShape == "radius") {
|
||||
vdPar[9] *= 2 ; // P12
|
||||
else if ( sShape == "radius" || sShape == "rounded" || sShape == "square" ) {
|
||||
if ( sShape != "radius") // P12
|
||||
vdPar[9] = MILL_DEF_RAD ;
|
||||
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 {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tenon Shape is unknown") ;
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Dovetail Tenon Shape is unknown") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -1027,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")
|
||||
@@ -1052,20 +1052,22 @@ ImportBtlx::ReadDovetailMortiseParams( pugi::xml_node process, int& nGroup, int&
|
||||
}
|
||||
|
||||
string sShape = process.child( "Shape").text().get() ;
|
||||
if ( sShape == "round") {
|
||||
if ( sShape == "round") {
|
||||
vdPar[7] = 0 ; // P09
|
||||
vdPar[10] = dWidth * cos( vdPar[8] * DEGTORAD) / ( 1 - sin( vdPar[8] * DEGTORAD)) ; // P12
|
||||
}
|
||||
else if ( sShape == "radius") {
|
||||
else if ( sShape == "radius" || sShape == "rounded" || sShape == "square") {
|
||||
if ( sShape != "radius") // P12
|
||||
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: Mortise Shape is unknown") ;
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Dovetail mortise Shape is unknown") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -1948,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 ;
|
||||
}
|
||||
@@ -2016,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 ;
|
||||
}
|
||||
@@ -2063,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 ;
|
||||
}
|
||||
@@ -2081,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 ;
|
||||
|
||||
@@ -2108,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 ;
|
||||
@@ -2145,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 ----------------------------------------------------------------
|
||||
// -------------------------------------------------------------------------------------------------------------
|
||||
@@ -2245,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 ;
|
||||
}
|
||||
|
||||
|
||||
+74
-43
@@ -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 ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImportCnc*> ( new(nothrow) ImportCnc) ;
|
||||
@@ -139,6 +140,8 @@ ImportCnc::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup, int nFlag)
|
||||
m_nCNC = CNC_OSAI ;
|
||||
else if ( sFileExt == "EIA")
|
||||
m_nCNC = CNC_MAZAK ;
|
||||
else if ( sFileExt == "PIM")
|
||||
m_nCNC = CNC_FAGOR ;
|
||||
|
||||
// ciclo di lettura delle linee
|
||||
bool bOk = true ;
|
||||
@@ -168,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
|
||||
@@ -190,6 +193,14 @@ ImportCnc::ProcessLine( const string& sLine)
|
||||
sMyLine.erase( nStart) ;
|
||||
}
|
||||
}
|
||||
// se controllo SIEMENS elimino i cicli 800 e 832
|
||||
else if ( m_nCNC == CNC_SIEMENS) {
|
||||
size_t nStart = sMyLine.find( "CYCLE800") ;
|
||||
if ( nStart == string::npos)
|
||||
nStart = sMyLine.find( "CYCLE832") ;
|
||||
if ( nStart != string::npos)
|
||||
sMyLine.erase( nStart) ;
|
||||
}
|
||||
|
||||
// divido la linea in parti
|
||||
STRVECTOR vsTokens ;
|
||||
@@ -310,6 +321,8 @@ ImportCnc::ParseRemark( const string& sLine)
|
||||
m_nCNC = CNC_TPA ;
|
||||
else if ( sCNC == "MAZAK")
|
||||
m_nCNC = CNC_MAZAK ;
|
||||
else if ( sCNC == "FAGOR")
|
||||
m_nCNC = CNC_FAGOR ;
|
||||
}
|
||||
// cerco indicazione di posizione Home
|
||||
string::size_type iFrom = sLine.find( "FROM/") ;
|
||||
@@ -486,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 ;
|
||||
}
|
||||
|
||||
@@ -983,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) ||
|
||||
@@ -1117,25 +1137,20 @@ ImportCnc::VerifyArcCenter( const Vector3d& vtN)
|
||||
if ( ! frOcs.Set( ORIG, vtN))
|
||||
return A_ERROR ;
|
||||
// porto i punti in questo riferimento
|
||||
Point3d ptLloc = m_ptLast ;
|
||||
ptLloc.ToLoc( frOcs) ;
|
||||
Point3d ptNloc = m_ptNext ;
|
||||
ptNloc.ToLoc( frOcs) ;
|
||||
Point3d ptCloc = m_ptCen ;
|
||||
ptCloc.ToLoc( frOcs) ;
|
||||
Vector3d vtOloc = m_vtOffs ;
|
||||
vtOloc.ToLoc( frOcs) ;
|
||||
Point3d ptLloc = GetToLoc( m_ptLast, frOcs) ;
|
||||
Point3d ptNloc = GetToLoc( m_ptNext, frOcs) ;
|
||||
Point3d ptCloc = GetToLoc( m_ptCen, frOcs) ;
|
||||
Vector3d vtOloc = GetToLoc( m_vtOffs, frOcs) ;
|
||||
// verifico se circonferenza
|
||||
int nRet = ( SqDistXY( ptLloc, ptNloc) > EPS_SMALL * EPS_SMALL) ? A_ARC : A_CIRC ;
|
||||
// se controllo Fanuc, centro è sempre in relativo
|
||||
if ( m_nCNC == CNC_FANUC) {
|
||||
// se controllo Fanuc o Fagor, centro è sempre in relativo
|
||||
if ( m_nCNC == CNC_FANUC || m_nCNC == CNC_FAGOR) {
|
||||
// centro in relativo
|
||||
Point3d ptCrl = ptCloc + ptLloc ;
|
||||
double dRadLast = DistXY( ptLloc, ptCrl) ;
|
||||
double dRadNext = DistXY( ptNloc, ptCrl) ;
|
||||
if ( abs( dRadNext - dRadLast) < 10 * EPS_SMALL) {
|
||||
m_ptCen = ptCrl ;
|
||||
m_ptCen.ToGlob( frOcs) ;
|
||||
if ( abs( dRadNext - dRadLast) < 100 * EPS_SMALL) {
|
||||
m_ptCen = GetToGlob( ptCrl, frOcs) ;
|
||||
return nRet ;
|
||||
}
|
||||
}
|
||||
@@ -1143,19 +1158,28 @@ ImportCnc::VerifyArcCenter( const Vector3d& vtN)
|
||||
else if ( m_bAbsCoord) {
|
||||
// centro in assoluto
|
||||
Point3d ptCas = ptCloc + vtOloc ;
|
||||
double dRadLast = DistXY( ptLloc, ptCas) ;
|
||||
double dRadNext = DistXY( ptNloc, ptCas) ;
|
||||
if ( abs( dRadNext - dRadLast) < 10 * EPS_SMALL) {
|
||||
double dRadCasLast = DistXY( ptLloc, ptCas) ;
|
||||
double dRadCasNext = DistXY( ptNloc, ptCas) ;
|
||||
// centro in relativo
|
||||
Point3d ptCrl = ptCloc + ptLloc ;
|
||||
double dRadCrlLast = DistXY( ptLloc, ptCrl) ;
|
||||
double dRadCrlNext = DistXY( ptNloc, ptCrl) ;
|
||||
// controlli con precisione più elevata
|
||||
if ( abs( dRadCasNext - dRadCasLast) < 10 * EPS_SMALL) {
|
||||
m_ptCen += m_vtOffs ;
|
||||
return nRet ;
|
||||
}
|
||||
// centro in relativo
|
||||
Point3d ptCrl = ptCloc + ptLloc ;
|
||||
dRadLast = DistXY( ptLloc, ptCrl) ;
|
||||
dRadNext = DistXY( ptNloc, ptCrl) ;
|
||||
if ( abs( dRadNext - dRadLast) < 10 * EPS_SMALL) {
|
||||
m_ptCen = ptCrl ;
|
||||
m_ptCen.ToGlob( frOcs) ;
|
||||
if ( abs( dRadCrlNext - dRadCrlLast) < 10 * EPS_SMALL) {
|
||||
m_ptCen = GetToGlob( ptCrl, frOcs) ;
|
||||
return nRet ;
|
||||
}
|
||||
// controlli con precisione più bassa
|
||||
if ( abs( dRadCasNext - dRadCasLast) < 100 * EPS_SMALL) {
|
||||
m_ptCen += m_vtOffs ;
|
||||
return nRet ;
|
||||
}
|
||||
if ( abs( dRadCrlNext - dRadCrlLast) < 100 * EPS_SMALL) {
|
||||
m_ptCen = GetToGlob( ptCrl, frOcs) ;
|
||||
return nRet ;
|
||||
}
|
||||
}
|
||||
@@ -1163,18 +1187,27 @@ ImportCnc::VerifyArcCenter( const Vector3d& vtN)
|
||||
else {
|
||||
// centro in relativo
|
||||
Point3d ptCrl = ptCloc + ptLloc ;
|
||||
double dRadLast = DistXY( ptLloc, ptCrl) ;
|
||||
double dRadNext = DistXY( ptNloc, ptCrl) ;
|
||||
if ( abs( dRadNext - dRadLast) < 10 * EPS_SMALL) {
|
||||
m_ptCen = ptCrl ;
|
||||
m_ptCen.ToGlob( frOcs) ;
|
||||
return nRet ;
|
||||
}
|
||||
double dRadCrlLast = DistXY( ptLloc, ptCrl) ;
|
||||
double dRadCrlNext = DistXY( ptNloc, ptCrl) ;
|
||||
// centro in assoluto
|
||||
Point3d ptCas = ptCloc + vtOloc ;
|
||||
dRadLast = DistXY( ptLloc, ptCas) ;
|
||||
dRadNext = DistXY( ptNloc, ptCas) ;
|
||||
if ( abs( dRadNext - dRadLast) < 10 * EPS_SMALL) {
|
||||
double dRadCasLast = DistXY( ptLloc, ptCas) ;
|
||||
double dRadCasNext = DistXY( ptNloc, ptCas) ;
|
||||
// controlli con precisione più elevata
|
||||
if ( abs( dRadCrlNext - dRadCrlLast) < 10 * EPS_SMALL) {
|
||||
m_ptCen = GetToGlob( ptCrl, frOcs) ;
|
||||
return nRet ;
|
||||
}
|
||||
if ( abs( dRadCasNext - dRadCasLast) < 10 * EPS_SMALL) {
|
||||
m_ptCen += m_vtOffs ;
|
||||
return nRet ;
|
||||
}
|
||||
// controlli con precisione più bassa
|
||||
if ( abs( dRadCrlNext - dRadCrlLast) < 100 * EPS_SMALL) {
|
||||
m_ptCen = GetToGlob( ptCrl, frOcs) ;
|
||||
return nRet ;
|
||||
}
|
||||
if ( abs( dRadCasNext - dRadCasLast) < 100 * EPS_SMALL) {
|
||||
m_ptCen += m_vtOffs ;
|
||||
return nRet ;
|
||||
}
|
||||
@@ -1193,12 +1226,9 @@ ImportCnc::SetCircC2PN( const Point3d& ptCen, const Point3d& ptStart, const Poin
|
||||
if ( ! frOcs.Set( ORIG, vtN))
|
||||
return false ;
|
||||
// porto i punti in questo riferimento
|
||||
Point3d ptCloc = ptCen ;
|
||||
ptCloc.ToLoc( frOcs) ;
|
||||
Point3d ptSloc = ptStart ;
|
||||
ptSloc.ToLoc( frOcs) ;
|
||||
Point3d ptNEloc = ptNearEnd ;
|
||||
ptNEloc.ToLoc( frOcs) ;
|
||||
Point3d ptCloc = GetToLoc( ptCen, frOcs) ;
|
||||
Point3d ptSloc = GetToLoc( ptStart, frOcs) ;
|
||||
Point3d ptNEloc = GetToLoc( ptNearEnd, frOcs) ;
|
||||
// calcolo il cerchio in questo piano
|
||||
double dRad = 0.5 * ( DistXY( ptCloc, ptSloc) + DistXY( ptCloc, ptNEloc)) ;
|
||||
ptCloc.z = ptSloc.z ;
|
||||
@@ -1301,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
@@ -71,7 +71,7 @@ class ImportCnc : public IImportCnc
|
||||
return true ; }
|
||||
|
||||
private :
|
||||
enum CncName { CNC_STD = 0, CNC_OSAI = 1, CNC_FANUC = 2, CNC_NUM = 3, CNC_SIEMENS = 4, CNC_TPA = 5, CNC_MAZAK = 6} ;
|
||||
enum CncName { CNC_STD = 0, CNC_OSAI = 1, CNC_FANUC = 2, CNC_NUM = 3, CNC_SIEMENS = 4, CNC_TPA = 5, CNC_MAZAK = 6, CNC_FAGOR} ;
|
||||
enum InterpPl { XY = 1, YZ = 2, ZX = 3} ;
|
||||
enum Command { NO_CMD = 0, MOVE = 1, IPL = 2, OFFS = 3} ;
|
||||
enum MoveType { RAPID = 0, LINE = 1, ARC_CW = 2, ARC_CCW = 3, ARC_MID_2D = 4, ARC_MID_3D = 5} ;
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ IImportCsf*
|
||||
CreateImportCsf( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! 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 ( ! 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 ( ! 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 ( ! 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