Files
EgtInterface/API_BeamMgr.cpp
T
DarioS dc907ddc81 EgtInterface :
- aggiunte interfacce per funzioni EgtBeamShowFacesName e EgtBeamShowLoadingSide.
2022-11-08 16:42:57 +01:00

231 lines
7.7 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2020-2020
//----------------------------------------------------------------------------
// File : API_BeamMgr.cpp Data : 02.09.20 Versione : 2.2i2
// Contenuto : Funzioni Beam Manager per API.
//
//
//
// Modifiche : 02.09.20 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "API.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EgtStringConverter.h"
using namespace std ;
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtInitBeamMgr( int nFlag)
{
return ( ExeInitBeamMgr( nFlag) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtBeamSetFlag( int nFlag)
{
return ( ExeBeamSetFlag( nFlag) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtBeamCreatePart( void)
{
return ExeBeamCreatePart() ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtBeamSetPart( int nPartId)
{
return ( ExeBeamSetPart( nPartId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtBeamErasePart( void)
{
return ( ExeBeamErasePart() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtBeamUpdatePart( void)
{
return ( ExeBeamUpdatePart() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtBeamSetPartProdNbr( int nProdNbr)
{
return ( ExeBeamSetPartProdNbr( nProdNbr) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtBeamSetPartName( const wchar_t* wsName)
{
return ( ExeBeamSetPartName( wstrztoA( wsName)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtBeamSetPartCount( int nCount)
{
return ( ExeBeamSetPartCount( nCount) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtBeamSetPartBox( double dLength, double dHeight, double dWidth, BOOL bUpdate)
{
return ( ExeBeamSetPartBox( dLength, dHeight, dWidth, ( bUpdate != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtBeamGetSideData( int nSide,
double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3],
double* pdLength, double* pdWidth, double* pdHeight)
{
// eseguo calcoli
Frame3d frRef ;
double dLength, dWidth, dHeight ;
if ( ! ExeBeamGetSideData( nSide, frRef, dLength, dWidth, dHeight))
return FALSE ;
// assegno l'origine
if ( ptOrig != nullptr)
VEC_FROM_3D( ptOrig, frRef.Orig())
// assegno il versore X
if ( vtX != nullptr)
VEC_FROM_3D( vtX, frRef.VersX())
// assegno il versore Y
if ( vtY != nullptr)
VEC_FROM_3D( vtY, frRef.VersY())
// assegno il versore Z
if ( vtZ != nullptr)
VEC_FROM_3D( vtZ, frRef.VersZ())
if ( pdLength != nullptr)
*pdLength = dLength ;
if ( pdWidth != nullptr)
*pdWidth = dWidth ;
if ( pdHeight != nullptr)
*pdHeight = dHeight ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtBeamShowFacesName( BOOL bShow)
{
return ( ExeBeamShowFacesName( ( bShow != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtBeamShowLoadingSide( BOOL bShow, BOOL bFromLeft)
{
return ( ExeBeamShowLoadingSide( ( bShow != FALSE), ( bFromLeft != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtBeamAddProcess( int nGroup, int nProc, int nSide, const wchar_t* wsDes, int nProcId,
const double ptOrig[3], const double vX[3], const double vY[3], const double vZ[3],
int nPar, const double vPar[], const wchar_t* wsPar, const wchar_t* wsUAtts,
int nCrvId, int nCrv2Id, BOOL bUpdate)
{
Frame3d frFrame ;
if ( ! frFrame.Set( ptOrig, vX, vY, vZ))
return GDB_ID_NULL ;
DBLVECTOR vdPar ;
vdPar.reserve( nPar) ;
for ( int i = 0 ; i < nPar ; ++i) {
vdPar.push_back( vPar[i]) ;
}
STRVECTOR vsUAtt ;
if ( ! Tokenize( string( wstrztoA( wsUAtts)), "\n", vsUAtt))
return FALSE ;
return ExeBeamAddProcess( nGroup, nProc, nSide, wstrztoA( wsDes), nProcId, frFrame,
vdPar, wstrztoA( wsPar), vsUAtt, nCrvId, nCrv2Id, ( bUpdate != FALSE)) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtBeamModifyProcess( int nGeomId, int nGroup, int nProc, int nSide, const wchar_t* wsDes, int nProcId,
const double ptOrig[3], const double vX[3], const double vY[3], const double vZ[3],
int nPar, const double vPar[], const wchar_t* wsPar, const wchar_t* wsUAtts,
int nCrvId, int nCrv2Id, BOOL bUpdate)
{
Frame3d frFrame ;
if ( ! frFrame.Set( ptOrig, vX, vY, vZ))
return GDB_ID_NULL ;
DBLVECTOR vdPar ;
vdPar.reserve( nPar) ;
for ( int i = 0 ; i < nPar ; ++i) {
vdPar.push_back( vPar[i]) ;
}
STRVECTOR vsUAtt ;
if ( ! Tokenize( string( wstrztoA( wsUAtts)), "\n", vsUAtt))
return FALSE ;
return ExeBeamModifyProcess( nGeomId, nGroup, nProc, nSide, wstrztoA( wsDes), nProcId, frFrame,
vdPar, wstrztoA( wsPar), vsUAtt, nCrvId, nCrv2Id, ( bUpdate != FALSE)) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtBeamEraseProcess( int nGeomId, BOOL bUpdate)
{
return ( ExeBeamEraseProcess( nGeomId, ( bUpdate != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtBeamEnableProcess( int nGeomId, BOOL bEnable, BOOL bUpdate)
{
return ( ExeBeamEnableProcess( nGeomId, ( bEnable != FALSE), ( bUpdate != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtBeamCalcSolid( int nPartId, BOOL bRecalc)
{
return ( ExeBeamCalcSolid( nPartId, ( bRecalc != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtBeamGetSolid( int nPartId)
{
return ExeBeamGetSolid( nPartId) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtBeamShowSolid( int nPartId, BOOL bShow)
{
return ( ExeBeamShowSolid( nPartId, ( bShow != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtBeamGetBuildingIsOn( void)
{
return ( ExeBeamGetBuildingIsOn() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtBeamShowBuilding( BOOL bShow)
{
return ( ExeBeamShowBuilding( ( bShow != FALSE)) ? TRUE : FALSE) ;
}