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 ;
|
||||
}
|
||||
@@ -39,6 +39,7 @@ class BtlGeom
|
||||
bool AdjustPartFlatOrVertPos( int nPartId) ;
|
||||
std::string GetPartName( void) ;
|
||||
bool SetUserAttribute( int nUAttrDest, const std::string& sString) ;
|
||||
bool SortParts( void) ;
|
||||
|
||||
public : // Outline
|
||||
bool AddPartOutline( int nSide, const FCEDEQUE& dqFce) ;
|
||||
@@ -150,7 +151,7 @@ class BtlGeom
|
||||
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
|
||||
bool AddFreeContour( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId, const Frame3d& frRef,
|
||||
const INTVECTOR& vnDPar, int nSPar, const DBLVECTOR& vdPar, const std::string& sPar, const STRVECTOR& vsUAtt) ;
|
||||
bool CreatePolygonInBox( const Point3d& ptP, const Vector3d& vtN, int nSide, Polygon3d& Polyg) ;
|
||||
bool CreatePolygonInBox( const Point3d& ptP, const Vector3d& vtN, int nSide, Polygon3d& Polyg, double dMinDim = FACE_MIN_CROSS_DIM) ;
|
||||
bool TrimPolygons( Polygon3d& plyP1, Polygon3d& plyP2, bool bInVsOut, bool bOnEq) ;
|
||||
bool VerifyPolygon( Polygon3d& plyP, double dMinDim = FACE_MIN_CROSS_DIM) ;
|
||||
bool VerifyPolygonWithPolygon( Polygon3d& plyP, const Polygon3d& plyRef, bool bInVsOut, double dMinDim = FACE_MIN_CROSS_DIM) ;
|
||||
|
||||
+24
-2
@@ -4260,7 +4260,7 @@ BtlGeom::AddFreeContour( int nGroup, int nProc, int nSide, const string& sDes, i
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
BtlGeom::CreatePolygonInBox( const Point3d& ptP, const Vector3d& vtN, int nSide, Polygon3d& Polyg)
|
||||
BtlGeom::CreatePolygonInBox( const Point3d& ptP, const Vector3d& vtN, int nSide, Polygon3d& Polyg, double dMinDim)
|
||||
{
|
||||
// calcolo il piano
|
||||
Plane3d plPlane ;
|
||||
@@ -4272,7 +4272,29 @@ BtlGeom::CreatePolygonInBox( const Point3d& ptP, const Vector3d& vtN, int nSide,
|
||||
plPlane.ToGlob( frRef) ;
|
||||
}
|
||||
// creo il poligono, limitandolo al box dell'oggetto (trave/parete)
|
||||
return Polyg.FromPlaneTrimmedWithBox( plPlane, ORIG, ORIG + m_vtDim) ;
|
||||
if ( ! Polyg.FromPlaneTrimmedWithBox( plPlane, ORIG, ORIG + m_vtDim))
|
||||
return false ;
|
||||
// verifico che il materiale lasciato non sia inferiore al minimo
|
||||
for ( int nS = BTL_SIDE_FRONT ; nS < BTL_SIDE_LEFT ; ++ nS) {
|
||||
// confronto con ogni faccia del box della trave quasi opposta
|
||||
Plane3d plFace = GetSidePlane( nS) ;
|
||||
if ( plPlane.GetVersN() * plFace.GetVersN() < -0.5) {
|
||||
// cerco minima profondità negativa
|
||||
PNTVECTOR vVert = Polyg.GetVertices() ;
|
||||
double dMinDist = 0 ;
|
||||
for ( const auto& ptV : vVert) {
|
||||
double dDist = DistPointPlane( ptV, plFace) ;
|
||||
if ( dDist < dMinDist)
|
||||
dMinDist = dDist ;
|
||||
}
|
||||
// se profondità non sufficicente, allora elimino la faccia
|
||||
if ( dMinDist > - abs( dMinDim)) {
|
||||
Polyg.Clear() ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
Binary file not shown.
@@ -149,6 +149,11 @@ ImportBtl::Import( const string& sFile, IGeomDB* pGDB, int nFlag)
|
||||
}
|
||||
}
|
||||
|
||||
// eventuale ordinamento dei pezzi secondo SN
|
||||
bool bSort = (( nFlag & EIBFLAG_SORT) != 0) ;
|
||||
if ( bSort)
|
||||
m_BtlGeom.SortParts() ;
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user