- aggiunte le variabili per la chiamata "muta" delle funzioni CreateParetina, CreateAdjustedPart.

This commit is contained in:
Daniele Bariletti
2025-01-16 14:56:00 +01:00
parent a96680c081
commit e92c3ee546
+92 -3
View File
@@ -14,10 +14,67 @@ local TOOL = {}
_G.TOOL = TOOL
TOOL.nId = GDB_ID.NULL
TOOL.nLay = GDB_ID.NULL
TOOL.nEdgeId = GDB_ID.NULL
TOOL.tbInfo = {}
TOOL.nPrev = -1
TOOL.nNext = -1
TOOL.nJunctionType = -1
TOOL.bOnLoop = nil
TOOL.dAngBR = nil
TOOL.dSideAngR = nil
TOOL.dAngBL = nil
TOOL.dSideAngL = nil
TOOL.dLen = nil
TOOL.dH = nil
TOOL.dXOffset = nil
TOOL.dBeta1 = nil
TOOL.dBeta2 = nil
function TOOL.SaveMePlease()
EgtSaveFile('D:\\Temp\\marmo\\Vein3D\\FOO.nge')
end
local function FindEdges(nLay)
local tbId = {}
local nId = EgtGetFirstInGroup(nLay)
while nId do
table.insert(tbId, nId)
nId = EgtGetNext(nId)
end
return tbId
end
local function FillInfoTable()
TOOL.tbInfo.nPrev = TOOL.nPrev
TOOL.tbInfo.nNext = TOOL.nNext
TOOL.tbInfo.nJunctionType = TOOL.nJunctionType
TOOL.tbInfo.bOnLoop = TOOL.bOnLoop
TOOL.tbInfo.dAngBR = TOOL.dAngBR
TOOL.tbInfo.dSideAngR = TOOL.dSideAngR
TOOL.tbInfo.dAngBL = TOOL.dAngBL
TOOL.tbInfo.dSideAngL = TOOL.dSideAngL
TOOL.tbInfo.dLen = TOOL.dLen
TOOL.tbInfo.dH = TOOL.dH
TOOL.tbInfo.dBeta1 = TOOL.dBeta1
TOOL.tbInfo.dBeta2 = TOOL.dBeta2
end
function TOOL.WriteDataToChildPart(nParent, nPart, nEdge, dLen, dAngDx, dAngSx, dH, dTh, dBeta1, dBeta2)
if not nPart then do return end end
if nParent then EgtSetInfo(nParent,"A"..tostring(nEdge), nPart) end
if nParent then EgtSetInfo(nPart, 'Parent', nParent) end
if nEdge then EgtSetInfo(nPart, 'ParentEdge', nEdge) end
if dLen then EgtSetInfo(nPart, 'Len', dLen) end
if dAngDx then EgtSetInfo(nPart, 'dAngDx', dAngDx) end
if dAgnSx then EgtSetInfo(nPart, 'dAngSx', dAngSx) end
if dH then EgtSetInfo(nPart, 'dH', dH) end
if dTh then EgtSetInfo(nPart, 'dTh', dTh) end
if dBeta1 then EgtSetInfo(nPart, 'dBeta1', dBeta1) end
if dBeta2 then EgtSetInfo(nPart, 'dBeta2', dBeta2) end
end
-- CREAZIONE dei Layer di un singolo Part
-- I nomi dei layer sono: OutLoop, Region, Ref, Labels, Aux
function TOOL.CreatePartLayer(PartName, sUNICode)
@@ -44,7 +101,7 @@ end
-- RESTITUISCE una tabella con gli Id dei layer costruiti nella funzione CreatePartLayer part,
-- Se il nome del Part non esiste restituice nil
function TOOL.FindLayers( IdPart)
if not EgtIsPart( IdPart) then
if not EgtIsPart( IdPart) then
CMP.ERR = 1
CMP.MSG = CMP.MSG.." In FindLayers 'IdPart' non è un Part"
return nil
@@ -192,7 +249,7 @@ function TOOL.CreatePart(tbLayer, sName, tbIdEntCrv, dTh, bInLoop)
CMP.MSG = CMP.MSG.." Sottrazione tra superficie 'OutLoop' "..tostring(IdOutRegion).." e 'InLoop' "..tostring(IdReg).." non riuscita."
end
EgtErase(IdReg)
end
end
-- if bInLoop then EgtInvertCurve(IdLoop) end
-- elimino il contorno chiuso
EgtErase(IdLoop)
@@ -441,6 +498,11 @@ function CalcDraftAngle( vtDir1, vtDir2, dPairAng1, dPairAng2, dAngBetween)
if (dPairAng1 > 90 and dBeta2 > 90) or (dPairAng1 < 90 and dBeta2 < 90) then dBeta2 = 180 - dBeta2 end
local dSideAng = 0
dSideAng = (180 - dAng3d) / 2
--debug
EgtOutLog(tostring(dSideAng)..' '.. tostring(dBeta1).. ' '..tostring(dBeta2))
--debug
return dSideAng, dBeta1, dBeta2
end
@@ -528,6 +590,14 @@ function TOOL.CreateAdjustedPart( nLayOutloop, dLen, dH, dBeta1, dBeta2)
-- beta 1 e beta 2 sono gli angoli alla base
-- dLen1 e dLen2 sono le proiezioni delle diagonali sulla base maggiore
-- beta 1 e beta 2 possono essere < 90 e quindi potrei avere anche un trapezio ribaltato, oppure un quasi parallelogramma
-- recupero eventuali input mancanti dalla tabella generale
if not dLen then dLen = TOOL.dLen end
if not dH then dH = TOOL.dH end
if not dBeta1 then dBeta1 = TOOL.dBeta1 end
if not dBeta2 then dBeta2 = TOOL.dBeta2 end
-- creo i lati del pezzo
if dBeta1 == nil then dBeta1 = 90 end
if dBeta2 == nil then dBeta2 = 90 end
local dProj1 = dH * tan( dBeta1 - 90)
@@ -565,7 +635,20 @@ function TOOL.CreateCircularHole(nPart, ptCenter, dDiam)
end
function TOOL.CreateParetina(i, tbIdLoopTC, tbInfo, dPairAngCorr)
--function TOOL.CreateParetina(i, tbIdLoopTC, tbInfo, dPairAngCorr)
function TOOL.CreateParetina(nEdgeId, tbInfo, dPairAngCorr)
-- se non ho ricevuto input li recupero dalla tabella generale
if not nEdgeId then nEdgeId = TOOL.nEdgeId end
if not tbInfo then
FillInfoTable()
tbInfo = TOOL.tbInfo
end
local nLay = EgtGetParent(nEdgeId)
local tbIdLoopTC = FindEdges(nLay) -- tabella che contiene gli id degli Edge del loop
-- local nId = EgtGetFirstInGroup(nLay)
local i = tbInfo.nEdge -- posizione del lato nel layer del loop
if dPairAngCorr == nil then dPairAngCorr = 0 end
local nPrev = i > 1 and i - 1 or #tbIdLoopTC
local nNext = i < #tbIdLoopTC and i + 1 or 1
@@ -654,4 +737,10 @@ function TOOL.CreateParetina(i, tbIdLoopTC, tbInfo, dPairAngCorr)
tbInfo.dXOffset = dXOffset
end
function TOOL.CreateParetinaFull()
-- devo modificare anche la paretina precedente e la successiva
TOOL.CreateParetina()
end
return TOOL