From ad44ff7c5a4d07a1b9772b3335623ba095f6e456 Mon Sep 17 00:00:00 2001 From: SaraP Date: Mon, 28 Apr 2025 15:07:36 +0200 Subject: [PATCH] 3dPrinting : - in spiral vase spostata approssimazione delle curve per farla sempre su curva piana. --- LuaLibs/CalcToolPath.lua | 43 ++++++++++++++++++++------------------- LuaLibs/RunCalcSolids.lua | 2 +- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/LuaLibs/CalcToolPath.lua b/LuaLibs/CalcToolPath.lua index ef64821..5cd1322 100644 --- a/LuaLibs/CalcToolPath.lua +++ b/LuaLibs/CalcToolPath.lua @@ -2105,18 +2105,28 @@ local function SpiralVase( vLayIds, LayerParams) EgtModifyCurveStartPoint( nNewEntId, ptOld, GDB_RT.GLOB) else -- distribuisco la differenza su tutta la curva - -- recupero la curva da usare come guida - local nGuideId = EgtCopyGlob( nOldPathId, nPathGrpId) - -- la rendo coerente con il toolpath - EgtMove( nGuideId, vtMove + LayerParams.dLayHeight * LayerParams.vtSlicing, GDB_RT.GLOB) - if LayerParams.bInvert then - EgtInvertCurve( nGuideId) + if not AreSamePointApprox( ptOld, ptNew) then + -- recupero la curva da usare come guida + local nGuideId = EgtCopyGlob( nOldPathId, nPathGrpId) + -- la rendo coerente con il toolpath + EgtMove( nGuideId, vtMove + LayerParams.dLayHeight * LayerParams.vtSlicing, GDB_RT.GLOB) + if LayerParams.bInvert then + EgtInvertCurve( nGuideId) + end + -- modifico i punti iniziali affinchè coincidano con il punto finale del percorso precedente + EgtChangeClosedCurveStartPoint( nGuideId, ptOld, GDB_RT.GLOB) + EgtChangeClosedCurveStartPoint( nNewEntId, ptOld, GDB_RT.GLOB) + EgtSpiralizeCurveAlongGuide( nNewEntId, nGuideId) + EgtErase( nGuideId) end - -- modifico i punti iniziali affinchè coincidano con il punto finale del percorso precedente - EgtChangeClosedCurveStartPoint( nGuideId, ptOld, GDB_RT.GLOB) - EgtChangeClosedCurveStartPoint( nNewEntId, ptOld, GDB_RT.GLOB) - EgtSpiralizeCurveAlongGuide( nNewEntId, nGuideId) - EgtErase( nGuideId) + end + + -- approssimo + local ptS = EgtSP( nNewEntId, GDB_ID.ROOT) + EgtCopyGlob( nNewEntId, nPathGrpId) + EgtApproxCurve( nNewEntId, GDB_CA.ARCS, s_dApproxTol) + if EgtCurveIsClosed( nNewEntId) then + EgtChangeClosedCurveStartPoint( nNewEntId, ptS, GDB_RT.GLOB) end -- modifica graduale del'altezza @@ -2129,17 +2139,8 @@ local function SpiralVase( vLayIds, LayerParams) EgtSpiralizeCurveAlongExtrusion( nNewEntId, LayerParams.dLayHeight) end end - - -- approssimo + local vTPathsCrvs = EgtGetAllInGroup( nTpathGrpId) - for i = 1, #vTPathsCrvs do - local ptS = EgtSP( vTPathsCrvs[i], GDB_ID.ROOT) - EgtApproxCurve( vTPathsCrvs[i], GDB_CA.ARCS, s_dApproxTol) - if EgtCurveIsClosed( vTPathsCrvs[i]) then - EgtChangeClosedCurveStartPoint( vTPathsCrvs[i], ptS, GDB_RT.GLOB) - end - end - nOldPathId = vEntIds[1] nOldId = vTPathsCrvs[#vTPathsCrvs] diff --git a/LuaLibs/RunCalcSolids.lua b/LuaLibs/RunCalcSolids.lua index d946977..e788314 100644 --- a/LuaLibs/RunCalcSolids.lua +++ b/LuaLibs/RunCalcSolids.lua @@ -438,7 +438,7 @@ function RunCalcSolids.Exec() -- scorro le curve del percorso utensile per creare i solidi local vIds = EgtGetAllInGroup( nTPathGrpId) - if LayerParams.bSpiralVase and #vIds > 2 then + if LayerParams.bSpiralVase and #vIds > 2 and EgtGetName( vIds[#vIds]) ~= WIPE_CRV then -- nel caso a spirale gestione speciale per unire i tratti dei primi layers che sono stati spezzati per feed variabile local bHasDelta = EgtExistsInfo( vIds[#vIds], KEY_FEED_COEFF) if bHasDelta then