aggiunto il fondo del lavello.

This commit is contained in:
Daniele Bariletti
2024-12-17 17:12:17 +01:00
parent d605c189ef
commit f38f5df4bf
3 changed files with 128 additions and 109 deletions
+19 -67
View File
@@ -209,9 +209,9 @@ function TOOL.CreatePart(tbLayer, sName, tbIdEntCrv, dTh, bInLoop)
return
end
-- definisco spessore pezzo
EgtSetInfo(IdPart, 'Th', dTh)
-- INFO NECESSARIA
EgtSetInfo(IdPart, 'Paired',tostring(IdPart))
if dTh then EgtSetInfo(IdPart, 'Th', dTh) end
-- INFO NECESSARIA
EgtSetInfo(IdPart, 'Paired',tostring(IdPart))
-- inserisco le etichette del pezzo nel centro della superofocie
local ptTop = EgtCP( IdReg, GDB_RT.GLOB)
@@ -379,70 +379,21 @@ end
-- end
-- --
-- -- Crea un contorno chiuso rettangolare come OutLoop (con diagonale da origine a ptEND)
-- function CreateWaterfall( tbLayer, sNameLayer, ptEND, PrevAng, NextAng, bIsPrevWaterfall, bIsNextWaterfall)
-- local OffseAng = 3
-- local NAng = NextAng/2 + OffseAng
-- local PAng = PrevAng/2 + OffseAng
-- if not bIsNextWaterfall then
-- if NAng >= 0 then
-- NAng = -90 + NextAng
-- else
-- NAng = -90 - NextAng
-- end
-- end
-- if not bIsPrevWaterfall then
-- if PAng >= 0 then
-- PAng = -90 + PrevAng
-- else
-- PAng = -90 - PrevAng
-- end
-- end
-- local IdLoop = EgtRectangle2P(tbLayer[sNameLayer],{0,0,0}, ptEND,GDB_RT.GLOB)
-- local tbIdLoop = ExplodeAndNameEdges( IdLoop)
-- -- definizione SideAng
-- -- bla bla bla---------------------------------------------------------------------------------------------------
-- EgtSetInfo( tbIdLoop[2], 'OrigSideAng', -NAng)
-- EgtSetInfo( tbIdLoop[2], 'SideAng', -NAng)
-- EgtSetInfo( tbIdLoop[4], 'OrigSideAng', -PAng)
-- EgtSetInfo( tbIdLoop[4], 'SideAng', -PAng)
-- -- bla bla bla---------------------------------------------------------------------------------------------------
-- return tbIdLoop
-- end
-- --
-- -- Crea un contorno chiuso rettangolare come OutLoop (con diagonale da origine a ptEND)
-- function CreateSplashtop( tbLayer, sNameLayer, ptEND, PrevAng, NextAng, bIsPrevSplashtop, bIsNextSplashtop)
-- local OffseAng = 3
-- local NAng = NextAng/2 + OffseAng
-- local PAng = PrevAng/2 + OffseAng
-- if not bIsNextWaterfall then
-- if NAng >= 0 then
-- NAng = 90 - NextAng
-- else
-- NAng = 90 + NextAng
-- end
-- end
-- if not bIsPrevWaterfall then
-- if PAng >= 0 then
-- PAng = 90 - PrevAng
-- else
-- PAng = 90 + PrevAng
-- end
-- end
-- EgtOutLog(PAng)
-- EgtOutLog(NAng)
-- local IdLoop = EgtRectangle2P(tbLayer[sNameLayer],{0,0,0}, ptEND,GDB_RT.GLOB)
-- local tbIdLoop = ExplodeAndNameEdges( IdLoop)
-- -- definizione SideAng
-- -- bla bla bla---------------------------------------------------------------------------------------------------
-- EgtSetInfo( tbIdLoop[2], 'OrigSideAng', -NAng)
-- EgtSetInfo( tbIdLoop[2], 'SideAng', -NAng)
-- EgtSetInfo( tbIdLoop[4], 'OrigSideAng', -PAng)
-- EgtSetInfo( tbIdLoop[4], 'SideAng', -PAng)
-- -- bla bla bla---------------------------------------------------------------------------------------------------
-- return tbIdLoop, PAng, NAng
-- end
-- --
function TOOL.AddLoopToLayer(nLay, tbIdLoop, dOffset, bInvert, bInLoop)
-- local tbLoop = {}
-- for i = 1, #tbIdLoop do
-- local nNewId = EgtCopyGlob(tbIdLoop[i], nLay)
-- if bInvert then EgtInvertCurve(nNewId) end
-- table.insert(tbLoop, nNewId)
-- end
-- TOOL.SetMachiningInfo(nLay, bInLoop)
--return tbLoop
local nNewLoop = EgtCurveCompoByChain(nLay, tbIdLoop, EgtSP(tbIdLoop[1], GDB_RT.GLOB), false)
if bInvert then EgtInvertCurve(nNewLoop) end
if dOffset > 0 then EgtOffsetCurve(nNewLoop, dOffset, GDB_OT.EXTEND) end
local tbNewLoop = TOOL.ExplodeAndNameEdges( nNewLoop, bInLoop)
return tbNewLoop
end
-- -------------------------------------------------------------------------------------------------------------------------
-- -- CREAZIONE/IMPORTAZIONE Loop FINE
@@ -608,6 +559,7 @@ function TOOL.CreateCircularHole(nPart, ptCenter, dDiam)
EgtSetName(nInLoopLay, 'InLoop')
local HoleId = EgtCircle( nInLoopLay, ptCenter, dDiam, GDB_RT.GLOB)
TOOL.SetMachiningInfo(nInLoopLay, true)
TOOL.CreatePart(TOOL.FindLayers(nPart),nil,{HoleId},nil,true)
end
+109 -42
View File
@@ -37,13 +37,16 @@ CMP.V7 = 5
CMP.N8 = 'Dimensione Foro' -- diametro del foro
CMP.T8 = 3
CMP.V8 = 5
CMP.N9 = 'Pendenza del fondo' -- angolo di pendenza del fondo
CMP.T9 = 3
CMP.V9 = 0.15
CMP.ResetView = false
CMP.DrawSolid = true
CMP.IsCabinet = true
CMP.Npar = 8
CMP.Npar = 9
CMP.Nome = 'TopChicken'
_G.CMP = CMP
@@ -67,13 +70,14 @@ local dAngFrontalino = -90
local tbOrigVal={}
local function OrigData()
tbOrigVal.v1 = CMP.V1
tbOrigVal.v2 = CMP.V2
tbOrigVal.v3 = CMP.V3
tbOrigVal.v4 = CMP.V4
tbOrigVal.v5 = CMP.V5
tbOrigVal.v6 = CMP.V6
tbOrigVal.v7 = CMP.V7
tbOrigVal.v8 = CMP.V8
tbOrigVal.v2 = CMP.V2
tbOrigVal.v3 = CMP.V3
tbOrigVal.v4 = CMP.V4
tbOrigVal.v5 = CMP.V5
tbOrigVal.v6 = CMP.V6
tbOrigVal.v7 = CMP.V7
tbOrigVal.v8 = CMP.V8
tbOrigVal.v9 = CMP.V9
end
---
@@ -156,13 +160,94 @@ end
--
local function WriteDataToChildPart(nParent, nPart, nEdge, dLen, dAngDx, dAngSx, dH, dTh)
EgtSetInfo(nPart, 'Parent', nParent)
EgtSetInfo(nPart, 'ParentEdge', nEdge)
EgtSetInfo(nPart, 'Len', dLen)
EgtSetInfo(nPart, 'dAngDx', dAngDx)
EgtSetInfo(nPart, 'dAngSx', dAngSx)
EgtSetInfo(nPart, 'dH', dH)
EgtSetInfo(nPart, 'dTh', 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
local tbPart = {}
local Pz_Bottom = TOOL.CreatePartLayer('Bottom', sUNICode)
tbPart.sName = 'Bottom'
tbPart.dTh = CMP.SB
tbPart.sDestRefOff = '0,0,-x'
tbPart.sRefOff = '0,0,0'
tbPart.dPairAng = 90
local tbLayerBottom = TOOL.FindLayers(Pz_Bottom)
local bInvert = true
local bInLoop = false
local tbOutLoop = TOOL.AddLoopToLayer(tbLayerBottom['OutLoop'], tbIdLoop, CMP.SWater, bInvert, bInLoop) -- il loop viene aggiunto ma nella posizione da inloop del piano cucina, non come nuovo pezzo messo nell'origine
TOOL.CreatePart(tbLayerBottom,tbPart.sName,tbOutLoop,tbPart.dTh,bInLoop)
-- creo il foro
local ptCenter = EgtGP( EgtGetFirstInGroup(tbLayerBottom['Region']), GDB_RT.GLOB)
TOOL.CreateCircularHole( Pz_Bottom, ptCenter, CMP.DiamBore)
--TOOL.CreatePart(tbLayerBottom,tbPart.sName,{HoleId},tbPart.dTh,true)
-- creo i riferimenti e salvo i parametri del part
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)
end
local function CreateSplitBottomPart( tbIdLoop, nParent)
-- creo il fondo diviso in un numero di pezzi pari ai lati del loop passato
local nLay = EgtGetParent(tbIdLoop[1])
local nLoop = EgtCurveCompoByChain(nLay, tbIdLoop, EgtSP(tbIdLoop[1], GDB_RT.GLOB), false)
local ptCenter = EgtGP(nLoop, GDB_RT.GLOB)
EgtErase(nLoop)
local nPrev = 0
local nFirst = 0
local tbSplitBottom = {}
-- creo i part con tutte le info
for i = 1, #tbIdLoop do
local tbPart = {}
local Pz_Bottom = TOOL.CreatePartLayer('BottomA'..tostring(i), sUNICode)
if i == 1 then nFirst = Pz_Bottom end
tbPart.sName = 'BottomA'..tostring(i)
tbPart.nId = Pz_Bottom
tbPart.nEdge = i
tbPart.dTh = CMP.SB
EgtSetInfo(Pz_Bottom, 'dTh', CMP.SB)
tbPart.sDestRefOff = '0,0,-x'
tbPart.sRefOff = '0,0,0'
tbPart.dPairAng = 90 - CMP.dSlopeAng
EgtSetInfo(Pz_Bottom, 'PairAng', tbPart.dPairAng)
tbPart.nJunctionType = 3
tbPart.dH = EgtPointCurveDist( ptCenter, tbIdLoop[i], GDB_RT.GLOB)
tbPart.nPrev = nPrev
if i > 1 then tbSplitBottom[nPrev].nNext = Pz_Bottom end
tbSplitBottom[Pz_Bottom] = tbPart
nPrev = Pz_Bottom
end
tbSplitBottom[nPrev].nNext = nFirst
tbSplitBottom[nFirst].nPrev = nPrev
-- scorro i part e costruisco effettivamente i pezzi in funzione del precedente e del successivo
for nPart, tbPart in pairs(tbSplitBottom) do
local tbLayerBottom = TOOL.FindLayers(nPart)
local bInLoop = false
TOOL.CreateParetina( tbPart.nEdge, tbIdLoop, tbPart)
local tbPartLoop = TOOL.CreateAdjustedPart( tbLayerBottom['OutLoop'],tbPart.dLen, tbPart.dH, tbPart.dAngBL, tbPart.dAngBR)
TOOL.CreatePart(tbLayerBottom,tbPart.sName,tbPartLoop,tbPart.dTh,bInLoop)
TOOL.SetMachiningInfo(tbLayerBottom['OutLoop'], false)
if tbPart.dSideAngL then TOOL.SetSideAng(tbLayerBottom['OutLoop'], 'A2', tbPart.dSideAngL) end
if tbPart.dSideAngR then TOOL.SetSideAng(tbLayerBottom['OutLoop'], 'A4', tbPart.dSideAngR) end
-- creo i riferimenti e salvo i parametri del part
local sNamePartDest = 'InPartA'..tostring(tbPart.nEdge)
TOOL.CreateReference( sUNICode, sNamePartDest, 'OutLoop', 'A1', 'R1', tbPart.dTh, tbPart.sDestRefOff)
TOOL.CreateReference(sUNICode, tbPart.sName, 'OutLoop', 'A3', 'R3', 0, tbPart.sRefOff)
TOOL.SetPairInfo(sUNICode, tbPart.sName, 'R3', sNamePartDest, 'R1', -1, tbPart.dPairAng, 4)
WriteDataToChildPart(nParent, nPart, nEdge,tbPart.dLen,tbPart.dAngBR, tbPart.dAngBL, tbPart.dH, tbPart.dTh)
end
return tbSplitBottom
end
-- Confronto i dati del file.dat con quelli letti da programma
@@ -177,6 +262,7 @@ local function IsDataChanged()
if math.abs(CMP.V6 - tbOrigVal.v6) > 0.5 then bOk = bOk or true end
if math.abs(CMP.V7 - tbOrigVal.v7) > 0.5 then bOk = bOk or true end
if math.abs(CMP.V8 - tbOrigVal.v8) > 0.5 then bOk = bOk or true end
if math.abs(CMP.V9 - tbOrigVal.v9) > 0.005 then bOk = bOk or true end
return bOk
end
@@ -199,6 +285,7 @@ function CMP_Draw(bPreview)
CMP.SSplash = CMP.V6 -- spessore alzatine
CMP.SWater = CMP.V7 -- spessore frontalini
CMP.DiamBore = CMP.V8 -- spessore back
CMP.dSlopeAng = CMP.V9 -- angolo di pendenza
-- PIANO POLLO
local Pz_Top = TOOL.CreatePartLayer( 'TopChicken', sUNICode)
@@ -355,33 +442,13 @@ function CMP_Draw(bPreview)
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)
end
-- TOOL.SaveMePlease()
-- creo il fondo del lavello
local tbPart = {}
local Pz_Bottom = TOOL.CreatePartLayer('Bottom', sUNICode)
tbPart.sName = 'Bottom'
tbPart.dLen = EgtCurveLength(tbIdInLoopTC[1]) + CMP.SWater * 2
tbPart.dH = EgtCurveLength(tbIdInLoopTC[2]) + CMP.SWater * 2
tbPart.dAngBL = 90
tbPart.dAngBR = 90
tbPart.dTh = CMP.SB
local dXOffset = - CMP.SWater * tan(45) -- side ang del InPart4 sul lato A1
tbPart.sDestRefOff = tostring(dXOffset)..',0,-x'
tbPart.sRefOff = '0,0,0'
tbPart.dPairAng = 90
local tbLayerBottom = TOOL.FindLayers(Pz_Bottom)
local tbIdLoop = TOOL.CreateAdjustedPart( tbLayerBottom['OutLoop'],tbPart.dLen, tbPart.dH, tbPart.dAngBL, tbPart.dAngBR)
TOOL.CreatePart(tbLayerBottom,tbPart.sName,tbIdLoop,tbPart.dTh,false)
-- creo il foro
local ptCenter = EgtGP( EgtGetFirstInGroup(tbLayerBottom['Region']), GDB_RT.GLOB)
TOOL.CreateCircularHole( Pz_Bottom, ptCenter, CMP.DiamBore)
TOOL.CreatePart(tbLayerBottom,tbPart.sName,{HoleId},tbPart.dTh,true)
-- creo i riferimenti e salvo i parametri del part
TOOL.CreateReference( sUNICode, 'InPartA4', 'OutLoop', 'A1', 'R1', tbPart.dTh, tbPart.sDestRefOff)
TOOL.CreateReference(sUNICode, tbPart.sName, 'OutLoop', 'A4', 'R4', 0, tbPart.sRefOff)
TOOL.SetPairInfo(sUNICode, tbPart.sName, 'R4', 'InPartA4', 'R1', -1, tbPart.dPairAng, 2)
WriteDataToChildPart(Pz_Top, Pz_Bottom, nEdge,tbPart.dLen,tbPart.dAngBR, tbPart.dAngBL, tbPart.dH, tbPart.dTh)
-- -- creo il fondo
CreateBottomPart( tbIdInLoopTC, 'InPartA4')
--CreateSplitBottomPart( tbIdInLoopTC, Pz_Top)
--TOOL.SaveMePlease()
TOOL.CreateDimensionLayer()
SetReference()
@@ -401,7 +468,7 @@ function CMP_Draw(bPreview)
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
BIN
View File
Binary file not shown.