3dPrinting :
- corretto errore reduced shell number di area nulla.
This commit is contained in:
+32
-14
@@ -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)
|
||||
|
||||
+15
-3
@@ -170,6 +170,10 @@ local function SliceStm( vIds, nLayId, vtSlicing, nType, sName, sNameGrp, tabPar
|
||||
local dDeltaZ = EgtGetInfo( nLayId, KEY_SLICE_DELTAZ, 'd')
|
||||
local nLayCnt = EgtGetInfo( nLayId, KEY_SLICE_NBR, 'i')
|
||||
|
||||
-- gruppo temporaneo per approx curve
|
||||
local frloc = Frame3d( ORIG(), vtSlicing)
|
||||
local nGrpTmp = EgtGroup( nLayId, frloc, GDB_RT.GLOB)
|
||||
|
||||
for i = 1, #vIds do
|
||||
-- verifico che oggetto sia trimesh
|
||||
local nTypeObj = EgtGetType( vIds[i])
|
||||
@@ -211,7 +215,12 @@ local function SliceStm( vIds, nLayId, vtSlicing, nType, sName, sNameGrp, tabPar
|
||||
for nId = nNewId + nPntCnt, nNewId + nPntCnt + nCrvCnt - 1 do
|
||||
table.insert( vChain, nId)
|
||||
end
|
||||
local nChainId, nCnt = EgtCurveCompoByChain( nGrp, vChain, ORIG(), true, GDB_RT.LOC, BIG_TOLER)
|
||||
local nChainId, nCnt = EgtCurveCompoByChain( nGrp, vChain, ORIG(), true, GDB_RT.LOC, TOLER)
|
||||
if not nChainId then
|
||||
-- se fallisce riprendo le curve originali
|
||||
nChainId = nNewId + nPntCnt
|
||||
nCnt = nCrvCnt
|
||||
end
|
||||
-- rinomino le curve, correggo di DeltaZ e assegno parametri
|
||||
for nId = nChainId, nChainId + nCnt - 1 do
|
||||
EgtSetName( nId, sName .. tostring( i))
|
||||
@@ -222,8 +231,11 @@ local function SliceStm( vIds, nLayId, vtSlicing, nType, sName, sNameGrp, tabPar
|
||||
EgtSetInfo( nId, sKey, sVal)
|
||||
end
|
||||
end
|
||||
EgtModifyCurveExtrusion( nId, vtSlicing)
|
||||
EgtModifyCurveExtrusion( nId, vtSlicing, GDB_RT.GLOB)
|
||||
EgtRelocateGlob( nId, nGrpTmp)
|
||||
EgtApproxCurve( nId, GDB_CA.ARCS, MID_TOLER)
|
||||
EgtRelocateGlob( nId, nGrp)
|
||||
|
||||
-- se ho ancora curve aperte, segnalo errore
|
||||
if nType ~= TYPE.RIB and nType ~= TYPE.INFILL and not EgtCurveIsClosed( nId) then
|
||||
EgtOutLog( 'Error : hole in object (layer '.. EgtNumToString( nLayCnt) ..') - CalcSlices')
|
||||
@@ -243,7 +255,7 @@ local function SliceStm( vIds, nLayId, vtSlicing, nType, sName, sNameGrp, tabPar
|
||||
if not EgtGetFirstInGroup( nGrp) then
|
||||
EgtErase( nGrp)
|
||||
end
|
||||
|
||||
EgtErase( nGrpTmp)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user