Import di OutLoop come piano cucina

This commit is contained in:
Nicola Pievani
2024-12-02 15:49:26 +01:00
parent 8706506d20
commit 04929d823f
2 changed files with 64 additions and 93 deletions
+64 -93
View File
@@ -23,16 +23,16 @@ CMP.T3 = 3
CMP.V3 = 300
CMP.N4 = 'Spessore Top' -- spessore top
CMP.T4 = 3
CMP.V4 = 6
CMP.V4 = 20
CMP.N5 = 'Spessore Bottom' -- spessore bottom
CMP.T5 = 3
CMP.V5 = 8
CMP.V5 = 20
CMP.N6 = 'Spessore Left' -- spessore left
CMP.T6 = 3
CMP.V6 = 8
CMP.N7 = 'Spessore Right' -- spessore right
CMP.T7 = 3
CMP.V7 = 65
CMP.V7 = 6
CMP.N8 = 'Spessore Back' -- spessore back
CMP.T8 = 3
CMP.V8 = 7
@@ -77,6 +77,10 @@ local sUNICode = os.date( '%y%m%d%H%M%S', os.time()).."_"
-- FUNZIONI BASE PER GENERARE I COMPO SOLID INIZIO
-------------------------------------------------------------------------------------------------------------------------
local function SaveMEPlease()
EgtSaveFile('c:\\EgtData\\OmagOFFICE\\Vein3D\\FUCK.nge')
end
-- CREAZIONE dei Layer di un singolo Part
-- I nomi dei layer sono: OutLoop, Region, Ref, Labels, Aux
local function CreatePartLayer(PartName)
@@ -94,6 +98,9 @@ local function CreatePartLayer(PartName)
EgtSetName(LLabel,'Labels')
local LAux= EgtGroup(Pz,GDB_RT.LOC) -- layer etichette
EgtSetName(LAux,'Aux')
EgtOutLog(' Creo Part: '..sUNICode..PartName)
SaveMEPlease()
return Pz
end
--
@@ -208,12 +215,8 @@ local function ExplodeAndNameEdges( IdLoop, bInLoop)
end
--
-- RIMUOVERE!! NON necessario!
local function CreateLayers()
for i=1, 5 do
-- Pezzo e Layer
CreatePartLayer(tbName[i])
end
-- CREAZIONE LAyer per le dimensioni
local function CreateLayerDimension()
local Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- layer dimensioni e etichette
EgtSetName( Pz, 'Dimensions')
end
@@ -452,56 +455,27 @@ end
-- COSTRUZIONE RIFERIMENTI INIZIO
-------------------------------------------------------------------------------------------------------------------------
local function SetReference()
-- Per accoppiamento Left-Bottom
CreateReference( tbName[1], 'OutLoop', 'A4', 'R1')
-- Per accoppiamento di right su bottom
CreateReference( tbName[1], 'OutLoop', 'A2', 'R2')
-- Per accoppiamento di back su bottom
CreateReference( tbName[1], 'OutLoop', 'A3', 'R3', CMP.SBA, '0,-x,0')
-- Esempio Riferimento:
-- CreateReference( tbName[2], 'OutLoop', 'A2', 'R1', CMP.SL, '0,0,-x')
-- SetPairInfo( tbName[2], 'R1', tbName[1], 'R1', -1, 90, 1)
-- Esempio Punto per dimension:
-- CreatePointReference( tbName[1], 'OutLoop', 'A1', 'R4', 0, CMP.SB, '0,0,-x')
-- setto le info di accoppiamento per il PartLeft
CreateReference( tbName[2], 'OutLoop', 'A2', 'R1', CMP.SL, '0,0,-x')
SetPairInfo( tbName[2], 'R1', tbName[1], 'R1', -1, 90, 1)
-- setto le info per l'accoppiamento del top sul left
CreateReference( tbName[2], 'OutLoop', 'A4', 'R2', CMP.SL, '0,0,-x')
-- setto le info per l'accoppiamento del back sul left
CreateReference( tbName[2], 'OutLoop', 'A3', 'R3', CMP.SL, '0,0,0')
CreateReference('TopChicken', 'OutLoop', 'A1', 'R1',CMP.ST,'0,0,-x')
CreateReference('A1Waterfall', 'OutLoop', 'A3', 'R1', CMP.SB, '0,0,0')
SetPairInfo('A1Waterfall', 'R1', 'TopChicken', 'R1', -1, -90)
-- setto le info di accoppiamento del PartRight
SetPairInfo( tbName[3], 'R1', tbName[1], 'R2', -1, 90, 2)
CreateReference( tbName[3], 'OutLoop', 'A4', 'R1', CMP.SR, '0,0,-x')
-- setto le info di accoppiamento del PartTop
SetPairInfo( tbName[4], 'R1', tbName[2], 'R2', -1, 90, 1)
CreateReference( tbName[4], 'OutLoop', 'A2', 'R1')
-- setto le info di accoppiamento del PartBack
SetPairInfo( tbName[5], 'R1', tbName[2], 'R3', -1, 90)
CreateReference( tbName[5], 'OutLoop', 'A1', 'R1', CMP.SBA, '0,0,-x')
-- 1° punto di riferimento per la dimensione dell'altezza
CreatePointReference( tbName[1], 'OutLoop', 'A1', 'R4', 0, CMP.SB, '0,0,-x')
-- 2° punto di riferimento per la quota dell'altezza ( e 1° per la lunghezza)
CreatePointReference( tbName[4], 'OutLoop', 'A1', 'R2', 1, CMP.ST, '0,0,-x')
-- 2° riferimento per la lunghezza ( e 1° per la profondità)
CreatePointReference( tbName[4], 'OutLoop', 'A1', 'R3', 0, CMP.ST, '0,0,-x')
-- 2° riferimento per la profondità
CreatePointReference( tbName[4], 'OutLoop', 'A4', 'R4', 0, CMP.ST, '0,0,-x')
CreateReference('TopChicken', 'OutLoop', 'A7', 'R7',CMP.ST,'0,0,-x')
CreateReference('A7Waterfall', 'OutLoop', 'A3', 'R3', CMP.SB, '0,0,0')
SetPairInfo('A7Waterfall', 'R3', 'TopChicken', 'R7', -1, -90)
SaveMEPlease()
end
--
local function AddDimensions()
local GridFr = Frame3d(ORIG(),GDB_FR.FRONT)
-- la dimensione dell'altezza ( R4 di Bottom e R2 di Top)
DrawLinearDimension( tbName[1], 'R4', tbName[4], 'R2', 'SUA ALTEZZA',GridFr, Point3d(-50,0,0))
--dimensione della lunghezza ( R2 del Top e R3 del Top)
GridFr = Frame3d(ORIG(),GDB_FR.TOP)
DrawLinearDimension( tbName[4], 'R2', tbName[4], 'R3', 'LARGHEZZA',GridFr, Point3d(0,-50,0))
-- dimensione della profondità ( R3 del Top e R4 del Top)
GridFr = Frame3d(ORIG(),GDB_FR.TOP)
DrawLinearDimension( tbName[4], 'R3', tbName[4], 'R4', 'PROFONDITÀ',GridFr, Point3d(50,0,0))
--Esempio:
-- DrawLinearDimension( tbName[1], 'R4', tbName[4], 'R2', 'SUA ALTEZZA',GridFr, Point3d(-50,0,0))
EgtSetGridFrame(GLOB_FRM())
end
--
@@ -513,20 +487,23 @@ end
-- CREAZIONE/IMPORTAZIONE Loop INIZIO
-------------------------------------------------------------------------------------------------------------------------
-- Importa un contorno chiuso da file nge
function ImportOutLoop( tbLayer)
local OutLayer = EgtGetParent(tbLayer['OutLoop'])
EgtInsertFile( sPath ..'\\'.. 'TopChicken.nge')
function ImportOutLoop( tbLayer, sNameFileNGE)
local OutLayer = tbLayer['OutLoop']
if not EgtInsertFile( sNameFileNGE) then
EgtOutLog(' IMPORTAZIONE FALLITA: '..sNameFileNGE)
end
-- recupero ultimo Part
local LstPart = EgtGetLastPart()
local FstLayerInLstPart = EgtGetFirstGroupInGroup( LstPart)
local LastPart = EgtGetLastPart()
local FstLayerInLstPart = EgtGetFirstGroupInGroup( LastPart)
local IdLoop = EgtGetFirstInGroup( FstLayerInLstPart)
EgtRelocateGlob( IdLoop, OutLayer)
if not EgtRelocateGlob( IdLoop, OutLayer) then
EgtOutLog(' RELOCATE AFLLITA MISERAMENTE: '..tostring(IdLoop)..';'..tostring(OutLayer))
end
EgtErase(LastPart)
local tbIdLoop = ExplodeAndNameEdges( IdLoop)
SaveMEPlease()
-- definizione SideAng
-- bla bla bla---------------------------------------------------------------------------------------------------
-- EgtSetInfo( tbIdLoop[1], 'OrigSideAng', 45)
-- EgtSetInfo( tbIdLoop[1], 'SideAng', 45)
-- bla bla bla---------------------------------------------------------------------------------------------------
return tbIdLoop
end
--
@@ -541,8 +518,10 @@ function CreateLoop( tbLayer, sNameLayer, ptEND)
local tbIdLoop = ExplodeAndNameEdges( IdLoop)
-- definizione SideAng
-- bla bla bla---------------------------------------------------------------------------------------------------
-- EgtSetInfo( tbIdLoop[1], 'OrigSideAng', 45)
-- EgtSetInfo( tbIdLoop[1], 'SideAng', 45)
EgtSetInfo( tbIdLoop[2], 'OrigSideAng', -50)
EgtSetInfo( tbIdLoop[2], 'SideAng', -50)
EgtSetInfo( tbIdLoop[4], 'OrigSideAng', -50)
EgtSetInfo( tbIdLoop[4], 'SideAng', -50)
-- bla bla bla---------------------------------------------------------------------------------------------------
return tbIdLoop
end
@@ -570,6 +549,7 @@ function CreateBore( tbLayer, sNameLayer)
-- bla bla bla---------------------------------------------------------------------------------------------------
return tbIdLoop
end
--
-------------------------------------------------------------------------------------------------------------------------
-- CREAZIONE/IMPORTAZIONE Loop FINE
@@ -604,36 +584,27 @@ function CMP_Draw(bPreview)
CMP.SL = CMP.V6 -- spessore left
CMP.SR = CMP.V7 -- spessore right
CMP.SBA = CMP.V8 -- spessore back
-- Costruisco i Part per ogni pezzo
CreateLayers()
-- Definisco le dimensioni dei rettangoli per costruire gli OutLoop
local tbDimension={{CMP.L,CMP.P,0},
{CMP.A-(CMP.ST+CMP.SB), CMP.P,0},
{CMP.A-(CMP.ST+CMP.SB), CMP.P,0},
{CMP.L,CMP.P,0},
{CMP.A-(CMP.ST+CMP.SB), CMP.L-(CMP.SL + CMP.SR),0}}
local tbTh={CMP.SB, CMP.SL, CMP.SR, CMP.ST, CMP.SBA}
-- Recupero il primo Part
local nIdP = EgtGetFirstPart()
local nCount = 1
while nIdP do
local sName = EgtGetName(nIdP)
if sName ~= 'Dimensions' and sName ~= 'SOLID' then
-- Recupero tabella Layer del pezzo
local tbLayer = FindLayers( nIdP)
-- Costruisco Layer OutLoop
local tbIdLoop = CreateLoop( tbLayer, 'OutLoop', tbDimension[nCount])
CreatePart(tbLayer, tbName[nCount], tbIdLoop, tbTh[nCount], HorizontalOffset)
-- -- Costruisco Layer InLoop
-- IdLoop = EgtRectangle2P(tbLayer['Aux'],{20,20,0}, {220,220,0},GDB_RT.GLOB)
tbIdLoop = CreateBore( tbLayer, 'InLoop')
CreatePart(tbLayer, tbName[nCount], tbIdLoop, 0, 0, true)
nCount = nCount + 1
end
nIdP = EgtGetNext(nIdP)
end
-- PIANO POLLO
local Pz_Top = CreatePartLayer( 'TopChicken')
-- Creo il contorno esterno
local tbIdLoop = ImportOutLoop( FindLayers( Pz_Top), sPath ..'\\'.. 'TopChicken.nge')
-- Creo il pezzo dato il contorno
CreatePart( FindLayers( Pz_Top), 'TopChicken', tbIdLoop, CMP.ST, 0)
-- WATERFALL su lato 1
local dH = 100
local Pz_A1 = CreatePartLayer('A1Waterfall')
local dLen = EgtCurveLength(tbIdLoop[1])
local tbIdLoopWF = CreateLoop( FindLayers(Pz_A1), 'OutLoop', {dLen, dH,0})
CreatePart( FindLayers(Pz_A1), 'A1Waterfall', tbIdLoopWF, CMP.ST, 0)
-- WATERFALL su lato 7
local dH = 100
local Pz_A7 = CreatePartLayer('A7Waterfall')
dLen = EgtCurveLength(tbIdLoop[7])
tbIdLoopWF = CreateLoop( FindLayers(Pz_A7), 'OutLoop', {dLen, dH,0})
CreatePart( FindLayers(Pz_A7), 'A7Waterfall', tbIdLoopWF, CMP.ST, 0)
CreateLayerDimension()
SetReference()
if CMP.DrawSolid then
BIN
View File
Binary file not shown.