3dPrinting :

- gestita interruzione degli script.
This commit is contained in:
SaraP
2023-02-16 10:27:46 +01:00
parent 31f27d66c1
commit 3a1dcbb822
6 changed files with 76 additions and 252 deletions
+29 -21
View File
@@ -286,13 +286,12 @@ local function ValueInArray( vArr, nValue)
end
---------------------------------------------------------------------
local function SlicingNoSolid( nRibsLay, vZSlices, dDeltaZStart, dZmin, frSlicing)
local function SlicingNoSolid( nRibsLay, vZSlices, dDeltaZStart, dZmin, frSlicing, vErr)
local vErr = {}
local vtSlicing = frSlicing:getVersZ()
-- contatore per il calcolo delle intersezioni
if EgtProcessEvents( 100, 0) == 1 then return end
if EgtProcessEvents( 100, 0) == 1 then return false end
-- creo i layer dello slicing
for i = 1, #vZSlices do
@@ -309,17 +308,17 @@ local function SlicingNoSolid( nRibsLay, vZSlices, dDeltaZStart, dZmin, frSlicin
local nGrpCrv = EgtGroup( nLayGrp)
EgtSetName( nGrpCrv, CONTOUR_GRP .. EgtNumToString( 0))
end
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + 20, 0) == 1 then return end
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + 20, 0) == 1 then return false end
-- slicing dei setti
SlicingExtraObjects( vtSlicing, nRibsLay, TYPE.RIB, RIBS_GRP, RIBS_CRV)
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + 100, 0) == 1 then return end
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + 100, 0) == 1 then return false end
return vErr
return true
end
---------------------------------------------------------------------
local function SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicing)
local function SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicing, vErr)
-- costanti
local TOLER = 0.05
@@ -327,14 +326,13 @@ local function SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicin
local BIG_TOLER = 2.0
local MIN_LEN = 20.0
local MIN_AREA = 25.0
local vErr = {}
local vtSlicing = frSlicing:getVersZ()
-- calcolo delle intersezioni
if EgtProcessEvents( 1, 0) == 1 then return end
if EgtProcessEvents( 1, 0) == 1 then return false end
local nLayId = EgtParPlanesSurfTmInters( ORIG(), vtSlicing, vZSlices, nStmId, s_nPartId, GDB_RT.GLOB, TOLER)
if EgtProcessEvents( 100, 0) == 1 then return end
if EgtProcessEvents( 100, 0) == 1 then return false end
local vPrevCen = {}
local nLayCnt = 1
@@ -574,9 +572,16 @@ local function SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicin
-- passo al layer successivo
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + nLayCnt / ( #vZSlices + 3) * 100, 0) == 1 then
EgtDraw()
return
-- elimino i layer non ancora analizzati
local nNext = EgtGetNext( nLayId)
while nNext do
local nCurr = nNext
nNext = EgtGetNext( nCurr)
EgtErase( nCurr)
end
return false
end
nLayCnt = nLayCnt + 1
nLayId = EgtGetNext( nLayId)
end
@@ -588,14 +593,14 @@ local function SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicin
if nRibsLay then
SlicingExtraObjects( vtSlicing, nRibsLay, TYPE.RIB, RIBS_GRP, RIBS_CRV)
end
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + ( #vZSlices + 1) / ( #vZSlices + 3) * 100, 0) == 1 then return end
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + ( #vZSlices + 1) / ( #vZSlices + 3) * 100, 0) == 1 then return false end
-- solidi per regioni con diverso numero di passate
local nShellNbrLay = EgtGetFirstNameInGroup( s_nPartId, LAY_SHELL_NBR)
if nShellNbrLay then
SlicingExtraObjects( vtSlicing, nShellNbrLay, TYPE.EXTRA_SHELL, SHELL_NBR_GRP, SHELL_NBR_CRV)
end
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + ( #vZSlices + 2) / ( #vZSlices + 3) * 100, 0) == 1 then return end
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + ( #vZSlices + 2) / ( #vZSlices + 3) * 100, 0) == 1 then return false end
-- solidi ausiliari
local nAuxSolidsLay = EgtGetFirstNameInGroup( s_nPartId, LAY_AUX_SOLIDS)
@@ -603,10 +608,10 @@ local function SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicin
AdjustAuxSolids( nAuxSolidsLay)
SlicingExtraObjects( vtSlicing, nAuxSolidsLay, TYPE.AUX_SOLID, AUX_SOLIDS_GRP, AUX_SOLIDS_CRV)
end
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + ( #vZSlices + 3) / ( #vZSlices + 3) * 100, 0) == 1 then return end
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + ( #vZSlices + 3) / ( #vZSlices + 3) * 100, 0) == 1 then return false end
end
return vErr
return true
end
---------------------------------------------------------------------
@@ -674,19 +679,22 @@ function CalcSlices.Exec( nPartId, nStmId, HMax)
local vZSlices = ComputeZSlices( dSliceStep, dZmin, dDeltaZStart, dZmax)
local vErr
local vErr = {}
local bOk = true
if not nStmId then
-- caso senza solido e solo setti
vErr = SlicingNoSolid( nRibsLay, vZSlices, dDeltaZStart, dZmin, frSlicing)
bOk = SlicingNoSolid( nRibsLay, vZSlices, dDeltaZStart, dZmin, frSlicing, vErr)
else
-- caso con solido
vErr = SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicing)
bOk = SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicing, vErr)
end
-- eventuale segnalazione errori
if vErr and #vErr > 0 then
if bOk and #vErr > 0 then
EgtOutBox( 'Slicing Error on layers :\n' .. table.concat( vErr, ','), 'SlicingCalc')
end
return bOk
end
---------------------------------------------------------------------