Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 91efbdc5df | |||
| 2a4d3b7947 | |||
| c1e12ea3df |
+27
-288
@@ -18,7 +18,6 @@
|
||||
#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"
|
||||
@@ -30,7 +29,7 @@ IBeamMgr*
|
||||
CreateBeamMgr( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPADV))
|
||||
if ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPADV, GetEExLogger()))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IBeamMgr*> ( new(nothrow) BeamMgr) ;
|
||||
@@ -46,31 +45,21 @@ BeamMgr::BeamMgr( void)
|
||||
bool
|
||||
BeamMgr::Init( IGeomDB* pGDB, int nFlag)
|
||||
{
|
||||
m_pGDB = pGDB ;
|
||||
return SetFlag( nFlag) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::SetFlag( int nFlag)
|
||||
{
|
||||
// verifico il gestore di DB geometrico
|
||||
if ( m_pGDB == nullptr)
|
||||
// assegno il gestore di DB geometrico
|
||||
if ( pGDB == nullptr)
|
||||
return false ;
|
||||
m_pGDB = pGDB ;
|
||||
// inizializzo il gestore geometria pezzi Btl
|
||||
int nFlatVertPos = 0 ;
|
||||
if (( nFlag & EIBFLAG_OUTL_FLAT_POS) != 0)
|
||||
nFlatVertPos = 4 ;
|
||||
else if (( nFlag & EIBFLAG_TS3_POS) != 0)
|
||||
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( m_pGDB, nFlatVertPos, bSpecialTrim, bTrimWithOutline, bUseUAttr)) {
|
||||
if ( ! m_BtlGeom.Init( pGDB, nFlatVertPos, bSpecialTrim, bUseUAttr)) {
|
||||
LOG_ERROR( GetEExLogger(), " Error on BtlGeom.Init")
|
||||
return false ;
|
||||
}
|
||||
@@ -131,10 +120,7 @@ BeamMgr::SetPartProdNbr( int nProdNbr)
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Verifico validità nuovo PDN
|
||||
if ( ! m_BtlGeom.VerifyNewPartProdNbr( nProdNbr))
|
||||
return false ;
|
||||
// Imposto il numero di produzione sul pezzo corrente
|
||||
// Imposto il numero di produzione al pezzo corrente
|
||||
return m_BtlGeom.SetPartProdNbr( nProdNbr) ;
|
||||
}
|
||||
|
||||
@@ -145,7 +131,7 @@ BeamMgr::SetPartName( const string& sName)
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Imposto il nome sul pezzo corrente
|
||||
// Imposto il nome al pezzo corrente
|
||||
return m_BtlGeom.SetPartName( sName) ;
|
||||
}
|
||||
|
||||
@@ -156,7 +142,7 @@ BeamMgr::SetPartCount( int nCount)
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Imposto il numero delle parti da produrre sul pezzo corrente
|
||||
// Imposto il numero delle parti da produrre al pezzo corrente
|
||||
return m_BtlGeom.SetPartCount( nCount) ;
|
||||
}
|
||||
|
||||
@@ -167,12 +153,9 @@ BeamMgr::SetPartBox( double dLength, double dHeight, double dWidth, bool bUpdate
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Imposto le dimensioni sul pezzo corrente
|
||||
// Imposto le dimensioni al 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() ;
|
||||
@@ -181,187 +164,10 @@ 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,
|
||||
int nCrvId, int nCrv2Id, bool bUpdate)
|
||||
const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar, const STRVECTOR& vsUAtt, bool bUpdate)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
@@ -376,30 +182,13 @@ 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 > 0 && j - 1 < int( vdPar.size()))
|
||||
if ( j - 1 < int( vdPar.size()))
|
||||
vdBtlPar[i] = vdPar[j-1] ;
|
||||
}
|
||||
sBtlPar = sPar ;
|
||||
// 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 ;
|
||||
}
|
||||
// Aggiungo la feature
|
||||
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() ;
|
||||
@@ -412,8 +201,7 @@ 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,
|
||||
int nCrvId, int nCrv2Id, bool bUpdate)
|
||||
const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar, const STRVECTOR& vsUAtt, bool bUpdate)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
@@ -421,11 +209,10 @@ 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) ;
|
||||
// accetto feature normali e Outline/Aperture
|
||||
if ( ! m_BtlGeom.SetPart( nPartId) || ( m_BtlGeom.GetCurrProcsLayId() != nLayId && m_BtlGeom.GetCurrOutsLayId() != nLayId))
|
||||
if ( ! m_BtlGeom.SetPart( nPartId) || m_BtlGeom.GetCurrProcsLayId() != nLayId)
|
||||
return GDB_ID_NULL ;
|
||||
// Aggiungo il nuovo processo modificato
|
||||
int nNewId = AddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vdPar, sPar, vsUAtt, nCrvId, nCrv2Id, false) ;
|
||||
int nNewId = AddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vdPar, sPar, vsUAtt, false) ;
|
||||
if ( nNewId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
// Sposto le geometrie inserite appena sopra le vecchie (mantenendo l'ordine relativo nel gruppo)
|
||||
@@ -470,8 +257,7 @@ BeamMgr::EraseProcess( int nGeomId, bool bUpdate)
|
||||
// Recupero il pezzo di appartenenza
|
||||
int nLayId = m_pGDB->GetParentId( nGeomId) ;
|
||||
int nPartId = m_pGDB->GetParentId( nLayId) ;
|
||||
// accetto feature normali e Outline/Aperture
|
||||
if ( ! m_BtlGeom.SetPart( nPartId) || ( m_BtlGeom.GetCurrProcsLayId() != nLayId && m_BtlGeom.GetCurrOutsLayId() != nLayId))
|
||||
if ( ! m_BtlGeom.SetPart( nPartId) || m_BtlGeom.GetCurrProcsLayId() != nLayId)
|
||||
return false ;
|
||||
// Cancello eventuali geometrie aggiuntive
|
||||
INTVECTOR vAdj ;
|
||||
@@ -485,18 +271,6 @@ 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) {
|
||||
@@ -545,13 +319,6 @@ 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() ;
|
||||
@@ -613,7 +380,7 @@ RegularizeTriMesh( const ISurfTriMesh* pStm, double dStep)
|
||||
if ( IsNull( pStmTmp))
|
||||
return nullptr ;
|
||||
if ( IsNull( pStmNew))
|
||||
pStmNew.Set( pStmTmp) ;
|
||||
pStmNew.Set( Release( pStmTmp)) ;
|
||||
else
|
||||
pStmNew->DoSewing( *pStmTmp) ;
|
||||
// recupero una nuova copia della faccetta originale
|
||||
@@ -658,7 +425,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, false)) ;
|
||||
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshBox( dDimX, dDimY, dDimz, true)) ;
|
||||
if ( IsNull( pSTM))
|
||||
return false ;
|
||||
pSTM->Translate( ptMin - ORIG) ;
|
||||
@@ -711,38 +478,12 @@ BeamMgr::CalcSolid( int nPartId, bool bRecalc)
|
||||
m_pGDB->GetInfo( nProcId, IKEY_DO, nDO) ;
|
||||
m_pGDB->GetInfo( nProcId, IKEY_TRIM, nTrim) ;
|
||||
if ( nDO != 0 && nTrim != 0 && m_pGDB->GetGeoType( nProcId) == SRF_TRIMESH) {
|
||||
// recupero eventuale superficie originale
|
||||
int nProcSurfId = nProcId ;
|
||||
int nOrigId = 0 ;
|
||||
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_ORIGID, nOrigId))
|
||||
nProcSurfId += nOrigId ;
|
||||
// se da utilizzare anche suerfici ausiliarie
|
||||
if ( nTrim == 2) {
|
||||
int nAux ;
|
||||
if ( m_pGDB->GetInfo( 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 ;
|
||||
}
|
||||
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 ;
|
||||
}
|
||||
nProcId = m_pGDB->GetNext( nProcId) ;
|
||||
}
|
||||
@@ -783,8 +524,6 @@ 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,7 +21,6 @@ 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 ;
|
||||
@@ -30,15 +29,10 @@ 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,
|
||||
int nCrvId, int nCrv2Id, bool bUpdate = true) override ;
|
||||
const Frame3d& frRef, const DBLVECTOR& vdPar, const std::string& sPar, const STRVECTOR& vsUAtt, 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,
|
||||
int nCrvId, int nCrv2Id, bool bUpdate = true) override ;
|
||||
const Frame3d& frRef, const DBLVECTOR& vdPar, const std::string& sPar, const STRVECTOR& vsUAtt, 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 ;
|
||||
@@ -51,8 +45,6 @@ class BeamMgr : public IBeamMgr
|
||||
BeamMgr( void) ;
|
||||
|
||||
private :
|
||||
bool UpdateFacesName( void) ;
|
||||
bool UpdateLoadingSide( void) ;
|
||||
|
||||
private :
|
||||
IGeomDB* m_pGDB ;
|
||||
|
||||
@@ -146,7 +146,6 @@ enum nPartKey {
|
||||
KEY_PART_STOREYTYPE,
|
||||
KEY_PART_TIMBERGRADE,
|
||||
KEY_PART_TRANSFORMATION,
|
||||
KEY_PART_TYPE,
|
||||
KEY_PART_UID,
|
||||
KEY_PART_USERATTRIBUTE,
|
||||
KEY_PART_WIDTH,
|
||||
@@ -187,7 +186,6 @@ static const std::array<std::string,KEY_PART_ZZZ> sPartKey = {
|
||||
"STOREYTYPE",
|
||||
"TIMBERGRADE",
|
||||
"TRANSFORMATION",
|
||||
"TYPE",
|
||||
"UID",
|
||||
"USERATTRIBUTE",
|
||||
"WIDTH"
|
||||
@@ -255,4 +253,3 @@ 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" ;
|
||||
|
||||
+13
-330
@@ -24,7 +24,6 @@
|
||||
#include "/EgtDev/Include/EGkExtText.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -35,20 +34,17 @@ string BtlGeom::m_sBtlAuxDir ;
|
||||
BtlGeom::BtlGeom( void)
|
||||
{
|
||||
m_pGDB = nullptr ;
|
||||
m_nFlatVertPos = 0 ;
|
||||
m_nFlatVertPos = false ;
|
||||
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, 30) ;
|
||||
m_ProcsOffCol = Color( 160, 160, 160, 100) ;
|
||||
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 ;
|
||||
@@ -62,7 +58,7 @@ BtlGeom::BtlGeom( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim, bool bTrimWithOutline, bool bUseUAttr)
|
||||
BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim, bool bUseUAttr)
|
||||
{
|
||||
// salvo puntatore a DB geometrico
|
||||
m_pGDB = pGDB ;
|
||||
@@ -71,7 +67,6 @@ BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim, bool bTrimWit
|
||||
// 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) ;
|
||||
@@ -81,9 +76,6 @@ BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim, bool bTrimWit
|
||||
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 ;
|
||||
}
|
||||
|
||||
@@ -247,17 +239,6 @@ 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
|
||||
@@ -272,29 +253,7 @@ BtlGeom::ErasePart( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
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)
|
||||
BtlGeom::SetPartProdNbr( int nProdNbr)
|
||||
{
|
||||
// se non c'è il DB geometrico o il pezzo corrente, errore
|
||||
if ( m_pGDB == nullptr || m_nPartId == GDB_ID_NULL)
|
||||
@@ -302,16 +261,7 @@ BtlGeom::SetPartProdNbr( int nProdNbr, int nPdnErr)
|
||||
// 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) ;
|
||||
}
|
||||
@@ -323,17 +273,12 @@ 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 la descrizione
|
||||
// assegno il nome del pezzo
|
||||
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
|
||||
@@ -412,7 +357,6 @@ 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 :
|
||||
@@ -438,7 +382,7 @@ BtlGeom::AddPartBox( double dLength, double dHeight, double dWidth)
|
||||
if ( IsNull( pText))
|
||||
return false ;
|
||||
int nSide = BTL_SIDE_TOP ;
|
||||
if (( m_nFlatVertPos == 1 || m_nFlatVertPos == 4) && m_vtDim.z > m_vtDim.y + EPS_SMALL)
|
||||
if ( m_nFlatVertPos == 1 && 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 ;
|
||||
@@ -498,7 +442,7 @@ BtlGeom::AdjustPartFlatOrVertPos( void)
|
||||
// dimensioni pezzo
|
||||
Vector3d vtDim = b3Part.GetMax() - b3Part.GetMin() ;
|
||||
// se richiesto piatto ed è in verticale, ruoto
|
||||
if (( m_nFlatVertPos == 1 || m_nFlatVertPos == 4) && vtDim.z > vtDim.y + EPS_SMALL) {
|
||||
if ( m_nFlatVertPos == 1 && 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) ;
|
||||
}
|
||||
@@ -571,24 +515,7 @@ 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, 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
|
||||
m_pGDB->SetInfo( nId, "!SOU", m_nPartId) ;
|
||||
// nascondo e blocco
|
||||
m_pGDB->SetStatus( nId, GDB_ST_OFF) ;
|
||||
m_pGDB->SetMode( nId, GDB_MD_LOCKED) ;
|
||||
@@ -825,69 +752,22 @@ 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::AdjustSnForParts( void)
|
||||
BtlGeom::SortParts( void)
|
||||
{
|
||||
// tabella Id-SN dei pezzi e massimo SN trovato
|
||||
// tabella Id-SN dei pezzi
|
||||
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) ;
|
||||
@@ -900,13 +780,14 @@ BtlGeom::SortObjects( int nGroupId, Point3d& ptIns)
|
||||
{ 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, nGroupId, GDB_LAST_SON) ;
|
||||
m_pGDB->Relocate( vIdSN[i].first, GDB_ID_ROOT, 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 + PART_OFFSET, 0) ;
|
||||
ptIns += Vector3d( 0, b3Part.GetMax().y - b3Part.GetMin().y + 300, 0) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
@@ -949,201 +830,3 @@ 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-2022
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : BtlGeom.h Data : 04.04.22 Versione : 2.4d25
|
||||
// File : BtlGeom.h Data : 26.08.15 Versione : 1.6h5
|
||||
// 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 bTrimWithOutline, bool bUseUAttr) ;
|
||||
bool Init( IGeomDB* pGDB, int nFlatPos, bool bSpecialTrim, bool bUseUAttr) ;
|
||||
bool CreatePart( void) ;
|
||||
bool SetPart( int nPartId) ;
|
||||
bool ErasePart( void) ;
|
||||
@@ -36,66 +36,59 @@ class BtlGeom
|
||||
{ return m_nOutsId ; }
|
||||
int GetCurrProcsLayId( void)
|
||||
{ return m_nProcsId ; }
|
||||
bool VerifyNewPartProdNbr( int nProdNbr) ;
|
||||
bool SetPartProdNbr( int nProdNbr, int nPdnErr = -1) ;
|
||||
bool SetPartProdNbr( int nProdNbr) ;
|
||||
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.y : 0) ;}
|
||||
double GetCurrPartWidth( void)
|
||||
{ return ( m_nPartId != GDB_ID_NULL ? m_vtDim.z : 0) ;}
|
||||
double GetCurrPartWidth( void)
|
||||
{ return ( m_nPartId != GDB_ID_NULL ? m_vtDim.y : 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 AdjustSnForParts( void) ;
|
||||
bool SortObjects( int nGroupId, Point3d& ptIns) ;
|
||||
bool SortParts( void) ;
|
||||
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( const INTMATRIX& vFacesVertices, const PNTVECTOR& vPoints) ;
|
||||
const INTVECTOR& vnDPar, DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddShapeBTLX( std::vector<INTVECTOR> vFacesVertices, std::vector<Point3d> vPoints) ;
|
||||
|
||||
public : // Data
|
||||
private :
|
||||
bool CreateInfoGroup( void) ;
|
||||
bool CreateAssemblyGroup( void) ;
|
||||
bool ReadUserAttribute( const std::string& sString, std::string& sKey, std::string& sVal) ;
|
||||
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 ;
|
||||
@@ -103,17 +96,6 @@ 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
|
||||
@@ -129,7 +111,6 @@ 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) ;
|
||||
|
||||
@@ -144,7 +125,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, const Frame3d& frRef,
|
||||
bool AddSlot( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
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) ;
|
||||
@@ -172,17 +153,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, const Frame3d& frRef,
|
||||
bool AddDrill( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
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, const Frame3d& frRef,
|
||||
bool AddMortise( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
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, const Frame3d& frRef,
|
||||
bool AddDovetailMortise( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
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) ;
|
||||
@@ -198,8 +179,6 @@ 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,
|
||||
@@ -220,11 +199,10 @@ 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, bool bOnlyStartOk = false) ;
|
||||
ICurveComposite* GetFreeContourCurve( int nProcId, const Frame3d& frRef) ;
|
||||
ISurfTriMesh* CreateOneCurveFreeContour( const ICurveComposite* pCrvCompo) ;
|
||||
bool AdjustFreeContourCurve( ICurve* pCrv, int nSide, bool& bClosed, bool& bEndsOnOrOutCont) ;
|
||||
bool AdjustFreeContourCurve( ICurve* pCrv, int nSide, bool& bClosed, bool& bEndsOnCont) ;
|
||||
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) ;
|
||||
@@ -256,15 +234,14 @@ 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, const Frame3d& frRef,
|
||||
bool InsertEmptySurface( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
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, 3=ruotato 90deg, 4=da outline o piatto)
|
||||
int m_nFlatVertPos ; // flag per posizionamento pezzi (0=come sono, 1=di piatto, 2=in verticale)
|
||||
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
|
||||
@@ -274,8 +251,6 @@ 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
|
||||
|
||||
+2
-24
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2022
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : BtlGeomCoStru.h Data : 27.02.22 Versione : 2.4b3
|
||||
// File : BtlGeomCoStru.h Data : 25.08.15 Versione : 1.6h5
|
||||
// Contenuto : Costanti e strutture per la classe BtlGeom.
|
||||
//
|
||||
//
|
||||
@@ -22,19 +22,12 @@
|
||||
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" ;
|
||||
@@ -43,13 +36,11 @@ 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" ;
|
||||
@@ -69,11 +60,8 @@ 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" ;
|
||||
@@ -82,16 +70,12 @@ 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 ;
|
||||
@@ -116,18 +100,12 @@ 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_" ;
|
||||
|
||||
+43
-494
@@ -19,11 +19,9 @@
|
||||
#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"
|
||||
@@ -79,164 +77,8 @@ 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) ;
|
||||
@@ -260,7 +102,6 @@ BtlGeom::AddPartOutline( int nSide, int nCrvId, const DBLVECTOR& vdPar, const ST
|
||||
// identificativi di geometrie ausiliarie
|
||||
SetAuxId( nId, {nTId}) ;
|
||||
|
||||
m_nProcId = nId ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -307,14 +148,8 @@ 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) ;
|
||||
@@ -341,135 +176,6 @@ 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)
|
||||
@@ -496,17 +202,6 @@ 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 ;
|
||||
}
|
||||
|
||||
@@ -573,12 +268,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( pMySfr1) ;
|
||||
pSfr2.Set( pMySfr2) ;
|
||||
pSfr1.Set( Release( pMySfr1)) ;
|
||||
pSfr2.Set( Release( pMySfr2)) ;
|
||||
}
|
||||
else {
|
||||
pSfr1.Set( pMySfr2) ;
|
||||
pSfr2.Set( pMySfr1) ;
|
||||
pSfr1.Set( Release( pMySfr2)) ;
|
||||
pSfr2.Set( Release( pMySfr1)) ;
|
||||
}
|
||||
}
|
||||
// se non riesce, li calcolo in modo approssimato
|
||||
@@ -685,55 +380,18 @@ BtlGeom::TrimOutlineWithApertures( void)
|
||||
bool
|
||||
BtlGeom::TrimOutlineWithProcesses( void)
|
||||
{
|
||||
// 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 nProcId = m_pGDB->GetFirstInGroup( m_nProcsId) ;
|
||||
while ( nProcId != GDB_ID_NULL) {
|
||||
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 ;
|
||||
// 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) ;
|
||||
// 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) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
@@ -762,20 +420,11 @@ 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
|
||||
if ( nTrim == 2) {
|
||||
// Recupero le due superfici del processo di lavorazione
|
||||
int nTrim ;
|
||||
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_TRIM, nTrim) && nTrim == 2) {
|
||||
int nAux ;
|
||||
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_AUXID, nAux) && nAux != 0) {
|
||||
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_AUXID, nAux)) {
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId)) ;
|
||||
const ISurfTriMesh* pAux = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId + nAux)) ;
|
||||
if ( pStm != nullptr && pAux != nullptr) {
|
||||
@@ -785,10 +434,8 @@ BtlGeom::TrimOutline( int nProcSurfId)
|
||||
return TrimOutline( pTrim) ;
|
||||
}
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Trim con una sola superficie
|
||||
// Recupero la superficie del processo di lavorazione
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return false ;
|
||||
@@ -1146,7 +793,7 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPOVECTOR& vCrvP)
|
||||
}
|
||||
// se la regione sottrazione totale non esiste, la assegno
|
||||
if ( IsNull( pSubReg))
|
||||
pSubReg.Set( pSfrReg) ;
|
||||
pSubReg.Set( Release( pSfrReg)) ;
|
||||
// altrimenti la combino con la nuova
|
||||
else {
|
||||
// salvo una copia della regione sottrazione totale
|
||||
@@ -1157,7 +804,7 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPOVECTOR& vCrvP)
|
||||
pSubReg->Intersect( *pSfrReg) ;
|
||||
// se non rimane alcunché, provo a unirle
|
||||
if ( ! pSubReg->IsValid()) {
|
||||
pSubReg.Set( pSubCopy) ;
|
||||
pSubReg.Set( Release( pSubCopy)) ;
|
||||
pSubReg->Add( *pSfrReg) ;
|
||||
}
|
||||
}
|
||||
@@ -1226,9 +873,9 @@ bool
|
||||
BtlGeom::IsPointNearFaceContour( const Point3d& ptP, int nSide)
|
||||
{
|
||||
// Il punto è nel riferimento faccia
|
||||
// Verifico se sta vicino al contorno o fuori entro il limite
|
||||
// Verifico se sta vicino al contorno o fuori
|
||||
const double EPS_IN_NEAR = 0.2 ;
|
||||
const double EPS_OUT_NEAR = 5.0 ;
|
||||
const double EPS_OUT_NEAR = 1.0 ;
|
||||
double dL = GetSideLength( nSide) ;
|
||||
double dW = GetSideWidth( nSide) ;
|
||||
return ( ( ptP.x > - EPS_OUT_NEAR && ptP.x < EPS_IN_NEAR) ||
|
||||
@@ -1237,16 +884,6 @@ 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)
|
||||
@@ -1304,134 +941,46 @@ 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( const INTMATRIX& vFacesVertices, const PNTVECTOR& vPoints)
|
||||
BtlGeom::AddShapeBTLX( vector<INTVECTOR> vFacesVertices, vector<Point3d> vPoints)
|
||||
{
|
||||
|
||||
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++) {
|
||||
ISurfTriMesh * Shape = CreateSurfTriMesh() ;
|
||||
|
||||
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
|
||||
PtrOwner<ICurveComposite> pCurveCompo( CreateCurveComposite()) ;
|
||||
pCurveCompo->AddPoint( vPoints[vVertices[0]]) ;
|
||||
// Creo il contorno della faccia
|
||||
ICurveComposite* CurveCompo = CreateCurveComposite() ;
|
||||
CurveCompo->AddPoint( vPoints[vVertices[0]]) ;
|
||||
for ( size_t i = 1 ; i != vVertices.size() ; i++)
|
||||
pCurveCompo->AddLine( vPoints[vVertices[i]]) ;
|
||||
pCurveCompo->AddLine( vPoints[vVertices[0]]) ;
|
||||
CurveCompo->AddLine( vPoints[vVertices[i]]) ;
|
||||
CurveCompo->AddLine( vPoints[vVertices[0]]) ;
|
||||
|
||||
PtrOwner<ISurfTriMesh> pSurf( GetSurfTriMeshByFlatContour( pCurveCompo)) ;
|
||||
if ( ! IsNull( pSurf)) {
|
||||
// recupero tutti i triangoli
|
||||
Triangle3d Tria ;
|
||||
int nT = pSurf->GetFirstTriangle( Tria) ;
|
||||
while ( nT != SVT_NULL) {
|
||||
// inserisco il triangolo nella nuova superficie
|
||||
StmFts.AddTriangle( Tria) ;
|
||||
// passo al triangolo successivo
|
||||
nT = pSurf->GetNextTriangle( nT, Tria) ;
|
||||
if ( 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 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nPartId + 3, Shape) ; // salvo in outline
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGDB->SetName( nId, OL_SHAPE_NAME) ;
|
||||
m_pGDB->SetName( nId, "Shape") ;
|
||||
m_pGDB->SetMaterial( nId, m_OutsCol) ;
|
||||
m_pGDB->SetStatus( nId, GDB_ST_ON) ;
|
||||
m_pGDB->SetStatus( nId, 0) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
+243
-1052
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2023
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DllMain.h Data : 30.05.23 Versione : 2.5e5
|
||||
// File : DllMain.h Data : 04.04.14 Versione : 1.5d1
|
||||
// Contenuto : Prototipi funzioni per uso locale della DLL.
|
||||
//
|
||||
//
|
||||
@@ -19,5 +19,3 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
ILogger* GetEExLogger( void) ;
|
||||
const std::string& GetEExKey( void) ;
|
||||
bool GetEExNetHwKey( void) ;
|
||||
bool VerifyKey( int nKeyOpt) ;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "DllMain.h"
|
||||
#include "/EgtDev/Include/EExDllMain.h"
|
||||
#include "/EgtDev/Include/EGnGetModuleVer.h"
|
||||
#include "/EgtDev/Include/EGnGetKeyData.h"
|
||||
#include "/EgtDev/Include/EgtTrace.h"
|
||||
|
||||
//--------------------------- Costanti ----------------------------------------
|
||||
@@ -90,7 +89,6 @@ GetEExLogger( void)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static std::string s_sKey ;
|
||||
static bool s_bNetHwKey = false ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
@@ -99,52 +97,9 @@ 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.
+14
-99
@@ -22,14 +22,14 @@
|
||||
<ProjectGuid>{80FCBEA4-1883-4542-939D-8582E66D8D51}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>EgtExchange</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
<PlatformToolset>v120_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>v141_xp</PlatformToolset>
|
||||
<PlatformToolset>v120_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>false</OpenMPSupport>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>
|
||||
</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -127,10 +127,9 @@ 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>
|
||||
@@ -162,8 +161,8 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>
|
||||
</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -191,14 +190,14 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<EnableFiberSafeOptimizations>false</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>
|
||||
@@ -216,101 +215,19 @@ 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" />
|
||||
@@ -322,7 +239,6 @@ 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" />
|
||||
@@ -359,7 +275,6 @@ 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,255 +126,6 @@
|
||||
<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">
|
||||
@@ -452,9 +203,6 @@
|
||||
<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,7 +43,6 @@ 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) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -235,38 +234,3 @@ 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,7 +40,6 @@ 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 ;
|
||||
|
||||
+217
-164
@@ -26,19 +26,18 @@
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
using namespace Lib3MF ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static string sInfoNamespace = "CustomInfo" ;
|
||||
using namespace Lib3MF ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IExport3MF*
|
||||
CreateExport3MF( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
|
||||
if ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_EXPBASE, GetEExLogger()))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IExport3MF*> ( new(nothrow) Export3MF) ;
|
||||
@@ -49,19 +48,19 @@ 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")
|
||||
return false ;
|
||||
}
|
||||
m_pGDB = pGDB ;
|
||||
|
||||
// verifico l'Id dell'oggetto da esportare
|
||||
if ( ! pGDB->ExistsObj( nId)) {
|
||||
@@ -69,55 +68,54 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// libreria 3MF
|
||||
try {
|
||||
if ( ! DoExport( nId, sFile))
|
||||
return false ;
|
||||
}
|
||||
catch ( ELib3MFException &exception) {
|
||||
LOG_ERROR( GetEExLogger(), exception.what()) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::DoExport( const int& nId, const string& sFile)
|
||||
{
|
||||
// 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)) ;
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_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 ;
|
||||
|
||||
// scrivo il file
|
||||
try {
|
||||
PWriter writer = m_model->QueryWriter( "3mf") ;
|
||||
writer->WriteToFile( sFile) ;
|
||||
}
|
||||
catch ( ELib3MFException &e) {
|
||||
LOG_ERROR( GetEExLogger(), "Export3MF : Error on writing")
|
||||
string s = e.what() ;
|
||||
LOG_ERROR( GetEExLogger(), ( " " + s).c_str()) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// scrivo il file
|
||||
PWriter writer = m_model->QueryWriter( "3mf") ;
|
||||
writer->WriteToFile( sFile) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -125,83 +123,66 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
||||
bool
|
||||
Export3MF::ExportObject( const IGdbIterator& iIter)
|
||||
{
|
||||
// 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
|
||||
Color cCol ;
|
||||
bool bCol = GetColor( cCol, iIter.GetGDB(), iIter.GetId()) ;
|
||||
// recupero le proprietà
|
||||
STRVECTOR vInfo ;
|
||||
iIter.GetAllInfo( vInfo) ;
|
||||
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 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)) {
|
||||
// emetto l'oggetto
|
||||
switch ( pGeoObj->GetType()) {
|
||||
case SRF_TRIMESH :
|
||||
if ( ! ExportSTM( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr, vInfo))
|
||||
if ( ! ExportSTM( iIter.GetId(), GetSurfTriMesh( pGeoObj)))
|
||||
return false ;
|
||||
break ;
|
||||
case SRF_FLATRGN :
|
||||
if ( ! ExportSFR( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr, vInfo))
|
||||
if ( ! ExportSFR( iIter.GetId(), GetSurfFlatRegion( pGeoObj)))
|
||||
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, bool bGroup)
|
||||
Export3MF::TestFilter( int nLev, int nMode, int nStat)
|
||||
{
|
||||
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))
|
||||
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))
|
||||
return false ;
|
||||
if ( ( nMode == GDB_MD_STD && ( nFilter & EEXFLT_MODESTD) == 0) ||
|
||||
( nMode == GDB_MD_LOCKED && ( nFilter & EEXFLT_MODELOCKED) == 0) ||
|
||||
( nMode == GDB_MD_HIDDEN && ( nFilter & EEXFLT_MODEHIDDEN) == 0))
|
||||
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))
|
||||
return false ;
|
||||
if ( ( nStat == GDB_ST_OFF && ( nFilter & EEXFLT_STAOFF) == 0) ||
|
||||
( nStat == GDB_ST_ON && ( nFilter & EEXFLT_STAON) == 0) ||
|
||||
( nStat == GDB_ST_SEL && ( nFilter & EEXFLT_STASEL) == 0))
|
||||
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))
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
@@ -209,65 +190,43 @@ Export3MF::TestFilter( int nLev, int nMode, int nStat, bool bGroup)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::CalcGroupFilter( void)
|
||||
{
|
||||
m_nGroupFilter = 0 ;
|
||||
// Status
|
||||
if ( ( m_nFilter & EEXFLT_STASEL) != 0)
|
||||
m_nGroupFilter += EEXFLT_STASEL + EEXFLT_STAOFF + EEXFLT_STAON ;
|
||||
else if ( ( m_nFilter & EEXFLT_STAOFF) != 0)
|
||||
m_nGroupFilter += EEXFLT_STAOFF + EEXFLT_STAON ;
|
||||
else
|
||||
m_nGroupFilter += EEXFLT_STAON ;
|
||||
// Mode
|
||||
if ( ( m_nFilter & EEXFLT_MODELOCKED) != 0)
|
||||
m_nGroupFilter += EEXFLT_MODELOCKED + EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
|
||||
else if ( ( m_nFilter & EEXFLT_MODEHIDDEN) != 0)
|
||||
m_nGroupFilter += EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
|
||||
else
|
||||
m_nGroupFilter += EEXFLT_MODESTD ;
|
||||
// Level
|
||||
if ( ( m_nFilter & EEXFLT_LEVSYSTEM) != 0)
|
||||
m_nGroupFilter += EEXFLT_LEVSYSTEM + EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
|
||||
else if ( ( m_nFilter & EEXFLT_LEVTEMP) != 0)
|
||||
m_nGroupFilter += EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
|
||||
else
|
||||
m_nGroupFilter += EEXFLT_LEVUSER ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, const STRVECTOR& vInfo)
|
||||
Export3MF::ExportSFR( const int& nId, const ISurfFlatRegion* pSFR)
|
||||
{
|
||||
// verifico oggetto
|
||||
const ISurfFlatRegion* pSFR = GetSurfFlatRegion( pGeoObj) ;
|
||||
if ( pSFR == nullptr)
|
||||
if ( pSFR == nullptr || nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// ricavo la trimesh equivalente
|
||||
const ISurfTriMesh* pStm = pSFR->GetAuxSurf() ;
|
||||
return ExportSTM( sName, pStm, frFrame, pCol, vInfo) ;
|
||||
return ExportSTM( nId, pStm) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::ExportSTM( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, const STRVECTOR& vInfo)
|
||||
Export3MF::ExportSTM( const int& nId, const ISurfTriMesh* pSTM)
|
||||
{
|
||||
// verifico oggetto
|
||||
const ISurfTriMesh* pSTM = GetSurfTriMesh( pGeoObj) ;
|
||||
if ( pSTM == nullptr)
|
||||
return false ;
|
||||
if ( pSTM == nullptr || nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
// recupero il riferimento globale dell'oggetto
|
||||
Frame3d frFrame ;
|
||||
if ( ! m_pGDB->GetGlobFrame( nId, frFrame))
|
||||
return false ;
|
||||
|
||||
// recupero eventuale nome
|
||||
string sName ;
|
||||
if ( ! m_pGDB->GetName( nId, sName))
|
||||
sName = ToString( nId) ;
|
||||
|
||||
// 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
|
||||
@@ -275,48 +234,44 @@ Export3MF::ExportSTM( const string& sName, const IGeoObj* pGeoObj, const Frame3d
|
||||
int k = 0 ;
|
||||
for ( int i = 0 ; i < pSTM->GetTriangleSize() ; i++) {
|
||||
int nIdVert[3] ;
|
||||
// se il triangolo non è valido passo al successivo
|
||||
if ( ! pSTM->GetTriangle( i, nIdVert))
|
||||
continue ;
|
||||
// assegno gli indici dei vertici
|
||||
if ( ! pSTM->GetTriangle( i, nIdVert))
|
||||
continue ; // se il triangolo non è valido passo al successivo
|
||||
|
||||
vTriangles[k].m_Indices[0] = nIdVert[0] ;
|
||||
vTriangles[k].m_Indices[1] = nIdVert[1] ;
|
||||
vTriangles[k].m_Indices[2] = nIdVert[2] ;
|
||||
k ++ ;
|
||||
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) ;
|
||||
|
||||
// texture
|
||||
if ( ! ExportTexture( nId, pSTM, meshObject))
|
||||
return false ;
|
||||
|
||||
// assegno il colore
|
||||
if ( pCol != nullptr) {
|
||||
Lib3MF_uint32 nColId = ColorHandler3MF( pCol) ;
|
||||
Color cCol ;
|
||||
if ( GetColor( nId, cCol)) {
|
||||
Lib3MF_uint32 nColId = ColorHandler3MF( cCol) ;
|
||||
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 ;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::ScanGroup( const IGdbIterator& iIter)
|
||||
@@ -339,35 +294,133 @@ Export3MF::ScanGroup( const IGdbIterator& iIter)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::GetColor( Color& pCol, const IGeomDB * pGDB, const int& nId)
|
||||
Export3MF::GetColor( const int& nId, Color& cCol)
|
||||
{
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
if ( ! pGDB->GetMaterial( nId, pCol))
|
||||
if ( ! m_pGDB->GetMaterial( nId, cCol))
|
||||
// se fallisce cerco il colore del parent
|
||||
return GetColor( pCol, pGDB, pGDB->GetParentId( nId)) ;
|
||||
return GetColor( m_pGDB->GetParentId( nId), cCol) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Lib3MF_uint32
|
||||
Export3MF::ColorHandler3MF( const Color* pCol)
|
||||
Export3MF::ColorHandler3MF( const Color& cCol)
|
||||
{
|
||||
PColorGroup pColorGrp = m_model->GetColorGroupByID( 1) ;
|
||||
// converto il colore nel formato usato da 3MF
|
||||
Lib3MF_uint8 nAlpha = ( int)( pCol->GetIntAlpha() * 2.55 + 0.5) ;
|
||||
sColor cCol3mf = m_wrapper->RGBAToColor( pCol->GetIntRed(), pCol->GetIntGreen(), pCol->GetIntBlue(), nAlpha) ;
|
||||
// verifico se il colore � gi� presente nel colorgroup
|
||||
Lib3MF_uint8 nAlpha = ( int)( cCol.GetIntAlpha() * 2.55 + 0.5) ;
|
||||
sColor cCol3mf = m_wrapper->RGBAToColor( cCol.GetIntRed(), cCol.GetIntGreen(), cCol.GetIntBlue(), nAlpha) ;
|
||||
// verifico se il colore è già presente nel colorgroup
|
||||
UINTVECTOR vColorIdx ;
|
||||
pColorGrp->GetAllPropertyIDs( vColorIdx) ;
|
||||
for ( Lib3MF_uint32 i : vColorIdx) {
|
||||
sColor cColTmp = pColorGrp->GetColor( i) ;
|
||||
if ( cColTmp.m_Red == cCol3mf.m_Red && cColTmp.m_Green == cCol3mf.m_Green && cColTmp.m_Blue == cCol3mf.m_Blue
|
||||
&& cColTmp.m_Alpha == cCol3mf.m_Alpha)
|
||||
return i ;
|
||||
return i ;
|
||||
}
|
||||
// se non fosse presente, lo aggiungo
|
||||
return pColorGrp->AddColor( cCol3mf) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::ExportTexture( const int& nObjId, const ISurfTriMesh* pSTM, PMeshObject& meshObject)
|
||||
{
|
||||
// verifico esistenza texture
|
||||
string sTxrName ;
|
||||
if ( ! m_pGDB->GetTextureName( nObjId, sTxrName))
|
||||
return true ;
|
||||
|
||||
// cerco id della texture nel GeomDB
|
||||
int nGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, "Photos") ;
|
||||
if ( nGrpId == GDB_ID_NULL)
|
||||
return false ;
|
||||
int nTxrId = m_pGDB->GetFirstNameInGroup( nGrpId, sTxrName) ;
|
||||
if ( nTxrId == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
double dDimX, dDimY ;
|
||||
if ( ! ExeGetPhotoDimensions( nTxrId, dDimX, dDimY))
|
||||
return false ;
|
||||
|
||||
// frame per gestire la texture
|
||||
Frame3d frSrf ;
|
||||
if ( ! m_pGDB->GetTextureFrame( nObjId, frSrf))
|
||||
return false ;
|
||||
|
||||
Lib3MF_uint32 nTxrGrpId = TextureGroupHandler( nTxrId) ;
|
||||
PTexture2DGroup textureGroup = m_model->GetTexture2DGroupByID( nTxrGrpId) ;
|
||||
|
||||
// creo coordinate ( u, v) della texture per ogni vertice di pSTM
|
||||
for ( int i = 0 ; i < pSTM->GetVertexSize() ; i ++) {
|
||||
Point3d pt( 0, 0, 0) ;
|
||||
pSTM->GetVertex( i, pt) ;
|
||||
pt.ToLoc( frSrf) ;
|
||||
textureGroup->AddTex2Coord( sLib3MFTex2Coord({ pt.x / dDimX, pt.y / dDimY})) ;
|
||||
}
|
||||
|
||||
// indice in textureGroup corrispondente al primo vertice di questa superficie
|
||||
int nOffs = textureGroup->GetCount() - pSTM->GetVertexSize() + 1 ;
|
||||
|
||||
// assegno ai triangoli
|
||||
int k = 0 ;
|
||||
for ( int i = 0 ; i < pSTM->GetTriangleSize() ; i++) {
|
||||
|
||||
sLib3MFTriangleProperties property ;
|
||||
property.m_ResourceID = nTxrGrpId ;
|
||||
|
||||
int nIdVert[3] ;
|
||||
if ( ! pSTM->GetTriangle( i, nIdVert))
|
||||
continue ;
|
||||
|
||||
property.m_PropertyIDs[0] = nIdVert[0] + nOffs ;
|
||||
property.m_PropertyIDs[1] = nIdVert[1] + nOffs ;
|
||||
property.m_PropertyIDs[2] = nIdVert[2] + nOffs ;
|
||||
|
||||
meshObject->SetTriangleProperties( k, property) ;
|
||||
k ++ ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Lib3MF_uint32
|
||||
Export3MF::TextureGroupHandler( const int& nTxrId)
|
||||
{
|
||||
auto it = m_TexturesMap.find( nTxrId) ;
|
||||
// se la texture è già presente nel modello 3MF restituisco il suo id
|
||||
if ( it != m_TexturesMap.end())
|
||||
return it->second ;
|
||||
|
||||
// se non è presente l'aggiungo
|
||||
string sTxrPath ;
|
||||
string sInfo ;
|
||||
m_pGDB->GetInfo( nTxrId, "Path", sInfo) ;
|
||||
|
||||
ExeGetPhotoPath( nTxrId, sTxrPath) ;
|
||||
string sTxrExtension = GetFileExtension( sTxrPath) ;
|
||||
|
||||
string sTxrRelationshipType = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture" ;
|
||||
string sOPCPath = "/3D/Texture/texture_" + to_string( m_TexturesMap.size()) + "." + sTxrExtension ;
|
||||
PAttachment attachment = m_model->AddAttachment( sOPCPath, sTxrRelationshipType) ;
|
||||
attachment->ReadFromFile( sTxrPath) ;
|
||||
|
||||
PTexture2D texture2D = m_model->AddTexture2DFromAttachment( attachment.get()) ;
|
||||
if ( sTxrExtension == "jpg" || sTxrExtension == "jpeg")
|
||||
texture2D->SetContentType( eTextureType::JPEG) ;
|
||||
else if ( sTxrExtension == "png")
|
||||
texture2D->SetContentType( eTextureType::PNG) ;
|
||||
texture2D->SetTileStyleUV( eTextureTileStyle::NoTileStyle, eTextureTileStyle::NoTileStyle) ;
|
||||
|
||||
PTexture2DGroup textureGroup = m_model->AddTexture2DGroup( texture2D.get()) ;
|
||||
Lib3MF_uint32 nTxrGrpId = textureGroup->GetResourceID() ;
|
||||
m_TexturesMap.emplace( nTxrId, nTxrGrpId) ;
|
||||
|
||||
return nTxrGrpId ;
|
||||
}
|
||||
+17
-15
@@ -16,8 +16,11 @@
|
||||
#define NOMINMAX
|
||||
#include "/EgtDev/Extern/Lib3MF/Include/lib3mf_implicit.hpp"
|
||||
#include "/EgtDev/Include/EExExport3MF.h"
|
||||
#include <map>
|
||||
|
||||
class IGdbIterator ;
|
||||
class ISurfTriMesh ;
|
||||
class ISurfFlatRegion ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Export3MF : public IExport3MF
|
||||
@@ -27,25 +30,24 @@ class Export3MF : public IExport3MF
|
||||
virtual bool Export( IGeomDB* pGDB, int nId, const std::string& sFile) ;
|
||||
|
||||
public :
|
||||
Export3MF( void) : m_nFilter( EEXFLT_DEFAULT) {
|
||||
CalcGroupFilter() ;
|
||||
}
|
||||
Export3MF( void) : m_nFilter( EEXFLT_DEFAULT) {}
|
||||
|
||||
private :
|
||||
bool DoExport( const int& nId, const std::string& sFile) ;
|
||||
bool ExportObject( const IGdbIterator& iIter) ;
|
||||
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) ;
|
||||
bool ScanGroup( const IGdbIterator& iIter) ;
|
||||
bool TestFilter( int nLev, int nMode, int nStat) ;
|
||||
bool ExportSFR( const int& nId, const ISurfFlatRegion* pSFR) ;
|
||||
bool ExportSTM( const int& nId, const ISurfTriMesh* pSTM) ;
|
||||
Lib3MF_uint32 ColorHandler3MF( const Color& cCol) ;
|
||||
bool GetColor( const int& nId, Color& cCol) ;
|
||||
bool ExportTexture( const int& nObjId, const ISurfTriMesh* pSTM, Lib3MF::PMeshObject& meshObject) ;
|
||||
Lib3MF_uint32 TextureGroupHandler( const int& nTxrId) ;
|
||||
|
||||
private :
|
||||
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
|
||||
private :
|
||||
IGeomDB* m_pGDB ;
|
||||
int m_nFilter ; // filtro su livello, modo e stato
|
||||
Lib3MF::PWrapper m_wrapper ; // lib3mf wrapper
|
||||
Lib3MF::PModel m_model ; // lib3mf model
|
||||
std::map< int, Lib3MF_uint32> m_TexturesMap ;
|
||||
} ;
|
||||
+78
-112
@@ -46,7 +46,7 @@ IExportDxf*
|
||||
CreateExportDxf( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
|
||||
if ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_EXPBASE, GetEExLogger()))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IExportDxf*> ( new(nothrow) ExportDxf) ;
|
||||
@@ -57,7 +57,6 @@ 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) ;
|
||||
@@ -101,7 +100,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 ;
|
||||
|
||||
@@ -603,7 +602,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 ;
|
||||
|
||||
@@ -617,7 +616,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, true))
|
||||
if ( ! TestFilter( nLev, nMode, nStat))
|
||||
return true ;
|
||||
|
||||
// aggiorno nome layer
|
||||
@@ -635,7 +634,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 ;
|
||||
}
|
||||
@@ -721,9 +720,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 ;
|
||||
@@ -919,7 +918,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 ;
|
||||
@@ -933,7 +932,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 ;
|
||||
|
||||
@@ -944,36 +943,35 @@ 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 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)
|
||||
// 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)
|
||||
int nCol = COL_DEFAULT ;
|
||||
Color cCol ;
|
||||
if ( ( m_bColorByLayer && iIter.GetMaterial( cCol)) ||
|
||||
@@ -1018,12 +1016,11 @@ ExportDxf::ExportGdbObject( const IGdbIterator& iIter, const string& sLay)
|
||||
return false ;
|
||||
break ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1080,7 +1077,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) ;
|
||||
}
|
||||
|
||||
@@ -1092,7 +1089,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) ;
|
||||
@@ -1165,9 +1162,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
|
||||
@@ -1176,7 +1173,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
|
||||
@@ -1199,7 +1196,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
|
||||
@@ -1219,7 +1216,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
|
||||
@@ -1242,7 +1239,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
|
||||
@@ -1258,7 +1255,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
|
||||
@@ -1314,7 +1311,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
|
||||
@@ -1357,7 +1354,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 ;
|
||||
@@ -1399,7 +1396,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
|
||||
@@ -1433,10 +1430,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
|
||||
@@ -1484,7 +1481,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
|
||||
@@ -1496,7 +1493,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
|
||||
@@ -1535,7 +1532,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
|
||||
@@ -1547,7 +1544,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
|
||||
@@ -1599,7 +1596,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
|
||||
@@ -1640,7 +1637,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
|
||||
@@ -1672,7 +1669,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
|
||||
@@ -1691,7 +1688,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
|
||||
@@ -1704,7 +1701,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
|
||||
@@ -1729,7 +1726,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
|
||||
@@ -1745,7 +1742,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
|
||||
@@ -1761,7 +1758,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
|
||||
@@ -1774,7 +1771,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
|
||||
@@ -1814,55 +1811,24 @@ ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExportDxf::TestFilter( int nLev, int nMode, int nStat, bool bGroup)
|
||||
ExportDxf::TestFilter( int nLev, int nMode, int nStat)
|
||||
{
|
||||
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))
|
||||
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))
|
||||
return false ;
|
||||
if ( ( nMode == GDB_MD_STD && ( nFilter & EEXFLT_MODESTD) == 0) ||
|
||||
( nMode == GDB_MD_LOCKED && ( nFilter & EEXFLT_MODELOCKED) == 0) ||
|
||||
( nMode == GDB_MD_HIDDEN && ( nFilter & EEXFLT_MODEHIDDEN) == 0))
|
||||
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))
|
||||
return false ;
|
||||
if ( ( nStat == GDB_ST_OFF && ( nFilter & EEXFLT_STAOFF) == 0) ||
|
||||
( nStat == GDB_ST_ON && ( nFilter & EEXFLT_STAON) == 0) ||
|
||||
( nStat == GDB_ST_SEL && ( nFilter & EEXFLT_STASEL) == 0))
|
||||
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))
|
||||
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)
|
||||
|
||||
+2
-4
@@ -71,8 +71,7 @@ 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 bGroup) ;
|
||||
bool CalcGroupFilter( void) ;
|
||||
bool TestFilter( int nLev, int nMode, int nStat) ;
|
||||
bool WriteItem( int nCode, int nVal) ;
|
||||
bool WriteItem( int nCode, double dVal, int nPrec = 6) ;
|
||||
bool WriteItem( int nCode, const std::string& sVal) ;
|
||||
@@ -82,8 +81,7 @@ class ExportDxf : public IExportDxf
|
||||
std::string AdjustFontName( const std::string& sFontName) ;
|
||||
|
||||
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
|
||||
int m_nFilter ; // filtro su livello, modo e stato
|
||||
bool m_bCompoundLayer ;
|
||||
bool m_bColorByLayer ;
|
||||
bool m_bAdvancedNames ;
|
||||
|
||||
+43
-77
@@ -34,7 +34,7 @@ IExportStl*
|
||||
CreateExportStl( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
|
||||
if ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_EXPBASE, GetEExLogger()))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IExportStl*> ( new(nothrow) ExportStl) ;
|
||||
@@ -45,7 +45,6 @@ bool
|
||||
ExportStl::SetOptions( int nFilter)
|
||||
{
|
||||
m_nFilter = nFilter ;
|
||||
CalcGroupFilter() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -90,35 +89,34 @@ ExportStl::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
||||
bool
|
||||
ExportStl::ExportObject( const IGdbIterator& iIter)
|
||||
{
|
||||
// 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
|
||||
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
|
||||
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 ;
|
||||
@@ -130,69 +128,37 @@ 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, bool bGroup)
|
||||
ExportStl::TestFilter( int nLev, int nMode, int nStat)
|
||||
{
|
||||
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))
|
||||
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))
|
||||
return false ;
|
||||
if ( ( nMode == GDB_MD_STD && ( nFilter & EEXFLT_MODESTD) == 0) ||
|
||||
( nMode == GDB_MD_LOCKED && ( nFilter & EEXFLT_MODELOCKED) == 0) ||
|
||||
( nMode == GDB_MD_HIDDEN && ( nFilter & EEXFLT_MODEHIDDEN) == 0))
|
||||
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))
|
||||
return false ;
|
||||
if ( ( nStat == GDB_ST_OFF && ( nFilter & EEXFLT_STAOFF) == 0) ||
|
||||
( nStat == GDB_ST_ON && ( nFilter & EEXFLT_STAON) == 0) ||
|
||||
( nStat == GDB_ST_SEL && ( nFilter & EEXFLT_STASEL) == 0))
|
||||
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))
|
||||
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)
|
||||
|
||||
+3
-7
@@ -28,20 +28,16 @@ class ExportStl : public IExportStl
|
||||
virtual bool Export( IGeomDB* pGDB, int nId, const std::string& sFile) ;
|
||||
|
||||
public :
|
||||
ExportStl( void) : m_nFilter( EEXFLT_DEFAULT) {
|
||||
CalcGroupFilter() ;
|
||||
}
|
||||
ExportStl( void) : m_nFilter( EEXFLT_DEFAULT) {}
|
||||
|
||||
private :
|
||||
bool ExportObject( const IGdbIterator& iIter) ;
|
||||
bool ScanGroup( const IGdbIterator& iIter) ;
|
||||
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup) ;
|
||||
bool CalcGroupFilter( void) ;
|
||||
bool TestFilter( int nLev, int nMode, int nStat) ;
|
||||
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, se l'oggeto da valutare è un oggetto geometrico
|
||||
int m_nGroupFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare è un gruppo
|
||||
int m_nFilter ; // filtro su livello, modo e stato
|
||||
Writer m_Writer ; // scrittore di file di testo
|
||||
} ;
|
||||
|
||||
+6
-179
@@ -41,7 +41,7 @@ IExportSvg*
|
||||
CreateExportSvg( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
|
||||
if ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_EXPBASE, GetEExLogger()))
|
||||
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.GetDimX() ;
|
||||
double dDimY = b3All.GetDimY() ;
|
||||
double dDimX = b3All.GetMax().x - b3All.GetMin().x ;
|
||||
double dDimY = b3All.GetMax().y - b3All.GetMin().y ;
|
||||
if ( ! ExportHeader( dDimX, dDimY))
|
||||
bOk = false ;
|
||||
|
||||
@@ -189,9 +189,6 @@ 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 ;
|
||||
@@ -336,18 +333,6 @@ 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)
|
||||
@@ -361,34 +346,9 @@ 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
|
||||
@@ -401,16 +361,6 @@ 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
|
||||
@@ -429,44 +379,18 @@ ExportSvg::ExportArc( const string& sName, const Color& colObj, const IGeoObj* p
|
||||
const ICurveArc* pArc = GetCurveArc( pGeoObj) ;
|
||||
if ( pArc == nullptr)
|
||||
return false ;
|
||||
// lo copio e lo porto in globale
|
||||
// lo inglobo in una curva composita 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" ;
|
||||
@@ -478,16 +402,6 @@ 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
|
||||
@@ -511,25 +425,6 @@ 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) ||
|
||||
@@ -537,12 +432,6 @@ 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" ;
|
||||
@@ -554,16 +443,6 @@ 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
|
||||
@@ -587,42 +466,6 @@ 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) ||
|
||||
@@ -630,12 +473,6 @@ 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" ;
|
||||
@@ -647,16 +484,6 @@ 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
|
||||
@@ -706,7 +533,7 @@ ExportSvg::ExportFlatRegion( const string& sName, const Color& colObj, const IGe
|
||||
if ( IsNull( pMyCompo))
|
||||
return false ;
|
||||
pMyCompo->AddCurve( Release( pLoop)) ;
|
||||
pLoop.Set( pMyCompo) ;
|
||||
pLoop.Set( Release( pMyCompo)) ;
|
||||
}
|
||||
pLoop->Scale( GLOB_FRM, 1, 1, 0) ;
|
||||
}
|
||||
@@ -774,7 +601,7 @@ ExportSvg::ExportTriMesh( const string& sName, const Color& colObj, const IGeoOb
|
||||
continue ;
|
||||
POLYLINEVECTOR vPL ;
|
||||
if ( ! pStm->GetFacetLoops( nF, vPL))
|
||||
continue ;
|
||||
return false ;
|
||||
// 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
@@ -1,92 +0,0 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// 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
|
||||
} ;
|
||||
+3
-82
@@ -17,8 +17,10 @@
|
||||
#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 ;
|
||||
@@ -28,7 +30,7 @@ IImport3MF*
|
||||
CreateImport3MF( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
if ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImport3MF*> ( new( nothrow) Import3MF) ;
|
||||
@@ -220,86 +222,6 @@ 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 ;
|
||||
@@ -370,7 +292,6 @@ Import3MF::ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, sTransform& sT
|
||||
}
|
||||
|
||||
return true ;
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
|
||||
+96
-121
@@ -39,7 +39,7 @@ IImportBtl*
|
||||
CreateImportBtl( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPADV))
|
||||
if ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPADV, GetEExLogger()))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImportBtl*> ( new(nothrow) ImportBtl) ;
|
||||
@@ -67,18 +67,15 @@ ImportBtl::Import( const string& sFile, IGeomDB* pGDB, int nFlag)
|
||||
|
||||
// inizializzo il gestore geometria pezzi Btl
|
||||
int nFlatVertPos = 0 ;
|
||||
if (( nFlag & EIBFLAG_OUTL_FLAT_POS) != 0)
|
||||
nFlatVertPos = 4 ;
|
||||
else if (( nFlag & EIBFLAG_TS3_POS) != 0)
|
||||
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, bTrimWithOutline, bUseUAttr)) {
|
||||
if ( ! m_BtlGeom.Init( pGDB, nFlatVertPos, bSpecialTrim, bUseUAttr)) {
|
||||
LOG_ERROR( GetEExLogger(), " Error on BtlGeom.Init")
|
||||
return false ;
|
||||
}
|
||||
@@ -94,41 +91,25 @@ ImportBtl::Import( const string& sFile, IGeomDB* pGDB, int nFlag)
|
||||
}
|
||||
|
||||
// lettura generalità
|
||||
bool bEnd ;
|
||||
if ( ! ReadGeneral( bEnd)) {
|
||||
if ( ! ReadGeneral()) {
|
||||
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 ;) {
|
||||
// leggo un grezzo
|
||||
if ( ! ReadObject( RAWPART, bEnd)) {
|
||||
// i log di errore sono già gestiti nella funzione chiamata
|
||||
if ( ! ReadRawPart( bEnd)) {
|
||||
string sOut = " Error (ReadRawPart) on line " + ToString( m_theScanner.GetCurrLineNbr()) ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
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 ;) {
|
||||
// leggo un pezzo
|
||||
if ( ! ReadObject( PART, bEnd)) {
|
||||
if ( ! ReadPart( bEnd)) {
|
||||
// i log di errore sono già gestiti nella funzione chiamata
|
||||
bOk = false ;
|
||||
}
|
||||
@@ -136,37 +117,17 @@ ImportBtl::Import( const string& sFile, IGeomDB* pGDB, int nFlag)
|
||||
|
||||
// ciclo sui compositi
|
||||
for ( bool bEnd = false ; ! bEnd ;) {
|
||||
// leggo un composito
|
||||
if ( ! ReadObject( COMPOSITE, bEnd)) {
|
||||
// i log di errore sono già gestiti nella funzione chiamata
|
||||
if ( ! ReadComposite( bEnd)) {
|
||||
string sOut = " Error on line " + ToString( m_theScanner.GetCurrLineNbr()) ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
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 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
// eventuale ordinamento dei pezzi secondo SN
|
||||
bool bSort = (( nFlag & EIBFLAG_SORT) != 0) ;
|
||||
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) ;
|
||||
}
|
||||
if ( bSort)
|
||||
m_BtlGeom.SortParts() ;
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
@@ -217,10 +178,8 @@ ImportBtl::ReadHeader( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtl::ReadGeneral( bool& bEnd)
|
||||
ImportBtl::ReadGeneral( void)
|
||||
{
|
||||
// default file non finito
|
||||
bEnd = false ;
|
||||
// conteggio campi utili letti
|
||||
int nRead = 0 ;
|
||||
// leggo la prossima linea e verifico sia la sezione GENERAL
|
||||
@@ -334,14 +293,44 @@ ImportBtl::ReadGeneral( bool& bEnd)
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// fine del file
|
||||
bEnd = true ;
|
||||
return ( nRead > 0) ;
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtl::ReadObject( ObjType nType, bool& bEnd)
|
||||
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
|
||||
}
|
||||
|
||||
bEnd = true ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtl::ReadPart( bool& bEnd)
|
||||
{
|
||||
string sLine ;
|
||||
// leggo la prossima linea
|
||||
@@ -349,10 +338,8 @@ ImportBtl::ReadObject( ObjType nType, bool& bEnd)
|
||||
bEnd = true ;
|
||||
return true ;
|
||||
}
|
||||
// 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)) {
|
||||
// verifico sia la sezione PART
|
||||
if ( sLine != SEC_PART) {
|
||||
m_theScanner.UngetLine( sLine) ;
|
||||
bEnd = true ;
|
||||
return true ;
|
||||
@@ -368,8 +355,7 @@ ImportBtl::ReadObject( ObjType nType, 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 ;
|
||||
string sUID = "0" ;
|
||||
int nTrasfCount = 0, nUID = 0 ;
|
||||
while ( m_theScanner.GetLine( sLine)) {
|
||||
// se cambio sezione
|
||||
if ( sLine[0] == '[') {
|
||||
@@ -382,10 +368,6 @@ ImportBtl::ReadObject( ObjType nType, 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 ;
|
||||
@@ -505,18 +487,16 @@ ImportBtl::ReadObject( ObjType nType, bool& bEnd)
|
||||
}
|
||||
break ;
|
||||
case KEY_PART_UID : // UID istanza pezzo nella struttura
|
||||
Trim( sVal, " \t\r\n\"") ;
|
||||
sUID = sVal ;
|
||||
FromString( sVal, nUID) ;
|
||||
break ;
|
||||
case KEY_PART_TRANSFORMATION : // matrice di trasformazione istanza pezzo nella struttura
|
||||
{
|
||||
Frame3d frRef ;
|
||||
if ( ReadTransformation( sVal, frRef)) {
|
||||
++ nTrasfCount ;
|
||||
if ( nType == PART)
|
||||
m_BtlGeom.AddPartTransformation( sUID, frRef) ;
|
||||
m_BtlGeom.AddPartTransformation( ToString( nUID), frRef) ;
|
||||
string sUIDKey = sPartKey[KEY_PART_UID] + ToString( nTrasfCount) ;
|
||||
m_BtlGeom.SetUserAttribute( UATD_PART, sUIDKey, sUID) ;
|
||||
m_BtlGeom.SetUserAttribute( UATD_PART, sUIDKey, ToString( nUID)) ;
|
||||
string sTRFKey = sPartKey[KEY_PART_TRANSFORMATION] + ToString( nTrasfCount) ;
|
||||
m_BtlGeom.SetUserAttribute( UATD_PART, sTRFKey, ToString( frRef)) ;
|
||||
}
|
||||
@@ -630,7 +610,7 @@ ImportBtl::ReadObject( ObjType nType, bool& bEnd)
|
||||
// interpreto le lavorazioni (processing)
|
||||
bool bOk = true ;
|
||||
for ( bool bProcEnd = false ; ! bProcEnd ;) {
|
||||
if ( ! ReadProcess( nType != PART, bProcEnd)) {
|
||||
if ( ! ReadProcess( bProcEnd)) {
|
||||
// i log di errore sono già gestiti nella funzione chiamata
|
||||
bOk = false ;
|
||||
}
|
||||
@@ -651,6 +631,36 @@ ImportBtl::ReadObject( ObjType nType, 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)
|
||||
@@ -905,7 +915,7 @@ ImportBtl::ReadReferenceSide( const string& sVal, int& nSide, bool& bAlign)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtl::ReadProcess( bool bObjRef, bool& bProcEnd)
|
||||
ImportBtl::ReadProcess( bool& bProcEnd)
|
||||
{
|
||||
bProcEnd = false ;
|
||||
string sLine ;
|
||||
@@ -942,17 +952,16 @@ ImportBtl::ReadProcess( bool bObjRef, bool& bProcEnd)
|
||||
FromString( vsItem[1], nProc) ;
|
||||
int nSide = 0 ;
|
||||
FromString( vsItem[2], nSide) ;
|
||||
if ( nGroup != BTL_OBJECT_REF && ( nSide < BTL_SIDE_FRONT || nSide > BTL_SIDE_TOP))
|
||||
if ( nSide < BTL_SIDE_FRONT || nSide > BTL_SIDE_TOP)
|
||||
nSide = BTL_SIDE_FRONT ;
|
||||
bool bParams = false ;
|
||||
INTVECTOR vnDPar ;
|
||||
int nSPar = 0 ;
|
||||
int nSPar ;
|
||||
DBLVECTOR vdPar ;
|
||||
string sPar ;
|
||||
int nProcId = 0 ;
|
||||
Frame3d frRef ;
|
||||
STRVECTOR vsUAtt ;
|
||||
string sUID ;
|
||||
// ciclo sulle linee
|
||||
while ( true) {
|
||||
// se fine file, concludo
|
||||
@@ -986,17 +995,6 @@ ImportBtl::ReadProcess( bool bObjRef, 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())
|
||||
@@ -1038,27 +1036,13 @@ ImportBtl::ReadProcess( bool bObjRef, bool& bProcEnd)
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// 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 ;
|
||||
}
|
||||
// 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 ;
|
||||
@@ -1233,9 +1217,6 @@ 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
|
||||
@@ -1249,9 +1230,6 @@ 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
|
||||
@@ -1262,9 +1240,6 @@ 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
|
||||
|
||||
+5
-6
@@ -26,20 +26,19 @@ class ImportBtl : public IImportBtl
|
||||
public :
|
||||
ImportBtl( void) ;
|
||||
|
||||
private :
|
||||
enum ObjType { PART = 1, RAWPART = 2, COMPOSITE = 3} ;
|
||||
|
||||
private :
|
||||
bool ReadHeader( void) ;
|
||||
bool ReadGeneral( bool& bEnd) ;
|
||||
bool ReadObject( ObjType nType, bool& bEnd) ;
|
||||
bool ReadGeneral( void) ;
|
||||
bool ReadRawPart( bool& bEnd) ;
|
||||
bool ReadPart( bool& bEnd) ;
|
||||
bool ReadComposite( 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 bObjRef, bool& bProcEnd) ;
|
||||
bool ReadProcess( bool& bProcEnd) ;
|
||||
bool SkipCurrSection( void) ;
|
||||
bool SkipCurrProcess( void) ;
|
||||
bool GetProcessParams( const std::string& sText, const std::string& sProcType,
|
||||
|
||||
+275
-181
@@ -20,7 +20,6 @@
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -43,7 +42,7 @@ IImportBtlx*
|
||||
CreateImportBtlx( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPADV))
|
||||
if ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPADV, GetEExLogger()))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImportBtlx*> ( new(nothrow) ImportBtlx) ;
|
||||
@@ -63,18 +62,15 @@ ImportBtlx::Import( const string& sFile, IGeomDB* pGDB, int nFlag)
|
||||
|
||||
// inizializzo il gestore geometria pezzi Btl
|
||||
int nFlatVertPos = 0 ;
|
||||
if (( nFlag & EIBFLAG_OUTL_FLAT_POS) != 0)
|
||||
nFlatVertPos = 4 ;
|
||||
else if (( nFlag & EIBFLAG_TS3_POS) != 0)
|
||||
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, bTrimWithOutline, bUseUAttr)) {
|
||||
if ( ! m_BtlGeom.Init( pGDB, nFlatVertPos, bSpecialTrim, bUseUAttr)) {
|
||||
LOG_ERROR( GetEExLogger(), " Error on BtlGeom.Init") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -84,7 +80,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( stringtoW( sFile)) ;
|
||||
pugi::xml_parse_result ParseResult = doc.load_file( sFile.c_str()) ;
|
||||
if ( ! ParseResult) {
|
||||
string sError = " Error parsing file : " ;
|
||||
sError += ParseResult.description() ;
|
||||
@@ -352,7 +348,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){
|
||||
@@ -397,7 +393,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") {
|
||||
@@ -409,55 +405,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 ;
|
||||
@@ -472,40 +468,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
|
||||
@@ -515,6 +511,7 @@ ImportBtlx::ReadPart( pugi::xml_node node)
|
||||
}
|
||||
|
||||
// Outline
|
||||
|
||||
bool bOutLineOk = m_BtlGeom.UpdateOutLine() ;
|
||||
if ( ! bOutLineOk ){
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part : BtlGeom.UpdateOutLine error") ;
|
||||
@@ -1085,15 +1082,15 @@ ImportBtlx::ReadUserReferencePlane( pugi::xml_node node)
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part ReferencePlane : ID missing") ;
|
||||
return false ;
|
||||
}
|
||||
int nId = node.attribute( "ID").as_int() ;
|
||||
int id = node.attribute( "ID").as_int() ;
|
||||
|
||||
if ( node.child( "Position") == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part ReferencePlane : Position missing") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
Point3d ptOrig ;
|
||||
Vector3d vX, vY ;
|
||||
Point3d Origin ;
|
||||
Vector3d VectX, VectY ;
|
||||
|
||||
// Origin
|
||||
if ( node.child( "Position").child( "ReferencePoint") == nullptr ||
|
||||
@@ -1104,9 +1101,9 @@ ImportBtlx::ReadUserReferencePlane( pugi::xml_node node)
|
||||
return false ;
|
||||
}
|
||||
|
||||
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() ;
|
||||
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() ;
|
||||
|
||||
// VectX
|
||||
if ( node.child( "Position").child( "XVector") == nullptr ||
|
||||
@@ -1116,9 +1113,9 @@ ImportBtlx::ReadUserReferencePlane( pugi::xml_node node)
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part ReferencePlane : VectorX error") ;
|
||||
return false ;
|
||||
}
|
||||
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() ;
|
||||
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() ;
|
||||
|
||||
// VectY
|
||||
if ( node.child( "Position").child( "YVector") == nullptr ||
|
||||
@@ -1128,28 +1125,26 @@ ImportBtlx::ReadUserReferencePlane( pugi::xml_node node)
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part ReferencePlane : VectorY error") ;
|
||||
return false ;
|
||||
}
|
||||
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() ;
|
||||
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() ;
|
||||
|
||||
Point3d ptOnX = ptOrig + 100 * vX ;
|
||||
Point3d ptOnY = ptOrig + 100 * vY ;
|
||||
Point3d ptOnX = Origin + 100 * VectX ;
|
||||
Point3d ptOnY = Origin + 100 * VectY ;
|
||||
|
||||
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 ;
|
||||
}
|
||||
Frame3d FrRef ;
|
||||
FrRef.Set( Origin, ptOnX, ptOnY) ;
|
||||
|
||||
MapURefPlanes.emplace( id, FrRef) ;
|
||||
|
||||
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
|
||||
@@ -1176,6 +1171,7 @@ 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:
|
||||
@@ -1211,53 +1207,101 @@ 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) ;
|
||||
@@ -1265,15 +1309,17 @@ 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
|
||||
@@ -1286,7 +1332,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 ;
|
||||
}
|
||||
@@ -1294,7 +1340,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) ;
|
||||
@@ -1306,13 +1352,14 @@ 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 ;
|
||||
}
|
||||
@@ -1330,7 +1377,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 ;
|
||||
}
|
||||
@@ -1339,7 +1386,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)
|
||||
@@ -1356,17 +1403,20 @@ 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 ){
|
||||
@@ -1375,84 +1425,128 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
|
||||
}
|
||||
}
|
||||
// DovetailMortise
|
||||
else if ( sProcessName == "DovetailMortise")
|
||||
else if ( sProcessName == "DovetailMortise") {
|
||||
// I parametri sono quasi gli stessi di Mortise, quindi chiamo la stessa funzione
|
||||
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) ;
|
||||
else if ( sProcessName == "Marking") {
|
||||
bProcessOk = ReadMarkingParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
}
|
||||
// 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) ;
|
||||
//bProcessOk = ReadSphereParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
||||
//if ( ! bProcessOk)
|
||||
// return false ;
|
||||
}
|
||||
// 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, vsUAtt) ;
|
||||
bProcessOk = ReadFreeContourParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar, curve_counter, vsUAtt) ;
|
||||
if ( ! bProcessOk)
|
||||
return false ;
|
||||
bAdd = false ;
|
||||
}
|
||||
|
||||
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] ;
|
||||
}
|
||||
|
||||
// Aggiungo il processo
|
||||
if ( bProcessOk && bAdd) {
|
||||
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
|
||||
|
||||
@@ -1464,7 +1558,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 ;
|
||||
}
|
||||
@@ -1484,8 +1578,8 @@ ImportBtlx::ReadShape( pugi::xml_node node)
|
||||
return false ;
|
||||
}
|
||||
|
||||
INTMATRIX vFacesVertices ;
|
||||
PNTVECTOR vPoints ;
|
||||
vector<INTVECTOR> vFacesVertices ;
|
||||
vector<Point3d> vPoints ;
|
||||
|
||||
size_t str_start = 0 ;
|
||||
size_t str_end ;
|
||||
@@ -1494,10 +1588,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() ;
|
||||
}
|
||||
@@ -1511,17 +1605,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 ;
|
||||
}
|
||||
|
||||
+7
-6
@@ -115,16 +115,17 @@ 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, 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) ;
|
||||
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) ;
|
||||
|
||||
private :
|
||||
BtlGeom m_BtlGeom ; // gestore geometria pezzi Btl
|
||||
std::string m_sVersion ; // versione btlx
|
||||
std::unordered_map< int, Frame3d> m_mapRefPlanes ;
|
||||
std::unordered_map< int, Frame3d> MapURefPlanes ;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
+118
-115
@@ -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: Moritise Shape is unknown") ;
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tenon Shape is unknown") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -980,22 +980,20 @@ 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" || sShape == "rounded" || sShape == "square" ) {
|
||||
if ( sShape != "radius") // P12
|
||||
vdPar[9] = MILL_DEF_RAD ;
|
||||
vdPar[9] *= 2 ;
|
||||
else if ( sShape == "radius") {
|
||||
vdPar[9] *= 2 ; // P12
|
||||
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: Dovetail Tenon Shape is unknown") ;
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tenon Shape is unknown") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -1029,17 +1027,19 @@ 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) ; // P10
|
||||
vdPar[8] = Clamp( ReadProcessChild( process, "ConeAngle", vdPar[8]), 0.1, 179.9) ; // P16
|
||||
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) ; // P12
|
||||
vdPar[10] = Clamp( ReadProcessChild( process, "ShapeRadius", vdPar[10]), 0.0, 1000.0) ; // P10
|
||||
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,22 +1052,20 @@ 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" || sShape == "rounded" || sShape == "square") {
|
||||
if ( sShape != "radius") // P12
|
||||
vdPar[10] = MILL_DEF_RAD ;
|
||||
else if ( sShape == "radius") {
|
||||
vdPar[10] *= 2 ; // P12
|
||||
vdPar[7] = dWidth - vdPar[10] * ( 1 - sin( vdPar[8] * DEGTORAD)) / cos( vdPar[8] * DEGTORAD) ; // P09
|
||||
if ( vdPar[7] < - EPS_SMALL) {
|
||||
if ( vdPar[7] < 0 ) {
|
||||
LOG_ERROR( GetEExLogger(), " Error : Dovetail mortise width") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Dovetail mortise Shape is unknown") ;
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Mortise Shape is unknown") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -1950,47 +1948,60 @@ ImportBtlx::ReadDovetailParams( pugi::xml_node process, int& nGroup, int& nProc,
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtlx::ReadFreeContourParams( pugi::xml_node process, const STRVECTOR& vsUAtt)
|
||||
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)
|
||||
{
|
||||
// identifico il processo con sigle usate nel btl
|
||||
int nProc = 250 ;
|
||||
int nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
// Identifico il processo con sigle usate nel btl
|
||||
nProc = 250 ;
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
string sToolPosition = process.attribute( "ToolPosition").value() ;
|
||||
int nGroup = 0 ;
|
||||
|
||||
if ( sToolPosition == "left")
|
||||
nGroup = 3 ;
|
||||
else if ( sToolPosition == "right")
|
||||
else if (sToolPosition == "center")
|
||||
nGroup = 0 ;
|
||||
else if (sToolPosition == "right")
|
||||
nGroup = 4 ;
|
||||
else if ( sToolPosition != "center") {
|
||||
else {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Free Contour group not defined") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
// Inizializzo i vettori dei parametri
|
||||
for ( pugi::xml_node_iterator it = process.begin() ; it != process.end() ; it ++ ) {
|
||||
|
||||
int nCrvCnt = 1 ;
|
||||
// scrorro i contours
|
||||
for ( pugi::xml_node_iterator it = process.begin() ; it != process.end() ; it ++) {
|
||||
// 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 ;
|
||||
}
|
||||
|
||||
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, bCounterSink, nCrvCnt, vsUAtt) ;
|
||||
bContOk = ReadSContourParams( *it, 0, 0, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar, curve_counter, vsUAtt) ;
|
||||
if ( ! bContOk)
|
||||
return false ;
|
||||
}
|
||||
else if ( itName == "DualContour") {
|
||||
bContOk = ReadDContourParams( *it, nGroup, nProc, nSide, bCounterSink, nCrvCnt, vsUAtt) ;
|
||||
bContOk = ReadDContourParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar, curve_counter, vsUAtt) ;
|
||||
if ( ! bContOk)
|
||||
return false ;
|
||||
}
|
||||
@@ -2005,73 +2016,45 @@ ImportBtlx::ReadFreeContourParams( pugi::xml_node process, const STRVECTOR& vsUA
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
bool
|
||||
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)
|
||||
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)
|
||||
{
|
||||
// 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 ;
|
||||
// Parametri propri del contour che non cambiano
|
||||
string sDepthBounded = process.attribute( "DepthBounded").value() ;
|
||||
if ( sDepthBounded == "no")
|
||||
vdPar[3] = 0 ;
|
||||
else
|
||||
vdPar[3] = process.attribute( "Depth").as_double() ;
|
||||
|
||||
int nContourCnt = 0 ;
|
||||
vdPar[3] = process.attribute( "Depth").as_double() ;
|
||||
|
||||
int contour_counter = 0 ;
|
||||
for ( pugi::xml_node_iterator it = process.begin() ; it != process.end() ; it++)
|
||||
nContourCnt ++ ;
|
||||
contour_counter ++ ;
|
||||
|
||||
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] = it->attribute( "Inclination").as_double() ;
|
||||
vdPar[4] = process.attribute( "Inclination").as_double() ;
|
||||
|
||||
i++ ;
|
||||
if ( i != nContourCnt)
|
||||
vdPar[7] = nCrvCnt + 1 ;
|
||||
if ( i != contour_counter)
|
||||
vdPar[7] = curve_counter + 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 ;
|
||||
}
|
||||
@@ -2080,16 +2063,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 ;
|
||||
}
|
||||
@@ -2098,7 +2081,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 ;
|
||||
|
||||
@@ -2125,19 +2108,36 @@ 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, nCrvCnt, frRef, vnDPar, nSPar, vdPar, sPar, vsUAtt, 0) ;
|
||||
|
||||
bool bProcessOk = m_BtlGeom.AddProcess( nGroup, nProc, nSide, sDes, curve_counter, frRef, vnDPar, nSPar, vdPar, sPar, vsUAtt, 0) ;
|
||||
if ( ! bProcessOk) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddProcess error") ;
|
||||
return false ;
|
||||
}
|
||||
nCrvCnt ++ ;
|
||||
curve_counter ++ ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
@@ -2145,36 +2145,39 @@ ImportBtlx::ReadSContourParams( pugi::xml_node process, int nType, int nOtherId,
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtlx::ReadDContourParams( pugi::xml_node process, const int nGroup, const int nProc, const int nSide, bool bCounterSink,
|
||||
int& nCrvCnt, const STRVECTOR& vsUAtt)
|
||||
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)
|
||||
{
|
||||
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 = 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 ++)
|
||||
nPrincipalCrvCnt ++ ;
|
||||
// Principal Contour
|
||||
int nPrincipalId = curve_counter + 1 ;
|
||||
int nPrincipalContCurves = 0 ;
|
||||
|
||||
bool bContourOk = ReadSContourParams( process.child( "PrincipalContour"), 100, nCrvCnt + nPrincipalCrvCnt,
|
||||
nGroup, nProc, nSide, bCounterSink, nCrvCnt, vsUAtt) ;
|
||||
// conto il numero di curve nel PrincipalContour
|
||||
for ( pugi::xml_node_iterator it = process.child( "PrincipalContour").child( "Contour").begin() ;
|
||||
it != process.child( "PrincipalContour").child( "Contour").end() ; it ++)
|
||||
nPrincipalContCurves ++ ;
|
||||
|
||||
bool bContourOk = ReadSContourParams( process.child( "PrincipalContour"), 100, curve_counter + nPrincipalContCurves,
|
||||
nGroup, nProc, nSide, vnDPar, nSPar,vdPar, sPar, curve_counter, vsUAtt) ;
|
||||
if ( ! bContourOk)
|
||||
return false ;
|
||||
|
||||
// associated Contour
|
||||
// Associated Contour
|
||||
bContourOk = ReadSContourParams( process.child( "AssociatedContour"), 101, nPrincipalId,
|
||||
nGroup, nProc, nSide, bCounterSink, nCrvCnt, vsUAtt) ;
|
||||
nGroup, nProc, nSide, vnDPar, nSPar,vdPar, sPar, curve_counter, vsUAtt) ;
|
||||
if ( ! bContourOk)
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------
|
||||
// ------------------------- Funzioni ausiliarie ----------------------------------------------------------------
|
||||
// -------------------------------------------------------------------------------------------------------------
|
||||
@@ -2242,7 +2245,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 ;
|
||||
}
|
||||
|
||||
|
||||
+44
-75
@@ -23,7 +23,6 @@
|
||||
#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"
|
||||
@@ -53,7 +52,7 @@ IImportCnc*
|
||||
CreateImportCnc( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
if ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImportCnc*> ( new(nothrow) ImportCnc) ;
|
||||
@@ -140,8 +139,6 @@ 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 ;
|
||||
@@ -171,7 +168,7 @@ ImportCnc::ProcessLine( const string& sLine)
|
||||
return ParseRemark( sLine) ;
|
||||
|
||||
// altre linee da saltare
|
||||
if ( sLine[0] == '$' || sLine[0] == '!' || ( sLine[0] == 'M' && sLine[1] == 'S' && sLine[2] == 'G'))
|
||||
if ( sLine[0] == '$' || sLine[0] == '!')
|
||||
return true ;
|
||||
|
||||
// eliminazione di commenti intermedi o finali
|
||||
@@ -193,14 +190,6 @@ 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 ;
|
||||
@@ -321,8 +310,6 @@ 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/") ;
|
||||
@@ -499,12 +486,6 @@ 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 ;
|
||||
}
|
||||
|
||||
@@ -1002,8 +983,7 @@ ImportCnc::AddArc( bool bCCW)
|
||||
switch ( VerifyArcCenter( vtN)) {
|
||||
case A_ARC :
|
||||
// punti estremi e centro
|
||||
pCrvArc.Set( GetArc2PCN( m_ptLast, m_ptNext, m_ptCen, vtN)) ;
|
||||
if ( IsNull( pCrvArc))
|
||||
if ( ! pCrvArc->SetC2PN( m_ptCen, m_ptLast, m_ptNext, vtN))
|
||||
return false ;
|
||||
// verifico senso di rotazione
|
||||
if ( ( bCCW && pCrvArc->GetAngCenter() < 0) ||
|
||||
@@ -1137,20 +1117,25 @@ ImportCnc::VerifyArcCenter( const Vector3d& vtN)
|
||||
if ( ! frOcs.Set( ORIG, vtN))
|
||||
return A_ERROR ;
|
||||
// porto i punti in questo riferimento
|
||||
Point3d ptLloc = GetToLoc( m_ptLast, frOcs) ;
|
||||
Point3d ptNloc = GetToLoc( m_ptNext, frOcs) ;
|
||||
Point3d ptCloc = GetToLoc( m_ptCen, frOcs) ;
|
||||
Vector3d vtOloc = GetToLoc( m_vtOffs, frOcs) ;
|
||||
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) ;
|
||||
// verifico se circonferenza
|
||||
int nRet = ( SqDistXY( ptLloc, ptNloc) > EPS_SMALL * EPS_SMALL) ? A_ARC : A_CIRC ;
|
||||
// se controllo Fanuc o Fagor, centro è sempre in relativo
|
||||
if ( m_nCNC == CNC_FANUC || m_nCNC == CNC_FAGOR) {
|
||||
// se controllo Fanuc, centro è sempre in relativo
|
||||
if ( m_nCNC == CNC_FANUC) {
|
||||
// centro in relativo
|
||||
Point3d ptCrl = ptCloc + ptLloc ;
|
||||
double dRadLast = DistXY( ptLloc, ptCrl) ;
|
||||
double dRadNext = DistXY( ptNloc, ptCrl) ;
|
||||
if ( abs( dRadNext - dRadLast) < 100 * EPS_SMALL) {
|
||||
m_ptCen = GetToGlob( ptCrl, frOcs) ;
|
||||
if ( abs( dRadNext - dRadLast) < 10 * EPS_SMALL) {
|
||||
m_ptCen = ptCrl ;
|
||||
m_ptCen.ToGlob( frOcs) ;
|
||||
return nRet ;
|
||||
}
|
||||
}
|
||||
@@ -1158,28 +1143,19 @@ ImportCnc::VerifyArcCenter( const Vector3d& vtN)
|
||||
else if ( m_bAbsCoord) {
|
||||
// centro in assoluto
|
||||
Point3d ptCas = ptCloc + vtOloc ;
|
||||
double dRadCasLast = DistXY( ptLloc, ptCas) ;
|
||||
double dRadCasNext = DistXY( ptNloc, ptCas) ;
|
||||
double dRadLast = DistXY( ptLloc, ptCas) ;
|
||||
double dRadNext = DistXY( ptNloc, ptCas) ;
|
||||
if ( abs( dRadNext - dRadLast) < 10 * EPS_SMALL) {
|
||||
m_ptCen += m_vtOffs ;
|
||||
return nRet ;
|
||||
}
|
||||
// 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 ;
|
||||
}
|
||||
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) ;
|
||||
dRadLast = DistXY( ptLloc, ptCrl) ;
|
||||
dRadNext = DistXY( ptNloc, ptCrl) ;
|
||||
if ( abs( dRadNext - dRadLast) < 10 * EPS_SMALL) {
|
||||
m_ptCen = ptCrl ;
|
||||
m_ptCen.ToGlob( frOcs) ;
|
||||
return nRet ;
|
||||
}
|
||||
}
|
||||
@@ -1187,27 +1163,18 @@ ImportCnc::VerifyArcCenter( const Vector3d& vtN)
|
||||
else {
|
||||
// centro in relativo
|
||||
Point3d ptCrl = ptCloc + ptLloc ;
|
||||
double dRadCrlLast = DistXY( ptLloc, ptCrl) ;
|
||||
double dRadCrlNext = DistXY( ptNloc, ptCrl) ;
|
||||
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 ;
|
||||
}
|
||||
// centro in assoluto
|
||||
Point3d ptCas = ptCloc + vtOloc ;
|
||||
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) {
|
||||
dRadLast = DistXY( ptLloc, ptCas) ;
|
||||
dRadNext = DistXY( ptNloc, ptCas) ;
|
||||
if ( abs( dRadNext - dRadLast) < 10 * EPS_SMALL) {
|
||||
m_ptCen += m_vtOffs ;
|
||||
return nRet ;
|
||||
}
|
||||
@@ -1226,9 +1193,12 @@ 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 = GetToLoc( ptCen, frOcs) ;
|
||||
Point3d ptSloc = GetToLoc( ptStart, frOcs) ;
|
||||
Point3d ptNEloc = GetToLoc( ptNearEnd, frOcs) ;
|
||||
Point3d ptCloc = ptCen ;
|
||||
ptCloc.ToLoc( frOcs) ;
|
||||
Point3d ptSloc = ptStart ;
|
||||
ptSloc.ToLoc( frOcs) ;
|
||||
Point3d ptNEloc = ptNearEnd ;
|
||||
ptNEloc.ToLoc( frOcs) ;
|
||||
// calcolo il cerchio in questo piano
|
||||
double dRad = 0.5 * ( DistXY( ptCloc, ptSloc) + DistXY( ptCloc, ptNEloc)) ;
|
||||
ptCloc.z = ptSloc.z ;
|
||||
@@ -1331,8 +1301,7 @@ ImportCnc::PostProcess( void)
|
||||
int nNextId = m_pGDB->GetNext( nId) ;
|
||||
// estraggo la curva e la accodo alla composita
|
||||
ICurve* pCrv = GetCurve( m_pGDB->RemoveGeoObjAndErase( nId)) ;
|
||||
if ( ! pCompo->AddCurve( pCrv, true, 10 * EPS_SMALL))
|
||||
return false ;
|
||||
pCompo->AddCurve( pCrv) ;
|
||||
// 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, CNC_FAGOR} ;
|
||||
enum CncName { CNC_STD = 0, CNC_OSAI = 1, CNC_FANUC = 2, CNC_NUM = 3, CNC_SIEMENS = 4, CNC_TPA = 5, CNC_MAZAK = 6} ;
|
||||
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 ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
if ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
|
||||
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 ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
if ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImportDxf*> ( new(nothrow) ImportDxf) ;
|
||||
|
||||
+3
-4
@@ -1378,7 +1378,7 @@ ImportDxf::ReadPoint( bool& bFileEnd)
|
||||
if ( ! pGeoPnt->Set( ptP))
|
||||
return false ;
|
||||
// lo passo all'oggetto geometrico generico
|
||||
pGeoObj.Set( pGeoPnt) ;
|
||||
pGeoObj.Set( Release( 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( pGeoVect) ;
|
||||
pGeoObj.Set( Release( pGeoVect)) ;
|
||||
}
|
||||
// inserisco l'entità nel DB
|
||||
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, GetGroupId( sLayer), Release( pGeoObj)) ;
|
||||
@@ -2253,9 +2253,8 @@ 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 ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
if ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
|
||||
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 ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
if ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImportStl*> ( new(nothrow) ImportStl) ;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#pragma comment(lib, EGTLIBDIR "EgtGeneral" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTLIBDIR "EgtNumKernel" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTLIBDIR "EgtGeomKernel" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTLIBDIR "EgtExecutor" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTEXTDIR "/libzip/Lib/zip" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTEXTDIR "/lib3mf/Lib/lib3mf" EGTLIBVER ".lib")
|
||||
|
||||
Reference in New Issue
Block a user