Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d8bfba501 | |||
| b5282c2330 | |||
| e407e75d29 | |||
| 2e01ccac6e | |||
| 1dd33644d8 | |||
| 73abd6aa1c | |||
| c94d4fb8d8 | |||
| 56ce2b317d | |||
| 1d60218943 | |||
| 889e97e5c9 | |||
| bafecedb38 | |||
| d352d8c93e | |||
| 04c3bad9c6 | |||
| cb1f1ab08b | |||
| cd61014fc2 | |||
| b0f2fc2260 | |||
| 8e0141d8c0 | |||
| a5972bf40a | |||
| 8a3c3eca30 | |||
| 369754cdd6 | |||
| cb472f4071 | |||
| e92c3ee546 | |||
| a96680c081 | |||
| 0816e66510 | |||
| 950f9bf303 | |||
| a4fea15aee | |||
| 28922eff89 | |||
| 6e6aa093cf | |||
| f38f5df4bf | |||
| d605c189ef | |||
| f948be4c49 | |||
| fe2cc47c51 | |||
| 098efa7a66 | |||
| 6b2b5eed0f | |||
| cd5c951697 | |||
| 5b7678e5d3 | |||
| 5ce9e807f2 | |||
| 3f5527ec0a | |||
| c6af34c0e8 | |||
| 04929d823f | |||
| 8706506d20 | |||
| 56370249a4 |
+16
@@ -0,0 +1,16 @@
|
||||
|
||||
# /
|
||||
/revision.h
|
||||
/*.aps
|
||||
/*.ncb
|
||||
/*.suo
|
||||
/*.user
|
||||
/*.sdf
|
||||
/*.opensdf
|
||||
/Debug32
|
||||
/Release32
|
||||
/Trial32
|
||||
/Debug64
|
||||
/Release64
|
||||
/ipch
|
||||
/.vscode
|
||||
+293
-116
@@ -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
|
||||
@@ -51,6 +51,11 @@ CMP.MSG = ''
|
||||
CMP.DATA = EgtGetSourceDir() .. CMP.Nome ..'.dat'
|
||||
LoadCompoData()
|
||||
|
||||
-- Percorso direttorio Vein3D
|
||||
local sPath = ""
|
||||
sPath = EgtGetStringFromIni( "Vein3D", "Vein3D_Dir", "", EgtGetIniFile())
|
||||
EgtOutLog(' → '..sPath)
|
||||
|
||||
-- Carico i dati letti da file .dat
|
||||
local tbOrigVal={}
|
||||
local function OrigData()
|
||||
@@ -68,15 +73,22 @@ end
|
||||
local tbName = {'Bottom', 'Left', 'Right', 'Top', 'Back'}
|
||||
local sUNICode = os.date( '%y%m%d%H%M%S', os.time()).."_"
|
||||
|
||||
-- CREAZIONE Layer di un singolo Part
|
||||
-------------------------------------------------------------------------------------------------------------------------
|
||||
-- FUNZIONI BASE PER GENERARE I COMPO SOLID INIZIO
|
||||
-------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
local function SaveMEPlease()
|
||||
EgtSaveFile('c:\\EgtData\\OmagOFFICE\\Vein3D\\FOO.nge')
|
||||
end
|
||||
|
||||
-- CREAZIONE dei Layer di un singolo Part
|
||||
-- I nomi dei layer sono: OutLoop, Region, Ref, Labels, Aux
|
||||
local function CreatePartLayer(PartName)
|
||||
-- Pezzo e Layer
|
||||
local Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- pezzo
|
||||
EgtSetName( Pz, sUNICode..PartName)
|
||||
local LOut = EgtGroup(Pz,GDB_RT.LOC) -- layer della figura principale
|
||||
EgtSetName(LOut,'OutLoop')
|
||||
local LIn = EgtGroup(Pz,GDB_RT.LOC) -- layer della figura principale
|
||||
EgtSetName(LIn,'InLoop')
|
||||
EgtSetName(LOut,'OutLoop')
|
||||
local LReg = EgtGroup(Pz,GDB_RT.LOC) -- layer regione
|
||||
EgtSetName(LReg,'Region')
|
||||
local LRef = EgtGroup(Pz,GDB_RT.LOC) -- layer riferimenti
|
||||
@@ -86,10 +98,14 @@ 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
|
||||
--
|
||||
|
||||
-- RESTITUISCE una tabella con gli Id dei layer del part, altrimenti nil
|
||||
-- RESTITUISCE una tabella con gli Id dei layer costruiti nella funzione CreatePartLayer part,
|
||||
-- Se il nome del Part non esiste restituice nil
|
||||
local function FindLayers( IdPart)
|
||||
if not EgtIsPart( IdPart) then
|
||||
CMP.ERR = 1
|
||||
@@ -98,7 +114,6 @@ local function FindLayers( IdPart)
|
||||
end
|
||||
local tbLayer = {}
|
||||
tbLayer['OutLoop'] = EgtGetFirstNameInGroup(IdPart, 'OutLoop')
|
||||
tbLayer['InLoop'] = EgtGetFirstNameInGroup(IdPart, 'InLoop')
|
||||
tbLayer['Region'] = EgtGetFirstNameInGroup(IdPart, 'Region')
|
||||
tbLayer['Ref'] = EgtGetFirstNameInGroup(IdPart, 'Ref')
|
||||
tbLayer['Labels'] = EgtGetFirstNameInGroup(IdPart, 'Labels')
|
||||
@@ -107,17 +122,6 @@ local function FindLayers( IdPart)
|
||||
end
|
||||
--
|
||||
|
||||
-- CREAZIONE Layers per ogni Parts indicato in tabella 'tbName' e Layer Dimensions
|
||||
local function CreateLayers()
|
||||
for i=1, 5 do
|
||||
-- Pezzo e Layer
|
||||
CreatePartLayer(tbName[i])
|
||||
end
|
||||
local Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- layer dimensioni e etichette
|
||||
EgtSetName( Pz, 'Dimensions')
|
||||
end
|
||||
--
|
||||
|
||||
-- ASSEGNO Info per conoscere le direzioni dei lati
|
||||
local function SetMachiningInfo(Layer, bInLoop)
|
||||
-- if not bInLoop then return end
|
||||
@@ -138,15 +142,21 @@ local function SetMachiningInfo(Layer, bInLoop)
|
||||
local nNextId = EgtGetNext(nId)
|
||||
local nFirstId = nId
|
||||
local nEdges = EgtGetGroupObjs(Layer)
|
||||
if nEdges == 1 then
|
||||
EgtSetInfo(nId, 'PrevAng', 0)
|
||||
EgtSetInfo(nId, 'NextAng', 0)
|
||||
return
|
||||
end
|
||||
for i = 1, nEdges do
|
||||
-- recupero i dati
|
||||
local vtCurrS = EgtSV(nId, GDB_RT.GLOB)
|
||||
local vtPrevS = EgtSV(nPrevId, GDB_RT.GLOB)
|
||||
local vtPrevE = EgtEV(nPrevId, GDB_RT.GLOB)
|
||||
local vtCurrE = EgtEV(nId, GDB_RT.GLOB)
|
||||
local vtNextS = EgtSV(nNextId, GDB_RT.GLOB)
|
||||
local vtAx = Z_AX()
|
||||
if bInLoop then vtAx=-vtAx end
|
||||
local NextAng = GetRotation( vtCurrS, vtNextS, vtAx)
|
||||
local PrevAng = GetRotation( vtPrevS, vtCurrS, vtAx)
|
||||
local NextAng = GetRotation( vtCurrE, vtNextS, vtAx)
|
||||
local PrevAng = GetRotation( vtPrevE, vtCurrS, vtAx)
|
||||
-- scrivo le info
|
||||
EgtSetInfo(nId, 'PrevAng', PrevAng)
|
||||
EgtSetInfo(nId, 'NextAng', NextAng)
|
||||
@@ -161,6 +171,7 @@ local function SetMachiningInfo(Layer, bInLoop)
|
||||
end
|
||||
--
|
||||
|
||||
-- DEVO RICEVERE SOLO UN CONTORNO!! Da semplificare
|
||||
-- Dato un contorno ricavo i lati nel Layer di appartenenza del contorno
|
||||
-- altrimenti se Part ricavo i lati nel loop specificato (Default=OutLoop o InLoop)
|
||||
local function ExplodeAndNameEdges( IdLoop, bInLoop)
|
||||
@@ -190,17 +201,28 @@ local function ExplodeAndNameEdges( IdLoop, bInLoop)
|
||||
local nLay = EgtGetParent(IdLoop)
|
||||
local nEdge, nTotEdges = EgtExplodeCurveCompo(IdLoop)
|
||||
local nCount = 1
|
||||
local tbIdLoop = {}
|
||||
while nEdge do
|
||||
local tbName = EgtNumToString(nCount)
|
||||
EgtSetName( nEdge, "A"..tbName)
|
||||
nCount = nCount + 1
|
||||
table.insert( tbIdLoop, nEdge)
|
||||
nEdge = EgtGetNext(nEdge)
|
||||
end
|
||||
-- Ricavo info direzioni
|
||||
SetMachiningInfo(nLay,bInLoop)
|
||||
return tbIdLoop
|
||||
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
|
||||
--
|
||||
|
||||
|
||||
-- Per disporre i pezzi in piano non sovrappposti (in assemblaggio non serve)
|
||||
local HorizontalOffset = 0
|
||||
|
||||
@@ -259,41 +281,43 @@ local function CreatePart_0(IdPart, sName, ptDiagStart, ptDiagEnd, dTh, dOffset,
|
||||
HorizontalOffset = HorizontalOffset + Point3d(ptDiagEnd):getX()
|
||||
end
|
||||
--
|
||||
local function CreatePart(tbLayer, sName, IdEntCrv, dTh, dOffset, bInLoop)
|
||||
|
||||
-- Creazione del part assegnato un contorno esploso:
|
||||
-- tbLayer : tabella dei layer (FindLayers dato il Part)
|
||||
-- sName : nome da assegnare in grafica
|
||||
-- tbIdEntCrv: tabella delle entità che costituiscono il contorno (da ExplodeAndNameEdges)
|
||||
-- dTh : spessore pezzo
|
||||
-- dOffset : per messa in piano dei pezzi (0 se non si usa)
|
||||
-- bInLoop : tipo di contorno
|
||||
local function CreatePart(tbLayer, sName, tbIdEntCrv, dTh, dOffset, bInLoop)
|
||||
-- recupero il layer del contorno
|
||||
local sNameLayer = ''
|
||||
if bInLoop then
|
||||
sNameLayer = 'InLoop'
|
||||
else
|
||||
sNameLayer = 'OutLoop'
|
||||
end
|
||||
local IdCurrLayer = EgtGetParent( tbIdEntCrv[1])
|
||||
-- recupero l'Id del part
|
||||
local IdPart = EgtGetParent( tbLayer[sNameLayer])
|
||||
-- Nel Layer OutLoop o InLoop definisco il contorno RETTANGOLO
|
||||
EgtOutLog(sNameLayer..' '..tostring(tbLayer[sNameLayer]))
|
||||
-- Copio nel layer OutLoop/InLoop il contorno
|
||||
local IdLoop = EgtCopy( IdEntCrv, tbLayer[sNameLayer])
|
||||
EgtErase(IdEntCrv)
|
||||
local IdPart = EgtGetParent( IdCurrLayer)
|
||||
-- costruisco il contorno chiuso
|
||||
local IdLoop = EgtCurveCompoByChain( IdCurrLayer, tbIdEntCrv, EgtSP(tbIdEntCrv[1],GDB_RT.GLOB), false, GDB_RT.GLOB)
|
||||
-- Nel Layer Region definisco la regione piana
|
||||
local IdReg = EgtSurfFlatRegion(tbLayer['Region'],IdLoop)
|
||||
-- Se InLoop allora faccio la sottrazione con la regione OutRegion
|
||||
if sNameLayer == 'InLoop' then
|
||||
if bInLoop then
|
||||
local IdOutRegion = EgtGetPrev(IdReg)
|
||||
if not EgtSurfFrSubtract( IdOutRegion,IdReg) then
|
||||
CMP.ERR = 5
|
||||
CMP.MSG = CMP.MSG.." Sottrazione tra superficie 'OutLoop' "..tostring(IdOutRegion).." e 'InLoop' "..tostring(IdReg).." non riuscita."
|
||||
end
|
||||
EgtErase(IdReg)
|
||||
end
|
||||
if bInLoop then EgtInvertCurve(IdLoop) end
|
||||
-- Ricavo i lati da lavorare
|
||||
ExplodeAndNameEdges( IdLoop)
|
||||
end
|
||||
-- if bInLoop then EgtInvertCurve(IdLoop) end
|
||||
-- elimino il contorno chiuso
|
||||
EgtErase(IdLoop)
|
||||
|
||||
-- Se sono InLoop non devo settare
|
||||
if bInLoop then return end
|
||||
-- definisco spessore pezzo
|
||||
EgtSetInfo(IdPart, 'Th', dTh)
|
||||
-- INFO NECESSARIA
|
||||
EgtSetInfo(IdPart, 'Paired',tostring(IdPart))
|
||||
|
||||
-- inserisco le etichette del pezzo nel centro della superofocie
|
||||
local ptTop = EgtCP( IdReg, GDB_RT.GLOB)
|
||||
local ptBottom = Point3d( ptTop:getX(), -ptTop:getY(), dTh)
|
||||
@@ -405,7 +429,7 @@ end
|
||||
-- Nome/valore stringa da scrivere nella dimensione
|
||||
-- Frame del piano su cui disegnare la quotatura
|
||||
-- Offset etichetta rispetto al punto medio
|
||||
local function DrawLineraDimension( sNamePart1, sNameRef1, sNamePart2, sNameRef2, sNameDimension, GridFrame, ptOffset)
|
||||
local function DrawLinearDimension( sNamePart1, sNameRef1, sNamePart2, sNameRef2, sNameDimension, GridFrame, ptOffset)
|
||||
EgtSetGridFrame(GridFrame)
|
||||
local nDimLay = EgtGetFirstNameInGroup(GDB_ID.ROOT, 'Dimensions')
|
||||
local nBottomLay = EgtGetFirstNameInGroup(GDB_ID.ROOT, sUNICode..sNamePart1)
|
||||
@@ -422,60 +446,203 @@ local function DrawLineraDimension( sNamePart1, sNameRef1, sNamePart2, sNameRef2
|
||||
EgtRelocate(nDim, GDB_RT.GRID)
|
||||
EgtSetName(nDim, sNameDimension)
|
||||
end
|
||||
--
|
||||
-------------------------------------------------------------------------------------------------------------------------
|
||||
-- FUNZIONI BASE PER GENERARE I COMPO SOLID FINE
|
||||
-------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------
|
||||
-- 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')
|
||||
|
||||
-- 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')
|
||||
SaveMEPlease()
|
||||
end
|
||||
--
|
||||
|
||||
local function AddDimensions()
|
||||
local GridFr = Frame3d(ORIG(),GDB_FR.FRONT)
|
||||
-- la dimensione dell'altezza ( R4 di Bottom e R2 di Top)
|
||||
DrawLineraDimension( 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)
|
||||
DrawLineraDimension( 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)
|
||||
DrawLineraDimension( 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
|
||||
--
|
||||
-------------------------------------------------------------------------------------------------------------------------
|
||||
-- COSTRUZIONE RIFERIMENTI FINE
|
||||
-------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------
|
||||
-- CREAZIONE/IMPORTAZIONE Loop INIZIO
|
||||
-------------------------------------------------------------------------------------------------------------------------
|
||||
-- Importa un contorno chiuso da file nge
|
||||
function ImportOutLoop( 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 AFLLITA MISERAMENTE: '..tostring(IdLoop)..';'..tostring(OutLayer))
|
||||
end
|
||||
EgtErase(LastPart)
|
||||
local tbIdLoop = ExplodeAndNameEdges( IdLoop)
|
||||
|
||||
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)
|
||||
SaveMEPlease()
|
||||
-- definizione SideAng
|
||||
-- EgtSetInfo( tbIdLoop[1], 'OrigSideAng', 45)
|
||||
return tbIdLoop
|
||||
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, Th)
|
||||
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)
|
||||
-- allarghiamo il pezzo
|
||||
ptEND[1] = ptEND[1] + Th*(sin(NAng) + sin(PAng))
|
||||
--ptEND[1] = ptEND[1] + Th*(sin(NAng) + sin(PAng)) - Th/cos(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, Th*sin(PAng)
|
||||
end
|
||||
--
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------
|
||||
-- CREAZIONE/IMPORTAZIONE Loop FINE
|
||||
-------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
local function GetInfoSplahtopOrWaterfall()
|
||||
local tbSplWf = {}
|
||||
-- ...
|
||||
return tbSplWf
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------
|
||||
-- METODI AUSILIARI LOCALI INIZIO
|
||||
-------------------------------------------------------------------------------------------------------------------------
|
||||
-- Restituisce l'angolo precedente e successivo dell'aentità passata
|
||||
local function GetPrevNextAng(IdEnt)
|
||||
local PrevAng = EgtGetInfo(IdEnt,'PrevAng','d') or 0
|
||||
local NextAng = EgtGetInfo(IdEnt,'NextAng','d') or 0
|
||||
return PrevAng, NextAng
|
||||
end
|
||||
--
|
||||
-- Verifica se esiste un Waterfall successivo a quallo corrente (i-esimo) della lista passata
|
||||
local function IsNextWaterfall(tbIdLoop, i)
|
||||
i = i+1
|
||||
if i > #tbIdLoop then i = 1 end
|
||||
local nVal = EgtGetInfo(tbIdLoop[i], 'AF', 'i') or 0
|
||||
if nVal == 2 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
--
|
||||
-- Verifica se esiste un Waterfall precedente a quallo corrente (i-esimo) della lista passata
|
||||
local function IsPrevWaterfall(tbIdLoop, i)
|
||||
i = i-1
|
||||
if i < 1 then i = #tbIdLoop end
|
||||
local nVal = EgtGetInfo(tbIdLoop[i], 'AF', 'i') or 0
|
||||
if nVal == 2 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
--
|
||||
-- Verifica se esiste un Splashtop successivo a quallo corrente (i-esimo) della lista passata
|
||||
local function IsNextSplashtop(tbIdLoop, i)
|
||||
i = i+1
|
||||
if i > #tbIdLoop then i = 1 end
|
||||
local nVal = EgtGetInfo(tbIdLoop[i], 'AF', 'i') or 0
|
||||
if nVal == 1 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
--
|
||||
-- Verifica se esiste un Splashtop precedente a quallo corrente (i-esimo) della lista passata
|
||||
local function IsPrevSplashtop(tbIdLoop, i)
|
||||
i = i-1
|
||||
if i < 1 then i = #tbIdLoop end
|
||||
local nVal = EgtGetInfo(tbIdLoop[i], 'AF', 'i') or 0
|
||||
if nVal == 1 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
-------------------------------------------------------------------------------------------------------------------------
|
||||
-- METODI AUSILIARI LOCALI FINE
|
||||
-------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- Confronto i dati del fiel .dat con quelli letti da programma
|
||||
local function IsDataChanged()
|
||||
@@ -494,7 +661,7 @@ end
|
||||
|
||||
function CMP_Draw(bPreview)
|
||||
local bRedraw = IsDataChanged()
|
||||
if bRedraw then
|
||||
if bRedraw or not CMP.DrawSolid then
|
||||
-- pulisco il file e leggo i dati
|
||||
EgtNewFile()
|
||||
HorizontalOffset = 0
|
||||
@@ -506,39 +673,49 @@ 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 IdLoop = EgtRectangle2P(tbLayer['Aux'],{0,0,0}, tbDimension[nCount],GDB_RT.GLOB)
|
||||
CreatePart(tbLayer, tbName[nCount], IdLoop,tbTh[nCount], HorizontalOffset)
|
||||
-- Costruisco Layer InLoop
|
||||
IdLoop = EgtRectangle2P(tbLayer['Aux'],{20,20,0}, {220,220,0},GDB_RT.GLOB)
|
||||
CreatePart(tbLayer, tbName[nCount], IdLoop, tbTh[nCount], HorizontalOffset, true)
|
||||
nCount = nCount + 1
|
||||
|
||||
-- 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)
|
||||
|
||||
for i=1, #tbIdLoop do
|
||||
local nVal = EgtGetInfo(tbIdLoop[i], 'AF', 'i') or 0
|
||||
if nVal == 2 then
|
||||
-- WATERFALL
|
||||
local dH = 100
|
||||
local sNamePz = 'A'.. tostring(i)..'Waterfall'
|
||||
local Pz_A = CreatePartLayer(sNamePz)
|
||||
local dLen = EgtCurveLength(tbIdLoop[i])
|
||||
local PAng, NAng = GetPrevNextAng(tbIdLoop[i])
|
||||
local tbIdLoopWF = CreateWaterfall( FindLayers(Pz_A), 'OutLoop', {dLen, dH,0}, PAng, NAng, IsPrevWaterfall(tbIdLoop, i), IsNextWaterfall(tbIdLoop, i))
|
||||
CreatePart( FindLayers(Pz_A), sNamePz, tbIdLoopWF, CMP.ST, 0)
|
||||
CreateReference( 'TopChicken', 'OutLoop', 'A'..tostring(i), 'R'..tostring(i), CMP.ST, '0,0,-x')
|
||||
CreateReference(sNamePz, 'OutLoop', 'A3', 'R3', CMP.ST, '0,0,0')
|
||||
SetPairInfo(sNamePz, 'R3', 'TopChicken', 'R'..tostring(i), -1, -90, 1)
|
||||
|
||||
elseif nVal == 1 then
|
||||
-- SPLASHTOP
|
||||
local dH = 200
|
||||
local sNamePz = 'A'.. tostring(i)..'Splahtop'
|
||||
local Pz_A = CreatePartLayer(sNamePz)
|
||||
local dLen = EgtCurveLength(tbIdLoop[i])
|
||||
local PAng, NAng = GetPrevNextAng(tbIdLoop[i])
|
||||
local tbIdLoopWF, PAng, dLenOffset = CreateSplashtop( FindLayers(Pz_A), 'OutLoop', {dLen, dH,0}, PAng, NAng, IsPrevSplashtop(tbIdLoop, i), IsNextSplashtop(tbIdLoop, i), CMP.ST)
|
||||
CreatePart( FindLayers(Pz_A), sNamePz, tbIdLoopWF, CMP.ST, 0)
|
||||
CreateReference( 'TopChicken', 'OutLoop', 'A'..tostring(i), 'R'..tostring(i), CMP.ST, '0,0,0')
|
||||
CreateReference(sNamePz, 'OutLoop', 'A3', 'R3', CMP.ST, tostring(dLenOffset)..',0,-x')
|
||||
--CreateReference(sNamePz, 'OutLoop', 'A3', 'R3', CMP.ST, '0,0,-x')
|
||||
SetPairInfo(sNamePz, 'R3', 'TopChicken', 'R'..tostring(i), -1, 90, 2)
|
||||
end
|
||||
nIdP = EgtGetNext(nIdP)
|
||||
end
|
||||
|
||||
CreateLayerDimension()
|
||||
SetReference()
|
||||
|
||||
if CMP.DrawSolid then
|
||||
local sPath = ""
|
||||
sPath = EgtGetStringFromIni( "Vein3D", "Vein3D_Dir", "", EgtGetIniFile())
|
||||
EgtOutLog(' → '..sPath)
|
||||
loadfile(sPath ..'\\'.. "CreateSOLID_FromPartsInPark.lua")({AutoRun=true})
|
||||
RelocateLabels()
|
||||
loadfile(sPath ..'\\'.. "OperationOnSolid.lua")({AutoRun=true, nVeinCtx=EgtGetContext()})
|
||||
@@ -552,7 +729,7 @@ function CMP_Draw(bPreview)
|
||||
SaveCompoData(CMP.Npar)
|
||||
OrigData()
|
||||
end
|
||||
EgtSaveFile(EgtGetStringFromIni( "Vein3D", "Vein3D_Dir", "", EgtGetIniFile()) ..'\\'.. "FUCK.nge")
|
||||
SaveMEPlease()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -215,7 +215,11 @@ end
|
||||
-- restituisce il valore dell'angolo successivo (se <0 angolo concavo)
|
||||
local function GetnNextAng( nInd)
|
||||
local A = EgtGetInfo( nInd, 'NextAng', 'd')
|
||||
return A
|
||||
if not A then
|
||||
SLD.ERR = 2
|
||||
SLD.MSG = 'Non è presente NAng, probabilmente non ci sono le info di machining sugli edge'
|
||||
end
|
||||
return A
|
||||
end
|
||||
--
|
||||
|
||||
@@ -754,28 +758,36 @@ local function SideAngSolid( tbLoop, bInLoop)
|
||||
end
|
||||
--
|
||||
|
||||
local function CorrectReference()
|
||||
local sName = EgtGetName( IdFP)
|
||||
function SLD.CorrectReference(IdPart)
|
||||
if not IdPart then IdPart = SLD.CurrId end
|
||||
|
||||
local sName = EgtGetName( IdPart)
|
||||
if sName ~= "SOLID" then
|
||||
local nLayRef = EgtGetFirstNameInGroup( IdFP, "Ref")
|
||||
local nLayRef = EgtGetFirstNameInGroup( IdPart, "Ref")
|
||||
local nRef = EgtGetFirstInGroup(nLayRef)
|
||||
while nRef do
|
||||
local var = EgtGetInfo(nRef, "Var")
|
||||
if var == "Th" then
|
||||
var = RTh
|
||||
else
|
||||
var = EgtGetInfo(nRef, "Var", "i")
|
||||
end
|
||||
local dir = EgtGetInfo(nRef, "Dir")
|
||||
if dir then
|
||||
local tbDir = EgtSplitString(dir,",")
|
||||
local vtDir = {}
|
||||
for _,sDir in pairs(tbDir) do
|
||||
sDir = sDir:gsub("x", EgtNumToString(var))
|
||||
table.insert(vtDir, EgtEvalNumExpr(sDir))
|
||||
-- controllo se l'offset ai riferimenti è già stato eseguito
|
||||
local bDone = EgtGetInfo(nRef, 'OffsetDone')
|
||||
if not bDone then
|
||||
local var = EgtGetInfo(nRef, "Var")
|
||||
if var == "Th" then
|
||||
var = RTh
|
||||
else
|
||||
var = EgtGetInfo(nRef, "Var", "i")
|
||||
end
|
||||
vtDir = Vector3d(vtDir)
|
||||
EgtMove(nRef,vtDir, GDB_RT.GLOB)
|
||||
local dir = EgtGetInfo(nRef, "Dir")
|
||||
if dir then
|
||||
local tbDir = EgtSplitString(dir,",")
|
||||
local vtDir = {}
|
||||
for _,sDir in pairs(tbDir) do
|
||||
sDir = sDir:gsub("x", EgtNumToString(var))
|
||||
table.insert(vtDir, EgtEvalNumExpr(sDir))
|
||||
end
|
||||
vtDir = Vector3d(vtDir)
|
||||
EgtMove(nRef,vtDir, GDB_RT.LOC)
|
||||
end
|
||||
-- setto l'info che certifica che l'offset è stato eseguito
|
||||
EgtSetInfo(nRef, 'OffsetDone', true)
|
||||
end
|
||||
nRef = EgtGetNext(nRef)
|
||||
end
|
||||
@@ -897,7 +909,7 @@ local function Draw(bPreview)
|
||||
SideAngSolid( tbId_InLoop[i], true)
|
||||
end
|
||||
|
||||
CreateSolid()
|
||||
CreateSolid()
|
||||
|
||||
|
||||
---- POCKET
|
||||
@@ -908,15 +920,14 @@ local function Draw(bPreview)
|
||||
OnPathSolid()
|
||||
-- WIREFRAME
|
||||
---- Correzione dei riferimenti
|
||||
CorrectReference()
|
||||
SLD.CorrectReference(IdFP)
|
||||
|
||||
|
||||
ExtractBoundaryAndFaces()
|
||||
end
|
||||
--
|
||||
|
||||
|
||||
--per uso nell' |omagOFFICE|
|
||||
--per uso nell' |omagOFFICE| ( bAutoRun deve essere settato a false)
|
||||
function SLD.Main()
|
||||
IdFP = SLD.CurrId
|
||||
ClearCurrIdSOLID()
|
||||
@@ -931,20 +942,20 @@ end
|
||||
GetThickness()
|
||||
Draw( true)
|
||||
EgtSetStatus( IdFP, GDB_ST.OFF)
|
||||
EgtDraw()
|
||||
--EgtDraw()
|
||||
SLD.ERR = 0
|
||||
end
|
||||
|
||||
--per uso nell' |omagOFFICE|
|
||||
|
||||
--per uso nel |CAM5| (bAutoRun da settare a true)
|
||||
bAutoRun = true -- debug
|
||||
--bAutoRun = true
|
||||
if bAutoRun then
|
||||
ClearCurrIdSOLID()
|
||||
RTh = SLD.THICK
|
||||
IdFP = EgtGetFirstPart()
|
||||
local sName = ""
|
||||
--IdFP = 49389
|
||||
--IdFP = 204
|
||||
while IdFP ~= nil and sName ~= "SOLID" do
|
||||
-- procedo a costruire il solido solo se sono in un part con un OutLoop
|
||||
local nLay = EgtGetFirstNameInGroup(IdFP, "OutLoop")
|
||||
@@ -958,7 +969,7 @@ if bAutoRun then
|
||||
--break
|
||||
end
|
||||
--EgtSaveFile('c:\\EgtData\\OmagOFFICE\\Temp\\buche_sottili_SOLID.nge')
|
||||
EgtDraw()
|
||||
--EgtDraw()
|
||||
--SLD.ERR = 0
|
||||
end
|
||||
-----per uso nel |CAM5|
|
||||
|
||||
+223
-132
@@ -37,6 +37,7 @@ ASS.bSaveHist = true -- flag che indica se salvare nella storia l'o
|
||||
ASS.bSaveTemp = false -- flag che indica se salvare nella storia temporanea l'operazione eseguita
|
||||
ASS.nTempToSave = GDB_ID.NULL -- posizione nel vettore temporaneo della trasformazione da salvare
|
||||
ASS.nTypeTrf = GDB_ID.NULL -- tipo della trasformazione da aggiungere alla storia ( 0: traslazione; 1: rotazione; 2: accoppiamento/disaccoppiamento; 3: import)
|
||||
ASS.nDoNTimes = 1 -- numero di volte per cui ripetere una certa operazione (per undo e redo)
|
||||
|
||||
-- output
|
||||
ASS.ERR = 0 -- -1 : valori non settati o sbagliati, -2 : operazione impossibile(es: fuori dall'array), -3 : manca qualcosa nel database (info, pezzi, layer..)
|
||||
@@ -54,6 +55,10 @@ local ptOrigId = ORIG()
|
||||
|
||||
-- gestione della storia
|
||||
-- tbEvent = { Id, vtDir, ptAx, dAngOrId, bWPaired, lPair} -- solo move e rotate possono essere effettuati su pezzi singoli, anche se accoppiati
|
||||
-- se vtDir ~= da V_NULL allora ho una rotazione o traslazione ( distinte da dAngOrId ~= 0)
|
||||
-- se vtDir == V_NULL e dAngOrId ~= 0 allora ho un accoppiamento o undo di un accoppiamento
|
||||
-- se dAngOrId == 0 e #lPair ~= 0 allora ho un disaccoppiamento o accoppiamento di un singolo part da/a un accoppiato
|
||||
-- se dAngOrId == 0 e #lPair == 0 allora ho un import
|
||||
local Time = 0
|
||||
local tbStory = {}
|
||||
-- gestione della storia temporanea
|
||||
@@ -113,6 +118,7 @@ local function AddEvent( tbEvent)
|
||||
for nItTime = Time, nLastEvent, 1 do
|
||||
table.remove(tbStory, Time + 1)
|
||||
end
|
||||
ASS.bRedoPossible = false
|
||||
end
|
||||
if Time < ASS.nMaxStory then Time = Time + 1 end
|
||||
table.insert( tbStory, tbEvent)
|
||||
@@ -170,17 +176,34 @@ function ASS.AddEvent()
|
||||
return bOk
|
||||
end
|
||||
|
||||
-- aggiunta di un singolo evento dalla storia temporanea(indice indicato da ASS.nTempToSave) a quella generale
|
||||
function ASS.AddEventFromTemp()
|
||||
ASS.sFunc = "AddEventFromTemp"
|
||||
if abs(ASS.nTempToSave) > #tbTempStory then
|
||||
ASS.ERR = -2
|
||||
return false
|
||||
end
|
||||
-- nTempToSave indica l'indice dell'elemento del vettore temporaneo da salvare
|
||||
-- con un valore negativo si intende contando a partire dal fondo del vettore
|
||||
if ASS.nTempToSave < 0 then ASS.nTempToSave = #tbTempStory + 1 + ASS.nTempToSave end
|
||||
AddEvent( tbTempStory[ASS.nTempToSave])
|
||||
return true
|
||||
end
|
||||
|
||||
-- aggiunta degli ultimi n eventi temporanei(ASS.nTempToSave) alla storia generale
|
||||
function ASS.AddLastestEventsFromTemp()
|
||||
ASS.sFunc = "AddTempEvents"
|
||||
if abs(ASS.nTempToSave) > #tbTempStory then
|
||||
ASS.ERR = -2
|
||||
return false
|
||||
end
|
||||
-- nTempToSave indica quanti degli ultimi elementi della storia temporanea salvare nella storia
|
||||
for i = ASS.nTempToSave, 0, -1 do
|
||||
AddEvent( tbTempStory[#tbTempStory-i])
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function ASS.ResetStory()
|
||||
tbStory = {}
|
||||
Time = 0
|
||||
@@ -201,31 +224,32 @@ local function ApplyTransf( tbEvent, bForward, bSave, bTemp)
|
||||
ASS.ERR = -1
|
||||
return false
|
||||
end
|
||||
|
||||
-- salvo le impostazioni di lavoro per la storia da ripristinare alla fine di questa funzione
|
||||
local bSaveHistBefore = ASS.bSaveHist
|
||||
ASS.bSaveHist = bSave
|
||||
local bSaveTempBefore = bSaveTempBefore
|
||||
ASS.bSaveTemp = bTemp
|
||||
local bOk = true
|
||||
-- se ho una traslazione o una rotazione applico la trasformazione a tutto l'accoppiato
|
||||
if not AreSameVectorExact(V_NULL(), tbEvent.vtDir) then
|
||||
local vtDir = Vector3d(tbEvent.vtDir)
|
||||
-- se è un undo allora inverto il vettore
|
||||
if not bForward then tbEvent.vtDir = Vector3d(tbEvent.vtDir) * (-1) end
|
||||
if not bForward then vtDir = vtDir * (-1) end
|
||||
if tbEvent.dAngOrId == 0 then
|
||||
ASS.nTypeTrf = 0 -- setto il tipo di trasformazione che sto facendo (in caso serva al chiamante)
|
||||
ASS.nPartId = tbEvent.Id
|
||||
ASS.vtMove = tbEvent.vtDir
|
||||
ASS.bSaveHist = bSave
|
||||
ASS.bSaveTemp = bTemp
|
||||
ASS.vtMove = vtDir
|
||||
if tbEvent.bWPaired then
|
||||
ASS.Move()
|
||||
else
|
||||
ASS.MoveSingle()
|
||||
end
|
||||
elseif not AreSameVectorExact(V_NULL(), tbEvent.vtDir) then
|
||||
elseif not AreSameVectorExact(V_NULL(), vtDir) then
|
||||
ASS.nTypeTrf = 1 -- setto il tipo di trasformazione che sto facendo (in caso serva al chiamante)
|
||||
ASS.nPartId = tbEvent.Id
|
||||
ASS.vtAx = tbEvent.vtDir
|
||||
ASS.vtAx = vtDir
|
||||
ASS.ptAx = tbEvent.ptAx
|
||||
ASS.dAng = tbEvent.dAngOrId
|
||||
ASS.bSaveHist = bSave
|
||||
ASS.bSaveTemp = bTemp
|
||||
if tbEvent.bWPaired then
|
||||
ASS.Rotate()
|
||||
else
|
||||
@@ -240,85 +264,118 @@ local function ApplyTransf( tbEvent, bForward, bSave, bTemp)
|
||||
local nChild = EgtGetInfo(tbEvent.Id, "Child", "i")
|
||||
EgtErase(nChild)
|
||||
EgtErase(tbEvent.Id)
|
||||
end
|
||||
-- se sto facendo un redo, non faccio nulla
|
||||
elseif bForward then
|
||||
ASS.nTypeTrf = 2 -- setto il tipo di trasformazione che sto facendo (in caso serva al chiamante)
|
||||
-- sto applicando un accoppiamento
|
||||
-- aggiorno le info dei due part e di tutti i loro associati
|
||||
ASS.nPartId = tbEvent.Id
|
||||
ASS.nPartToPair = tbEvent.dAngOrId
|
||||
if not ASS.UpdatePairInfo() then return false end
|
||||
else
|
||||
ASS.nTypeTrf = 2 -- setto il tipo di trasformazione che sto facendo (in caso serva al chiamante)
|
||||
-- sto applicando un disaccoppiamento
|
||||
if #tbEvent.lPair == 1 then
|
||||
ASS.nPartId = tbEvent.dAngOrId
|
||||
if not ASS.Unpair() then ASS.ERR = -2 return false end
|
||||
else
|
||||
-- alla lista dei paired del part selezionato per essere accoppiato tolgo tutti i part che ho aggiunto( part destinatario e suoi eventuali accoppiati)
|
||||
for n, nIdToUnpair in pairs(tbEvent.lPair) do
|
||||
-- rimuovo anche le info
|
||||
ASS.nPartId = tbEvent.Id
|
||||
ASS.nPartToPair = nIdToUnpair
|
||||
if not ASS.RemovePairInfo() then return false end
|
||||
end
|
||||
local sPairedNew1 = EgtGetInfo( tbEvent.Id, "Paired", "s")
|
||||
local lPairNew1 = EgtGetInfo(tbEvent.Id, "Paired", "vi")
|
||||
if lPairNew1 == nil or sPairedNew1 == nil then ASS.ERR = -3 return false end
|
||||
-- copio la nuova lista dei paired in tutti gli altri paired
|
||||
for n, nIdPaired in pairs(lPairNew1) do
|
||||
ASS.nPartId = nIdPaired
|
||||
ASS.sPairList = sPairedNew1
|
||||
ASS.nGroup = -1
|
||||
ASS.UpdatePairInfoSingle()
|
||||
end
|
||||
-- se il part corrente era già accoppiato con altri pezzi allora lascio a quell'accoppiato il numero del gruppo che sto spezzando
|
||||
-- e darò un nuovo numero al destinatario e al suo accoppiato
|
||||
local bCurrWasSingle = false
|
||||
if #lPairNew1 == 1 then
|
||||
bCurrWasSingle = true
|
||||
ASS.sPairList = sPairedNew1
|
||||
ASS.nGroup = 0
|
||||
ASS.UpdatePairInfoSingle()
|
||||
end
|
||||
-- alla lista del part destinatario dell'accoppiamento tolgo tutti i part che gli ho aggiunto
|
||||
for n, nIdPaired in pairs(lPairNew1) do
|
||||
-- se sto facendo un redo, non faccio nulla
|
||||
end
|
||||
elseif #tbEvent.lPair > 0 and dAngOrId < 0 then
|
||||
-- sto effettuando un disaccoppiamento (di un part da tutto l'assemblato)
|
||||
ASS.nTypeTrf = 2
|
||||
ASS.nPartId = tbEvent.Id
|
||||
if bForward then
|
||||
ASS.Unpair()
|
||||
else
|
||||
ASS.nPartToPair = tbEvent.lPair[0]
|
||||
ASS.UpdatePairInfo()
|
||||
end
|
||||
else
|
||||
-- sto applicando un accoppiamento o l'undo di un accoppiamento
|
||||
if bForward then
|
||||
ASS.nTypeTrf = 2 -- setto il tipo di trasformazione che sto facendo (in caso serva al chiamante)
|
||||
-- sto applicando un accoppiamento
|
||||
-- aggiorno le info dei due part e di tutti i loro associati
|
||||
ASS.nPartId = tbEvent.Id
|
||||
ASS.nPartToPair = tbEvent.dAngOrId
|
||||
if not ASS.UpdatePairInfo() then bOk = false goto END end
|
||||
else
|
||||
ASS.nTypeTrf = 2 -- setto il tipo di trasformazione che sto facendo (in caso serva al chiamante)
|
||||
-- sto applicando un disaccoppiamento (come undo di un accoppiamento)
|
||||
if #tbEvent.lPair == 1 then
|
||||
ASS.nPartId = tbEvent.dAngOrId
|
||||
ASS.nPartToPair = nIdPaired
|
||||
if not ASS.RemovePairInfo() then return false end
|
||||
end
|
||||
-- assegno un nuovo numero di gruppo al gruppo che ho creato
|
||||
local sPairedNew2 = EgtGetInfo( tbEvent.dAngOrId, "Paired", "s")
|
||||
local lPairNew2 = EgtGetInfo( tbEvent.dAngOrId, "Paired", "vi")
|
||||
local nGroupCode = -1
|
||||
-- se il curr era single allora mantengo il numero di gruppo per l'assemblato del destinatario
|
||||
if not bCurrWasSingle then
|
||||
-- il curr non era single, quindi a lui resta il numero di gruppo
|
||||
if #lPairNew2 > 1 then
|
||||
-- anche il destinatario non era single, quindi serve un nuovo numero di gruppo
|
||||
nGroupCode = GroupCounter
|
||||
GroupCounter = GroupCounter + 1
|
||||
else
|
||||
-- il destinatario era single, quindi rimetto semplicemente a 0 il numero di gruppo
|
||||
nGroupCode = 0
|
||||
if not ASS.Unpair() then
|
||||
ASS.ERR = -2
|
||||
bOk = false
|
||||
goto END
|
||||
end
|
||||
else
|
||||
-- alla lista dei paired del part selezionato per essere accoppiato tolgo tutti i part che ho aggiunto( part destinatario e suoi eventuali accoppiati)
|
||||
for n, nIdToUnpair in pairs(tbEvent.lPair) do
|
||||
-- rimuovo anche le info
|
||||
ASS.nPartId = tbEvent.Id
|
||||
ASS.nPartToPair = nIdToUnpair
|
||||
if not ASS.RemovePairInfo() then
|
||||
bOk = false
|
||||
goto END
|
||||
end
|
||||
end
|
||||
local sPairedNew1 = EgtGetInfo( tbEvent.Id, "Paired", "s")
|
||||
local lPairNew1 = EgtGetInfo(tbEvent.Id, "Paired", "vi")
|
||||
if lPairNew1 == nil or sPairedNew1 == nil then
|
||||
ASS.ERR = -3
|
||||
bOk = false
|
||||
goto END
|
||||
end
|
||||
-- copio la nuova lista dei paired in tutti gli altri paired
|
||||
for n, nIdPaired in pairs(lPairNew1) do
|
||||
ASS.nPartId = nIdPaired
|
||||
ASS.sPairList = sPairedNew1
|
||||
ASS.nGroup = -1
|
||||
ASS.UpdatePairInfoSingle()
|
||||
end
|
||||
-- se il part corrente era già accoppiato con altri pezzi allora lascio a quell'accoppiato il numero del gruppo che sto spezzando
|
||||
-- e darò un nuovo numero al destinatario e al suo accoppiato
|
||||
local bCurrWasSingle = false
|
||||
if #lPairNew1 == 1 then
|
||||
bCurrWasSingle = true
|
||||
ASS.sPairList = sPairedNew1
|
||||
ASS.nGroup = 0
|
||||
ASS.UpdatePairInfoSingle()
|
||||
end
|
||||
-- alla lista del part destinatario dell'accoppiamento tolgo tutti i part che gli ho aggiunto
|
||||
for n, nIdPaired in pairs(lPairNew1) do
|
||||
ASS.nPartId = tbEvent.dAngOrId
|
||||
ASS.nPartToPair = nIdPaired
|
||||
if not ASS.RemovePairInfo() then
|
||||
bOk = false
|
||||
goto END
|
||||
end
|
||||
end
|
||||
-- assegno un nuovo numero di gruppo al gruppo che ho creato
|
||||
local sPairedNew2 = EgtGetInfo( tbEvent.dAngOrId, "Paired", "s")
|
||||
local lPairNew2 = EgtGetInfo( tbEvent.dAngOrId, "Paired", "vi")
|
||||
local nGroupCode = -1
|
||||
-- se il curr era single allora mantengo il numero di gruppo per l'assemblato del destinatario
|
||||
if not bCurrWasSingle then
|
||||
-- il curr non era single, quindi a lui resta il numero di gruppo
|
||||
if #lPairNew2 > 1 then
|
||||
-- anche il destinatario non era single, quindi serve un nuovo numero di gruppo
|
||||
nGroupCode = GroupCounter
|
||||
GroupCounter = GroupCounter + 1
|
||||
else
|
||||
-- il destinatario era single, quindi rimetto semplicemente a 0 il numero di gruppo
|
||||
nGroupCode = 0
|
||||
end
|
||||
end
|
||||
-- aggiorno la lista dei part che erano già paired con il part selezionato
|
||||
for n, nIdPaired in pairs(lPairNew2) do
|
||||
ASS.nPartId = nIdPaired
|
||||
ASS.sPairList = sPairedNew2
|
||||
ASS.nGroup = nGroupCode
|
||||
ASS.UpdatePairInfoSingle()
|
||||
end
|
||||
end
|
||||
-- aggiorno la lista dei part che erano già paired con il part selezionato
|
||||
for n, nIdPaired in pairs(lPairNew2) do
|
||||
ASS.nPartId = nIdPaired
|
||||
ASS.sPairList = sPairedNew2
|
||||
ASS.nGroup = nGroupCode
|
||||
ASS.UpdatePairInfoSingle()
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
|
||||
::END::
|
||||
-- ripristino i valori iniziali delle impostazioni di salvataggio
|
||||
ASS.bSaveHist = bSaveHistBefore
|
||||
ASS.bSaveTemp = bSaveTempBefore
|
||||
return bOk
|
||||
end
|
||||
|
||||
function ASS.Undo()
|
||||
ASS.sFunc = "ASS.Undo"
|
||||
if Time == 0 then do return end end
|
||||
if Time == 0 then do return false end end
|
||||
if Time > #tbStory then Time = #tbStory end
|
||||
ApplyTransf(tbStory[Time], false, false, false)
|
||||
Time = Time - 1
|
||||
@@ -360,7 +417,7 @@ local function RetrieveSurfNorm( nPartId)
|
||||
local nLayR = EgtGetFirstNameInGroup( nPartId, "Region")
|
||||
local nId = EgtGetFirstInGroup(nLayR)
|
||||
local nSurfId = GDB_ID.NULL
|
||||
while nId ~= GDB_ID.NULL do
|
||||
while nId do
|
||||
if EgtGetType( nId) == GDB_TY.SRF_FRGN then
|
||||
nSurfId = nId
|
||||
break
|
||||
@@ -658,6 +715,7 @@ end
|
||||
function ASS.Unpair()
|
||||
ASS.sFunc = "ASS.Unpair"
|
||||
if ASS.nPartId == nil or ASS.nPartId == GDB_ID.NULL then ASS.ERR = -1 return false end
|
||||
local lPairList = EgtGetInfo( ASS.nPartId, "Paired", "vi")
|
||||
-- rimuovo le info dal PartCurr e da tutti i suoi Pair
|
||||
ASS.nPartToPair = ASS.nPartId
|
||||
if not ASS.RemovePairInfo() then return false end
|
||||
@@ -676,6 +734,13 @@ function ASS.Unpair()
|
||||
ASS.sPairList = EgtNumToString(nPartCurr)
|
||||
ASS.nGroup = 0
|
||||
if not ASS.UpdatePairInfoSingle() then return false end
|
||||
-- se richiesto salvo la storia
|
||||
local nPartToPair = lPairList[1] ~= ASS.nPartId and -lPairList[1] or -lPairList[2]
|
||||
if ASS.bActiveHist then
|
||||
local tbEv = {Id = ASS.nPartId, vtDir = V_NULL(), ptAx = ORIG() , dAngOrId = nPartToPair, bWPaired = false, lPair = lPairList}
|
||||
if ASS.bSaveHist then AddEvent( tbEv) end
|
||||
if ASS.bSaveTemp then AddTempEvent( tbEv) end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -784,68 +849,94 @@ function ASS.UpdatePairInfo()
|
||||
return true
|
||||
end
|
||||
|
||||
local function PairPartFollowingInfo(nPart, tbTrasfTot)
|
||||
local sLineToPair = EgtGetInfo(nPart, "PairToRef")
|
||||
local sMyLineToPairName = EgtGetInfo( nPart, "PairMyRef")
|
||||
if sLineToPair then
|
||||
-- recupero l'id del lato da accoppiare
|
||||
local sLayName = "Ref"
|
||||
local nLayRef = EgtGetFirstNameInGroup(nPart, sLayName)
|
||||
local nMyLineToPair = EgtGetFirstNameInGroup(nLayRef, sMyLineToPairName)
|
||||
if nMyLineToPair == nil or nMyLineToPair == GDB_ID.NULL then ASS.ERR = -3 return false end
|
||||
-- spezzo l'informazione per risalire al lato di destinazione dell'accoppiamento
|
||||
local vToInfo = EgtSplitString(sLineToPair, ",")
|
||||
local sLineToPairName = vToInfo[2]
|
||||
local sPartName = vToInfo[1]
|
||||
local nPartToPair = EgtGetFirstNameInGroup(GDB_ID.ROOT, sPartName)
|
||||
local nLay = EgtGetFirstNameInGroup(nPartToPair, sLayName)
|
||||
local nLineToPair = EgtGetFirstNameInGroup(nLay, sLineToPairName)
|
||||
if nLineToPair == nil or nLineToPair == GDB_ID.NULL then ASS.ERR = -3 return false end
|
||||
|
||||
local nSpin = EgtGetInfo(nPart, "PairSpin", "i")
|
||||
ASS.nPartId = nPart
|
||||
ASS.nIdFirstLine = nMyLineToPair
|
||||
ASS.nIdSecondLine = nLineToPair
|
||||
|
||||
-- controllo se è settata la modalità di accoppiamento sennò lascio il default middle-middle
|
||||
local nOption = EgtGetInfo(nPart, "PairMode", "i")
|
||||
ASS.nOption = nOption and nOption or 4
|
||||
if not ASS.EdgePair() then return false end
|
||||
tbTrasfTot[1] = tbTrasfTot[1] + ASS.nTransf
|
||||
|
||||
-- verifico che lo spin sia rispettato
|
||||
local vtEdge1 = EgtSV( ASS.nIdFirstLine, GDB_RT.GLOB)
|
||||
local vtEdge2 = EgtSV( ASS.nIdSecondLine, GDB_RT.GLOB)
|
||||
if AreSameVectorApprox( vtEdge1, vtEdge2) and nSpin == -1 then
|
||||
if not ASS.FlipParallel() then return false end
|
||||
end
|
||||
-- recupero l'angolo che deve esserci tra le due facce dei part alla fine dell'accoppiamento
|
||||
local nAngGoal = EgtGetInfo(nPart, "PairAng", "d")
|
||||
-- calcolo l'angolo attuale tra le due normali e quindi la rotazione che devo applicare per differenza
|
||||
local vtSurf1 = RetrieveSurfNorm(nPart)
|
||||
local vtSurf2 = RetrieveSurfNorm(RetrieveParent(ASS.nIdSecondLine))
|
||||
if vtSurf1 == nil or AreSameVectorApprox( vtSurf1, V_NULL()) or vtSurf2 == nil or AreSameVectorApprox( vtSurf2, V_NULL()) then ASS.ERR = -3 return false end
|
||||
ASS.vtAx = EgtSV(ASS.nIdSecondLine, GDB_RT.GLOB)
|
||||
if ASS.vtAx == nil or AreSameVectorApprox(ASS.vtAx, V_NULL()) then ASS.ERR = -1 return false end
|
||||
local dAngCurr = GetRotation(vtSurf1, vtSurf2, ASS.vtAx)
|
||||
ASS.dAng = dAngCurr - nAngGoal
|
||||
ASS.ptAx = EgtSP(ASS.nIdSecondLine, GDB_RT.GLOB)
|
||||
if not ASS.Rotate() then return false end
|
||||
tbTrasfTot[1] = tbTrasfTot[1] + 1
|
||||
-- aggiorno le info di accoppiamento
|
||||
ASS.nPartToPair = nPartToPair
|
||||
if not ASS.UpdatePairInfo() then return false end
|
||||
tbTrasfTot[1] = tbTrasfTot[1] + 1
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function ASS.PairSingle()
|
||||
if ASS.nPartId ~= GDB_ID.NULL then
|
||||
local tbTrasfTot = {0}
|
||||
PairPartFollowingInfo(ASS.nPartId, tbTrasfTot)
|
||||
ASS.nTransf = tbTrasfTot[1]
|
||||
end
|
||||
end
|
||||
|
||||
function ASS.PairAll()
|
||||
ASS.sFunc = "ASS.PairAll"
|
||||
local nTrasfTot = 0
|
||||
local tbTrasfTot = {0} -- tabella per il conteggio delle operazioni svolte (uso la tabella per passare per riferimento il numero di operazioni alla
|
||||
-- funzione PairPartFollowingInfo)
|
||||
EgtSetContext(ASS.nVeinCtx)
|
||||
local nPart = EgtGetFirstPart()
|
||||
if nPart == nil or nPart == GDB_ID.NULL then ASS.ERR = -3 return false end
|
||||
while nPart do
|
||||
local sLineToPair = EgtGetInfo(nPart, "PairToRef")
|
||||
local sMyLineToPairName = EgtGetInfo( nPart, "PairMyRef")
|
||||
if sLineToPair then
|
||||
-- recupero l'id del lato da accoppiare
|
||||
local sLayName = "Ref"
|
||||
local nLayRef = EgtGetFirstNameInGroup(nPart, sLayName)
|
||||
local nMyLineToPair = EgtGetFirstNameInGroup(nLayRef, sMyLineToPairName)
|
||||
if nMyLineToPair == nil or nMyLineToPair == GDB_ID.NULL then ASS.ERR = -3 return false end
|
||||
-- spezzo l'informazione per risalire al lato di destionazione dell'accoppiamento
|
||||
local vToInfo = EgtSplitString(sLineToPair, "_")
|
||||
local sLineToPairName = vToInfo[3]
|
||||
local sPartName = vToInfo[1].."_"..vToInfo[2]
|
||||
local nPartToPair = EgtGetFirstNameInGroup(GDB_ID.ROOT, sPartName)
|
||||
local nLay = EgtGetFirstNameInGroup(nPartToPair, sLayName)
|
||||
local nLineToPair = EgtGetFirstNameInGroup(nLay, sLineToPairName)
|
||||
if nLineToPair == nil or nLineToPair == GDB_ID.NULL then ASS.ERR = -3 return false end
|
||||
|
||||
local nSpin = EgtGetInfo(nPart, "PairSpin", "i")
|
||||
ASS.nPartId = nPart
|
||||
ASS.nIdFirstLine = nMyLineToPair
|
||||
ASS.nIdSecondLine = nLineToPair
|
||||
|
||||
-- controllo se è settata la modalità di accoppiamento sennò lascio il default middle-middle
|
||||
local nOption = EgtGetInfo(nPart, "PairMode", "i")
|
||||
ASS.nOption = nOption and nOption or 4
|
||||
if not ASS.EdgePair() then return false end
|
||||
nTrasfTot = ASS.nTransf
|
||||
|
||||
-- verifico che lo spin sia rispettato
|
||||
local vtEdge1 = EgtSV( ASS.nIdFirstLine, GDB_RT.GLOB)
|
||||
local vtEdge2 = EgtSV( ASS.nIdSecondLine, GDB_RT.GLOB)
|
||||
if AreSameVectorApprox( vtEdge1, vtEdge2) and nSpin == -1 then
|
||||
if not ASS.FlipParallel() then return false end
|
||||
end
|
||||
-- recupero l'angolo che deve esserci tra le due facce dei part alla fine dell'accoppiamento
|
||||
local nAngGoal = EgtGetInfo(nPart, "PairAng", "i")
|
||||
-- calcolo l'angolo attuale tra le due normali e quindi la rotazione che devo applicare per differenza
|
||||
local vtSurf1 = RetrieveSurfNorm(nPart)
|
||||
local vtSurf2 = RetrieveSurfNorm(RetrieveParent(ASS.nIdSecondLine))
|
||||
if vtSurf1 == nil or AreSameVectorApprox( vtSurf1, V_NULL()) or vtSurf2 == nil or AreSameVectorApprox( vtSurf2, V_NULL()) then ASS.ERR = -3 return false end
|
||||
ASS.vtAx = EgtSV(ASS.nIdSecondLine, GDB_RT.GLOB)
|
||||
if ASS.vtAx == nil or AreSameVectorApprox(ASS.vtAx, V_NULL()) then ASS.ERR = -1 return false end
|
||||
local dAngCurr = GetRotation(vtSurf1, vtSurf2, ASS.vtAx)
|
||||
ASS.dAng = dAngCurr - nAngGoal
|
||||
ASS.ptAx = EgtSP(ASS.nIdSecondLine, GDB_RT.GLOB)
|
||||
if not ASS.Rotate() then return false end
|
||||
nTrasfTot = nTrasfTot + 1
|
||||
-- aggiorno le info di accoppiamento
|
||||
ASS.nPartToPair = nPartToPair
|
||||
if not ASS.UpdatePairInfo() then return false end
|
||||
nTrasfTot = nTrasfTot + 1
|
||||
EgtOutLog(tostring(nPart))
|
||||
-- controllo se il pezzo è già stato accoppiato con la sua destinazione
|
||||
local tbPaired = EgtGetInfo(nPart, "Paired","vi")
|
||||
if not tbPaired then EgtSetInfo(nPart, "Paired", EgtNumToString(nPart)) end
|
||||
local bAlreadyPaired = false
|
||||
if not tbPaired then goto NEXT end
|
||||
for _, nPaired in pairs(tbPaired) do
|
||||
if nPaired == nPartToPair then bAlreadyPaired = true end
|
||||
if bAlreadyPaired then goto NEXT end
|
||||
end
|
||||
|
||||
PairPartFollowingInfo(nPart, tbTrasfTot)
|
||||
::NEXT::
|
||||
nPart = EgtGetNext(nPart)
|
||||
end
|
||||
ASS.nTransf = nTrasfTot
|
||||
ASS.nTransf = tbTrasfTot[1]
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
+1349
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
###ESEMPIO COMANDO ROBOCOPY###
|
||||
|
||||
#path cartella di origine
|
||||
$sourceFolder = "C:\Users\YYY"
|
||||
|
||||
#nomi dei file da copiare
|
||||
$file1 = "nome1.txt"
|
||||
$file2 = "nome2.txt"
|
||||
$file3 = "nome3.txt"
|
||||
|
||||
#path delle cartelle di destinazione
|
||||
$destFolder1 = "C:\Users\XXX1"
|
||||
$destFolder2 = "C:\Users\XXX2"
|
||||
$destFolder3 = "C:\Users\XXX3"
|
||||
|
||||
#copio primo file
|
||||
robocopy $sourceFolder $destFolder1 $file1
|
||||
#copio secondo file
|
||||
robocopy $sourceFolder $destFolder2 $file2
|
||||
#copio terzo file
|
||||
robocopy $sourceFolder $destFolder3 $file3
|
||||
+476
@@ -0,0 +1,476 @@
|
||||
-- 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
|
||||
Binary file not shown.
Reference in New Issue
Block a user