EgtExchange 2.1g1 :
- in import BTL aggiunto flag per sort travi secondo il numero di serie (SINGLEMEMBERNUMBER) - in import BTL aggiunto controllo creazione facce di feature che non siano praticamente insignificanti.
This commit is contained in:
+37
@@ -579,3 +579,40 @@ BtlGeom::SetAlpha( int nId, int nAlpha)
|
||||
cCol.SetAlpha( nAlpha) ;
|
||||
return m_pGDB->SetMaterial( nId, cCol) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::SortParts( void)
|
||||
{
|
||||
// tabella Id-SN dei pezzi
|
||||
INTINTVECTOR vIdSN ;
|
||||
|
||||
// recupero il numero di serie di ogni singolo pezzo
|
||||
int nPartId = m_pGDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
|
||||
while ( nPartId != GDB_ID_NULL) {
|
||||
int nLev ;
|
||||
if ( m_pGDB->GetCalcLevel( nPartId, nLev) && nLev == GDB_LV_USER) {
|
||||
int nSN = 0 ;
|
||||
m_pGDB->GetInfo( nPartId, IKEY_PROD_NBR, nSN) ;
|
||||
vIdSN.emplace_back( nPartId, nSN) ;
|
||||
}
|
||||
nPartId = m_pGDB->GetNextGroup( nPartId) ;
|
||||
}
|
||||
|
||||
// ordino la tabella secondo SN
|
||||
sort( vIdSN.begin(), vIdSN.end(), []( const INTINT& a, const INTINT& b)
|
||||
{ return a.second < b.second ; }) ;
|
||||
|
||||
// cambio posizione dei pezzi nel DB come da ordine in tabella
|
||||
Point3d ptIns ;
|
||||
for ( int i = 0 ; i < int( vIdSN.size()) ; ++ i) {
|
||||
m_pGDB->Relocate( vIdSN[i].first, GDB_ID_ROOT, GDB_LAST_SON) ;
|
||||
BBox3d b3Part ;
|
||||
int nBoxId = m_pGDB->GetFirstNameInGroup( vIdSN[i].first, BOX_LAYER_NAME) ;
|
||||
m_pGDB->GetGlobalBBox( nBoxId, b3Part) ;
|
||||
m_pGDB->Translate( vIdSN[i].first, ptIns - b3Part.GetMin()) ;
|
||||
ptIns += Vector3d( 0, b3Part.GetMax().y - b3Part.GetMin().y + 300, 0) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
Reference in New Issue
Block a user