Trimming 3.1b1 :
- migliorata la gestione dei colori ( rimozione passaggi con esadecimali) - aggiunta la funzione di Undo per le curve di sincronizzazione per interpolazione.
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -65,7 +65,7 @@ end
|
||||
local nFirstId = GDB_ID.NULL
|
||||
local nCount = 0
|
||||
bOk, nFirstId, nCount = EgtTrimmingInterpolateSyncLines( nLayerEditId, nFirstSync, nSecondSync, vnBzCrvId[1], vnBzCrvId[2], dEdgeLinTol, dEdgeAngTol)
|
||||
if not bOk or nFirstId == GDB_ID.NULL or nCount == 0 then
|
||||
if not bOk then
|
||||
EgtOutBox( ERROR_EDIT_SYNC_CURVES .. 'Invalid Interpolation', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
end
|
||||
@@ -73,9 +73,15 @@ end
|
||||
-- Cambio il colore alle due Linee di Sincronizzaione selezionate e alle nuove calcolate
|
||||
EgtSetColor( nFirstSync, SYNC_LINE_INTERP_COLOR)
|
||||
EgtSetColor( nSecondSync, SYNC_LINE_INTERP_COLOR)
|
||||
for i = 0, nCount do
|
||||
EgtSetColor( nFirstId + i, SYNC_LINE_INTERP_COLOR)
|
||||
EgtSetName( nFirstId + i, SYNC_LINE_NAME)
|
||||
if nFirstId ~= GDB_ID.NULL and nCount > 0 then
|
||||
local vNewIds = {}
|
||||
for i = 0, nCount do
|
||||
EgtSetColor( nFirstId + i, SYNC_LINE_INTERP_COLOR)
|
||||
EgtSetName( nFirstId + i, SYNC_LINE_NAME)
|
||||
table.insert( vNewIds, nFirstId + i)
|
||||
end
|
||||
-- Memorizzo gli Id delle curve inserite
|
||||
EgtSetInfo( nLayerEditId, KEY_SYNC_LINES_INTERPOLATION_IDS, vNewIds)
|
||||
end
|
||||
|
||||
-- Metto il Focus sul Layer di Sincronizzazione delle curve
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
-- ResetInterpSyncLines.lua by Egalware s.r.l. 2026/02/23
|
||||
|
||||
require( 'EgtBase')
|
||||
_ENV = EgtProtectGlobal()
|
||||
EgtEnableDebug( false)
|
||||
|
||||
-- Carico le costanti di Trimming
|
||||
EgtAddToPackagePath( EgtGetSourceDir() .. '?.lua')
|
||||
local GlobVar = require( 'TrimmingLib')
|
||||
-- Costante di Errore
|
||||
local ERROR_EDIT_SYNC_CURVES = 'Error in Edit Sync Curves : '
|
||||
|
||||
-- Recupero il Part e Layer di Trimming corrente
|
||||
local nCurrPartId = EgtGetCurrPart()
|
||||
local nCurrLayerId = EgtGetCurrLayer()
|
||||
local nTrimmingLayer = GlobVar.GetTrimmingLayerRefId( nCurrLayerId)
|
||||
if not nTrimmingLayer or nTrimmingLayer == GDB_ID.NULL then
|
||||
EgtOutBox( ERROR_EDIT_SYNC_CURVES .. 'Not a valid Trimming Layer', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
end
|
||||
|
||||
-- Recupero il Layer di Edit
|
||||
local nLayerEditId = GlobVar.GetCurrentEditSyncCurvesLayer( nCurrPartId, nTrimmingLayer)
|
||||
if ( not nLayerEditId or nLayerEditId == GDB_ID.NULL) then
|
||||
EgtOutBox( ERROR_EDIT_SYNC_CURVES .. 'Not a valid Edit mode created', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
end
|
||||
|
||||
-- Chiedo all'Utente la conferma dell'operazione
|
||||
local bRemove = EgtOutBox( 'Do you want to remove the last Interpolated Sync Lines ?', 'Deleting', 'QUESTION', 'YESNO')
|
||||
if not bRemove then return end
|
||||
|
||||
-- Recupero le ultime Linee di Sincronizzazione aggiunte e le elimino
|
||||
local vLastSurfIds = EgtGetInfo( nLayerEditId, KEY_SYNC_LINES_INTERPOLATION_IDS, 'vi')
|
||||
if vLastSurfIds ~= nil and #vLastSurfIds ~= 0 then EgtErase( vLastSurfIds) end
|
||||
|
||||
-- Metto il focus sul Layer di Edit delle curve di Sincronizzazione
|
||||
EgtSetCurrPartLayer( nCurrPartId, nLayerEditId)
|
||||
|
||||
-- Aggiorno la grafica
|
||||
EgtDraw()
|
||||
+1
-1
@@ -45,7 +45,7 @@ EgtErase( vIdToErase)
|
||||
|
||||
-- Se Esiste un Layer di Edit o di Stored, lo Rimuovo
|
||||
-- [NB. La DeSelezione cancella tutti i risultati fatti fino ad adesso]
|
||||
local nLayerSynEditId = GlobVar.GetCurrentEditSyncCurvesLayer( nCurrPartId, nCurrLayerId)
|
||||
local nLayerSynEditId = GlobVar.GetCurrentEditSyncCurvesLayer( nCurrPartId, nTrimmingLayer)
|
||||
if nLayerSynEditId ~= nil and nLayerSynEditId ~= GDB_ID.NULL then EgtErase( nLayerEditId) end
|
||||
|
||||
-- Recupero l'ultima(le ultime) Supercicie(i) aggiunta(e) e la(e) elimino
|
||||
|
||||
+10
-10
@@ -19,11 +19,11 @@ if not sFileIni then
|
||||
end
|
||||
|
||||
-- Recupero i Colori in Hex come stringhe
|
||||
local sHexSurfSelColor = GlobVar.GetColorFromRGBToHex( SELECTION_SURF_COLOR)
|
||||
local sHexEdgeColor = GlobVar.GetColorFromRGBToHex( EDGES_COLOR)
|
||||
local sHexSyncLinesColor = GlobVar.GetColorFromRGBToHex( SYNC_LINE_COLOR)
|
||||
local sHexSyncInterpLinesColor = GlobVar.GetColorFromRGBToHex( SYNC_LINE_INTERP_COLOR)
|
||||
local sHexRuledBzColor = GlobVar.GetColorFromRGBToHex( RULED_BZ_COLOR)
|
||||
local sHexSurfSelColor = GlobVar.GetStringFromColor( SELECTION_SURF_COLOR)
|
||||
local sHexEdgeColor = GlobVar.GetStringFromColor( EDGES_COLOR)
|
||||
local sHexSyncLinesColor = GlobVar.GetStringFromColor( SYNC_LINE_COLOR)
|
||||
local sHexSyncInterpLinesColor = GlobVar.GetStringFromColor( SYNC_LINE_INTERP_COLOR)
|
||||
local sHexRuledBzColor = GlobVar.GetStringFromColor( RULED_BZ_COLOR)
|
||||
if not sHexSurfSelColor or not sHexEdgeColor or not sHexSyncLinesColor or not sHexSyncInterpLinesColor or not sHexRuledBzColor then
|
||||
EgtOutBox( ERROR_SETTINGS .. 'Error in Converting Colors', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
@@ -38,11 +38,11 @@ local vsVal = EgtDialogBox( 'Settings', { 'Surf Selection','CP:'.. sHexSurfSelCo
|
||||
if not vsVal or #vsVal ~= 5 then return end
|
||||
|
||||
-- Memorizzo i nuovi colori per le variabili
|
||||
local SelSurfCol = GlobVar.GetColorFromHexToRGB( vsVal[1])
|
||||
local EdgeColor = GlobVar.GetColorFromHexToRGB( vsVal[2])
|
||||
local SyncLineColor = GlobVar.GetColorFromHexToRGB( vsVal[3])
|
||||
local SyncInterpLinesColor = GlobVar.GetColorFromHexToRGB( vsVal[4])
|
||||
local RuledBZColor = GlobVar.GetColorFromHexToRGB( vsVal[5])
|
||||
local SelSurfCol = GlobVar.GetColorFromString( vsVal[1])
|
||||
local EdgeColor = GlobVar.GetColorFromString( vsVal[2])
|
||||
local SyncLineColor = GlobVar.GetColorFromString( vsVal[3])
|
||||
local SyncInterpLinesColor = GlobVar.GetColorFromString( vsVal[4])
|
||||
local RuledBZColor = GlobVar.GetColorFromString( vsVal[5])
|
||||
if not SelSurfCol or not EdgeColor or not SyncLineColor or not SyncInterpLinesColor or not RuledBZColor then
|
||||
EgtOutBox( ERROR_SETTINGS .. 'Error in Converting Colors', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
|
||||
+24
-23
@@ -1,28 +1,29 @@
|
||||
[Trimming]
|
||||
TrimEnable=1
|
||||
SurfSelectionColor=255,255,185
|
||||
SurfSelectionColor=255,255,179
|
||||
EdgesColor=0,128,255
|
||||
SyncLineColor=0,255,0
|
||||
SyncLineInterpColor=255,165,0
|
||||
RuledBzColor=37,37,37
|
||||
SyncLineInterpColor=255,43,149
|
||||
RuledBzColor=81,162,162
|
||||
BaseDir=C:\EgtData\Trimming
|
||||
Button1=Settings.lua,Images\Settings.png,Settings
|
||||
Button2=Separator
|
||||
Button3=NewTrimming.lua,Images\NewTrimming.png,New Trimming
|
||||
Button4=DeleteTrimming.lua,Images\DeleteTrimming.png, Delete Trimming
|
||||
Button5=Separator
|
||||
Button6=Select.lua,Images\Select.png,Select
|
||||
Button7=SelectHoles.lua,Images\SelectHoles.png,Select Holes
|
||||
Button8=ResetSelect.lua,Images\ResetSelect.png, <-- Undo,
|
||||
Button9=Separator
|
||||
Button10=CalcBezierEdges.lua,Images\BezierEdges.png,Get Borders
|
||||
Button11=EditBezierBorders.lua,Images\EditBezierEdges.png,Edit Curves
|
||||
Button12=ResetEditBezierBorders.lua,Images\ResetEditBezierEdges.png,<-- Undo
|
||||
Button13=EndEditBezierBorders.lua,Images\EndEditBezierEdges.png,Ok
|
||||
Button14=Separator
|
||||
Button15=EditSyncLines.lua,Images\EditSyncLines.png,Edit SyncLines
|
||||
Button16=InterpolateSyncLines.lua,Images\InterpolateSyncLines.png,Interpolate SyncLines
|
||||
Button17=ResetSyncLines.lua,Images\ResetSyncLines.png,Reset SyncLines
|
||||
Button18=Separator
|
||||
Button19=CalcBezier.lua,Images\BezierSurf.png,Get Surf
|
||||
Button20=ResetBezierSurf.lua,Images\ResetBezierSurf.png,<-- Undo
|
||||
Button1=NewTrimming.lua,Images\NewTrimming.png,New Trimming
|
||||
Button2=DeleteTrimming.lua,Images\DeleteTrimming.png, Delete Trimming
|
||||
Button3=Separator
|
||||
Button4=Select.lua,Images\Select.png,Select
|
||||
Button5=SelectHoles.lua,Images\SelectHoles.png,Select Holes
|
||||
Button6=ResetSelect.lua,Images\ResetSelect.png, <-- Undo,
|
||||
Button7=Separator
|
||||
Button8=CalcBezierEdges.lua,Images\BezierEdges.png,Get Borders
|
||||
Button9=EditBezierBorders.lua,Images\EditBezierEdges.png,Edit Curves
|
||||
Button10=ResetEditBezierBorders.lua,Images\ResetEditBezierEdges.png,<-- Undo
|
||||
Button11=EndEditBezierBorders.lua,Images\EndEditBezierEdges.png,Ok
|
||||
Button12=Separator
|
||||
Button13=EditSyncLines.lua,Images\EditSyncLines.png,Edit SyncLines
|
||||
Button14=InterpolateSyncLines.lua,Images\InterpolateSyncLines.png,Interpolate SyncLines
|
||||
Button15=ResetInterpolateSyncLines.lua,Images\ResetInterpolateSyncLines.png,<-- Undo
|
||||
Button16=ResetSyncLines.lua,Images\ResetSyncLines.png,Reset SyncLines
|
||||
Button17=Separator
|
||||
Button18=CalcBezier.lua,Images\BezierSurf.png,Get Surf
|
||||
Button19=ResetBezierSurf.lua,Images\ResetBezierSurf.png,<-- Undo
|
||||
Button20=Separator
|
||||
Button21=Settings.lua,Images\Settings.png,Settings
|
||||
+32
-41
@@ -25,6 +25,7 @@ KEY_AUTO_TRIMMING = 'AutoTrim' -- AutoTrimming
|
||||
KEY_SYNC_LINES_NUMBER = 'SkimmingFactor' -- Skimming Sync Lines
|
||||
KEY_SYNC_LINES_SHOW_ON_CORNERS = 'SyncLineShowOnCorners' -- Skimming Sync Lines Show on Corners
|
||||
KEY_SYNC_LINES_NUMBER_ANG_TOL = 'SkimmingFactorAngTol' -- Skimming Sync Lines Tol
|
||||
KEY_SYNC_LINES_INTERPOLATION_IDS = 'SyncLineInterIds' -- Skinning Sync Lines Interpolation Ids
|
||||
|
||||
-- Chive per Tipologia di Layer
|
||||
KEY_LAYER_TYPE = 'Trimming_Layer_Type'
|
||||
@@ -265,6 +266,37 @@ function TrimmingVar.GetCurrentEditSyncCurvesLayer( nPartId, nTrimmingLayerId)
|
||||
return GDB_ID.NULL
|
||||
end
|
||||
|
||||
--======================== Colori ========================
|
||||
|
||||
-- Funzione che recupera il colore da una stringa "nR,nG,nB" [0-255],[0-255],[0-255]
|
||||
function TrimmingVar.GetColorFromString( sColor)
|
||||
local sVal = EgtSplitString( sColor)
|
||||
if not sVal then return nil end
|
||||
if #sVal ~= 3 then return nil end
|
||||
local nRed = tonumber( sVal[1])
|
||||
local nGreen = tonumber( sVal[2])
|
||||
local nBlue = tonumber( sVal[3])
|
||||
if not nRed or not nGreen or not nBlue then return nil end
|
||||
if 0 <= nRed and nRed <= 255 and 0 <= nGreen and nGreen <= 255 and 0 <= nBlue and nBlue <= 255 then
|
||||
return Color3d( nRed, nGreen, nBlue)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Funzione per convertire un Color3d ad una stringa "nR,nG,nB" [0-255],[0-255],[0-255]
|
||||
function TrimmingVar.GetStringFromColor( myColor)
|
||||
if not myColor then return nil end
|
||||
return ( "".. myColor:getRed().. ",".. myColor:getGreen().. ",".. myColor:getBlue())
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Funzione per convertire Colori da Classe3d a stringa per File.ini
|
||||
function TrimmingVar.GetColorForIniFile( myColor)
|
||||
if not myColor then return nil end
|
||||
return ( myColor:getRed().. ",".. myColor:getGreen().. ",".. myColor:getBlue())
|
||||
end
|
||||
|
||||
--======================== Utility =======================
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
@@ -300,47 +332,6 @@ function TrimmingVar.GetGlobBox( vIds)
|
||||
return BBox3dGlob
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Funzione che recupera il colore da una stringa "nR,nG,nB" [0-255],[0-255],[0-255]
|
||||
function TrimmingVar.GetColorFromString( sColor)
|
||||
local sVal = EgtSplitString( sColor)
|
||||
if not sVal then return nil end
|
||||
if #sVal ~= 3 then return nil end
|
||||
local nRed = tonumber( sVal[1])
|
||||
local nGreen = tonumber( sVal[2])
|
||||
local nBlue = tonumber( sVal[3])
|
||||
if not nRed or not nGreen or not nBlue then return nil end
|
||||
if 0 <= nRed and nRed <= 255 and 0 <= nGreen and nGreen <= 255 and 0 <= nBlue and nBlue <= 255 then
|
||||
return Color3d( nRed, nGreen, nBlue)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Conversione Colori da Hex -> Color3d
|
||||
function TrimmingVar.GetColorFromHexToRGB( sHex)
|
||||
if not sHex then return nil end
|
||||
-- Rimozione eventuale "#" iniziale
|
||||
sHex = sHex:gsub( "#", "")
|
||||
-- Estraggo le Coppie
|
||||
local nR, nG, nB = sHex:match( "(%x%x)(%x%x)(%x%x)")
|
||||
-- Restituisco il risultato
|
||||
return Color3d( tonumber( nR, 16), tonumber( nG, 16), tonumber( nB, 16))
|
||||
end
|
||||
|
||||
-- Conversione Colori da classe Color3d a Hex
|
||||
function TrimmingVar.GetColorFromRGBToHex( myColor)
|
||||
if not myColor then return nil end
|
||||
return ( string.format("%02X", myColor:getRed()) ..
|
||||
string.format("%02X", myColor:getGreen()) ..
|
||||
string.format("%02X", myColor:getBlue()))
|
||||
end
|
||||
|
||||
-- Conversione Colori da Classe3d a stringa per File.ini
|
||||
function TrimmingVar.GetColorForIniFile( myColor)
|
||||
if not myColor then return nil end
|
||||
return ( myColor:getRed().. ",".. myColor:getGreen().. ",".. myColor:getBlue())
|
||||
end
|
||||
|
||||
-- Inizializzazione per lettura delle variabili
|
||||
if not TrimmingVar.bInit then
|
||||
local sFileIni = EgtGetIniFile()
|
||||
|
||||
+2
-2
@@ -2,5 +2,5 @@
|
||||
-- Gestione della versione di Trimming dei Termoformati
|
||||
|
||||
NAME = 'Trimming'
|
||||
VERSION = '3.1a7'
|
||||
MIN_EXE = '3.1a7'
|
||||
VERSION = '3.1b1'
|
||||
MIN_EXE = '3.1b1'
|
||||
|
||||
Reference in New Issue
Block a user