477 lines
18 KiB
Lua
477 lines
18 KiB
Lua
-- 2024/11/22
|
|
-- Template per la creazione di un cabinet
|
|
|
|
-- Intestazioni
|
|
require( 'EgtBase')
|
|
_ENV = EgtProtectGlobal()
|
|
EgtEnableDebug( false)
|
|
|
|
EgtAddToPackagePath(EgtGetSourceDir() .. 'LuaLibs\\?.lua')
|
|
require( 'EgtCompo')
|
|
|
|
|
|
-- Parametri : dichiarazione e valori standard
|
|
-- N.B.: le dimensioni sono comprese di spessori
|
|
local CMP = {}
|
|
CMP.N1 = 'Altezza alzatina' -- altezza
|
|
CMP.T1 = 3 -- 0=null, 1=bool, 2=int, 3=len, 4=num, 5=string
|
|
CMP.V1 = 40
|
|
CMP.N2 = 'Altezza frontalino' -- larghezza
|
|
CMP.T2 = 3
|
|
CMP.V2 = 60
|
|
CMP.N3 = 'Profondità lavello' -- profondità
|
|
CMP.T3 = 3
|
|
CMP.V3 = 300
|
|
CMP.N4 = 'Spessore Top' -- spessore top
|
|
CMP.T4 = 3
|
|
CMP.V4 = 20
|
|
CMP.N5 = 'Spessore Bottom' -- spessore bottom
|
|
CMP.T5 = 3
|
|
CMP.V5 = 10
|
|
CMP.N6 = 'Spessore Alzatine' -- spessore left
|
|
CMP.T6 = 3
|
|
CMP.V6 = 30
|
|
CMP.N7 = 'Spessore Frontalini' -- spessore right
|
|
CMP.T7 = 3
|
|
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 = 9
|
|
CMP.Nome = 'TopChicken'
|
|
_G.CMP = CMP
|
|
|
|
CMP.ERR = 0
|
|
CMP.MSG = ''
|
|
|
|
-- Aggiorno con ultimi valori salvati (se presenti)
|
|
CMP.DATA = EgtGetSourceDir() .. CMP.Nome ..'.dat'
|
|
LoadCompoData()
|
|
|
|
-- Percorso direttorio Vein3D
|
|
local sPath = ""
|
|
sPath = EgtGetStringFromIni( "Vein3D", "Vein3D_Dir", "", EgtGetIniFile())
|
|
EgtOutLog(' → '..sPath)
|
|
|
|
-- definzione delle variabile per le classi di paretine
|
|
local dAngAlzatina = 90
|
|
local dAngFrontalino = -90
|
|
|
|
-- Carico i dati letti da file .dat
|
|
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.v9 = CMP.V9
|
|
end
|
|
---
|
|
|
|
-- Per disporre i pezzi in piano non sovrappposti (in assemblaggio non serve)
|
|
local HorizontalOffset = 0
|
|
|
|
-------------------------------------------------------------------------------------------------------------------------
|
|
-- COSTRUZIONE RIFERIMENTI INIZIO
|
|
-------------------------------------------------------------------------------------------------------------------------
|
|
local function SetReference()
|
|
-- 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')
|
|
|
|
--SaveMePlease()
|
|
end
|
|
--
|
|
|
|
local function AddDimensions()
|
|
-- local GridFr = Frame3d(ORIG(),GDB_FR.FRONT)
|
|
-- --Esempio:
|
|
-- -- DrawLinearDimension( tbName[1], 'R4', tbName[4], 'R2', 'SUA ALTEZZA',GridFr, Point3d(-50,0,0))
|
|
-- EgtSetGridFrame(GLOB_FRM())
|
|
end
|
|
--
|
|
-------------------------------------------------------------------------------------------------------------------------
|
|
-- COSTRUZIONE RIFERIMENTI FINE
|
|
-------------------------------------------------------------------------------------------------------------------------
|
|
|
|
-------------------------------------------------------------------------------------------------------------------------
|
|
-- CREAZIONE/IMPORTAZIONE Loop INIZIO
|
|
-------------------------------------------------------------------------------------------------------------------------
|
|
-- Importa un contorno chiuso da file nge
|
|
function ImportLoop( PartId, tbLayer, sNameFileNGE)
|
|
local OutLayer = tbLayer['OutLoop']
|
|
if not EgtInsertFile( sNameFileNGE) then
|
|
EgtOutLog(' IMPORTAZIONE FALLITA: '..sNameFileNGE)
|
|
end
|
|
-- recupero ultimo Part
|
|
local LastPart = EgtGetLastPart()
|
|
local FstLayerInLstPart = EgtGetFirstGroupInGroup( LastPart)
|
|
local IdLoop = EgtGetFirstInGroup( FstLayerInLstPart)
|
|
if not EgtRelocateGlob( IdLoop, OutLayer) then
|
|
EgtOutLog(' RELOCATE FALLITA MISERAMENTE: '..tostring(IdLoop)..';'..tostring(OutLayer))
|
|
end
|
|
local tbIdAllLoops = {}
|
|
local tbIdLoop = TOOL.ExplodeAndNameEdges( IdLoop)
|
|
table.insert(tbIdAllLoops, tbIdLoop)
|
|
EgtSetInfo(tbIdLoop[1],'AF',1)
|
|
EgtSetInfo(tbIdLoop[2],'AF',2)
|
|
EgtSetInfo(tbIdLoop[3],'AF',2)
|
|
EgtSetInfo(tbIdLoop[4],'AF',2)
|
|
EgtSetInfo(tbIdLoop[5],'AF',2)
|
|
EgtSetInfo(tbIdLoop[6],'AF',2)
|
|
EgtSetInfo(tbIdLoop[7],'AF',1)
|
|
|
|
-- controllo la presenza di eventuali inloop ( che mi aspetto essere CCW)
|
|
local IdInLoop = EgtGetFirstInGroup(FstLayerInLstPart)
|
|
if IdInLoop then
|
|
EgtInvertCurve(IdInLoop)
|
|
local InLoopLay = EgtGroup(PartId)
|
|
EgtSetName(InLoopLay, 'InLoop')
|
|
EgtRelocateGlob( IdInLoop, InLoopLay)
|
|
local tbIdInLoop = TOOL.ExplodeAndNameEdges( IdInLoop, true)
|
|
table.insert(tbIdAllLoops, tbIdInLoop)
|
|
EgtSetInfo(tbIdInLoop[1],'AF',2)
|
|
EgtSetInfo(tbIdInLoop[2],'AF',2)
|
|
EgtSetInfo(tbIdInLoop[3],'AF',2)
|
|
EgtSetInfo(tbIdInLoop[4],'AF',2)
|
|
end
|
|
|
|
-- cancello il part dell'importazione
|
|
EgtErase(LastPart)
|
|
|
|
return tbIdAllLoops
|
|
end
|
|
--
|
|
|
|
-- sNamePartDest deve essere il pezzo al cui lato A1 si attacca il lato A4 del pezzo Bottom
|
|
local function CreateBottomPart( tbIdLoop, nParent)
|
|
-- creo il fondo del lavello
|
|
local tbPart = {}
|
|
tbPart.sName = sUNICode..'Bottom'
|
|
local Pz_Bottom = TOOL.CreatePartLayer(tbPart.sName)
|
|
tbPart.nId = Pz_Bottom
|
|
tbPart.nParent = nParent
|
|
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)
|
|
-- creo i riferimenti e salvo i parametri del part
|
|
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)
|
|
-- creo il fondo diviso in un numero di pezzi pari ai lati del loop passato
|
|
local nLay = EgtGetParent(tbIdLoop[1])
|
|
local nAuxLay = EgtGroup( nLay)
|
|
EgtSetName(nAuxLay, 'OutLoop')
|
|
local nLoop = EgtCurveCompoByChain(nAuxLay, tbIdLoop, EgtSP(tbIdLoop[1], GDB_RT.GLOB), false)
|
|
EgtOffsetCurve(nLoop, -dOffset, GDB_OT.EXTEND)
|
|
local ptCenter = EgtGP(nLoop, GDB_RT.GLOB)
|
|
local tbLoopOff = TOOL.ExplodeAndNameEdges( nLoop, false)
|
|
local nPrev = 0
|
|
local nFirst = 0
|
|
local tbSplitBottom = {}
|
|
-- creo i part con tutte le info
|
|
for i = 1, #tbLoopOff do
|
|
local tbPart = {}
|
|
local Pz_Bottom = TOOL.CreatePartLayer('BottomA'..tostring(i), sUNICode)
|
|
if i == 1 then nFirst = Pz_Bottom end
|
|
tbPart.sName = EgtGetName(Pz_Bottom)
|
|
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'
|
|
tbPart.sRefOff = '0,0,0'
|
|
tbPart.dPairAng = 90 - CMP.dSlopeAng
|
|
EgtSetInfo(Pz_Bottom, 'PairAng', tbPart.dPairAng)
|
|
tbPart.nJunctionType = 3
|
|
tbPart.bOnLoop = true
|
|
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
|
|
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
|
|
local c = 1
|
|
for nPart, tbPart in pairs(tbSplitBottom) do
|
|
local tbLayerBottom = TOOL.FindLayers(nPart)
|
|
local bInLoop = false
|
|
TOOL.CreateParetina( tbPart.nEdgeId, tbPart, 90)
|
|
-- tbPart.dLen = 300 + CMP.SWater * 2
|
|
-- tbPart.dAngBL = 46
|
|
-- tbPart.dAngBR = 46
|
|
local tbPartLoop = TOOL.CreateAdjustedPart( tbLayerBottom['OutLoop'],tbPart.dLen, tbPart.dH, tbPart.dAngBL, tbPart.dAngBR)
|
|
TOOL.CreatePart(tbLayerBottom,tbPart)
|
|
-- tbPart.dSideAngL = 8
|
|
-- tbPart.dSideAngR = 8
|
|
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 nPartDestId = tbParent[c]
|
|
c = c + 1
|
|
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)
|
|
|
|
return tbSplitBottom
|
|
end
|
|
|
|
-- Confronto i dati del file.dat con quelli letti da programma
|
|
local function IsDataChanged()
|
|
local bOk = false
|
|
if not tbOrigVal.v1 then return true end
|
|
if math.abs(CMP.V1 - tbOrigVal.v1) > 0.5 then bOk = bOk or true end
|
|
if math.abs(CMP.V2 - tbOrigVal.v2) > 0.5 then bOk = bOk or true end
|
|
if math.abs(CMP.V3 - tbOrigVal.v3) > 0.5 then bOk = bOk or true end
|
|
if math.abs(CMP.V4 - tbOrigVal.v4) > 0.5 then bOk = bOk or true end
|
|
if math.abs(CMP.V5 - tbOrigVal.v5) > 0.5 then bOk = bOk or true end
|
|
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
|
|
|
|
-- EgtAddToPackagePath(sPath..'TemplateTool.lua')
|
|
-- require('TemplateTool')
|
|
local TOOL = dofile(sPath..'TemplateTool.lua')
|
|
local sUNICode = TOOL.sUNICode
|
|
|
|
function CMP_Draw(bPreview)
|
|
local bRedraw = IsDataChanged()
|
|
if bRedraw or not CMP.DrawSolid then
|
|
|
|
-- pulisco il file e leggo i dati
|
|
EgtNewFile()
|
|
HorizontalOffset = 0
|
|
CMP.HSplash = CMP.V1 -- altezza alzatina
|
|
CMP.HWater = CMP.V2 -- altezza frotalino
|
|
CMP.DSink = CMP.V3 -- profondità lavello
|
|
CMP.ST = CMP.V4 -- spessore top
|
|
CMP.SB = CMP.V5 -- spessore bottom
|
|
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')
|
|
-- Creo il contorno esterno (id degli edge esterni)
|
|
local tbLoopsTC = ImportLoop( Pz_Top, TOOL.FindLayers( Pz_Top), sPath .. 'TopChicken.nge')
|
|
local tbIdLoopTC = tbLoopsTC[1]
|
|
local tbIdInLoopTC = tbLoopsTC[2]
|
|
-- Creo il pezzo dato il contorno
|
|
local dTh_TC = CMP.ST
|
|
local tbTCLayer = TOOL.FindLayers( Pz_Top)
|
|
local tbTCInfo = {sName = "TopChicken", dTh = dTh_TC, }
|
|
TOOL.CreatePart( tbTCLayer['OutLoop'], tbTCInfo)
|
|
if tbTCLayer['InLoop'] then
|
|
TOOL.AddInLoopToPart( tbTCLayer['InLoop'])
|
|
end
|
|
|
|
--INIZIO CREAZIONE PARETINE dell'OutLoop
|
|
-- tabella che contiene le tabelle con le info dei vari part
|
|
local tbPartsInfo = {}
|
|
local dThCurr = 20
|
|
local dHCurr = 100
|
|
local nPrev = 0
|
|
local nFirst = 0
|
|
for i=1, #tbIdLoopTC do
|
|
local tbInfo = {}
|
|
tbInfo.nParent = Pz_Top
|
|
tbInfo.nEdge = i -- posizione dell'edge nel loop, 1 based
|
|
tbInfo.nEdgeId = tbIdLoopTC[i]
|
|
tbInfo.nPrev = nPrev
|
|
local sNamePz = 'PartA'.. tostring(i)
|
|
tbInfo.sName = sUNICode..sNamePz
|
|
local Pz_A = TOOL.CreatePartLayer(sNamePz)
|
|
if nPrev ~= 0 then tbPartsInfo[nPrev].nNext = Pz_A end
|
|
if i == 1 then nFirst = Pz_A end
|
|
tbInfo.nId = Pz_A
|
|
local nType = EgtGetInfo(tbInfo.nEdgeId, 'AF', 'i') or 0
|
|
local dPairAng = 0
|
|
if nType == 1 then
|
|
dPairAng = dAngAlzatina
|
|
tbInfo.dTh = CMP.SSplash
|
|
tbInfo.dH = CMP.HSplash
|
|
elseif nType == 2 then
|
|
dPairAng = dAngFrontalino
|
|
tbInfo.dTh = CMP.SWater
|
|
tbInfo.dH = CMP.HWater
|
|
end
|
|
tbInfo.nType = nType
|
|
tbInfo.dPairAng = dPairAng
|
|
|
|
nPrev = Pz_A
|
|
tbPartsInfo[tbInfo.nId] = tbInfo
|
|
end
|
|
tbPartsInfo[nFirst].nPrev = nPrev
|
|
tbPartsInfo[nPrev].nNext = nFirst
|
|
|
|
-- aggiungo le paretine dell'InLoop
|
|
nPrev = 0
|
|
nFirst = 0
|
|
for i=1, #tbIdInLoopTC do
|
|
local tbInfo = {}
|
|
tbInfo.nParent = Pz_Top
|
|
tbInfo.nEdge = i -- posizione dell'edge nel loop, 1 based
|
|
tbInfo.nEdgeId = tbIdInLoopTC[i]
|
|
tbInfo.nPrev = nPrev
|
|
local sNamePz = 'InPartA'.. tostring(i)
|
|
tbInfo.sName = sUNICode..sNamePz
|
|
local Pz_A = TOOL.CreatePartLayer(sNamePz)
|
|
if nPrev ~= 0 then tbPartsInfo[nPrev].nNext = Pz_A end
|
|
if i == 1 then nFirst = Pz_A end
|
|
tbInfo.nId = Pz_A
|
|
local nType = EgtGetInfo(tbInfo.nEdgeId, 'AF', 'i') or 0
|
|
local dPairAng = 0
|
|
if nType == 1 then
|
|
dPairAng = dAngAlzatina
|
|
elseif nType == 2 then
|
|
dPairAng = dAngFrontalino
|
|
end
|
|
tbInfo.nType = nType
|
|
tbInfo.dPairAng = dPairAng
|
|
tbInfo.dTh = CMP.SWater
|
|
tbInfo.dH = CMP.DSink
|
|
nPrev = Pz_A
|
|
tbInfo.bInLoop = true
|
|
tbPartsInfo[tbInfo.nId] = tbInfo
|
|
end
|
|
tbPartsInfo[nFirst].nPrev = nPrev
|
|
tbPartsInfo[nPrev].nNext = nFirst
|
|
|
|
|
|
--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
|
|
if nType == 1 then
|
|
----- caratteristiche alzatina
|
|
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
|
|
tbInfo.bOnLoop = false
|
|
----- caratteristiche alzatina
|
|
elseif nType == 2 then
|
|
----- caratteristiche frontalino
|
|
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
|
|
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
|
|
-- SPLASHTOP
|
|
tbInfo.sDestRefOff = '0,0,0'
|
|
tbInfo.sRefOff = tostring(tbInfo.dXOffset)..','..tostring(tbInfo.dYOffset)..',-x'
|
|
elseif nType == 2 then
|
|
-- WATERFALL
|
|
tbInfo.sDestRefOff = '0,0,-x'
|
|
tbInfo.sRefOff = '0,'..tostring(tbInfo.dYOffset)..',0'
|
|
end
|
|
end
|
|
|
|
-- creo tutte le paretine
|
|
for nPart, tbPart in pairs( tbPartsInfo) do
|
|
EgtOutLog(tostring(nPart))
|
|
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['OutLoop'],tbPart)
|
|
if not tbPart.bInLoop then
|
|
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
|
|
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
|
|
if tbPart.dSideAngT then TOOL.SetSideAng(tbLayer['OutLoop'], 'A3', tbPart.dSideAngT) end
|
|
end
|
|
|
|
-- -- creo il fondo
|
|
-- devo ricavare "id del InPartA4" dalle info del TC
|
|
--CreateBottomPart( tbIdInLoopTC, -- id del 'InPartA4')
|
|
CreateSplitBottomPart( tbIdInLoopTC, Pz_Top, CMP.SWater)
|
|
|
|
TOOL.CreateDimensionLayer()
|
|
--SetReference()
|
|
|
|
--TOOL.SaveMePlease()
|
|
|
|
if CMP.DrawSolid then
|
|
loadfile(sPath ..'\\'.. "CreateSOLID_FromPartsInPark.lua")({AutoRun=true})
|
|
TOOL.RelocateLabels()
|
|
loadfile(sPath ..'\\'.. "OperationOnSolid.lua")({AutoRun=true, nVeinCtx=EgtGetContext()})
|
|
AddDimensions()
|
|
end
|
|
-- Se non ci sono errori salvo i dati
|
|
if CMP.ERR == 0 then
|
|
-- scrivo i parametri nelle info del pezzo !! DA FARE !!
|
|
-- WriteCompoDataToPart( Pz, CMP.Nome, CMP.Npar)
|
|
-- salvo i parametri come nuovo default
|
|
SaveCompoData(CMP.Npar)
|
|
OrigData()
|
|
end
|
|
--EgtSaveFile("D:\\Temp\\marmo\\Vein3D\\piano_assemblato.nge")
|
|
end
|
|
end
|
|
|
|
--CMP_Draw()
|
|
|
|
_G.CMP_Draw = CMP_Draw
|