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.
This commit is contained in:
Dario Sassi
2020-06-10 06:55:57 +00:00
parent 0ccafc14a9
commit 7ed825cf03
6 changed files with 104 additions and 17 deletions
+2 -2
View File
@@ -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
+26 -5
View File
@@ -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<ISurfFlatRegion> 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<ISurfFlatRegion> pSfr1( CreateSurfFlatRegion()) ;
if ( IsNull( pSfr1) || ! pSfr1->AddExtLoop( Release( pCrvCompo)))
+23 -1
View File
@@ -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<ICurve> 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) ;
BIN
View File
Binary file not shown.
+52 -9
View File
@@ -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 ;
+1
View File
@@ -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) ;