- gestito il caso di selezione randomico dei part per la creazione di uno split bottom.

This commit is contained in:
Daniele Bariletti
2025-02-07 17:29:20 +01:00
parent 2e01ccac6e
commit e407e75d29
+22 -9
View File
@@ -342,8 +342,8 @@ function TOOL.AddInLoopToPart(nLayLoop)
if not EgtSurfFrSubtract( IdOutRegion,IdReg) then
CMP.ERR = 5
CMP.MSG = CMP.MSG.." Sottrazione tra superficie 'OutLoop' "..EgtNumToString(IdOutRegion).." e 'InLoop' "..EgtNumToString(IdReg).." non riuscita."
end
EgtErase(IdReg)
end
EgtErase(IdReg)
end
-- elimino il contorno chiuso
@@ -935,7 +935,7 @@ function TOOL.CreateParetina(nEdgeId, tbInfo, dPairAngCorr)
tbInfo.dXOffset = dXOffset
end
local function CreateSplitBottomPart(tbInfo, i, tbIdEdges, ptCenter, nPrev, nFirst)
local function CreateSplitBottomPart(tbInfo, i, tbIdEdges, nPrev, nFirst)
local Pz_Bottom = GDB_ID.NULL
-- devo verificare se la paretina esiste già allora devo distruggerla e ricrearla, sennò la creo da zero
local nChildPart = EgtGetFirstNameInGroup(GDB_ID.ROOT, EgtGetInfo(tbInfo.nParent, "A"..tbInfo.nEdge))
@@ -1044,10 +1044,6 @@ function TOOL.CreateSplitBottom( tbIdEdges, dOffset)
table.remove(tbIdEdges, 1)
end
local tbParent = {}
for _, nEdgeId in pairs(tbIdEdges) do
table.insert(tbParent, EgtGetParent(EgtGetParent(nEdgeId)))
end
if not dOffset then
if TOOL.dOffset then
dOffset = TOOL.dOffset
@@ -1059,8 +1055,25 @@ function TOOL.CreateSplitBottom( tbIdEdges, dOffset)
local nAuxPart = EgtGroup(GDB_ID.ROOT)
local nAuxLay = EgtGroup(nAuxPart)
local nLoop = EgtCurveCompoByChain(nAuxLay, tbIdEdges, EgtSP(tbIdEdges[1], GDB_RT.GLOB), false)
-- ora che ho gli edge nell'ordine giusto ricostruisco la tabella dei parent
local tbIdEdgesOrd = {}
for i = 1, #tbIdEdges do
local ptStart = EgtUP(nLoop, i - 1, GDB_ID.ROOT)
for j = 1, #tbIdEdges do
if dist(ptStart, EgtSP(tbIdEdges[j], GDB_ID.ROOT)) < 0.001 then
table.insert(tbIdEdgesOrd, tbIdEdges[j])
break
end
end
end
tbIdEdges = tbIdEdgesOrd
local tbParent = {}
for _, nEdgeId in pairs(tbIdEdges) do
table.insert(tbParent, EgtGetParent(EgtGetParent(nEdgeId)))
end
EgtOffsetCurve(nLoop, -dOffset, GDB_OT.EXTEND) -- N.B.: qui spero che si sia mantenuto il numero di curve e di poter ancora associare le curve di offset con quelle originali e con il relativo part di origine
local ptCenter = EgtGP(nLoop, GDB_RT.GLOB)
local dOffsetMax = EgtCurveMaxOffset(nLoop)
TOOL.tbIdLoop = TOOL.ExplodeAndNameEdges( nLoop, false)
@@ -1083,7 +1096,7 @@ function TOOL.CreateSplitBottom( tbIdEdges, dOffset)
local dThParent = EgtGetInfo(tbInfo.nParent, "Th", "d") or 0
tbInfo.dH = ((dOffsetMax - TOOL.dDiamBore/2) + dThParent) / cos(TOOL.dSlopeAng)
tbInfo.nEdge = 3 -- so già che il pezzo che creo si attaccherà al lato A3 del loop della paretina del lavandino
nPrev = CreateSplitBottomPart(tbInfo, i, tbIdEdges, ptCenter, nPrev, nFirst)
nPrev = CreateSplitBottomPart(tbInfo, i, tbIdEdges, nPrev, nFirst)
-- modifico le paretine vicine se serve
local nNextId = TOOL.tbInfo.nNextId