Compare commits

...

6 Commits

Author SHA1 Message Date
Riccardo Elitropi 6b5dc3fc30 Merge commit '9e1f151bbc90bc257749d8df7cbabefa679163e1' into VmillAdditivo 2024-04-30 08:38:44 +02:00
Dario Sassi 9e1f151bbc EgtExecutor :
- adattamenti per Zmap con virtual additive.
2024-04-26 11:33:16 +02:00
Dario Sassi ed6c8fb11d Merge commit '22774303af440f13f3db243c23798652b2fa7cc4' 2024-04-22 19:07:16 +02:00
Dario Sassi 9ef30272b4 EgtExecutor :
- aggiunta funzione Exe/Lua GetExitId.
2024-04-22 15:30:00 +02:00
Riccardo Elitropi 22774303af EgtExecutor :
- aggiunte funzioni per Vmill additivo.
2024-04-22 13:23:59 +02:00
Dario Sassi a3c905c33a EgtExecutor :
- adattamenti per Surf Bezier
- aggiunta funzione Exe/Lua CreateArc2PR.
2024-04-19 17:51:00 +02:00
9 changed files with 241 additions and 13 deletions
+39
View File
@@ -1088,6 +1088,45 @@ ExeCreateArc3P( int nParentId, const Point3d& ptP1,
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateArc2PR( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
double dRad, bool bCCW, 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, il versore normale e quelloe estrusione
Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ;
Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ;
Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// creo l'arco
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
bOk = bOk && ( ! IsNull( pCrvArc) &&
pCrvArc->Set2PNRS( ptStartL, ptEndL, vtNormL, dRad, bCCW)) ;
// assegno il versore estrusione
bOk = bOk && pCrvArc->SetExtrusion( vtExtrL) ;
// inserisco l'arco nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtArc2PR(" + IdToString( nParentId) + ",{" +
ToString( ptStart) + "},{" +
ToString( ptEnd) + "}," +
ToString( dRad) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateArc2PB( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
-5
View File
@@ -1668,8 +1668,6 @@ ExeCreateSurfBezier( int nParentId, int nDegU, int nDegV, int nSpanU, int nSpanV
if ( ! pSurfBez->SetControlPoint( i, ptCtrl))
bOk = false ;
}
// calcolo eventuali poli
pSurfBez->CalcPoles() ;
// se superficie nulla (ovvero ridotta a punto), errore
bOk = bOk && ! pSurfBez->IsAPoint() ;
// inserisco la superficie nel DB
@@ -1722,8 +1720,6 @@ ExeCreateSurfBezierRational( int nParentId, int nDegU, int nDegV, int nSpanU, in
if ( ! pSurfBez->SetControlPoint( i, ptCtrl, vPntW[i].second))
bOk = false ;
}
// calcolo eventuali poli
pSurfBez->CalcPoles() ;
// se superficie nulla (ovvero ridotta a punto), errore
bOk = bOk && ! pSurfBez->IsAPoint() ;
// inserisco la superficie nel DB
@@ -1899,7 +1895,6 @@ ExeCreateBezierSphere( int nParentId, const Point3d& ptCenter, double dR, int nR
Point3d ptCenterLoc = GetPointLocal( pGeomDB, ptCenter, nRefType, frLoc) ;
// Creo la superficie
PtrOwner<ISurfBezier> pSurfBez( CreateBezierSphere( ptCenterLoc, dR)) ;
pSurfBez->CalcPoles() ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSurfBez)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
+47 -4
View File
@@ -1,4 +1,4 @@
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// EgalTech 2016-2016
//----------------------------------------------------------------------------
// File : EXE_GdbCreateVol.cpp Data : 27.10.16 Versione : 1.6v7
@@ -64,7 +64,50 @@ ExeCreateVolZmap( int nParentId, const Point3d& ptIni, double dDimX, double dDim
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int ExeCreateVolZmapEmpty( int nParentId, const Point3d& ptIni, double dDimX, double dDimY, double dDimZ,
double dPrec, bool bTriDex, 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->CreateEmpty( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex) ;
// 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 = "EgtVolZmapEmpty(" + IdToString( nParentId) + ",{" +
ToString( ptIni) + "}," +
ToString( dDimX) + "," +
ToString( dDimY) + "," +
ToString( dDimZ) + "," +
ToString( dPrec) + "," +
( bTriDex ? "true" : "false") + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -103,7 +146,7 @@ ExeCreateVolZmapByRegionExtrusion( int nParentId, int nSfrId, double dDimZ, doub
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -141,6 +184,6 @@ ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDe
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
+28
View File
@@ -337,6 +337,34 @@ ExeVolZmapSetChiselTool( const INTVECTOR& vIds, const string& sToolName,
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapSetAdditiveTool( const INTVECTOR& vIds, const string& sToolName,
double dLen, double dDiam, double dCornR, int nFlag, bool bFirst)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero gli Zmap e assegno i dati dell'utensile
bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( bOk && pVZM != nullptr && pVZM->SetAdditiveTool( sToolName, dLen, dDiam / 2, dCornR, nFlag, bFirst)) ;
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapSetAdditiveTool({" + IdListToString( vIds) + "}," +
sToolName + "," +
ToString( dLen) + "," +
ToString( dDiam) + "," +
ToString( dCornR) + "," +
ToString( nFlag) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapResetTools( const INTVECTOR& vIds)
+10
View File
@@ -3421,6 +3421,16 @@ ExeGetHeadExitCount( const string& sHead)
return pMachMgr->GetHeadExitCount( sHead) ;
}
//-----------------------------------------------------------------------------
int
ExeGetExitId( const string& sHead, int nExit)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// restituisco identificativo dell'uscita della testa indicata nella macchina della macchinata corrente
return pMachMgr->GetExitId( sHead, nExit) ;
}
//-----------------------------------------------------------------------------
int
ExeGetTcPosId( const string& sTcPos)
+29
View File
@@ -425,6 +425,34 @@ LuaCreateArc3P( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateArc2PR( lua_State* L)
{
// 5 o 6 parametri : ParentId, PtStart, PtEnd, dRad, bCCW [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptStart ;
LuaCheckParam( L, 2, ptStart)
Point3d ptEnd ;
LuaCheckParam( L, 3, ptEnd)
double dRad ;
LuaCheckParam( L, 4, dRad)
bool bCCW ;
LuaCheckParam( L, 5, bCCW) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 6, nRefType) ;
LuaClearStack( L) ;
// creo l'arco
int nId = ExeCreateArc2PR( nParentId, ptStart, ptEnd, dRad, bCCW, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateArc2PB( lua_State* L)
@@ -1083,6 +1111,7 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2P", LuaCreateArcC2P) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2PEx", LuaCreateArcC2PEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc3P", LuaCreateArc3P) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PR", LuaCreateArc2PR) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PB", LuaCreateArc2PB) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PD", LuaCreateArc2PD) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PDEx", LuaCreateArc2PDEx) ;
+37
View File
@@ -54,6 +54,42 @@ LuaCreateVolZmapBox( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateVolZmapEmpty( lua_State* L)
{
// 6 o 7 o 8 parametri : ParentId, PtIni, dDimX, dDimY, dDimZ, dPrec [, bTriDex] [, 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)
bool bTriDex = true ;
int nRefType = RTY_DEFAULT ;
if ( ! LuaGetParam( L, 7, bTriDex))
LuaGetParam( L, 7, nRefType) ;
else
LuaGetParam( L, 8, nRefType) ;
LuaClearStack( L) ;
// creo VZM parallelepipedo
int nId = ExeCreateVolZmapEmpty( nParentId, ptIni, dDimX, dDimY, dDimZ, dPrec, bTriDex, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateVolZmapByRegionExtrusion( lua_State* L)
@@ -110,6 +146,7 @@ LuaInstallGdbCreateVol( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapBox", LuaCreateVolZmapBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapEmpty", LuaCreateVolZmapEmpty) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapByRegionExtrusion", LuaCreateVolZmapByRegionExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapFromSurfTm", LuaCreateVolZmapFromSurfTm) ;
return bOk ;
+30 -4
View File
@@ -152,7 +152,7 @@ LuaVolZmapSetAdvTool( lua_State* L)
static int
LuaVolZmapSetSawTool( lua_State* L)
{
// 7 o 8 parametri : vIds, sToolName, dLen, dDiam, dThick, dStemDiam, dCornR, nFlag
// 7 o 8 parametri : vIds, sToolName, dLen, dDiam, dThick, dStemDiam, dCornR [, nFlag]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
@@ -181,7 +181,7 @@ LuaVolZmapSetSawTool( lua_State* L)
static int
LuaVolZmapSetGenTool( lua_State* L)
{
// 3 o 4 parametri : vIds, sToolName, ToolSectId, nFlag
// 3 o 4 parametri : vIds, sToolName, ToolSectId [, nFlag]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
@@ -202,7 +202,7 @@ LuaVolZmapSetGenTool( lua_State* L)
static int
LuaVolZmapSetMortiserTool( lua_State* L)
{
// 6 o 7 parametri : Id, sToolName, dLen, dWidth, dThick, dCornR, nFlag
// 6 o 7 parametri : Id, sToolName, dLen, dWidth, dThick, dCornR [, nFlag]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
@@ -229,7 +229,7 @@ LuaVolZmapSetMortiserTool( lua_State* L)
static int
LuaVolZmapSetChiselTool( lua_State* L)
{
// 5 o 6 parametri : vIds, sToolName, dLen, dWidth, dThick, nFlag
// 5 o 6 parametri : vIds, sToolName, dLen, dWidth, dThick [, nFlag]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
@@ -250,6 +250,31 @@ LuaVolZmapSetChiselTool( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaVolZmapSetAdditiveTool( lua_State* L)
{
// 5 o 6 parametri : vIds, sToolName, dLen, dDiam, dCornR [, nFlag]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
LuaCheckParam( L, 2, sToolName)
double dLen ;
LuaCheckParam( L, 3, dLen)
double dDiam ;
LuaCheckParam( L, 4, dDiam)
double dCornR ;
LuaCheckParam( L, 5, dCornR)
int nFlag = 1 ;
LuaGetParam( L, 6, nFlag) ;
LuaClearStack( L) ;
// imposto utensile additivo a Zmap indicati
bool bOk = ExeVolZmapSetAdditiveTool( vIds, sToolName, dLen, dDiam, dCornR, nFlag, true) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaVolZmapResetTool( lua_State* L)
@@ -375,6 +400,7 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetGenTool", LuaVolZmapSetGenTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetMortiserTool", LuaVolZmapSetMortiserTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetChiselTool", LuaVolZmapSetChiselTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdditiveTool", LuaVolZmapSetAdditiveTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapResetTool", LuaVolZmapResetTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetToolOutline", LuaVolZmapGetToolOutline) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapMillingStep", LuaVolZmapMillingStep) ;
+21
View File
@@ -3737,6 +3737,26 @@ LuaGetHeadExitCount( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetExitId( lua_State* L)
{
// 2 parametri : sHead, nExit
string sHead ;
LuaCheckParam( L, 1, sHead)
int nExit ;
LuaCheckParam( L, 2, nExit)
LuaClearStack( L) ;
// recupero l'identificativo dell'Uscita della Testa indicata della macchina
int nId = ExeGetExitId( sHead, nExit) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetTcPosId( lua_State* L)
@@ -4299,6 +4319,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisId", LuaGetAxisId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetHeadId", LuaGetHeadId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetHeadExitCount", LuaGetHeadExitCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetExitId", LuaGetExitId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTcPosId", LuaGetTcPosId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisToken", LuaGetAxisToken) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisType", LuaGetAxisType) ;