- aggiunstamenti e generalizzazzioni.

This commit is contained in:
Daniele Bariletti
2025-01-23 14:34:59 +01:00
parent 8a3c3eca30
commit a5972bf40a
2 changed files with 120 additions and 99 deletions
+95 -66
View File
@@ -73,7 +73,7 @@ end
local function FillInfoTable()
if TOOL.nId then TOOL.tbInfo.nId = TOOL.nId end
if TOOL.nEdgeId then TOOL.tbInfo.nEdgeId = TOOL.nEdgeId end
if TOOL.nOutLayParent then TOOL.tbInfo.nOutLayParent = TOOL.nOutLayParent end
if TOOL.nOutLayParent and TOOL.nOutLayParent ~= GDB_ID.NULL then TOOL.tbInfo.nOutLayParent = TOOL.nOutLayParent end
if (not TOOL.tbInfo.nOutLayParent or TOOL.tbInfo.nOutLayParent == GDB_ID.NULL) and TOOL.nEdgeId and TOOL.nEdgeId ~= GDB_ID.NULL then EgtGetParent( TOOL.nEdgeId) end
if TOOL.nParent then TOOL.tbInfo.nParent = TOOL.nParent end
if (not TOOL.tbInfo.nParent or TOOL.tbInfo.nParent == GDB_ID.NULL) and TOOL.nEdgeId and TOOL.nEdgeId ~= GDB_ID.NULL then EgtGetParent(EgtGetParent( TOOL.nEdgeId)) end
@@ -98,7 +98,6 @@ end
local function FillInfoTableFromPart(nPartId)
if not nPartId or nPartId == GDB_ID.NULL then return end
TOOL.tbInfo.nId = nPartId
if TOOL.nOutLayParent and TOOL.nOutLayParent ~= GDB_ID.NULL then TOOL.tbInfo.nOutLayParent = TOOL.nOutLayParent end
TOOL.tbInfo.nPrevId = EgtGetInfo(nPartId,"Prev", "i")
TOOL.tbInfo.nNextId = EgtGetInfo(nPartId,"Next", "i")
TOOL.tbInfo.nJunctionType = EgtGetInfo(nPartId,"JunctionType", "i")
@@ -109,6 +108,11 @@ local function FillInfoTableFromPart(nPartId)
TOOL.tbInfo.dSideAngL = EgtGetInfo(nPartId,"SideAngL", "d")
TOOL.tbInfo.dLen = EgtGetInfo(nPartId,"Len", "d")
TOOL.tbInfo.dH = EgtGetInfo(nPartId,"H", "d")
TOOL.tbInfo.nEdge = EgtGetInfo(nPartId, "ParentEdge", "i")
TOOL.tbInfo.nParent = EgtGetInfo(nPartId, "Parent","i")
TOOL.nOutLayParent = EgtGetFirstNameInGroup(TOOL.tbInfo.nParent, "OutLoop")
if TOOL.nOutLayParent then TOOL.tbInfo.nOutLayParent = TOOL.nOutLayParent end
TOOL.tbInfo.nEdgeId = EgtGetFirstNameInGroup(TOOL.tbInfo.nOutLayParent, "A"..TOOL.tbInfo.nEdge)
-- TOOL.tbInfo.dBeta1 = EgtGetInfo(nPartId,"Beta1", "d")
-- TOOL.tbInfo.dBeta2 = EgtGetInfo(nPartId,"Beta2", "d")
end
@@ -121,6 +125,7 @@ function TOOL.WriteDataToChildPart(tbInfo)
if tbInfo.dLen then EgtSetInfo(tbInfo.nId, 'Len', tbInfo.dLen) end
if tbInfo.dAngDx then EgtSetInfo(tbInfo.nId, 'AngDx', tbInfo.dAngDx) end
if tbInfo.dAgnSx then EgtSetInfo(tbInfo.nId, 'AngSx', tbInfo.dAngSx) end
if tbInfo.bOnLoop then EgtSetInfo(tbInfo.nId, "OnLoop", tbInfo.bOnLoop) end
if tbInfo.dH then EgtSetInfo(tbInfo.nId, 'H', tbInfo.dH) end
if tbInfo.dTh then EgtSetInfo(tbInfo.nId, 'Th', tbInfo.dTh) end
-- if tbInfo.dBeta1 then EgtSetInfo(tbInfo.nId, 'Beta1', tbInfo.dBeta1) end
@@ -375,7 +380,7 @@ end
-- Nome dello spigolo,
-- Nome della copia riferimento
-- Info per spostamento Ref in funzione di una variabile
function TOOL.CreateReference( IdPart, sNameLayer,sNameEdge, sNameRef, dVar, sDir)
function TOOL.CreateReference( IdPart, sNameLayer,sNameEdge, dVar, sDir)
local tbLayer = TOOL.FindLayers( IdPart)
--accoppiamento di left su bottom
local IdEnt = EgtGetFirstNameInGroup(tbLayer[sNameLayer], sNameEdge)
@@ -386,6 +391,9 @@ function TOOL.CreateReference( IdPart, sNameLayer,sNameEdge, sNameRef, dVar, sDi
end
-- creo la copia dello spigolo come riferimento
local IdRef = EgtCopy( IdEnt, tbLayer['Ref'])
EgtSetInfo(IdRef, "OrigEdge", IdEnt)
local nNumRef = EgtGetGroupObjs(tbLayer['Ref'])
local sNameRef = "R"..tostring(nNumRef+ 1)
EgtSetName( IdRef, sNameRef)
if dVar and sDir then
EgtSetInfo(IdRef, 'Var', dVar)
@@ -432,13 +440,21 @@ end
-- Angolo relativo tra i due pezzi: porta la normale della regione del pezzo corrente a coincidere
-- con la normale della regione del pezzo destinatario; il segno è riferito al verso del riferimento del part destinatario
-- Modalità di accoppiamento tra gli spigoli (0: start-start, 1:start-end, 2: end-start, 3: end-end, 4: mid-mid)
function TOOL.SetPairInfo( sMyNamePart, sNameMyRef, sToNamePart, sNameToRef, nPairSpin, dPairAng, nPairMode)
local nPart = EgtGetFirstNameInGroup(GDB_ID.ROOT, sMyNamePart)
function TOOL.SetPairInfo( tbInfo, nIdMyRef, sToNamePart, nIdRefDest, nPairSpin)
local nPart = tbInfo.nId
local sNameMyRef = EgtGetName(nIdMyRef)
EgtSetInfo(nPart, "PairMyRef", sNameMyRef)
EgtSetInfo(nPart, "PairToRef", sToNamePart.."_"..sNameToRef)
local sNameRefDest = EgtGetName(nIdRefDest)
EgtSetInfo(nPart, "PairToRef", sToNamePart.."_"..sNameRefDest)
EgtSetInfo(nPart, "PairSpin", nPairSpin)
EgtSetInfo(nPart, "PairAng", dPairAng)
if nPairMode then EgtSetInfo(nPart, "PairMode", nPairMode) end
EgtSetInfo(nPart, "PairAng", tbInfo.dPairAng)
local nPairMode = 4
if tbInfo.nJunctionType == 1 then
nPairMode = 1
elseif tbInfo.nJunctionType == 2 then
nPairMode = 2
end
EgtSetInfo(nPart, "PairMode", nPairMode)
end
-- Disegna la quota lineare
@@ -610,10 +626,10 @@ function TJunction(dAngBetween, dTh1, dTh2, nType, dLen1, dLen2, bOnLoop)
dXOffset = dDeltaStart
elseif nType == 2 then
-- il trim end diventa un extend start
local dDeltaStart = - dTh1 / sin(dAngBetween)
if not bOnLoop then dDeltaStart = dDeltaStart - dTh2 * tan(90 - math.abs(dAngBetween)) end
dLen2 = dLen2 + dDeltaStart
dXOffset = math.abs(dDeltaStart)
local dDeltaStart = dTh1 / sin(dAngBetween)
if not bOnLoop then dDeltaStart = dDeltaStart + dTh2 * tan(90 - math.abs(dAngBetween)) end
dLen2 = dLen2 - dDeltaStart
dXOffset = dDeltaStart
-- accorcio l'end
dLen1 = dLen1 - dTh1 * tan(90- math.abs(dAngBetween))
end
@@ -719,18 +735,18 @@ function TOOL.CreateParetina(nEdgeId, tbInfo, dPairAngCorr)
local nPrev = i > 1 and i - 1 or #tbIdLoopTC
local nNext = i < #tbIdLoopTC and i + 1 or 1
if not tbInfo.nPrevId then tbInfo.nPrevId = GDB_ID.NULL end
local dPairAngPrev = (EgtGetInfo(tbInfo.nPrev, 'PairAng', 'd') or 0) + dPairAngCorr
local dPairAngPrev = (EgtGetInfo(tbInfo.nPrevId, 'PairAng', 'd') or 0) + dPairAngCorr
if not tbInfo.nNextId then tbInfo.nNextId = GDB_ID.NULL end
local dPairAngNext = (EgtGetInfo(tbInfo.nNext, 'PairAng', 'd') or 0) + dPairAngCorr
local dPairAng = (EgtGetInfo(tbInfo.nId, 'PairAng', 'd') or 0) + dPairAngCorr
local dPairAngNext = (EgtGetInfo(tbInfo.nNextId, 'PairAng', 'd') or 0) + dPairAngCorr
local dPairAng = (tbInfo.dPairAng or 0) + dPairAngCorr
local vtDirCurr = EgtSV( tbIdLoopTC[i], GDB_RT.GLOB)
local vtDirNext = EgtSV( tbIdLoopTC[nNext], GDB_RT.GLOB)
local vtDirPrev = EgtEV( tbIdLoopTC[nPrev], GDB_RT.GLOB)
local dLen = EgtCurveLength(tbIdLoopTC[i])
local dLenPrev = EgtCurveLength(tbIdLoopTC[#tbIdLoopTC])
local dLenPrev = EgtCurveLength(tbIdLoopTC[nPrev])
local dLenNext = EgtCurveLength(tbIdLoopTC[nNext])
local PrevAng, NextAng = GetPrevNextAng(tbIdLoopTC[i])
local dTh = tbInfo.dTh and tbInfo.dTh or EgtGetInfo(tbInfo.nId, 'dTh','d')
local dTh = tbInfo.dTh and tbInfo.dTh or EgtGetInfo(tbInfo.nId, 'dTh','d')
-- calcolo l'angolo di sformo con il pezzo precedente
local dXOffset = 0
@@ -738,22 +754,23 @@ function TOOL.CreateParetina(nEdgeId, 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, PrevAng)
local dSideAngDx, _, 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 PrevAng < 0 then dSideAng_4 = dSideAng_4 * (-1) end
tbInfo.dSideAngR = dSideAng_4
if tbInfo.bOnLoop then dSideAngDx = dSideAngDx * (-1) end
if PrevAng < 0 then dSideAngDx = dSideAngDx * (-1) end
tbInfo.dSideAngR = dSideAngDx
if not tbInfo.bOnLoop then
dLenPrev, dLen, dXOffset = ManageJunction(PrevAng,dTh, dTh,tbInfo.nJunctionType, dLenPrev, dLen)
dLenPrev, dLen, _ = 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(PrevAng,dTh, dTh,tbInfo.nJunctionType, dLenPrev, dLen)
dLenPrev, dLen, _ = ManageJunction(PrevAng,dTh, dTh,tbInfo.nJunctionType, dLenPrev, dLen)
-- setto il sideang da giunzione a T
local dSideAng_4 = 90 - math.abs(PrevAng)
if tbInfo.bOnLoop then dSideAng_4 = dSideAng_4 * (-1) end
tbInfo.dSideAngR = dSideAng_4
local dSideAngDx = 90 - math.abs(PrevAng)
if tbInfo.bOnLoop then dSideAngDx = dSideAngDx * (-1) end
tbInfo.dSideAngR = dSideAngDx
tbInfo.dAngBR = 90
end
else
-- setto il sideAng da giunzione a T (che va bene anche se la giunzione è angolata ma senza pezzo precedente)
@@ -763,7 +780,7 @@ function TOOL.CreateParetina(nEdgeId, tbInfo, dPairAngCorr)
tbInfo.dAngBR = 90
-- 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 - PrevAng)
local dOffset = dTh * tan( dSideAng)
dLen = dLen + dOffset
if tbInfo.nJunctionType == 1 then dXOffset = dXOffset + dOffset end
end
@@ -772,22 +789,23 @@ function TOOL.CreateParetina(nEdgeId, tbInfo, dPairAngCorr)
bSameSide = dPairAng * dPairAngNext > 0
if bSameSide then
if tbInfo.nJunctionType == 3 then
local dSideAng_2, dBeta_SX, __ = CalcDraftAngle( vtDirCurr, vtDirNext, dPairAng, dPairAngNext, NextAng)
local dSideAngSx, 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 NextAng < 0 then dSideAng_2 = dSideAng_2 * (-1) end
tbInfo.dSideAngL = dSideAng_2
if tbInfo.bOnLoop then dSideAngSx = dSideAngSx * (-1) end
if NextAng < 0 then dSideAngSx = dSideAngSx * (-1) end
tbInfo.dSideAngL = dSideAngSx
if not tbInfo.bOnLoop then
dLen, dLenNext = ManageJunction(NextAng, 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(NextAng, 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(NextAng)
if tbInfo.bOnLoop then dSideAng_2 = dSideAng_2 * (-1) end
tbInfo.dSideAngL = dSideAng_2
local dSideAngSx = 90 - math.abs(NextAng)
if tbInfo.bOnLoop then dSideAngSx = dSideAngSx * (-1) end
tbInfo.dSideAngL = dSideAngSx
tbInfo.dAngBL = 90
end
else
-- setto il sideAng da giunzione a T (che va bene anche se la giunzione è angolata ma senza pezzo successivo)
@@ -797,7 +815,7 @@ function TOOL.CreateParetina(nEdgeId, tbInfo, dPairAngCorr)
tbInfo.dAngBL = 90
-- 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 - NextAng)
local dOffset = dTh * tan( dSideAng)
dLen = dLen + dOffset
if tbInfo.nJunctionType == 2 then dXOffset = dXOffset + dOffset end
end
@@ -822,14 +840,24 @@ end
local function UpdateNeighInfo()
if not TOOL.nLay or TOOL.nLay == GDB_ID.NULL then TOOL.nLay = EgtGetParent(TOOL.nEdgeId) end
local nEdges = EgtGetGroupObjs(TOOL.nLay)
local nPrev = TOOL.tbInfo.nEdge > 1 and TOOL.tbInfo.nEdge - 1 or nEdges -- numero ordinale della paretina precedente alla corrente
-- al precedente setto il curr come Next
-- al corrente setto il prev
local sNamePrev = "A"..tostring(nPrev)
local nPrevId = EgtGetInfo(TOOL.tbInfo.nParent, sNamePrev, "i")
if nPrevId then EgtSetInfo(nPrevId, "Next", TOOL.tbInfo.nId) end
TOOL.tbInfo.nPrevId = EgtGetInfo(TOOL.tbInfo.nParent, sNamePrev, "i")
if TOOL.tbInfo.nPrevId then
EgtSetInfo(TOOL.tbInfo.nPrevId, "Next", TOOL.tbInfo.nId)
EgtSetInfo(TOOL.tbInfo.nId, "Prev", TOOL.tbInfo.nPrevId)
end
-- al successivo setto il curr come Prev
-- al corrente setto il next
local sNameNext = "A"..tostring(nNext)
local nNextId = EgtGetInfo(TOOL.tbInfo.nParent, sNameNext, "i")
if nNextId then EgtSetInfo(nNextId, "Prev", TOOL.tbInfo.nId) end
TOOL.tbInfo.nNextId = EgtGetInfo(TOOL.tbInfo.nParent, sNameNext, "i")
if TOOL.tbInfo.nNextId then
EgtSetInfo(TOOL.tbInfo.nNextId, "Prev", TOOL.tbInfo.nId)
EgtSetInfo(TOOL.tbInfo.nId, "Next", TOOL.tbInfo.nNextId)
end
end
function TOOL.CreateParetinaFull(bPrev, bNext)
@@ -837,14 +865,13 @@ function TOOL.CreateParetinaFull(bPrev, bNext)
if bNext == nil then bNext = TOOL.bNext end
-- se non ho ricevuto input li recupero dalla tabella generale
if not TOOL.nEdgeId or TOOL.nEdgeId == GDB_ID.NULL then return end
TOOL.nLay = EgtGetParent(TOOL.nEdgeId)
TOOL.tbInfo.nEdgeId = TOOL.nEdgeId
TOOL.tbIdLoop = FindEdges(TOOL.nLay, TOOL.tbInfo) -- tabella che contiene gli id degli Edge del loop
if #TOOL.tbInfo == 0 then
if not TOOL.nEdgeId then return end
if not TOOL.tbInfo.nId then
-- recupero tutte le info che mi servono (che vengono messe in TOOL.tbInfo)
FillInfoTable()
end
TOOL.tbInfo.nLay = EgtGetParent(TOOL.tbInfo.nEdgeId)
TOOL.tbIdLoop = FindEdges(TOOL.tbInfo.nLay, TOOL.tbInfo) -- tabella che contiene gli id degli Edge del loop
-- controllo se nelle info del parent se era già stato creato il part associato a quel lato
local sEdgeName = EgtGetName(TOOL.tbInfo.nEdgeId)
@@ -862,23 +889,20 @@ function TOOL.CreateParetinaFull(bPrev, bNext)
-- se esisteva già ripulisco i layer della regione e del loop ed elimino il solido
ClearPart(nChildPart)
TOOL.tbInfo.nId = nChildPart
-- recupero l'id di eventuali vicini
TOOL.tbInfo.nPrevId = EgtGetInfo(TOOL.tbInfo.nId, "Prev", "i") or GDB_ID.NULL
TOOL.tbInfo.nNextId = EgtGetInfo(TOOL.tbInfo.nId, "Next", "i") or GDB_ID.NULL
end
TOOL.tbInfo.sName = EgtGetName(TOOL.tbInfo.nId)
local tbLayers = TOOL.FindLayers(TOOL.tbInfo.nId)
TOOL.tbInfo.nOutLay = tbLayers["OutLoop"]
-- verifico se esistono dei vicini da modificare dopo la creazione di questo pezzo
local nEdges = EgtGetGroupObjs(TOOL.nLay)
local nPrev = TOOL.tbInfo.nEdge > 1 and TOOL.tbInfo.nEdge - 1 or nEdges -- numero ordinale della paretina precedente alla corrente
TOOL.tbInfo.nPrevId = EgtGetInfo(TOOL.tbInfo.nParent, "A"..tostring(nPrev), "i") -- id del part della paretina precedente alla corrente
local nNext = TOOL.tbInfo.nEdge == nEdges and 1 or TOOL.tbInfo.nEdge + 1
TOOL.tbInfo.nNextId = EgtGetInfo(TOOL.tbInfo.nParent, "A"..tostring(nNext), "i")
TOOL.CreateParetina()
TOOL.CreateAdjustedPart()
TOOL.CreatePart()
-- setto i sideAng
if TOOL.tbInfo.dSideAngL then TOOL.SetSideAng(tbLayers['OutLoop'], 'A2', TOOL.tbInfo.dSideAngL) end
if TOOL.tbInfo.dSideAngR then TOOL.SetSideAng(tbLayers['OutLoop'], 'A4', TOOL.tbInfo.dSideAngR) end
if TOOL.tbInfo.dSideAngL then TOOL.SetSideAng(tbLayers['OutLoop'], 'A2', TOOL.tbInfo.dSideAngR) end
if TOOL.tbInfo.dSideAngR then TOOL.SetSideAng(tbLayers['OutLoop'], 'A4', TOOL.tbInfo.dSideAngL) end
-- creo i riferimenti e salvo i parametri del part
local sNamePartDest = EgtGetName(TOOL.tbInfo.nParent)
local sEdgeDest = EgtGetName(TOOL.tbInfo.nEdgeId)
@@ -898,21 +922,26 @@ function TOOL.CreateParetinaFull(bPrev, bNext)
TOOL.tbInfo.sRefOff = tostring(TOOL.tbInfo.dXOffset)..','..tostring(TOOL.tbInfo.dYOffset)..',-x'
end
TOOL.tbInfo.dThParent = EgtGetInfo(TOOL.tbInfo.nParent, "Th", "d")
TOOL.CreateReference( TOOL.tbInfo.nParent, sLayEdgeDest, sEdgeDest, sRefDest, TOOL.tbInfo.dThParent, TOOL.tbInfo.sDestRefOff)
TOOL.CreateReference( TOOL.tbInfo.nId, 'OutLoop', 'A1', 'R1', TOOL.tbInfo.dTh, TOOL.tbInfo.sRefOff)
TOOL.SetPairInfo( TOOL.tbInfo.sName, 'R1', sNamePartDest, sRefDest, -1, TOOL.tbInfo.dPairAng, 4)
local nIdRefDest = TOOL.CreateReference( TOOL.tbInfo.nParent, sLayEdgeDest, sEdgeDest, TOOL.tbInfo.dThParent, TOOL.tbInfo.sDestRefOff)
local nIdMyRef = TOOL.CreateReference( TOOL.tbInfo.nId, 'OutLoop', 'A1', TOOL.tbInfo.dTh, TOOL.tbInfo.sRefOff)
TOOL.SetPairInfo( TOOL.tbInfo, nIdMyRef, sNamePartDest, nIdRefDest, -1)
-- devo modificare anche la paretina precedente e la successiva
-- modifico anche la paretina precedente(se esiste)
local nNextId = TOOL.tbInfo.nNextId
local nCurr = TOOL.tbInfo.nId
FillInfoTableFromPart(TOOL.tbInfo.nPrevId)
if bPrev and TOOL.tbInfo.nPrevId and TOOL.tbInfo.nPrevId ~= GDB_ID.NULL then TOOL.CreateParetinaFull(false, false) end
-- modifico anche la paretina successiva(se esiste)
FillInfoTableFromPart(nNextId)
if bNext and TOOL.tbInfo.nNextId and TOOL.tbInfo.nNextId ~= GDB_ID.NULL then TOOL.CreateParetinaFull(false, false) end
-- -- devo modificare anche la paretina precedente e la successiva
-- -- modifico anche la paretina precedente(se esiste)
-- local nNextId = TOOL.tbInfo.nNextId
-- local nCurr = TOOL.tbInfo.nId
-- if bPrev and TOOL.tbInfo.nPrevId and TOOL.tbInfo.nPrevId ~= GDB_ID.NULL then
-- FillInfoTableFromPart(TOOL.tbInfo.nPrevId)
-- TOOL.CreateParetinaFull(false, false)
-- end
-- -- modifico anche la paretina successiva(se esiste)
-- if bNext and TOOL.tbInfo.nNextId and TOOL.tbInfo.nNextId ~= GDB_ID.NULL then
-- FillInfoTableFromPart(nNextId)
-- TOOL.CreateParetinaFull(false, false)
-- end
-- creo il solido e lo accoppio
local nCurr = TOOL.tbInfo.nId -- debug -- SARà DA TOGLIERE quando scommento la parte di aggiornamento prev e next
if SLD then
SLD.CurrId = nCurr
SLD.Main()
+25 -33
View File
@@ -179,9 +179,9 @@ local function CreateBottomPart( tbIdLoop, nParent)
local ptCenter = EgtGP( EgtGetFirstInGroup(tbLayerBottom['Region']), GDB_RT.GLOB)
TOOL.CreateCircularHole( Pz_Bottom, ptCenter, CMP.DiamBore)
-- creo i riferimenti e salvo i parametri del part
TOOL.CreateReference( nParent, 'OutLoop', 'A1', 'R1', tbPart.dTh, tbPart.sDestRefOff)
TOOL.CreateReference( tbPart.nId, 'OutLoop', 'A4', 'R4', 0, tbPart.sRefOff)
TOOL.SetPairInfo( tbPart.sName, 'R4', sNamePartDest, 'R1', -1, tbPart.dPairAng, 4)
local nIdRefDest = TOOL.CreateReference( nParent, 'OutLoop', 'A1', tbPart.dTh, tbPart.sDestRefOff)
local nIdMyRef = TOOL.CreateReference( tbPart.nId, 'OutLoop', 'A4', 0, tbPart.sRefOff)
TOOL.SetPairInfo( tbPart, nIdMyRef, sNamePartDest, nIdRefDest, -1)
end
local function CreateSplitBottomPart( tbIdLoop, tbParent, dOffset)
@@ -240,9 +240,9 @@ local function CreateSplitBottomPart( tbIdLoop, tbParent, dOffset)
-- creo i riferimenti e salvo i parametri del part
local nPartDestId = tbParent[c]
c = c + 1
TOOL.CreateReference( nPartDestId, 'OutLoop', 'A1', 'R1', tbPart.dTh, tbPart.sDestRefOff)
TOOL.CreateReference( tbPart.nId, 'OutLoop', 'A1', 'R1', 0, tbPart.sRefOff)
TOOL.SetPairInfo( tbPart.sName, 'R1', sNamePartDest, 'R1', -1, tbPart.dPairAng, 4)
local nIdToRef = TOOL.CreateReference( nPartDestId, 'OutLoop', 'A1', 'R1', tbPart.dTh, tbPart.sDestRefOff)
local nMyRef = TOOL.CreateReference( tbPart.nId, 'OutLoop', 'A1', 'R1', 0, tbPart.sRefOff)
TOOL.SetPairInfo( tbPart, nMyRef, sNamePartDest, nIdToRef, -1)
end
EgtErase(nAuxLay)
@@ -289,7 +289,7 @@ function CMP_Draw(bPreview)
CMP.dSlopeAng = CMP.V9 -- angolo di pendenza
-- PIANO POLLO
local Pz_Top = TOOL.CreatePartLayer( 'TopChicken', sUNICode)
local Pz_Top = TOOL.CreatePartLayer( 'TopChicken')
-- Creo il contorno esterno (id degli edge esterni)
local tbLoopsTC = ImportLoop( Pz_Top, TOOL.FindLayers( Pz_Top), sPath .. 'TopChicken.nge')
local tbIdLoopTC = tbLoopsTC[1]
@@ -326,15 +326,15 @@ function CMP_Draw(bPreview)
local dPairAng = 0
if nType == 1 then
dPairAng = dAngAlzatina
EgtSetInfo(Pz_A, 'dTh', CMP.SSplash)
EgtSetInfo(Pz_A, 'dH', CMP.HSplash)
tbInfo.dTh = CMP.SSplash
tbInfo.dH = CMP.HSplash
elseif nType == 2 then
dPairAng = dAngFrontalino
EgtSetInfo(Pz_A, 'dTh', CMP.SWater)
EgtSetInfo(Pz_A, 'dH', CMP.HWater)
tbInfo.dTh = CMP.SWater
tbInfo.dH = CMP.HWater
end
tbInfo.nType = nType
EgtSetInfo(Pz_A, 'PairAng', dPairAng)
tbInfo.dPairAng = dPairAng
nPrev = Pz_A
tbPartsInfo[tbInfo.nId] = tbInfo
@@ -365,9 +365,9 @@ function CMP_Draw(bPreview)
dPairAng = dAngFrontalino
end
tbInfo.nType = nType
EgtSetInfo(Pz_A, 'PairAng', dPairAng)
EgtSetInfo(Pz_A, 'dTh', CMP.SWater)
EgtSetInfo(Pz_A, 'dH', CMP.DSink)
tbInfo.dPairAng = dPairAng
tbInfo.dTh = CMP.SWater
tbInfo.dH = CMP.DSink
nPrev = Pz_A
tbInfo.bInLoop = true
tbPartsInfo[tbInfo.nId] = tbInfo
@@ -385,16 +385,10 @@ function CMP_Draw(bPreview)
EgtSetInfo(tbInfo.nId, "Base", Pz_Top)
-- procedo a raccogliere tutte le altre info che mi servono per creare il pezzo
local nType = tbInfo.nType
local dH = EgtGetInfo(nPart, 'dH', 'd')
tbInfo.dH = dH
local dTh = EgtGetInfo(nPart, 'dTh', 'd')
local dPairAng = EgtGetInfo(nPart, 'PairAng', 'd')
if nType == 1 then
----- caratteristiche alzatina
tbInfo.dPairAng = dPairAng
tbInfo.dSideAngT = dPairAng - 90 -- side ang del lato top
tbInfo.dTh = dTh
tbInfo.dYOffset = dTh * tan(tbInfo.dSideAngT)
tbInfo.dSideAngT = tbInfo.dPairAng - 90 -- side ang del lato top
tbInfo.dYOffset = tbInfo.dTh * tan(tbInfo.dSideAngT)
--nJunctionType = 2 -- trim end
--nJunctionType = 1 -- trim start
tbInfo.nJunctionType = 1 -- angle junction
@@ -402,10 +396,8 @@ function CMP_Draw(bPreview)
----- caratteristiche alzatina
elseif nType == 2 then
----- caratteristiche frontalino
tbInfo.dPairAng = dPairAng
tbInfo.dSideAngT = -( -dPairAng - 90) -- side ang del lato top
tbInfo.dTh = dTh
tbInfo.dYOffset = dTh * tan(tbInfo.dSideAngT)
tbInfo.dSideAngT = tbInfo.dPairAng + 90 -- side ang del lato top
tbInfo.dYOffset = tbInfo.dTh * tan(tbInfo.dSideAngT)
tbInfo.nJunctionType = 3 -- angle junction
tbInfo.bOnLoop = true
----- caratteristiche forntalino
@@ -438,13 +430,13 @@ function CMP_Draw(bPreview)
local tbIdLoop = TOOL.CreateAdjustedPart( tbLayer['OutLoop'],tbPart.dLen, tbPart.dH, tbPart.dAngBL, tbPart.dAngBR)
TOOL.CreatePart(tbLayer['OutLoop'],tbPart)
if not tbPart.bInLoop then
TOOL.CreateReference( tbPart.nParent, 'OutLoop', 'A'..tostring(nEdge), 'R'..tostring(nEdge), dTh_TC, tbPart.sDestRefOff)
TOOL.CreateReference( tbPart.nId, 'OutLoop', 'A3', 'R3', tbPart.dTh, tbPart.sRefOff)
TOOL.SetPairInfo( tbPart.sName, 'R3', 'TopChicken', 'R'..tostring(nEdge), -1, tbPart.dPairAng, 2)
local nIdRefDest = TOOL.CreateReference( tbPart.nParent, 'OutLoop', 'A'..tostring(nEdge), dTh_TC, tbPart.sDestRefOff)
local nIdMyRef = TOOL.CreateReference( tbPart.nId, 'OutLoop', 'A3', tbPart.dTh, tbPart.sRefOff)
TOOL.SetPairInfo( tbPart, nIdMyRef, 'TopChicken', nIdRefDest, -1)
else
TOOL.CreateReference( tbPart.nParent, 'InLoop', 'A'..tostring(nEdge), 'R'..tostring(nEdge+#tbIdLoopTC), dTh_TC, tbPart.sDestRefOff)
TOOL.CreateReference( tbPart.nId, 'OutLoop', 'A3', 'R3', tbPart.dTh, tbPart.sRefOff)
TOOL.SetPairInfo( tbPart.sName, 'R3', 'TopChicken', 'R'..tostring(nEdge+#tbIdLoopTC), -1, tbPart.dPairAng, 2)
local nIdRefDest = TOOL.CreateReference( tbPart.nParent, 'InLoop', 'A'..tostring(nEdge), dTh_TC, tbPart.sDestRefOff)
local nIdMyRef = TOOL.CreateReference( tbPart.nId, 'OutLoop', 'A3', tbPart.dTh, tbPart.sRefOff)
TOOL.SetPairInfo( tbPart, nIdMyRef, 'TopChicken', nIdRefDest, -1)
end
if tbPart.dSideAngL then TOOL.SetSideAng(tbLayer['OutLoop'], 'A2', tbPart.dSideAngL) end
if tbPart.dSideAngR then TOOL.SetSideAng(tbLayer['OutLoop'], 'A4', tbPart.dSideAngR) end