Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| edb45ce149 | |||
| 063b0f5cc4 | |||
| 2da612140e | |||
| 5d6f9c5d1d | |||
| 83ee155b8a | |||
| 3ff02fe0fe | |||
| 52cb174832 | |||
| d3a6f99ba5 |
@@ -1,90 +0,0 @@
|
|||||||
//----------------------------------------------------------------------------
|
|
||||||
// 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)) ;
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
//----------------------------------------------------------------------------
|
|
||||||
// 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) ;
|
|
||||||
@@ -59,8 +59,8 @@ ExePocketing( int nId, double dRad, double dStep, double dAngle, int nType, bool
|
|||||||
|
|
||||||
// eseguo Pocketing
|
// eseguo Pocketing
|
||||||
ICRVCOMPOPOVECTOR vCrvCompoRes ;
|
ICRVCOMPOPOVECTOR vCrvCompoRes ;
|
||||||
bool bOk = CalcPocketing( pSfr, dRad, 0, dStep, dAngle, 5., nType, bSmooth, true, false, false, false, true, P_INVALID, nullptr, false,
|
bool bOk = CalcPocketing( pSfr, dRad, 0, dStep, dAngle, 5., nType, bSmooth, true, false, false, true, false, true, P_INVALID, nullptr, false,
|
||||||
dStep, 0, INFINITO, 0, 0, INFINITO, false, 0., 0., vCrvCompoRes) ;
|
dStep, 0, INFINITO, 0, 0, INFINITO, false, 0., 0., false, vCrvCompoRes) ;
|
||||||
nFirstId = GDB_ID_NULL ;
|
nFirstId = GDB_ID_NULL ;
|
||||||
nCrvCount = int( vCrvCompoRes.size()) ;
|
nCrvCount = int( vCrvCompoRes.size()) ;
|
||||||
if ( bOk && nCrvCount > 0) {
|
if ( bOk && nCrvCount > 0) {
|
||||||
|
|||||||
@@ -2358,7 +2358,7 @@ ExeCurveCompoSetTempParam( int nId, int nCrv, double dParam, int nParamInd)
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static bool
|
static bool
|
||||||
MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, int nRefType)
|
MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, int nRefType, double dToler)
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
@@ -2368,7 +2368,6 @@ MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, in
|
|||||||
if ( ! pGeomDB->GetGroupGlobFrame( nGroupId, frGrp))
|
if ( ! pGeomDB->GetGroupGlobFrame( nGroupId, frGrp))
|
||||||
return false ;
|
return false ;
|
||||||
// preparo i dati per il concatenamento
|
// preparo i dati per il concatenamento
|
||||||
double dToler = 10 * EPS_SMALL ;
|
|
||||||
ChainCurves chainC ;
|
ChainCurves chainC ;
|
||||||
chainC.Init( bAllowInvert, dToler, pGeomDB->GetGroupObjs( nGroupId)) ;
|
chainC.Init( bAllowInvert, dToler, pGeomDB->GetGroupObjs( nGroupId)) ;
|
||||||
int nId = pGeomDB->GetFirstInGroup( nGroupId) ;
|
int nId = pGeomDB->GetFirstInGroup( nGroupId) ;
|
||||||
@@ -2412,9 +2411,9 @@ MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, in
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
|
ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType, double dToler)
|
||||||
{
|
{
|
||||||
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, true, nRefType) ;
|
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, true, nRefType, dToler) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
@@ -2429,9 +2428,9 @@ ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
|
ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType, double dToler)
|
||||||
{
|
{
|
||||||
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, false, nRefType) ;
|
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, false, nRefType, dToler) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "EXE.h"
|
#include "EXE.h"
|
||||||
#include "EXE_Macro.h"
|
#include "EXE_Macro.h"
|
||||||
#include "AuxDialogBox.h"
|
|
||||||
#include "/EgtDev/Include/EXeExecutor.h"
|
#include "/EgtDev/Include/EXeExecutor.h"
|
||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||||
@@ -77,9 +76,6 @@ ExeSelectObj( int nId)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
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
|
// restituisco risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -104,9 +100,6 @@ ExeDeselectObj( int nId)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
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
|
// restituisco risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -146,9 +139,6 @@ ExeSelectAll( bool bOnlyIfVisible)
|
|||||||
" -- bOk=1" ;
|
" -- bOk=1" ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
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
|
// restituisco risultato
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
@@ -170,9 +160,6 @@ ExeDeselectAll( void)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
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
|
// restituisco risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -199,9 +186,6 @@ ExeSelectGroupObjs( int nGroupId)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
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
|
// restituisco risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -225,9 +209,6 @@ ExeDeselectGroupObjs( int nGroupId)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
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
|
// restituisco risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
+24
-3
@@ -524,17 +524,38 @@ ExeAddRawPart( Point3d ptOrig, double dLength, double dWidth, double dHeight, Co
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
ExeAddRawPartWithPart( int nPartId, int nCrvId, double dOverMat, Color cCol)
|
ExeAddRawPartGen( int nCrvSrfId, double dOverMat, Color cCol)
|
||||||
{
|
{
|
||||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||||
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
|
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
|
||||||
// inserisco grezzo con pezzo nella macchinata corrente
|
// inserisco grezzo con pezzo nella macchinata corrente
|
||||||
int nId = pMachMgr->AddRawPartWithPart( nPartId, nCrvId, dOverMat, cCol) ;
|
int nId = pMachMgr->AddRawPart( nCrvSrfId, dOverMat, cCol) ;
|
||||||
|
ExeSetModified() ;
|
||||||
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
|
if ( IsCmdLog()) {
|
||||||
|
string sLua = "EgtAddRawPartGen(" + ToString( nCrvSrfId) + "," +
|
||||||
|
ToString( dOverMat) + ",{" +
|
||||||
|
ToString( cCol) + "})" +
|
||||||
|
" -- Id=" + ToString( nId) ;
|
||||||
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
|
}
|
||||||
|
// restituisco il risultato
|
||||||
|
return nId ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
int
|
||||||
|
ExeAddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color cCol)
|
||||||
|
{
|
||||||
|
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||||
|
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
|
||||||
|
// inserisco grezzo con pezzo nella macchinata corrente
|
||||||
|
int nId = pMachMgr->AddRawPartWithPart( nPartId, nCrvSrfId, dOverMat, cCol) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
string sLua = "EgtAddRawPartWithPart(" + ToString( nPartId) + "," +
|
string sLua = "EgtAddRawPartWithPart(" + ToString( nPartId) + "," +
|
||||||
ToString( nCrvId) + "," +
|
ToString( nCrvSrfId) + "," +
|
||||||
ToString( dOverMat) + ",{" +
|
ToString( dOverMat) + ",{" +
|
||||||
ToString( cCol) + "})" +
|
ToString( cCol) + "})" +
|
||||||
" -- Id=" + ToString( nId) ;
|
" -- Id=" + ToString( nId) ;
|
||||||
|
|||||||
+536
-4
@@ -16,6 +16,8 @@
|
|||||||
#include "DllExchange.h"
|
#include "DllExchange.h"
|
||||||
#include "GeoTools.h"
|
#include "GeoTools.h"
|
||||||
#include "AuxTools.h"
|
#include "AuxTools.h"
|
||||||
|
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||||
|
#include "/EgtDev/Include/EGkCurveAux.h"
|
||||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||||
#include "/EgtDev/Include/EXeExecutor.h"
|
#include "/EgtDev/Include/EXeExecutor.h"
|
||||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||||
@@ -24,9 +26,12 @@
|
|||||||
#include "/EgtDev/Include/EGkTrimming.h"
|
#include "/EgtDev/Include/EGkTrimming.h"
|
||||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||||
|
#include "/EgtDev/Include/EGkDistPointSurfBz.h"
|
||||||
|
#include "/EgtDev/Include/EGkSbzFromCurves.h"
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -868,10 +873,537 @@ ExeTrimmingGetSurfBzSyncPoints( int nParentId, int nEdge1Id, int nEdge2Id, doubl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
int
|
bool
|
||||||
ExeRegolarizeSurfaceLocally( int nParentId, int nSurfId, int nSyncStartId, int nSyncEndId, double dLinTol)
|
ExeTrimmingGetToolOrientationLines( int nParentId, int nMainEdgeId, int nOtherEdgeId, int nSyncLayerId, int nLineSId, int nLineEId,
|
||||||
|
double dThetaStart, double dPhiStart, double dThetaEnd, double dPhiEnd, double dInterpLenS,
|
||||||
|
double dInterpLenE, double dLinTol,
|
||||||
|
int& nInterpStartId, int& nStartId, int& nEndId, int& nInterpEndId)
|
||||||
|
{
|
||||||
|
// Verifica database geometrico
|
||||||
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
|
|
||||||
|
// Imposto i parametri di ritorno
|
||||||
|
nInterpStartId = GDB_ID_NULL, nStartId = GDB_ID_NULL, nEndId = GDB_ID_NULL, nInterpEndId = GDB_ID_NULL ;
|
||||||
|
|
||||||
|
// Se necessario aggiusto le tolleranze
|
||||||
|
double dMyLinTol = Clamp( dLinTol, EPS_SMALL, 1e5 * EPS_SMALL) ;
|
||||||
|
const double TOL = dMyLinTol ;
|
||||||
|
// Definisco costanti per interpolazione
|
||||||
|
const double INTERPOLATION_DIST = 0.5 ; // alzare
|
||||||
|
const double ISO_PAR_SAMPLE = 20.0 ;
|
||||||
|
|
||||||
|
// Recupero il riferimento del gruppo di destinazione
|
||||||
|
Frame3d frDest ;
|
||||||
|
bool bOk = ( pGeomDB->GetGlobFrame( nParentId, frDest)) ;
|
||||||
|
|
||||||
|
// Recupero le due Curve di bordo
|
||||||
|
const ICurve* pCrvMainEdge = GetCurve( pGeomDB->GetGeoObj( nMainEdgeId)) ;
|
||||||
|
const ICurve* pCrvOtherEdge = GetCurve( pGeomDB->GetGeoObj( nOtherEdgeId)) ;
|
||||||
|
bOk = bOk && ( pCrvMainEdge != nullptr && pCrvMainEdge->IsValid() && pCrvOtherEdge != nullptr && pCrvOtherEdge->IsValid()) ;
|
||||||
|
|
||||||
|
// Verifico che le curve siano entrambe Aperte o entrambe Chiuse e memorizzo il risultato
|
||||||
|
bOk = bOk && ( pCrvMainEdge->IsClosed() == pCrvOtherEdge->IsClosed()) ;
|
||||||
|
bool bBorderClosed = ( pCrvMainEdge->IsClosed()) ;
|
||||||
|
|
||||||
|
// Recupero le Linee di Sincronizzazione iniziali e finali e verifico che giacciano sulle Curve di Bordo
|
||||||
|
PtrOwner<ICurve> pCrvSyncS( GetCurve( pGeomDB->GetGeoObj( nLineSId))->Clone()) ;
|
||||||
|
PtrOwner<ICurve> pCrvSyncE( GetCurve( pGeomDB->GetGeoObj( nLineEId))->Clone()) ;
|
||||||
|
bOk = bOk && ( pCrvSyncS != nullptr && pCrvSyncS->IsValid() && pCrvSyncE != nullptr && pCrvSyncE->IsValid()) ;
|
||||||
|
BIPOINT Line1, Line2 ;
|
||||||
|
bOk = bOk && ( pCrvSyncS->GetStartPoint( Line1.first)) && ( pCrvSyncS->GetEndPoint( Line1.second)) ;
|
||||||
|
bOk = bOk && ( pCrvSyncE->GetStartPoint( Line2.first)) && ( pCrvSyncE->GetEndPoint( Line2.second)) ;
|
||||||
|
// --- se necessario oriento le linee di Sync in modo che inizino entrambe dal Bordo Main
|
||||||
|
if ( bOk) {
|
||||||
|
if ( pCrvMainEdge->IsPointOn( Line1.first, TOL))
|
||||||
|
bOk = ( pCrvOtherEdge->IsPointOn( Line1.second, TOL)) ;
|
||||||
|
else if ( pCrvOtherEdge->IsPointOn( Line1.first, TOL)) {
|
||||||
|
bOk = ( pCrvMainEdge->IsPointOn( Line1.second, TOL)) ;
|
||||||
|
if ( bOk) {
|
||||||
|
swap( Line1.first, Line1.second) ;
|
||||||
|
pCrvSyncS->Invert() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
bOk = false ;
|
||||||
|
}
|
||||||
|
if ( bOk) {
|
||||||
|
if ( pCrvMainEdge->IsPointOn( Line2.first, TOL))
|
||||||
|
bOk = ( pCrvOtherEdge->IsPointOn( Line2.second, TOL)) ;
|
||||||
|
else if ( pCrvOtherEdge->IsPointOn( Line2.first, TOL)) {
|
||||||
|
bOk = ( pCrvMainEdge->IsPointOn( Line2.second, TOL)) ;
|
||||||
|
if ( bOk) {
|
||||||
|
swap( Line2.first, Line2.second) ;
|
||||||
|
pCrvSyncE->Invert() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else bOk = false ;
|
||||||
|
}
|
||||||
|
// Il percorso selezionato è il minore tra le due possibilità di percorrenza
|
||||||
|
if ( bOk && bBorderClosed) {
|
||||||
|
double dParS = 0. ;
|
||||||
|
PtrOwner<ICurveComposite> pCompoMainCL( ConvertCurveToComposite( pCrvMainEdge->Clone())) ;
|
||||||
|
bOk = ( ! IsNull( pCompoMainCL) && pCompoMainCL->IsValid() &&
|
||||||
|
pCompoMainCL->GetParamAtPoint( Line1.first, dParS, TOL)) ;
|
||||||
|
if ( bOk) {
|
||||||
|
pCompoMainCL->ChangeStartPoint( dParS) ;
|
||||||
|
double dLenE = 0., dLenMain = 0. ;
|
||||||
|
bOk = ( pCompoMainCL->GetLengthAtPoint( Line2.first, dLenE, TOL) &&
|
||||||
|
pCompoMainCL->GetLength( dLenMain)) ;
|
||||||
|
if ( dLenE > dLenMain / 2. + EPS_SMALL) {
|
||||||
|
swap( Line1, Line2) ;
|
||||||
|
swap( pCrvSyncS, pCrvSyncE) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calcolo la lunghezza delle due curve di Bordo
|
||||||
|
double dLenMain = 0., dLenOther = 0. ;
|
||||||
|
bOk = bOk && ( pCrvMainEdge->GetLength( dLenMain) && pCrvOtherEdge->GetLength( dLenOther) &&
|
||||||
|
dLenMain > 2. * TOL + dInterpLenS + dInterpLenE + EPS_SMALL &&
|
||||||
|
dLenOther > 2. * TOL + dInterpLenS + dInterpLenE + EPS_SMALL) ;
|
||||||
|
|
||||||
|
// Recupero i punti di sincronizzazione (se presenti)
|
||||||
|
BIPNTVECTOR vSyncPoints ; vSyncPoints.reserve( pGeomDB->GetGroupObjs( nSyncLayerId)) ;
|
||||||
|
int nLineId = pGeomDB->GetFirstInGroup( nSyncLayerId) ;
|
||||||
|
while ( bOk && nLineId != GDB_ID_NULL) {
|
||||||
|
// Recupero la Curva
|
||||||
|
const ICurve* pLine = GetCurve( pGeomDB->GetGeoObj( nLineId)) ;
|
||||||
|
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 dDistS1 = INFINITO ;
|
||||||
|
if ( ! DistPointCurve( ptStart, *pCrvMainEdge).GetDist( dDistS1)) {
|
||||||
|
nLineId = pGeomDB->GetNext( nLineId) ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
if ( dDistS1 < dLinTol) {
|
||||||
|
double dDistE2 = INFINITO ;
|
||||||
|
if ( ! DistPointCurve( ptEnd, *pCrvOtherEdge).GetDist( dDistE2) || dDistE2 > dLinTol) {
|
||||||
|
nLineId = pGeomDB->GetNext( nLineId) ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
double dDistS2 = INFINITO ;
|
||||||
|
if ( ! DistPointCurve( ptStart, *pCrvMainEdge).GetDist( dDistS2) || dDistS2 > dLinTol) {
|
||||||
|
nLineId = pGeomDB->GetNext( nLineId) ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
double dDistE1 = INFINITO ;
|
||||||
|
if ( ! DistPointCurve( ptEnd, *pCrvOtherEdge).GetDist( dDistE1) || dDistE1 > dLinTol) {
|
||||||
|
nLineId = pGeomDB->GetNext( nLineId) ;
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
swap( ptStart, ptEnd) ;
|
||||||
|
}
|
||||||
|
vSyncPoints.emplace_back( make_pair( ptStart, ptEnd)) ;
|
||||||
|
}
|
||||||
|
nLineId = pGeomDB->GetNext( nLineId) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recupero la superficie Bezier rigata
|
||||||
|
PtrOwner<ISurfBezier> pSurfBzRuled ;
|
||||||
|
if ( bOk) {
|
||||||
|
// Se non ho linee di sincronizzazione
|
||||||
|
if ( vSyncPoints.empty())
|
||||||
|
pSurfBzRuled.Set( GetSurfBezierRuledSmooth( pCrvMainEdge, pCrvOtherEdge, vSyncPoints, ISO_PAR_SAMPLE)) ;
|
||||||
|
// Se ho linee di sincronizzazione
|
||||||
|
else
|
||||||
|
pSurfBzRuled.Set( GetSurfBezierRuledGuided( pCrvMainEdge, pCrvOtherEdge, vSyncPoints, dMyLinTol)) ;
|
||||||
|
bOk = bOk && ( ! IsNull( pSurfBzRuled) && pSurfBzRuled->IsValid()) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Calcolo delle Linee di Orientamento ---
|
||||||
|
if ( bOk) {
|
||||||
|
|
||||||
|
// Rotazione delle curve di Bordo rispetto al Bordo Main
|
||||||
|
double dLenS ; pCrvSyncS->GetLength( dLenS) ;
|
||||||
|
Line1.second = Line1.first + FromSpherical( dLenS, dThetaStart, dPhiStart) ;
|
||||||
|
double dLenE ; pCrvSyncE->GetLength( dLenE) ;
|
||||||
|
Line2.second = Line2.first + FromSpherical( dLenE, dThetaEnd, dPhiEnd) ;
|
||||||
|
|
||||||
|
// --- Eventuale Interpolazione Lineare di Raccordo all'Inizio ---
|
||||||
|
if ( dInterpLenS > TOL) {
|
||||||
|
double dExtension = dInterpLenS ;
|
||||||
|
double dLen = -1. ; pCrvMainEdge->GetLengthAtPoint( Line1.first, dLen, TOL) ;
|
||||||
|
if ( bBorderClosed) {
|
||||||
|
dLen -= dInterpLenS ;
|
||||||
|
if ( dLen < EPS_SMALL)
|
||||||
|
dLen = dLenMain + dLen ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ( dLen < dInterpLenS - EPS_SMALL) {
|
||||||
|
dExtension = dLen ;
|
||||||
|
dLen = 0 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
double dU = - 1;
|
||||||
|
bOk = pCrvMainEdge->GetParamAtLength( dLen, dU) ;
|
||||||
|
if ( bOk) {
|
||||||
|
// Definisco la linea si sincronizzazione
|
||||||
|
Point3d ptInterpS ; double dParU, dParV ;
|
||||||
|
PtrOwner<ICurveComposite> pCompoIso( nullptr) ;
|
||||||
|
BIPOINT LineInterpS ;
|
||||||
|
bOk = ( pCrvMainEdge->GetPointD1D2( dU, ICurve::FROM_MINUS, ptInterpS) &&
|
||||||
|
DistPointSurfBz( ptInterpS, *pSurfBzRuled).GetParamsAtMinDistPoint( dParU, dParV) &&
|
||||||
|
pCompoIso.Set( pSurfBzRuled->GetCurveOnV( dParU)) &&
|
||||||
|
pCompoIso->IsValid() &&
|
||||||
|
pCompoIso->GetStartPoint( LineInterpS.first) &&
|
||||||
|
pCompoIso->GetEndPoint( LineInterpS.second)) ;
|
||||||
|
if ( bOk) {
|
||||||
|
bool bFirst = true ;
|
||||||
|
// Interpolo
|
||||||
|
double dLenLineInterpS = Dist( LineInterpS.first, LineInterpS.second) ;
|
||||||
|
double dLenLine1 = Dist( Line1.first, Line1.second) ;
|
||||||
|
int nStep = max( 1, int( ceil( dExtension / INTERPOLATION_DIST))) ;
|
||||||
|
Vector3d vtInterpStart = ( LineInterpS.second - LineInterpS.first) ; vtInterpStart.Normalize() ;
|
||||||
|
Vector3d vtInterpEnd = ( Line1.second - Line1.first) ; vtInterpEnd.Normalize() ;
|
||||||
|
Vector3d vtDiff = vtInterpEnd - vtInterpStart ;
|
||||||
|
for ( int i = 0 ; bOk && i < ( nStep - 1) ; ++ i) { // ( nStep - 1) per evitare sovrapposizione con la Copia del vettore
|
||||||
|
double dI = double( i) ;
|
||||||
|
Vector3d vtInterp = vtInterpStart + ( dI / ( nStep - 1)) * vtDiff ;
|
||||||
|
double dUInterpMain = 0. ; Point3d ptInterpOnMain ;
|
||||||
|
double dCurrLen = dLen + ( dI * dExtension / ( nStep - 1)) ;
|
||||||
|
if ( dCurrLen > dLenMain)
|
||||||
|
dCurrLen -= dLenMain ;
|
||||||
|
bOk = ( pCrvMainEdge->GetParamAtLength( dCurrLen, dUInterpMain) &&
|
||||||
|
pCrvMainEdge->GetPointD1D2( dUInterpMain, ICurve::FROM_MINUS, ptInterpOnMain)) ;
|
||||||
|
if ( bOk) {
|
||||||
|
double dMagnitude = dLenLineInterpS + ( dI / ( nStep - 1)) * ( dLenLine1 - dLenLineInterpS) ;
|
||||||
|
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||||
|
bOk = ( ! IsNull( pLine) && pLine->Set( ptInterpOnMain, ptInterpOnMain + vtInterp * dMagnitude)) ;
|
||||||
|
if ( bOk) {
|
||||||
|
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pLine)) ;
|
||||||
|
bOk = ( nNewId != GDB_ID_NULL) ;
|
||||||
|
if ( bOk) {
|
||||||
|
if ( bFirst) {
|
||||||
|
nInterpStartId = nNewId ;
|
||||||
|
bFirst = false ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Interpolazione tra le due Linee di Sincronizzazione ---
|
||||||
|
if ( bOk) {
|
||||||
|
double dLenS = -1., dLenE = -1 ;
|
||||||
|
bOk = ( pCrvMainEdge->GetLengthAtPoint( Line1.first, dLenS, TOL) &&
|
||||||
|
pCrvMainEdge->GetLengthAtPoint( Line2.first, dLenE, TOL)) ;
|
||||||
|
if ( bOk) {
|
||||||
|
double dToTDist = 0. ;
|
||||||
|
if ( dLenS < dLenE)
|
||||||
|
dToTDist = dLenE - dLenS ;
|
||||||
|
else
|
||||||
|
dToTDist = ( dLenMain - dLenS) + dLenE ;
|
||||||
|
if ( dToTDist > TOL) {
|
||||||
|
bool bFirst = true ;
|
||||||
|
// Interpolo
|
||||||
|
double dLenLine1 = Dist( Line1.first, Line1.second) ;
|
||||||
|
double dLenLine2 = Dist( Line2.first, Line2.second) ;
|
||||||
|
int nStep = max( 1, int( ceil( dToTDist / INTERPOLATION_DIST))) ;
|
||||||
|
Vector3d vtLineS = ( Line1.second - Line1.first) ; vtLineS.Normalize() ;
|
||||||
|
Vector3d vtLineE = ( Line2.second - Line2.first) ; vtLineE.Normalize() ;
|
||||||
|
Vector3d vtDiff = ( vtLineE - vtLineS) ;
|
||||||
|
for ( int i = 0 ; bOk && i <= nStep ; ++ i) {
|
||||||
|
double dI = double( i) ;
|
||||||
|
Vector3d vtInterp = vtLineS + ( dI / nStep) * vtDiff ;
|
||||||
|
double dUInterpMain = 0. ; Point3d ptInterpOnMain ;
|
||||||
|
double dCurrLen = dLenS + ( dI * dToTDist / nStep) ;
|
||||||
|
if ( dCurrLen > dLenMain)
|
||||||
|
dCurrLen -= dLenMain ;
|
||||||
|
bOk = ( pCrvMainEdge->GetParamAtLength( dCurrLen, dUInterpMain) &&
|
||||||
|
pCrvMainEdge->GetPointD1D2( dUInterpMain, ICurve::FROM_MINUS, ptInterpOnMain)) ;
|
||||||
|
if ( bOk) {
|
||||||
|
double dMagnitude = dLenLine1 + ( dI / nStep) * ( dLenLine2 - dLenLine1) ;
|
||||||
|
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||||
|
bOk = ( ! IsNull( pLine) && pLine->Set( ptInterpOnMain, ptInterpOnMain + vtInterp * dMagnitude)) ;
|
||||||
|
if ( bOk) {
|
||||||
|
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pLine)) ;
|
||||||
|
bOk = ( nNewId != GDB_ID_NULL) ;
|
||||||
|
if ( bOk) {
|
||||||
|
if ( bFirst) {
|
||||||
|
nStartId = nNewId ;
|
||||||
|
bFirst = false ;
|
||||||
|
}
|
||||||
|
nEndId = nNewId ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Eventuale Interpolazione Lineare di Raccordo alla Fine ---
|
||||||
|
if ( bOk && dInterpLenE > TOL) {
|
||||||
|
double dExtension = dInterpLenE ;
|
||||||
|
double dLen = -1. ; pCrvMainEdge->GetLengthAtPoint( Line2.first, dLen, TOL) ;
|
||||||
|
if ( bBorderClosed) {
|
||||||
|
dLen += dInterpLenE ;
|
||||||
|
if ( dLen > dLenMain - EPS_SMALL)
|
||||||
|
dLen -= dLenMain ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ( dLen > dLenMain - dInterpLenE - EPS_SMALL) {
|
||||||
|
dExtension = dLenMain - dLen ;
|
||||||
|
dLen = dLenMain ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
double dU = - 1 ;
|
||||||
|
bOk = pCrvMainEdge->GetParamAtLength( dLen, dU) ;
|
||||||
|
if ( bOk) {
|
||||||
|
// Definisco la linea si sincronizzazione
|
||||||
|
Point3d ptInterpE ; double dParU, dParV ;
|
||||||
|
PtrOwner<ICurveComposite> pCompoIso( nullptr) ;
|
||||||
|
BIPOINT LineInterpE ;
|
||||||
|
bOk = ( pCrvMainEdge->GetPointD1D2( dU, ICurve::FROM_MINUS, ptInterpE) &&
|
||||||
|
DistPointSurfBz( ptInterpE, *pSurfBzRuled).GetParamsAtMinDistPoint( dParU, dParV) &&
|
||||||
|
pCompoIso.Set( pSurfBzRuled->GetCurveOnV( dParU)) &&
|
||||||
|
pCompoIso->IsValid() &&
|
||||||
|
pCompoIso->GetStartPoint( LineInterpE.first) &&
|
||||||
|
pCompoIso->GetEndPoint( LineInterpE.second)) ;
|
||||||
|
if ( bOk) {
|
||||||
|
// Interpolo
|
||||||
|
double dLenLineInterpE = Dist( LineInterpE.first, LineInterpE.second) ;
|
||||||
|
double dLenLine2 = Dist( Line2.first, Line2.second) ;
|
||||||
|
int nStep = max( 1, int( ceil( dExtension / INTERPOLATION_DIST))) ;
|
||||||
|
Vector3d vtInterpStart = ( Line2.second - Line2.first) ; vtInterpStart.Normalize() ;
|
||||||
|
Vector3d vtInterpEnd = ( LineInterpE.second - LineInterpE.first) ; vtInterpEnd.Normalize() ;
|
||||||
|
Vector3d vtDiff = vtInterpEnd - vtInterpStart ;
|
||||||
|
for ( int i = 1 ; bOk && i < nStep ; ++ i) { // i = 1 per evitare la sopvrapposizione con la Copia del vettore
|
||||||
|
double dI = double( i) ;
|
||||||
|
Vector3d vtInterp = vtInterpStart + ( dI / ( nStep - 1)) * vtDiff ;
|
||||||
|
double dUInterpMain = 0. ; Point3d ptInterpOnMain ;
|
||||||
|
double dCurrLen = ( dLen - dExtension) + ( dI * dExtension / ( nStep - 1)) ;
|
||||||
|
if ( dCurrLen > dLenMain)
|
||||||
|
dCurrLen -= dLenMain ;
|
||||||
|
bOk = ( pCrvMainEdge->GetParamAtLength( dCurrLen, dUInterpMain) &&
|
||||||
|
pCrvMainEdge->GetPointD1D2( dUInterpMain, ICurve::FROM_MINUS, ptInterpOnMain)) ;
|
||||||
|
if ( bOk) {
|
||||||
|
double dMagnitude = dLenLine2 + ( dI / ( nStep - 1)) * ( dLenLineInterpE - dLenLine2) ;
|
||||||
|
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||||
|
bOk = ( ! IsNull( pLine) && pLine->Set( ptInterpOnMain, ptInterpOnMain + vtInterp * dMagnitude)) ;
|
||||||
|
if ( bOk) {
|
||||||
|
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pLine)) ;
|
||||||
|
bOk = ( nNewId != GDB_ID_NULL) ;
|
||||||
|
if ( bOk)
|
||||||
|
nInterpEndId = nNewId ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ExeSetModified() ;
|
||||||
|
// Se richiesto, salvo il comando Lua equivalente
|
||||||
|
if ( IsCmdLog()) {
|
||||||
|
string sLua = "EgtTrimmingGetToolOrientationLines(" + ToString( nParentId) + "," +
|
||||||
|
ToString( nMainEdgeId) + "," +
|
||||||
|
ToString( nOtherEdgeId) + "," +
|
||||||
|
ToString( nLineSId) + "," +
|
||||||
|
ToString( nLineEId) + "," +
|
||||||
|
ToString( dThetaStart) + "," +
|
||||||
|
ToString( dPhiStart) + "," +
|
||||||
|
ToString( dThetaEnd) + "," +
|
||||||
|
ToString( dPhiEnd) + "," +
|
||||||
|
ToString( dLinTol) + "," +
|
||||||
|
ToString( dInterpLenS) + "," +
|
||||||
|
ToString( dInterpLenE) + "," +
|
||||||
|
" -- bOk=" + ToString( bOk) +
|
||||||
|
" -- nInterpStartId=" + ToString( nInterpStartId) + ", nStartId=" + ToString( nStartId) +
|
||||||
|
", nEndId=" + ToString( nEndId) + ", nInterpEndId=" + ToString( nInterpEndId) ;
|
||||||
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bOk ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
struct TrimmingInterval {
|
||||||
|
double dLenStart ;
|
||||||
|
double dLenEnd ;
|
||||||
|
Vector3d vtStart ;
|
||||||
|
Vector3d vtEnd ;
|
||||||
|
TrimmingInterval()
|
||||||
|
: dLenStart( - EPS_SMALL), dLenEnd( - EPS_SMALL), vtStart( V_INVALID), vtEnd( V_INVALID) {} ;
|
||||||
|
TrimmingInterval( double dLenS, double dLenE, const Vector3d& vtS, const Vector3d& vtE)
|
||||||
|
: dLenStart( dLenS), dLenEnd( dLenE), vtStart( vtS), vtEnd( vtE) {} ;
|
||||||
|
} ;
|
||||||
|
typedef vector<TrimmingInterval> TRIMMINGINTERVALVECTOR ;
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
GetTrimmingInterval( const IGeomDB* pGeomDB, const ICurveComposite* pCompo, const Frame3d& frCompo, int nIdS, int nIdE, TrimmingInterval& TrimmingInt)
|
||||||
|
{
|
||||||
|
// Verifico validità dei parametri
|
||||||
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
|
if ( pCompo == nullptr || ! pCompo->IsValid() || ! frCompo.IsValid())
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
// Recupero le linee di Orienting
|
||||||
|
const ICurve* pGeoCrvS = GetCurve( pGeomDB->GetGeoObj( nIdS)) ;
|
||||||
|
const ICurve* pGeoCrvE = GetCurve( pGeomDB->GetGeoObj( nIdE)) ;
|
||||||
|
if ( pGeoCrvS != nullptr && pGeoCrvE != nullptr && pGeoCrvS->IsValid() && pGeoCrvE->IsValid()) {
|
||||||
|
// Recupero i punti base e i vettori direzioni ( sono ICurveLine*, ma le tratto come ICurve* generiche)
|
||||||
|
Point3d ptS = P_INVALID ; pGeoCrvS->GetStartPoint( ptS) ; // Line1.ptStart
|
||||||
|
Point3d ptE = P_INVALID ; pGeoCrvE->GetStartPoint( ptE) ; // Line2.ptStart
|
||||||
|
Vector3d vtS = V_INVALID ; pGeoCrvS->GetStartDir( vtS) ; // Line1.vtStart
|
||||||
|
Vector3d vtE = V_INVALID ; pGeoCrvE->GetStartDir( vtE) ; // Line2.vtStart
|
||||||
|
if ( ptS.IsValid() && ptE.IsValid() && vtS.IsValid() && vtE.IsValid()) {
|
||||||
|
// Recupero il Frame delle Linee
|
||||||
|
Frame3d frCrv1, frCrv2 ;
|
||||||
|
if ( ! pGeomDB->GetGlobFrame( nIdS, frCrv1) || ! pGeomDB->GetGlobFrame( nIdE, frCrv2))
|
||||||
|
return false ;
|
||||||
|
// Porto Tali valori nel riferimento dalla Composita
|
||||||
|
Point3d ptSLoc = GetLocToLoc( ptS, frCrv1, frCompo) ;
|
||||||
|
Point3d ptELoc = GetLocToLoc( ptE, frCrv2, frCompo) ;
|
||||||
|
Vector3d vtSLoc = GetLocToLoc( vtS, frCrv1, frCompo) ;
|
||||||
|
Vector3d vtELoc = GetLocToLoc( vtE, frCrv2, frCompo) ;
|
||||||
|
// Recupero il parametro sulla curva
|
||||||
|
double dParS = - EPS_PARAM, dParE = - EPS_PARAM ;
|
||||||
|
int nFlag = 0 ;
|
||||||
|
if ( DistPointCurve( ptSLoc, *pCompo).GetParamAtMinDistPoint( EPS_SMALL, dParS, nFlag) &&
|
||||||
|
DistPointCurve( ptELoc, *pCompo).GetParamAtMinDistPoint( EPS_SMALL, dParE, nFlag)) {
|
||||||
|
// Recupero la lunghezza su tale curva
|
||||||
|
double dLenS = - EPS_SMALL, dLenE = - EPS_SMALL ;
|
||||||
|
if ( pCompo->GetLengthAtParam( dParS, dLenS) && pCompo->GetLengthAtParam( dParE, dLenE)) {
|
||||||
|
TrimmingInt = TrimmingInterval( dLenS, dLenE, vtSLoc, vtELoc) ;
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
Exe5AxTrimmingModifyToolDir( int nCrvId, int nPathId, int nTrimLayId, const INTVECTOR& vnOrientingId, const INTVECTOR& vnOrientingISId,
|
||||||
|
const INTVECTOR& vnOrientingSId, const INTVECTOR& vnOrientingEId, const INTVECTOR& vnOrientingIEId)
|
||||||
|
{
|
||||||
|
// Verifica database geometrico
|
||||||
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
|
|
||||||
|
// Verifico validità dei parametri
|
||||||
|
bool bOk = ( nCrvId != GDB_ID_NULL && nPathId != GDB_ID_NULL && nTrimLayId != GDB_ID_NULL &&
|
||||||
|
ssize( vnOrientingId) == ssize( vnOrientingISId) && ssize( vnOrientingISId) == ssize( vnOrientingSId) &&
|
||||||
|
ssize( vnOrientingSId) == ssize( vnOrientingEId) && ssize( vnOrientingEId) == ssize( vnOrientingIEId)) ;
|
||||||
|
|
||||||
|
// Recupero la curva di Bordo e la sua composit associata
|
||||||
|
const ICurve* pCrvBorder = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ;
|
||||||
|
bOk = bOk && ( pCrvBorder != nullptr && pCrvBorder->IsValid()) ;
|
||||||
|
PtrOwner<ICurveComposite> pCompoBorder( nullptr) ;
|
||||||
|
if ( bOk)
|
||||||
|
bOk = ( pCompoBorder.Set( ConvertCurveToComposite( pCrvBorder->Clone())) && pCompoBorder->IsValid()) ;
|
||||||
|
double dLen = - EPS_SMALL ;
|
||||||
|
if ( bOk)
|
||||||
|
bOk = pCompoBorder->GetLength( dLen) ;
|
||||||
|
|
||||||
|
// Recupero il Frame della curva corrente
|
||||||
|
Frame3d frCompo ;
|
||||||
|
bOk = bOk && ( pGeomDB->GetGlobFrame( nCrvId, frCompo)) ;
|
||||||
|
|
||||||
|
// Recupero i versori di interpolazione e creo dei gruppi
|
||||||
|
TRIMMINGINTERVALVECTOR vInterval ; vInterval.reserve( 3 * ssize( vnOrientingId)) ;
|
||||||
|
for ( int i = 0 ; bOk && i < ssize( vnOrientingId) ; ++ i) {
|
||||||
|
// Se presente Interpolazione iniziale
|
||||||
|
if ( vnOrientingISId[i] != GDB_ID_NULL && vnOrientingSId[i] != GDB_ID_NULL) {
|
||||||
|
TrimmingInterval myTrimInt ;
|
||||||
|
if ( GetTrimmingInterval( pGeomDB, pCompoBorder, frCompo, vnOrientingISId[i], vnOrientingSId[i], myTrimInt))
|
||||||
|
vInterval.emplace_back( myTrimInt) ;
|
||||||
|
}
|
||||||
|
// Interpolazione ( deve essere sempre presente, ma per scrupolo si controlla lo stesso)
|
||||||
|
if ( vnOrientingSId[i] != GDB_ID_NULL && vnOrientingEId[i] != GDB_ID_NULL) {
|
||||||
|
TrimmingInterval myTrimInt ;
|
||||||
|
if ( GetTrimmingInterval( pGeomDB, pCompoBorder, frCompo, vnOrientingSId[i], vnOrientingEId[i], myTrimInt))
|
||||||
|
vInterval.emplace_back( myTrimInt) ;
|
||||||
|
}
|
||||||
|
// Se presente Interpolazione finale
|
||||||
|
if ( vnOrientingEId[i] != GDB_ID_NULL && vnOrientingIEId[i] != GDB_ID_NULL) {
|
||||||
|
TrimmingInterval myTrimInt ;
|
||||||
|
if ( GetTrimmingInterval( pGeomDB, pCompoBorder, frCompo, vnOrientingEId[i], vnOrientingIEId[i], myTrimInt))
|
||||||
|
vInterval.emplace_back( myTrimInt) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Se ho degli intervalli di Interpolazione
|
||||||
|
if ( ! vInterval.empty()) {
|
||||||
|
// Scorro i vettori presenti nel Layer ausiliario della lavorazione
|
||||||
|
int nId = pGeomDB->GetFirstInGroup( nPathId) ;
|
||||||
|
while ( bOk && nId != GDB_ID_NULL) {
|
||||||
|
IGeoVector3d* vGeo = GetGeoVector3d( pGeomDB->GetGeoObj( nId)) ;
|
||||||
|
if ( vGeo != nullptr && vGeo->IsValid()) {
|
||||||
|
// Recupero i parametri di tale vettore
|
||||||
|
Point3d ptBase = vGeo->GetBase() ;
|
||||||
|
Vector3d vtDirV = V_INVALID ; ;
|
||||||
|
if ( pGeomDB->GetInfo( nId, "DirV", vtDirV) && vtDirV.IsValid()) {
|
||||||
|
// Recupero la lunghezza associata al Punto di Base sulla Compo
|
||||||
|
double dCurrPar = - EPS_SMALL ;
|
||||||
|
int nFlag = 0 ;
|
||||||
|
if ( DistPointCurve( ptBase, *pCompoBorder).GetParamAtMinDistPoint( 0., dCurrPar, nFlag)) {
|
||||||
|
double dCurrLen = - EPS_SMALL ;
|
||||||
|
if ( pCompoBorder->GetLengthAtParam( dCurrPar, dCurrLen)) {
|
||||||
|
for ( const TrimmingInterval& CurrInterval : vInterval) {
|
||||||
|
// Controlli per Intervalli a cavallo dei punti iniziali e finali della curva
|
||||||
|
double dLenA = CurrInterval.dLenStart ;
|
||||||
|
double dLenB = CurrInterval.dLenEnd ;
|
||||||
|
double dLenC = dCurrLen ;
|
||||||
|
if ( dLenA > dLenB) {
|
||||||
|
dLenB += dLen ;
|
||||||
|
if ( dLenC < CurrInterval.dLenStart - EPS_SMALL)
|
||||||
|
dLenC += dLen ;
|
||||||
|
}
|
||||||
|
// Se l'intervallo non è troppo piccolo e se sono all'interno di tale Intervallo
|
||||||
|
if ( dLenB - dLenA > 10. * EPS_SMALL && /* bastava anche 2 * EPS_SMALL */
|
||||||
|
dLenA + EPS_SMALL < dLenC && dLenC < dLenB + EPS_SMALL /* estremi esclusi, va bene ? */) {
|
||||||
|
// Media pesata dei due vettori
|
||||||
|
double dMeanPar = ( dLenC - dLenA) / ( dLenB - dLenA) ;
|
||||||
|
Vector3d vtMean = Media( CurrInterval.vtStart, CurrInterval.vtEnd, dMeanPar) ;
|
||||||
|
// Assegno la Info a tale vettore
|
||||||
|
pGeomDB->SetInfo( nId, "DirV", vtMean) ;
|
||||||
|
break ; // non controllo altri intervalli
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nId = pGeomDB->GetNext( nId) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ExeSetModified() ;
|
||||||
|
// Se richiesto, salvo il comando Lua equivalente
|
||||||
|
if ( IsCmdLog()) {
|
||||||
|
string sLua = "EgtTrimmingGetToolOrientationLines(" + ToString( nCrvId) + "," +
|
||||||
|
ToString( nPathId) + "," +
|
||||||
|
ToString( nTrimLayId) + "," +
|
||||||
|
ToString( vnOrientingId) + "," +
|
||||||
|
ToString( vnOrientingISId) + "," +
|
||||||
|
ToString( vnOrientingSId) + "," +
|
||||||
|
ToString( vnOrientingEId) + "," +
|
||||||
|
ToString( vnOrientingIEId) + "," +
|
||||||
|
" -- bOk=" + ToString( bOk) ;
|
||||||
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bOk ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
int
|
||||||
|
ExeRegolarizeSurfaceLocally( int nParentId, int nSurfId, int nSyncStartId, int nSyncEndId, double dLinTol, int nType)
|
||||||
{
|
{
|
||||||
bool bOk = true ;
|
|
||||||
// Verifica database geometrico
|
// Verifica database geometrico
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
@@ -889,7 +1421,7 @@ ExeRegolarizeSurfaceLocally( int nParentId, int nSurfId, int nSyncStartId, int n
|
|||||||
Point3d ptE2 ; pSyncEnd->GetEndPoint( ptE2) ;
|
Point3d ptE2 ; pSyncEnd->GetEndPoint( ptE2) ;
|
||||||
BIPOINT bpIsoEnd( ptS2, ptE2) ;
|
BIPOINT bpIsoEnd( ptS2, ptE2) ;
|
||||||
|
|
||||||
PtrOwner<ISurfBezier> pNewSurf( RegolarizeBordersLocally( pSurfBez, bpIsoStart, bpIsoEnd, dLinTol)) ;
|
PtrOwner<ISurfBezier> pNewSurf( RegolarizeBordersLocally( pSurfBez, bpIsoStart, bpIsoEnd, dLinTol, nType)) ;
|
||||||
if ( IsNull( pNewSurf))
|
if ( IsNull( pNewSurf))
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pNewSurf)) ;
|
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pNewSurf)) ;
|
||||||
|
|||||||
Binary file not shown.
@@ -228,7 +228,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClInclude Include="..\Include\EXeConst.h" />
|
<ClInclude Include="..\Include\EXeConst.h" />
|
||||||
<ClInclude Include="..\Include\EXeDllMain.h" />
|
<ClInclude Include="..\Include\EXeDllMain.h" />
|
||||||
<ClInclude Include="..\Include\EXeExecutor.h" />
|
<ClInclude Include="..\Include\EXeExecutor.h" />
|
||||||
<ClInclude Include="AuxDialogBox.h" />
|
|
||||||
<ClInclude Include="DllExch3dm.h" />
|
<ClInclude Include="DllExch3dm.h" />
|
||||||
<ClInclude Include="DllMain.h" />
|
<ClInclude Include="DllMain.h" />
|
||||||
<ClInclude Include="DllNesting.h" />
|
<ClInclude Include="DllNesting.h" />
|
||||||
@@ -250,7 +249,6 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="AuxDialogBox.cpp" />
|
|
||||||
<ClCompile Include="DllExch3dm.cpp" />
|
<ClCompile Include="DllExch3dm.cpp" />
|
||||||
<ClCompile Include="DllNesting.cpp" />
|
<ClCompile Include="DllNesting.cpp" />
|
||||||
<ClCompile Include="EXE_Base64.cpp" />
|
<ClCompile Include="EXE_Base64.cpp" />
|
||||||
|
|||||||
@@ -111,9 +111,6 @@
|
|||||||
<ClInclude Include="DllExch3dm.h">
|
<ClInclude Include="DllExch3dm.h">
|
||||||
<Filter>File di intestazione</Filter>
|
<Filter>File di intestazione</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="AuxDialogBox.h">
|
|
||||||
<Filter>File di intestazione</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="LUA_Exchange.cpp">
|
<ClCompile Include="LUA_Exchange.cpp">
|
||||||
@@ -434,9 +431,6 @@
|
|||||||
<ClCompile Include="LUA_Base64.cpp">
|
<ClCompile Include="LUA_Base64.cpp">
|
||||||
<Filter>File di origine\LUA</Filter>
|
<Filter>File di origine\LUA</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="AuxDialogBox.cpp">
|
|
||||||
<Filter>File di origine\Global</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="EgtExecutor.rc">
|
<ResourceCompile Include="EgtExecutor.rc">
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ AdjustId( int nId, int nCtx)
|
|||||||
Vector3d
|
Vector3d
|
||||||
GetVectorLocal( IGeomDB* pGeomDB, const Vector3d& vtV, int nRefType, const Frame3d& frLoc)
|
GetVectorLocal( IGeomDB* pGeomDB, const Vector3d& vtV, int nRefType, const Frame3d& frLoc)
|
||||||
{
|
{
|
||||||
|
if ( ! vtV.IsValid())
|
||||||
|
return vtV ;
|
||||||
Vector3d vtVL( vtV) ;
|
Vector3d vtVL( vtV) ;
|
||||||
if ( nRefType == RTY_GLOB)
|
if ( nRefType == RTY_GLOB)
|
||||||
vtVL.ToLoc( frLoc) ;
|
vtVL.ToLoc( frLoc) ;
|
||||||
@@ -50,6 +52,8 @@ GetVectorLocal( IGeomDB* pGeomDB, const Vector3d& vtV, int nRefType, const Frame
|
|||||||
Vector3d
|
Vector3d
|
||||||
GetVectorInRef( IGeomDB* pGeomDB, const Vector3d& vtV, const Frame3d& frLoc, int nRefType)
|
GetVectorInRef( IGeomDB* pGeomDB, const Vector3d& vtV, const Frame3d& frLoc, int nRefType)
|
||||||
{
|
{
|
||||||
|
if ( ! vtV.IsValid())
|
||||||
|
return vtV ;
|
||||||
Vector3d vtVL( vtV) ;
|
Vector3d vtVL( vtV) ;
|
||||||
if ( nRefType == RTY_GLOB)
|
if ( nRefType == RTY_GLOB)
|
||||||
vtVL.ToGlob( frLoc) ;
|
vtVL.ToGlob( frLoc) ;
|
||||||
@@ -62,6 +66,8 @@ GetVectorInRef( IGeomDB* pGeomDB, const Vector3d& vtV, const Frame3d& frLoc, int
|
|||||||
Point3d
|
Point3d
|
||||||
GetPointLocal( IGeomDB* pGeomDB, const Point3d& ptP, int nRefType, const Frame3d& frLoc)
|
GetPointLocal( IGeomDB* pGeomDB, const Point3d& ptP, int nRefType, const Frame3d& frLoc)
|
||||||
{
|
{
|
||||||
|
if ( ! ptP.IsValid())
|
||||||
|
return ptP ;
|
||||||
Point3d ptPL( ptP) ;
|
Point3d ptPL( ptP) ;
|
||||||
if ( nRefType == RTY_GLOB)
|
if ( nRefType == RTY_GLOB)
|
||||||
ptPL.ToLoc( frLoc) ;
|
ptPL.ToLoc( frLoc) ;
|
||||||
@@ -74,6 +80,8 @@ GetPointLocal( IGeomDB* pGeomDB, const Point3d& ptP, int nRefType, const Frame3d
|
|||||||
Point3d
|
Point3d
|
||||||
GetPointInRef( IGeomDB* pGeomDB, const Point3d& ptP, const Frame3d& frLoc, int nRefType)
|
GetPointInRef( IGeomDB* pGeomDB, const Point3d& ptP, const Frame3d& frLoc, int nRefType)
|
||||||
{
|
{
|
||||||
|
if ( ! ptP.IsValid())
|
||||||
|
return ptP ;
|
||||||
Point3d ptPL( ptP) ;
|
Point3d ptPL( ptP) ;
|
||||||
if ( nRefType == RTY_GLOB)
|
if ( nRefType == RTY_GLOB)
|
||||||
ptPL.ToGlob( frLoc) ;
|
ptPL.ToGlob( frLoc) ;
|
||||||
|
|||||||
@@ -805,7 +805,7 @@ LuaCreateSurfTmSwept( lua_State* L)
|
|||||||
int nGuideId ;
|
int nGuideId ;
|
||||||
LuaCheckParam( L, 3, nGuideId)
|
LuaCheckParam( L, 3, nGuideId)
|
||||||
int nPar = 4 ;
|
int nPar = 4 ;
|
||||||
Vector3d vtAx = V_NULL ;
|
Vector3d vtAx = V_INVALID ;
|
||||||
if ( LuaGetParam( L, nPar, vtAx))
|
if ( LuaGetParam( L, nPar, vtAx))
|
||||||
++ nPar ;
|
++ nPar ;
|
||||||
bool bCapEnds ;
|
bool bCapEnds ;
|
||||||
|
|||||||
+13
-9
@@ -409,7 +409,7 @@ LuaTrimExtendCurveByLen( lua_State* L)
|
|||||||
int nRefType = RTY_DEFAULT ;
|
int nRefType = RTY_DEFAULT ;
|
||||||
LuaGetParam( L, 4, nRefType) ;
|
LuaGetParam( L, 4, nRefType) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// taglio o allungo la curva nell'estremo più vicino al punto
|
// taglio o allungo la curva nell'estremo più vicino al punto
|
||||||
bool bOk = ExeTrimExtendCurveByLen( nId, dLen, ptNear, nRefType) ;
|
bool bOk = ExeTrimExtendCurveByLen( nId, dLen, ptNear, nRefType) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
@@ -943,7 +943,7 @@ LuaCurveCompoSetTempProp( lua_State* L)
|
|||||||
int nPropInd = 0 ;
|
int nPropInd = 0 ;
|
||||||
LuaGetParam( L, 4, nPropInd) ;
|
LuaGetParam( L, 4, nPropInd) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// imposto sulla curva della composita la proprietà temporanea
|
// imposto sulla curva della composita la proprietà temporanea
|
||||||
bool bOk = ExeCurveCompoSetTempProp( nId, nCrv, nProp, nPropInd) ;
|
bool bOk = ExeCurveCompoSetTempProp( nId, nCrv, nProp, nPropInd) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
@@ -973,16 +973,18 @@ LuaCurveCompoSetTempParam( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaChainCurvesInGroup( lua_State* L)
|
LuaChainCurvesInGroup( lua_State* L)
|
||||||
{
|
{
|
||||||
// 2 o 3 parametri : nGroupId, ptNear [, nRefType]
|
// 2, 3 o 4 parametri : nGroupId, ptNear [, nRefType] [, dToler]
|
||||||
int nGroupId ;
|
int nGroupId ;
|
||||||
LuaCheckParam( L, 1, nGroupId)
|
LuaCheckParam( L, 1, nGroupId)
|
||||||
Point3d ptNear ;
|
Point3d ptNear ;
|
||||||
LuaCheckParam( L, 2, ptNear)
|
LuaCheckParam( L, 2, ptNear)
|
||||||
int nRefType = RTY_DEFAULT ;
|
int nRefType = RTY_DEFAULT ;
|
||||||
LuaGetParam( L, 3, nRefType) ;
|
LuaGetParam( L, 3, nRefType) ;
|
||||||
|
double dToler = 10 * EPS_SMALL ;
|
||||||
|
LuaGetParam( L, 4, dToler) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// concateno le curve nel gruppo (senza fonderle in una curva composita)
|
// concateno le curve nel gruppo (senza fonderle in una curva composita)
|
||||||
bool bOk = ExeChainCurvesInGroup( nGroupId, ptNear, nRefType) ;
|
bool bOk = ExeChainCurvesInGroup( nGroupId, ptNear, nRefType, dToler) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
@@ -991,16 +993,18 @@ LuaChainCurvesInGroup( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaReorderCurvesInGroup( lua_State* L)
|
LuaReorderCurvesInGroup( lua_State* L)
|
||||||
{
|
{
|
||||||
// 2 o 3 parametri : nGroupId, ptNear [, nRefType]
|
// 2, 3 o 4 parametri : nGroupId, ptNear [, nRefType] [, dToler]
|
||||||
int nGroupId ;
|
int nGroupId ;
|
||||||
LuaCheckParam( L, 1, nGroupId)
|
LuaCheckParam( L, 1, nGroupId)
|
||||||
Point3d ptNear ;
|
Point3d ptNear ;
|
||||||
LuaCheckParam( L, 2, ptNear)
|
LuaCheckParam( L, 2, ptNear)
|
||||||
int nRefType = RTY_DEFAULT ;
|
int nRefType = RTY_DEFAULT ;
|
||||||
LuaGetParam( L, 3, nRefType) ;
|
LuaGetParam( L, 3, nRefType) ;
|
||||||
|
double dToler = 10 * EPS_SMALL ;
|
||||||
|
LuaGetParam( L, 4, dToler) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// riordino le curve nel gruppo (senza fonderle in una curva composita)
|
// riordino le curve nel gruppo (senza fonderle in una curva composita)
|
||||||
bool bOk = ExeReorderCurvesInGroup( nGroupId, ptNear, nRefType) ;
|
bool bOk = ExeReorderCurvesInGroup( nGroupId, ptNear, nRefType, dToler) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
@@ -1021,7 +1025,7 @@ LuaProjectCurveOnSurf( lua_State* L)
|
|||||||
if ( LuaGetParam( L, 4, dLinTol))
|
if ( LuaGetParam( L, 4, dLinTol))
|
||||||
LuaGetParam( L, 5, dMaxSegmLen) ;
|
LuaGetParam( L, 5, dMaxSegmLen) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// proietto la curva su una o più superfici a minima distanza
|
// proietto la curva su una o più superfici a minima distanza
|
||||||
bool bOk = ExeProjectCurveOnSurf( nCurveId, vSurfId, nDestGrpId, dLinTol, dMaxSegmLen) ;
|
bool bOk = ExeProjectCurveOnSurf( nCurveId, vSurfId, nDestGrpId, dLinTol, dMaxSegmLen) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
@@ -1051,7 +1055,7 @@ LuaProjectCurveOnSurfDir( lua_State* L)
|
|||||||
LuaGetParam( L, 8, bFromVsTo))
|
LuaGetParam( L, 8, bFromVsTo))
|
||||||
LuaGetParam( L, 9, nRefType) ;
|
LuaGetParam( L, 9, nRefType) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// proietto la curva su una o più superfici secondo la direzione data
|
// proietto la curva su una o più superfici secondo la direzione data
|
||||||
bool bOk = ExeProjectCurveOnSurfDir( nCurveId, vSurfId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, bFromVsTo, nRefType) ;
|
bool bOk = ExeProjectCurveOnSurfDir( nCurveId, vSurfId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, bFromVsTo, nRefType) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
@@ -1079,7 +1083,7 @@ LuaProjectCurveOnSurfExt( lua_State* L)
|
|||||||
LuaGetParam( L, 7, bDirFromGuide))
|
LuaGetParam( L, 7, bDirFromGuide))
|
||||||
LuaGetParam( L, 8, bFromVsTo) ;
|
LuaGetParam( L, 8, bFromVsTo) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// proietto la curva su una o più superfici secondo la direzione verso la guida
|
// proietto la curva su una o più superfici secondo la direzione verso la guida
|
||||||
bool bOk = ExeProjectCurveOnSurfExt( nCurveId, vSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide, bFromVsTo) ;
|
bool bOk = ExeProjectCurveOnSurfExt( nCurveId, vSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide, bFromVsTo) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
|
|||||||
+8
-493
@@ -18,7 +18,6 @@
|
|||||||
#include "LUA.h"
|
#include "LUA.h"
|
||||||
#include "GenTools.h"
|
#include "GenTools.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "AuxDialogBox.h"
|
|
||||||
#include "/EgtDev/Include/ExeExecutor.h"
|
#include "/EgtDev/Include/ExeExecutor.h"
|
||||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||||
@@ -1213,39 +1212,22 @@ LuaReleaseMutex( lua_State* L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
// =================================== DIALOG ===================================
|
const int MAX_CTRLS = IDC_TEXT8 -IDC_TEXT1 + 1 ;
|
||||||
// Variabili Globali
|
|
||||||
const int OFFS_CTRLS = 40 ;
|
const int OFFS_CTRLS = 40 ;
|
||||||
enum TYPE_CTRLS { CTRL_NONE = 0, CTRL_CHECK = 1, CTRL_COMBO = 2, CTRL_EDIT = 3, CTRL_COLOR = 4, CTRL_BUTTON = 5} ;
|
enum TYPE_CTRLS { CTRL_NONE = 0, CTRL_CHECK = 1, CTRL_COMBO = 2, CTRL_EDIT = 3, CTRL_COLOR = 4} ;
|
||||||
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 int s_nCtrls = 0 ;
|
||||||
static string s_sCaption ;
|
static string s_sCaption ;
|
||||||
static string s_sText[MAX_CTRLS] ;
|
static string s_sText[MAX_CTRLS] ;
|
||||||
static string s_sEdit[MAX_CTRLS] ;
|
static string s_sEdit[MAX_CTRLS] ;
|
||||||
static int s_nType[MAX_CTRLS] ;
|
static int s_nType[MAX_CTRLS] ;
|
||||||
|
static COLORREF s_CustomColors[16] = {12632256} ; // 16 colori GRAY
|
||||||
// Dialogo non modale
|
static bool s_bCustomColorsInit = false ; // flag di inizializzazione colori
|
||||||
const int MAX_CTRLS_ML = IDC_TEXT_ML_8 - IDC_TEXT_ML_1 + 1 ;
|
const char* SEC_SCENE = "Scene" ;
|
||||||
static int s_nCtrls_ML = 0 ;
|
const char* KEY_CUSTOMCOLORS = "CustomColors" ;
|
||||||
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
|
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
|
// variabili static locali per mantenere lo stato tra chiamate per selezione colori
|
||||||
static COLORREF selectedColor[MAX_CTRLS] = {0} ; // BLACK
|
static COLORREF selectedColor[MAX_CTRLS] = {0} ; // BLACK
|
||||||
@@ -1525,408 +1507,6 @@ CALLBACK DialogBoxProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam
|
|||||||
return FALSE ;
|
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_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 ;
|
|
||||||
}
|
|
||||||
// rimuovo finestra e annullo il contesto
|
|
||||||
DestroyWindow( hwndDlg) ;
|
|
||||||
phDlgModeless = nullptr ;
|
|
||||||
nDlgModelessItem = -1 ;
|
|
||||||
return TRUE ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return FALSE ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaDialogBox( lua_State* L)
|
LuaDialogBox( lua_State* L)
|
||||||
@@ -1966,71 +1546,6 @@ LuaDialogBox( lua_State* L)
|
|||||||
return 1 ;
|
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
|
bool
|
||||||
LuaInstallGeneral( LuaMgr& luaMgr)
|
LuaInstallGeneral( LuaMgr& luaMgr)
|
||||||
@@ -2092,6 +1607,6 @@ LuaInstallGeneral( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateMutex", LuaCreateMutex) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateMutex", LuaCreateMutex) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtReleaseMutex", LuaReleaseMutex) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtReleaseMutex", LuaReleaseMutex) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBoxModeless", LuaDialogBoxModeless) ;
|
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -504,6 +504,7 @@ LuaGetNextRawPart( lua_State* L)
|
|||||||
LuaSetParam( L) ;
|
LuaSetParam( L) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaAddRawPart( lua_State* L)
|
LuaAddRawPart( lua_State* L)
|
||||||
@@ -530,6 +531,28 @@ LuaAddRawPart( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaAddRawPartGen( lua_State* L)
|
||||||
|
{
|
||||||
|
// 3 parametri : nCrvSrfId, dOverMat, Color
|
||||||
|
int nCrvSrfId ;
|
||||||
|
LuaCheckParam( L, 1, nCrvSrfId)
|
||||||
|
double dOverMat ;
|
||||||
|
LuaCheckParam( L, 2, dOverMat)
|
||||||
|
Color cCol ;
|
||||||
|
LuaCheckParam( L, 3, cCol)
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// inserisco il grezzo nella macchinata corrente
|
||||||
|
int nInd = ExeAddRawPartGen( nCrvSrfId, dOverMat, cCol) ;
|
||||||
|
// restituisco il risultato
|
||||||
|
if ( nInd != GDB_ID_NULL)
|
||||||
|
LuaSetParam( L, nInd) ;
|
||||||
|
else
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaAddRawPartWithPart( lua_State* L)
|
LuaAddRawPartWithPart( lua_State* L)
|
||||||
@@ -4584,6 +4607,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstRawPart", LuaGetFirstRawPart) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstRawPart", LuaGetFirstRawPart) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextRawPart", LuaGetNextRawPart) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextRawPart", LuaGetNextRawPart) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPart", LuaAddRawPart) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPart", LuaAddRawPart) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPartGen", LuaAddRawPartGen) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPartWithPart", LuaAddRawPartWithPart) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPartWithPart", LuaAddRawPartWithPart) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPart", LuaModifyRawPart) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPart", LuaModifyRawPart) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPartSize", LuaModifyRawPartSize) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPartSize", LuaModifyRawPartSize) ;
|
||||||
|
|||||||
+80
-1
@@ -283,6 +283,80 @@ LuaTrimmingGetSurfBzSyncPoints( lua_State* L)
|
|||||||
return 3 ;
|
return 3 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaTrimmingGetToolOrientationLines( lua_State* L)
|
||||||
|
{
|
||||||
|
// 13 parametri : nParentId, nMainEdgeId, nOtherEdgeId, nSyncLayerId, nLineSId, nLineEId,
|
||||||
|
// dThetaStart, dPhiStart, dThetaEnd, dPhiEnd, dInterpLenS, dInterpLenE, dLinTol
|
||||||
|
int nParentId ;
|
||||||
|
LuaCheckParam( L, 1, nParentId)
|
||||||
|
int nMainEdgeId ;
|
||||||
|
LuaCheckParam( L, 2, nMainEdgeId)
|
||||||
|
int nOtherEdgeId ;
|
||||||
|
LuaCheckParam( L, 3, nOtherEdgeId)
|
||||||
|
int nLineSId ;
|
||||||
|
LuaCheckParam( L, 4, nLineSId)
|
||||||
|
int nLineEId ;
|
||||||
|
LuaCheckParam( L, 5, nLineEId)
|
||||||
|
int nSyncLayerId ;
|
||||||
|
LuaCheckParam( L, 6, nSyncLayerId)
|
||||||
|
double dThetaStart ;
|
||||||
|
LuaCheckParam( L, 7, dThetaStart)
|
||||||
|
double dPhiStart ;
|
||||||
|
LuaCheckParam( L, 8, dPhiStart)
|
||||||
|
double dThetaEnd ;
|
||||||
|
LuaCheckParam( L, 9, dThetaEnd)
|
||||||
|
double dPhiEnd ;
|
||||||
|
LuaCheckParam( L, 10, dPhiEnd) ;
|
||||||
|
double dInterpLenS ;
|
||||||
|
LuaCheckParam( L, 11, dInterpLenS)
|
||||||
|
double dInterpLenE ;
|
||||||
|
LuaCheckParam( L, 12, dInterpLenE)
|
||||||
|
double dLinTol ;
|
||||||
|
LuaCheckParam( L, 13, dLinTol)
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// Inserisco i tratti lineari associati calcolati lungo il percorso
|
||||||
|
int nInterpStartId = GDB_ID_NULL, nStartId = GDB_ID_NULL, nEndId = GDB_ID_NULL, nInterpEndId = GDB_ID_NULL ;
|
||||||
|
bool bOk = ExeTrimmingGetToolOrientationLines( nParentId, nMainEdgeId, nOtherEdgeId, nSyncLayerId, nLineSId, nLineEId,
|
||||||
|
dThetaStart, dPhiStart, dThetaEnd, dPhiEnd, dInterpLenS, dInterpLenE, dLinTol,
|
||||||
|
nInterpStartId, nStartId, nEndId, nInterpEndId) ;
|
||||||
|
LuaSetParam( L, bOk) ;
|
||||||
|
LuaSetParam( L, nInterpStartId) ;
|
||||||
|
LuaSetParam( L, nStartId) ;
|
||||||
|
LuaSetParam( L, nEndId) ;
|
||||||
|
LuaSetParam( L, nInterpEndId) ;
|
||||||
|
return 5 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
Lua5AxTrimmingModifyToolDir( lua_State* L)
|
||||||
|
{
|
||||||
|
// 8 parametri : nCrvId, nAuxId, nTrimLayId, vnOrientingId, vnOrientingISId, vnOrientingSId, vnOrientingEId, vnOrientingIEId
|
||||||
|
int nCrvId ;
|
||||||
|
LuaCheckParam( L, 1, nCrvId)
|
||||||
|
int nPathId ;
|
||||||
|
LuaCheckParam( L, 2, nPathId)
|
||||||
|
int nTrimLayId ;
|
||||||
|
LuaCheckParam( L, 3, nTrimLayId)
|
||||||
|
INTVECTOR vnOrientingId ;
|
||||||
|
LuaCheckParam( L, 4, vnOrientingId)
|
||||||
|
INTVECTOR vnOrientingISId ;
|
||||||
|
LuaCheckParam( L, 5, vnOrientingISId)
|
||||||
|
INTVECTOR vnOrientingSId ;
|
||||||
|
LuaCheckParam( L, 6, vnOrientingSId)
|
||||||
|
INTVECTOR vnOrientingEId ;
|
||||||
|
LuaCheckParam( L, 7, vnOrientingEId)
|
||||||
|
INTVECTOR vnOrientingIEId ;
|
||||||
|
LuaCheckParam( L, 8, vnOrientingIEId) ;
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// Modifico le Direzioni utensile
|
||||||
|
bool bOk = Exe5AxTrimmingModifyToolDir( nCrvId, nPathId, nTrimLayId, vnOrientingId, vnOrientingISId, vnOrientingSId, vnOrientingEId, vnOrientingIEId) ;
|
||||||
|
LuaSetParam( L, bOk) ;
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaRegolarizeSurfaceLocally( lua_State* L)
|
LuaRegolarizeSurfaceLocally( lua_State* L)
|
||||||
@@ -297,8 +371,10 @@ LuaRegolarizeSurfaceLocally( lua_State* L)
|
|||||||
LuaCheckParam( L, 4, nSyncEndId)
|
LuaCheckParam( L, 4, nSyncEndId)
|
||||||
double dLinTol ;
|
double dLinTol ;
|
||||||
LuaCheckParam( L, 5, dLinTol)
|
LuaCheckParam( L, 5, dLinTol)
|
||||||
|
int nType = 0 ;
|
||||||
|
LuaCheckParam( L, 6, nType)
|
||||||
|
|
||||||
int nId = ExeRegolarizeSurfaceLocally( nParentId, nSurfId, nSyncStartId, nSyncEndId, dLinTol) ;
|
int nId = ExeRegolarizeSurfaceLocally( nParentId, nSurfId, nSyncStartId, nSyncEndId, dLinTol, nType) ;
|
||||||
LuaSetParam( L, nId) ;
|
LuaSetParam( L, nId) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
@@ -322,6 +398,9 @@ LuaInstallTrimming( LuaMgr& luaMgr)
|
|||||||
// --- Recupero linee di sincronizzazione
|
// --- Recupero linee di sincronizzazione
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingInterpolateSyncLines", LuaTrimmingInterpolateSyncLines) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingInterpolateSyncLines", LuaTrimmingInterpolateSyncLines) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetSurfBzSyncPoints", LuaTrimmingGetSurfBzSyncPoints) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetSurfBzSyncPoints", LuaTrimmingGetSurfBzSyncPoints) ;
|
||||||
|
// --- Recupero linee di Orientamento dell'Utensile e Modifica della lavorazione 5Ax
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetToolOrientationLines", LuaTrimmingGetToolOrientationLines) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "Egt5AxTrimmingModifyToolDir", Lua5AxTrimmingModifyToolDir) ;
|
||||||
// --- Modifica della superficie
|
// --- Modifica della superficie
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRegolarizeSurfaceLocally", LuaRegolarizeSurfaceLocally) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtRegolarizeSurfaceLocally", LuaRegolarizeSurfaceLocally) ;
|
||||||
return bOk ;
|
return bOk ;
|
||||||
|
|||||||
+4
-60
@@ -1,13 +1,10 @@
|
|||||||
//{{NO_DEPENDENCIES}}
|
//{{NO_DEPENDENCIES}}
|
||||||
// File di inclusione generato con Microsoft Visual C++.
|
// Microsoft Visual C++ generated include file.
|
||||||
// Utilizzato da EgtExecutor.rc
|
// Used by EgtExecutor.rc
|
||||||
//
|
//
|
||||||
#define VS_VERSION_INFO 1
|
#define VS_VERSION_INFO 1
|
||||||
|
|
||||||
#define IDD_LUADLG 101
|
#define IDD_LUADLG 101
|
||||||
#define IDD_LUASCENE 102
|
#define IDD_LUASCENE 102
|
||||||
#define IDD_LUADLG_ML 103
|
|
||||||
|
|
||||||
#define IDC_TEXT1 1001
|
#define IDC_TEXT1 1001
|
||||||
#define IDC_TEXT2 1002
|
#define IDC_TEXT2 1002
|
||||||
#define IDC_TEXT3 1003
|
#define IDC_TEXT3 1003
|
||||||
@@ -16,7 +13,6 @@
|
|||||||
#define IDC_TEXT6 1006
|
#define IDC_TEXT6 1006
|
||||||
#define IDC_TEXT7 1007
|
#define IDC_TEXT7 1007
|
||||||
#define IDC_TEXT8 1008
|
#define IDC_TEXT8 1008
|
||||||
|
|
||||||
#define IDC_EDIT1 1011
|
#define IDC_EDIT1 1011
|
||||||
#define IDC_EDIT2 1012
|
#define IDC_EDIT2 1012
|
||||||
#define IDC_EDIT3 1013
|
#define IDC_EDIT3 1013
|
||||||
@@ -25,7 +21,6 @@
|
|||||||
#define IDC_EDIT6 1016
|
#define IDC_EDIT6 1016
|
||||||
#define IDC_EDIT7 1017
|
#define IDC_EDIT7 1017
|
||||||
#define IDC_EDIT8 1018
|
#define IDC_EDIT8 1018
|
||||||
|
|
||||||
#define IDC_COMBO1 1021
|
#define IDC_COMBO1 1021
|
||||||
#define IDC_COMBO2 1022
|
#define IDC_COMBO2 1022
|
||||||
#define IDC_COMBO3 1023
|
#define IDC_COMBO3 1023
|
||||||
@@ -34,7 +29,6 @@
|
|||||||
#define IDC_COMBO6 1026
|
#define IDC_COMBO6 1026
|
||||||
#define IDC_COMBO7 1027
|
#define IDC_COMBO7 1027
|
||||||
#define IDC_COMBO8 1028
|
#define IDC_COMBO8 1028
|
||||||
|
|
||||||
#define IDC_CHECK1 1031
|
#define IDC_CHECK1 1031
|
||||||
#define IDC_CHECK2 1032
|
#define IDC_CHECK2 1032
|
||||||
#define IDC_CHECK3 1033
|
#define IDC_CHECK3 1033
|
||||||
@@ -43,7 +37,6 @@
|
|||||||
#define IDC_CHECK6 1036
|
#define IDC_CHECK6 1036
|
||||||
#define IDC_CHECK7 1037
|
#define IDC_CHECK7 1037
|
||||||
#define IDC_CHECK8 1038
|
#define IDC_CHECK8 1038
|
||||||
|
|
||||||
#define IDC_COLOR1 1041
|
#define IDC_COLOR1 1041
|
||||||
#define IDC_COLOR2 1042
|
#define IDC_COLOR2 1042
|
||||||
#define IDC_COLOR3 1043
|
#define IDC_COLOR3 1043
|
||||||
@@ -52,64 +45,15 @@
|
|||||||
#define IDC_COLOR6 1046
|
#define IDC_COLOR6 1046
|
||||||
#define IDC_COLOR7 1047
|
#define IDC_COLOR7 1047
|
||||||
#define IDC_COLOR8 1048
|
#define IDC_COLOR8 1048
|
||||||
|
|
||||||
#define IDC_PICTURE1 1101
|
#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
|
// Next default values for new objects
|
||||||
//
|
//
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 105
|
#define _APS_NEXT_RESOURCE_VALUE 103
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1072
|
#define _APS_NEXT_CONTROL_VALUE 1030
|
||||||
#define _APS_NEXT_SYMED_VALUE 115
|
#define _APS_NEXT_SYMED_VALUE 115
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user