EgtExchange 2.3c3 :

- in importBTL migliorata gestione tasche di mortase a coda di rondine (anche di testa).
This commit is contained in:
Dario Sassi
2021-03-26 11:07:02 +00:00
parent 07f5866b2a
commit bc286fd2ed
4 changed files with 91 additions and 8 deletions
+1
View File
@@ -217,6 +217,7 @@ class BtlGeom
bool DoSewing( ISurfTriMesh* pStm, const Polygon3d& Polyg) ;
bool TrimSurfTmWithBox( ISurfTriMesh* pStm) ;
bool TrimFlatCurveWithBox( ICurve* pCurve) ;
ICurve* TrimFlatCurveWithBoxEx( ICurve* pCurve) ;
bool TrimSegmentWithBox( Point3d& ptP1, Point3d& ptP2, double dRad) ;
ICurveComposite* CurveFromFces( const FCEDEQUE& dqFce, int nStartInd = 0) ;
ICurve* GetDirectrixOfRuledSurf( const ISurfTriMesh* pStm, const Vector3d& vtExtr) ;
+1
View File
@@ -97,6 +97,7 @@ const double DTMORT_EXTRA_LEN = 10.0 ;
// minima e massima dimensione tasca per mortasa a coda di rondine
const double MIN_DTMORT_POCKET = 30.0 ;
const double MAX_DTMORT_POCKET = 200.0 ;
const double MIN_DTMORT_AREA = 100.0 ;
// angolo di fianco per contorno libero default e non definito
const double FC_SIDEANG_DEF = 0.0 ;
const double FC_SIDEANG_NONE = 999.0 ;
+89 -8
View File
@@ -4126,14 +4126,23 @@ BtlGeom::AddDovetailMortise( int nGroup, int nProc, int nSide, const string& sDe
// inserisco eventuale curva della tasca nel DB geometrico
int nPId = GDB_ID_NULL ;
if ( ! IsNull( pCrvPock)) {
nPId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pCrvPock)) ;
if ( nPId == GDB_ID_NULL)
return false ;
PtrOwner<ICurve> pNewPock( TrimFlatCurveWithBoxEx( Release( pCrvPock))) ;
Plane3d plPlane ; double dArea ;
if ( IsNull( pNewPock) || ! pNewPock->GetArea( plPlane, dArea) || dArea < MIN_DTMORT_AREA) {
nPock = 0 ;
}
else {
nPId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pNewPock)) ;
if ( nPId == GDB_ID_NULL)
return false ;
}
}
// nome e info con tipo
SetNameAndInfo( nId, nGroup, nProc, nSide, sDes, nProcId) ;
// parametri
SetParams( nId, vnDPar, vdPar, vsUAtt) ;
DBLVECTOR vdMyPar = vdPar ;
vdMyPar[4] = nPock ;
SetParams( nId, vnDPar, vdMyPar, vsUAtt) ;
// identificativi di geometrie ausiliarie
SetAuxId( nId, {nMId, nPId}) ;
@@ -4374,14 +4383,23 @@ BtlGeom::AddDtMortiseFront( int nGroup, int nProc, int nSide, const string& sDes
// inserisco eventuale curva della tasca nel DB geometrico
int nPId = GDB_ID_NULL ;
if ( ! IsNull( pCrvPock)) {
nPId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pCrvPock)) ;
if ( nPId == GDB_ID_NULL)
return false ;
PtrOwner<ICurve> pNewPock( TrimFlatCurveWithBoxEx( Release( pCrvPock))) ;
Plane3d plPlane ; double dArea ;
if ( IsNull( pNewPock) || ! pNewPock->GetArea( plPlane, dArea) || dArea < MIN_DTMORT_AREA) {
nPock = 0 ;
}
else {
nPId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pNewPock)) ;
if ( nPId == GDB_ID_NULL)
return false ;
}
}
// nome e info con tipo
SetNameAndInfo( nId, nGroup, nProc, nSide, sDes, nProcId) ;
// parametri
SetParams( nId, vnDPar, vdPar, vsUAtt) ;
DBLVECTOR vdMyPar = vdPar ;
vdMyPar[4] = nPock ;
SetParams( nId, vnDPar, vdMyPar, vsUAtt) ;
// identificativi di geometrie ausiliarie
SetAuxId( nId, { nTId, nPId}) ;
@@ -6840,6 +6858,69 @@ BtlGeom::TrimFlatCurveWithBox( ICurve* pCurve)
return false ;
}
//----------------------------------------------------------------------------
ICurve*
BtlGeom::TrimFlatCurveWithBoxEx( ICurve* pCurve)
{
// verifico esistenza curva
PtrOwner< ICurve> pMyCrv( pCurve) ;
if ( IsNull( pMyCrv))
return nullptr ;
// determino il piano della curva
Plane3d plPlane ;
if ( ! pCurve->IsFlat( plPlane, false, 10 * EPS_SMALL))
return nullptr ;
// determino la parte di piano (poligono) compresa nel box della trave
Polygon3d Polyg ;
if ( ! Polyg.FromPlaneTrimmedWithBox( plPlane, ORIG, ORIG + m_vtDim, true, true))
return nullptr ;
// creo la regione corrispondente
PtrOwner<ICurveComposite> pCrv( CreateCurveComposite()) ;
if ( IsNull( pCrv) || ! pCrv->FromPolyLine( Polyg.GetPolyLine()))
return nullptr ;
PtrOwner<ISurfFlatRegion> pSfr( CreateSurfFlatRegion()) ;
if ( IsNull( pSfr) || ! pSfr->AddExtLoop( Release( pCrv)))
return nullptr ;
// se curva aperta
if ( ! pMyCrv->IsClosed()) {
// calcolo la classificazione della curva rispetto alla regione
CRVCVECTOR ccClass ;
if ( ! pSfr->GetCurveClassification( *pMyCrv, ccClass))
return nullptr ;
// determino gli intervalli di curva da conservare
Intervals inOk ;
for ( auto& ccOne : ccClass) {
if ( ccOne.nClass == CRVC_IN ||
ccOne.nClass == CRVC_ON_P || ccOne.nClass == CRVC_ON_M)
inOk.Add( ccOne.dParS, ccOne.dParE) ;
}
// considero solo min-max degli intervalli
if ( inOk.GetCount() >= 1) {
// eseguo il taglio
double dParS, dParE ;
inOk.GetMinMax( dParS, dParE) ;
if ( ! pMyCrv->TrimStartEndAtParam( dParS, dParE))
return nullptr ;
}
return Release( pMyCrv) ;
}
// altrimenti curva chiusa
else {
// creo la regione delimitata dalla curva chiusa
PtrOwner<ISurfFlatRegion> pSfrCrv( CreateSurfFlatRegion()) ;
if ( IsNull( pSfrCrv) || ! pSfrCrv->AddExtLoop( Release( pMyCrv)))
return nullptr ;
// eseguo l'intersezione tra le due regioni
if ( ! pSfrCrv->Intersect( *pSfr))
return nullptr ;
// recupero il contorno esterno della nuova regione
PtrOwner<ICurve> pNewCrv( pSfrCrv->GetLoop( 0, 0)) ;
return Release( pNewCrv) ;
}
return nullptr ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::TrimSegmentWithBox( Point3d& ptP1, Point3d& ptP2, double dRad)
BIN
View File
Binary file not shown.