bf990439aa
- aggiunta info sui bordi per determinare un ordine tra i due. - migliorie nella gestione delle info.
97 lines
3.5 KiB
Lua
97 lines
3.5 KiB
Lua
-- DeleteTrimming.lua by Egalware s.r.l. 2026/05/12
|
|
|
|
require( 'EgtBase')
|
|
_ENV = EgtProtectGlobal()
|
|
EgtEnableDebug( false)
|
|
|
|
-- Carico le costanti di Trimming
|
|
EgtAddToPackagePath( EgtGetSourceDir() .. '?.lua')
|
|
local GlobVar = require( 'TrimmingLib')
|
|
-- Costante di Errore
|
|
local ERROR_DELETING_ORIENTING_LINES = 'Error in Deleting Orienting Lines : '
|
|
|
|
-- Recupero il Part e il Layer corrente di Trimming
|
|
local nCurrPartId = EgtGetCurrPart()
|
|
local nCurrLayerId = EgtGetCurrLayer()
|
|
|
|
local nTrimmingLayerId = nil
|
|
-- Se il Layer corrente è di Trimming, memorizzo il suo Id
|
|
if GlobVar.IsTrimmingLayer( nCurrLayerId) then nTrimmingLayerId = nCurrLayerId
|
|
-- Se invece è un altro Layer, recupero il Layer di Trimmatura a cui si riferisce
|
|
else nTrimmingLayerId = GlobVar.GetTrimmingLayerRefId( nCurrLayerId) end
|
|
if nTrimmingLayerId == nil or nTrimmingLayerId == GDB_ID.NULL then
|
|
EgtOutBox( ERROR_DELETING_ORIENTING_LINES.. 'No Trimming Machinining Layer Found', 'Error', 'ERROR', 'OK')
|
|
return
|
|
end
|
|
|
|
-- Verifico che il Layer corrente sia di Orinting Curves
|
|
if not GlobVar.IsOrientationCurvesLayer( nCurrLayerId) then
|
|
EgtOutBox( ERROR_DELETING_ORIENTING_LINES.. 'No Orienting Lines Layer Found', 'Error', 'ERROR', 'OK')
|
|
return
|
|
end
|
|
|
|
-- Chiedo all'Utente la conferma per eliminare il Layer di Orienting Lines corrente
|
|
local bDelete = EgtOutBox( 'Do you want to delete the current Orienting Orienting Layer ?', 'Deleting', 'QUESTION', 'YESNO')
|
|
if not bDelete then return end
|
|
|
|
|
|
-- Elimino dalle curve di bordo le info
|
|
-- Layer di Orienting ( da togliere dalla lista)
|
|
local vOrientingLayerId = EgtGetInfo( vIdEdges[1], MCH_TRIMMING.OR_LAYER, 'vi')
|
|
if #vOrientingLayerId > 1 then
|
|
table.remove(vOrientingLayerId)
|
|
EgtSetInfo( vIdEdges[1], MCH_TRIMMING.OR_LAYER, vOrientingLayerId)
|
|
EgtSetInfo( vIdEdges[2], MCH_TRIMMING.OR_LAYER, vOrientingLayerId)
|
|
else
|
|
EgtRemoveInfo(vIdEdges[1], MCH_TRIMMING.OR_LAYER)
|
|
EgtRemoveInfo(vIdEdges[2], MCH_TRIMMING.OR_LAYER)
|
|
end
|
|
-- elimino i Vettori rappresentativi
|
|
-- Interpolation Start
|
|
local vOrientingISId = EgtGetInfo( vIdEdges[1], MCH_TRIMMING.OR_IS, 'vi')
|
|
|
|
if #vOrientingISId > 1 then
|
|
table.remove( vOrientingISId)
|
|
EgtSetInfo( vIdEdges[1], MCH_TRIMMING.OR_IS, vOrientingISId)
|
|
EgtSetInfo( vIdEdges[2], MCH_TRIMMING.OR_IS, vOrientingISId)
|
|
else
|
|
EgtRemoveInfo(vIdEdges[1], MCH_TRIMMING.OR_IS)
|
|
EgtRemoveInfo(vIdEdges[2], MCH_TRIMMING.OR_IS)
|
|
end
|
|
-- Start
|
|
local vOrientingSId = EgtGetInfo( vIdEdges[1], MCH_TRIMMING.OR_S, 'vi')
|
|
|
|
if #vOrientingSId > 1 then
|
|
table.remove( vOrientingSId)
|
|
EgtSetInfo( vIdEdges[1], MCH_TRIMMING.OR_S, vOrientingSId)
|
|
EgtSetInfo( vIdEdges[2], MCH_TRIMMING.OR_S, vOrientingSId)
|
|
else
|
|
EgtRemoveInfo(vIdEdges[1], MCH_TRIMMING.OR_S)
|
|
EgtRemoveInfo(vIdEdges[2], MCH_TRIMMING.OR_S)
|
|
end
|
|
-- End
|
|
local vOrientingEId = EgtGetInfo( vIdEdges[1], MCH_TRIMMING.OR_E, 'vi')
|
|
if #vOrientingEId > 1 then
|
|
table.insert( vOrientingEId, nEndId)
|
|
EgtSetInfo( vIdEdges[1], MCH_TRIMMING.OR_E, vOrientingEId)
|
|
EgtSetInfo( vIdEdges[2], MCH_TRIMMING.OR_E, vOrientingEId)
|
|
else
|
|
EgtRemoveInfo(vIdEdges[1], MCH_TRIMMING.OR_E)
|
|
EgtRemoveInfo(vIdEdges[2], MCH_TRIMMING.OR_E)
|
|
end
|
|
-- Interpolation End
|
|
local vOrientingIEId = EgtGetInfo( vIdEdges[1], MCH_TRIMMING.OR_IE, 'vi')
|
|
if #vOrientingIEId > 1 then
|
|
table.remove( vOrientingIEId)
|
|
EgtSetInfo( vIdEdges[1], MCH_TRIMMING.OR_IE, vOrientingIEId)
|
|
EgtSetInfo( vIdEdges[2], MCH_TRIMMING.OR_IE, vOrientingIEId)
|
|
else
|
|
EgtRemoveInfo(vIdEdges[1], MCH_TRIMMING.OR_IE)
|
|
EgtRemoveInfo(vIdEdges[2], MCH_TRIMMING.OR_IE)
|
|
end
|
|
|
|
-- Elimino il Layer
|
|
EgtErase( nCurrLayerId)
|
|
|
|
-- Aggiorno la Grafica
|
|
EgtDraw() |