- gestione degli offset una tantum dei riferimenti, durante la creazione dei solidi

- gestione dimensione foro nel fondello split.
This commit is contained in:
Daniele Bariletti
2024-12-20 17:54:02 +01:00
parent 28922eff89
commit a4fea15aee
3 changed files with 38 additions and 32 deletions
+21 -15
View File
@@ -760,22 +760,28 @@ local function CorrectReference()
local nLayRef = EgtGetFirstNameInGroup( IdFP, "Ref")
local nRef = EgtGetFirstInGroup(nLayRef)
while nRef do
local var = EgtGetInfo(nRef, "Var")
if var == "Th" then
var = RTh
else
var = EgtGetInfo(nRef, "Var", "i")
end
local dir = EgtGetInfo(nRef, "Dir")
if dir then
local tbDir = EgtSplitString(dir,",")
local vtDir = {}
for _,sDir in pairs(tbDir) do
sDir = sDir:gsub("x", EgtNumToString(var))
table.insert(vtDir, EgtEvalNumExpr(sDir))
-- controllo se l'offset ai riferimenti è già stato eseguito
local bDone = EgtGetInfo(nRef, 'OffsetDone')
if not bDone then
local var = EgtGetInfo(nRef, "Var")
if var == "Th" then
var = RTh
else
var = EgtGetInfo(nRef, "Var", "i")
end
vtDir = Vector3d(vtDir)
EgtMove(nRef,vtDir, GDB_RT.GLOB)
local dir = EgtGetInfo(nRef, "Dir")
if dir then
local tbDir = EgtSplitString(dir,",")
local vtDir = {}
for _,sDir in pairs(tbDir) do
sDir = sDir:gsub("x", EgtNumToString(var))
table.insert(vtDir, EgtEvalNumExpr(sDir))
end
vtDir = Vector3d(vtDir)
EgtMove(nRef,vtDir, GDB_RT.GLOB)
end
-- setto l'info che certifica che l'offset è stato eseguito
EgtSetInfo(nRef, 'OffsetDone', true)
end
nRef = EgtGetNext(nRef)
end
+15 -15
View File
@@ -578,7 +578,7 @@ function TOOL.CreateParetina(i, tbIdLoopTC, tbInfo, dPairAngCorr)
local dLen = EgtCurveLength(tbIdLoopTC[i])
local dLenPrev = EgtCurveLength(tbIdLoopTC[#tbIdLoopTC])
local dLenNext = EgtCurveLength(tbIdLoopTC[nNext])
local PAng, NAng = GetPrevNextAng(tbIdLoopTC[i])
local PrevAng, NextAng = GetPrevNextAng(tbIdLoopTC[i])
local dTh = EgtGetInfo(tbInfo.nId, 'dTh','d')
-- calcolo l'angolo di sformo con il pezzo precedente
@@ -587,32 +587,32 @@ function TOOL.CreateParetina(i, tbIdLoopTC, tbInfo, dPairAngCorr)
local bSameSide = dPairAng * dPairAngPrev > 0
if bSameSide then
if tbInfo.nJunctionType == 3 then
local dSideAng_4, _, dBeta_DX = CalcDraftAngle( vtDirPrev, vtDirCurr, dPairAngPrev, dPairAng, PAng)
local dSideAng_4, _, dBeta_DX = CalcDraftAngle( vtDirPrev, vtDirCurr, dPairAngPrev, dPairAng, PrevAng)
--tbInfo.dAngBR = 180 - dBeta_DX
tbInfo.dAngBR = dBeta_DX
if tbInfo.bOnLoop then dSideAng_4 = dSideAng_4 * (-1) end
if PAng < 0 then dSideAng_4 = dSideAng_4 * (-1) end
if PrevAng < 0 then dSideAng_4 = dSideAng_4 * (-1) end
tbInfo.dSideAngR = dSideAng_4
if not tbInfo.bOnLoop then
dLenPrev, dLen, dXOffset = ManageJunction(PAng,dTh, dTh,tbInfo.nJunctionType, dLenPrev, dLen)
dLenPrev, dLen, dXOffset = ManageJunction(PrevAng,dTh, dTh,tbInfo.nJunctionType, dLenPrev, dLen)
end
else
-- se ho una giunzione a T allora devo aggiustare la lunghezza dei pezzi sia che la faccia sia On, sia che sia Off
dLenPrev, dLen, dXOffset = ManageJunction(PAng,dTh, dTh,tbInfo.nJunctionType, dLenPrev, dLen)
dLenPrev, dLen, dXOffset = ManageJunction(PrevAng,dTh, dTh,tbInfo.nJunctionType, dLenPrev, dLen)
-- setto il sideang da giunzione a T
-- setto il sideang da giunzione a T
local dSideAng_4 = 90 - math.abs(PAng)
local dSideAng_4 = 90 - math.abs(PrevAng)
if tbInfo.bOnLoop then dSideAng_4 = dSideAng_4 * (-1) end
tbInfo.dSideAngR = dSideAng_4
end
else
-- setto il sideAng da giunzione a T (che va bene anche se la giunzione è angolata ma senza pezzo precedente)
local dSideAng = PAng < 0 and (90 + PAng) or 90-PAng
local dSideAng = PrevAng < 0 and (90 + PrevAng) or 90-PrevAng
if tbInfo.bOnLoop then dSideAng = dSideAng * (-1) end
tbInfo.dSideAngR = dSideAng
-- visto che il pezzo precedente non è dallo stesso lato allora corrego l'estensione del pezzo corrente (in funzione del suo spessore)
if not tbInfo.bOnLoop then
local dOffset = dTh * tan( 90 - PAng)
local dOffset = dTh * tan( 90 - PrevAng)
dLen = dLen + dOffset
if tbInfo.nJunctionType == 1 then dXOffset = dXOffset + dOffset end
end
@@ -621,31 +621,31 @@ function TOOL.CreateParetina(i, tbIdLoopTC, tbInfo, dPairAngCorr)
bSameSide = dPairAng * dPairAngNext > 0
if bSameSide then
if tbInfo.nJunctionType == 3 then
local dSideAng_2, dBeta_SX, __ = CalcDraftAngle( vtDirCurr, vtDirNext, dPairAng, dPairAngNext, NAng)
local dSideAng_2, dBeta_SX, __ = CalcDraftAngle( vtDirCurr, vtDirNext, dPairAng, dPairAngNext, NextAng)
-- tbInfo.dAngBL = 180 - dBeta_SX
tbInfo.dAngBL = dBeta_SX
if tbInfo.bOnLoop then dSideAng_2 = dSideAng_2 * (-1) end
if NAng < 0 then dSideAng_2 = dSideAng_2 * (-1) end
if NextAng < 0 then dSideAng_2 = dSideAng_2 * (-1) end
tbInfo.dSideAngL = dSideAng_2
if not tbInfo.bOnLoop then
dLen, dLenNext = ManageJunction(NAng, dTh, dTh, tbInfo.nJunctionType, dLen, dLenNext)
dLen, dLenNext = ManageJunction(NextAng, dTh, dTh, tbInfo.nJunctionType, dLen, dLenNext)
end
else
-- se ho una giunzione a T allora devo aggiustare la lunghezza dei pezzi sia che la faccia sia On, sia che sia Off
dLen, dLenNext = ManageJunction(NAng, dTh, dTh, tbInfo.nJunctionType, dLen, dLenNext)
dLen, dLenNext = ManageJunction(NextAng, dTh, dTh, tbInfo.nJunctionType, dLen, dLenNext)
-- setto il sideang da giunzione a T
local dSideAng_2 = 90 - math.abs(NAng)
local dSideAng_2 = 90 - math.abs(NextAng)
if tbInfo.bOnLoop then dSideAng_2 = dSideAng_2 * (-1) end
tbInfo.dSideAngL = dSideAng_2
end
else
-- setto il sideAng da giunzione a T (che va bene anche se la giunzione è angolata ma senza pezzo successivo)
local dSideAng = NAng < 0 and (90 + NAng) or 90-NAng
local dSideAng = NextAng < 0 and (90 + NextAng) or 90-NextAng
if tbInfo.bOnLoop then dSideAng = dSideAng * (-1) end
tbInfo.dSideAngL = dSideAng
-- visto che il pezzo successivo non è dallo stesso lato allora correggo l'estensione del pezzo corrente (in funzione del suo spessore)
if not tbInfo.bOnLoop then
local dOffset = dTh * tan( 90 - NAng)
local dOffset = dTh * tan( 90 - NextAng)
dLen = dLen + dOffset
if tbInfo.nJunctionType == 2 then dXOffset = dXOffset + dOffset end
end
+2 -2
View File
@@ -225,7 +225,7 @@ local function CreateSplitBottomPart( tbIdLoop, nParent, dOffset)
EgtSetInfo(Pz_Bottom, 'PairAng', tbPart.dPairAng)
tbPart.nJunctionType = 3
tbPart.bOnLoop = true
tbPart.dH = EgtPointCurveDist( ptCenter, tbLoopOff[i], GDB_RT.GLOB) - 15
tbPart.dH = (EgtPointCurveDist( ptCenter, tbLoopOff[i], GDB_RT.GLOB) - CMP.DiamBore) / cos(CMP.dSlopeAng)
tbPart.nPrev = nPrev
if i > 1 then tbSplitBottom[nPrev].nNext = Pz_Bottom end
tbSplitBottom[Pz_Bottom] = tbPart
@@ -459,7 +459,7 @@ function CMP_Draw(bPreview)
--CreateBottomPart( tbIdInLoopTC, 'InPartA4')
CreateSplitBottomPart( tbIdInLoopTC, Pz_Top, CMP.SWater)
TOOL.SaveMePlease()
--TOOL.SaveMePlease()
TOOL.CreateDimensionLayer()