Files
EgtInterface/API_MachMgr.cpp
Dario Sassi 9516b56b5a EgtInterface 3.1c1 :
- aggiunta interfaccia per EgtChangePreviewMachiningToolShow.
2026-03-03 18:35:54 +01:00

2386 lines
74 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : API_MachMgr.cpp Data : 23.03.15 Versione : 1.6c8
// Contenuto : Funzioni Machining Manager per API.
//
//
//
// Modifiche : 23.03.15 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 EgtInitMachMgr( const wchar_t* wsMachinesDir, const wchar_t* wsToolMakersDir)
{
return ( ExeInitMachMgr( wstrztoA( wsMachinesDir), wstrztoA( wsToolMakersDir)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
// Errors & Warnings
//-----------------------------------------------------------------------------
int
__stdcall EgtGetLastMachMgrErrorId( void)
{
return ExeGetLastMachMgrErrorId() ;
}
//-----------------------------------------------------------------------------
wchar_t*
__stdcall EgtGetLastMachMgrErrorString( void)
{
return _wcsdup( stringtoW( ExeGetLastMachMgrErrorString())) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetMachMgrWarningId( int nInd)
{
return ExeGetMachMgrWarningId( nInd) ;
}
//-----------------------------------------------------------------------------
wchar_t*
__stdcall EgtGetMachMgrWarningString( int nInd)
{
return _wcsdup( stringtoW( ExeGetMachMgrWarningString( nInd))) ;
}
//-----------------------------------------------------------------------------
// Machines
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetMachines( wchar_t*& wsMachineNames, wchar_t*& wsMachineDirs)
{
if ( &wsMachineNames == nullptr || &wsMachineDirs == nullptr)
return FALSE ;
STRVECTOR vsMachineNames ;
STRVECTOR vsMachineDirs ;
if ( ! ExeGetMachines( vsMachineNames, vsMachineDirs))
return FALSE ;
// restituzione vettore nomi
string sMachineNames ;
for ( const auto& sName : vsMachineNames)
sMachineNames += sName + "\n" ;
if ( ! sMachineNames.empty())
sMachineNames.pop_back() ;
wsMachineNames = _wcsdup( stringtoW( sMachineNames)) ;
if ( wsMachineNames == nullptr)
return FALSE ;
// restituzione vettore direttori
string sMachineDirs ;
for ( const auto& sName : vsMachineDirs)
sMachineDirs += sName + "\n" ;
if ( ! sMachineDirs.empty())
sMachineDirs.pop_back() ;
wsMachineDirs = _wcsdup( stringtoW( sMachineDirs)) ;
if ( wsMachineDirs == nullptr) {
free( wsMachineNames) ;
return FALSE ;
}
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetCurrMachine( const wchar_t* wsMachineName)
{
return ( ExeSetCurrMachine( wstrztoA( wsMachineName)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCurrMachineName( wchar_t*& wsMachineName)
{
if ( &wsMachineName == nullptr)
return FALSE ;
string sMachineName ;
if ( ! ExeGetCurrMachineName( sMachineName))
return FALSE ;
wsMachineName = _wcsdup( stringtoW( sMachineName)) ;
return (( wsMachineName == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCurrMachineDir( wchar_t*& wsMachineDir)
{
if ( &wsMachineDir == nullptr)
return FALSE ;
string sMachineDir ;
if ( ! ExeGetCurrMachineDir( sMachineDir))
return FALSE ;
wsMachineDir = _wcsdup( stringtoW( sMachineDir)) ;
return (( wsMachineDir == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
// Machining Groups
//-----------------------------------------------------------------------------
int
__stdcall EgtGetMachGroupCount( void)
{
return ExeGetMachGroupCount() ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetFirstMachGroup( void)
{
return ExeGetFirstMachGroup() ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetNextMachGroup( int nId)
{
return ExeGetNextMachGroup( nId) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetLastMachGroup( void)
{
return ExeGetLastMachGroup() ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetPrevMachGroup( int nId)
{
return ExeGetPrevMachGroup( nId) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetMachGroupNewName( const wchar_t* wsName, wchar_t*& wsNewName)
{
if ( &wsNewName == nullptr)
return FALSE ;
string sNewName = wstrztoA( wsName) ;
if ( ! ExeGetMachGroupNewName( sNewName))
return FALSE ;
wsNewName = _wcsdup( stringtoW( sNewName)) ;
return (( wsNewName == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtAddMachGroup( const wchar_t* wsName, const wchar_t* wsMachineName)
{
return ExeAddMachGroup( wstrztoA( wsName), wstrztoA( wsMachineName)) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtCopyMachGroup( const wchar_t* wsSouName, const wchar_t* wsName)
{
return ExeCopyMachGroup( wstrztoA( wsSouName), wstrztoA( wsName)) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRemoveMachGroup( int nMGroupId)
{
return ( ExeRemoveMachGroup( nMGroupId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtChangeMachGroupName( int nMGroupInd, const wchar_t* wsNewName)
{
return ( ExeChangeMachGroupName( nMGroupInd, wstrztoA( wsNewName)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetMachGroupName( int nMGroupInd, wchar_t*& wsName)
{
if ( &wsName == nullptr)
return FALSE ;
string sName ;
if ( ! ExeGetMachGroupName( nMGroupInd, sName))
return FALSE ;
wsName = _wcsdup( stringtoW( sName)) ;
return (( wsName == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetMachGroupMachineName( int nMGroupInd, wchar_t*& wsMachineName)
{
if ( &wsMachineName == nullptr)
return FALSE ;
string sMachineName ;
if ( ! ExeGetMachGroupMachineName( nMGroupInd, sMachineName))
return FALSE ;
wsMachineName = _wcsdup( stringtoW( sMachineName)) ;
return (( wsMachineName == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetMachGroupId( const wchar_t* wsName)
{
return ExeGetMachGroupId( wstrztoA( wsName)) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetCurrMachGroup( int nMGroupId)
{
return ( ExeSetCurrMachGroup( nMGroupId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtResetCurrMachGroup( void)
{
return ( ExeResetCurrMachGroup() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetCurrMachGroup( void)
{
return ExeGetCurrMachGroup() ;
}
//-----------------------------------------------------------------------------
// Phases
//-----------------------------------------------------------------------------
int
__stdcall EgtAddPhase( void)
{
return ExeAddPhase() ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetCurrPhase( int nPhase, BOOL bForced)
{
return ( ExeSetCurrPhase( nPhase, ( bForced != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetCurrPhase( void)
{
return ExeGetCurrPhase() ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRemoveLastPhase( void)
{
return ( ExeRemoveLastPhase() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetPhaseCount( void)
{
return ExeGetPhaseCount() ;
}
//-----------------------------------------------------------------------------
// Raw Parts
//-----------------------------------------------------------------------------
int
__stdcall EgtGetRawPartCount( void)
{
return ExeGetRawPartCount() ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetFirstRawPart( void)
{
return ExeGetFirstRawPart() ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetNextRawPart( int nRawId)
{
return ExeGetNextRawPart( nRawId) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtAddRawPart( const double ptOrig[3],
double dLength, double dWidth, double dHeight, const int vCol[4])
{
return ExeAddRawPart( ptOrig, dLength, dWidth, dHeight, vCol) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtModifyRawPart( int nRawId, const double ptOrig[3],
double dLength, double dWidth, double dHeight, const int vCol[4])
{
return ( ExeModifyRawPart( nRawId, ptOrig, dLength, dWidth, dHeight, vCol) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtModifyRawPart2( int nRawId, int nCrvId,
double dOverMat, double dHeight, const int vCol[4])
{
return ( ExeModifyRawPart( nRawId, nCrvId, dOverMat, dHeight, vCol) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtModifyRawPartSize( int nRawId, double dLength, double dWidth, double dHeight)
{
return ( ExeModifyRawPartSize( nRawId, dLength, dWidth, dHeight) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtModifyRawPartHeight( int nRawId, double dHeight)
{
return ( ExeModifyRawPartHeight( nRawId, dHeight) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtKeepRawPart( int nRawId, int nSouPhase)
{
return ( ExeKeepRawPart( nRawId, nSouPhase) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtVerifyRawPartPhase( int nRawId, int nPhase)
{
return ( ExeVerifyRawPartPhase( nRawId, nPhase) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtVerifyRawPartCurrPhase( int nRawId)
{
return ( ExeVerifyRawPartCurrPhase( nRawId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRemoveRawPartFromCurrPhase( int nRawId)
{
return ( ExeRemoveRawPartFromCurrPhase( nRawId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRemoveRawPart( int nRawId)
{
return ( ExeRemoveRawPart( nRawId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMoveToCornerRawPart( int nRawId, const double ptCorner[3], int nFlag)
{
return ( ExeMoveToCornerRawPart( nRawId, ptCorner, nFlag) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMoveRawPart( int nRawId, const double vtMove[3])
{
return ( ExeMoveRawPart( nRawId, vtMove) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRotateRawPart( int nRawId, const double vtAx[3], double dAngDeg)
{
return ( ExeRotateRawPart( nRawId, vtAx, dAngDeg) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetRawPartCenter( int nRawId, double ptCen[3])
{
// recupero il centro
Point3d ptTmp ;
if ( ! ExeGetRawPartCenter( nRawId, ptTmp))
return FALSE ;
// ritorno il centro
VEC_FROM_3D( ptCen, ptTmp)
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetRawPartBBox( int nRawId, double ptMin[3], double ptMax[3])
{
// recupero il bounding box
BBox3d b3Raw ;
if ( ! ExeGetRawPartBBox( nRawId, b3Raw))
return FALSE ;
// ritorno gli estremi del box
VEC_FROM_3D( ptMin, b3Raw.GetMin())
VEC_FROM_3D( ptMax, b3Raw.GetMax())
return TRUE ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtSplitFlatRawPartWithMachinings( int nRawId, int nNumMchId, const int nMchIds[])
{
INTVECTOR vMchIds ;
vMchIds.reserve( nNumMchId) ;
for ( int i = 0 ; i < nNumMchId ; ++i) {
vMchIds.push_back( nMchIds[i]) ;
}
return ExeSplitFlatRawPartWithMachinings( nRawId, vMchIds) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetPartInRawPartCount( int nRawId)
{
return ExeGetPartInRawPartCount( nRawId) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetFirstPartInRawPart( int nRawId)
{
return ExeGetFirstPartInRawPart( nRawId) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetNextPartInRawPart( int nPartId)
{
return ExeGetNextPartInRawPart( nPartId) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtAddPartToRawPart( int nPartId, const double ptPos[3], int nRawId)
{
return ( ExeAddPartToRawPart( nPartId, ptPos, nRawId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetRawPartFromPart( int nPartId)
{
return ExeGetRawPartFromPart( nPartId) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRemovePartFromRawPart( int nPartId)
{
return ( ExeRemovePartFromRawPart( nPartId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMovePartInRawPart( int nPartId, const double vtMove[3])
{
return ( ExeTranslatePartInRawPart( nPartId, vtMove) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRotatePartInRawPart( int nRawId, const double vtAx[3], double dAngDeg)
{
return ( ExeRotatePartInRawPart( nRawId, vtAx, dAngDeg) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
// Table & Fixtures
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetTable( const wchar_t* wsTable)
{
return ( ExeSetTable( wstrztoA( wsTable)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetTableAreaOffset( double dOffsXP, double dOffsYP, double dOffsXM, double dOffsYM)
{
return ( ExeSetTableAreaOffset( dOffsXP, dOffsYP, dOffsXM, dOffsYM) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetTableName( wchar_t*& wsTableName)
{
if ( &wsTableName == nullptr)
return FALSE ;
string sTableName ;
if ( ! ExeGetTable( sTableName))
return FALSE ;
wsTableName = _wcsdup( stringtoW( sTableName)) ;
return (( wsTableName == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetTableRef( int nInd, double ptPos[3])
{
// recupero il punto
Point3d ptTemp ;
if ( ! ExeGetTableRef( nInd, ptTemp))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptPos, ptTemp)
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetTableArea( int nInd, double ptMin[3], double ptMax[3])
{
// recupero l'identificativo
BBox3d b3Area ;
if ( ! ExeGetTableArea( nInd, b3Area))
return FALSE ;
// ritorno i dati
if ( ptMin != nullptr)
VEC_FROM_3D( ptMin, b3Area.GetMin()) ;
if ( ptMax != nullptr)
VEC_FROM_3D( ptMax, b3Area.GetMax()) ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetTableAreaOffset( int nInd, double ptMinOffs[3], double ptMaxOffs[3])
{
// recupero l'identificativo
BBox3d b3Area ;
if ( ! ExeGetTableAreaOffset( nInd, b3Area))
return FALSE ;
// ritorno i dati
if ( ptMinOffs != nullptr)
VEC_FROM_3D( ptMinOffs, b3Area.GetMin()) ;
if ( ptMaxOffs != nullptr)
VEC_FROM_3D( ptMaxOffs, b3Area.GetMax()) ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtChangeTable( const wchar_t* wsTable, BOOL bUpdateDisp)
{
return ( ExeChangeTable( wstrztoA( wsTable), ( bUpdateDisp != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtShowOnlyTable( BOOL bVal)
{
return ( ExeShowOnlyTable( ( bVal != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMoveDispAxis( const wchar_t* wsName, double dPos)
{
return ( ExeMoveDispAxis( wstrztoA( wsName), dPos) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRemoveDispAxis( const wchar_t* wsName)
{
return ( ExeRemoveDispAxis( wstrztoA( wsName)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtKeepAllDispAxes( int nSouPhase)
{
return ( ExeKeepAllDispAxes( nSouPhase) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtAddFixture( const wchar_t* wsName, const double ptPos[3], double dAngRotDeg, double dMov)
{
return ExeAddFixture( wstrztoA( wsName), ptPos, dAngRotDeg, dMov) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtKeepFixture( int nFxtId, int nSouPhase)
{
return ( ExeKeepFixture( nFxtId, nSouPhase) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRemoveFixture( int nFxtId)
{
return ( ExeRemoveFixture( nFxtId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtVerifyFixture( int nFxtId)
{
return ( ExeVerifyFixture( nFxtId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetFirstFixture( void)
{
return ExeGetFirstFixture() ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetNextFixture( int nFxtId)
{
return ExeGetNextFixture( nFxtId) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMoveFixture( int nFxtId, const double vtMove[3])
{
return ( ExeMoveFixture( nFxtId, vtMove) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRotateFixture( int nFxtId, double dDeltaAngDeg)
{
return ( ExeRotateFixture( nFxtId, dDeltaAngDeg) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetFixtureLink( int nFxtId, const wchar_t* wsTaLink)
{
return ( ExeSetFixtureLink( nFxtId, wstrztoA( wsTaLink)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMoveFixtureMobile( int nFxtId, double dDeltaMov)
{
return ( ExeMoveFixtureMobile( nFxtId, dDeltaMov) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetFixtureMobile( int nFxtId, double dMov)
{
return ( ExeSetFixtureMobile( nFxtId, dMov) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
// Tools DataBase
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbGetToolNewName( const wchar_t* wsName, wchar_t*& wsNewName)
{
if ( &wsNewName == nullptr)
return FALSE ;
string sNewName = wstrztoA( wsName) ;
if ( ! ExeTdbGetToolNewName( sNewName))
return FALSE ;
wsNewName = _wcsdup( stringtoW( sNewName)) ;
return (( wsNewName == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbAddTool( const wchar_t* wsName, int nType)
{
return ( ExeTdbAddTool( wstrztoA( wsName), nType) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbCopyTool( const wchar_t* wsSource, const wchar_t* wsName)
{
return ( ExeTdbCopyTool( wstrztoA( wsSource), wstrztoA( wsName)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbRemoveTool( const wchar_t* wsName)
{
return ( ExeTdbRemoveTool( wstrztoA( wsName)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbGetFirstTool( int nFamily, wchar_t*& wsName, int* pnType)
{
if ( &wsName == nullptr || pnType == nullptr)
return FALSE ;
string sName ;
if ( ! ExeTdbGetFirstTool( nFamily, sName, *pnType))
return FALSE ;
wsName = _wcsdup( stringtoW( sName)) ;
return (( wsName == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbGetNextTool( int nFamily, wchar_t*& wsName, int* pnType)
{
if ( &wsName == nullptr || pnType == nullptr)
return FALSE ;
string sName ;
if ( ! ExeTdbGetNextTool( nFamily, sName, *pnType))
return FALSE ;
wsName = _wcsdup( stringtoW( sName)) ;
return (( wsName == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbGetToolFromUUID( const wchar_t* wsTuuid, wchar_t*& wsName)
{
if ( &wsName == nullptr)
return FALSE ;
string sName ;
if ( ! ExeTdbGetToolFromUUID( wstrztoA( wsTuuid), sName))
return FALSE ;
wsName = _wcsdup( stringtoW( sName)) ;
return (( wsName == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbSetCurrTool( const wchar_t* wsName)
{
return ( ExeTdbSetCurrTool( wstrztoA( wsName)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbSaveCurrTool( void)
{
return ( ExeTdbSaveCurrTool() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbIsCurrToolModified( void)
{
return ( ExeTdbIsCurrToolModified() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbSetCurrToolParamBool( int nType, BOOL bVal)
{
return ( ExeTdbSetCurrToolParam( nType, ( bVal != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbSetCurrToolParamInt( int nType, int nVal)
{
return ( ExeTdbSetCurrToolParam( nType, nVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbSetCurrToolParamDouble( int nType, double dVal)
{
return ( ExeTdbSetCurrToolParam( nType, dVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbSetCurrToolParamString( int nType, const wchar_t* wsVal)
{
return ( ExeTdbSetCurrToolParam( nType, string( wstrztoA( wsVal))) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbSetCurrToolValInNotesBool( int nType, const wchar_t* wsKey, BOOL bVal)
{
return ( ExeTdbSetCurrToolValInNotes( nType, string( wstrztoA( wsKey)), ( bVal != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbSetCurrToolValInNotesInt( int nType, const wchar_t* wsKey, int nVal)
{
return ( ExeTdbSetCurrToolValInNotes( nType, string( wstrztoA( wsKey)), nVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbSetCurrToolValInNotesDouble( int nType, const wchar_t* wsKey, double dVal)
{
return ( ExeTdbSetCurrToolValInNotes( nType, string( wstrztoA( wsKey)), dVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbSetCurrToolValInNotesString( int nType, const wchar_t* wsKey, const wchar_t* wsVal)
{
return ( ExeTdbSetCurrToolValInNotes( nType, string( wstrztoA( wsKey)), string( wstrztoA( wsVal))) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbRemoveCurrToolValInNotes( int nType, const wchar_t* wsKey)
{
return ( ExeTdbRemoveCurrToolValInNotes( nType, string( wstrztoA( wsKey))) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbGetCurrToolParamBool( int nType, BOOL* pbVal)
{
if ( pbVal == nullptr)
return FALSE ;
bool bVal ;
if ( ! ExeTdbGetCurrToolParam( nType, bVal))
return FALSE ;
*pbVal = ( bVal ? TRUE : FALSE) ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbGetCurrToolParamInt( int nType, int* pnVal)
{
if ( pnVal == nullptr)
return FALSE ;
return ( ExeTdbGetCurrToolParam( nType, *pnVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbGetCurrToolParamDouble( int nType, double* pdVal)
{
if ( pdVal == nullptr)
return FALSE ;
return ( ExeTdbGetCurrToolParam( nType, *pdVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbGetCurrToolParamString( int nType, wchar_t*& wsVal)
{
if ( &wsVal == nullptr)
return FALSE ;
string sVal ;
if ( ! ExeTdbGetCurrToolParam( nType, sVal))
return FALSE ;
wsVal = _wcsdup( stringtoW( sVal)) ;
return (( wsVal == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbGetCurrToolValInNotesBool( int nType, const wchar_t* wsKey, BOOL* pbVal)
{
if ( pbVal == nullptr)
return FALSE ;
bool bVal ;
if ( ! ExeTdbGetCurrToolValInNotes( nType, string( wstrztoA( wsKey)), bVal))
return FALSE ;
*pbVal = ( bVal ? TRUE : FALSE) ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbGetCurrToolValInNotesInt( int nType, const wchar_t* wsKey, int* pnVal)
{
if ( pnVal == nullptr)
return FALSE ;
return ( ExeTdbGetCurrToolValInNotes( nType, string( wstrztoA( wsKey)), *pnVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbGetCurrToolValInNotesDouble( int nType, const wchar_t* wsKey, double* pdVal)
{
if ( pdVal == nullptr)
return FALSE ;
return ( ExeTdbGetCurrToolValInNotes( nType, string( wstrztoA( wsKey)), *pdVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbGetCurrToolValInNotesString( int nType, const wchar_t* wsKey, wchar_t*& wsVal)
{
if ( &wsVal == nullptr)
return FALSE ;
string sVal ;
if ( ! ExeTdbGetCurrToolValInNotes( nType, string( wstrztoA( wsKey)), sVal))
return FALSE ;
wsVal = _wcsdup( stringtoW( sVal)) ;
return (( wsVal == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbGetCurrToolMaxDepth( double* pdVal)
{
if ( pdVal == nullptr)
return FALSE ;
return ( ExeTdbGetCurrToolMaxDepth( *pdVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtTdbCurrToolDraw( int nGenCtx, int nToolCtx)
{
return ExeTdbCurrToolDraw( nGenCtx, nToolCtx) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbReload( void)
{
return ( ExeTdbReload() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbSave( void)
{
return ( ExeTdbSave() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbGetToolDir( wchar_t*& wsToolDir)
{
if ( &wsToolDir == nullptr)
return FALSE ;
string sToolDir ;
if ( ! ExeTdbGetToolDir( sToolDir))
return FALSE ;
wsToolDir = _wcsdup( stringtoW( sToolDir)) ;
return (( wsToolDir == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbGetToolHolderDir( wchar_t*& wsTHolderDir)
{
if ( &wsTHolderDir == nullptr)
return FALSE ;
string sTHolderDir ;
if ( ! ExeTdbGetToolHolderDir( sTHolderDir))
return FALSE ;
wsTHolderDir = _wcsdup( stringtoW( sTHolderDir)) ;
return (( wsTHolderDir == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbExport( const wchar_t* wsToolsNames, const wchar_t* wsOutFile)
{
STRVECTOR vsToolsNames ;
if ( ! Tokenize( string( wstrztoA( wsToolsNames)), "\n", vsToolsNames))
return FALSE ;
return( ExeTdbExport( vsToolsNames, string( wstrztoA( wsOutFile))) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbToBeImported( const wchar_t* wsFile, wchar_t*& wsToolsNames, int*& vTypes, int* pnCount)
{
if ( &wsToolsNames == nullptr || &vTypes == nullptr || pnCount == nullptr)
return FALSE ;
STRVECTOR vsToolsNames ;
INTVECTOR vToolsTypes ;
if ( ! ExeTdbToBeImported( string( wstrztoA( wsFile)), vsToolsNames, vToolsTypes))
return FALSE ;
// restituzione vettore nomi
string sToolsNames ;
for ( const auto& sName : vsToolsNames)
sToolsNames += sName + "\n" ;
if ( ! sToolsNames.empty())
sToolsNames.pop_back() ;
wsToolsNames = _wcsdup( stringtoW( sToolsNames)) ;
if ( wsToolsNames == nullptr)
return FALSE ;
// restituzione vettore tipi
int nDim = int( vToolsTypes.size()) ;
if ( nDim == 0) {
vTypes = nullptr ;
}
else {
vTypes = (int*) malloc( nDim * sizeof( int)) ;
if ( vTypes == nullptr) {
free( wsToolsNames) ;
return FALSE ;
}
for ( int i = 0 ; i < nDim ; ++ i)
vTypes[i] = vToolsTypes[i] ;
}
*pnCount = nDim ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtTdbImport( const wchar_t* wsFile, const wchar_t* wsToolsToImport, const wchar_t* wsToolsNames, wchar_t*& wsImported)
{
if ( &wsImported == nullptr)
return FALSE ;
STRVECTOR vsToolsToImport ;
if ( ! Tokenize( string( wstrztoA( wsToolsToImport)), "\n", vsToolsToImport))
return FALSE ;
STRVECTOR vsToolsNames ;
if ( ! Tokenize( string( wstrztoA( wsToolsNames)), "\n", vsToolsNames))
return FALSE ;
STRVECTOR vsImported ;
if ( ! ExeTdbImport( string( wstrztoA( wsFile)), vsToolsToImport, vsToolsNames, vsImported))
return FALSE ;
string sImported ;
for ( const auto& sName : vsImported)
sImported += sName + "\n" ;
if ( ! sImported.empty())
sImported.pop_back() ;
wsImported = _wcsdup( stringtoW( sImported)) ;
return (( wsImported == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
// Setup
//-----------------------------------------------------------------------------
int
__stdcall EgtGetCurrSetup( void)
{
return ExeGetCurrSetup() ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtImportSetup( const wchar_t* wsName)
{
return (ExeImportSetup( wstrztoA( wsName)) ? TRUE : FALSE ) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtUpdateCurrSetup( void)
{
return (ExeUpdateCurrSetup() ? TRUE : FALSE ) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtEraseCurrSetup( void)
{
return (ExeEraseCurrSetup() ? TRUE : FALSE ) ;
}
//-----------------------------------------------------------------------------
// Machinings DataBase
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbGetMachiningNewName( const wchar_t* wsName, wchar_t*& wsNewName)
{
if ( &wsNewName == nullptr)
return FALSE ;
string sNewName = wstrztoA( wsName) ;
if ( ! ExeMdbGetMachiningNewName( sNewName))
return FALSE ;
wsNewName = _wcsdup( stringtoW( sNewName)) ;
return (( wsNewName == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbAddMachining( const wchar_t* wsName, int nType)
{
return ( ExeMdbAddMachining( wstrztoA( wsName), nType) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbCopyMachining( const wchar_t* wsSource, const wchar_t* wsName)
{
return ( ExeMdbCopyMachining( wstrztoA( wsSource), wstrztoA( wsName)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbRemoveMachining( const wchar_t* wsName)
{
return ( ExeMdbRemoveMachining( wstrztoA( wsName)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbGetFirstMachining( int nType, wchar_t*& wsName)
{
if ( &wsName == nullptr)
return FALSE ;
string sName ;
if ( ! ExeMdbGetFirstMachining( nType, sName))
return FALSE ;
wsName = _wcsdup( stringtoW( sName)) ;
return (( wsName == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbGetNextMachining( int nType, wchar_t*& wsName)
{
if ( &wsName == nullptr)
return FALSE ;
string sName ;
if ( ! ExeMdbGetNextMachining( nType, sName))
return FALSE ;
wsName = _wcsdup( stringtoW( sName)) ;
return (( wsName == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbGetMachiningFromUUID( const wchar_t* wsMuuid, wchar_t*& wsName)
{
if ( &wsName == nullptr)
return FALSE ;
string sName ;
if ( ! ExeMdbGetMachiningFromUUID( wstrztoA( wsMuuid), sName))
return FALSE ;
wsName = _wcsdup( stringtoW( sName)) ;
return (( wsName == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbSetCurrMachining( const wchar_t* wsName)
{
return ( ExeMdbSetCurrMachining( wstrztoA( wsName)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbSaveCurrMachining( void)
{
return ( ExeMdbSaveCurrMachining() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbIsCurrMachiningModified( void)
{
return ( ExeMdbIsCurrMachiningModified() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbSetCurrMachiningParamBool( int nType, BOOL bVal)
{
return ( ExeMdbSetCurrMachiningParam( nType, ( bVal != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbSetCurrMachiningParamInt( int nType, int nVal)
{
return ( ExeMdbSetCurrMachiningParam( nType, nVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbSetCurrMachiningParamDouble( int nType, double dVal)
{
return ( ExeMdbSetCurrMachiningParam( nType, dVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbSetCurrMachiningParamString( int nType, const wchar_t* wsVal)
{
return ( ExeMdbSetCurrMachiningParam( nType, string( wstrztoA( wsVal))) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbGetCurrMachiningParamBool( int nType, BOOL* pbVal)
{
if ( pbVal == nullptr)
return FALSE ;
bool bVal ;
if ( ! ExeMdbGetCurrMachiningParam( nType, bVal))
return FALSE ;
*pbVal = ( bVal ? TRUE : FALSE) ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbGetCurrMachiningParamInt( int nType, int* pnVal)
{
if ( pnVal == nullptr)
return FALSE ;
return ( ExeMdbGetCurrMachiningParam( nType, *pnVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbGetCurrMachiningParamDouble( int nType, double* pdVal)
{
if ( pdVal == nullptr)
return FALSE ;
return ( ExeMdbGetCurrMachiningParam( nType, *pdVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbGetCurrMachiningParamString( int nType, wchar_t*& wsVal)
{
if ( &wsVal == nullptr)
return FALSE ;
string sVal ;
if ( ! ExeMdbGetCurrMachiningParam( nType, sVal))
return FALSE ;
wsVal = _wcsdup( stringtoW( sVal)) ;
return (( wsVal == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbSetGeneralParamBool( int nType, BOOL bVal)
{
return ( ExeMdbSetGeneralParam( nType, bVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbSetGeneralParamInt( int nType, int nVal)
{
return ( ExeMdbSetGeneralParam( nType, nVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbSetGeneralParamDouble( int nType, double dVal)
{
return ( ExeMdbSetGeneralParam( nType, dVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbGetGeneralParamBool( int nType, BOOL* pbVal)
{
if ( pbVal == nullptr)
return FALSE ;
bool bVal ;
if ( ! ExeMdbGetGeneralParam( nType, bVal))
return FALSE ;
*pbVal = ( bVal ? TRUE : FALSE) ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbGetGeneralParamInt( int nType, int* pnVal)
{
if ( pnVal == nullptr)
return FALSE ;
return ( ExeMdbGetGeneralParam( nType, *pnVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbGetGeneralParamDouble( int nType, double* pdVal)
{
if ( pdVal == nullptr)
return FALSE ;
return ( ExeMdbGetGeneralParam( nType, *pdVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbReload( void)
{
return ( ExeMdbReload() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbSave( void)
{
return ( ExeMdbSave() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbGetMachiningDir( wchar_t*& wsMchDir)
{
if ( &wsMchDir == nullptr)
return FALSE ;
string sMchDir ;
if ( ! ExeTdbGetToolDir( sMchDir))
return FALSE ;
wsMchDir = _wcsdup( stringtoW( sMchDir)) ;
return (( wsMchDir == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbExport( const wchar_t* wsMachiningsNames, const wchar_t* wsOutFile)
{
STRVECTOR vsMachiningsNames ;
if ( ! Tokenize( string( wstrztoA( wsMachiningsNames)), "\n", vsMachiningsNames))
return FALSE ;
return( ExeMdbExport( vsMachiningsNames, string( wstrztoA( wsOutFile))) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbToBeImported( const wchar_t* wsFile, wchar_t*& wsMachiningsNames, int*& vTypes, int* pnCount)
{
if ( &wsMachiningsNames == nullptr || &vTypes == nullptr || pnCount == nullptr)
return FALSE ;
STRVECTOR vsMachiningsNames ;
INTVECTOR vMachiningsTypes ;
if ( ! ExeMdbToBeImported( string( wstrztoA( wsFile)), vsMachiningsNames, vMachiningsTypes))
return FALSE ;
// restituzione vettore nomi
string sMachiningsNames ;
for ( const auto& sName : vsMachiningsNames)
sMachiningsNames += sName + "\n" ;
if ( ! sMachiningsNames.empty())
sMachiningsNames.pop_back() ;
wsMachiningsNames = _wcsdup( stringtoW( sMachiningsNames)) ;
if ( wsMachiningsNames == nullptr)
return FALSE ;
// restituzione vettore tipi
int nDim = int( vMachiningsTypes.size()) ;
if ( nDim == 0) {
vTypes = nullptr ;
}
else {
vTypes = (int*) malloc( nDim * sizeof( int)) ;
if ( vTypes == nullptr) {
free( wsMachiningsNames) ;
return FALSE ;
}
for ( int i = 0 ; i < nDim ; ++ i)
vTypes[i] = vMachiningsTypes[i] ;
}
*pnCount = nDim ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbImport( const wchar_t* wsFile, const wchar_t* wsMachiningsToImport, const wchar_t* wsMachiningsNames, wchar_t*& wsImported)
{
if ( &wsImported == nullptr)
return FALSE ;
STRVECTOR vsMachiningsToImport ;
if ( ! Tokenize( string( wstrztoA( wsMachiningsToImport)), "\n", vsMachiningsToImport))
return FALSE ;
STRVECTOR vsMachiningsNames ;
if ( ! Tokenize( string( wstrztoA( wsMachiningsNames)), "\n", vsMachiningsNames))
return FALSE ;
STRVECTOR vsImported ;
if ( ! ExeMdbImport( string( wstrztoA( wsFile)), vsMachiningsToImport, vsMachiningsNames, vsImported))
return FALSE ;
string sImported ;
for ( const auto& sName : vsImported)
sImported += sName + "\n" ;
if ( ! sImported.empty())
sImported.pop_back() ;
wsImported = _wcsdup( stringtoW( sImported)) ;
return (( wsImported == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
// Operations
//-----------------------------------------------------------------------------
int
__stdcall EgtGetFirstOperation( void)
{
return ExeGetFirstOperation() ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetNextOperation( int nId)
{
return ExeGetNextOperation( nId) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetLastOperation( void)
{
return ExeGetLastOperation() ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetPrevOperation( int nId)
{
return ExeGetPrevOperation( nId) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetFirstActiveOperation( bool bNeedMachNotEmpty)
{
return ExeGetFirstActiveOperation( bNeedMachNotEmpty) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetNextActiveOperation( int nId, bool bNeedMachNotEmpty)
{
return ExeGetNextActiveOperation( nId, bNeedMachNotEmpty) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetLastActiveOperation( bool bNeedMachNotEmpty)
{
return ExeGetLastActiveOperation( bNeedMachNotEmpty) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetPrevActiveOperation( int nId, bool bNeedMachNotEmpty)
{
return ExeGetPrevActiveOperation( nId, bNeedMachNotEmpty) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetOperationType( int nId)
{
return ExeGetOperationType( nId) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetOperationPhase( int nId)
{
return ExeGetOperationPhase( nId) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetOperationName( int nId, const wchar_t* wsName)
{
return ( ExeSetOperationName( nId, string( wstrztoA( wsName))) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetOperationName( int nId, wchar_t*& wsName)
{
if ( &wsName == nullptr)
return FALSE ;
string sName ;
if ( ! ExeGetOperationName( nId, sName))
return FALSE ;
wsName = _wcsdup( stringtoW( sName)) ;
return (( wsName == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetOperationId( const wchar_t* wsName)
{
return ExeGetOperationId( wstrztoA( wsName)) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtIsOperationEmpty( int nId, int nEmptyType)
{
return ( ExeIsOperationEmpty( nId, nEmptyType) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRemoveOperation( int nId)
{
return ( ExeRemoveOperation( nId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRemoveAllPhaseOperations( int nPhase)
{
return ( ExeRemoveAllPhaseOperations( nPhase) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRemoveAllOperations( void)
{
return ( ExeRemoveAllOperations() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetOperationMode( int nId, BOOL bActive)
{
return ( ExeSetOperationMode( nId, bActive!= FALSE) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetOperationMode( int nId)
{
bool bActive ;
if ( ! ExeGetOperationMode( nId, bActive))
return FALSE ;
return ( bActive ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetAllOperationsMode( BOOL bActive)
{
return ( ExeSetAllOperationsMode( bActive!= FALSE) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetOperationStatus( int nId, BOOL bShow)
{
return ( ExeSetOperationStatus( nId, ( bShow != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetOperationStatus( int nId)
{
bool bShow ;
if ( ! ExeGetOperationStatus( nId, bShow))
return FALSE ;
return ( bShow ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetAllOperationsStatus( BOOL bShow)
{
return ( ExeSetAllOperationsStatus( bShow != FALSE) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtAdjustOperationPhase( int nId)
{
return ( ExeAdjustOperationPhase( nId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtChangeOperationPhase( int nId, int nNewPhase)
{
return ( ExeChangeOperationPhase( nId, nNewPhase) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetPhaseLastOperation( int nPhase)
{
return ExeGetPhaseLastOperation( nPhase) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRemoveOperationHome( int nId)
{
return ( ExeRemoveOperationHome( nId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
// Dispositions
//-----------------------------------------------------------------------------
int
__stdcall EgtGetPhaseDisposition( int nPhase)
{
return ExeGetPhaseDisposition( nPhase) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSpecialApplyDisposition( int nId, BOOL bRecalc)
{
return ( ExeSpecialApplyDisposition( nId, ( bRecalc != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSpecialUpdateDisposition( int nId)
{
return ( ExeSpecialUpdateDisposition( nId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
// Machinings
//-----------------------------------------------------------------------------
int
__stdcall EgtAddMachining( const wchar_t* wsName, const wchar_t* wsMachining)
{
return ExeAddMachining( wstrztoA( wsName), wstrztoA( wsMachining)) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtCreateMachining( const wchar_t* wsName, int nMchType, const wchar_t* wsTool)
{
return ExeAddMachining( wstrztoA( wsName), nMchType, wstrztoA( wsTool)) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtCopyMachining( const wchar_t* wsName, const wchar_t* wsSouName)
{
return ExeCopyMachining( wstrztoA( wsName), wstrztoA( wsSouName)) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetCurrMachining( int nId)
{
return ( ExeSetCurrMachining( nId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtResetCurrMachining( void)
{
return ( ExeResetCurrMachining() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetCurrMachining( void)
{
return ExeGetCurrMachining() ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetMachiningParamBool( int nType, BOOL bVal)
{
return ( ExeSetMachiningParam( nType, ( bVal != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetMachiningParamInt( int nType, int nVal)
{
return ( ExeSetMachiningParam( nType, nVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetMachiningParamDouble( int nType, double dVal)
{
return ( ExeSetMachiningParam( nType, dVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetMachiningParamString( int nType, const wchar_t* wsVal)
{
return ( ExeSetMachiningParam( nType, string( wstrztoA( wsVal))) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetMachiningGeometry( int nNumId, const int nIds[], const int nSubs[])
{
if ( nIds == nullptr || nSubs == nullptr)
return FALSE ;
// creo elenco identificativi
SELVECTOR vIds ;
vIds.reserve( nNumId) ;
for ( int i = 0 ; i < nNumId ; ++ i)
vIds.emplace_back( nIds[i], nSubs[i]) ;
return ( ExeSetMachiningGeometry( vIds) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtPreviewMachining( BOOL bRecalc)
{
return ( ExePreviewMachining( bRecalc != FALSE) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtApplyMachining( BOOL bRecalc)
{
return ( ExeApplyMachining( bRecalc != FALSE) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtUpdateMachining( void)
{
return ( ExeUpdateMachining() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtChangePreviewMachiningToolShow( int nLookFlag)
{
return ( ExeChangePreviewMachiningToolShow( nLookFlag) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtPreparePreviewMachiningTool( void)
{
return ( ExePreparePreviewMachiningTool() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRemovePreviewMachiningTool( void)
{
return ( ExeRemovePreviewMachiningTool() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetPreviewMachiningToolStepCount( void)
{
return ExeGetPreviewMachiningToolStepCount() ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtPreviewMachiningTool( int nEntId, int nStep)
{
return ExePreviewMachiningTool( nEntId, nStep) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetMachiningParamBool( int nType, BOOL* pbVal)
{
if ( pbVal == nullptr)
return FALSE ;
bool bVal ;
if ( ! ExeGetMachiningParam( nType, bVal))
return FALSE ;
*pbVal = bVal ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetMachiningParamInt( int nType, int* pnVal)
{
if ( pnVal == nullptr)
return FALSE ;
return ( ExeGetMachiningParam( nType, *pnVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetMachiningParamDouble( int nType, double* pdVal)
{
if ( pdVal == nullptr)
return FALSE ;
return ( ExeGetMachiningParam( nType, *pdVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetMachiningParamString( int nType, wchar_t*& wsVal)
{
if ( &wsVal == nullptr)
return FALSE ;
string sVal ;
if ( ! ExeGetMachiningParam( nType, sVal))
return FALSE ;
wsVal = _wcsdup( stringtoW( sVal)) ;
return (( wsVal == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetMachiningGeometry( int nInd, int* pnId, int* pnSub)
{
if ( pnId == nullptr || pnSub == nullptr)
return FALSE ;
// recupero elenco identificativi
SELVECTOR vIds ;
if ( ! ExeGetMachiningGeometry( vIds)) {
*pnId = GDB_ID_NULL ;
return FALSE ;
}
// verifico indice
if ( nInd < 0 || nInd >= int( vIds.size())) {
*pnId = GDB_ID_NULL ;
return FALSE ;
}
// assegno il risultato
*pnId = vIds[nInd].nId ;
*pnSub = vIds[nInd].nSub ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtIsMachiningEmpty( int nEmptyType)
{
return ( ExeIsMachiningEmpty( nEmptyType) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetMachiningStartPoint( double ptP[3])
{
// recupero il punto
Point3d ptStart ;
if ( ! ExeGetMachiningStartPoint( ptStart))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptStart)
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetMachiningEndPoint( double ptP[3])
{
// recupero il punto
Point3d ptEnd ;
if ( ! ExeGetMachiningEndPoint( ptEnd))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptEnd)
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtApplyAllMachinings( BOOL bRecalc, BOOL bStopOnFirstErr, wchar_t*& wsErrList)
{
if ( &wsErrList == nullptr)
return FALSE ;
string sErrList ;
bool bOk = ExeApplyAllMachinings( bRecalc != FALSE, bStopOnFirstErr != FALSE, sErrList) ;
wsErrList = _wcsdup( stringtoW( sErrList)) ;
return ( ( bOk && wsErrList != nullptr) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtUpdateAllMachinings( BOOL bStopOnFirstErr, wchar_t*& wsErrList)
{
if ( &wsErrList == nullptr)
return FALSE ;
string sErrList ;
bool bOk = ExeUpdateAllMachinings( bStopOnFirstErr != FALSE, sErrList) ;
wsErrList = _wcsdup( stringtoW( sErrList)) ;
return ( ( bOk && wsErrList != nullptr) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
// Simulation
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSimInit( void)
{
return ( ExeSimInit() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSimStart( BOOL bFirst)
{
return ( ExeSimStart( bFirst != FALSE) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSimMove( int* pnStatus)
{
int nStatus ;
bool bOk = ExeSimMove( nStatus) ;
if ( pnStatus != nullptr)
*pnStatus = nStatus ;
return ( bOk ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSimHome( void)
{
return ( ExeSimHome() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSimSetStep( double dStep)
{
return ( ExeSimSetStep( dStep) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSimSetUiStatus( int nUiStatus)
{
return ( ExeSimSetUiStatus( nUiStatus) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSimEnableToolTipTrace( BOOL bEnable)
{
return ( ExeSimEnableToolTipTrace( bEnable != FALSE) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSimGetAxisInfoPos( int nI, wchar_t*& wsName, wchar_t*& wsToken, BOOL* pbLinear, double* pdVal)
{
if ( &wsName == nullptr || &wsToken == nullptr || pbLinear == nullptr || pdVal == nullptr)
return FALSE ;
string sName ;
string sToken ;
bool bLinear ;
if ( ! ExeSimGetAxisInfoPos( nI, sName, sToken, bLinear, *pdVal))
return FALSE ;
wsName = _wcsdup( stringtoW( sName)) ;
wsToken = ( wsName != nullptr ? _wcsdup( stringtoW( sToken)) : nullptr) ;
*pbLinear = ( bLinear ? TRUE : FALSE) ;
return (( wsName == nullptr || wsToken == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSimGetToolInfo( wchar_t*& wsTool, double* pdSpeed)
{
if ( &wsTool == nullptr || pdSpeed == nullptr)
return FALSE ;
string sTool ;
if ( ! ExeSimGetToolInfo( sTool, *pdSpeed))
return FALSE ;
wsTool = _wcsdup( stringtoW( sTool)) ;
return (( wsTool == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSimGetOperationInfo( wchar_t*& wsName, int* pnType)
{
if ( &wsName == nullptr || pnType == nullptr)
return FALSE ;
string sName ;
if ( ! ExeSimGetOperationInfo( sName, *pnType))
return FALSE ;
wsName = _wcsdup( stringtoW( sName)) ;
return (( wsName == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSimGetMoveInfo( int* pnGmove, double* pdFeed)
{
if ( pnGmove == nullptr || pdFeed == nullptr)
return FALSE ;
return ( ExeSimGetMoveInfo( *pnGmove, *pdFeed) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSimExit( void)
{
return ( ExeSimExit() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
// Generation & T&L estimation
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGenerate( const wchar_t* wsCncFile, const wchar_t* wsInfo)
{
return ( ExeGenerate( wstrztoA( wsCncFile), wstrztoA( wsInfo)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtEstimate( const wchar_t* wsEstFile, const wchar_t* wsInfo)
{
return ( ExeEstimate( wstrztoA( wsEstFile), wstrztoA( wsInfo)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
// Machine
//-----------------------------------------------------------------------------
int
__stdcall EgtGetBaseId( const wchar_t* wsBase)
{
return ExeGetBaseId( wstrztoA( wsBase)) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetTableId( const wchar_t* wsTable)
{
return ExeGetTableId( wstrztoA( wsTable)) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetAxisId( const wchar_t* wsAxis)
{
return ExeGetAxisId( wstrztoA( wsAxis)) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetHeadId( const wchar_t* wsHead)
{
return ExeGetHeadId( wstrztoA( wsHead)) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetHeadExitCount( const wchar_t* wsHead)
{
return ExeGetHeadExitCount( wstrztoA( wsHead)) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetAxisType( const wchar_t* wsAxis, BOOL* pbLinear)
{
if ( pbLinear == nullptr)
return FALSE ;
bool bLinear ;
if ( ! ExeGetAxisType( wstrztoA( wsAxis), bLinear))
return FALSE ;
*pbLinear = ( bLinear ? TRUE : FALSE) ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetAxisDir( const wchar_t* wsAxis, double vtDir[3])
{
if ( vtDir == nullptr)
return FALSE ;
Vector3d vtTmp ;
if ( ! ExeGetAxisDir( wstrztoA( wsAxis), vtTmp))
return FALSE ;
VEC_FROM_3D( vtDir, vtTmp) ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetAxisInvert( const wchar_t* wsAxis, BOOL* pbInvert)
{
if ( pbInvert == nullptr)
return FALSE ;
bool bInvert ;
if ( ! ExeGetAxisInvert( wstrztoA( wsAxis), bInvert))
return FALSE ;
*pbInvert = ( bInvert ? TRUE : FALSE) ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetAxisOffset( const wchar_t* wsAxis, double* pdOffset)
{
if ( pdOffset == nullptr)
return FALSE ;
return( ExeGetAxisOffset( wstrztoA( wsAxis), *pdOffset) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetAllHeadsNames( wchar_t*& wsNames)
{
if ( &wsNames == nullptr)
return FALSE ;
STRVECTOR vNames ;
if ( ! ExeGetAllHeadsNames( vNames))
return FALSE ;
string sNames ;
for ( const auto& sName : vNames)
sNames += sName + "," ;
if ( ! sNames.empty())
sNames.pop_back() ;
wsNames = _wcsdup( stringtoW( sNames)) ;
return (( wsNames == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetAllTablesNames( wchar_t*& wsNames)
{
if ( &wsNames == nullptr)
return FALSE ;
STRVECTOR vNames ;
if ( ! ExeGetAllTablesNames( vNames))
return FALSE ;
string sNames ;
for ( const auto& sName : vNames)
sNames += sName + "," ;
if ( ! sNames.empty())
sNames.pop_back() ;
wsNames = _wcsdup( stringtoW( sNames)) ;
return (( wsNames == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
// Machine Calc
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetCalcTool( const wchar_t* wsTool, const wchar_t* wsHead, int nExit)
{
return ( ExeSetCalcTool( wstrztoA( wsTool), wstrztoA( wsHead), nExit) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCalcTool( wchar_t*& wsTool, wchar_t*& wsHead, int* pnExit)
{
if ( &wsTool == nullptr || &wsHead == nullptr || pnExit == nullptr)
return FALSE ;
string sTool, sHead ;
if ( ! ExeGetCalcTool( sTool, sHead, *pnExit))
return FALSE ;
wsTool = _wcsdup( stringtoW( sTool)) ;
if ( wsTool == nullptr)
return FALSE ;
wsHead = _wcsdup( stringtoW( sHead)) ;
if ( wsHead == nullptr) {
free( wsTool) ;
return FALSE ;
}
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetAllCurrAxesNames( wchar_t*& wsAxNames)
{
if ( &wsAxNames == nullptr)
return FALSE ;
STRVECTOR vsAxNames ;
if ( ! ExeGetAllCurrAxesNames( vsAxNames))
return FALSE ;
// restituzione vettore risultati
string sAxNames ;
for ( const auto& sAxName : vsAxNames)
sAxNames += sAxName + "\n" ;
if ( ! sAxNames.empty())
sAxNames.pop_back() ;
wsAxNames = _wcsdup( stringtoW( sAxNames)) ;
return (( wsAxNames == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCalcAngles( const double vtDirT[3], const double vtDirA[3],
int* pnStat, double* pdAngA1, double* pdAngB1, double* pdAngA2, double* pdAngB2)
{
if ( vtDirT == nullptr || vtDirA == nullptr ||
pnStat == nullptr || pdAngA1 == nullptr || pdAngA2 == nullptr || pdAngB1 == nullptr || pdAngB2 == nullptr)
return FALSE ;
return ( ExeGetCalcAngles( vtDirT, vtDirA, *pnStat, *pdAngA1, *pdAngB1, *pdAngA2, *pdAngB2) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCalcAnglesEx( const double vtDirT[3], const double vtDirA[3],
int* pnStat, double*& vAngs1, double*& vAngs2, int* pnCount)
{
if ( vtDirT == nullptr || vtDirA == nullptr ||
pnStat == nullptr || pnCount == nullptr || &vAngs1 == nullptr || &vAngs2 == nullptr)
return FALSE ;
DBLVECTOR vA1, vA2 ;
if ( ! ExeGetCalcAngles( vtDirT, vtDirA, *pnStat, vA1, vA2) || vA1.size() != vA2.size())
return FALSE ;
// restituzione vettori angoli
int nDim = int( vA1.size()) ;
if ( nDim == 0) {
vAngs1 = nullptr ;
vAngs2 = nullptr ;
}
else {
vAngs1 = (double*) malloc( nDim * sizeof( double)) ;
if ( vAngs1 == nullptr)
return FALSE ;
vAngs2 = (double*) malloc( nDim * sizeof( double)) ;
if ( vAngs2 == nullptr) {
free( vAngs1) ;
return FALSE ;
}
for ( int i = 0 ; i < nDim ; ++ i) {
vAngs1[i] = vA1[i] ;
vAngs2[i] = vA2[i] ;
}
}
*pnCount = nDim ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCalcPositions( const double ptP[3], int nCount, const double dAngs[],
int* pnStat, double* pdX, double* pdY, double* pdZ)
{
if ( ptP == nullptr || dAngs == nullptr ||
pnStat == nullptr || pdX == nullptr || pdY == nullptr || pdZ == nullptr)
return FALSE ;
DBLVECTOR vAng ;
for ( int i = 0 ; i < nCount ; ++i)
vAng.push_back( dAngs[i]) ;
*pnStat = 0 ; // mantenuto per compatibilit
return ( ExeGetCalcPositions( ptP, vAng, *pdX, *pdY, *pdZ) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCalcTipFromPositions( double dX, double dY, double dZ, int nCount, const double dAngs[],
BOOL bBottom, double ptTip[3])
{
if ( dAngs == nullptr || ptTip == nullptr)
return FALSE ;
DBLVECTOR vAng ;
for ( int i = 0 ; i < nCount ; ++i)
vAng.push_back( dAngs[i]) ;
Point3d ptTmp ;
if ( ! ExeGetCalcTipFromPositions( dX, dY, dZ, vAng, ( bBottom != FALSE), ptTmp))
return FALSE ;
// ritorno i dati
VEC_FROM_3D( ptTip, ptTmp) ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCalcToolDirFromAngles( int nCount, const double dAngs[], double vtDir[3])
{
if ( dAngs == nullptr || vtDir == nullptr)
return FALSE ;
DBLVECTOR vAng ;
for ( int i = 0 ; i < nCount ; ++i)
vAng.push_back( dAngs[i]) ;
Vector3d vtTmp ;
if ( ! ExeGetCalcToolDirFromAngles( vAng, vtTmp))
return FALSE ;
// ritorno i dati
VEC_FROM_3D( vtDir, vtTmp) ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtVerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int* pnStat)
{
int nStat ;
if ( ! ExeVerifyOutstroke( dX, dY, dZ, dAngA, dAngB, nStat))
return FALSE ;
if ( pnStat != nullptr)
*pnStat = nStat ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetOutstrokeInfo( wchar_t*& wsInfo)
{
if ( &wsInfo == nullptr)
return FALSE ;
string sInfo ;
if ( ! ExeGetOutstrokeInfo( sInfo))
return FALSE ;
wsInfo = _wcsdup( stringtoW( sInfo)) ;
return (( wsInfo == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
// Machine Move
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetAxisPos( const wchar_t* wsAxis, double dVal)
{
return ( ExeSetAxisPos( wstrztoA( wsAxis), dVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetAxisPos( const wchar_t* wsAxis, double* pdVal)
{
return ( ExeGetAxisPos( wstrztoA( wsAxis), pdVal) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetAxisMin( const wchar_t* wsAxis, double* pdMin)
{
return ( ExeGetAxisMin( wstrztoA( wsAxis), pdMin) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetAxisMax( const wchar_t* wsAxis, double* pdMax)
{
return ( ExeGetAxisMax( wstrztoA( wsAxis), pdMax) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetAxisHomePos( const wchar_t* wsAxis, double* pdHome)
{
return ( ExeGetAxisHomePos( wstrztoA( wsAxis), pdHome) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtLoadTool( const wchar_t* wsHead, int nExit, const wchar_t* wsTool)
{
return ( ExeLoadTool( wstrztoA( wsHead), nExit, wstrztoA( wsTool)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtResetHeadSet( const wchar_t* wsHead)
{
return ( ExeResetHeadSet( wstrztoA( wsHead)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetMachineLook( int nFlag)
{
return ( ExeSetMachineLook( nFlag) ? TRUE : FALSE) ;
}