3dPrinting :
- gestione intersezione costolature - corretta gestione error/warning in CalcPath - correzione nel calcolo dei solidi.
This commit is contained in:
+51
-20
@@ -265,9 +265,19 @@ local function AddRibsLeadIn( nCrv, nLoopsGrp, LayerParams)
|
||||
if abs( dParS - dEndPar) < GEO.EPS_SMALL then
|
||||
EgtInvertCurve( nCrvId)
|
||||
elseif abs( dParS) > GEO.EPS_SMALL or bClosed then
|
||||
-- se ho più tratti possibili scelgo in base al parametro RibsLIInvert
|
||||
-- se ho più tratti possibili scelgo in base al parametro RibsLIInvert o alle dimensioni
|
||||
local nNewId = EgtSplitCurveAtParam( nCrvId, dParS) or EgtCopyGlob( nCrvId, nCrv, GDB_IN.BEFORE)
|
||||
if LayerParams.bRibsLIInvert then
|
||||
local dLen1 = EgtCurveLength( nCrvId)
|
||||
local dLen2 = EgtCurveLength( nNewId)
|
||||
|
||||
local bKeepFirst = LayerParams.bRibsLIInvert
|
||||
if dLen1 > LayerParams.dRibsLILen - GEO.EPS_SMALL and dLen2 < LayerParams.dRibsLILen - GEO.EPS_SMALL then
|
||||
bKeepFirst = true
|
||||
elseif dLen1 < LayerParams.dRibsLILen - GEO.EPS_SMALL and dLen2 > LayerParams.dRibsLILen - GEO.EPS_SMALL then
|
||||
bKeepFirst = false
|
||||
end
|
||||
|
||||
if bKeepFirst then
|
||||
EgtInvertCurve( nCrvId)
|
||||
EgtErase( nNewId)
|
||||
else
|
||||
@@ -320,9 +330,17 @@ local function AddRibsLeadOut( nCrv, nTPathGrp, nLoopsGrp, LayerParams)
|
||||
EgtInvertCurve( nCrvRef)
|
||||
bInvert = true
|
||||
elseif abs( dParE) > GEO.EPS_SMALL or bClosed then
|
||||
-- se ho più tratti possibili scelgo in base al parametro RibsLOInvert
|
||||
bInvert = LayerParams.bRibsLOInvert
|
||||
-- se ho più tratti possibili scelgo in base al parametro RibsLOInvert o alle dimensioni
|
||||
local nNewId = EgtSplitCurveAtParam( nCrvRef, dParE) or EgtCopyGlob( nCrvRef, nCrv, GDB_IN.AFTER)
|
||||
local dLen1 = EgtCurveLength( nCrvRef)
|
||||
local dLen2 = EgtCurveLength( nNewId)
|
||||
bInvert = LayerParams.bRibsLOInvert
|
||||
if dLen1 > LayerParams.dRibsLOLen + LayerParams.dRibsLOCoasting - GEO.EPS_SMALL and dLen2 < LayerParams.dRibsLOLen + LayerParams.dRibsLOCoasting - GEO.EPS_SMALL then
|
||||
bInvert = true
|
||||
elseif dLen1 < LayerParams.dRibsLOLen + LayerParams.dRibsLOCoasting - GEO.EPS_SMALL and dLen2 > LayerParams.dRibsLOLen + LayerParams.dRibsLOCoasting - GEO.EPS_SMALL then
|
||||
bInvert = false
|
||||
end
|
||||
|
||||
if bInvert then
|
||||
EgtInvertCurve( nCrvRef)
|
||||
EgtErase( nNewId)
|
||||
@@ -332,10 +350,13 @@ local function AddRibsLeadOut( nCrv, nTPathGrp, nLoopsGrp, LayerParams)
|
||||
end
|
||||
end
|
||||
|
||||
-- verifico se la curva ha lunghezza sufficiente
|
||||
local dLen = EgtCurveLength( nCrvRef)
|
||||
local bSkip = ( dLen - LayerParams.dRibsLOLen - LayerParams.dRibsLOCoasting < - GEO.EPS_SMALL)
|
||||
local vtE = EgtSV( nCrvRef)
|
||||
|
||||
-- primo tratto ( segue offset con flusso aperto)
|
||||
if LayerParams.dRibsLOLen > GEO.EPS_SMALL then
|
||||
if LayerParams.dRibsLOLen > GEO.EPS_SMALL and not bSkip then
|
||||
nCrvLO = EgtCopyGlob( nCrvRef, nCrv, GDB_IN.AFTER)
|
||||
EgtTrimCurveEndAtLen( nCrvLO, LayerParams.dRibsLOLen)
|
||||
EgtSetInfo( nCrvLO, KEY_TYPE, TYPE.RIB)
|
||||
@@ -346,9 +367,9 @@ local function AddRibsLeadOut( nCrv, nTPathGrp, nLoopsGrp, LayerParams)
|
||||
end
|
||||
|
||||
-- secondo tratto ( segue offset con flusso chiuso)
|
||||
if LayerParams.dRibsLOCoasting > GEO.EPS_SMALL then
|
||||
if LayerParams.dRibsLOCoasting > GEO.EPS_SMALL and not bSkip then
|
||||
nCoasting = EgtCopyGlob( nCrvRef, nCrvLO or nCrv, GDB_IN.AFTER)
|
||||
EgtTrimCurveStartAtLen( nCoasting, LayerParams.dRibsLOLen)
|
||||
EgtTrimCurveStartAtLen( nCoasting, LayerParams.dRibsLOLen)
|
||||
EgtTrimCurveEndAtLen( nCoasting, LayerParams.dRibsLOCoasting)
|
||||
|
||||
EgtSetName( nCoasting, COASTING_CRV)
|
||||
@@ -423,18 +444,22 @@ local function CalcRibsToolPath( nCrvGrp, nTpathGrpId, LayerParams, dCorrZ)
|
||||
nFirst = EgtGetNextName( vIds[#vIds], RIBS_CRV .. '*')
|
||||
end
|
||||
|
||||
local bInters = EgtGetInfo( nRibsGrp, KEY_RIBS_INTERS, 'b') or false
|
||||
local bSpecialCase = bInters and LayerParams.nRibsShellsNbr == 2
|
||||
-- orientamento delle curve
|
||||
local bInvert = LayerParams.bRibsInvert
|
||||
for i = 1, #tabRibs do
|
||||
-- oriento tutte le passate relative ad una stessa costolatura
|
||||
for j = 1, #tabRibs[i] do
|
||||
if ( bInvert and j % 2 == 1) or ( not bInvert and j % 2 == 0) then
|
||||
EgtInvertCurve( tabRibs[i][j])
|
||||
local bInvert = LayerParams.bRibsInvert
|
||||
if not bSpecialCase then
|
||||
for i = 1, #tabRibs do
|
||||
-- oriento tutte le passate relative ad una stessa costolatura
|
||||
for j = 1, #tabRibs[i] do
|
||||
if ( bInvert and j % 2 == 1) or ( not bInvert and j % 2 == 0) then
|
||||
EgtInvertCurve( tabRibs[i][j])
|
||||
end
|
||||
end
|
||||
-- aggiorno bInvert per il gruppo di costolature successivo
|
||||
if LayerParams.bRibsLink and LayerParams.nRibsShellsNbr % 2 == 1 then
|
||||
bInvert = not bInvert
|
||||
end
|
||||
end
|
||||
-- aggiorno bInvert per il gruppo di costolature successivo
|
||||
if LayerParams.bRibsLink and LayerParams.nRibsShellsNbr % 2 == 1 then
|
||||
bInvert = not bInvert
|
||||
end
|
||||
end
|
||||
|
||||
@@ -445,10 +470,16 @@ local function CalcRibsToolPath( nCrvGrp, nTpathGrpId, LayerParams, dCorrZ)
|
||||
local ptS = EgtEP( tabRibs[i][j])
|
||||
local ptE = EgtSP( tabRibs[i][j + 1])
|
||||
CalcRibsLink( ptS, ptE, tabRibs[i][j], nLoopGrp, true)
|
||||
-- creo link fittizio per eliminare tratto corrispondente sulla curva di offset
|
||||
local nFakeLink = CalcRibsLink( EgtSP( tabRibs[i][j]), EgtEP( tabRibs[i][j + 1]), tabRibs[i][j], nLoopGrp, false)
|
||||
EgtErase( nFakeLink)
|
||||
if not bSpecialCase then
|
||||
-- creo link fittizio per eliminare tratto corrispondente sulla curva di offset
|
||||
local nFakeLink = CalcRibsLink( EgtSP( tabRibs[i][j]), EgtEP( tabRibs[i][j + 1]), tabRibs[i][j], nLoopGrp, false)
|
||||
EgtErase( nFakeLink)
|
||||
end
|
||||
end
|
||||
if bSpecialCase then
|
||||
local nFakeLink = CalcRibsLink( EgtSP( tabRibs[i][1]), EgtEP( tabRibs[i][#tabRibs[i]]), tabRibs[i][1], nLoopGrp, false)
|
||||
EgtErase( nFakeLink)
|
||||
end
|
||||
end
|
||||
-- se necessario collego le diverse costolature
|
||||
if LayerParams.bRibsLink then
|
||||
|
||||
Reference in New Issue
Block a user