Trimming 3.1a6 :
- aggiunta gestione fori e asole - ridimensionamento delle immagini dei bottoni - aggiornamento del file .ini - correzioni varie.
@@ -1,69 +0,0 @@
|
||||
-- AutoNewTrimming.lua by Egalware s.r.l. 2026/01/05
|
||||
|
||||
require( 'EgtBase')
|
||||
_ENV = EgtProtectGlobal()
|
||||
EgtEnableDebug( false)
|
||||
|
||||
-- Carico le costanti di Trimming
|
||||
EgtAddToPackagePath( EgtGetSourceDir() .. '?.lua')
|
||||
require( 'Constants')
|
||||
-- Costante di Errore
|
||||
local ERROR_CREATING_NEW_TRIMMING = 'Error in Creating New Trimming : '
|
||||
local WARNING_CREATING_NEW_TRIMMING = 'Warning in Creating New Trimming : '
|
||||
|
||||
|
||||
-- Se Part di Trimming non presente, lo creo
|
||||
local nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART_NAME)
|
||||
if not nPartId then
|
||||
nPartId = EgtGroup( GDB_ID.ROOT)
|
||||
if nPartId == nil or nPartId == GDB_ID.NULL or not EgtSetName( nPartId, PART_NAME) then
|
||||
EgtOutBox( ERROR_CREATING_NEW_TRIMMING .. 'Defining Part failed', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- Definisco un Layer temporaneo per l'inserimento delle possibili geometrie
|
||||
local nTmpLayerId = EgtGroup( nPartId)
|
||||
|
||||
-- Chiedo all'utente le Tolleranze e le geometrie di ricerca automatica
|
||||
local vsVal = EgtDialogBox( 'New Auto Trimming', { 'Surface Layer Id', '9'},
|
||||
{ 'Linear Shape Tolerance', '1.0'},
|
||||
{ 'Angular Shape Tolerance', '30.0'},
|
||||
{ 'Linear Tolerance', '0.05'},
|
||||
{ 'Edge Linear Tolerance', '0.05'},
|
||||
{ 'Angular Tolerance', '15.0'},
|
||||
{ 'Surface Angular Tolerance', '30.0'},
|
||||
{ 'Circles', 'CK:1'})
|
||||
if not vsVal or #vsVal ~= 8 then
|
||||
EgtErase( nLayerSelId)
|
||||
return
|
||||
end
|
||||
local nSurfLayerId = tonumber( vsVal[1])
|
||||
local dShapeLinTol = tonumber( vsVal[2])
|
||||
local dShapeAngTol = tonumber( vsVal[3])
|
||||
local dLinTol = tonumber( vsVal[4])
|
||||
local dEdgeLinTol = tonumber( vsVal[5])
|
||||
local dAngTol = tonumber( vsVal[6])
|
||||
local dAngFaceTol = tonumber( vsVal[7])
|
||||
local bCircle = vsVal[8]
|
||||
|
||||
-- Ricerco le Geometrie
|
||||
local vsEntities = {}
|
||||
if bCircle then table.insert( vsEntities, "circle") end
|
||||
local bOk = EgtTrimmingAutoSearch( nTmpLayerId, nSurfLayerId, dShapeLinTol, dShapeAngTol, dLinTol, dEdgeLinTol, dAngTol, dAngFaceTol, vsEntities)
|
||||
if not bOk then
|
||||
EgtErase( nTmpLayerId)
|
||||
EgtOutBox( ERROR_CREATING_NEW_TRIMMING .. 'Detecting Shapes Failed', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
end
|
||||
|
||||
-- Se nel nuovo Layer non ho inserito nulla, allora non sono state trovate geometrie compatibili
|
||||
local nNewId = {}
|
||||
local nId = EgtGetFirstInGroup( nTmpLayerId)
|
||||
if not nId then
|
||||
EgtErase( nTmpLayerId)
|
||||
EgtOutBox( WARNING_CREATING_NEW_TRIMMING .. 'No Geometry found', 'Warning', 'WARNING', 'OK')
|
||||
return
|
||||
end
|
||||
|
||||
-- Sposto tutte le Geometrie ripartizionandole in nuovi Layer di Trimming
|
||||
@@ -46,6 +46,9 @@ if not vsVal or #vsVal ~= 4 then return end
|
||||
dEdgeLinTol = tonumber( vsVal[2])
|
||||
dEdgeAngTol = tonumber( vsVal[3])
|
||||
dEdgeThick = tonumber( vsVal[4])
|
||||
EgtSetInfo( nCurrLayerId, KEY_LIN_TOL_EDGES, dEdgeLinTol)
|
||||
EgtSetInfo( nCurrLayerId, KEY_ANG_TOL_EDGES, dEdgeAngTol)
|
||||
EgtSetInfo( nCurrLayerId, KEY_THICK_EDGES, dEdgeThick)
|
||||
|
||||
-- Rendo invisibili gli altri Layer di Trimmatura e tutti i Layer Temporanei
|
||||
-- NB. Il focus va sul Layer corrente
|
||||
|
||||
|
Before Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 379 B |
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 109 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 119 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 708 B |
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
@@ -18,13 +18,14 @@ if nCurrPartId == nil then
|
||||
end
|
||||
|
||||
-- Chiedo all'utente le Tolleranze e le Salvo come Info nel Layer di Trimming
|
||||
local vsVal = EgtDialogBox( 'New Trimming', { 'Linear Tolerance', tostring( LIN_TOL)},
|
||||
{ 'Angular Tolerance', tostring( ANG_TOL)},
|
||||
{ 'Surface Angular Tolerance', tostring( ANG_FACE_TOL)})
|
||||
if not vsVal or #vsVal ~= 3 then return end
|
||||
local vsVal = EgtDialogBox( 'New Trimming', { 'Surf Linear Tolerance', tostring( LIN_TOL)},
|
||||
{ 'Surf Angular Tolerance', tostring( ANG_TOL)},
|
||||
{ 'Surf Norm Angular Tolerance', tostring( ANG_FACE_TOL)},
|
||||
{ 'For Holes','CK:0'})
|
||||
if not vsVal or #vsVal ~= 4 then return end
|
||||
|
||||
-- Creo il Layer di Trimming all'interno del Part corrente e lo rendo corrente
|
||||
local nCurrLayerId = GlobVar.CreateTrimmingLayer( nCurrPartId)
|
||||
local nCurrLayerId = GlobVar.CreateTrimmingLayer( nCurrPartId, ( tonumber( vsVal[4]) == 1))
|
||||
if nCurrLayerId == GDB_ID.NULL then
|
||||
EgtOutBox( ERROR_CREATING_NEW_TRIMMING .. 'Defining Layer failed', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
|
||||
@@ -31,10 +31,10 @@ if nType ~= GDB_TY.SRF_BEZ and nType ~= GDB_TY.SRF_MESH then
|
||||
end
|
||||
|
||||
-- Chiedo l'operazione da svolgere su tale superficie e ricavo i parametri inseriti
|
||||
local dSize = 5.0
|
||||
local dSize = STRIP_SIZE
|
||||
local dStoredSize = EgtGetInfo( nCurrLayerId, KEY_SURF_BORDER_SIZE, 'd')
|
||||
if dStoredSize ~= nil then dSize = dStoredSize end
|
||||
local dSizeTol = 0.75
|
||||
local dSizeTol = STRIP_SIZE_TOL
|
||||
local dStoredSizeTol = EgtGetInfo( nCurrLayerId, KEY_SURF_BORDER_SIZE_TOL, 'd')
|
||||
if dStoredSizeTol ~= nil then dSizeTol = dStoredSizeTol end
|
||||
local nLastSelType = EgtGetInfo( nCurrLayerId, KEY_SELECTION_LAST_SELECTION_TYPE, 'i')
|
||||
@@ -51,8 +51,8 @@ else
|
||||
sTypeDBSel = 'CB:' .. table.concat( sLabels, ',')
|
||||
end
|
||||
local vsVal = EgtDialogBox( 'Seletion', { 'Type', sTypeDBSel},
|
||||
{ 'Size', tostring( dSize)},
|
||||
{ 'Size Tolerance', tostring( dSizeTol)})
|
||||
{ 'Strip Size', tostring( dSize)},
|
||||
{ 'Strip Size Tolerance', tostring( dSizeTol)})
|
||||
if not vsVal or #vsVal ~= 3 then return end
|
||||
dSize = tonumber( vsVal[2])
|
||||
dSizeTol = tonumber( vsVal[3])
|
||||
@@ -178,7 +178,7 @@ elseif vsVal[1] == 'Face Search' then
|
||||
local sStr = 'Pt = ' .. tostring( ptInt) .. ' - nTria = ' .. tostring( nTria)
|
||||
EgtOutLog( sStr)
|
||||
-- Recupero la superficie mediante adiancenza dei triangoli
|
||||
local nInsertSurfId = EgtTrimmingGetSurfTmFaceAdj( nCurrLayerId, nId, {nTria}, {ptInt}, dAngFaceTol, dSize, dSizeTol)
|
||||
local nInsertSurfId = EgtTrimmingGetSurfTmFaceAdj( nCurrLayerId, nId, nTria, ptInt, dAngFaceTol, dSize, dSizeTol)
|
||||
if not nInsertSurfId or nInsertSurfId == GDB_ID.NULL then
|
||||
EgtOutBox( ERROR_SELECTION .. 'Face Search failed', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
@@ -210,14 +210,15 @@ elseif vsVal[1] == 'Surf Search' then
|
||||
while nOtherId do
|
||||
local nStatus = EgtGetStatus( nOtherId)
|
||||
if nStatus == GDB_ST.ON and nOtherId ~= nId then
|
||||
table.insert( vAllSurfIds, nOtherId)
|
||||
local nType = EgtGetType( nOtherId)
|
||||
if nType == GDB_TY.SRF_BEZ or nType == GDB_TY.SRF_MESH then table.insert( vAllSurfIds, nOtherId) end
|
||||
end
|
||||
nOtherId = EgtGetNext( nOtherId)
|
||||
end
|
||||
-- Recupero le superfici da Selezionare
|
||||
local bOk, vSelSurfId = EgtTrimmingGetAdjSurfs( nSelObjId, vAllSurfIds, dLinTol, dAngTol, dAngFaceTol)
|
||||
if not bOk then
|
||||
EgtOutBox( ERROR_SELECTION, 'Surface Search failed', 'Error', 'ERROR', 'OK')
|
||||
EgtOutBox( ERROR_SELECTION .. 'Surface Search failed', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
end
|
||||
table.insert( vSelSurfId, nSelObjId)
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
-- SelectHoles.lua by Egalware s.r.l. 2026/01/05
|
||||
|
||||
require( 'EgtBase')
|
||||
_ENV = EgtProtectGlobal()
|
||||
EgtEnableDebug( false)
|
||||
|
||||
-- Carico le costanti di Trimming
|
||||
EgtAddToPackagePath( EgtGetSourceDir() .. '?.lua')
|
||||
local GlobVar = require( 'TrimmingLib')
|
||||
-- Costante di Errore
|
||||
local ERROR_SELECTION = 'Error in Surf Selection : '
|
||||
|
||||
-- Recupero il Part e Layer di Trimming corrente
|
||||
local nCurrPartId = EgtGetCurrPart()
|
||||
local nCurrLayerId = EgtGetCurrLayer()
|
||||
if not GlobVar.IsTrimmingHoleLayer( nCurrLayerId) then
|
||||
EgtOutBox( ERROR_SELECTION .. 'Not a valid Hole Trimming Layer', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
end
|
||||
|
||||
-- Recupero l'oggetto selezionato ( verifico che sia Superficie TriMesh o Superficie Bezier)
|
||||
local nSelObjId = EgtGetLastSelectedObj()
|
||||
if not nSelObjId then
|
||||
EgtOutBox( ERROR_SELECTION .. 'No Object Selected', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
end
|
||||
local nType = EgtGetType( nSelObjId)
|
||||
if nType ~= GDB_TY.SRF_BEZ and nType ~= GDB_TY.SRF_MESH then
|
||||
EgtOutBox( ERROR_SELECTION .. 'Invalid Surface Selected. The Surface must be a TriMesh or a Bezier', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
end
|
||||
|
||||
-- Recupero le tolleranze impostate alla creazione del Layer di Trimming corrente
|
||||
local dLinTol = EgtGetInfo( nCurrLayerId, KEY_LIN_TOL, 'd')
|
||||
local dAngTol = EgtGetInfo( nCurrLayerId, KEY_ANG_TOL, 'd')
|
||||
local dAngFaceTol = EgtGetInfo( nCurrLayerId, KEY_SURF_ANG_TOL, 'd')
|
||||
local bOk = ( dLinTol ~= nil and dAngTol ~= nil and dAngFaceTol ~= nil)
|
||||
if not bOk then
|
||||
EgtOutBox( ERROR_SELECTION .. 'Not a valid Trimming Layer', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
end
|
||||
|
||||
-- Chiedo l'operazione da svolgere su tale superficie e ricavo i parametri inseriti
|
||||
local dSize = STRIP_SIZE
|
||||
local dStoredSize = EgtGetInfo( nCurrLayerId, KEY_SURF_BORDER_SIZE, 'd')
|
||||
if dStoredSize ~= nil then dSize = dStoredSize end
|
||||
local dSizeTol = STRIP_SIZE_TOL
|
||||
local dStoredSizeTol = EgtGetInfo( nCurrLayerId, KEY_SURF_BORDER_SIZE_TOL, 'd')
|
||||
if dStoredSizeTol ~= nil then dSizeTol = dStoredSizeTol end
|
||||
local nLastSelType = EgtGetInfo( nCurrLayerId, KEY_SELECTION_LAST_SELECTION_TYPE, 'i')
|
||||
local sLabels = { 'Insert Surface', 'Face Search', 'Surf Search'}
|
||||
local sTypeDBSel
|
||||
if nLastSelType ~= nil then
|
||||
local sParts = {}
|
||||
for i, sLabel in ipairs( sLabels) do
|
||||
if i == nLastSelType then sParts[i] = '*' .. sLabel
|
||||
else sParts[i] = sLabel end
|
||||
end
|
||||
sTypeDBSel = 'CB:' .. table.concat( sParts, ',')
|
||||
else
|
||||
sTypeDBSel = 'CB:' .. table.concat( sLabels, ',')
|
||||
end
|
||||
local dLinTolForEdges = dLinTol
|
||||
local dAngTolForEdges = dAngTol
|
||||
local dThickForEdges = EDGE_THICK
|
||||
local dEdgeLinTol = EgtGetInfo( nCurrLayerId, KEY_LIN_TOL_EDGES, 'd')
|
||||
local dEdgeAngTol = EgtGetInfo( nCurrLayerId, KEY_ANG_TOL_EDGES, 'd')
|
||||
local dEdgeThick = EgtGetInfo( nCurrLayerId, KEY_THICK_EDGES, 'd')
|
||||
if dEdgeLinTol then dLinTolForEdges = dEdgeLinTol end
|
||||
if dEdgeAngTol then dAngTolForEdges = dEdgeAngTol end
|
||||
if dEdgeThick then dThickForEdges = dEdgeThick end
|
||||
local vsVal = EgtDialogBox( 'Seletion', { 'Type', sTypeDBSel},
|
||||
{ 'Strip Size', tostring( dSize)},
|
||||
{ 'Strip Size Tolerance', tostring( dSizeTol)},
|
||||
{ 'Approx Linear Tolerance', tostring( dLinTolForEdges)},
|
||||
{ 'Approx Angular Tolerance', tostring( dAngTolForEdges)},
|
||||
{ 'Thickness', tostring( dThickForEdges)})
|
||||
if not vsVal or #vsVal ~= 6 then return end
|
||||
dSize = tonumber( vsVal[2])
|
||||
dSizeTol = tonumber( vsVal[3])
|
||||
EgtSetInfo( nCurrLayerId, KEY_SURF_BORDER_SIZE, dSize)
|
||||
EgtSetInfo( nCurrLayerId, KEY_SURF_BORDER_SIZE_TOL, dSizeTol)
|
||||
for i, sLabel in ipairs( sLabels) do
|
||||
if sLabel == vsVal[1] then EgtSetInfo( nCurrLayerId, KEY_SELECTION_LAST_SELECTION_TYPE, i) break end
|
||||
end
|
||||
dEdgeLinTol = tonumber( vsVal[4])
|
||||
dEdgeAngTol = tonumber( vsVal[5])
|
||||
dEdgeThick = tonumber( vsVal[6])
|
||||
EgtSetInfo( nCurrLayerId, KEY_LIN_TOL_EDGES, dEdgeLinTol)
|
||||
EgtSetInfo( nCurrLayerId, KEY_ANG_TOL_EDGES, dEdgeAngTol)
|
||||
EgtSetInfo( nCurrLayerId, KEY_THICK_EDGES, dEdgeThick)
|
||||
|
||||
-- Rendo invisibili gli altri Layer di Trimmatura e tutti i Layer Temporanei
|
||||
-- NB. Il focus va sul Layer corrente
|
||||
EgtSetStatus( nCurrLayerId, GDB_ST.ON)
|
||||
nId = EgtGetFirstInGroup( nCurrPartId)
|
||||
while nId do
|
||||
if nId ~= nCurrLayerId and
|
||||
( GlobVar.IsTrimmingLayer( nId) or GlobVar.IsEditSyncCurvesLayer( nId)) then EgtSetStatus( nId, GDB_ST.OFF) end
|
||||
nId = EgtGetNext( nId)
|
||||
end
|
||||
|
||||
-- Recupero gli Id delle Superfici rappresentanti il Foro o l'Asola corrente
|
||||
local vSurfIds = {}
|
||||
--------------------------------- Inserimento della Superficie ---------------------------------
|
||||
-- [Nessuna Tolleranza]
|
||||
if vsVal[1] == 'Insert Surface' then
|
||||
-- Recupero tutti gli Oggetti selezionati che sono Superfici TriMesh o di Bezier
|
||||
local vObjId = {}
|
||||
local nCurrObjId = EgtGetFirstSelectedObj()
|
||||
while nCurrObjId do
|
||||
local nObjType = EgtGetType( nCurrObjId)
|
||||
if nObjType == GDB_TY.SRF_MESH or nObjType == GDB_TY.SRF_BEZ then table.insert( vSurfIds, nCurrObjId) end
|
||||
nCurrObjId = EgtGetNextSelectedObj()
|
||||
end
|
||||
--------------------------------- Ricerca delle facce adiancenti --------------------------------
|
||||
-- [Tolleranza angolare di superficie]
|
||||
elseif vsVal[1] == 'Face Search' then
|
||||
local bOk = false
|
||||
-- Se la superficie è una Bezier, allora è lei
|
||||
if nType == GDB_TY.SRF_BEZ then table.insert( vSurfIds, nSelObjId)
|
||||
-- Se invece è una Trimesh, recupero il primo triangolo selezionato
|
||||
else
|
||||
local nId, nTria, ptInt = EgtGetLastSelInfo()
|
||||
if not nId or not nTria then
|
||||
EgtOutBox( ERROR_SELECTION .. 'Face not found', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
end
|
||||
-- *** Debug ( nel caso di errori, so che punto è stato selezionato ) ***
|
||||
local sStr = 'Pt = ' .. tostring( ptInt) .. ' - nTria = ' .. tostring( nTria)
|
||||
EgtOutLog( sStr)
|
||||
-- Recupero la superficie mediante adiancenza dei triangoli
|
||||
local nInsertSurfId = EgtTrimmingGetSurfTmFaceAdj( nCurrLayerId, nId, nTria, ptInt, dAngFaceTol, dSize, dSizeTol)
|
||||
if not nInsertSurfId or nInsertSurfId == GDB_ID.NULL then
|
||||
EgtOutBox( ERROR_SELECTION .. 'Face Search failed', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
end
|
||||
table.insert( vSurfIds, nInsertSurfId)
|
||||
end
|
||||
--------------------------------- Ricerca delle superfici Adiacenti ---------------------------------
|
||||
-- [Tolleranza lineare, Tolleranza angolare e Tolleranza angolare applicata alla Superficie]
|
||||
elseif vsVal[1] == 'Surf Search' then
|
||||
-- Recupero il Gruppo della superficie corrente
|
||||
local nSurfGroup = EgtGetParent( nSelObjId)
|
||||
if not nSurfGroup or nSurfGroup == GDB_ID.NULL then
|
||||
EgtOutBox( ERROR_SELECTION .. 'Surface not in a valid Group', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
end
|
||||
-- Recupero tutti Gli Id delle Superfici Attive del Gruppo della Superficie Corrente
|
||||
local vAllSurfIds = {}
|
||||
local nOtherId = EgtGetFirstInGroup( nSurfGroup)
|
||||
while nOtherId do
|
||||
local nStatus = EgtGetStatus( nOtherId)
|
||||
if nStatus == GDB_ST.ON and nOtherId ~= nId then
|
||||
table.insert( vAllSurfIds, nOtherId)
|
||||
end
|
||||
nOtherId = EgtGetNext( nOtherId)
|
||||
end
|
||||
-- Recupero le superfici da Selezionare
|
||||
local bOk, vSelSurfId = EgtTrimmingGetAdjSurfs( nSelObjId, vAllSurfIds, dLinTol, dAngTol, dAngFaceTol)
|
||||
if not bOk then
|
||||
EgtOutBox( ERROR_SELECTION .. 'Surface Search failed', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
end
|
||||
table.insert( vSurfIds, nSelObjId)
|
||||
for i = 1, #vSelSurfId do table.insert( vSurfIds, vSelSurfId[i]) end
|
||||
end
|
||||
|
||||
-- Se non ho ottenuto Id di Superfici, errore
|
||||
if #vSurfIds == 0 then
|
||||
EgtOutBox( ERROR_SELECTION .. 'Not a valid Surf Detected', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
end
|
||||
|
||||
-- Recupero tutte Le Superfici Visibili nello Stesso Layer dell'Oggetto Selezionato
|
||||
local vAllOtherSurfIds = GlobVar.GetAllOtherVisibileSurfsInSameLayer( nSelObjId)
|
||||
if not vAllOtherSurfIds then
|
||||
EgtOutBox( ERROR_SELECTION .. 'Surface not in a valid Group', 'Error', 'ERROR', 'OK')
|
||||
return
|
||||
end
|
||||
|
||||
-- Da queste superfici Recupero i Fori e le Asole
|
||||
local nFirstId, nCount
|
||||
bOk, nFirstId, nCount = EgtTrimmingGetHoleBorder( nCurrLayerId, vSurfIds, vAllOtherSurfIds, dLinTol, dAngTol, dEdgeLinTol, dEdgeAngTol, dEdgeThick)
|
||||
if bOk and ( nFirstId == GDB_ID.NULL or nCount == 0) then
|
||||
EgtOutBox( 'No Hole found under Tolerances', 'Edge Warning', 'WARNING', 'OK')
|
||||
else
|
||||
-- Assegno Colore e Nome alla curva ricavata
|
||||
bOk = bOk and nFirstId ~= nil and nFirstId ~= GDB_ID.NULL and nCount > 0
|
||||
if bOk then
|
||||
for i = 0, nCount - 1 do
|
||||
EgtSetName( i + nFirstId, EDGE_HOLE_NAME)
|
||||
EgtSetColor( i + nFirstId, EDGES_COLOR)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Elimino tutte le entità in eccesso nel Layer corrente
|
||||
local nId = EgtGetFirstInGroup( nCurrLayerId)
|
||||
local vIdToErase = {}
|
||||
while nId do
|
||||
if EgtGetName( nId) ~= EDGE_HOLE_NAME then table.insert( vIdToErase, nId) end
|
||||
nId = EgtGetNext( nId)
|
||||
end
|
||||
EgtErase( vIdToErase)
|
||||
|
||||
-- Deseleziono la superficie corrente e aggiorno la grafica
|
||||
EgtDeselectAll()
|
||||
|
||||
-- Aggiorno la Grafica
|
||||
EgtDraw()
|
||||
@@ -1,11 +1,11 @@
|
||||
[Trimming]
|
||||
TrimEnable=1
|
||||
BaseDir=C:\EgtData\Trimming
|
||||
Button1=AutoNewTrimming.lua,Images\AutoNewTrimming.png,Auto New Trimming
|
||||
Button2=NewTrimming.lua,Images\NewTrimming.png,New Trimming
|
||||
Button3=DeleteTrimming.lua,Images\DeleteTrimming.png, Delete Trimming
|
||||
Button4=Separator
|
||||
Button5=Select.lua,Images\Select.png,Select,
|
||||
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
|
||||
@@ -15,7 +15,6 @@ Button11=EndEditBezierBorders.lua,Images\EndEditBezierEdges.png,Ok
|
||||
Button12=Separator
|
||||
Button13=EditSyncLines.lua,Images\EditSyncLines.png,Edit SyncLines
|
||||
Button14=ResetSyncLines.lua,Images\ResetSyncLines.png,Reset SyncLines
|
||||
;Button15=EndEditSyncLines.lua,Images\EndSyncLines.png,Ok
|
||||
Button15=Separator
|
||||
Button16=CalcBezier.lua,Images\BezierSurf.png,Get Surf
|
||||
Button17=ResetBezierSurf.lua,Images\ResetBezierSurf.png,<-- Undo
|
||||
@@ -28,6 +28,7 @@ KEY_SYNC_LINES_NUMBER_ANG_TOL = 'SkimmingFactorAngTol' -- Skimming Sync Lines
|
||||
-- Chive per Tipologia di Layer
|
||||
KEY_LAYER_TYPE = 'Trimming_Layer_Type'
|
||||
KEY_LAYER_SELECTION = 'Trimming_Selection_Layer'
|
||||
KEY_LAYER_SELECTION_HOLES = 'Trimming_Selection_Holes_Layer'
|
||||
KEY_LAYER_EDIT_CURVES = 'Trimming_EditCurves_Layer'
|
||||
KEY_LAYER_SYNC_CURVES = 'Trimming_SyncCurves_Layer'
|
||||
KEY_LAYER_SYNC_STORE_CURVES = 'Trimming_SyncStoredCurves_Layer'
|
||||
@@ -35,12 +36,15 @@ KEY_LAYER_SYNC_STORE_CURVES = 'Trimming_SyncStoredCurves_Layer'
|
||||
-- Generali
|
||||
PART_NAME = 'Trimming'
|
||||
LAYER_NAME_SELECTION = 'Trimming'
|
||||
LAYER_NAME_SELECTION_HOLES = 'TrimmingHoles'
|
||||
LAYER_NAME_EDIT_CURVES = 'EditCurves'
|
||||
LAYER_NAME_SYNC_CURVES = 'SyncCurves'
|
||||
LAYER_NAME_SYNC_STORED_CURVES = 'SyncStoredCurves'
|
||||
ANG_FACE_TOL = 30.
|
||||
ANG_TOL = 15.
|
||||
LIN_TOL = 0.2
|
||||
STRIP_SIZE = 5.0
|
||||
STRIP_SIZE_TOL = 0.75
|
||||
EDGE_THICK = 5.0
|
||||
SYNC_LINES_NUMBER = 0
|
||||
SYNC_LINES_ANG_TOL = 15.0
|
||||
@@ -57,6 +61,7 @@ SELECTION_SURF_COLOR = Color3d( 255, 255, 185)
|
||||
|
||||
-- Creazione dei bordi Bezier --
|
||||
EDGES_NAME = 'Border'
|
||||
EDGE_HOLE_NAME = 'ButtonHole'
|
||||
EDGES_COLOR = Color3d( 0, 128, 255)
|
||||
|
||||
-- Edit dei bordi di Bezier --
|
||||
@@ -87,13 +92,18 @@ end
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Funzione per creare un Layer di Trimmatura
|
||||
function TrimmingVar.CreateTrimmingLayer( nCurrPartId)
|
||||
function TrimmingVar.CreateTrimmingLayer( nCurrPartId, bForHoles)
|
||||
local nCurrLayerId = EgtGroup( nCurrPartId)
|
||||
local bOk = ( nCurrLayerId ~= nil)
|
||||
if bOk then
|
||||
TrimmingVar.IncrementCounter()
|
||||
if not bForHoles then
|
||||
local sName = LAYER_NAME_SELECTION .. ' ' .. TrimmingVar.nCounter
|
||||
bOk = EgtSetName( nCurrLayerId, sName) and EgtSetInfo( nCurrLayerId, KEY_LAYER_TYPE, KEY_LAYER_SELECTION)
|
||||
else
|
||||
local sName = LAYER_NAME_SELECTION_HOLES .. ' ' .. TrimmingVar.nCounter
|
||||
bOk = EgtSetName( nCurrLayerId, sName) and EgtSetInfo( nCurrLayerId, KEY_LAYER_TYPE, KEY_LAYER_SELECTION_HOLES)
|
||||
end
|
||||
end
|
||||
if not bOk then
|
||||
EgtErase( nCurrLayerId)
|
||||
@@ -107,7 +117,16 @@ end
|
||||
function TrimmingVar.IsTrimmingLayer( nId)
|
||||
-- Verifico che la chiave del gruppo sia coerente
|
||||
local sLayerType = EgtGetInfo( nId, KEY_LAYER_TYPE, 's')
|
||||
return ( sLayerType ~= nil and sLayerType == KEY_LAYER_SELECTION)
|
||||
return ( sLayerType ~= nil and ( sLayerType == KEY_LAYER_SELECTION or sLayerType == KEY_LAYER_SELECTION_HOLES))
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- Funzione per verificare se un Layer è un Layer di Trimmatura per Fori/Asole
|
||||
function TrimmingVar.IsTrimmingHoleLayer( nId)
|
||||
-- Verifico che sia un Layer di Trimmatura
|
||||
if not TrimmingVar.IsTrimmingLayer( nId) then return false end
|
||||
local sLayerType = EgtGetInfo( nId, KEY_LAYER_TYPE, 's')
|
||||
return ( sLayerType ~= nil and sLayerType == KEY_LAYER_SELECTION_HOLES)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
@@ -213,4 +232,37 @@ end
|
||||
|
||||
--======================== Utility =======================
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Funzione che ritorna tutte le Superici Visibili presenti e visibili nel Layer dell'Entità nId
|
||||
-- Ritorna un vettore di Id = {} o nil in caso di errore
|
||||
function TrimmingVar.GetAllOtherVisibileSurfsInSameLayer( nId)
|
||||
local nSurfGrp = EgtGetParent( nId)
|
||||
if not nSurfGrp or nSurfGrp == GDB_ID.NULL then return nil end
|
||||
local vAllSurfIds = { }
|
||||
local nOtherId = EgtGetFirstInGroup( nSurfGrp)
|
||||
while nOtherId do
|
||||
if EgtGetStatus( nOtherId) == GDB_ST.ON and nOtherId ~= nId then
|
||||
local nType = EgtGetType( nOtherId)
|
||||
if nType == GDB_TY.SRF_BEZ or nType == GDB_TY.SRF_MESH then table.insert( vAllSurfIds, nOtherId) end
|
||||
end
|
||||
nOtherId = EgtGetNext( nOtherId)
|
||||
end
|
||||
return vAllSurfIds
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Funzione che ritorna il Box Complessivo delle Entità desiderate
|
||||
function TrimmingVar.GetGlobBox( vIds)
|
||||
local BBox3dGlob = BBox3d()
|
||||
for i = 1, #vIds do
|
||||
local nId = vIds[i]
|
||||
if nId then
|
||||
local currBBox3d = EgtGetBBoxGlob( nId, GDB_BB.STANDARD)
|
||||
if i == 1 then BBox3dGlob = currBBox3d
|
||||
else BBox3dGlob = BBox3dGlob + currBBox3d end
|
||||
end
|
||||
end
|
||||
return BBox3dGlob
|
||||
end
|
||||
|
||||
return TrimmingVar
|
||||
@@ -2,5 +2,5 @@
|
||||
-- Gestione della versione di Trimming dei Termoformati
|
||||
|
||||
NAME = 'Trimming'
|
||||
VERSION = '3.1a5'
|
||||
MIN_EXE = '3.1a5'
|
||||
VERSION = '3.1a6'
|
||||
MIN_EXE = '3.1a6'
|
||||
|
||||