0ca47c7bef
- in export DXF e STL gestite anche le regioni - in import BTL aggiunto flag per mettere i pezzi di piatto - in import BTL aggiynto al pezzo testo con nome.
551 lines
18 KiB
C++
551 lines
18 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2015-2015
|
|
//----------------------------------------------------------------------------
|
|
// File : BtlGeom.cpp Data : 26.08.15 Versione : 1.6h5
|
|
// Contenuto : Implementazione della classe BtlGeom.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 26.08.15 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "BtlGeom.h"
|
|
#include "DllMain.h"
|
|
#include "/EgtDev/Include/EGkCurveLine.h"
|
|
#include "/EgtDev/Include/EGkCurveArc.h"
|
|
#include "/EgtDev/Include/EGkCurveComposite.h"
|
|
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
|
#include "/EgtDev/Include/EGkStmStandard.h"
|
|
#include "/EgtDev/Include/EGkStmFromCurves.h"
|
|
#include "/EgtDev/Include/EGkExtText.h"
|
|
#include "/EgtDev/Include/EGnStringUtils.h"
|
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
|
|
|
using namespace std ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
BtlGeom::BtlGeom( void)
|
|
{
|
|
m_pGDB = nullptr ;
|
|
m_BoxCol = Color( 255, 128, 0, 30) ;
|
|
m_OutsCol = Color( 192, 128, 0, 70) ;
|
|
m_ProcsCol = Color( 160, 80, 0, 100) ;
|
|
m_MarkCol = Color( 255, 0, 0, 100) ;
|
|
m_nAsseId = GDB_ID_NULL ;
|
|
m_ptOrig = ORIG ;
|
|
m_nPartId = GDB_ID_NULL ;
|
|
m_nAuxId = GDB_ID_NULL ;
|
|
m_nBoxId = GDB_ID_NULL ;
|
|
m_nOutsId = GDB_ID_NULL ;
|
|
m_nProcsId = GDB_ID_NULL ;
|
|
m_vtDim = V_NULL ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
BtlGeom::Init( IGeomDB* pGDB, bool bFlatPos)
|
|
{
|
|
// salvo puntatore a DB geometrico
|
|
m_pGDB = pGDB ;
|
|
if ( m_pGDB == nullptr)
|
|
return false ;
|
|
// salvo flag
|
|
m_bFlatPos = bFlatPos ;
|
|
// se non esiste, creo gruppo per assemblaggio
|
|
m_nAsseId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME) ;
|
|
if ( m_nAsseId == GDB_ID_NULL)
|
|
return CreateAssemblyGroup() ;
|
|
else
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
BtlGeom::CreateAssemblyGroup( void)
|
|
{
|
|
// creo il gruppo sotto la radice
|
|
m_nAsseId = m_pGDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
|
|
if ( m_nAsseId == GDB_ID_NULL)
|
|
return false ;
|
|
// assegno livello di sistema
|
|
m_pGDB->SetLevel( m_nAsseId, GDB_LV_SYSTEM) ;
|
|
// assegno nome
|
|
m_pGDB->SetName( m_nAsseId, ASSEMBLY_GROUP_NAME) ;
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
BtlGeom::CreatePart( void)
|
|
{
|
|
// reset identificativi del pezzo precedente
|
|
m_nPartId = GDB_ID_NULL ;
|
|
m_nAuxId = GDB_ID_NULL ;
|
|
m_nBoxId = GDB_ID_NULL ;
|
|
m_nOutsId = GDB_ID_NULL ;
|
|
m_nProcsId = GDB_ID_NULL ;
|
|
// creazione nuovo pezzo
|
|
int nPartId = m_pGDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d( m_ptOrig)) ;
|
|
if ( nPartId == GDB_ID_NULL)
|
|
return false ;
|
|
// creo il layer ausiliario (per nome)
|
|
int nAuxId = m_pGDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
|
|
if ( nAuxId == GDB_ID_NULL)
|
|
return false ;
|
|
m_pGDB->SetName( nAuxId, AUX_LAYER_NAME) ;
|
|
m_pGDB->SetMaterial( nAuxId, BLACK) ;
|
|
// creo il layer per il box (parallelepipedo)
|
|
int nBoxId = m_pGDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
|
|
if ( nBoxId == GDB_ID_NULL)
|
|
return false ;
|
|
m_pGDB->SetName( nBoxId, BOX_LAYER_NAME) ;
|
|
m_pGDB->SetMaterial( nBoxId, m_BoxCol) ;
|
|
// creo il layer per l'outline (eventuali contorni)
|
|
int nOutsId = m_pGDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
|
|
if ( nOutsId == GDB_ID_NULL)
|
|
return false ;
|
|
m_pGDB->SetName( nOutsId, OUTLINE_LAYER_NAME) ;
|
|
m_pGDB->SetMaterial( nOutsId, m_OutsCol) ;
|
|
// creo il layer per le lavorazioni (features o processings)
|
|
int nProcsId = m_pGDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
|
|
if ( nProcsId == GDB_ID_NULL)
|
|
return false ;
|
|
m_pGDB->SetName( nProcsId, PROCESSINGS_LAYER_NAME) ;
|
|
m_pGDB->SetMaterial( nProcsId, m_ProcsCol) ;
|
|
// assegnazione identificativi
|
|
m_nPartId = nPartId ;
|
|
m_nAuxId = nAuxId ;
|
|
m_nBoxId = nBoxId ;
|
|
m_nOutsId = nOutsId ;
|
|
m_nProcsId = nProcsId ;
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
BtlGeom::ErasePart( void)
|
|
{
|
|
// se non c'è il DB geometrico, errore
|
|
if ( m_pGDB == nullptr)
|
|
return false ;
|
|
// se non esiste un pezzo corrente, esco
|
|
if ( m_nPartId == GDB_ID_NULL)
|
|
return true ;
|
|
// cancello il pezzo
|
|
m_pGDB->Erase( m_nPartId) ;
|
|
// annullo tutti gli identificativi del pezzo
|
|
m_nPartId = GDB_ID_NULL ;
|
|
m_nAuxId = GDB_ID_NULL ;
|
|
m_nBoxId = GDB_ID_NULL ;
|
|
m_nOutsId = GDB_ID_NULL ;
|
|
m_nProcsId = GDB_ID_NULL ;
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
BtlGeom::SetPartProdNbr( int nProdNbr)
|
|
{
|
|
return ( m_pGDB != nullptr && m_pGDB->SetInfo( m_nPartId, IKEY_PROD_NBR, nProdNbr)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
BtlGeom::SetPartName( string sDes)
|
|
{
|
|
if ( m_pGDB == nullptr)
|
|
return false ;
|
|
if ( ! m_pGDB->SetInfo( m_nPartId, IKEY_NAME, sDes))
|
|
return false ;
|
|
int nProdNbr = 0 ;
|
|
m_pGDB->GetInfo( m_nPartId, IKEY_PROD_NBR, nProdNbr) ;
|
|
string sName = ToString( nProdNbr) ;
|
|
if ( ! sDes.empty())
|
|
sName += "-" + sDes ;
|
|
// assegnazione del nome al pezzo
|
|
return m_pGDB->SetName( m_nPartId, sName) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
BtlGeom::SetPartCount( int nCount)
|
|
{
|
|
return ( m_pGDB != nullptr && m_pGDB->SetInfo( m_nPartId, IKEY_COUNT, nCount)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
BtlGeom::AddPartBox( double dLength, double dHeight, double dWidth)
|
|
{
|
|
// creo il solido (parallelepipedo)
|
|
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshBox( dLength, dHeight, dWidth)) ;
|
|
if ( IsNull( pStm))
|
|
return false ;
|
|
// lo inserisco nel layer box del pezzo
|
|
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nBoxId, Release( pStm)) ;
|
|
if ( nId == GDB_ID_NULL)
|
|
return false ;
|
|
// assegno nome
|
|
m_pGDB->SetName( nId, BOX_BOX_NAME) ;
|
|
// assegno colore
|
|
m_pGDB->SetMaterial( nId, m_BoxCol) ;
|
|
// salvo in info pezzo le sue dimensioni
|
|
m_pGDB->SetInfo( m_nPartId, IKEY_LENGTH, dLength) ;
|
|
m_pGDB->SetInfo( m_nPartId, IKEY_HEIGHT, dHeight) ;
|
|
m_pGDB->SetInfo( m_nPartId, IKEY_WIDTH, dWidth) ;
|
|
// imposto dimensioni pezzo corrente
|
|
m_vtDim.Set( dLength, dHeight, dWidth) ;
|
|
// metto di piatto, se richiesto
|
|
if ( m_bFlatPos)
|
|
AdjustPartFlatPos( m_nPartId) ;
|
|
// aggiorno origine per prossimo pezzo
|
|
const double PART_OFFSET = 200 ;
|
|
if ( m_bFlatPos)
|
|
m_ptOrig.y += max( dHeight, dWidth) + PART_OFFSET ;
|
|
else
|
|
m_ptOrig.y += dHeight + PART_OFFSET ;
|
|
|
|
// scrittura del nome sulla superficie del box come testo del layer ausiliario
|
|
string sName ;
|
|
if ( ! m_pGDB->GetName( m_nPartId, sName) || sName.empty())
|
|
return true ;
|
|
PtrOwner<IExtText> pText( CreateExtText()) ;
|
|
if ( IsNull( pText))
|
|
return false ;
|
|
int nSide = (( m_vtDim.z > m_vtDim.y + EPS_SMALL) ? 1 : 4) ;
|
|
double dSideLen = GetSideLength( nSide) ;
|
|
double dSideWidth = GetSideWidth( nSide) ;
|
|
Point3d ptCen( 0.5 * dSideLen, 0.5 * dSideWidth, 0) ;
|
|
if ( ! pText->Set( ptCen, Z_AX, X_AX, sName, "", 100, false, 0.1 * dSideWidth, 1, 0, ETXT_IPMC))
|
|
return false ;
|
|
// porto il testo nel piano della faccia
|
|
Frame3d frRef = GetSideFrame( nSide) ;
|
|
pText->ToGlob( frRef) ;
|
|
// inserisco il testo nel DB geometrico
|
|
int nTextId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nAuxId, Release( pText)) ;
|
|
if ( nTextId == GDB_ID_NULL)
|
|
return false ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
BtlGeom::AdjustPartFlatPos( int nPartId)
|
|
{
|
|
// recupero il box del pezzo
|
|
BBox3d b3Part ;
|
|
int nBoxId = m_pGDB->GetFirstNameInGroup( nPartId, BOX_LAYER_NAME) ;
|
|
if ( nBoxId == GDB_ID_NULL ||
|
|
! m_pGDB->GetGlobalBBox( nBoxId, b3Part))
|
|
return false ;
|
|
// se necessario ruoto
|
|
Vector3d vtDim = b3Part.GetMax() - b3Part.GetMin() ;
|
|
if ( vtDim.z > vtDim.y + EPS_SMALL) {
|
|
Point3d ptAx = b3Part.GetMin() + 0.5 * Vector3d( 0, vtDim.y, vtDim.y) ;
|
|
m_pGDB->RotateGlob( nPartId, ptAx, X_AX, 0, -1) ;
|
|
}
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
BtlGeom::AddPartTransformation( int nUID, const Frame3d& frRef)
|
|
{
|
|
// creo un nuovo gruppo nell'assemblaggio
|
|
int nId = m_pGDB->AddGroup( GDB_ID_NULL, m_nAsseId, frRef) ;
|
|
if ( nId == GDB_ID_NULL)
|
|
return false ;
|
|
// assegno Nome con UID
|
|
m_pGDB->SetName( nId, "UID-" + ToString( nUID)) ;
|
|
// assegno Id pezzo istanziato
|
|
m_pGDB->SetInfo( nId, "!SOU", m_nPartId) ;
|
|
// nascondo e blocco
|
|
m_pGDB->SetStatus( nId, GDB_ST_OFF) ;
|
|
m_pGDB->SetMode( nId, GDB_MD_LOCKED) ;
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
BtlGeom::AddPartOutline( int nSide, const FCEDEQUE& dqFce)
|
|
{
|
|
// verifico esistenza pezzo
|
|
if ( m_nBoxId == GDB_ID_NULL)
|
|
return false ;
|
|
// verifico validità faccia
|
|
if ( ! IsSideValid( nSide))
|
|
return false ;
|
|
// verifico siano definiti almeno 4 punti (triangolo)
|
|
if ( dqFce.size() < 4)
|
|
return false ;
|
|
// verifico che primo e ultimo punto coincidano
|
|
if ( ! AreSamePointApprox( dqFce.front().ptP, dqFce.back().ptP))
|
|
return false ;
|
|
// verifico che sia un percorso semplice
|
|
if ( dqFce.front().nFlag != FreeContourEnt::START)
|
|
return false ;
|
|
// verifico non ci sia angolo di sbandamento
|
|
for ( auto& Fce : dqFce) {
|
|
if ( fabs( Fce.dAng) > EPS_ANG_SMALL)
|
|
return false ;
|
|
}
|
|
// costruisco il percorso di contorno
|
|
PtrOwner<ICurveComposite> pCrvCompo( CurveFromFces( dqFce)) ;
|
|
if ( IsNull( pCrvCompo))
|
|
return false ;
|
|
// aggiusto orientamento affinché sia antiorario
|
|
double dArea ;
|
|
pCrvCompo->GetAreaXY( dArea) ;
|
|
if ( dArea < 0)
|
|
pCrvCompo->Invert() ;
|
|
// Porto il percorso sul piano corretto
|
|
Frame3d frRef = GetSideFrame( nSide) ;
|
|
pCrvCompo->ToGlob( frRef) ;
|
|
// Estrudo il contorno
|
|
Vector3d vtExtr = - frRef.VersZ() * GetSideHeight( nSide) ;
|
|
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshByExtrusion( Get( pCrvCompo), vtExtr, false, EPS_SMALL)) ;
|
|
if ( IsNull( pStm))
|
|
return false ;
|
|
pStm->Invert() ;
|
|
// Inserisco la superficie nel layer Outline
|
|
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pStm)) ;
|
|
if ( nId == GDB_ID_NULL)
|
|
return false ;
|
|
m_pGDB->SetName( nId, GetOutlineOutName( nSide)) ;
|
|
// Creo le regioni sopra e sotto
|
|
PtrOwner<ISurfFlatRegion> pSfr1( CreateSurfFlatRegion()) ;
|
|
if ( IsNull( pSfr1) || ! pSfr1->AddExtLoop( Release( pCrvCompo)))
|
|
return false ;
|
|
PtrOwner<ISurfFlatRegion> pSfr2( GetSurfFlatRegion( pSfr1->Clone())) ;
|
|
if ( IsNull( pSfr2))
|
|
return false ;
|
|
pSfr2->Invert() ;
|
|
pSfr2->Translate( vtExtr) ;
|
|
// Inserisco le regioni nel layer Outline
|
|
int nId1 = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pSfr1)) ;
|
|
if ( nId1 == GDB_ID_NULL)
|
|
return false ;
|
|
m_pGDB->SetName( nId1, GetOutlineTopName( nSide)) ;
|
|
int nId2 = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pSfr2)) ;
|
|
if ( nId2 == GDB_ID_NULL)
|
|
return false ;
|
|
m_pGDB->SetName( nId2, GetOutlineBottomName( nSide)) ;
|
|
// nascondo il box
|
|
m_pGDB->SetStatus( m_nBoxId, GDB_ST_OFF) ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
BtlGeom::AddPartAperture( int nSide, const FCEDEQUE& dqFce)
|
|
{
|
|
// verifico validità faccia
|
|
if ( ! IsSideValid( nSide))
|
|
return false ;
|
|
// verifico siano definiti almeno 4 punti (triangolo)
|
|
if ( dqFce.size() < 4)
|
|
return false ;
|
|
// verifico che primo e ultimo punto coincidano
|
|
if ( ! AreSamePointApprox( dqFce.front().ptP, dqFce.back().ptP))
|
|
return false ;
|
|
// verifico che sia un percorso semplice
|
|
if ( dqFce.front().nFlag != FreeContourEnt::START)
|
|
return false ;
|
|
// verifico non ci sia angolo di sbandamento
|
|
for ( auto& Fce : dqFce) {
|
|
if ( fabs( Fce.dAng) > EPS_ANG_SMALL)
|
|
return false ;
|
|
}
|
|
// costruisco il percorso di contorno
|
|
PtrOwner<ICurveComposite> pCrvCompo( CurveFromFces( dqFce)) ;
|
|
if ( IsNull( pCrvCompo))
|
|
return false ;
|
|
// aggiusto orientamento affinché sia antiorario
|
|
double dArea ;
|
|
pCrvCompo->GetAreaXY( dArea) ;
|
|
if ( dArea < 0)
|
|
pCrvCompo->Invert() ;
|
|
// Porto il percorso sul piano corretto
|
|
Frame3d frRef = GetSideFrame( nSide) ;
|
|
pCrvCompo->ToGlob( frRef) ;
|
|
// Estrudo il contorno
|
|
Vector3d vtExtr = - frRef.VersZ() * GetSideHeight( nSide) ;
|
|
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshByExtrusion( Get( pCrvCompo), vtExtr, false, EPS_SMALL)) ;
|
|
if ( IsNull( pStm))
|
|
return false ;
|
|
// Inserisco la superficie nel layer Outline
|
|
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pStm)) ;
|
|
if ( nId == GDB_ID_NULL)
|
|
return false ;
|
|
m_pGDB->SetName( nId, GetOutlineApertureName( nSide)) ;
|
|
// Creo le regioni sopra e sotto
|
|
PtrOwner<ISurfFlatRegion> pSfr1( CreateSurfFlatRegion()) ;
|
|
if ( IsNull( pSfr1) || ! pSfr1->AddExtLoop( Release( pCrvCompo)))
|
|
return false ;
|
|
PtrOwner<ISurfFlatRegion> pSfr2( GetSurfFlatRegion( pSfr1->Clone())) ;
|
|
if ( IsNull( pSfr2))
|
|
return false ;
|
|
pSfr2->Invert() ;
|
|
pSfr2->Translate( vtExtr) ;
|
|
// Sottraggo le regioni da quelle già presenti nell'outline
|
|
ISurfFlatRegion* pSfrTop = GetSurfFlatRegion( m_pGDB->GetGeoObj( m_pGDB->GetFirstNameInGroup( m_nOutsId, GetOutlineTopName( nSide)))) ;
|
|
if ( pSfrTop == nullptr)
|
|
return false ;
|
|
pSfrTop->Subtract( *pSfr1) ;
|
|
ISurfFlatRegion* pSfrBot = GetSurfFlatRegion( m_pGDB->GetGeoObj( m_pGDB->GetFirstNameInGroup( m_nOutsId, GetOutlineBottomName( nSide)))) ;
|
|
if ( pSfrBot == nullptr)
|
|
return false ;
|
|
pSfrBot->Subtract( *pSfr2) ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
BtlGeom::IsSideValid( int nSide)
|
|
{
|
|
return ( nSide >= BTL_SIDE_FRONT && nSide <= BTL_SIDE_TOP) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
ICurveComposite*
|
|
BtlGeom::CurveFromFces( const FCEDEQUE& dqFce)
|
|
{
|
|
// verifico esistenza dati di ingresso
|
|
if ( dqFce.size() < 2)
|
|
return nullptr ;
|
|
// creo la curva composita
|
|
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
|
if ( IsNull( pCrvCompo))
|
|
return false ;
|
|
// recupero le entità free contour !!! sono da gestire gli attributi : angolo, Id e OtherId !!!
|
|
for ( size_t i = 1 ; i < dqFce.size() ; ++ i) {
|
|
// se retta
|
|
if ( dqFce[i].nFlag == FreeContourEnt::LINE) {
|
|
// creo la retta
|
|
PtrOwner<ICurveLine> pCrvLine( CreateCurveLine()) ;
|
|
if ( IsNull( pCrvLine))
|
|
return nullptr ;
|
|
// setto la linea
|
|
if ( ! pCrvLine->Set( dqFce[i-1].ptP, dqFce[i].ptP))
|
|
return nullptr ;
|
|
// inserisco la linea nella curva composta
|
|
if ( ! pCrvCompo->AddCurve( ::Release( pCrvLine)))
|
|
return nullptr ;
|
|
}
|
|
// altrimenti arco
|
|
else if ( dqFce[i].nFlag == FreeContourEnt::ARC) {
|
|
// creo l'arco
|
|
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
|
|
if ( IsNull( pCrvArc))
|
|
return nullptr ;
|
|
// setto l'arco
|
|
if ( ! pCrvArc->Set3P( dqFce[i-1].ptP, dqFce[i].ptM, dqFce[i].ptP))
|
|
return nullptr ;
|
|
// inserisco l'arco nella curva composta
|
|
if ( ! pCrvCompo->AddCurve( Release( pCrvArc)))
|
|
return nullptr ;
|
|
}
|
|
// altrimenti errore (start vari solo su prima entità)
|
|
else
|
|
return nullptr ;
|
|
}
|
|
return Release( pCrvCompo) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
string
|
|
BtlGeom::GetOutlineOutName( int nSide)
|
|
{
|
|
return ( ToString( nSide) + "-" + OL_OUTSTM_NAME) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
string
|
|
BtlGeom::GetOutlineApertureName( int nSide)
|
|
{
|
|
return ( ToString( nSide) + "-" + OL_APERTURESTM_NAME) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
string
|
|
BtlGeom::GetOutlineTopName( int nSide)
|
|
{
|
|
return ( ToString( nSide) + "-" + OL_TOPREGION_NAME) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
string
|
|
BtlGeom::GetOutlineBottomName( int nSide)
|
|
{
|
|
return ( ToString( nSide) + "-" + OL_BOTTOMREGION_NAME) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
double
|
|
BtlGeom::GetSideLength( int nSide)
|
|
{
|
|
if ( nSide < BTL_SIDE_FRONT || nSide > BTL_SIDE_TOP)
|
|
return 0 ;
|
|
else
|
|
return m_vtDim.x ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
double
|
|
BtlGeom::GetSideWidth( int nSide)
|
|
{
|
|
switch ( nSide) {
|
|
case BTL_SIDE_FRONT :
|
|
case BTL_SIDE_BACK :
|
|
return m_vtDim.z ;
|
|
case BTL_SIDE_TOP :
|
|
case BTL_SIDE_BOTTOM :
|
|
return m_vtDim.y ;
|
|
}
|
|
return 0 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
double
|
|
BtlGeom::GetSideHeight( int nSide)
|
|
{
|
|
switch ( nSide) {
|
|
case BTL_SIDE_FRONT :
|
|
case BTL_SIDE_BACK :
|
|
return m_vtDim.y ;
|
|
case BTL_SIDE_TOP :
|
|
case BTL_SIDE_BOTTOM :
|
|
return m_vtDim.z ;
|
|
}
|
|
return 0 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
Frame3d
|
|
BtlGeom::GetSideFrame( int nSide)
|
|
{
|
|
Frame3d frRef ;
|
|
switch ( nSide) {
|
|
case BTL_SIDE_FRONT :
|
|
frRef.Set( Point3d( 0, 0, 0), X_AX, Z_AX, - Y_AX) ;
|
|
break ;
|
|
case BTL_SIDE_BOTTOM :
|
|
frRef.Set( Point3d( 0, m_vtDim.y, 0), X_AX, - Y_AX, - Z_AX) ;
|
|
break ;
|
|
case BTL_SIDE_BACK :
|
|
frRef.Set( Point3d( 0, m_vtDim.y, m_vtDim.z), X_AX, - Z_AX, Y_AX) ;
|
|
break ;
|
|
case BTL_SIDE_TOP :
|
|
frRef.Set( Point3d( 0, 0, m_vtDim.z), X_AX, Y_AX, Z_AX) ;
|
|
break ;
|
|
}
|
|
return frRef ;
|
|
}
|