- cambiata la variabile globale da CMD a SLD

- attivata la funzionalità da CAM e disattivata per l'uso da OFFICE.
This commit is contained in:
Daniele Bariletti
2024-11-26 12:21:27 +01:00
parent a466488114
commit f595d03482
+78 -61
View File
@@ -2,7 +2,7 @@
-- |ultima modifica:|
-- |aggiunta gestione di più loop interni|
--ERR == -1 valore di default
--ERR == 1 CMP.CurrId non è valido ( == -1)
--ERR == 1 SLD.CurrId non è valido ( == -1)
--ERR == 0 eseguito senza problemi
-- Intestazioni
@@ -18,17 +18,18 @@ EgtEnableDebug( false)
--EgtOpenFile( "C:\\EgtData\\OmagOFFICE\\Temp\\sideAng_archi_Interni_45.nge")
--EgtOpenFile( "C:\\EgtData\\OmagOFFICE\\Temp\\buca_limitata.nge")
-- Dati raccolti direttamente dal programma
local CMP = {}
--input
CMP.THICK = 40
CMP.CurrId = -1
-- output
CMP.CurrPartSolid = -1
CMP.CurrSrfTmId = -1
CMP.ERR = -1
_G.CMP = CMP
-- Dati raccolti direttamente dal programma
local SLD = {}
--input
SLD.THICK = 40
SLD.CurrId = -1
-- output
SLD.CurrPartSolid = -1
SLD.CurrSrfTmId = -1
SLD.ERR = -1
_G.SLD = SLD
local ColorSTD = 'AQUA'
local ColocERR = 'ORANGE'
@@ -86,8 +87,8 @@ local bAlwaysOnTop = true
--local nIdTrimIn = -1
local tbTrimTot = {}
-- Estensioni delle regioni di taglio per SideAngle
local ovX = 100
local ovY = 100
--NB: lo spessore dei pezzi è limitato a 100(o meno, se ci sono dei sideAng), quindi per spessori importanti bisognerebbe modificare il valore di questa dimensione
local DefaultDim = 100
-- valore di tolleranza minimo per estrarre i contorni da una regione
local TollY = 1
local m_bArc = false
@@ -230,7 +231,7 @@ end
----------------------------------------------------------------------------
-- riceve la tablella e il nome del Layer, riempie la tabella e restituisce l'ID del layer
local function GetIdFromLay( myTab, sLay)
RTh = CMP.THICK
RTh = SLD.THICK
--IdFP = EgtGetFirstPart()
local IdLay = EgtGetFirstNameInGroup( IdFP, sLay)
local tbIdLayTemp = {}
@@ -315,8 +316,8 @@ local function CreateSolid()
EgtErase( tbTrimTot)
tbTrimTot = {nIdTrimTot}
IdEnt_Part = nIdTrimTot
CMP.CurrPartSolid = IdP_SOLID
CMP.CurrSrfTmId = nIdTrimTot
SLD.CurrPartSolid = IdP_SOLID
SLD.CurrSrfTmId = nIdTrimTot
end
--
@@ -374,7 +375,7 @@ local function OnPathSolid()
local nInd = tbId_OnPath[i][j]
local D = GetDepthOnPath( nInd)
if D > RTh then
CMP.ERR = 1
SLD.ERR = 1
EgtSetColor( {IdEnt_Part}, ColocERR)
end
-- creo una copia nel Layer "Temp"
@@ -593,7 +594,7 @@ local function SideAngSolid( tbLoop, bInLoop)
local ptS = EgtSP( IdS, GDB_ID.ROOT)
local vtS = EgtSV( IdS, GDB_ID.ROOT)
local vtE = EgtEV( IdS, GDB_ID.ROOT)
local IdRect = EgtCurveGetFatCurve( IdS, IdL_Temp, 100, true)
local IdRect = EgtCurveGetFatCurve( IdS, IdL_Temp, DefaultDim, true)
local IdSurf = EgtSurfTmByRegion( IdL_Solid, IdRect)
EgtErase( IdRect)
@@ -786,6 +787,13 @@ local function CorrectReference()
end
end
local function GetThickness()
local val = EgtGetInfo( IdFP,"Th","d")
if val then
SLD.THICK = val
end
end
----------------------------------------------------------------------------
-- **Wire Frame**
----------------------------------------------------------------------------
@@ -820,21 +828,28 @@ local function ExtractBoundaryAndFaces()
-- EgtSurfTmByTriangles( IdL_Temp, tabMergSurf)
-- EgtErase( tabMergSurf)
-- IdS = EgtGetNext( IdS)
------------------------ gestione archi
----------- gestione archi che non vengono esplosi----------------
nCount = nCount + 1
local bExplode = false
----------- gestione archi che non vengono esplosi----------------
---
local nLoop, nLoopCount = EgtExtractSurfTmFacetLoops( IdS, 0, IdL_Bound)
local ColorApply = 'BLACK'
local tbLoopFlatRegion = {}
for l=nLoop, nLoop + (nLoopCount-1), 1 do
-- ricreo la faccia laterale come flat region e la metto con trasparenza massima
local nIdFace = EgtSurfFlatRegion( IdL_Faces, l)
EgtSetAlpha(nIdFace,1)
table.insert( tbId_Faces, nIdFace)
-- coloro il loop e lo esplodo
-- coloro il loop e lo aggiungo alla tabella per ricreare la flat region
EgtSetColor( l, ColorApply)
table.insert(tbLoopFlatRegion, l)
end
-- ricreo la faccia laterale come flat region e la metto con trasparenza massima
local nIdFace = EgtSurfFlatRegion( IdL_Faces, tbLoopFlatRegion)
EgtSetAlpha(nIdFace,1)
table.insert( tbId_Faces, nIdFace)
for l=nLoop, nLoop + (nLoopCount-1), 1 do
-- esplodo i loop
EgtExplodeCurveCompo( l)
end
local nIdCurr = IdS
@@ -914,51 +929,53 @@ local function Draw(bPreview)
CorrectReference()
--ExtractBoundaryAndFaces()
ExtractBoundaryAndFaces()
--EgtSetGridFrame({{0,0,0},{1,0,0},{0,1,0},{0,0,1}})
end
--
--per uso nell' |omagOFFICE|
function CMP.Main()
IdFP = CMP.CurrId
ClearCurrIdSOLID()
if IdFP == -1 then
CMP.ERR = 1
return
end
RTh = CMP.THICK
if RTh == 0 then
return
end
Draw( true)
EgtSetStatus( IdFP, GDB_ST.OFF)
--EgtSaveFile('c:\\EgtData\\OmagOFFICE\\Temp\\Ribasso_0.nge')
EgtDraw()
CMP.ERR = 0
end
-- --per uso nell' |omagOFFICE|
-- function SLD.Main()
-- IdFP = SLD.CurrId
-- ClearCurrIdSOLID()
-- if IdFP == -1 then
-- SLD.ERR = 1
-- return
-- end
-- RTh = SLD.THICK
-- if RTh == 0 then
-- return
-- end
-- GetThickness()
-- Draw( true)
-- EgtSetStatus( IdFP, GDB_ST.OFF)
-- --EgtSaveFile('c:\\EgtData\\OmagOFFICE\\Temp\\Ribasso_0.nge')
-- EgtDraw()
-- SLD.ERR = 0
-- end
--per uso nell' |omagOFFICE|
-- --per uso nell' |omagOFFICE|
-- --per uso nel |CAM5|
-- ClearCurrIdSOLID()
-- RTh = CMP.THICK
-- IdFP = EgtGetFirstPart()
-- local sName = ""
-- --IdFP = 49389
-- while IdFP ~= nil and sName ~= "SOLID" do
-- Draw( true)
-- EgtSetStatus( IdFP, GDB_ST.OFF)
-- IdFP = EgtGetNextPart(IdFP)
-- sName = EgtGetName(IdFP)
-- --break
-- end
-- --EgtSaveFile('c:\\EgtData\\OmagOFFICE\\Temp\\buche_sottili_SOLID.nge')
-- EgtDraw()
-- --CMP.ERR = 0
-- -----per uso nel |CAM5|
--per uso nel |CAM5|
ClearCurrIdSOLID()
RTh = SLD.THICK
IdFP = EgtGetFirstPart()
local sName = ""
--IdFP = 49389
while IdFP ~= nil and sName ~= "SOLID" do
GetThickness()
Draw( true)
EgtSetStatus( IdFP, GDB_ST.OFF)
IdFP = EgtGetNextPart(IdFP)
sName = EgtGetName(IdFP)
--break
end
--EgtSaveFile('c:\\EgtData\\OmagOFFICE\\Temp\\buche_sottili_SOLID.nge')
EgtDraw()
--SLD.ERR = 0
-----per uso nel |CAM5|
--_G.CMP_Main = CMP_Main
--_G.SLD_Main = SLD_Main