3dPrinting :

- corretto errore reduced shell number di area nulla.
This commit is contained in:
SaraP
2023-06-08 10:34:42 +02:00
parent 4225985a61
commit bc3cf3b3a9
2 changed files with 47 additions and 17 deletions
+32 -14
View File
@@ -2245,15 +2245,21 @@ local function CreateShellNbrSurfaces( nGrp, nShellsNbr)
local nCrvId = EgtGetFirstNameInGroup( nGrp, SHELL_NBR_CRV .. '*')
while nCrvId do
if EgtCurveIsClosed( nCrvId) then
-- recupero info sul gap
local nShellNbrDiff = EgtGetInfo( nCrvId, KEY_SHELL_NBR_DIFF, 'i')
-- aggiorno eventuale massimo
if nMaxShellNbrDiff < nShellNbrDiff then nMaxShellNbrDiff = nShellNbrDiff end
-- salvo gli id delle curve
if not tDiffCrvs[nShellNbrDiff] then
tDiffCrvs[nShellNbrDiff] = { nCrvId}
-- verifico se area significativa
local _, _, dArea = EgtCurveArea( nCrvId)
if dArea and dArea > GEO.EPS_SMALL then
-- recupero info sul gap
local nShellNbrDiff = EgtGetInfo( nCrvId, KEY_SHELL_NBR_DIFF, 'i')
-- aggiorno eventuale massimo
if nMaxShellNbrDiff < nShellNbrDiff then nMaxShellNbrDiff = nShellNbrDiff end
-- salvo gli id delle curve
if not tDiffCrvs[nShellNbrDiff] then
tDiffCrvs[nShellNbrDiff] = { nCrvId}
else
table.insert( tDiffCrvs[nShellNbrDiff], nCrvId)
end
else
table.insert( tDiffCrvs[nShellNbrDiff], nCrvId)
EgtOutLog( 'Warning: ReducedShellNumber is too small (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
end
else
EgtOutLog( 'Error: ReducedShellNumber is not closed (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
@@ -2298,10 +2304,11 @@ local function CreateShellNbrSurfaces( nGrp, nShellsNbr)
table.insert( s_vErr, 'layer ' .. EgtNumToString( s_nCurrIdx) .. ' : ReducedShellNumber is not considered')
end
end
EgtSetName( nSrfId, SHELL_NBR_SURF .. EgtNumToString( nDiff))
-- salvo come info gli id delle curve che la definiscono
EgtSetInfo( nSrfId, KEY_ASSOCIATED_CRVS, vCrvIds)
if nSrfId then
EgtSetName( nSrfId, SHELL_NBR_SURF .. EgtNumToString( nDiff))
-- salvo come info gli id delle curve che la definiscono
EgtSetInfo( nSrfId, KEY_ASSOCIATED_CRVS, vCrvIds)
end
end
end
@@ -2409,7 +2416,8 @@ local function ReorderExtraShells( nPathGrp, dStrand, vPtStart, bPrintInvert)
local nFirst = EgtGetFirstNameInGroup( nPathGrp, EXTRA_SHELL_CRV .. '*')
while nFirst do
-- recupero tratti appartenenti alla stessa shell
local vShells = EgtGetNameInGroup( nPathGrp, EgtGetName( nFirst))
local sName = EgtGetName( nFirst)
local vShells = EgtGetNameInGroup( nPathGrp, sName)
local nCurr = vShells[1]
for i = 2, #vShells do
if dist( EgtEP( nCurr), EgtSP( vShells[i])) < dStrand + GEO.EPS_SMALL then
@@ -2427,6 +2435,16 @@ local function ReorderExtraShells( nPathGrp, dStrand, vPtStart, bPrintInvert)
EgtAddCurveCompoCurve( nCurr, nFirst)
end
-- verifico se le curve si possono chiudere
vShells = EgtGetNameInGroup( nPathGrp, sName)
for i = 1, #vShells do
if not EgtCurveIsClosed( vShells[i]) then
if dist( EgtSP( vShells[i]), EgtEP( vShells[i])) < dStrand + GEO.EPS_SMALL then
EgtCloseCurveCompo( vShells[i])
end
end
end
nFirst = EgtGetNextName( nCurr, EXTRA_SHELL_CRV .. '*')
end
@@ -2531,7 +2549,7 @@ local function CalcExtraShellsPath( nMaxShellNbrDiff, nShellNbrGrp, nCrvGrpId, d
-- calcolo offset della curva ( è il percorso della shell)
EgtModifyCurveExtrusion( nCrvT, LayerParams.vtSlicing, GDB_RT.GLOB)
local nOffs, nOffsCnt = EgtOffsetCurveAdv( nCrvT, - dOffs)
EgtErase( nCrvT)
EgtErase( nCrvT)
for nCrvOffs = nOffs, nOffs + nOffsCnt - 1 do
-- trim con la regione già occupata dal altre shell
local nCrv, nCnt = EgtTrimCurveWithRegion( nCrvOffs, nSrfTrim, true, true)