miglioramento dell'autopair.

This commit is contained in:
Daniele Bariletti
2025-01-03 16:39:16 +01:00
parent a4fea15aee
commit 950f9bf303
+11 -2
View File
@@ -799,7 +799,7 @@ function ASS.PairAll()
local nLayRef = EgtGetFirstNameInGroup(nPart, sLayName)
local nMyLineToPair = EgtGetFirstNameInGroup(nLayRef, sMyLineToPairName)
if nMyLineToPair == nil or nMyLineToPair == GDB_ID.NULL then ASS.ERR = -3 return false end
-- spezzo l'informazione per risalire al lato di destionazione dell'accoppiamento
-- spezzo l'informazione per risalire al lato di destinazione dell'accoppiamento
local vToInfo = EgtSplitString(sLineToPair, "_")
local sLineToPairName = vToInfo[3]
local sPartName = vToInfo[1].."_"..vToInfo[2]
@@ -808,6 +808,14 @@ function ASS.PairAll()
local nLineToPair = EgtGetFirstNameInGroup(nLay, sLineToPairName)
if nLineToPair == nil or nLineToPair == GDB_ID.NULL then ASS.ERR = -3 return false end
-- controllo se il pezzo è già stato accoppiato con la sua destinazione
local tbPaired = EgtGetInfo(nPart, "Paired","vi")
local bAlreadyPaired = false
for _, nPaired in pairs(tbPaired) do
if nPaired == nPartToPair then bAlreadyPaired = true end
if bAlreadyPaired then goto NEXT end
end
local nSpin = EgtGetInfo(nPart, "PairSpin", "i")
ASS.nPartId = nPart
ASS.nIdFirstLine = nMyLineToPair
@@ -826,7 +834,7 @@ function ASS.PairAll()
if not ASS.FlipParallel() then return false end
end
-- recupero l'angolo che deve esserci tra le due facce dei part alla fine dell'accoppiamento
local nAngGoal = EgtGetInfo(nPart, "PairAng", "i")
local nAngGoal = EgtGetInfo(nPart, "PairAng", "d")
-- calcolo l'angolo attuale tra le due normali e quindi la rotazione che devo applicare per differenza
local vtSurf1 = RetrieveSurfNorm(nPart)
local vtSurf2 = RetrieveSurfNorm(RetrieveParent(ASS.nIdSecondLine))
@@ -843,6 +851,7 @@ function ASS.PairAll()
if not ASS.UpdatePairInfo() then return false end
nTrasfTot = nTrasfTot + 1
end
::NEXT::
nPart = EgtGetNext(nPart)
end
ASS.nTransf = nTrasfTot