- generalizzazzione delle funzioni e del loro uso: spostate funzioni ed elementi da TopChicken a Template Tool
- aggiunte funzioni a TemplateTool per facilitare l'aggiunta di input. - corretta in OperationOnSolid la funzione per il salvataggio definitivo degli eventi temporanei.
This commit is contained in:
@@ -921,7 +921,6 @@ local function Draw(bPreview)
|
||||
end
|
||||
--
|
||||
|
||||
|
||||
--per uso nell' |omagOFFICE| ( bAutoRun deve essere settato a false)
|
||||
function SLD.Main()
|
||||
IdFP = SLD.CurrId
|
||||
|
||||
@@ -176,6 +176,7 @@ 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
|
||||
@@ -189,15 +190,17 @@ function ASS.AddEventFromTemp()
|
||||
return true
|
||||
end
|
||||
|
||||
function ASS.AddAllTempEvents()
|
||||
ASS.sFunc = "AddAllTempEvents"
|
||||
-- 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
|
||||
|
||||
AddEvent( tbTempStory[ASS.nTempToSave])
|
||||
for i = ASS.nTempToSave, 0, -1 do
|
||||
AddEvent( tbTempStory[#tbTempStory-i])
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
+162
-58
@@ -18,9 +18,11 @@ TOOL.nId = GDB_ID.NULL
|
||||
TOOL.nLay = GDB_ID.NULL
|
||||
TOOL.nEdgeId = GDB_ID.NULL
|
||||
TOOL.tbInfo = {}
|
||||
TOOL.nPrev = -1
|
||||
TOOL.nNext = -1
|
||||
TOOL.nJunctionType = -1
|
||||
TOOL.nParent = GDB_ID.NULL
|
||||
TOOL.nPrev = GDB_ID.NULL
|
||||
TOOL.nNext = GDB_ID.NULL
|
||||
TOOL.dPairAng = nil
|
||||
TOOL.nJunctionType = nil
|
||||
TOOL.bOnLoop = nil
|
||||
TOOL.dAngBR = nil
|
||||
TOOL.dSideAngR = nil
|
||||
@@ -31,22 +33,39 @@ TOOL.dH = nil
|
||||
TOOL.dXOffset = nil
|
||||
TOOL.dBeta1 = nil
|
||||
TOOL.dBeta2 = nil
|
||||
TOOL.sName = ""
|
||||
TOOL.bPrev = nil
|
||||
TOOL.bNext = nil
|
||||
|
||||
-- creo il codice univoco per l'identificazione dei part
|
||||
TOOL.sUNICode = os.date( '%y%m%d%H%M%S', os.time()).."_"
|
||||
|
||||
function TOOL.SaveMePlease()
|
||||
EgtSaveFile('D:\\Temp\\marmo\\Vein3D\\FOO.nge')
|
||||
end
|
||||
|
||||
local function FindEdges(nLay)
|
||||
local function FindEdges(nLay, tbInfo)
|
||||
-- crea una tabella con gli indici degli elementi nel Layer passato (nLay) e
|
||||
-- trova l'indice del lato tbInfo.nEdgeId, 1 based, restituito in tbInfo.nEdge
|
||||
local tbId = {}
|
||||
local nId = EgtGetFirstInGroup(nLay)
|
||||
local c = 1
|
||||
while nId do
|
||||
if tbInfo.nEdgeId ~= GDB_ID.NULL and tbInfo.nEdgeId then
|
||||
if nId == tbInfo.nEdgeId then tbInfo.nEdge = c end
|
||||
end
|
||||
table.insert(tbId, nId)
|
||||
nId = EgtGetNext(nId)
|
||||
c = c + 1
|
||||
end
|
||||
return tbId
|
||||
end
|
||||
|
||||
local function FillInfoTable()
|
||||
|
||||
TOOL.tbInfo.nId = TOOL.nId
|
||||
TOOL.tbInfo.nEdgeId = TOOL.nEdgeId
|
||||
TOOL.tbInfo.nParent = TOOL.nParent
|
||||
TOOL.tbInfo.nPrev = TOOL.nPrev
|
||||
TOOL.tbInfo.nNext = TOOL.nNext
|
||||
TOOL.tbInfo.nJunctionType = TOOL.nJunctionType
|
||||
@@ -56,23 +75,41 @@ local function FillInfoTable()
|
||||
TOOL.tbInfo.dAngBL = TOOL.dAngBL
|
||||
TOOL.tbInfo.dSideAngL = TOOL.dSideAngL
|
||||
TOOL.tbInfo.dLen = TOOL.dLen
|
||||
TOOL.tbInfo.dTh = TOOL.dTh
|
||||
TOOL.tbInfo.dH = TOOL.dH
|
||||
TOOL.tbInfo.dBeta1 = TOOL.dBeta1
|
||||
TOOL.tbInfo.dBeta2 = TOOL.dBeta2
|
||||
end
|
||||
|
||||
function TOOL.WriteDataToChildPart(nParent, nPart, nEdge, dLen, dAngDx, dAngSx, dH, dTh, dBeta1, dBeta2)
|
||||
if not nPart then do return end end
|
||||
if nParent then EgtSetInfo(nParent,"A"..tostring(nEdge), nPart) end
|
||||
if nParent then EgtSetInfo(nPart, 'Parent', nParent) end
|
||||
if nEdge then EgtSetInfo(nPart, 'ParentEdge', nEdge) end
|
||||
if dLen then EgtSetInfo(nPart, 'Len', dLen) end
|
||||
if dAngDx then EgtSetInfo(nPart, 'dAngDx', dAngDx) end
|
||||
if dAgnSx then EgtSetInfo(nPart, 'dAngSx', dAngSx) end
|
||||
if dH then EgtSetInfo(nPart, 'dH', dH) end
|
||||
if dTh then EgtSetInfo(nPart, 'dTh', dTh) end
|
||||
if dBeta1 then EgtSetInfo(nPart, 'dBeta1', dBeta1) end
|
||||
if dBeta2 then EgtSetInfo(nPart, 'dBeta2', dBeta2) end
|
||||
local function FillInfoTableFromPart(nPartId)
|
||||
TOOL.tbInfo.nId =nPartId
|
||||
TOOL.tbInfo.nPrev = EgtGetInfo(nPartId,"Prev", "i")
|
||||
TOOL.tbInfo.nNext = EgtGetInfo(nPartId,"Next", "i")
|
||||
TOOL.tbInfo.nJunctionType = EgtGetInfo(nPartId,"JunctionType", "i")
|
||||
TOOL.tbInfo.bOnLoop = EgtGetInfo(nPartId,"OnLoop", "b")
|
||||
TOOL.tbInfo.dAngBR = EgtGetInfo(nPartId,"AngBR", "d")
|
||||
TOOL.tbInfo.dSideAngR = EgtGetInfo(nPartId,"SideAngR", "d")
|
||||
TOOL.tbInfo.dAngBL = EgtGetInfo(nPartId,"AngBL", "d")
|
||||
TOOL.tbInfo.dSideAngL = EgtGetInfo(nPartId,"SideAngL", "d")
|
||||
TOOL.tbInfo.dLen = EgtGetInfo(nPartId,"Len", "d")
|
||||
TOOL.tbInfo.dH = EgtGetInfo(nPartId,"H", "d")
|
||||
TOOL.tbInfo.dBeta1 = EgtGetInfo(nPartId,"Beta1", "d")
|
||||
TOOL.tbInfo.dBeta2 = EgtGetInfo(nPartId,"Beta2", "d")
|
||||
end
|
||||
|
||||
function TOOL.WriteDataToChildPart(tbInfo)
|
||||
if not tbInfo or not tbInfo.nPart then do return end end
|
||||
if tbInfo.nParent then EgtSetInfo(nParent,"A"..tostring(nEdge), tbInfo.nPart) end
|
||||
if tbInfo.nParent then EgtSetInfo(nPart, 'Parent', tbInfo.nParent) end
|
||||
if tbInfo.nEdge then EgtSetInfo(nPart, 'ParentEdge', tbInfo.nEdge) end
|
||||
if tbInfo.dLen then EgtSetInfo(nPart, 'Len', tbInfo.dLen) end
|
||||
if tbInfo.dAngDx then EgtSetInfo(nPart, 'AngDx', tbInfo.dAngDx) end
|
||||
if tbInfo.dAgnSx then EgtSetInfo(nPart, 'AngSx', tbInfo.dAngSx) end
|
||||
if tbInfo.dH then EgtSetInfo(nPart, 'H', tbInfo.dH) end
|
||||
if tbInfo.dTh then EgtSetInfo(nPart, 'Th', tbInfo.dTh) end
|
||||
if tbInfo.dBeta1 then EgtSetInfo(nPart, 'Beta1', tbInfo.dBeta1) end
|
||||
if tbInfo.dBeta2 then EgtSetInfo(nPart, 'Beta2', tbInfo.dBeta2) end
|
||||
if tbInfo.nJunctionType then EgtSetInfo(nPart, 'Beta2', tbInfo.dBeta2) end
|
||||
end
|
||||
|
||||
-- CREAZIONE dei Layer di un singolo Part
|
||||
@@ -103,7 +140,7 @@ end
|
||||
function TOOL.FindLayers( IdPart)
|
||||
if not EgtIsPart( IdPart) then
|
||||
CMP.ERR = 1
|
||||
CMP.MSG = CMP.MSG.." In FindLayers 'IdPart' non è un Part"
|
||||
CMP.MSG = CMP.MSG.." In FindLayers "..tostring(IdPart).." non è un Part"
|
||||
return nil
|
||||
end
|
||||
local tbLayer = {}
|
||||
@@ -208,13 +245,43 @@ function TOOL.ExplodeAndNameEdges( IdLoop, bInLoop)
|
||||
end
|
||||
--
|
||||
|
||||
-- CREAZIONE LAyer per le dimensioni
|
||||
-- CREAZIONE Layer per le dimensioni
|
||||
function TOOL.CreateDimensionLayer()
|
||||
local Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- layer dimensioni e etichette
|
||||
EgtSetName( Pz, 'Dimensions')
|
||||
end
|
||||
--
|
||||
|
||||
function TOOL.AddInLoopToPart(nLayLoop)
|
||||
-- nLay è il layer contenente il loop da inserire
|
||||
-- recupero l'Id del part
|
||||
local tbIdEntCrv = FindEdges(nLayLoop)
|
||||
local IdPart = EgtGetParent( nLayLoop)
|
||||
local tbLayer = TOOL.FindLayers(IdPart)
|
||||
-- costruisco il contorno chiuso
|
||||
local IdLoop = EgtCurveCompoByChain( nLayLoop, 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 bInLoop then
|
||||
local IdOutRegion = EgtGetPrev(IdReg)
|
||||
local vtNorm1 = EgtSurfFrNormVersor(IdOutRegion)
|
||||
local vtNorm2 = EgtSurfFrNormVersor(IdReg)
|
||||
if AreOppositeVectorApprox( vtNorm1, vtNorm2) then
|
||||
EgtInvertSurf(IdReg)
|
||||
end
|
||||
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
|
||||
|
||||
-- elimino il contorno chiuso
|
||||
EgtErase(IdLoop)
|
||||
end
|
||||
|
||||
-- Per disporre i pezzi in piano non sovrappposti (in assemblaggio non serve)
|
||||
local HorizontalOffset = 0
|
||||
|
||||
@@ -225,53 +292,33 @@ local HorizontalOffset = 0
|
||||
-- dTh : spessore pezzo
|
||||
-- dOffset : per messa in piano dei pezzi (0 se non si usa)
|
||||
-- bInLoop : tipo di contorno
|
||||
function TOOL.CreatePart(tbLayer, sName, tbIdEntCrv, dTh, bInLoop)
|
||||
-- recupero il layer del contorno
|
||||
local IdCurrLayer = EgtGetParent( tbIdEntCrv[1])
|
||||
function TOOL.CreatePart(nLayLoop, tbPart)
|
||||
-- se mancano le variabili di input le recupero dalla tabella generale
|
||||
if not nLayLoop then nLayLoop = TOOL.nLay end
|
||||
if not tbPart then tbPart = TOOL.tbInfo end
|
||||
|
||||
-- recupero l'Id del part
|
||||
local IdPart = EgtGetParent( IdCurrLayer)
|
||||
local tbIdEntCrv = FindEdges(nLayLoop)
|
||||
local IdPart = EgtGetParent( nLayLoop)
|
||||
local tbLayer = TOOL.FindLayers(IdPart)
|
||||
local sPartName = EgtGetName(IdPart)
|
||||
local tbPartName = EgtSplitString(sPartName,"_")
|
||||
local sName = tbPartName[2]
|
||||
-- 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
|
||||
--local bInvertCurve = false
|
||||
if bInLoop then
|
||||
local IdOutRegion = EgtGetPrev(IdReg)
|
||||
local vtNorm1 = EgtSurfFrNormVersor(IdOutRegion)
|
||||
local vtNorm2 = EgtSurfFrNormVersor(IdReg)
|
||||
if AreOppositeVectorApprox( vtNorm1, vtNorm2) then
|
||||
EgtInvertSurf(IdReg)
|
||||
--bInvertCurve = true
|
||||
end
|
||||
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
|
||||
-- elimino il contorno chiuso
|
||||
EgtErase(IdLoop)
|
||||
|
||||
-- Se sono InLoop non devo settare
|
||||
if bInLoop then
|
||||
--if bInvertCurve then
|
||||
-- for i = 1, #tbIdEntCrv do
|
||||
-- EgtInvertCurve(tbIdEntCrv[i])
|
||||
-- end
|
||||
--end
|
||||
return
|
||||
end
|
||||
|
||||
-- definisco spessore pezzo
|
||||
if dTh then EgtSetInfo(IdPart, 'Th', dTh) end
|
||||
-- scrivo nel part le informazioni di costruzione
|
||||
TOOL.WriteDataToChildPart(tbPart)
|
||||
-- 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)
|
||||
local ptBottom = Point3d( ptTop:getX(), -ptTop:getY(), tbPart.dTh)
|
||||
EgtTextAdv(tbLayer['Labels'], ptTop,0,sName, '', 10, '', 15,1.5,0,GDB_TI.MC)
|
||||
if CMP.DrawSolid then
|
||||
EgtSetGridFrame(Frame3d(ORIG(),GDB_FR.BOTTOM))
|
||||
@@ -631,7 +678,7 @@ function TOOL.CreateCircularHole(nPart, ptCenter, dDiam)
|
||||
EgtSetName(nInLoopLay, 'InLoop')
|
||||
local HoleId = EgtCircle( nInLoopLay, ptCenter, dDiam, GDB_RT.GLOB)
|
||||
TOOL.SetMachiningInfo(nInLoopLay)
|
||||
TOOL.CreatePart(TOOL.FindLayers(nPart),nil,{HoleId},nil,true)
|
||||
TOOL.AddInLoopToPart(nInLoopLay)
|
||||
end
|
||||
|
||||
|
||||
@@ -645,7 +692,7 @@ function TOOL.CreateParetina(nEdgeId, tbInfo, dPairAngCorr)
|
||||
end
|
||||
|
||||
local nLay = EgtGetParent(nEdgeId)
|
||||
local tbIdLoopTC = FindEdges(nLay) -- tabella che contiene gli id degli Edge del loop
|
||||
local tbIdLoopTC = FindEdges(nLay, tbInfo) -- tabella che contiene gli id degli Edge del loop
|
||||
-- local nId = EgtGetFirstInGroup(nLay)
|
||||
local i = tbInfo.nEdge -- posizione del lato nel layer del loop
|
||||
|
||||
@@ -662,7 +709,7 @@ function TOOL.CreateParetina(nEdgeId, tbInfo, dPairAngCorr)
|
||||
local dLenPrev = EgtCurveLength(tbIdLoopTC[#tbIdLoopTC])
|
||||
local dLenNext = EgtCurveLength(tbIdLoopTC[nNext])
|
||||
local PrevAng, NextAng = GetPrevNextAng(tbIdLoopTC[i])
|
||||
local dTh = EgtGetInfo(tbInfo.nId, 'dTh','d')
|
||||
local dTh = tbInfo.dTh and tbInfo.dTh or EgtGetInfo(tbInfo.nId, 'dTh','d')
|
||||
|
||||
-- calcolo l'angolo di sformo con il pezzo precedente
|
||||
local dXOffset = 0
|
||||
@@ -683,7 +730,6 @@ function TOOL.CreateParetina(nEdgeId, tbInfo, dPairAngCorr)
|
||||
-- se ho una giunzione a T allora devo aggiustare la lunghezza dei pezzi sia che la faccia sia On, sia che sia Off
|
||||
dLenPrev, dLen, dXOffset = ManageJunction(PrevAng,dTh, dTh,tbInfo.nJunctionType, dLenPrev, dLen)
|
||||
-- setto il sideang da giunzione a T
|
||||
-- setto il sideang da giunzione a T
|
||||
local dSideAng_4 = 90 - math.abs(PrevAng)
|
||||
if tbInfo.bOnLoop then dSideAng_4 = dSideAng_4 * (-1) end
|
||||
tbInfo.dSideAngR = dSideAng_4
|
||||
@@ -737,10 +783,68 @@ function TOOL.CreateParetina(nEdgeId, tbInfo, dPairAngCorr)
|
||||
tbInfo.dXOffset = dXOffset
|
||||
end
|
||||
|
||||
function TOOL.CreateParetinaFull()
|
||||
-- devo modificare anche la paretina precedente e la successiva
|
||||
local function ClearPart(nPartId)
|
||||
local tbLayer = TOOL.FindLayers(nPartId)
|
||||
EgtEmptyGroup(tbLayer["OutLoop"])
|
||||
EgtEmptyGroup(tbLayer["Region"])
|
||||
local PartSolid = EgtGetInfo(TOOL.tbInfo.nId, "Child")
|
||||
EgtErase(PartSolid)
|
||||
end
|
||||
|
||||
-- local function AdaptNeighbour(nPartNeigh)
|
||||
-- TOOL.tbInfo = {}
|
||||
-- FillInfoTableFromPart(nPartNeigh)
|
||||
|
||||
-- end
|
||||
|
||||
function TOOL.CreateParetinaFull(bPrev, bNext)
|
||||
if bPrev == nil then bPrev = TOOL.bPrev end
|
||||
if bNext == nil then bNext = TOOL.bNext end
|
||||
|
||||
-- recupero tutte le info che mi servono (che vengono messe in TOOL.tbInfo)
|
||||
FillInfoTable()
|
||||
|
||||
-- controllo se nelle info del parent se era già stato creato il part associato a quel lato
|
||||
local sEdgeName = EgtGetName(TOOL.tbInfo.nEdgeId)
|
||||
local nEdge = tonumber(string.sub(sEdgeName, 2))
|
||||
if not TOOL.tbInfo.nParent or TOOL.tbInfo.nParent == GDB_ID.NULL then TOOL.tbInfo.nParent = EgtGetParent(EgtGetParent(TOOL.tbInfo.nEdgeId))end
|
||||
local nChildPart = EgtGetInfo(TOOL.tbInfo.nParent, sEdgeName, "i")
|
||||
|
||||
if not nChildPart then
|
||||
-- se il part non esiste, lo creo
|
||||
local sPrefix = EgtGetName(EgtGetParent(TOOL.tbInfo.nEdgeId)) == "OutLoop" and "Part" or "InPart"
|
||||
local sPartname = sPrefix..sEdgeName
|
||||
TOOL.CreatePartLayer(sPartname, TOOL.sUNICode)
|
||||
else
|
||||
-- se esisteva già ripulisco i layer della regione e del loop ed elimino il solido
|
||||
ClearPart(nChildPart)
|
||||
end
|
||||
|
||||
TOOL.CreateParetina()
|
||||
TOOL.CreateAdjustedPart()
|
||||
TOOL.CreatePart()
|
||||
|
||||
-- devo modificare anche la paretina precedente e la successiva
|
||||
-- modifico anche la paretina precedente(se esiste)
|
||||
local nNext = tbInfo.nNext
|
||||
local nCurr = tbInfo.nId
|
||||
FillInfoTableFromPart(tbInfo.nPrev)
|
||||
if bPrev then TOOL.CreateParetinaFull(false, false) end
|
||||
-- modifico anche la paretina successiva(se esiste)
|
||||
FillInfoTableFromPart(nNext)
|
||||
if bNext then TOOL.CreateParetinaFull(false, false) end
|
||||
|
||||
-- creo il solido e lo accoppio
|
||||
if not SLD then
|
||||
SLD.CurrId = nCurr
|
||||
SLD.Main()
|
||||
end
|
||||
if not ASS then
|
||||
ASS.nPartId = nCurr
|
||||
ASS.PairSingle()
|
||||
end
|
||||
-- pulisco la tabella con i dati
|
||||
TOOL.tbInfo = {}
|
||||
end
|
||||
|
||||
return TOOL
|
||||
|
||||
+13
-13
@@ -81,8 +81,6 @@ local function OrigData()
|
||||
end
|
||||
---
|
||||
|
||||
local sUNICode = os.date( '%y%m%d%H%M%S', os.time()).."_"
|
||||
|
||||
-- Per disporre i pezzi in piano non sovrappposti (in assemblaggio non serve)
|
||||
local HorizontalOffset = 0
|
||||
|
||||
@@ -166,6 +164,7 @@ local function CreateBottomPart( tbIdLoop, sNamePartDest, nParent)
|
||||
local tbPart = {}
|
||||
local Pz_Bottom = TOOL.CreatePartLayer('Bottom', sUNICode)
|
||||
tbPart.sName = 'Bottom'
|
||||
tbPart.nParent = nParent
|
||||
tbPart.dTh = CMP.SB
|
||||
tbPart.sDestRefOff = '0,0,-x'
|
||||
tbPart.sRefOff = '0,0,0'
|
||||
@@ -183,7 +182,6 @@ local function CreateBottomPart( tbIdLoop, sNamePartDest, nParent)
|
||||
TOOL.CreateReference( sUNICode, sNamePartDest, 'OutLoop', 'A1', 'R1', tbPart.dTh, tbPart.sDestRefOff)
|
||||
TOOL.CreateReference(sUNICode, tbPart.sName, 'OutLoop', 'A4', 'R4', 0, tbPart.sRefOff)
|
||||
TOOL.SetPairInfo(sUNICode, tbPart.sName, 'R4', sNamePartDest, 'R1', -1, tbPart.dPairAng, 4)
|
||||
TOOL.WriteDataToChildPart(nParent, Pz_Bottom, nEdge,tbPart.dLen,tbPart.dAngBR, tbPart.dAngBL, tbPart.dH, tbPart.dTh)
|
||||
end
|
||||
|
||||
local function CreateSplitBottomPart( tbIdLoop, nParent, dOffset)
|
||||
@@ -244,7 +242,6 @@ local function CreateSplitBottomPart( tbIdLoop, nParent, dOffset)
|
||||
TOOL.CreateReference( sUNICode, sNamePartDest, 'OutLoop', 'A1', 'R1', tbPart.dTh, tbPart.sDestRefOff)
|
||||
TOOL.CreateReference(sUNICode, tbPart.sName, 'OutLoop', 'A1', 'R1', 0, tbPart.sRefOff)
|
||||
TOOL.SetPairInfo(sUNICode, tbPart.sName, 'R1', sNamePartDest, 'R1', -1, tbPart.dPairAng, 4)
|
||||
TOOL.WriteDataToChildPart(Pz_Top, nPart, tbPart.nEdge,tbPart.dLen,tbPart.dAngBR, tbPart.dAngBL, tbPart.dH, tbPart.dTh)
|
||||
end
|
||||
|
||||
EgtErase(nAuxLay)
|
||||
@@ -271,6 +268,7 @@ end
|
||||
-- EgtAddToPackagePath(sPath..'TemplateTool.lua')
|
||||
-- require('TemplateTool')
|
||||
local TOOL = dofile(sPath..'TemplateTool.lua')
|
||||
local sUNICode = TOOL.sUNICode
|
||||
|
||||
function CMP_Draw(bPreview)
|
||||
local bRedraw = IsDataChanged()
|
||||
@@ -298,9 +296,10 @@ function CMP_Draw(bPreview)
|
||||
-- Creo il pezzo dato il contorno
|
||||
local dTh_TC = CMP.ST
|
||||
local tbTCLayer = TOOL.FindLayers( Pz_Top)
|
||||
TOOL.CreatePart( tbTCLayer, 'TopChicken', tbIdLoopTC, dTh_TC, false)
|
||||
local tbTCInfo = {sName = "TopChicken", dTh = dTh_TC, }
|
||||
TOOL.CreatePart( tbTCLayer['OutLoop'], tbTCInfo)
|
||||
if tbTCLayer['InLoop'] then
|
||||
TOOL.CreatePart( tbTCLayer, 'TopChicken', tbIdInLoopTC, dTh_TC, true)
|
||||
TOOL.AddInLoopToPart( tbTCLayer['InLoop'])
|
||||
end
|
||||
|
||||
--INIZIO CREAZIONE PARETINE dell'OutLoop
|
||||
@@ -312,7 +311,8 @@ function CMP_Draw(bPreview)
|
||||
local nFirst = 0
|
||||
for i=1, #tbIdLoopTC do
|
||||
local tbInfo = {}
|
||||
tbInfo.nEdge = i
|
||||
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)
|
||||
@@ -347,11 +347,12 @@ function CMP_Draw(bPreview)
|
||||
nFirst = 0
|
||||
for i=1, #tbIdInLoopTC do
|
||||
local tbInfo = {}
|
||||
tbInfo.nEdge = i
|
||||
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
|
||||
--tbInfo.sName = sUNICode..sNamePz
|
||||
local Pz_A = TOOL.CreatePartLayer(sNamePz, sUNICode)
|
||||
if nPrev ~= 0 then tbPartsInfo[nPrev].nNext = Pz_A end
|
||||
if i == 1 then nFirst = Pz_A end
|
||||
@@ -392,7 +393,7 @@ function CMP_Draw(bPreview)
|
||||
if nType == 1 then
|
||||
----- caratteristiche alzatina
|
||||
tbInfo.dPairAng = dPairAng
|
||||
tbInfo.dSideAngT = dPairAng - 90
|
||||
tbInfo.dSideAngT = dPairAng - 90 -- side ang del lato top
|
||||
tbInfo.dTh = dTh
|
||||
tbInfo.dYOffset = dTh * tan(tbInfo.dSideAngT)
|
||||
--nJunctionType = 2 -- trim end
|
||||
@@ -403,7 +404,7 @@ function CMP_Draw(bPreview)
|
||||
elseif nType == 2 then
|
||||
----- caratteristiche frontalino
|
||||
tbInfo.dPairAng = dPairAng
|
||||
tbInfo.dSideAngT = -( -dPairAng - 90)
|
||||
tbInfo.dSideAngT = -( -dPairAng - 90) -- side ang del lato top
|
||||
tbInfo.dTh = dTh
|
||||
tbInfo.dYOffset = dTh * tan(tbInfo.dSideAngT)
|
||||
tbInfo.nJunctionType = 3 -- angle junction
|
||||
@@ -438,7 +439,7 @@ function CMP_Draw(bPreview)
|
||||
local nEdge = tbPart.nEdge
|
||||
local tbLayer = TOOL.FindLayers(nPart)
|
||||
local tbIdLoop = TOOL.CreateAdjustedPart( tbLayer['OutLoop'],tbPart.dLen, tbPart.dH, tbPart.dAngBL, tbPart.dAngBR)
|
||||
TOOL.CreatePart(tbLayer,tbPart.sName,tbIdLoop,tbPart.dTh,false)
|
||||
TOOL.CreatePart(tbLayer['OutLoop'],tbPart)
|
||||
if not tbPart.bInLoop then
|
||||
TOOL.CreateReference( sUNICode, 'TopChicken', 'OutLoop', 'A'..tostring(nEdge), 'R'..tostring(nEdge), dTh_TC, tbPart.sDestRefOff)
|
||||
TOOL.CreateReference(sUNICode, tbPart.sName, 'OutLoop', 'A3', 'R3', tbPart.dTh, tbPart.sRefOff)
|
||||
@@ -451,7 +452,6 @@ function CMP_Draw(bPreview)
|
||||
if tbPart.dSideAngL then TOOL.SetSideAng(tbLayer['OutLoop'], 'A2', tbPart.dSideAngL) end
|
||||
if tbPart.dSideAngR then TOOL.SetSideAng(tbLayer['OutLoop'], 'A4', tbPart.dSideAngR) end
|
||||
if tbPart.dSideAngT then TOOL.SetSideAng(tbLayer['OutLoop'], 'A3', tbPart.dSideAngT) end
|
||||
TOOL.WriteDataToChildPart(Pz_Top, nPart, nEdge,tbPart.dLen,tbPart.dAngBR, tbPart.dAngBL, tbPart.dH, tbPart.dTh)
|
||||
end
|
||||
|
||||
-- -- creo il fondo
|
||||
|
||||
Reference in New Issue
Block a user