e5d27c6603
- in Exe e Lua aggiunto parametro vsUserAttr a BeamAddProcess e BeamModifyProcess.
252 lines
8.2 KiB
C++
252 lines
8.2 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2020-2020
|
|
//----------------------------------------------------------------------------
|
|
// File : EXE_BeamMgr.cpp Data : 30.08.20 Versione : 2.2i1
|
|
// Contenuto : Funzioni Beam Manager per EXE.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 30.08.20 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "EXE.h"
|
|
#include "EXE_Macro.h"
|
|
#include "DllExchange.h"
|
|
#include "/EgtDev/Include/EXeExecutor.h"
|
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
|
|
|
using namespace std ;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
bool
|
|
ExeInitBeamMgr( int nFlag)
|
|
{
|
|
GseContext* pGseCtx = GetCurrGseContext() ;
|
|
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
|
// inizializzazione gestore travi
|
|
PtrOwner<IBeamMgr> pBeamMgr( MyCreateBeamMgr()) ;
|
|
VERIFY_NULL( Get( pBeamMgr), "Error in CreateBeamMgr", false)
|
|
bool bOk = pBeamMgr->Init( pGseCtx->m_pGeomDB, nFlag) ;
|
|
// assegno il gestore al contesto
|
|
pGseCtx->m_pBeamMgr = ( bOk ? Release( pBeamMgr) : nullptr) ;
|
|
// log avvio Beam Manager
|
|
string sLog = "BeamMgr" ;
|
|
sLog += ( bOk ? " started" : " error") ;
|
|
LOG_INFO( GetLogger(), sLog.c_str())
|
|
return bOk ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
int
|
|
ExeBeamCreatePart( void)
|
|
{
|
|
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
|
VERIFY_BEAMMGR( pBeamMgr, GDB_ID_NULL)
|
|
// creo un pezzo (trave o parete) e lo rendo corrente
|
|
ExeSetModified() ;
|
|
return pBeamMgr->CreatePart() ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
bool
|
|
ExeBeamSetPart( int nPartId)
|
|
{
|
|
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
|
VERIFY_BEAMMGR( pBeamMgr, false)
|
|
// rendo corrente un pezzo
|
|
return pBeamMgr->SetPart( nPartId) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
bool
|
|
ExeBeamErasePart( void)
|
|
{
|
|
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
|
VERIFY_BEAMMGR( pBeamMgr, false)
|
|
// cancello il pezzo corrente
|
|
ExeSetModified() ;
|
|
return pBeamMgr->ErasePart() ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
bool
|
|
ExeBeamUpdatePart( void)
|
|
{
|
|
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
|
VERIFY_BEAMMGR( pBeamMgr, false)
|
|
// forzo aggiornamento del pezzo corrente
|
|
ExeSetModified() ;
|
|
return pBeamMgr->UpdatePart() ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
bool
|
|
ExeBeamSetPartProdNbr( int nProdNbr)
|
|
{
|
|
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
|
VERIFY_BEAMMGR( pBeamMgr, false)
|
|
// imposto il numero di produzione al pezzo corrente
|
|
ExeSetModified() ;
|
|
return pBeamMgr->SetPartProdNbr( nProdNbr) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
bool
|
|
ExeBeamSetPartName( const string& sName)
|
|
{
|
|
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
|
VERIFY_BEAMMGR( pBeamMgr, false)
|
|
// imposto il nome al pezzo corrente
|
|
ExeSetModified() ;
|
|
return pBeamMgr->SetPartName( sName) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
bool
|
|
ExeBeamSetPartCount( int nCount)
|
|
{
|
|
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
|
VERIFY_BEAMMGR( pBeamMgr, false)
|
|
// imposto il numero di parti da produrre al pezzo corrente
|
|
ExeSetModified() ;
|
|
return pBeamMgr->SetPartCount( nCount) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
bool
|
|
ExeBeamSetPartBox( double dLength, double dHeight, double dWidth, bool bUpdate)
|
|
{
|
|
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
|
VERIFY_BEAMMGR( pBeamMgr, false)
|
|
// imposto le dimensioni al pezzo corrente
|
|
ExeSetModified() ;
|
|
return pBeamMgr->SetPartBox( dLength, dHeight, dWidth, bUpdate) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
int
|
|
ExeBeamAddProcess( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
|
|
const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar, const STRVECTOR& vsUAtt, bool bUpdate)
|
|
{
|
|
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
|
VERIFY_BEAMMGR( pBeamMgr, GDB_ID_NULL)
|
|
// aggiungo una feature al pezzo corrente
|
|
ExeSetModified() ;
|
|
return pBeamMgr->AddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vdPar, sPar, vsUAtt, bUpdate) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
int
|
|
ExeBeamModifyProcess( int nGeomId, int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
|
|
const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar, const STRVECTOR& vsUAtt, bool bUpdate)
|
|
{
|
|
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
|
VERIFY_BEAMMGR( pBeamMgr, GDB_ID_NULL)
|
|
// modifico una feature di un pezzo
|
|
ExeSetModified() ;
|
|
return pBeamMgr->ModifyProcess( nGeomId, nGroup, nProc, nSide, sDes, nProcId, frRef, vdPar, sPar, vsUAtt, bUpdate) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
bool
|
|
ExeBeamEraseProcess( int nGeomId, bool bUpdate)
|
|
{
|
|
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
|
VERIFY_BEAMMGR( pBeamMgr, false)
|
|
// cancello una feature di un pezzo
|
|
ExeSetModified() ;
|
|
return pBeamMgr->EraseProcess( nGeomId, bUpdate) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
bool
|
|
ExeBeamEnableProcess( int nGeomId, bool bEnable, bool bUpdate)
|
|
{
|
|
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
|
VERIFY_BEAMMGR( pBeamMgr, false)
|
|
// abilito la lavorazione di una feature di un pezzo
|
|
ExeSetModified() ;
|
|
return pBeamMgr->EnableProcess( nGeomId, bEnable, bUpdate) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
bool
|
|
ExeBeamCalcSolid( int nPartId, bool bRecalc)
|
|
{
|
|
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
|
VERIFY_BEAMMGR( pBeamMgr, false)
|
|
// disabilito possibilità di alterare il flag di modifica
|
|
bool bOldEnabModif = ExeGetEnableModified() ;
|
|
if ( bOldEnabModif)
|
|
ExeDisableModified() ;
|
|
// calcolo il solido della trave
|
|
bool bOk = pBeamMgr->CalcSolid( nPartId, bRecalc) ;
|
|
// ripristino possibilità di alterare il flag di modifica
|
|
if ( bOldEnabModif)
|
|
ExeEnableModified() ;
|
|
// risultato
|
|
return bOk ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
int
|
|
ExeBeamGetSolid( int nPartId)
|
|
{
|
|
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
|
VERIFY_BEAMMGR( pBeamMgr, GDB_ID_NULL)
|
|
// recupero l'identificativo del solido della trave
|
|
return pBeamMgr->GetSolid( nPartId) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
bool
|
|
ExeBeamShowSolid( int nPartId, bool bShow)
|
|
{
|
|
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
|
VERIFY_BEAMMGR( pBeamMgr, false)
|
|
// disabilito possibilità di alterare il flag di modifica
|
|
bool bOldEnabModif = ExeGetEnableModified() ;
|
|
if ( bOldEnabModif)
|
|
ExeDisableModified() ;
|
|
// aggiorno lo stato di visualizzazione della trave (solido e complementari)
|
|
bool bOk = pBeamMgr->ShowSolid( nPartId, bShow) ;
|
|
// ripristino possibilità di alterare il flag di modifica
|
|
if ( bOldEnabModif)
|
|
ExeEnableModified() ;
|
|
// risultato
|
|
return bOk ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
bool
|
|
ExeBeamGetBuildingIsOn( void)
|
|
{
|
|
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
|
VERIFY_BEAMMGR( pBeamMgr, false)
|
|
// verifico se assemblaggio attivato
|
|
return pBeamMgr->GetBuildingIsOn() ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
bool
|
|
ExeBeamShowBuilding( bool bShow)
|
|
{
|
|
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
|
|
VERIFY_BEAMMGR( pBeamMgr, false)
|
|
// disabilito possibilità di alterare il flag di modifica
|
|
bool bOldEnabModif = ExeGetEnableModified() ;
|
|
if ( bOldEnabModif)
|
|
ExeDisableModified() ;
|
|
// attivo o disattivo la visualizzazione l'assemblaggio
|
|
bool bOk = pBeamMgr->ShowBuilding( bShow) ;
|
|
// ripristino possibilità di alterare il flag di modifica
|
|
if ( bOldEnabModif)
|
|
ExeEnableModified() ;
|
|
// risultato
|
|
return bOk ;
|
|
}
|