Compare commits
69 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 91d1260d8a | |||
| aead658f5d | |||
| 82a5161b07 | |||
| f923477b7e | |||
| 96a5f77b12 | |||
| c47b3ee4d3 | |||
| c1f32c6c59 | |||
| 30b1085ef5 | |||
| 9577795c73 | |||
| e7e7cb21bd | |||
| 5e74d640aa | |||
| 398f7d86a6 | |||
| 8eaf7c174f | |||
| 18c7c4601a | |||
| df864c93a8 | |||
| e16657f560 | |||
| 1f24ff1dfb | |||
| 8d70d31eff | |||
| a874068e7b | |||
| 15dfae1789 | |||
| 62aecf63eb | |||
| 2bb1767c9d | |||
| 798c23e42d | |||
| 13c2a1d9e5 | |||
| 83215059a5 | |||
| 120e341fb7 | |||
| b7c3dbc576 | |||
| 1e09cdff14 | |||
| 53962aa5c1 | |||
| c16fba2752 | |||
| 03eb6707ee | |||
| c8b4cd9bee | |||
| 9331803efc | |||
| 050d3acd60 | |||
| ac55ab01df | |||
| 4ab0d89e60 | |||
| b6d4d76783 | |||
| b366963eee | |||
| d1a19ed42f | |||
| ae950c0efa | |||
| aa80fb63af | |||
| 7778cf5027 | |||
| bb75d9c878 | |||
| f54f1f8969 | |||
| a71e1211d1 | |||
| 75d5fc367c | |||
| 6624da2a03 | |||
| 3d8c83f33c | |||
| 584cec6f1c | |||
| 7ed7f56415 | |||
| 22d47e551a | |||
| 6434dc6c89 | |||
| ca58abb125 | |||
| f7fb6d3435 | |||
| ad9acebd04 | |||
| 3543839299 | |||
| b5a3fb5543 | |||
| 80634b8fcd | |||
| 025336f011 | |||
| deaab1767f | |||
| ee8d0c8c21 | |||
| 1a7483b7c4 | |||
| 3205e80262 | |||
| 567a7ddba6 | |||
| f8dc7803b5 | |||
| d4fb909a0f | |||
| cf05547a38 | |||
| 926074db57 | |||
| 254d4792cf |
+277
-92
@@ -22,6 +22,7 @@
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtStringEncoder.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include <future>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -70,7 +71,8 @@ BeamMgr::SetFlag( int nFlag)
|
||||
bool bSpecialTrim = (( nFlag & EIBFLAG_SPECIAL_TRIM) != 0) ;
|
||||
bool bTrimWithOutline = (( nFlag & EIBFLAG_TRIM_WITH_OUTLINE) != 0) ;
|
||||
bool bUseUAttr = (( nFlag & EIBFLAG_USEUATTR) != 0) ;
|
||||
if ( ! m_BtlGeom.Init( m_pGDB, nFlatVertPos, bSpecialTrim, bTrimWithOutline, bUseUAttr)) {
|
||||
bool bPartOffset = (( nFlag & EIBFLAG_PARTOFFSET) != 0) ;
|
||||
if ( ! m_BtlGeom.Init( m_pGDB, nFlatVertPos, bSpecialTrim, bTrimWithOutline, bUseUAttr, bPartOffset, false)) {
|
||||
LOG_ERROR( GetEExLogger(), " Error on BtlGeom.Init")
|
||||
return false ;
|
||||
}
|
||||
@@ -82,7 +84,7 @@ BeamMgr::SetFlag( int nFlag)
|
||||
int
|
||||
BeamMgr::CreatePart( void)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// Aggiorno posizione
|
||||
@@ -95,7 +97,7 @@ BeamMgr::CreatePart( void)
|
||||
bool
|
||||
BeamMgr::SetPart( int nPartId)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Imposto il pezzo come corrente
|
||||
@@ -106,7 +108,7 @@ BeamMgr::SetPart( int nPartId)
|
||||
bool
|
||||
BeamMgr::ErasePart( void)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Cancello il pezzo corrente
|
||||
@@ -117,7 +119,7 @@ BeamMgr::ErasePart( void)
|
||||
bool
|
||||
BeamMgr::UpdatePart( void)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Forzo aggiornamento del pezzo corrente
|
||||
@@ -128,10 +130,10 @@ BeamMgr::UpdatePart( void)
|
||||
bool
|
||||
BeamMgr::SetPartProdNbr( int nProdNbr)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Verifico validità nuovo PDN
|
||||
// Verifico validità nuovo PDN
|
||||
if ( ! m_BtlGeom.VerifyNewPartProdNbr( nProdNbr))
|
||||
return false ;
|
||||
// Imposto il numero di produzione sul pezzo corrente
|
||||
@@ -142,7 +144,7 @@ BeamMgr::SetPartProdNbr( int nProdNbr)
|
||||
bool
|
||||
BeamMgr::SetPartName( const string& sName)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Imposto il nome sul pezzo corrente
|
||||
@@ -153,7 +155,7 @@ BeamMgr::SetPartName( const string& sName)
|
||||
bool
|
||||
BeamMgr::SetPartCount( int nCount)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Imposto il numero delle parti da produrre sul pezzo corrente
|
||||
@@ -164,7 +166,7 @@ BeamMgr::SetPartCount( int nCount)
|
||||
bool
|
||||
BeamMgr::SetPartBox( double dLength, double dHeight, double dWidth, bool bUpdate)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Imposto le dimensioni sul pezzo corrente
|
||||
@@ -185,10 +187,10 @@ BeamMgr::SetPartBox( double dLength, double dHeight, double dWidth, bool bUpdate
|
||||
bool
|
||||
BeamMgr::GetSideData( int nSide, Frame3d& frRef, double& dLength, double& dWidth, double& dHeight)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Verifico validità identificativo di faccia
|
||||
// Verifico validità identificativo di faccia
|
||||
if ( nSide < BTL_SIDE_FRONT || nSide > BTL_SIDE_RIGHT)
|
||||
return false ;
|
||||
// Recupero riferimento del pezzo corrente
|
||||
@@ -210,7 +212,7 @@ BeamMgr::GetSideData( int nSide, Frame3d& frRef, double& dLength, double& dWidth
|
||||
bool
|
||||
BeamMgr::ShowFacesName( bool bShow)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Verifico esistenza del pezzo corrente
|
||||
@@ -253,7 +255,7 @@ BeamMgr::ShowFacesName( bool bShow)
|
||||
// porto il testo nel piano della faccia
|
||||
Frame3d frRef = m_BtlGeom.GetSideFrame( nS) ;
|
||||
pText->ToGlob( frRef) ;
|
||||
// recupero eventuale nome già presente
|
||||
// recupero eventuale nome già presente
|
||||
int nOldTextId = m_pGDB->GetFirstNameInGroup( nFcsNameLayId, sFace) ;
|
||||
// se gia presente, lo rimpiazzo
|
||||
if ( nOldTextId != GDB_ID_NULL) {
|
||||
@@ -293,7 +295,7 @@ BeamMgr::UpdateFacesName( void)
|
||||
bool
|
||||
BeamMgr::ShowLoadingSide( bool bShow, bool bFromLeft)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Verifico esistenza del pezzo corrente
|
||||
@@ -363,7 +365,7 @@ BeamMgr::AddProcess( int nGroup, int nProc, int nSide, const string& sDes, int n
|
||||
const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar, const STRVECTOR& vsUAtt,
|
||||
int nCrvId, int nCrv2Id, bool bUpdate)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// Recupero i dati di default della feature
|
||||
@@ -415,7 +417,7 @@ BeamMgr::ModifyProcess( int nGeomId, int nGroup, int nProc, int nSide, const str
|
||||
const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar, const STRVECTOR& vsUAtt,
|
||||
int nCrvId, int nCrv2Id, bool bUpdate)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// Recupero il pezzo di appartenenza
|
||||
@@ -464,7 +466,7 @@ BeamMgr::ModifyProcess( int nGeomId, int nGroup, int nProc, int nSide, const str
|
||||
bool
|
||||
BeamMgr::EraseProcess( int nGeomId, bool bUpdate)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Recupero il pezzo di appartenenza
|
||||
@@ -528,7 +530,7 @@ MyEnableProcess( IGeomDB* pGDB, BtlGeom& BtlG, int nGeomId, bool bEnable)
|
||||
bool
|
||||
BeamMgr::EnableProcess( int nGeomId, bool bEnable, bool bUpdate)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Recupero il pezzo di appartenenza
|
||||
@@ -560,6 +562,113 @@ BeamMgr::EnableProcess( int nGeomId, bool bEnable, bool bUpdate)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::CalcAllSolids( bool bShow, bool bRecalc, pcfProcEvents pFun)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
|
||||
// Recupero tutti i pezzi
|
||||
INTVECTOR vPartId ;
|
||||
int nPartId = m_pGDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
|
||||
while ( nPartId != GDB_ID_NULL) {
|
||||
int nLevel ;
|
||||
if ( m_pGDB->GetLevel( nPartId, nLevel) && nLevel == GDB_LV_USER &&
|
||||
m_pGDB->GetFirstNameInGroup( nPartId, BOX_LAYER_NAME) != GDB_ID_NULL) {
|
||||
vPartId.push_back( nPartId) ;
|
||||
// nascondo il layer del solido per non avere problemi con le visualizzazioni durante i calcoli in multithread
|
||||
m_pGDB->SetStatus( m_pGDB->GetFirstNameInGroup( nPartId, SOLID_LAYER_NAME), GDB_ST_OFF) ;
|
||||
}
|
||||
nPartId = m_pGDB->GetNextGroup( nPartId) ;
|
||||
}
|
||||
|
||||
// Calcolo i solidi
|
||||
bool bOk = true ;
|
||||
|
||||
constexpr bool MULTITHREAD = true ;
|
||||
if ( MULTITHREAD) {
|
||||
int nPartCnt = int( vPartId.size()) ;
|
||||
int nThreadMax = min( max( 1, int( thread::hardware_concurrency()) - 1), nPartCnt) ;
|
||||
vector< future<bool>> vRes( nPartCnt) ;
|
||||
INTVECTOR vInd( nThreadMax) ;
|
||||
// lancio tutto quanto possibile
|
||||
for ( int i = 0 ; i < nThreadMax ; ++ i) {
|
||||
vInd[i] = i ;
|
||||
vRes[vInd[i]] = async( launch::async, &BeamMgr::CalcSolid, this, vPartId[vInd[i]], bRecalc) ;
|
||||
}
|
||||
// attesa completamento e rilancio successivi (occupando sempre lo stesso numero di thread)
|
||||
int nNext = nThreadMax ;
|
||||
int nTerminated = 0 ;
|
||||
while ( nTerminated < nPartCnt) {
|
||||
for ( int i = 0 ; i < nThreadMax ; ++ i) {
|
||||
if ( vInd[i] >= 0 && vRes[vInd[i]].valid() && vRes[vInd[i]].wait_for( chrono::microseconds{ 1}) == future_status::ready) {
|
||||
++ nTerminated ;
|
||||
if ( ! vRes[vInd[i]].get())
|
||||
bOk = false ;
|
||||
ShowSolid( vPartId[vInd[i]], bShow) ;
|
||||
if ( pFun != nullptr)
|
||||
pFun( ( 100 * nTerminated) / nPartCnt, -1) ;
|
||||
if ( nNext < nPartCnt) {
|
||||
vInd[i] = nNext ;
|
||||
++ nNext ;
|
||||
vRes[vInd[i]] = async( launch::async, &BeamMgr::CalcSolid, this, vPartId[vInd[i]], bRecalc) ;
|
||||
}
|
||||
else
|
||||
vInd[i] = -1 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// non multithread solo per DEBUG
|
||||
else {
|
||||
int nPartCnt = int( vPartId.size()) ;
|
||||
for ( int i = 0 ; i < nPartCnt ; ++ i) {
|
||||
if ( ! CalcSolid( vPartId[i], bRecalc))
|
||||
bOk = false ;
|
||||
ShowSolid( vPartId[i], bShow) ;
|
||||
if ( pFun != nullptr)
|
||||
pFun( ( 100 * ( i + 1)) / nPartCnt, -1) ;
|
||||
}
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::ShowAllSolids( bool bShow, pcfProcEvents pFun)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
|
||||
// Recupero tutti i pezzi
|
||||
INTVECTOR vPartId ;
|
||||
int nPartId = m_pGDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
|
||||
while ( nPartId != GDB_ID_NULL) {
|
||||
int nLevel ;
|
||||
if ( m_pGDB->GetLevel( nPartId, nLevel) && nLevel == GDB_LV_USER &&
|
||||
m_pGDB->GetFirstNameInGroup( nPartId, BOX_LAYER_NAME) != GDB_ID_NULL)
|
||||
vPartId.push_back( nPartId) ;
|
||||
nPartId = m_pGDB->GetNextGroup( nPartId) ;
|
||||
}
|
||||
|
||||
// Aggiorno visualizzazione dei solidi
|
||||
bool bOk = true ;
|
||||
int nPartCnt = int( vPartId.size()) ;
|
||||
for ( int i = 0 ; i < nPartCnt ; ++ i) {
|
||||
if ( ! ShowSolid( vPartId[i], bShow))
|
||||
bOk = false ;
|
||||
if ( pFun != nullptr)
|
||||
pFun( ( 100 * ( i + 1)) / nPartCnt, -1) ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static ISurfTriMesh*
|
||||
RegularizeTriMesh( const ISurfTriMesh* pStm, double dStep)
|
||||
@@ -627,11 +736,51 @@ RegularizeTriMesh( const ISurfTriMesh* pStm, double dStep)
|
||||
return Release( pStmNew) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
IntersectOneFeature( int nProcId, int nTrim, double dStep, IGeomDB* pGDB, ISurfTriMesh* pStm)
|
||||
{
|
||||
// recupero eventuale superficie originale
|
||||
int nProcSurfId = nProcId ;
|
||||
int nOrigId = 0 ;
|
||||
if ( pGDB->GetInfo( nProcSurfId, IKEY_ORIGID, nOrigId))
|
||||
nProcSurfId += nOrigId ;
|
||||
// se da utilizzare anche superfici ausiliarie
|
||||
if ( nTrim == 2) {
|
||||
int nAux ;
|
||||
if ( pGDB->GetInfo( nProcSurfId, IKEY_AUXID, nAux)) {
|
||||
const ISurfTriMesh* pStmProc = GetSurfTriMesh( pGDB->GetGeoObj( nProcSurfId)) ;
|
||||
const ISurfTriMesh* pAux = GetSurfTriMesh( pGDB->GetGeoObj( nProcSurfId + nAux)) ;
|
||||
if ( pStmProc != nullptr && ! pStmProc->IsEmpty() && pAux != nullptr && ! pAux->IsEmpty()) {
|
||||
PtrOwner<ISurfTriMesh> pTrim( pAux->Clone()) ;
|
||||
if ( IsNull( pTrim) || ! pTrim->DoSewing( *pStmProc))
|
||||
return false ;
|
||||
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pTrim, dStep)) ;
|
||||
const ISurfTriMesh* pStmTool = ( ! IsNull( pStmTmp) ? Get( pStmTmp) : Get( pTrim)) ;
|
||||
if ( pStmTool == nullptr || ! pStm->Intersect( *pStmTool))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// caso standard
|
||||
else {
|
||||
const ISurfTriMesh* pStmProc = GetSurfTriMesh( pGDB->GetGeoObj( nProcSurfId)) ;
|
||||
if ( ! pStmProc->IsEmpty()) {
|
||||
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pStmProc, dStep)) ;
|
||||
if ( ! IsNull( pStmTmp))
|
||||
pStmProc = Get( pStmTmp) ;
|
||||
if ( pStmProc == nullptr || ! pStm->Intersect( *pStmProc))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::CalcSolid( int nPartId, bool bRecalc)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Verifico esistenza del pezzo
|
||||
@@ -649,32 +798,34 @@ BeamMgr::CalcSolid( int nPartId, bool bRecalc)
|
||||
m_pGDB->SetMaterial( nSolLayId, Color(255, 160, 32)) ;
|
||||
}
|
||||
int nSolidId = m_pGDB->GetFirstNameInGroup( nSolLayId, SOLID_SOLID_NAME) ;
|
||||
const ISurfTriMesh* pOldStm = GetSurfTriMesh( m_pGDB->GetGeoObj( nSolidId)) ;
|
||||
if ( pOldStm == nullptr || pOldStm->GetFacetCount() == 0)
|
||||
if ( ! m_pGDB->ExistsInfo( nSolidId, IKEY_VALID))
|
||||
bRecalc = true ;
|
||||
if ( bRecalc) {
|
||||
BBox3d b3Box ;
|
||||
m_pGDB->GetLocalBBox( nBoxId, b3Box, BBF_STANDARD) ;
|
||||
Point3d ptMin ; double dDimX, dDimY, dDimz ;
|
||||
if ( ! b3Box.GetMinDim( ptMin, dDimX, dDimY, dDimz))
|
||||
const ISurfTriMesh* pOldStm = GetSurfTriMesh( m_pGDB->GetGeoObj( nSolidId)) ;
|
||||
if ( pOldStm == nullptr || pOldStm->IsEmpty())
|
||||
bRecalc = true ;
|
||||
// Se non necessario ricalcolo, esco con successo
|
||||
if ( ! bRecalc)
|
||||
return true ;
|
||||
|
||||
// Calcolo il solido senza feature
|
||||
BBox3d b3Box ;
|
||||
m_pGDB->GetLocalBBox( nBoxId, b3Box, BBF_STANDARD) ;
|
||||
Point3d ptMin ; double dDimX, dDimY, dDimZ ;
|
||||
if ( ! b3Box.GetMinDim( ptMin, dDimX, dDimY, dDimZ))
|
||||
return false ;
|
||||
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshBox( dDimX, dDimY, dDimZ, false)) ;
|
||||
if ( IsNull( pSTM))
|
||||
return false ;
|
||||
pSTM->Translate( ptMin - ORIG) ;
|
||||
if ( nSolidId != GDB_ID_NULL) {
|
||||
if ( ! m_pGDB->ReplaceGeoObj( nSolidId, Release( pSTM)))
|
||||
return false ;
|
||||
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshBox( dDimX, dDimY, dDimz, false)) ;
|
||||
if ( IsNull( pSTM))
|
||||
return false ;
|
||||
pSTM->Translate( ptMin - ORIG) ;
|
||||
if ( nSolidId != GDB_ID_NULL) {
|
||||
if ( ! m_pGDB->ReplaceGeoObj( nSolidId, Release( pSTM)))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
nSolidId = m_pGDB->AddGeoObj( GDB_ID_NULL, nSolLayId, Release( pSTM)) ;
|
||||
if ( nSolidId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGDB->SetName( nSolidId, SOLID_SOLID_NAME) ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return true ;
|
||||
nSolidId = m_pGDB->AddGeoObj( GDB_ID_NULL, nSolLayId, Release( pSTM)) ;
|
||||
if ( nSolidId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGDB->SetName( nSolidId, SOLID_SOLID_NAME) ;
|
||||
}
|
||||
BBox3d b3Solid ;
|
||||
m_pGDB->GetLocalBBox( nSolidId, b3Solid, BBF_STANDARD) ;
|
||||
@@ -693,17 +844,21 @@ BeamMgr::CalcSolid( int nPartId, bool bRecalc)
|
||||
int nDO = 1 ;
|
||||
m_pGDB->GetInfo( nOutId, IKEY_DO, nDO) ;
|
||||
if ( nDO != 0 && m_pGDB->GetGeoType( nOutId) == SRF_TRIMESH) {
|
||||
// sempre standard
|
||||
const ISurfTriMesh* pStmOut = GetSurfTriMesh( m_pGDB->GetGeoObj( nOutId)) ;
|
||||
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pStmOut, dStep)) ;
|
||||
if ( ! IsNull( pStmTmp))
|
||||
pStmOut = Get( pStmTmp) ;
|
||||
if ( pStmOut == nullptr || ! pStm->Intersect( *pStmOut))
|
||||
return false ;
|
||||
if ( ! pStmOut->IsEmpty()) {
|
||||
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pStmOut, dStep)) ;
|
||||
if ( ! IsNull( pStmTmp))
|
||||
pStmOut = Get( pStmTmp) ;
|
||||
if ( pStmOut == nullptr || ! pStm->Intersect( *pStmOut))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
nOutId = m_pGDB->GetNext( nOutId) ;
|
||||
}
|
||||
// ciclo sulle features
|
||||
// ciclo su feature troncanti (taglio di testa,..)
|
||||
int nProcLayId = m_pGDB->GetFirstNameInGroup( nPartId, PROCESSINGS_LAYER_NAME) ;
|
||||
INTVECTOR vUsedFea ;
|
||||
int nProcId = m_pGDB->GetFirstInGroup( nProcLayId) ;
|
||||
while ( nProcId != GDB_ID_NULL) {
|
||||
int nDO = 1 ;
|
||||
@@ -711,41 +866,36 @@ BeamMgr::CalcSolid( int nPartId, bool bRecalc)
|
||||
m_pGDB->GetInfo( nProcId, IKEY_DO, nDO) ;
|
||||
m_pGDB->GetInfo( nProcId, IKEY_TRIM, nTrim) ;
|
||||
if ( nDO != 0 && nTrim != 0 && m_pGDB->GetGeoType( nProcId) == SRF_TRIMESH) {
|
||||
// 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))
|
||||
int nGroup = 0 ;
|
||||
int nProc = 0 ;
|
||||
m_pGDB->GetInfo( nProcId, IKEY_GROUP, nGroup) ;
|
||||
m_pGDB->GetInfo( nProcId, IKEY_PROC, nProc) ;
|
||||
if ( IS_CUT( nGroup, nProc) || IS_DOUBLE_CUT( nGroup, nProc) ||
|
||||
IS_TENON( nGroup, nProc) || IS_DOVETAIL_TENON( nGroup, nProc)) {
|
||||
if ( ! IntersectOneFeature( nProcId, nTrim, dStep, m_pGDB, pStm))
|
||||
return false ;
|
||||
vUsedFea.push_back( nProcId) ;
|
||||
}
|
||||
}
|
||||
nProcId = m_pGDB->GetNext( nProcId) ;
|
||||
}
|
||||
// ciclo sulle altre features
|
||||
nProcId = m_pGDB->GetFirstInGroup( nProcLayId) ;
|
||||
while ( nProcId != GDB_ID_NULL) {
|
||||
int nDO = 1 ;
|
||||
int nTrim = 1 ;
|
||||
m_pGDB->GetInfo( nProcId, IKEY_DO, nDO) ;
|
||||
m_pGDB->GetInfo( nProcId, IKEY_TRIM, nTrim) ;
|
||||
if ( find( vUsedFea.begin(), vUsedFea.end(), nProcId) == vUsedFea.end() &&
|
||||
nDO != 0 && nTrim != 0 && m_pGDB->GetGeoType( nProcId) == SRF_TRIMESH) {
|
||||
if ( ! IntersectOneFeature( nProcId, nTrim, dStep, m_pGDB, pStm))
|
||||
return false ;
|
||||
}
|
||||
nProcId = m_pGDB->GetNext( nProcId) ;
|
||||
}
|
||||
// imposto visualizzazione spigoli
|
||||
pStm->SetShowEdges( true) ;
|
||||
// dichiaro calcolato il solido
|
||||
m_pGDB->SetInfo( nSolidId, IKEY_VALID, 1) ;
|
||||
|
||||
return true ;
|
||||
@@ -755,7 +905,7 @@ BeamMgr::CalcSolid( int nPartId, bool bRecalc)
|
||||
int
|
||||
BeamMgr::GetSolid( int nPartId) const
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Recupero layer del solido e Id del solido
|
||||
@@ -768,7 +918,7 @@ BeamMgr::GetSolid( int nPartId) const
|
||||
bool
|
||||
BeamMgr::ShowSolid( int nPartId, bool bShow)
|
||||
{
|
||||
// Verifico validità GDB
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
// Verifico esistenza del pezzo
|
||||
@@ -790,30 +940,54 @@ BeamMgr::ShowSolid( int nPartId, bool bShow)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::GetBuildingIsOn( void) const
|
||||
BeamMgr::GetBuildingIsOn( int nAssGrpId) const
|
||||
{
|
||||
// verifico esistenza gruppo di assemblaggio
|
||||
int nAssGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME) ;
|
||||
if ( nAssGrpId == GDB_ID_NULL)
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
|
||||
// se gruppo di assemblaggio indicato lo verifico
|
||||
if ( nAssGrpId != GDB_ID_NULL) {
|
||||
string sAssName ;
|
||||
if ( ! m_pGDB->GetName( nAssGrpId, sAssName) || sAssName != ASSEMBLY_GROUP_NAME)
|
||||
return false ;
|
||||
}
|
||||
// altrimenti cerco il primo gruppo di assemblaggio
|
||||
else {
|
||||
nAssGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME) ;
|
||||
if ( nAssGrpId == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// recupero il primo oggetto nel gruppo
|
||||
int nAssId = m_pGDB->GetFirstInGroup( nAssGrpId) ;
|
||||
if ( nAssId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// se contiene oggetti, assemblaggio è On
|
||||
// se contiene oggetti, assemblaggio è On
|
||||
return ( m_pGDB->GetGroupObjs( nAssId) > 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BeamMgr::ShowBuilding( bool bShow)
|
||||
BeamMgr::ShowBuilding( int nAssGrpId, bool bShow)
|
||||
{
|
||||
// verifico esistenza gruppo di assemblaggio
|
||||
int nAssGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME) ;
|
||||
if ( nAssGrpId == GDB_ID_NULL)
|
||||
// Verifico validità GDB
|
||||
if ( m_pGDB == nullptr)
|
||||
return false ;
|
||||
|
||||
// se gruppo di assemblaggio indicato lo verifico
|
||||
if ( nAssGrpId != GDB_ID_NULL) {
|
||||
string sAssName ;
|
||||
if ( ! m_pGDB->GetName( nAssGrpId, sAssName) || sAssName != ASSEMBLY_GROUP_NAME)
|
||||
return false ;
|
||||
}
|
||||
// altrimenti cerco il primo gruppo di assemblaggio
|
||||
else {
|
||||
nAssGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME) ;
|
||||
if ( nAssGrpId == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// ciclo sul gruppo di assemblaggio
|
||||
int nAssId = m_pGDB->GetFirstInGroup( nAssGrpId) ;
|
||||
while ( nAssId != GDB_ID_NULL) {
|
||||
@@ -826,7 +1000,7 @@ BeamMgr::ShowBuilding( bool bShow)
|
||||
if ( m_pGDB->GetInfo( nAssId, GDB_SI_SOURCE, nSouId)) {
|
||||
m_pGDB->SetMode( nSouId, GDB_MD_STD) ;
|
||||
m_pGDB->SetStatus( nSouId, GDB_ST_ON) ;
|
||||
// se già utilizzato, ne faccio una copia
|
||||
// se già utilizzato, ne faccio una copia
|
||||
if ( m_pGDB->GetParentId( nSouId) != GDB_ID_ROOT) {
|
||||
int nCopyId = m_pGDB->Copy( nSouId, GDB_ID_NULL, GDB_ID_ROOT) ;
|
||||
if ( nCopyId != GDB_ID_NULL) {
|
||||
@@ -837,7 +1011,7 @@ BeamMgr::ShowBuilding( bool bShow)
|
||||
m_pGDB->SetInfo( nAssId, GDB_SI_SOURCE, nSouId) ;
|
||||
}
|
||||
}
|
||||
m_pGDB->SetStatus( m_pGDB->GetFirstNameInGroup( nSouId, BOX_LAYER_NAME), GDB_ST_OFF) ;
|
||||
m_pGDB->SetMode( m_pGDB->GetFirstNameInGroup( nSouId, BOX_LAYER_NAME), GDB_MD_HIDDEN) ;
|
||||
m_pGDB->GroupSwap( nSouId, nAssId, true, true) ;
|
||||
}
|
||||
}
|
||||
@@ -852,12 +1026,23 @@ BeamMgr::ShowBuilding( bool bShow)
|
||||
m_pGDB->SetInfo( nBaseId, GDB_SI_SOURCE, nCopyId) ;
|
||||
}
|
||||
else {
|
||||
m_pGDB->SetStatus( m_pGDB->GetFirstNameInGroup( nAssId, BOX_LAYER_NAME), GDB_ST_ON) ;
|
||||
m_pGDB->SetMode( m_pGDB->GetFirstNameInGroup( nAssId, BOX_LAYER_NAME), GDB_MD_STD) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// passo al successivo
|
||||
nAssId = nNextId ;
|
||||
}
|
||||
|
||||
// Nascondo o visualizzo tutti i pezzi sotto la radice
|
||||
int nPartId = m_pGDB->GetFirstInGroup( GDB_ID_ROOT) ;
|
||||
while ( nPartId != GDB_ID_NULL) {
|
||||
int nLevel ;
|
||||
if ( m_pGDB->GetLevel( nPartId, nLevel) && nLevel == GDB_LV_USER &&
|
||||
m_pGDB->GetFirstNameInGroup( nPartId, BOX_LAYER_NAME) != GDB_ID_NULL)
|
||||
m_pGDB->SetStatus( nPartId, ( bShow ? GDB_ST_OFF : GDB_ST_ON)) ;
|
||||
nPartId = m_pGDB->GetNext( nPartId) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -41,11 +41,13 @@ class BeamMgr : public IBeamMgr
|
||||
int nCrvId, int nCrv2Id, bool bUpdate = true) override ;
|
||||
bool EraseProcess( int nGeomId, bool bUpdate = true) override ;
|
||||
bool EnableProcess( int nGeomId, bool bEnable, bool bUpdate = true) override ;
|
||||
bool CalcAllSolids( bool bShow, bool bRecalc, pcfProcEvents pFun = nullptr) override ;
|
||||
bool ShowAllSolids( bool bShow, pcfProcEvents pFun = nullptr) override ;
|
||||
bool CalcSolid( int nPartId, bool bRecalc = false) override ;
|
||||
int GetSolid( int nPartId) const override ;
|
||||
bool ShowSolid( int nPartId, bool bShow) override ;
|
||||
bool GetBuildingIsOn( void) const override ;
|
||||
bool ShowBuilding( bool bShow) override ;
|
||||
bool GetBuildingIsOn( int nAssGrpId) const override ;
|
||||
bool ShowBuilding( int nAssGrpId, bool bShow) override ;
|
||||
|
||||
public :
|
||||
BeamMgr( void) ;
|
||||
|
||||
+104
-7
@@ -22,6 +22,7 @@
|
||||
#include "/EgtDev/Include/EGkStmStandard.h"
|
||||
#include "/EgtDev/Include/EGkStmFromCurves.h"
|
||||
#include "/EgtDev/Include/EGkExtText.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include <unordered_map>
|
||||
@@ -30,6 +31,8 @@ using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
string BtlGeom::m_sBtlAuxDir ;
|
||||
string BtlGeom::m_sBtlLuaLibsDir ;
|
||||
string BtlGeom::m_sBtlLuaLastRequire ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BtlGeom::BtlGeom( void)
|
||||
@@ -39,7 +42,9 @@ BtlGeom::BtlGeom( void)
|
||||
m_bSpecialTrim = false ;
|
||||
m_bTrimWithOutline = false ;
|
||||
m_bUseUAttr = false ;
|
||||
m_bPartOffset = false ;
|
||||
m_BoxCol = Color( 255, 128, 0, 15) ;
|
||||
m_OffsCol = Color( 255, 0, 0, 15) ;
|
||||
m_OutsCol = Color( 224, 128, 0, 50) ;
|
||||
m_ProcsCol = Color( 80, 160, 160, 100) ;
|
||||
m_ProcsOffCol = Color( 160, 160, 160, 30) ;
|
||||
@@ -58,11 +63,24 @@ BtlGeom::BtlGeom( void)
|
||||
m_nSolidsId = GDB_ID_NULL ;
|
||||
m_vtDim = V_NULL ;
|
||||
m_nCount = 0 ;
|
||||
m_nProcId = GDB_ID_NULL ;
|
||||
m_nBtlLine = 0 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BtlGeom::~BtlGeom( void)
|
||||
{
|
||||
// chiudo lua ( se era aperto)
|
||||
if ( m_LuaMgr.Exit()) {
|
||||
string sLua = "Lua BtlGeom interpreter closed" ;
|
||||
LOG_INFO( GetEExLogger(), sLua.data())
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim, bool bTrimWithOutline, bool bUseUAttr)
|
||||
BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim,
|
||||
bool bTrimWithOutline, bool bUseUAttr, bool bPartOffset, bool bIsAdding)
|
||||
{
|
||||
// salvo puntatore a DB geometrico
|
||||
m_pGDB = pGDB ;
|
||||
@@ -73,17 +91,35 @@ BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim, bool bTrimWit
|
||||
m_bSpecialTrim = bSpecialTrim ;
|
||||
m_bTrimWithOutline = bTrimWithOutline ;
|
||||
m_bUseUAttr = bUseUAttr ;
|
||||
// se non esiste, creo gruppo per informazioni varie
|
||||
m_nInfoId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, INFO_GROUP_NAME) ;
|
||||
if ( m_nInfoId == GDB_ID_NULL && ! CreateInfoGroup())
|
||||
m_bPartOffset = bPartOffset ;
|
||||
// gruppo per informazioni varie, se in aggiunta lo creo sempre
|
||||
m_nInfoId = ( bIsAdding ? GDB_ID_NULL : m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, INFO_GROUP_NAME)) ;
|
||||
if ( bIsAdding && ! CreateInfoGroup())
|
||||
return false ;
|
||||
// se non esiste, creo gruppo per assemblaggio
|
||||
m_nAsseId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME) ;
|
||||
if ( m_nAsseId == GDB_ID_NULL && ! CreateAssemblyGroup())
|
||||
// gruppo per assemblaggio, se in aggiunta lo creo sempre
|
||||
m_nAsseId = ( bIsAdding ? GDB_ID_NULL : m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME)) ;
|
||||
if ( bIsAdding && ! CreateAssemblyGroup())
|
||||
return false ;
|
||||
// recupero eventuali riferimenti a gruppi per grezzi e compositi
|
||||
m_nRawPartsId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, RAWPARTS_GROUP_NAME) ;
|
||||
m_nCompositesId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, COMPOSITES_GROUP_NAME) ;
|
||||
// inizializzo interprete lua
|
||||
if ( ! m_LuaMgr.Init())
|
||||
return false ;
|
||||
// carico le funzioni speciali
|
||||
if ( ! LuaInstallEgtFunctions( m_LuaMgr))
|
||||
return false ;
|
||||
// recupero la versione di Lua
|
||||
string sLua ;
|
||||
if ( m_LuaMgr.GetVersion( sLua))
|
||||
sLua += " BtlGeom interpreter started" ;
|
||||
else
|
||||
sLua = "Lua *.* BtlGeom interpreter started" ;
|
||||
LOG_INFO( GetEExLogger(), sLua.data())
|
||||
// imposto il direttorio delle librerie
|
||||
m_LuaMgr.SetLuaLibsDir( m_sBtlLuaLibsDir) ;
|
||||
// carico la libreria standard
|
||||
m_LuaMgr.Require( m_sBtlLuaLastRequire) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -595,6 +631,67 @@ BtlGeom::AddObjectRef( const string& sUID, const Frame3d& frRef)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::AddPartOffset( const DBLVECTOR& vdPar)
|
||||
{
|
||||
// se non c'è il DB geometrico o il pezzo corrente, errore
|
||||
if ( m_pGDB == nullptr || m_nPartId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// recupero le dimensioni del pezzo corrente
|
||||
if ( m_vtDim.IsSmall())
|
||||
return false ;
|
||||
// se non abilitato, esco
|
||||
if ( ! m_bPartOffset)
|
||||
return true ;
|
||||
// aggiusto i solidi di rappresentazione dell'offset
|
||||
for ( int i = 1 ; i <= 4 ; ++ i) {
|
||||
string sOffsName = BOX_OFFSX_NAME + ToString( i) ;
|
||||
int nOffsId = m_pGDB->GetFirstNameInGroup( m_nBoxId, sOffsName) ;
|
||||
// se valore offset significativo, modifico o aggiungo nuovo solido
|
||||
if ( vdPar[i] > EPS_SMALL) {
|
||||
double dDimX = m_vtDim.x ;
|
||||
double dDimY = (( i == 1 || i == 3) ? vdPar[i] : m_vtDim.y) ;
|
||||
double dDimZ = (( i == 1 || i == 3) ? m_vtDim.z : vdPar[i]) ;
|
||||
// creo il solido (parallelepipedo)
|
||||
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshBox( dDimX, dDimY, dDimZ)) ;
|
||||
if ( IsNull( pStm))
|
||||
return false ;
|
||||
// lo traslo opportunamente
|
||||
Vector3d vtMove ;
|
||||
if ( i == 1)
|
||||
vtMove = Vector3d( 0, -vdPar[i], 0) ;
|
||||
else if ( i == 2)
|
||||
vtMove = Vector3d( 0, 0, -vdPar[i]) ;
|
||||
else if ( i == 3)
|
||||
vtMove = Vector3d( 0, m_vtDim.y, 0) ;
|
||||
else
|
||||
vtMove = Vector3d( 0, 0, m_vtDim.z) ;
|
||||
pStm->Translate( vtMove) ;
|
||||
// se gia presente, lo rimpiazzo
|
||||
if ( nOffsId != GDB_ID_NULL) {
|
||||
if ( ! m_pGDB->ReplaceGeoObj( nOffsId, Release( pStm)))
|
||||
return false ;
|
||||
}
|
||||
// altrimenti, lo inserisco nel layer box del pezzo
|
||||
else {
|
||||
nOffsId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nBoxId, Release( pStm)) ;
|
||||
if ( nOffsId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// assegno nome
|
||||
m_pGDB->SetName( nOffsId, sOffsName) ;
|
||||
}
|
||||
// assegno il colore
|
||||
m_pGDB->SetMaterial( nOffsId, m_OffsCol) ;
|
||||
}
|
||||
// elimino eventuale vecchio solido
|
||||
else {
|
||||
m_pGDB->Erase( nOffsId) ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::ResetPartSolid( void)
|
||||
|
||||
@@ -18,15 +18,16 @@
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkPolygon3d.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGnLuaMgr.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class BtlGeom
|
||||
{
|
||||
public :
|
||||
BtlGeom( void) ;
|
||||
|
||||
public :
|
||||
bool Init( IGeomDB* pGDB, int nFlatPos, bool bSpecialTrim, bool bTrimWithOutline, bool bUseUAttr) ;
|
||||
~BtlGeom( void) ;
|
||||
bool Init( IGeomDB* pGDB, int nFlatPos, bool bSpecialTrim,
|
||||
bool bTrimWithOutline, bool bUseUAttr, bool bPartOffset, bool bIsAdding) ;
|
||||
bool CreatePart( void) ;
|
||||
bool SetPart( int nPartId) ;
|
||||
bool ErasePart( void) ;
|
||||
@@ -49,6 +50,7 @@ class BtlGeom
|
||||
{ return ( m_nPartId != GDB_ID_NULL ? m_vtDim.z : 0) ;}
|
||||
bool AddPartTransformation( const std::string& sUID, const Frame3d& frRef) ;
|
||||
bool AddObjectRef( const std::string& sUID, const Frame3d& frRef) ;
|
||||
bool AddPartOffset( const DBLVECTOR& vdPar) ;
|
||||
bool AdjustPartFlatOrVertPos( void) ;
|
||||
bool ResetPartSolid( void) ;
|
||||
std::string GetPartName( void) ;
|
||||
@@ -210,6 +212,8 @@ class BtlGeom
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddRoundArch( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddSphere( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddTriangleCut( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddTyroleanDovetail( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
@@ -220,6 +224,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) ;
|
||||
bool AddVariantLua( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt, const std::string& sLuaPath) ;
|
||||
bool AddVariantNge( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt, const std::string& sNgePath) ;
|
||||
ICurveComposite* GetFreeContourCurve( int nProcId, const Frame3d& frRef, bool bOnlyStartOk = false) ;
|
||||
ISurfTriMesh* CreateOneCurveFreeContour( const ICurveComposite* pCrvCompo) ;
|
||||
bool AdjustFreeContourCurve( ICurve* pCrv, int nSide, bool& bClosed, bool& bEndsOnOrOutCont) ;
|
||||
@@ -227,7 +235,7 @@ class BtlGeom
|
||||
bool GetFreeContourCurveSideAngles( const ICurveComposite* pCrvCompo, DBLVECTOR& vSideAng) ;
|
||||
bool CreatePolygonInBox( const Point3d& ptP, const Vector3d& vtN, int nSide, Polygon3d& Polyg,
|
||||
double dMatMin = FACE_MIN_BACK_MAT, double dAreaMin = FACE_MIN_BACK_AREA) ;
|
||||
double GetPlaneElevation( const Plane3d& plPlane) ;
|
||||
double GetDistanceBeamPlane( const Plane3d& plPlane) ;
|
||||
bool TrimPolygons( Polygon3d& plyP1, Polygon3d& plyP2, bool bInVsOut, bool bOnEq) ;
|
||||
bool VerifyPolygonSize( Polygon3d& plyP, double dMinDim = FACE_MIN_CROSS_DIM) ;
|
||||
bool VerifyPolygonBackMat( Polygon3d& plyP, double dMatMin = FACE_MIN_BACK_MAT, double dAreaMin = FACE_MIN_BACK_AREA) ;
|
||||
@@ -262,11 +270,14 @@ class BtlGeom
|
||||
|
||||
private :
|
||||
IGeomDB* m_pGDB ;
|
||||
LuaMgr m_LuaMgr ; // interprete per Variant parametrici
|
||||
int m_nFlatVertPos ; // flag per posizionamento pezzi (0=come sono, 1=di piatto, 2=in verticale, 3=ruotato 90deg, 4=da outline o piatto)
|
||||
bool m_bSpecialTrim ; // flag per trim speciale regioni per pareti (solo con feature passanti)
|
||||
bool m_bTrimWithOutline ; // flag per trim delle feature con l'outline (se presente)
|
||||
bool m_bUseUAttr ; // flag per utilizzo attributi utente per modificare geometria features
|
||||
bool m_bPartOffset ; // flag per gestione geometrica di PARTOFFSET
|
||||
Color m_BoxCol ; // colore per box pezzi
|
||||
Color m_OffsCol ; // colore per offset pezzi
|
||||
Color m_OutsCol ; // colore per outline pezzi
|
||||
Color m_ProcsCol ; // colore per lavorazioni pezzi
|
||||
Color m_ProcsOffCol ; // colore per lavorazioni pezzi disabilitate
|
||||
@@ -291,5 +302,7 @@ class BtlGeom
|
||||
FCEDEQUE m_FcData ; // dati per contorni liberi in definizione
|
||||
|
||||
public :
|
||||
static std::string m_sBtlAuxDir ; // direttorio in cui cercare i dati per le feature Variant
|
||||
static std::string m_sBtlAuxDir ; // direttorio in cui cercare i dati per le feature Variant
|
||||
static std::string m_sBtlLuaLibsDir ; // direttorio librerie lua per Variant
|
||||
static std::string m_sBtlLuaLastRequire ; // ultimo require lua per Variant
|
||||
} ;
|
||||
|
||||
+59
-1
@@ -17,6 +17,56 @@
|
||||
#include "/EgtDev/Include/EgtStringBase.h"
|
||||
#include <deque>
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Riconoscimento feature
|
||||
#define IS_CUT( nG, nP) ( ( nG == 1 || nG == 2) && nP == 10)
|
||||
#define IS_LONGIT_CUT( nG, nP) ( ( nG == 0 || nG == 3 || nG == 4) && nP == 10)
|
||||
#define IS_DOUBLE_CUT( nG, nP) ( ( nG == 1 || nG == 2) && nP == 11)
|
||||
#define IS_RIDGEVALLEY_CUT( nG, nP) ( ( nG == 0) && nP == 12)
|
||||
#define IS_SAW_CUT( nG, nP) ( ( nG == 0 || nG == 3 || nG == 4) && nP == 13)
|
||||
#define IS_SLOT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 16)
|
||||
#define IS_FRONT_SLOT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 17)
|
||||
#define IS_BIRDS_MOUTH( nG, nP) ( ( nG == 3 || nG == 4) && nP == 20)
|
||||
#define IS_RAFTER_NOTCH( nG, nP) ( ( nG == 3 || nG == 4) && nP == 25)
|
||||
#define IS_RIDGE_LAP( nG, nP) ( ( nG == 1 || nG == 2) && nP == 30)
|
||||
#define IS_LAP_JOINT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 30)
|
||||
#define IS_NOTCH( nG, nP) ( ( nG == 3 || nG == 4) && nP == 32)
|
||||
#define IS_LOGHOUSE_HL2( nG, nP) ( ( nG == 3 || nG == 4) && nP == 33)
|
||||
#define IS_SEATHING_CUT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 34)
|
||||
#define IS_FRENCH_RIDGELAP( nG, nP) ( ( nG == 1 || nG == 2) && nP == 35)
|
||||
#define IS_CHAMFER( nG, nP) ( ( nG == 3 || nG == 4) && nP == 36)
|
||||
#define IS_LOGHOUSE_HL4( nG, nP) ( ( nG == 4) && nP == 37)
|
||||
#define IS_LOGHOUSE_FRONT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 38)
|
||||
#define IS_POCKET( nG, nP) ( ( nG == 4) && nP == 39)
|
||||
#define IS_DRILL( nG, nP) ( ( nG == 3 || nG == 4) && nP == 40)
|
||||
#define IS_TENON( nG, nP) ( ( nG == 1 || nG == 2) && nP == 50)
|
||||
#define IS_MORTISE( nG, nP) ( ( nG == 3 || nG == 4) && nP == 50)
|
||||
#define IS_MORTISE_FRONT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 51)
|
||||
#define IS_HOUSE( nG, nP) ( ( nG == 1 || nG == 2 || nG == 3 || nG == 4) && nP == 52)
|
||||
#define IS_HOUSE_MORTISE( nG, nP) ( ( nG == 3 || nG == 4) && nP == 53)
|
||||
#define IS_DOVETAIL_TENON( nG, nP) ( ( nG == 1 || nG == 2) && nP == 55)
|
||||
#define IS_DOVETAIL_MORTISE( nG, nP) ( ( nG == 3 || nG == 4) && nP == 55)
|
||||
#define IS_DTMORTISE_FRONT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 56)
|
||||
#define IS_MARKING( nG, nP) ( ( nG == 3 || nG == 4) && nP == 60)
|
||||
#define IS_TEXT( nG, nP) ( ( nG == 4) && nP == 61)
|
||||
#define IS_SIMPLESCARF( nG, nP) ( ( nG == 1 || nG == 2) && nP == 70)
|
||||
#define IS_SCARFJOINT( nG, nP) ( ( nG == 1 || nG == 2) && nP == 71)
|
||||
#define IS_STEPJOINT( nG, nP) ( ( nG == 1 || nG == 2) && nP == 80)
|
||||
#define IS_STEPJOINTNOTCH( nG, nP) ( ( nG == 3 || nG == 4) && nP == 80)
|
||||
#define IS_PLANING( nG, nP) ( ( nG == 3 || nG == 4) && nP == 90)
|
||||
#define IS_PROF_FRONT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 100)
|
||||
#define IS_PROF_HEADCONCAVE( nG, nP) ( ( nG == 3 || nG == 4) && nP == 101)
|
||||
#define IS_PROF_HEADCONVEX( nG, nP) ( ( nG == 3 || nG == 4) && nP == 102)
|
||||
#define IS_PROF_HEADCAMBERED( nG, nP) ( ( nG == 3 || nG == 4) && nP == 103)
|
||||
#define IS_PROF_HEAD( nG, nP) ( ( nG == 3 || nG == 4) && nP == 106)
|
||||
#define IS_ROUND_ARCH( nG, nP) ( ( nG == 4) && nP == 104)
|
||||
#define IS_SPHERE( nG, nP) ( ( nG == 3 || nG == 4) && nP == 107)
|
||||
#define IS_TRIANGLE_CUT( nG, nP) ( ( nG == 4) && nP == 120)
|
||||
#define IS_TYROLEAN_DOVETAIL( nG, nP) ( ( nG == 1 || nG == 2 || nG == 3 || nG == 4) && nP == 136)
|
||||
#define IS_DOVETAIL( nG, nP) ( ( nG == 1 || nG == 2 || nG == 3 || nG == 4) && nP == 138)
|
||||
#define IS_FREE_CONTOUR( nG, nP) ( ( nG == 0 || nG == 3 || nG == 4) && (nP == 250 || nP == 251 || nP == 252))
|
||||
#define IS_VARIANT( nG, nP) ( ( nG == 0 || nG == 1 || nG == 2 || nG == 3 || nG == 4) && nP == 900)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// nome gruppo di sistema per informazioni varie
|
||||
static const std::string INFO_GROUP_NAME = "BtlInfo" ;
|
||||
@@ -38,6 +88,7 @@ static const std::string FCSNAME_LAYER_NAME = "FcsName" ;
|
||||
// nomi entità standard dei pezzi
|
||||
static const std::string AUX_PART_NAME = "Name" ;
|
||||
static const std::string BOX_BOX_NAME = "Box" ;
|
||||
static const std::string BOX_OFFSX_NAME = "Offs" ;
|
||||
static const std::string OL_OUTSTM_NAME = "Out" ;
|
||||
static const std::string OL_APERTURESTM_NAME = "Ape" ;
|
||||
static const std::string OL_TOPREGION_NAME = "Top" ;
|
||||
@@ -102,6 +153,8 @@ const double FACE_MIN_BACK_MAT = 2.0 ;
|
||||
const double FACE_MIN_BACK_AREA = 400.0 ;
|
||||
// minimo materiale dietro la faccia, limite assoluto
|
||||
const double FACE_ZERO_BACK_MAT = 0.5 ;
|
||||
// minima area di componente staccata
|
||||
const double FACE_DETACHED_MIN_AREA = 400.0 ;
|
||||
// minimo spostamento per vari tipi di Mortise
|
||||
const double MORTISE_DISPL_MIN = 0.5 ;
|
||||
// raggio fresa di default
|
||||
@@ -110,11 +163,12 @@ const double MILL_DEF_RAD = 12.5 ;
|
||||
const double DTMILL_DEF_RAD = 30.0 ;
|
||||
// angolo coda di rondine di default
|
||||
const double DOVETAIL_DEF_ANG = 15.0 ;
|
||||
// lunghezza extra per tenoni coda di rondine passanti
|
||||
const double DTTEN_EXTRA_LEN = 5.0 ;
|
||||
// lunghezza extra per mortase coda di rondine passanti
|
||||
const double DTMORT_EXTRA_LEN = 10.0 ;
|
||||
// minima e massima dimensione tasca per mortasa a coda di rondine
|
||||
const double MIN_DTMORT_POCKET = 70.0 ;
|
||||
const double MAX_DTMORT_POCKET = 200.0 ;
|
||||
const double MIN_DTMORT_AREA = 100.0 ;
|
||||
// tolleranza fuoriuscita curve di tasche di code di rondine
|
||||
const double DTMORT_OUT_CRV_TOL = 30.0 ;
|
||||
@@ -123,6 +177,10 @@ const double FC_SIDEANG_DEF = 0.0 ;
|
||||
const double FC_SIDEANG_NONE = 999.0 ;
|
||||
// tolleranza fuoriuscita curve di contorni liberi
|
||||
const double FC_OUT_CRV_TOL = 50.0 ;
|
||||
// dimensione massima di contorno libero
|
||||
const double FC_MAX_DIM = 200000.0 ;
|
||||
// distanza limite tra diagonali per quadrilatero con twist di freecontour
|
||||
const double FC_TWIST_DIAG_DIST = 2.0 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Numero processo speciale Riferimento ad altro oggetto
|
||||
|
||||
+14
-23
@@ -496,9 +496,10 @@ BtlGeom::UpdateOutLine( void)
|
||||
// taglio con tutte le features
|
||||
TrimOutlineWithProcesses() ;
|
||||
|
||||
// se presente Shape, nascondo Outline
|
||||
// se presente Shape e abilitato, nascondo Outline
|
||||
int nDO ;
|
||||
int nShapeId = m_pGDB->GetFirstNameInGroup( m_nOutsId, OL_SHAPE_NAME) ;
|
||||
if ( nShapeId != GDB_ID_NULL) {
|
||||
if ( nShapeId != GDB_ID_NULL && m_pGDB->GetInfo( nShapeId, IKEY_DO, nDO) && nDO != 0) {
|
||||
int nEntId = m_pGDB->GetFirstInGroup( m_nOutsId) ;
|
||||
while ( nEntId != GDB_ID_NULL) {
|
||||
if ( nEntId != nShapeId)
|
||||
@@ -1073,8 +1074,8 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPOVECTOR& vCrvP)
|
||||
// concateno le linee senza invertirle
|
||||
const double TOLER = 10 * EPS_SMALL ;
|
||||
ChainCurves chainC ;
|
||||
chainC.Init( false, TOLER, int( vCrvP.size())) ;
|
||||
for ( size_t i = 0 ; i < vCrvP.size() ; ++ i) {
|
||||
chainC.Init( false, TOLER, ssize( vCrvP)) ;
|
||||
for ( int i = 0 ; i < ssize( vCrvP) ; ++ i) {
|
||||
Point3d ptStart, ptEnd ;
|
||||
Vector3d vtStart, vtEnd ;
|
||||
if ( ! vCrvP[i]->GetStartPoint( ptStart) || ! vCrvP[i]->GetStartDir( vtStart) ||
|
||||
@@ -1091,7 +1092,7 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPOVECTOR& vCrvP)
|
||||
if ( IsNull( pCrvCompo))
|
||||
return false ;
|
||||
// recupero le curve semplici e le inserisco nella curva composita
|
||||
for ( size_t i = 0 ; i < vId2s.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( vId2s) ; ++ i) {
|
||||
// indice della curva
|
||||
int j = vId2s[i] - 1 ;
|
||||
// la aggiungo alla curva composta
|
||||
@@ -1385,7 +1386,6 @@ BtlGeom::TrimProcessWithOutline( int nProcId)
|
||||
bool
|
||||
BtlGeom::AddShapeBTLX( const INTMATRIX& vFacesVertices, const PNTVECTOR& vPoints)
|
||||
{
|
||||
|
||||
StmFromTriangleSoup StmFts ;
|
||||
if ( ! StmFts.Start()) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Shape: StmFts.Start error")
|
||||
@@ -1401,22 +1401,13 @@ BtlGeom::AddShapeBTLX( const INTMATRIX& vFacesVertices, const PNTVECTOR& vPoints
|
||||
// creo il contorno della faccia
|
||||
PtrOwner<ICurveComposite> pCurveCompo( CreateCurveComposite()) ;
|
||||
pCurveCompo->AddPoint( vPoints[vVertices[0]]) ;
|
||||
for ( size_t i = 1 ; i != vVertices.size() ; i++)
|
||||
pCurveCompo->AddLine( vPoints[vVertices[i]]) ;
|
||||
for ( int i = 1 ; i < ssize( vVertices) ; i++)
|
||||
pCurveCompo->AddLine( vPoints[vVertices[i]]) ;
|
||||
pCurveCompo->AddLine( vPoints[vVertices[0]]) ;
|
||||
|
||||
// creo la faccia e recupero i suoi triangoli
|
||||
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 ( ! IsNull( pSurf))
|
||||
StmFts.AddSurfTriMesh( *pSurf) ;
|
||||
}
|
||||
|
||||
if ( ! StmFts.End()) {
|
||||
@@ -1425,13 +1416,13 @@ BtlGeom::AddShapeBTLX( const INTMATRIX& vFacesVertices, const PNTVECTOR& vPoints
|
||||
}
|
||||
|
||||
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_nOutsId, Release( pShape)) ;
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGDB->SetName( nId, OL_SHAPE_NAME) ;
|
||||
m_pGDB->SetMaterial( nId, m_OutsCol) ;
|
||||
m_pGDB->SetStatus( nId, GDB_ST_ON) ;
|
||||
m_pGDB->SetStatus( nId, GDB_ST_OFF) ;
|
||||
m_pGDB->SetInfo( nId, IKEY_DO, 0) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
+727
-227
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2
-2
@@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28307.645
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.12.35521.163
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EgtExchange", "EgtExchange.vcxproj", "{80FCBEA4-1883-4542-939D-8582E66D8D51}"
|
||||
EndProject
|
||||
|
||||
+14
-7
@@ -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</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@@ -42,7 +42,7 @@
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
@@ -104,7 +104,7 @@
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -128,7 +128,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
|
||||
<PreprocessorDefinitions>WIN32;I_AM_EEX;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</ClCompile>
|
||||
@@ -163,7 +163,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -197,7 +197,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@@ -232,6 +232,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="..\Include\EExImportCnc.h" />
|
||||
<ClInclude Include="..\Include\EExImportCsf.h" />
|
||||
<ClInclude Include="..\Include\EExImportDxf.h" />
|
||||
<ClInclude Include="..\Include\EExImportOff.h" />
|
||||
<ClInclude Include="..\Include\EExImportPnt.h" />
|
||||
<ClInclude Include="..\Include\EExImportStl.h" />
|
||||
<ClInclude Include="..\Include\EGkAngle.h" />
|
||||
@@ -330,7 +331,10 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="ImportCnc.h" />
|
||||
<ClInclude Include="ImportCsf.h" />
|
||||
<ClInclude Include="ImportDxf.h" />
|
||||
<ClInclude Include="ImportOff.h" />
|
||||
<ClInclude Include="ImportPly.h" />
|
||||
<ClInclude Include="ImportStl.h" />
|
||||
<ClInclude Include="miniply.h" />
|
||||
<ClInclude Include="pugiconfig.hpp" />
|
||||
<ClInclude Include="pugixml.hpp" />
|
||||
<ClInclude Include="resource.h" />
|
||||
@@ -372,8 +376,11 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="ImportDxfEnts.cpp" />
|
||||
<ClCompile Include="ImportDxfHeader.cpp" />
|
||||
<ClCompile Include="ImportDxfTabs.cpp" />
|
||||
<ClCompile Include="ImportOff.cpp" />
|
||||
<ClCompile Include="ImportPly.cpp" />
|
||||
<ClCompile Include="ImportPnt.cpp" />
|
||||
<ClCompile Include="ImportStl.cpp" />
|
||||
<ClCompile Include="miniply.cpp" />
|
||||
<ClCompile Include="pugixml.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
|
||||
@@ -375,6 +375,18 @@
|
||||
<ClInclude Include="..\Include\SELkKeyProc.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ImportOff.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EExImportOff.h">
|
||||
<Filter>File di intestazione\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ImportPly.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="miniply.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
@@ -455,6 +467,15 @@
|
||||
<ClCompile Include="ExportThreeJS.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ImportOff.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ImportPly.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="miniply.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtExchange.rc">
|
||||
|
||||
+86
-90
@@ -17,15 +17,9 @@
|
||||
#include "Export3MF.h"
|
||||
#include "DllMain.h"
|
||||
#include "/EgtDev/Include/EExDllMain.h"
|
||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
using namespace Lib3MF ;
|
||||
@@ -71,13 +65,13 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
||||
|
||||
// libreria 3MF
|
||||
m_wrapper = CWrapper::loadLibrary() ;
|
||||
if ( ! m_wrapper) {
|
||||
if ( m_wrapper == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), "Export3MF : Error on lib3mf Wrapper")
|
||||
return false ;
|
||||
}
|
||||
// creo model per 3MF
|
||||
m_model = m_wrapper->CreateModel() ;
|
||||
if ( ! m_model) {
|
||||
if ( m_model == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), "Export3MF : Error on lib3mf Model")
|
||||
return false ;
|
||||
}
|
||||
@@ -92,20 +86,10 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
||||
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") ;
|
||||
@@ -123,7 +107,7 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::ExportObject( const IGdbIterator& iIter)
|
||||
Export3MF::ExportObject( const IGdbIterator& iIter, PComponentsObject pParent, bool bSaveGrpAsComponent)
|
||||
{
|
||||
// recupero il livello dell'oggetto
|
||||
int nLev = GDB_LV_USER ;
|
||||
@@ -137,48 +121,43 @@ Export3MF::ExportObject( const IGdbIterator& iIter)
|
||||
int nType = iIter.GetGdbType() ;
|
||||
// se il filtro lo abilita
|
||||
if ( TestFilter( nLev, nMode, nStat, nType == GDB_TY_GROUP)) {
|
||||
switch ( iIter.GetGdbType()) {
|
||||
// se è un oggetto geometrico diverso da una superficie esco
|
||||
int nGeoType = iIter.GetGeoType() ;
|
||||
if ( nGeoType != GEO_NONE && nGeoType != SRF_TRIMESH && nGeoType != SRF_FLATRGN)
|
||||
return true ;
|
||||
// recupero nome
|
||||
string sName ;
|
||||
iIter.GetName( sName) ;
|
||||
// recupero info
|
||||
STRVECTOR vsInfo ;
|
||||
iIter.GetAllInfo( vsInfo) ;
|
||||
// esporto
|
||||
switch ( nType) {
|
||||
case GDB_TY_GEO :
|
||||
{
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return true ;
|
||||
// se non è una superficie esco
|
||||
if ( pGeoObj->GetType() != SRF_TRIMESH && pGeoObj->GetType() != SRF_FLATRGN)
|
||||
return true ;
|
||||
return false ;
|
||||
// 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()) ;
|
||||
return false ;
|
||||
// recupero il colore
|
||||
Color cCol ;
|
||||
bool bCol = GetColor( cCol, iIter.GetGDB(), iIter.GetId()) ;
|
||||
// recupero le proprietà
|
||||
STRVECTOR vInfo ;
|
||||
iIter.GetAllInfo( vInfo) ;
|
||||
iIter.GetCalcMaterial( cCol) ;
|
||||
// emetto l'oggetto
|
||||
switch ( pGeoObj->GetType()) {
|
||||
switch ( nGeoType) {
|
||||
case SRF_TRIMESH :
|
||||
if ( ! ExportSTM( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr, vInfo))
|
||||
return false ;
|
||||
break ;
|
||||
return ExportSTM( pGeoObj, frFrame, sName, vsInfo, cCol, pParent) ;
|
||||
case SRF_FLATRGN :
|
||||
if ( ! ExportSFR( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr, vInfo))
|
||||
return false ;
|
||||
break ;
|
||||
return ExportSFR( pGeoObj, frFrame, sName, vsInfo, cCol, pParent) ;
|
||||
default :
|
||||
break ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
case GDB_TY_GROUP :
|
||||
// esploro il gruppo
|
||||
return ScanGroup( iIter) ;
|
||||
case GDB_TY_GROUP :
|
||||
return ExportGroup( iIter, sName, vsInfo, pParent, bSaveGrpAsComponent) ;
|
||||
default :
|
||||
return false ;
|
||||
}
|
||||
@@ -188,7 +167,7 @@ Export3MF::ExportObject( const IGdbIterator& iIter)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::TestFilter( int nLev, int nMode, int nStat, bool bGroup)
|
||||
Export3MF::TestFilter( int nLev, int nMode, int nStat, bool bGroup) const
|
||||
{
|
||||
int nFilter = bGroup ? m_nGroupFilter : m_nFilter ;
|
||||
if ( ( nLev == GDB_LV_USER && ( nFilter & EEXFLT_LEVUSER) == 0) ||
|
||||
@@ -239,7 +218,8 @@ Export3MF::CalcGroupFilter( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, const STRVECTOR& vInfo)
|
||||
Export3MF::ExportSFR( const IGeoObj* pGeoObj, const Frame3d& frFrame, const string& sName, const STRVECTOR& vInfo,
|
||||
const Color& cCol, PComponentsObject pParent)
|
||||
{
|
||||
// verifico oggetto
|
||||
const ISurfFlatRegion* pSFR = GetSurfFlatRegion( pGeoObj) ;
|
||||
@@ -247,12 +227,13 @@ Export3MF::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d
|
||||
return false ;
|
||||
// ricavo la trimesh equivalente
|
||||
const ISurfTriMesh* pStm = pSFR->GetAuxSurf() ;
|
||||
return ExportSTM( sName, pStm, frFrame, pCol, vInfo) ;
|
||||
return ExportSTM( pStm, frFrame, sName, vInfo, cCol, pParent) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::ExportSTM( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, const STRVECTOR& vInfo)
|
||||
Export3MF::ExportSTM( const IGeoObj* pGeoObj, const Frame3d& frFrame, const string& sName, const STRVECTOR& vInfo,
|
||||
const Color& cCol, PComponentsObject pParent)
|
||||
{
|
||||
// verifico oggetto
|
||||
const ISurfTriMesh* pSTM = GetSurfTriMesh( pGeoObj) ;
|
||||
@@ -286,25 +267,21 @@ Export3MF::ExportSTM( const string& sName, const IGeoObj* pGeoObj, const Frame3d
|
||||
}
|
||||
|
||||
if ( vVertices.size() == 0 || vTriangles.size() == 0) {
|
||||
LOG_ERROR( GetEExLogger(), ( "Export3MF : surface \"" + sName + "\" is empty. Ignored.").c_str()) ;
|
||||
LOG_ERROR( GetEExLogger(), "Export3MF : empty surface ignored") ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
// creo mesh 3MF
|
||||
PMeshObject meshObject = m_model->AddMeshObject() ;
|
||||
if ( ! meshObject) {
|
||||
if ( meshObject == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), "Export3MF : Error on lib3mf Mesh Object")
|
||||
return false ;
|
||||
}
|
||||
meshObject->SetName( sName) ;
|
||||
meshObject->SetGeometry( vVertices, vTriangles) ;
|
||||
|
||||
// assegno il colore
|
||||
if ( pCol != nullptr) {
|
||||
Lib3MF_uint32 nColId = ColorHandler3MF( pCol) ;
|
||||
meshObject->SetObjectLevelProperty( 1, nColId) ;
|
||||
}
|
||||
|
||||
// assegno il nome
|
||||
if ( ! sName.empty())
|
||||
meshObject->SetName( sName) ;
|
||||
// assegno le info
|
||||
PMetaDataGroup metaDataGrp = meshObject->GetMetaDataGroup() ;
|
||||
for ( const string& sInfo : vInfo) {
|
||||
@@ -312,60 +289,79 @@ Export3MF::ExportSTM( const string& sName, const IGeoObj* pGeoObj, const Frame3d
|
||||
SplitFirst( sInfo, "=", sKey, sVal) ;
|
||||
metaDataGrp->AddMetaData( sInfoNamespace, sKey, sVal, "xs:string", 0) ;
|
||||
}
|
||||
// assegno il colore
|
||||
Lib3MF_uint32 nColId = ColorHandler3MF( cCol) ;
|
||||
meshObject->SetObjectLevelProperty( 1, nColId) ;
|
||||
|
||||
// aggiungo al modello
|
||||
if ( pParent == nullptr)
|
||||
m_model->AddBuildItem( meshObject.get(), m_wrapper->GetIdentityTransform()) ;
|
||||
else
|
||||
pParent->AddComponent( meshObject.get(), m_wrapper->GetIdentityTransform()) ;
|
||||
|
||||
m_model->AddBuildItem( meshObject.get(), m_wrapper->GetIdentityTransform()) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::ScanGroup( const IGdbIterator& iIter)
|
||||
Export3MF::ExportGroup( const IGdbIterator& iIter, const string& sName, const STRVECTOR& vsInfo, PComponentsObject pParent,
|
||||
bool bSaveAsComponent)
|
||||
{
|
||||
// creo un iteratore
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( iIter.GetGDB())) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
// scandisco il gruppo
|
||||
bool bOk = true ;
|
||||
for ( bool bNext = pIter->GoToFirstInGroup( iIter) ;
|
||||
bNext ;
|
||||
bNext = pIter->GoToNext()) {
|
||||
if ( ! ExportObject( *pIter))
|
||||
bOk = false ;
|
||||
PComponentsObject pComponent = pParent ;
|
||||
// se il layer va salvato come componente, la creo
|
||||
if ( bSaveAsComponent) {
|
||||
pComponent = m_model->AddComponentsObject() ;
|
||||
if ( ! sName.empty())
|
||||
pComponent->SetName( sName) ;
|
||||
}
|
||||
|
||||
// salvo le info sulla componente ( se il gruppo viene esportato come tale) o sul modello
|
||||
PMetaDataGroup metaDataGrp ;
|
||||
if ( bSaveAsComponent)
|
||||
metaDataGrp = pComponent->GetMetaDataGroup() ;
|
||||
else
|
||||
metaDataGrp = m_model->GetMetaDataGroup() ;
|
||||
for ( const string& sInfo : vsInfo) {
|
||||
string sKey, sVal ;
|
||||
SplitFirst( sInfo, "=", sKey, sVal) ;
|
||||
metaDataGrp->AddMetaData( sInfoNamespace, sKey, sVal, "xs:string", 0) ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
// scandisco il gruppo per inserire i suoi oggetti
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( iIter.GetGDB())) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
for ( bool bNext = pIter->GoToFirstInGroup( iIter) ; bNext ; bNext = pIter->GoToNext()) {
|
||||
if ( ! ExportObject( *pIter, pComponent, true))
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Export3MF::GetColor( Color& pCol, const IGeomDB * pGDB, const int& nId)
|
||||
{
|
||||
if ( nId == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
if ( ! pGDB->GetMaterial( nId, pCol))
|
||||
// se fallisce cerco il colore del parent
|
||||
return GetColor( pCol, pGDB, pGDB->GetParentId( nId)) ;
|
||||
// se il gruppo va salvato come componente, lo aggiungo al modello
|
||||
if ( bSaveAsComponent && pComponent->GetComponentCount() > 0) {
|
||||
if ( pParent == nullptr)
|
||||
m_model->AddBuildItem( pComponent.get(), m_wrapper->GetIdentityTransform()) ;
|
||||
else
|
||||
pParent->AddComponent( pComponent.get(), m_wrapper->GetIdentityTransform()) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Lib3MF_uint32
|
||||
Export3MF::ColorHandler3MF( const Color* pCol)
|
||||
Export3MF::ColorHandler3MF( const Color& cCol)
|
||||
{
|
||||
PColorGroup pColorGrp = m_model->GetColorGroupByID( 1) ;
|
||||
// converto il colore nel formato usato da 3MF
|
||||
Lib3MF_uint8 nAlpha = ( int)( pCol->GetIntAlpha() * 2.55 + 0.5) ;
|
||||
sColor cCol3mf = m_wrapper->RGBAToColor( pCol->GetIntRed(), pCol->GetIntGreen(), pCol->GetIntBlue(), nAlpha) ;
|
||||
// verifico se il colore � gi� presente nel colorgroup
|
||||
Lib3MF_uint8 nAlpha = ( int)( cCol.GetIntAlpha() * 2.55 + 0.5) ;
|
||||
sColor cCol3mf = m_wrapper->RGBAToColor( cCol.GetIntRed(), cCol.GetIntGreen(), cCol.GetIntBlue(), nAlpha) ;
|
||||
// verifico se il colore è già presente nel colorgroup
|
||||
UINTVECTOR vColorIdx ;
|
||||
pColorGrp->GetAllPropertyIDs( vColorIdx) ;
|
||||
for ( Lib3MF_uint32 i : vColorIdx) {
|
||||
sColor cColTmp = pColorGrp->GetColor( i) ;
|
||||
if ( cColTmp.m_Red == cCol3mf.m_Red && cColTmp.m_Green == cCol3mf.m_Green && cColTmp.m_Blue == cCol3mf.m_Blue
|
||||
&& cColTmp.m_Alpha == cCol3mf.m_Alpha)
|
||||
if ( cColTmp.m_Red == cCol3mf.m_Red && cColTmp.m_Green == cCol3mf.m_Green && cColTmp.m_Blue == cCol3mf.m_Blue &&
|
||||
cColTmp.m_Alpha == cCol3mf.m_Alpha)
|
||||
return i ;
|
||||
}
|
||||
// se non fosse presente, lo aggiungo
|
||||
|
||||
+12
-12
@@ -13,7 +13,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define NOMINMAX
|
||||
#define NOMINMAX
|
||||
#include "/EgtDev/Extern/Lib3MF/Include/lib3mf_implicit.hpp"
|
||||
#include "/EgtDev/Include/EExExport3MF.h"
|
||||
|
||||
@@ -32,20 +32,20 @@ class Export3MF : public IExport3MF
|
||||
}
|
||||
|
||||
private :
|
||||
bool ExportObject( const IGdbIterator& iIter) ;
|
||||
bool ScanGroup( const IGdbIterator& iIter) ;
|
||||
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup) ;
|
||||
bool ExportObject( const IGdbIterator& iIter, Lib3MF::PComponentsObject pParent = nullptr, bool bSaveGrpAsComponent = false) ;
|
||||
bool ExportGroup( const IGdbIterator& iIter, const std::string& sName, const STRVECTOR& vsInfo, Lib3MF::PComponentsObject pParent,
|
||||
bool bSaveAsComponent) ;
|
||||
bool ExportSFR( const IGeoObj* pGeoObj, const Frame3d& frFrame, const std::string& sName, const STRVECTOR& vInfo,
|
||||
const Color& cCol, Lib3MF::PComponentsObject pParent) ;
|
||||
bool ExportSTM( const IGeoObj* pGeoObj, const Frame3d& frFrame, const std::string& sName, const STRVECTOR& vInfo,
|
||||
const Color& cCol, Lib3MF::PComponentsObject pParent) ;
|
||||
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup) const ;
|
||||
bool CalcGroupFilter( void) ;
|
||||
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) ;
|
||||
Lib3MF_uint32 ColorHandler3MF( const Color& cCol) ;
|
||||
|
||||
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
|
||||
int m_nFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare è un oggetto geometrico
|
||||
int m_nGroupFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare è un gruppo
|
||||
Lib3MF::PWrapper m_wrapper ; // lib3mf wrapper
|
||||
Lib3MF::PModel m_model ; // lib3mf model
|
||||
} ;
|
||||
@@ -33,8 +33,6 @@
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtStringDecoder.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include <fstream>
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include <fstream>
|
||||
|
||||
+104
-212
@@ -18,7 +18,7 @@
|
||||
#include "Import3MF.h"
|
||||
#include "DllMain.h"
|
||||
#include "/EgtDev/Include/EExDllMain.h"
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
|
||||
using namespace std ;
|
||||
using namespace Lib3MF ;
|
||||
@@ -27,16 +27,16 @@ using namespace Lib3MF ;
|
||||
IImport3MF*
|
||||
CreateImport3MF( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
// creo l'oggetto
|
||||
return static_cast<IImport3MF*> ( new( nothrow) Import3MF) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Import3MF::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup)
|
||||
Import3MF::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup, int nFlag)
|
||||
{
|
||||
LOG_INFO( GetEExLogger(), ( "Import3MF : " + sFile).c_str()) ;
|
||||
|
||||
@@ -53,7 +53,10 @@ Import3MF::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup)
|
||||
return false ;
|
||||
}
|
||||
m_nIdGroup = nIdGroup ;
|
||||
|
||||
|
||||
// imposto le opzioni di importazione
|
||||
m_nFlag = nFlag ;
|
||||
|
||||
try {
|
||||
if ( ! DoImport( sFile))
|
||||
return false ;
|
||||
@@ -71,15 +74,15 @@ bool
|
||||
Import3MF::DoImport( const string& sFile)
|
||||
{
|
||||
// libreria 3MF
|
||||
PWrapper m_wrapper = CWrapper::loadLibrary() ;
|
||||
if ( ! m_wrapper) {
|
||||
m_wrapper = CWrapper::loadLibrary() ;
|
||||
if ( m_wrapper == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Import3MF : Error on lib3mf Wrapper") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// creazione del 3MF model
|
||||
m_model = m_wrapper->CreateModel() ;
|
||||
if ( ! m_model) {
|
||||
if ( m_model == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Import3MF : Error on lib3mf Model") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -87,33 +90,34 @@ Import3MF::DoImport( const string& sFile)
|
||||
// lettura file
|
||||
PReader reader = m_model->QueryReader( "3mf") ;
|
||||
reader->ReadFromFile( sFile) ;
|
||||
for ( Lib3MF_uint32 iWarning = 0 ; iWarning < reader->GetWarningCount() ; iWarning ++) {
|
||||
for ( Lib3MF_uint32 nWarning = 0 ; nWarning < reader->GetWarningCount() ; nWarning ++) {
|
||||
Lib3MF_uint32 nErrorCode ;
|
||||
string sWarningMsg = reader->GetWarning( iWarning, nErrorCode) ;
|
||||
string sErrorMsg = " Reading 3MF file encountered warning # " + to_string( nErrorCode) + " : " + sWarningMsg ;
|
||||
string sWarningMsg = reader->GetWarning( nWarning, nErrorCode) ;
|
||||
string sErrorMsg = " Reading 3MF file encountered warning # " + to_string( nErrorCode) + " : " + sWarningMsg ;
|
||||
LOG_ERROR( GetEExLogger(), sErrorMsg.c_str()) ;
|
||||
}
|
||||
|
||||
switch ( m_model->GetUnit()) {
|
||||
case eModelUnit::MicroMeter :
|
||||
m_nScaleFactor = 0.001 ;
|
||||
m_dScaleFactor = 0.001 ;
|
||||
break ;
|
||||
case eModelUnit::MilliMeter :
|
||||
m_nScaleFactor = 1.0 ;
|
||||
m_dScaleFactor = 1.0 ;
|
||||
break ;
|
||||
case eModelUnit::CentiMeter :
|
||||
m_nScaleFactor = 10.0 ;
|
||||
m_dScaleFactor = 10.0 ;
|
||||
break ;
|
||||
case eModelUnit::Inch :
|
||||
m_nScaleFactor = 25.4 ;
|
||||
m_dScaleFactor = 25.4 ;
|
||||
break ;
|
||||
case eModelUnit::Foot :
|
||||
m_nScaleFactor = 304.8 ;
|
||||
m_dScaleFactor = 304.8 ;
|
||||
break ;
|
||||
case eModelUnit::Meter :
|
||||
m_nScaleFactor = 1000.0 ;
|
||||
m_dScaleFactor = 1000.0 ;
|
||||
break ;
|
||||
default:
|
||||
m_nScaleFactor = 1.0 ;
|
||||
m_dScaleFactor = 1.0 ;
|
||||
}
|
||||
|
||||
// analisi metadata
|
||||
@@ -121,83 +125,54 @@ Import3MF::DoImport( const string& sFile)
|
||||
Lib3MF_uint32 nMetaDataCount = metaDataGrp->GetMetaDataCount() ;
|
||||
for ( Lib3MF_uint32 i = 0 ; i < nMetaDataCount ; i ++) {
|
||||
PMetaData metaData = metaDataGrp->GetMetaData( i) ;
|
||||
string sMetaDataValue = metaData->GetValue() ;
|
||||
string sMetaDataName = metaData->GetName() ;
|
||||
if ( ! sMetaDataValue.empty() && ! sMetaDataName.empty())
|
||||
m_pGDB->SetInfo( m_nIdGroup, sMetaDataName, sMetaDataValue) ;
|
||||
string sName = metaData->GetName() ;
|
||||
string sValue = metaData->GetValue() ;
|
||||
if ( ! sName.empty() && ! sValue.empty())
|
||||
m_pGDB->SetInfo( m_nIdGroup, sName, sValue) ;
|
||||
}
|
||||
|
||||
// scorro gli items nel build node
|
||||
PBuildItemIterator pBuildItemsIter = m_model->GetBuildItems() ;
|
||||
while ( pBuildItemsIter->MoveNext()) {
|
||||
if ( ! ReadItem( pBuildItemsIter->GetCurrent()))
|
||||
return false ;
|
||||
PBuildItem pItem = pBuildItemsIter->GetCurrent() ;
|
||||
// ignoro i suoi attributes e i suoi metadata
|
||||
// recupero la sua trasformazione
|
||||
sTransform sTransf = pItem->GetObjectTransform() ;
|
||||
// lettura oggetto associato
|
||||
if ( ! ReadObject( pItem->GetObjectResource(), sTransf, m_nIdGroup))
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool
|
||||
Import3MF::ReadItem( const PBuildItem pItem)
|
||||
{
|
||||
if ( ! pItem)
|
||||
return false ;
|
||||
|
||||
// trasformazione
|
||||
sTransform sTransf = pItem->GetObjectTransform() ;
|
||||
|
||||
// attributes
|
||||
ATTRVECTOR vAttr ;
|
||||
string sProp = pItem->GetPartNumber() ;
|
||||
if ( ! sProp.empty())
|
||||
vAttr.push_back( make_pair( "Item partnumber", pItem->GetPartNumber())) ;
|
||||
bool bUUID ;
|
||||
sProp = pItem->GetUUID( bUUID) ;
|
||||
if ( bUUID)
|
||||
vAttr.push_back( make_pair( "Item UUID", sProp)) ;
|
||||
|
||||
// metadata
|
||||
PMetaDataGroup pMetaDataGrp = pItem->GetMetaDataGroup() ;
|
||||
if ( pMetaDataGrp)
|
||||
ReadMetaDataGroup( pMetaDataGrp, vAttr, Item) ;
|
||||
|
||||
// lettura oggetto associato
|
||||
return ReadObject( pItem->GetObjectResource(), vAttr, sTransf) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
bool
|
||||
Import3MF::ReadObject( const PObject pObj, ATTRVECTOR& vAttr, sTransform& sTransf)
|
||||
Import3MF::ReadObject( const PObject pObj, const sTransform& Transform, int nParentId)
|
||||
{
|
||||
if ( ! pObj)
|
||||
if ( pObj == nullptr)
|
||||
return false ;
|
||||
|
||||
bool bMeshObj = pObj->IsMeshObject() ;
|
||||
|
||||
// attributes
|
||||
string sProp = pObj->GetName() ;
|
||||
INFOVECTOR vInfo ;
|
||||
string sName = pObj->GetName() ;
|
||||
string sProp = pObj->GetPartNumber() ;
|
||||
if ( ! sProp.empty())
|
||||
vAttr.push_back( make_pair( "name", sProp)) ;
|
||||
sProp = pObj->GetPartNumber() ;
|
||||
if ( ! sProp.empty())
|
||||
vAttr.push_back( make_pair( "partnumber", sProp)) ;
|
||||
vInfo.emplace_back( "PartNumber", sProp) ;
|
||||
bool bUUID = false ;
|
||||
sProp = pObj->GetUUID( bUUID) ;
|
||||
if ( bUUID) {
|
||||
string sPropName = bMeshObj ? "UUID" : "object UUID" ;
|
||||
vAttr.push_back( make_pair( sPropName, sProp)) ;
|
||||
}
|
||||
if ( bUUID)
|
||||
vInfo.emplace_back( "UUID", sProp) ;
|
||||
|
||||
switch ( pObj->GetType()) {
|
||||
case eObjectType::Model :
|
||||
vAttr.push_back( make_pair( "type", "Model")) ;
|
||||
vInfo.emplace_back( "Type", "Model") ;
|
||||
break ;
|
||||
case eObjectType::Support :
|
||||
vAttr.push_back( make_pair( "type", "Support")) ;
|
||||
vInfo.emplace_back( "Type", "Support") ;
|
||||
break ;
|
||||
case eObjectType::SolidSupport :
|
||||
vAttr.push_back( make_pair( "type", "SolidSupport")) ;
|
||||
vInfo.emplace_back( "Type", "SolidSupport") ;
|
||||
break ;
|
||||
default :
|
||||
break ;
|
||||
@@ -205,29 +180,34 @@ Import3MF::ReadObject( const PObject pObj, ATTRVECTOR& vAttr, sTransform& sTrans
|
||||
|
||||
// metadata
|
||||
PMetaDataGroup pMetaDataGrp = pObj->GetMetaDataGroup() ;
|
||||
if ( pMetaDataGrp)
|
||||
ReadMetaDataGroup( pMetaDataGrp, vAttr, bMeshObj ? Mesh : Component) ;
|
||||
for ( Lib3MF_uint32 i = 0 ; i < pMetaDataGrp->GetMetaDataCount() ; i ++) {
|
||||
PMetaData metaData = pMetaDataGrp->GetMetaData( i) ;
|
||||
string sMetaDataName = metaData->GetName() ;
|
||||
string sMetaDataValue = metaData->GetValue() ;
|
||||
if ( ! sMetaDataName.empty() && ! sMetaDataValue.empty())
|
||||
vInfo.emplace_back( sMetaDataName, sMetaDataValue) ;
|
||||
}
|
||||
|
||||
if ( pObj->IsMeshObject())
|
||||
return ReadMesh( pObj->GetResourceID(), vAttr, sTransf) ;
|
||||
return ReadMesh( pObj->GetResourceID(), sName, vInfo, Transform, nParentId) ;
|
||||
else if ( pObj->IsComponentsObject())
|
||||
return ReadComponents( pObj->GetResourceID(), vAttr, sTransf) ;
|
||||
return ReadComponent( pObj->GetResourceID(), sName, vInfo, Transform, nParentId) ;
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
bool
|
||||
Import3MF::ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, sTransform& sTransf)
|
||||
Import3MF::ReadMesh( Lib3MF_uint32 nId, const string& sName, const INFOVECTOR& vInfo, const sTransform& Transform, int nParentId)
|
||||
{
|
||||
// Recupero puntatore alla mesh 3MF
|
||||
PMeshObject pMesh = m_model->GetMeshObjectByID( nId) ;
|
||||
if ( pMesh.get() == nullptr)
|
||||
if ( pMesh == nullptr)
|
||||
return false ;
|
||||
|
||||
// Creo e inizializzo trimesh
|
||||
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pStm) || ! pStm->Init( 3, 1)) {
|
||||
if ( IsNull( pStm) || ! pStm->Init( pMesh->GetVertexCount(), pMesh->GetTriangleCount())) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : ISurfTriMesh Create error") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -240,15 +220,15 @@ Import3MF::ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, sTransform& sT
|
||||
// applico la trasformazione
|
||||
double x = 0.0, y = 0.0, z = 0.0 ;
|
||||
for ( int k = 0 ; k < 3 ; k ++) {
|
||||
x += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][0] ;
|
||||
y += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][1] ;
|
||||
z += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][2] ;
|
||||
x += pVertex.m_Coordinates[k] * Transform.m_Fields[k][0] ;
|
||||
y += pVertex.m_Coordinates[k] * Transform.m_Fields[k][1] ;
|
||||
z += pVertex.m_Coordinates[k] * Transform.m_Fields[k][2] ;
|
||||
}
|
||||
x += sTransf.m_Fields[3][0] ;
|
||||
y += sTransf.m_Fields[3][1] ;
|
||||
z += sTransf.m_Fields[3][2] ;
|
||||
x += Transform.m_Fields[3][0] ;
|
||||
y += Transform.m_Fields[3][1] ;
|
||||
z += Transform.m_Fields[3][2] ;
|
||||
// inserisco il vertice nella trimesh
|
||||
if ( pStm->AddVertex( Point3d( x, y, z)) == SVT_NULL) {
|
||||
if ( pStm->AddVertex( Point3d( x, y, z) * m_dScaleFactor) == SVT_NULL) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : ISurfTriMesh AddVertex error") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -275,7 +255,7 @@ Import3MF::ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, sTransform& sT
|
||||
}
|
||||
|
||||
// Inserimento nel DB geometrico
|
||||
int nGeoId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, Release( pStm)) ;
|
||||
int nGeoId = m_pGDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) ;
|
||||
if ( nGeoId == GDB_ID_NULL) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : error adding GeoObject") ;
|
||||
return false ;
|
||||
@@ -290,125 +270,65 @@ Import3MF::ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, sTransform& sT
|
||||
}
|
||||
|
||||
// attributes
|
||||
for ( size_t i = 0 ; i < vAttr.size() ; i++) {
|
||||
if ( vAttr[i].first == "name")
|
||||
m_pGDB->SetName( nGeoId, vAttr[i].second) ;
|
||||
else
|
||||
m_pGDB->SetInfo( nGeoId, vAttr[i].first, vAttr[i].second) ;
|
||||
}
|
||||
if ( ! sName.empty())
|
||||
m_pGDB->SetName( nGeoId, sName) ;
|
||||
for ( int i = 0 ; i < int( vInfo.size()) ; i++)
|
||||
m_pGDB->SetInfo( nGeoId, vInfo[i].first, vInfo[i].second) ;
|
||||
|
||||
return true ;
|
||||
|
||||
#if 0
|
||||
PMeshObject pMesh = m_model->GetMeshObjectByID( nId) ;
|
||||
|
||||
StmFromTriangleSoup Stm ;
|
||||
if ( ! Stm.Start()) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : StmFromTriangleSoup error") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// vertici
|
||||
vector<Point3d> vVertices( pMesh->GetVertexCount()) ;
|
||||
for ( Lib3MF_uint32 i = 0 ; i < pMesh->GetVertexCount() ; i ++) {
|
||||
sPosition pVertex = pMesh->GetVertex( i) ;
|
||||
// applico la trasformazione
|
||||
double x = 0.0, y = 0.0, z = 0.0 ;
|
||||
for ( Lib3MF_uint32 k = 0 ; k < 3 ; k ++) {
|
||||
x += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][0] ;
|
||||
y += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][1] ;
|
||||
z += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][2] ;
|
||||
}
|
||||
x += sTransf.m_Fields[3][0] ;
|
||||
y += sTransf.m_Fields[3][1] ;
|
||||
z += sTransf.m_Fields[3][2] ;
|
||||
|
||||
Point3d pt( x, y, z) ;
|
||||
vVertices[i] = pt * m_nScaleFactor ;
|
||||
}
|
||||
|
||||
// triangoli
|
||||
for ( Lib3MF_uint32 i = 0 ; i < pMesh->GetTriangleCount() ; i ++) {
|
||||
sTriangle tTrg = pMesh->GetTriangle( i) ;
|
||||
if ( ! Stm.AddTriangle( vVertices[tTrg.m_Indices[0]], vVertices[tTrg.m_Indices[1]], vVertices[tTrg.m_Indices[2]])) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : StmFromTriangleSoup AddTriangle error") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! Stm.End()) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : StmFromTriangleSoup error") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
ISurfTriMesh* pSurf = Stm.GetSurf() ;
|
||||
if ( pSurf == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : StmFromTriangleSoup GetSurf error") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
int nGeoId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, pSurf) ;
|
||||
if ( nGeoId == GDB_ID_NULL) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : error adding GeoObject") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// colore
|
||||
Lib3MF_uint32 pid, pindex ;
|
||||
if ( pMesh->GetObjectLevelProperty( pid, pindex)) {
|
||||
Color cCol ;
|
||||
if ( FindColor( pid, pindex, cCol))
|
||||
m_pGDB->SetMaterial( nGeoId, cCol) ;
|
||||
}
|
||||
|
||||
// attributes
|
||||
for ( size_t i = 0 ; i < vAttr.size() ; i++) {
|
||||
if ( vAttr[i].first == "name")
|
||||
m_pGDB->SetName( nGeoId, vAttr[i].second) ;
|
||||
else
|
||||
m_pGDB->SetInfo( nGeoId, vAttr[i].first, vAttr[i].second) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
bool
|
||||
Import3MF::ReadComponents( const Lib3MF_uint32& nId, ATTRVECTOR& attributes, sTransform& sTransfItem)
|
||||
Import3MF::ReadComponent( Lib3MF_uint32 nId, const string& sName, const INFOVECTOR& vInfo, const sTransform& Transform, int nParentId)
|
||||
{
|
||||
PComponentsObject pComponents = m_model->GetComponentsObjectByID( nId) ;
|
||||
// se va conservata la gerarchia ogni componente corrisponde ad un layer, altrimenti gli elementi della componente vengono
|
||||
// inseriti direttamente in m_nIdGroup e i suoi attributes vengono ignorati
|
||||
|
||||
// Scorro tutte le componenti
|
||||
for ( Lib3MF_uint32 iC = 0 ; iC < pComponents->GetComponentCount() ; iC ++ ) {
|
||||
PComponentsObject pComponents = m_model->GetComponentsObjectByID( nId) ;
|
||||
if ( pComponents == nullptr)
|
||||
return false ;
|
||||
|
||||
int nLayerId = nParentId ;
|
||||
// se importo gerarchia creo il layer corrispondente alla componente
|
||||
if ( ( m_nFlag & EI3FLAG_KEEP_GROUPS) != 0) {
|
||||
nLayerId = m_pGDB->AddGroup( GDB_ID_NULL, nParentId, GLOB_FRM) ;
|
||||
// assegno nome e info
|
||||
if ( ! sName.empty())
|
||||
m_pGDB->SetName( nLayerId, sName) ;
|
||||
for ( int i = 0 ; i < int( vInfo.size()) ; i++)
|
||||
m_pGDB->SetInfo( nLayerId, vInfo[i].first, vInfo[i].second) ;
|
||||
}
|
||||
|
||||
// scorro tutti i suoi oggetti
|
||||
for ( Lib3MF_uint32 nC = 0 ; nC < pComponents->GetComponentCount() ; nC++) {
|
||||
|
||||
PComponent pComponent = pComponents->GetComponent( iC) ;
|
||||
|
||||
sTransform sTransfComp = pComponent->GetTransform() ;
|
||||
// combino le trasformazioni
|
||||
sTransform sTransfRes ;
|
||||
// inizializzo sTransfRes a zero
|
||||
PComponent pComponent = pComponents->GetComponent( nC) ;
|
||||
|
||||
// combino le trasformazioni
|
||||
sTransform TransfComp = pComponent->GetTransform() ;
|
||||
sTransform TransfRes ;
|
||||
// inizializzo TransfRes a zero
|
||||
for ( Lib3MF_uint32 i = 0 ; i < 4 ; i++)
|
||||
fill( sTransfRes.m_Fields[i], sTransfRes.m_Fields[i] + 3, ( Lib3MF_single)0.0) ;
|
||||
fill( TransfRes.m_Fields[i], TransfRes.m_Fields[i] + 3, ( Lib3MF_single) 0.0) ;
|
||||
|
||||
for ( Lib3MF_uint32 i = 0 ; i < 4 ; i ++)
|
||||
for ( Lib3MF_uint32 j = 0 ; j < 3 ; j++)
|
||||
for ( Lib3MF_uint32 k = 0 ; k < 3 ; k ++)
|
||||
sTransfRes.m_Fields[i][j] += sTransfComp.m_Fields[i][k] * sTransfItem.m_Fields[k][j] ; // prodotto fra matrici
|
||||
TransfRes.m_Fields[i][j] += TransfComp.m_Fields[i][k] * Transform.m_Fields[k][j] ; // prodotto fra matrici
|
||||
|
||||
for ( Lib3MF_uint32 j = 0 ; j < 3 ; j ++)
|
||||
sTransfRes.m_Fields[3][j] += sTransfItem.m_Fields[3][j] ;
|
||||
TransfRes.m_Fields[3][j] += Transform.m_Fields[3][j] ;
|
||||
|
||||
if ( ! ReadObject( pComponent->GetObjectResource(), attributes, sTransfRes))
|
||||
if ( ! ReadObject( pComponent->GetObjectResource(), TransfRes, nLayerId))
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
bool
|
||||
Import3MF::FindColor( const Lib3MF_uint32& pid, const Lib3MF_uint32& pindex, Color& cCol)
|
||||
Import3MF::FindColor( Lib3MF_uint32 pid, Lib3MF_uint32 pindex, Color& cCol) const
|
||||
{
|
||||
sColor sCol ;
|
||||
|
||||
@@ -431,12 +351,12 @@ Import3MF::FindColor( const Lib3MF_uint32& pid, const Lib3MF_uint32& pindex, Col
|
||||
// multiproperty corrispondente a pindex
|
||||
UINTVECTOR pindices ;
|
||||
pMultiPropGrp->GetMultiProperty( pindex, pindices) ;
|
||||
// analizzo i layers alla ricerca di una proprietà che definisca un colore
|
||||
// analizzo i layers alla ricerca di una proprietà che definisca un colore
|
||||
Lib3MF_uint32 nLayers = pMultiPropGrp->GetLayerCount() ;
|
||||
for ( Lib3MF_uint32 i = 0 ; i < nLayers ; i ++) {
|
||||
sMultiPropertyLayer layer = pMultiPropGrp->GetLayer( i) ;
|
||||
Lib3MF_uint32 pidLayer = layer.m_ResourceID ;
|
||||
// appena trovo una propietà che definisce un colore mi fermo
|
||||
// appena trovo una propietà che definisce un colore mi fermo
|
||||
if ( m_model->GetPropertyTypeByID( pidLayer) == ePropertyType::BaseMaterial ||
|
||||
m_model->GetPropertyTypeByID( pidLayer) == ePropertyType::Colors)
|
||||
return FindColor( pidLayer, pindices[i], cCol) ;
|
||||
@@ -453,19 +373,19 @@ Import3MF::FindColor( const Lib3MF_uint32& pid, const Lib3MF_uint32& pindex, Col
|
||||
|
||||
// check sui valori in vComposite
|
||||
double dMixSum = 0.0 ;
|
||||
for( size_t i = 0 ; i < vComposite.size(); i ++)
|
||||
for( int i = 0 ; i < int( vComposite.size()) ; i ++)
|
||||
dMixSum += vComposite[i].m_MixingRatio ;
|
||||
// se fossero tutti zero, considero proporzioni uguali per ogni colore
|
||||
if ( abs( dMixSum) < EPS_SMALL) {
|
||||
dMixSum = vComposite.size() ;
|
||||
for ( size_t i = 0 ; i < vComposite.size() ; i++)
|
||||
for ( int i = 0 ; i < int( vComposite.size()) ; i++)
|
||||
vComposite[i].m_MixingRatio = 1 ;
|
||||
}
|
||||
|
||||
double dRed = 0.0, dGreen = 0.0, dBlue = 0.0, dAlpha = 0.0 ; // colore finale
|
||||
Lib3MF_uint8 nRedTmp, nGreenTmp, nBlueTmp, nAlphaTmp ; // colore del BaseMaterial
|
||||
// per ogni elemento di composite aggiungo il suo colore con l'opportuno coefficiente
|
||||
for ( size_t i = 0 ; i < vComposite.size() ; i++) {
|
||||
for ( int i = 0 ; i < int( vComposite.size()) ; i++) {
|
||||
sCol = pBaseMatGrp->GetDisplayColor( vComposite[i].m_PropertyID) ;
|
||||
m_wrapper->ColorToRGBA( sCol, nRedTmp, nGreenTmp, nBlueTmp, nAlphaTmp) ;
|
||||
double dMixingRatio = vComposite[i].m_MixingRatio / dMixSum ;
|
||||
@@ -490,31 +410,3 @@ Import3MF::FindColor( const Lib3MF_uint32& pid, const Lib3MF_uint32& pindex, Col
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool
|
||||
Import3MF::ReadMetaDataGroup( const PMetaDataGroup pMetaDataGrp, ATTRVECTOR& vAttr, const MDGCaller& caller)
|
||||
{
|
||||
for ( Lib3MF_uint32 i = 0 ; i < pMetaDataGrp->GetMetaDataCount() ; i ++) {
|
||||
|
||||
PMetaData metaData = pMetaDataGrp->GetMetaData( i) ;
|
||||
string sMetaDataValue = metaData->GetValue() ;
|
||||
if ( sMetaDataValue.empty())
|
||||
continue ;
|
||||
string sMetaDataName ;
|
||||
switch ( caller) {
|
||||
case Item :
|
||||
sMetaDataName = "Item " ;
|
||||
break ;
|
||||
case Component :
|
||||
sMetaDataName = "Object " ;
|
||||
break ;
|
||||
case Mesh :
|
||||
sMetaDataName = "" ;
|
||||
}
|
||||
sMetaDataName += metaData->GetName() ;
|
||||
vAttr.push_back( make_pair( sMetaDataName, sMetaDataValue)) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
+16
-19
@@ -13,39 +13,36 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
#include "/EgtDev/Include/EExImport3MF.h"
|
||||
#include "pugixml.hpp"
|
||||
#include "/EgtDev/Extern/libzip/Include/zip.h"
|
||||
#define NOMINMAX
|
||||
#include "/EgtDev/Extern/Lib3MF/Include/lib3mf_implicit.hpp"
|
||||
|
||||
#include "/EgtDev/Include/EExImport3MF.h"
|
||||
#include "/EgtDev/Extern/lib3MF/Include/lib3mf_implicit.hpp"
|
||||
#include <unordered_map>
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Import3MF : public IImport3MF
|
||||
{
|
||||
private :
|
||||
typedef std::vector<std::pair<std::string, std::string>> ATTRVECTOR ;
|
||||
enum MDGCaller { Item = 0, Component = 1, Mesh = 2 } ;
|
||||
typedef std::vector<std::pair<std::string, std::string>> INFOVECTOR ;
|
||||
|
||||
public :
|
||||
virtual bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup) ;
|
||||
virtual bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup, int nFlag = 0) ;
|
||||
|
||||
private :
|
||||
bool DoImport( const std::string& sFile) ;
|
||||
bool ReadItem( const Lib3MF::PBuildItem item) ;
|
||||
bool ReadObject( const Lib3MF::PObject pObj, ATTRVECTOR& vAttr, Lib3MF::sTransform& sTransf) ;
|
||||
bool ReadComponents( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, Lib3MF::sTransform& sTransfItem) ;
|
||||
bool ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, Lib3MF::sTransform& sTransfr) ;
|
||||
bool ReadMetaDataGroup( const Lib3MF::PMetaDataGroup pMetaDataGrp, ATTRVECTOR& vAttr, const MDGCaller& caller) ;
|
||||
bool FindColor( const Lib3MF_uint32& pid, const Lib3MF_uint32& pindex, Color& cCol) ;
|
||||
bool ReadObject( const Lib3MF::PObject pObj, const Lib3MF::sTransform& Transform, int nParentId) ;
|
||||
bool ReadComponent( Lib3MF_uint32 nId, const std::string& sName, const INFOVECTOR& vInfo, const Lib3MF::sTransform& Transform,
|
||||
int nParentId) ;
|
||||
bool ReadMesh( Lib3MF_uint32 nId, const std::string& sName, const INFOVECTOR& vInfo, const Lib3MF::sTransform& Transfrorm,
|
||||
int nParentId) ;
|
||||
bool FindColor( Lib3MF_uint32 pid, Lib3MF_uint32 pindex, Color& cCol) const ;
|
||||
|
||||
private :
|
||||
double m_nScaleFactor ;
|
||||
private :
|
||||
double m_dScaleFactor ;
|
||||
IGeomDB* m_pGDB ;
|
||||
int m_nIdGroup ;
|
||||
int m_nFlag ;
|
||||
Lib3MF::PWrapper m_wrapper ;
|
||||
Lib3MF::PModel m_model ;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
+53
-13
@@ -20,9 +20,8 @@
|
||||
#include "/EgtDev/Include/EGkStmStandard.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtStringEncoder.h"
|
||||
#include "/EgtDev/Include/EgtStringEncoder.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -34,6 +33,15 @@ SetBtlAuxDir( const string& sBtlAuxDir)
|
||||
return ExistsDirectory( sBtlAuxDir) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SetBtlLuaData( const string& sLuaLibsDir, const string& sLuaLastRequire)
|
||||
{
|
||||
BtlGeom::m_sBtlLuaLibsDir = sLuaLibsDir ;
|
||||
BtlGeom::m_sBtlLuaLastRequire = sLuaLastRequire ;
|
||||
return ExistsDirectory( sLuaLibsDir) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IImportBtl*
|
||||
CreateImportBtl( void)
|
||||
@@ -49,6 +57,7 @@ CreateImportBtl( void)
|
||||
ImportBtl::ImportBtl( void)
|
||||
{
|
||||
m_nBuild = 10000 ;
|
||||
m_nEdition = 0 ;
|
||||
m_dScale = 1 ;
|
||||
}
|
||||
|
||||
@@ -78,7 +87,8 @@ ImportBtl::Import( const string& sFile, IGeomDB* pGDB, int nFlag)
|
||||
bool bSpecialTrim = (( nFlag & EIBFLAG_SPECIAL_TRIM) != 0) ;
|
||||
bool bTrimWithOutline = (( nFlag & EIBFLAG_TRIM_WITH_OUTLINE) != 0) ;
|
||||
bool bUseUAttr = (( nFlag & EIBFLAG_USEUATTR) != 0) ;
|
||||
if ( ! m_BtlGeom.Init( pGDB, nFlatVertPos, bSpecialTrim, bTrimWithOutline, bUseUAttr)) {
|
||||
bool bPartOffset = (( nFlag & EIBFLAG_PARTOFFSET) != 0) ;
|
||||
if ( ! m_BtlGeom.Init( pGDB, nFlatVertPos, bSpecialTrim, bTrimWithOutline, bUseUAttr, bPartOffset, true)) {
|
||||
LOG_ERROR( GetEExLogger(), " Error on BtlGeom.Init")
|
||||
return false ;
|
||||
}
|
||||
@@ -299,7 +309,7 @@ ImportBtl::ReadGeneral( bool& bEnd)
|
||||
Trim( sVal, " \t\r\n\"") ;
|
||||
int nUnit ;
|
||||
if ( FromString( sVal, nUnit)) {
|
||||
m_dScale = pow( 10, - nUnit) ;
|
||||
m_dScale = Pow( 10, -nUnit) ;
|
||||
++ nRead ;
|
||||
}
|
||||
m_BtlGeom.SetUserAttribute( UATD_INFO, sKey, sVal) ;
|
||||
@@ -527,8 +537,14 @@ ImportBtl::ReadObject( ObjType nType, bool& bEnd)
|
||||
m_BtlGeom.SetUserAttribute( UATD_PART, sKey, sVal) ;
|
||||
break ;
|
||||
case KEY_PART_PARTOFFSET : // offset pezzo
|
||||
Trim( sVal, " \t\r\n\"") ;
|
||||
m_BtlGeom.SetUserAttribute( UATD_PART, sKey, sVal) ;
|
||||
{
|
||||
DBLVECTOR vdPar ;
|
||||
if ( ReadPartOffset( sVal, vdPar)) {
|
||||
m_BtlGeom.AddPartOffset( vdPar) ;
|
||||
string sVal = ToString( vdPar) ;
|
||||
m_BtlGeom.SetUserAttribute( UATD_PART, sPartKey[KEY_PART_PARTOFFSET], sVal) ;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
case KEY_PART_PROCESSINGQUALITY : // qualità di lavorazione
|
||||
Trim( sVal, " \t\r\n\"") ;
|
||||
@@ -676,6 +692,21 @@ ImportBtl::ReadTransformation( const string& sVal, Frame3d& frRef)
|
||||
return frRef.Set( ptO, ptO + vtX, ptO + vtY) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtl::ReadPartOffset( const string& sVal, DBLVECTOR& vdPar)
|
||||
{
|
||||
// assegno i valori di default
|
||||
vdPar = { 0, 0, 0, 0, 0} ;
|
||||
// leggo i valori
|
||||
GetParamP( sVal, 4, vdPar[0]) ;
|
||||
GetParamP( sVal, 11, vdPar[1]) ;
|
||||
GetParamP( sVal, 12, vdPar[2]) ;
|
||||
GetParamP( sVal, 13, vdPar[3]) ;
|
||||
GetParamP( sVal, 14, vdPar[4]) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportBtl::ReadOutline( void)
|
||||
@@ -704,6 +735,18 @@ ImportBtl::ReadOutline( void)
|
||||
break ;
|
||||
}
|
||||
// leggo i dati
|
||||
// leggo faccia di riferimento
|
||||
int nCurrSide ;
|
||||
if ( GetInfo( sVal, PAR_SIDE, nCurrSide)) {
|
||||
// se non ancora assegnata
|
||||
if ( nSide == BTL_SIDE_NONE)
|
||||
nSide = nCurrSide ;
|
||||
// altrimenti è un nuovo outline, si assegna questo e si esce
|
||||
else if ( nSide != nCurrSide) {
|
||||
m_theScanner.UngetLine( sLine) ;
|
||||
return m_BtlGeom.AddPartOutline( nSide, dqFce, nContType, nContData, dContPar, vsUAtt) ;
|
||||
}
|
||||
}
|
||||
// tipo
|
||||
int nFlag ;
|
||||
GetParamP( sVal, 8, nFlag) ;
|
||||
@@ -716,9 +759,6 @@ ImportBtl::ReadOutline( void)
|
||||
bProcFound = true ;
|
||||
}
|
||||
}
|
||||
// se non ancora assegnata, leggo faccia di riferimento
|
||||
if ( nSide == BTL_SIDE_NONE)
|
||||
GetInfo( sVal, PAR_SIDE, nSide) ;
|
||||
// punto principale
|
||||
Point3d ptP ;
|
||||
GetParamP( sVal, 1, ptP.x) ;
|
||||
@@ -837,13 +877,13 @@ ImportBtl::ReadColor( const string& sVal, Color& colRes)
|
||||
// leggo i valori
|
||||
string sRes ;
|
||||
GetParam( sVal, PAR_R, sRes) ;
|
||||
int nRed ; FromString( sRes, nRed) ;
|
||||
int nRed = 0 ; FromString( sRes, nRed) ;
|
||||
GetParam( sVal, PAR_G, sRes) ;
|
||||
int nGreen ; FromString( sRes, nGreen) ;
|
||||
int nGreen = 0 ; FromString( sRes, nGreen) ;
|
||||
GetParam( sVal, PAR_B, sRes) ;
|
||||
int nBlue ; FromString( sRes, nBlue) ;
|
||||
int nBlue = 0 ; FromString( sRes, nBlue) ;
|
||||
GetParam( sVal, PAR_A, sRes) ;
|
||||
int nAlpha ; FromString( sRes, nAlpha) ; nAlpha = nAlpha * 100 / 255 ;
|
||||
int nAlpha = 0 ; FromString( sRes, nAlpha) ; nAlpha = nAlpha * 100 / 255 ;
|
||||
colRes.Set( nRed, nGreen, nBlue, nAlpha) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ class ImportBtl : public IImportBtl
|
||||
bool ReadGeneral( bool& bEnd) ;
|
||||
bool ReadObject( ObjType nType, bool& bEnd) ;
|
||||
bool ReadTransformation( const std::string& sVal, Frame3d& frRef) ;
|
||||
bool ReadPartOffset( const std::string& sVal, DBLVECTOR& vdPar) ;
|
||||
bool ReadOutline( void) ;
|
||||
bool ReadAperture( void) ;
|
||||
bool ReadColor( const std::string& sVal, Color& colRes) ;
|
||||
|
||||
+232
-266
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -28,7 +28,7 @@ public :
|
||||
|
||||
bool ReadFileHistory( pugi::xml_node node) ;
|
||||
bool ReadProjectAttributes( pugi::xml_attribute attr) ;
|
||||
bool ReadUserAttributes( pugi::xml_node node, int caller, std::vector<std::string> * pvsAttr = nullptr) ;
|
||||
bool ReadUserAttributes( pugi::xml_node node, int caller, STRVECTOR* pvsAttr = nullptr) ;
|
||||
bool ReadPart( pugi::xml_node node) ;
|
||||
bool ReadPartAttributes( pugi::xml_attribute attr) ;
|
||||
bool ReadCamber( pugi::xml_node node) ;
|
||||
@@ -42,7 +42,7 @@ public :
|
||||
bool ReadAperture( pugi::xml_node node, int nSide) ;
|
||||
bool ReadUserReferencePlane( pugi::xml_node node) ;
|
||||
bool ReadShape( pugi::xml_node node) ;
|
||||
bool CheckGuid ( std::string s) ;
|
||||
bool CheckGuid( const std::string& s) ;
|
||||
|
||||
// processing
|
||||
bool ReadJackRafterCutParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide, INTVECTOR& vnDPar, int& nSPar,
|
||||
|
||||
+132
-123
@@ -30,12 +30,12 @@ using namespace std ;
|
||||
// ------------------------- Prototipi locali funzioni ausiliarie ---------------------------------
|
||||
static int GetGroup12( const pugi::xml_node& process) ;
|
||||
static int GetGroup34( const pugi::xml_node& process) ;
|
||||
static double ReadProcessChild( const pugi::xml_node& process, const string& sChild, const double& dVal) ;
|
||||
static double ReadProcessChildAttribute( const pugi::xml_node& process, const string& sChild, const string& sAttribute, const double& dVal) ;
|
||||
static double ReadProcessChild( const pugi::xml_node& process, const string& sChild, double dVal) ;
|
||||
static double ReadProcessChildAttribute( const pugi::xml_node& process, const string& sChild, const string& sAttribute, double dVal) ;
|
||||
static int ReadProcessChildBool( const pugi::xml_node& process, const string& sChild, const int& nDefaultVal, bool bInverted = false) ;
|
||||
static string ReadProcessChildYesNo( const pugi::xml_node& process, const string& sChild, const string& sVal) ;
|
||||
static double ReadProcessChildYesNoToDouble( const pugi::xml_node& process, const string& sChild1, const string& sDefaultOpt, const string& sChild2,
|
||||
const double& nDefaultVal) ;
|
||||
double nDefaultVal) ;
|
||||
static int ComputeP04( const STRVECTOR& values) ;
|
||||
static int ComputeP04( const pugi::xml_node& MachiningLimits) ;
|
||||
|
||||
@@ -52,7 +52,7 @@ ImportBtlx::ReadJackRafterCutParams( pugi::xml_node process, int& nGroup, int& n
|
||||
}
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
nGroup = GetGroup12( process) ;
|
||||
if ( nGroup == -1 ) {
|
||||
if ( nGroup == -1) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: JackRafterCut Orientation is not valid") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -98,9 +98,9 @@ ImportBtlx::ReadLongitudinalCutParams( pugi::xml_node process, int& nGroup, int&
|
||||
if ( sToolPosition == "center")
|
||||
nGroup = 0 ;
|
||||
else if ( sToolPosition == "right")
|
||||
nGroup = 3 ;
|
||||
else if ( sToolPosition == "left")
|
||||
nGroup = 4 ;
|
||||
else if ( sToolPosition == "left")
|
||||
nGroup = 3 ;
|
||||
else {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: LongitudinalCut Tool position not valid") ;
|
||||
return false ;
|
||||
@@ -126,6 +126,13 @@ ImportBtlx::ReadLongitudinalCutParams( pugi::xml_node process, int& nGroup, int&
|
||||
vdPar[6] = Clamp( ReadProcessChild( process, "AngleStart", vdPar[6]), 0.1, 179.9) ; // P13
|
||||
vdPar[7] = Clamp( ReadProcessChild( process, "AngleEnd", vdPar[7]), 0.1, 179.9) ; // P14
|
||||
|
||||
if ( vdPar[3] < 0) {
|
||||
if ( nGroup == 3)
|
||||
nGroup = 4 ;
|
||||
else if ( nGroup == 4)
|
||||
nGroup = 3 ;
|
||||
}
|
||||
|
||||
string sStartLimited = ReadProcessChildYesNo( process, "StartLimited", "no") ; // P04
|
||||
string sEndLimited = ReadProcessChildYesNo( process, "EndLimited", "no") ;
|
||||
vdPar[2] = ComputeP04( { "no", sStartLimited, sEndLimited}) ;
|
||||
@@ -148,14 +155,14 @@ ImportBtlx::ReadDoubleCutParams( pugi::xml_node process, int& nGroup, int& nProc
|
||||
}
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
nGroup = GetGroup12( process) ;
|
||||
if ( nGroup == -1 ) {
|
||||
if ( nGroup == -1) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: DoubleCut orientation unknown") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
@@ -191,7 +198,7 @@ ImportBtlx::ReadRidgeValleyCutParams( pugi::xml_node process, int& nGroup, int&
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
@@ -288,7 +295,7 @@ ImportBtlx::ReadSlotParams( pugi::xml_node process, int& nGroup, int& nProc, int
|
||||
}
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
nGroup = GetGroup34( process) ;
|
||||
if ( nGroup == -1 ) {
|
||||
if ( nGroup == -1) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Slot orientation unknown") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -317,7 +324,7 @@ ImportBtlx::ReadSlotParams( pugi::xml_node process, int& nGroup, int& nProc, int
|
||||
vdPar[10] = ReadProcessChild( process, "Length", vdPar[10]) ; // P12
|
||||
vdPar[11] = ReadProcessChild( process, "Thickness", vdPar[11]) ; // P13
|
||||
|
||||
if ( process.child( "MachiningLimits") != nullptr ) { // P04
|
||||
if ( process.child( "MachiningLimits") != nullptr) { // P04
|
||||
vdPar[3] = ComputeP04( process.child( "MachiningLimits")) ;
|
||||
if ( vdPar[3] == -2)
|
||||
return false ;
|
||||
@@ -341,7 +348,7 @@ ImportBtlx::ReadBirdsMouthParams( pugi::xml_node process, int& nGroup, int& nPro
|
||||
}
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
nGroup = GetGroup34( process) ;
|
||||
if ( nGroup == -1 ) {
|
||||
if ( nGroup == -1) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BirdsMouth orientation unknwon") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -388,7 +395,7 @@ ImportBtlx::ReadHipValleyRafterNotchParams( pugi::xml_node process, int& nGroup,
|
||||
}
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
nGroup = GetGroup34( process) ;
|
||||
if ( nGroup == -1 ) {
|
||||
if ( nGroup == -1) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: HipValleyRafterNotch orientation unknwon") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -437,7 +444,7 @@ ImportBtlx::ReadLapParams( pugi::xml_node process, int& nGroup, int& nProc, int&
|
||||
}
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
nGroup = GetGroup34( process) ;
|
||||
if ( nGroup == -1 ) {
|
||||
if ( nGroup == -1) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: HipValleyRafterNotch orientation unknwon") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -456,7 +463,7 @@ ImportBtlx::ReadLapParams( pugi::xml_node process, int& nGroup, int& nProc, int&
|
||||
// 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] = ? Non c'è StartDepth
|
||||
// vdPar[2] = ? Non c'è StartDepth
|
||||
vdPar[4] = ReadProcessChild( process, "Angle", vdPar[4]) ; // P04
|
||||
vdPar[5] = ReadProcessChild( process, "Inclination", vdPar[5]) ; // P07
|
||||
vdPar[6] = ReadProcessChild( process, "Slope", vdPar[6]) ; // P08
|
||||
@@ -467,7 +474,7 @@ ImportBtlx::ReadLapParams( pugi::xml_node process, int& nGroup, int& nProc, int&
|
||||
// vdPar[11] = ?
|
||||
vdPar[12] = Clamp( ReadProcessChild( process, "Width", vdPar[12]), 0.0, 50000.0) ; // P14
|
||||
|
||||
if ( process.child( "MachiningLimits") != nullptr ) {
|
||||
if ( process.child( "MachiningLimits") != nullptr) {
|
||||
vdPar[3] = ComputeP04( process.child( "MachiningLimits")) ;
|
||||
if ( vdPar[3] == -2)
|
||||
return false ;
|
||||
@@ -489,14 +496,14 @@ ImportBtlx::ReadLogHouseHalfLapParams( pugi::xml_node process, int& nGroup, int&
|
||||
}
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
nGroup = GetGroup34( process) ;
|
||||
if ( nGroup == -1 ) {
|
||||
if ( nGroup == -1) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: LogHouseHalfLap orientation unknwon") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
@@ -529,7 +536,7 @@ ImportBtlx::ReadFrenchRidgeLapParams( pugi::xml_node process, int& nGroup, int&
|
||||
}
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
nGroup = GetGroup12( process) ;
|
||||
if ( nGroup == -1 ) {
|
||||
if ( nGroup == -1) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: FrenchRidgeLap orientation unknwon") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -537,7 +544,7 @@ ImportBtlx::ReadFrenchRidgeLapParams( pugi::xml_node process, int& nGroup, int&
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
@@ -549,8 +556,7 @@ ImportBtlx::ReadFrenchRidgeLapParams( pugi::xml_node process, int& nGroup, int&
|
||||
// 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[2] = ReadProcessChild( process, "Angle", vdPar[2]) ; // P06
|
||||
vdPar[3] = ReadProcessChild( process, "DrillholeDiam", vdPar[3]) ; // P13
|
||||
|
||||
vdPar[3] = ReadProcessChild( process, "DrillholeDiam", vdPar[3]) ; // P13
|
||||
|
||||
string sRefPosition = process.child( "RefPosition").text().get() ; // P02
|
||||
if ( sRefPosition == "refedge" || sRefPosition.empty())
|
||||
@@ -575,10 +581,9 @@ ImportBtlx::ReadChamferParams( pugi::xml_node process, int& nGroup, int& nProc,
|
||||
nSide = 3 ; // Chamfer non ha un reference plane
|
||||
nGroup = 4 ; // Chamfer non ha orientation ( prendo start)
|
||||
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
@@ -596,12 +601,12 @@ ImportBtlx::ReadChamferParams( pugi::xml_node process, int& nGroup, int& nProc,
|
||||
string sCamferEdge23 = ReadProcessChildYesNo( process, "ChamferEdge23", "yes") ;
|
||||
string sCamferEdge34 = ReadProcessChildYesNo( process, "ChamferEdge34", "yes") ;
|
||||
string sCamferEdge41 = ReadProcessChildYesNo( process, "ChamferEdge41", "yes") ;
|
||||
STRVECTOR values = { sCamferEdge12, sCamferEdge23, sCamferEdge34, sCamferEdge41} ;
|
||||
STRVECTOR vsValues = { sCamferEdge12, sCamferEdge23, sCamferEdge34, sCamferEdge41} ;
|
||||
vdPar[1] = 0.0 ;
|
||||
for ( size_t i = 0 ; i < values.size() ; i++) {
|
||||
if ( values[i] == "yes")
|
||||
vdPar[1] += pow( 2, i) ;
|
||||
else if ( values[i] != "no") {
|
||||
for ( int i = 0 ; i < ssize( vsValues) ; i++) {
|
||||
if ( vsValues[i] == "yes")
|
||||
vdPar[1] += Pow( 2, i) ;
|
||||
else if ( vsValues[i] != "no") {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: ChamferEdge value is not valid") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -638,11 +643,11 @@ ImportBtlx::ReadLogHouseJointParams( pugi::xml_node process, int& nGroup, int& n
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
if ( vdPar.size() != 15) {
|
||||
if ( vdPar.size() != 16) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: LogHouseJoint number of parameters is wrong") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -700,14 +705,14 @@ ImportBtlx::ReadLogHouseFrontParams( pugi::xml_node process, int& nGroup, int& n
|
||||
}
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
nGroup = GetGroup34( process) ;
|
||||
if ( nGroup == -1 ) {
|
||||
if ( nGroup == -1) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: LogHouseFront orientation unknwon") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
@@ -744,7 +749,7 @@ ImportBtlx::ReadPocketParams( pugi::xml_node process, int& nGroup, int& nProc, i
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
@@ -768,8 +773,7 @@ ImportBtlx::ReadPocketParams( pugi::xml_node process, int& nGroup, int& nProc, i
|
||||
vdPar[2] = ComputeP04( process.child( "MachiningLimits")) ;
|
||||
if ( vdPar[2] == -2)
|
||||
return false ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -790,7 +794,7 @@ ImportBtlx::ReadDrillingParams( pugi::xml_node process, int& nGroup, int& nProc,
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
@@ -885,12 +889,11 @@ ImportBtlx::ReadMortiseParams( pugi::xml_node process, int& nGroup, int& nProc,
|
||||
return false ;
|
||||
}
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
nGroup = 4 ;
|
||||
|
||||
nGroup = 4 ;
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
@@ -911,7 +914,6 @@ ImportBtlx::ReadMortiseParams( pugi::xml_node process, int& nGroup, int& nProc,
|
||||
vdPar[10] = Clamp( ReadProcessChild( process, "Length", vdPar[10]), 0.0, 50000.0) ; // P13
|
||||
vdPar[13] = Clamp( ReadProcessChild( process, "Slope", vdPar[13]), 0.1, 179.9) ; // P16
|
||||
|
||||
|
||||
string sShape = process.child( "Shape").text().get() ; // P04
|
||||
if ( sShape == "automatic" || sShape.empty())
|
||||
vdPar[3] = 0 ;
|
||||
@@ -940,7 +942,7 @@ bool
|
||||
ImportBtlx::ReadDovetailTenonParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
||||
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
||||
{
|
||||
// Identifico il processo con sigle usate nel btl
|
||||
// Identifico il processo con codici usate nel btl
|
||||
nProc = 55 ;
|
||||
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
||||
@@ -948,7 +950,7 @@ ImportBtlx::ReadDovetailTenonParams( pugi::xml_node process, int& nGroup, int& n
|
||||
}
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
nGroup = GetGroup12( process) ;
|
||||
if ( nGroup == -1 ) {
|
||||
if ( nGroup == -1) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Orientation unknown") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -986,13 +988,14 @@ ImportBtlx::ReadDovetailTenonParams( pugi::xml_node process, int& nGroup, int& n
|
||||
}
|
||||
else if ( sShape == "radius" || sShape == "rounded" || sShape == "square" ) {
|
||||
if ( sShape != "radius") // P12
|
||||
vdPar[9] = MILL_DEF_RAD ;
|
||||
vdPar[9] = DTMILL_DEF_RAD ;
|
||||
vdPar[9] *= 2 ;
|
||||
vdPar[6] = dWidth - vdPar[9] * ( 1 - sin( vdPar[7] * DEGTORAD)) / cos( vdPar[7] * DEGTORAD) ; // P09
|
||||
if ( vdPar[6] < 0 ) {
|
||||
if ( vdPar[6] < -10 * EPS_SMALL) {
|
||||
LOG_ERROR( GetEExLogger(), " Error : Dovetail tenon width") ;
|
||||
return false ;
|
||||
}
|
||||
vdPar[6] = max( vdPar[6], 0.) ;
|
||||
}
|
||||
else {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Dovetail Tenon Shape is unknown") ;
|
||||
@@ -1058,13 +1061,14 @@ ImportBtlx::ReadDovetailMortiseParams( pugi::xml_node process, int& nGroup, int&
|
||||
}
|
||||
else if ( sShape == "radius" || sShape == "rounded" || sShape == "square") {
|
||||
if ( sShape != "radius") // P12
|
||||
vdPar[10] = MILL_DEF_RAD ;
|
||||
vdPar[10] = DTMILL_DEF_RAD ;
|
||||
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] < - 10 * EPS_SMALL) {
|
||||
LOG_ERROR( GetEExLogger(), " Error : Dovetail mortise width") ;
|
||||
return false ;
|
||||
}
|
||||
vdPar[7] = max( vdPar[7], 0.) ;
|
||||
}
|
||||
else {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Dovetail mortise Shape is unknown") ;
|
||||
@@ -1085,7 +1089,7 @@ ImportBtlx::ReadMarkingParams( pugi::xml_node process, int& nGroup, int& nProc,
|
||||
{
|
||||
// Identifico il processo con sigle usate nel btl
|
||||
nProc = 60 ;
|
||||
if ( process.attribute( "ReferencePlaneID") == nullptr){
|
||||
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1123,7 +1127,7 @@ ImportBtlx::ReadMarkingParams( pugi::xml_node process, int& nGroup, int& nProc,
|
||||
if ( nGroup == 4)
|
||||
vtD.Mirror( X_AX) ;
|
||||
if ( sLimited == "no" || sLimited.empty())
|
||||
vdPar[6] = 0.0 ; // la funzione AddMarking sistemerà il valore in base alla lunghezza del lato
|
||||
vdPar[6] = 0.0 ; // la funzione AddMarking sistemerà il valore in base alla lunghezza del lato
|
||||
else if ( sLimited == "yes")
|
||||
if ( abs( vdPar[3]) < EPS_SMALL)
|
||||
vdPar[6] = dLength ;
|
||||
@@ -1177,7 +1181,7 @@ ImportBtlx::ReadTextParams( pugi::xml_node process, int& nGroup, int& nProc, int
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
@@ -1255,7 +1259,7 @@ ImportBtlx::ReadSimpleScarfParams( pugi::xml_node process, int& nGroup, int& nPr
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
@@ -1288,7 +1292,7 @@ ImportBtlx::ReadScarfJointParams( pugi::xml_node process, int& nGroup, int& nPro
|
||||
}
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
nGroup = GetGroup12( process) ;
|
||||
if ( nGroup == -1 ) {
|
||||
if ( nGroup == -1) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tenon orientation unknwon") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1312,8 +1316,7 @@ ImportBtlx::ReadScarfJointParams( pugi::xml_node process, int& nGroup, int& nPro
|
||||
vdPar[5] = ReadProcessChild( process, "DepthOppSide", vdPar[5]) ; // P12
|
||||
vdPar[6] = ReadProcessChild( process, "Length", vdPar[6]) ; // P13
|
||||
vdPar[7] = ReadProcessChild( process, "DrillHoleDiam1", vdPar[7]) ; // P14
|
||||
vdPar[8] = ReadProcessChild( process, "DrillHoleDiam2", vdPar[8]) ; // P15
|
||||
|
||||
vdPar[8] = ReadProcessChild( process, "DrillHoleDiam2", vdPar[8]) ; // P15
|
||||
|
||||
string sScarfShape = process.child( "ScarfShape").text().get() ; // P09
|
||||
if ( sScarfShape == "classic")
|
||||
@@ -1337,7 +1340,7 @@ ImportBtlx::ReadStepJointParams( pugi::xml_node process, int& nGroup, int& nProc
|
||||
{
|
||||
// Identifico il processo con sigle usate nel btl
|
||||
nProc = 80 ;
|
||||
if ( process.attribute( "ReferencePlaneID") == nullptr){
|
||||
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1350,7 +1353,7 @@ ImportBtlx::ReadStepJointParams( pugi::xml_node process, int& nGroup, int& nProc
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
@@ -1389,7 +1392,7 @@ ImportBtlx::ReadStepJointNotchParams( pugi::xml_node process, int& nGroup, int&
|
||||
{
|
||||
// Identifico il processo con sigle usate nel btl
|
||||
nProc = 80 ;
|
||||
if ( process.attribute( "ReferencePlaneID") == nullptr){
|
||||
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1402,7 +1405,7 @@ ImportBtlx::ReadStepJointNotchParams( pugi::xml_node process, int& nGroup, int&
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
@@ -1447,7 +1450,7 @@ ImportBtlx::ReadPlaningParams( pugi::xml_node process, int& nGroup, int& nProc,
|
||||
{
|
||||
// Identifico il processo con sigle usate nel btl
|
||||
nProc = 90 ;
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
nSide = BTL_SIDE_FRONT ;
|
||||
nGroup = 4 ;
|
||||
|
||||
// Inizializzo i vettori dei parametri
|
||||
@@ -1486,7 +1489,7 @@ ImportBtlx::ReadProfileFrontParams( pugi::xml_node process, int& nGroup, int& nP
|
||||
nProc = 100 ;
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
nGroup = GetGroup34( process) ;
|
||||
if ( nGroup == -1 ) {
|
||||
if ( nGroup == -1) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: ProfileFront orientation unknwon") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1523,14 +1526,14 @@ ImportBtlx::ReadProfileCamberedParams( pugi::xml_node process, int& nGroup, int&
|
||||
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
nGroup = GetGroup34( process) ;
|
||||
if ( nGroup == -1 ) {
|
||||
if ( nGroup == -1) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: ProfileCambered orientation unknwon") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
@@ -1547,7 +1550,6 @@ ImportBtlx::ReadProfileCamberedParams( pugi::xml_node process, int& nGroup, int&
|
||||
vdPar[4] = Clamp( ReadProcessChild( process, "MinDepth", vdPar[4]), 0.0, 1000.0) ; // P13
|
||||
vdPar[5] = Clamp( ReadProcessChild( process, "EndDepth", vdPar[5]), 0.0, 1000.0) ; // P14
|
||||
|
||||
|
||||
string sPremill = process.child( "Premill").text().get() ; // P15
|
||||
if ( sPremill == "round")
|
||||
vdPar[6] = 0 ;
|
||||
@@ -1587,6 +1589,10 @@ ImportBtlx::ReadRoundArchParams( pugi::xml_node process, int& nGroup, int& nProc
|
||||
vdPar[1] = Clamp( ReadProcessChild( process, "Camber", vdPar[1]), 0.0, 1000.0) ; // P11
|
||||
vdPar[2] = ReadProcessChild( process, "Length", vdPar[2]) ; // P12
|
||||
|
||||
string sArcShape = process.child( "ArcShape").text().get() ;
|
||||
if ( sArcShape == "convex")
|
||||
vdPar[1] = -vdPar[1] ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -1599,7 +1605,7 @@ ImportBtlx::ReadProfileHeadParams( pugi::xml_node process, int& nGroup, int& nPr
|
||||
nProc = 106 ;
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
nGroup = GetGroup34( process) ;
|
||||
if ( nGroup == -1 ) {
|
||||
if ( nGroup == -1) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: ProfileHead orientation unknwon") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1687,14 +1693,14 @@ ImportBtlx::ReadSphereParams( pugi::xml_node process, int& nGroup, int& nProc, i
|
||||
nProc = 107 ;
|
||||
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
||||
nGroup = GetGroup34( process) ;
|
||||
if ( nGroup == -1 ) {
|
||||
if ( nGroup == -1) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Sphere orientation unknwon") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
@@ -1726,7 +1732,7 @@ ImportBtlx::ReadTriangleCutParams( pugi::xml_node process, int& nGroup, int& nPr
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
@@ -1817,7 +1823,7 @@ ImportBtlx::ReadTyroleanDovetailParams( pugi::xml_node process, int& nGroup, int
|
||||
vdPar[4] = -1 ;
|
||||
else if ( sLapExit == "rebate") {
|
||||
if ( process.child( "RebateLength") != nullptr)
|
||||
vdPar[4] = std::stod( process.child( "RebateLength").text().get()) ;
|
||||
FromString( process.child( "RebateLength").text().get(), vdPar[4]) ;
|
||||
else
|
||||
vdPar[4] = 10.0 ; // valore di default
|
||||
}
|
||||
@@ -1864,13 +1870,13 @@ ImportBtlx::ReadDovetailParams( pugi::xml_node process, int& nGroup, int& nProc,
|
||||
if ( sCutOff.empty())
|
||||
sCutOff = "no" ; // se non ci fosse, valore di default
|
||||
|
||||
if( sOrientation == "end" && sCutOff == "yes")
|
||||
if( sOrientation == "end" && sCutOff == "yes")
|
||||
nGroup = 1 ;
|
||||
else if (sOrientation == "start" && sCutOff == "yes")
|
||||
else if ( sOrientation == "start" && sCutOff == "yes")
|
||||
nGroup = 2 ;
|
||||
else if (sOrientation == "end" && sCutOff == "no")
|
||||
else if ( sOrientation == "end" && sCutOff == "no")
|
||||
nGroup = 3 ;
|
||||
else if (sOrientation == "start" && sCutOff == "yes")
|
||||
else if ( sOrientation == "start" && sCutOff == "yes")
|
||||
nGroup = 4 ;
|
||||
else {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Dovetail group not defined") ;
|
||||
@@ -1879,7 +1885,7 @@ ImportBtlx::ReadDovetailParams( pugi::xml_node process, int& nGroup, int& nProc,
|
||||
|
||||
// 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 ;
|
||||
}
|
||||
@@ -1924,7 +1930,7 @@ ImportBtlx::ReadDovetailParams( pugi::xml_node process, int& nGroup, int& nProc,
|
||||
vdPar[4] = -1 ;
|
||||
else if ( sLapExit == "rebate") {
|
||||
if ( process.child( "RebateLength") != nullptr)
|
||||
vdPar[4] = std::stod( process.child( "RebateLength").text().get()) ;
|
||||
FromString( process.child( "RebateLength").text().get(), vdPar[4]) ;
|
||||
else
|
||||
vdPar[4] = 10.0 ; // valore di default
|
||||
}
|
||||
@@ -1982,14 +1988,14 @@ ImportBtlx::ReadFreeContourParams( pugi::xml_node process, const STRVECTOR& vsUA
|
||||
// scrorro i contours
|
||||
for ( pugi::xml_node_iterator it = process.begin() ; it != process.end() ; it ++) {
|
||||
|
||||
string itName = it->name() ;
|
||||
string sName = it->name() ;
|
||||
bool bContOk = true ;
|
||||
if ( itName == "Contour") {
|
||||
if ( sName == "Contour") {
|
||||
bContOk = ReadSContourParams( *it, 0, 0, nGroup, nProc, nSide, bCounterSink, nCrvCnt, vsUAtt) ;
|
||||
if ( ! bContOk)
|
||||
return false ;
|
||||
}
|
||||
else if ( itName == "DualContour") {
|
||||
else if ( sName == "DualContour") {
|
||||
bContOk = ReadDContourParams( *it, nGroup, nProc, nSide, bCounterSink, nCrvCnt, vsUAtt) ;
|
||||
if ( ! bContOk)
|
||||
return false ;
|
||||
@@ -2018,7 +2024,7 @@ ImportBtlx::ReadSContourParams( pugi::xml_node process, int nType, int nOtherId,
|
||||
}
|
||||
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()) ;
|
||||
LOG_ERROR( GetEExLogger(), ( " Error reading Part Process: FreeContour User Reference Plane " + to_string( nSide) + " is not valid").c_str()) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -2206,17 +2212,20 @@ GetGroup34( const pugi::xml_node& process)
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
double
|
||||
ReadProcessChild( const pugi::xml_node& process, const string& sChild, const double& dVal)
|
||||
ReadProcessChild( const pugi::xml_node& process, const string& sChild, double dVal)
|
||||
{
|
||||
if ( process.child( sChild.c_str()) != nullptr && process.child( sChild.c_str()).text().get() != '\0')
|
||||
return std::stod( process.child( sChild.c_str()).text().get()) ;
|
||||
if ( process.child( sChild.c_str()) != nullptr && process.child( sChild.c_str()).text().get() != nullptr) {
|
||||
double dRes = dVal ;
|
||||
FromString( process.child( sChild.c_str()).text().get(), dRes) ;
|
||||
return dRes ;
|
||||
}
|
||||
else
|
||||
return dVal ;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
double
|
||||
ReadProcessChildAttribute( const pugi::xml_node& process, const string& sChild, const string& sAttribute, const double& dVal)
|
||||
ReadProcessChildAttribute( const pugi::xml_node& process, const string& sChild, const string& sAttribute, double dVal)
|
||||
{
|
||||
if ( process.child( sChild.c_str()) != nullptr && process.child( sChild.c_str()).attribute( sAttribute.c_str()) != nullptr)
|
||||
return process.child( sChild.c_str()).attribute( sAttribute.c_str()).as_double() ;
|
||||
@@ -2259,7 +2268,7 @@ ReadProcessChildYesNo( const pugi::xml_node& process, const string& sChild, cons
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
double
|
||||
ReadProcessChildYesNoToDouble( const pugi::xml_node& process, const string& sChild1, const string& sDefaultOpt, const string& sChild2,
|
||||
const double& nDefaultVal)
|
||||
double nDefaultVal)
|
||||
{
|
||||
string sValue = process.child( sChild1.c_str()).text().get() ;
|
||||
if ( sValue == sDefaultOpt || sValue.empty() || ( sValue != "no" && sValue != "yes"))
|
||||
@@ -2270,96 +2279,96 @@ ReadProcessChildYesNoToDouble( const pugi::xml_node& process, const string& sChi
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------------------------
|
||||
int
|
||||
ComputeP04( const STRVECTOR& values)
|
||||
ComputeP04( const STRVECTOR& vsValues)
|
||||
{
|
||||
if ( values.size() > 6 || values.empty()) {
|
||||
if ( vsValues.size() > 6 || vsValues.empty()) {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: P04 is not valid") ;
|
||||
return -2 ;
|
||||
}
|
||||
|
||||
int result = 0 ;
|
||||
for ( size_t i = 0 ; i < values.size() ; i ++) {
|
||||
if ( values[i] == "no")
|
||||
result += static_cast<int>( pow( 2, i)) ;
|
||||
else if ( values[i] != "yes") {
|
||||
int nResult = 0 ;
|
||||
for ( int i = 0 ; i < ssize( vsValues) ; i ++) {
|
||||
if ( vsValues[i] == "no")
|
||||
nResult += int( Pow( 2, i)) ;
|
||||
else if ( vsValues[i] != "yes") {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: MachiningLimit value is not valid") ;
|
||||
return -2 ;
|
||||
}
|
||||
}
|
||||
|
||||
return result ;
|
||||
return nResult ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------------------------
|
||||
int
|
||||
ComputeP04( const pugi::xml_node& MachiningLimits)
|
||||
{
|
||||
string FaceLimitedStart = "yes" ;
|
||||
string sFaceLimitedStart = "yes" ;
|
||||
if ( MachiningLimits.attribute( "FaceLimitedStart") != nullptr)
|
||||
FaceLimitedStart = MachiningLimits.attribute( "FaceLimitedStart").value() ;
|
||||
sFaceLimitedStart = MachiningLimits.attribute( "FaceLimitedStart").value() ;
|
||||
|
||||
string FaceLimitedEnd = "yes" ;
|
||||
string sFaceLimitedEnd = "yes" ;
|
||||
if ( MachiningLimits.attribute( "FaceLimitedEnd") != nullptr)
|
||||
FaceLimitedEnd = MachiningLimits.attribute( "FaceLimitedEnd").value() ;
|
||||
sFaceLimitedEnd = MachiningLimits.attribute( "FaceLimitedEnd").value() ;
|
||||
|
||||
string FaceLimitedFront = "yes" ;
|
||||
string sFaceLimitedFront = "yes" ;
|
||||
if ( MachiningLimits.attribute( "FaceLimitedFront") != nullptr)
|
||||
FaceLimitedFront = MachiningLimits.attribute( "FaceLimitedFront").value() ;
|
||||
sFaceLimitedFront = MachiningLimits.attribute( "FaceLimitedFront").value() ;
|
||||
|
||||
string FaceLimitedBack = "yes" ;
|
||||
string sFaceLimitedBack = "yes" ;
|
||||
if ( MachiningLimits.attribute( "FaceLimitedBack") != nullptr)
|
||||
FaceLimitedBack = MachiningLimits.attribute( "FaceLimitedBack").value() ;
|
||||
sFaceLimitedBack = MachiningLimits.attribute( "FaceLimitedBack").value() ;
|
||||
|
||||
string FaceLimitedBottom = "yes" ;
|
||||
string sFaceLimitedBottom = "yes" ;
|
||||
if ( MachiningLimits.attribute( "FaceLimitedBottom") != nullptr)
|
||||
FaceLimitedBottom = MachiningLimits.attribute( "FaceLimitedBottom").value() ;
|
||||
sFaceLimitedBottom = MachiningLimits.attribute( "FaceLimitedBottom").value() ;
|
||||
|
||||
string FaceLimitedTop = "no" ;
|
||||
string sFaceLimitedTop = "no" ;
|
||||
if ( MachiningLimits.attribute( "FaceLimitedTop") != nullptr)
|
||||
FaceLimitedTop = MachiningLimits.attribute( "FaceLimitedTop").value() ;
|
||||
sFaceLimitedTop = MachiningLimits.attribute( "FaceLimitedTop").value() ;
|
||||
|
||||
int result = 0 ;
|
||||
if ( FaceLimitedStart == "no")
|
||||
result += 1 ;
|
||||
else if ( FaceLimitedStart != "yes") {
|
||||
int nResult = 0 ;
|
||||
if ( sFaceLimitedStart == "no")
|
||||
nResult += 1 ;
|
||||
else if ( sFaceLimitedStart != "yes") {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: MachiningLimit is not valid") ;
|
||||
return -2 ;
|
||||
}
|
||||
|
||||
if ( FaceLimitedEnd == "no")
|
||||
result += 2 ;
|
||||
else if ( FaceLimitedEnd != "yes") {
|
||||
if ( sFaceLimitedEnd == "no")
|
||||
nResult += 2 ;
|
||||
else if ( sFaceLimitedEnd != "yes") {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: MachiningLimit is not valid") ;
|
||||
return -2 ;
|
||||
}
|
||||
|
||||
if ( FaceLimitedFront == "no")
|
||||
result += 4 ;
|
||||
else if ( FaceLimitedFront != "yes") {
|
||||
if ( sFaceLimitedFront == "no")
|
||||
nResult += 4 ;
|
||||
else if ( sFaceLimitedFront != "yes") {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: MachiningLimit is not valid") ;
|
||||
return -2 ;
|
||||
}
|
||||
|
||||
if ( FaceLimitedBack == "no")
|
||||
result += 8 ;
|
||||
else if ( FaceLimitedBack != "yes") {
|
||||
if ( sFaceLimitedBack == "no")
|
||||
nResult += 8 ;
|
||||
else if ( sFaceLimitedBack != "yes") {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: MachiningLimit is not valid") ;
|
||||
return -2 ;
|
||||
}
|
||||
|
||||
if ( FaceLimitedBottom == "no")
|
||||
result += 16 ;
|
||||
else if ( FaceLimitedBottom != "yes") {
|
||||
if ( sFaceLimitedBottom == "no")
|
||||
nResult += 16 ;
|
||||
else if ( sFaceLimitedBottom != "yes") {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: MachiningLimit is not valid") ;
|
||||
return -2 ;
|
||||
}
|
||||
|
||||
if ( FaceLimitedTop == "no")
|
||||
result += 32 ;
|
||||
else if ( FaceLimitedTop != "yes") {
|
||||
if ( sFaceLimitedTop == "no")
|
||||
nResult += 32 ;
|
||||
else if ( sFaceLimitedTop != "yes") {
|
||||
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: MachiningLimit is not valid") ;
|
||||
return -2 ;
|
||||
}
|
||||
|
||||
return result ;
|
||||
return nResult ;
|
||||
}
|
||||
|
||||
+56
-8
@@ -25,8 +25,6 @@
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkArcSpecial.h"
|
||||
#include "/EgtDEv/Include/EGnScanner.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
@@ -43,6 +41,7 @@ static const string KEY_EXIT = "EXIT" ;
|
||||
static const string KEY_TPOS = "TPOS" ;
|
||||
static const string KEY_TPOS2 = "TPOS2" ;
|
||||
static const string KEY_SPEED = "SPEED" ;
|
||||
static const string KEY_FEED = "FEED" ;
|
||||
static const string KEY_ROTAX_A = "A" ;
|
||||
static const string KEY_ROTAX_B = "B" ;
|
||||
static const string KEY_ROTAX_C = "C" ;
|
||||
@@ -125,6 +124,7 @@ ImportCnc::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup, int nFlag)
|
||||
m_colCurr = BLACK ;
|
||||
m_sToolName.clear() ;
|
||||
m_nExit = 1 ;
|
||||
m_dFeed = 0 ;
|
||||
|
||||
// se estensione xpi è NUM
|
||||
string sFileTitle, sFileExt ;
|
||||
@@ -171,7 +171,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] == '!' || sLine.starts_with( "MSG"))
|
||||
return true ;
|
||||
|
||||
// eliminazione di commenti intermedi o finali
|
||||
@@ -179,6 +179,8 @@ ImportCnc::ProcessLine( const string& sLine)
|
||||
// se controllo OSAI elimino le parti dopo ;
|
||||
if ( m_nCNC == CNC_OSAI) {
|
||||
size_t nStart = sMyLine.find( ';') ;
|
||||
if ( nStart == string::npos)
|
||||
nStart = sMyLine.find( "@") ;
|
||||
if ( nStart != string::npos)
|
||||
sMyLine.erase( nStart) ;
|
||||
}
|
||||
@@ -193,13 +195,21 @@ ImportCnc::ProcessLine( const string& sLine)
|
||||
sMyLine.erase( nStart) ;
|
||||
}
|
||||
}
|
||||
// se controllo SIEMENS elimino i cicli 800 e 832
|
||||
// se controllo SIEMENS elimino alcuni comandi speciali ed effettuo conversioni o salti
|
||||
else if ( m_nCNC == CNC_SIEMENS) {
|
||||
if ( sMyLine.starts_with( "ID"))
|
||||
return true ;
|
||||
if ( sMyLine.starts_with( "DYN"))
|
||||
return true ;
|
||||
size_t nStart = sMyLine.find( "CYCLE800") ;
|
||||
if ( nStart == string::npos)
|
||||
nStart = sMyLine.find( "CYCLE832") ;
|
||||
if ( nStart == string::npos)
|
||||
nStart = sMyLine.find( "/WHEN") ;
|
||||
if ( nStart != string::npos)
|
||||
sMyLine.erase( nStart) ;
|
||||
ReplaceString( sMyLine, "SUPA", "G79") ;
|
||||
ReplaceString( sMyLine, "AC(", "") ;
|
||||
}
|
||||
|
||||
// divido la linea in parti
|
||||
@@ -207,7 +217,7 @@ ImportCnc::ProcessLine( const string& sLine)
|
||||
TokenizePlus( sMyLine, "NGXYZIJKPQRUVWABCFTMHhDEL", vsTokens) ;
|
||||
|
||||
// analizzo ogni singola parte
|
||||
for ( size_t i = 0 ; i < vsTokens.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( vsTokens) ; ++ i) {
|
||||
// analizzo per categorie determinate dal primo carattere del token
|
||||
switch ( vsTokens[i][0]) {
|
||||
case 'G' :
|
||||
@@ -252,6 +262,9 @@ ImportCnc::ProcessLine( const string& sLine)
|
||||
case 'T' :
|
||||
ParseT( vsTokens[i]) ;
|
||||
break ;
|
||||
case 'F' :
|
||||
ParseF( vsTokens[i]) ;
|
||||
break ;
|
||||
case 'M' :
|
||||
ParseM( vsTokens[i]) ;
|
||||
break ;
|
||||
@@ -274,8 +287,11 @@ ImportCnc::ProcessLine( const string& sLine)
|
||||
// se utensile da caricare
|
||||
if ( m_bLoadTool)
|
||||
m_nTool = m_nNextTool ;
|
||||
// se comando da ignorare
|
||||
if ( m_nCommand == SKIP)
|
||||
;
|
||||
// se comando di movimento o riconosciuto movimento, lo eseguo
|
||||
if ( m_nCommand == MOVE || m_bToMove)
|
||||
else if ( m_nCommand == MOVE || m_bToMove)
|
||||
bOk = ExecMovement() ;
|
||||
// se comando di impostazione piano di interpolazione
|
||||
else if ( m_nCommand == IPL)
|
||||
@@ -363,7 +379,8 @@ ImportCnc::ParseRemark( const string& sLine)
|
||||
if ( iExit == string::npos)
|
||||
iExit = sLine.find( "EXIT=") ;
|
||||
if ( iExit != string::npos) {
|
||||
FromString( sLine.substr( iExit + 5), m_nExit) ;
|
||||
if ( ! FromString( sLine.substr( iExit + 5), m_nExit))
|
||||
m_nExit = 0 ;
|
||||
return true ;
|
||||
}
|
||||
// cerco indicazione posizione nel TC
|
||||
@@ -435,6 +452,9 @@ ImportCnc::ParseG( const string& sToken)
|
||||
m_nCommand = MOVE ;
|
||||
m_nMoveType = ARC_CCW ;
|
||||
break ;
|
||||
case 4 :
|
||||
m_nCommand = SKIP ;
|
||||
break ;
|
||||
case 14 :
|
||||
m_nCommand = MOVE ;
|
||||
m_nMoveType = ARC_MID_3D ;
|
||||
@@ -523,6 +543,8 @@ ImportCnc::ParseX( const string& sToken)
|
||||
case OFFS :
|
||||
m_vtOffs.x = dVal ;
|
||||
break ;
|
||||
case SKIP :
|
||||
break ;
|
||||
default :
|
||||
if ( m_bZeroMach)
|
||||
m_ptNext.x = m_ptHome.x + dVal ;
|
||||
@@ -550,6 +572,8 @@ ImportCnc::ParseY( const string& sToken)
|
||||
case OFFS :
|
||||
m_vtOffs.y = dVal ;
|
||||
break ;
|
||||
case SKIP :
|
||||
break ;
|
||||
default :
|
||||
if ( m_bZeroMach)
|
||||
m_ptNext.y = m_ptHome.y + dVal ;
|
||||
@@ -577,6 +601,8 @@ ImportCnc::ParseZ( const string& sToken)
|
||||
case OFFS :
|
||||
m_vtOffs.z = dVal ;
|
||||
break ;
|
||||
case SKIP :
|
||||
break ;
|
||||
default :
|
||||
if ( m_bZeroMach)
|
||||
m_ptNext.z = m_ptHome.z + dVal ;
|
||||
@@ -630,7 +656,6 @@ ImportCnc::ParseJ( const string& sToken)
|
||||
case ZX : m_ptCen.x = dVal ; break ;
|
||||
}
|
||||
}
|
||||
|
||||
m_nArcType = CENTER ;
|
||||
m_bToMove = true ;
|
||||
return true ;
|
||||
@@ -771,6 +796,17 @@ ImportCnc::ParseT( const string& sToken)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportCnc::ParseF( const string& sToken)
|
||||
{
|
||||
double dVal ;
|
||||
int nStart = ( sToken[1] == '=' ? 2 : 1) ;
|
||||
if ( FromString( sToken.substr( nStart), dVal))
|
||||
m_dFeed = dVal ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportCnc::ParseM( const string& sToken)
|
||||
@@ -903,6 +939,9 @@ ImportCnc::AddPoint( int nPntType)
|
||||
m_pGDB->SetInfo( nId, KEY_ROTAX_B, m_dRotAxB) ;
|
||||
if ( ! isnan( m_dRotAxC))
|
||||
m_pGDB->SetInfo( nId, KEY_ROTAX_C, m_dRotAxC) ;
|
||||
// assegnazione eventuale Feed
|
||||
if ( nPntType == P_PNT && abs( m_dFeed) > 0.1)
|
||||
m_pGDB->SetInfo( nId, KEY_FEED, m_dFeed) ;
|
||||
// assegnazione eventuali info
|
||||
SetInfos( nId) ;
|
||||
m_vInfos.clear() ;
|
||||
@@ -962,6 +1001,9 @@ ImportCnc::AddLine( int nLineType)
|
||||
m_pGDB->SetInfo( nId, KEY_ROTAX_B, m_dRotAxB) ;
|
||||
if ( ! isnan( m_dRotAxC))
|
||||
m_pGDB->SetInfo( nId, KEY_ROTAX_C, m_dRotAxC) ;
|
||||
// assegnazione eventuale Feed
|
||||
if ( nLineType == L_LINE && abs( m_dFeed) > 0.1)
|
||||
m_pGDB->SetInfo( nId, KEY_FEED, m_dFeed) ;
|
||||
// assegnazione eventuali info
|
||||
SetInfos( nId) ;
|
||||
m_vInfos.clear() ;
|
||||
@@ -1053,6 +1095,9 @@ ImportCnc::AddArc( bool bCCW)
|
||||
m_pGDB->SetInfo( nId, KEY_ROTAX_B, m_dRotAxB) ;
|
||||
if ( ! isnan( m_dRotAxC))
|
||||
m_pGDB->SetInfo( nId, KEY_ROTAX_C, m_dRotAxC) ;
|
||||
// assegnazione eventuale Feed
|
||||
if ( abs( m_dFeed) > 0.1)
|
||||
m_pGDB->SetInfo( nId, KEY_FEED, m_dFeed) ;
|
||||
// assegnazione eventuali info
|
||||
SetInfos( nId) ;
|
||||
m_vInfos.clear() ;
|
||||
@@ -1119,6 +1164,9 @@ ImportCnc::AddArc3P( bool bIs2D)
|
||||
m_pGDB->SetInfo( nId, KEY_ROTAX_B, m_dRotAxB) ;
|
||||
if ( ! isnan( m_dRotAxC))
|
||||
m_pGDB->SetInfo( nId, KEY_ROTAX_C, m_dRotAxC) ;
|
||||
// assegnazione eventuale Feed
|
||||
if ( abs( m_dFeed) > 0.1)
|
||||
m_pGDB->SetInfo( nId, KEY_FEED, m_dFeed) ;
|
||||
// assegnazione eventuali info
|
||||
SetInfos( nId) ;
|
||||
m_vInfos.clear() ;
|
||||
|
||||
+3
-1
@@ -42,6 +42,7 @@ class ImportCnc : public IImportCnc
|
||||
bool ParseB( const std::string& sToken) ;
|
||||
bool ParseC( const std::string& sToken) ;
|
||||
bool ParseT( const std::string& sToken) ;
|
||||
bool ParseF( const std::string& sToken) ;
|
||||
bool ParseM( const std::string& sToken) ;
|
||||
bool ParseH( const std::string& sToken) ;
|
||||
bool ExecSetIPL( void) ;
|
||||
@@ -73,7 +74,7 @@ class ImportCnc : public IImportCnc
|
||||
private :
|
||||
enum CncName { CNC_STD = 0, CNC_OSAI = 1, CNC_FANUC = 2, CNC_NUM = 3, CNC_SIEMENS = 4, CNC_TPA = 5, CNC_MAZAK = 6, CNC_FAGOR} ;
|
||||
enum InterpPl { XY = 1, YZ = 2, ZX = 3} ;
|
||||
enum Command { NO_CMD = 0, MOVE = 1, IPL = 2, OFFS = 3} ;
|
||||
enum Command { NO_CMD = 0, MOVE = 1, IPL = 2, OFFS = 3, SKIP = 4} ;
|
||||
enum MoveType { RAPID = 0, LINE = 1, ARC_CW = 2, ARC_CCW = 3, ARC_MID_2D = 4, ARC_MID_3D = 5} ;
|
||||
enum PntType { P_RAPID = 0, P_PNT = 1, P_ERROR = 2} ;
|
||||
enum LineType { L_RAPID = 0, L_LINE = 1, L_ERROR = 2} ;
|
||||
@@ -125,5 +126,6 @@ class ImportCnc : public IImportCnc
|
||||
std::string m_sToolPos ;
|
||||
std::string m_sToolPos2 ;
|
||||
std::string m_sSpeed ;
|
||||
double m_dFeed ;
|
||||
STRVECTOR m_vInfos ;
|
||||
} ;
|
||||
|
||||
+1
-3
@@ -25,8 +25,6 @@
|
||||
#include "/EgtDev/Include/EGkExtText.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include <fstream>
|
||||
@@ -599,7 +597,7 @@ ImportCsf::ProcessExtendedText( const CsfEnt& csfEnt)
|
||||
}
|
||||
// salvataggio testo con un punto di inserimento per ogni carattere
|
||||
else if ( etData.sText.size() == etData.vPnt.size()) {
|
||||
for ( size_t i = 0 ; i < etData.sText.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( etData.sText) ; ++ i) {
|
||||
// creo il testo
|
||||
PtrOwner<IExtText> pTxt( CreateExtText()) ;
|
||||
if ( IsNull( pTxt))
|
||||
|
||||
@@ -19,12 +19,9 @@
|
||||
#include "/EgtDev/Include/EExDllMain.h"
|
||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IImportDxf*
|
||||
CreateImportDxf( void)
|
||||
|
||||
+25
-17
@@ -398,9 +398,9 @@ bool
|
||||
ImportDxf::ReadArc( bool& bFileEnd)
|
||||
{
|
||||
Point3d ptCen ;
|
||||
double dRadius ;
|
||||
double dStartAng ;
|
||||
double dEndAng ;
|
||||
double dRadius = 0 ;
|
||||
double dStartAng = 0 ;
|
||||
double dEndAng = 0 ;
|
||||
Vector3d vtExtr = Z_AX ;
|
||||
double dThick = 0 ;
|
||||
string sLayer ;
|
||||
@@ -529,7 +529,7 @@ bool
|
||||
ImportDxf::ReadCircle( bool& bFileEnd)
|
||||
{
|
||||
Point3d ptCen ;
|
||||
double dRadius ;
|
||||
double dRadius = 0 ;
|
||||
Vector3d vtExtr = Z_AX ;
|
||||
double dThick = 0 ;
|
||||
string sLayer ;
|
||||
@@ -2146,47 +2146,55 @@ ImportDxf::ReadSpline( bool& bFileEnd)
|
||||
sLayer = m_sCurrItem ;
|
||||
break ;
|
||||
case 10 :
|
||||
FromString( m_sCurrItem, ptP.x) ;
|
||||
if ( ! FromString( m_sCurrItem, ptP.x))
|
||||
ptP.x = 0 ;
|
||||
++ nContX ;
|
||||
if ( nContX == nContY && nContY == nContZ)
|
||||
cnData.vCP.push_back( ptP) ;
|
||||
break ;
|
||||
case 20 :
|
||||
FromString( m_sCurrItem, ptP.y) ;
|
||||
if ( ! FromString( m_sCurrItem, ptP.y))
|
||||
ptP.y = 0 ;
|
||||
++ nContY ;
|
||||
if ( nContX == nContY && nContY == nContZ)
|
||||
cnData.vCP.push_back( ptP) ;
|
||||
break ;
|
||||
case 30 :
|
||||
FromString( m_sCurrItem, ptP.z) ;
|
||||
if ( ! FromString( m_sCurrItem, ptP.z))
|
||||
ptP.z = 0 ;
|
||||
++ nContZ ;
|
||||
if ( nContX == nContY && nContY == nContZ)
|
||||
cnData.vCP.push_back( ptP) ;
|
||||
break ;
|
||||
case 11 :
|
||||
FromString( m_sCurrItem, ptInt.x) ;
|
||||
if ( ! FromString( m_sCurrItem, ptInt.x))
|
||||
ptInt.x = 0 ;
|
||||
++ nIntX ;
|
||||
if ( nIntX == nIntY && nIntY == nIntZ)
|
||||
vIntPnt.push_back( ptInt) ;
|
||||
break ;
|
||||
case 21 :
|
||||
FromString( m_sCurrItem, ptInt.y) ;
|
||||
if ( ! FromString( m_sCurrItem, ptInt.y))
|
||||
ptInt.y = 0 ;
|
||||
++ nIntY ;
|
||||
if ( nIntX == nIntY && nIntY == nIntZ)
|
||||
vIntPnt.push_back( ptInt) ;
|
||||
break ;
|
||||
case 31 :
|
||||
FromString( m_sCurrItem, ptInt.z) ;
|
||||
if ( ! FromString( m_sCurrItem, ptInt.z))
|
||||
ptInt.z = 0 ;
|
||||
++ nIntZ ;
|
||||
if ( nIntX == nIntY && nIntY == nIntZ)
|
||||
vIntPnt.push_back( ptInt) ;
|
||||
break ;
|
||||
case 40 :
|
||||
FromString( m_sCurrItem, dTemp) ;
|
||||
if ( ! FromString( m_sCurrItem, dTemp))
|
||||
dTemp = 0 ;
|
||||
cnData.vU.push_back( dTemp) ;
|
||||
break;
|
||||
case 41 :
|
||||
FromString( m_sCurrItem, dTemp) ;
|
||||
if ( ! FromString( m_sCurrItem, dTemp))
|
||||
dTemp = 0 ;
|
||||
cnData.vW.push_back( dTemp) ;
|
||||
break;
|
||||
case 60 :
|
||||
@@ -2302,7 +2310,7 @@ ImportDxf::ReadText( int nGroupId, bool& bFileEnd)
|
||||
string sText ;
|
||||
string sLayer ;
|
||||
string sStyle = "STANDARD" ;
|
||||
double dH ;
|
||||
double dH = 0 ;
|
||||
double dAngDeg = 0 ;
|
||||
double dRat = 1 ;
|
||||
int nSpace = ENT_MODELSPACE ;
|
||||
@@ -2500,7 +2508,7 @@ ImportDxf::ReadMText( bool& bFileEnd)
|
||||
string sText ;
|
||||
string sLayer ;
|
||||
string sStyle = "STANDARD" ;
|
||||
double dH ;
|
||||
double dH = 0 ;
|
||||
double dTextMaxWidth = 0 ;
|
||||
double dAngRad = 0 ;
|
||||
int nInsPos = ETXT_IPBL ;
|
||||
@@ -2687,16 +2695,16 @@ ImportDxf::AdjustMText( string& sText, double dTextMaxWidth, double dW)
|
||||
// coefficiente empirico che in generale migliora l'adattamento
|
||||
const double COEFF_LARGH = 1.2 ;
|
||||
// gestione max lunghezza riga di testo
|
||||
size_t nLastSp = - 1 ;
|
||||
int nLastSp = -1 ;
|
||||
double dCurrWidth = 0 ;
|
||||
for ( size_t i = 0 ; i < sText.size() ; ++ i) {
|
||||
for ( int i = 0 ; i < ssize( sText) ; ++ i) {
|
||||
// posso dividere solo sugli spazi
|
||||
if ( sText[i] == ' ')
|
||||
nLastSp = i ;
|
||||
// se c'è già un a capo
|
||||
if ( sText[i] == '\n') {
|
||||
dCurrWidth = 0 ;
|
||||
nLastSp = - 1 ;
|
||||
nLastSp = -1 ;
|
||||
}
|
||||
// se supera il limite
|
||||
else if ( dCurrWidth > COEFF_LARGH * dTextMaxWidth) {
|
||||
|
||||
+206
@@ -0,0 +1,206 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2024-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ImportOff.cpp Data : 28.11.24 Versione : 2.6k2
|
||||
// Contenuto : Implementazione della classe per l'importazione di OFF.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 28.11.24 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "ImportOff.h"
|
||||
#include "DllMain.h"
|
||||
#include "/EgtDev/Include/EExDllMain.h"
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IImportOff*
|
||||
CreateImportOff( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImportOff*> ( new( nothrow) ImportOff) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportOff::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup, double dScaleFactor)
|
||||
{
|
||||
// verifico il DB geometrico
|
||||
if ( pGDB == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), "ImportOff : Error on GeomDB")
|
||||
return false ;
|
||||
}
|
||||
m_pGDB = pGDB ;
|
||||
|
||||
// verifico l'Id di gruppo
|
||||
if ( ! m_pGDB->ExistsObj( nIdGroup)) {
|
||||
LOG_ERROR( GetEExLogger(), "ImportOff : Error on IdGroup")
|
||||
return false ;
|
||||
}
|
||||
m_nIdGroup = nIdGroup ;
|
||||
|
||||
// verifico il fattore di scala
|
||||
if ( dScaleFactor < EPS_SMALL) {
|
||||
LOG_ERROR( GetEExLogger(), "ImportOff : Error on ScaleFactor too small (minimum 0.001).")
|
||||
return false ;
|
||||
}
|
||||
m_dScaleFactor = dScaleFactor ;
|
||||
|
||||
// inizializzo lo scanner
|
||||
if ( ! m_theScanner.Init( sFile, "#")) {
|
||||
LOG_ERROR( GetEExLogger(), "ImportOff : Error on Init")
|
||||
return false ;
|
||||
}
|
||||
|
||||
// lettura intestazione
|
||||
if ( ! ReadData()) {
|
||||
string sOut = " ImportOff : Error in ReadData on line " + ToString( m_theScanner.GetCurrLineNbr()) ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportOff::ReadData( void)
|
||||
{
|
||||
string sLine ;
|
||||
|
||||
// Intestazione opzionale OFF
|
||||
if ( ! m_theScanner.GetLine( sLine))
|
||||
return false ;
|
||||
bool bOFF = ( sLine.find( "OFF") != string::npos) ;
|
||||
|
||||
// Numero di vertici, di facce e di spigoli (ignorato)
|
||||
if ( bOFF && ! m_theScanner.GetLine( sLine))
|
||||
return false ;
|
||||
STRVECTOR vsTok ;
|
||||
Tokenize( sLine, " ", vsTok) ;
|
||||
if ( vsTok.size() < 3)
|
||||
return false ;
|
||||
int nVerts = 0, nFaces = 0 ;
|
||||
if ( ! FromString( vsTok[0], nVerts) || nVerts <= 0 ||
|
||||
! FromString( vsTok[1], nFaces) || nFaces <= 0)
|
||||
return false ;
|
||||
|
||||
// Vettore dei vertici
|
||||
PNTVECTOR vVert( nVerts) ;
|
||||
// lettura dei vertici
|
||||
for ( int i = 0 ; i < nVerts ; ++ i) {
|
||||
if ( ! m_theScanner.GetLine( sLine))
|
||||
return false ;
|
||||
STRVECTOR vsTok ;
|
||||
Tokenize( sLine, " ", vsTok) ;
|
||||
if ( vsTok.size() < 3)
|
||||
return false ;
|
||||
if ( ! FromString( vsTok[0], vVert[i].x) || ! FromString( vsTok[1],vVert[i].y) || ! FromString( vsTok[2], vVert[i].z))
|
||||
return false ;
|
||||
vVert[i] *= m_dScaleFactor ;
|
||||
}
|
||||
|
||||
// Costruttore di trimesh da insieme disordinato di triangoli
|
||||
StmFromTriangleSoup StmFts ;
|
||||
if ( ! StmFts.Start())
|
||||
return false ;
|
||||
// lettura delle facce
|
||||
int nBadFaces = 0 ;
|
||||
for ( int i = 0 ; i < nFaces ; ++ i) {
|
||||
if ( ! m_theScanner.GetLine( sLine))
|
||||
return false ;
|
||||
STRVECTOR vsTok ;
|
||||
Tokenize( sLine, " ", vsTok) ;
|
||||
if ( vsTok.empty())
|
||||
return false ;
|
||||
int nFVs = 0 ;
|
||||
if ( ! FromString( vsTok[0], nFVs) || int( vsTok.size()) < nFVs + 1)
|
||||
return false ;
|
||||
// se triangolo
|
||||
if ( nFVs == 3) {
|
||||
Triangle3d Tria ;
|
||||
for ( int j = 0 ; j < 3 ; ++ j) {
|
||||
int nV = -1 ;
|
||||
if ( ! FromString( vsTok[j+1], nV) || nV < 0 || nV >= nVerts)
|
||||
return false ;
|
||||
Tria.SetP( j, vVert[nV]) ;
|
||||
}
|
||||
if ( Tria.Validate( true)) {
|
||||
if ( ! StmFts.AddTriangle( Tria))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
++ nBadFaces ;
|
||||
}
|
||||
// se quadrilatero
|
||||
else if ( nFVs == 4) {
|
||||
Triangle3d TriaA, TriaB ;
|
||||
for ( int j = 0 ; j < 4 ; ++ j) {
|
||||
int nV = -1 ;
|
||||
if ( ! FromString( vsTok[j+1], nV) || nV < 0 || nV >= nVerts)
|
||||
return false ;
|
||||
if ( j != 3)
|
||||
TriaA.SetP( j, vVert[nV]) ;
|
||||
if ( j != 1)
|
||||
TriaB.SetP( ( j == 0 ? j : j - 1), vVert[nV]) ;
|
||||
}
|
||||
if ( TriaA.Validate( true)) {
|
||||
if ( ! StmFts.AddTriangle( TriaA))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
++ nBadFaces ;
|
||||
if ( TriaB.Validate( true)) {
|
||||
if ( ! StmFts.AddTriangle( TriaB))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
++ nBadFaces ;
|
||||
}
|
||||
// altrimenti poligono generico
|
||||
else {
|
||||
PolyLine PL ;
|
||||
for ( int j = 0 ; j < nFVs ; ++ j) {
|
||||
int nV = -1 ;
|
||||
if ( ! FromString( vsTok[j+1], nV) || nV < 0 || nV >= nVerts)
|
||||
return false ;
|
||||
PL.AddUPoint( j, vVert[nV]) ;
|
||||
}
|
||||
PL.Close() ;
|
||||
PL.FlattenInAutoPlane( 1.) ;
|
||||
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
||||
if ( ! IsNull( pStm) && pStm->CreateByFlatContour( PL)) {
|
||||
if ( ! StmFts.AddSurfTriMesh( *pStm))
|
||||
return false ;
|
||||
}
|
||||
else
|
||||
++ nBadFaces ;
|
||||
}
|
||||
}
|
||||
if ( nBadFaces > 0) {
|
||||
string sOut = " ImportOff : found " + ToString( nBadFaces) + " bad faces" ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
}
|
||||
|
||||
// Valido la superficie e calcolo le adiacenze
|
||||
if ( ! StmFts.End())
|
||||
return false ;
|
||||
// inserisco l'oggetto nel DB geometrico
|
||||
PtrOwner<ISurfTriMesh> pSTM( StmFts.GetSurf()) ;
|
||||
int nIdNew = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, Release( pSTM)) ;
|
||||
if ( nIdNew == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2024-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ImportOff.h Data : 28.11.24 Versione : 2.6k2
|
||||
// Contenuto : Dichiarazione della classe ImportOff.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 28.11.24 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EExImportOff.h"
|
||||
#include "/EgtDEv/Include/EGnScanner.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class ImportOff : public IImportOff
|
||||
{
|
||||
public :
|
||||
virtual bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup, double dScaleFactor = 1) ;
|
||||
|
||||
private :
|
||||
bool ReadData( void) ;
|
||||
|
||||
private :
|
||||
Scanner m_theScanner ;
|
||||
IGeomDB* m_pGDB ;
|
||||
int m_nIdGroup ;
|
||||
double m_dScaleFactor ;
|
||||
} ;
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2025-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ImportPLY.cpp Data : 28.02.25 Versione : 2.7b2
|
||||
// Contenuto : Implementazione della classe per l'importazione di PLY.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 28.02.25 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "ImportPly.h"
|
||||
#include "DllMain.h"
|
||||
#include "/EgtDev/Include/EExDllMain.h"
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IImportPly*
|
||||
CreateImportPly( void)
|
||||
{
|
||||
// verifico la chiave e le opzioni
|
||||
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
|
||||
return nullptr ;
|
||||
// creo l'oggetto
|
||||
return static_cast<IImportPly*> ( new( nothrow) ImportPly) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportPly::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup, double dScaleFactor)
|
||||
{
|
||||
// verifico il DB geometrico
|
||||
if ( pGDB == nullptr) {
|
||||
LOG_ERROR( GetEExLogger(), "ImportPly : Error on GeomDB")
|
||||
return false ;
|
||||
}
|
||||
m_pGDB = pGDB ;
|
||||
|
||||
// verifico l'Id di gruppo
|
||||
if ( ! m_pGDB->ExistsObj( nIdGroup)) {
|
||||
LOG_ERROR( GetEExLogger(), "ImportPly : Error on IdGroup")
|
||||
return false ;
|
||||
}
|
||||
m_nIdGroup = nIdGroup ;
|
||||
|
||||
// verifico il fattore di scala
|
||||
if ( dScaleFactor < EPS_SMALL) {
|
||||
LOG_ERROR( GetEExLogger(), "ImportPly : Error on ScaleFactor too small (minimum 0.001).")
|
||||
return false ;
|
||||
}
|
||||
m_dScaleFactor = dScaleFactor ;
|
||||
|
||||
// inizializzo il lettore
|
||||
miniply::PLYReader TheReader( sFile.data()) ;
|
||||
if ( ! TheReader.valid()) {
|
||||
LOG_ERROR( GetEExLogger(), "ImportPly : Error on Init")
|
||||
return false ;
|
||||
}
|
||||
|
||||
// lettura dati
|
||||
return ReadData( TheReader) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ImportPly::ReadData( miniply::PLYReader& TheReader)
|
||||
{
|
||||
typedef std::vector<float> FLTVECTOR ; // vettore di float
|
||||
|
||||
uint32_t propIdxs[3] ;
|
||||
bool bGotVerts = false, bGotFaces = false ;
|
||||
|
||||
int nVerts = 0 ;
|
||||
FLTVECTOR vVert ;
|
||||
int nTrias = 0 ;
|
||||
INTVECTOR vTria ;
|
||||
while ( TheReader.has_element() && ( ! bGotVerts || ! bGotFaces)) {
|
||||
// Recupero i vertici
|
||||
if ( TheReader.element_is( miniply::kPLYVertexElement) && TheReader.load_element() && TheReader.find_pos( propIdxs)) {
|
||||
nVerts = TheReader.num_rows() ;
|
||||
vVert.resize( 3 * nVerts) ;
|
||||
TheReader.extract_properties( propIdxs, 3, miniply::PLYPropertyType::Float, vVert.data()) ;
|
||||
bGotVerts = true ;
|
||||
}
|
||||
// Recupero gli indici dei vertici dei triangoli delle facce
|
||||
else if ( TheReader.element_is( miniply::kPLYFaceElement) && TheReader.load_element() && TheReader.find_indices( propIdxs)) {
|
||||
bool bPolys = TheReader.requires_triangulation( propIdxs[0]) ;
|
||||
if ( bPolys && ! bGotVerts) {
|
||||
string sOut = " ImportPly : need vertex positions to triangulate faces" ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
if ( bPolys) {
|
||||
nTrias = TheReader.num_triangles( propIdxs[0]) ;
|
||||
vTria.resize( 3 * nTrias) ;
|
||||
TheReader.extract_triangles( propIdxs[0], vVert.data(), nVerts, miniply::PLYPropertyType::Int, vTria.data()) ;
|
||||
}
|
||||
else {
|
||||
nTrias = TheReader.num_rows() ;
|
||||
vTria.resize( 3 * nTrias) ;
|
||||
TheReader.extract_list_property( propIdxs[0], miniply::PLYPropertyType::Int, vTria.data()) ;
|
||||
}
|
||||
bGotFaces = true ;
|
||||
}
|
||||
if ( bGotVerts && bGotFaces)
|
||||
break ;
|
||||
TheReader.next_element() ;
|
||||
}
|
||||
|
||||
// Controllo lettura effettiuata di vertici e facce
|
||||
if ( ! bGotVerts) {
|
||||
string sOut = " ImportPly : vertex positions not found" ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
if ( ! bGotFaces) {
|
||||
string sOut = " ImportPly : face indices not found" ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Costruttore di trimesh da insieme disordinato di triangoli
|
||||
StmFromTriangleSoup StmFts ;
|
||||
if ( ! StmFts.Start())
|
||||
return false ;
|
||||
// ciclo sui triangoli
|
||||
int nBadTrias = 0 ;
|
||||
for ( int i = 0 ; i < nTrias ; ++ i) {
|
||||
int nT = 3 * i ;
|
||||
Triangle3d Tria ;
|
||||
for ( int j = 0 ; j < 3 ; ++ j) {
|
||||
int nV = 3 * vTria[nT+j] ;
|
||||
Point3d ptP( vVert[nV], vVert[nV+1], vVert[nV+2]) ;
|
||||
ptP *= m_dScaleFactor ;
|
||||
Tria.SetP( j, ptP) ;
|
||||
}
|
||||
if ( Tria.Validate( true)) {
|
||||
if ( ! StmFts.AddTriangle( Tria)) {
|
||||
string sOut = " ImportPly : error adding triangle" ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
else
|
||||
++ nBadTrias ;
|
||||
}
|
||||
if ( nBadTrias > 0) {
|
||||
string sOut = " ImportPly : found " + ToString( nBadTrias) + " bad triangles" ;
|
||||
LOG_ERROR( GetEExLogger(), sOut.c_str())
|
||||
}
|
||||
|
||||
// Valido la superficie e calcolo le adiacenze
|
||||
if ( ! StmFts.End())
|
||||
return false ;
|
||||
// inserisco l'oggetto nel DB geometrico
|
||||
PtrOwner<ISurfTriMesh> pSTM( StmFts.GetSurf()) ;
|
||||
int nIdNew = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, Release( pSTM)) ;
|
||||
if ( nIdNew == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2025-2025
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ImportPly.h Data : 28.02.25 Versione : 2.7b2
|
||||
// Contenuto : Dichiarazione della classe ImportPly.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 28.02.25 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "miniply.h"
|
||||
#include "/EgtDev/Include/EExImportPly.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class ImportPly : public IImportPly
|
||||
{
|
||||
public :
|
||||
virtual bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup, double dScaleFactor = 1) ;
|
||||
|
||||
private :
|
||||
bool ReadData( miniply::PLYReader& TheReader) ;
|
||||
|
||||
private :
|
||||
IGeomDB* m_pGDB ;
|
||||
int m_nIdGroup ;
|
||||
double m_dScaleFactor ;
|
||||
} ;
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "/EgtDev/Include/EExDllMain.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "/EgtDEv/Include/EGnScanner.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
+7
-8
@@ -16,13 +16,10 @@
|
||||
#include "ImportStl.h"
|
||||
#include "DllMain.h"
|
||||
#include "/EgtDev/Include/EExDllMain.h"
|
||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
#include "/EgtDEv/Include/EGnScanner.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include <fstream>
|
||||
@@ -199,14 +196,16 @@ ImportStl::LoadSolid( Scanner& TheScanner, bool& bEnd)
|
||||
return false ;
|
||||
}
|
||||
// inserisco l'oggetto nel DB geometrico
|
||||
ISurfTriMesh* pSTM = StmFts.GetSurf() ;
|
||||
int nIdNew = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, pSTM) ;
|
||||
PtrOwner<ISurfTriMesh> pSTM( StmFts.GetSurf()) ;
|
||||
int nIdNew = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, Release( pSTM)) ;
|
||||
if ( nIdNew == GDB_ID_NULL)
|
||||
return false ;
|
||||
// se previsto il nome, lo assegno
|
||||
if ( ! sName.empty())
|
||||
m_pGDB->SetName( nIdNew, sName) ;
|
||||
|
||||
bEnd = false ;
|
||||
return ( nIdNew != GDB_ID_NULL) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+2058
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,317 @@
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Vilya Harvey
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MINIPLY_H
|
||||
#define MINIPLY_H
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
/// miniply - A simple and fast parser for PLY files
|
||||
/// ================================================
|
||||
///
|
||||
/// For details about the PLY format see:
|
||||
/// * http://paulbourke.net/dataformats/ply/
|
||||
/// * https://en.wikipedia.org/wiki/PLY_(file_format)
|
||||
|
||||
namespace miniply {
|
||||
|
||||
//
|
||||
// Constants
|
||||
//
|
||||
|
||||
static constexpr uint32_t kInvalidIndex = 0xFFFFFFFFu;
|
||||
|
||||
// Standard PLY element names
|
||||
extern const char* kPLYVertexElement; // "vertex"
|
||||
extern const char* kPLYFaceElement; // "face"
|
||||
|
||||
|
||||
//
|
||||
// PLY Parsing types
|
||||
//
|
||||
|
||||
enum class PLYFileType {
|
||||
ASCII,
|
||||
Binary,
|
||||
BinaryBigEndian,
|
||||
};
|
||||
|
||||
|
||||
enum class PLYPropertyType {
|
||||
Char,
|
||||
UChar,
|
||||
Short,
|
||||
UShort,
|
||||
Int,
|
||||
UInt,
|
||||
Float,
|
||||
Double,
|
||||
|
||||
None, //!< Special value used in Element::listCountType to indicate a non-list property.
|
||||
};
|
||||
|
||||
|
||||
struct PLYProperty {
|
||||
std::string name;
|
||||
PLYPropertyType type = PLYPropertyType::None; //!< Type of the data. Must be set to a value other than None.
|
||||
PLYPropertyType countType = PLYPropertyType::None; //!< None indicates this is not a list type, otherwise it's the type for the list count.
|
||||
uint32_t offset = 0; //!< Byte offset from the start of the row.
|
||||
uint32_t stride = 0;
|
||||
|
||||
std::vector<uint8_t> listData;
|
||||
std::vector<uint32_t> rowCount; // Entry `i` is the number of items (*not* the number of bytes) in row `i`.
|
||||
};
|
||||
|
||||
|
||||
struct PLYElement {
|
||||
std::string name; //!< Name of this element.
|
||||
std::vector<PLYProperty> properties;
|
||||
uint32_t count = 0; //!< The number of items in this element (e.g. the number of vertices if this is the vertex element).
|
||||
bool fixedSize = true; //!< `true` if there are only fixed-size properties in this element, i.e. no list properties.
|
||||
uint32_t rowStride = 0; //!< The number of bytes from the start of one row to the start of the next, for this element.
|
||||
|
||||
void calculate_offsets();
|
||||
|
||||
/// Returns the index for the named property in this element, or `kInvalidIndex`
|
||||
/// if it can't be found.
|
||||
uint32_t find_property(const char* propName) const;
|
||||
|
||||
/// Return the indices for several properties in one go. Use it like this:
|
||||
/// ```
|
||||
/// uint32_t indexes[3];
|
||||
/// if (elem.find_properties(indexes, 3, "foo", "bar", "baz")) { ... }
|
||||
/// ```
|
||||
/// `propIdxs` is where the property indexes will be stored. `numIdxs` is
|
||||
/// the number of properties we will look up. There must be exactly
|
||||
/// `numIdxs` parameters after `numIdxs`; each of the is a c-style string
|
||||
/// giving the name of a property.
|
||||
///
|
||||
/// The return value will be true if all properties were found. If it was
|
||||
/// not true, you should not use any values from propIdxs.
|
||||
bool find_properties(uint32_t propIdxs[], uint32_t numIdxs, ...) const;
|
||||
|
||||
/// Same as `find_properties`, for when you already have a `va_list`. This
|
||||
/// is called internally by both `PLYElement::find_properties` and
|
||||
/// `PLYReader::find_properties`.
|
||||
bool find_properties_va(uint32_t propIdxs[], uint32_t numIdxs, va_list names) const;
|
||||
|
||||
/// Call this on the element at some point before you load its data, when
|
||||
/// you know that every row's list will have the same length. It will
|
||||
/// replace the single variable-size property with a set of new fixed-size
|
||||
/// properties: one for the list count, followed by one for each of the
|
||||
/// list values. This will allow miniply to load and extract the property
|
||||
/// data a lot more efficiently, giving a big performance increase.
|
||||
///
|
||||
/// After you've called this, you must use PLYReader's `extract_columns`
|
||||
/// method to get the data, rather than `extract_list_column`.
|
||||
///
|
||||
/// The `newPropIdxs` parameter must be an array with at least `listSize`
|
||||
/// entries. If the function returns true, this will have been populated
|
||||
/// with the indices of the new properties that represent the list values
|
||||
/// (i.e. not including the list count property, which will have the same
|
||||
/// index as the old list property).
|
||||
///
|
||||
/// The function returns false if the property index is invalid, or the
|
||||
/// property it refers to is not a list property. In these cases it will
|
||||
/// not modify anything. Otherwise it will return true.
|
||||
bool convert_list_to_fixed_size(uint32_t listPropIdx, uint32_t listSize, uint32_t newPropIdxs[]);
|
||||
};
|
||||
|
||||
|
||||
class PLYReader {
|
||||
public:
|
||||
PLYReader(const char* filename);
|
||||
~PLYReader();
|
||||
|
||||
bool valid() const;
|
||||
bool has_element() const;
|
||||
const PLYElement* element() const;
|
||||
bool load_element();
|
||||
void next_element();
|
||||
|
||||
PLYFileType file_type() const;
|
||||
int version_major() const;
|
||||
int version_minor() const;
|
||||
uint32_t num_elements() const;
|
||||
uint32_t find_element(const char* name) const;
|
||||
PLYElement* get_element(uint32_t idx);
|
||||
|
||||
/// Check whether the current element has the given name.
|
||||
bool element_is(const char* name) const;
|
||||
|
||||
/// Number of rows in the current element.
|
||||
uint32_t num_rows() const;
|
||||
|
||||
/// Returns the index for the named property in the current element, or
|
||||
/// `kInvalidIndex` if it can't be found.
|
||||
uint32_t find_property(const char* name) const;
|
||||
|
||||
/// Equivalent to calling `find_properties` on the current element.
|
||||
bool find_properties(uint32_t propIdxs[], uint32_t numIdxs, ...) const;
|
||||
|
||||
/// Copy the data for the specified properties into `dest`, which must be
|
||||
/// an array with at least enough space to hold all of the extracted column
|
||||
/// data. `propIdxs` is an array containing the indexes of the properties
|
||||
/// to copy; it has `numProps` elements.
|
||||
///
|
||||
/// `destType` specifies the data type for values stored in `dest`. All
|
||||
/// property values will be converted to this type if necessary.
|
||||
///
|
||||
/// This function does some checks up front to pick the most efficient code
|
||||
/// path for extracting the data. It considers:
|
||||
/// (a) whether any data conversion is required.
|
||||
/// (b) whether all property values to be extracted are in contiguous
|
||||
/// memory locations for any given item.
|
||||
/// (c) whether the data for all rows is contiguous in memory.
|
||||
/// In the best case it reduces to a single memcpy call. In the worst case
|
||||
/// we must iterate over all values to be copied, applying type conversions
|
||||
/// as we go.
|
||||
///
|
||||
/// Note that this function does not handle list-valued properties. Use
|
||||
/// `extract_list_column()` for those instead.
|
||||
bool extract_properties(const uint32_t propIdxs[], uint32_t numProps, PLYPropertyType destType, void* dest) const;
|
||||
|
||||
/// The same as `extract_properties`, but does not require rows in the
|
||||
/// destination to be contiguous: `destStride` is the number of bytes
|
||||
/// between the start of one row and the start of the next row in the
|
||||
/// destination memory.
|
||||
///
|
||||
/// This is useful for when your destination is an array of structs where
|
||||
/// you cannot extract all of the properties with a single
|
||||
/// `extract_properties` call, e.g. when not all of the struct members
|
||||
/// have the same type, or when the data you're extracting is only a
|
||||
/// subset of the columns in each destination row.
|
||||
///
|
||||
/// This is a tiny bit slower than `extract_properties`. Wherever possible
|
||||
/// you should use `extract_properties` in preference to this method.
|
||||
bool extract_properties_with_stride(const uint32_t propIdxs[], uint32_t numProps, PLYPropertyType destType, void* dest, uint32_t destStride) const;
|
||||
|
||||
/// Get the array of item counts for a list property. Entry `i` in this
|
||||
/// array is the number of items in the `i`th list.
|
||||
const uint32_t* get_list_counts(uint32_t propIdx) const;
|
||||
|
||||
/// Get the sum of all item counts for a list property. This can be useful
|
||||
/// to determine how big a destination array you'll need for a call to
|
||||
/// `extract_list_property`. It's equivalent to summing up all the values
|
||||
/// in the array returned by `get_list_counts`, but faster.
|
||||
uint32_t sum_of_list_counts(uint32_t propIdx) const;
|
||||
|
||||
const uint8_t* get_list_data(uint32_t propIdx) const;
|
||||
bool extract_list_property(uint32_t propIdx, PLYPropertyType destType, void* dest) const;
|
||||
|
||||
uint32_t num_triangles(uint32_t propIdx) const;
|
||||
bool requires_triangulation(uint32_t propIdx) const;
|
||||
bool extract_triangles(uint32_t propIdx, const float pos[], uint32_t numVerts, PLYPropertyType destType, void* dest) const;
|
||||
|
||||
bool find_pos(uint32_t propIdxs[3]) const;
|
||||
bool find_normal(uint32_t propIdxs[3]) const;
|
||||
bool find_texcoord(uint32_t propIdxs[2]) const;
|
||||
bool find_color(uint32_t propIdxs[3]) const;
|
||||
bool find_indices(uint32_t propIdxs[1]) const;
|
||||
|
||||
private:
|
||||
bool refill_buffer();
|
||||
bool rewind_to_safe_char();
|
||||
bool accept();
|
||||
bool advance();
|
||||
bool next_line();
|
||||
bool match(const char* str);
|
||||
bool which(const char* values[], uint32_t* index);
|
||||
bool which_property_type(PLYPropertyType* type);
|
||||
bool keyword(const char* kw);
|
||||
bool identifier(char* dest, size_t destLen);
|
||||
|
||||
template <class T> // T must be a type compatible with uint32_t.
|
||||
bool typed_which(const char* values[], T* index) {
|
||||
return which(values, reinterpret_cast<uint32_t*>(index));
|
||||
}
|
||||
|
||||
bool int_literal(int* value);
|
||||
bool float_literal(float* value);
|
||||
bool double_literal(double* value);
|
||||
|
||||
bool parse_elements();
|
||||
bool parse_element();
|
||||
bool parse_property(std::vector<PLYProperty>& properties);
|
||||
|
||||
bool load_fixed_size_element(PLYElement& elem);
|
||||
bool load_variable_size_element(PLYElement& elem);
|
||||
|
||||
bool load_ascii_scalar_property(PLYProperty& prop, size_t& destIndex);
|
||||
bool load_ascii_list_property(PLYProperty& prop);
|
||||
bool load_binary_scalar_property(PLYProperty& prop, size_t& destIndex);
|
||||
bool load_binary_list_property(PLYProperty& prop);
|
||||
bool load_binary_scalar_property_big_endian(PLYProperty& prop, size_t& destIndex);
|
||||
bool load_binary_list_property_big_endian(PLYProperty& prop);
|
||||
|
||||
bool ascii_value(PLYPropertyType propType, uint8_t value[8]);
|
||||
|
||||
private:
|
||||
FILE* m_f = nullptr;
|
||||
char* m_buf = nullptr;
|
||||
const char* m_bufEnd = nullptr;
|
||||
const char* m_pos = nullptr;
|
||||
const char* m_end = nullptr;
|
||||
bool m_inDataSection = false;
|
||||
bool m_atEOF = false;
|
||||
int64_t m_bufOffset = 0;
|
||||
|
||||
bool m_valid = false;
|
||||
|
||||
PLYFileType m_fileType = PLYFileType::ASCII; //!< Whether the file was ascii, binary little-endian, or binary big-endian.
|
||||
int m_majorVersion = 0;
|
||||
int m_minorVersion = 0;
|
||||
std::vector<PLYElement> m_elements; //!< Element descriptors for this file.
|
||||
|
||||
size_t m_currentElement = 0;
|
||||
bool m_elementLoaded = false;
|
||||
std::vector<uint8_t> m_elementData;
|
||||
|
||||
char* m_tmpBuf = nullptr;
|
||||
};
|
||||
|
||||
|
||||
/// Given a polygon with `n` vertices, where `n` > 3, triangulate it and
|
||||
/// store the indices for the resulting triangles in `dst`. The `pos`
|
||||
/// parameter is the array of all vertex positions for the mesh; `indices` is
|
||||
/// the list of `n` indices for the polygon we're triangulating; and `dst` is
|
||||
/// where we write the new indices to.
|
||||
///
|
||||
/// The triangulation will always produce `n - 2` triangles, so `dst` must
|
||||
/// have enough space for `3 * (n - 2)` indices.
|
||||
///
|
||||
/// If `n == 3`, we simply copy the input indices to `dst`. If `n < 3`,
|
||||
/// nothing gets written to dst.
|
||||
///
|
||||
/// The return value is the number of triangles.
|
||||
uint32_t triangulate_polygon(uint32_t n, const float pos[], uint32_t numVerts, const int indices[], int dst[]);
|
||||
|
||||
} // namespace miniply
|
||||
|
||||
#endif // MINIPLY_H
|
||||
+38
-38
@@ -1,15 +1,15 @@
|
||||
/**
|
||||
* pugixml parser - version 1.11
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at https://pugixml.org/
|
||||
*
|
||||
* This library is distributed under the MIT License. See notice at the end
|
||||
* of this file.
|
||||
*
|
||||
* This work is based on the pugxml parser, which is:
|
||||
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
|
||||
*/
|
||||
* pugixml parser - version 1.15
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2025, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at https://pugixml.org/
|
||||
*
|
||||
* This library is distributed under the MIT License. See notice at the end
|
||||
* of this file.
|
||||
*
|
||||
* This work is based on the pugxml parser, which is:
|
||||
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
|
||||
*/
|
||||
|
||||
#ifndef HEADER_PUGICONFIG_HPP
|
||||
#define HEADER_PUGICONFIG_HPP
|
||||
@@ -46,35 +46,35 @@
|
||||
// Uncomment this to switch to header-only version
|
||||
// #define PUGIXML_HEADER_ONLY
|
||||
|
||||
// Uncomment this to enable long long support
|
||||
// Uncomment this to enable long long support (usually enabled automatically)
|
||||
// #define PUGIXML_HAS_LONG_LONG
|
||||
|
||||
// Uncomment this to enable support for std::string_view (usually enabled automatically)
|
||||
// #define PUGIXML_HAS_STRING_VIEW
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2020 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
* Copyright (c) 2006-2025 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
+9831
-9297
File diff suppressed because it is too large
Load Diff
+204
-119
@@ -1,20 +1,20 @@
|
||||
/**
|
||||
* pugixml parser - version 1.11
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at https://pugixml.org/
|
||||
*
|
||||
* This library is distributed under the MIT License. See notice at the end
|
||||
* of this file.
|
||||
*
|
||||
* This work is based on the pugxml parser, which is:
|
||||
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
|
||||
*/
|
||||
* pugixml parser - version 1.15
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2025, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at https://pugixml.org/
|
||||
*
|
||||
* This library is distributed under the MIT License. See notice at the end
|
||||
* of this file.
|
||||
*
|
||||
* This work is based on the pugxml parser, which is:
|
||||
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
|
||||
*/
|
||||
|
||||
#ifndef PUGIXML_VERSION
|
||||
// Define version macro; evaluates to major * 1000 + minor * 10 + patch so that it's safe to use in less-than comparisons
|
||||
// Note: pugixml used major * 100 + minor * 10 + patch format up until 1.9 (which had version identifier 190); starting from pugixml 1.10, the minor version number is two digits
|
||||
# define PUGIXML_VERSION 1110
|
||||
#ifndef PUGIXML_VERSION
|
||||
# define PUGIXML_VERSION 1150 // 1.15
|
||||
#endif
|
||||
|
||||
// Include user configuration file (this can define various configuration macros)
|
||||
@@ -38,6 +38,20 @@
|
||||
# include <string>
|
||||
#endif
|
||||
|
||||
// Check if std::string_view is available
|
||||
#if !defined(PUGIXML_HAS_STRING_VIEW) && !defined(PUGIXML_NO_STL)
|
||||
# if __cplusplus >= 201703L
|
||||
# define PUGIXML_HAS_STRING_VIEW
|
||||
# elif defined(_MSVC_LANG) && _MSVC_LANG >= 201703L
|
||||
# define PUGIXML_HAS_STRING_VIEW
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Include string_view if appropriate
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
# include <string_view>
|
||||
#endif
|
||||
|
||||
// Macro for deprecated features
|
||||
#ifndef PUGIXML_DEPRECATED
|
||||
# if defined(__GNUC__)
|
||||
@@ -82,14 +96,14 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// If C++ is 2011 or higher, add 'noexcept' specifiers
|
||||
// If C++ is 2011 or higher, use 'noexcept' specifiers
|
||||
#ifndef PUGIXML_NOEXCEPT
|
||||
# if __cplusplus >= 201103
|
||||
# define PUGIXML_NOEXCEPT noexcept
|
||||
# elif defined(_MSC_VER) && _MSC_VER >= 1900
|
||||
# define PUGIXML_NOEXCEPT noexcept
|
||||
# else
|
||||
# define PUGIXML_NOEXCEPT
|
||||
# define PUGIXML_NOEXCEPT throw()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -115,6 +129,8 @@
|
||||
#ifndef PUGIXML_NULL
|
||||
# if __cplusplus >= 201103
|
||||
# define PUGIXML_NULL nullptr
|
||||
# elif defined(_MSC_VER) && _MSC_VER >= 1600
|
||||
# define PUGIXML_NULL nullptr
|
||||
# else
|
||||
# define PUGIXML_NULL 0
|
||||
# endif
|
||||
@@ -136,7 +152,12 @@ namespace pugi
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// String type used for operations that work with STL string; depends on PUGIXML_WCHAR_MODE
|
||||
typedef std::basic_string<PUGIXML_CHAR, std::char_traits<PUGIXML_CHAR>, std::allocator<PUGIXML_CHAR> > string_t;
|
||||
typedef std::basic_string<PUGIXML_CHAR> string_t;
|
||||
#endif
|
||||
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
// String view type used for operations that can work with a length delimited string; depends on PUGIXML_WCHAR_MODE
|
||||
typedef std::basic_string_view<PUGIXML_CHAR> string_view_t;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -211,6 +232,10 @@ namespace pugi
|
||||
// This flag is off by default.
|
||||
const unsigned int parse_embed_pcdata = 0x2000;
|
||||
|
||||
// This flag determines whether determines whether the the two pcdata should be merged or not, if no intermediatory data are parsed in the document.
|
||||
// This flag is off by default.
|
||||
const unsigned int parse_merge_pcdata = 0x4000;
|
||||
|
||||
// The default parsing mode.
|
||||
// Elements, PCDATA and CDATA sections are added to the DOM tree, character/reference entities are expanded,
|
||||
// End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
|
||||
@@ -291,12 +316,12 @@ namespace pugi
|
||||
|
||||
class xml_text;
|
||||
|
||||
#ifndef PUGIXML_NO_XPATH
|
||||
#ifndef PUGIXML_NO_XPATH
|
||||
class xpath_node;
|
||||
class xpath_node_set;
|
||||
class xpath_query;
|
||||
class xpath_variable_set;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Range-based for loop support
|
||||
template <typename It> class xml_object_range
|
||||
@@ -312,6 +337,8 @@ namespace pugi
|
||||
It begin() const { return _begin; }
|
||||
It end() const { return _end; }
|
||||
|
||||
bool empty() const { return _begin == _end; }
|
||||
|
||||
private:
|
||||
It _begin, _end;
|
||||
};
|
||||
@@ -320,7 +347,7 @@ namespace pugi
|
||||
class PUGIXML_CLASS xml_writer
|
||||
{
|
||||
public:
|
||||
virtual ~xml_writer() {}
|
||||
virtual ~xml_writer();
|
||||
|
||||
// Write memory chunk into stream/file/whatever
|
||||
virtual void write(const void* data, size_t size) = 0;
|
||||
@@ -339,22 +366,22 @@ namespace pugi
|
||||
void* file;
|
||||
};
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// xml_writer implementation for streams
|
||||
class PUGIXML_CLASS xml_writer_stream: public xml_writer
|
||||
{
|
||||
public:
|
||||
// Construct writer from an output stream object
|
||||
xml_writer_stream(std::basic_ostream<char, std::char_traits<char> >& stream);
|
||||
xml_writer_stream(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream);
|
||||
xml_writer_stream(std::basic_ostream<char>& stream);
|
||||
xml_writer_stream(std::basic_ostream<wchar_t>& stream);
|
||||
|
||||
virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE;
|
||||
|
||||
private:
|
||||
std::basic_ostream<char, std::char_traits<char> >* narrow_stream;
|
||||
std::basic_ostream<wchar_t, std::char_traits<wchar_t> >* wide_stream;
|
||||
std::basic_ostream<char>* narrow_stream;
|
||||
std::basic_ostream<wchar_t>* wide_stream;
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// A light-weight handle for manipulating attributes in DOM tree
|
||||
class PUGIXML_CLASS xml_attribute
|
||||
@@ -388,7 +415,7 @@ namespace pugi
|
||||
bool operator<=(const xml_attribute& r) const;
|
||||
bool operator>=(const xml_attribute& r) const;
|
||||
|
||||
// Check if attribute is empty
|
||||
// Check if attribute is empty (null)
|
||||
bool empty() const;
|
||||
|
||||
// Get attribute name/value, or "" if attribute is empty
|
||||
@@ -404,17 +431,25 @@ namespace pugi
|
||||
double as_double(double def = 0) const;
|
||||
float as_float(float def = 0) const;
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
long long as_llong(long long def = 0) const;
|
||||
unsigned long long as_ullong(unsigned long long def = 0) const;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Get attribute value as bool (returns true if first character is in '1tTyY' set), or the default value if attribute is empty
|
||||
bool as_bool(bool def = false) const;
|
||||
|
||||
// Set attribute name/value (returns false if attribute is empty or there is not enough memory)
|
||||
bool set_name(const char_t* rhs);
|
||||
bool set_name(const char_t* rhs, size_t size);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
bool set_name(string_view_t rhs);
|
||||
#endif
|
||||
bool set_value(const char_t* rhs);
|
||||
bool set_value(const char_t* rhs, size_t size);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
bool set_value(string_view_t rhs);
|
||||
#endif
|
||||
|
||||
// Set attribute value with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
|
||||
bool set_value(int rhs);
|
||||
@@ -427,10 +462,10 @@ namespace pugi
|
||||
bool set_value(float rhs, int precision);
|
||||
bool set_value(bool rhs);
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
bool set_value(long long rhs);
|
||||
bool set_value(unsigned long long rhs);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Set attribute value (equivalent to set_value without error checking)
|
||||
xml_attribute& operator=(const char_t* rhs);
|
||||
@@ -442,10 +477,14 @@ namespace pugi
|
||||
xml_attribute& operator=(float rhs);
|
||||
xml_attribute& operator=(bool rhs);
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
xml_attribute& operator=(string_view_t rhs);
|
||||
#endif
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
xml_attribute& operator=(long long rhs);
|
||||
xml_attribute& operator=(unsigned long long rhs);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Get next/previous attribute in the attribute list of the parent node
|
||||
xml_attribute next_attribute() const;
|
||||
@@ -497,7 +536,7 @@ namespace pugi
|
||||
bool operator<=(const xml_node& r) const;
|
||||
bool operator>=(const xml_node& r) const;
|
||||
|
||||
// Check if node is empty.
|
||||
// Check if node is empty (null)
|
||||
bool empty() const;
|
||||
|
||||
// Get node type
|
||||
@@ -536,9 +575,18 @@ namespace pugi
|
||||
xml_attribute attribute(const char_t* name) const;
|
||||
xml_node next_sibling(const char_t* name) const;
|
||||
xml_node previous_sibling(const char_t* name) const;
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
xml_node child(string_view_t name) const;
|
||||
xml_attribute attribute(string_view_t name) const;
|
||||
xml_node next_sibling(string_view_t name) const;
|
||||
xml_node previous_sibling(string_view_t name) const;
|
||||
#endif
|
||||
|
||||
// Get attribute, starting the search from a hint (and updating hint so that searching for a sequence of attributes is fast)
|
||||
xml_attribute attribute(const char_t* name, xml_attribute& hint) const;
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
xml_attribute attribute(string_view_t name, xml_attribute& hint) const;
|
||||
#endif
|
||||
|
||||
// Get child value of current node; that is, value of the first child node of type PCDATA/CDATA
|
||||
const char_t* child_value() const;
|
||||
@@ -548,13 +596,27 @@ namespace pugi
|
||||
|
||||
// Set node name/value (returns false if node is empty, there is not enough memory, or node can not have name/value)
|
||||
bool set_name(const char_t* rhs);
|
||||
bool set_name(const char_t* rhs, size_t size);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
bool set_name(string_view_t rhs);
|
||||
#endif
|
||||
bool set_value(const char_t* rhs);
|
||||
bool set_value(const char_t* rhs, size_t size);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
bool set_value(string_view_t rhs);
|
||||
#endif
|
||||
|
||||
// Add attribute with specified name. Returns added attribute, or empty attribute on errors.
|
||||
xml_attribute append_attribute(const char_t* name);
|
||||
xml_attribute prepend_attribute(const char_t* name);
|
||||
xml_attribute insert_attribute_after(const char_t* name, const xml_attribute& attr);
|
||||
xml_attribute insert_attribute_before(const char_t* name, const xml_attribute& attr);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
xml_attribute append_attribute(string_view_t name);
|
||||
xml_attribute prepend_attribute(string_view_t name);
|
||||
xml_attribute insert_attribute_after(string_view_t name, const xml_attribute& attr);
|
||||
xml_attribute insert_attribute_before(string_view_t name, const xml_attribute& attr);
|
||||
#endif
|
||||
|
||||
// Add a copy of the specified attribute. Returns added attribute, or empty attribute on errors.
|
||||
xml_attribute append_copy(const xml_attribute& proto);
|
||||
@@ -573,6 +635,12 @@ namespace pugi
|
||||
xml_node prepend_child(const char_t* name);
|
||||
xml_node insert_child_after(const char_t* name, const xml_node& node);
|
||||
xml_node insert_child_before(const char_t* name, const xml_node& node);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
xml_node append_child(string_view_t name);
|
||||
xml_node prepend_child(string_view_t name);
|
||||
xml_node insert_child_after(string_view_t, const xml_node& node);
|
||||
xml_node insert_child_before(string_view_t name, const xml_node& node);
|
||||
#endif
|
||||
|
||||
// Add a copy of the specified node as a child. Returns added node, or empty node on errors.
|
||||
xml_node append_copy(const xml_node& proto);
|
||||
@@ -589,6 +657,9 @@ namespace pugi
|
||||
// Remove specified attribute
|
||||
bool remove_attribute(const xml_attribute& a);
|
||||
bool remove_attribute(const char_t* name);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
bool remove_attribute(string_view_t name);
|
||||
#endif
|
||||
|
||||
// Remove all attributes
|
||||
bool remove_attributes();
|
||||
@@ -596,6 +667,9 @@ namespace pugi
|
||||
// Remove specified child
|
||||
bool remove_child(const xml_node& n);
|
||||
bool remove_child(const char_t* name);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
bool remove_child(string_view_t name);
|
||||
#endif
|
||||
|
||||
// Remove all children
|
||||
bool remove_children();
|
||||
@@ -657,10 +731,10 @@ namespace pugi
|
||||
xml_node find_child_by_attribute(const char_t* name, const char_t* attr_name, const char_t* attr_value) const;
|
||||
xml_node find_child_by_attribute(const char_t* attr_name, const char_t* attr_value) const;
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// Get the absolute node path from root as a text string.
|
||||
string_t path(char_t delimiter = '/') const;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Search for a node by path consisting of node names and . or .. elements.
|
||||
xml_node first_element_by_path(const char_t* path, char_t delimiter = '/') const;
|
||||
@@ -668,7 +742,7 @@ namespace pugi
|
||||
// Recursively traverse subtree with xml_tree_walker
|
||||
bool traverse(xml_tree_walker& walker);
|
||||
|
||||
#ifndef PUGIXML_NO_XPATH
|
||||
#ifndef PUGIXML_NO_XPATH
|
||||
// Select single node by evaluating XPath query. Returns first node from the resulting node set.
|
||||
xpath_node select_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
|
||||
xpath_node select_node(const xpath_query& query) const;
|
||||
@@ -681,16 +755,16 @@ namespace pugi
|
||||
PUGIXML_DEPRECATED xpath_node select_single_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
|
||||
PUGIXML_DEPRECATED xpath_node select_single_node(const xpath_query& query) const;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Print subtree using a writer object
|
||||
void print(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// Print subtree to stream
|
||||
void print(std::basic_ostream<char, std::char_traits<char> >& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
|
||||
void print(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, unsigned int depth = 0) const;
|
||||
#endif
|
||||
void print(std::basic_ostream<char>& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
|
||||
void print(std::basic_ostream<wchar_t>& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, unsigned int depth = 0) const;
|
||||
#endif
|
||||
|
||||
// Child nodes iterators
|
||||
typedef xml_node_iterator iterator;
|
||||
@@ -706,9 +780,12 @@ namespace pugi
|
||||
|
||||
// Range-based for support
|
||||
xml_object_range<xml_node_iterator> children() const;
|
||||
xml_object_range<xml_named_node_iterator> children(const char_t* name) const;
|
||||
xml_object_range<xml_attribute_iterator> attributes() const;
|
||||
|
||||
// Range-based for support for all children with the specified name
|
||||
// Note: name pointer must have a longer lifetime than the returned object; be careful with passing temporaries!
|
||||
xml_object_range<xml_named_node_iterator> children(const char_t* name) const;
|
||||
|
||||
// Get node offset in parsed file/string (in char_t units) for debugging purposes
|
||||
ptrdiff_t offset_debug() const;
|
||||
|
||||
@@ -749,7 +826,7 @@ namespace pugi
|
||||
// Borland C++ workaround
|
||||
bool operator!() const;
|
||||
|
||||
// Check if text object is empty
|
||||
// Check if text object is empty (null)
|
||||
bool empty() const;
|
||||
|
||||
// Get text, or "" if object is empty
|
||||
@@ -764,16 +841,20 @@ namespace pugi
|
||||
double as_double(double def = 0) const;
|
||||
float as_float(float def = 0) const;
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
long long as_llong(long long def = 0) const;
|
||||
unsigned long long as_ullong(unsigned long long def = 0) const;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Get text as bool (returns true if first character is in '1tTyY' set), or the default value if object is empty
|
||||
bool as_bool(bool def = false) const;
|
||||
|
||||
// Set text (returns false if object is empty or there is not enough memory)
|
||||
bool set(const char_t* rhs);
|
||||
bool set(const char_t* rhs, size_t size);
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
bool set(string_view_t rhs);
|
||||
#endif
|
||||
|
||||
// Set text with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
|
||||
bool set(int rhs);
|
||||
@@ -786,10 +867,10 @@ namespace pugi
|
||||
bool set(float rhs, int precision);
|
||||
bool set(bool rhs);
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
bool set(long long rhs);
|
||||
bool set(unsigned long long rhs);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Set text (equivalent to set without error checking)
|
||||
xml_text& operator=(const char_t* rhs);
|
||||
@@ -801,10 +882,14 @@ namespace pugi
|
||||
xml_text& operator=(float rhs);
|
||||
xml_text& operator=(bool rhs);
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
#ifdef PUGIXML_HAS_STRING_VIEW
|
||||
xml_text& operator=(string_view_t rhs);
|
||||
#endif
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
xml_text& operator=(long long rhs);
|
||||
xml_text& operator=(unsigned long long rhs);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Get the data node (node_pcdata or node_cdata) for this object
|
||||
xml_node data() const;
|
||||
@@ -834,9 +919,9 @@ namespace pugi
|
||||
typedef xml_node* pointer;
|
||||
typedef xml_node& reference;
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Default constructor
|
||||
xml_node_iterator();
|
||||
@@ -851,10 +936,10 @@ namespace pugi
|
||||
xml_node& operator*() const;
|
||||
xml_node* operator->() const;
|
||||
|
||||
const xml_node_iterator& operator++();
|
||||
xml_node_iterator& operator++();
|
||||
xml_node_iterator operator++(int);
|
||||
|
||||
const xml_node_iterator& operator--();
|
||||
xml_node_iterator& operator--();
|
||||
xml_node_iterator operator--(int);
|
||||
};
|
||||
|
||||
@@ -876,9 +961,9 @@ namespace pugi
|
||||
typedef xml_attribute* pointer;
|
||||
typedef xml_attribute& reference;
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Default constructor
|
||||
xml_attribute_iterator();
|
||||
@@ -893,10 +978,10 @@ namespace pugi
|
||||
xml_attribute& operator*() const;
|
||||
xml_attribute* operator->() const;
|
||||
|
||||
const xml_attribute_iterator& operator++();
|
||||
xml_attribute_iterator& operator++();
|
||||
xml_attribute_iterator operator++(int);
|
||||
|
||||
const xml_attribute_iterator& operator--();
|
||||
xml_attribute_iterator& operator--();
|
||||
xml_attribute_iterator operator--(int);
|
||||
};
|
||||
|
||||
@@ -912,14 +997,15 @@ namespace pugi
|
||||
typedef xml_node* pointer;
|
||||
typedef xml_node& reference;
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Default constructor
|
||||
xml_named_node_iterator();
|
||||
|
||||
// Construct an iterator which points to the specified node
|
||||
// Note: name pointer is stored in the iterator and must have a longer lifetime than iterator itself
|
||||
xml_named_node_iterator(const xml_node& node, const char_t* name);
|
||||
|
||||
// Iterator operators
|
||||
@@ -929,10 +1015,10 @@ namespace pugi
|
||||
xml_node& operator*() const;
|
||||
xml_node* operator->() const;
|
||||
|
||||
const xml_named_node_iterator& operator++();
|
||||
xml_named_node_iterator& operator++();
|
||||
xml_named_node_iterator operator++(int);
|
||||
|
||||
const xml_named_node_iterator& operator--();
|
||||
xml_named_node_iterator& operator--();
|
||||
xml_named_node_iterator operator--(int);
|
||||
|
||||
private:
|
||||
@@ -1041,11 +1127,11 @@ namespace pugi
|
||||
// Destructor, invalidates all node/attribute handles to this document
|
||||
~xml_document();
|
||||
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
// Move semantics support
|
||||
xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
|
||||
xml_document& operator=(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Removes all nodes, leaving the empty document
|
||||
void reset();
|
||||
@@ -1053,11 +1139,11 @@ namespace pugi
|
||||
// Removes all nodes, then copies the entire contents of the specified document
|
||||
void reset(const xml_document& proto);
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// Load document from stream.
|
||||
xml_parse_result load(std::basic_istream<char, std::char_traits<char> >& stream, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
|
||||
xml_parse_result load(std::basic_istream<wchar_t, std::char_traits<wchar_t> >& stream, unsigned int options = parse_default);
|
||||
#endif
|
||||
xml_parse_result load(std::basic_istream<char>& stream, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
|
||||
xml_parse_result load(std::basic_istream<wchar_t>& stream, unsigned int options = parse_default);
|
||||
#endif
|
||||
|
||||
// (deprecated: use load_string instead) Load document from zero-terminated string. No encoding conversions are applied.
|
||||
PUGIXML_DEPRECATED xml_parse_result load(const char_t* contents, unsigned int options = parse_default);
|
||||
@@ -1083,11 +1169,11 @@ namespace pugi
|
||||
// Save XML document to writer (semantics is slightly different from xml_node::print, see documentation for details).
|
||||
void save(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// Save XML document to stream (semantics is slightly different from xml_node::print, see documentation for details).
|
||||
void save(std::basic_ostream<char, std::char_traits<char> >& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
|
||||
void save(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default) const;
|
||||
#endif
|
||||
void save(std::basic_ostream<char>& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
|
||||
void save(std::basic_ostream<wchar_t>& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default) const;
|
||||
#endif
|
||||
|
||||
// Save XML to file
|
||||
bool save_file(const char* path, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
|
||||
@@ -1185,11 +1271,11 @@ namespace pugi
|
||||
xpath_variable_set(const xpath_variable_set& rhs);
|
||||
xpath_variable_set& operator=(const xpath_variable_set& rhs);
|
||||
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
// Move semantics support
|
||||
xpath_variable_set(xpath_variable_set&& rhs) PUGIXML_NOEXCEPT;
|
||||
xpath_variable_set& operator=(xpath_variable_set&& rhs) PUGIXML_NOEXCEPT;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Add a new variable or get the existing one, if the types match
|
||||
xpath_variable* add(const char_t* name, xpath_value_type type);
|
||||
@@ -1229,11 +1315,11 @@ namespace pugi
|
||||
// Destructor
|
||||
~xpath_query();
|
||||
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
// Move semantics support
|
||||
xpath_query(xpath_query&& rhs) PUGIXML_NOEXCEPT;
|
||||
xpath_query& operator=(xpath_query&& rhs) PUGIXML_NOEXCEPT;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Get query expression return type
|
||||
xpath_value_type return_type() const;
|
||||
@@ -1246,11 +1332,11 @@ namespace pugi
|
||||
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
|
||||
double evaluate_number(const xpath_node& n) const;
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// Evaluate expression as string value in the specified context; performs type conversion if necessary.
|
||||
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
|
||||
string_t evaluate_string(const xpath_node& n) const;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Evaluate expression as string value in the specified context; performs type conversion if necessary.
|
||||
// At most capacity characters are written to the destination buffer, full result size is returned (includes terminating zero).
|
||||
@@ -1279,13 +1365,13 @@ namespace pugi
|
||||
bool operator!() const;
|
||||
};
|
||||
|
||||
#ifndef PUGIXML_NO_EXCEPTIONS
|
||||
#if defined(_MSC_VER)
|
||||
// C4275 can be ignored in Visual C++ if you are deriving
|
||||
// from a type in the Standard C++ Library
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4275)
|
||||
#endif
|
||||
#ifndef PUGIXML_NO_EXCEPTIONS
|
||||
#if defined(_MSC_VER)
|
||||
// C4275 can be ignored in Visual C++ if you are deriving
|
||||
// from a type in the Standard C++ Library
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4275)
|
||||
#endif
|
||||
// XPath exception class
|
||||
class PUGIXML_CLASS xpath_exception: public std::exception
|
||||
{
|
||||
@@ -1297,15 +1383,15 @@ namespace pugi
|
||||
explicit xpath_exception(const xpath_parse_result& result);
|
||||
|
||||
// Get error message
|
||||
virtual const char* what() const throw() PUGIXML_OVERRIDE;
|
||||
virtual const char* what() const PUGIXML_NOEXCEPT PUGIXML_OVERRIDE;
|
||||
|
||||
// Get parse result
|
||||
const xpath_parse_result& result() const;
|
||||
};
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// XPath node class (either xml_node or xml_attribute)
|
||||
class PUGIXML_CLASS xpath_node
|
||||
@@ -1379,11 +1465,11 @@ namespace pugi
|
||||
xpath_node_set(const xpath_node_set& ns);
|
||||
xpath_node_set& operator=(const xpath_node_set& ns);
|
||||
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
// Move semantics support
|
||||
xpath_node_set(xpath_node_set&& rhs) PUGIXML_NOEXCEPT;
|
||||
xpath_node_set& operator=(xpath_node_set&& rhs) PUGIXML_NOEXCEPT;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Get collection type
|
||||
type_t type() const;
|
||||
@@ -1422,12 +1508,12 @@ namespace pugi
|
||||
|
||||
#ifndef PUGIXML_NO_STL
|
||||
// Convert wide string to UTF8
|
||||
std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(const wchar_t* str);
|
||||
std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(const std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >& str);
|
||||
std::basic_string<char> PUGIXML_FUNCTION as_utf8(const wchar_t* str);
|
||||
std::basic_string<char> PUGIXML_FUNCTION as_utf8(const std::basic_string<wchar_t>& str);
|
||||
|
||||
// Convert UTF8 to wide string
|
||||
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(const char* str);
|
||||
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(const std::basic_string<char, std::char_traits<char>, std::allocator<char> >& str);
|
||||
std::basic_string<wchar_t> PUGIXML_FUNCTION as_wide(const char* str);
|
||||
std::basic_string<wchar_t> PUGIXML_FUNCTION as_wide(const std::basic_string<char>& str);
|
||||
#endif
|
||||
|
||||
// Memory allocation function interface; returns pointer to allocated memory or NULL on failure
|
||||
@@ -1474,27 +1560,26 @@ namespace std
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2020 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
* Copyright (c) 2006-2025 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
@@ -31,8 +31,10 @@
|
||||
#pragma comment(lib, EGTLIBDIR "EgtGeneral" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTLIBDIR "EgtNumKernel" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTLIBDIR "EgtGeomKernel" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTLIBDIR "EgtExecutor" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTEXTDIR "/libzip/Lib/zip" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTEXTDIR "/lib3mf/Lib/lib3mf" EGTLIBVER ".lib")
|
||||
#pragma comment(lib, EGTEXTDIR "Lua/Lib/Lua54" EGTLIBVER ".lib")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user