3dPrinting :

- correzione calcolo toolpath in spiral vase quando sezione varia tra layer.
This commit is contained in:
SaraP
2022-12-01 11:31:18 +01:00
parent 693746d6e3
commit 298b0a4506
3 changed files with 36 additions and 19 deletions
+23 -11
View File
@@ -944,7 +944,7 @@ local function AddSpiralVaseLeadOut( nOldId, LayerParams)
local nLeadOut = AddLeadOut( nOldId, LayerParams, EgtGetParent( nOldId))
if nLeadOut then
local dDelta = LayerParams.dLayHeight / EgtCurveLength( nOldId) * EgtCurveLength( nLeadOut)
EgtSpiralizeCurve( nLeadOut, dDelta)
EgtSpiralizeCurveAlongExtrusion( nLeadOut, dDelta)
end
AddRetractionOnLastCrv( nOldId, EgtGetParent( nOldId), LayerParams, LayerParams.dCoastingLen, LayerParams.dWipeLen, LayerParams.dWipeDir)
else
@@ -956,7 +956,7 @@ end
---------------------------------------------------------------------
local function SpiralVase( vLayIds, dCorrZ, LayerParams)
local nOldId
local nOldId, nOldPathId
local bFirst = true
local nSlicingType = EgtGetInfo( s_nPartId, KEY_SLICING_TYPE, 'i')
@@ -1007,13 +1007,15 @@ local function SpiralVase( vLayIds, dCorrZ, LayerParams)
local nEntId = EgtGetFirstInGroup( nPathGrpId)
while nEntId do
local nNewEntId = EgtCopyGlob( nEntId, nTpathGrpId, GDB_IN.LAST_SON)
-- correggo posizione in Z ( per essere sicuri di appoggiare sul piano)
EgtMove( nNewEntId, dCorrZ * Z_AX(), GDB_RT.GLOB)
-- correggo la posizione del toolpath
local vtMove = dCorrZ * Z_AX()
if nSlicingType == SLICING_TYPE.DEG45_X or nSlicingType == SLICING_TYPE.DEG45_Y then
-- eventuale spostamento dell'altezza layer
EgtMove( nNewEntId, LayerParams.dLayHeight * LayerParams.vtSlicing, GDB_RT.GLOB)
vtMove = vtMove + LayerParams.dLayHeight * LayerParams.vtSlicing
end
EgtMove( nNewEntId, vtMove, GDB_RT.GLOB)
EgtModifyCurveExtrusion( nNewEntId, LayerParams.vtSlicing, GDB_RT.GLOB)
-- eventuale inversione
if LayerParams.bInvert then
@@ -1033,19 +1035,29 @@ local function SpiralVase( vLayIds, dCorrZ, LayerParams)
end
bFirst = false
else
-- modifico lo start point per collegarlo alla curva precedente
local ptOld = EgtEP( nOldId, GDB_ID.ROOT)
if dist( EgtSP( nNewEntId, GDB_ID.ROOT), ptOld) < LayerParams.dStrand + 10 then
EgtChangeClosedCurveStartPoint( nNewEntId, ptOld, GDB_RT.GLOB)
EgtModifyCurveStartPoint( nNewEntId, ptOld, GDB_RT.GLOB)
local ptNew = EgtSP( nNewEntId, GDB_ID.ROOT)
if dist( ptNew, ptOld) < LayerParams.dStrand then
-- se i punti sono vicini ma non coincidenti modifico la curva per avere transizione più uniforme
if not AreSamePointApprox( ptOld, ptNew) then
-- recupero la curva da usare come guida
local nGuideId = EgtCopyGlob( nOldPathId, nTpathGrpId)
-- la porto alla stessa quota del toolpath
EgtMove( nGuideId, vtMove + LayerParams.dLayHeight * LayerParams.vtSlicing, GDB_RT.GLOB)
EgtChangeClosedCurveStartPoint( nGuideId, ptOld, GDB_RT.GLOB)
EgtSpiralizeCurveAlongGuide( nNewEntId, nGuideId)
EgtErase( nGuideId)
end
else
EgtOutLog( 'Warning : in spiral vase mode no link betweeen toolpaths (layer '..tostring( nIdx)..') - CalcToolPath')
-- aggiungo uscita, coasting e wipe sulla curva precedente
AddSpiralVaseLeadOut( nOldId, LayerParams)
end
EgtSpiralizeCurve( nNewEntId, LayerParams.dLayHeight)
EgtSpiralizeCurveAlongExtrusion( nNewEntId, LayerParams.dLayHeight)
end
nOldPathId = nEntId
nOldId = nNewEntId
nEntId = EgtGetNext( nEntId)
end