diff --git a/EGnLuaAux.h b/EGnLuaAux.h index da0b50c..8776316 100644 --- a/EGnLuaAux.h +++ b/EGnLuaAux.h @@ -185,6 +185,42 @@ LuaGetParam( lua_State* L, int nInd, DBLVECTOR& vPar) return false ; } +//---------------------------------------------------------------------------- +inline bool +LuaGetParam( lua_State* L, int nInd, STRVECTOR& vPar) +{ + vPar.clear() ; + if ( lua_isstring( L, nInd)) { + std::string sVal = lua_tostring( L, nInd) ; + vPar.emplace_back( sVal) ; + return true ; + } + else if ( lua_istable( L, nInd)) { + // lunghezza della tavola + lua_len( L, nInd) ; + if ( ! lua_isnumber( L, -1)) { + lua_pop( L, 1) ; + return false ; + } + int nLen = int( lua_tointeger( L, -1)) ; + lua_pop( L, 1) ; + vPar.reserve( nLen) ; + for ( int i = 1 ; i <= nLen ; ++ i) { + lua_rawgeti( L, nInd, i) ; + if ( ! lua_isstring( L, -1)) { + lua_pop( L, 1) ; + return false ; + } + std::string sVal = lua_tostring( L, -1) ; + vPar.emplace_back( sVal) ; + lua_pop( L, 1) ; + } + return true ; + } + else + return false ; +} + //---------------------------------------------------------------------------- template bool @@ -198,6 +234,14 @@ LuaGetTabFieldParam( lua_State* L, int nInd, const char* szField, T& Val) return bOk ; } +//---------------------------------------------------------------------------- +template +bool +LuaGetTabFieldParam( lua_State* L, int nInd, const std::string& sField, T& Val) +{ + return LuaGetTabFieldParam( L, nInd, sField.c_str(), Val) ; +} + //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- @@ -314,6 +358,24 @@ LuaSetParam( lua_State* L, const DBLVECTOR& vPar) return true ; } +//---------------------------------------------------------------------------- +inline bool +LuaSetParam( lua_State* L, const STRVECTOR& vPar) +{ + try { + int nSize = int( vPar.size()) ; + lua_createtable( L, nSize, 0) ; + for ( int i = 1 ; i <= nSize ; ++ i) { + lua_pushstring( L, vPar[i-1].c_str()) ; + lua_rawseti( L, -2, i) ; + } + } + catch( ...) { + return false ; + } + return true ; +} + //---------------------------------------------------------------------------- inline bool LuaSetTabFieldParam( lua_State* L, int nInd, const char* szField) @@ -327,6 +389,13 @@ LuaSetTabFieldParam( lua_State* L, int nInd, const char* szField) return true ; } +//---------------------------------------------------------------------------- +inline bool +LuaSetTabFieldParam( lua_State* L, int nInd, const std::string& sField) +{ + return LuaSetTabFieldParam( L, nInd, sField.c_str()) ; +} + //---------------------------------------------------------------------------- template bool @@ -341,6 +410,14 @@ LuaSetTabFieldParam( lua_State* L, int nInd, const char* szField, const T& Val) return true ; } +//---------------------------------------------------------------------------- +template +bool +LuaSetTabFieldParam( lua_State* L, int nInd, const std::string& sField, const T& Val) +{ + return LuaSetTabFieldParam( L, nInd, sField.c_str(), Val) ; +} + //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- diff --git a/EInAPI.h b/EInAPI.h index 9adb2e0..8efa082 100644 --- a/EInAPI.h +++ b/EInAPI.h @@ -74,6 +74,7 @@ EIN_EXPORT BOOL __stdcall EgtSetCurrFilePath( const wchar_t* wsFilePath) ; EIN_EXPORT BOOL __stdcall EgtGetCurrFilePath( wchar_t*& wsFilePath) ; EIN_EXPORT BOOL __stdcall EgtEnableModified( void) ; EIN_EXPORT BOOL __stdcall EgtDisableModified( void) ; +EIN_EXPORT BOOL __stdcall EgtGetEnableModified( void) ; EIN_EXPORT BOOL __stdcall EgtSetModified( void) ; EIN_EXPORT BOOL __stdcall EgtResetModified( void) ; EIN_EXPORT BOOL __stdcall EgtGetModified( void) ; @@ -541,7 +542,6 @@ EIN_EXPORT int __stdcall EgtGetNextPartInRawPart( int nPartId) ; EIN_EXPORT BOOL __stdcall EgtAddPartToRawPart( int nPartId, const double ptPos[3], int nRawId) ; EIN_EXPORT BOOL __stdcall EgtRemovePartFromRawPart( int nPartId) ; // Table & Fixtures -EIN_EXPORT BOOL __stdcall EgtExistsTable( const wchar_t* wsTable) ; EIN_EXPORT BOOL __stdcall EgtSetTable( const wchar_t* wsTable) ; EIN_EXPORT BOOL __stdcall EgtGetTableRef( int nInd, double ptPos[3]) ; EIN_EXPORT BOOL __stdcall EgtGetTableArea( int nInd, double ptMin[3], double ptMax[3]) ; @@ -606,7 +606,9 @@ EIN_EXPORT BOOL __stdcall EgtSetOperationStatus( int nId, BOOL bShow) ; EIN_EXPORT BOOL __stdcall EgtGetOperationStatus( int nId) ; EIN_EXPORT BOOL __stdcall EgtSetAllOperationsStatus( BOOL bShow) ; EIN_EXPORT BOOL __stdcall EgtChangeOperationPhase( int nId, int nNewPhase) ; +// Dispositions EIN_EXPORT int __stdcall EgtGetPhaseDisposition( int nPhase) ; +EIN_EXPORT BOOL __stdcall EgtSpecialApplyDisposition( int nId, BOOL bRecalc) ; // Machinings EIN_EXPORT int __stdcall EgtAddMachining( const wchar_t* wsName, const wchar_t* wsMachining) ; EIN_EXPORT int __stdcall EgtCreateMachining( const wchar_t* wsName, int nMchType, const wchar_t* wsTool) ; @@ -634,6 +636,11 @@ EIN_EXPORT BOOL __stdcall EgtSimSetStep( double dStep) ; EIN_EXPORT BOOL __stdcall EgtSimStop( void) ; // Generation EIN_EXPORT BOOL __stdcall EgtGenerate( const wchar_t* wsCncFile, const wchar_t* wsInfo) ; +// Machine +EIN_EXPORT int __stdcall EgtGetBaseId( const wchar_t* wsBase) ; +EIN_EXPORT int __stdcall EgtGetTableId( const wchar_t* wsTable) ; +EIN_EXPORT int __stdcall EgtGetAxisId( const wchar_t* wsAxis) ; +EIN_EXPORT int __stdcall EgtGetHeadId( const wchar_t* wsHead) ; // Machine Calc EIN_EXPORT BOOL __stdcall EgtSetCalcTool( const wchar_t* wsTool, const wchar_t* wsHead, int nExit) ; EIN_EXPORT BOOL __stdcall EgtGetCalcTipFromPositions( double dX, double dY, double dZ, double dAngA, double dAngB, diff --git a/EMkMachMgr.h b/EMkMachMgr.h index 25fcf3b..d6c62c0 100644 --- a/EMkMachMgr.h +++ b/EMkMachMgr.h @@ -83,7 +83,6 @@ class __declspec( novtable) IMachMgr virtual bool TranslatePartInRawPart( int nPartId, const Vector3d& vtMove) = 0 ; virtual bool RotatePartInRawPart( int nPartId, const Vector3d& vtAx, double dAngRotDeg) = 0 ; // Tables and Fixtures - virtual bool ExistsTable( const std::string& sTable) = 0 ; virtual bool SetTable( const std::string& sTable) = 0 ; virtual bool GetTableRef( int nInd, Point3d& ptPos) = 0 ; virtual bool GetTableArea( int nInd, BBox3d& b3Area) = 0 ; @@ -148,6 +147,7 @@ class __declspec( novtable) IMachMgr virtual int GetOperationPhase( int nId) const = 0 ; virtual std::string GetOperationName( int nId) const = 0 ; virtual int GetOperationId( const std::string& sName) const = 0 ; + virtual bool IsOperationEmpty( int nId) const = 0 ; virtual bool RemoveOperation( int nId) = 0 ; virtual bool RemoveAllPhaseOperations( int nPhase) = 0 ; virtual bool RemoveAllOperations( void) = 0 ; @@ -160,6 +160,7 @@ class __declspec( novtable) IMachMgr virtual bool ChangeOperationPhase( int nId, int nNewPhase) = 0 ; // Operations : dispositions virtual int GetPhaseDisposition( int nPhase) const = 0 ; + virtual bool DispositionSpecialApply( int nId, bool bRecalc) = 0 ; // Operations : machinings virtual int AddMachining( const std::string& sName, const std::string& sMachining) = 0 ; virtual int AddMachining( const std::string& sName, int nMchType, const std::string& sTool) = 0 ; @@ -172,6 +173,8 @@ class __declspec( novtable) IMachMgr virtual bool SetMachiningParam( int nType, const std::string& sVal) = 0 ; virtual bool SetMachiningGeometry( const SELVECTOR& vIds) = 0 ; virtual bool MachiningPreview( bool bRecalc) = 0 ; + virtual bool ExistsMachiningPreview( void) = 0 ; + virtual bool RemoveMachiningPreview( void) = 0 ; virtual bool MachiningApply( bool bRecalc) = 0 ; virtual bool GetMachiningParam( int nType, bool& bVal) const = 0 ; virtual bool GetMachiningParam( int nType, int& dVal) const = 0 ; @@ -186,6 +189,7 @@ class __declspec( novtable) IMachMgr virtual bool SimGetToolInfo( std::string& sName, double& dSpeed) = 0 ; virtual bool SimGetMoveInfo( int& nGmove, double& dFeed) = 0 ; virtual bool SimSetStep( double dStep) = 0 ; + virtual bool SimGoHome( void) = 0 ; virtual bool SimStop( void) = 0 ; // Generation virtual bool Generate( const std::string& sCncFile, const std::string& sInfo) = 0 ; @@ -203,10 +207,14 @@ class __declspec( novtable) IMachMgr virtual bool GetNearestAngleInStroke( int nId, double dAngRef, double& dAng) = 0 ; virtual bool VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) = 0 ; virtual const std::string& GetOutstrokeInfo( void) const = 0 ; - // Machine Move + // Machine + virtual int GetBaseId( const std::string& sBase) const = 0 ; + virtual int GetTableId( const std::string& sTable) const = 0 ; + virtual int GetAxisId( const std::string& sAxis) const = 0 ; + virtual int GetHeadId( const std::string& sHead) const = 0 ; virtual bool SetAxisPos( const std::string& sAxis, double dVal) = 0 ; - virtual bool GetAxisPos( const std::string& sAxis, double& dVal) = 0 ; - virtual bool GetAxisHomePos( const std::string& sAxis, double& dHomeVal) = 0 ; + virtual bool GetAxisPos( const std::string& sAxis, double& dVal) const = 0 ; + virtual bool GetAxisHomePos( const std::string& sAxis, double& dHomeVal) const = 0 ; virtual bool ResetAxisPos( const std::string& sAxis) = 0 ; virtual bool ResetAllAxesPos( void) = 0 ; virtual bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) = 0 ; diff --git a/EXeExecutor.h b/EXeExecutor.h index ccc42a4..e200a9e 100644 --- a/EXeExecutor.h +++ b/EXeExecutor.h @@ -76,6 +76,7 @@ EXE_EXPORT bool ExeSetCurrFilePath( const std::string& sFilePath) ; EXE_EXPORT bool ExeGetCurrFilePath( std::string& sFilePath) ; EXE_EXPORT bool ExeEnableModified( void) ; EXE_EXPORT bool ExeDisableModified( void) ; +EXE_EXPORT bool ExeGetEnableModified( void) ; EXE_EXPORT bool ExeSetModified( void) ; EXE_EXPORT bool ExeResetModified( void) ; EXE_EXPORT bool ExeGetModified( void) ; @@ -582,7 +583,6 @@ EXE_EXPORT bool ExeRemovePartFromRawPart( int nPartId) ; EXE_EXPORT bool ExeTranslatePartInRawPart( int nPartId, const Vector3d& vtMove) ; EXE_EXPORT bool ExeRotatePartInRawPart( int nPartId, const Vector3d& vtAx, double dAngRotDeg) ; // Table & Disposition -EXE_EXPORT bool ExeExistsTable( const std::string& sTable) ; EXE_EXPORT bool ExeSetTable( const std::string& sTable) ; EXE_EXPORT bool ExeGetTableRef( int nInd, Point3d& ptPos) ; EXE_EXPORT bool ExeGetTableArea( int nInd, BBox3d& b3Area) ; @@ -638,6 +638,7 @@ EXE_EXPORT int ExeGetOperationType( int nId) ; EXE_EXPORT int ExeGetOperationPhase( int nId) ; EXE_EXPORT bool ExeGetOperationName( int nId, std::string& sName) ; EXE_EXPORT int ExeGetOperationId( const std::string& sName) ; +EXE_EXPORT bool ExeIsOperationEmpty( int nId) ; EXE_EXPORT bool ExeRemoveOperation( int nId) ; EXE_EXPORT bool ExeRemoveAllPhaseOperations( int nPhase) ; EXE_EXPORT bool ExeRemoveAllOperations( void) ; @@ -648,7 +649,9 @@ EXE_EXPORT bool ExeSetOperationStatus( int nId, bool bShow) ; EXE_EXPORT bool ExeGetOperationStatus( int nId, bool& bShow) ; EXE_EXPORT bool ExeSetAllOperationsStatus( bool bShow) ; EXE_EXPORT bool ExeChangeOperationPhase( int nId, int nNewPhase) ; +// Dispositions EXE_EXPORT int ExeGetPhaseDisposition( int nPhase) ; +EXE_EXPORT bool ExeSpecialApplyDisposition( int nId, bool bRecalc) ; // Machinings EXE_EXPORT int ExeAddMachining( const std::string& sName, const std::string& sMachining) ; EXE_EXPORT int ExeAddMachining( const std::string& sName, int nMchType, const std::string& sTool) ; @@ -679,6 +682,11 @@ EXE_EXPORT bool ExeSimSetStep( double dStep) ; EXE_EXPORT bool ExeSimStop( void) ; // Generation EXE_EXPORT bool ExeGenerate( const std::string& sCncFile, const std::string& sInfo) ; +// Machine +EXE_EXPORT int ExeGetBaseId( const std::string& sBase) ; +EXE_EXPORT int ExeGetTableId( const std::string& sTable) ; +EXE_EXPORT int ExeGetAxisId( const std::string& sAxis) ; +EXE_EXPORT int ExeGetHeadId( const std::string& sHead) ; // Machine Calc EXE_EXPORT bool ExeSetCalcTable( const std::string& sTable) ; EXE_EXPORT bool ExeSetCalcTool( const std::string& sTool, const std::string& sHead, int nExit) ;