Compare commits

...

81 Commits

Author SHA1 Message Date
Daniele Bariletti ee55f97b3a EgtExecutor :
- aggiunta funzione per la creazione della surf bezier ruled guided.
2025-11-12 09:40:48 +01:00
Dario Sassi d41edd344a EgtExecutor :
- aggiustamenti.
2025-11-05 11:29:21 +01:00
Riccardo Elitropi 5a998a5d13 EgtExecutor 2.7k2 :
- aggiunta funzione per il calcolo della Curvatura in un vertice per una Superficie TriMesh.
2025-11-04 15:52:48 +01:00
Dario Sassi 14f471bbf9 EgtExecutor :
- aggunta funzione lua EgtInitBeamMgr.
2025-11-03 19:58:00 +01:00
Dario Sassi 6ce68192a2 EgtExecutor :
- aggiunte funzioni exe e lua Base64Encode e Base64Decode.
2025-11-03 18:05:42 +01:00
Dario Sassi 8010d19c06 EgtExecutor :
- aggiunta funzione exe/lua GetImageEx (per fare bitmap di vista progetto in contesti senza Scene).
2025-11-03 15:17:04 +01:00
Dario Sassi 2b3574cefc EgtExecutor 2.7k1 :
- ricompilazione per passaggio a C++ 20
- modifiche a funzioni exe/lua SetLevel e SetMode per ricevere un vettore di Id.
2025-11-01 17:37:44 +01:00
Riccardo Elitropi 8fcf079126 EgtExecutor 2.7j4 :
- in Redis aggiunta gestione di connessioni multiple.
2025-10-31 10:32:38 +01:00
SaraP ffcd014ec3 EgtExecutor :
- correzioni in ExeSpiralizeCurveAlongGuide.
2025-10-30 14:54:07 +01:00
Dario Sassi 8b23085328 EgtExecutor :
- funzione exe/lua SaveObjToFile ora accetta un vettore di indici
- eliminata la forma semplicificata della funzione ExeSaveMachGroupToFile.
2025-10-29 19:31:23 +01:00
Daniele Bariletti 8901525ac8 EgtExecutor :
- aggiunta funzione per calcolare la distanza tra punto e superficie di Bezier.
2025-10-29 15:09:12 +01:00
Dario Sassi 4247a6893f EgtExecutor :
- a funzione exe/lua SurfTmGetFacetOutlineInfo aggiunto parametro vettore di punti iniziali.
2025-10-28 16:19:18 +01:00
Dario Sassi 36572eb1e4 EgtExecutor 2.7j3 :
- alla funzione exe/lua SaveMachGroupToFile aggiunto parametro opzionale per indicare oggetti aggiuntivi.
2025-10-28 15:20:46 +01:00
Daniele Bariletti 78ad752545 EgtExecutor :
- aggiornamento funzioni per restituire loop di una surf bezier.
2025-10-14 16:29:59 +02:00
Dario Sassi 0a5fd7262b EgtExecutor :
- aggiunte funzioni exe e lua BeamCalcAllSolids e BeamShowAllSolids.
2025-10-13 08:49:01 +02:00
Dario Sassi e450aea667 EgtExecutor 2.7j2 :
- ricompilazione.
2025-10-11 10:07:04 +02:00
Dario Sassi a85ef8fe2d Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2025-10-11 10:05:01 +02:00
Dario Sassi f2fa332cc1 EgtExecutor 2.7j2 :
- modifiche per nuova gestione assemblaggi da BTL.
2025-10-11 10:03:53 +02:00
Daniele Bariletti bb8ef04733 EgtExecutor :
- aggiunto un tipo di interpolazione con le bezier.
2025-10-10 12:13:02 +02:00
Riccardo Elitropi 4c7de36ba0 EgtExecutor :
- Correzione e miglioramento della funzione per uniformare un VolZMap.
2025-10-09 09:38:55 +02:00
Dario Sassi 16930e4c4e EgtExecutor :
- aggiunte funzioni exe e lua CopyEx e CopyGlobEx.
2025-10-08 18:32:36 +02:00
Dario Sassi 248aa6f948 EgtExecutor 2.7j1 :
- ricompilazione con cambio versione.
2025-10-08 08:36:34 +02:00
Dario Sassi ab5223c4f5 EgtExecutor :
- miglioria in inperpolazione curve per pezzi piani Stone.
2025-10-02 12:52:01 +02:00
SaraP a206a58ffe EgtExecutor 2.7i6 :
- aggiunte funzioni Exe e Lua ModifyArcAngCenter.
2025-10-02 11:17:35 +02:00
Riccardo Elitropi cd5a82324b EgtExecutor :
- in Redis aggiunta autenticazione con utente e password per modalità sincrona e asincrona.
2025-10-01 13:32:54 +02:00
Dario Sassi 0ce7384fcc EgtExecutor 2.7i5 :
- ricompilazione con cambio versione.
2025-09-30 19:55:54 +02:00
Riccardo Elitropi 85af19455b EgtExecutor :
- in Redis, piccola miglioria per evitare saturazione CPU
2025-09-30 11:45:48 +02:00
Riccardo Elitropi b1f606e821 EgtExecutor :
- in redis migliorato ciclo degli eventi e aggiunte funzioni per collegamento asincrono per nodo sentinalla e autenticazione (test).
2025-09-30 11:29:39 +02:00
Riccardo Elitropi 55aca40285 EgtExecutor :
- in hiredis aggiunta gestione nodi sentinella e Auth per connessione sincrona.
2025-09-26 15:29:04 +02:00
Riccardo Elitropi cc3aab12ec EgtExecutor :
- in hiredis aggiunto sleep nel thread degli eventi per non saturare la CPU.
2025-09-26 14:52:46 +02:00
Riccardo Elitropi 592056897b EgtExecutor :
- aggiunta funzione per ricavare i parametri da stringa di connessione per hiredis.
2025-09-26 12:00:59 +02:00
Daniele Bariletti dd423355da EgtExecutor :
- aggiornamento parametri per conversione a bezier.
2025-09-26 10:43:53 +02:00
Dario Sassi a4de699814 EgtExecutor :
- sistemazione nomi delle funzioni asincrone di Redis.
2025-09-25 16:48:28 +02:00
Riccardo Elitropi 32f18ca9f7 EgtExecutor :
- aggiunte funzioni hiredis.
2025-09-24 16:16:35 +02:00
Dario Sassi 98bc4fa40c EgtExecutor 2.7i4 :
- aumentata lunghezza massima di dropdown di combobox di EgtDialogBox di lua.
2025-09-23 19:14:20 +02:00
Dario Sassi bbe59a3d90 EgtExecutor :
- aggiunto parametro opzionale dExtraBox a funzione ExeCreateVolZmapFromSurfTm ed equivalente lua EgtVolZmapFromSurfTm.
2025-09-19 11:14:40 +02:00
Daniele Bariletti 3d3098ed0b EgtExecutor :
- aggiunta funzione per creare il loop di un triangolo di una trimesh.
2025-09-17 11:29:39 +02:00
Dario Sassi 6c762b1b8e EgtExecutor :
- tolto parametro nStat non usato dalle funzioni ExeGetCalcPositions.
2025-09-14 23:02:40 +02:00
Riccardo Elitropi e8e8dbbf8d EgtExecutor :
- Aggiunta funzione per Offset Fillet per VolZMap.
2025-09-12 17:02:46 +02:00
SaraP 4a98a0a25e EgtExecutor 2.7i3 :
- aggiunte funzioni Exe e Lua per calcolo shear sequence nei nesting a ghigliottina.
2025-09-12 10:27:47 +02:00
Dario Sassi 04d3af8d62 EgtExecutor :
- ora ExeSetFont se riceve sNfeFontDir vuoto imposta solo il font di default
- aggiunte funzioni lua EgtSetDefaultFont e EgtGetDefaultFont.
2025-09-11 15:23:40 +02:00
Dario Sassi 24d355f08a EgtExecutor 2.7i2 :
- aggiunta funzione Exe/lua GetRobotAngles.
2025-09-10 08:53:22 +02:00
SaraP c736496b6a EgtExecutor :
- in ExeSpiralizeCurveAlongGuide aggiunta gestione per associare gli spigoli.
2025-09-08 17:33:54 +02:00
Dario Sassi 953c9f956e EgtExecutor :
- alla funzione lua EgtPause aggiunto un secondo parametro opzionale per forzarne l'esecuzione in assenza di UI (user interface).
2025-09-05 19:37:32 +02:00
Dario Sassi 77bded7c68 EgtExecutor 2.7i1 :
- ricompilazione con cambio versione.
2025-09-04 19:49:27 +02:00
Dario Sassi cc75866f3e EgtExecutor :
- aggiunte funzioni ExeSetShowSurfBezierTol e ExeGetShowSurfBezierTol.
2025-08-24 19:14:39 +02:00
Dario Sassi b02a00ef6b EgtExecutor 2.7h1 :
- se si cambia il modo di visualizzare insiemi di triangoli con ExeSetShowTriaAdv si invalidano tutti gli oggetti grafici.
2025-08-22 11:51:00 +02:00
Dario Sassi 8d7fdeb0c2 EgtExecutor 2.7g3 :
- le funzioni lua EgtCurveCompoGetTempProp e EgtCurveCompoGetTempParam ora accettano l'indice del dato richiesto (0 o 1).
2025-07-28 08:41:57 +02:00
Dario Sassi 54c761d722 EgtExecutor 2.7g2 :
- correzioni e modifiche a ExeCreateSurfBzByExtrusion.
2025-07-22 08:31:52 +02:00
Dario Sassi 901d6f7107 EgtExecutor :
- ora ModifyCurveStartPoint e ModifyCurveEndPoint quando necessario trasformano archi in rette.
2025-07-18 10:39:55 +02:00
Riccardo Elitropi 0f039b809b EgtExecutor :
- modifica parametri per CalcPocketing in ExePocketing.
2025-07-14 10:15:58 +02:00
Dario Sassi c36ce0a26f EgtExecutor :
- prime sistemazioni per offset superfici trimesh tramite Zmap
- eliminate funzioni exe/lua CreateVolZmapFromSurfTmOffset e CreateVolZmapFromSurfTmThickeningOffset.
2025-07-07 14:59:59 +02:00
Riccardo Elitropi 92a6b54666 EgtExecutor :
- aggiunte funzioni per calcolo di Zmap e TriMesh di Offset Fillet Thickening.
2025-07-04 13:00:31 +02:00
Dario Sassi af170b7597 EgtExecutor 2.7g1 :
- ricompilazione con cambio versione.
2025-07-02 19:50:07 +02:00
Riccardo Elitropi 9c5f48be88 EgtExecutor :
- ricollocazione funzioni di Offset per superfici TriMesh chiuse.
2025-06-16 13:17:31 +02:00
Riccardo Elitropi 362c845ed3 EgtExecutor 2.7f2 :
- Aggiunte funzioni per Offset di SurfTriMesh chiuse
- Migliorata la creazione di una TriMesh a partire da uno ZMap (con SaraP).
2025-06-16 11:37:23 +02:00
Dario Sassi 092896750c EgtExecutor :
- aggiunta funzione e xe e lua SimEnableToolTipTrace.
2025-06-08 19:13:35 +02:00
Dario Sassi 3ce5ce7a6b EgtExecutor 2.7f1 :
- funzioni exe ExeEndPoint e lua EgtEP gestiscono anche entità geometrica punto.
2025-06-06 16:14:28 +02:00
Dario Sassi bc99212f79 EgtExecutor :
- anche a exe/lua AddCurveCompoArc2P aggiunta possibilità di partire da una entità GeoPoint3d per trasformarla in composita con un arco.
2025-06-01 10:04:33 +02:00
Dario Sassi 7279684119 EgtExecutor :
- a exe/lua AddCurveCompoLine aggiunta possibilità di partire da una entità GeoPoint3d per trasformarla in composita con un segmento di retta.
2025-06-01 09:09:40 +02:00
Dario Sassi 142091b113 EgtExecutor :
- funzioni exe e lua CreateCurveBezierForm rinominate CreateCurveBezierFromCurve.
2025-05-31 11:57:52 +02:00
Dario Sassi 553e2e980d EgtExecutor 2.7e3 :
- nella funzione lua EgtGetCalcTipFromPositions riso opzionale anche il parametro bottom
2025-05-30 17:23:19 +02:00
Riccardo Elitropi c9111ba2ff EgtExecutor :
- modifica parametri per CalcPocketing in ExePocketing.
2025-05-30 11:47:44 +02:00
Riccardo Elitropi c9f3051cd3 EgtExecutor :
- Modifica parametri in CalcPocketing per ExePocketing.
2025-05-15 16:21:25 +02:00
Dario Sassi fc8ee49c11 EgtExecutor 2.7e2 :
- modifiche per gestione lavorazioni con percorsi utensile vuoti.
2025-05-12 09:48:27 +02:00
Riccardo Elitropi 028e4af506 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2025-05-09 16:14:01 +02:00
Riccardo Elitropi a3e7d7e372 EgtExecutor :
- Rimozione parametro in eccesso in ModifyRawPart.
2025-05-09 16:13:58 +02:00
Dario Sassi ab9eb54224 EgtExecutor 2.7e1 :
- ricompilazione con cambio versione.
2025-05-07 20:07:42 +02:00
Dario Sassi dbc2365a68 EgtExecutor :
- sistemazioni per proiezione curve su superfici
- semplificazione parametri di alcune funzioni MachOpt.
2025-04-23 12:19:21 +02:00
Dario Sassi 025af8a9aa Merge remote-tracking branch 'origin/master' 2025-04-23 10:59:52 +02:00
Riccardo Elitropi 2c1d4ee259 EgtExecutor :
- Aggiunte funzioni Lua per ottimizzazione ordine delle lavorazioni.
2025-04-23 10:10:38 +02:00
Dario Sassi cfedb7de7d EgtExecutor 2.7d3 :
- ricompilazione con cambio versione.
2025-04-21 11:19:17 +02:00
Dario Sassi 3a31abedce EgtExecutor :
- miglioria in ExeSetBtlAuxDir per evitare errori successivi nell'interprete lua per le feature Variant.
2025-04-16 15:58:14 +02:00
Dario Sassi 1901133b00 EgtExecutor 2.7d2 :
- ora la funzione Exe/Lua Generate se non è noto il nome del partprogram va a prendere l'estensione dall'ini di macchina (come EgtCAM5, Icarus e OmagCUT).
2025-04-15 19:42:23 +02:00
Dario Sassi 0f48db648a EgtExecutor :
- tolto include inutile.
2025-04-08 13:08:20 +02:00
Dario Sassi 6d02a2e6cf EgtExecutor 2.7d1 :
- ricompilazione con cambio versione.
2025-04-07 11:54:59 +02:00
Dario Sassi 9be9b80b8e EgtExecutor :
- al caricamento immagine per texture se non trovata si prova anche nel direttorio dell'eventuale macchina corrente.
2025-03-31 17:26:09 +02:00
Dario Sassi 55e34f9297 EgtExecutor :
- aggiunta funzione exe e lua CreateSurfTmByPolygonWithHoles.
2025-03-28 20:21:16 +01:00
Dario Sassi 784e53f580 EgtExecutor :
- aggiunta funzione exe e lua CreateSurfTmByPolygon.
2025-03-27 19:19:33 +01:00
Daniele Bariletti b0f819dc69 - piccola correzione. 2025-03-27 15:54:43 +01:00
Dario Sassi 034635ae1d EgtExecutor :
- aggiunte funzioni exe e lua CreateSurfTmPyramidFrustum e CreateSurfTmConeFrustum
- adattata funzione ExeCreateSurfTmPyramid a modifiche di GeomKernel per avere funzionamento da esterno inalterato
- piccole sistemazioni.
2025-03-27 15:30:27 +01:00
58 changed files with 4388 additions and 635 deletions
+3
View File
@@ -44,3 +44,6 @@ bool ExeInsertDuplo( int nInsGrp) ;
//----------------------------------------------------------------------------
bool ExeCreateMutex( const std::string& sMutexName) ;
bool ExeReleaseMutex( void) ;
//----------------------------------------------------------------------------
bool ExeSetModified( int nCtx) ;
+66
View File
@@ -0,0 +1,66 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : EXE_Base64.cpp Data : 03.11.25 Versione : 2.7k1
// Contenuto : Funzioni per codificare/decodificare in Base64.
//
//
//
// Modifiche : 03.11.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtBase64.h"
#include <fstream>
using namespace std ;
//----------------------------------------------------------------------------
bool
ExeBase64Encode( const string& sFile, string& sB64Dest)
{
// apro il file in modo binario
ifstream InFile( stringtoW( sFile), ios::in | ios::binary, _SH_DENYWR) ;
if ( InFile.fail()) {
if ( InFile.is_open())
InFile.close() ;
return false ;
}
// leggo il file
string sSou( istreambuf_iterator<char>( InFile), {}) ;
// lo chiudo
if ( InFile.is_open())
InFile.close() ;
// converto in Base64
return B64Encode( sSou, sB64Dest) ;
}
//----------------------------------------------------------------------------
bool
ExeBase64Decode( const string& sB64Sou, const string& sFile)
{
// converto da Base64
string sDest ;
if ( ! B64Decode( sB64Sou, sDest))
return false ;
// apro il file in modo binario
ofstream OutFile( stringtoW( sFile), ios::out | ios::binary, _SH_DENYWR) ;
if ( ! OutFile.good()) {
if ( OutFile.is_open())
OutFile.close() ;
return false ;
}
// scrivo sul file
OutFile.write( sDest.data(), sDest.size()) ;
// lo chiudo
if ( OutFile.is_open())
OutFile.close() ;
return true ;
}
+42 -4
View File
@@ -216,6 +216,44 @@ ExeBeamEnableProcess( int nGeomId, bool bEnable, bool bUpdate)
return pBeamMgr->EnableProcess( nGeomId, bEnable, bUpdate) ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamCalcAllSolids( bool bShow, bool bRecalc)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// disabilito possibilità di alterare il flag di modifica
bool bOldEnabModif = ExeGetEnableModified() ;
if ( bOldEnabModif)
ExeDisableModified() ;
// calcolo i solidi di tutte le travi
bool bOk = pBeamMgr->CalcAllSolids( bShow, bRecalc, ExeProcessEvents) ;
// ripristino possibilità di alterare il flag di modifica
if ( bOldEnabModif)
ExeEnableModified() ;
// risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamShowAllSolids( bool bShow)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// disabilito possibilità di alterare il flag di modifica
bool bOldEnabModif = ExeGetEnableModified() ;
if ( bOldEnabModif)
ExeDisableModified() ;
// aggiorno stato di visualizzazione dei solidi di tutte le travi
bool bOk = pBeamMgr->ShowAllSolids( bShow, ExeProcessEvents) ;
// ripristino possibilità di alterare il flag di modifica
if ( bOldEnabModif)
ExeEnableModified() ;
// risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamCalcSolid( int nPartId, bool bRecalc)
@@ -266,17 +304,17 @@ ExeBeamShowSolid( int nPartId, bool bShow)
//-----------------------------------------------------------------------------
bool
ExeBeamGetBuildingIsOn( void)
ExeBeamGetBuildingIsOn( int nAssGrpId)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// verifico se assemblaggio attivato
return pBeamMgr->GetBuildingIsOn() ;
return pBeamMgr->GetBuildingIsOn( nAssGrpId) ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamShowBuilding( bool bShow)
ExeBeamShowBuilding( int nAssGrpId, bool bShow)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
@@ -285,7 +323,7 @@ ExeBeamShowBuilding( bool bShow)
if ( bOldEnabModif)
ExeDisableModified() ;
// attivo o disattivo la visualizzazione l'assemblaggio
bool bOk = pBeamMgr->ShowBuilding( bShow) ;
bool bOk = pBeamMgr->ShowBuilding( nAssGrpId, bShow) ;
// ripristino possibilità di alterare il flag di modifica
if ( bOldEnabModif)
ExeEnableModified() ;
+3 -1
View File
@@ -130,7 +130,9 @@ ExeGetFileType( const string& sFilePath)
bool
ExeSetBtlAuxDir( const string& sBtlAuxDir)
{
return MySetBtlAuxDir( sBtlAuxDir) && MySetBtlLuaData( LuaGetLuaLibsDir(), LuaGetLastRequire()) ;
bool bOk1 = MySetBtlAuxDir( sBtlAuxDir) ;
bool bOk2 = MySetBtlLuaData( LuaGetLuaLibsDir(), LuaGetLastRequire()) ;
return ( bOk1 && bOk2) ;
}
//-----------------------------------------------------------------------------
+52 -71
View File
@@ -1665,6 +1665,55 @@ ExeCreateCurveBezierFromArc( int nParentId, int nArcId, bool bErase)
return nId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateCurveBezierFromCurve( int nParentId, int nCrvId, bool bRational)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento della curva
Frame3d frCrv ;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frCrv))
return GDB_ID_NULL ;
// recupero il riferimento di destinazione
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero la curva
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCurve == nullptr || ! pCurve->IsValid())
return GDB_ID_NULL ;
// recupero il vettore estrusione della curva e lo porto in locale al gruppo destinazione
Vector3d vtExtr ;
pCurve->GetExtrusion( vtExtr) ;
vtExtr.LocToLoc( frCrv, frLoc) ;
PtrOwner<ICurve> pCrvBez ( CurveToBezierCurve( pCurve, bRational)) ;
// setto l'estrusione
pCrvBez->SetExtrusion( vtExtr) ;
// aggiungo la curva in forma di Bezier al DB
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvBez)) ;
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateCurveBezierFromCurve( int nParentId, int nCrvId, bool bRational)
{
// eseguo
int nId = MyCreateCurveBezierFromCurve( nParentId, nCrvId, bRational) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCurveBezierFromCurve(" + IdToString( nParentId) + "," +
IdToString( nCrvId) + ")"
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
int
MyCreateCurveCompo( int nParentId, const INTVECTOR& vIds, bool bErase)
@@ -2013,12 +2062,12 @@ ExeCreateCurveCompoByInterpolation( int nParentId, const PolyLine& PL, int nType
nMethod = CurveByInterp::BESSEL ;
nCrvType = CurveByInterp::CUBIC_BEZIERS ;
}
else if ( nType == ITT_CUBICS_LONG)
nCrvType = CurveByInterp::CUBIC_BEZIERS_LONG ;
// oggetto interpolatore
CurveByInterp crvByInterp ;
Point3d ptP ;
for ( bool bFound = PL.GetFirstPoint( ptP) ;
bFound ;
bFound = PL.GetNextPoint( ptP))
for ( bool bFound = PL.GetFirstPoint( ptP) ; bFound ; bFound = PL.GetNextPoint( ptP))
crvByInterp.AddPoint( ptP) ;
PtrOwner<ICurve> pCrvCompo( crvByInterp.GetCurve( nMethod, nCrvType)) ;
bOk = bOk && ! IsNull( pCrvCompo) ;
@@ -2585,71 +2634,3 @@ CalcExtrusion( IGeomDB* pGeomDB, int nParentId, int nRefType)
vtExtr.LocToLoc( pGeomDB->GetGridFrame(), frEnt) ;
return vtExtr ;
}
//-------------------------------------------------------------------------------
static int
MyCreateCurveBezierForm( int nParentId, int nCrvId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento della curva
Frame3d frCrv ;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frCrv))
return GDB_ID_NULL ;
// recupero il riferimento di destinazione
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero la curva
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCurve == nullptr || ! pCurve->IsValid())
return GDB_ID_NULL ;
// recupero il vettore estrusione della curva e lo porto in locale al gruppo destinazione
Vector3d vtExtr ;
pCurve->GetExtrusion( vtExtr) ;
vtExtr.LocToLoc( frCrv, frLoc) ;
PtrOwner<ICurve> pCrvBez ( CurveToBezierCurve( pCurve)) ;
//int nType = pCurve->GetType() ;
//switch ( nType ) {
//case CRV_LINE :
// pCrvBez.Set( LineToBezierCurve( GetCurveLine( pCurve))) ;
// break ;
//case CRV_ARC :
// pCrvBez.Set( ArcToBezierCurve( GetCurveArc( pCurve))) ;
// break ;
//case CRV_BEZIER :
// pCrvBez.Set( BezierToBasicBezierCurve( GetCurveBezier( pCurve))) ;
// break ;
//case CRV_COMPO :
// pCrvBez.Set( CompositeToBezierCurve( GetCurveComposite( pCurve))) ;
// break ;
//default :
// break ;
//}
// setto l'estrusione
pCrvBez->SetExtrusion( vtExtr) ;
// aggiungo la curva in forma di Bezier al DB
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvBez)) ;
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateCurveBezierForm( int nParentId, int nCrvId, int nDeg)
{
// eseguo
int nId = MyCreateCurveBezierForm( nParentId, nCrvId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCurveBezierForm(" + IdToString( nParentId) + "," +
IdToString( nCrvId) + "," +
ToString( nDeg) + ")"
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
+278 -56
View File
@@ -20,9 +20,7 @@
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkDistPointLine.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkStmFromCurves.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
@@ -747,9 +745,9 @@ ExeCreateSurfTmPyramid( int nParentId, const Point3d& ptIni, const Point3d& ptCr
// creo la piramide nel suo riferimento intrinseco
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshPyramid( abs( dWidth), dLen, dHeight)) ;
bOk = bOk && ! IsNull( pSTM) ;
// eventuale traslazione per larghezza negativa
if ( bOk && dWidth < 0)
pSTM->Translate( Vector3d( dWidth, 0, 0)) ;
// traslazione per riferimento BL e anche per eventuale larghezza negativa
if ( bOk)
pSTM->Translate( Vector3d( dWidth / 2 + min( dWidth, 0.), dLen / 2, 0)) ;
// porto la piramide nel riferimento locale
bOk = bOk && pSTM->ToGlob( frBox) ;
// inserisco la superficie nel DB
@@ -890,6 +888,63 @@ ExeCreateSurfTmSphere( int nParentId, const Point3d& ptOrig,
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmPyramidFrustum( int nParentId, double dBaseDimX, double dBaseDimY, double dTopDimX, double dTopDimY, double dHeight)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// creo il tronco di cono
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshPyramidFrustum( dBaseDimX, dBaseDimY, dTopDimX, dTopDimY, dHeight)) ;
bOk = bOk && ! IsNull( pSTM) ;
// inserisco la superficie nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmPyramidFrustum(" + IdToString( nParentId) + "," +
ToString( dBaseDimX) + "," +
ToString( dBaseDimY) + "," +
ToString( dTopDimX) + "," +
ToString( dTopDimY) + "," +
ToString( dHeight) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmConeFrustum( int nParentId, double dBaseRad, double dTopRad, double dHeight, double dLinTol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// creo il tronco di cono
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshConeFrustum( dBaseRad, dTopRad, dHeight, dLinTol)) ;
bOk = bOk && ! IsNull( pSTM) ;
// inserisco la superficie nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmConeFrustum(" + IdToString( nParentId) + "," +
ToString( dBaseRad) + "," +
ToString( dTopRad) + "," +
ToString( dHeight) + "," +
ToString( dLinTol) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmTriangle( int nParentId, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptP3, int nRefType)
@@ -981,6 +1036,92 @@ ExeCreateSurfTmRectangle( int nParentId, const Point3d& ptO, const Point3d& ptL,
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmByPolygon( int nParentId, const PolyLine& PL, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento del gruppo destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frDest) ;
// creo la superficie trimesh
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
bOk = bOk && ! IsNull( pSTM) ;
bOk = bOk && pSTM->CreateByFlatContour( PL) ;
// eventuale trasformazione per riferimento di espressione dei punti
if ( bOk && nRefType == RTY_GLOB)
pSTM->ToLoc( frDest) ;
else if ( bOk && nRefType == RTY_GRID)
pSTM->LocToLoc( pGeomDB->GetGridFrame(), frDest) ;
// inserisco la superficie nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sPnt ;
Point3d ptP ;
if ( PL.GetFirstPoint( ptP))
sPnt += "{" + ToString( ptP) + "}" ;
while ( PL.GetNextPoint( ptP))
sPnt += ",{" + ToString( ptP) + "}" ;
string sLua = "EgtSurfTmByPolygon(" + IdToString( nParentId) + ",{" +
sPnt + "}," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmByPolygonWithHoles( int nParentId, const POLYLINEVECTOR& vPL, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento del gruppo destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frDest) ;
// creo la superficie trimesh
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
bOk = bOk && ! IsNull( pSTM) ;
bOk = bOk && pSTM->CreateByPolygonWithHoles( vPL) ;
// eventuale trasformazione per riferimento di espressione dei punti
if ( bOk && nRefType == RTY_GLOB)
pSTM->ToLoc( frDest) ;
else if ( bOk && nRefType == RTY_GRID)
pSTM->LocToLoc( pGeomDB->GetGridFrame(), frDest) ;
// inserisco la superficie nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sPnt ;
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
if ( i > 0)
sPnt += ",{0/0,0/0,0/0}," ; ;
Point3d ptP ;
if ( vPL[i].GetFirstPoint( ptP))
sPnt += "{" + ToString( ptP) + "}" ;
while ( vPL[i].GetNextPoint( ptP))
sPnt += ",{" + ToString( ptP) + "}" ;
}
string sLua = "EgtSurfTmByPolygonWithHoles(" + IdToString( nParentId) + ",{" +
sPnt + "}," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmByFlatContour( int nParentId, int nCrvId, double dLinTol)
@@ -1349,7 +1490,7 @@ ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, const Vector3d&
}
// controllo se la sezione è definita da una regione piana
else if ( nSecType == SRF_FLATRGN) {
// recupero la regione sezion in locale
// recupero la regione sezione in locale
SurfLocal SrfSect( pGeomDB, nSectId, frLoc) ;
const ISurfFlatRegion* pSFrSect = GetSurfFlatRegion( SrfSect.Get()) ;
bOk = bOk && ( pSFrSect != nullptr) ;
@@ -1478,10 +1619,15 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sType = "'IP'" ;
if ( nType == ISurfTriMesh::RLT_MINDIST)
sType = "'MD'" ;
else if ( nType == ISurfTriMesh::RLT_ISOPAR_SMOOTH)
sType = "'IP_SM'" ;
string sLua = "EgtSurfTmRuled(" + IdToString( nParentId) + "," +
ToString( nPtOrCrvId1) + "," +
ToString( nPtOrCrvId2) + "," +
( nType == ISurfTriMesh::RLT_MINDIST ? "'MD'" : "'IP'") + "," +
sType + "," +
ToString( dLinTol) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
@@ -1665,28 +1811,12 @@ ExeCreateSurfTmByVolZmap( int nParentId, int nZmapId, int nPart)
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// Costruttore di trimesh da insieme disordinato di triangoli
StmFromTriangleSoup StmFts ;
bOk = bOk && StmFts.Start() ;
// recupero i triangoli del bordo dello Zmap
int nCount = ( bOk ? pVZM->GetBlockCount() : 0) ;
for ( int i = 0 ; i < nCount && bOk ; ++ i) {
// recupero i triangoli del blocco
TRIA3DEXVECTOR vTria ;
pVZM->GetBlockTriangles( i, vTria) ;
for ( auto& Tria : vTria) {
// aggiusto per i sistemi di riferimento
Tria.LocToLoc( frSou, frLoc) ;
// inserisco il triangolo nella nuova superficie
if ( ! StmFts.AddTriangle( Tria))
bOk = false ;
}
}
// valido la superficie e calcolo le adiacenze
bOk = bOk && StmFts.End() ;
// chiudo eventuali fessure tra i triangoli
PtrOwner<ISurfTriMesh> pStm( StmFts.GetSurf()) ;
bOk = bOk && pStm->Repair() ;
// Recupero la TriMesh
PtrOwner<ISurfTriMesh> pStm ;
bOk = bOk && pStm.Set( pVZM->GetSurfTriMesh()) ;
bOk = bOk && ( ! IsNull( pStm)) ;
// la porto in locale al frame di destinazione
bOk = bOk && pStm->LocToLoc( frSou, frLoc) ;
// inserisco la superficie trimesh nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
ExeSetModified() ;
@@ -2011,7 +2141,7 @@ ExeCreateSurfBzByRegion( int nParentId, const INTVECTOR& vCrvIds, double dLinTol
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
@@ -2052,11 +2182,11 @@ ExeCreateSurfBzByRegion( int nParentId, const INTVECTOR& vCrvIds, double dLinTol
//-------------------------------------------------------------------------------
int
ExeCreateSurfBzByExtrusion( int nParentId, int nCrvId, const Vector3d& vtExtr, bool bCapEnds,
double dLinTol, int nRefType)
double dLinTol, int nRefType, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
@@ -2070,7 +2200,6 @@ ExeCreateSurfBzByExtrusion( int nParentId, int nCrvId, const Vector3d& vtExtr, b
// porto in locale il vettore estrusione
Vector3d vtExtrL = GetVectorLocal( pGeomDB, vtExtr, nRefType, frLoc) ;
// creo la superficie e la inserisco nel DB
int nFirstId = GDB_ID_NULL ;
double dAndTolStdDeg = 15 ;
Plane3d plPlane ;
double dArea ;
@@ -2078,7 +2207,7 @@ ExeCreateSurfBzByExtrusion( int nParentId, int nCrvId, const Vector3d& vtExtr, b
pCrv->ApproxWithLines( dLinTol, dAndTolStdDeg, ICurve::APL_STD, plApprox) ;
double dOrthoExtr = 0 ;
if ( bCapEnds && plApprox.IsClosedAndFlat( plPlane, dArea, 50 * EPS_SMALL)){
dOrthoExtr = plPlane.GetVersN() * vtExtr ;
dOrthoExtr = plPlane.GetVersN() * vtExtrL ;
if ( ( abs( dOrthoExtr) < EPS_SMALL))
return GDB_ID_NULL ;
if ( dOrthoExtr < 0)
@@ -2088,21 +2217,31 @@ ExeCreateSurfBzByExtrusion( int nParentId, int nCrvId, const Vector3d& vtExtr, b
PtrOwner<ISurfBezier> pSbz( bOk ? GetSurfBezierByExtrusion( pCrv, vtExtrL, false, dLinTol) : nullptr ) ;
bOk = bOk && ! IsNull( pSbz) ;
// inserisco la superficie nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSbz)) : GDB_ID_NULL) ;
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
int nFirstId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSbz)) : GDB_ID_NULL) ;
bOk = bOk && ( nFirstId != GDB_ID_NULL) ;
int nCount = ( bOk ? 1 : 0) ;
// se richiesta chiusura agli estremi
if ( bCapEnds && bOk) {
if ( bOk && bCapEnds) {
PtrOwner<ISurfBezier> pSrfBzTop( CreateSurfBezier()) ;
pSrfBzTop->CreateByFlatContour( plApprox) ;
pSrfBzTop->Translate( vtExtrL) ;
pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSrfBzTop)) ;
bOk = ( ! IsNull( pSrfBzTop) &&
pSrfBzTop->CreateByFlatContour( plApprox) &&
pSrfBzTop->Translate( vtExtrL)) ;
int nTopId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSrfBzTop)) : GDB_ID_NULL) ;
PtrOwner<ISurfBezier> pSrfBzBottom( CreateSurfBezier()) ;
pSrfBzBottom->CreateByFlatContour( plApprox) ;
pSrfBzBottom->Invert() ;
pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSrfBzBottom)) ;
bOk = ( ! IsNull( pSrfBzBottom) &&
pSrfBzBottom->CreateByFlatContour( plApprox) &&
pSrfBzBottom->Invert()) ;
int nBotId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSrfBzBottom)) : GDB_ID_NULL) ;
if ( nTopId == GDB_ID_NULL || nBotId == GDB_ID_NULL) {
pGeomDB->Erase( nFirstId) ;
pGeomDB->Erase( nTopId) ;
pGeomDB->Erase( nBotId) ;
nFirstId = GDB_ID_NULL ;
nCount = 0 ;
}
}
if ( pnCount != nullptr)
*pnCount = nCount ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -2112,7 +2251,7 @@ ExeCreateSurfBzByExtrusion( int nParentId, int nCrvId, const Vector3d& vtExtr, b
( bCapEnds ? "true" : "false") + "," +
ToString( dLinTol) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nFirstId) ;
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
@@ -2375,29 +2514,30 @@ ExeCreateSurfBzByRevolve( int nParentId, int nCrvId,
bbox3dSurf.Add( ptCtrl) ;
}
// recupero i loop
ICRVCOMPOPOVECTOR vCCLoop ;
pSbz->GetLoops( vCCLoop, true) ;
ICRVCOMPOPOVECTOR vCCLoop(2) ;
vCCLoop[0].Set(pSbz->GetSingleEdge3D( true, 1)) ;
vCCLoop[1].Set(pSbz->GetSingleEdge3D( true, 3)) ;
// controllo se i loop trovati sono validi
bool bValidLoop1 = false ;
bool bValidLoop3 = false ;
if( ! IsNull(vCCLoop[1]) && vCCLoop[1]->IsValid())
if( ! IsNull(vCCLoop[0]) && vCCLoop[0]->IsValid())
bValidLoop1 = true ;
if( ! IsNull(vCCLoop[3]) && vCCLoop[3]->IsValid())
if( ! IsNull(vCCLoop[1]) && vCCLoop[1]->IsValid())
bValidLoop3 = true ;
if( ! IsNull(vCCLoop[1]) && ! vCCLoop[1]->IsValid() && ! bStartOnAx)
if( ! IsNull(vCCLoop[0]) && ! vCCLoop[0]->IsValid() && ! bStartOnAx)
return GDB_ID_NULL ;
if( ! IsNull(vCCLoop[3]) && ! vCCLoop[3]->IsValid() && ! bEndOnAx)
if( ! IsNull(vCCLoop[1]) && ! vCCLoop[1]->IsValid() && ! bEndOnAx)
return GDB_ID_NULL ;
// il getLoops per superfici non trimmate restituisce 1 elemento per ogni lato dello spazio parametrico.
// in questo caso la superficie è chiusa lungo il parametro V, quindi i lati 0 e 2 saranno null.
double dAngTolDeg = 5 ;
PolyLine plEdge1 ;
if( bValidLoop1)
vCCLoop[1]->ApproxWithLines( dLinTol, dAngTolDeg, ICurve::APL_STD, plEdge1) ;
vCCLoop[0]->ApproxWithLines( dLinTol, dAngTolDeg, ICurve::APL_STD, plEdge1) ;
PolyLine plEdge3 ;
if( bValidLoop3)
vCCLoop[3]->ApproxWithLines( dLinTol, dAngTolDeg, ICurve::APL_STD, plEdge3) ;
vCCLoop[1]->ApproxWithLines( dLinTol, dAngTolDeg, ICurve::APL_STD, plEdge3) ;
// devo distinguere tra il loop superiore e quello inferiore
Point3d ptCen ;
@@ -2407,7 +2547,7 @@ ExeCreateSurfBzByRevolve( int nParentId, int nCrvId,
bOk = bOk && plEdge1.IsClosedAndFlat( plPlane, dArea, 50 * EPS_SMALL) ;
vtN = plPlane.GetVersN() ;
// vedo come questa normale è orientata rispetto alla bbox della superficie
vCCLoop[1]->GetCentroid( ptCen) ;
vCCLoop[0]->GetCentroid( ptCen) ;
ptCen += vtN ;
if ( bbox3dSurf.Encloses( ptCen))
plEdge1.Invert() ;
@@ -2416,7 +2556,7 @@ ExeCreateSurfBzByRevolve( int nParentId, int nCrvId,
bOk = bOk && plEdge3.IsClosedAndFlat( plPlane, dArea, 50 * EPS_SMALL) ;
vtN = plPlane.GetVersN() ;
// vedo come questa normale è orientata rispetto alla bbox della superficie
vCCLoop[3]->GetCentroid( ptCen) ;
vCCLoop[1]->GetCentroid( ptCen) ;
ptCen += vtN ;
if ( bbox3dSurf.Encloses( ptCen))
plEdge3.Invert() ;
@@ -2528,6 +2668,88 @@ ExeCreateSurfBzRuled( int nParentId, int nCrvId1, int nCrvId2, int nRuledType, b
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfBzRuledGuided( int nParentId, int nCrvId1, int nCrvId2, int nLayGuides, bool bCapEnds, double dLinTol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// recupero le curve in locale
CurveLocal CrvLoc1( pGeomDB, nCrvId1, frLoc) ;
bOk = bOk && ( CrvLoc1.Get() != nullptr) ;
CurveLocal CrvLoc2( pGeomDB, nCrvId2, frLoc) ;
bOk = bOk && ( CrvLoc2.Get() != nullptr) ;
ICURVEPOVECTOR vCrv ;
int nId = pGeomDB->GetFirstInGroup( nLayGuides) ;
while( nId != GDB_ID_NULL && bOk) {
CurveLocal CrvLocGuide( pGeomDB, nId, frLoc) ;
bOk = bOk && ( CrvLocGuide.Get() != nullptr) ;
vCrv.emplace_back( CrvLocGuide.Get()->Clone()) ;
nId = pGeomDB->GetNext( nId) ;
}
// calcolo la superficie
PtrOwner<ISurfBezier> pSbz( bOk ? GetSurfBezierRuledGuided( CrvLoc1, CrvLoc2, vCrv, dLinTol) : nullptr) ;
bOk = bOk && ! IsNull( pSbz) ;
// verifiche per orientamento se con tappi
bool bWithCaps = false ;
bool bStdOrient = true ;
Plane3d plPlane1, plPlane2 ;
double dArea1, dArea2 ;
if ( bOk && bCapEnds &&
CrvLoc1->IsClosed() && CrvLoc2->IsClosed() && CrvLoc1->GetArea( plPlane1, dArea1) && CrvLoc2->GetArea( plPlane2, dArea2)) {
bWithCaps = true ;
Point3d ptStart1 ; CrvLoc1->GetStartPoint( ptStart1) ;
Point3d ptStart2 ; CrvLoc2->GetStartPoint( ptStart2) ;
Vector3d vtRuling = ptStart2 - ptStart1 ;
bStdOrient = ( vtRuling * plPlane1.GetVersN() > 0) ;
if ( ! bStdOrient)
pSbz->Invert() ;
}
// inserisco la superficie nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSbz)) : GDB_ID_NULL) ;
// se richiesto inserisco anche il cap
if ( bOk && bWithCaps) {
// costruisco la superficie dalla curva 1
PtrOwner<ISurfBezier> pSbzFlat1( CreateSurfBezier()) ;
double dAngTolDeg = 5 ;
PolyLine pl1 ; CrvLoc1->ApproxWithLines(dLinTol, dAngTolDeg, ICurve::APL_STD, pl1) ;
pSbzFlat1->CreateByFlatContour( pl1) ;
if ( bStdOrient)
pSbzFlat1->Invert() ;
// inserisco la superficie nel DB
bOk = bOk && pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSbzFlat1)) ;
// costruisco la superficie dalla curva 2
PtrOwner<ISurfBezier> pSbzFlat2( CreateSurfBezier()) ;
PolyLine pl2 ; CrvLoc2->ApproxWithLines(dLinTol, dAngTolDeg, ICurve::APL_STD, pl2) ;
pSbzFlat2->CreateByFlatContour( pl2) ;
if ( ! bStdOrient)
pSbzFlat2->Invert() ;
// inserisco la superficie nel DB
bOk = bOk && pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSbzFlat2)) ;
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfBzRuledGuided(" + IdToString( nParentId) + "," +
ToString( nCrvId1) + "," +
ToString( nCrvId2) + "," +
( bCapEnds ? "true" : "false") + "," +
ToString( dLinTol) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfBzSkinned( int nParentId, const INTVECTOR& vCrvIds, bool bCapEnds, double dLinTol)
+13 -10
View File
@@ -152,7 +152,7 @@ ExeCreateVolZmapByRegionExtrusion( int nParentId, int nSfrId, double dDimZ, doub
//-------------------------------------------------------------------------------
int
ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDex)
ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDex, double dExtraBox)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -169,7 +169,7 @@ ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDe
// creo lo Zmap nel suo riferimento intrinseco
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
bOk = bOk && ! IsNull( pVZM) ;
bOk = bOk && pVZM->CreateFromTriMesh( *pStm, dPrec, bTriDex) ;
bOk = bOk && pVZM->CreateFromTriMesh( *pStm, dPrec, bTriDex, dExtraBox) ;
// lo porto nel riferimento di destinazione
bOk = bOk && pVZM->LocToLoc( frStm, frDest) ;
// inserisco lo Zmap nel DB
@@ -177,10 +177,11 @@ ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDe
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapFromTriMesh(" + IdToString( nParentId) + "," +
ToString( nStmId) + "," +
ToString( dPrec) + "," +
( bTriDex ? "true" : "false") + ")" +
string sLua = "EgtVolZmapFromSurfTm(" + IdToString( nParentId) + "," +
ToString( nStmId) + "," +
ToString( dPrec) + "," +
( bTriDex ? "true" : "false") + "," +
ToString( dExtraBox) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -221,7 +222,7 @@ ExeUpdateVolZmapByAddingSurfTm( int nVolZmapId, int nStmId)
//-------------------------------------------------------------------------------
bool
ExeUniformVolZmap( int nVolZmapId, double dToler)
ExeUniformVolZmap( int nVolZmapId, double dToler, bool bExtensionFirst, int nToolNum)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -230,12 +231,14 @@ ExeUniformVolZmap( int nVolZmapId, double dToler)
bool bOk = ( pVZM != nullptr) ;
// aggiorno lo Zmap
dToler = max( dToler, EPS_SMALL) ;
bOk = bOk && pVZM->MakeUniform( dToler) ;
bOk = bOk && pVZM->MakeUniform( dToler, bExtensionFirst, nToolNum) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtUniformZmap(" + ToString( nVolZmapId) + "," +
ToString( dToler) + ")"
string sLua = "EgtUniformVolZmap(" + ToString( nVolZmapId) + "," +
ToString( dToler) + "," +
( bExtensionFirst ? "true" : "false") +
ToString( nToolNum) + ")"
" -- bOk =" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
+37 -20
View File
@@ -16,6 +16,7 @@
#include "EXE.h"
#include "EXE_Const.h"
#include "EXE_Macro.h"
#include "AuxTools.h"
#include "GeoTools.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EXeExecutor.h"
@@ -31,6 +32,8 @@
#include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
using namespace std ;
//----------------------------------------------------------------------------
bool
ExeCurveDomain( int nId, double* pdStart, double* pdEnd)
@@ -755,15 +758,15 @@ ExeShowCurveBezierControlPoints( int nCrvId, int nDestGrpId, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva di bezier
// recupero la curva di Bezier
IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nCrvId) ;
if ( pGeoObj->GetType() != CRV_BEZIER && pGeoObj->GetType() != CRV_COMPO)
return GDB_ID_NULL ;
// recupero il riferimento della curva
// recupero il riferimento della curva
Frame3d frCrv ;
bool bOk = true ;
bOk = bOk && pGeomDB->GetGlobFrame( nCrvId, frCrv) ;
// recupero il riferimento di destinazione
// recupero il riferimento di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
if ( ! bOk)
@@ -799,7 +802,7 @@ ExeShowCurveBezierControlPoints( int nCrvId, int nDestGrpId, int* pnCount)
++nCount ;
}
}
// restituisco i risultati
// restituisco i risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
@@ -826,7 +829,7 @@ ExeShowCurveBezierControlPoints( int nCrvId, int nDestGrpId, int* pnCount)
if ( nId != GDB_ID_NULL)
++nCount ;
}
// restituisco i risultati
// restituisco i risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
@@ -841,11 +844,13 @@ ExeCurveMaxOffset( int nId, double& dMaxOffset)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico il parametro
// verifico il parametro
if ( &dMaxOffset == nullptr)
return false ;
// recupero la curva
// recupero la curva
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
if ( pCrv == nullptr)
return false ;
return CalcCurveLimitOffset( *pCrv, dMaxOffset) ;
}
@@ -855,30 +860,39 @@ ExeCopyCompoSubCurve( int nCrvId, int nSubCrvToCopy, int nDestGrpId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva compo
// recupero la curva compo
const ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCompo == nullptr)
return GDB_ID_NULL ;
// recupero il riferimento della curva
// recupero il riferimento della curva
Frame3d frCrv ;
bool bOk = true ;
bOk = bOk && pGeomDB->GetGlobFrame( nCrvId, frCrv) ;
// recupero il riferimento di destinazione
// recupero il riferimento di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
if ( ! bOk)
return GDB_ID_NULL ;
int nSubCrvs = pCompo->GetCurveCount() ;
if ( nSubCrvToCopy > nSubCrvs - 1)
return GDB_ID_NULL ;
// creo una copia e la porto nel frame della destinazione
// creo una copia e la porto nel frame della destinazione
const ICurve* pSubCrv = pCompo->GetCurve( nSubCrvToCopy) ;
if ( pSubCrv == nullptr)
return GDB_ID_NULL ;
ICurve* pSubCrvCopy = pSubCrv->Clone() ;
if ( pSubCrvCopy == nullptr)
return GDB_ID_NULL ;
pSubCrvCopy->LocToLoc( frCrv, frDest) ;
int nSubCrvId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, pSubCrvCopy) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCopyCompoSubCurve(" + IdToString( nCrvId) + "," +
ToString( nSubCrvToCopy) + "," +
IdToString( nDestGrpId) + ")" +
" -- Id=" + ToString( nSubCrvId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nSubCrvId ;
}
@@ -888,22 +902,25 @@ ExeCopyParamRange( int nCrvId, double dUStart, double dUEnd, int nDestGrpId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva
// recupero la curva
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ;
// recupero il riferimento della curva
// recupero il riferimento della curva
Frame3d frCrv ;
bool bOk = true ;
bOk = bOk && pGeomDB->GetGlobFrame( nCrvId, frCrv) ;
// recupero il riferimento di destinazione
// recupero il riferimento di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
if ( ! bOk)
return GDB_ID_NULL ;
// creo una copia e la porto nel frame della destinazione
// creo una copia e la porto nel frame della destinazione
ICurve* pSubCrvCopy = pCrv->CopyParamRange( dUStart, dUEnd) ;
if ( pSubCrvCopy == nullptr)
return GDB_ID_NULL ;
pSubCrvCopy->LocToLoc( frCrv, frDest) ;
int nSubCrvId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, pSubCrvCopy) ;
ExeSetModified() ;
return nSubCrvId ;
}
+1 -1
View File
@@ -59,7 +59,7 @@ ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType
// eseguo Pocketing
ICRVCOMPOPOVECTOR vCrvCompoRes ;
bool bOk = CalcPocketing( pSfr, dRad, 0, dStep, dAngle, 5., nType, bSmooth, false, false, false, true, P_INVALID, nullptr, false, vCrvCompoRes) ;
bool bOk = CalcPocketing( pSfr, dRad, 0, dStep, dAngle, 5., nType, bSmooth, true, false, false, false, true, P_INVALID, nullptr, false, dStep, INFINITO, 0, vCrvCompoRes) ;
nFirstId = GDB_ID_NULL ;
nCrvCount = int( vCrvCompoRes.size()) ;
if ( bOk && nCrvCount > 0) {
+103 -2
View File
@@ -1115,6 +1115,59 @@ ExeExtractSurfTmFacetLoops( int nId, int nFacet, int nDestGrpId, int* pnCount)
return nFirstId ;
}
//----------------------------------------------------------------------------
int
ExeExtractSurfTmTriaLoop( int nId, int nT, int nDestGrpId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return GDB_ID_NULL ;
bool bOk = true ;
// recupero il riferimento della superficie
Frame3d frSurf ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frSurf) ;
// recupero il riferimento di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
// recupero la normale del trinagolo (da usare come estrusione della curva)
Triangle3d tria ; pStm->GetTriangle(nT, tria) ;
Vector3d vtN = tria.GetN() ;
// creo il loop come poliline
PolyLine PL ;
for ( int i = 0 ; i < 3 ; ++i)
PL.AddUPoint( i, tria.GetP(i)) ;
PL.Close() ;
// dalla polilinea creo la curva e la inserisco nel DB
// creo la curva
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
bOk = bOk && pCrvCompo->FromPolyLine( PL) ;
// imposto estrusione
bOk = bOk && pCrvCompo->SetExtrusion( vtN) ;
// la porto nel riferimento destinazione
bOk = bOk && pCrvCompo->LocToLoc( frSurf, frDest) ;
// la inserisco nel DB geometrico
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCrvCompo)) : GDB_ID_NULL) ;
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
// copio il materiale
if ( ! pGeomDB->CopyMaterial( nId, nNewId))
return GDB_ID_NULL ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtExtractSurfTmTriaLoop(" + ToString( nId) + "," +
ToString( nT) + "," +
ToString( nDestGrpId) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCopySurfTmFacet( int nId, int nFacet, int nDestGrpId)
@@ -1227,7 +1280,8 @@ ExeSurfTmGetFacetBBoxRef( int nId, int nFacet, int nFlag, const Frame3d& frRef,
//-----------------------------------------------------------------------------
bool
ExeSurfTmGetFacetOutlineInfo( int nId, int nFacet, int nRefId,
int& nStatus, BOOLVECTOR& vbOpen, INTVECTOR& vnAdj, DBLVECTOR& vdLen, VCT3DVECTOR& vvtNorm, DBLVECTOR& vdElev)
int& nStatus, BOOLVECTOR& vbOpen, INTVECTOR& vnAdj, DBLVECTOR& vdLen,
PNTVECTOR& vptStart, VCT3DVECTOR& vvtNorm, DBLVECTOR& vdElev)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -1272,6 +1326,7 @@ ExeSurfTmGetFacetOutlineInfo( int nId, int nFacet, int nRefId,
vbOpen.clear() ; vbOpen.reserve( nDim) ;
vnAdj.clear() ; vnAdj.reserve( nDim) ;
vdLen.clear() ; vdLen.reserve( nDim) ;
vptStart.clear() ; vptStart.reserve( nDim) ;
vvtNorm.clear() ; vvtNorm.reserve( nDim) ;
vdElev.clear() ; vdElev.reserve( nDim) ;
// recupero riferimento alla lista dei punti
@@ -1301,12 +1356,15 @@ ExeSurfTmGetFacetOutlineInfo( int nId, int nFacet, int nRefId,
double dDist = ( PU.first - ptIni) * vtN ;
dElev = ( bOpen ? min( dElev, dDist) : max( dElev, dDist)) ;
}
// porto punto iniziale nel riferimento desiderato
TransformPoint( pGeomDB, nId, nRefId, ptIni) ;
// porto normale nel riferimento desiderato
TransformVector( pGeomDB, nId, nRefId, vtN) ;
// inserisco dati nei parametri di ritorno
vbOpen.emplace_back( bOpen) ;
vnAdj.emplace_back( nAdj) ;
vdLen.emplace_back( dLen) ;
vptStart.emplace_back( ptIni) ;
vvtNorm.emplace_back( vtN) ;
vdElev.emplace_back( dElev) ;
// passo al prossimo lato
@@ -1373,6 +1431,47 @@ ExeSurfTmGetEdges( int nId, int nDestGrpId, bool bSmoothAng, int* pnCount)
return nFirstId ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmGetCurvatures( int nId, int nV, double& dK1, Vector3d& vtK1, double& dK2, Vector3d& vtK2)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// Inzializzo i parametri di ritorno
dK1 = 0. ; dK2 = 0. ;
vtK1 = V_NULL ; vtK2 = V_NULL ;
// Recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// Recupero il riferimento globale del gruppo cui appartiene
Frame3d frSurf ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frSurf) ;
// Calcolo la Curvatura
bool bPlanar = false ;
Vector3d vtNorm = V_NULL ;
bOk = bOk && pStm->GetCurvature( nV, dK1, vtK1, dK2, vtK2, bPlanar, vtNorm) ;
// Se superficie localmente piana
if ( bPlanar) {
vtK1 = V_NULL ; // Generico vettore parallelo alla superficie (dK1 circa 0.)
vtK2 = V_NULL ; // generico vettore generico parallelo alla superficie e perpendicolare a vtK1 (dK2 circa 0.)
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmGetCurvature(" + ToString( nId) + "," +
ToString( nV) + ")" +
" -- bOk=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// Restituisco il risultato
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfBezierGetPoint( int nSurfId, double dU, double dV, int nRefId, Point3d& ptP)
@@ -1688,6 +1787,8 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
// recupero la superficie di Bezier
const ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pSbz != nullptr) ;
if( ! bOk)
return GDB_ID_NULL ;
// recupero il riferimento della superficie
Frame3d frSurf ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frSurf) ;
@@ -1698,7 +1799,7 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
ICRVCOMPOPOVECTOR vCC ;
pSbz->GetLoops( vCC , true) ;
pSbz->GetLoops( vCC, true) ;
for ( int i = 0 ; i < int( vCC.size()) ; ++i) {
if ( IsNull( vCC[i]) || ! vCC[i]->IsValid())
continue ;
+201 -61
View File
@@ -22,7 +22,7 @@
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveBezier.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
@@ -237,7 +237,8 @@ ExeApproxCurve( int nId, int nApprType, double dLinTol, double dMaxSegmLen)
if ( IsCmdLog()) {
string sLua = "EgtApproxCurve(" + ToString( nId) + "," +
ApproxTypeToString( nApprType) + "," +
ToString( dLinTol) + ")" +
ToString( dLinTol) + "," +
ToString( dMaxSegmLen) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -363,17 +364,24 @@ ExeModifyCurveStartPoint( int nId, const Point3d& ptP, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pCurve != nullptr) ;
bool bOk = ( pCurve != nullptr) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
// porto in locale il nuovo punto iniziale
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
// ne modifico il punto iniziale
bOk = bOk && pCurve->ModifyStart( ptPL) ;
if ( bOk && ! pCurve->ModifyStart( ptPL)) {
bOk = false ;
Point3d ptEnd ;
if ( pCurve->GetEndPoint( ptEnd) && ! AreSamePointApprox( ptPL, ptEnd)) {
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
if ( ! IsNull( pLine) && pLine->Set( ptPL, ptEnd))
bOk = pGeomDB->ReplaceGeoObj( nId, Release( pLine)) ;
}
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -393,17 +401,24 @@ ExeModifyCurveEndPoint( int nId, const Point3d& ptP, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pCurve != nullptr) ;
bool bOk = ( pCurve != nullptr) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
// porto in locale il nuovo punto finale
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
// ne modifico il punto finale
bOk = bOk && pCurve->ModifyEnd( ptPL) ;
if ( bOk && ! pCurve->ModifyEnd( ptPL)) {
bOk = false ;
Point3d ptStart ;
if ( pCurve->GetStartPoint( ptStart) && ! AreSamePointApprox( ptStart, ptPL)) {
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
if ( ! IsNull( pLine) && pLine->Set( ptStart, ptPL))
bOk = pGeomDB->ReplaceGeoObj( nId, Release( pLine)) ;
}
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -507,12 +522,74 @@ ExeSpiralizeCurveAlongGuide( int nCrvId, int nGuideId, double dLinTol)
bFound = PL1.GetNextPoint( ptP1) ;
}
bOk = bOk && pCompoGuide->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, APP_SPECIAL_LINES, PL2) ;
// associo i punti a minima distanza delle polylines
PNTIVECTOR vPnt1, vPnt2 ;
bool bTmp ;
bOk = bOk && AssociatePolyLinesMinDistPoints( PL1, PL2, vPnt1, vPnt2, bTmp) ;
// correzione per gestione ottimale degli spigoli :
// individuo gli spigoli
const double CORNER_COS = 0.96 ;
int nTotP1 = vPnt1.size() ;
int nTotP2 = vPnt2.size() ;
BOOLVECTOR vSharpCorner1( nTotP1, false), vSharpCorner2( nTotP2, false) ;
for ( int i = 0 ; i < nTotP1 - 1 ; i ++) {
// se estremo di curva aperta non è spigolo
if ( i == 0 && ! PL1.IsClosed())
continue ;
// recupero direzioni precedente e successiva
int nPrevI = ( i == 0 ? nTotP1 - 2 : i - 1) ;
int nNextI = i + 1 ;
Vector3d vtPrev = vPnt1[i].first - vPnt1[nPrevI].first ;
vtPrev.Normalize() ;
Vector3d vtNext = vPnt1[nNextI].first - vPnt1[i].first ;
vtNext.Normalize() ;
vSharpCorner1[i] = ( vtPrev * vtNext < CORNER_COS) ;
}
if ( bOk)
vSharpCorner1.back() = vSharpCorner1.front() ;
for ( int i = 0 ; i < nTotP2 - 1 ; i ++) {
if ( i == 0 && ! PL2.IsClosed())
continue ;
int nPrevI = ( i == 0 ? nTotP2 - 2 : i - 1) ;
int nNextI = i + 1 ;
Vector3d vtPrev = vPnt2[i].first - vPnt2[nPrevI].first ;
vtPrev.Normalize() ;
Vector3d vtNext = vPnt2[nNextI].first - vPnt2[i].first ;
vtNext.Normalize() ;
vSharpCorner2[i] = ( vtPrev * vtNext < CORNER_COS) ;
}
if ( bOk)
vSharpCorner2.back() = vSharpCorner2.front() ;
// se spigolo non associato ad altro spigolo, verifico se esiste un possibile spigolo da associare
for ( int i = 0 ; i < nTotP1 ; i ++) {
if ( vSharpCorner1[i] && ! vSharpCorner2[vPnt1[i].second]) {
// individuo i limiti per la ricerca dello spigolo
int nPrevI = ( i == 0 ? 0 : i - 1) ;
int nNextI = ( i == nTotP1 - 1 ? i : i + 1) ;
int nPrevJ = vPnt1[nPrevI].second ;
int nNextJ = vPnt1[nNextI].second ;
int nStart = ( vSharpCorner2[nPrevJ] ? nPrevJ + 1 : nPrevJ) ;
int nEnd = ( vSharpCorner2[nNextJ] ? nNextJ - 1 : nNextJ) ;
double dSqMinDist = INFINITO ;
int nCorner = vPnt1[i].second ;
// cerco lo spigolo più vicino nel range fissato
for ( int j = nStart ; j <= nEnd ; j ++) {
if ( vSharpCorner2[j]) {
double dSqDist = SqDist( vPnt1[i].first, vPnt2[j].first) ;
if ( dSqDist < dSqMinDist) {
dSqMinDist = dSqDist ;
nCorner = j ;
}
}
}
vPnt1[i].second = nCorner ;
}
}
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
bOk = bOk && ! IsNull( pCompo) ;
@@ -935,7 +1012,7 @@ MyTrimCurveWithRegion( int nCrvId, int nRegId, bool bInVsOut, bool bOn, int& nCo
// calcolo la classificazione della curva rispetto alla regione
CRVCVECTOR ccClass ;
if ( ! pSFR->GetCurveClassification( *CrvLoc, EPS_SMALL, ccClass))
return GDB_ID_NULL ;
return GDB_ID_NULL ;
// determino gli intervalli di curva da conservare
Intervals inOk( 100 * EPS_PARAM) ;
for ( auto& ccOne : ccClass) {
@@ -1596,6 +1673,20 @@ ExeModifyArcRadius( int nId, double dRad, bool bKeepCenter)
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeModifyArcAngCenter( int nId, double dAngCenter)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero l'arco
ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nId)) ;
if ( pArc == nullptr)
return false ;
// modifico angolo al centro
return pArc->ChangeAngCenter( dAngCenter) ;
}
//-------------------------------------------------------------------------------
bool
ExeModifyArcC2P( int nId, const Point3d& ptEnd, int nRefType)
@@ -1713,7 +1804,7 @@ ExeCloseCurveCompo( int nId)
}
//-------------------------------------------------------------------------------
bool
static bool
MyAddCurveCompoCurve( int nId, int nAddCrvId, bool bEraseOrig, bool bEndVsStart)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
@@ -1776,16 +1867,32 @@ ExeAddCurveCompoLine( int nId, const Point3d& ptP, bool bEndVsStart, int nRefTyp
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// recupero la curva composita
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pCompo != nullptr) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
// porto in locale il nuovo punto
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
// eseguo la modifica
bOk = bOk && pCompo->AddLine( ptPL, bEndVsStart) ;
// se l'entità da modificare è un punto geometrico
if ( pGeomDB->GetGeoType( nId) == GEO_PNT3D) {
// creo la curva composita
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
bOk = bOk && ( ! IsNull( pCompo)) ;
// recupero il punto di start
Point3d ptStart = GetGeoPoint3d( pGeomDB->GetGeoObj( nId))->GetPoint() ;
// sistemo la curva composita
bOk = bOk && pCompo->AddPoint( ptStart) && pCompo->AddLine( ptPL, bEndVsStart) ;
// la sostituisco al GeoPoint originale
bOk = bOk && pGeomDB->ReplaceGeoObj( nId, Release( pCompo)) ;
}
// altrimenti deve essere curva composita
else {
// recupero la curva composita
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pCompo != nullptr) ;
// eseguo la modifica
bOk = bOk && pCompo->AddLine( ptPL, bEndVsStart) ;
}
// dichiaro modificato progetto
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -1832,17 +1939,32 @@ ExeAddCurveCompoArc2P( int nId, const Point3d& ptMid, const Point3d& ptP, bool b
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// recupero la curva composita
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pCompo != nullptr) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
// porto in locale i punti
Point3d ptMidL = GetPointLocal( pGeomDB, ptMid, nRefType, frLoc) ;
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
// eseguo la modifica
bOk = bOk && pCompo->AddArc2P( ptMidL, ptPL, bEndVsStart) ;
// se l'entità da modificare è un punto geometrico
if ( pGeomDB->GetGeoType( nId) == GEO_PNT3D) {
// creo la curva composita
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
bOk = bOk && ( ! IsNull( pCompo)) ;
// recupero il punto di start
Point3d ptStart = GetGeoPoint3d( pGeomDB->GetGeoObj( nId))->GetPoint() ;
// sistemo la curva composita
bOk = bOk && pCompo->AddPoint( ptStart) && pCompo->AddArc2P( ptMidL, ptPL, bEndVsStart) ;
// la sostituisco al GeoPoint originale
bOk = bOk && pGeomDB->ReplaceGeoObj( nId, Release( pCompo)) ;
}
// altrimenti deve essere curva composita
else {
// recupero la curva composita
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pCompo != nullptr) ;
// eseguo la modifica
bOk = bOk && pCompo->AddArc2P( ptMidL, ptPL, bEndVsStart) ;
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -2319,7 +2441,7 @@ ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
//-------------------------------------------------------------------------------
static bool
MyProjectCurveOnSurf( int nCurveId, int nSurfTmId, const Vector3d& vtProj, int nDestGrpId,
MyProjectCurveOnSurf( int nCurveId, const INTVECTOR& vnSurfId, const Vector3d& vtProj, int nDestGrpId,
double dLinTol, double dMaxSegmLen, bool bDirFromProj, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
@@ -2331,29 +2453,38 @@ MyProjectCurveOnSurf( int nCurveId, int nSurfTmId, const Vector3d& vtProj, int n
Frame3d frCrv ;
if ( ! pGeomDB->GetGlobFrame( nCurveId, frCrv))
return false ;
// recupero la superficie e il suo riferimento
const ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nSurfTmId)) ;
if ( pSurf == nullptr)
// deve esserci almeno una superficie
if ( vnSurfId.empty())
return false ;
Frame3d frStm ;
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frStm))
// recupero il riferimento della prima superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( vnSurfId[0], frSurf))
return false ;
// recupero le superfici e le porto tutte in locale alla prima
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vnSurfId.size()) ;
CISURFPVECTOR vpSurf ; vpSurf.reserve( vnSurfId.size()) ;
for ( int i = 0 ; i < int( vnSurfId.size()) ; ++ i) {
vSurfL.emplace_back( pGeomDB, vnSurfId[i], frSurf) ;
if ( vSurfL[i].Get() == nullptr)
return false ;
vpSurf.emplace_back( vSurfL[i].Get()) ;
}
// recupero il riferimento del gruppo di destinazione
nDestGrpId = AdjustId( nDestGrpId) ;
Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return false ;
// porto la curva e il vettore nel riferimento della superficie
CurveLocal CrvLoc( pCrv, frCrv, frStm) ;
CurveLocal CrvLoc( pCrv, frCrv, frSurf) ;
if ( CrvLoc.Get() == nullptr)
return false ;
Vector3d vtProjL = GetVectorLocal( pGeomDB, vtProj, nRefType, frCrv) ;
vtProjL.LocToLoc( frCrv, frStm) ;
vtProjL.LocToLoc( frCrv, frSurf) ;
// vanno affilati gli spigoli solo se direzione non da proiezione
bool bSharpEdges = ( ! bDirFromProj) ;
// eseguo la proiezione
PNT5AXVECTOR vPt5ax ;
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), *pSurf, vtProjL, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, vtProjL, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
return false ;
// inserisco la composita nel gruppo destinazione
PtrOwner<ICurveComposite> pCompo ;
@@ -2362,10 +2493,10 @@ MyProjectCurveOnSurf( int nCurveId, int nSurfTmId, const Vector3d& vtProj, int n
pCompo.Set( CreateCurveComposite()) ;
if ( IsNull( pCompo))
return false ;
pCompo->AddPoint( GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
pCompo->AddPoint( GetLocToLoc( Pt5ax.ptP, frSurf, frDest)) ;
}
else
pCompo->AddLine( GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
pCompo->AddLine( GetLocToLoc( Pt5ax.ptP, frSurf, frDest)) ;
}
int nCompoId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCompo)) ;
if ( nCompoId == GDB_ID_NULL)
@@ -2377,7 +2508,7 @@ MyProjectCurveOnSurf( int nCurveId, int nSurfTmId, const Vector3d& vtProj, int n
if ( IsNull( pGeoVct))
return false ;
Vector3d vtDir = ( bDirFromProj ? Pt5ax.vtDir2 : Pt5ax.vtDir1) ;
pGeoVct->Set( 10 * GetLocToLoc( vtDir, frStm, frDest), GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
pGeoVct->Set( 10 * GetLocToLoc( vtDir, frSurf, frDest), GetLocToLoc( Pt5ax.ptP, frSurf, frDest)) ;
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pGeoVct)) ;
if ( nNewId == GDB_ID_NULL)
return false ;
@@ -2391,15 +2522,15 @@ MyProjectCurveOnSurf( int nCurveId, int nSurfTmId, const Vector3d& vtProj, int n
//-------------------------------------------------------------------------------
bool
ExeProjectCurveOnSurf( int nCurveId, int nSurfTmId, const Vector3d& vtProj, int nDestGrpId,
ExeProjectCurveOnSurf( int nCurveId, const INTVECTOR& vnSurfId, const Vector3d& vtProj, int nDestGrpId,
double dLinTol, double dMaxSegmLen, bool bDirFromProj, int nRefType)
{
bool bOk = MyProjectCurveOnSurf( nCurveId, nSurfTmId, vtProj, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, nRefType) ;
bool bOk = MyProjectCurveOnSurf( nCurveId, vnSurfId, vtProj, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtProjectCurveOnSurf(" + ToString( nCurveId) + "," +
ToString( nSurfTmId) + ",{" +
string sLua = "EgtProjectCurveOnSurf(" + ToString( nCurveId) + ",{" +
ToString( vnSurfId) + "},{" +
ToString( vtProj) + "}," +
ToString( nDestGrpId) + "," +
ToString( dLinTol) + "," +
@@ -2415,7 +2546,7 @@ ExeProjectCurveOnSurf( int nCurveId, int nSurfTmId, const Vector3d& vtProj, int
//-------------------------------------------------------------------------------
static bool
MyProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrpId,
MyProjectCurveOnSurfExt( int nCurveId, const INTVECTOR& vnSurfId, int nGuideId, int nDestGrpId,
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
@@ -2427,13 +2558,22 @@ MyProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrp
Frame3d frCrv ;
if ( ! pGeomDB->GetGlobFrame( nCurveId, frCrv))
return false ;
// recupero la superficie e il suo riferimento
const ISurf* pStm = GetSurf( pGeomDB->GetGeoObj( nSurfTmId)) ;
if ( pStm == nullptr)
// deve esserci almeno una superficie
if ( vnSurfId.empty())
return false ;
Frame3d frStm ;
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frStm))
// recupero il riferimento della prima superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( vnSurfId[0], frSurf))
return false ;
// recupero le superfici e le porto tutte in locale alla prima
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vnSurfId.size()) ;
CISURFPVECTOR vpSurf ; vpSurf.reserve( vnSurfId.size()) ;
for ( int i = 0 ; i < int( vnSurfId.size()) ; ++ i) {
vSurfL.emplace_back( pGeomDB, vnSurfId[i], frSurf) ;
if ( vSurfL[i].Get() == nullptr)
return false ;
vpSurf.emplace_back( vSurfL[i].Get()) ;
}
// recupero l'entità guida (punto, curva o superficie) e il suo riferimento
const IGeoPoint3d* pGdePnt = nullptr ;
const ICurve* pGdeCrv = nullptr ;
@@ -2456,7 +2596,7 @@ MyProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrp
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return false ;
// porto la curva nel riferimento della superficie
CurveLocal CrvLoc( pCrv, frCrv, frStm) ;
CurveLocal CrvLoc( pCrv, frCrv, frSurf) ;
if ( CrvLoc.Get() == nullptr)
return false ;
// vanno affilati gli spigoli solo se direzione non da guida
@@ -2467,23 +2607,23 @@ MyProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrp
PtrOwner<IGeoPoint3d> pGdeLoc( pGdePnt->Clone()) ;
if ( pGdeLoc == nullptr)
return false ;
pGdeLoc->LocToLoc( frGde, frStm) ;
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), *pStm, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
pGdeLoc->LocToLoc( frGde, frSurf) ;
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
return false ;
}
else if ( pGdeCrv != nullptr) {
CurveLocal GdeLoc( pGdeCrv, frGde, frStm) ;
CurveLocal GdeLoc( pGdeCrv, frGde, frSurf) ;
if ( GdeLoc.Get() == nullptr)
return false ;
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), *pStm, *GdeLoc.Get(), dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *GdeLoc.Get(), dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
return false ;
}
else { // pGdeStm != nullptr
SurfLocal GdeLoc( pGdeStm, frGde, frStm) ;
SurfLocal GdeLoc( pGdeStm, frGde, frSurf) ;
const ISurf* pGdeLoc = GetSurf( GdeLoc.Get()) ;
if ( pGdeLoc == nullptr)
return false ;
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), *pStm, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
return false ;
}
// inserisco la composita nel gruppo destinazione
@@ -2493,10 +2633,10 @@ MyProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrp
pCompo.Set( CreateCurveComposite()) ;
if ( IsNull( pCompo))
return false ;
pCompo->AddPoint( GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
pCompo->AddPoint( GetLocToLoc( Pt5ax.ptP, frSurf, frDest)) ;
}
else
pCompo->AddLine( GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
pCompo->AddLine( GetLocToLoc( Pt5ax.ptP, frSurf, frDest)) ;
}
int nCompoId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCompo)) ;
if ( nCompoId == GDB_ID_NULL)
@@ -2508,7 +2648,7 @@ MyProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrp
if ( IsNull( pGeoVct))
return false ;
Vector3d vtDir = ( bDirFromGuide ? Pt5ax.vtDir2 : Pt5ax.vtDir1) ;
pGeoVct->Set( 10 * GetLocToLoc( vtDir, frStm, frDest), GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
pGeoVct->Set( 10 * GetLocToLoc( vtDir, frSurf, frDest), GetLocToLoc( Pt5ax.ptP, frSurf, frDest)) ;
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pGeoVct)) ;
if ( nNewId == GDB_ID_NULL)
return false ;
@@ -2522,16 +2662,16 @@ MyProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrp
//-------------------------------------------------------------------------------
bool
ExeProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrpId,
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
ExeProjectCurveOnSurfExt( int nCurveId, const INTVECTOR& vnSurfId, int nGuideId, int nDestGrpId,
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
{
bool bOk = MyProjectCurveOnSurfExt( nCurveId, nSurfTmId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
bool bOk = MyProjectCurveOnSurfExt( nCurveId, vnSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtProjectCurveOnSurfExt(" + ToString( nCurveId) + "," +
ToString( nSurfTmId) + ",{" +
ToString( nGuideId) + "}," +
string sLua = "EgtProjectCurveOnSurfExt(" + ToString( nCurveId) + ",{" +
ToString( vnSurfId) + "}," +
ToString( nGuideId) + "," +
ToString( nDestGrpId) + "," +
ToString( dLinTol) + "," +
ToString( dMaxSegmLen) + "," +
@@ -2606,8 +2746,8 @@ ExeCurveGetVoronoi( const INTVECTOR& vIds, int nDestGrpId, int nBound, int* pnCo
ExeSetModified() ;
if ( IsCmdLog()) {
string sLua = "EgtCurveGetVoronoi(" + ToString( vIds[0]) + "," +
ToString( nDestGrpId) + ")" +
string sLua = "EgtCurveGetVoronoi({" + ToString( vIds) + "}," +
ToString( nDestGrpId) + ")" +
" FirstId=" + ToString( nFirstId) + " nCurveCount=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
+155 -57
View File
@@ -23,7 +23,7 @@
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkSurfTriMeshAux.h"
#include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
@@ -745,41 +745,6 @@ ExeCutSurfTmPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSave
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeCutSurfBzPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSaveOnEq, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pSbz != nullptr) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
// porto in locale il punto e la normale del piano
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ;
// calcolo il piano di taglio
Plane3d plPlane ;
bOk = bOk && plPlane.Set( ptOnL, vtNL) ;
// eseguo il taglio
bOk = bOk && pSbz->Cut( plPlane, bSaveOnEq) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCutSurfBzPlane(" + IdToString( nId) + ",{" +
ToString( ptOn) + "},{" +
ToString( vtN) + "}," +
( bSaveOnEq ? "true" : "false") + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeCutSurfTmClosedCurve( int nSurfId, int nCurveId, bool bSaveOnEq)
@@ -1224,6 +1189,160 @@ ExeSurfTmGetShowEdges( int nId, bool& bShow)
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmSetSmoothAng( int nId, double dAngDeg)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimseh da trimmare
ISurfTriMesh* pSrfTm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pSrfTm == nullptr)
return false ;
pSrfTm->SetSmoothAngle( dAngDeg) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmSetSmoothAng(" + ToString( nId) + "," +
ToString( dAngDeg) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return true ;
}
//----------------------------------------------------------------------------
static double
GetStmOffsPrec( double dOffs, double dLinTol)
{
return max( min( abs( dOffs) / 4, 100 * max( dLinTol, EPS_SMALL)), 0.5) ;
}
//----------------------------------------------------------------------------
int
ExeSurfTmOffset( int nParentId, const INTVECTOR& vStmIds, double dOffs, double dLinTol, int nType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// se non ci sono superfici non c'è niente da calcolare
if ( vStmIds.empty())
return GDB_ID_NULL ;
// recupero il riferimento del gruppo di inserimento
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero le superfici TriMesh e le porto tutte in locale
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vStmIds.size()) ;
CISURFTMPVECTOR vpStm ; vpStm.reserve( vStmIds.size()) ;
for ( int i = 0 ; i < int( vStmIds.size()) ; ++ i) {
vSurfL.emplace_back( pGeomDB, vStmIds[i], frLoc) ;
if ( vSurfL[i].Get() == nullptr)
return GDB_ID_NULL ;
vpStm.emplace_back( GetSurfTriMesh( vSurfL[i].Get())) ;
}
// precisione per Tridexel in funzione dell'offset e della tolleranza lineare
double dPrec = GetStmOffsPrec( dOffs, dLinTol) ;
// recupero la superficie risultante
PtrOwner<ISurfTriMesh> pStmOffs( CreateSurfTriMeshesOffset( vpStm, dOffs, dPrec, nType)) ;
bool bOk = ( ! IsNull( pStmOffs) && pStmOffs->IsValid()) ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStmOffs)) : GDB_ID_NULL) ;
// copio gli attributi
pGeomDB->CopyAttributes( vStmIds[0], nId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmOffset(" + ToString( nParentId) + ")" +
ToString( vStmIds) + "," +
ToString( dOffs) + "," +
ToString( dLinTol) + "," +
ToString( nType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeSurfTmThickeningOffset( int nParentId, const INTVECTOR& vStmIds, double dOffs, double dLinTol, int nType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// se non ci sono superfici non c'è niente da calcolare
if ( vStmIds.empty())
return GDB_ID_NULL ;
// recupero il riferimento del gruppo di inserimento
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero le superfici TriMesh e le porto tutte in locale
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vStmIds.size()) ;
CISURFTMPVECTOR vpStm ; vpStm.reserve( vStmIds.size()) ;
for ( int i = 0 ; i < int( vStmIds.size()) ; ++ i) {
vSurfL.emplace_back( pGeomDB, vStmIds[i], frLoc) ;
if ( vSurfL[i].Get() == nullptr)
return GDB_ID_NULL ;
vpStm.emplace_back( GetSurfTriMesh( vSurfL[i].Get())) ;
}
// precisione per Tridexel in funzione dell'offset e della tolleranza lineare
double dPrec = GetStmOffsPrec( dOffs, dLinTol) ;
// recupero la superficie risultante
PtrOwner<ISurfTriMesh> pStmOffs( CreateSurfTriMeshesThickeningOffset( vpStm, dOffs, dPrec, nType)) ;
bool bOk = ( ! IsNull( pStmOffs) && pStmOffs->IsValid()) ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStmOffs)) : GDB_ID_NULL) ;
// copio gli attributi
pGeomDB->CopyAttributes( vStmIds[0], nId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmThickeningOffset(" + ToString( nParentId) + ")" +
ToString( vStmIds) + "," +
ToString( dOffs) + "," +
ToString( dLinTol) + "," +
ToString( nType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return nId ;
}
//-------------------------------------------------------------------------------
bool
ExeCutSurfBzPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSaveOnEq, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pSbz != nullptr) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
// porto in locale il punto e la normale del piano
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ;
// calcolo il piano di taglio
Plane3d plPlane ;
bOk = bOk && plPlane.Set( ptOnL, vtNL) ;
// eseguo il taglio
bOk = bOk && pSbz->Cut( plPlane, bSaveOnEq) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCutSurfBzPlane(" + IdToString( nId) + ",{" +
ToString( ptOn) + "},{" +
ToString( vtN) + "}," +
( bSaveOnEq ? "true" : "false") + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//----------------------------------------------------------------------------
static bool
MySurfBzTrim( int nId, int nTrimmerId)
@@ -1267,24 +1386,3 @@ ExeSurfBzTrim( int nId, int nCutterId)
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmSetSmoothAng( int nId, double dAngDeg)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimseh da trimmare
ISurfTriMesh* pSrfTm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pSrfTm == nullptr)
return false ;
pSrfTm->SetSmoothAngle( dAngDeg) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmSetSmoothAng(" + ToString( nId) + "," +
ToString( dAngDeg) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return true ;
}
+26
View File
@@ -535,3 +535,29 @@ ExeCutVolZmapPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, int nRefT
// restituisco risultato
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZMapOffset( int nId, double dDist, int nType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap
IVolZmap* pVolZmap = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pVolZmap != nullptr) ;
// eseguo l'offset
bOk = bOk && pVolZmap->Offset( dDist, nType) ;
// se il risultato è vuoto, cancello lo Zmap
if ( bOk && ! pVolZmap->IsValid())
pGeomDB->Erase( nId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapOffset(" + ToString( nId) + "," +
ToString( dDist) + "," +
ToString( nType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
+94 -8
View File
@@ -38,13 +38,56 @@ ExeCopyAttributes( int nSouId, int nDestId)
//-----------------------------------------------------------------------------
bool
ExeSetLevel( int nId, int nLevel)
ExeSetLevel( const INTVECTOR& vIds, int nLevel)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// imposto il livello
bool bOk = pGeomDB->SetLevel( nId, nLevel) ;
// recupero pezzo e layer correnti
bool bCurrPartOff = false ;
bool bCurrLayerOff = false ;
int nCurrPartId = ExeGetCurrPart() ;
int nCurrLayerId = ExeGetCurrLayer() ;
// ciclo sul vettore degli identificativi
bool bOk = true ;
for ( int i = 0 ; i < ssize( vIds) && bOk ; ++ i) {
// impostazione livello
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
while ( nId != GDB_ID_NULL) {
// imposto il livello
if ( ! pGeomDB->SetLevel( nId, nLevel))
bOk = false ;
// se nascosto pezzo corrente o layer corrente
if ( nLevel != GDB_LV_USER) {
if ( nId == nCurrPartId)
bCurrPartOff = true ;
else if ( nId == nCurrLayerId)
bCurrLayerOff = true ;
}
// passo al successivo
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
}
}
// se pezzo o layer correnti da rideterminare
bool bPrevCmdLog = SetCmdLog( false) ;
if ( bCurrPartOff)
ExeResetCurrPartLayer() ;
else if ( bCurrLayerOff)
ExeSetCurrPartLayer( nCurrPartId, ExeGetFirstLayer( nCurrPartId, true)) ;
SetCmdLog( bPrevCmdLog) ;
// dichiaro progetto modificato
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLevel = "GDB_LV.USER" ;
if ( nLevel == GDB_LV_SYSTEM)
sLevel = "GDB_LV.SYSTEM" ;
else if ( nLevel == GDB_LV_TEMP)
sLevel = "GDB_LV.TEMP" ;
string sLua = "EgtSetLevel({" + IdListToString( vIds) + "}," +
sLevel + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
@@ -88,13 +131,56 @@ ExeGetCalcLevel( int nId, int* pnLevel)
//-----------------------------------------------------------------------------
bool
ExeSetMode( int nId, int nMode)
ExeSetMode( const INTVECTOR& vIds, int nMode)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// imposto il modo
bool bOk = pGeomDB->SetMode( nId, nMode) ;
// recupero pezzo e layer correnti
bool bCurrPartOff = false ;
bool bCurrLayerOff = false ;
int nCurrPartId = ExeGetCurrPart() ;
int nCurrLayerId = ExeGetCurrLayer() ;
// ciclo sul vettore degli identificativi
bool bOk = true ;
for ( int i = 0 ; i < ssize( vIds) && bOk ; ++ i) {
// impostazione livello
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
while ( nId != GDB_ID_NULL) {
// imposto il modo
if ( ! pGeomDB->SetMode( nId, nMode))
bOk = false ;
// se nascosto pezzo corrente o layer corrente
if ( nMode != GDB_MD_STD) {
if ( nId == nCurrPartId)
bCurrPartOff = true ;
else if ( nId == nCurrLayerId)
bCurrLayerOff = true ;
}
// passo al successivo
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
}
}
// se pezzo o layer correnti da rideterminare
bool bPrevCmdLog = SetCmdLog( false) ;
if ( bCurrPartOff)
ExeResetCurrPartLayer() ;
else if ( bCurrLayerOff)
ExeSetCurrPartLayer( nCurrPartId, ExeGetFirstLayer( nCurrPartId, true)) ;
SetCmdLog( bPrevCmdLog) ;
// dichiaro progetto modificato
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sMode = "GDB_MD.STD" ;
if ( nMode == GDB_MD_LOCKED)
sMode = "GDB_MD.LOCKED" ;
else if ( nMode == GDB_MD_HIDDEN)
sMode = "GDB_MD.HIDDEN" ;
string sLua = "EgtSetMode({" + IdListToString( vIds) + "}," +
sMode + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
@@ -149,11 +235,11 @@ ExeSetStatus( const INTVECTOR& vIds, int nStat)
int nCurrLayerId = ExeGetCurrLayer() ;
// ciclo sul vettore degli identificativi
bool bOk = true ;
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
for ( int i = 0 ; i < ssize( vIds) && bOk ; ++ i) {
// impostazione stato
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
while ( nId != GDB_ID_NULL) {
// imposto il modo
// imposto lo stato
if ( ! pGeomDB->SetStatus( nId, nStat))
bOk = false ;
// se nascosto pezzo corrente o layer corrente
+75 -40
View File
@@ -18,6 +18,7 @@
#include "GeoTools.h"
#include "AuxTools.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkMultiGeomDB.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkUiUnits.h"
#include "/EgtDev/Include/EgtStringConverter.h"
@@ -300,16 +301,39 @@ ExeCopy( int nSouId, int nRefId, int nSonBeforeAfter)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua ;
if ( nSonBeforeAfter == GDB_LAST_SON)
sLua = "EgtCopy(" + ToString( nSouId) + "," +
IdToString( nRefId) + ")" +
" -- Id=" + ToString( nNewId) ;
else
sLua = "EgtCopy(" + ToString( nSouId) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Id=" + ToString( nNewId) ;
string sLua = "EgtCopy(" + ToString( nSouId) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nNewId ;
}
//-----------------------------------------------------------------------------
int
ExeCopyEx( int nSouCtx, int nSouId, int nDestCtx, int nRefId, int nSonBeforeAfter)
{
// recupero i due GeomDB
IGeomDB* pSouGeomDB = GetGeomDB( nSouCtx) ;
VERIFY_GEOMDB( pSouGeomDB, GDB_ID_NULL)
IGeomDB* pDstGeomDB = GetGeomDB( nDestCtx) ;
VERIFY_GEOMDB( pDstGeomDB, GDB_ID_NULL)
// risolvo l'Id di riferimento per destinazione
nRefId = AdjustId( nRefId, nDestCtx) ;
// eseguo la copia
int nNewId = Copy( pSouGeomDB, nSouId, pDstGeomDB, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
pDstGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
pDstGeomDB->RemoveInfo( nNewId, GDB_SI_DUPLIST) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCopyEx(" + ToString( nSouCtx) + "," +
ToString( nSouId) + "," +
ToString( nDestCtx) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
@@ -330,16 +354,39 @@ ExeCopyGlob( int nSouId, int nRefId, int nSonBeforeAfter)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua ;
if ( nSonBeforeAfter == GDB_LAST_SON)
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
IdToString( nRefId) + ")" +
" -- Id=" + ToString( nNewId) ;
else
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Id=" + ToString( nNewId) ;
string sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nNewId ;
}
//-----------------------------------------------------------------------------
int
ExeCopyGlobEx( int nSouCtx, int nSouId, int nDestCtx, int nRefId, int nSonBeforeAfter)
{
// recupero i due GeomDB
IGeomDB* pSouGeomDB = GetGeomDB( nSouCtx) ;
VERIFY_GEOMDB( pSouGeomDB, GDB_ID_NULL)
IGeomDB* pDstGeomDB = GetGeomDB( nDestCtx) ;
VERIFY_GEOMDB( pDstGeomDB, GDB_ID_NULL)
// risolvo l'Id di riferimento per destinazione
nRefId = AdjustId( nRefId, nDestCtx) ;
// eseguo la copia
int nNewId = CopyGlob( pSouGeomDB, nSouId, pDstGeomDB, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
pDstGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
pDstGeomDB->RemoveInfo( nNewId, GDB_SI_DUPLIST) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCopyGlobEx(" + ToString( nSouCtx) + "," +
ToString( nSouId) + "," +
ToString( nDestCtx) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
@@ -358,16 +405,10 @@ ExeRelocate( int nSouId, int nRefId, int nSonBeforeAfter)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua ;
if ( nSonBeforeAfter == GDB_LAST_SON)
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
IdToString( nRefId) + ")" +
" -- Ok=" + ToString( bOk) ;
else
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Ok=" + ToString( bOk) ;
string sLua = "EgtRelocate(" + ToString( nSouId) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
@@ -386,16 +427,10 @@ ExeRelocateGlob( int nSouId, int nRefId, int nSonBeforeAfter)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua ;
if ( nSonBeforeAfter == GDB_LAST_SON)
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
IdToString( nRefId) + ")" +
" -- Ok=" + ToString( bOk) ;
else
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Ok=" + ToString( bOk) ;
string sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
+12 -8
View File
@@ -59,9 +59,9 @@ static string s_sNestKey ;
static string s_sLockId ;
static string s_sIniFile ;
static bool s_bEnableUI = true ;
static pfOnTerminateProcess s_pFunOnTerminateProcess = nullptr ;
static pfProcEvents s_pFunProcEvents = nullptr ;
static pfOutText s_pFunOutText = nullptr ;
static psfOnTerminateProcess s_pFunOnTerminateProcess = nullptr ;
static psfProcEvents s_pFunProcEvents = nullptr ;
static psfOutText s_pFunOutText = nullptr ;
static HWND s_hMainWnd = nullptr ;
static string s_sTempDir ;
@@ -210,7 +210,7 @@ ExeExit( void)
//-----------------------------------------------------------------------------
bool
ExeSetOnTerminateProcess( pfOnTerminateProcess pFun)
ExeSetOnTerminateProcess( psfOnTerminateProcess pFun)
{
s_pFunOnTerminateProcess = pFun ;
return ( pFun != nullptr) ;
@@ -384,8 +384,12 @@ ExeVerifyKeyOption( int nOptInd)
bool
ExeSetFont( const string& sNfeFontDir, const string& sDefaultFont)
{
// inizializzazioni gestore font Nfe
InitFontManager( sNfeFontDir, sDefaultFont) ;
// se definito anche direttorio font Nfe, inizializzazione gestore font
if ( ! sNfeFontDir.empty())
InitFontManager( sNfeFontDir, sDefaultFont) ;
// altrimenti impostazione del solo font di default
else
SetDefaultFont( sDefaultFont) ;
return true ;
}
@@ -685,7 +689,7 @@ ExeMessageBox( const string& sText, const string& sTitle, int nType)
//-----------------------------------------------------------------------------
bool
ExeSetProcessEvents( pfProcEvents pFun)
ExeSetProcessEvents( psfProcEvents pFun)
{
s_pFunProcEvents = pFun ;
SetEGkProcessEvents( pFun) ;
@@ -704,7 +708,7 @@ ExeProcessEvents( int nProg, int nPause)
//-----------------------------------------------------------------------------
bool
ExeSetOutText( pfOutText pFun)
ExeSetOutText( psfOutText pFun)
{
s_pFunOutText = pFun ;
return ( pFun != nullptr) ;
+36
View File
@@ -21,6 +21,7 @@
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkDistPointSurfTm.h"
#include "/EgtDev/Include/EGkDistPointSurfBz.h"
using namespace std ;
@@ -122,3 +123,38 @@ ExePointSurfTmDist( const Point3d& ptP, int nStmId, int nRefType,
ptMin = GetPointInRef( pGeomDB, ptMinL, frStm, nRefType) ;
return distPS.GetMinDistTriaIndex( *pnTria) ;
}
//----------------------------------------------------------------------------
bool
ExePointSurfBzDist( const Point3d& ptP, int nSbzId, int nRefType,
double* pdDist, Point3d& ptMin, Vector3d& vtN)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico il primo parametro di ritorno obbligatorio
if ( pdDist == nullptr)
return false ;
// recupero la superficie bezier
ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nSbzId)) ;
if ( pSbz == nullptr)
return false ;
// recupero il suo riferimento globale
Frame3d frSbz ;
if ( ! pGeomDB->GetGlobFrame( nSbzId, frSbz))
return false ;
// porto il punto nel riferimento della superficie
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frSbz) ;
// recupero i risultati
DistPointSurfBz distPS( ptPL, *pSbz) ;
if ( ! distPS.GetDist( *pdDist))
return false ;
Point3d ptMinL ;
if ( ! distPS.GetMinDistPoint( ptMinL))
return false ;
ptMin = GetPointInRef( pGeomDB, ptMinL, frSbz, nRefType) ;
Vector3d vtNL ;
if ( ! distPS.GetNorm( vtNL))
return false ;
vtN = GetVectorInRef( pGeomDB, vtNL, frSbz, nRefType) ;
return true ;
}
+28 -21
View File
@@ -32,7 +32,7 @@ ExeStartPoint( int nId, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ;
@@ -85,12 +85,19 @@ ExeEndPoint( int nId, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ;
// se punto
if ( pGObj->GetType() == GEO_PNT3D) {
// recupero il geo-punto
const IGeoPoint3d* pGP = GetGeoPoint3d( pGObj) ;
// assegno il punto
ptP = pGP->GetPoint() ;
}
// se vettore
if ( pGObj->GetType() == GEO_VECT3D) {
else if ( pGObj->GetType() == GEO_VECT3D) {
// recupero il geo-vettore
const IGeoVector3d* pGV = GetGeoVector3d( pGObj) ;
// assegno il punto
@@ -122,7 +129,7 @@ ExeMidPoint( int nId, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ;
@@ -154,7 +161,7 @@ ExeCenterPoint( int nId, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ;
@@ -194,7 +201,7 @@ ExeCentroid( int nId, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ;
@@ -234,7 +241,7 @@ ExeAtParamPoint( int nId, double dU, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ;
@@ -257,11 +264,11 @@ ExeNearPoint( int nId, const Point3d& ptNear, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj = pGeomDB->GetGeoObj( nId) ;
if ( pGObj == nullptr)
return false ;
// porto il punto near nel riferimento dell'entità
// porto il punto near nel riferimento dell'entità
Point3d ptNearL = ptNear ;
if ( ! InvTransformPoint( pGeomDB, nId, nRefId, ptNearL))
return false ;
@@ -269,7 +276,7 @@ ExeNearPoint( int nId, const Point3d& ptNear, int nRefId, Point3d& ptP)
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
// recupero la curva
const ICurve* pCrv = GetCurve( pGObj) ;
// calcolo il punto della curva più vicino al punto di riferimento
// calcolo il punto della curva più vicino al punto di riferimento
DistPointCurve dstPC( ptNearL, *pCrv) ;
int nFlag ;
if ( ! dstPC.GetMinDistPoint( 0, ptP, nFlag))
@@ -290,7 +297,7 @@ ExeIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Poi
// se auto-intersezione
if ( nId1 == nId2) {
// deve essere entità geometriche
// deve essere entità geometriche
const IGeoObj* pGObj1 ;
if ( ( pGObj1 = pGeomDB->GetGeoObj( nId1)) == nullptr)
return false ;
@@ -298,11 +305,11 @@ ExeIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Poi
if ( ( pGObj1->GetType() & GEO_CURVE) != 0) {
// recupero la curva
const ICurve* pCrv1 = GetCurve( pGObj1) ;
// porto il punto Near nel riferimento dell'entità
// porto il punto Near nel riferimento dell'entità
Point3d ptNearL = ptNear ;
if ( ! InvTransformPoint( pGeomDB, nId1, nRefId, ptNearL))
return false ;
// calcolo il punto di auto-intersezione sulla curva più vicino al punto di riferimento
// calcolo il punto di auto-intersezione sulla curva più vicino al punto di riferimento
SelfIntersCurve sintC( *pCrv1) ;
if ( ! sintC.GetIntersPointNearTo( ptNearL, ptP))
return false ;
@@ -313,7 +320,7 @@ ExeIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Poi
return TransformPoint( pGeomDB, nId1, nRefId, ptP) ;
}
// devono essere entità geometriche
// devono essere entità geometriche
const IGeoObj* pGObj1 ;
if ( ( pGObj1 = pGeomDB->GetGeoObj( nId1)) == nullptr)
return false ;
@@ -332,7 +339,7 @@ ExeIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Poi
Frame3d frEnt2 ;
if ( ! pGeomDB->GetGlobFrame( nId2, frEnt2))
return false ;
// se il riferimento della seconda curva è diverso da quello della prima entità, devo trasformarla
// se il riferimento della seconda curva è diverso da quello della prima entità, devo trasformarla
PtrOwner<ICurve> pcrvTrans ;
if ( ! AreSameFrame( frEnt1, frEnt2)) {
pcrvTrans.Set( pCrv2->Clone()) ;
@@ -341,11 +348,11 @@ ExeIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Poi
pcrvTrans->LocToLoc( frEnt2, frEnt1) ;
pCrv2 = pcrvTrans ;
}
// porto il punto Near nel riferimento della prima entità
// porto il punto Near nel riferimento della prima entità
Point3d ptNearL = ptNear ;
if ( ! InvTransformPoint( pGeomDB, nId1, nRefId, ptNearL))
return false ;
// calcolo il punto di intersezione sulla prima curva più vicino al punto di riferimento
// calcolo il punto di intersezione sulla prima curva più vicino al punto di riferimento
IntersCurveCurve intCC( *pCrv1, *pCrv2, true) ;
if ( ! intCC.GetIntersPointNearTo( 0, ptNearL, ptP))
return false ;
@@ -362,7 +369,7 @@ ExeStartVector( int nId, int nRefId, Vector3d& vtV)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj = pGeomDB->GetGeoObj( nId) ;
if ( pGObj == nullptr)
return false ;
@@ -400,7 +407,7 @@ ExeEndVector( int nId, int nRefId, Vector3d& vtV)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj = pGeomDB->GetGeoObj( nId) ;
if ( pGObj == nullptr)
return false ;
@@ -424,7 +431,7 @@ ExeMidVector( int nId, int nRefId, Vector3d& vtV)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ;
@@ -448,7 +455,7 @@ ExeAtParamVector( int nId, double dU, int nSide, int nRefId, Vector3d& vtV)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica
// se non è entità geometrica
const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ;
+76 -21
View File
@@ -226,6 +226,18 @@ ExeSetModified( void)
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeSetModified( int nCtx)
{
GseContext* pGseCtx = GetGseContext( nCtx) ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
// se consentito, imposto il flag
if ( pGseCtx->m_bEnableModified)
pGseCtx->m_bModified = true ;
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeResetModified( void)
@@ -387,7 +399,7 @@ ExeInsertFile( const string& sFilePath)
class CamStatus
{
public :
CamStatus( void) : m_nCurrMachGroup( GDB_ID_NULL), m_nCurrPhase( 0) {
CamStatus( void) : m_nCurrMachGroup( GDB_ID_NULL), m_nCurrPhase( 0), m_nCurrMachining( GDB_ID_NULL) {
IMachMgr* pMachMgr = GetCurrMachMgr() ;
if ( pMachMgr == nullptr)
return ;
@@ -463,33 +475,62 @@ ExeSaveFile( const string& sFilePath, int nFlag)
return bOk ;
}
//-----------------------------------------------------------------------------
static bool
IsMachGroupOrWithin( int nId, const IGeomDB* pGeomDB, const IMachMgr* pMachMgr, int& nMachGroupId)
{
// default non definito
nMachGroupId = GDB_ID_NULL ;
// verifico validità puntatori
if ( pGeomDB == nullptr || pMachMgr == nullptr)
return false ;
// eseguo ricerca
int nParentId = pGeomDB->GetParentId( nId) ;
int nPrevParId = nId ;
while ( nParentId != GDB_ID_NULL && nParentId != GDB_ID_ROOT) {
if ( pMachMgr->IsMachBase( nParentId)) {
nMachGroupId = nPrevParId ;
return true ;
}
nPrevParId = nParentId ;
nParentId = pGeomDB->GetParentId( nParentId) ;
}
return false ;
}
//-----------------------------------------------------------------------------
bool
ExeSaveObjToFile( int nId, const string& sFilePath, int nFlag)
ExeSaveObjToFile( const INTVECTOR& vId, const string& sFilePath, int nFlag)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
IMachMgr* pMachMgr = GetCurrMachMgr() ;
// se l'oggetto è la base dei gruppi di lavoro, chiamo la funzione di salvataggio di tutto
if ( pMachMgr != nullptr && pMachMgr->IsMachBase( nId))
return ExeSaveFile( sFilePath, nFlag) ;
// se l'oggetto è un gruppo di lavoro o una sua parte, chiamo la appropriata funzione di salvataggio
int nParentId = pGeomDB->GetParentId( nId) ;
int nPrevParId = nId ;
while ( pMachMgr != nullptr && nParentId != GDB_ID_NULL && nParentId != GDB_ID_ROOT) {
if ( pMachMgr->IsMachBase( nParentId))
return ExeSaveMachGroupToFile( nPrevParId, sFilePath, nFlag) ;
nPrevParId = nParentId ;
nParentId = pGeomDB->GetParentId( nParentId) ;
// se uno degli oggetti è la base dei gruppi di lavoro, chiamo la funzione di salvataggio di tutto
for ( int nId : vId) {
if ( pMachMgr != nullptr && pMachMgr->IsMachBase( nId))
return ExeSaveFile( sFilePath, nFlag) ;
}
// se uno degli oggetti è un gruppo di lavoro o una sua parte, chiamo la appropriata funzione di salvataggio
for ( int nId : vId) {
int nMachGroupId ;
if ( IsMachGroupOrWithin( nId, pGeomDB, pMachMgr, nMachGroupId)) {
INTVECTOR vOthId ;
vOthId.reserve( vId.size()) ;
for ( int nSouId : vId) {
if ( nSouId != nId)
vOthId.push_back( nSouId) ;
}
return ExeSaveMachGroupToFile( nMachGroupId, vOthId, sFilePath, nFlag) ;
}
}
// se ero in CAM, non esco <---
// copio l'oggetto nel file
bool bOk = pGeomDB->Save( nId, sFilePath, nFlag) ;
bool bOk = pGeomDB->Save( vId, sFilePath, nFlag) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSaveObjToFile(" + ToString( nId) + ",'" +
StringToLuaString( sFilePath) + "'," +
NgeTypeToString( nFlag) + ")" +
string sLua = "EgtSaveObjToFile({" + ToString( vId) + "},'" +
StringToLuaString( sFilePath) + "'," +
NgeTypeToString( nFlag) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -499,7 +540,7 @@ ExeSaveObjToFile( int nId, const string& sFilePath, int nFlag)
//-----------------------------------------------------------------------------
bool
ExeSaveMachGroupToFile( int nMGroupId, const string& sFilePath, int nFlag)
ExeSaveMachGroupToFile( int nMGroupId, const INTVECTOR& vPlusId, const string& sFilePath, int nFlag)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -514,11 +555,21 @@ ExeSaveMachGroupToFile( int nMGroupId, const string& sFilePath, int nFlag)
// se ero in CAM, esco dopo averne salvato lo stato
CamStatus CurrCamStatus ;
ExeResetCurrMachGroup() ;
// verifico che gli oggetti Plus non siano gruppi di lavoro o una loro parte
bool bOk = true ;
for ( int nPlusId : vPlusId) {
int nMGrpPlusId ;
if ( IsMachGroupOrWithin( nPlusId, pGeomDB, pMachMgr, nMGrpPlusId)) {
bOk = false ;
break ;
}
}
// recupero eventuali pezzi e foto del gruppo di lavoro
INTVECTOR vId ;
int nPhotoId = GDB_ID_NULL ;
string sPhotoOriPath = "" ;
if ( pMachMgr->SetCurrMachGroup( nMGroupId)) {
bOk = bOk && pMachMgr->SetCurrMachGroup( nMGroupId) ;
if ( bOk) {
// aggiungo gruppo di lavoro
vId.emplace_back( nMGroupId) ;
// aggiungo pezzi
@@ -552,8 +603,11 @@ ExeSaveMachGroupToFile( int nMGroupId, const string& sFilePath, int nFlag)
// disattivo gruppo di lavoro
pMachMgr->ResetCurrMachGroup() ;
}
// aggiungo gli oggetti plus
if ( bOk)
vId.insert( vId.end(), vPlusId.begin(), vPlusId.end()) ;
// salvo gli oggetti appena identificati
bool bOk = pGeomDB->Save( vId, sFilePath, nFlag) ;
bOk = bOk && pGeomDB->Save( vId, sFilePath, nFlag) ;
// eventuale ripristino dati fotografia
if ( nPhotoId != GDB_ID_NULL)
ExeChangePhotoPath( nPhotoId, sPhotoOriPath) ;
@@ -566,7 +620,8 @@ ExeSaveMachGroupToFile( int nMGroupId, const string& sFilePath, int nFlag)
SetCmdLog( bPrevCmdLog) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSaveMachGroupToFile(" + ToString( nMGroupId) + ",'" +
string sLua = "EgtSaveMachGroupToFile(" + ToString( nMGroupId) + ",{" +
ToString( vPlusId) + "},'" +
StringToLuaString( sFilePath) + "'," +
NgeTypeToString( nFlag) + ")" +
" -- Ok=" + ToString( bOk) ;
+47 -20
View File
@@ -27,6 +27,7 @@
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EGnEgtUUID.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtIniFile.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
@@ -558,12 +559,12 @@ ExeModifyRawPart( int nRawId, Point3d ptOrig, double dLength, double dWidth, dou
//-----------------------------------------------------------------------------
bool
ExeModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol)
ExeModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dHeight, Color cCol)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// modifico grezzo indicato nella macchinata corrente
bool bOk = pMachMgr->ModifyRawPart( nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol) ;
bool bOk = pMachMgr->ModifyRawPart( nRawId, nCrvId, dOverMat, dHeight, cCol) ;
ExeSetModified() ;
// restituisco il risultato
return bOk ;
@@ -2105,42 +2106,42 @@ ExeGetPrevOperation( int nId)
}
//-----------------------------------------------------------------------------
int
ExeGetFirstActiveOperation( void)
ExeGetFirstActiveOperation( bool bNeedMachNotEmpty)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// recupero la prima operazione attiva della macchinata corrente
return pMachMgr->GetFirstActiveOperation() ;
return pMachMgr->GetFirstActiveOperation( bNeedMachNotEmpty) ;
}
//-----------------------------------------------------------------------------
int
ExeGetNextActiveOperation( int nId)
ExeGetNextActiveOperation( int nId, bool bNeedMachNotEmpty)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// recupero la successiva operazione attiva della macchinata corrente
return pMachMgr->GetNextActiveOperation( nId) ;
return pMachMgr->GetNextActiveOperation( nId, bNeedMachNotEmpty) ;
}
//-----------------------------------------------------------------------------
int
ExeGetLastActiveOperation( void)
ExeGetLastActiveOperation( bool bNeedMachNotEmpty)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero l'ultima operazione attiva della macchinata corrente
return pMachMgr->GetLastActiveOperation() ;
return pMachMgr->GetLastActiveOperation( bNeedMachNotEmpty) ;
}
//-----------------------------------------------------------------------------
int
ExeGetPrevActiveOperation( int nId)
ExeGetPrevActiveOperation( int nId, bool bNeedMachNotEmpty)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// recupero la precedente operazione attiva della macchinata corrente
return pMachMgr->GetPrevActiveOperation( nId) ;
return pMachMgr->GetPrevActiveOperation( nId, bNeedMachNotEmpty) ;
}
//-----------------------------------------------------------------------------
@@ -2205,12 +2206,12 @@ ExeGetOperationId( const string& sName)
//-----------------------------------------------------------------------------
bool
ExeIsOperationEmpty( int nId)
ExeIsOperationEmpty( int nId, int nEmptyType)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero lo stato dell'operazione indicata della macchinata corrente
return pMachMgr->IsOperationEmpty( nId) ;
return pMachMgr->IsOperationEmpty( nId, nEmptyType) ;
}
//-----------------------------------------------------------------------------
@@ -2839,12 +2840,12 @@ ExeGetMachiningSkippedGeometry( SELVECTOR& vIds)
//-----------------------------------------------------------------------------
bool
ExeIsMachiningEmpty( void)
ExeIsMachiningEmpty( int nEmptyType)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// restituisco lo stato della lavorazione corrente
return pMachMgr->IsMachiningEmpty() ;
return pMachMgr->IsMachiningEmpty( nEmptyType) ;
}
//-----------------------------------------------------------------------------
@@ -3151,6 +3152,16 @@ ExeSimSetUiStatus( int nUiStatus)
return pMachMgr->SimSetUiStatus( nUiStatus) ;
}
//-----------------------------------------------------------------------------
bool
ExeSimEnableToolTipTrace( bool bEnable)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// imposto abilitazione disegno traccia della punta utensile
return pMachMgr->SimEnableToolTipTrace( bEnable) ;
}
//-----------------------------------------------------------------------------
bool
ExeSimGetAxisInfoPos( int nI, string& sName, string& sToken, bool& bLinear, double& dVal)
@@ -3221,8 +3232,13 @@ ExeGenerate( const string& sCncFile, const string& sInfo)
ReplaceString( sDir, "/", "\\") ;
// recupero il nome
string sNcName ;
if ( ! ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sNcName))
sNcName = GetFileTitleEgt( sProjPath) + ".cnc" ;
if ( ! ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sNcName)) {
string sCurrMachDir ; pMachMgr->GetCurrMachineDir( sCurrMachDir) ;
string sCurrMachName ; pMachMgr->GetCurrMachineName( sCurrMachName) ;
string sCurrMachIni = sCurrMachDir + "\\" + sCurrMachName + ".ini" ;
string sExt = GetPrivateProfileStringUtf8( "PartProgram", "Extension", ".cnc", sCurrMachIni.c_str()) ;
sNcName = ChangeFileExtension( GetFileTitleEgt( sProjPath), sExt) ;
}
// creo la path completa
sMyCncFile = sDir + "\\" + sNcName ;
}
@@ -3445,23 +3461,34 @@ ExeGetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
//-----------------------------------------------------------------------------
bool
ExeGetCalcPositions( const Point3d& ptP, double dAngA, double dAngB,
int& nStat, double& dX, double& dY, double& dZ)
double& dX, double& dY, double& dZ)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// calcolo gli assi lineari macchina dalla posizione e dagli assi rotanti
return pMachMgr->GetCalcPositions( ptP, dAngA, dAngB, nStat, dX, dY, dZ) ;
return pMachMgr->GetCalcPositions( ptP, dAngA, dAngB, dX, dY, dZ) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetCalcPositions( const Point3d& ptP, const DBLVECTOR& vAng,
int& nStat, double& dX, double& dY, double& dZ)
double& dX, double& dY, double& dZ)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// calcolo gli assi lineari macchina dalla posizione e dagli assi rotanti
return pMachMgr->GetCalcPositions( ptP, vAng, nStat, dX, dY, dZ) ;
return pMachMgr->GetCalcPositions( ptP, vAng, dX, dY, dZ) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
DBLVECTOR& vAng1, DBLVECTOR& vAng2)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// calcolo gli angoli macchina dalle direzioni fresa e ausiliaria passate
return pMachMgr->GetRobotAngles( ptP, vtDirT, vtDirA, vAng1, vAng2) ;
}
//-----------------------------------------------------------------------------
+158
View File
@@ -0,0 +1,158 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : EXE_MachOpt.cpp Data : 02.04.2025 Versione : 2.7c1
// Contenuto : Funzioni per Ottimizzare i tempi tra le lavorazioni.
//
//
//
// Modifiche : 02.04.25 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "EXE_Const.h"
#include "DllNesting.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/ENkMachOptimization.h"
using namespace std ;
//----------------------------------------------------------------------------
// Static LuaMgr per EgtExecutor
//----------------------------------------------------------------------------
static PtrOwner<IMachOptimization> s_pMO ;
//----------------------------------------------------------------------------
bool
ExeOptMachInit( void)
{
// Creo l'oggetto per il calcolo del percorso minimo (ShortestPath)
s_pMO.Set( CreateMachOptimization()) ;
return ( ! IsNull( s_pMO)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachTerminate( void)
{
// Distruggo l'oggetto
s_pMO.Reset() ;
return ( IsNull( s_pMO)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachAddTool( int nId, double dTCX, double dTCY, double dTCZ, double dTCA,
double dTCB, double dTCC, bool bX, bool bY, bool bZ, bool bA,
bool bB, bool bC, double dTLoad, double dTUnL)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Inserisco il Record
return ( s_pMO->InsertTool( nId, dTCX, dTCY, dTCZ, dTCA, dTCB, dTCC, bX, bY, bZ, bA,
bB, bC, dTLoad, dTUnL)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachAddMachining( int nId, int nToolId, int nGroup,
double dX_Start, double dY_Start, double dZ_Start,
double dA_Start, double dB_Start, double dC_Start,
double dX_End, double dY_End, double dZ_End,
double dA_End, double dB_End, double dC_End)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Inserisco il Record
return ( s_pMO->InsertMachining( nId, nToolId, nGroup,
dX_Start, dY_Start, dZ_Start,
dA_Start, dB_Start, dC_Start,
dX_End, dY_End, dZ_End,
dA_End, dB_End, dC_End)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachSetFirstMachining( int nId)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Imposto la prima lavorazione
return ( s_pMO->SetFirstMachining( nId)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachSetLastMachining( int nId)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Imposto l'ultima lavorazione
return ( s_pMO->SetLastMachining( nId)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachSetFeeds( double dFeedL, double dFeedA)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Imposto l'ultima lavorazione
return ( s_pMO->SetFeeds( dFeedL, dFeedA)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachAddDependence( int nIdPrec, int nIdSucc)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Inserisco la Dipendenza obbligatoria
return ( s_pMO->InsertDependence( nIdPrec, nIdSucc)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachAddSuggestedDependence( int nIdPrec, int nIdSucc)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Inserisco la Dipendenza obbligatoria
return ( s_pMO->InsertSuggestedDependences( nIdPrec, nIdSucc)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachSetAllGroupDependencesAsMandatory( bool bAllMandatory)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Imposto il Flag
return ( s_pMO->SetAllGroupsAsMandatory( bAllMandatory)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachGetResult( INTVECTOR& vIds)
{
vIds.clear() ;
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Recupero i risultati
return ( s_pMO->GetResult( vIds)) ;
}
+18 -1
View File
@@ -19,7 +19,6 @@
#include "DllNesting.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/ENsAutoNester.h"
#include "/EgtDev/Include/EGnStringUtils.h"
@@ -258,6 +257,15 @@ ExeAutoNestSetInterpartGap( double dGap)
return s_pAutoNester->SetInterpartGap( dGap) ;
}
//-----------------------------------------------------------------------------
bool
ExeAutoNestSetShearGap( double dShearGap)
{
if ( IsNull( s_pAutoNester))
return false ;
return s_pAutoNester->SetShearGap( dShearGap) ;
}
//-----------------------------------------------------------------------------
bool
ExeAutoNestSetReportFile( const string& sReportFile)
@@ -339,3 +347,12 @@ ExeAutoNestGetOneResult( int nInd, int& nType, int& nId, int& nFlag, double& dX,
dAngRot = s_vANestInfo[nInd].dAngRot ;
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeAutoNestCalcShearSequence( int nNesting, PNTVECTOR& vPtStart, PNTVECTOR& vPtEnd)
{
if ( IsNull( s_pAutoNester))
return false ;
return s_pAutoNester->CalcShearSequence( nNesting, vPtStart, vPtEnd) ;
}
+4
View File
@@ -89,6 +89,10 @@ ApproxCurveIfNeeded( IGdbIterator* pEnt, double dToler)
PolyArc PA ;
double dTol = max( dToler, LIN_TOL_FINE) ;
bool bOk = pCrv->ApproxWithArcsEx( dTol, ANG_TOL_STD_DEG, LIN_FEA_STD, PA) && pCC->FromPolyArc( PA) ;
// eliminazione di small Z
bOk = bOk && pCC->RemoveSmallDefects( 0.5 * dTol, ANG_TOL_STD_DEG) ;
// merge di archi identici di biarchi
bOk = bOk && pCC->MergeCurves( 0.5 * dTol, ANG_TOL_STD_DEG) ;
bOk = bOk && pEnt->GetGDB()->ReplaceGeoObj( pEnt->GetId(), Release( pCC)) ;
return bOk ;
}
+1271
View File
File diff suppressed because it is too large Load Diff
+179 -26
View File
@@ -16,10 +16,14 @@
#include "EXE.h"
#include "EXE_Macro.h"
#include "DllGraphics.h"
#include "DllMain.h"
#include "resource.h"
#include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <Windowsx.h>
using namespace std ;
@@ -210,6 +214,31 @@ ExeSetGridColor( Color colMin, Color colMaj)
return pScene->SetGridColor( colMin, colMaj) ;
}
//-----------------------------------------------------------------------------
bool
ExeSetCameraType( bool bOrthoOrPersp, bool bRedraw)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
pScene->SetCameraType( bOrthoOrPersp) ;
if ( bRedraw)
pScene->RedrawWindow() ;
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeSetZoomType( int nMode, bool bRedraw)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
if ( ! pScene->SetZoomType( nMode))
return false ;
if ( bRedraw)
pScene->RedrawWindow() ;
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeResize( int nW, int nH)
@@ -431,17 +460,44 @@ ExeGetShowCurveDirection( void)
return pScene->GetShowCurveDirection() ;
}
//-----------------------------------------------------------------------------
static bool
MyResetGroupObjGraphics( IGeomDB* pGDB, int nGroupId)
{
if ( pGDB == nullptr)
return false ;
int nEntId = pGDB->GetFirstInGroup( nGroupId) ;
while ( nEntId != GDB_ID_NULL) {
if ( pGDB->GetGdbType( nEntId) == GDB_TY_GROUP) {
MyResetGroupObjGraphics( pGDB, nEntId) ;
}
else {
IGeoObj* pGeoObj = pGDB->GetGeoObj( nEntId) ;
if ( pGeoObj != nullptr)
pGeoObj->SetObjGraphics( nullptr) ;
}
nEntId = pGDB->GetNext( nEntId) ;
}
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeSetShowTriaAdv( bool bAdvanced, bool bRedraw)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// imposto stato
pScene->SetShowTriaAdvanced( bAdvanced) ;
// se cambiato, imposto stato
if ( pScene->GetShowTriaAdvanced() != bAdvanced) {
// imposto il nuovo stato
pScene->SetShowTriaAdvanced( bAdvanced) ;
// forzo ricalcolo della grafica di tutti gli oggetti
if ( ! MyResetGroupObjGraphics( pScene->GetGeomDB(), GDB_ID_ROOT))
return false ;
}
if ( bRedraw)
pScene->RedrawWindow() ;
return TRUE ;
return true ;
}
//-----------------------------------------------------------------------------
@@ -454,17 +510,50 @@ ExeGetShowTriaAdv( void)
return pScene->GetShowTriaAdvanced() ;
}
//-------------------------------------------------------------------------------
bool
ExeSetShowSurfBezierTol( double dLinTol, bool bRedraw)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// se diverso, imposto il nuovo valore
if ( abs( GetSurfBezierAuxSurfTol() - dLinTol) > 10 * EPS_SMALL) {
// imposto il nuovo valore di approssimazione
SetSurfBezierAuxSurfTol( dLinTol) ;
// forzo ricalcolo della grafica di tutti gli oggetti
if ( ! MyResetGroupObjGraphics( pScene->GetGeomDB(), GDB_ID_ROOT))
return false ;
}
if ( bRedraw)
pScene->RedrawWindow() ;
return true ;
}
//-----------------------------------------------------------------------------
double
ExeGetShowSurfBezierTol( void)
{
// recupero il valore
return GetSurfBezierAuxSurfTol() ;
}
//-----------------------------------------------------------------------------
bool
ExeSetShowZmap( int nMode, bool bRedraw)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// imposto stato
pScene->SetShowZmap( nMode) ;
// se cambiato, imposto il nuovo stato
if ( pScene->GetShowZmap() != nMode) {
// imposto il nuovo stato
pScene->SetShowZmap( nMode) ;
// forzo ricalcolo della grafica di tutti gli oggetti
if ( ! MyResetGroupObjGraphics( pScene->GetGeomDB(), GDB_ID_ROOT))
return false ;
}
if ( bRedraw)
pScene->RedrawWindow() ;
return TRUE ;
return true ;
}
//-----------------------------------------------------------------------------
@@ -472,7 +561,7 @@ int
ExeGetShowZmap( void)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
VERIFY_SCENE( pScene, -1)
// recupero lo stato
return pScene->GetShowZmap() ;
}
@@ -897,27 +986,91 @@ ExeGetImage( int nShowMode, Color colBackTop, Color colBackBottom,
return pScene->GetImage( nShowMode, colBackTop, colBackBottom, nWidth, nHeight, sFile) ;
}
//-----------------------------------------------------------------------------
bool
ExeSetCameraType( bool bOrthoOrPersp, bool bRedraw)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
pScene->SetCameraType( bOrthoOrPersp) ;
if ( bRedraw)
pScene->RedrawWindow() ;
return true ;
//-------------------------------------------------------------------------------
static int s_nContext = 0 ;
static int s_nDriver = 3 ;
static bool s_b2Buff = true ;
static int s_nColorBits = 32 ;
static int s_nDepthBits = 24 ;
static int s_nShowMode = SM_SHADING ;
static Color s_colBackTop = WHITE ;
static Color s_colBackBottom = WHITE ;
static int s_nCameraDir = CT_TOP ;
static int s_nWidth = 1024 ;
static int s_nHeight = 1024 ;
static string s_sImageFile ;
//-------------------------------------------------------------------------------
BOOL
CALLBACK SceneBoxProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch ( message) {
case WM_INITDIALOG :
{
// imposto dimensione box e picture
const int WIN_MAX_DIM = 1024 ;
int nWinW = ( s_nWidth >= s_nHeight ? WIN_MAX_DIM : ( WIN_MAX_DIM * s_nWidth) / s_nHeight) ;
int nWinH = ( s_nHeight >= s_nWidth ? WIN_MAX_DIM : ( WIN_MAX_DIM * s_nHeight) / s_nWidth) ;
HWND hPic = GetDlgItem( hwndDlg, IDC_PICTURE1) ;
SetWindowPos( hwndDlg, HWND_TOP, 0, 0, nWinW, nWinH, SWP_NOMOVE | SWP_NOREPOSITION) ;
SetWindowPos( hPic, HWND_TOP, 0, 0, nWinW, nWinH, SWP_NOMOVE | SWP_NOREPOSITION) ;
// imposto scena
int nContext = GetIndCurrGseContext() ;
GseContext* pGseCtx = GetGseContext( nContext) ;
if ( pGseCtx != nullptr && pGseCtx->m_pScene == nullptr) {
ExeInitScene( hPic, s_nDriver, s_b2Buff, s_nColorBits, s_nDepthBits) ;
if ( pGseCtx->m_pGeomDB != nullptr && pGseCtx->m_pScene != nullptr) {
s_nContext = nContext ;
pGseCtx->m_pScene->SetCamera( s_nCameraDir) ;
pGseCtx->m_pScene->ZoomAll() ;
pGseCtx->m_pScene->GetImage( s_nShowMode, s_colBackTop, s_colBackBottom, s_nWidth, s_nHeight, s_sImageFile) ;
MyResetGroupObjGraphics( pGseCtx->m_pGeomDB, GDB_ID_ROOT) ;
EndDialog( hwndDlg, wParam) ;
}
}
else
s_nContext = 0 ;
}
break ;
}
return FALSE ;
}
//-----------------------------------------------------------------------------
//-------------------------------------------------------------------------------
bool
ExeSetZoomType( int nMode, bool bRedraw)
ExeGetImageEx( int nDriver, bool b2Buff, int nColorBits, int nDepthBits,
int nShowMode, Color colBackTop, Color colBackBottom,
int nCameraDir, int nWidth, int nHeight, const string& sFile)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
if ( ! pScene->SetZoomType( nMode))
return false ;
if ( bRedraw)
pScene->RedrawWindow() ;
return true ;
// Se il contesto corrente possiede già una scena
if ( GetCurrScene() != nullptr) {
return ExeGetImage( nShowMode, colBackTop, colBackBottom, nWidth, nHeight, sFile) ;
}
// altrimenti ne creo una temporanea
else {
// salvo i parametri
s_nDriver = nDriver ;
s_b2Buff = b2Buff ;
s_nColorBits = nColorBits ;
s_nDepthBits = nDepthBits ;
s_nShowMode = nShowMode ;
s_colBackTop = colBackTop ;
s_colBackBottom = colBackBottom ;
s_nCameraDir = nCameraDir ;
s_nWidth = nWidth ;
s_nHeight = nHeight ;
s_sImageFile = sFile ;
// lancio dialogo
HWND hTopWnd = ExeGetMainWindowHandle() ;
DialogBox( GetModuleIstance(), MAKEINTRESOURCE( IDD_LUASCENE), hTopWnd, (DLGPROC)SceneBoxProc) ;
bool bOk = ( s_nContext != 0) ;
// elimino la scena dal contesto
GseContext* pGseCtx = GetGseContext( s_nContext) ;
if ( pGseCtx != nullptr) {
delete pGseCtx->m_pScene ;
pGseCtx->m_pScene = nullptr ;
}
s_nContext = 0 ;
return bOk ;
}
}
+6 -5
View File
@@ -36,7 +36,6 @@ const int STR_DIM = 50 ;
//-----------------------------------------------------------------------------
static HINSTANCE s_hModule = nullptr ;
static char s_szEXeNameVer[STR_DIM] ;
//-----------------------------------------------------------------------------
BOOL APIENTRY
@@ -71,10 +70,12 @@ DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
const char*
GetEXeVersion( void)
{
std::string sVer ;
GetModuleVersion( s_hModule, sVer) ;
sprintf_s( s_szEXeNameVer, STR_DIM, "%s%s", EXE_STR, sVer.c_str()) ;
static char s_szEXeNameVer[STR_DIM] = "" ;
if ( s_szEXeNameVer[0] == '\0') {
std::string sVer ;
GetModuleVersion( s_hModule, sVer) ;
sprintf_s( s_szEXeNameVer, STR_DIM, "%s%s", EXE_STR, sVer.c_str()) ;
}
return s_szEXeNameVer ;
}
BIN
View File
Binary file not shown.
+7 -2
View File
@@ -1,6 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.13.35919.96 d17.13
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EgtExecutor", "EgtExecutor.vcxproj", "{DF654897-F85B-4108-A621-F2C4AB099A48}"
EndProject
Global
@@ -23,4 +25,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {30B63942-DD1D-428A-BFD1-E603299B17B6}
EndGlobalSection
EndGlobal
+10 -4
View File
@@ -105,7 +105,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
<OpenMPSupport>false</OpenMPSupport>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -131,7 +131,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
<OmitFramePointers>false</OmitFramePointers>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile>
<Link>
@@ -166,7 +166,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -201,7 +201,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile>
<Link>
@@ -251,6 +251,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ItemGroup>
<ClCompile Include="DllExch3dm.cpp" />
<ClCompile Include="DllNesting.cpp" />
<ClCompile Include="EXE_Base64.cpp" />
<ClCompile Include="EXE_BeamMgr.cpp" />
<ClCompile Include="EXE_CAvTool.cpp" />
<ClCompile Include="EXE_CDeObjSolid.cpp" />
@@ -264,6 +265,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="EXE_GeoDist.cpp" />
<ClCompile Include="EXE_GeoInters.cpp" />
<ClCompile Include="EXE_Image.cpp" />
<ClCompile Include="EXE_MachOpt.cpp" />
<ClCompile Include="EXE_MaxFiller.cpp" />
<ClCompile Include="EXE_Mutex.cpp" />
<ClCompile Include="EXE_NstAutoNesting.cpp" />
@@ -291,6 +293,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="EXE_NstCreateFlatParts.cpp" />
<ClCompile Include="EXE_Photo.cpp" />
<ClCompile Include="EXE_Picture.cpp" />
<ClCompile Include="EXE_Redis.cpp" />
<ClCompile Include="EXE_Scene.cpp" />
<ClCompile Include="EXE_ShortestPath.cpp" />
<ClCompile Include="EXE_TestObjSurface.cpp" />
@@ -304,6 +307,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="GenTools.cpp" />
<ClCompile Include="GeoTools.cpp" />
<ClCompile Include="GseContext.cpp" />
<ClCompile Include="LUA_Base64.cpp" />
<ClCompile Include="LUA_BeamMgr.cpp" />
<ClCompile Include="LUA_CAvTool.cpp" />
<ClCompile Include="LUA_CDeObjSolid.cpp" />
@@ -314,9 +318,11 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="LUA_GdbGetVol.cpp" />
<ClCompile Include="LUA_GeoDist.cpp" />
<ClCompile Include="LUA_GeoInters.cpp" />
<ClCompile Include="LUA_MachOpt.cpp" />
<ClCompile Include="LUA_MaxFiller.cpp" />
<ClCompile Include="LUA_Picture.cpp" />
<ClCompile Include="LUA_PolynomialRoots.cpp" />
<ClCompile Include="LUA_Redis.cpp" />
<ClCompile Include="LUA_TestObjSurface.cpp" />
<ClCompile Include="PictureObj.cpp" />
<ClCompile Include="LUA_Base.cpp" />
+18
View File
@@ -407,6 +407,24 @@
<ClCompile Include="LUA_TestObjSurface.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="EXE_MachOpt.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_MachOpt.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="EXE_Redis.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_Redis.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="EXE_Base64.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_Base64.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="EgtExecutor.rc">
+2 -2
View File
@@ -20,9 +20,9 @@
//----------------------------------------------------------------------------
int
AdjustId( int nId)
AdjustId( int nId, int nCtx)
{
GseContext* pCtx = GetCurrGseContext() ;
GseContext* pCtx = ( nCtx == 0 ? GetCurrGseContext() : GetGseContext( nCtx));
VERIFY_CTX( pCtx, GDB_ID_NULL)
if ( nId == GDB_ID_CURRPART)
return pCtx->m_nCurrPart ;
+1 -1
View File
@@ -20,7 +20,7 @@ class IGeomDB ;
//----------------------------------------------------------------------------
// Sistemo Id per pezzo o layer correnti
int AdjustId( int nId) ;
int AdjustId( int nId, int nCtx = 0) ;
// Vettore espresso nel riferimento desiderato partendo da vettore nel riferimento RefType
Vector3d GetVectorLocal( IGeomDB* pGeomDB, const Vector3d& vtV, int nRefType, const Frame3d& frLoc) ;
// Vettore espresso nel riferimento RefType partendo da vettore nel riferimento locale
+11 -2
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2024
// EgalTech 2014-2025
//----------------------------------------------------------------------------
// File : LUA.h Data : 24.03.24 Versione : 2.6c2
// File : LUA.h Data : 03.11.25 Versione : 2.7k1
// Contenuto : Dichiarazioni locali per moduli LUA.
//
//
@@ -129,6 +129,15 @@ bool LuaInstallPolynomialRoots( LuaMgr& luaMgr) ;
//-------------------------- Shortest Path -----------------------------------
bool LuaInstallShortestPath( LuaMgr& luaMgr) ;
//----------------------- Machining Time Optimization ------------------------
bool LuaInstallMachiningOptimization( LuaMgr& luaMgr) ;
//-------------------------- Collision Avoidance Tool ------------------------
bool LuaInstallCAvTool( LuaMgr& luaMgr) ;
//---------------------------------- Redis ----------------------------------
bool LuaInstallRedis( LuaMgr& luaMgr) ;
//-------------------------- Base64 ------------------------------------------
bool LuaInstallBase64( LuaMgr& luaMgr) ;
+13
View File
@@ -178,10 +178,23 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
LOG_ERROR( GetLogger(), "Error in LuaInstallShortestPath (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallMachiningOptimization( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallMachiningOptimization (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallCAvTool( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallCAvTool (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallRedis( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallRedis (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallBase64( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallBase64 (LuaInstallEgtFunctions)")
return false ;
}
return true ;
}
+65
View File
@@ -0,0 +1,65 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : LUA_Base64.cpp Data : 03.11.25 Versione : 2.7k1
// Contenuto : Funzioni per codificare/decodificare in Base64 per LUA.
//
//
//
// Modifiche : 03.11.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaBase64Encode( lua_State* L)
{
// 1 parametro : sFile
string sFile ;
LuaCheckParam( L, 1, sFile) ;
LuaClearStack( L) ;
// eseguo la codifica del contenuto del file
string sB64Dest ;
bool bOk = ExeBase64Encode( sFile, sB64Dest) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, sB64Dest) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBase64Decode( lua_State* L)
{
// 2 parametro : sB64Sou, sFile
string sB64Sou ;
LuaCheckParam( L, 1, sB64Sou) ;
string sFile ;
LuaCheckParam( L, 2, sFile) ;
LuaClearStack( L) ;
// eseguo la decodifica della stringa nel file
bool bOk = ExeBase64Decode( sB64Sou, sFile) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallBase64( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBase64Encode", LuaBase64Encode) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBase64Decode", LuaBase64Decode) ;
return bOk ;
}
+66 -8
View File
@@ -21,6 +21,21 @@
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaInitBeamMgr( lua_State* L)
{
// 1 o nessun parametro : [nFlag]
int nFlag = EIB_FLAG_NONE ;
LuaGetParam( L, 1, nFlag) ;
LuaClearStack( L) ;
// inizializzo in gestore di travi e pareti
bool bOk = ExeInitBeamMgr( nFlag) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamCreatePart( lua_State* L)
@@ -151,7 +166,7 @@ LuaBeamGetSideData( lua_State* L)
int nSide ;
LuaCheckParam( L, 1, nSide)
LuaClearStack( L) ;
// imposto le dimensioni al pezzo corrente
// restituisce i dati della faccia indicata del pezzo corrente
Frame3d frRef ;
double dLength, dWidth, dHeight ;
bool bOk = ExeBeamGetSideData( nSide, frRef, dLength, dWidth, dHeight) ;
@@ -173,7 +188,7 @@ LuaBeamGetSideData( lua_State* L)
static int
LuaBeamAddProcess( lua_State* L)
{
// 9 o 10 o 11 o 12 parametri : nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar [, nCrv, nCrv2] [, bUpdate]
// 9 o 10 o 11 o 12 parametri : nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar, vsUAtt [, nCrv] [, nCrv2] [, bUpdate]
int nGroup ;
LuaCheckParam( L, 1, nGroup)
int nProc ;
@@ -198,6 +213,8 @@ LuaBeamAddProcess( lua_State* L)
if ( LuaGetParam( L, 10, nCrvId) &&
LuaGetParam( L, 11, nCrv2Id))
LuaGetParam( L, 12, bUpdate) ;
else if ( LuaGetParam( L, 10, nCrvId))
LuaGetParam( L, 11, bUpdate) ;
else
LuaGetParam( L, 10, bUpdate) ;
LuaClearStack( L) ;
@@ -215,7 +232,7 @@ LuaBeamAddProcess( lua_State* L)
static int
LuaBeamModifyProcess( lua_State* L)
{
// 10 o 11 o 12 o 13 parametri : nGeomId, nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar [, nCrv, nCrv2] [, bUpdate]
// 10 o 11 o 12 o 13 parametri : nGeomId, nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar, vsUAtt [, nCrv, nCrv2] [, bUpdate]
int nGeomId ;
LuaCheckParam( L, 1, nGeomId)
int nGroup ;
@@ -242,6 +259,8 @@ LuaBeamModifyProcess( lua_State* L)
if ( LuaGetParam( L, 11, nCrvId) &&
LuaGetParam( L, 12, nCrv2Id))
LuaGetParam( L, 13, bUpdate) ;
else if ( LuaGetParam( L, 11, nCrvId))
LuaGetParam( L, 12, bUpdate) ;
else
LuaGetParam( L, 11, bUpdate) ;
LuaClearStack( L) ;
@@ -291,6 +310,38 @@ LuaBeamEnableProcess( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamCalcAllSolids( lua_State* L)
{
// 1 o 2 parametri : bShow [,bRecalc]
bool bShow ;
LuaCheckParam( L, 1, bShow)
bool bRecalc = false ;
LuaGetParam( L, 2, bRecalc) ;
LuaClearStack( L) ;
// eseguo calcolo dei solidi di tutte le travi
bool bOk = ExeBeamCalcAllSolids( bShow, bRecalc) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamShowAllSolids( lua_State* L)
{
// 1 parametro : bShow
bool bShow ;
LuaCheckParam( L, 1, bShow)
LuaClearStack( L) ;
// aggiorno stato di visualizzazione dei solidi di tutte le travi
bool bOk = ExeBeamShowAllSolids( bShow) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamCalcSolid( lua_State* L)
@@ -347,10 +398,12 @@ LuaBeamShowSolid( lua_State* L)
static int
LuaBeamGetBuildingIsOn( lua_State* L)
{
// Nessun parametro
// 1 o nessun parametro : [nAssGrpId]
int nAssGrpId = GDB_ID_NULL ;
LuaGetParam( L, 1, nAssGrpId) ;
LuaClearStack( L) ;
// restituisco identificativo del solido della trave
bool bOk = ExeBeamGetBuildingIsOn() ;
bool bOk = ExeBeamGetBuildingIsOn( nAssGrpId) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -360,12 +413,14 @@ LuaBeamGetBuildingIsOn( lua_State* L)
static int
LuaBeamShowBuilding( lua_State* L)
{
// 1 parametro : bShow
// 1 o 2 parametri : [nAssGrpId,] bShow
int nAssGrpId = GDB_ID_NULL ;
int nPar = ( LuaGetParam( L, 1, nAssGrpId) ? 2 : 1) ;
bool bShow ;
LuaCheckParam( L, 1, bShow)
LuaCheckParam( L, nPar, bShow)
LuaClearStack( L) ;
// attivo o disattivo la visualizzazione l'assemblaggio
bool bOk = ExeBeamShowBuilding( bShow) ;
bool bOk = ExeBeamShowBuilding( nAssGrpId, bShow) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -376,6 +431,7 @@ bool
LuaInstallBeamMgr( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtInitBeamMgr", LuaInitBeamMgr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamCreatePart", LuaBeamCreatePart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamSetPart", LuaBeamSetPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamErasePart", LuaBeamErasePart) ;
@@ -389,6 +445,8 @@ LuaInstallBeamMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamModifyProcess", LuaBeamModifyProcess) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamEraseProcess", LuaBeamEraseProcess) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamEnableProcess", LuaBeamEnableProcess) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamCalcAllSolids", LuaBeamCalcAllSolids) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamShowAllSolids", LuaBeamShowAllSolids) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamCalcSolid", LuaBeamCalcSolid) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamGetSolid", LuaBeamGetSolid) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamShowSolid", LuaBeamShowSolid) ;
+22 -22
View File
@@ -728,6 +728,27 @@ LuaCreateCurveBezierFromArc( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateCurveBezierFromCurve( lua_State* L)
{
// 2 o 3 parametri : ParentId, nCrvId [, bRat]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId)
bool bRat = true ;
LuaGetParam( L, 3, bRat) ;
// creo la versione bezier della curva
int nId = ExeCreateCurveBezierFromCurve( nParentId, nCrvId, bRat) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateCurveCompo( lua_State* L)
@@ -1091,27 +1112,6 @@ LuaCreateCirclesAlongCurve( lua_State* L)
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateCurveBezierForm( lua_State* L)
{
// 2 o 3 parametri : ParentId, nCrvId [, nDeg]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId)
int nDeg = 3 ;
LuaGetParam( L, 3, nDeg) ;
// creo la versione bezier della curva
int nId = ExeCreateCurveBezierForm( nParentId, nCrvId, nDeg) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
@@ -1143,6 +1143,7 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezier", LuaCreateCurveBezier) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierRat", LuaCreateCurveBezierRational) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierFromArc", LuaCreateCurveBezierFromArc) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierFromCurve", LuaCreateCurveBezierFromCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompo", LuaCreateCurveCompo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoByChain", LuaCreateCurveCompoByChain) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoByReorder", LuaCreateCurveCompoByReorder) ;
@@ -1156,6 +1157,5 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromApothem", LuaCreatePolygonFromApothem) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromSide", LuaCreatePolygonFromSide) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCirclesAlongCurve", LuaCreateCirclesAlongCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierForm", LuaCreateCurveBezierForm) ;
return bOk ;
}
+163 -5
View File
@@ -15,6 +15,7 @@
#include "stdafx.h"
#include "LUA.h"
#include "EXE_Const.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
@@ -417,6 +418,60 @@ LuaCreateSurfTmSphere( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmPyramidFrustum( lua_State* L)
{
// 6 parametri : ParentId, dBaseDimX, dBaseDimY, dTopDimX, dTopDimY, dHeight
int nParentId ;
LuaCheckParam( L, 1, nParentId)
double dBaseDimX ;
LuaCheckParam( L, 2, dBaseDimX)
double dBaseDimY ;
LuaCheckParam( L, 3, dBaseDimY)
double dTopDimX ;
LuaCheckParam( L, 4, dTopDimX)
double dTopDimY ;
LuaCheckParam( L, 5, dTopDimY)
double dHeight ;
LuaCheckParam( L, 6, dHeight)
LuaClearStack( L) ;
// creo STM cilindro
int nId = ExeCreateSurfTmPyramidFrustum( nParentId, dBaseDimX, dBaseDimY, dTopDimX, dTopDimY, dHeight) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmConeFrustum( lua_State* L)
{
// 4 o 5 parametri : ParentId, dBaseRad, dTopRad, dHeight [, dTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
double dBaseRad ;
LuaCheckParam( L, 2, dBaseRad)
double dTopRad ;
LuaCheckParam( L, 3, dTopRad)
double dHeight ;
LuaCheckParam( L, 4, dHeight)
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, 5, dLinTol) ;
LuaClearStack( L) ;
// creo STM cilindro
int nId = ExeCreateSurfTmConeFrustum( nParentId, dBaseRad, dTopRad, dHeight, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmTriangle( lua_State* L)
@@ -469,6 +524,72 @@ LuaCreateSurfTmRectangle( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmByPolygon( lua_State* L)
{
// 2 o 3 parametri : ParentId, ptPs [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
PNTVECTOR vPnt ;
LuaCheckParam( L, 2, vPnt)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 3, nRefType) ;
LuaClearStack( L) ;
// creo una polilinea a partire dai punti
PolyLine PL ;
for ( size_t i = 0 ; i < vPnt.size() ; ++ i) {
if ( ! vPnt[i].IsValid())
break ;
PL.AddUPoint( double( i), vPnt[i]) ;
}
PL.Close() ;
// creo la SurfTriMesh del poligono
int nId = ExeCreateSurfTmByPolygon( nParentId, PL, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmByPolygonWithHoles( lua_State* L)
{
// 2 o 3 parametri : ParentId, ptPs [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
PNTVECTOR vPnt ;
LuaCheckParam( L, 2, vPnt)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 3, nRefType) ;
LuaClearStack( L) ;
// creo un vettore di polilinee a partire dai punti
POLYLINEVECTOR vPL ;
vPL.push_back( {}) ;
for ( size_t i = 0 ; i < vPnt.size() ; ++ i) {
if ( vPnt[i].IsValid())
vPL.back().AddUPoint( double( i), vPnt[i]) ;
else {
if ( ! vPL.empty())
vPL.back().Close() ;
vPL.push_back( {}) ;
}
}
if ( ! vPL.empty())
vPL.back().Close() ;
// creo la SurfTriMesh del poligono
int nId = ExeCreateSurfTmByPolygonWithHoles( nParentId, vPL, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmByFlatContour( lua_State* L)
@@ -1044,7 +1165,7 @@ LuaCreateSurfBzByRegion( lua_State* L)
static int
LuaCreateSurfBzByExtrusion( lua_State* L)
{
// 3 o 4 o 5 o 6 parametri : ParentId, CrvId, vtExtr [, bool bCapEnds] [, dTol] [, nRefType]
// 3 o 4 o 5 o 6 parametri : ParentId, CrvId, vtExtr [, bool bCapEnds] [, dTol] [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
@@ -1061,14 +1182,16 @@ LuaCreateSurfBzByExtrusion( lua_State* L)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, nPar, nRefType) ;
LuaClearStack( L) ;
// creo STM estrudendo uno o più percorsi, se piani si possono mettere i tappi
int nId = ExeCreateSurfBzByExtrusion( nParentId, nCrvId, vtExtr, bCapEnds, dLinTol, nRefType) ;
// creo SurfBezier estrudendo un percorso, se piano si possono mettere i tappi
int nCount = 0 ;
int nId = ExeCreateSurfBzByExtrusion( nParentId, nCrvId, vtExtr, bCapEnds, dLinTol, nRefType, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//-------------------------------------------------------------------------------
@@ -1226,7 +1349,7 @@ LuaCreateSurfBzRuled( lua_State* L)
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, nPar, dLinTol) ;
LuaClearStack( L) ;
// creo STM riempiendo un contorno piano
// creo una surf bezier come rigata tra le due curve passate
int nId = ExeCreateSurfBzRuled( nParentId, nCrvId1, nCrvId2, nRuledType, bCapEnds, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
@@ -1236,6 +1359,36 @@ LuaCreateSurfBzRuled( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzRuledGuided( lua_State* L)
{
// 4 o 5 o 6 parametri : ParentId, CrvId1, CrvId2 nLayGuides [, bCapEnds] [, dTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId1 ;
LuaCheckParam( L, 2, nCrvId1)
int nCrvId2 ;
LuaCheckParam( L, 3, nCrvId2)
int nLayGuides ;
LuaCheckParam( L, 4, nLayGuides)
bool bCapEnds = false ;
int nPar = 5 ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, nPar, dLinTol) ;
LuaClearStack( L) ;
// creo una surf bezier come rigata tra le due curve passate, usando le isocurve nel layer nLayIso
int nId = ExeCreateSurfBzRuledGuided( nParentId, nCrvId1, nCrvId2, nLayGuides, bCapEnds, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzSkinned( lua_State* L)
@@ -1317,8 +1470,12 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCylinder", LuaCreateSurfTmCylinder) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCone", LuaCreateSurfTmCone) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSphere", LuaCreateSurfTmSphere) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPyramidFrustum", LuaCreateSurfTmPyramidFrustum) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmConeFrustum", LuaCreateSurfTmConeFrustum) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmTriangle", LuaCreateSurfTmTriangle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRectangle", LuaCreateSurfTmRectangle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByPolygon", LuaCreateSurfTmByPolygon) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByPolygonWithHoles", LuaCreateSurfTmByPolygonWithHoles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByFlatContour", LuaCreateSurfTmByFlatContour) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRegion", LuaCreateSurfTmByRegion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByExtrusion", LuaCreateSurfTmByExtrusion) ;
@@ -1345,6 +1502,7 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzByRevolve", LuaCreateSurfBzByRevolve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzByPointCurve", LuaCreateSurfBzByPointCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzRuled", LuaCreateSurfBzRuled) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzRuledGuided", LuaCreateSurfBzRuledGuided) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzSkinned", LuaCreateSurfBzSkinned) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzSwept", LuaCreateSurfBzSwept) ;
return bOk ;
+8 -36
View File
@@ -14,6 +14,7 @@
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
@@ -120,7 +121,7 @@ LuaCreateVolZmapByRegionExtrusion( lua_State* L)
static int
LuaCreateVolZmapFromSurfTm( lua_State* L)
{
// 3 o 4 parametri : ParentId, StmId, dPrec [, bTriDex]
// 3 o 4 o 5 parametri : ParentId, StmId, dPrec [, bTriDex] [, dExtraBox]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nStmId ;
@@ -128,10 +129,14 @@ LuaCreateVolZmapFromSurfTm( lua_State* L)
double dPrec ;
LuaCheckParam( L, 3, dPrec)
bool bTriDex = true ;
LuaGetParam( L, 4, bTriDex) ;
double dExtraBox = 0 ;
if ( LuaGetParam( L, 4, bTriDex))
LuaGetParam( L, 5, dExtraBox) ;
else
LuaGetParam( L, 4, dExtraBox) ;
LuaClearStack( L) ;
// creo VZM da superficie trimesh
int nId = ExeCreateVolZmapFromSurfTm( nParentId, nStmId, dPrec, bTriDex) ;
int nId = ExeCreateVolZmapFromSurfTm( nParentId, nStmId, dPrec, bTriDex, dExtraBox) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
@@ -140,37 +145,6 @@ LuaCreateVolZmapFromSurfTm( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaUpdateVolZmapByAddingSurfTm( lua_State* L)
{
// 2 parametri : nVolZmapId, StmId,
int nVolZmapId ;
LuaCheckParam( L, 1, nVolZmapId) ;
int nStmId ;
LuaCheckParam( L, 2, nStmId) ;
LuaClearStack( L) ;
bool bOk = ExeUpdateVolZmapByAddingSurfTm( nVolZmapId, nStmId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaUniformVolZmap( lua_State* L)
{
// 1 o 2 parametri : nVolZmapId [, dToler]
int nVolZmapId ;
LuaCheckParam( L, 1, nVolZmapId) ;
double dToler = EPS_SMALL ;
LuaGetParam( L, 2, dToler) ;
LuaClearStack( L) ;
bool bOk = ExeUniformVolZmap( nVolZmapId, dToler) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbCreateVol( LuaMgr& luaMgr)
@@ -180,7 +154,5 @@ LuaInstallGdbCreateVol( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapEmpty", LuaCreateVolZmapEmpty) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapByRegionExtrusion", LuaCreateVolZmapByRegionExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapFromSurfTm", LuaCreateVolZmapFromSurfTm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtUpdateVolZmapByAddingSurfTm", LuaUpdateVolZmapByAddingSurfTm ) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtUniformZmap", LuaUniformVolZmap) ;
return bOk ;
}
+11 -7
View File
@@ -558,7 +558,7 @@ LuaCurveCompoNormVersor( lua_State* L)
int nRefId = nId ;
LuaGetParam( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero l'angolo al centro della curva semplice indicizzata
// recupero il versore normale della curva semplice indicizzata (non nullo solo se arco)
Vector3d vtNorm ;
if ( ExeCurveCompoNormVersor( nId, nCrv, nRefId, vtNorm))
LuaSetParam( L, vtNorm) ;
@@ -571,13 +571,15 @@ LuaCurveCompoNormVersor( lua_State* L)
static int
LuaCurveCompoGetTempProp( lua_State* L)
{
// 1 parametro : Id
// 1 o 2 parametri : Id [, nPropInd]
int nId ;
LuaCheckParam( L, 1, nId)
int nPropInd = 0 ;
LuaGetParam( L, 2, nPropInd) ;
LuaClearStack( L) ;
// recupero l'angolo al centro della curva semplice indicizzata
// recupero il vettore delle proprietà temporanee di indice dato
INTVECTOR vProp ;
if ( ExeCurveCompoGetTempProp( nId, vProp, 0))
if ( ExeCurveCompoGetTempProp( nId, vProp, nPropInd))
LuaSetParam( L, vProp) ;
else
LuaSetParam( L) ;
@@ -588,13 +590,15 @@ LuaCurveCompoGetTempProp( lua_State* L)
static int
LuaCurveCompoGetTempParam( lua_State* L)
{
// 1 parametro : Id
// 1 o 2 parametri : Id [, nParamInd]
int nId ;
LuaCheckParam( L, 1, nId)
int nParamInd = 0 ;
LuaGetParam( L, 2, nParamInd) ;
LuaClearStack( L) ;
// recupero l'angolo al centro della curva semplice indicizzata
// recupero il vettore dei parametri temporanei di indice dato
DBLVECTOR vParam ;
if ( ExeCurveCompoGetTempParam( nId, vParam, 0))
if ( ExeCurveCompoGetTempParam( nId, vParam, nParamInd))
LuaSetParam( L, vParam) ;
else
LuaSetParam( L) ;
+52 -2
View File
@@ -499,19 +499,21 @@ LuaSurfTmGetFacetOutlineInfo( lua_State* L)
int nStatus ;
BOOLVECTOR vbOpen ;
INTVECTOR vnAdj ;
PNTVECTOR vptStart ;
VCT3DVECTOR vvtNorm ;
DBLVECTOR vdElev ;
DBLVECTOR vdLen ;
bool bOk = ExeSurfTmGetFacetOutlineInfo( nId, nFacet, nRefId, nStatus, vbOpen, vnAdj, vdLen, vvtNorm, vdElev) ;
bool bOk = ExeSurfTmGetFacetOutlineInfo( nId, nFacet, nRefId, nStatus, vbOpen, vnAdj, vdLen, vptStart, vvtNorm, vdElev) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, nStatus) ;
LuaSetParam( L, vbOpen) ;
LuaSetParam( L, vnAdj) ;
LuaSetParam( L, vdLen) ;
LuaSetParam( L, vptStart) ;
LuaSetParam( L, vvtNorm) ;
LuaSetParam( L, vdElev) ;
return 6 ;
return 7 ;
}
else {
LuaSetParam( L) ;
@@ -904,6 +906,28 @@ LuaExtractSurfTmFacetLoops( lua_State* L)
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaExtractSurfTmTriaLoop( lua_State* L)
{
// 3 parametri : nId, nT, nDestGrpId
int nId ;
LuaCheckParam( L, 1, nId)
int nT ;
LuaCheckParam( L, 2, nT)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId)
LuaClearStack( L) ;
// recupero i contorni della superficie
int nNewId = ExeExtractSurfTmTriaLoop( nId, nT, nDestGrpId) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaCopySurfTmFacet( lua_State* L)
@@ -953,6 +977,30 @@ LuaSurfTmGetEdges( lua_State* L)
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetCurvature( lua_State* L)
{
// 2 parametri : nStmId, nIndV
int nStmId ;
LuaCheckParam( L, 1, nStmId) ;
int nIndVertex ;
LuaCheckParam( L, 2, nIndVertex) ;
LuaClearStack( L) ;
double dK1 = 0., dK2 = 0. ;
Vector3d vtK1 = V_NULL, vtK2 = V_NULL ;
bool bOk = ExeSurfTmGetCurvatures( nStmId, nIndVertex, dK1, vtK1, dK2, vtK2) ;
LuaSetParam( L, bOk) ;
if ( bOk) {
LuaSetParam( L, dK1) ;
LuaSetParam( L, vtK1) ;
LuaSetParam( L, dK2) ;
LuaSetParam( L, vtK2) ;
return 5 ;
}
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfBezierGetPoint( lua_State* L)
@@ -1255,8 +1303,10 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfTmSilhouette", LuaGetSurfTmSilhouette) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfTmParSilhouettes", LuaGetSurfTmParSilhouettes) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmFacetLoops", LuaExtractSurfTmFacetLoops) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmTriaLoop", LuaExtractSurfTmTriaLoop) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopySurfTmFacet", LuaCopySurfTmFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetEdges", LuaSurfTmGetEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetCurvature", LuaSurfTmGetCurvature) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPoint", LuaSurfBezierGetPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPointD1", LuaSurfBezierGetPointD1) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPointNrmD1", LuaSurfBezierGetPointNrmD1) ;
+27 -10
View File
@@ -586,6 +586,22 @@ LuaModifyArcRadius( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaModifyArcAngCenter( lua_State* L)
{
// 2 parametri : Id, dNewAngCenter
int nId ;
LuaCheckParam( L, 1, nId)
double dNewAngCenter ;
LuaCheckParam( L, 2, dNewAngCenter)
LuaClearStack( L) ;
// modifica dell'angolo al centro
bool bOk = ExeModifyArcAngCenter( nId, dNewAngCenter) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaModifyArcToExplementary( lua_State* L)
@@ -989,11 +1005,11 @@ LuaReorderCurvesInGroup( lua_State* L)
static int
LuaProjectCurveOnSurf( lua_State* L)
{
// 4, 5, 6, 7 o 8 parametri : nCurveId, nSurfTmId, vtDir, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromProj] [, nRefType]]
// 4, 5, 6, 7 o 8 parametri : nCurveId, vSurfId, vtDir, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromProj] [, nRefType]]
int nCurveId ;
LuaCheckParam( L, 1, nCurveId)
int nSurfTmId ;
LuaCheckParam( L, 2, nSurfTmId)
INTVECTOR vSurfId ;
LuaCheckParam( L, 2, vSurfId)
Vector3d vtDir ;
LuaCheckParam( L, 3, vtDir)
int nDestGrpId ;
@@ -1007,8 +1023,8 @@ LuaProjectCurveOnSurf( lua_State* L)
LuaGetParam( L, 7, bDirFromProj))
LuaGetParam( L, 8, nRefType) ;
LuaClearStack( L) ;
// proietto la curva su una superficie secondo la direzione data
bool bOk = ExeProjectCurveOnSurf( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, nRefType) ;
// proietto la curva su una o più superfici secondo la direzione data
bool bOk = ExeProjectCurveOnSurf( nCurveId, vSurfId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, nRefType) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
@@ -1017,11 +1033,11 @@ LuaProjectCurveOnSurf( lua_State* L)
static int
LuaProjectCurveOnSurfExt( lua_State* L)
{
// 4, 5, 6 o 7 parametri : nCurveId, nSurfTmId, nGuideId, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromGuide]]
// 4, 5, 6 o 7 parametri : nCurveId, vSurfId, nGuideId, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromGuide]]
int nCurveId ;
LuaCheckParam( L, 1, nCurveId)
int nSurfTmId ;
LuaCheckParam( L, 2, nSurfTmId)
INTVECTOR vSurfId ;
LuaCheckParam( L, 2, vSurfId)
int nGuideId ;
LuaCheckParam( L, 3, nGuideId)
int nDestGrpId ;
@@ -1033,8 +1049,8 @@ LuaProjectCurveOnSurfExt( lua_State* L)
LuaGetParam( L, 6, dMaxSegmLen))
LuaGetParam( L, 7, bDirFromGuide) ;
LuaClearStack( L) ;
// proietto la curva su una superficie secondo la direzione verso la guida
bool bOk = ExeProjectCurveOnSurfExt( nCurveId, nSurfTmId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
// proietto la curva su una o più superfici secondo la direzione verso la guida
bool bOk = ExeProjectCurveOnSurfExt( nCurveId, vSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
@@ -1214,6 +1230,7 @@ LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitCurveAtCorners", LuaSplitCurveAtCorners) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitCurveAtSelfInters", LuaSplitCurveAtSelfInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcRadius", LuaModifyArcRadius) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcAngCenter", LuaModifyArcAngCenter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcToExplementary", LuaModifyArcToExplementary) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcByFlip", LuaModifyArcByFlip) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCloseCurveCompo", LuaCloseCurveCompo) ;
+88 -41
View File
@@ -18,6 +18,7 @@
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkSurfTriMeshAux.h"
#include "/EgtDev/Include/EGkGdbConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
@@ -325,29 +326,6 @@ LuaCutSurfTmPlane( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCutSurfBzPlane( lua_State* L)
{
// 4 o 5 parametri : Id, ptOn, vtN, bSaveOnEq [, nRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptOn ;
LuaCheckParam( L, 2, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 3, vtN)
bool bSaveOnEq ;
LuaGetParam( L, 4, bSaveOnEq) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// taglio la superficie con ilpiano
bool bOk = ExeCutSurfBzPlane( nId, ptOn, vtN, bSaveOnEq, nRefType) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCutSurfTmClosedCurve( lua_State* L)
@@ -583,22 +561,6 @@ LuaSurfTmGetShowEdges( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfBzTrim( lua_State* L)
{
// 2 parametri : nId, nCutterId
int nId ;
LuaCheckParam( L, 1, nId)
int nCutterId ;
LuaCheckParam( L, 2, nCutterId)
LuaClearStack( L) ;
// taglio la prima superficie in base alla seconda
bool bOk = ExeSurfBzTrim( nId, nCutterId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmSetSmoothAng( lua_State* L)
@@ -615,6 +577,89 @@ LuaSurfTmSetSmoothAng( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmOffset( lua_State* L)
{
// 4 o 5 parametri : ParentId, vIds, dOffs, dLinTol [, nType]
int nParentId ;
LuaGetParam( L, 1, nParentId) ;
INTVECTOR vIds ;
LuaCheckParam( L, 2, vIds)
double dOffs ;
LuaCheckParam( L, 3, dOffs)
double dLinTol ;
LuaCheckParam( L, 4, dLinTol) ;
int nType = STMOFF_FILLET ;
LuaGetParam( L, 5, nType) ;
LuaClearStack( L) ;
// interseco la prima superficie con la seconda
int nId = ExeSurfTmOffset( nParentId, vIds, dOffs, dLinTol, nType) ;
LuaSetParam( L, nId) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmThickeningOffset( lua_State* L)
{
// 4 o 5 parametri : ParentId, vIds, dOffs, dLinTol [, nType]
int nParentId ;
LuaGetParam( L, 1, nParentId) ;
INTVECTOR vIds ;
LuaCheckParam( L, 2, vIds)
double dOffs ;
LuaCheckParam( L, 3, dOffs)
double dLinTol ;
LuaCheckParam( L, 4, dLinTol) ;
int nType = STMOFF_FILLET ;
LuaGetParam( L, 5, nType) ;
LuaClearStack( L) ;
// interseco la prima superficie con la seconda
int nId = ExeSurfTmThickeningOffset( nParentId, vIds, dOffs, dLinTol, nType) ;
LuaSetParam( L, nId) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCutSurfBzPlane( lua_State* L)
{
// 4 o 5 parametri : Id, ptOn, vtN, bSaveOnEq [, nRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptOn ;
LuaCheckParam( L, 2, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 3, vtN)
bool bSaveOnEq ;
LuaGetParam( L, 4, bSaveOnEq) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// taglio la superficie con ilpiano
bool bOk = ExeCutSurfBzPlane( nId, ptOn, vtN, bSaveOnEq, nRefType) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfBzTrim( lua_State* L)
{
// 2 parametri : nId, nCutterId
int nId ;
LuaCheckParam( L, 1, nId)
int nCutterId ;
LuaCheckParam( L, 2, nCutterId)
LuaClearStack( L) ;
// taglio la prima superficie in base alla seconda
bool bOk = ExeSurfBzTrim( nId, nCutterId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbModifySurf( LuaMgr& luaMgr)
@@ -636,7 +681,6 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwapFacets", LuaSurfTmSwapFacets) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemovePart", LuaSurfTmRemovePart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmPlane", LuaCutSurfTmPlane) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfBzPlane", LuaCutSurfBzPlane) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmClosedCurve", LuaCutSurfTmClosedCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmAdd", LuaSurfTmAdd) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtract", LuaSurfTmSubtract) ;
@@ -649,7 +693,10 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetShowEdges", LuaSurfTmSetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetShowEdges", LuaSurfTmGetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzTrim", LuaSurfBzTrim) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetSmoothAng", LuaSurfTmSetSmoothAng) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmOffset", LuaSurfTmOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmThickeningOffset", LuaSurfTmThickeningOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfBzPlane", LuaCutSurfBzPlane) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzTrim", LuaSurfBzTrim) ;
return bOk ;
}
+56 -1
View File
@@ -378,13 +378,65 @@ LuaCutVolZmapPlane( lua_State* L)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// taglio la superficie con ilpiano
// taglio la superficie con il piano
bool bOk = ExeCutVolZmapPlane( nId, ptOn, vtN, nRefType) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaUpdateVolZmapByAddingSurfTm( lua_State* L)
{
// 2 parametri : nVolZmapId, StmId,
int nVolZmapId ;
LuaCheckParam( L, 1, nVolZmapId) ;
int nStmId ;
LuaCheckParam( L, 2, nStmId) ;
LuaClearStack( L) ;
bool bOk = ExeUpdateVolZmapByAddingSurfTm( nVolZmapId, nStmId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaUniformVolZmap( lua_State* L)
{
// 2 o 3 o 4 parametri : nVolZmapId, dToler [, bExtensionFirst] [, nToolNum]
int nVolZmapId ;
LuaCheckParam( L, 1, nVolZmapId) ;
double dToler ;
LuaCheckParam( L, 2, dToler) ;
bool bExtensionFirst = true ;
LuaGetParam( L, 3, bExtensionFirst) ;
int nToolNum = 0 ;
LuaGetParam( L, 4, nToolNum) ;
LuaClearStack( L) ;
bool bOk = ExeUniformVolZmap( nVolZmapId, dToler, bExtensionFirst, nToolNum) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaVolZmapOffset( lua_State* L)
{
// 3 parametri : Id, dDist, nType
int nId ;
LuaCheckParam( L, 1, nId)
double dDist ;
LuaCheckParam( L, 2, dDist)
int nType = VolZmapOffset::FILLET ;
LuaGetParam( L, 3, nType) ;
LuaClearStack( L) ;
// eseguo l'offset della regione
bool bOk = ExeVolZMapOffset( nId, dDist, nType) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbModifyVol( LuaMgr& luaMgr)
@@ -405,5 +457,8 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetToolOutline", LuaVolZmapGetToolOutline) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapMillingStep", LuaVolZmapMillingStep) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutVolZmapPlane", LuaCutVolZmapPlane) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtUpdateVolZmapByAddingSurfTm", LuaUpdateVolZmapByAddingSurfTm ) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtUniformVolZmap", LuaUniformVolZmap) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapOffset", LuaVolZmapOffset) ;
return bOk ;
}
+9 -9
View File
@@ -42,13 +42,13 @@ LuaCopyAttributes( lua_State* L)
static int
LuaSetLevel( lua_State* L)
{
// 2 parametri : nId, nLevel
int nId ;
LuaCheckParam( L, 1, nId)
// 2 parametri : Ids, nLevel
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
int nLevel ;
LuaCheckParam( L, 2, nLevel)
// imposto lo stato
bool bOk = ExeSetLevel( nId, nLevel) ;
bool bOk = ExeSetLevel( vId, nLevel) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -111,14 +111,14 @@ LuaGetCalcLevel( lua_State* L)
static int
LuaSetMode( lua_State* L)
{
// 2 parametri : nId, nMode
int nId ;
LuaCheckParam( L, 1, nId)
// 2 parametri : Ids, nMode
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
int nMode ;
LuaCheckParam( L, 2, nMode)
LuaClearStack( L) ;
// imposto il modo
bool bOk = ExeSetMode( nId, nMode) ;
bool bOk = ExeSetMode( vId, nMode) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -179,7 +179,7 @@ LuaGetCalcMode( lua_State* L)
static int
LuaSetStatus( lua_State* L)
{
// 2 parametri : Id, nStatus
// 2 parametri : Ids, nStatus
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
int nStatus ;
+54
View File
@@ -489,6 +489,32 @@ LuaCopy( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCopyEx( lua_State* L)
{
// 4 o 5 parametri : nSouCtx, SouId, nDestCtx, RefId [, nSonBeforeAfter]
int nSouCtx ;
LuaCheckParam( L, 1, nSouCtx)
int nSouId ;
LuaCheckParam( L, 2, nSouId)
int nDestCtx ;
LuaCheckParam( L, 3, nDestCtx)
int nRefId ;
LuaCheckParam( L, 4, nRefId)
int nSonBeforeAfter = GDB_LAST_SON ;
LuaGetParam( L, 5, nSonBeforeAfter) ;
LuaClearStack( L) ;
// eseguo la copia
int nNewId = ExeCopyEx( nSouCtx, nSouId, nDestCtx, nRefId, nSonBeforeAfter) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCopyGlob( lua_State* L)
@@ -511,6 +537,32 @@ LuaCopyGlob( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCopyGlobEx( lua_State* L)
{
// 4 o 5 parametri : nSouCtx, SouId, nDestCtx, RefId [, nSonBeforeAfter]
int nSouCtx ;
LuaCheckParam( L, 1, nSouCtx)
int nSouId ;
LuaCheckParam( L, 2, nSouId)
int nDestCtx ;
LuaCheckParam( L, 3, nDestCtx)
int nRefId ;
LuaCheckParam( L, 4, nRefId)
int nSonBeforeAfter = GDB_LAST_SON ;
LuaGetParam( L, 5, nSonBeforeAfter) ;
LuaClearStack( L) ;
// eseguo la copia
int nNewId = ExeCopyGlobEx( nSouCtx, nSouId, nDestCtx, nRefId, nSonBeforeAfter) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRelocate( lua_State* L)
@@ -663,7 +715,9 @@ LuaInstallGdbObjects( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetBBoxGlob", LuaGetBBoxGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetBBoxRef", LuaGetBBoxRef) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopy", LuaCopy) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyEx", LuaCopyEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyGlob", LuaCopyGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyGlobEx", LuaCopyGlobEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRelocate", LuaRelocate) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRelocateGlob", LuaRelocateGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGroupSwap", LuaGroupSwap) ;
+41 -7
View File
@@ -30,8 +30,8 @@
#include "/EgtDev/Include/EgtIniFile.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "Windowsx.h"
#include "shlobj.h"
#include <Windowsx.h>
#include <shlobj.h>
using namespace std ;
@@ -88,12 +88,14 @@ LuaEvalNumExpr( lua_State* L)
static int
LuaPause( lua_State* L)
{
// 1 parametro : numero di millisecondi
// 1 o 2 parametri : numero di millisecondi [, bForced]
int nTime ;
LuaCheckParam( L, 1, nTime)
bool bForced = false ;
LuaGetParam( L, 2, bForced) ;
LuaClearStack( L) ;
// se abilitata UI, controllo la durata della pausa e la eseguo
if ( ExeGetEnableUI()) {
// se forzata o abilitata UI, controllo la durata della pausa e la eseguo
if ( bForced || ExeGetEnableUI()) {
const int MIN_TIME = 0 ;
const int MAX_TIME = 10000 ;
if ( nTime < MIN_TIME)
@@ -1097,6 +1099,36 @@ LuaVerifyKeyOption( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetDefaultFont( lua_State* L)
{
// 1 parametro : sDefaultFont
string sDefaultFont ;
LuaCheckParam( L, 1, sDefaultFont)
LuaClearStack( L) ;
// imposta il font di default
bool bOk = ExeSetFont( "", sDefaultFont) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetDefaultFont( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupera il font di cefault
string sDefaultFont ;
bool bOk = ExeGetDefaultFont( sDefaultFont) ;
if ( bOk)
LuaSetParam( L, sDefaultFont) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaWinExec( lua_State* L)
@@ -1298,7 +1330,7 @@ CALLBACK DialogBoxProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam
break ;
}
}
// continua di seguito
[[fallthrough]] ;
case IDCANCEL :
EndDialog( hwndDlg, wParam) ;
return TRUE ;
@@ -1399,11 +1431,13 @@ LuaInstallGeneral( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLanguage", LuaGetLanguage) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtMsg", LuaGetMsg) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVerifyKeyOption", LuaVerifyKeyOption) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetDefaultFont", LuaSetDefaultFont) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetDefaultFont", LuaGetDefaultFont) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtWinExec", LuaWinExec) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCloseExe", LuaCloseExe) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateMutex", LuaCreateMutex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtReleaseMutex", LuaReleaseMutex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ;
return bOk ;
}
+31
View File
@@ -111,6 +111,36 @@ LuaPointSurfTmDist( lua_State* L)
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaPointSurfBzDist( lua_State* L)
{
// 2 o 3 parametri : ptP, nSbzId, [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
int nId ;
LuaCheckParam( L, 2, nId)
int nRefType = nId ;
LuaGetParam( L, 3, nRefType) ;
LuaClearStack( L) ;
// calcolo la distanza
double dDist ;
Point3d ptMin ;
Vector3d vtN ;
bool bOk = ExePointSurfBzDist( ptP, nId, nRefType, &dDist, ptMin, vtN) ;
if ( bOk) {
LuaSetParam( L, dDist) ;
LuaSetParam( L, ptMin) ;
LuaSetParam( L, vtN) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGeoDist( LuaMgr& luaMgr)
@@ -119,5 +149,6 @@ LuaInstallGeoDist( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtPointCurveDist", LuaPointCurveDist) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPointCurveDistSide", LuaPointCurveDistSide) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPointSurfTmDist", LuaPointSurfTmDist) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPointSurfBzDist", LuaPointSurfBzDist) ;
return bOk ;
}
+10 -8
View File
@@ -312,16 +312,16 @@ LuaSaveFile( lua_State* L)
static int
LuaSaveObjToFile( lua_State* L)
{
// 2 o 3 parametri : nId, path del file [, flag]
int nId ;
LuaCheckParam( L, 1, nId)
// 2 o 3 parametri : vId, path del file [, flag]
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
string sFilePath ;
LuaCheckParam( L, 2, sFilePath)
int nFlag = GDB_SV_CMPTXT ;
LuaGetParam( L, 3, nFlag) ;
LuaClearStack( L) ;
// copio il gruppo nel file
bool bOk = ExeSaveObjToFile( nId, sFilePath, nFlag) ;
bool bOk = ExeSaveObjToFile( vId, sFilePath, nFlag) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -331,16 +331,18 @@ LuaSaveObjToFile( lua_State* L)
static int
LuaSaveMachGroupToFile( lua_State* L)
{
// 2 o 3 parametri : nMGroupId, path del file [, flag]
// 2, 3 o 4 parametri : nMGroupId, [ vPlusId,] sFilePath [, nFlag]
int nMGroupId ;
LuaCheckParam( L, 1, nMGroupId)
INTVECTOR vPlusId ;
int nOffs = ( LuaGetParam( L, 2, vPlusId) ?1 : 0) ;
string sFilePath ;
LuaCheckParam( L, 2, sFilePath)
LuaCheckParam( L, 2 + nOffs, sFilePath)
int nFlag = GDB_SV_CMPTXT ;
LuaGetParam( L, 3, nFlag) ;
LuaGetParam( L, 3 + nOffs, nFlag) ;
LuaClearStack( L) ;
// copio il gruppo nel file
bool bOk = ExeSaveMachGroupToFile( nMGroupId, sFilePath, nFlag) ;
bool bOk = ExeSaveMachGroupToFile( nMGroupId, vPlusId, sFilePath, nFlag) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
+83 -27
View File
@@ -15,6 +15,7 @@
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EMkToolConst.h"
#include "/EgtDev/Include/EMkMachiningConst.h"
#include "/EgtDev/Include/EGkGdbConst.h"
@@ -557,22 +558,20 @@ LuaAddRawPartWithPart( lua_State* L)
static int
LuaModifyRawPart( lua_State* L)
{
// 6 parametri : nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol
// 5 parametri : nRawId, nCrvId, dOverMat, dHeight, cCol
int nRawId ;
LuaCheckParam( L, 1, nRawId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId)
double dOverMat ;
LuaCheckParam( L, 3, dOverMat)
double dZmin ;
LuaCheckParam( L, 4, dZmin)
double dHeight ;
LuaCheckParam( L, 5, dHeight)
LuaCheckParam( L, 4, dHeight)
Color cCol ;
LuaCheckParam( L, 6, cCol)
LuaCheckParam( L, 5, cCol)
LuaClearStack( L) ;
// modifico le dimensioni del grezzo
bool bOk = ExeModifyRawPart( nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol) ;
bool bOk = ExeModifyRawPart( nRawId, nCrvId, dOverMat, dHeight, cCol) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -2286,10 +2285,12 @@ LuaGetPrevOperation( lua_State* L)
static int
LuaGetFirstActiveOperation( lua_State* L)
{
// nessun parametro
// nessuno o 1 parametro : [bNeedMachNotEmpty]
bool bNeedMachNotEmpty = false ;
LuaGetParam( L, 1, bNeedMachNotEmpty) ;
LuaClearStack( L) ;
// recupero la prima operazione attiva della macchinata corrente
int nId = ExeGetFirstActiveOperation() ;
int nId = ExeGetFirstActiveOperation( bNeedMachNotEmpty) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
@@ -2302,12 +2303,14 @@ LuaGetFirstActiveOperation( lua_State* L)
static int
LuaGetNextActiveOperation( lua_State* L)
{
// 1 parametro : nId
// 1 o 2 parametri : nId [, bNeedMachNotEmpty]
int nId ;
LuaCheckParam( L, 1, nId)
bool bNeedMachNotEmpty = false ;
LuaGetParam( L, 2, bNeedMachNotEmpty) ;
LuaClearStack( L) ;
// recupero la successiva operazione attiva della macchinata corrente
int nNextId = ExeGetNextActiveOperation( nId) ;
int nNextId = ExeGetNextActiveOperation( nId, bNeedMachNotEmpty) ;
// restituisco il risultato
if ( nNextId != GDB_ID_NULL)
LuaSetParam( L, nNextId) ;
@@ -2320,10 +2323,12 @@ LuaGetNextActiveOperation( lua_State* L)
static int
LuaGetLastActiveOperation( lua_State* L)
{
// nessun parametro
// nessuno o 1 parametro : [bNeedMachNotEmpty]
bool bNeedMachNotEmpty = false ;
LuaGetParam( L, 1, bNeedMachNotEmpty) ;
LuaClearStack( L) ;
// recupero l'ultima operazione attiva della macchinata corrente
int nId = ExeGetLastActiveOperation() ;
int nId = ExeGetLastActiveOperation( bNeedMachNotEmpty) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
@@ -2336,12 +2341,14 @@ LuaGetLastActiveOperation( lua_State* L)
static int
LuaGetPrevActiveOperation( lua_State* L)
{
// 1 parametro : nId
// 1 o 2 parametri : nId [, bNeedMachNotEmpty]
int nId ;
LuaCheckParam( L, 1, nId)
bool bNeedMachNotEmpty = false ;
LuaGetParam( L, 2, bNeedMachNotEmpty) ;
LuaClearStack( L) ;
// recupero la precedente operazione attiva della macchinata corrente
int nNextId = ExeGetPrevActiveOperation( nId) ;
int nNextId = ExeGetPrevActiveOperation( nId, bNeedMachNotEmpty) ;
// restituisco il risultato
if ( nNextId != GDB_ID_NULL)
LuaSetParam( L, nNextId) ;
@@ -2438,12 +2445,14 @@ LuaGetOperationId( lua_State* L)
static int
LuaIsOperationEmpty( lua_State* L)
{
// 1 parametro : nId
// 1 o 2 parametri : nId [, nEmptyType]
int nId ;
LuaCheckParam( L, 1, nId)
int nEmptyType = EMP_NEED_GEOM ;
LuaGetParam( L, 2, nEmptyType) ;
LuaClearStack( L) ;
// recupero lo stato della operazione indicata della macchinata corrente
bool bOk = ExeIsOperationEmpty( nId) ;
bool bOk = ExeIsOperationEmpty( nId, nEmptyType) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -3028,10 +3037,12 @@ LuaGetMachiningSkippedGeometry( lua_State* L)
static int
LuaIsMachiningEmpty( lua_State* L)
{
// nessun parametro
// nessuno o 1 parametro : [nEmptyType]
int nEmptyType = EMP_NEED_GEOM ;
LuaGetParam( L, 1, nEmptyType) ;
LuaClearStack( L) ;
// recupero lo stato della lavorazione corrente
bool bEmpty = ExeIsMachiningEmpty() ;
bool bEmpty = ExeIsMachiningEmpty( nEmptyType) ;
// restituisco il risultato
LuaSetParam( L, bEmpty) ;
return 1 ;
@@ -3317,6 +3328,21 @@ LuaSimSetUiStatus( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSimEnableToolTipTrace( lua_State* L)
{
// 1 parametro : bEnable
bool bEnable ;
LuaCheckParam( L, 1, bEnable)
LuaClearStack( L) ;
// imposto abilitazione disegno traccia della punta utensile
bool bOk = ExeSimEnableToolTipTrace( bEnable) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSimGetAxisInfoPos( lua_State* L)
@@ -3660,13 +3686,13 @@ LuaGetCalcPositions( lua_State* L)
break ;
}
LuaClearStack( L) ;
// imposto la tavola corrente per il calcolo
int nStat ; double dX ; double dY ; double dZ ;
bool bOk = ExeGetCalcPositions( ptP, vAng, nStat, dX, dY, dZ) ;
// calcolo gli assi lineari dalla posizione e dagli angoli
double dX ; double dY ; double dZ ;
bool bOk = ExeGetCalcPositions( ptP, vAng, dX, dY, dZ) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, bOk) ;
LuaSetParam( L, nStat) ;
LuaSetParam( L, 0) ; // assegnato per compatibilità
LuaSetParam( L, dX) ;
LuaSetParam( L, dY) ;
LuaSetParam( L, dZ) ;
@@ -3678,11 +3704,39 @@ LuaGetCalcPositions( lua_State* L)
}
}
//-------------------------------------------------------------------------------
static int
LuaGetRobotAngles( lua_State* L)
{
// da 3 parametri : ptP, vtTool, vtAux
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtTool ;
LuaCheckParam( L, 2, vtTool)
Vector3d vtAux ;
LuaCheckParam( L, 3, vtAux)
LuaClearStack( L) ;
// imposto la tavola corrente per il calcolo
DBLVECTOR vAng1, vAng2 ;
bool bOk = ExeGetRobotAngles( ptP, vtTool, vtAux, vAng1, vAng2) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, bOk) ;
LuaSetParam( L, vAng1) ;
LuaSetParam( L, vAng2) ;
return 3 ;
}
else {
LuaSetParam( L, bOk) ;
return 1 ;
}
}
//-------------------------------------------------------------------------------
static int
LuaGetCalcTipFromPositions( lua_State* L)
{
// da 5 a 10 parametri : dX, dY, dZ, dAngR1[, dAngR2][, dAngR3][, dAngR4][, dAngR5][, dAngR6], bBottom
// da 3 a 10 parametri : dX, dY, dZ [, dAngR1] [, dAngR2] [, dAngR3] [, dAngR4] [, dAngR5] [, dAngR6] [, bBottom]
double dX ;
LuaCheckParam( L, 1, dX)
double dY ;
@@ -3698,8 +3752,8 @@ LuaGetCalcTipFromPositions( lua_State* L)
else
break ;
}
bool bBottom ;
LuaCheckParam( L, i, bBottom)
bool bBottom = false ;
LuaGetParam( L, i, bBottom) ;
LuaClearStack( L) ;
// calcolo il tip utensile dagli assi macchina
Point3d ptTip ;
@@ -3716,7 +3770,7 @@ LuaGetCalcTipFromPositions( lua_State* L)
static int
LuaGetCalcToolDirFromAngles( lua_State* L)
{
// da 1 a 6 parametri : dAngR1, dAngR2, dAngR3, dAngR4, dAngR5, dAngR6
// da 0 a 6 parametri : [dAngR1] [, dAngR2] [, dAngR3] [, dAngR4] [, dAngR5] [, dAngR6]
DBLVECTOR vAng ;
for ( int i = 1 ; i <= 6 ; ++ i) {
double dAng ;
@@ -3741,7 +3795,7 @@ LuaGetCalcToolDirFromAngles( lua_State* L)
static int
LuaGetCalcAuxDirFromAngles( lua_State* L)
{
// da 1 a 6 parametri : dAngR1, dAngR2, dAngR3, dAngR4, dAngR5, dAngR6
// da 0 a 6 parametri : [dAngR1] [, dAngR2] [, dAngR3] [, dAngR4] [, dAngR5] [, dAngR6]
DBLVECTOR vAng ;
for ( int i = 1 ; i <= 6 ; ++ i) {
double dAng ;
@@ -4493,6 +4547,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSimHome", LuaSimHome) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSimSetStep", LuaSimSetStep) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSimSetUiStatus", LuaSimSetUiStatus) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSimEnableToolTipTrace", LuaSimEnableToolTipTrace) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSimGetAxisInfoPos", LuaSimGetAxisInfoPos) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSimGetToolInfo", LuaSimGetToolInfo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSimGetOperationInfo", LuaSimGetOperationInfo) ;
@@ -4529,6 +4584,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRotAxisBlocked", LuaGetRotAxisBlocked) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAngles", LuaGetCalcAngles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcPositions", LuaGetCalcPositions) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRobotAngles", LuaGetRobotAngles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTipFromPositions", LuaGetCalcTipFromPositions) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcToolDirFromAngles", LuaGetCalcToolDirFromAngles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAuxDirFromAngles", LuaGetCalcAuxDirFromAngles) ;
+240
View File
@@ -0,0 +1,240 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : LUA_MachOpt.cpp Data : 02.04.25 Versione : 2.7c1
// Contenuto : Funzioni per Ottimizzare i tempi tra le lavorazioni per LUA.
//
//
//
// Modifiche : 02.04.25 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGnStringUtils.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaOptMachInit( lua_State* L)
{
// Nessun parametro
LuaClearStack( L) ;
// Inizializzo il calcolatore per minimizzare i tempi tra le lavorazioni
bool bOk = ExeOptMachInit() ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachTerminate( lua_State* L)
{
// Nessun parametro
LuaClearStack( L) ;
// Termino il calcolatore per minimizzare i tempi tra le lavorazioni
bool bOk = ExeOptMachTerminate() ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachAddTool( lua_State* L)
{
// Definizione 9 parametri (3 obbligatori)
int nId ;
LuaCheckParam( L, 1, nId) ;
double dTLoad ;
LuaCheckParam( L, 2, dTLoad) ;
double dTUnload ;
LuaCheckParam( L, 3, dTUnload) ;
double dTC_X = 0. ;
bool bTC_X = LuaGetParam( L, 4, dTC_X) ;
double dTC_Y = 0. ;
bool bTC_Y = LuaGetParam( L, 5, dTC_Y) ;
double dTC_Z = 0. ;
bool bTC_Z = LuaGetParam( L, 6, dTC_Z) ;
double dTC_A = 0. ;
bool bTC_A = LuaGetParam( L, 7, dTC_A) ;
double dTC_B = 0. ;
bool bTC_B = LuaGetParam( L, 8, dTC_B) ;
double dTC_C = 0. ;
bool bTC_C = LuaGetParam( L, 9, dTC_C) ;
LuaClearStack( L) ;
// Aggiungo la Lavorazione
bool bOk = ExeOptMachAddTool( nId, dTC_X, dTC_Y, dTC_Z, dTC_A, dTC_B, dTC_C,
bTC_X, bTC_Y, bTC_Z, bTC_A, bTC_B, bTC_C,
dTLoad, dTUnload) ;
// Rstituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachAddMachining( lua_State* L)
{
// Definizione 5 parametri
int nId ;
LuaCheckParam( L, 1, nId) ;
int nToolId ;
LuaCheckParam( L, 2, nToolId) ;
int nGroup ;
LuaCheckParam( L, 3, nGroup) ;
DBLVECTOR vAxStart ;
LuaCheckParam( L, 4, vAxStart) ;
DBLVECTOR vAxEnd ;
LuaCheckParam( L, 5, vAxEnd) ;
LuaClearStack( L) ;
// Completamento valori assi
while ( vAxStart.size() < 6)
vAxStart.push_back( 0) ;
while ( vAxEnd.size() < 6)
vAxEnd.push_back( 0) ;
// Aggiungo la Lavorazione
bool bOk = ExeOptMachAddMachining( nId, nToolId, nGroup,
vAxStart[0], vAxStart[1], vAxStart[2], vAxStart[3], vAxStart[4], vAxStart[5],
vAxEnd[0], vAxEnd[1], vAxEnd[2], vAxEnd[3], vAxEnd[4], vAxEnd[5]) ;
// Rstituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachSetFirstMachining( lua_State* L)
{
// 1 parametro : nId
int nId = 0 ;
LuaCheckParam( L, 1, nId) ;
LuaClearStack( L) ;
// Imposto la prima lavorazione
bool bOk = ExeOptMachSetFirstMachining( nId) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------
static int
LuaOptMachSetLastMachining( lua_State* L)
{
// 1 parametro : nId
int nId = 0 ;
LuaCheckParam( L, 1, nId) ;
LuaClearStack( L) ;
// Imposto la prima lavorazione
bool bOk = ExeOptMachSetLastMachining( nId) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------
static int
LuaOptMachSetFeeds( lua_State* L)
{
// 2 Parametri : dFeedL, dFeedA
double dFeedL = 1. ;
LuaCheckParam( L, 1, dFeedL) ;
double dFeedA = 1. ;
LuaCheckParam( L, 2, dFeedA) ;
LuaClearStack( L) ;
// Imposto le Feeds
bool bOk = ExeOptMachSetFeeds( dFeedL, dFeedA) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachAddDependence( lua_State* L)
{
// 2 parametri : nIdPrev, nIdSucc
int nIdPrev = 0 ; int nIdNext = 0 ;
LuaCheckParam( L, 1, nIdPrev) ;
LuaCheckParam( L, 2, nIdNext) ;
LuaClearStack( L) ;
// Imposto Dipendenza obbligatoria
bool bOk = ExeOptMachAddDependence( nIdPrev, nIdNext) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachAddSuggestedDependence( lua_State* L)
{
// 2 parametri : nIdPrev, nIdSucc
int nIdPrev = 0 ; int nIdNext = 0 ;
LuaCheckParam( L, 1, nIdPrev) ;
LuaCheckParam( L, 2, nIdNext) ;
LuaClearStack( L) ;
// Imposto Dipendenza suggerita
bool bOk = ExeOptMachAddSuggestedDependence( nIdPrev, nIdNext) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachSetAllGroupDependencesAsMandatory( lua_State* L)
{
// 1 Parametro : bAllMendatory
bool bAllMendatory = false ;
LuaCheckParam( L, 1, bAllMendatory) ;
LuaClearStack( L) ;
// Imposto il Flag
bool bOk = ExeOptMachSetAllGroupDependencesAsMandatory( bAllMendatory) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachGetResult( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// eseguo calcolo di minimo percorso
INTVECTOR vOrder ;
bool bOk = ExeOptMachGetResult( vOrder) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vOrder) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallMachiningOptimization( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachInit", LuaOptMachInit) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachTerminate", LuaOptMachTerminate) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachAddTool", LuaOptMachAddTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachAddMachining", LuaOptMachAddMachining) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetFirstMachining", LuaOptMachSetFirstMachining) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetLastMachining", LuaOptMachSetLastMachining) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetFeeds", LuaOptMachSetFeeds) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachAddDependence", LuaOptMachAddDependence) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachAddSuggestedDependence", LuaOptMachAddSuggestedDependence) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetAllGroupsDependencesAsMandatory", LuaOptMachSetAllGroupDependencesAsMandatory) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachGetResult", LuaOptMachGetResult) ;
return bOk ;
}
+39
View File
@@ -340,6 +340,21 @@ LuaAutoNestSetInterpartGap( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaAutoNestSetShearGap( lua_State* L)
{
// 1 parametro : dShearGap
double dShearGap ;
LuaCheckParam( L, 1, dShearGap)
LuaClearStack( L) ;
// imposto shear gap
bool bOk = ExeAutoNestSetShearGap( dShearGap) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaAutoNestSetReportFile( lua_State* L)
@@ -466,6 +481,28 @@ LuaAutoNestGetOneResult( lua_State* L)
}
}
//-------------------------------------------------------------------------------
static int
LuaAutoNestCalcShearSequence( lua_State* L)
{
// 1 parametro : nNesting
int nNesting ;
LuaCheckParam( L, 1, nNesting)
LuaClearStack( L) ;
// calcolo shear sequence
PNTVECTOR vPtStart, vPtEnd ;
bool bOk = ExeAutoNestCalcShearSequence( nNesting, vPtStart, vPtEnd) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
if ( bOk) {
LuaSetParam( L, vPtStart) ;
LuaSetParam( L, vPtEnd) ;
return 3 ;
}
else
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallNesting( LuaMgr& luaMgr)
@@ -488,6 +525,7 @@ LuaInstallNesting( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetStripYconstraintToPart", LuaAutoNestSetStripYconstraintToPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetStripXconstraintToPart", LuaAutoNestSetStripXconstraintToPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetInterpartGap", LuaAutoNestSetInterpartGap) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetShearGap", LuaAutoNestSetShearGap) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetReportFile", LuaAutoNestSetReportFile) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestCompute", LuaAutoNestCompute) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestCancelComputation", LuaAutoNestCancelComputation) ;
@@ -495,6 +533,7 @@ LuaInstallNesting( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestPrintResults", LuaAutoNestPrintResults) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestGetResults", LuaAutoNestGetResults) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestGetOneResult", LuaAutoNestGetOneResult) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestCalcShearSequence", LuaAutoNestCalcShearSequence) ;
return bOk ;
}
+214
View File
@@ -0,0 +1,214 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : LUA_Redis.cpp Data : 17.09.25 Versione : 2.7i3
// Contenuto : Funzioni per interfacciarsi con server Redis.
//
//
//
// Modifiche : 17.09.25 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkLuaAux.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaRedisConnect( lua_State* L)
{
// 1 parametro : sConnection
string sConnection ;
LuaCheckParam( L, 1, sConnection)
LuaClearStack( L) ;
// Imposto la connessione
int nIdConnection = 0 ;
bool bOk = ExeRedisConnect( sConnection, nIdConnection) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
LuaSetParam( L, nIdConnection) ;
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisDisconnect( lua_State* L)
{
// 1 parametro : nIdConnection
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
LuaClearStack( L) ;
// Imposto la connessione
bool bOk = ExeRedisDisconnect( nIdConnection) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisSetValFromKey( lua_State* L)
{
// 3 parametri : nIdConnection, sKey, sVal
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sKey ;
LuaCheckParam( L, 2, sKey) ;
string sVal ;
LuaCheckParam( L, 3, sVal) ;
LuaClearStack( L) ;
// Imposto il valore della chiave
bool bOk = ExeRedisSetValFromKey( nIdConnection, sKey, sVal) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisGetValFromKey( lua_State* L)
{
// 2 parametri : nIdConnection, sKey
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sKey ;
LuaCheckParam( L, 2, sKey)
LuaClearStack( L) ;
// Recupero il valore della chiave
string sVal, sType ;
bool bOk = ExeRedisGetValFromKey( nIdConnection, sKey, sVal) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
LuaSetParam( L, sVal) ;
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisAsyncConnect( lua_State* L)
{
// 2 parametri : sConnection
string sConnection ;
LuaCheckParam( L, 1, sConnection)
LuaClearStack( L) ;
// Imposto la connessione
int nIdConnection = -1 ;
bool bOk = ExeRedisAsyncConnect( sConnection, nIdConnection) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
LuaSetParam( L, nIdConnection) ;
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisAsyncDiconnect( lua_State* L)
{
// 1 parametro : nIdConnection
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
LuaClearStack( L) ;
// Imposto la connessione
bool bOK = ExeRedisAsyncDisconnect( nIdConnection) ;
// Restituisco il risultato
LuaSetParam( L, bOK) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisAsyncPublish( lua_State* L)
{
// 3 parametri : nIdConnection, sChannel, sMessage
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sChannel ;
LuaCheckParam( L, 2, sChannel) ;
string sMessage ;
LuaCheckParam( L, 3, sMessage) ;
LuaClearStack( L) ;
// Pubblico il messaggio sul canale
bool bOk = ExeRedisAsyncPublish( nIdConnection, sChannel, sMessage) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//--------------------------------------------------------------------------------
static int
LuaRedisAsyncSubscribe( lua_State* L)
{
// 2 parametri : nIdConnection, sChannel
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sChannel ;
LuaCheckParam( L, 2, sChannel) ;
LuaClearStack( L) ;
// Iscrizione al canale
bool bOk = ExeRedisAsyncSubscribe( nIdConnection, sChannel) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//--------------------------------------------------------------------------------
static int
LuaRedisAsyncUnsubscribe( lua_State* L)
{
// 2 parametri : nIdConnection, sChannel
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sChannel ;
LuaCheckParam( L, 2, sChannel) ;
LuaClearStack( L) ;
// Disiscrizione
bool bOk = ExeRedisAsyncUnsubscribe( nIdConnection, sChannel) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisAsyncSubscribeOneMessage( lua_State* L)
{
// 3 parametri : nIdConnection, sChannel, dMaxTimeOut
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sChannel ;
LuaCheckParam( L, 2, sChannel) ;
double dMaxTimeOut = 0. ;
LuaCheckParam( L, 3, dMaxTimeOut) ;
LuaClearStack( L) ;
// Eseguo funzione speciale di iscrizione - attesa messaggio - disiscrizione
string sMessage ;
bool bOk = ExeRedisAsyncSubscribeOneMessage( nIdConnection, sChannel, dMaxTimeOut, sMessage) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
LuaSetParam( L, sMessage) ;
return 2 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallRedis( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisConnect", LuaRedisConnect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisDisconnect", LuaRedisDisconnect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisSetValFromKey", LuaRedisSetValFromKey) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisGetValFromKey", LuaRedisGetValFromKey) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncConnect", LuaRedisAsyncConnect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncDisconnect", LuaRedisAsyncDiconnect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncPublish", LuaRedisAsyncPublish) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncSubscribe", LuaRedisAsyncSubscribe) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncUnsubscribe", LuaRedisAsyncUnsubscribe) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncSubscribeOneMessage", LuaRedisAsyncSubscribeOneMessage) ;
return bOk ;
}
+37
View File
@@ -322,6 +322,42 @@ LuaGetImage( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetImageEx( lua_State* L)
{
// 11 argomenti : nDriver, b2Buff, nColorBits, nDepthBits, nShowMode, colBackTop, colBackBottom, nCameraDir, nWidth, nHeight, sFile
int nDriver ;
LuaCheckParam( L, 1, nDriver)
bool b2Buff ;
LuaCheckParam( L, 2, b2Buff)
int nColorBits ;
LuaCheckParam( L, 3, nColorBits)
int nDepthBits ;
LuaCheckParam( L, 4, nDepthBits)
int nShowMode ;
LuaCheckParam( L, 5, nShowMode)
Color colBackTop ;
LuaCheckParam( L, 6, colBackTop)
Color colBackBottom ;
LuaCheckParam( L, 7, colBackBottom)
int nCameraDir ;
LuaCheckParam( L, 8, nCameraDir)
int nWidth ;
LuaCheckParam( L, 9, nWidth)
int nHeight ;
LuaCheckParam( L, 10, nHeight)
string sFile ;
LuaCheckParam( L, 11, sFile)
LuaClearStack( L) ;
// creo e salvo una immagine della scena
bool bOk = ExeGetImageEx( nDriver, b2Buff, nColorBits, nDepthBits, nShowMode,
colBackTop, colBackBottom, nCameraDir, nWidth, nHeight, sFile) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallScene( LuaMgr& luaMgr)
@@ -344,5 +380,6 @@ LuaInstallScene( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetView", LuaGetView) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetGenericView", LuaGetGenericView) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetImage", LuaGetImage) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetImageEx", LuaGetImageEx) ;
return bOk ;
}
+1 -1
View File
@@ -160,7 +160,7 @@ LuaSpSetZzOwStep( lua_State* L)
LuaCheckParam( L, 1, dStep)
LuaClearStack( L) ;
// imposto lo step per tipologie ZigZag e OneWay
bool bOk = ExeSpSetZzOwStep( dStep) ;
bool bOk = ExeSpSetZzOwStep( dStep) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
+15 -1
View File
@@ -163,8 +163,22 @@ PictureObj::Load( const STRVECTOR& vString, int nBaseGdbId)
string sOut = "Error loading image " + sOtherPath ;
LOG_ERROR( GetLogger(), sOut.c_str())
}
return true ;
}
else {
// provo dalla path della macchina corrente
string sMachineDir ;
if ( ExeGetCurrMachineDir( sMachineDir)) {
string sOtherPath = sMachineDir + "\\" + GetFileName( m_sPath) ;
if ( ExistsFile( sOtherPath)) {
if ( ! ExeLoadTexture( m_sName, sOtherPath, 0, m_dDimX, m_dDimY, TXR_CLAMP)) {
string sOut = "Error loading image " + sOtherPath ;
LOG_ERROR( GetLogger(), sOut.c_str())
}
return true ;
}
}
// altrimenti errore
{
string sOut = "Error missing image " + sOtherPath ;
LOG_ERROR( GetLogger(), sOut.c_str())
}
+3 -1
View File
@@ -4,6 +4,7 @@
//
#define VS_VERSION_INFO 1
#define IDD_LUADLG 101
#define IDD_LUASCENE 102
#define IDC_TEXT1 1001
#define IDC_TEXT2 1002
#define IDC_TEXT3 1003
@@ -36,6 +37,7 @@
#define IDC_CHECK6 1036
#define IDC_CHECK7 1037
#define IDC_CHECK8 1038
#define IDC_PICTURE1 1041
// Next default values for new objects
//
@@ -44,6 +46,6 @@
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1030
#define _APS_NEXT_SYMED_VALUE 113
#define _APS_NEXT_SYMED_VALUE 115
#endif
#endif
+7 -5
View File
@@ -28,8 +28,10 @@
#include "/EgtDev/Include/EgtLibVer.h"
#pragma comment(lib, EGTLIBDIR "EgtGeneral" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "EgtNumKernel" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "EgtGeomKernel" EGTLIBVER ".lib")
#pragma comment(lib, EGTEXTDIR "Lua/Lib/Lua54" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")
#pragma comment( lib, EGTLIBDIR "EgtGeneral" EGTLIBVER ".lib")
#pragma comment( lib, EGTLIBDIR "EgtNumKernel" EGTLIBVER ".lib")
#pragma comment( lib, EGTLIBDIR "EgtGeomKernel" EGTLIBVER ".lib")
#pragma comment( lib, EGTEXTDIR "Lua/Lib/Lua54" EGTLIBVER ".lib")
#pragma comment( lib, EGTEXTDIR "hiredis/Lib/hiredis" EGTLIBVER ".lib")
#pragma comment( lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")
#pragma comment( lib, "ws2_32.lib")