EgtExchange 3.1a2 :

- per BTL aggiunta possibilità di gestione geometrica del PARTOFFSET (controllata da flag).
This commit is contained in:
Dario Sassi
2026-01-23 18:53:20 +01:00
parent e7e7cb21bd
commit 9577795c73
9 changed files with 104 additions and 7 deletions
+2 -1
View File
@@ -71,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, false)) {
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 ;
}
+66 -1
View File
@@ -42,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) ;
@@ -77,7 +79,8 @@ BtlGeom::~BtlGeom( void)
//----------------------------------------------------------------------------
bool
BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim, bool bTrimWithOutline, bool bUseUAttr, bool bIsAdding)
BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim,
bool bTrimWithOutline, bool bUseUAttr, bool bPartOffset, bool bIsAdding)
{
// salvo puntatore a DB geometrico
m_pGDB = pGDB ;
@@ -88,6 +91,7 @@ BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim, bool bTrimWit
m_bSpecialTrim = bSpecialTrim ;
m_bTrimWithOutline = bTrimWithOutline ;
m_bUseUAttr = bUseUAttr ;
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())
@@ -627,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)
+5 -1
View File
@@ -26,7 +26,8 @@ class BtlGeom
public :
BtlGeom( void) ;
~BtlGeom( void) ;
bool Init( IGeomDB* pGDB, int nFlatPos, bool bSpecialTrim, bool bTrimWithOutline, bool bUseUAttr, bool bIsAdding) ;
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) ;
@@ -273,7 +275,9 @@ class BtlGeom
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
+1
View File
@@ -88,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" ;
BIN
View File
Binary file not shown.
+26 -3
View File
@@ -57,6 +57,7 @@ CreateImportBtl( void)
ImportBtl::ImportBtl( void)
{
m_nBuild = 10000 ;
m_nEdition = 0 ;
m_dScale = 1 ;
}
@@ -86,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, true)) {
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 ;
}
@@ -535,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\"") ;
@@ -684,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)
+1
View File
@@ -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) ;
+2 -1
View File
@@ -74,7 +74,8 @@ ImportBtlx::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, true)) {
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 ;
}
+1
View File
@@ -205,6 +205,7 @@ ImportCnc::ProcessLine( const string& sLine)
if ( nStart != string::npos)
sMyLine.erase( nStart) ;
ReplaceString( sMyLine, "SUPA", "G79") ;
ReplaceString( sMyLine, "AC(", "") ;
}
// divido la linea in parti