Compare commits

...

94 Commits

Author SHA1 Message Date
Riccardo Elitropi 5d5a8bd01e Merge commit 'e31fcee3386361d8265e138accf2b6bf49858643' into ModelessDialog 2026-05-08 08:44:13 +02:00
Riccardo Elitropi 292361139a EgtExecutor (ModelessDialog) :
- primo commit.
2026-05-08 08:40:01 +02:00
Dario Sassi e31fcee338 EgtExecutor 3.1e1 :
- ricompilazione con cambio versione.
2026-05-07 12:23:40 +02:00
Daniele Bariletti 4746474864 EgtExecutor :
- aggiunto argomento alla RegolarizeSurfaceLocally.
2026-05-07 11:29:44 +02:00
Daniele Bariletti 7cefd64b2a EgtExecutor :
- modificata funzione per la regolarize.
2026-04-22 16:42:46 +02:00
Daniele Bariletti 8a51d5e3a5 Merge branch 'Trimming' 2026-04-21 15:09:38 +02:00
Daniele Bariletti d32fdc5417 EgtExecutor :
- aggiunte funzioni per regolarizzare i bordi di una surf di trimming.
2026-04-21 15:06:24 +02:00
Daniele Bariletti ccaaa5bd22 Merge branch 'master' into Trimming 2026-04-20 09:27:37 +02:00
Dario Sassi 00e6d24f2e EgtExecutor 3.1d3 :
- piccoli aggiustamenti.
2026-04-19 10:55:49 +02:00
Daniele Bariletti 2d4d4ddf03 EgtExecutor .
- aggiunto controllo.
2026-04-17 13:23:56 +02:00
Dario Sassi cfcb844923 EgtExecutor 3.1d2 :
- nelle funzioni exe e lua di proiezione di curve su superfici aggiunto paramtetro bFromVsTo.
2026-04-15 08:56:43 +02:00
Dario Sassi e9f368a85f EgtExecutor 3.1d1 :
- aggiunta funzione Exe/lua Redraw
- aggiunte funzioni Exe/lua SurfTmGetSmoothAng e VolZmapGetShowEdges.
2026-04-08 19:30:11 +02:00
Riccardo Elitropi 1abcac8aa4 EgtExecutor :
- In ExePocketing aggiunti parametri per lucidatura.
2026-03-31 19:02:17 +02:00
Daniele Bariletti a9b5d9627a Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2026-03-31 15:02:04 +02:00
Daniele Bariletti 41790f7d57 EgtExecutor :
- aggiunto controllo.
2026-03-31 15:01:56 +02:00
Riccardo Elitropi c33cbe7b9f EgtExecutor 3.1c6 :
- In Nesting aggiunto controllo e gestione di collisioni con i loop interni delle regioni piane
- in nesting aggiunte funzioni per interferenza tra regioni piane
- aggiunto controllo per allineamento e riposizionamento nel caso di lavorazioni con Waterjet.
2026-03-31 14:24:05 +02:00
Riccardo Elitropi 35455e011e Merge commit '1d9ecd9b7874511eb24965b857a7d7b21dc9b8b3' 2026-03-31 14:21:08 +02:00
Riccardo Elitropi 1d9ecd9b78 EgtExecutor (Nst_SurfFr) :
- migliorata la collisione e l'allineamento per Regioni Piane.
2026-03-31 13:22:51 +02:00
Riccardo Elitropi 6c2437831d EgtExecutor (Nst_SurfFr) :
- aggiunti controlli aggiuntivi per collisioni.
2026-03-30 18:17:52 +02:00
Riccardo Elitropi d87b349788 EgtExecutor (Nst_SurfFr) :
- primo commit per CAv tra Regioni Piane con loop interni e Interferenza tra Regioni Piane.
2026-03-27 18:43:36 +01:00
Dario Sassi 1141af30d7 EgtExecutor :
- aggiunta funzione lua EgtGetCalcAnglesEx per calcolo assi rotanti in centri di lavoro con più di due assi
- funzione lua EgtVerifyOutstroke estesa per accettare fino a 4 assi rotanti.
2026-03-25 16:48:10 +01:00
Riccardo Elitropi 4a34b2e45d EgtExecutor 3.1c5 :
- aggiunto controllo sulla dimensione alle funzioni di creazione ZMap per versioni a 32Bit.
2026-03-24 16:01:43 +01:00
Dario Sassi bdd0e89b78 EgtExecutor :
- piccole modifiche estetiche.
2026-03-23 08:25:59 +01:00
Dario Sassi 4b8f8ee87e EgtExecutor :
- aggiunto parametro nRefType a funzione VolZMapRemoveFins.
2026-03-20 09:02:56 +01:00
Dario Sassi 5314a1926b EgtExecutor :
- cambio nome di funzione exe/lua da EraseFins in RemoveFins
- cambio nome di funzione exe/lua da UniformVolZmap a VolZmapMakeUniform.
2026-03-19 19:31:36 +01:00
Riccardo Elitropi 0699f7ffd1 EgtExecutor :
- aggiunta funzione EraseFins per gli Zmap.
2026-03-19 18:43:11 +01:00
Daniele Bariletti a6e3732296 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2026-03-19 14:53:45 +01:00
Riccardo Elitropi 6b6fd884a0 EgtExecutor 3.1c4 :
- in MachMgr aggiunte funzioni per ottenere vTDir, vCDir e vADir per entità CamData.
2026-03-18 15:56:28 +01:00
Daniele Bariletti e96bcefcc3 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2026-03-16 17:07:22 +01:00
Dario Sassi 7412a3085f EgtExecutor :
- la funzione Exe/Lua SurfBezierParamsFromPoint ora restituisce solo i valori dei parametri U e V che corrispondono al punto
- piccole migliorie.
2026-03-13 13:33:46 +01:00
Daniele Bariletti e1b2c93f22 EgtExecutor :
- piccola correzione.
2026-03-13 09:14:07 +01:00
Daniele Bariletti 2687fd90dc EgtExecutor :
- cambio restituzione valori per ExeSurfBezParamsFromPoint.
2026-03-12 18:12:21 +01:00
Daniele Bariletti 7af8d0ae41 EgtExecutor :
- modificata funzione ExeSurfBezParamsFromPoint.
2026-03-10 17:35:08 +01:00
SaraP b010769af6 EgtExecutor 3.1c3 :
- piccola miglioria nel concatenamento delle curve nelle intersezioni con piano per gestire meglio i tratti di lunghezza inferiore alla tolleranza.
2026-03-10 10:01:56 +01:00
Daniele Bariletti fec60b2ea7 EgtExecutor 3.1c2 :
- cambio versione.
2026-03-05 10:47:42 +01:00
Daniele Bariletti 6056ac41cd EgtExecutor :
- piccola correzione.
2026-03-04 16:04:26 +01:00
Daniele Bariletti 4925444552 EgtExecutor :
- piccola correzione.
2026-03-04 15:48:22 +01:00
Daniele Bariletti dc759d5eb3 EgtExecutor :
- aggiunta funzione per ottenere part e shell di una faccia di una trimesh.
2026-03-04 15:43:16 +01:00
Daniele Bariletti bc167e8832 EgtExecutor :
- aggiunta funzione per richiedere i parametri di un punto di una bezier.
2026-03-04 14:49:15 +01:00
Dario Sassi 6356d67034 EgtExecutor 3.1c1 :
- aggiunta funzione ExeChangePreviewMachiningToolShow.
2026-03-03 18:34:50 +01:00
Dario Sassi 0da1798029 EgtExecutor :
- piccole modifiche a scelta colore per dialogo lua.
2026-02-24 08:42:06 +01:00
Riccardo Elitropi 71009205b5 EgtExecutor :
- in LUA_GENERAL migliorato e corretto il dialogo di tipo Brush/ColorPicker.
2026-02-23 15:53:39 +01:00
Daniele Bariletti 7b48821c00 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2026-02-23 09:47:48 +01:00
Daniele Bariletti 9611421fbc EgtExecutor :
- aggiunto flag alla funzione EgtSurfBezierLeaves.
2026-02-23 09:47:41 +01:00
Riccardo Elitropi 5723c92e09 EgtExecutor 3.1b2 :
- in Trimming aggiunte funzioni per interpolazione curve di sincronizzazione
- in LUA_GENERAL aggiunto il dialogo di tipo Brush/ColorPicker.
2026-02-20 16:51:40 +01:00
Daniele Bariletti e9f38149ac EgtExecutor :
- piccola correzione.
2026-02-19 16:01:21 +01:00
Dario Sassi 9d611b80a8 EgtExecutor 3.1b1 :
- correzioni a recupero nome da nota NcName di Gruppo di Lavoro per generazione e stima.
2026-02-19 10:02:17 +01:00
Daniele Bariletti 09dd6cc2f7 EgtExecutor :
- aggiunta possibilità di approsimare con curve di bezier.
2026-02-11 16:46:25 +01:00
Daniele Bariletti 7bb53a0e3f EgtExecutor :
- ripristinata tollerenza corretta.
2026-02-10 15:44:43 +01:00
Riccardo Elitropi d55f02a7b2 EgtExecutor :
- in Trimming migliorata la funzione per il calcolo delle curve di sincronizzazione.
2026-02-09 14:52:30 +01:00
Dario Sassi 50dcd97857 EgtExecutor :
- aggiunte info in ProjectCurveOnSurf
- piccolo aggiustamento per ricavere curve di sincro da trimming.
2026-02-09 08:25:27 +01:00
Dario Sassi f5f9b9813d EgtExecutor :
- aggiunta funzione exe/lua GetClEntFeed.
2026-02-03 17:46:42 +01:00
Riccardo Elitropi 039f261f0c EgtExecutor 3.1a4 :
- in Trimming aggiunte le funzioni per riconoscimento di fori e asole
- in Trimming pulizia del codice.
2026-02-03 17:20:21 +01:00
Dario Sassi d6c79cbf78 EgtExecutor 3.1a3 :
- aggiunto a funzioni lua EgtCurveCompoSetTempProp e EgtCurveCompoSetTempParam il parametro opzionale indice (default 0).
2026-02-02 10:32:05 +01:00
Riccardo Elitropi 7cf368e518 EgtExecutor :
- in Trimming piccole migliorie/correzioni.
2026-01-26 18:04:19 +01:00
Dario Sassi e68153fb70 EgtExecutor :
- a Exe e lua TestSurfaceSurface aggiunto il parametro opzionale bTestEnclusion per segnalare collisione anche quando una delle due è chiusa (ovvero racchiude un volume) e contiene l'altra
2026-01-23 10:22:02 +01:00
Riccardo Elitropi f2dc3876b0 EgtExecutor :
- in Trimming piccola miglioria nella scelta delle curve di sincronizzazione da visualizzare.
2026-01-22 19:25:01 +01:00
Daniele Bariletti ab3681e209 EgtExecutor :
- modifica alla funzione GetSurfBezierRuledGuided.
2026-01-22 11:22:59 +01:00
Riccardo Elitropi 11c47c4394 EgtExecutor :
- in Trimming semplificazione delle funzioni per le curve di sincronizzazione.
2026-01-21 18:28:33 +01:00
Riccardo Elitropi 54a1a882de EgtExecutor 3.1a2 :
- modifiche e migliorie alla funzioni di Trimming.
2026-01-20 17:30:32 +01:00
Daniele Bariletti c306967cb2 EgtExecutor :
- modificata la chiamata alla GetSurfBezierRuledGuided.
2026-01-19 12:33:59 +01:00
Daniele Bariletti 23a46d56cd EgtExecutor :
- aggiunto controllo alla funzione MyCurveCurveInters.
2026-01-15 11:53:26 +01:00
Daniele Bariletti 2aa7669c7b EgtExecutor :
- aggiunti argomenti alla funzione GetSurfBezierRuledGuided.
2026-01-15 11:52:39 +01:00
Dario Sassi 5a8d472ddf Executor :
- aggiunta funzione lua EraseNonEmptyDirectory.
2026-01-09 19:00:36 +01:00
Dario Sassi fb188d566e EgtExecutor :
- piccole correzioni.
2026-01-07 09:23:32 +01:00
Dario Sassi b1fcb75e4f EgtExecutor :
- aggiunte funzioni di striping per trimming dei termoformati
2026-01-04 20:39:53 +01:00
Dario Sassi 116e7c0061 EgtExecutor 3.1a1 :
- ricompilazione con cambio major version.
2026-01-02 12:34:15 +01:00
Dario Sassi e0c2b9dacd EgtExecutor :
- aggiunta funzione exe/lua DuplicateGeomDB.
2025-12-23 15:36:20 +01:00
Riccardo Elitropi 0e8f8d0502 EgtExecutor :
- prima versione per Trimming.
2025-12-22 17:07:44 +01:00
Riccardo Elitropi 9a719b94cf EgtExecutor :
- in Redis aggiunta gestione per riconnessioni.
2025-12-22 17:05:30 +01:00
Dario Sassi c50ecf7d53 EgtExecutor :
- piccole migliorie al salvataggio progetti per salvataggio e ripristioni CamStatus.
2025-12-22 11:43:54 +01:00
Dario Sassi 6ca16a587c EgtExecutor :
- aggiunte funzioni exe/lua SetCalcSolCh e GetCalcSolCh.
2025-12-19 09:49:26 +01:00
Riccardo Elitropi fb29be348a EgtExecutor :
- modifica prototipi in Machining Optimization.
2025-12-18 09:06:41 +01:00
Riccardo Elitropi d256c5f5ea EgtExecutor :
- in Machining Optimization aggiunta gestione OpenBounds.
2025-12-17 15:05:18 +01:00
Riccardo Elitropi 0ea77e1e6a EgtExecutor 2.7l3 :
- in Machining Optimization aggiunta ottimizzazione mirata ai singoli gruppi.
2025-12-16 15:50:27 +01:00
Riccardo Elitropi e1c468a0df EgtExecutor :
- modifica prototipi per creazione SurfTmShell.
2025-12-15 11:39:51 +01:00
Riccardo Elitropi 740d3817de EgtExecutor 2.7l2 :
- Modificate le funzioni di Offset per superfici TriMesh aperte
- Aggiunta la funzione per la creazione di Shell per TriMesh.
2025-12-15 11:32:21 +01:00
Riccardo Elitropi ea4cc8a368 EgtExecutor :
- in Redis modifica nomi variabili statiche di modulo.
2025-12-15 08:31:11 +01:00
Riccardo Elitropi 37a4fce4ae EgtExecutor :
- in Redis piccola correzione nella ricerca dei messaggi.
2025-12-12 17:43:57 +01:00
Dario Sassi b68dd72cf6 EgtExecutor :
- migliorie nella funzione ExeGetImageEx per gestione errori e per modalità driver OpenGL 1.
2025-12-11 12:10:14 +01:00
Dario Sassi 57d01e7f4c EgtExecutor :
- aggiunta funzione exe/lua ExistsCurrSetup.
2025-12-11 08:49:42 +01:00
Riccardo Elitropi 9d64ca5d39 EgtExecutor :
- in Redis piccola correzione.
2025-12-11 08:10:30 +01:00
Riccardo Elitropi e177fd8ccd EgtExecutor :
- in Redis migliorata la gestione dei Messaggi per thread concorrenti.
2025-12-09 10:05:29 +01:00
Dario Sassi 50d92d366d EgtExecutor :
- aggiunte funzioni exe e lua per valori iniziali e finali degli assi in una lavorazione GetMachiningStartAxes e GetMachiningEndAxes
- aggiunta funzione di proiezione a minima distanza di curva su superficie ProjectCurveOnSurf
- rinominata funzione di proiezione lungo direzione di curva su superficie in ProjectCurveOnSurfDir.
2025-12-09 08:17:51 +01:00
Riccardo Elitropi f698451c4c EgtExecutor 2.7l1 :
- in Redis aggiunta lettura ultimo Messaggio.
2025-12-04 12:06:23 +01:00
Dario Sassi 0d0a99d91e EgtExecutor 2.7k4 :
- eliminato include inutile.
2025-12-01 09:17:22 +01:00
Daniele Bariletti cf95041887 EgtExecutor :
- aggiunto comando LUA per modificare la qualità di visualizzazione delle surf di Bezier.
2025-11-20 12:27:04 +01:00
Daniele Bariletti 6f8e37c9ee EgtExecutor :
- aggiunto funioni alla IntersCurveCurve per filtrare le intersezioni 3D.
2025-11-19 13:08:36 +01:00
Daniele Bariletti 2407fef277 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2025-11-18 10:16:46 +01:00
Daniele Bariletti f0de82dd96 EgtExecutor :
- aggiunta funzione per l'overlap di bbox.
2025-11-18 10:16:42 +01:00
SaraP 1cf4310cd9 EgtExecutor :
- aggiunto valore di default a parametro opzionale in LuaRemoveCurveCompoCurve.
2025-11-17 12:38:32 +01:00
Dario Sassi 22b9c46fb4 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2025-11-12 15:40:41 +01:00
Dario Sassi 8e79cda146 EgtExecutor 2.7k3 :
- corretta funzione exe/lua PlaneVolZmapInters per sistemi di riferimento.
2025-11-12 15:37:48 +01:00
Daniele Bariletti 8131fd64e0 Merge branch 'NewRuled' 2025-11-12 13:11:34 +01:00
44 changed files with 4603 additions and 687 deletions
+90
View File
@@ -0,0 +1,90 @@
//----------------------------------------------------------------------------
// EgalTech 2026-2026
//----------------------------------------------------------------------------
// File : AuxDialogBox.cpp Data : 24.04.26 Versione : 3.1d4
// Contenuto : Funzioni DialogBox.
//
//
// Modifiche : 24.04.26 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "AuxDialogBox.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EgtStringConverter.h"
using namespace std ;
#pragma comment( lib, "Comctl32.lib")
HWND phDlgModeless = nullptr ;
int nDlgModelessItem = -1 ;
//-----------------------------------------------------------------------------
bool
UpdateIdsModelessDialog( HWND phDlgModeless, int nDlgModelessItem)
{
// se DialogBox Modeless non inizializzato, esco
if ( phDlgModeless == nullptr)
return false ;
// se Id del controllo da aggiornare non valido, esco
if ( nDlgModelessItem == -1)
return false ;
// recupero tutti gli elementi selezionati
string sIds ;
int nId = ExeGetFirstSelectedObj() ;
while ( nId != GDB_ID_NULL) {
sIds.append( ToString( nId) + string{","}) ;
nId = ExeGetNextSelectedObj() ;
}
if ( ! sIds.empty())
sIds.pop_back() ;
// aggiorno il contenuto nel dialogo
return ( SetDlgItemText( phDlgModeless, nDlgModelessItem, stringtoW( sIds))) ;
}
//-----------------------------------------------------------------------------
LRESULT CALLBACK UpdateSelectionModelessDialog( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{
if ( msg == WM_GETDLGCODE)
return DLGC_WANTALLKEYS ;
if ( msg == WM_KEYDOWN && wParam == VK_RETURN) {
// dwRefData contiene l'ID dell'EDIT
int nEditId = int( dwRefData) ;
HWND hwndDlg = GetParent(hwnd);
if ( hwndDlg == nullptr)
return FALSE ;
// recupero il testo dell'EDIT corretto
string sIds ;
AtoWEX<128> wsEdit( "") ;
if ( GetDlgItemText( hwndDlg, nEditId, LPWSTR( wsEdit), 128) > 0)
sIds = wstrztoA( wsEdit) ;
// deseleziono tutto
ExeDeselectAll() ;
// seleziono gli ID contenuti
if ( ! sIds.empty()) {
STRVECTOR vsIds;
Tokenize( sIds, ",", vsIds) ;
for ( auto& s : vsIds) {
int nId = GDB_ID_NULL ;
if ( FromString( s, nId) && nId != GDB_ID_NULL)
ExeSelectObj( nId) ;
}
}
// aggiorno la grafica ed esco
ExeDraw() ;
return TRUE ;
}
return ( DefSubclassProc(hwnd, msg, wParam, lParam)) ;
}
+31
View File
@@ -0,0 +1,31 @@
//----------------------------------------------------------------------------
// EgalTech 2026-2026
//----------------------------------------------------------------------------
// File : AuxDialogBox.h Data : 24.04.2026 Versione : 3.1d4
// Contenuto : Prototipi funzioni DialogBox.
//
//
//
// Modifiche : 22.04.26 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "stdafx.h"
#include "resource.h"
#include "/EgtDev/Include/ExeExecutor.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include <shlobj.h>
//----------------------------------------------------------------------------
// Identificativo della finestra ModeLess corrente ( nullptr se non esiste)
extern HWND phDlgModeless ;
extern int nDlgModelessItem ;
// Funzione per passaggi di parametri tra Selezione DB e dialogo non modale
bool UpdateIdsModelessDialog( HWND phDlgModeless, int UpdateIdsModelessDialog) ;
//Funzione per selezionare gli Id presenti all'interno dei un EditText
LRESULT CALLBACK UpdateSelectionModelessDialog( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) ;
+123 -10
View File
@@ -1832,6 +1832,106 @@ ExeCreateSurfTmByVolZmap( int nParentId, int nZmapId, int nPart)
return nNewId ;
}
//----------------------------------------------------------------------------
static double
GetStmOffsPrec( double dOffs, double dLinTol)
{
return max( min( abs( dOffs) / 4., 10. * max( dLinTol, EPS_SMALL)), 0.5) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfShell( int nParentId, int nSurfId, double dThick, double dLinTol)
{
// Verifica del DB geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// Sistemo lo spessore ( diretto in direzione opposta alla normale della superficie) e ala tolleranza lineare
bool bOk = ( abs( dThick) > 10. * EPS_SMALL) ;
double dOffs = ( - abs( dThick)) ;
double dMyLinTol = max( EPS_SMALL, dLinTol) ;
// Recupero la superficie
const ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nSurfId)) ;
bOk = bOk && ( pSurf != nullptr && pSurf->IsValid()) ;
// Recupero il riferimento del gruppo di destinazione
Frame3d frDest ;
bOk = bOk && ( pGeomDB->GetGroupGlobFrame( nParentId, frDest)) ;
// Definisco la TriMesh risultate
PtrOwner<ISurfTriMesh> pStmRes( CreateSurfTriMesh()) ;
bOk = bOk && ( ! IsNull( pStmRes)) ;
// Definisco la Shell in base al tipo di superficie
if ( bOk) {
switch ( pSurf->GetType()) {
case SRF_TRIMESH : {
// Recupero la superficie TriMesh ( deve essere aperta)
const ISurfTriMesh* pStm = GetSurfTriMesh( pSurf) ;
bOk = ( pStm != nullptr && pStm->IsValid() && ! pStm->IsClosed()) ;
if ( bOk) {
double dPrec = GetStmOffsPrec( dOffs, dMyLinTol) ;
bOk = ( pStmRes.Set( CreateSurfTriMeshShell( pStm, dOffs, dPrec))) ;
bOk = bOk && ( ! IsNull( pStmRes) && pStmRes->IsValid()) ;
}
}
break ;
case SRF_BEZIER : {
// Recupero la superficie di Bezier
const ISurfBezier* pSBz = GetSurfBezier( pSurf) ;
bOk = ( pSBz != nullptr && pSBz->IsValid()) ;
// TODO :
bOk = false ; // <---
}
break ;
case SRF_FLATRGN : {
// Recupero la superficie piana
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pSurf) ;
bOk = ( pSfr != nullptr && pSfr->IsValid()) ;
// Definisco la superficie di estrusione dai Loops della regione piana
CICURVEPVECTOR vLoops ;
for ( int nChunk = 0 ; bOk && nChunk < pSfr->GetChunkCount() ; ++ nChunk) {
for ( int nLoop = 0 ; bOk && nLoop < pSfr->GetLoopCount( nChunk) ; ++ nLoop)
bOk = ( vLoops.emplace_back( pSfr->GetLoop( nChunk, nLoop)) && vLoops.back()->IsValid()) ;
}
bOk = bOk && pStmRes.Set( GetSurfTriMeshByRegionExtrusion( vLoops, - dOffs * pSfr->GetNormVersor(), dMyLinTol)) ;
}
default :
bOk = false ;
break ;
}
}
// Verifico che la superficie risultante sia valida
bOk = bOk && ( ! IsNull( pStmRes) && pStmRes->IsValid()) ;
// Porto la superficie risultante nel frame di destinazione
bOk = bOk && ( pStmRes->ToLoc( frDest)) ;
// Inserisco la superficie trimesh nel DB
int nNewId = GDB_ID_NULL ;
if ( bOk) {
nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStmRes)) ;
bOk = ( nNewId != GDB_ID_NULL) ;
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmShell(" + IdToString( nParentId) + "," +
IdToString( nSurfId) + "," +
ToString( dThick) + "," +
ToString( dLinTol) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfBezier( int nParentId, int nDegU, int nDegV, int nSpanU, int nSpanV, const PNTVECTOR& vPnt, int nRefType)
@@ -1938,7 +2038,7 @@ ExeCreateSurfBezierRational( int nParentId, int nDegU, int nDegV, int nSpanU, in
//-------------------------------------------------------------------------------
int
ExeCreateSurfBezierLeaves( int nParentId, int nSurfBzId, int nTextHeight, bool bShowTrim, int* pnCount)
ExeCreateSurfBezierLeaves( int nParentId, int nSurfBzId, int nTextHeight, bool bShowTrim, bool bRefined, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -1949,7 +2049,7 @@ ExeCreateSurfBezierLeaves( int nParentId, int nSurfBzId, int nTextHeight, bool b
return GDB_ID_NULL ;
// disegno le foglie
vector<tuple<int,Point3d,Point3d>> vLeaves ;
pSurfBez->GetLeaves( vLeaves) ;
pSurfBez->GetLeaves( vLeaves, bRefined) ;
double dFactor = 1 ;
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
@@ -2670,7 +2770,7 @@ ExeCreateSurfBzRuled( int nParentId, int nCrvId1, int nCrvId2, int nRuledType, b
//-------------------------------------------------------------------------------
int
ExeCreateSurfBzRuledGuided( int nParentId, int nCrvId1, int nCrvId2, int nLayGuides, bool bCapEnds, double dLinTol)
ExeCreateSurfBzRuledGuided( int nParentId, int nCrvId1, int nCrvId2, const BIPNTVECTOR& vGuidesCrv, bool bCapEnds, double dLinTol, int nLayGuides)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -2684,14 +2784,27 @@ ExeCreateSurfBzRuledGuided( int nParentId, int nCrvId1, int nCrvId2, int nLayGui
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) ;
BIPNTVECTOR vCrv ;
if( nLayGuides != -1 && vGuidesCrv.empty()) {
int nId = pGeomDB->GetFirstInGroup( nLayGuides) ;
while( nId != GDB_ID_NULL && bOk) {
CurveLocal CrvLocGuide( pGeomDB, nId, frLoc) ;
bOk = bOk && ( CrvLocGuide.Get() != nullptr) ;
const ICurve* pCrv = CrvLocGuide.Get() ;
Point3d ptStart ; pCrv->GetStartPoint( ptStart) ;
ptStart.ToLoc( frLoc) ;
Point3d ptEnd ; pCrv->GetEndPoint( ptEnd) ;
ptEnd.ToLoc( frLoc) ;
vCrv.emplace_back( ptStart, ptEnd) ;
nId = pGeomDB->GetNext( nId) ;
}
}
else if( ! vGuidesCrv.empty()) {
for( int i = 0 ; i < ssize( vGuidesCrv) ; ++i)
vCrv.emplace_back( GetToLoc( vGuidesCrv[i].first, frLoc), GetToLoc( vGuidesCrv[i].second, frLoc)) ;
}
else
return GDB_ID_NULL ;
// calcolo la superficie
PtrOwner<ISurfBezier> pSbz( bOk ? GetSurfBezierRuledGuided( CrvLoc1, CrvLoc2, vCrv, dLinTol) : nullptr) ;
+40 -60
View File
@@ -45,7 +45,16 @@ ExeCreateVolZmap( int nParentId, const Point3d& ptIni, double dDimX, double dDim
// creo lo Zmap nel suo riferimento intrinseco
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
bOk = bOk && ! IsNull( pVZM) ;
bOk = bOk && pVZM->Create( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex) ;
if ( bOk) {
int nError = 0 ;
bOk = pVZM->Create( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex, &nError) ;
if ( ! bOk) {
if ( nError == 1)
ExeOutLog( "EgtVolZmapBox too big for a 32-bit system") ;
else
ExeOutLog( "EgtVolZmapBox error number : " + ToString( nError)) ;
}
}
// lo porto nel riferimento locale
bOk = bOk && pVZM->ToGlob( frBox) ;
// inserisco lo Zmap nel DB
@@ -88,7 +97,16 @@ int ExeCreateVolZmapEmpty( int nParentId, const Point3d& ptIni, double dDimX, do
// creo lo Zmap nel suo riferimento intrinseco
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
bOk = bOk && ! IsNull( pVZM) ;
bOk = bOk && pVZM->CreateEmpty( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex) ;
if ( bOk) {
int nError = 0 ;
bOk = pVZM->CreateEmpty( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex, &nError) ;
if ( ! bOk) {
if ( nError == 1)
ExeOutLog( "EgtVolZmapEmpty too big for a 32-bit system") ;
else
ExeOutLog( "EgtVolZmapEmpty error number : " + ToString( nError)) ;
}
}
// lo porto nel riferimento locale
bOk = bOk && pVZM->ToGlob( frBox) ;
// inserisco lo Zmap nel DB
@@ -130,7 +148,16 @@ ExeCreateVolZmapByRegionExtrusion( int nParentId, int nSfrId, double dDimZ, doub
// creo lo Zmap nel suo riferimento intrinseco
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
bOk = bOk && ! IsNull( pVZM) ;
bOk = bOk && pVZM->CreateFromFlatRegion( *pSfr, dDimZ, dPrec, bTriDex) ;
if ( bOk) {
int nError = 0 ;
bOk = pVZM->CreateFromFlatRegion( *pSfr, dDimZ, dPrec, bTriDex, &nError) ;
if ( ! bOk) {
if ( nError == 1)
ExeOutLog( "EgtVolZmapByRegionExtrusion too big for a 32-bit system") ;
else
ExeOutLog( "EgtVolZmapByRegionExtrusion error number : " + ToString( nError)) ;
}
}
// lo porto nel riferimento di destinazione
bOk = bOk && pVZM->LocToLoc( frSfr, frDest) ;
// inserisco lo Zmap nel DB
@@ -169,7 +196,16 @@ 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, dExtraBox) ;
if ( bOk) {
int nError = 0 ;
bOk = pVZM->CreateFromTriMesh( *pStm, dPrec, bTriDex, dExtraBox, &nError) ;
if ( ! bOk) {
if ( nError == 1)
ExeOutLog( "EgtVolZmapFromSurfTm too big for a 32-bit system") ;
else
ExeOutLog( "EgtVolZmapFromSurfTm error number : " + ToString( nError)) ;
}
}
// lo porto nel riferimento di destinazione
bOk = bOk && pVZM->LocToLoc( frStm, frDest) ;
// inserisco lo Zmap nel DB
@@ -188,59 +224,3 @@ ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDe
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
bool
ExeUpdateVolZmapByAddingSurfTm( int nVolZmapId, int nStmId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nVolZmapId)) ;
bool bOk = ( pVZM != nullptr) ;
// recupero la trimesh
PtrOwner<ISurfTriMesh> pStm( CloneSurfTriMesh( pGeomDB->GetGeoObj( nStmId))) ;
bOk = bOk && !IsNull( pStm) ;
// recupero il frame dello Zmap e della Trimesh
Frame3d frZmap, frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( nVolZmapId, frZmap) &&
pGeomDB->GetGlobFrame( nStmId, frStm) ;
// porto la Stm nel frame dello Zmap
bOk = bOk && pStm->LocToLoc( frStm, frZmap) ;
// aggiorno lo Zmap con la nuova superficie
bOk = bOk && pVZM->AddSurfTm( pStm) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtUpdateVolZmapByAddingSurfTm(" + ToString( nVolZmapId) + "," +
ToString( nStmId) + ")"
" -- bOk =" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeUniformVolZmap( int nVolZmapId, double dToler, bool bExtensionFirst, int nToolNum)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nVolZmapId)) ;
bool bOk = ( pVZM != nullptr) ;
// aggiorno lo Zmap
dToler = max( dToler, EPS_SMALL) ;
bOk = bOk && pVZM->MakeUniform( dToler, bExtensionFirst, nToolNum) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtUniformVolZmap(" + ToString( nVolZmapId) + "," +
ToString( dToler) + "," +
( bExtensionFirst ? "true" : "false") +
ToString( nToolNum) + ")"
" -- bOk =" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
+1 -1
View File
@@ -760,7 +760,7 @@ ExeShowCurveBezierControlPoints( int nCrvId, int nDestGrpId, int* pnCount)
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva di Bezier
IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nCrvId) ;
if ( pGeoObj->GetType() != CRV_BEZIER && pGeoObj->GetType() != CRV_COMPO)
if ( pGeoObj == nullptr || ( pGeoObj->GetType() != CRV_BEZIER && pGeoObj->GetType() != CRV_COMPO))
return GDB_ID_NULL ;
// recupero il riferimento della curva
Frame3d frCrv ;
+3 -2
View File
@@ -23,7 +23,7 @@ using namespace std ;
//----------------------------------------------------------------------------
bool
ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType, bool bSmooth, int nDestGrpId,
ExePocketing( int nId, double dRad, double dStep, double dAngle, int nType, bool bSmooth, int nDestGrpId,
int& nFirstId, int& nCrvCount)
{
// database geometrico
@@ -59,7 +59,8 @@ 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, true, false, false, false, true, P_INVALID, nullptr, false, dStep, INFINITO, 0, vCrvCompoRes) ;
bool bOk = CalcPocketing( pSfr, dRad, 0, dStep, dAngle, 5., nType, bSmooth, true, false, false, false, true, P_INVALID, nullptr, false,
dStep, 0, INFINITO, 0, 0, INFINITO, false, 0., 0., vCrvCompoRes) ;
nFirstId = GDB_ID_NULL ;
nCrvCount = int( vCrvCompoRes.size()) ;
if ( bOk && nCrvCount > 0) {
+84 -18
View File
@@ -21,6 +21,7 @@
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveBezier.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
@@ -32,7 +33,6 @@
#include "/EgtDev/Include/EGkDistPointSurfFr.h"
#include "/EgtDev/Include/EGkDistPointSurfTm.h"
#include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkIntersLineBox.h"
#include "/EgtDev/Include/EGkIntersLineSurfTm.h"
#include "/EgtDev/Include/EGkCAvSilhouetteSurfTm.h"
#include "/EgtDev/Include/EGkCalcPocketing.h"
@@ -48,9 +48,6 @@ ExeSurfArea( int nId, double& dArea)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico il parametro
if ( &dArea == nullptr)
return false ;
// recupero la superficie
ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nId)) ;
// ne restituisco l'area
@@ -75,9 +72,6 @@ ExeSurfVolume( int nId, double& dVol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico il parametro
if ( &dVol == nullptr)
return false ;
// recupero la superficie
ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nId)) ;
// ne restituisco l'eventuale volume (se è chiusa)
@@ -106,9 +100,6 @@ ExeSurfFrGrossArea( int nId, double& dArea)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico il parametro
if ( &dArea == nullptr)
return false ;
// recupero la Regione
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
// ne restituisco l'area senza eventuali buchi
@@ -220,9 +211,6 @@ ExeSurfFrChunkMaxOffset( int nId, int nChunk, double& dMaxOffset)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico il parametro
if ( &dMaxOffset == nullptr)
return false ;
// recupero la Regione
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
return ( pSfr != nullptr && pSfr->GetChunkMaxOffset( nChunk, dMaxOffset)) ;
@@ -261,6 +249,46 @@ ExeSurfFrChunkSimpleClassify( int nId1, int nChunk1, int nId2, int nChunk2, doub
return nRes ;
}
//----------------------------------------------------------------------------
// Resultati restituiti : REGC_NULL ( errore), REGC_OUT ( Chunks esterni), REGC_INTERS ( Chunk che si intersecano)
int
ExeSurfFlatRegionInterference( int nId1, int nChunk1, int nId2, int nChunk2, double dToler)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pSfr1 != nullptr) ;
// recupero il riferimento della superficie
Frame3d frSurf1 ;
bOk = bOk && pGeomDB->GetGlobFrame( nId1, frSurf1) ;
// recupero la seconda superficie FlatRegion
const ISurfFlatRegion* pSfr2 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId2)) ;
bOk = bOk && ( pSfr2 != nullptr) ;
// recupero il riferimento della superficie
Frame3d frSurf2 ;
bOk = bOk && pGeomDB->GetGlobFrame( nId2, frSurf2) ;
// se riferimenti diversi, porto una copia della seconda nel riferimento della prima
const ISurfFlatRegion* pSfr2L = pSfr2 ;
PtrOwner<ISurfFlatRegion> pTmp ;
if ( bOk && ( abs( dToler) > EPS_SMALL || ! AreSameFrame( frSurf1, frSurf2))) {
pTmp.Set( pSfr2->Clone()) ;
bOk = ( ! IsNull( pTmp)) ;
bOk = bOk && pTmp->LocToLoc( frSurf2, frSurf1) ;
pTmp->Offset( - abs( dToler), ICurve::OFF_FILLET) ;
pSfr2L = pTmp ;
}
// verifico interferenza del Chunk della prima regione rispetto a quello della seconda
int nRes = REGC_NULL ;
if ( bOk) {
bool bInterference = false ;
bOk = pSfr1->CheckChunkInterference( nChunk1, *pSfr2L, nChunk2, bInterference) ;
if ( bOk)
nRes = ( bInterference ? REGC_INTERS : REGC_OUT) ;
}
return nRes ;
}
//----------------------------------------------------------------------------
bool
ExeSurfFrChunkCenter( int nId, int nChunk, int nRefId, Point3d& ptCen, Vector3d& vtN)
@@ -374,6 +402,20 @@ ExeSurfTmPartCount( int nId)
return pStm->GetPartCount() ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmGetPartAndShellFromFacet( int nIdSurfTm, int nIdFacet, int& nPart, int& nShell)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nIdSurfTm)) ;
if ( pStm == nullptr)
return false ;
// recupero la parte e la shell a cui appartiene la faccia passata
return pStm->GetPartAndShellFromFacet( nIdFacet, nPart, nShell) ;
}
//-----------------------------------------------------------------------------
bool
ExeSurfTmGetVertex( int nId, int nVert, int nRefId, Point3d& ptVert)
@@ -1573,7 +1615,7 @@ ExeSurfBezierGetPointNrmD1( int nSurfId, double dU, double dV, int nUsd, int nVs
}
//----------------------------------------------------------------------------
int
static int
MySurfBezierGetCurveUV( int nSurfId, bool bIsU, double dPar, int nDestGrpId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
@@ -1658,6 +1700,30 @@ ExeSurfBezierGetCurveV( int nSurfId, double dU, int nDestGrpId)
return nNewId ;
}
//----------------------------------------------------------------------------
bool
ExeSurfBezierParamsFromPoint( int nSurfId, const Point3d& ptOnSurf, int nRefId, double& dU, double& dV)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie di Bezier
const ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nSurfId)) ;
if ( pSbz == nullptr)
return false ;
// porto il punto Near nel riferimento dell'entità
Point3d ptOnSurfL = ptOnSurf ;
if ( ! InvTransformPoint( pGeomDB, nSurfId, nRefId, ptOnSurfL))
return false ;
// determino i parametri corrispondenti al punto
Point3d ptParam ;
if ( ! pSbz->UnprojectPoint( ptOnSurfL, ptParam, P_INVALID))
return false ;
dU = ptParam.x ;
dV = ptParam.y ;
return true ;
}
//----------------------------------------------------------------------------
bool
ExeSurfBezierGetInfo( int nSurfId, int& nDegU, int& nDegV, int& nSpanU, int& nSpanV, bool& bIsRat, bool& bTrimmed)
@@ -1787,7 +1853,7 @@ 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)
if ( ! bOk)
return GDB_ID_NULL ;
// recupero il riferimento della superficie
Frame3d frSurf ;
@@ -1837,10 +1903,10 @@ int
ExeShowSurfBezierControlPoints( int nSrfId, int nDestGrpId, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie di bezier
IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nSrfId) ;
if ( pGeoObj->GetType() != SRF_BEZIER)
if ( pGeoObj == nullptr || pGeoObj->GetType() != SRF_BEZIER)
return GDB_ID_NULL ;
// recupero il riferimento della superficie
Frame3d frSurf ;
@@ -1871,4 +1937,4 @@ ExeShowSurfBezierControlPoints( int nSrfId, int nDestGrpId, int* pnCount)
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
}
+127 -24
View File
@@ -208,7 +208,7 @@ ExeApproxCurve( int nId, int nApprType, double dLinTol, double dMaxSegmLen)
// eliminazione di small Z
bOk = bOk && pCC->RemoveSmallDefects( 0.5 * dLinTol, ANG_TOL_STD_DEG) ;
}
else { // con bi-archi
else if ( nApprType == APP_ARCS) { // con bi-archi
PolyArc PA ;
double dLinFea = LIN_FEA_STD ;
double dAngTol = ANG_TOL_STD_DEG ;
@@ -223,6 +223,11 @@ ExeApproxCurve( int nId, int nApprType, double dLinTol, double dMaxSegmLen)
// merge di archi identici di biarchi
bOk = bOk && pCC->MergeCurves( 0.5 * dLinTol, ANG_TOL_STD_DEG) ;
}
else if ( nApprType == APP_CUBIC_BEZIER) {
PtrOwner<ICurve> pCrv( ApproxCurveWithBezier( pCurve, dLinTol)) ;
bOk = bOk && ! IsNull( pCrv) ;
bOk = bOk && pCC->AddCurve( Release( pCrv)) ;
}
// copio estrusione e spessore
Vector3d vtExtr ;
if ( bOk && pCurve->GetExtrusion( vtExtr))
@@ -2441,8 +2446,106 @@ ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
//-------------------------------------------------------------------------------
static bool
MyProjectCurveOnSurf( int nCurveId, const INTVECTOR& vnSurfId, const Vector3d& vtProj, int nDestGrpId,
double dLinTol, double dMaxSegmLen, bool bDirFromProj, int nRefType)
MyProjectCurveOnSurf( int nCurveId, const INTVECTOR& vnSurfId, int nDestGrpId,
double dLinTol, double dMaxSegmLen)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva e il suo riferimento
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCurveId)) ;
if ( pCrv == nullptr)
return false ;
Frame3d frCrv ;
if ( ! pGeomDB->GetGlobFrame( nCurveId, frCrv))
return false ;
// deve esserci almeno una superficie
if ( vnSurfId.empty())
return false ;
// 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, frSurf) ;
if ( CrvLoc.Get() == nullptr)
return false ;
// eseguo la proiezione
PNT5AXVECTOR vPt5ax ;
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, dLinTol, dMaxSegmLen, true, vPt5ax))
return false ;
// inserisco la composita nel gruppo destinazione
PtrOwner<ICurveComposite> pCompo ;
for ( const auto& Pt5ax : vPt5ax) {
if ( IsNull( pCompo)) {
pCompo.Set( CreateCurveComposite()) ;
if ( IsNull( pCompo))
return false ;
pCompo->AddPoint( GetLocToLoc( Pt5ax.ptP, frSurf, frDest)) ;
}
else
pCompo->AddLine( GetLocToLoc( Pt5ax.ptP, frSurf, frDest)) ;
}
int nCompoId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCompo)) ;
if ( nCompoId == GDB_ID_NULL)
return false ;
// aggiungo i versori nel gruppo destinazione
int nInd = 0 ;
for ( const auto& Pt5ax : vPt5ax) {
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
if ( IsNull( pGeoVct))
return false ;
pGeoVct->Set( 10 * GetLocToLoc( Pt5ax.vtDir1, frSurf, frDest), GetLocToLoc( Pt5ax.ptP, frSurf, frDest)) ;
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pGeoVct)) ;
if ( nNewId == GDB_ID_NULL)
return false ;
pGeomDB->SetInfo( nNewId, "Ind", nInd ++) ;
pGeomDB->SetInfo( nNewId, "Par", Pt5ax.dPar) ;
pGeomDB->SetInfo( nNewId, "Flag", Pt5ax.nFlag) ;
pGeomDB->SetInfo( nNewId, "DirU", Pt5ax.vtDirU) ;
pGeomDB->SetInfo( nNewId, "DirV", Pt5ax.vtDirV) ;
}
return true ;
}
//-------------------------------------------------------------------------------
bool
ExeProjectCurveOnSurf( int nCurveId, const INTVECTOR& vnSurfId, int nDestGrpId,
double dLinTol, double dMaxSegmLen)
{
bool bOk = MyProjectCurveOnSurf( nCurveId, vnSurfId, nDestGrpId, dLinTol, dMaxSegmLen) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtProjectCurveOnSurf(" + ToString( nCurveId) + ",{" +
ToString( vnSurfId) + "},{" +
ToString( nDestGrpId) + "," +
ToString( dLinTol) + "," +
ToString( dMaxSegmLen) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//-------------------------------------------------------------------------------
static bool
MyProjectCurveOnSurfDir( int nCurveId, const INTVECTOR& vnSurfId, const Vector3d& vtProj, int nDestGrpId,
double dLinTol, double dMaxSegmLen, bool bDirFromProj, bool bFromVsTo, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -2484,7 +2587,7 @@ MyProjectCurveOnSurf( int nCurveId, const INTVECTOR& vnSurfId, const Vector3d& v
bool bSharpEdges = ( ! bDirFromProj) ;
// eseguo la proiezione
PNT5AXVECTOR vPt5ax ;
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, vtProjL, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, vtProjL, dLinTol, dMaxSegmLen, bSharpEdges, bFromVsTo, vPt5ax))
return false ;
// inserisco la composita nel gruppo destinazione
PtrOwner<ICurveComposite> pCompo ;
@@ -2522,32 +2625,32 @@ MyProjectCurveOnSurf( int nCurveId, const INTVECTOR& vnSurfId, const Vector3d& v
//-------------------------------------------------------------------------------
bool
ExeProjectCurveOnSurf( int nCurveId, const INTVECTOR& vnSurfId, const Vector3d& vtProj, int nDestGrpId,
double dLinTol, double dMaxSegmLen, bool bDirFromProj, int nRefType)
ExeProjectCurveOnSurfDir( int nCurveId, const INTVECTOR& vnSurfId, const Vector3d& vtProj, int nDestGrpId,
double dLinTol, double dMaxSegmLen, bool bDirFromProj, bool bFromVsTo, int nRefType)
{
bool bOk = MyProjectCurveOnSurf( nCurveId, vnSurfId, vtProj, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, nRefType) ;
bool bOk = MyProjectCurveOnSurfDir( nCurveId, vnSurfId, vtProj, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, bFromVsTo, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtProjectCurveOnSurf(" + ToString( nCurveId) + ",{" +
ToString( vnSurfId) + "},{" +
ToString( vtProj) + "}," +
ToString( nDestGrpId) + "," +
ToString( dLinTol) + "," +
ToString( dMaxSegmLen) + "," +
( bDirFromProj ? "true" : "false") + "," +
RefTypeToString( nRefType) + ")" +
string sLua = "EgtProjectCurveOnSurfDir(" + ToString( nCurveId) + ",{" +
ToString( vnSurfId) + "},{" +
ToString( vtProj) + "}," +
ToString( nDestGrpId) + "," +
ToString( dLinTol) + "," +
ToString( dMaxSegmLen) + "," +
( bDirFromProj ? "true" : "false") + "," +
( bFromVsTo ? "true" : "false") + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//-------------------------------------------------------------------------------
static bool
MyProjectCurveOnSurfExt( int nCurveId, const INTVECTOR& vnSurfId, int nGuideId, int nDestGrpId,
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
double dLinTol, double dMaxSegmLen, bool bDirFromGuide, bool bFromVsTo)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -2608,14 +2711,14 @@ MyProjectCurveOnSurfExt( int nCurveId, const INTVECTOR& vnSurfId, int nGuideId,
if ( pGdeLoc == nullptr)
return false ;
pGdeLoc->LocToLoc( frGde, frSurf) ;
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, bFromVsTo, vPt5ax))
return false ;
}
else if ( pGdeCrv != nullptr) {
CurveLocal GdeLoc( pGdeCrv, frGde, frSurf) ;
if ( GdeLoc.Get() == nullptr)
return false ;
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *GdeLoc.Get(), dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *GdeLoc.Get(), dLinTol, dMaxSegmLen, bSharpEdges, bFromVsTo, vPt5ax))
return false ;
}
else { // pGdeStm != nullptr
@@ -2623,7 +2726,7 @@ MyProjectCurveOnSurfExt( int nCurveId, const INTVECTOR& vnSurfId, int nGuideId,
const ISurf* pGdeLoc = GetSurf( GdeLoc.Get()) ;
if ( pGdeLoc == nullptr)
return false ;
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, bFromVsTo, vPt5ax))
return false ;
}
// inserisco la composita nel gruppo destinazione
@@ -2663,9 +2766,9 @@ MyProjectCurveOnSurfExt( int nCurveId, const INTVECTOR& vnSurfId, int nGuideId,
//-------------------------------------------------------------------------------
bool
ExeProjectCurveOnSurfExt( int nCurveId, const INTVECTOR& vnSurfId, int nGuideId, int nDestGrpId,
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
double dLinTol, double dMaxSegmLen, bool bDirFromGuide, bool bFromVsTo)
{
bool bOk = MyProjectCurveOnSurfExt( nCurveId, vnSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
bool bOk = MyProjectCurveOnSurfExt( nCurveId, vnSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide, bFromVsTo) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -2675,12 +2778,12 @@ ExeProjectCurveOnSurfExt( int nCurveId, const INTVECTOR& vnSurfId, int nGuideId,
ToString( nDestGrpId) + "," +
ToString( dLinTol) + "," +
ToString( dMaxSegmLen) + "," +
( bDirFromGuide ? "true" : "false") + ")" +
( bDirFromGuide ? "true" : "false") + "," +
( bFromVsTo ? "true" : "false") + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
+23 -2
View File
@@ -1185,7 +1185,10 @@ ExeSurfTmGetShowEdges( int nId, bool& bShow)
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero lo stato di visualizzazione degli spigoli vivi
bShow = ( bOk && pStm->GetShowEdges()) ;
if ( bOk)
bShow = pStm->GetShowEdges() ;
else
bShow = false ;
return bOk ;
}
@@ -1199,6 +1202,7 @@ ExeSurfTmSetSmoothAng( int nId, double dAngDeg)
ISurfTriMesh* pSrfTm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pSrfTm == nullptr)
return false ;
// imposto l'angolo discriminante degli spigoli vivi
pSrfTm->SetSmoothAngle( dAngDeg) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
@@ -1210,11 +1214,28 @@ ExeSurfTmSetSmoothAng( int nId, double dAngDeg)
return true ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmGetSmoothAng( int nId, double& dAngDeg)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero l'angolo discriminante degli spigoli vivi
if ( bOk)
dAngDeg = pStm->GetSmoothAngle() ;
else
dAngDeg = 0 ;
return bOk ;
}
//----------------------------------------------------------------------------
static double
GetStmOffsPrec( double dOffs, double dLinTol)
{
return max( min( abs( dOffs) / 4, 100 * max( dLinTol, EPS_SMALL)), 0.5) ;
return max( min( abs( dOffs) / 4., 10. * max( dLinTol, EPS_SMALL)), 0.5) ;
}
//----------------------------------------------------------------------------
+101
View File
@@ -142,6 +142,23 @@ ExeVolZmapSetShowEdges( int nId, bool bShow)
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapGetShowEdges( int nId, bool& bShow)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pVZM != nullptr) ;
// leggo lo stato di visualizzazione degli spigoli vivi
if ( bOk)
bShow = pVZM->GetShowEdges() ;
else
bShow = false ;
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeRemoveVolZmapPart( int nId, int nPart)
@@ -561,3 +578,87 @@ ExeVolZMapOffset( int nId, double dDist, int nType)
}
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeUpdateVolZmapByAddingSurfTm( int nVolZmapId, int nStmId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nVolZmapId)) ;
bool bOk = ( pVZM != nullptr) ;
// recupero la trimesh
PtrOwner<ISurfTriMesh> pStm( CloneSurfTriMesh( pGeomDB->GetGeoObj( nStmId))) ;
bOk = bOk && !IsNull( pStm) ;
// recupero il frame dello Zmap e della Trimesh
Frame3d frZmap, frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( nVolZmapId, frZmap) &&
pGeomDB->GetGlobFrame( nStmId, frStm) ;
// porto la Stm nel frame dello Zmap
bOk = bOk && pStm->LocToLoc( frStm, frZmap) ;
// aggiorno lo Zmap con la nuova superficie
bOk = bOk && pVZM->AddSurfTm( pStm) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtUpdateVolZmapByAddingSurfTm(" + ToString( nVolZmapId) + "," +
ToString( nStmId) + ")"
" -- bOk =" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeVolZmapMakeUniform( int nVolZmapId, double dToler, bool bExtensionFirst, int nToolNum)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nVolZmapId)) ;
bool bOk = ( pVZM != nullptr) ;
// aggiorno lo Zmap
dToler = max( dToler, EPS_SMALL) ;
bOk = bOk && pVZM->MakeUniform( dToler, bExtensionFirst, nToolNum) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapMakeUniform(" + ToString( nVolZmapId) + "," +
ToString( dToler) + "," +
( bExtensionFirst ? "true" : "false") +
ToString( nToolNum) + ")"
" -- bOk =" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//--------------------------------------------------------------------------------
bool
ExeVolZMapRemoveFins( int nVolZMapId, const Vector3d& vtDir, double dThick, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) ;
// Recupero lo ZMap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nVolZMapId)) ;
bool bOk = ( pVZM != nullptr) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nVolZMapId, frLoc) ;
// porto in locale la normale al piano
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frLoc) ;
// Aggiorno lo ZMap mediante rimozione delle alette
bOk = bOk && pVZM->RemoveFins( vtDirL, dThick) ;
// Se richiesto salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZMapRemoveFins(" + ToString( nVolZMapId) + "," +
ToString( vtDir) + "," +
ToString( dThick) + "," +
RefTypeToString( nRefType) + ")" +
" -- bOk =" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
+19
View File
@@ -15,6 +15,7 @@
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "AuxDialogBox.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EgtStringConverter.h"
@@ -76,6 +77,9 @@ ExeSelectObj( int nId)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// verifico se presente un dialogo modeless per aggiornare i valori
if ( bOk && phDlgModeless != nullptr && nDlgModelessItem != -1)
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
// restituisco risultato
return bOk ;
}
@@ -100,6 +104,9 @@ ExeDeselectObj( int nId)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// verifico se presente un dialogo modeless per aggiornare i valori
if ( bOk && phDlgModeless != nullptr && nDlgModelessItem != -1)
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
// restituisco risultato
return bOk ;
}
@@ -139,6 +146,9 @@ ExeSelectAll( bool bOnlyIfVisible)
" -- bOk=1" ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// verifico se presente un dialogo modeless per aggiornare i valori
if ( phDlgModeless != nullptr && nDlgModelessItem != -1)
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
// restituisco risultato
return true ;
}
@@ -160,6 +170,9 @@ ExeDeselectAll( void)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// verifico se presente un dialogo modeless per aggiornare i valori
if ( bOk && phDlgModeless != nullptr && nDlgModelessItem != -1)
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
// restituisco risultato
return bOk ;
}
@@ -186,6 +199,9 @@ ExeSelectGroupObjs( int nGroupId)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// verifico se presente un dialogo modeless per aggiornare i valori
if ( bOk && phDlgModeless != nullptr && nDlgModelessItem != -1)
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
// restituisco risultato
return bOk ;
}
@@ -209,6 +225,9 @@ ExeDeselectGroupObjs( int nGroupId)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// verifico se presente un dialogo modeless per aggiornare i valori
if ( bOk && phDlgModeless != nullptr && nDlgModelessItem != -1)
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
// restituisco risultato
return bOk ;
}
+23
View File
@@ -393,6 +393,29 @@ ExeCopyGlobEx( int nSouCtx, int nSouId, int nDestCtx, int nRefId, int nSonBefore
return nNewId ;
}
//-----------------------------------------------------------------------------
bool
ExeDuplicateGeomDB( int nSouCtx, int nDestCtx, bool bSkipTemp)
{
// recupero i due GeomDB
IGeomDB* pSouGeomDB = GetGeomDB( nSouCtx) ;
VERIFY_GEOMDB( pSouGeomDB, GDB_ID_NULL)
IGeomDB* pDstGeomDB = GetGeomDB( nDestCtx) ;
VERIFY_GEOMDB( pDstGeomDB, GDB_ID_NULL)
// eseguo la duplicazione del primo GeomDB nel secondo
bool bOk = DuplicateGeomDB( pSouGeomDB, pDstGeomDB, bSkipTemp) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtDuplicateGeomDB(" + ToString( nSouCtx) + "," +
ToString( nDestCtx) + "," +
( bSkipTemp ? "true" : "false") + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeRelocate( int nSouId, int nRefId, int nSonBeforeAfter)
+86 -35
View File
@@ -47,8 +47,8 @@
using namespace std ;
//-------------------------------------------------------------------------------
bool
MyLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, const int nId, const int nRefType,
static bool
MyLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType,
INTDBLVECTOR& vInters)
{
vInters.clear() ;
@@ -71,7 +71,7 @@ MyLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, const int nId, con
if ( ! CrvLoc->GetLocalBBox( b3Crv))
return false ;
b3Crv.Expand( 100 * EPS_SMALL) ;
// definisco la linea (punto e direzione sono gi nel riferimento di calcolo)
// definisco la linea (punto e direzione sono già nel riferimento di calcolo)
double dLen = 2 * floor( b3Crv.MaxDistFromPoint( ptP)) ;
double dOffs = -dLen / 2 ;
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
@@ -127,7 +127,7 @@ MyLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, const int nId, con
//-------------------------------------------------------------------------------
bool
ExeLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, const int nId, const int nRefType,
ExeLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType,
INTDBLVECTOR& vInters)
{
// eseguo
@@ -161,7 +161,7 @@ ExeLineBoxInters( const Point3d& ptP, const Vector3d& vtDir, const BBox3d& b3Box
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entit
// restituisco l'identificativo della prima nuova entità
return bOk ;
}
@@ -217,7 +217,7 @@ ExeLineSurfTmInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRe
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entit
// restituisco l'identificativo della prima nuova entità
return bOk ;
}
@@ -272,7 +272,7 @@ ExeLineSurfBzInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRe
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entit
// restituisco l'identificativo della prima nuova entità
return bOk ;
}
@@ -359,15 +359,27 @@ MyAddPlaneIntersResultToGeomDB( IGeomDB* pGeomDB, const PNTVECTOR& vPnt, const B
}
// Inserisco le curve nel DB (dopo averle concatenate)
ChainCurves chainC ;
chainC.Init( false, dToler, int( vBpt.size())) ;
chainC.Init( false, dToler, int( vBpt.size())) ;
DBLVECTOR vdLen ; vdLen.reserve( vBpt.size()) ;
for ( int i = 0 ; i < int( vBpt.size()) ; ++ i) {
Vector3d vtDir = vBpt[i].second - vBpt[i].first ;
vdLen.emplace_back( vtDir.Len()) ;
vtDir.Normalize() ;
if ( ! chainC.AddCurve( i + 1, vBpt[i].first, vtDir, vBpt[i].second, vtDir))
return GDB_ID_NULL ;
}
// recupero i percorsi concatenati
// il punto di inizio viene scelto come lo start di un tratto più lungo della tolleranza in modo da evitare casi problematici
// del chain in cui percorsi formati da tratti di lunghezza inferiore alla tolleranza vengono individuati erroneamente come chiusi
// interrompendo il loro concatenamento con le altre curve
Point3d ptNear = ( vBpt.empty() ? ORIG : vBpt[0].first) ;
for ( int i = 0 ; i < int( vdLen.size()) ; ++ i) {
if ( vdLen[i] > 2 * dToler) {
ptNear = vBpt[i].first ;
break ;
}
}
INTVECTOR vId ;
while ( chainC.GetChainFromNear( ptNear, false, vId)) {
// creo una curva composita
@@ -390,6 +402,8 @@ MyAddPlaneIntersResultToGeomDB( IGeomDB* pGeomDB, const PNTVECTOR& vPnt, const B
pLine->Set( ptStart, ptEnd) &&
pCrvCompo->AddCurve( Release( pLine), true, dToler)) ;
ptNear = ( bAdded ? ptEnd : ptStart) ;
// rendo invalida la sua lunghezza per non ritrovarlo come tratto iniziale del percorso successivo
vdLen[nInd] = -1 ;
}
// se lunghezza curva inferiore a 5 volte la tolleranza, la ignoro
double dCrvLen ;
@@ -421,6 +435,13 @@ MyAddPlaneIntersResultToGeomDB( IGeomDB* pGeomDB, const PNTVECTOR& vPnt, const B
if ( nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
++ nCrvCount ;
// scelgo il nuovo punto di inizio
for ( int i = 0 ; i < int( vdLen.size()) ; ++ i) {
if ( vdLen[i] > 2 * dToler) {
ptNear = vBpt[i].first ;
break ;
}
}
}
// Inserisco i triangoli nel DB (dopo averli uniti in una superficie trimesh)
StmFromTriangleSoup StmFts ;
@@ -454,8 +475,8 @@ MyAddPlaneIntersResultToGeomDB( IGeomDB* pGeomDB, const PNTVECTOR& vPnt, const B
}
//-------------------------------------------------------------------------------
int
MyPlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, const int nDestGrpId, const int nRefType, int& nCount)
static int
MyPlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDestGrpId, int nRefType, int& nCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -546,13 +567,13 @@ MyPlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, con
EPS_SMALL, nPntCount, nCrvCount, nTmp) ;
nCount = nPntCount + nCrvCount ;
// restituisco l'identificativo della prima entit creata
// restituisco l'identificativo della prima entità creata
return nFirstId ;
}
//-------------------------------------------------------------------------------
int
ExePlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, const int nDestGrpId, const int nRefType, int* pnCount)
ExePlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDestGrpId, int nRefType, int* pnCount)
{
// eseguo
int nCount{ 0} ;
@@ -575,7 +596,7 @@ ExePlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, co
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entit
// restituisco l'identificativo della prima nuova entità
return nFirstId ;
}
@@ -746,7 +767,7 @@ MyPlaneBoxInters( const Point3d& ptOn, const Vector3d& vtN, const BBox3d& b3Box,
nFirstId = nNewId ;
++ nSrfCount ;
}
// restituisco l'identificativo della prima nuova entit
// restituisco l'identificativo della prima nuova entità
return nFirstId ;
}
@@ -779,7 +800,7 @@ ExePlaneBoxInters( const Point3d& ptOn, const Vector3d& vtN, const BBox3d& b3Box
", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entit
// restituisco l'identificativo della prima nuova entità
return nFirstId ;
}
@@ -818,7 +839,7 @@ MyPlaneSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDes
// inserisco il risultato dell'intersezione nel DB
int nFirstId = MyAddPlaneIntersResultToGeomDB( pGeomDB, vPnt, vBpt, vTria, frSurf, frDest, nId, nDestGrpId, plPlane.GetVersN(), dToler,
nPntCount, nCrvCount, nSrfCount) ;
// restituisco l'identificativo della prima nuova entit
// restituisco l'identificativo della prima nuova entità
return nFirstId ;
}
@@ -852,7 +873,7 @@ ExePlaneSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDe
", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entit
// restituisco l'identificativo della prima nuova entità
return nFirstId ;
}
@@ -941,7 +962,7 @@ ExeParPlanesSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, const DBLVEC
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entit
// restituisco l'identificativo della prima nuova entità
return nFirstId ;
}
@@ -977,7 +998,7 @@ MyPlaneVolZmapInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDe
PtrOwner<ICurve> pCrv( Release( vpLoop[i])) ;
if ( IsNull( pCrv))
continue ;
pCrv->ToLoc( frDest) ;
pCrv->LocToLoc( frLoc, frDest) ;
// inserisco la curva composita nel gruppo destinazione
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, ::Release( pCrv)) ;
if ( nNewId == GDB_ID_NULL)
@@ -986,7 +1007,7 @@ MyPlaneVolZmapInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDe
nFirstId = nNewId ;
++ nCount ;
}
// restituisco l'identificativo della prima nuova entit
// restituisco l'identificativo della prima nuova entità
return nFirstId ;
}
@@ -1010,13 +1031,13 @@ ExePlaneVolZmapInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nD
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entit
// restituisco l'identificativo della prima nuova entità
return nFirstId ;
}
//-------------------------------------------------------------------------------
int
MyCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int& nPntCount, int& nCrvCount)
static int
MyCurveCurveInters( int nId1, int nId2, int nDestGrpId, int& nPntCount, int& nCrvCount, bool bOnly3D)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -1032,14 +1053,24 @@ MyCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int& n
CurveLocal Crv1Loc( pGeomDB, nId1, frDest) ;
CurveLocal Crv2Loc( pGeomDB, nId2, frDest) ;
if( Crv1Loc.Get() == nullptr || Crv2Loc.Get() == nullptr)
return GDB_ID_NULL ;
// intersezione fra le curve nel piano XY locale
IntersCurveCurve intCC( *Crv1Loc, *Crv2Loc, true) ;
int nInters = intCC.GetIntersCount() ;
int nInters = 0 ;
if ( ! bOnly3D)
nInters = intCC.GetIntersCount() ;
else
nInters = intCC.GetInters3DCount() ;
// recupero i punti risultanti
for ( int i = 0 ; i < nInters ; i++) {
IntCrvCrvInfo aInfo ;
intCC.GetIntCrvCrvInfo( i, aInfo) ;
IntCrvCrvInfo aInfo ;
if( ! bOnly3D)
intCC.GetIntCrvCrvInfo( i, aInfo) ;
else
intCC.GetInt3DCrvCrvInfo( i, aInfo) ;
// verifico se punto
if ( ! aInfo.bOverlap) {
PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ;
@@ -1060,7 +1091,10 @@ MyCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int& n
// recupero le curve risultanti
for ( int i = 0 ; i < nInters ; i++) {
IntCrvCrvInfo aInfo ;
intCC.GetIntCrvCrvInfo( i, aInfo) ;
if( ! bOnly3D)
intCC.GetIntCrvCrvInfo( i, aInfo) ;
else
intCC.GetInt3DCrvCrvInfo( i, aInfo) ;
// verifico se curva
if ( aInfo.bOverlap) {
PtrOwner<ICurve> pCrvRes( Crv1Loc->CopyParamRange( aInfo.IciA[0].dU, aInfo.IciA[1].dU)) ;
@@ -1082,11 +1116,11 @@ MyCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int& n
//-------------------------------------------------------------------------------
int
ExeCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int* pnPntCount, int* pnCrvCount)
ExeCurveCurveInters( int nId1, int nId2, int nDestGrpId, int* pnPntCount, int* pnCrvCount, bool bOnly3D)
{
// eseguo
int nPntCount{ 0}, nCrvCount{ 0} ;
int nFirstId = MyCurveCurveInters( nId1, nId2, nDestGrpId, nPntCount, nCrvCount) ;
int nFirstId = MyCurveCurveInters( nId1, nId2, nDestGrpId, nPntCount, nCrvCount, bOnly3D) ;
// aggiorno contatori
if ( nFirstId != GDB_ID_NULL) {
if ( pnPntCount != nullptr)
@@ -1104,7 +1138,7 @@ ExeCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int*
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entit
// restituisco l'identificativo della prima nuova entità
return nFirstId ;
}
@@ -1127,7 +1161,7 @@ GetCurveSurfTmIntersType( int nFlag)
//-------------------------------------------------------------------------------
static int
MyCurveSurfTmInters( const int nCrvId, const int nId2, const int nDestGrpId, int& nPntCount, int& nCrvCount)
MyCurveSurfTmInters( int nCrvId, int nId2, int nDestGrpId, int& nPntCount, int& nCrvCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -1209,7 +1243,7 @@ MyCurveSurfTmInters( const int nCrvId, const int nId2, const int nDestGrpId, int
//-------------------------------------------------------------------------------
int
ExeCurveSurfTmInters( const int nCrvId, const int nStmId, const int nDestGrpId, int* pnPntCount, int* pnCrvCount)
ExeCurveSurfTmInters( int nCrvId, int nStmId, int nDestGrpId, int* pnPntCount, int* pnCrvCount)
{
// eseguo
int nPntCount{ 0}, nCrvCount{ 0} ;
@@ -1364,7 +1398,7 @@ MySurfTmSurfTmInters( int nId1, int nId2, int nDestGrpId, double dToler,
const ISurfTriMesh* pStm2L = GetSurfTriMesh( Surf2Loc) ;
if ( pStm2L == nullptr)
return GDB_ID_NULL ;
// eseguo l'intersezione (gi espressa nel riferimento destinazione)
// eseguo l'intersezione (già espressa nel riferimento destinazione)
PNTVECTOR vPnt ;
BIPNTVECTOR vBpt ;
TRIA3DVECTOR vTria ;
@@ -1420,7 +1454,7 @@ MySurfTmSurfTmInters( int nId1, int nId2, int nDestGrpId, double dToler,
nFirstId = nNewId ;
++ nSrfCount ;
}
// restituisco l'identificativo della prima nuova entit
// restituisco l'identificativo della prima nuova entità
return nFirstId ;
}
@@ -1452,6 +1486,23 @@ ExeSurfTmSurfTmInters( int nId1, int nId2, int nDestGrpId, double dToler,
", CrvNbr=" + ToString( nCrvCount) + ", SrfNbr=" + ToString( nSrfCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della prima nuova entit
// restituisco l'identificativo della prima nuova entità
return nFirstId ;
}
//-------------------------------------------------------------------------------
bool
ExeBBoxOverlap( const BBox3d& bboxA, const Frame3d& frA, const BBox3d& bboxB, const Frame3d& frB)
{
bool bRes = Overlaps( bboxA, frA, bboxB, frB) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "ExeBBoxOverlap(" + ToString( bboxA) + "," +
ToString( frA) + "," +
ToString( bboxB) + "," +
ToString( frB) + ")" ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bRes ;
}
+7 -4
View File
@@ -417,14 +417,19 @@ class CamStatus
m_vIdStat.push_back( ( bShow ? nId : - nId)) ;
nId = pMachMgr->GetNextOperation( nId) ;
}
pMachMgr->ResetCurrMachGroup() ;
}
~CamStatus( void) {
Restore() ;
}
void Restore( void) {
if ( m_nCurrMachGroup == GDB_ID_NULL)
return ;
IMachMgr* pMachMgr = GetCurrMachMgr() ;
if ( pMachMgr == nullptr)
return ;
if ( m_nCurrMachGroup == GDB_ID_NULL)
return ;
pMachMgr->SetCurrMachGroup( m_nCurrMachGroup) ;
m_nCurrMachGroup = GDB_ID_NULL ;
if ( m_nCurrPhase == 0)
return ;
pMachMgr->SetCurrPhase( m_nCurrPhase, true) ;
@@ -449,7 +454,6 @@ ExeSaveFile( const string& sFilePath, int nFlag)
VERIFY_CTX_GEOMDB( pGseCtx, false)
// se ero in CAM, esco dopo averne salvato lo stato
CamStatus CurrCamStatus ;
ExeResetCurrMachGroup() ;
// imposto path corrente del file
pGseCtx->m_sFilePath = sFilePath ;
// salvo il file
@@ -554,7 +558,6 @@ ExeSaveMachGroupToFile( int nMGroupId, const INTVECTOR& vPlusId, const string& s
ExeDisableModified() ;
// 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) {
+118 -4
View File
@@ -1701,6 +1701,16 @@ ExeImportSetup( const string& sName)
return pMachMgr->ImportSetup( sName) ;
}
//-----------------------------------------------------------------------------
bool
ExeExistsCurrSetup( void)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// eseguo la verifica
return pMachMgr->ExistsCurrSetup() ;
}
//-----------------------------------------------------------------------------
bool
ExeVerifyCurrSetup( STRVECTOR& vsErrors)
@@ -2738,6 +2748,16 @@ ExeUpdateMachining( bool bPostApply)
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeChangePreviewMachiningToolShow( int nLookFlag)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// impostazione tipo visualizzazione anteprima utensile su lavorazione
return pMachMgr->ChangePreviewMachiningToolShow( nLookFlag) ;
}
//-----------------------------------------------------------------------------
bool
ExePreparePreviewMachiningTool( void)
@@ -2868,6 +2888,26 @@ ExeGetMachiningEndPoint( Point3d& ptEnd)
return pMachMgr->GetMachiningEndPoint( ptEnd) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetMachiningStartAxes( bool bSkipClimb, DBLVECTOR& vAxVal)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// restituisco quanto cercato
return pMachMgr->GetMachiningStartAxes( bSkipClimb, vAxVal) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetMachiningEndAxes( bool bSkipRise, DBLVECTOR& vAxVal)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// restituisco quanto cercato
return pMachMgr->GetMachiningEndAxes( bSkipRise, vAxVal) ;
}
//-----------------------------------------------------------------------------
bool
ExeApplyAllMachinings( bool bRecalc, bool bStopOnFirstErr, string& sErrList)
@@ -3060,6 +3100,16 @@ ExeGetClEntIndex( int nEntId, int& nIndex)
return pMachMgr->GetClEntIndex( nEntId, nIndex) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetClEntFeed( int nEntId, double& dFeed)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero la feed
return pMachMgr->GetClEntFeed( nEntId, dFeed) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetClEntAxesStatus( int nEntId, int& nStatus)
@@ -3090,6 +3140,36 @@ ExeGetClEntAxesVal( int nEntId, DBLVECTOR& vAxes)
return pMachMgr->GetClEntAxesVal( nEntId, vAxes) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetClEntTDir( int nEntId, Vector3d& vtTDir)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) ;
// recupero TDir
return pMachMgr->GetClEntTDir( nEntId, vtTDir) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetClEntCDir( int nEntId, Vector3d& vtCDir)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) ;
// recupero CDir
return pMachMgr->GetClEntCDir( nEntId, vtCDir) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetClEntADir( int nEntId, Vector3d& vtADir)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) ;
// recupero ADir
return pMachMgr->GetClEntADir( nEntId, vtADir) ;
}
//-----------------------------------------------------------------------------
// Simulazione
//-----------------------------------------------------------------------------
@@ -3232,12 +3312,14 @@ ExeGenerate( const string& sCncFile, const string& sInfo)
ReplaceString( sDir, "/", "\\") ;
// recupero il nome
string sNcName ;
if ( ! ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sNcName)) {
if ( ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sNcName))
sNcName = GetFileName( sNcName) ;
else {
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) ;
sNcName = ChangeFileExtension( GetFileName( sProjPath), sExt) ;
}
// creo la path completa
sMyCncFile = sDir + "\\" + sNcName ;
@@ -3264,8 +3346,10 @@ ExeEstimate( const string& sEstFile, const string& sInfo)
ReplaceString( sDir, "/", "\\") ;
// recupero il nome
string sEstName ;
if ( ! ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sEstName))
sEstName = GetFileTitleEgt( sProjPath) ;
if ( ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sEstName))
sEstName = GetFileName( sEstName) ;
else
sEstName = GetFileName( sProjPath) ;
sEstName = ChangeFileExtension( sEstName, ".html") ;
// creo la path completa
sMyEstFile = sDir + "\\" + sEstName ;
@@ -3386,6 +3470,16 @@ ExeSetCalcTool( const string& sTool, const string& sHead, int nExit)
return pMachMgr->SetCalcTool( sTool, sHead, nExit) ;
}
//----------------------------------------------------------------------------
bool
ExeSetCalcSolCh( int nScc, bool bExact)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// imposto il criterio di scelta della soluzione e se deve essere rispettato esattamente
return pMachMgr->SetCalcSolCh( nScc, bExact) ;
}
//----------------------------------------------------------------------------
bool
ExeSetRotAxisBlock( const string& sAxis, double dVal)
@@ -3416,6 +3510,16 @@ ExeGetCalcTool( string& sTool, string& sHead, int& nExit)
return ( pMachMgr->GetCalcTool( sTool) && pMachMgr->GetCalcHead( sHead) && pMachMgr->GetCalcExit( nExit)) ;
}
//----------------------------------------------------------------------------
bool
ExeGetCalcSolCh( int& nScc, bool& bExact)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero il criterio di scelta della soluzione e se deve essere rispettato esattamente
return pMachMgr->GetCalcSolCh( nScc, bExact) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetAllCurrAxesNames( STRVECTOR& vAxName)
@@ -3543,6 +3647,16 @@ ExeVerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB,
return pMachMgr->VerifyOutstroke( dX, dY, dZ, dAngA, dAngB, nStat) ;
}
//-----------------------------------------------------------------------------
bool
ExeVerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// verifica l'extracorsa degli assi
return pMachMgr->VerifyOutstroke( dX, dY, dZ, vAng, true, nStat) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetOutstrokeInfo( string& sInfo)
+35 -2
View File
@@ -147,12 +147,45 @@ ExeOptMachSetAllGroupDependencesAsMandatory( bool bAllMandatory)
//----------------------------------------------------------------------------
bool
ExeOptMachGetResult( INTVECTOR& vIds)
ExeOptMachSetOptimizationForGroups( bool bOptForGroups)
{
// Se oggetto non istanziato, errore
if ( IsNull( s_pMO))
return false ;
// Imposto il Flag
return ( s_pMO->SetOptimizationForGroups( bOptForGroups)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachSetOpenBound( bool bStartVsEnd, int nFlag, double dX, double dY, double dZ)
{
// Se oggetto non istanziato, errore
if ( IsNull( s_pMO))
return false ;
// Imposto il Flag
return ( s_pMO->SetOpenBound( bStartVsEnd, nFlag, dX, dY, dZ)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachSetOpenBoundForGroups( int nGroup, bool bStartVsEnd, int nFlag, double dX, double dY, double dZ)
{
// Se oggetto non istanziato, errore
if ( IsNull( s_pMO))
return false ;
// Impsto il Flag
return ( s_pMO->SetOpenBoundForGroups( nGroup, bStartVsEnd, nFlag, dX, dY, dZ)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachCalculate( INTVECTOR& vIds)
{
vIds.clear() ;
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Recupero i risultati
return ( s_pMO->GetResult( vIds)) ;
return ( s_pMO->Calculate( vIds)) ;
}
+10 -10
View File
@@ -16,13 +16,13 @@
class IGeomDB ;
//----------------------------------------------------------------------------
int GetFlatPartRegion( IGeomDB* pGeomDB, int nId) ;
int GetFlatPartUpRegion( IGeomDB* pGeomDB, int nId) ;
int GetFlatPartDownRegion( IGeomDB* pGeomDB, int nId) ;
bool GetFlatPartCutRegions( IGeomDB* pGeomDB, int nId, bool bReduced, INTVECTOR& vCrId) ;
bool GetFlatPartDownCutRegions( IGeomDB* pGeomDB, int nId, bool bReduced, INTVECTOR& vCrId) ;
bool GetFlatPartInterpartGap(IGeomDB* pGeomDB, int nId, double& dGap);
int GetFlatPartFromRegion( IGeomDB* pGeomDB, int nId) ;
int GetFlatPartFromCut( IGeomDB* pGeomDB, int nId) ;
int GetGeometryFromCut( IGeomDB* pGeomDB, IMachMgr* pMachMgr, int nId) ;
bool GetFlatPartApproxContour( IGeomDB* pGeomDB, int nId, PolyLine& PL) ;
int GetFlatPartRegion( IGeomDB* pGeomDB, int nId) ;
int GetFlatPartUpRegion( IGeomDB* pGeomDB, int nId) ;
int GetFlatPartDownRegion( IGeomDB* pGeomDB, int nId) ;
bool GetFlatPartCutRegions( IGeomDB* pGeomDB, int nId, bool bReduced, INTVECTOR& vCrId) ;
bool GetFlatPartDownCutRegions( IGeomDB* pGeomDB, int nId, bool bReduced, INTVECTOR& vCrId) ;
bool GetFlatPartInterpartGap(IGeomDB* pGeomDB, int nId, double& dGap);
int GetFlatPartFromRegion( IGeomDB* pGeomDB, int nId) ;
int GetFlatPartFromCut( IGeomDB* pGeomDB, int nId) ;
INTVECTOR GetGeometryFromCut( IGeomDB* pGeomDB, IMachMgr* pMachMgr, int nId) ;
bool GetFlatPartApproxContour( IGeomDB* pGeomDB, int nId, PolyLine& PL) ;
+11 -10
View File
@@ -2184,24 +2184,25 @@ GetFlatPartFromCut( IGeomDB* pGeomDB, int nId)
}
//----------------------------------------------------------------------------
int
INTVECTOR
GetGeometryFromCut( IGeomDB* pGeomDB, IMachMgr* pMachMgr, int nId)
{
INTVECTOR vnIds ;
if ( pGeomDB == nullptr || pMachMgr == nullptr)
return GDB_ID_NULL ;
return vnIds ;
// verifico appartenga ad una lavorazione
int nMchId ;
if ( ! pGeomDB->GetInfo( pGeomDB->GetParentId( pGeomDB->GetParentId( nId)), "MId", nMchId))
return GDB_ID_NULL ;
return vnIds ;
// recupero la geometria di applicazione della lavorazione (deve essere una sola)
if ( ! pMachMgr->SetCurrMachining( nMchId))
return GDB_ID_NULL ;
SELVECTOR vIds ;
pMachMgr->GetMachiningGeometry( vIds) ;
if ( vIds.size() == 1)
return vIds[0].nId ;
else
return GDB_ID_NULL ;
return vnIds ;
SELVECTOR vSelIds ;
pMachMgr->GetMachiningGeometry( vSelIds) ;
vnIds.reserve( vSelIds.size()) ;
for ( const SelData& mySelData : vSelIds)
vnIds.emplace_back( mySelData.nId) ;
return vnIds ;
}
//----------------------------------------------------------------------------
+6 -6
View File
@@ -143,7 +143,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
// confronto la regione di attacco della lavorazione con le regioni degli altri pezzi
for ( int nMchRegId : vMchLiReg) {
for ( int nOthRegId : vOthReg) {
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_LI ;
}
}
@@ -152,7 +152,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
if ( vMchDwnLiReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nMchRegId = ( ( vMchDwnLiReg[i] != GDB_ID_NULL) ? vMchDwnLiReg[i] : vMchLiReg[i]) ;
int nOthRegId = ( ( vOthDwnReg[j] != GDB_ID_NULL) ? vOthDwnReg[j] : vOthReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_LI ;
}
}
@@ -160,7 +160,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
// confronto la regione ridotta della lavorazione con le regioni degli altri pezzi
for ( int nMchRegId : vMchRReg) {
for ( int nOthRegId : vOthReg) {
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_RM ;
}
}
@@ -169,7 +169,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
if ( vMchDwnRReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nMchRegId = ( ( vMchDwnRReg[i] != GDB_ID_NULL) ? vMchDwnRReg[i] : vMchRReg[i]) ;
int nOthRegId = ( ( vOthDwnReg[j] != GDB_ID_NULL) ? vOthDwnReg[j] : vOthReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_RM ;
}
}
@@ -177,7 +177,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
// confronto la regione di uscita della lavorazione con le regioni degli altri pezzi
for ( int nMchRegId : vMchLoReg) {
for ( int nOthRegId : vOthReg) {
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_LO ;
}
}
@@ -186,7 +186,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
if ( vMchDwnLoReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nMchRegId = ( ( vMchDwnLoReg[i] != GDB_ID_NULL) ? vMchDwnLoReg[i] : vMchLoReg[i]) ;
int nOthRegId = ( ( vOthDwnReg[j] != GDB_ID_NULL) ? vOthDwnReg[j] : vOthReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_LO ;
}
}
+331 -132
View File
@@ -22,8 +22,10 @@
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkDistPointLine.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkCAvSimpleSurfFrMove.h"
#include "/EgtDev/Include/EGkCAvSurfFrMove.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EMkMachiningGeoConst.h"
#include "/EgtDev/Include/EGkIntervals.h"
@@ -32,6 +34,7 @@
using namespace std ;
//----------------------------------------------------------------------------
// collisioni semplici
struct SCollInfoEx : public SCollInfo
{
int nIdM ; // identificativo della regione mobile
@@ -43,7 +46,7 @@ struct SCollInfoEx : public SCollInfo
nIdF( GDB_ID_NULL), bIsCutF( false) {}
SCollInfoEx( const SCollInfo& Sou) : SCollInfo( Sou), nIdM( GDB_ID_NULL), bIsCutM( false),
nIdF( GDB_ID_NULL), bIsCutF( false) {}
} ;
} ;
//----------------------------------------------------------------------------
static const double SPESS = 100 ;
@@ -92,7 +95,7 @@ ExeCreateOutRegion( int nParentId, double dXmin, double dYmin, double dXmax, dou
dYmax < dYmin + GAP + 2 * EPS_SMALL)
return false ;
// se già esiste, posso uscire
// se già esiste, posso uscire
int nBoxId = pGeomDB->GetFirstNameInGroup( nParentId, NST_SHEET_OUTREG) ;
if ( nBoxId != GDB_ID_NULL)
return true ;
@@ -149,7 +152,7 @@ ExeCreateOutRegion( int nParentId, int nOutCrvId)
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se già esiste, posso uscire
// se già esiste, posso uscire
int nBoxId = pGeomDB->GetFirstNameInGroup( nParentId, NST_SHEET_OUTREG) ;
if ( nBoxId != GDB_ID_NULL)
return true ;
@@ -187,7 +190,7 @@ ExeCreateOutRegion( int nParentId, int nOutCrvId)
BBox3d b3Box ;
pCompo->GetLocalBBox( b3Box) ;
b3Box.Expand( SPESS, SPESS, 0) ;
// determino il punto più vicino al massimo del box e lo faccio diventare il nuovo inizio
// determino il punto più vicino al massimo del box e lo faccio diventare il nuovo inizio
int nFlag ;
double dU ;
DistPointCurve distPC( b3Box.GetMax(), *pCompo) ;
@@ -250,7 +253,7 @@ ExeCreateReferenceRegion( int nParentId, int nOutCrvId, bool bBottomUp)
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se già esiste, posso uscire
// se già esiste, posso uscire
int nRegId = pGeomDB->GetFirstNameInGroup( nParentId, NST_REFERENCE_REG) ;
if ( nRegId != GDB_ID_NULL)
return true ;
@@ -283,7 +286,7 @@ ExeCreateReferenceRegion( int nParentId, int nOutCrvId, bool bBottomUp)
// ne ricavo il bbox
BBox3d b3Box ;
PL.GetLocalBBox( b3Box) ;
// cerco i punti più vicini ai quattro vertici (0=BL, 1=BR, 2=TR, 3=TL)
// cerco i punti più vicini ai quattro vertici (0=BL, 1=BR, 2=TR, 3=TL)
double dU[4] = { -1, -1, -1, -1} ;
double dMinSqDist[4] = { SQ_INFINITO, SQ_INFINITO, SQ_INFINITO, SQ_INFINITO} ;
Point3d ptVert[4] ;
@@ -391,7 +394,7 @@ ExeCreateDamagedRegion( int nParentId, int nDmgCrvId)
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico se esiste già la regione associata
// verifico se esiste già la regione associata
int nRegId = pGeomDB->GetFirstNameInGroup( nParentId, NST_DAMAGED_REG) ;
while ( nRegId != GDB_ID_NULL) {
// recupero l'indice della curva di origine
@@ -710,7 +713,7 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
// box delle regioni dei pezzi rispetto al box dell'esterno
if ( ! b3Region.EnclosesXY( b3RegCluster))
return false ;
// regioni dei pezzi rispetto alla regione dell'esterno
// regioni dei pezzi rispetto alla regione dell'esterno (controllo semplice)
for ( int nRegId : vReg) {
if ( ExeSurfFrChunkSimpleClassify( nRegId, 0, nBoxId, 0) != REGC_OUT)
return false ;
@@ -721,7 +724,7 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
return false ;
}
// Verifico con l'eventuale regione di riferimento
// Verifico con l'eventuale regione di riferimento (controllo semplice)
// recupero la regione
int nRefReg = pGeomDB->GetFirstNameInGroup( nGroupId, NST_REFERENCE_REG) ;
if ( pGeomDB->ExistsInfo( nRefReg, KEY_NST_OFF))
@@ -749,17 +752,17 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
vDmgReg.emplace_back( nId) ;
nId = pGeomDB->GetNextName( nId, NST_DAMAGED_REG) ;
}
// regioni dei pezzi rispetto alle regioni delle aree danneggiate
// regioni dei pezzi rispetto alle regioni delle aree danneggiate (controllo completo)
for ( int nRegId : vReg) {
for ( int nDmgRegId : vDmgReg) {
if ( ExeSurfFrChunkSimpleClassify( nRegId, 0, nDmgRegId, 0) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nRegId, 0, nDmgRegId, 0) != REGC_OUT)
return false ;
}
}
for ( int nDwnRegId : vDwnReg) {
if ( nDwnRegId != GDB_ID_NULL) {
for ( int nDmgRegId : vDmgReg) {
if ( ExeSurfFrChunkSimpleClassify( nDwnRegId, 0, nDmgRegId, 0) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nDwnRegId, 0, nDmgRegId, 0) != REGC_OUT)
return false ;
}
}
@@ -800,59 +803,62 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
nId2 = ( bInRoot ? ExeGetNextPart( nId2, true) : ExeGetNextGroup( nId2)) ;
}
// Eseguo verifiche
// Eseguo verifiche (controllo completo)
// regioni dei pezzi
for ( size_t i = 0 ; i < vReg.size() ; ++ i) {
// verifico con le regioni degli altri pezzi (sempre regioni standard)
for ( int i = 0 ; i < ssize( vReg) ; ++ i) {
// verifico con le regioni degli altri pezzi
for ( int nOthRegId : vOthReg) {
if ( ExeSurfFrChunkSimpleClassify( vReg[i], 0, nOthRegId, 0) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( vReg[i], 0, nOthRegId, 0) != REGC_OUT)
return false ;
}
// e con le regioni dei tagli degli altri pezzi (se esistono le regioni up devo usarle)
int nRegUpId = ((vUpReg[i] == GDB_ID_NULL) ? vReg[i] : vUpReg[i]) ;
int nRegUpId = ( ( vUpReg[i] == GDB_ID_NULL) ? vReg[i] : vUpReg[i]) ;
for ( int nOthCutRegId : vOthCutReg) {
if ( ExeSurfFrChunkSimpleClassify( nRegUpId, 0, nOthCutRegId, 0) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nRegUpId, 0, nOthCutRegId, 0) != REGC_OUT)
return false ;
}
}
// regioni sotto dei pezzi
for ( size_t i = 0 ; i < vDwnReg.size() ; ++ i) {
// regioni sotto dei pezzi (controllo completo)
for ( int i = 0 ; i < ssize( vDwnReg) ; ++ i) {
// verifico con le regioni sotto degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) {
for ( int j = 0 ; j < ssize( vOthDwnReg) ; ++ j) {
if ( vDwnReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nDwnRegId = ( vDwnReg[i] != GDB_ID_NULL ? vDwnReg[i] : vReg[i]) ;
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nDwnRegId, 0, nOthDwnRegId, 0) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nDwnRegId, 0, nOthDwnRegId, 0) != REGC_OUT)
return false ;
}
}
// e con le regioni sotto dei tagli degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnCutReg.size() ; ++ j) {
for ( int j = 0 ; j < ssize( vOthDwnCutReg) ; ++ j) {
if ( vDwnReg[i] != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) {
int nDwnRegId = ( vDwnReg[i] != GDB_ID_NULL ? vDwnReg[i] : vReg[i]) ;
int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nDwnRegId, 0, nOthDwnCutRegId, 0) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nDwnRegId, 0, nOthDwnCutRegId, 0) != REGC_OUT)
return false ;
}
}
}
// regioni delle lavorazioni dei pezzi
for ( int nCutRegId : vCutReg) {
// le confronto con le regioni degli altri pezzi
for ( size_t j = 0 ; j < vOthReg.size() ; ++ j) {
int nOthUpRegId = (( vOthUpReg[j] == GDB_ID_NULL) ? vOthReg[j] : vOthUpReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nCutRegId, 0, nOthUpRegId, 0) != REGC_OUT)
// le confronto con le regioni degli altri pezzi (controllo completo)
for ( int j = 0 ; j < ssize( vOthReg) ; ++ j) {
int nOthUpRegId = ( ( vOthUpReg[j] == GDB_ID_NULL) ? vOthReg[j] : vOthUpReg[j]) ;
if ( ExeSurfFlatRegionInterference( nCutRegId, 0, nOthUpRegId, 0) != REGC_OUT)
return false ;
}
}
// regioni sotto delle lavorazioni dei pezzi
for ( size_t i = 0 ; i < vDwnCutReg.size() ; ++ i) {
// le confronto con le regioni sotto degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) {
for ( int i = 0 ; i < ssize( vDwnCutReg) ; ++ i) {
// le confronto con le regioni sotto degli altri pezzi (controllo completo)
for ( int j = 0 ; j < ssize( vOthDwnReg) ; ++ j) {
if ( vDwnCutReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nDwnCutRegId = ( vDwnCutReg[i] != GDB_ID_NULL ? vDwnCutReg[i] : vCutReg[i]) ;
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nDwnCutRegId, 0, nOthDwnRegId, 0) != REGC_OUT)
if ( ExeSurfFlatRegionInterference( nDwnCutRegId, 0, nOthDwnRegId, 0) != REGC_OUT)
return false ;
}
}
@@ -1031,14 +1037,14 @@ ExePackPartCluster( const INTVECTOR& vIds, bool bReducedCut, bool bBottomUp)
double dRegClDimY = b3RegCluster.GetMax().y - b3RegCluster.GetMin().y ;
Point3d ptOrig = b3RegCluster.GetMin() ;
// Determino punto più in basso a sinistra del cluster
// Determino punto più in basso a sinistra del cluster
Point3d ptBL = b3RegCluster.GetMax() ;
double dDimBottom = 0 ;
for ( int nId : vTrueIds) {
// recupero l'approssimazione lineare del contorno del pezzo ( in globale)
PolyLine PL ;
if ( GetFlatPartApproxContour( pGeomDB, nId, PL)) {
// cerco il punto più in basso a sinistra
// cerco il punto più in basso a sinistra
Point3d ptP ;
bool bFound = PL.GetFirstPoint( ptP) ;
while ( bFound) {
@@ -1163,6 +1169,7 @@ UpdateCollId( double dLen, double dPrevLen, int nId1, int nId2, bool bIsCut1, bo
}
//----------------------------------------------------------------------------
// Collisione semplice
static bool
MySurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, SCollInfo& scInfo)
{
@@ -1170,23 +1177,27 @@ MySurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pSfr1 != nullptr) ;
if ( pSfr1 == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf1 ;
bOk = bOk && pGeomDB->GetGlobFrame( nId1, frSurf1) ;
if ( ! pGeomDB->GetGlobFrame( nId1, frSurf1))
return false ;
// recupero la seconda superficie FlatRegion
const ISurfFlatRegion* pSfr2 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId2)) ;
bOk = bOk && ( pSfr2 != nullptr) ;
if ( pSfr2 == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf2 ;
bOk = bOk && pGeomDB->GetGlobFrame( nId2, frSurf2) ;
if ( ! pGeomDB->GetGlobFrame( nId2, frSurf2))
return false ;
// se riferimenti diversi, porto una copia della seconda nel riferimento della prima
const ISurfFlatRegion* pSfr2L = pSfr2 ;
PtrOwner<ISurfFlatRegion> pTmp ;
if ( ! AreSameFrame( frSurf1, frSurf2)) {
pTmp.Set( pSfr2->Clone()) ;
bOk = bOk && ! IsNull( pTmp) ;
bOk = bOk && pTmp->LocToLoc( frSurf2, frSurf1) ;
if ( IsNull( pTmp) || ! pTmp->LocToLoc( frSurf2, frSurf1))
return false ;
pSfr2L = pTmp ;
}
// porto in locale alla prima superficie il versore di movimento
@@ -1194,21 +1205,71 @@ MySurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double
vtDirL.ToLoc( frSurf1) ;
// calcolo massima lunghezza di traslazione della prima regione senza semplice collisione con la seconda
CAvSimpleSurfFrMove ScdSfrMove( *pSfr1, *pSfr2L) ;
bOk = bOk && ScdSfrMove.Translate( vtDirL, dLen) ;
if ( bOk) {
scInfo = ScdSfrMove.GetSCollInfo() ;
if ( scInfo.nType != SCI_NONE) {
scInfo.ptP1.ToGlob( frSurf1) ;
scInfo.vtDirM.ToGlob( frSurf1) ;
scInfo.vtDirF.ToGlob( frSurf1) ;
}
if ( scInfo.nType == SCI_LINE_LINE)
scInfo.ptP2.ToGlob( frSurf1) ;
if ( ! ScdSfrMove.Translate( vtDirL, dLen))
return false ;
scInfo = ScdSfrMove.GetSCollInfo() ;
if ( scInfo.nType != SCI_NONE) {
scInfo.ptP1.ToGlob( frSurf1) ;
scInfo.vtDirM.ToGlob( frSurf1) ;
scInfo.vtDirF.ToGlob( frSurf1) ;
}
return bOk ;
if ( scInfo.nType == SCI_LINE_LINE)
scInfo.ptP2.ToGlob( frSurf1) ;
return true ;
}
//----------------------------------------------------------------------------
// Collisione completa
static bool
MySurfFrMoveNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, SCollInfo& cInfo)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
if ( pSfr1 == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf1 ;
if ( ! pGeomDB->GetGlobFrame( nId1, frSurf1))
return false ;
// recupero la seconda superficie FlatRegion
const ISurfFlatRegion* pSfr2 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId2)) ;
if ( pSfr2 == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf2 ;
if ( ! pGeomDB->GetGlobFrame( nId2, frSurf2))
return false ;
// se riferimenti diversi, porto una copia della seconda nel riferimento della prima
const ISurfFlatRegion* pSfr2L = pSfr2 ;
PtrOwner<ISurfFlatRegion> pTmp ;
if ( ! AreSameFrame( frSurf1, frSurf2)) {
pTmp.Set( pSfr2->Clone()) ;
if ( IsNull( pTmp) || ! pTmp->LocToLoc( frSurf2, frSurf1))
return false ;
pSfr2L = pTmp ;
}
// porto in locale alla prima superficie il versore di movimento
Vector3d vtDirL = vtDir ;
vtDirL.ToLoc( frSurf1) ;
// calcolo massima lunghezza di traslazione della prima regione senza collisione con la seconda
CAvSurfFrMove cdSfrMove( *pSfr1, *pSfr2L) ;
if ( ! cdSfrMove.Translate( vtDirL, dLen))
return false ;
cInfo = cdSfrMove.GetCollInfo() ;
if ( cInfo.nType != SCI_NONE) {
cInfo.ptP1.ToGlob( frSurf1) ;
cInfo.vtDirM.ToGlob( frSurf1) ;
cInfo.vtDirF.ToGlob( frSurf1) ;
}
if ( cInfo.nType == SCI_LINE_LINE)
cInfo.ptP2.ToGlob( frSurf1) ;
return true ;
}
//----------------------------------------------------------------------------
// Traslazione con CAvSurfFr
static bool
MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster, bool bReducedCut, Vector3d& vtMove)
{
@@ -1293,67 +1354,67 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
bOk = false ;
break ;
}
// la confronto con il box
// la confronto con il box (collisione semplice)
MySurfFrMoveSimpleNoCollision( nRegId, nBoxId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nBoxId, false, false, scInfoCurr) ;
// la confronto con la regione di riferimento
// la confronto con la regione di riferimento (collisione semplice)
if ( nRefReg != GDB_ID_NULL) {
MySurfFrMoveSimpleNoCollision( nRegId, nRefReg, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nRefReg, false, false, scInfoCurr) ;
}
// la confronto con le aree danneggiate
// la confronto con le aree danneggiate (collisione completa)
for ( int nDmgRegId : vDmgReg) {
MySurfFrMoveSimpleNoCollision( nRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nDmgRegId, false, false, scInfoCurr) ;
}
// la confronto con le regioni degli altri pezzi
// la confronto con le regioni degli altri pezzi (collisione completa)
for ( int nOthRegId : vOthReg) {
MySurfFrMoveSimpleNoCollision( nRegId, nOthRegId, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nRegId, nOthRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nOthRegId, false, false, scInfoCurr) ;
}
// e con le regioni dei tagli degli altri pezzi
// recupero regione in alto del pezzo
// recupero regione in alto del pezzo (collisione completa)
int nUpRegId = GetFlatPartUpRegion( pGeomDB, nTrueId) ;
int nTestRegId = (( nUpRegId == GDB_ID_NULL) ? nRegId : nUpRegId) ;
for ( int nOthCutRegId : vOthCutReg) {
MySurfFrMoveSimpleNoCollision( nTestRegId, nOthCutRegId, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nTestRegId, nOthCutRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nTestRegId, nOthCutRegId, false, true, scInfoCurr) ;
}
// -----------------------------------------
// recupero regione in basso del pezzo
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nTrueId) ;
// la confronto con il box
// la confronto con il box (collisone semplice)
if ( nDwnRegId != GDB_ID_NULL) {
MySurfFrMoveSimpleNoCollision( nDwnRegId, nBoxId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nBoxId, false, false, scInfoCurr) ;
}
// la confronto con la regione di riferimento
// la confronto con la regione di riferimento (collisione completa)
if ( nDwnRegId != GDB_ID_NULL && nRefReg != GDB_ID_NULL) {
MySurfFrMoveSimpleNoCollision( nDwnRegId, nRefReg, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nDwnRegId, nRefReg, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nRefReg, false, false, scInfoCurr) ;
}
// la confronto con le aree danneggiate
// la confronto con le aree danneggiate (collisione completa)
if ( nDwnRegId != GDB_ID_NULL) {
for ( int nDmgRegId : vDmgReg) {
MySurfFrMoveSimpleNoCollision( nDwnRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nDwnRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nDmgRegId, false, false, scInfoCurr) ;
}
}
// la confronto con le regioni in basso degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) {
// la confronto con le regioni in basso degli altri pezzi (collisione completa)
for ( int j = 0 ; j < ssize( vOthDwnReg) ; ++ j) {
if ( nDwnRegId != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
MySurfFrMoveSimpleNoCollision( nTmpDwnRegId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nTmpDwnRegId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnRegId, nOthDwnRegId, false, false, scInfoCurr) ;
}
}
// e con le regioni in basso dei tagli degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnCutReg.size() ; ++ j) {
// e con le regioni in basso dei tagli degli altri pezzi (collisione completa)
for ( int j = 0 ; j < ssize( vOthDwnCutReg) ; ++ j) {
if ( nDwnRegId != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) {
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ;
MySurfFrMoveSimpleNoCollision( nTmpDwnRegId, nOthDwnCutRegId, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nTmpDwnRegId, nOthDwnCutRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnRegId, nOthDwnCutRegId, false, true, scInfoCurr) ;
}
}
@@ -1364,11 +1425,11 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
bOk = false ;
break ;
}
// le confronto con le regioni degli altri pezzi
// le confronto con le regioni degli altri pezzi (collisione completa)
for ( int nCrId : vCrId) {
for ( size_t k = 0 ; k < vOthReg.size() ; ++ k) {
for ( int k = 0 ; k < ssize( vOthReg) ; ++ k) {
int nOthRegId = ( vOthUpReg[k] == GDB_ID_NULL ? vOthReg[k] : vOthUpReg[k]) ;
MySurfFrMoveSimpleNoCollision( nCrId, nOthRegId, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nCrId, nOthRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nCrId, nOthRegId, true, false, scInfoCurr) ;
}
}
@@ -1379,13 +1440,13 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
bOk = false ;
break ;
}
// le confronto con le regioni in basso degli altri pezzi
for ( size_t j = 0 ; j < vDwnCrId.size() ; ++ j) {
for ( size_t k = 0 ; k < vOthDwnReg.size() ; ++ k) {
// le confronto con le regioni in basso degli altri pezzi (collisione completa)
for ( int j = 0 ; j < ssize( vDwnCrId) ; ++ j) {
for ( int k = 0 ; k < ssize( vOthDwnReg) ; ++ k) {
if ( vDwnCrId[j] != GDB_ID_NULL || vOthDwnReg[k] != GDB_ID_NULL) {
int nTmpDwnCrId = ( vDwnCrId[j] != GDB_ID_NULL ? vDwnCrId[j] : vCrId[j]) ;
int nOthDwnRegId = ( vOthDwnReg[k] != GDB_ID_NULL ? vOthDwnReg[k] : vOthReg[k]) ;
MySurfFrMoveSimpleNoCollision( nTmpDwnCrId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
MySurfFrMoveNoCollision( nTmpDwnCrId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnCrId, nOthDwnRegId, true, false, scInfoCurr) ;
}
}
@@ -1419,7 +1480,7 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
}
}
// Se movimento risultante nullo, non faccio alcunché
// Se movimento risultante nullo, non faccio alcunché
vtMoveXY = vtDir * dLen ;
if ( vtMoveXY.IsSmall())
return true ;
@@ -1464,7 +1525,7 @@ ExeMovePartCluster( const INTVECTOR& vIds, bool bReducedCut, Vector3d& vtMove)
vtMove = vtM ;
return true ;
}
// altrimenti, riprovo con tagli standard
// altrimenti, riprovo con tagli standard
else {
// annullo il movimento
for ( int nId : vTrueIds)
@@ -1475,7 +1536,50 @@ ExeMovePartCluster( const INTVECTOR& vIds, bool bReducedCut, Vector3d& vtMove)
}
}
//----------------------------------------------------------------------------
static bool
MySurfFrRotateNoCollision( int nId1, int nId2, const Point3d& ptCen, double& dAngDeg, SCollInfo& cInfo)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
if ( pSfr1 == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf1 ;
if ( ! pGeomDB->GetGlobFrame( nId1, frSurf1))
return false ;
// recupero la seconda superficie FlatRegion
const ISurfFlatRegion* pSfr2 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId2)) ;
if ( pSfr2 == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf2 ;
if ( ! pGeomDB->GetGlobFrame( nId2, frSurf2))
return false ;
// se riferimenti diversi, porto una copia della seconda nel riferimento della prima
const ISurfFlatRegion* pSfr2L = pSfr2 ;
PtrOwner<ISurfFlatRegion> pTmp ;
if ( ! AreSameFrame( frSurf1, frSurf2)) {
pTmp.Set( pSfr2->Clone()) ;
if ( IsNull( pTmp) || ! pTmp->LocToLoc( frSurf2, frSurf1))
return false ;
pSfr2L = pTmp ;
}
// porto in locale alla prima superficie il punto di rotazione
Point3d ptCenL = ptCen ;
ptCenL.ToLoc( frSurf1) ;
// calcolo massima lunghezza di traslazione della prima regione senza collisione con la seconda
CAvSurfFrMove cdSfrMove( *pSfr1, *pSfr2L) ;
if ( ! cdSfrMove.Rotate( ptCenL, dAngDeg))
return false ;
return true ;
}
//----------------------------------------------------------------------------
// Rotazione con CAvSurfFr
bool
MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Cluster, bool bReducedCut,
const Point3d& ptCen, double& dRotAngDeg)
@@ -1553,21 +1657,21 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
bOk = false ;
break ;
}
// la confronto con il box
// la confronto con il box (collisione semplice)
ExeSurfFrRotateSimpleNoCollision( nRegId, nBoxId, ptCen, dAng, RTY_GLOB) ;
// la confronto con la regione di riferimento
// la confronto con la regione di riferimento (collisione semplice)
if ( nRefReg != GDB_ID_NULL) {
ExeSurfFrRotateSimpleNoCollision( nRegId, nRefReg, ptCen, dAng, RTY_GLOB) ;
}
// la confronto con le aree danneggiate
// la confronto con le aree danneggiate (collisione completa)
for ( int nDmgRegId : vDmgReg) {
ExeSurfFrRotateSimpleNoCollision( nRegId, nDmgRegId, ptCen, dAng, RTY_GLOB) ;
MySurfFrRotateNoCollision( nRegId, nDmgRegId, ptCen, dAng, s_scInfo) ;
}
// la confronto con le regioni degli altri pezzi
// la confronto con le regioni degli altri pezzi (collisione completa)
for ( int nOthRegId : vOthReg) {
ExeSurfFrRotateSimpleNoCollision( nRegId, nOthRegId, ptCen, dAng, RTY_GLOB) ;
MySurfFrRotateNoCollision( nRegId, nOthRegId, ptCen, dAng, s_scInfo) ;
}
// e con le regioni dei tagli degli altri pezzi
// e con le regioni dei tagli degli altri pezzi (collisione completa)
// recupero regione in alto del pezzo
int nUpRegId = GetFlatPartUpRegion( pGeomDB, nTrueId) ;
int nTestRegId = (( nUpRegId == GDB_ID_NULL) ? nRegId : nUpRegId) ;
@@ -1577,33 +1681,33 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
// -----------------------------------------
// recupero regione in basso del pezzo
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nTrueId) ;
// la confronto con il box
// la confronto con il box (collisione semplice)
if ( nDwnRegId != GDB_ID_NULL)
ExeSurfFrRotateSimpleNoCollision( nDwnRegId, nBoxId, ptCen, dAng, RTY_GLOB) ;
// la confronto con la regione di riferimento
// la confronto con la regione di riferimento (collisione semplice)
if ( nRefReg != GDB_ID_NULL) {
ExeSurfFrRotateSimpleNoCollision( nDwnRegId, nRefReg, ptCen, dAng, RTY_GLOB) ;
}
// la confronto con le aree danneggiate
// la confronto con le aree danneggiate (collisione completa)
if ( nDwnRegId != GDB_ID_NULL) {
for ( int nDmgRegId : vDmgReg) {
ExeSurfFrRotateSimpleNoCollision( nDwnRegId, nDmgRegId, ptCen, dAng, RTY_GLOB) ;
MySurfFrRotateNoCollision( nDwnRegId, nDmgRegId, ptCen, dAng, s_scInfo) ;
}
}
// la confronto con le regioni in basso degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) {
// la confronto con le regioni in basso degli altri pezzi (collisione completa)
for ( int j = 0 ; j < ssize( vOthDwnReg) ; ++ j) {
if ( nDwnRegId != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
ExeSurfFrRotateSimpleNoCollision( nTmpDwnRegId, nOthDwnRegId, ptCen, dAng, RTY_GLOB) ;
MySurfFrRotateNoCollision( nTmpDwnRegId, nOthDwnRegId, ptCen, dAng, s_scInfo) ;
}
}
// e con le regioni in basso dei tagli degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnCutReg.size() ; ++ j) {
// e con le regioni in basso dei tagli degli altri pezzi (collisione completa)
for ( int j = 0 ; j < ssize( vOthDwnCutReg) ; ++ j) {
if ( nDwnRegId != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) {
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ;
ExeSurfFrRotateSimpleNoCollision( nTmpDwnRegId, nOthDwnCutRegId, ptCen, dAng, RTY_GLOB) ;
MySurfFrRotateNoCollision( nTmpDwnRegId, nOthDwnCutRegId, ptCen, dAng, s_scInfo) ;
}
}
// -----------------------------------------
@@ -1613,11 +1717,11 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
bOk = false ;
break ;
}
// le confronto con le regioni degli altri pezzi
// le confronto con le regioni degli altri pezzi (collisione completa)
for ( int nCrId : vCrId) {
for ( size_t k = 0 ; k < vOthReg.size() ; ++ k) {
for ( int k = 0 ; k < ssize( vOthReg) ; ++ k) {
int nOthRegId = ( vOthUpReg[k] == GDB_ID_NULL ? vOthReg[k] : vOthUpReg[k]) ;
ExeSurfFrRotateSimpleNoCollision( nCrId, nOthRegId, ptCen, dAng, RTY_GLOB) ;
MySurfFrRotateNoCollision( nCrId, nOthRegId, ptCen, dAng, s_scInfo) ;
}
}
// -----------------------------------------
@@ -1627,13 +1731,13 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
bOk = false ;
break ;
}
// le confronto con le regioni in basso degli altri pezzi
for ( size_t j = 0 ; j < vDwnCrId.size() ; ++ j) {
for ( size_t k = 0 ; k < vOthDwnReg.size() ; ++ k) {
// le confronto con le regioni in basso degli altri pezzi (collisione completa)
for ( int j = 0 ; j < ssize( vDwnCrId) ; ++ j) {
for ( int k = 0 ; k < ssize( vOthDwnReg) ; ++ k) {
if ( vDwnCrId[j] != GDB_ID_NULL || vOthDwnReg[k] != GDB_ID_NULL) {
int nTmpDwnCrId = ( vDwnCrId[j] != GDB_ID_NULL ? vDwnCrId[j] : vCrId[j]) ;
int nOthDwnRegId = ( vOthDwnReg[k] != GDB_ID_NULL ? vOthDwnReg[k] : vOthReg[k]) ;
ExeSurfFrRotateSimpleNoCollision( nTmpDwnCrId, nOthDwnRegId, ptCen, dAng, RTY_GLOB) ;
MySurfFrRotateNoCollision( nTmpDwnCrId, nOthDwnRegId, ptCen, dAng, s_scInfo) ;
}
}
}
@@ -1643,7 +1747,7 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
if ( ! bOk)
return false ;
// Se movimento risultante nullo, non faccio alcunché
// Se movimento risultante nullo, non faccio alcunché
dRotAngDeg = dAng ;
if ( abs( dAng) < EPS_ANG_SMALL)
return true ;
@@ -1686,7 +1790,7 @@ GetObstacleTangent( Vector3d& vtTang)
//----------------------------------------------------------------------------
static bool
GetMovingTangent( Vector3d& vtTang)
GetMovingTangent( Vector3d& vtTang)
{
if ( s_scInfo.nType != SCI_LINE_PNT && s_scInfo.nType != SCI_LINE_LINE)
return false ;
@@ -1733,7 +1837,7 @@ ExeAlignPartClusterOnCollision( const INTVECTOR& vIds, bool bReducedCut, bool& b
Point3d ptCntL = s_scInfo.ptP1 ;
ptCntL.ToLoc( frSfr) ;
// cerco le direzioni tangenti prima e dopo il punto di contatto sulle parti mobili
PtrOwner<ICurve> pCrv( pSfr->GetLoop( s_scInfo.nChunkM, 0)) ;
PtrOwner<ICurve> pCrv( pSfr->GetLoop( s_scInfo.nChunkM, s_scInfo.nLoopM)) ;
if ( IsNull( pCrv))
return false ;
double dU ;
@@ -1760,7 +1864,7 @@ ExeAlignPartClusterOnCollision( const INTVECTOR& vIds, bool bReducedCut, bool& b
string sOut = "vtTp=(" + ToString( vtTp) + ") vtTn=(" + ToString( vtTn) + ")" ;
LOG_INFO( GetLogger(), sOut.c_str()) ;
}
// ruoto dalla parte dell'angolo più piccolo (componente più grande)
// ruoto dalla parte dell'angolo più piccolo (componente più grande)
double dRotAngDeg = ( abs( vtTp * s_scInfo.vtDirF) > abs( vtTn * s_scInfo.vtDirF)) ? 90 : - 90 ;
// provo a ruotare sul punto di collisione in senso orario
Point3d ptCen = s_scInfo.ptP1 ;
@@ -1784,6 +1888,7 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
// cerco i due tagli in collisione
int nCutM = GDB_ID_NULL ;
int nGeoM = GDB_ID_NULL ;
INTVECTOR vnGeoM, vnGeoF ;
Point3d ptStartM, ptEndM ;
Vector3d vtDirM ;
Frame3d frGeoM ;
@@ -1792,13 +1897,38 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
Point3d ptStartF, ptEndF ;
Vector3d vtDirF ;
Frame3d frGeoF ;
// se mobile è già un taglio, ne ricavo i dati
// se mobile è già un taglio, ne ricavo i dati
if ( s_scInfo.bIsCutM) {
if ( s_scInfo.nIdM == GDB_ID_NULL)
return false ;
nCutM = s_scInfo.nIdM ;
nGeoM = GetGeometryFromCut( pGeomDB, pMachMgr, nCutM) ;
ICurveLine* pLineM = GetCurveLine( pGeomDB->GetGeoObj( nGeoM)) ;
if ( nCutM == GDB_ID_NULL || nGeoM == GDB_ID_NULL ||
pLineM == nullptr || ! pGeomDB->GetGlobFrame( nGeoM, frGeoM))
vnGeoM = GetGeometryFromCut( pGeomDB, pMachMgr, nCutM) ;
if ( vnGeoM.empty())
return false ;
ICurveLine* pLineM = nullptr ;
// se ho un solo taglio, allora è quello
if ( ssize( vnGeoM) == 1) {
pLineM = GetCurveLine( pGeomDB->GetGeoObj( vnGeoM[0])) ;
nGeoM = vnGeoM[0] ;
}
// se più tagli, cerco quello più vicino alla linea corrente
else {
double dMinSqDist = INFINITO ;
for ( int i = 0 ; i < ssize( vnGeoM) ; ++ i) {
Frame3d frCurrGeoM ;
ICurveLine* pCurrLineM = GetCurveLine( pGeomDB->GetGeoObj( vnGeoM[i])) ;
if ( pCurrLineM == nullptr || ! pGeomDB->GetGlobFrame( vnGeoM[i], frCurrGeoM))
return false ;
double dCurrSqDist ;
DistPointLine( GetToLoc( s_scInfo.ptP1, frCurrGeoM), *pCurrLineM).GetSqDist( dCurrSqDist) ;
if ( dCurrSqDist < dMinSqDist) {
dMinSqDist = dCurrSqDist ;
pLineM = pCurrLineM ;
nGeoM = vnGeoM[i] ;
}
}
}
if ( pLineM == nullptr || ! pGeomDB->GetGlobFrame( nGeoM, frGeoM))
return false ;
ptStartM = pLineM->GetStart() ;
ptStartM.ToGlob( frGeoM) ;
@@ -1807,13 +1937,36 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
vtDirM = ptEndM - ptStartM ;
vtDirM.Normalize() ;
}
// se fisso è già un taglio, ne ricavo i dati
// se fisso è già un taglio, ne ricavo i dati
if ( s_scInfo.bIsCutF) {
if ( s_scInfo.nChunkF == GDB_ID_NULL)
return false ;
nCutF = s_scInfo.nIdF ;
nGeoF = GetGeometryFromCut( pGeomDB, pMachMgr, nCutF) ;
vnGeoF = GetGeometryFromCut( pGeomDB, pMachMgr, nCutF) ;
ICurveLine* pLineF = GetCurveLine( pGeomDB->GetGeoObj( nGeoF)) ;
if ( nCutF == GDB_ID_NULL || nGeoF == GDB_ID_NULL ||
pLineF == nullptr || ! pGeomDB->GetGlobFrame( nGeoF, frGeoF))
// se ho un solo taglio, allora è quello
if ( ssize( vnGeoF) == 1) {
pLineF = GetCurveLine( pGeomDB->GetGeoObj( vnGeoF[0])) ;
nGeoF = vnGeoF[0] ;
}
// se più tagli, cerco quello più vicino alla linea corrente
else {
double dMinSqDist = INFINITO ;
for ( int i = 0 ; i < ssize( vnGeoF) ; ++ i) {
Frame3d frCurrGeoF ;
ICurveLine* pCurrLineF = GetCurveLine( pGeomDB->GetGeoObj( vnGeoF[i])) ;
if ( pCurrLineF == nullptr || ! pGeomDB->GetGlobFrame( vnGeoF[i], frCurrGeoF))
return false ;
double dCurrSqDist ;
DistPointLine( GetToLoc( s_scInfo.ptP1, frCurrGeoF), *pCurrLineF).GetSqDist( dCurrSqDist) ;
if ( dCurrSqDist < dMinSqDist) {
dMinSqDist = dCurrSqDist ;
pLineF = pCurrLineF ;
nGeoF = vnGeoF[i] ;
}
}
}
if ( pLineF == nullptr || ! pGeomDB->GetGlobFrame( nGeoF, frGeoF))
return false ;
ptStartF = pLineF->GetStart() ;
ptStartF.ToGlob( frGeoF) ;
@@ -1838,8 +1991,31 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
BBox3d b3Temp ;
pGeomDB->GetGlobalBBox( nId, b3Temp) ;
if ( b3Temp.OverlapsXY( b3CutM)) {
int nGeom = GetGeometryFromCut( pGeomDB, pMachMgr, nId) ;
ICurveLine* pLine = GetCurveLine( pGeomDB->GetGeoObj( nGeom)) ;
int nGeom = GDB_ID_NULL ;
INTVECTOR vnGeom = GetGeometryFromCut( pGeomDB, pMachMgr, nId) ;
ICurveLine* pLine = nullptr ;
// se ho un solo taglio, allora è quello
if ( ssize( vnGeom) == 1) {
pLine = GetCurveLine( pGeomDB->GetGeoObj( vnGeom[0])) ;
nGeom = vnGeom[0] ;
}
// se ho più tagli, cerco quello più vicino alla linea corrente
else {
double dMinSqDist = INFINITO ;
for ( int i = 0 ; i < ssize( vnGeom) ; ++ i) {
Frame3d frCurrGeo ;
ICurveLine* pCurrLine = GetCurveLine( pGeomDB->GetGeoObj( vnGeom[i])) ;
if ( pCurrLine == nullptr || ! pGeomDB->GetGlobFrame( vnGeom[i], frCurrGeo))
return false ;
double dCurrSqDist ;
DistPointLine( GetToLoc( s_scInfo.ptP1, frCurrGeo), *pCurrLine).GetSqDist( dCurrSqDist) ;
if ( dCurrSqDist < dMinSqDist) {
dMinSqDist = dCurrSqDist ;
pLine = pCurrLine ;
nGeom = vnGeom[i] ;
}
}
}
if ( nGeom == GDB_ID_NULL || pLine == nullptr || ! pGeomDB->GetGlobFrame( nGeom, frGeoF))
continue ;
ptStartF = pLine->GetStart() ;
@@ -1872,8 +2048,31 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
BBox3d b3Temp ;
pGeomDB->GetGlobalBBox( nId, b3Temp) ;
if ( b3Temp.OverlapsXY( b3CutF)) {
int nGeom = GetGeometryFromCut( pGeomDB, pMachMgr, nId) ;
ICurveLine* pLine = GetCurveLine( pGeomDB->GetGeoObj( nGeom)) ;
int nGeom = GDB_ID_NULL ;
INTVECTOR vnGeom = GetGeometryFromCut( pGeomDB, pMachMgr, nId) ;
ICurveLine* pLine = nullptr ;
// se ho un solo taglio, allora è quello
if ( ssize( vnGeom) == 1) {
pLine = GetCurveLine( pGeomDB->GetGeoObj( vnGeom[0])) ;
nGeom = vnGeom[0] ;
}
// se ho più tagli, cerco quello più vicino alla linea corrente
else {
double dMinSqDist = INFINITO ;
for ( int i = 0 ; i < ssize( vnGeom) ; ++ i) {
Frame3d frCurrGeo ;
ICurveLine* pCurrLine = GetCurveLine( pGeomDB->GetGeoObj( vnGeom[0])) ;
if ( pCurrLine == nullptr || ! pGeomDB->GetGlobFrame( vnGeom[i], frCurrGeo))
return false ;
double dCurrSqDist ;
DistPointLine( GetToLoc( s_scInfo.ptP1, frCurrGeo), *pCurrLine).GetSqDist( dCurrSqDist) ;
if ( dCurrSqDist < dMinSqDist) {
dMinSqDist = dCurrSqDist ;
pLine = pCurrLine ;
nGeom = vnGeom[i] ;
}
}
}
if ( nGeom == GDB_ID_NULL || pLine == nullptr || ! pGeomDB->GetGlobFrame( nGeom, frGeoM))
continue ;
ptStartM = pLine->GetStart() ;
@@ -1950,9 +2149,9 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
dMoveMn = CrossXY( ptStartF - ptEndM, vtDirFp) / dDenom ;
}
}
// pareggio la parte più vicina, se almeno una sotto soglia
// pareggio la parte più vicina, se almeno una sotto soglia
if ( abs( dMoveMp) < dMaxMove || abs( dMoveMn) < dMaxMove) {
// calcolo movimento necessario, se nullo già a posto
// calcolo movimento necessario, se nullo già a posto
Vector3d vtMove = (( abs( dMoveMp) < abs( dMoveMn)) ? dMoveMp : dMoveMn) * vtDirF ;
if ( vtMove.IsSmall()) {
bMoved = false ;
@@ -1977,7 +2176,7 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
pGeomDB->GetRefBBox( nCutM, frCutF, b3CutM) ;
double dStartDelta = b3CutF.GetMin().x - b3CutM.GetMin().x ;
double dEndDelta = b3CutF.GetMax().x - b3CutM.GetMax().x ;
// pareggio la parte più vicina, se sotto soglia
// pareggio la parte più vicina, se sotto soglia
if ( abs( dStartDelta) > dMaxMove && abs( dEndDelta) > dMaxMove)
return false ;
Vector3d vtMove = (( abs( dStartDelta) < abs( dEndDelta)) ? dStartDelta : dEndDelta) * vtDirF ;
@@ -2079,7 +2278,7 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
// Avvio nesting automatico
ExeAutoNestStart() ;
// Modalità ghigliottina incompatibile con tagli completi
// Modalità ghigliottina incompatibile con tagli completi
if ( ! bReducedCut)
bGuillotineMode = false ;
@@ -2102,11 +2301,11 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
nDamId = pGeomDB->GetNextName( nDamId, NST_DAMAGED_REG) ;
}
// Modalità ghigliottina incompatibile con pannelli non rettangolari
// Modalità ghigliottina incompatibile con pannelli non rettangolari
if ( ! bIsRect)
bGuillotineMode = false ;
// Assegno le aree occupate dai pezzi già nestati
// Assegno le aree occupate dai pezzi già nestati
bool bPartAlreadyNested = false ;
BBox3d b3Sheet ;
pGeomDB->GetGlobalBBox( nRefReg, b3Sheet) ;
@@ -2132,18 +2331,18 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
GetFlatPartDownCutRegions( pGeomDB, nId, bReducedCut, vCutReg) ;
for ( int nRegId : vCutReg)
ExeAutoNestAddDefectToSheet( nSheetId, nRegId) ;
// dichiaro ci sono pezzi già nestati
// dichiaro ci sono pezzi già nestati
bPartAlreadyNested = true ;
}
}
nId = ( bInRoot ? ExeGetNextPart( nId, true) : ExeGetNextGroup( nId)) ;
}
// Pezzi già nestati incompatibili con ghigliottina
// Pezzi già nestati incompatibili con ghigliottina
if ( bPartAlreadyNested)
bGuillotineMode = false ;
// Se richiesta modalità ghigliottina
// Se richiesta modalità ghigliottina
if ( bGuillotineMode) {
// cerco il gap necessario tra le parti
double dGap = 0 ;
@@ -2153,7 +2352,7 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
if ( GetFlatPartInterpartGap( pGeomDB, nPartId, dCurrGap) && dCurrGap > dGap)
dGap = dCurrGap ;
}
// se non trovato disabilito richiesta modalità ghigliottina
// se non trovato disabilito richiesta modalità ghigliottina
if ( dGap < EPS_SMALL)
bGuillotineMode = false ;
// altrimenti lo imposto
@@ -2161,7 +2360,7 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
ExeAutoNestSetInterpartGap( dGap) ;
}
// Se richiesto e abilitato, imposto modalità ghigliottina
// Se richiesto e abilitato, imposto modalità ghigliottina
if ( bGuillotineMode)
ExeAutoNestSetGuillotineMode() ;
@@ -2177,7 +2376,7 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nPartId) ;
if ( nDwnRegId != GDB_ID_NULL)
ExeAutoNestAddAnotherOutlineToPart( nPartId, nDwnRegId) ;
// se non è ghigliottina imposto le regioni dei tagli (con ghigliottina si usa il gap)
// se non è ghigliottina imposto le regioni dei tagli (con ghigliottina si usa il gap)
if ( ! bGuillotineMode) {
// recupero regioni dei tagli del pezzo
INTVECTOR vCutReg ;
+618 -176
View File
File diff suppressed because it is too large Load Diff
+24 -4
View File
@@ -267,6 +267,21 @@ ExeDraw( void)
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeRedraw( void)
{
// se interfaccia disabilitata, esco subito
if ( ! ExeGetEnableUI())
return true ;
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// forzo ridisegno
pScene->RedrawWindow() ;
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeSelect( int nWinX, int nWinY, int nSelW, int nSelH, int* pnSel)
@@ -1008,7 +1023,7 @@ CALLBACK SceneBoxProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
case WM_INITDIALOG :
{
// imposto dimensione box e picture
const int WIN_MAX_DIM = 1024 ;
const int WIN_MAX_DIM = ( s_nDriver == 1 ? 512 : 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) ;
@@ -1023,10 +1038,15 @@ CALLBACK SceneBoxProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
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) ;
if ( ! pGseCtx->m_pScene->GetImage( s_nShowMode, s_colBackTop, s_colBackBottom, s_nWidth, s_nHeight, s_sImageFile))
s_nContext = -s_nContext ;
MyResetGroupObjGraphics( pGseCtx->m_pGeomDB, GDB_ID_ROOT) ;
EndDialog( hwndDlg, wParam) ;
}
else {
s_nContext = 0 ;
EndDialog( hwndDlg, wParam) ;
}
}
else
s_nContext = 0 ;
@@ -1063,9 +1083,9 @@ ExeGetImageEx( int nDriver, bool b2Buff, int nColorBits, int nDepthBits,
// lancio dialogo
HWND hTopWnd = ExeGetMainWindowHandle() ;
DialogBox( GetModuleIstance(), MAKEINTRESOURCE( IDD_LUASCENE), hTopWnd, (DLGPROC)SceneBoxProc) ;
bool bOk = ( s_nContext != 0) ;
bool bOk = ( s_nContext > 0) ;
// elimino la scena dal contesto
GseContext* pGseCtx = GetGseContext( s_nContext) ;
GseContext* pGseCtx = GetGseContext( abs( s_nContext)) ;
if ( pGseCtx != nullptr) {
delete pGseCtx->m_pScene ;
pGseCtx->m_pScene = nullptr ;
+9 -8
View File
@@ -242,7 +242,7 @@ MyTestSpheSurfTm( const Point3d& ptCen, double dR, int nSurfTmId, double dSafeDi
return -1 ;
// porto in locale alla superficie il centro della sfera
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frSurf) ;
// verifico l'a collisione'interferenza
// verifico l'interferenza
return ( TestSpheSurfTm( ptCenL, dR, *pStm, dSafeDist) ? 1 : 0) ;
}
@@ -271,7 +271,7 @@ ExeTestSpheSurface( const Point3d& ptCen, double dR, int nSurfId, double dSafeDi
//----------------------------------------------------------------------------
static int
MyTestSurfTmSurfTm( int nSurfTm1Id, int nSurfTm2Id, double dSafeDist)
MyTestSurfTmSurfTm( int nSurfTm1Id, int nSurfTm2Id, double dSafeDist, bool bTestEnclosion)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
@@ -288,26 +288,27 @@ MyTestSurfTmSurfTm( int nSurfTm1Id, int nSurfTm2Id, double dSafeDist)
const ISurfTriMesh* pStm2 = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTm2Id)) ;
if ( pStm2 == nullptr)
return -1 ;
// verifico l'a collisione'interferenza
return ( TestSurfTmSurfTm( *pStm1, *pStm2, dSafeDist) ? 1 : 0) ;
// verifico l'interferenza
return ( TestSurfTmSurfTm( *pStm1, *pStm2, dSafeDist, bTestEnclosion) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
int
ExeTestSurfaceSurface( int nSurf1Id, int nSurf2Id, double dSafeDist)
ExeTestSurfaceSurface( int nSurf1Id, int nSurf2Id, double dSafeDist, bool bTestEnclosion)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ;
if ( pGeomDB != nullptr) {
if ( pGeomDB->GetGeoType( nSurf1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSurf2Id) == SRF_TRIMESH)
nRes = MyTestSurfTmSurfTm( nSurf1Id, nSurf2Id, dSafeDist) ;
// è da aggiungere il test con le superfici di Bezier
nRes = MyTestSurfTmSurfTm( nSurf1Id, nSurf2Id, dSafeDist, bTestEnclosion) ;
// è da aggiungere il test con le superfici di Bezier
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTestSurfaceSurface({" + IdToString( nSurf1Id) + "," +
IdToString( nSurf2Id) + "," +
ToString( dSafeDist) + ")" +
ToString( dSafeDist) + "," +
( bTestEnclosion ? "true" : "false") + ")" +
" -- Res=" + ToString( nRes) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
+898
View File
@@ -0,0 +1,898 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : EXE_Trimming.cpp Data : 25.10.25 Versione : 2.7j3
// Funzioni per le lavorazioni di Trimming.
//
// Modifiche : 23.10.25 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "DllExchange.h"
#include "GeoTools.h"
#include "AuxTools.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkTrimming.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include <unordered_map>
#include <algorithm>
using namespace std ;
// ---------------------------------------------------------------------------
bool
ExeTrimmingGetHoleBorder( int nParentId, const INTVECTOR& vSurfIds, const INTVECTOR& vOtherSurfIds,
double dSurfLinTol, double dSurfAngTol, double dEdgeLinTol, double dEdgeAngTol,
double dEdgeThick, int& nFirstId, int& nCount)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Inizializzo i valori di ritorno
nFirstId = GDB_ID_NULL ;
nCount = 0 ;
// Se non ho geometrie da ricercare, non faccio nulla
if ( vSurfIds.empty())
return true ;
// Recupero le superfici da cui estrarre i bordi
CISURFPVECTOR vpSurfs ; vpSurfs.reserve( vSurfIds.size()) ;
for ( int i = 0 ; i < ssize( vSurfIds) ; ++ i) {
int nSurfId = vSurfIds[i] ;
// Recupero l'entità
const IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nSurfId) ;
if ( pGeoObj != nullptr) {
// Recupero il Tipo
int nType = pGeoObj->GetType() ;
if ( nType == SRF_TRIMESH || nType == SRF_BEZIER) {
// Recupero la superficie
const ISurf* pSurf = GetSurf( pGeoObj) ;
if ( pSurf != nullptr && pSurf->IsValid())
vpSurfs.emplace_back( pSurf) ;
}
}
}
// Se non ho superfici non faccio nulla
if ( vpSurfs.empty())
return false ;
// Calcolo il Centroide delle superfici complessive
Point3d ptRef = P_INVALID ;
if ( ! vOtherSurfIds.empty()) {
int nToTSurf = 0 ;
for ( int nOtherSurfId : vOtherSurfIds) {
// Recupero l'entità
const IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nOtherSurfId) ;
if ( pGeoObj != nullptr) {
// Recupero il Tipo
int nType = pGeoObj->GetType() ;
if ( nType == SRF_TRIMESH || nType == SRF_BEZIER) {
// Recupero la superficie
const ISurf* pSurf = GetSurf( pGeoObj) ;
if ( pSurf != nullptr && pSurf->IsValid()) {
// Recupero il Centroide
Point3d ptCentroid ;
pSurf->GetCentroid( ptCentroid) ;
if ( ! ptRef.IsValid())
ptRef = ptCentroid ;
else
ptRef += ptCentroid ;
++ nToTSurf ;
}
}
}
}
if ( nToTSurf > 0) {
for ( const ISurf* pSurf : vpSurfs) {
Point3d ptCentroid ;
pSurf->GetCentroid( ptCentroid) ;
if ( ! ptRef.IsValid())
ptRef = ptCentroid ;
else
ptRef += ptCentroid ;
++ nToTSurf ;
}
ptRef /= nToTSurf ;
}
}
// Recupero i Bordi per fori ed asole
ICRVCOMPOPOVECTOR vHoleBorders ;
bool bOk = GetTrimmingHoleBorders( vpSurfs, ptRef, dSurfLinTol, dSurfAngTol, dEdgeLinTol, dEdgeAngTol,
dEdgeThick, vHoleBorders) ;
if ( bOk) {
// Inserisco le curve nel DB e imposto i parametri di ritorno
bool bFirst = true ;
for ( int i = 0 ; bOk && i < ssize( vHoleBorders) ; ++ i) {
// Verifico che sia valida
if ( ! IsNull( vHoleBorders[i]) && vHoleBorders[i]->IsValid()) {
int nCrvId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vHoleBorders[i])) ;
bOk = ( nCrvId != GDB_ID_NULL) ;
if ( bOk) {
++ nCount ;
if ( bFirst) {
nFirstId = nCrvId ;
bFirst = false ;
}
}
}
}
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetHoleBorder(" + ToString( nParentId) + "," +
ToString( vSurfIds) + "," +
ToString( dSurfLinTol) + "," +
ToString( dSurfAngTol) + "," +
ToString( dEdgeLinTol) + "," +
ToString( dEdgeAngTol) + "," +
ToString( dEdgeThick) + ")" +
" bOk=" + ToString( bOk) +
" nNewSurfId=" + ToString( nFirstId) + ", nCount= " + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
// ---------------------------------------------------------------------------
int
ExeTrimmingGetSurfTmFaceAdj( int nParentId, int nSurfId, int nTria, const Point3d& ptTria,
double dAngTol, double dSize, double dSizeTol)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfId)) ;
bool bOk = ( pStm != nullptr && pStm->IsValid()) ;
// Recupero la superficie formata dai triangoli di adiacenza
int nNewSurfId = GDB_ID_NULL ;
if ( bOk) {
PtrOwner<ISurfTriMesh> pStmAdjFace( CreateSurfTriMesh()) ;
bOk = ( ! IsNull( pStmAdjFace) && pStmAdjFace->AdjustTopology()) ;
bOk = GetTrimmingStmAdjTria( pStm, nTria, ptTria, dAngTol, dSize, dSizeTol, pStmAdjFace) ;
bOk = ( ! IsNull( pStmAdjFace) && pStmAdjFace->IsValid() && pStmAdjFace->GetTriangleCount() > 0) ;
// Inserisco la Superficie nel DB geometrico
if ( bOk) {
nNewSurfId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStmAdjFace)) ;
bOk = ( nNewSurfId != GDB_ID_NULL) ;
}
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetSurfTmFromFaceAdj(" + ToString( nParentId) + "," +
ToString( nSurfId) + "," +
ToString( nTria) + "," +
"{ " + ToString( ptTria.x) + "," +
ToString( ptTria.y) + "," +
ToString( ptTria.z) + "}," +
ToString( dAngTol) + ")" +
" nNewSurfId=" + ToString( nNewSurfId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return nNewSurfId ;
}
// ---------------------------------------------------------------------------
int
ExeTrimmingGetSurfTmFromStmFaces( int nParentId, int nSurfId, const INTVECTOR& vFaces)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// Recupero il riferimento del gruppo di destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGlobFrame( nParentId, frDest))
return GDB_ID_NULL ;
// Recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfId)) ;
if ( pStm == nullptr || ! pStm->IsValid())
return GDB_ID_NULL ;
// Verifico che le facce appartengano alla superficie
if ( vFaces.empty())
return CMD_ID_NULL ;
for ( int nF = 0 ; nF < int( vFaces.size()) ; ++ nF) {
double dArea = 0. ;
if ( ! pStm->GetFacetArea( vFaces[nF], dArea))
return GDB_ID_NULL ;
}
// Definisco la superficie
StmFromTriangleSoup TriaSoup ;
TriaSoup.Start() ;
for ( int nF = 0 ; nF < int( vFaces.size()) ; ++ nF) {
INTVECTOR vT ;
if ( ! pStm->GetAllTriaInFacet( vFaces[nF], vT))
return GDB_ID_NULL ;
for ( int nT = 0 ; nT < int( vT.size()) ; ++ nT) {
Triangle3d Tria ;
if ( ! pStm->GetTriangle( vT[nT], Tria) || ! TriaSoup.AddTriangle( Tria))
return GDB_ID_NULL ;
}
}
TriaSoup.End() ;
PtrOwner<ISurfTriMesh> pStmTria( TriaSoup.GetSurf()) ;
if ( IsNull( pStmTria) || ! pStmTria->IsValid() || pStmTria->GetTriangleCount() == 0)
return GDB_ID_NULL ;
// Aggiungo la superficie al DB
int nNewSurfId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStmTria)) ;
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "TrimmingGetSurfTmFromStmFaces(" + ToString( nParentId) + "," +
ToString( nSurfId) + "," +
ToString( vFaces) + ")" +
" -- nId=" + ToString( nNewSurfId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return nNewSurfId ;
}
// ---------------------------------------------------------------------------
bool
ExeTrimmingGetAdjSurfs( const INTVECTOR& vSurfId, const INTVECTOR& vOtherSurfId, double dLinTol,
double dAngTol, double dAngFaceTol, INTVECTOR& vResId)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Recupero le superfici di Riferimento
CISURFPVECTOR vRefSurf ; vRefSurf.reserve( vSurfId.size()) ;
bool bOk = true ;
for ( int i = 0 ; bOk && i < int( vSurfId.size()) ; ++ i) {
const ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( vSurfId[i])) ;
bOk = ( pSurf != nullptr && pSurf->IsValid()) ;
vRefSurf.emplace_back( pSurf) ;
}
// Recupero le superfici complessive, escludendo eventualmente quelle di riferimento se presenti
CISURFPVECTOR vOtherSurf ; vOtherSurf.reserve( vOtherSurfId.size()) ;
INTVECTOR vIds ;
for ( int i = 0 ; bOk && i < int( vOtherSurfId.size()) ; ++ i) {
if ( find( vSurfId.begin(), vSurfId.end(), vOtherSurfId[i]) == vSurfId.end()) {
const ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( vOtherSurfId[i])) ;
bOk = ( pSurf != nullptr && pSurf->IsValid()) ;
vOtherSurf.emplace_back( pSurf) ;
vIds.push_back( vOtherSurfId[i]) ;
}
}
// Recupero le facce adiancenti nella tolleranza richiesta
INTVECTOR vMyInds ;
bOk = bOk && GetTrimmingAdjSurfs( vRefSurf, vOtherSurf, dLinTol, dAngTol, dAngFaceTol, vMyInds) ;
if ( bOk) {
for ( int myInd : vMyInds)
vResId.push_back( vIds[myInd]) ;
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetAdjSurfs(" + ToString( vSurfId) + "," +
ToString( vOtherSurfId) + "," +
ToString( dAngTol) + ")" +
" -- bOk=" + ToString( bOk) + ",vResId=" + ToString( vResId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
// ---------------------------------------------------------------------------
bool
ExeTrimmingGetBorders( int nParentId, const SELVECTOR& vIds, double dSurfLinTol, double dSurfAngTol,
double dLinTol, double dAngTol, int& nFirstId, int& nCount)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Parametri da restituire
nFirstId = GDB_ID_NULL ;
nCount = 0 ;
// vIds : vettore di { nId = SurfId, nSubId = nSurfFace }
// Controllo che vIds non sia vuoto
bool bOk = ( ! vIds.empty()) ;
// Recupero il riferimento della prima superficie
Frame3d frSurf ;
bOk = bOk && pGeomDB->GetGlobFrame( vIds[0].nId, frSurf) ;
// Recupero il riferimento dei gruppi di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGlobFrame( nParentId, frDest) ;
// Recupero gli Id univoci delle superfici selezionate
INTSET setUniqueId ;
for ( const SelData& nIds : vIds)
setUniqueId.insert( nIds.nId) ;
// Recupero le superfici e le porto tutte in locale alla prima
unordered_map<int, int> uMapPos ; uMapPos.reserve( setUniqueId.size()) ;
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( setUniqueId.size()) ;
CISURFPVECTOR vpSurf ; vpSurf.reserve( setUniqueId.size()) ;
int nSurf = 0 ;
for ( auto nIter = setUniqueId.begin() ; bOk && nIter != setUniqueId.end() ; ++ nIter) {
vSurfL.emplace_back( pGeomDB, *nIter, frSurf) ;
bOk = ( vSurfL.back().Get() != nullptr) ;
vpSurf.emplace_back( vSurfL.back().Get()) ;
uMapPos[*nIter] = nSurf ;
++ nSurf ;
}
// Recupero il vettore di Selezione associato non più agli Id delle superficie ma alle loro posizioni nel vettore
SELVECTOR vFaces ; vFaces.reserve( vIds.size()) ;
for ( int i = 0 ; bOk && i < int( vIds.size()) ; ++ i)
vFaces.emplace_back( uMapPos[vIds[i].nId], vIds[i].nSub) ;
// Calcolo le curve di Edge grezze ( quindi i tratti lineari)
ICRVCOMPOPOVECTOR vRawEdges ;
bOk = bOk && GetTrimmingRawEdges( vpSurf, vFaces, dSurfLinTol, dSurfAngTol, vRawEdges) &&
( ! vRawEdges.empty()) ;
// Calcolo le curve di Edge approssimate mediante curve di Bezier
ICRVCOMPOPOVECTOR vBezierEdges ;
bOk = bOk && GetTrimmingBezierEdges( vRawEdges, dLinTol, dAngTol, vBezierEdges) ;
nCount = int( vBezierEdges.size()) ;
if ( bOk) {
// Scorro i gli Edges ottenuti
for ( int nCrv = 0 ; bOk && nCrv < nCount ; ++ nCrv) {
vBezierEdges[nCrv]->ToLoc( frDest) ;
// Inserisco la curva nel DB Geometrico
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vBezierEdges[nCrv])) ;
bOk = ( nCurrId != GDB_ID_NULL) ;
if ( nCrv == 0)
nFirstId = nCurrId ;
}
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetBorders(" + IdToString( nParentId) + "," +
ToString( dSurfLinTol) + "," +
ToString( dSurfAngTol) + "," +
ToString( dLinTol) + "," +
ToString( dAngTol) + ")" ;
sLua += " -- bOk=" + ToString( bOk) +
" -- FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
// ---------------------------------------------------------------------------
bool
ExeTrimmingGetBordersByNormals( int nParentId, const SELVECTOR& vIds, double dSurfLinTol,
double dSurfAngTol, double dLinTol, double dAngTol, double dThick,
int& nFirstId, int& nCount)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Parametri da restituire
nFirstId = GDB_ID_NULL ;
nCount = 0 ;
// vIds : vettore di { nId = SurfId, nSubId = nSurfFace }
// Controllo che vIds non sia vuoto
bool bOk = ( ! vIds.empty()) ;
// Recupero il riferimento della prima superficie
Frame3d frSurf ;
bOk = bOk && pGeomDB->GetGlobFrame( vIds[0].nId, frSurf) ;
// Recupero il riferimento dei gruppi di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGlobFrame( nParentId, frDest) ;
// Recupero gli Id univoci delle superfici selezionate
INTSET setUniqueId ;
for ( const SelData& nIds : vIds)
setUniqueId.insert( nIds.nId) ;
// Recupero le superfici e le porto tutte in locale alla prima
unordered_map<int, int> uMapPos ; uMapPos.reserve( setUniqueId.size()) ;
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( setUniqueId.size()) ;
CISURFPVECTOR vpSurf ; vpSurf.reserve( setUniqueId.size()) ;
int nSurf = 0 ;
for ( auto nIter = setUniqueId.begin() ; bOk && nIter != setUniqueId.end() ; ++ nIter) {
vSurfL.emplace_back( pGeomDB, *nIter, frSurf) ;
bOk = ( vSurfL.back().Get() != nullptr) ;
vpSurf.emplace_back( vSurfL.back().Get()) ;
uMapPos[*nIter] = nSurf ;
++ nSurf ;
}
// Recupero il vettore di Selezione associato non più agli Id delle superficie ma alle loro posizioni nel vettore
SELVECTOR vFaces ; vFaces.reserve( vIds.size()) ;
for ( int i = 0 ; bOk && i < int( vIds.size()) ; ++ i)
vFaces.emplace_back( uMapPos[vIds[i].nId], vIds[i].nSub) ;
// Calcolo le curve di Edge approssimate mediante curve di Bezier
ICRVCOMPOPOVECTOR vBezierEdges ;
bOk = bOk && GetTrimmingFinalBorders( vpSurf, vFaces, dSurfLinTol, dSurfAngTol, dLinTol, dAngTol, dThick, vBezierEdges) ;
if ( bOk) {
nCount = int( vBezierEdges.size()) ;
// Scorro i gli Edges ottenuti
for ( int nCrv = 0 ; bOk && nCrv < nCount ; ++ nCrv) {
vBezierEdges[nCrv]->ToLoc( frDest) ;
// Inserisco la curva nel DB Geometrico
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vBezierEdges[nCrv])) ;
bOk = ( nCurrId != GDB_ID_NULL) ;
if ( nCrv == 0)
nFirstId = nCurrId ;
}
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetBordersByNormals(" + IdToString( nParentId) + "," +
ToString( dLinTol) + "," +
ToString( dAngTol) + ")" ;
sLua += " -- bOk=" + ToString( bOk) +
" -- FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
// ---------------------------------------------------------------------------
bool
ExeTrimmingGetFinalBorders( int nParentId, const INTVECTOR& vCrvBezierId, double dLinTol, double dAngTol,
const PNTVECTOR& vBrkPts, double dThick, double dThickTol,
int& nFirstId, int& nCount)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Parametri da restituire
nFirstId = GDB_ID_NULL ;
nCount = 0 ;
// Recupero il riferimento del gruppo di destinazione
Frame3d frDest ;
bool bOk = ( pGeomDB->GetGlobFrame( nParentId, frDest)) ;
// Recupero le curve di Bordo approssimate come Bezier
ICRVCOMPOPOVECTOR vCompoBezierEdges ; vCompoBezierEdges.reserve( vCrvBezierId.size()) ;
for ( int nCrv = 0 ; bOk && nCrv < int( vCrvBezierId.size()) ; ++ nCrv) {
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( vCrvBezierId[nCrv])) ;
bOk = ( pCrv != nullptr && pCrv->IsValid()) ;
if ( bOk) {
PtrOwner<ICurveComposite> pCompoRawEdges( ConvertCurveToComposite( pCrv->Clone())) ;
bOk = ( ! IsNull( pCompoRawEdges) && pCompoRawEdges->IsValid() &&
vCompoBezierEdges.emplace_back( Release( pCompoRawEdges))) ;
}
}
// Converto i punti in coppie di punti ( se dispari l'ultimo viene ignorato)
BIPNTVECTOR vBreakingPts ; vBreakingPts.reserve( int( int( vBrkPts.size()) / 2)) ;
for ( int nPt = 0 ; bOk && nPt < int( vBrkPts.size()) - 1 ; nPt += 2)
vBreakingPts.emplace_back( make_pair( vBrkPts[nPt], vBrkPts[nPt+1])) ;
if ( int( vBrkPts.size()) % 2 != 0)
LOG_INFO( GetCmdLogger(), "Warning in EgtExtractSurfFrChunkLoops : Odd number of breaking points") ;
// Calcolo le curve di Edge
bOk = bOk && GetTrimmingFinalBorders( vCompoBezierEdges, dLinTol, dAngTol, vBreakingPts, dThick, dThickTol) ;
nCount = int( vCompoBezierEdges.size()) ;
if ( bOk) {
// Scorro i gli Edges ottenuti
for ( int nCrv = 0 ; bOk && nCrv < nCount ; ++ nCrv) {
vCompoBezierEdges[nCrv]->ToLoc( frDest) ;
// Inserisco la curva nel DB Geometrico
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vCompoBezierEdges[nCrv])) ;
bOk = ( nCurrId != GDB_ID_NULL) ;
if ( nCrv == 0)
nFirstId = nCurrId ;
}
ExeSetModified() ;
}
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetFinalBorders(" + IdToString( nParentId) + "," +
ToString( vCrvBezierId) + "," +
ToString( dLinTol) + "," +
ToString( dAngTol) + "," ;
sLua += "{" ;
for ( int nP = 0 ; nP < int( vBrkPts.size()) ; ++ nP) {
sLua += "(" + ToString( vBrkPts[nP].x) + ", " + ToString( vBrkPts[nP].y) + ", " + ToString( vBrkPts[nP].z) + ")" +
( nP != int( vBrkPts.size()) - 1 ? "," : "") ;
}
sLua += "}" ;
sLua += ToString( dThick) + "," + ToString( dThickTol) + ")" ;
sLua += " -- bOk=" + ToString( bOk) +
" -- FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
// ---------------------------------------------------------------------------
int
ExeTrimmingGetRuledBezier( int nParentId, const INTVECTOR& vIds, int nEdge1Id, int nEdge2Id, double dLinTol,
const INTVECTOR& vnLineId)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// Aggiusto la tolleranza lineare se necessario
double dMyLinTol = Clamp( dLinTol, EPS_SMALL, 1e5 * EPS_SMALL) ;
// Recupero il riferimento dei gruppi di destinazione
Frame3d frDest ;
bool bOk = pGeomDB->GetGlobFrame( nParentId, frDest) ;
// Recupero la prima curva
const ICurve* pCrvEdge1 = GetCurve( pGeomDB->GetGeoObj( nEdge1Id)) ;
bOk = bOk && ( pCrvEdge1 != nullptr && pCrvEdge1->IsValid()) ;
// Recupero la seconda curva
const ICurve* pCrvEdge2 = GetCurve( pGeomDB->GetGeoObj( nEdge2Id)) ;
bOk = bOk && ( pCrvEdge2 != nullptr && pCrvEdge2->IsValid()) ;
// Se ci sono delle superfici di riferimento
CISURFPVECTOR vpSurf ; vpSurf.reserve( vIds.size()) ;
if ( ! vIds.empty()) {
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vIds.size()) ;
// Recupero il riferimento della prima superficie
Frame3d frSurf ;
bOk = bOk && ( pGeomDB->GetGlobFrame( vIds[0], frSurf)) ;
// Porto le altre nel riferimento della prima
for ( int nSurf = 0 ; bOk && nSurf < int( vIds.size()) ; ++ nSurf) {
vSurfL.emplace_back( pGeomDB, vIds[nSurf], frSurf) ;
if ( vSurfL.back().Get() == nullptr) {
bOk = false ;
break ;
}
vpSurf.emplace_back( vSurfL.back().Get()) ;
}
}
// Recupero i punti di sincronizzazione ( se presenti)
BIPNTVECTOR vSyncPoints ; vSyncPoints.reserve( pGeomDB->GetGroupObjs( vnLineId.size())) ;
for ( int i = 0 ; bOk && i < ssize( vnLineId) ; ++ i) {
// Recupero la Curva
const ICurve* pLine = GetCurve( pGeomDB->GetGeoObj( vnLineId[i])) ;
bOk = bOk && ( pLine != nullptr && pLine->IsValid()) ;
if ( bOk) {
// Recupero gli Estremi
Point3d ptStart ; pLine->GetStartPoint( ptStart) ;
Point3d ptEnd ; pLine->GetEndPoint( ptEnd) ;
// Mi assicuro che gli estremi siano sulle curve di Bordo e orientati correttamente ( nel caso inverto)
double dSqDistS1 = INFINITO ;
if ( ! DistPointCurve( ptStart, *pCrvEdge1).GetSqDist( dSqDistS1))
continue ;
if ( dSqDistS1 < dLinTol * dLinTol) {
double dSqDistE2 = INFINITO ;
if ( ! DistPointCurve( ptEnd, *pCrvEdge2).GetSqDist( dSqDistE2) ||
dSqDistE2 > dLinTol * dLinTol)
continue ;
}
else {
double dSqDistS2 = INFINITO ;
if ( ! DistPointCurve( ptStart, *pCrvEdge2).GetSqDist( dSqDistS2) ||
dSqDistS2 > dLinTol * dLinTol)
continue ;
double dSqDistE1 = INFINITO ;
if ( ! DistPointCurve( ptEnd, *pCrvEdge1).GetSqDist( dSqDistE1) ||
dSqDistE1 > dLinTol * dLinTol)
continue ;
swap( ptStart, ptEnd) ;
}
vSyncPoints.emplace_back( make_pair( ptStart, ptEnd)) ;
}
}
// Recupero la superficie Bezier rigata
PtrOwner<ISurfBezier> pSurfBzRuled ;
if ( bOk) {
pSurfBzRuled.Set( GetTrimmingRuledBezier( vpSurf, pCrvEdge1, pCrvEdge2, dMyLinTol, vSyncPoints)) ;
bOk = bOk && ( ! IsNull( pSurfBzRuled) && pSurfBzRuled->IsValid()) ;
}
// Inserisco la curva nel DB Geometrico
int nSurfBzId = GDB_ID_NULL ;
if ( bOk) {
pSurfBzRuled->ToLoc( frDest) ;
nSurfBzId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSurfBzRuled)) ;
bOk = bOk && ( nSurfBzId != GDB_ID_NULL) ;
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetRuledBezier(" + ToString( nParentId) + "," +
ToString( vIds) + "," +
ToString( nEdge1Id) + "," +
ToString( nEdge2Id) + "," +
ToString( dLinTol) + ")" +
" -- bOk=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// Restituisco il risultato
return nSurfBzId ;
}
// ---------------------------------------------------------------------------
bool
ExeTrimmingInterpolateSyncLines( int nParentId, int nSync1Id, int nSync2Id, int nBorder1Id,
int nBorder2Id, double dEdgeLinTol, double dEdgeAngTol,
int& nFirstId, int& nCount)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// Reset parametri di ritorno
nFirstId = GDB_ID_NULL ;
nCount = 0 ;
// Aggiusto la tolleranza lineare e angolare se necessario
double dMyEdgeLinTol = Clamp( dEdgeLinTol, EPS_SMALL, 1e5 * EPS_SMALL) ;
double dMyEdgeAngTol = Clamp( dEdgeAngTol, EPS_ANG_SMALL, 60.) ;
// recupero le due curve di sincronizzazione
const ICurve* pSync1 = GetCurve( pGeomDB->GetGeoObj( nSync1Id)) ;
const ICurve* pSync2 = GetCurve( pGeomDB->GetGeoObj( nSync2Id)) ;
bool bOk = ( pSync1 != nullptr && pSync1->IsValid() &&
pSync2 != nullptr && pSync2->IsValid()) ;
// Recupero le due curve di bordo
const ICurve* pCrvEdge1 = GetCurve( pGeomDB->GetGeoObj( nBorder1Id)) ;
const ICurve* pCrvEdge2 = GetCurve( pGeomDB->GetGeoObj( nBorder2Id)) ;
bOk = bOk && ( pCrvEdge1 != nullptr && pCrvEdge1->IsValid()) ;
bOk = bOk && ( pCrvEdge2 != nullptr && pCrvEdge2->IsValid()) ;
// Calcolo le Curve di sincornizzazione Interpolate
BIPNTVECTOR vSyncPoints ;
bOk = bOk && GetTrimmingSyncInterpolation( pCrvEdge1, pCrvEdge2, pSync1, pSync2, dMyEdgeLinTol,
dMyEdgeAngTol, vSyncPoints) ;
if ( bOk && ! vSyncPoints.empty()) {
// Inserisco le curve di sincronizzazione nel DB
// [orientate da pCrvEdge1 a pCrvEdge2]
for ( int i = 0 ; bOk && i < ssize( vSyncPoints) ; ++ i) {
PtrOwner<ICurveLine> pSyncLine( CreateCurveLine()) ;
bOk = ( ! IsNull( pSyncLine) && pSyncLine->Set( vSyncPoints[i].first, vSyncPoints[i].second)) ;
if ( bOk) {
if ( pCrvEdge1->IsPointOn( vSyncPoints[i].second, dMyEdgeLinTol))
pSyncLine->Invert() ;
int nSyncId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSyncLine)) ;
bOk = ( nSyncId != CMD_ID_NULL) ;
if ( i == 0)
nFirstId = nSyncId ;
}
}
nCount = ssize( vSyncPoints) ;
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingInterpolateSyncLines(" + ToString( nParentId) + "," +
ToString( nSync1Id) + "," +
ToString( nSync2Id) + "," +
ToString( nBorder1Id) + "," +
ToString( nBorder2Id) + "," +
ToString( dEdgeLinTol) + "," +
ToString( dEdgeAngTol) + ")" +
" -- bOk=" + ToString( bOk) +
" -- nFirstId=" + ToString( nFirstId) + " nCount=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
// ---------------------------------------------------------------------------
bool
ExeTrimmingGetSurfBzSyncPoints( int nParentId, int nEdge1Id, int nEdge2Id, double dLinTol,
double dAngTol, int nLineNbr, bool bShowOnCorners,
int& nFirstId, int& nCount)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Imposto i parametri di ritorno
nFirstId = GDB_ID_NULL ;
nCount = 0 ;
// Se non devo visualizzare alcuna linea, non faccio nulla
if ( nLineNbr <= 0 && ! bShowOnCorners)
return true ;
// Se necessario aggiusto le tolleranze
double dMyLinTol = Clamp( dLinTol, EPS_SMALL, 1e5 * EPS_SMALL) ;
double dMyAngTol = Clamp( dAngTol, EPS_ANG_SMALL, ANG_RIGHT) ;
// Recupero il riferimento del gruppo di destinazione
Frame3d frDest ;
bool bOk = ( pGeomDB->GetGlobFrame( nParentId, frDest)) ;
// Recupero le due Curve di bordo
const ICurve* pCrvEdge1 = GetCurve( pGeomDB->GetGeoObj( nEdge1Id)) ;
const ICurve* pCrvEdge2 = GetCurve( pGeomDB->GetGeoObj( nEdge2Id)) ;
bOk = bOk && ( pCrvEdge1 != nullptr && pCrvEdge1->IsValid() &&
pCrvEdge2 != nullptr && pCrvEdge2->IsValid()) ;
// Verifico che le curve siano entrambe Aperte o entrambe Chiuse
bOk = bOk && ( pCrvEdge1->IsClosed() == pCrvEdge2->IsClosed()) ;
// Recupero i punti di sincronizzazione
BIPNTVECTOR vSyncPoints ;
bOk = bOk && GetTrimmingSurfBzSyncPoints( pCrvEdge1, pCrvEdge2, dMyLinTol, vSyncPoints) &&
( ! vSyncPoints.empty()) ;
int nToTSyncLines = ssize( vSyncPoints) ;
// Ogni punto di sincronizzazione deve avere gli estremi sulle curve di Bordo
for ( int i = 0 ; bOk && i < ssize( vSyncPoints) ; ++ i) {
double dSqDistStart = INFINITO, dSqDistEnd = INFINITO ;
bOk = ( DistPointCurve( vSyncPoints[i].first, *pCrvEdge1).GetSqDist( dSqDistStart) &&
dSqDistStart < dMyLinTol * dMyLinTol &&
DistPointCurve( vSyncPoints[i].second, *pCrvEdge2).GetSqDist( dSqDistEnd) &&
dSqDistEnd < dMyLinTol * dMyLinTol) ;
}
if ( bOk) {
INTSET setInds ;
// Se devo visualizzare più linee di quante ne ho ricavate, allora le devo visualizzare tutte
if ( nLineNbr >= nToTSyncLines) {
for ( int i = 0 ; i < nToTSyncLines ; ++ i)
setInds.insert( i) ;
}
// Altrimenti
else {
// Se voglio visualizzare gli Spigoli
if ( bShowOnCorners) {
for ( int nL = 0 ; bOk && nL < nToTSyncLines ; ++ nL) {
// Controllo se punto su spigolo della curva
double dU = 0. ;
Vector3d vtTanPrev, vtTanAft ;
Point3d ptUseless ;
bOk = ( pCrvEdge1->GetParamAtPoint( vSyncPoints[nL].first, dU, dMyLinTol) &&
pCrvEdge1->GetPointD1D2( dU, ICurve::FROM_MINUS, ptUseless, &vtTanPrev) &&
pCrvEdge1->GetPointD1D2( dU, ICurve::FROM_PLUS, ptUseless, &vtTanAft)) ;
if ( ! bOk)
break ;
vtTanPrev.Normalize() ;
vtTanAft.Normalize() ;
if ( vtTanPrev * vtTanAft < cos( ( dMyAngTol + EPS_ANG_SMALL) * DEGTORAD)) {
setInds.insert( nL) ;
continue ;
}
bOk = ( pCrvEdge2->GetParamAtPoint( vSyncPoints[nL].second, dU, dMyLinTol) &&
pCrvEdge2->GetPointD1D2( dU, ICurve::FROM_MINUS, ptUseless, &vtTanPrev) &&
pCrvEdge2->GetPointD1D2( dU, ICurve::FROM_PLUS, ptUseless, &vtTanAft)) ;
if ( ! bOk)
break ;
vtTanPrev.Normalize() ;
vtTanAft.Normalize() ;
if ( vtTanPrev * vtTanAft < cos( ( dMyAngTol + EPS_ANG_SMALL) * DEGTORAD)) {
setInds.insert( nL) ;
continue ;
}
}
}
// Se devo mostrare alcune Linee
if ( bOk && nLineNbr > 0) {
bool bBothOpen = ( ! pCrvEdge1->IsClosed() && ! pCrvEdge2->IsClosed()) ;
bool bBothClosed = ( ! bBothOpen) ;
int nLastIdx = nToTSyncLines - 1 ;
if ( bBothClosed) {
int nLine = nLineNbr ;
if ( nLine == 1)
setInds.insert( 0) ;
else {
int nMaxIndex = nToTSyncLines - 2 ;
for ( int i = 0 ; i < nLine ; ++ i) {
double dT = double( i) / double( nLine) ;
int nIdx = int( 0.5 + dT * nMaxIndex) ;
setInds.insert( nIdx) ;
}
setInds.erase( nLastIdx) ;
}
}
else {
int nInternal = nLineNbr ;
setInds.insert( 0) ;
setInds.insert( nLastIdx) ;
int nMaxIndex = nLastIdx ;
for ( int i = 0; i < nInternal ; ++ i) {
double dT = double( i + 1) / double( nInternal + 1) ;
int nIdx = int( 0.5 + dT * nMaxIndex) ;
setInds.insert( nIdx) ;
}
}
}
}
// Visualizzo i segmenti lineari di sincronizzazione per ogni indice ricavato
bool bFirst = true ;
for ( auto Iter = setInds.begin() ; bOk && Iter != setInds.end() ; ++ Iter) {
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
bOk = ( ! IsNull( pLine) && pLine->Set( vSyncPoints[*Iter].first, vSyncPoints[*Iter].second)) ;
if ( bOk) {
int nLineId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pLine)) ;
bOk = ( nLineId != GDB_ID_NULL) ;
if ( bFirst) {
nFirstId = nLineId ;
bFirst = false ;
}
++ nCount ;
}
}
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetSurfBzSyncPoints(" + ToString( nParentId) + "," +
ToString( nEdge1Id) + "," +
ToString( nEdge2Id) + "," +
ToString( dLinTol) + "," +
ToString( nFirstId) + "," +
ToString( nCount) + ")" +
" -- bOk=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
// ---------------------------------------------------------------------------
int
ExeRegolarizeSurfaceLocally( int nParentId, int nSurfId, int nSyncStartId, int nSyncEndId, double dLinTol)
{
bool bOk = true ;
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie
ISurfBezier* pSurfBez = GetSurfBezier( GetSurf( pGeomDB->GetGeoObj( nSurfId))) ;
// recupero le due isocurve
const ICurve* pSyncStart = GetCurveLine( GetCurve( pGeomDB->GetGeoObj( nSyncStartId))) ;
const ICurve* pSyncEnd = GetCurveLine( GetCurve( pGeomDB->GetGeoObj( nSyncEndId))) ;
Point3d ptS1 ; pSyncStart->GetStartPoint( ptS1) ;
Point3d ptE1 ; pSyncStart->GetEndPoint( ptE1) ;
BIPOINT bpIsoStart( ptS1, ptE1) ;
Point3d ptS2 ; pSyncEnd->GetStartPoint( ptS2) ;
Point3d ptE2 ; pSyncEnd->GetEndPoint( ptE2) ;
BIPOINT bpIsoEnd( ptS2, ptE2) ;
PtrOwner<ISurfBezier> pNewSurf( RegolarizeBordersLocally( pSurfBez, bpIsoStart, bpIsoEnd, dLinTol)) ;
if ( IsNull( pNewSurf))
return GDB_ID_NULL ;
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pNewSurf)) ;
return nId ;
}
BIN
View File
Binary file not shown.
+4
View File
@@ -228,6 +228,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EXeConst.h" />
<ClInclude Include="..\Include\EXeDllMain.h" />
<ClInclude Include="..\Include\EXeExecutor.h" />
<ClInclude Include="AuxDialogBox.h" />
<ClInclude Include="DllExch3dm.h" />
<ClInclude Include="DllMain.h" />
<ClInclude Include="DllNesting.h" />
@@ -249,6 +250,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="stdafx.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="AuxDialogBox.cpp" />
<ClCompile Include="DllExch3dm.cpp" />
<ClCompile Include="DllNesting.cpp" />
<ClCompile Include="EXE_Base64.cpp" />
@@ -297,6 +299,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="EXE_Scene.cpp" />
<ClCompile Include="EXE_ShortestPath.cpp" />
<ClCompile Include="EXE_TestObjSurface.cpp" />
<ClCompile Include="EXE_Trimming.cpp" />
<ClCompile Include="EXE_TscExec.cpp" />
<ClCompile Include="AuxTools.cpp" />
<ClCompile Include="DllExchange.cpp" />
@@ -324,6 +327,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="LUA_PolynomialRoots.cpp" />
<ClCompile Include="LUA_Redis.cpp" />
<ClCompile Include="LUA_TestObjSurface.cpp" />
<ClCompile Include="LUA_Trimming.cpp" />
<ClCompile Include="PictureObj.cpp" />
<ClCompile Include="LUA_Base.cpp" />
<ClCompile Include="LUA_GdbCreateCurve.cpp" />
+12
View File
@@ -111,6 +111,9 @@
<ClInclude Include="DllExch3dm.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="AuxDialogBox.h">
<Filter>File di intestazione</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="LUA_Exchange.cpp">
@@ -407,6 +410,12 @@
<ClCompile Include="LUA_TestObjSurface.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="Lua_Trimming.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="EXE_Trimming.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="EXE_MachOpt.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
@@ -425,6 +434,9 @@
<ClCompile Include="LUA_Base64.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="AuxDialogBox.cpp">
<Filter>File di origine\Global</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="EgtExecutor.rc">
+2
View File
@@ -141,3 +141,5 @@ bool LuaInstallRedis( LuaMgr& luaMgr) ;
//-------------------------- Base64 ------------------------------------------
bool LuaInstallBase64( LuaMgr& luaMgr) ;
//---------------------------------- Trimming ----------------------------------
bool LuaInstallTrimming( LuaMgr& luaMgr) ;
+5 -1
View File
@@ -194,7 +194,11 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
LOG_ERROR( GetLogger(), "Error in LuaInstallBase64 (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallTrimming( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallTrimming (LuaInstallEgtFunctions)")
return false ;
}
return true ;
}
+39 -7
View File
@@ -956,6 +956,29 @@ LuaCreateSurfTmByVolZmap( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfShell( lua_State* L)
{
// 4 parametri : nParentId, nSurfId, dThick, dLinTol
int nParentId ;
LuaCheckParam( L, 1, nParentId) ;
int nSurfId ;
LuaCheckParam( L, 2, nSurfId) ;
double dThick ;
LuaCheckParam( L, 3, dThick) ;
double dLinTol ;
LuaCheckParam( L, 4, dLinTol) ;
// creo la STM
int nId = ExeCreateSurfShell( nParentId, nSurfId, dThick, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBezier( lua_State* L)
@@ -1028,21 +1051,27 @@ LuaCreateSurfBezierRational( lua_State* L)
static int
LuaCreateSurfBezierLeaves( lua_State* L)
{
// 2, 3 o 4 parametri : ParentId, nId [, nTextHeight] [, bShowTrim]
// 2, 3 o 4 parametri : ParentId, nId [, nTextHeight] [, bShowTrim] [, bRefined]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nSurfBzId ;
LuaCheckParam( L, 2, nSurfBzId)
int nTextHeight = 50 ;
bool bShowTrim = false ;
if ( LuaGetParam( L, 3, nTextHeight))
LuaGetParam( L, 4, bShowTrim) ;
else
bool bRefined = false ;
// testo più due booleani o solo due booleani
if ( LuaGetParam( L, 3, nTextHeight)) {
if ( LuaGetParam( L, 4, bShowTrim))
LuaGetParam( L, 5, bRefined) ;
}
else {
LuaGetParam( L, 3, bShowTrim) ;
LuaGetParam( L, 4, bRefined) ;
}
LuaClearStack( L) ;
// creo la superficie
int nCount = 0 ;
int nId = ExeCreateSurfBezierLeaves( nParentId, nSurfBzId, nTextHeight, bShowTrim, &nCount) ;
int nId = ExeCreateSurfBezierLeaves( nParentId, nSurfBzId, nTextHeight, bShowTrim, bRefined, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL) {
LuaSetParam( L, nId) ;
@@ -1363,7 +1392,7 @@ LuaCreateSurfBzRuled( lua_State* L)
static int
LuaCreateSurfBzRuledGuided( lua_State* L)
{
// 4 o 5 o 6 parametri : ParentId, CrvId1, CrvId2 nLayGuides [, bCapEnds] [, dTol]
// 4 o 5 o 6 parametri : ParentId, CrvId1, CrvId2, nLayGuides [, bCapEnds] [, dTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId1 ;
@@ -1379,8 +1408,10 @@ LuaCreateSurfBzRuledGuided( lua_State* L)
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, nPar, dLinTol) ;
LuaClearStack( L) ;
BIPNTVECTOR vGuides ;
// 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) ;
int nId = ExeCreateSurfBzRuledGuided( nParentId, nCrvId1, nCrvId2, vGuides, bCapEnds, dLinTol, nLayGuides) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
@@ -1489,6 +1520,7 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByTriangles", LuaCreateSurfTmByTriangles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySewing", LuaCreateSurfTmBySewing) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByVolZmap", LuaCreateSurfTmByVolZmap) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmShell", LuaCreateSurfShell) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezier", LuaCreateSurfBezier) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierRat", LuaCreateSurfBezierRational) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierLeaves", LuaCreateSurfBezierLeaves) ;
+55 -6
View File
@@ -48,7 +48,7 @@ LuaSurfIsClosed( lua_State* L)
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// verifico se è superficie chiusa
// verifico se superficie chiusa
bool bOk = ExeSurfIsClosed( nId) ;
LuaSetParam( L, bOk) ;
return 1 ;
@@ -218,7 +218,7 @@ LuaSurfFrMoveSimpleNoCollision( lua_State* L)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// verifico quale è la massima traslazione possibile
// verifico quale la massima traslazione possibile
double dLen = vtMove.Len() ;
Vector3d vtDir = ( dLen > EPS_SMALL ? vtMove / dLen : V_NULL) ;
bool bOk = ExeSurfFrMoveSimpleNoCollision( nId1, nId2, vtDir, dLen, nRefType) ;
@@ -246,7 +246,7 @@ LuaSurfFrRotateSimpleNoCollision( lua_State* L)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// verifico quale è la massima (in valore assoluto) rotazione possibile
// verifico quale la massima (in valore assoluto) rotazione possibile
bool bOk = ExeSurfFrRotateSimpleNoCollision( nId1, nId2, ptCen, dAngDeg, nRefType) ;
// restituisco il risultato
if ( bOk)
@@ -301,6 +301,25 @@ LuaSurfTmPartCount( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetPartAndShellFromFacet( lua_State* L)
{
// 2 parametri : Id SurfTm, Id Facet
int nIdSurfTm ;
LuaCheckParam( L, 1, nIdSurfTm)
int nIdFacet ;
LuaCheckParam( L, 2, nIdFacet)
LuaClearStack( L) ;
// recupero il numero di parti della superficie trimesh
int nPart = - 1 ;
int nShell = - 1 ;
ExeSurfTmGetPartAndShellFromFacet( nIdSurfTm, nIdFacet, nPart, nShell) ;
LuaSetParam( L, nPart) ;
LuaSetParam( L, nShell) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetVertex( lua_State* L)
@@ -335,7 +354,7 @@ LuaSurfTmGetNearestVertex( lua_State* L)
int nRefId = nId ;
LuaGetParam( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero il vertice più vicino della superficie
// recupero il vertice pi vicino della superficie
int nVert ;
Point3d ptVert ;
bool bOk = ExeSurfTmGetNearestVertex( nId, ptNear, nRefId, nVert, ptVert) ;
@@ -556,7 +575,7 @@ LuaSurfTmFacetNearestEndPoint( lua_State* L)
int nRefId = nId ;
LuaGetParam( L, 4, nRefId) ;
LuaClearStack( L) ;
// recupero il punto End più vicino della faccia della superficie trimesh
// recupero il punto End pi vicino della faccia della superficie trimesh
Point3d ptEnd ;
Vector3d vtN ;
if ( ExeSurfTmFacetNearestEndPoint( nId, nFacet, ptNear, nRefId, ptEnd, vtN)) {
@@ -584,7 +603,7 @@ LuaSurfTmFacetNearestMidPoint( lua_State* L)
int nRefId = nId ;
LuaGetParam( L, 4, nRefId) ;
LuaClearStack( L) ;
// recupero il punto Mid più vicino della faccia della superficie trimesh
// recupero il punto Mid pi vicino della faccia della superficie trimesh
Point3d ptMid ;
Vector3d vtN ;
if ( ExeSurfTmFacetNearestMidPoint( nId, nFacet, ptNear, nRefId, ptMid, vtN)) {
@@ -1140,6 +1159,34 @@ LuaSurfBezierGetCurveV( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfBezParamsFromPoint( lua_State* L)
{
// 2 o 3 parametri : nSurfId, ptOnSurf [, nRefId]
int nSurfId ;
LuaCheckParam( L, 1, nSurfId)
Point3d ptOnSurf ;
LuaCheckParam( L, 2, ptOnSurf)
int nRefId = nSurfId ;
LuaGetParam( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero le coordinate parametriche del punto
double dU = - 1 ;
double dV = - 1 ;
bool bOk = ExeSurfBezierParamsFromPoint( nSurfId, ptOnSurf, nRefId, dU, dV) ;
if ( bOk) {
LuaSetParam( L, dU) ;
LuaSetParam( L, dV) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfBezierGetInfo( lua_State* L)
@@ -1280,6 +1327,7 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmVertexCount", LuaSurfTmVertexCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCount", LuaSurfTmFacetCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPartCount", LuaSurfTmPartCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetPartAndShellFromFacet", LuaSurfTmGetPartAndShellFromFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetVertex", LuaSurfTmGetVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetNearestVertex", LuaSurfTmGetNearestVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmTriangleNormVersor", LuaSurfTmTriangleNormVersor) ;
@@ -1312,6 +1360,7 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPointNrmD1", LuaSurfBezierGetPointNrmD1) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetCurveU", LuaSurfBezierGetCurveU) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetCurveV", LuaSurfBezierGetCurveV) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezParamsFromPoint", LuaSurfBezParamsFromPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetInfo", LuaSurfBezierGetInfo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetControlCurveU", LuaSurfBezierGetControlCurveU) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetControlCurveV", LuaSurfBezierGetControlCurveV) ;
+44 -13
View File
@@ -757,7 +757,7 @@ LuaRemoveCurveCompoCurve( lua_State* L)
// 1 o 2 parametri : Id [, bLast]
int nId ;
LuaCheckParam( L, 1, nId)
bool bLast ;
bool bLast = true ;
LuaGetParam( L, 2, bLast) ;
LuaClearStack( L) ;
// rimuovo prima o ultima curva della composita
@@ -933,16 +933,18 @@ LuaRemoveCurveCompoUndercutOnY( lua_State* L)
static int
LuaCurveCompoSetTempProp( lua_State* L)
{
// 3 parametri : Id, nCrv, nProp
// 3 parametri : Id, nCrv, nProp [, nPropInd]
int nId ;
LuaCheckParam( L, 1, nId)
int nCrv ;
LuaCheckParam( L, 2, nCrv)
int nProp ;
LuaCheckParam( L, 3, nProp)
int nPropInd = 0 ;
LuaGetParam( L, 4, nPropInd) ;
LuaClearStack( L) ;
// imposto sulla curva della composita la proprietà temporanea
bool bOk = ExeCurveCompoSetTempProp( nId, nCrv, nProp) ;
bool bOk = ExeCurveCompoSetTempProp( nId, nCrv, nProp, nPropInd) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
@@ -951,16 +953,18 @@ LuaCurveCompoSetTempProp( lua_State* L)
static int
LuaCurveCompoSetTempParam( lua_State* L)
{
// 3 parametri : Id, nCrv, dParam
// 3 parametri : Id, nCrv, dParam [, nParamInd]
int nId ;
LuaCheckParam( L, 1, nId)
int nCrv ;
LuaCheckParam( L, 2, nCrv)
double dParam ;
LuaCheckParam( L, 3, dParam)
int nParamInd = 0 ;
LuaGetParam( L, 4, nParamInd) ;
LuaClearStack( L) ;
// imposto sulla curva della composita il parametro temporaneo
bool bOk = ExeCurveCompoSetTempParam( nId, nCrv, dParam) ;
bool bOk = ExeCurveCompoSetTempParam( nId, nCrv, dParam, nParamInd) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
@@ -1005,7 +1009,29 @@ LuaReorderCurvesInGroup( lua_State* L)
static int
LuaProjectCurveOnSurf( lua_State* L)
{
// 4, 5, 6, 7 o 8 parametri : nCurveId, vSurfId, vtDir, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromProj] [, nRefType]]
// 3, 4 o 5 parametri : nCurveId, vSurfId, nDestGrpId [, dLinTol [, dMaxSegmLen]]
int nCurveId ;
LuaCheckParam( L, 1, nCurveId)
INTVECTOR vSurfId ;
LuaCheckParam( L, 2, vSurfId)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId)
double dLinTol = 0.01 ;
double dMaxSegmLen = INFINITO ;
if ( LuaGetParam( L, 4, dLinTol))
LuaGetParam( L, 5, dMaxSegmLen) ;
LuaClearStack( L) ;
// proietto la curva su una o più superfici a minima distanza
bool bOk = ExeProjectCurveOnSurf( nCurveId, vSurfId, nDestGrpId, dLinTol, dMaxSegmLen) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaProjectCurveOnSurfDir( lua_State* L)
{
// 4, 5, 6, 7 o 8 parametri : nCurveId, vSurfId, vtDir, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromProj] [,bFromVsTo] [, nRefType]]
int nCurveId ;
LuaCheckParam( L, 1, nCurveId)
INTVECTOR vSurfId ;
@@ -1017,14 +1043,16 @@ LuaProjectCurveOnSurf( lua_State* L)
double dLinTol = 0.01 ;
double dMaxSegmLen = INFINITO ;
bool bDirFromProj = false ;
bool bFromVsTo = true ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 5, dLinTol) &&
LuaGetParam( L, 6, dMaxSegmLen) &&
LuaGetParam( L, 7, bDirFromProj))
LuaGetParam( L, 8, nRefType) ;
LuaGetParam( L, 7, bDirFromProj) &&
LuaGetParam( L, 8, bFromVsTo))
LuaGetParam( L, 9, nRefType) ;
LuaClearStack( L) ;
// proietto la curva su una o più superfici secondo la direzione data
bool bOk = ExeProjectCurveOnSurf( nCurveId, vSurfId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, nRefType) ;
bool bOk = ExeProjectCurveOnSurfDir( nCurveId, vSurfId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, bFromVsTo, nRefType) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
@@ -1033,7 +1061,7 @@ LuaProjectCurveOnSurf( lua_State* L)
static int
LuaProjectCurveOnSurfExt( lua_State* L)
{
// 4, 5, 6 o 7 parametri : nCurveId, vSurfId, nGuideId, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromGuide]]
// 4, 5, 6 o 7 parametri : nCurveId, vSurfId, nGuideId, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromGuide] [,bFromVsTo]]
int nCurveId ;
LuaCheckParam( L, 1, nCurveId)
INTVECTOR vSurfId ;
@@ -1045,12 +1073,14 @@ LuaProjectCurveOnSurfExt( lua_State* L)
double dLinTol = 0.01 ;
double dMaxSegmLen = INFINITO ;
bool bDirFromGuide = false ;
bool bFromVsTo = true ;
if ( LuaGetParam( L, 5, dLinTol) &&
LuaGetParam( L, 6, dMaxSegmLen))
LuaGetParam( L, 7, bDirFromGuide) ;
LuaGetParam( L, 6, dMaxSegmLen) &&
LuaGetParam( L, 7, bDirFromGuide))
LuaGetParam( L, 8, bFromVsTo) ;
LuaClearStack( L) ;
// proietto la curva su una o più superfici secondo la direzione verso la guida
bool bOk = ExeProjectCurveOnSurfExt( nCurveId, vSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
bool bOk = ExeProjectCurveOnSurfExt( nCurveId, vSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide, bFromVsTo) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
@@ -1254,6 +1284,7 @@ LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtChainCurvesInGroup", LuaChainCurvesInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtReorderCurvesInGroup", LuaReorderCurvesInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurf", LuaProjectCurveOnSurf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurfDir", LuaProjectCurveOnSurfDir) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurfExt", LuaProjectCurveOnSurfExt) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveGetVoronoi", LuaCurveGetVoronoi) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveMedialAxisAdv", LuaCurveMedialAxisAdv) ;
+21 -2
View File
@@ -565,7 +565,7 @@ LuaSurfTmGetShowEdges( lua_State* L)
static int
LuaSurfTmSetSmoothAng( lua_State* L)
{
// 2 parametri : nId, nCutterId
// 2 parametri : nId, dAngDeg
int nId ;
LuaCheckParam( L, 1, nId)
double dAngDeg ;
@@ -577,6 +577,24 @@ LuaSurfTmSetSmoothAng( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmGetSmoothAng( lua_State* L)
{
// 1 parametro : nId
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero lo smooth angle della superficie
double dAngDeg ;
bool bOk = ExeSurfTmGetSmoothAng( nId, dAngDeg) ;
if ( bOk)
LuaSetParam( L, dAngDeg) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmOffset( lua_State* L)
@@ -664,7 +682,7 @@ LuaSurfBzTrim( lua_State* L)
bool
LuaInstallGdbModifySurf( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bool bOk = true ;
bOk = bOk && luaMgr.RegisterFunction( "EgtInvertSurf", LuaInvertSurf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeSurf", LuaExplodeSurf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtApproxSurf", LuaApproxSurf) ;
@@ -694,6 +712,7 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetShowEdges", LuaSurfTmSetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetShowEdges", LuaSurfTmGetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetSmoothAng", LuaSurfTmSetSmoothAng) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetSmoothAng", LuaSurfTmGetSmoothAng) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmOffset", LuaSurfTmOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmThickeningOffset", LuaSurfTmThickeningOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfBzPlane", LuaCutSurfBzPlane) ;
+44 -3
View File
@@ -73,6 +73,25 @@ LuaVolZmapSetShowEdges( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaVolZmapGetShowEdges( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// imposto flag visualizzazione spigoli vivi
bool bShow ;
bool bOk = ExeVolZmapGetShowEdges( nId, bShow) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, bShow) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaRemoveVolZmapPart( lua_State* L)
@@ -402,7 +421,7 @@ LuaUpdateVolZmapByAddingSurfTm( lua_State* L)
//-------------------------------------------------------------------------------
static int
LuaUniformVolZmap( lua_State* L)
LuaVolZmapMakeUniform( lua_State* L)
{
// 2 o 3 o 4 parametri : nVolZmapId, dToler [, bExtensionFirst] [, nToolNum]
int nVolZmapId ;
@@ -414,7 +433,7 @@ LuaUniformVolZmap( lua_State* L)
int nToolNum = 0 ;
LuaGetParam( L, 4, nToolNum) ;
LuaClearStack( L) ;
bool bOk = ExeUniformVolZmap( nVolZmapId, dToler, bExtensionFirst, nToolNum) ;
bool bOk = ExeVolZmapMakeUniform( nVolZmapId, dToler, bExtensionFirst, nToolNum) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
@@ -437,6 +456,26 @@ LuaVolZmapOffset( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaVolZmapRemoveFins( lua_State* L)
{
// 3 parametri : Id, vtDir, dThick
int nId ;
LuaCheckParam( L, 1, nId) ;
Vector3d vtDir ;
LuaCheckParam( L, 2, vtDir) ;
double dThick ;
LuaCheckParam( L, 3, dThick) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// Eseguo la rimozione delle alette
bool bOk = ExeVolZMapRemoveFins( nId, vtDir, dThick, nRefType) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbModifyVol( LuaMgr& luaMgr)
@@ -445,6 +484,7 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeVolume", LuaExplodeVolume) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapChangeResolution", LuaVolZmapChangeResolution) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetShowEdges", LuaVolZmapSetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetShowEdges", LuaVolZmapGetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveVolZmapPart", LuaRemoveVolZmapPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdvTool", LuaVolZmapSetAdvTool) ;
@@ -458,7 +498,8 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
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( "EgtVolZmapMakeUniform", LuaVolZmapMakeUniform) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapOffset", LuaVolZmapOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapRemoveFins", LuaVolZmapRemoveFins) ;
return bOk ;
}
+20
View File
@@ -563,6 +563,25 @@ LuaCopyGlobEx( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaDuplicateGeomDB( lua_State* L)
{
// 2 o 3 parametri : nSouCtx, nDestCtx [, bSkipTemp]
int nSouCtx ;
LuaCheckParam( L, 1, nSouCtx)
int nDestCtx ;
LuaCheckParam( L, 2, nDestCtx)
bool bSkipTemp = false ;
LuaGetParam( L, 3, bSkipTemp) ;
LuaClearStack( L) ;
// eseguo la copia
bool bOk = ExeDuplicateGeomDB( nSouCtx, nDestCtx, bSkipTemp) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRelocate( lua_State* L)
@@ -718,6 +737,7 @@ LuaInstallGdbObjects( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyEx", LuaCopyEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyGlob", LuaCopyGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyGlobEx", LuaCopyGlobEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuplicateGeomDB", LuaDuplicateGeomDB) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRelocate", LuaRelocate) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRelocateGlob", LuaRelocateGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGroupSwap", LuaGroupSwap) ;
+775 -121
View File
@@ -18,6 +18,7 @@
#include "LUA.h"
#include "GenTools.h"
#include "resource.h"
#include "AuxDialogBox.h"
#include "/EgtDev/Include/ExeExecutor.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
@@ -30,6 +31,7 @@
#include "/EgtDev/Include/EgtIniFile.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include <sstream>
#include <Windowsx.h>
#include <shlobj.h>
@@ -898,6 +900,21 @@ LuaEraseDirectory( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaEraseNonEmptyDirectory( lua_State* L)
{
// 1 parametro : sDir
string sDir ;
LuaCheckParam( L, 1, sDir)
LuaClearStack( L) ;
// cancello direttorio (deve essere vuoto)
bool bOk = EraseNonEmptyDirectory( sDir) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaTextFileCompare( lua_State* L)
@@ -1196,148 +1213,719 @@ LuaReleaseMutex( lua_State* L)
}
//-------------------------------------------------------------------------------
const int MAX_CTRLS = IDC_TEXT8 -IDC_TEXT1 + 1 ;
// =================================== DIALOG ===================================
// Variabili Globali
const int OFFS_CTRLS = 40 ;
enum TYPE_CTRLS { CTRL_NONE = 0, CTRL_CHECK = 1, CTRL_COMBO = 2, CTRL_EDIT = 3} ;
enum TYPE_CTRLS { CTRL_NONE = 0, CTRL_CHECK = 1, CTRL_COMBO = 2, CTRL_EDIT = 3, CTRL_COLOR = 4, CTRL_BUTTON = 5} ;
static COLORREF s_CustomColors[16] = {12632256} ; // 16 colori GRAY
static bool s_bCustomColorsInit = false ; // flag di inizializzazione colori
const char* SEC_SCENE = "Scene" ;
const char* KEY_CUSTOMCOLORS = "CustomColors" ;
// Dialogo Modale
const int MAX_CTRLS = IDC_TEXT8 - IDC_TEXT1 + 1 ;
static int s_nCtrls = 0 ;
static string s_sCaption ;
static string s_sText[MAX_CTRLS] ;
static string s_sEdit[MAX_CTRLS] ;
static int s_nType[MAX_CTRLS] ;
// Dialogo non modale
const int MAX_CTRLS_ML = IDC_TEXT_ML_8 - IDC_TEXT_ML_1 + 1 ;
static int s_nCtrls_ML = 0 ;
static string s_sCaption_ML ;
static string s_sText_ML[MAX_CTRLS_ML] ;
static string s_sEdit_ML[MAX_CTRLS_ML] ;
static int s_nType_ML[MAX_CTRLS_ML] ;
struct DialogContext {
lua_State* L ; // stato Lua per Click bottone OK
int nCallBackFun ; // indice di funzione CallBack
} ;
static string s_sIdSel_ML ;
//-------------------------------------------------------------------------------
BOOL
CALLBACK DialogBoxProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
CALLBACK DialogBoxProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
// variabili static locali per mantenere lo stato tra chiamate per selezione colori
static COLORREF selectedColor[MAX_CTRLS] = {0} ; // BLACK
static HBRUSH hColorBrush[MAX_CTRLS] = {NULL} ; // non definito
switch ( message) {
case WM_INITDIALOG :
{
// dati del dialogo
HWND hwndOwner = GetParent( hwndDlg) ;
if ( hwndOwner == nullptr)
hwndOwner = GetDesktopWindow() ;
RECT rcOwner, rcDlg ;
GetWindowRect( hwndOwner, &rcOwner) ;
GetWindowRect( hwndDlg, &rcDlg) ;
// determino la posizione dell'ultima riga di dati da visualizzare
HWND hwndLR = GetDlgItem( hwndDlg, IDC_TEXT1 + Clamp( s_nCtrls, 1, MAX_CTRLS) - 1) ;
RECT rcLR ;
GetWindowRect( hwndLR, &rcLR) ;
POINT ptLR{ rcLR.left, rcLR.top} ;
ScreenToClient( hwndDlg, &ptLR) ;
// centro e scalo il dialogo
int nNewH = rcLR.top - rcOwner.top + 2 * OFFS_CTRLS ; // non chiaro perchè va sottratto rcOwner.top ma funziona sempre
SetWindowPos( hwndDlg,
HWND_TOP,
( rcOwner.left + rcOwner.right - ( rcDlg.right - rcDlg.left)) / 2,
( rcOwner.top + rcOwner.bottom - nNewH) / 2,
( rcDlg.right - rcDlg.left),
nNewH,
0) ;
// riposiziono il bottone Ok
HWND hwndOk = GetDlgItem( hwndDlg, IDOK) ;
RECT rcOk ;
GetWindowRect( hwndOk, &rcOk) ;
POINT ptOk{ rcOk.left, rcOk.top} ;
ScreenToClient( hwndDlg, &ptOk) ;
SetWindowPos( hwndOk,
hwndDlg,
ptOk.x,
ptLR.y + OFFS_CTRLS,
0, 0,
SWP_NOSIZE | SWP_NOZORDER) ;
// riposiziono il bottone Cancel
HWND hwndCl = GetDlgItem( hwndDlg, IDCANCEL) ;
RECT rcCl ;
GetWindowRect( hwndCl, &rcCl) ;
POINT ptCl{ rcCl.left, rcCl.top} ;
ScreenToClient( hwndDlg, &ptCl) ;
SetWindowPos( hwndCl,
hwndDlg,
ptCl.x,
ptLR.y + OFFS_CTRLS,
0, 0,
SWP_NOSIZE | SWP_NOZORDER) ;
}
// assegno titolo del dialogo
SetWindowText( hwndDlg, stringtoW( s_sCaption)) ;
// assegno testi e valori di default e nascondo linee dei controlli non usati
for ( int i = 0 ; i < MAX_CTRLS ; ++ i) {
if ( i < s_nCtrls) {
SetDlgItemText( hwndDlg, IDC_TEXT1 + i, stringtoW( s_sText[i])) ;
if ( s_sEdit[i].find( "CK:") == 0) {
bool bChecked = false ;
FromString( s_sEdit[i].substr( 3), bChecked) ;
CheckDlgButton( hwndDlg, IDC_CHECK1 + i, ( bChecked ? BST_CHECKED : BST_UNCHECKED)) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO1 + i), SW_HIDE) ;
s_nType[i] = CTRL_CHECK ;
case WM_INITDIALOG :
{
// colore di default
COLORREF defaultColor = RGB( 255, 0, 0) ;
// inizializzazione colori e brush
for ( int i = 0 ; i < MAX_CTRLS ; ++ i) {
selectedColor[i] = defaultColor ;
if ( hColorBrush[i] != NULL)
DeleteObject( hColorBrush[i]) ;
hColorBrush[i] = CreateSolidBrush( selectedColor[i]) ;
}
else if ( s_sEdit[i].find( "CB:") == 0) {
string sList = s_sEdit[i].substr( 3) ;
STRVECTOR vsVal ;
Tokenize( sList, ",", vsVal) ;
int nSel = 0 ;
HWND hwndCBox = GetDlgItem( hwndDlg, IDC_COMBO1 + i) ;
for ( int j = 0 ; j < int( vsVal.size()) ; ++ j) {
string sItem ;
if ( vsVal[j][0] == '*') {
nSel = j ;
sItem = vsVal[j].substr( 1) ;
}
else
sItem = vsVal[j] ;
ComboBox_AddString( hwndCBox, stringtoW( sItem)) ;
// dati del dialogo
HWND hwndOwner = GetParent( hwndDlg) ;
if ( hwndOwner == nullptr)
hwndOwner = GetDesktopWindow() ;
RECT rcOwner, rcDlg ;
GetWindowRect( hwndOwner, &rcOwner) ;
GetWindowRect( hwndDlg, &rcDlg) ;
// determino la posizione dell'ultima riga di dati da visualizzare
HWND hwndLR = GetDlgItem( hwndDlg, IDC_TEXT1 + Clamp( s_nCtrls, 1, MAX_CTRLS) - 1) ;
RECT rcLR ;
GetWindowRect( hwndLR, &rcLR) ;
POINT ptLR{ rcLR.left, rcLR.top} ;
ScreenToClient( hwndDlg, &ptLR) ;
// centro e scalo il dialogo
int nNewH = rcLR.top - rcOwner.top + 2 * OFFS_CTRLS ; // non chiaro perchè va sottratto rcOwner.top ma funziona sempre
SetWindowPos( hwndDlg,
HWND_TOP,
( rcOwner.left + rcOwner.right - ( rcDlg.right - rcDlg.left)) / 2,
( rcOwner.top + rcOwner.bottom - nNewH) / 2,
( rcDlg.right - rcDlg.left),
nNewH,
0) ;
// riposiziono il bottone Ok
HWND hwndOk = GetDlgItem( hwndDlg, IDOK) ;
RECT rcOk ;
GetWindowRect( hwndOk, &rcOk) ;
POINT ptOk{ rcOk.left, rcOk.top} ;
ScreenToClient( hwndDlg, &ptOk) ;
SetWindowPos( hwndOk,
hwndDlg,
ptOk.x,
ptLR.y + OFFS_CTRLS,
0, 0,
SWP_NOSIZE | SWP_NOZORDER) ;
// riposiziono il bottone Cancel
HWND hwndCl = GetDlgItem( hwndDlg, IDCANCEL) ;
RECT rcCl ;
GetWindowRect( hwndCl, &rcCl) ;
POINT ptCl{ rcCl.left, rcCl.top} ;
ScreenToClient( hwndDlg, &ptCl) ;
SetWindowPos( hwndCl,
hwndDlg,
ptCl.x,
ptLR.y + OFFS_CTRLS,
0, 0,
SWP_NOSIZE | SWP_NOZORDER) ;
}
// assegno titolo del dialogo
SetWindowText( hwndDlg, stringtoW( s_sCaption)) ;
// assegno testi e valori di default e nascondo linee dei controlli non usati
for ( int i = 0 ; i < MAX_CTRLS ; ++ i) {
if ( i < s_nCtrls) {
SetDlgItemText( hwndDlg, IDC_TEXT1 + i, stringtoW( s_sText[i])) ;
if ( s_sEdit[i].find( "CK:") == 0) {
bool bChecked = false ;
FromString( s_sEdit[i].substr( 3), bChecked) ;
CheckDlgButton( hwndDlg, IDC_CHECK1 + i, ( bChecked ? BST_CHECKED : BST_UNCHECKED)) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO1 + i), SW_HIDE) ;
s_nType[i] = CTRL_CHECK ;
}
else if ( s_sEdit[i].find( "CB:") == 0) {
string sList = s_sEdit[i].substr( 3) ;
STRVECTOR vsVal ;
Tokenize( sList, ",", vsVal) ;
int nSel = 0 ;
HWND hwndCBox = GetDlgItem( hwndDlg, IDC_COMBO1 + i) ;
for ( int j = 0 ; j < int( vsVal.size()) ; ++ j) {
string sItem ;
if ( vsVal[j][0] == '*') {
nSel = j ;
sItem = vsVal[j].substr( 1) ;
}
else
sItem = vsVal[j] ;
ComboBox_AddString( hwndCBox, stringtoW( sItem)) ;
}
ComboBox_SetCurSel( hwndCBox, nSel) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK1 + i), SW_HIDE) ;
s_nType[i] = CTRL_COMBO ;
}
else if ( s_sEdit[i].find( "CP:") == 0) {
string sVal = s_sEdit[i].substr( 3) ;
Color CColor ;
if ( ! FromString( sVal, CColor))
CColor = INVISIBLE ;
selectedColor[i] = RGB( CColor.GetIntRed(), CColor.GetIntGreen(), CColor.GetIntBlue()) ;
if ( hColorBrush[i] != NULL)
DeleteObject( hColorBrush[i]) ;
hColorBrush[i] = CreateSolidBrush( selectedColor[i]) ;
// recupero i valori dei colori personalizzati dal file .ini
if ( ! s_bCustomColorsInit) {
// recupero il file Ini
string sIniFile = ExeGetIniFile() ;
if ( ! sIniFile.empty()) {
string sCustomVals = GetPrivateProfileStringUtf8( SEC_SCENE, KEY_CUSTOMCOLORS, "", sIniFile.c_str()) ;
STRVECTOR vsWinColors ; Tokenize( sCustomVals, ",", vsWinColors) ;
for ( int j = 0 ; j < ssize( vsWinColors) && j < 16 ; ++ j) {
unsigned int unVal ;
if ( FromString( vsWinColors[j], unVal)) {
unsigned int unR = unVal & 0xFF ;
unsigned int unG = ( unVal >> 8) & 0xFF ;
unsigned int unB = ( unVal >> 16) & 0xFF ;
s_CustomColors[j] = RGB( unR, unG, unB) ;
}
}
}
s_bCustomColorsInit = true ;
}
// nascondo qualsiasi tipo di componente ( per sicurezza)
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK1 + i), SW_HIDE) ;
// margini per dimensione del rettangolo preview pickColor
const int MARGIN_RIGHT = 8 ; // spazio tra preview e bordo destro dialog
const int PREVIEW_HEIGHT = 20 ; // altezza del rettangolo
const int PREVIEW_MIN_WIDTH = 40 ; // larghezza minima
// ottieni o crea la static preview (allargata fino al bordo destro del dialog)
HWND hwndPreview = NULL ;
RECT rcLabel ;
HWND hwndLabel = GetDlgItem( hwndDlg, IDC_TEXT1 + i) ;
RECT rcClient ; GetClientRect( hwndDlg, &rcClient) ; // coordinate client del dialog
if ( hwndLabel && GetWindowRect( hwndLabel, &rcLabel)) {
// converti rcLabel in coordinate client
POINT ptLabel = { rcLabel.right, rcLabel.top } ;
ScreenToClient( hwndDlg, &ptLabel) ;
int x = ptLabel.x + 8 ; // distanza dal label
int y = ptLabel.y ;
int width = rcClient.right - x - MARGIN_RIGHT ;
if ( width < PREVIEW_MIN_WIDTH)
width = PREVIEW_MIN_WIDTH ;
hwndPreview = CreateWindowEx( 0, L"STATIC", NULL,
WS_CHILD | WS_VISIBLE | SS_NOTIFY | SS_CENTERIMAGE | WS_BORDER,
x, y, width, PREVIEW_HEIGHT,
hwndDlg, ( HMENU)( IDC_COLOR1 + i),
GetModuleHandle( NULL), NULL) ;
}
// pulizia elementi testuali
if ( hwndPreview) {
SetWindowText( hwndPreview, L"") ;
SetWindowPos( hwndPreview, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) ;
InvalidateRect( hwndPreview, NULL, TRUE) ;
UpdateWindow( hwndPreview) ;
}
s_nType[i] = CTRL_COLOR ;
}
else {
SetDlgItemText( hwndDlg, IDC_EDIT1 + i, stringtoW( s_sEdit[i])) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK1 + i), SW_HIDE) ;
s_nType[i] = CTRL_EDIT ;
}
ComboBox_SetCurSel( hwndCBox, nSel) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK1 + i), SW_HIDE) ;
s_nType[i] = CTRL_COMBO ;
}
else {
SetDlgItemText( hwndDlg, IDC_EDIT1 + i, stringtoW( s_sEdit[i])) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_TEXT1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK1 + i), SW_HIDE) ;
s_nType[i] = CTRL_EDIT ;
s_nType[i] = CTRL_NONE ;
}
}
else {
ShowWindow( GetDlgItem( hwndDlg, IDC_TEXT1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK1 + i), SW_HIDE) ;
s_nType[i] = CTRL_NONE ;
break ;
case WM_CTLCOLORSTATIC :
{
HDC hdcStatic = ( HDC)wParam ;
HWND hwndCtrl = ( HWND)lParam ;
int ctrlId = GetDlgCtrlID( hwndCtrl) ;
if ( ctrlId >= IDC_COLOR1 && ctrlId <= IDC_COLOR8) {
int idx = ctrlId - IDC_COLOR1 ;
if ( hColorBrush[idx] == NULL)
hColorBrush[idx] = CreateSolidBrush( selectedColor[idx]) ;
SetBkMode( hdcStatic, OPAQUE) ;
SetBkColor( hdcStatic, selectedColor[idx]) ;
return ( INT_PTR)hColorBrush[idx] ;
}
}
break ;
case WM_COMMAND : {
int id = LOWORD( wParam) ;
int code = HIWORD( wParam) ;
// comando di Preview per brush di colori mediante click del mouse
if ( code == STN_CLICKED && id >= IDC_COLOR1 && id <= IDC_COLOR8) {
int idx = id - IDC_COLOR1 ;
HWND hwndPreview = GetDlgItem( hwndDlg, IDC_COLOR1 + idx) ;
if ( ! hwndPreview)
return TRUE ;
// apertura ChooseColor (usa hwndDlg come owner)
CHOOSECOLOR cc = {} ;
cc.lStructSize = sizeof( cc) ;
cc.hwndOwner = hwndDlg ;
cc.lpCustColors = s_CustomColors ;
cc.rgbResult = selectedColor[idx] ;
cc.Flags = CC_FULLOPEN | CC_RGBINIT ;
if ( ChooseColor( &cc)) {
selectedColor[idx] = cc.rgbResult ;
// salvo nel file Ini i nuovi colori personalizzati
string sIniFile = ExeGetIniFile() ;
if ( ! sIniFile.empty()) {
string sOut = "" ;
for ( int j = 0 ; j < ssize( s_CustomColors) && j < 16 ; ++ j)
sOut += ToString( ( unsigned int)s_CustomColors[j]) + "," ;
sOut.pop_back() ;
WritePrivateProfileStringUtf8( SEC_SCENE, KEY_CUSTOMCOLORS, sOut.c_str(), sIniFile.c_str()) ;
}
if ( hColorBrush[idx] != NULL)
DeleteObject( hColorBrush[idx]) ;
hColorBrush[idx] = CreateSolidBrush( selectedColor[idx]) ;
InvalidateRect(hwndPreview, NULL, TRUE) ;
UpdateWindow( hwndPreview) ;
}
return TRUE ;
}
switch ( LOWORD( wParam)) {
case IDOK :
for ( int i = 0 ; i < s_nCtrls ; ++ i) {
AtoWEX<128> wsEdit( "") ;
s_sEdit[i] = "" ;
switch ( s_nType[i]) {
case CTRL_CHECK :
s_sEdit[i] = ( IsDlgButtonChecked( hwndDlg, IDC_CHECK1 + i) == BST_CHECKED ? "1" : "0") ;
break ;
case CTRL_COMBO :
if ( GetDlgItemText( hwndDlg, IDC_COMBO1 + i, LPWSTR( wsEdit), 128) > 0)
s_sEdit[i] = wstrztoA( wsEdit) ;
break ;
case CTRL_EDIT :
if ( GetDlgItemText( hwndDlg, IDC_EDIT1 + i, LPWSTR( wsEdit), 128) > 0)
s_sEdit[i] = wstrztoA( wsEdit) ;
break ;
case CTRL_COLOR :
{
COLORREF col = selectedColor[i] ;
BYTE r = GetRValue( col), g = GetGValue( col), b = GetBValue( col) ;
char buf[16] ;
sprintf_s( buf, sizeof( buf), "%u,%u,%u", r, g, b) ;
s_sEdit[i] = buf ;
break ;
}
}
}
[[fallthrough]] ;
case IDCANCEL : {
// pulizia brush colori
for ( int i = 0 ; i < MAX_CTRLS ; ++ i) {
if ( hColorBrush[i] != NULL) {
DeleteObject( hColorBrush[i]) ;
hColorBrush[i] = NULL ;
}
}
EndDialog( hwndDlg, wParam) ;
return TRUE ;
}
}
}
}
return FALSE ;
}
//-------------------------------------------------------------------------------
BOOL
CALLBACK DialogBoxModelessProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
// variabili static locali per mantenere lo stato tra chiamate per selezione colori
static COLORREF selectedColor[MAX_CTRLS_ML] = {0} ; // BLACK
static HBRUSH hColorBrush[MAX_CTRLS_ML] = {NULL} ; // non definito
switch ( message) {
case WM_INITDIALOG :
{
// imposto il contesto per recuperalo in futuro ( per la funzione di CallBack Lua)
SetWindowLongPtr( hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam) ;
// colore di default
COLORREF defaultColor = RGB( 255, 0, 0) ;
// inizializzazione colori e brush
for ( int i = 0 ; i < MAX_CTRLS_ML ; ++ i) {
selectedColor[i] = defaultColor ;
if ( hColorBrush[i] != NULL)
DeleteObject( hColorBrush[i]) ;
hColorBrush[i] = CreateSolidBrush( selectedColor[i]) ;
}
// dati del dialogo
HWND hwndOwner = GetParent( hwndDlg) ;
if ( hwndOwner == nullptr)
hwndOwner = GetDesktopWindow() ;
RECT rcOwner, rcDlg ;
GetWindowRect( hwndOwner, &rcOwner) ;
GetWindowRect( hwndDlg, &rcDlg) ;
// determino la posizione dell'ultima riga di dati da visualizzare
HWND hwndLR = GetDlgItem( hwndDlg, IDC_TEXT_ML_1 + Clamp( s_nCtrls_ML, 1, MAX_CTRLS_ML) - 1) ;
RECT rcLR ;
GetWindowRect( hwndLR, &rcLR) ;
POINT ptLR{ rcLR.left, rcLR.top} ;
ScreenToClient( hwndDlg, &ptLR) ;
// centro e scalo il dialogo
int nNewH = rcLR.top - rcOwner.top + 2 * OFFS_CTRLS ; // non chiaro perchè va sottratto rcOwner.top ma funziona sempre
SetWindowPos( hwndDlg, HWND_TOP,
( rcOwner.left + rcOwner.right - ( rcDlg.right - rcDlg.left)) / 2,
( rcOwner.top + rcOwner.bottom - nNewH) / 2,
( rcDlg.right - rcDlg.left),
nNewH, 0) ;
// riposiziono il bottone Ok
HWND hwndOk = GetDlgItem( hwndDlg, IDOK_ML) ;
RECT rcOk ;
GetWindowRect( hwndOk, &rcOk) ;
POINT ptOk{ rcOk.left, rcOk.top} ;
ScreenToClient( hwndDlg, &ptOk) ;
SetWindowPos( hwndOk, hwndDlg, ptOk.x, ptLR.y + OFFS_CTRLS, 0, 0, SWP_NOSIZE | SWP_NOZORDER) ;
// riposiziono il bottone Cancel
HWND hwndCl = GetDlgItem( hwndDlg, IDCANCEL_ML) ;
RECT rcCl ;
GetWindowRect( hwndCl, &rcCl) ;
POINT ptCl{ rcCl.left, rcCl.top} ;
ScreenToClient( hwndDlg, &ptCl) ;
SetWindowPos( hwndCl, hwndDlg, ptCl.x, ptLR.y + OFFS_CTRLS, 0, 0, SWP_NOSIZE | SWP_NOZORDER) ;
// stile finestra
LONG style = GetWindowLong( hwndDlg, GWL_STYLE) ;
style |= WS_SYSMENU ;
SetWindowLong( hwndDlg, GWL_STYLE, style) ;
}
// assegno titolo del dialogo
SetWindowText( hwndDlg, stringtoW( s_sCaption_ML)) ;
// assegno testi e valori di default e nascondo linee dei controlli non usati
for ( int i = 0 ; i < MAX_CTRLS_ML ; ++ i) {
if ( i < s_nCtrls_ML) {
// imposto il testo nella riga corrente
SetDlgItemText( hwndDlg, IDC_TEXT_ML_1 + i, stringtoW( s_sText_ML[i])) ;
// --- se CheckBox
if ( s_sEdit_ML[i].find( "CK:") == 0) {
bool bChecked = false ;
FromString( s_sEdit_ML[i].substr( 3), bChecked) ;
CheckDlgButton( hwndDlg, IDC_CHECK_ML_1 + i, ( bChecked ? BST_CHECKED : BST_UNCHECKED)) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT_ML_1 + i), SW_HIDE) ; // nascondo Edit
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO_ML_1 + i), SW_HIDE) ; // nascondo Combo
ShowWindow( GetDlgItem( hwndDlg, IDC_BUTTON_ML_1 + i), SW_HIDE) ; // nascondo Button di selezione
s_nType_ML[i] = CTRL_CHECK ;
}
// --- se ComboBox
else if ( s_sEdit_ML[i].find( "CB:") == 0) {
string sList = s_sEdit_ML[i].substr( 3) ;
STRVECTOR vsVal ;
Tokenize( sList, ",", vsVal) ;
int nSel = 0 ;
HWND hwndCBox = GetDlgItem( hwndDlg, IDC_COMBO_ML_1 + i) ;
for ( int j = 0 ; j < ssize( vsVal) ; ++ j) {
string sItem ;
if ( vsVal[j][0] == '*') {
nSel = j ;
sItem = vsVal[j].substr( 1) ;
}
else
sItem = vsVal[j] ;
ComboBox_AddString( hwndCBox, stringtoW( sItem)) ;
}
ComboBox_SetCurSel( hwndCBox, nSel) ;
int nEditHeight = int( SendMessage( hwndCBox, CB_GETITEMHEIGHT, (WPARAM)-1, 0)) ;
int nItemHeight = int( SendMessage( hwndCBox, CB_GETITEMHEIGHT, 0, 0)) ;
int nTotalHeight = nEditHeight + nItemHeight * ( ssize( vsVal) + 1) ;
RECT rc ; GetWindowRect( hwndCBox, &rc) ;
HWND parent = GetParent(hwndCBox) ; MapWindowPoints( NULL, parent, (LPPOINT)&rc, 2) ;
SetWindowPos( hwndCBox, NULL, rc.left, rc.top, rc.right - rc.left, nTotalHeight, SWP_NOZORDER) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT_ML_1 + i), SW_HIDE) ; // nascondo Edit
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK_ML_1 + i), SW_HIDE) ; // nascondo CheckBox
ShowWindow( GetDlgItem( hwndDlg, IDC_BUTTON_ML_1 + i), SW_HIDE) ; // nascondo Button di selezione
s_nType_ML[i] = CTRL_COMBO ;
}
// --- se ColorPicker
else if ( s_sEdit_ML[i].find( "CP:") == 0) {
string sVal = s_sEdit_ML[i].substr( 3) ;
Color CColor ;
if ( ! FromString( sVal, CColor))
CColor = INVISIBLE ;
selectedColor[i] = RGB( CColor.GetIntRed(), CColor.GetIntGreen(), CColor.GetIntBlue()) ;
if ( hColorBrush[i] != NULL)
DeleteObject( hColorBrush[i]) ;
hColorBrush[i] = CreateSolidBrush( selectedColor[i]) ;
// recupero i valori dei colori personalizzati dal file .ini
if ( ! s_bCustomColorsInit) {
// recupero il file Ini
string sIniFile = ExeGetIniFile() ;
if ( ! sIniFile.empty()) {
string sCustomVals = GetPrivateProfileStringUtf8( SEC_SCENE, KEY_CUSTOMCOLORS, "", sIniFile.c_str()) ;
STRVECTOR vsWinColors ; Tokenize( sCustomVals, ",", vsWinColors) ;
for ( int j = 0 ; j < ssize( vsWinColors) && j < 16 ; ++ j) {
unsigned int unVal ;
if ( FromString( vsWinColors[j], unVal)) {
unsigned int unR = unVal & 0xFF ;
unsigned int unG = ( unVal >> 8) & 0xFF ;
unsigned int unB = ( unVal >> 16) & 0xFF ;
s_CustomColors[j] = RGB( unR, unG, unB) ;
}
}
}
s_bCustomColorsInit = true ;
}
// nascondo qualsiasi tipo di componente
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT_ML_1 + i), SW_HIDE) ; // nascondo Edit
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO_ML_1 + i), SW_HIDE) ; // nascondo Combo
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK_ML_1 + i), SW_HIDE) ; // nascondo Check
ShowWindow( GetDlgItem( hwndDlg, IDC_BUTTON_ML_1 + i), SW_HIDE) ; // nascondo Button di selezione
// margini per dimensione del rettangolo preview pickColor
const int MARGIN_RIGHT = 8 ; // spazio tra preview e bordo destro dialog
const int PREVIEW_HEIGHT = 20 ; // altezza del rettangolo
const int PREVIEW_MIN_WIDTH = 40 ; // larghezza minima
// creazione della static preview
HWND hwndPreview = NULL ;
HWND hwndEdit = GetDlgItem( hwndDlg, IDC_EDIT_ML_1 + i) ;
RECT rcEdit ; GetClientRect( hwndDlg, &rcEdit) ; // coordinate client del dialog
if ( hwndEdit != nullptr && GetWindowRect( hwndEdit, &rcEdit)) {
// converti rcLabel in coordinate client
POINT ptEdit = { rcEdit.left, rcEdit.top } ;
ScreenToClient( hwndDlg, &ptEdit) ;
int x = ptEdit.x ;
int y = ptEdit.y ;
int width = rcEdit.right - rcEdit.left ;
if ( width < PREVIEW_MIN_WIDTH)
width = PREVIEW_MIN_WIDTH ;
hwndPreview = CreateWindowEx( 0, L"STATIC", NULL,
WS_CHILD | WS_VISIBLE | SS_NOTIFY | SS_CENTERIMAGE | WS_BORDER,
x, y, width, PREVIEW_HEIGHT,
hwndDlg, ( HMENU)( IDC_COLOR1 + i),
GetModuleHandle( NULL), NULL) ;
}
// pulizia elementi testuali
if ( hwndPreview) {
SetWindowText( hwndPreview, L"") ;
SetWindowPos( hwndPreview, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) ;
InvalidateRect( hwndPreview, NULL, TRUE) ;
UpdateWindow( hwndPreview) ;
}
s_nType_ML[i] = CTRL_COLOR ;
}
// --- se Button di selezione
else if ( s_sEdit_ML[i].find( "BT:") == 0) {
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO_ML_1 + i), SW_HIDE) ; // nascondo la Combo
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK_ML_1 + i), SW_HIDE) ; // nascondo la Check
SetDlgItemText( hwndDlg, IDC_BUTTON_ML_1 + i, stringtoW( string{ "N"})) ; // modalità non Selezione
// associo alla casella di testo la funzione di KeyPress su Enter
HWND hEdit = GetDlgItem( hwndDlg, IDC_EDIT_ML_1 + i) ;
if ( hEdit != nullptr)
SetWindowSubclass( hEdit, UpdateSelectionModelessDialog, 1, (DWORD_PTR)( IDC_EDIT_ML_1 + i)) ;
s_nType_ML[i] = CTRL_BUTTON ;
}
// --- se Testo
else {
SetDlgItemText( hwndDlg, IDC_EDIT_ML_1 + i, stringtoW( s_sEdit_ML[i])) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO_ML_1 + i), SW_HIDE) ; // nascondo Combo
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK_ML_1 + i), SW_HIDE) ; // nascondo Check
ShowWindow( GetDlgItem( hwndDlg, IDC_BUTTON_ML_1 + i), SW_HIDE) ; // nascondo Button di selezione
s_nType_ML[i] = CTRL_EDIT ;
}
}
// se numero di controllo superiore al massimo, non visualizzo nullo ( in questo caso aggiungere elementi a Dialog in .rc)
else {
// nascondo tutto
ShowWindow( GetDlgItem( hwndDlg, IDC_TEXT_ML_1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT_ML_1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO_ML_1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK_ML_1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_BUTTON_ML_1 + i), SW_HIDE) ;
s_nType[i] = CTRL_NONE ;
}
}
break ;
case WM_CTLCOLORSTATIC :
{
HDC hdcStatic = ( HDC)wParam ;
HWND hwndCtrl = ( HWND)lParam ;
int ctrlId = GetDlgCtrlID( hwndCtrl) ;
if ( ctrlId >= IDC_COLOR1 && ctrlId <= IDC_COLOR8) {
int idx = ctrlId - IDC_COLOR1 ;
if ( hColorBrush[idx] == NULL)
hColorBrush[idx] = CreateSolidBrush( selectedColor[idx]) ;
SetBkMode( hdcStatic, OPAQUE) ;
SetBkColor( hdcStatic, selectedColor[idx]) ;
return ( INT_PTR)hColorBrush[idx] ;
}
}
break ;
case WM_COMMAND : {
int id = LOWORD( wParam) ;
int code = HIWORD( wParam) ;
// --- se click di un Button di selezione
if ( id >= IDC_BUTTON_ML_1 && id < IDC_BUTTON_ML_1 + MAX_CTRLS_ML) {
int nBtnId = id ;
int nEditId = IDC_EDIT_ML_1 + ( id - IDC_BUTTON_ML_1) ;
// se il bottone premuto è lo stesso, allora termina le selezione degli Ids
if ( nDlgModelessItem == nEditId) {
SetDlgItemText( hwndDlg, nBtnId, stringtoW( string{ "N"})) ;
nDlgModelessItem = -1 ;
}
// se nuovo buttone premuto
else {
// se esisteva una selezione precedente, questa viene annullata
if ( nDlgModelessItem != -1) {
// recupero il Button di selezione precedente e modifico il suo testo
int nPrevBtnId = IDC_BUTTON_ML_1 + ( nDlgModelessItem - IDC_EDIT_ML_1) ;
SetDlgItemText( hwndDlg, nPrevBtnId, stringtoW( string{ "N"})) ;
}
// la selezione passa al comando corrente
nDlgModelessItem = nEditId ;
SetDlgItemText( hwndDlg, nBtnId, stringtoW( string{ "S"})) ;
}
// per semplicità, deseleziono tutto
ExeDeselectAll() ;
ExeDraw() ;
}
// --- se comando di Preview per brush di colori mediante click del mouse
else if ( code == STN_CLICKED && id >= IDC_COLOR1 && id <= IDC_COLOR8) {
int idx = id - IDC_COLOR1 ;
HWND hwndPreview = GetDlgItem( hwndDlg, IDC_COLOR1 + idx) ;
if ( ! hwndPreview)
return TRUE ;
// apertura ChooseColor (usa hwndDlg come owner)
CHOOSECOLOR cc = {} ;
cc.lStructSize = sizeof( cc) ;
cc.hwndOwner = hwndDlg ;
cc.lpCustColors = s_CustomColors ;
cc.rgbResult = selectedColor[idx] ;
cc.Flags = CC_FULLOPEN | CC_RGBINIT ;
if ( ChooseColor( &cc)) {
selectedColor[idx] = cc.rgbResult ;
// salvo nel file Ini i nuovi colori personalizzati
string sIniFile = ExeGetIniFile() ;
if ( ! sIniFile.empty()) {
string sOut = "" ;
for ( int j = 0 ; j < ssize( s_CustomColors) && j < 16 ; ++ j)
sOut += ToString( ( unsigned int)s_CustomColors[j]) + "," ;
sOut.pop_back() ;
WritePrivateProfileStringUtf8( SEC_SCENE, KEY_CUSTOMCOLORS, sOut.c_str(), sIniFile.c_str()) ;
}
if ( hColorBrush[idx] != NULL)
DeleteObject( hColorBrush[idx]) ;
hColorBrush[idx] = CreateSolidBrush( selectedColor[idx]) ;
InvalidateRect(hwndPreview, NULL, TRUE) ;
UpdateWindow( hwndPreview) ;
}
return TRUE ;
}
switch ( LOWORD( wParam)) {
case IDOK_ML : {
// recupero il contesto impostato alla creazione della finestra ( durante esecuzione WM_INITDIALOG)
DialogContext* ctx = (DialogContext*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA) ;
if ( ctx != nullptr && ctx->nCallBackFun != LUA_NOREF) {
// recupero la CallBack
lua_rawgeti( ctx->L, LUA_REGISTRYINDEX, ctx->nCallBackFun) ;
// definisco una tabella per tutti i valori Lua da restituire
lua_newtable( ctx->L) ;
// recupero i valori degli Item
for ( int i = 0 ; i < s_nCtrls_ML ; ++ i) {
AtoWEX<128> wsEdit( "") ;
s_sEdit_ML[i] = "" ;
switch ( s_nType_ML[i]) {
case CTRL_CHECK :
s_sEdit_ML[i] = ( IsDlgButtonChecked( hwndDlg, IDC_CHECK_ML_1 + i) == BST_CHECKED ? "1" : "0") ;
break ;
case CTRL_COMBO :
if ( GetDlgItemText( hwndDlg, IDC_COMBO_ML_1 + i, LPWSTR( wsEdit), 128) > 0)
s_sEdit_ML[i] = wstrztoA( wsEdit) ;
break ;
case CTRL_EDIT :
if ( GetDlgItemText( hwndDlg, IDC_EDIT_ML_1 + i, LPWSTR( wsEdit), 128) > 0)
s_sEdit_ML[i] = wstrztoA( wsEdit) ;
break ;
case CTRL_COLOR :
{
COLORREF col = selectedColor[i] ;
BYTE r = GetRValue( col), g = GetGValue( col), b = GetBValue( col) ;
char buf[16] ;
sprintf_s( buf, sizeof( buf), "%u,%u,%u", r, g, b) ;
s_sEdit_ML[i] = buf ;
}
break ;
case CTRL_BUTTON :
if ( GetDlgItemText( hwndDlg, IDC_EDIT_ML_1 + i, LPWSTR( wsEdit), 128) > 0)
s_sEdit_ML[i] = wstrztoA( wsEdit) ;
break ;
}
}
// Ogni valore letto viene inserito all'interno della Table creata in precedenza e passata alla CallBack di lua
int nIndex = 1 ;
for ( const string& sVal : s_sEdit_ML) {
lua_pushstring( ctx->L, sVal.c_str()) ;
lua_rawseti( ctx->L, -2, nIndex ++) ;
}
// chiamo la CallBack
lua_pcall( ctx->L, 1, 0, 0) ;
// libero la memoria
luaL_unref( ctx->L, LUA_REGISTRYINDEX, ctx->nCallBackFun) ;
delete ctx ;
ctx = nullptr ;
}
// rimuovo finestra e annullo il contesto
DestroyWindow( hwndDlg) ;
phDlgModeless = nullptr ;
nDlgModelessItem = -1 ;
return TRUE ;
}
[[fallthrough]] ;
case IDCANCEL_ML : {
// pulizia brush colori
for ( int i = 0 ; i < MAX_CTRLS_ML ; ++ i) {
if ( hColorBrush[i] != NULL) {
DeleteObject( hColorBrush[i]) ;
hColorBrush[i] = NULL ;
}
}
// recupero il contesto impostato alla creazione della finestra ( durante esecuzione WM_INITDIALOG) e se esiste lo rimuovo
DialogContext* ctx = (DialogContext*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA) ;
if ( ctx != nullptr && ctx->nCallBackFun != LUA_NOREF) {
luaL_unref( ctx->L, LUA_REGISTRYINDEX, ctx->nCallBackFun) ;
delete ctx ;
ctx = nullptr ;
}
// rimuovo finestra e annullo il contesto
DestroyWindow( hwndDlg) ;
phDlgModeless = nullptr ;
nDlgModelessItem = -1 ;
return TRUE ;
}
}
}
break ;
case WM_COMMAND :
switch ( LOWORD( wParam)) {
case IDOK :
for ( int i = 0 ; i < s_nCtrls ; ++ i) {
AtoWEX<128> wsEdit( "") ;
s_sEdit[i] = "" ;
switch ( s_nType[i]) {
case CTRL_CHECK :
s_sEdit[i] = ( IsDlgButtonChecked( hwndDlg, IDC_CHECK1 + i) == BST_CHECKED ? "1" : "0") ;
break ;
case CTRL_COMBO :
if ( GetDlgItemText( hwndDlg, IDC_COMBO1 + i, LPWSTR( wsEdit), 128) > 0)
s_sEdit[i] = wstrztoA( wsEdit) ;
break ;
case CTRL_EDIT :
if ( GetDlgItemText( hwndDlg, IDC_EDIT1 + i, LPWSTR( wsEdit), 128) > 0)
s_sEdit[i] = wstrztoA( wsEdit) ;
break ;
}
case WM_CLOSE : {
// recupero il contesto impostato alla creazione della finestra ( durante esecuzione WM_INITDIALOG) e se esiste lo rimuovo
DialogContext* ctx = (DialogContext*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA) ;
if ( ctx != nullptr && ctx->nCallBackFun != LUA_NOREF) {
luaL_unref( ctx->L, LUA_REGISTRYINDEX, ctx->nCallBackFun) ;
delete ctx ;
ctx = nullptr ;
}
[[fallthrough]] ;
case IDCANCEL :
EndDialog( hwndDlg, wParam) ;
return TRUE ;
}
}
return FALSE ;
}
// rimuovo finestra e annullo il contesto
DestroyWindow( hwndDlg) ;
phDlgModeless = nullptr ;
nDlgModelessItem = -1 ;
return TRUE ;
}
}
return FALSE ;
}
//-------------------------------------------------------------------------------
static int
@@ -1378,6 +1966,71 @@ LuaDialogBox( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaDialogBoxModeless( lua_State* L)
{
// 1 .. 9 parametri : sCaption, { sText, sDefault}, ...
LuaCheckParam( L, 1, s_sCaption_ML)
s_nCtrls_ML = 0 ;
for ( int i = 0 ; i < MAX_CTRLS_ML ; ++ i) {
STRVECTOR vData ;
if ( LuaGetParam( L, 2 + i, vData) && ssize( vData) >= 2) {
s_sText_ML[i] = Trim( vData[0]) ;
s_sEdit_ML[i] = Trim( vData[1]) ;
++ s_nCtrls_ML ;
}
else
break ;
}
// se abilitata UI, lancio dialogo
if ( ExeGetEnableUI()) {
// se dialogo già presente, errore ( per ora una sola finestra non modale per volta)
if ( phDlgModeless != nullptr) {
LuaSetParam( L, false) ;
return 1 ;
}
// definisco il contesto per il dialogo
DialogContext* ctx = new DialogContext() ;
if ( ctx != nullptr) {
// recupero la funzione di CallBack per restituire i valori presenti nella DialogBoxModeless
// questa funzione deve essere l'ultimo parametro
int nCallBackRef = LUA_NOREF ;
int nLastPar = lua_gettop( L) ;
if ( lua_isfunction( L, nLastPar)) {
lua_pushvalue( L, nLastPar) ; // copio la funzione
ctx->nCallBackFun = luaL_ref( L, LUA_REGISTRYINDEX) ; // salvo nel registro
ctx->L = L ; // salvo lo State Lua
// lancio dialogo
HWND hTopWnd = ExeGetMainWindowHandle() ;
nDlgModelessItem = -1 ;
phDlgModeless = ( CreateDialogParam( GetModuleIstance(), MAKEINTRESOURCE( IDD_LUADLG_ML), hTopWnd,
(DLGPROC)DialogBoxModelessProc, (LPARAM)ctx)) ;
if ( phDlgModeless != nullptr) {
// se dialogo creato, porto la finestra in primo piano
ShowWindow( phDlgModeless, SW_SHOW) ;
SetForegroundWindow( phDlgModeless) ;
}
else {
delete ctx ;
LuaSetParam( L) ;
}
}
else {
delete ctx ;
LuaSetParam( L) ;
}
}
else
LuaSetParam( L) ;
}
else
LuaSetParam( L) ;
LuaClearStack( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGeneral( LuaMgr& luaMgr)
@@ -1419,6 +2072,7 @@ LuaInstallGeneral( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateDirectory", LuaCreateDirectory) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtEmptyDirectory", LuaEmptyDirectory) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseDirectory", LuaEraseDirectory) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseNonEmptyDirectory", LuaEraseNonEmptyDirectory) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTextFileCompare", LuaTextFileCompare) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBinaryFileCompare", LuaBinaryFileCompare) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetStringFromIni", LuaGetStringFromIni) ;
@@ -1438,6 +2092,6 @@ LuaInstallGeneral( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateMutex", LuaCreateMutex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtReleaseMutex", LuaReleaseMutex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBoxModeless", LuaDialogBoxModeless) ;
return bOk ;
}
+25 -2
View File
@@ -354,18 +354,20 @@ LuaPlaneVolZmapInters( lua_State* L)
static int
LuaCurveCurveInters( lua_State* L)
{
// 3 parametri : nId1, nId2, nDestGrpId
// 3 o 4 parametri : nId1, nId2, nDestGrpId [, bOnly3D]
int nId1 ;
LuaCheckParam( L, 1, nId1)
int nId2 ;
LuaCheckParam( L, 2, nId2)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId) ;
bool bOnly3D = false ;
LuaGetParam( L, 4, bOnly3D) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nNewId = ExeCurveCurveInters( nId1, nId2, nDestGrpId, &nPntCount, &nCrvCount) ;
int nNewId = ExeCurveCurveInters( nId1, nId2, nDestGrpId, &nPntCount, &nCrvCount, bOnly3D) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
@@ -432,6 +434,26 @@ LuaSurfTmSurfTmInters( lua_State* L)
return 4 ;
}
//----------------------------------------------------------------------------
static int
LuaBBoxOverlap( lua_State* L)
{
// 4 parametri : BBoxA, frA, BBoxB, frB
BBox3d bboxA ;
LuaCheckParam( L, 1, bboxA)
Frame3d frA ;
LuaCheckParam( L, 2, frA)
BBox3d bboxB ;
LuaCheckParam( L, 3, bboxB) ;
Frame3d frB ;
LuaCheckParam( L, 4, frB) ;
LuaClearStack( L) ;
bool bRes = ExeBBoxOverlap( bboxA, frA, bboxB, frB) ;
// restituisco il risultato
LuaSetParam( L, bRes) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGeoInters( LuaMgr& luaMgr)
@@ -450,5 +472,6 @@ LuaInstallGeoInters( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCurveInters", LuaCurveCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveSurfTmInters", LuaCurveSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxOverlap", LuaBBoxOverlap) ;
return bOk ;
}
+217 -13
View File
@@ -1462,7 +1462,7 @@ LuaTdbIsCurrToolModified( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// verifico se l'utensile corrente è stato modificato
// verifico se l'utensile corrente stato modificato
bool bOk = ExeTdbIsCurrToolModified() ;
LuaSetParam( L, bOk) ;
return 1 ;
@@ -1823,6 +1823,18 @@ LuaImportSetup( lua_State* L)
return 1 ;
}
//-----------------------------------------------------------------------------
static int
LuaExistsCurrSetup( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// verifico l'esistenza dell'attrezzaggio della macchinata corrente
bool bOk = ExeExistsCurrSetup() ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-----------------------------------------------------------------------------
static int
LuaVerifyCurrSetup( lua_State* L)
@@ -2025,7 +2037,7 @@ LuaMdbIsCurrMachiningModified( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// verifico se la lavorazione corrente è stata modificata
// verifico se la lavorazione corrente stata modificata
bool bOk = ExeMdbIsCurrMachiningModified() ;
LuaSetParam( L, bOk) ;
return 1 ;
@@ -3082,6 +3094,44 @@ LuaGetMachiningEndPoint( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetMachiningStartAxes( lua_State* L)
{
// 0 o 1 parametro : [bSkipClimb]
bool bSkipClimb = true ;
LuaGetParam( L, 1, bSkipClimb) ;
LuaClearStack( L) ;
// recupero il valore iniziale degli assi del primo percorso della lavorazione corrente
DBLVECTOR vAxVal ;
bool bOk = ExeGetMachiningStartAxes( bSkipClimb, vAxVal) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vAxVal) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetMachiningEndAxes( lua_State* L)
{
// 0 o 1 parametro : [bSkipRise]
bool bSkipRise = true ;
LuaGetParam( L, 1, bSkipRise) ;
LuaClearStack( L) ;
// recupero il valore finale degli assi dell'ultimo percorso della lavorazione corrente
DBLVECTOR vAxVal ;
bool bOk = ExeGetMachiningEndAxes( bSkipRise, vAxVal) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vAxVal) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaApplyAllMachinings( lua_State* L)
@@ -3183,6 +3233,25 @@ LuaGetClEntIndex( lua_State* L)
return 1 ;
}
//-----------------------------------------------------------------------------
static int
LuaGetClEntFeed( lua_State* L)
{
// 1 parametro : nEntId
int nEntId ;
LuaGetParam( L, 1, nEntId) ;
LuaClearStack( L) ;
// recupero la feed
double dFeed ;
bool bOk = ExeGetClEntFeed( nEntId, dFeed) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, dFeed) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-----------------------------------------------------------------------------
static int
LuaGetClEntAxesStatus( lua_State* L)
@@ -3240,6 +3309,60 @@ LuaGetClEntAxesVal( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetClEntTDir( lua_State* L)
{
// 1 parametro : nEntId
int nEntId ;
LuaGetParam( L, 1, nEntId) ;
LuaClearStack( L) ;
// recupero TDir
Vector3d vtTDir ;
bool bOk = ExeGetClEntTDir( nEntId, vtTDir) ;
if ( bOk)
LuaSetParam( L, vtTDir) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetClEntCDir( lua_State* L)
{
// 1 parametro : nEntId
int nEntId ;
LuaGetParam( L, 1, nEntId) ;
LuaClearStack( L) ;
// recupero CDir
Vector3d vtCDir ;
bool bOk = ExeGetClEntCDir( nEntId, vtCDir) ;
if ( bOk)
LuaSetParam( L, vtCDir) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetClEntADir( lua_State* L)
{
// 1 parametro : nEntId
int nEntId ;
LuaGetParam( L, 1, nEntId) ;
LuaClearStack( L) ;
// recupero ADir
Vector3d vtADir ;
bool bOk = ExeGetClEntADir( nEntId, vtADir) ;
if ( bOk)
LuaSetParam( L, vtADir) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
// Simulation
//-------------------------------------------------------------------------------
@@ -3423,7 +3546,7 @@ LuaSimGetMoveInfo( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero tipo e veolcità del movimento corrente
// recupero tipo e veolcit del movimento corrente
int nGmove ;
double dFeed ;
bool bOk = ExeSimGetMoveInfo( nGmove, dFeed) ;
@@ -3541,6 +3664,23 @@ LuaSetCalcTool( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetCalcSolCh( lua_State* L)
{
// 1 o 2 parametri : nScc [, bExact]
int nScc ;
LuaCheckParam( L, 1, nScc)
bool bExact = false ;
LuaGetParam( L, 2, bExact) ;
LuaClearStack( L) ;
// imposto il criterio di scelta della soluzione e se deve essere rispettato esattamente
bool bOk = ExeSetCalcSolCh( nScc, bExact) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetRotAxisBlock( lua_State* L)
@@ -3600,6 +3740,28 @@ LuaGetCalcTool( lua_State* L)
return 3 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetCalcSolCh( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero il criterio di scelta della soluzione e se deve essere rispettato esattamente
int nScc ;
bool bExact ;
bool bOk = ExeGetCalcSolCh( nScc, bExact) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, nScc) ;
LuaSetParam( L, bExact) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetAllCurrAxesNames( lua_State* L)
@@ -3670,11 +3832,38 @@ LuaGetCalcAngles( lua_State* L)
}
}
//-------------------------------------------------------------------------------
static int
LuaGetCalcAnglesEx( lua_State* L)
{
// 1 o 2 parametri : vtDirT, vtDirA
Vector3d vtDirT ;
LuaCheckParam( L, 1, vtDirT)
Vector3d vtDirA ;
LuaGetParam( L, 2, vtDirA) ;
LuaClearStack( L) ;
// calcolo gli angoli macchina dalle direzioni fresa e ausiliaria
int nStat ; DBLVECTOR vAng1, vAng2 ;
bool bOk = ExeGetCalcAngles( vtDirT, vtDirA, nStat, vAng1, vAng2) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, bOk) ;
LuaSetParam( L, nStat) ;
LuaSetParam( L, vAng1) ;
LuaSetParam( L, vAng2) ;
return 4 ;
}
else {
LuaSetParam( L, bOk) ;
return 1 ;
}
}
//-------------------------------------------------------------------------------
static int
LuaGetCalcPositions( lua_State* L)
{
// da 2 a 5 parametri : ptP, dAngA [, dAngB] [, dAngC] [, dAngD]
// da 1 a 5 parametri : ptP [, dAngR1] [, dAngR2] [, dAngR3] [, dAngR4]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
DBLVECTOR vAng ;
@@ -3692,7 +3881,7 @@ LuaGetCalcPositions( lua_State* L)
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, bOk) ;
LuaSetParam( L, 0) ; // assegnato per compatibilità
LuaSetParam( L, 0) ; // assegnato per compatibilità
LuaSetParam( L, dX) ;
LuaSetParam( L, dY) ;
LuaSetParam( L, dZ) ;
@@ -3820,21 +4009,26 @@ LuaGetCalcAuxDirFromAngles( lua_State* L)
static int
LuaVerifyOutstroke( lua_State* L)
{
// 5 parametri : dX, dY, dZ, dAngA, dAngB
// 3 o 4 o 5 o 6 o 7 parametri : dX, dY, dZ [, dAngR1] [, dAngR2] [, dAngR3] [, dAngR4]
double dX ;
LuaCheckParam( L, 1, dX)
double dY ;
LuaCheckParam( L, 2, dY)
double dZ ;
LuaCheckParam( L, 3, dZ)
double dAngA ;
LuaCheckParam( L, 4, dAngA)
double dAngB ;
LuaCheckParam( L, 5, dAngB)
DBLVECTOR vAng ;
int i ;
for ( i = 4 ; i <= 7 ; ++ i) {
double dAng ;
if ( LuaGetParam( L, i, dAng))
vAng.emplace_back( dAng) ;
else
break ;
}
LuaClearStack( L) ;
// imposto la tavola corrente per il calcolo
int nStat ;
bool bOk = ExeVerifyOutstroke( dX, dY, dZ, dAngA, dAngB, nStat) ;
bool bOk = ExeVerifyOutstroke( dX, dY, dZ, vAng, nStat) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, ( nStat == 0)) ;
@@ -4461,6 +4655,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCurrSetup", LuaGetCurrSetup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetDefaultSetupName", LuaGetDefaultSetupName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImportSetup", LuaImportSetup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExistsCurrSetup", LuaExistsCurrSetup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVerifyCurrSetup", LuaVerifyCurrSetup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtFindToolInCurrSetup", LuaFindToolInCurrSetup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetToolsInCurrSetupPos", LuaGetToolsInCurrSetupPos) ;
@@ -4531,15 +4726,21 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtIsMachiningEmpty", LuaIsMachiningEmpty) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningStartPoint", LuaGetMachiningStartPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningEndPoint", LuaGetMachiningEndPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningStartAxes", LuaGetMachiningStartAxes) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningEndAxes", LuaGetMachiningEndAxes) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtApplyAllMachinings", LuaApplyAllMachinings) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtUpdateAllMachinings", LuaUpdateAllMachinings) ;
// CL Entities Interrogations
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntMove", LuaGetClEntMove) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntFlag", LuaGetClEntFlag) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntIndex", LuaGetClEntIndex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntIndex", LuaGetClEntIndex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntFeed", LuaGetClEntFeed) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesStatus", LuaGetClEntAxesStatus) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesMask", LuaGetClEntAxesMask) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesVal", LuaGetClEntAxesVal) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesVal", LuaGetClEntAxesVal) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntTDir", LuaGetClEntTDir) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntCDir", LuaGetClEntCDir) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntADir", LuaGetClEntADir) ;
// Simulation
bOk = bOk && luaMgr.RegisterFunction( "EgtSimInit", LuaSimInit) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSimStart", LuaSimStart) ;
@@ -4577,12 +4778,15 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
// Machine Calc
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTable", LuaSetCalcTable) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTool", LuaSetCalcTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcSolCh", LuaSetCalcSolCh) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetRotAxisBlock", LuaSetRotAxisBlock) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTable", LuaGetCalcTable) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTool", LuaGetCalcTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcSolCh", LuaGetCalcSolCh) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllCurrAxesNames", LuaGetAllCurrAxesNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRotAxisBlocked", LuaGetRotAxisBlocked) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAngles", LuaGetCalcAngles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAnglesEx", LuaGetCalcAnglesEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcPositions", LuaGetCalcPositions) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRobotAngles", LuaGetRobotAngles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTipFromPositions", LuaGetCalcTipFromPositions) ;
+69 -3
View File
@@ -205,13 +205,76 @@ LuaOptMachSetAllGroupDependencesAsMandatory( lua_State* L)
//-------------------------------------------------------------------------------
static int
LuaOptMachGetResult( lua_State* L)
LuaOptMachSetOptimizationForGroups( lua_State* L)
{
// 1 Parametro : bOptForGroups
bool bOptForGroups = false ;
LuaCheckParam( L, 1, bOptForGroups) ;
LuaClearStack( L) ;
// Imposto il Flag
bool bOk = ExeOptMachSetOptimizationForGroups( bOptForGroups) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachSetOpenBound( lua_State* L)
{
// 5 parametri : bStartVsEnd, nFlag, dX, dY, dZ
bool bStartVsEnd ;
LuaCheckParam( L, 1, bStartVsEnd) ;
int nFlag ;
LuaCheckParam( L, 2, nFlag) ;
double dX ;
LuaCheckParam( L, 3, dX) ;
double dY ;
LuaCheckParam( L, 4, dY) ;
double dZ ;
LuaCheckParam( L, 5, dZ) ;
LuaClearStack( L) ;
// Imposto la condizione
bool bOk = ExeOptMachSetOpenBound( bStartVsEnd, nFlag, dX, dY, dZ) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachSetOpenBoundForGroups( lua_State* L)
{
// 6 parametri : nGroup, bStartVsEnd, nFlag, dX, dY, dZ
int nGroup ;
LuaCheckParam( L, 1, nGroup) ;
bool bStartVsEnd ;
LuaCheckParam( L, 2, bStartVsEnd) ;
int nFlag ;
LuaCheckParam( L, 3, nFlag) ;
double dX ;
LuaCheckParam( L, 4, dX) ;
double dY ;
LuaCheckParam( L, 5, dY) ;
double dZ ;
LuaCheckParam( L, 6, dZ) ;
LuaClearStack( L) ;
// Imposto la condizione
bool bOk = ExeOptMachSetOpenBoundForGroups( nGroup, bStartVsEnd, nFlag, dX, dY, dZ) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachCalculate( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// eseguo calcolo di minimo percorso
INTVECTOR vOrder ;
bool bOk = ExeOptMachGetResult( vOrder) ;
bool bOk = ExeOptMachCalculate( vOrder) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vOrder) ;
@@ -235,6 +298,9 @@ LuaInstallMachiningOptimization( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachAddDependence", LuaOptMachAddDependence) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachAddSuggestedDependence", LuaOptMachAddSuggestedDependence) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetAllGroupsDependencesAsMandatory", LuaOptMachSetAllGroupDependencesAsMandatory) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachGetResult", LuaOptMachGetResult) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetOptimizationForGroups", LuaOptMachSetOptimizationForGroups) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetOpenBound", LuaOptMachSetOpenBound) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetOpenBoundForGroups", LuaOptMachSetOpenBoundForGroups) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachCalculate", LuaOptMachCalculate) ;
return bOk ;
}
+20
View File
@@ -195,6 +195,25 @@ LuaRedisAsyncSubscribeOneMessage( lua_State* L)
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisAsyncGetMessage( lua_State* L)
{
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sChannel ;
LuaCheckParam( L, 2, sChannel) ;
// Eseguo la funzione per leggere il messaggio
int nCount = 0 ;
string sMessage ;
bool bOk = ExeRedisAsyncGetMessage( nIdConnection, sChannel, nCount, sMessage) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
LuaSetParam( L, nCount) ;
LuaSetParam( L, sMessage) ;
return 3 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallRedis( LuaMgr& luaMgr)
@@ -210,5 +229,6 @@ LuaInstallRedis( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncSubscribe", LuaRedisAsyncSubscribe) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncUnsubscribe", LuaRedisAsyncUnsubscribe) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncSubscribeOneMessage", LuaRedisAsyncSubscribeOneMessage) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncGetMessage", LuaRedisAsyncGetMessage) ;
return bOk ;
}
+32 -1
View File
@@ -73,6 +73,19 @@ LuaDraw( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedraw( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// forzo ridisegno
bool bOk = ExeRedraw() ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetShowMode( lua_State* L)
@@ -358,14 +371,31 @@ LuaGetImageEx( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetShowSurfBezierTol( lua_State* L)
{
// 1 o 2 argomenti : dLinTol [, bRedraw]
double dLinTol ;
LuaCheckParam( L, 1, dLinTol)
bool bRedraw = true ;
LuaCheckParam( L, 2, bRedraw)
bool bOk = ExeSetShowSurfBezierTol( dLinTol, bRedraw) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallScene( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bool bOk = true ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetBackground", LuaSetBackground) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetBackground", LuaGetBackground) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDraw", LuaDraw) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedraw", LuaRedraw) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowMode", LuaSetShowMode) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowCurveDirection", LuaSetShowCurveDirection) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowTriaAdv", LuaSetShowTriaAdv) ;
@@ -381,5 +411,6 @@ LuaInstallScene( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetGenericView", LuaGetGenericView) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetImage", LuaGetImage) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetImageEx", LuaGetImageEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowSurfBezierTol", LuaSetShowSurfBezierTol) ;
return bOk ;
}
+4 -2
View File
@@ -169,16 +169,18 @@ LuaTestSpheSurface( lua_State* L)
static int
LuaTestSurfaceSurface( lua_State* L)
{
// 3 parametri : nSurf1Id, nSurf2Id, dSafeDist
// 3 o 4 parametri : nSurf1Id, nSurf2Id, dSafeDist [, bTestEnclusion]
int nSurf1Id ;
LuaCheckParam( L, 1, nSurf1Id)
int nSurf2Id ;
LuaCheckParam( L, 2, nSurf2Id)
double dSafeDist ;
LuaCheckParam( L, 3, dSafeDist)
bool bTestEnclusion = false ;
LuaGetParam( L, 4, bTestEnclusion) ;
LuaClearStack( L) ;
// eseguo verifica di interferenza
int nRes = ExeTestSurfaceSurface( nSurf1Id, nSurf2Id, dSafeDist) ;
int nRes = ExeTestSurfaceSurface( nSurf1Id, nSurf2Id, dSafeDist, bTestEnclusion) ;
// restituisco il risultato
if ( nRes >= 0)
LuaSetParam( L, ( nRes != 0)) ;
+328
View File
@@ -0,0 +1,328 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : LUA_Trimming.cpp Data : 23.10.25 Versione : 2.7j3
// Contenuto : Funzioni per le lavorazioni di Trimming.
//
// Modifiche : 23.10.25 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGnStringUtils.h"
using namespace std ;
// ------------------------------------------------------------------------------
static int
LuaTrimmingGetHoleBorder( lua_State* L)
{
// 7 parametri : nPartId, vSurfIds, vOtherSurfIds, dSurfLinTol, dSurfAngTol, dEdgeLinTol, dEdgeAngTol, dEdgeThick
int nParentId ;
LuaCheckParam( L, 1, nParentId) ;
INTVECTOR vSurfIds ;
LuaCheckParam( L, 2, vSurfIds) ;
INTVECTOR vOtherSurfIds ;
LuaCheckParam( L, 3, vOtherSurfIds) ;
double dSurfLinTol ;
LuaCheckParam( L, 4, dSurfLinTol) ;
double dSurfAngTol ;
LuaCheckParam( L, 5, dSurfAngTol) ;
double dEdgeLinTol ;
LuaCheckParam( L, 6, dEdgeLinTol) ;
double dEdgeAngTol ;
LuaCheckParam( L, 7, dEdgeAngTol) ;
double dEdgeThick ;
LuaCheckParam( L, 8, dEdgeThick) ;
LuaClearStack( L) ;
// Recupero le Curve per Asole e Fori
int nFirstId = GDB_ID_NULL, nCount = 0 ;
bool bOk = ExeTrimmingGetHoleBorder( nParentId, vSurfIds, vOtherSurfIds, dSurfLinTol, dSurfAngTol, dEdgeLinTol,
dEdgeAngTol, dEdgeThick, nFirstId, nCount) ;
LuaSetParam( L, bOk) ;
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
return 3 ;
}
// ------------------------------------------------------------------------------
static int
LuaTrimmingGetSurfTmFaceAdj( lua_State* L)
{
// 7 parametri : nParentId, nSurfId, nTria, ptTria, dAngTol, dSize, dSizeTol
int nParentId ;
LuaCheckParam( L, 1, nParentId) ;
int nSurfId ;
LuaCheckParam( L, 2, nSurfId)
int nTria ;
LuaCheckParam( L, 3, nTria)
Point3d ptTria ;
LuaCheckParam( L, 4, ptTria)
double dAngTol ;
LuaCheckParam( L, 5, dAngTol)
double dSize ;
LuaCheckParam( L, 6, dSize)
double dSizeTol ;
LuaCheckParam( L, 7, dSizeTol)
LuaClearStack( L) ;
// Recupero le facce adiacenti in tolleranza angolare
INTVECTOR vOtherFaces ;
int nNewSurfId = ExeTrimmingGetSurfTmFaceAdj( nParentId, nSurfId, nTria, ptTria, dAngTol, dSize, dSizeTol) ;
LuaSetParam( L, nNewSurfId) ;
return 1 ;
}
// ------------------------------------------------------------------------------
static int
LuaTrimmingGetAdjSurfs( lua_State* L)
{
// 5 parametri : nRefSfrId, vAllSurfId, dLinTol, dAngTol, dAngFaceTol
INTVECTOR vRefSurfId ;
LuaCheckParam( L, 1, vRefSurfId)
INTVECTOR vOtherSurfId ;
LuaCheckParam( L, 2, vOtherSurfId)
double dLinTol ;
LuaCheckParam( L, 3, dLinTol)
double dAngTol ;
LuaCheckParam( L, 4, dAngTol)
double dAngFaceTol ;
LuaCheckParam( L, 5, dAngFaceTol)
LuaClearStack( L) ;
// Calcolo le facce adiacenti per tolleranza
INTVECTOR vOtherSurf ;
bool bOk = ExeTrimmingGetAdjSurfs( vRefSurfId, vOtherSurfId, dLinTol, dAngTol, dAngFaceTol, vOtherSurf) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
LuaSetParam( L, vOtherSurf) ;
return 2 ;
}
// -------------------------------------------------------------------------------
static int
LuaTrimmingGetBorders( lua_State* L)
{
// 6 parametri : nParentId, vIds, dSurfLinTol, dSurfAngTol, dLinTol, dAngTol
int nParentId ;
LuaCheckParam( L, 1, nParentId)
SELVECTOR vIds ;
LuaCheckParam( L, 2, vIds)
double dSurfLinTol ;
LuaCheckParam( L, 3, dSurfLinTol) ;
double dSurfAngTol ;
LuaCheckParam( L, 4, dSurfAngTol) ;
double dLinTol ;
LuaCheckParam( L, 5, dLinTol)
double dAngTol ;
LuaCheckParam( L, 6, dAngTol)
LuaClearStack( L) ;
// Creo le curve di Edge grezze
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
bool bOk = ExeTrimmingGetBorders( nParentId, vIds, dSurfLinTol, dSurfAngTol, dLinTol, dAngTol, nFirstId, nCount) ;
LuaSetParam( L, bOk) ;
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
return 3 ;
}
// -------------------------------------------------------------------------------
static int
LuaTrimmingGetBordersByNormals( lua_State* L)
{
// 7 o 8 parametri : nParentId, vIds, dSurfLinTol, dSurfAngTol, dThickness
int nParentId ;
LuaCheckParam( L, 1, nParentId)
SELVECTOR vIds ;
LuaCheckParam( L, 2, vIds)
double dSurfLinTol ;
LuaCheckParam( L, 3, dSurfLinTol) ;
double dSurfAngTol ;
LuaCheckParam( L, 4, dSurfAngTol) ;
double dLinTol ;
LuaCheckParam( L, 5, dLinTol)
double dAngTol ;
LuaCheckParam( L, 6, dAngTol)
double dThickness ;
LuaCheckParam( L, 7, dThickness)
LuaClearStack( L) ;
// Creo le curve di Edge grezze
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
bool bOk = ExeTrimmingGetBordersByNormals( nParentId, vIds, dSurfLinTol, dSurfAngTol, dLinTol, dAngTol, dThickness, nFirstId, nCount) ;
LuaSetParam( L, bOk) ;
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
return 3 ;
}
// -------------------------------------------------------------------------------
static int
LuaTrimmingGetFinalBorders( lua_State* L)
{
// 4 o 5 o 6 o 7 parametri : nParentId, vCrvBezierId, dLinTol, dAngTol [,vBreakingPts] [,dThick [,dThickTol]]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
INTVECTOR vCrvBezierId ;
LuaCheckParam( L, 2, vCrvBezierId)
double dLinTol ;
LuaCheckParam( L, 3, dLinTol)
double dAngTol ;
LuaCheckParam( L, 4, dAngTol)
PNTVECTOR vBreakingPts ;
int nInd = 5 ;
if ( LuaGetParam( L, nInd, vBreakingPts))
++ nInd ;
double dThick = 0., dThickTol = EPS_SMALL ;
if ( LuaGetParam( L, nInd, dThick)) {
if ( ! LuaGetParam( L, nInd + 1, dThickTol)) {
LuaClearStack( L) ;
LuaSetParam( L, false) ;
return 1 ;
}
}
LuaClearStack( L) ;
// Creo le curve Edges
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
bool bOk = ExeTrimmingGetFinalBorders( nParentId, vCrvBezierId, dLinTol, dAngTol, vBreakingPts, dThick, dThickTol,
nFirstId, nCount) ;
LuaSetParam( L, bOk) ;
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
return 3 ;
}
//-------------------------------------------------------------------------------
static int
LuaTrimmingGetRuledBezier( lua_State* L)
{
// 5 o 6 parametri : nParentId, vIds, nEdge1Id, nEdge2Id, dLinTol [,vnLineId]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
INTVECTOR vIds ;
LuaCheckParam( L, 2, vIds) ; // serve per orientare la superficie rigata ( Ids delle superfici)
int nEdge1Id ;
LuaCheckParam( L, 3, nEdge1Id)
int nEdge2Id ;
LuaCheckParam( L, 4, nEdge2Id)
double dLinTol ;
LuaCheckParam( L, 5, dLinTol)
INTVECTOR vnLineId ;
LuaGetParam( L, 6, vnLineId) ;
LuaClearStack( L) ;
// Calcolo la superficie di Bezier rigata
int nId = ExeTrimmingGetRuledBezier( nParentId, vIds, nEdge1Id, nEdge2Id, dLinTol, vnLineId) ;
LuaSetParam( L, nId) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaTrimmingInterpolateSyncLines( lua_State* L)
{
// 7 parametri : nParentId, nFirstSyncId, nSecondSyncId, nBorder1Id, nBorder2Id, dEdgeLinTol, dEdgeAngTol
int nParentId ;
LuaCheckParam( L, 1, nParentId) ;
int nSync1Id ;
LuaCheckParam( L, 2, nSync1Id) ;
int nSync2Id ;
LuaCheckParam( L, 3, nSync2Id) ;
int nBorder1Id ;
LuaCheckParam( L, 4, nBorder1Id) ;
int nBorder2Id ;
LuaCheckParam( L, 5, nBorder2Id) ;
double dEdgeLinTol ;
LuaCheckParam( L, 6, dEdgeLinTol) ;
double dEdgeAngTol ;
LuaCheckParam( L, 7, dEdgeAngTol) ;
LuaClearStack( L) ;
// Interpolo le curve di sincronizzazione
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
bool bOk = ExeTrimmingInterpolateSyncLines( nParentId, nSync1Id, nSync2Id, nBorder1Id,
nBorder2Id, dEdgeLinTol, dEdgeAngTol, nFirstId, nCount) ;
LuaSetParam( L, bOk) ;
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
return 3 ;
}
//-------------------------------------------------------------------------------
static int
LuaTrimmingGetSurfBzSyncPoints( lua_State* L)
{
// 7 parametri : nParentId, nEdge1Id, nEdge2Id, dLinTol, dAngTol, nLinesNbr, bShowOnCorners
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nEdge1Id ;
LuaCheckParam( L, 2, nEdge1Id)
int nEdge2Id ;
LuaCheckParam( L, 3, nEdge2Id)
double dLinTol ;
LuaCheckParam( L, 4, dLinTol)
double dAngTol ;
LuaCheckParam( L, 5, dAngTol)
int nLineNbr ;
LuaCheckParam( L, 6, nLineNbr)
bool bShowOnCorners ;
LuaCheckParam( L, 7, bShowOnCorners)
LuaClearStack( L) ;
// Inserisco i tratti lineari associati ai punti di sincronizzazione
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
bool bOk = ExeTrimmingGetSurfBzSyncPoints( nParentId, nEdge1Id, nEdge2Id, dLinTol, dAngTol, nLineNbr, bShowOnCorners, nFirstId, nCount) ;
LuaSetParam( L, bOk) ;
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
return 3 ;
}
//-------------------------------------------------------------------------------
static int
LuaRegolarizeSurfaceLocally( lua_State* L)
{
int nParentId = GDB_ID_NULL ;
LuaCheckParam( L, 1, nParentId)
int nSurfId = GDB_ID_NULL ;
LuaCheckParam( L, 2, nSurfId)
int nSyncStartId ;
LuaCheckParam( L, 3, nSyncStartId)
int nSyncEndId ;
LuaCheckParam( L, 4, nSyncEndId)
double dLinTol ;
LuaCheckParam( L, 5, dLinTol)
int nId = ExeRegolarizeSurfaceLocally( nParentId, nSurfId, nSyncStartId, nSyncEndId, dLinTol) ;
LuaSetParam( L, nId) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallTrimming( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
// --- Ricerca Fori e Asole
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetHoleBorder", LuaTrimmingGetHoleBorder) ;
// --- Ricerca Superifici
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetSurfTmFaceAdj", LuaTrimmingGetSurfTmFaceAdj) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetAdjSurfs", LuaTrimmingGetAdjSurfs) ;
// --- Estrazione dei Bordi
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetBorders", LuaTrimmingGetBorders) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetBordersByNormals", LuaTrimmingGetBordersByNormals) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetFinalBorders", LuaTrimmingGetFinalBorders) ;
// --- Recupero Surf Bezier Ruled
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetRuledBezier", LuaTrimmingGetRuledBezier) ;
// --- Recupero linee di sincronizzazione
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingInterpolateSyncLines", LuaTrimmingInterpolateSyncLines) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetSurfBzSyncPoints", LuaTrimmingGetSurfBzSyncPoints) ;
// --- Modifica della superficie
bOk = bOk && luaMgr.RegisterFunction( "EgtRegolarizeSurfaceLocally", LuaRegolarizeSurfaceLocally) ;
return bOk ;
}
+69 -5
View File
@@ -1,10 +1,13 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by EgtExecutor.rc
// File di inclusione generato con Microsoft Visual C++.
// Utilizzato da EgtExecutor.rc
//
#define VS_VERSION_INFO 1
#define IDD_LUADLG 101
#define IDD_LUASCENE 102
#define IDD_LUADLG_ML 103
#define IDC_TEXT1 1001
#define IDC_TEXT2 1002
#define IDC_TEXT3 1003
@@ -13,6 +16,7 @@
#define IDC_TEXT6 1006
#define IDC_TEXT7 1007
#define IDC_TEXT8 1008
#define IDC_EDIT1 1011
#define IDC_EDIT2 1012
#define IDC_EDIT3 1013
@@ -21,6 +25,7 @@
#define IDC_EDIT6 1016
#define IDC_EDIT7 1017
#define IDC_EDIT8 1018
#define IDC_COMBO1 1021
#define IDC_COMBO2 1022
#define IDC_COMBO3 1023
@@ -29,6 +34,7 @@
#define IDC_COMBO6 1026
#define IDC_COMBO7 1027
#define IDC_COMBO8 1028
#define IDC_CHECK1 1031
#define IDC_CHECK2 1032
#define IDC_CHECK3 1033
@@ -37,15 +43,73 @@
#define IDC_CHECK6 1036
#define IDC_CHECK7 1037
#define IDC_CHECK8 1038
#define IDC_PICTURE1 1041
#define IDC_COLOR1 1041
#define IDC_COLOR2 1042
#define IDC_COLOR3 1043
#define IDC_COLOR4 1044
#define IDC_COLOR5 1045
#define IDC_COLOR6 1046
#define IDC_COLOR7 1047
#define IDC_COLOR8 1048
#define IDC_PICTURE1 1101
#define IDC_TEXT_ML_1 2001
#define IDC_TEXT_ML_2 2002
#define IDC_TEXT_ML_3 2003
#define IDC_TEXT_ML_4 2004
#define IDC_TEXT_ML_5 2005
#define IDC_TEXT_ML_6 2006
#define IDC_TEXT_ML_7 2007
#define IDC_TEXT_ML_8 2008
#define IDC_EDIT_ML_1 2011
#define IDC_EDIT_ML_2 2012
#define IDC_EDIT_ML_3 2013
#define IDC_EDIT_ML_4 2014
#define IDC_EDIT_ML_5 2015
#define IDC_EDIT_ML_6 2016
#define IDC_EDIT_ML_7 2017
#define IDC_EDIT_ML_8 2018
#define IDC_COMBO_ML_1 2021
#define IDC_COMBO_ML_2 2022
#define IDC_COMBO_ML_3 2023
#define IDC_COMBO_ML_4 2024
#define IDC_COMBO_ML_5 2025
#define IDC_COMBO_ML_6 2026
#define IDC_COMBO_ML_7 2027
#define IDC_COMBO_ML_8 2028
#define IDC_CHECK_ML_1 2031
#define IDC_CHECK_ML_2 2032
#define IDC_CHECK_ML_3 2033
#define IDC_CHECK_ML_4 2034
#define IDC_CHECK_ML_5 2035
#define IDC_CHECK_ML_6 2036
#define IDC_CHECK_ML_7 2037
#define IDC_CHECK_ML_8 2038
#define IDC_BUTTON_ML_1 2041
#define IDC_BUTTON_ML_2 2042
#define IDC_BUTTON_ML_3 2043
#define IDC_BUTTON_ML_4 2044
#define IDC_BUTTON_ML_5 2045
#define IDC_BUTTON_ML_6 2046
#define IDC_BUTTON_ML_7 2047
#define IDC_BUTTON_ML_8 2048
#define IDOK_ML 2051
#define IDCANCEL_ML 2052
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1030
#define _APS_NEXT_CONTROL_VALUE 1072
#define _APS_NEXT_SYMED_VALUE 115
#endif
#endif