EgtExecutor 1.6v7 :

- introdotte prime funzioni Exe e Lua per solidi Zmap.
This commit is contained in:
Dario Sassi
2016-10-27 16:45:50 +00:00
parent 9b54f331c4
commit c935ebbf35
9 changed files with 320 additions and 0 deletions
+68
View File
@@ -0,0 +1,68 @@
//----------------------------------------------------------------------------
// EgalTech 2016-2016
//----------------------------------------------------------------------------
// File : EXE_GdbCreateVol.cpp Data : 27.10.16 Versione : 1.6v7
// Contenuto : Funzioni di creazione solidi del DB geometrico per EXE.
//
//
//
// Modifiche : 27.10.16 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "AuxTools.h"
#include "GeoTools.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkVolZmap.h"
#include "/EgtDev/Include/EgkStringUtils3d.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
//-------------------------------------------------------------------------------
int
ExeCreateVolZmap( int nParentId, const Point3d& ptIni, double dDimX, double dDimY, double dDimZ,
double dPrec, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti
Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ;
Point3d ptOnXL = GetPointLocal( pGeomDB, ptIni + X_AX, nRefType, frLoc) ;
Point3d ptOnYL = GetPointLocal( pGeomDB, ptIni + Y_AX, nRefType, frLoc) ;
// ne ricavo un riferimento intrinseco
Frame3d frBox ;
bOk = bOk && frBox.Set( ptIniL, ptOnXL, ptOnYL) ;
// creo lo Zmap nel suo riferimento intrinseco
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
bOk = bOk && ! IsNull( pVZM) ;
bOk = bOk && pVZM->CreateMap( ORIG, dDimX, dDimY, dDimZ, dPrec) ;
// lo porto nel riferimento locale
bOk = bOk && pVZM->ToGlob( frBox) ;
// inserisco lo Zmap nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pVZM)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapBox(" + IdToString( nParentId) + ",{" +
ToString( ptIni) + "}," +
ToString( dDimX) + "," +
ToString( dDimY) + "," +
ToString( dDimZ) + "," +
ToString( dPrec) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
+83
View File
@@ -0,0 +1,83 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2016
//----------------------------------------------------------------------------
// File : EXE_ModifyVol.cpp Data : 27.10.16 Versione : 1.6v7
// Contenuto : Funzioni di modifica dei solidi per EXE.
//
//
//
// Modifiche : 27.10.16 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "AuxTools.h"
#include "GeoTools.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkVolZmap.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
using namespace std ;
//----------------------------------------------------------------------------
bool
ExeVolZmapSetStdTool( int nId, const string& sToolName, double dLen, double dDiam, double dCornR)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap e assegno i dati dell'utensile
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pVZM != nullptr && pVZM->SetStdTool( sToolName, dLen, 0.5 * dDiam, dCornR)) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapSetStdTool(" + IdToString( nId) + "," +
sToolName + "," +
ToString( dLen) + "," +
ToString( dDiam) + "," +
ToString( dCornR) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapMillingStep( int nId, const Point3d& ptPs, const Vector3d& vtDs,
const Point3d& ptPe, const Vector3d& vtDe, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero il riferimento locale
Frame3d frLoc ;
bool bOk = pGeomDB->GetGlobFrame( nId, frLoc) ;
// porto in locale i punti e i vettori
Point3d ptPsL = GetPointLocal( pGeomDB, ptPs, nRefType, frLoc) ;
Vector3d vtDsL = GetVectorLocal( pGeomDB, vtDs, nRefType, frLoc) ;
Point3d ptPeL = GetPointLocal( pGeomDB, ptPe, nRefType, frLoc) ;
Vector3d vtDeL = GetVectorLocal( pGeomDB, vtDe, nRefType, frLoc) ;
// recupero lo Zmap e eseguo movimento di fresatura con l'utensile già associato
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pVZM != nullptr && pVZM->MillingStep( ptPsL, vtDsL, ptPeL, vtDeL)) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapMillingStep(" + IdToString( nId) + ",{" +
ToString( ptPs) + "},{" +
ToString( vtDs) + "},{" +
ToString( ptPe) + "},{" +
ToString( vtDe) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
BIN
View File
Binary file not shown.
+4
View File
@@ -230,6 +230,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="stdafx.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="EXE_GdbCreateVol.cpp" />
<ClCompile Include="EXE_GdbModifyVol.cpp" />
<ClCompile Include="EXE_NstMachining.cpp" />
<ClCompile Include="EXE_NstPartNesting.cpp" />
<ClCompile Include="EXE_GdbCreateCurve.cpp" />
@@ -267,10 +269,12 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="LUA_Base.cpp" />
<ClCompile Include="LUA_GdbCreateCurve.cpp" />
<ClCompile Include="LUA_GdbCreateSurf.cpp" />
<ClCompile Include="LUA_GdbCreateVol.cpp" />
<ClCompile Include="LUA_GdbModifyCurve.cpp" />
<ClCompile Include="LUA_Exchange.cpp" />
<ClCompile Include="LUA_GdbModify.cpp" />
<ClCompile Include="LUA_GdbModifySurf.cpp" />
<ClCompile Include="LUA_GdbModifyVol.cpp" />
<ClCompile Include="LUA_GdbObjAttribs.cpp" />
<ClCompile Include="LUA_GdbObjects.cpp" />
<ClCompile Include="LUA_GdbObjSelection.cpp" />
+12
View File
@@ -278,6 +278,18 @@
<ClCompile Include="EXE_NstMachining.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="EXE_GdbCreateVol.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_GdbCreateVol.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="EXE_GdbModifyVol.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_GdbModifyVol.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="EgtExecutor.rc">
+6
View File
@@ -36,6 +36,9 @@ bool LuaInstallGdbCreateCurve( LuaMgr& luaMgr) ;
//-------------------------- GdbCreateSurf -----------------------------------
bool LuaInstallGdbCreateSurf( LuaMgr& luaMgr) ;
//-------------------------- GdbCreateVol ------------------------------------
bool LuaInstallGdbCreateVol( LuaMgr& luaMgr) ;
//-------------------------- GdbModify ---------------------------------------
bool LuaInstallGdbModify( LuaMgr& luaMgr) ;
@@ -45,6 +48,9 @@ bool LuaInstallGdbModifyCurve( LuaMgr& luaMgr) ;
//-------------------------- GdbModifySurf -----------------------------------
bool LuaInstallGdbModifySurf( LuaMgr& luaMgr) ;
//-------------------------- GdbModifyVol -----------------------------------
bool LuaInstallGdbModifyVol( LuaMgr& luaMgr) ;
//-------------------------- GdbPartLayer ------------------------------------
bool LuaInstallGdbPartLayer( LuaMgr& luaMgr) ;
+8
View File
@@ -54,6 +54,10 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbCreateSurf (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbCreateVol( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbCreateVol (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbModify( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbModify (" __FUNCTION__ ")")
return false ;
@@ -66,6 +70,10 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbModifySurf (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbModifyVol( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbModifyVol (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbPartLayer( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbPartLayer (" __FUNCTION__ ")")
return false ;
+60
View File
@@ -0,0 +1,60 @@
//----------------------------------------------------------------------------
// EgalTech 2016-2016
//----------------------------------------------------------------------------
// File : LUA_GdbCreateVol.cpp Data : 27.10.16 Versione : 1.6vt
// Contenuto : Funzioni di creazione solidi per LUA.
//
//
//
// Modifiche : 27.10.16 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaCreateVolZmapBox( lua_State* L)
{
// 5 o 6 parametri : ParentId, PtIni, dDimX, dDimY, dDimZ, dPrec [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptIni ;
LuaCheckParam( L, 2, ptIni)
double dDimX ;
LuaCheckParam( L, 3, dDimX)
double dDimY ;
LuaCheckParam( L, 4, dDimY)
double dDimZ ;
LuaCheckParam( L, 5, dDimZ)
double dPrec ;
LuaCheckParam( L, 6, dPrec)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ;
// creo VZM parallelepipedo
int nId = ExeCreateVolZmap( nParentId, ptIni, dDimX, dDimY, dDimZ, dPrec, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbCreateVol( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapBox", LuaCreateVolZmapBox) ;
return bOk ;
}
+79
View File
@@ -0,0 +1,79 @@
//----------------------------------------------------------------------------
// EgalTech 2016-2016
//----------------------------------------------------------------------------
// File : LUA_GdbModifyVol.cpp Data : 27.10.16 Versione : 1.6v7
// Contenuto : Funzioni di modifica dei solidi per LUA.
//
//
//
// Modifiche : 27.10.16 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
using namespace std ;
//----------------------------------------------------------------------------
static int
LuaVolZmapSetStdTool( lua_State* L)
{
// 5 parametri : Id, sToolName, dLen, dDiam, dCornR
int nId ;
LuaCheckParam( L, 1, nId)
string sToolName ;
LuaCheckParam( L, 2, sToolName)
double dLen ;
LuaCheckParam( L, 3, dLen)
double dDiam ;
LuaCheckParam( L, 4, dDiam)
double dCornR ;
LuaCheckParam( L, 5, dCornR)
LuaClearStack( L) ;
// imposto utensile standard a Zmap indicato
bool bOk = ExeVolZmapSetStdTool( nId, sToolName, dLen, dDiam, dCornR) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaVolZmapMillingStep( lua_State* L)
{
// 5 o 6 parametri : nId, ptPs, vtDs, ptPe, vtDe [, nRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptPs ;
LuaCheckParam( L, 2, ptPs)
Vector3d vtDs ;
LuaCheckParam( L, 3, vtDs)
Point3d ptPe ;
LuaCheckParam( L, 4, ptPe)
Vector3d vtDe ;
LuaCheckParam( L, 5, vtDe)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 6, nRefType) ;
LuaClearStack( L) ;
// eseguo movimento di fresatura con l'utensile già associato a Zmap
bool bOk = ExeVolZmapMillingStep( nId, ptPs, vtDs, ptPe, vtDe, nRefType) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbModifyVol( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapMillingStep", LuaVolZmapMillingStep) ;
return bOk ;
}