From 7ed825cf0341c32da3ac6c19f8facc54338bbf0c Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Wed, 10 Jun 2020 06:55:57 +0000 Subject: [PATCH] EgtExchange 2.2f3 : - in import BTL aggiunte curve per smussi a processo DoubleCut (1/2-011-X) - in import BTL estesa gestione Outline e Aperture. --- BtlGeom.h | 4 +-- BtlGeomOutline.cpp | 31 +++++++++++++++++++---- BtlGeomProc.cpp | 24 +++++++++++++++++- EgtExchange.rc | Bin 11670 -> 11670 bytes ImportBtl.cpp | 61 ++++++++++++++++++++++++++++++++++++++------- ImportBtl.h | 1 + 6 files changed, 104 insertions(+), 17 deletions(-) diff --git a/BtlGeom.h b/BtlGeom.h index d09cf6c..a1a1661 100644 --- a/BtlGeom.h +++ b/BtlGeom.h @@ -40,8 +40,8 @@ class BtlGeom bool SortParts( void) ; public : // Outline - bool AddPartOutline( int nSide, const FCEDEQUE& dqFce) ; - bool AddPartAperture( int nSide, const FCEDEQUE& dqFce) ; + bool AddPartOutline( int nSide, const FCEDEQUE& dqFce, const STRVECTOR& vsUAtt) ; + bool AddPartAperture( int nSide, const FCEDEQUE& dqFce, const STRVECTOR& vsUAtt) ; bool AddPartStdOutline( void) ; public : // Proc diff --git a/BtlGeomOutline.cpp b/BtlGeomOutline.cpp index 5242653..9ab0aa6 100644 --- a/BtlGeomOutline.cpp +++ b/BtlGeomOutline.cpp @@ -31,7 +31,7 @@ using namespace std ; //---------------------------------------------------------------------------- bool -BtlGeom::AddPartOutline( int nSide, const FCEDEQUE& dqFce) +BtlGeom::AddPartOutline( int nSide, const FCEDEQUE& dqFce, const STRVECTOR& vsUAtt) { // verifico esistenza pezzo if ( m_nBoxId == GDB_ID_NULL) @@ -75,10 +75,19 @@ BtlGeom::AddPartOutline( int nSide, const FCEDEQUE& dqFce) int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pStm)) ; if ( nId == GDB_ID_NULL) return false ; - m_pGDB->SetName( nId, GetOutlineOutName( nSide)) ; - Color cCol = m_OutsCol ; - cCol.SetAlpha( 80) ; + // colore + Color cCol = m_ProcsCol ; + //cCol.SetAlpha( 80) ; m_pGDB->SetMaterial( nId, cCol) ; + // nome + m_pGDB->SetName( nId, GetOutlineOutName( nSide)) ; + // info con tipo + m_pGDB->SetInfo( nId, IKEY_GROUP, 4) ; + m_pGDB->SetInfo( nId, IKEY_PROC, 251) ; + m_pGDB->SetInfo( nId, IKEY_SIDE, nSide) ; + // elenco degli eventuali attributi utente + if ( ! SetUserAttributes( nId, vsUAtt)) + return false ; // Creo le regioni sopra e sotto PtrOwner pSfr1( CreateSurfFlatRegion()) ; if ( IsNull( pSfr1) || ! pSfr1->AddExtLoop( Release( pCrvCompo))) @@ -107,7 +116,7 @@ BtlGeom::AddPartOutline( int nSide, const FCEDEQUE& dqFce) //---------------------------------------------------------------------------- bool -BtlGeom::AddPartAperture( int nSide, const FCEDEQUE& dqFce) +BtlGeom::AddPartAperture( int nSide, const FCEDEQUE& dqFce, const STRVECTOR& vsUAtt) { // verifico esistenza pezzo if ( m_nBoxId == GDB_ID_NULL) @@ -150,7 +159,19 @@ BtlGeom::AddPartAperture( int nSide, const FCEDEQUE& dqFce) int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pStm)) ; if ( nId == GDB_ID_NULL) return false ; + // colore + Color cCol = m_ProcsCol ; + //cCol.SetAlpha( 80) ; + m_pGDB->SetMaterial( nId, cCol) ; + // nome m_pGDB->SetName( nId, GetOutlineApertureName( nSide)) ; + // info con tipo + m_pGDB->SetInfo( nId, IKEY_GROUP, 4) ; + m_pGDB->SetInfo( nId, IKEY_PROC, 252) ; + m_pGDB->SetInfo( nId, IKEY_SIDE, nSide) ; + // elenco degli eventuali attributi utente + if ( ! SetUserAttributes( nId, vsUAtt)) + return false ; // Creo le regioni sopra e sotto PtrOwner pSfr1( CreateSurfFlatRegion()) ; if ( IsNull( pSfr1) || ! pSfr1->AddExtLoop( Release( pCrvCompo))) diff --git a/BtlGeomProc.cpp b/BtlGeomProc.cpp index 01dd00c..57f3439 100644 --- a/BtlGeomProc.cpp +++ b/BtlGeomProc.cpp @@ -87,7 +87,7 @@ using namespace std ; #define IS_TRIANGLE_CUT( nG, nP) ( ( nGroup == 4) && nProc == 120) #define IS_TYROLEAN_DOVETAIL( nG, nP) ( ( nGroup == 1 || nGroup == 2 || nGroup == 3 || nGroup == 4) && nProc == 136) #define IS_DOVETAIL( nG, nP) ( ( nGroup == 1 || nGroup == 2 || nGroup == 3 || nGroup == 4) && nProc == 138) -#define IS_FREE_CONTOUR( nG, nP) ( ( nGroup == 0 || nGroup == 3 || nGroup == 4) && nProc == 250) +#define IS_FREE_CONTOUR( nG, nP) ( ( nGroup == 0 || nGroup == 3 || nGroup == 4) && (nProc == 250 || nProc == 251 || nProc == 252)) //---------------------------------------------------------------------------- const double COS_ALMOST_PERP = cos( 85. * DEGTORAD) ; @@ -1112,16 +1112,38 @@ BtlGeom::AddDoubleCut( int nGroup, int nProc, int nSide, const string& sDes, int ! DoSewing( pStm, plyCut2)) return false ; pStm->DoCompacting() ; + // calcolo la direttrice di questa superficie rigata + PtrOwner pCrv ; + if ( abs( dInclination1 - ANG_RIGHT) < EPS_SMALL && abs( dInclination2 - ANG_RIGHT) < EPS_SMALL) { + int nAdjSide = ( nSide + 1 <= 4 ? nSide + 1 : 1) ; + Vector3d vtNorm ; pStm->GetFacetNormal( 0, vtNorm) ; + Vector3d vtExtr = GetSideVersN( nAdjSide) ^ vtNorm ; + pCrv.Set( GetDirectrixOfRuledSurf( pStm, vtExtr)) ; + if ( IsNull( pCrv)) + return false ; + // imposto estrusione e spessore + pCrv->SetExtrusion( vtExtr) ; + pCrv->SetThickness( -GetSideWidth( nAdjSide)) ; + } // inserisco la superficie nel DB geometrico int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pStm)) ; if ( nId == GDB_ID_NULL) return false ; + // inserisco la curva nel DB geometrico + int nTId = GDB_ID_NULL ; + if ( ! IsNull( pCrv)) { + nTId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pCrv)) ; + if ( nTId == GDB_ID_NULL) + return false ; + } // colore semitrasparente SetAlpha( nId, 80) ; // nome e info con tipo SetNameAndInfo( nId, nGroup, nProc, nSide, sDes, nProcId) ; // parametri SetParams( nId, vnDPar, vdPar, vsUAtt) ; + // identificativi di geometrie ausiliarie + SetAuxId( nId, {nTId}) ; // aggiusto l'outline if ( UseProcessToTrimOutline( nId)) TrimOutline( nId) ; diff --git a/EgtExchange.rc b/EgtExchange.rc index a06ef6d06277b6e4cdf23a26724194453bc74a60..13d0ed2ba5d555704f47ba7325c92841c49ef171 100644 GIT binary patch delta 86 zcmbOhJuP~}FE&Qw&3E|@GELsYnFC~gl&oglyoB3=87yoFqCQGiGH&h=wt@&Dsoczh KrYJz!jSB#V(H`0W delta 86 zcmbOhJuP~}FE&P_&3E|@GELsYnFC~gl&oglyoB3=87yoFqCQGiGH&h=wt@&Dsoc!M OXb9AcP!yo-#svU{Z6478 diff --git a/ImportBtl.cpp b/ImportBtl.cpp index 764dcdf..585164d 100644 --- a/ImportBtl.cpp +++ b/ImportBtl.cpp @@ -59,6 +59,7 @@ static const std::string PAR_XZ = "XZ" ; static const std::string PAR_YX = "YX" ; static const std::string PAR_YY = "YY" ; static const std::string PAR_YZ = "YZ" ; +static const std::string PAR_PROCESS = "PROCESS" ; static const std::string PAR_SIDE = "SIDE" ; static const std::string PAR_P = "P" ; @@ -485,16 +486,23 @@ ImportBtl::ReadTransformation( const string& sVal, Frame3d& frRef) bool ImportBtl::ReadOutline( void) { + bool bProcFound = false ; int nSide = BTL_SIDE_NONE ; FCEDEQUE dqFce ; + STRVECTOR vsUAtt ; // ciclo sulle linee string sLine ; while ( m_theScanner.GetLine( sLine)) { // spezzo la linea string sKey, sVal ; SplitFirst( sLine, ":", sKey, sVal) ; + // se attributo utente + if ( sKey == KEY_USERATTRIBUTE) { + vsUAtt.emplace_back( sVal) ; + continue ; + } // se cambio tipologia, concludo - if ( sKey != KEY_OUTLINE) { + else if ( sKey != KEY_OUTLINE) { m_theScanner.UngetLine( sLine) ; break ; } @@ -502,6 +510,14 @@ ImportBtl::ReadOutline( void) // tipo int nFlag ; GetParamP( sVal, 8, nFlag) ; + // se non ancora assegnato, leggo se da lavorare + if ( ! bProcFound) { + string sToDo ; + GetInfo( sVal, PAR_PROCESS, sToDo) ; + if ( sToDo.find( "YES") != 0) + vsUAtt.emplace_back( "DO:0") ; + bProcFound = true ; + } // se non ancora assegnata, leggo faccia di riferimento if ( nSide == BTL_SIDE_NONE) GetInfo( sVal, PAR_SIDE, nSide) ; @@ -521,23 +537,30 @@ ImportBtl::ReadOutline( void) dqFce.emplace_back( nFlag, ptP, ptM, 0., 0, 0) ; } // inserimento del contorno nel pezzo - return m_BtlGeom.AddPartOutline( nSide, dqFce) ; + return m_BtlGeom.AddPartOutline( nSide, dqFce, vsUAtt) ; } //---------------------------------------------------------------------------- bool ImportBtl::ReadAperture( void) { + bool bProcFound = false ; int nSide = BTL_SIDE_NONE ; FCEDEQUE dqFce ; + STRVECTOR vsUAtt ; // ciclo sulle linee string sLine ; while ( m_theScanner.GetLine( sLine)) { // spezzo la linea string sKey, sVal ; SplitFirst( sLine, ":", sKey, sVal) ; + // se attributo utente + if ( sKey == KEY_USERATTRIBUTE) { + vsUAtt.emplace_back( sVal) ; + continue ; + } // se cambio tipologia, concludo - if ( sKey != KEY_APERTURE) { + else if ( sKey != KEY_APERTURE) { m_theScanner.UngetLine( sLine) ; break ; } @@ -547,10 +570,20 @@ ImportBtl::ReadAperture( void) GetParamP( sVal, 8, nFlag) ; // se tipo start ed esistono precedenti entità, ne derivo una apertura if ( nFlag == FreeContourEnt::START && dqFce.size() > 0) { - if ( ! m_BtlGeom.AddPartAperture( nSide, dqFce)) + if ( ! m_BtlGeom.AddPartAperture( nSide, dqFce, vsUAtt)) return false ; nSide = BTL_SIDE_NONE ; + bProcFound = false ; dqFce.clear() ; + vsUAtt.clear() ; + } + // se non ancora assegnato, leggo se da lavorare + if ( ! bProcFound) { + string sToDo ; + GetInfo( sVal, PAR_PROCESS, sToDo) ; + if ( sToDo.find( "YES") != 0) + vsUAtt.emplace_back( "DO:0") ; + bProcFound = true ; } // se non ancora assegnata, leggo faccia di riferimento if ( nSide == BTL_SIDE_NONE) @@ -571,7 +604,7 @@ ImportBtl::ReadAperture( void) dqFce.emplace_back( nFlag, ptP, ptM, 0., 0, 0) ; } // inserimento dell'ultima apertura nel pezzo - return m_BtlGeom.AddPartAperture( nSide, dqFce) ; + return m_BtlGeom.AddPartAperture( nSide, dqFce, vsUAtt) ; } //---------------------------------------------------------------------------- @@ -777,16 +810,26 @@ ImportBtl::GetProcessParams( const string& sText, const string& sProcType, //---------------------------------------------------------------------------- bool -ImportBtl::GetInfo( const string& sText, const string& sPar, int& nVal) +ImportBtl::GetInfo( const string& sText, const string& sPar, string& sVal) { // cerco l'identificativo del parametro size_t nPos = sText.find( sPar + ":") ; if ( nPos == string::npos) return false ; // recupero la stringa successiva - const int SVAL_LEN = 14 ; - string sVal = sText.substr( nPos + sPar.length() + 1, SVAL_LEN) ; - TrimLeft( sVal, " \t\r\n0") ; + const int SVAL_LEN = 6 ; + sVal = sText.substr( nPos + sPar.length() + 1, SVAL_LEN) ; + Trim( sVal, " \t\r\n0") ; + return true ; +} + +//---------------------------------------------------------------------------- +bool +ImportBtl::GetInfo( const string& sText, const string& sPar, int& nVal) +{ + string sVal ; + if ( ! GetInfo( sText, sPar, sVal)) + return false ; nVal = 0 ; FromString( sVal, nVal) ; return true ; diff --git a/ImportBtl.h b/ImportBtl.h index 3c59625..0db147c 100644 --- a/ImportBtl.h +++ b/ImportBtl.h @@ -41,6 +41,7 @@ class ImportBtl : public IImportBtl bool GetProcessParams( const std::string& sText, const std::string& sProcType, const INTVECTOR& vnDPar, int nSPar, DBLVECTOR& vdPar, std::string& sPar) ; + bool GetInfo( const std::string& sText, const std::string& sPar, std::string& sVal) ; bool GetInfo( const std::string& sText, const std::string& sPar, int& nVal) ; bool GetParam( const std::string& sText, const std::string& sPar, double& dVal) ; bool GetParam( const std::string& sText, const std::string& sPar, std::string& sVal) ;