From cb472f40712dd48aa4ba99e08400ca56904c3e36 Mon Sep 17 00:00:00 2001 From: Daniele Bariletti Date: Thu, 16 Jan 2025 14:56:33 +0100 Subject: [PATCH] - aggiustamenti per l'aggiornamento delle funzioni di TemplateTool. --- TopChicken.lua | 57 ++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/TopChicken.lua b/TopChicken.lua index cfc83c4..021ea40 100644 --- a/TopChicken.lua +++ b/TopChicken.lua @@ -160,17 +160,6 @@ function ImportLoop( PartId, tbLayer, sNameFileNGE) end -- -local function WriteDataToChildPart(nParent, nPart, nEdge, dLen, dAngDx, dAngSx, dH, dTh) - if not nPart then do return end 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 -end - -- sNamePartDest deve essere il pezzo al cui lato A1 si attacca il lato A4 del pezzo Bottom local function CreateBottomPart( tbIdLoop, sNamePartDest, nParent) -- creo il fondo del lavello @@ -194,7 +183,7 @@ local function CreateBottomPart( tbIdLoop, sNamePartDest, nParent) TOOL.CreateReference( sUNICode, sNamePartDest, 'OutLoop', 'A1', 'R1', tbPart.dTh, tbPart.sDestRefOff) TOOL.CreateReference(sUNICode, tbPart.sName, 'OutLoop', 'A4', 'R4', 0, tbPart.sRefOff) TOOL.SetPairInfo(sUNICode, tbPart.sName, 'R4', sNamePartDest, 'R1', -1, tbPart.dPairAng, 4) - WriteDataToChildPart(nParent, Pz_Bottom, nEdge,tbPart.dLen,tbPart.dAngBR, tbPart.dAngBL, tbPart.dH, tbPart.dTh) + TOOL.WriteDataToChildPart(nParent, Pz_Bottom, nEdge,tbPart.dLen,tbPart.dAngBR, tbPart.dAngBL, tbPart.dH, tbPart.dTh) end local function CreateSplitBottomPart( tbIdLoop, nParent, dOffset) @@ -217,6 +206,7 @@ local function CreateSplitBottomPart( tbIdLoop, nParent, dOffset) tbPart.sName = 'BottomA'..tostring(i) tbPart.nId = Pz_Bottom tbPart.nEdge = i + tbPart.nEdgeId = tbLoopOff[i] tbPart.dTh = CMP.SB EgtSetInfo(Pz_Bottom, 'dTh', CMP.SB) tbPart.sDestRefOff = '0,0,-x' @@ -225,7 +215,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) - CMP.DiamBore) / cos(CMP.dSlopeAng) + tbPart.dH = (EgtPointCurveDist( ptCenter, tbPart.nEdgeId, 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 @@ -238,7 +228,7 @@ local function CreateSplitBottomPart( tbIdLoop, nParent, dOffset) for nPart, tbPart in pairs(tbSplitBottom) do local tbLayerBottom = TOOL.FindLayers(nPart) local bInLoop = false - TOOL.CreateParetina( tbPart.nEdge, tbLoopOff, tbPart, 90) + TOOL.CreateParetina( tbPart.nEdgeId, tbPart, 90) -- tbPart.dLen = 300 + CMP.SWater * 2 -- tbPart.dAngBL = 46 -- tbPart.dAngBR = 46 @@ -254,7 +244,7 @@ local function CreateSplitBottomPart( tbIdLoop, nParent, dOffset) TOOL.CreateReference( sUNICode, sNamePartDest, 'OutLoop', 'A1', 'R1', tbPart.dTh, tbPart.sDestRefOff) TOOL.CreateReference(sUNICode, tbPart.sName, 'OutLoop', 'A1', 'R1', 0, tbPart.sRefOff) TOOL.SetPairInfo(sUNICode, tbPart.sName, 'R1', sNamePartDest, 'R1', -1, tbPart.dPairAng, 4) - WriteDataToChildPart(nParent, nPart, nEdge,tbPart.dLen,tbPart.dAngBR, tbPart.dAngBL, tbPart.dH, tbPart.dTh) + TOOL.WriteDataToChildPart(Pz_Top, nPart, tbPart.nEdge,tbPart.dLen,tbPart.dAngBR, tbPart.dAngBL, tbPart.dH, tbPart.dTh) end EgtErase(nAuxLay) @@ -323,6 +313,7 @@ function CMP_Draw(bPreview) for i=1, #tbIdLoopTC do local tbInfo = {} tbInfo.nEdge = i + tbInfo.nEdgeId = tbIdLoopTC[i] tbInfo.nPrev = nPrev local sNamePz = 'PartA'.. tostring(i) tbInfo.sName = sUNICode..sNamePz @@ -331,7 +322,7 @@ function CMP_Draw(bPreview) if i == 1 then nFirst = Pz_A end tbInfo.nId = Pz_A tbInfo.sName = sNamePz - local nType = EgtGetInfo(tbIdLoopTC[i], 'AF', 'i') or 0 + local nType = EgtGetInfo(tbInfo.nEdgeId, 'AF', 'i') or 0 local dPairAng = 0 if nType == 1 then dPairAng = dAngAlzatina @@ -357,6 +348,7 @@ function CMP_Draw(bPreview) for i=1, #tbIdInLoopTC do local tbInfo = {} tbInfo.nEdge = i + tbInfo.nEdgeId = tbIdInLoopTC[i] tbInfo.nPrev = nPrev local sNamePz = 'InPartA'.. tostring(i) tbInfo.sName = sUNICode..sNamePz @@ -365,7 +357,7 @@ function CMP_Draw(bPreview) if i == 1 then nFirst = Pz_A end tbInfo.nId = Pz_A tbInfo.sName = sNamePz - local nType = EgtGetInfo(tbIdInLoopTC[i], 'AF', 'i') or 0 + local nType = EgtGetInfo(tbInfo.nEdgeId, 'AF', 'i') or 0 local dPairAng = 0 if nType == 1 then dPairAng = dAngAlzatina @@ -387,6 +379,11 @@ function CMP_Draw(bPreview) --local bOnLoop = false -- bool che indica se la faccia buona del part sta sull'edge del piano cucina o no --local nJunctionType = 1 -- tipo di giunzione: 1 trim start, 2 trim end, 3 giunzione angolata for nPart, tbInfo in pairs( tbPartsInfo) do + -- scrivo nel part le info di prev e next e del part proprietario del loop + EgtSetInfo(tbInfo.nId, "Next", tbInfo.nNext) + EgtSetInfo(tbInfo.nId, "Prev", tbInfo.nPrev) + 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 @@ -414,11 +411,12 @@ function CMP_Draw(bPreview) ----- caratteristiche forntalino end - if not tbInfo.bInLoop then - TOOL.CreateParetina( tbInfo.nEdge, tbIdLoopTC, tbInfo) - else - TOOL.CreateParetina( tbInfo.nEdge, tbIdInLoopTC, tbInfo) - end + -- if not tbInfo.bInLoop then + -- TOOL.CreateParetina( tbInfo.nEdgeId, tbIdLoopTC, tbInfo) + -- else + -- TOOL.CreateParetina( tbInfo.nEdgeId, tbIdInLoopTC, tbInfo) + -- end + TOOL.CreateParetina( tbInfo.nEdgeId, tbInfo) -- setto l'offset dei riferimenti if nType == 1 then @@ -435,8 +433,9 @@ function CMP_Draw(bPreview) -- creo tutte le paretine for nPart, tbPart in pairs( tbPartsInfo) do EgtOutLog(tostring(nPart)) - local nNameChar = tbPart.bInLoop and 8 or 6 - local nEdge = string.sub(tbPart.sName, nNameChar) + -- local nNameChar = tbPart.bInLoop and 8 or 6 -- PartA1 per pezzi costruiti sull'outloop, InPartA1 per i pezzi costruiti su un InLoop + -- local nEdge = string.sub(tbPart.sName, nNameChar) -- di "PartA1" tengo solo "1" + local nEdge = tbPart.nEdge local tbLayer = TOOL.FindLayers(nPart) local tbIdLoop = TOOL.CreateAdjustedPart( tbLayer['OutLoop'],tbPart.dLen, tbPart.dH, tbPart.dAngBL, tbPart.dAngBR) TOOL.CreatePart(tbLayer,tbPart.sName,tbIdLoop,tbPart.dTh,false) @@ -452,19 +451,18 @@ function CMP_Draw(bPreview) if tbPart.dSideAngL then TOOL.SetSideAng(tbLayer['OutLoop'], 'A2', tbPart.dSideAngL) end if tbPart.dSideAngR then TOOL.SetSideAng(tbLayer['OutLoop'], 'A4', tbPart.dSideAngR) end if tbPart.dSideAngT then TOOL.SetSideAng(tbLayer['OutLoop'], 'A3', tbPart.dSideAngT) end - WriteDataToChildPart(Pz_Top, nPart, nEdge,tbPart.dLen,tbPart.dAngBR, tbPart.dAngBL, tbPart.dH, tbPart.dTh) + TOOL.WriteDataToChildPart(Pz_Top, nPart, nEdge,tbPart.dLen,tbPart.dAngBR, tbPart.dAngBL, tbPart.dH, tbPart.dTh) end -- -- creo il fondo --CreateBottomPart( tbIdInLoopTC, 'InPartA4') CreateSplitBottomPart( tbIdInLoopTC, Pz_Top, CMP.SWater) - --TOOL.SaveMePlease() - - TOOL.CreateDimensionLayer() SetReference() + --TOOL.SaveMePlease() + if CMP.DrawSolid then loadfile(sPath ..'\\'.. "CreateSOLID_FromPartsInPark.lua")({AutoRun=true}) TOOL.RelocateLabels() @@ -479,8 +477,7 @@ function CMP_Draw(bPreview) SaveCompoData(CMP.Npar) OrigData() end - --EgtSaveFile(EgtGetStringFromIni( "Vein3D", "Vein3D_Dir", "", EgtGetIniFile()) ..'\\'.. "FOO.nge") - EgtSaveFile("D:\\Temp\\marmo\\Vein3D\\piano_assemblato.nge") + --EgtSaveFile("D:\\Temp\\marmo\\Vein3D\\piano_assemblato.nge") end end