diff --git a/BtlGeom.cpp b/BtlGeom.cpp index 0d9924a..091ce35 100644 --- a/BtlGeom.cpp +++ b/BtlGeom.cpp @@ -247,6 +247,17 @@ BtlGeom::ErasePart( void) // se non c'è il DB geometrico o il pezzo corrente, errore if ( m_pGDB == nullptr || m_nPartId == GDB_ID_NULL) return false ; + // rimuovo eventuali riferimenti e copie nell'assemblato + int nAsseBaseRefId = GDB_ID_NULL ; + if ( m_pGDB->GetInfo( m_nPartId, GDB_SI_LIST, nAsseBaseRefId)) { + m_pGDB->Erase( nAsseBaseRefId) ; + int nInd = 1 ; + int nSouPartId = GDB_ID_NULL ; + while ( m_pGDB->GetInfo( nAsseBaseRefId + nInd, GDB_SI_SOURCE, nSouPartId) && nSouPartId == m_nPartId) { + m_pGDB->Erase( nAsseBaseRefId + nInd) ; + ++ nInd ; + } + } // cancello il pezzo m_pGDB->Erase( m_nPartId) ; // annullo tutti gli identificativi del pezzo diff --git a/BtlGeom.h b/BtlGeom.h index d3a7eb3..c6f40fb 100644 --- a/BtlGeom.h +++ b/BtlGeom.h @@ -217,6 +217,7 @@ class BtlGeom ISurfTriMesh* CreateOneCurveFreeContour( const ICurveComposite* pCrvCompo) ; bool AdjustFreeContourCurve( ICurve* pCrv, int nSide, bool& bClosed, bool& bEndsOnCont) ; bool VerifyFreeContourCurveSideAng( const ICurveComposite* pCrvCompo) ; + bool GetFreeContourCurveSideAngles( const ICurveComposite* pCrvCompo, DBLVECTOR& vSideAng) ; bool CreatePolygonInBox( const Point3d& ptP, const Vector3d& vtN, int nSide, Polygon3d& Polyg, double dMatMin = FACE_MIN_BACK_MAT, double dAreaMin = FACE_MIN_BACK_AREA) ; double GetPlaneElevation( const Plane3d& plPlane) ; diff --git a/BtlGeomCoStru.h b/BtlGeomCoStru.h index c432194..cb1b72d 100644 --- a/BtlGeomCoStru.h +++ b/BtlGeomCoStru.h @@ -67,6 +67,7 @@ static const std::string IKEY_AUXID = "AUXID" ; static const std::string IKEY_ORIGID = "ORIGID" ; static const std::string IKEY_START_FACE = "FCS" ; static const std::string IKEY_END_FACE = "FCE" ; +static const std::string IKEY_SIDEANGS = "SideAngs" ; static const std::string IKEY_DEPTH = "DEPTH" ; static const std::string IKEY_POCKET = "PCKT" ; static const std::string IKEY_RULED = "RULED" ; diff --git a/BtlGeomOutline.cpp b/BtlGeomOutline.cpp index a1ab07e..79e6a29 100644 --- a/BtlGeomOutline.cpp +++ b/BtlGeomOutline.cpp @@ -77,8 +77,14 @@ BtlGeom::AddPartOutline( int nSide, const FCEDEQUE& dqFce, int nContType, int nC int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pStm)) ; if ( nId == GDB_ID_NULL) return false ; + // recupero eventuali angoli di fianco + DBLVECTOR vSideAng ; + if ( VerifyFreeContourCurveSideAng( pCrvCompo)) + GetFreeContourCurveSideAngles( pCrvCompo, vSideAng) ; // inserisco la curva nel DB geometrico int nTId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pCrvCompo)) ; + if ( nTId != GDB_ID_NULL && vSideAng.size() > 0) + m_pGDB->SetInfo( nTId, IKEY_SIDEANGS, vSideAng) ; // colore Color cCol = m_ProcsCol ; m_pGDB->SetMaterial( nId, cCol) ; @@ -152,6 +158,13 @@ BtlGeom::AddPartOutline( int nSide, int nCrvId, const DBLVECTOR& vdPar, const ST // verifico che sia chiuso if ( ! pCrvCompo->IsClosed()) return false ; + // assegno eventuali angoli di fianco + { DBLVECTOR vSideAng ; + if ( m_pGDB->GetInfo( nCrvId, IKEY_SIDEANGS, vSideAng)) { + for ( int i = 0 ; i < int( vSideAng.size()) ; ++ i) + pCrvCompo->SetCurveTempProp( i, int( vSideAng[i] * 1000)) ; + } + } // Lo porto nel riferimento del lato e ve lo appiattisco Frame3d frRef = GetSideFrame( nSide) ; pCrvCompo->ToLoc( frRef) ; @@ -164,7 +177,7 @@ BtlGeom::AddPartOutline( int nSide, int nCrvId, const DBLVECTOR& vdPar, const ST for ( int i = 0 ; i < pCrvCompo->GetCurveCount() ; ++ i) { int nAng ; if ( pCrvCompo->GetCurveTempProp( i, nAng) && abs( nAng) > 10) - pCrvCompo->SetCurveTempProp( i, - nAng) ; + pCrvCompo->SetCurveTempProp( i, -nAng) ; } } // Porto il percorso sul piano corretto @@ -181,8 +194,14 @@ BtlGeom::AddPartOutline( int nSide, int nCrvId, const DBLVECTOR& vdPar, const ST int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pStm)) ; if ( nId == GDB_ID_NULL) return false ; + // recupero eventuali angoli di fianco + DBLVECTOR vSideAng ; + if ( VerifyFreeContourCurveSideAng( pCrvCompo)) + GetFreeContourCurveSideAngles( pCrvCompo, vSideAng) ; // inserisco la curva nel DB geometrico int nTId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pCrvCompo)) ; + if ( nTId != GDB_ID_NULL && vSideAng.size() > 0) + m_pGDB->SetInfo( nTId, IKEY_SIDEANGS, vSideAng) ; // colore Color cCol = m_ProcsCol ; m_pGDB->SetMaterial( nId, cCol) ; @@ -253,8 +272,14 @@ BtlGeom::AddPartAperture( int nSide, const FCEDEQUE& dqFce, int nContType, int n int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pStm)) ; if ( nId == GDB_ID_NULL) return false ; + // recupero eventuali angoli di fianco + DBLVECTOR vSideAng ; + if ( VerifyFreeContourCurveSideAng( pCrvCompo)) + GetFreeContourCurveSideAngles( pCrvCompo, vSideAng) ; // inserisco la curva nel DB geometrico int nTId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pCrvCompo)) ; + if ( nTId != GDB_ID_NULL && vSideAng.size() > 0) + m_pGDB->SetInfo( nTId, IKEY_SIDEANGS, vSideAng) ; // colore Color cCol = m_ProcsCol ; m_pGDB->SetMaterial( nId, cCol) ; @@ -312,6 +337,13 @@ BtlGeom::AddPartAperture( int nSide, int nCrvId, const DBLVECTOR& vdPar, const S // verifico che sia chiuso if ( ! pCrvCompo->IsClosed()) return false ; + // assegno eventuali angoli di fianco + { DBLVECTOR vSideAng ; + if ( m_pGDB->GetInfo( nCrvId, IKEY_SIDEANGS, vSideAng)) { + for ( int i = 0 ; i < int( vSideAng.size()) ; ++ i) + pCrvCompo->SetCurveTempProp( i, int( vSideAng[i] * 1000)) ; + } + } // Lo porto nel riferimento del lato e ve lo appiattisco Frame3d frRef = GetSideFrame( nSide) ; pCrvCompo->ToLoc( frRef) ; @@ -335,8 +367,14 @@ BtlGeom::AddPartAperture( int nSide, int nCrvId, const DBLVECTOR& vdPar, const S int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pStm)) ; if ( nId == GDB_ID_NULL) return false ; + // recupero eventuali angoli di fianco + DBLVECTOR vSideAng ; + if ( VerifyFreeContourCurveSideAng( pCrvCompo)) + GetFreeContourCurveSideAngles( pCrvCompo, vSideAng) ; // inserisco la curva nel DB geometrico int nTId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pCrvCompo)) ; + if ( nTId != GDB_ID_NULL && vSideAng.size() > 0) + m_pGDB->SetInfo( nTId, IKEY_SIDEANGS, vSideAng) ; // colore Color cCol = m_ProcsCol ; m_pGDB->SetMaterial( nId, cCol) ; diff --git a/BtlGeomProc.cpp b/BtlGeomProc.cpp index 185ee5d..03e577a 100644 --- a/BtlGeomProc.cpp +++ b/BtlGeomProc.cpp @@ -6700,6 +6700,8 @@ BtlGeom::AdjustFreeContourCurve( ICurve* pCrv, int nSide, bool& bClosed, bool& b bool BtlGeom::VerifyFreeContourCurveSideAng( const ICurveComposite* pCrvCompo) { + if ( pCrvCompo == nullptr) + return false ; bool bSideAng = false ; for ( int i = 0 ; i < pCrvCompo->GetCurveCount() ; ++ i) { int nAng ; @@ -6711,6 +6713,20 @@ BtlGeom::VerifyFreeContourCurveSideAng( const ICurveComposite* pCrvCompo) return bSideAng ; } +//---------------------------------------------------------------------------- +bool +BtlGeom::GetFreeContourCurveSideAngles( const ICurveComposite* pCrvCompo, DBLVECTOR& vSideAng) +{ + if ( pCrvCompo == nullptr) + return false ; + for ( int i = 0 ; i < pCrvCompo->GetCurveCount() ; ++ i) { + int nAng = 0 ; + pCrvCompo->GetCurveTempProp( i, nAng) ; + vSideAng.emplace_back( nAng / 1000.) ; + } + return true ; +} + //---------------------------------------------------------------------------- static ISurfTriMesh* MyCreateSubSurfTm( const ISurfTriMesh* pStm, const INTVECTOR& vTria) @@ -7075,8 +7091,14 @@ BtlGeom::CreateFreeContours( void) continue ; // eseguo trim con le facce della trave TrimFlatCurveWithBox( pCrvCompo, FC_OUT_CRV_TOL) ; + // recupero eventuali angoli di fianco + DBLVECTOR vSideAng ; + if ( bOneCurve && VerifyFreeContourCurveSideAng( pCrvCompo)) + GetFreeContourCurveSideAngles( pCrvCompo, vSideAng) ; // inserisco la curva nel DB geometrico int nTId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pCrvCompo)) ; + if ( nTId != GDB_ID_NULL && vSideAng.size() > 0) + m_pGDB->SetInfo( nTId, IKEY_SIDEANGS, vSideAng) ; // inserisco eventuale seconda curva int nT2Id = GDB_ID_NULL ; if ( ! bOneCurve) { @@ -7177,6 +7199,13 @@ BtlGeom::AddOneFreeContour( int nGroup, int nProc, int nSide, const string& sDes else if ( nCrvCnt == 1) { // se previsto, imposto spessore pCrvCompo->SetThickness( -dDepth) ; + // assegno eventuali angoli di fianco + { DBLVECTOR vSideAng ; + if ( m_pGDB->GetInfo( nCrvId, IKEY_SIDEANGS, vSideAng)) { + for ( int i = 0 ; i < int( vSideAng.size()) ; ++ i) + pCrvCompo->SetCurveTempProp( i, int( vSideAng[i] * 1000)) ; + } + } // porto la curva nel riferimento della faccia Frame3d frSide = GetSideFrame( nSide) ; pCrvCompo->ToLoc( frSide) ; @@ -7334,8 +7363,14 @@ BtlGeom::AddOneFreeContour( int nGroup, int nProc, int nSide, const string& sDes return false ; // eseguo trim con le facce della trave TrimFlatCurveWithBox( pCrvCompo, FC_OUT_CRV_TOL) ; + // recupero eventuali angoli di fianco + DBLVECTOR vSideAng ; + if ( nCrvCnt == 1 && VerifyFreeContourCurveSideAng( pCrvCompo)) + GetFreeContourCurveSideAngles( pCrvCompo, vSideAng) ; // inserisco la curva nel DB geometrico int nTId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pCrvCompo)) ; + if ( nTId != GDB_ID_NULL && vSideAng.size() > 0) + m_pGDB->SetInfo( nTId, IKEY_SIDEANGS, vSideAng) ; // inserisco eventuale seconda curva int nT2Id = GDB_ID_NULL ; if ( nCrvCnt == 2) diff --git a/EgtExchange.rc b/EgtExchange.rc index 6268340..b32ac23 100644 Binary files a/EgtExchange.rc and b/EgtExchange.rc differ