From 2a324175bddf84a25c8c8e90d7c7444fdd4910eb Mon Sep 17 00:00:00 2001 From: SaraP Date: Thu, 29 Sep 2022 09:56:23 +0200 Subject: [PATCH] 3dPrinting : - corretta gestione dell'orientamento dei setti. --- LuaLibs/CalcPaths.lua | 15 ++++++++++----- LuaLibs/CalcSlices.lua | 3 ++- LuaLibs/CalcToolPath.lua | 10 ++++------ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/LuaLibs/CalcPaths.lua b/LuaLibs/CalcPaths.lua index 6f0102c..b7e4e35 100644 --- a/LuaLibs/CalcPaths.lua +++ b/LuaLibs/CalcPaths.lua @@ -589,15 +589,17 @@ local function ReorderRibs( nGrp, bInvertOrder, dStrand, nMaxNbr) end -- aggiusto tutte le costolature divise + local tabSplitted = {} for i = 1, #vSplitRibs do local nPrevId = EgtGetInfo( vSplitRibs[i], KEY_SPLIT_RIB, 'i') local bInverted = EgtGetInfo( vSplitRibs[i], KEY_INVERTED_CRV, 'b') or false -- aggiungo come successiva alla costolatura da cui si è generata EgtRelocateGlob( vSplitRibs[i], nPrevId, EgtIf( bInverted, GDB_IN.BEFORE, GDB_IN.AFTER)) -- correggo le info per gestire correttamente nel calcolo toolpath - if bInverted then + if bInverted and not tabSplitted[nPrevId] then EgtRemoveInfo( vSplitRibs[i], KEY_SPLIT_RIB) EgtSetInfo( nPrevId, KEY_SPLIT_RIB, vSplitRibs[i]) + tabSplitted[nPrevId] = 1 end end @@ -820,14 +822,14 @@ local function CalcRibsPaths( nSliceGrp, nRibsGrp, LayerParams, nIdx, nMaxStrand local nSrfBase = EgtGetFirstNameInGroup( nCrvGrp, TOT_SHELL_TRIM_SURF) if not nSrfBase then EgtOutLog( 'Warning : Ribs not possible (layer '..tostring( nIdx)..') - CalcPaths') - else + else local vSurfOffs = ComputeTrimSurfWithOverlaps( vRibs, nSrfBase, KEY_RIBS_OVERLAP, LayerParams.dStrand, nRibsPathGrp) -- gestisco eventuali intersezioni fra costolature local bInters = HandleRibsIntersections( nRibsGrp, LayerParams, nOffsGrp, nRibsPathGrp, bAllTwoStrands) EgtSetInfo( nRibsPathGrp or GDB_ID.NULL, KEY_RIBS_INTERS, bInters) EgtSetInfo( nRibsPathGrp or GDB_ID.NULL, KEY_RIBS_TWO_STRANDS, bAllTwoStrands) - + -- eseguo il trim delle costole con la regione offsettata local tOldNewIds = {} local vOrderedRibs = EgtGetNameInGroup( nRibsPathGrp, RIBS_CRV ..'*') @@ -855,7 +857,10 @@ local function CalcRibsPaths( nSliceGrp, nRibsGrp, LayerParams, nIdx, nMaxStrand local dXl = sqrt( sqr( vtDir:getX()) + sqr( vtDir:getZ())) local dYl = abs( vtDir:getY()) local dVal = EgtIf( dXl > dYl - GEO.EPS_SMALL, vtDir:getX(), vtDir:getY()) - if dVal < - GEO.EPS_SMALL then + local bInvert = dVal < - GEO.EPS_SMALL + -- inversione della curva + local bInvertInfo = EgtGetInfo( nCrv + nInd, KEY_RIBS_INVERT_DIR, 'b') or false + if bInvert ~= bInvertInfo then EgtInvertCurve( nCrv + nInd) EgtSetInfo( nCrv + nInd, KEY_INVERTED_CRV, 1) end @@ -1420,7 +1425,7 @@ function CalcPaths.Exec( nPartId) -- parete esterna local dOffs = - LayerParams.dOffs - 0.5 * LayerParams.dStrand if nMaxShellNbrDiff < LayerParams.nShellsNbr then - dOffs = dOffs + LayerParams.dStrand * ( 1 - LayerParams.nStrandOverlap / 100) + dOffs = dOffs + LayerParams.dStrand local bOk, bExists, nSrfId = ComputeSurfOffset( nSrf, nCrvGrpId, - dOffs) if not bOk then EgtOutLog( 'Error on ExtOffset (layer '..tostring( nIdx)..') - CalcPaths') diff --git a/LuaLibs/CalcSlices.lua b/LuaLibs/CalcSlices.lua index 1a864c8..9126850 100644 --- a/LuaLibs/CalcSlices.lua +++ b/LuaLibs/CalcSlices.lua @@ -90,7 +90,8 @@ end -------------------------------------------------------------------- local function ReadParam( nId, sKey, sType, table) - local info = EgtGetInfo( nId, sKey, sType) or EgtGetInfo( s_nPartId, sKey, sType) + local info = EgtGetInfo( nId, sKey, sType) + if info == nil then info = EgtGetInfo( s_nPartId, sKey, sType) end table[sKey] = info end diff --git a/LuaLibs/CalcToolPath.lua b/LuaLibs/CalcToolPath.lua index c26e0f8..fb027a4 100644 --- a/LuaLibs/CalcToolPath.lua +++ b/LuaLibs/CalcToolPath.lua @@ -715,16 +715,14 @@ local function CalcRibsToolPath( nCrvGrp, nTpathGrpId, LayerParams, dCorrZ) local bAllTwoStrands = EgtGetInfo( nRibsGrp, KEY_RIBS_TWO_STRANDS, 'b') or false local bSpecialCase = bInters and bAllTwoStrands local bSwap = false - -- orientamento del primo gruppo di curve - local bInvert = EgtGetInfo( tabRibs[1][1], KEY_RIBS_INVERT_DIR, 'b') + + local bInvert = false -- curve già orientate in CalcPaths if not bSpecialCase then for i = 1, #tabRibs do local nInfo = EgtGetInfo( tabRibs[i][1], KEY_SPLIT_RIB, 'i') local nShellsNbr = EgtGetInfo( tabRibs[i][1], KEY_RIBS_SHELLS_NBR, 'i') - -- aggiorno bInvert per il gruppo di costolature analizzato - if not LayerParams.bRibsLink then - bInvert = EgtGetInfo( tabRibs[i][1], KEY_RIBS_INVERT_DIR, 'b') - else + -- se link aggiorno bInvert per il gruppo di costolature corrente in modo da essere coerente con il collegamento + if LayerParams.bRibsLink then if i > 1 and not nInfo then local nPrevShellsNbr = EgtGetInfo( tabRibs[i-1][1], KEY_RIBS_SHELLS_NBR, 'i') if nPrevShellsNbr % 2 == 1 then