- corretto bug nella creazione del solido di un pezzo con un foro.
- aggiunta lettura thickness dalle info del part.
This commit is contained in:
@@ -10,14 +10,6 @@ require( 'EgtBase')
|
||||
_ENV = EgtProtectGlobal()
|
||||
EgtEnableDebug( false)
|
||||
|
||||
--EgtOpenFile( "C:\\EgtData\\OmagOFFICE\\Temp\\debug_buche_sottili.nge")
|
||||
--EgtOpenFile( "C:\\EgtData\\OmagOFFICE\\Temp\\buca_squadrata.nge")
|
||||
--EgtOpenFile( "C:\\EgtData\\OmagOFFICE\\Temp\\buca_squadrata45.nge")
|
||||
--EgtOpenFile( "C:\\EgtData\\OmagOFFICE\\Temp\\buca_squadrata-45.nge")
|
||||
--EgtOpenFile( "C:\\EgtData\\OmagOFFICE\\Temp\\sideAng_archi_Interni_-45.nge")
|
||||
--EgtOpenFile( "C:\\EgtData\\OmagOFFICE\\Temp\\sideAng_archi_Interni_45.nge")
|
||||
--EgtOpenFile( "C:\\EgtData\\OmagOFFICE\\Temp\\buca_limitata.nge")
|
||||
|
||||
|
||||
-- Dati raccolti direttamente dal programma
|
||||
local SLD = {}
|
||||
@@ -29,6 +21,13 @@ SLD.CurrPartSolid = -1
|
||||
SLD.CurrSrfTmId = -1
|
||||
SLD.ERR = -1
|
||||
|
||||
----- mi preparo a ricevere argomenti
|
||||
local arg = ...
|
||||
local bAutoRun = false
|
||||
if arg then
|
||||
bAutoRun = arg.AutoRun
|
||||
end
|
||||
|
||||
_G.SLD = SLD
|
||||
|
||||
local ColorSTD = 'AQUA'
|
||||
@@ -156,6 +155,7 @@ local function CreatePartSOLID()
|
||||
EgtSetName( IdP_SOLID, "SOLID")
|
||||
EgtSetInfo(IdP_SOLID, "Parent", IdFP)
|
||||
EgtSetInfo(IdFP, "Child", IdP_SOLID)
|
||||
EgtSetInfo( IdP_SOLID, "Th", RTh)
|
||||
IdL_Temp = EgtGroup(IdP_SOLID,GDB_RT.LOC)
|
||||
EgtSetName( IdL_Temp, "Temp")
|
||||
IdL_Solid = EgtGroup(IdP_SOLID,GDB_RT.LOC)
|
||||
@@ -287,14 +287,6 @@ local function CreateSolid()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- -- salvo le facce sopra e sotto come flat region
|
||||
-- local nIdSurfFr1 = EgtSurfFlatRegion( IdL_Faces, tbLoop1)
|
||||
-- local nIdSurfFr2 = EgtSurfFlatRegion( IdL_Faces, tbLoop2)
|
||||
-- EgtSetAlpha({nIdSurfFr1,nIdSurfFr2},1)
|
||||
-- table.insert( tbId_Faces, nIdSurfFr1)
|
||||
-- table.insert( tbId_Faces, nIdSurfFr2)
|
||||
|
||||
-- creo le SurfTm delle facce sopra e sotto
|
||||
local nIdSurf1 = EgtSurfTmByRegion( IdL_Solid, tbLoop1)
|
||||
local nIdSurf2 = EgtSurfTmByRegion( IdL_Solid, tbLoop2)
|
||||
@@ -632,9 +624,11 @@ local function SideAngSolid( tbLoop, bInLoop)
|
||||
if i == #tbIdR then
|
||||
Ind_Nex = 1
|
||||
end
|
||||
-- se ho solo una faccia laterale termino ( è un foro descritto da un unico loop circolare)
|
||||
if Ind_Curr == Ind_Nex then break end
|
||||
|
||||
local pt_n, vn_n = EgtSurfTmFacetCenter( tbIdR[Ind_Nex][1], 0)
|
||||
local pt_c, vn_c = EgtSurfTmFacetCenter( tbIdR[Ind_Curr][1], 0)
|
||||
|
||||
if tbArc[Ind_Nex] then
|
||||
pt_n = tbIdR[Ind_Nex][2] -- prendo startPoint
|
||||
vn_n = tbIdR[Ind_Nex][3] -- prendo vtStart
|
||||
@@ -725,6 +719,7 @@ local function SideAngSolid( tbLoop, bInLoop)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- unisco tutte le superfici laterali
|
||||
local tbIdTrim = {}
|
||||
for i=1, #tbIdR, 1 do
|
||||
@@ -888,7 +883,6 @@ end
|
||||
----------------------------------------------------------------------------
|
||||
-- funzione che si occupa di creare il solido finale
|
||||
local function Draw(bPreview)
|
||||
--ClearAllSOLID()
|
||||
CreatePartSOLID()
|
||||
-- SOLID
|
||||
IdL_OutLoop = GetIdFromLay( tbId_OutLoop, 'OutLoop')
|
||||
@@ -897,18 +891,6 @@ local function Draw(bPreview)
|
||||
IdL_Pocket = GetIdFromLay( tbId_Pocket, 'Pocket')
|
||||
IdL_FiloTop = GetIdFromLay( tbId_FiloTop, 'FiloTop')
|
||||
|
||||
-- local nLoop = EgtGetFirstInGroup(IdL_OutLoop)
|
||||
-- EgtDeselectAll()
|
||||
-- while nLoop ~= nil do
|
||||
-- EgtSelectObj(nLoop)
|
||||
-- nLoop = EgtGetNext( nLoop)
|
||||
-- end
|
||||
|
||||
-- local nOutLoop = EgtCurveCompoByChain(GDB_ID.CL,{GDB_ID.SEL},EgtEP(nLoop),false,GDB_RT.GRID,0.01)
|
||||
-- --EgtSetGridFrame({{0,20,25},{0,-1,0},{0,0,1},{-1,0,0}}) -- Ok=1
|
||||
-- EgtSetGridFrame({EgtMP(nOutLoop),EgtSV(nOutLoop),EgtCurveExtrusion(nOutLoop^EgtSV(nOutLoop),EgtCurveExtrusion(nOutLoop)})
|
||||
-- EgtErase(nOutLoop)
|
||||
|
||||
-- SIDEANG
|
||||
SideAngSolid( tbId_OutLoop, false)
|
||||
for i = 1, #tbId_InLoop, 1 do
|
||||
@@ -930,52 +912,55 @@ local function Draw(bPreview)
|
||||
|
||||
|
||||
ExtractBoundaryAndFaces()
|
||||
|
||||
--EgtSetGridFrame({{0,0,0},{1,0,0},{0,1,0},{0,0,1}})
|
||||
end
|
||||
--
|
||||
|
||||
|
||||
-- --per uso nell' |omagOFFICE|
|
||||
-- function SLD.Main()
|
||||
-- IdFP = SLD.CurrId
|
||||
-- ClearCurrIdSOLID()
|
||||
-- if IdFP == -1 then
|
||||
-- SLD.ERR = 1
|
||||
-- return
|
||||
-- end
|
||||
-- RTh = SLD.THICK
|
||||
-- if RTh == 0 then
|
||||
-- return
|
||||
-- end
|
||||
-- GetThickness()
|
||||
-- Draw( true)
|
||||
-- EgtSetStatus( IdFP, GDB_ST.OFF)
|
||||
-- --EgtSaveFile('c:\\EgtData\\OmagOFFICE\\Temp\\Ribasso_0.nge')
|
||||
-- EgtDraw()
|
||||
-- SLD.ERR = 0
|
||||
-- end
|
||||
|
||||
-- --per uso nell' |omagOFFICE|
|
||||
|
||||
|
||||
--per uso nel |CAM5|
|
||||
ClearCurrIdSOLID()
|
||||
RTh = SLD.THICK
|
||||
IdFP = EgtGetFirstPart()
|
||||
local sName = ""
|
||||
--IdFP = 49389
|
||||
while IdFP ~= nil and sName ~= "SOLID" do
|
||||
--per uso nell' |omagOFFICE|
|
||||
function SLD.Main()
|
||||
IdFP = SLD.CurrId
|
||||
ClearCurrIdSOLID()
|
||||
if IdFP == -1 then
|
||||
SLD.ERR = 1
|
||||
return
|
||||
end
|
||||
RTh = SLD.THICK
|
||||
if RTh == 0 then
|
||||
return
|
||||
end
|
||||
GetThickness()
|
||||
Draw( true)
|
||||
EgtSetStatus( IdFP, GDB_ST.OFF)
|
||||
EgtDraw()
|
||||
SLD.ERR = 0
|
||||
end
|
||||
|
||||
--per uso nell' |omagOFFICE|
|
||||
|
||||
--per uso nel |CAM5| (bAutoRun da settare a true)
|
||||
bAutoRun = true -- debug
|
||||
if bAutoRun then
|
||||
ClearCurrIdSOLID()
|
||||
RTh = SLD.THICK
|
||||
IdFP = EgtGetFirstPart()
|
||||
local sName = ""
|
||||
--IdFP = 49389
|
||||
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")
|
||||
if nLay then
|
||||
GetThickness()
|
||||
Draw( true)
|
||||
EgtSetStatus( IdFP, GDB_ST.OFF)
|
||||
end
|
||||
IdFP = EgtGetNextPart(IdFP)
|
||||
sName = EgtGetName(IdFP)
|
||||
--break
|
||||
end
|
||||
--EgtSaveFile('c:\\EgtData\\OmagOFFICE\\Temp\\buche_sottili_SOLID.nge')
|
||||
EgtDraw()
|
||||
--SLD.ERR = 0
|
||||
end
|
||||
--EgtSaveFile('c:\\EgtData\\OmagOFFICE\\Temp\\buche_sottili_SOLID.nge')
|
||||
EgtDraw()
|
||||
--SLD.ERR = 0
|
||||
-----per uso nel |CAM5|
|
||||
|
||||
--_G.SLD_Main = SLD_Main
|
||||
|
||||
+25
-36
@@ -6,6 +6,9 @@ require( 'EgtBase')
|
||||
_ENV = EgtProtectGlobal()
|
||||
EgtEnableDebug( false)
|
||||
|
||||
-- mi preparo a ricevere argomenti
|
||||
local arg =...
|
||||
|
||||
-- variabile globale
|
||||
-- setto i valori standard nella tabella di comunicazione col programma
|
||||
local ASS = {}
|
||||
@@ -57,7 +60,12 @@ local tbStory = {}
|
||||
local TempTime = 0
|
||||
local tbTempStory = {}
|
||||
|
||||
|
||||
-- leggo gli argomenti passati dalla chiamata del file
|
||||
local bAutoRun = false
|
||||
if arg then
|
||||
ASS.nVeinCtx = arg.nVeinCtx
|
||||
bAutoRun = arg.AutoRun
|
||||
end
|
||||
|
||||
-- rendo la variabile globale
|
||||
_G.ASS = ASS
|
||||
@@ -633,7 +641,7 @@ function ASS.EdgePair()
|
||||
if not ASS.Move() then return false end
|
||||
local dTol = 0.001
|
||||
if dAng < dTol or abs(dAng - 180) < dTol or abs(dAng - 360) < dTol then
|
||||
EgtDraw()
|
||||
--EgtDraw()
|
||||
return true
|
||||
end
|
||||
ASS.nTransf = 2
|
||||
@@ -643,7 +651,7 @@ function ASS.EdgePair()
|
||||
ASS.ptAx = ptFin
|
||||
ASS.vtAx = vtAx
|
||||
if not ASS.Rotate() then return false end
|
||||
EgtDraw()
|
||||
--EgtDraw()
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -776,11 +784,8 @@ function ASS.UpdatePairInfo()
|
||||
return true
|
||||
end
|
||||
|
||||
--dofile("D:\\Temp\\marmo\\repeat2.lua")
|
||||
|
||||
function ASS.PairAll()
|
||||
ASS.sFunc = "ASS.PairAll"
|
||||
--local sTime = os.date( '%y%m%d%H%M%S', os.time())
|
||||
local nTrasfTot = 0
|
||||
EgtSetContext(ASS.nVeinCtx)
|
||||
local nPart = EgtGetFirstPart()
|
||||
@@ -814,35 +819,6 @@ function ASS.PairAll()
|
||||
if not ASS.EdgePair() then return false end
|
||||
nTrasfTot = ASS.nTransf
|
||||
|
||||
-- local ptFirst
|
||||
-- local ptSecond
|
||||
-- if ASS.nOption == 0 then
|
||||
-- --Start-Start
|
||||
-- ptFirst = EgtEP( ASS.nIdFirstLine, GDB_RT.GLOB)
|
||||
-- ptSecond = EgtEP( ASS.nIdSecondLine, GDB_RT.GLOB)
|
||||
-- elseif ASS.nOption == 1 then
|
||||
-- --Start-End
|
||||
-- ptFirst = EgtEP( ASS.nIdFirstLine, GDB_RT.GLOB)
|
||||
-- ptSecond = EgtSP( ASS.nIdSecondLine, GDB_RT.GLOB)
|
||||
-- elseif ASS.nOption == 2 then
|
||||
-- --End-Start
|
||||
-- ptFirst = EgtSP( ASS.nIdFirstLine, GDB_RT.GLOB)
|
||||
-- ptSecond = EgtEP( ASS.nIdSecondLine, GDB_RT.GLOB)
|
||||
-- elseif ASS.nOption == 3 then
|
||||
-- --End-End
|
||||
-- ptFirst = EgtSP( ASS.nIdFirstLine, GDB_RT.GLOB)
|
||||
-- ptSecond = EgtSP( ASS.nIdSecondLine, GDB_RT.GLOB)
|
||||
-- elseif ASS.nOption == 4 then
|
||||
-- --Mid-Mid
|
||||
-- if nSpin == 1 then
|
||||
-- ptFirst = EgtSP( ASS.nIdFirstLine, GDB_RT.GLOB)
|
||||
-- ptSecond = EgtSP( ASS.nIdSecondLine, GDB_RT.GLOB)
|
||||
-- elseif nSpin == -1 then
|
||||
-- ptFirst = EgtSP( ASS.nIdFirstLine, GDB_RT.GLOB)
|
||||
-- ptSecond = EgtEP( ASS.nIdSecondLine, GDB_RT.GLOB)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- verifico che lo spin sia rispettato
|
||||
local vtEdge1 = EgtSV( ASS.nIdFirstLine, GDB_RT.GLOB)
|
||||
local vtEdge2 = EgtSV( ASS.nIdSecondLine, GDB_RT.GLOB)
|
||||
@@ -873,4 +849,17 @@ function ASS.PairAll()
|
||||
return true
|
||||
end
|
||||
|
||||
return ASS
|
||||
------ per funzionare con il require
|
||||
--return ASS
|
||||
------ per funzionare con il require
|
||||
|
||||
------ per funzionare nel CAM5
|
||||
-- ASS.nVeinCtx = 1
|
||||
-- ASS.PairAll()
|
||||
-- EgtDraw()
|
||||
------ per funzionare nel CAM5
|
||||
---
|
||||
|
||||
if bAutoRun then
|
||||
ASS.PairAll()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user