3dPrinting :
- gestione di offset lead point con valori negativi.
This commit is contained in:
@@ -242,10 +242,19 @@ local function AddRetraction( nCrvId, vtSlicing, dCoastingLen, dWipeLen, dWipeDi
|
||||
|
||||
-- curva ausiliaria per generare correttamente wipe
|
||||
local nCopyId = EgtCopyGlob( nCrvId, nCrvId, GDB_IN.AFTER)
|
||||
EgtCloseCurveCompo( nCopyId)
|
||||
local ptNewStart = EgtEP( nCrvId)
|
||||
EgtChangeClosedCurveStartPoint( nCopyId, ptNewStart)
|
||||
|
||||
if not EgtCurveIsClosed( nCopyId) then
|
||||
local ptNewStart = EgtEP( nCrvId)
|
||||
local dPar = EgtCurveParamAtPoint( nCopyId, ptNewStart)
|
||||
local _, dParE = EgtCurveDomain( nCopyId)
|
||||
if abs( dPar - dParE) < GEO.EPS_SMALL then
|
||||
EgtCloseCurveCompo( nCopyId)
|
||||
EgtChangeClosedCurveStartPoint( nCopyId, ptNewStart)
|
||||
else
|
||||
-- caso con sovrapposizione
|
||||
EgtTrimCurveStartAtParam( nCopyId, dPar)
|
||||
end
|
||||
end
|
||||
|
||||
local nCoastingId
|
||||
if dCoastingLen > GEO.EPS_SMALL then
|
||||
nCoastingId = EgtCopyGlob( nCrvId, nCrvId, GDB_IN.AFTER)
|
||||
@@ -284,7 +293,7 @@ local function AddRetraction( nCrvId, vtSlicing, dCoastingLen, dWipeLen, dWipeDi
|
||||
if nType == TYPE.INFILL or nType == TYPE.AUX_SOLID then
|
||||
local vtS = EgtGetInfo( nCrvId, KEY_ZIG_ZAG_DIR, 'v')
|
||||
local bSameDir = AreSameVectorApprox( vtS, vtDir)
|
||||
bChangeSign = ( bInverted == bSameDir)
|
||||
bChangeSign = ( bInverted == bSameDir)
|
||||
else
|
||||
bChangeSign = bInverted
|
||||
end
|
||||
@@ -292,7 +301,7 @@ local function AddRetraction( nCrvId, vtSlicing, dCoastingLen, dWipeLen, dWipeDi
|
||||
local ptS = EgtEP( nCoastingId or nCrvId, GDB_ID.ROOT)
|
||||
local ptE = ptS + vtDir * dWipeLen
|
||||
-- verifico soddisfi altezza minima per dimensioni utensile
|
||||
local k = 1
|
||||
local k = 1
|
||||
while ptE:getZ() < s_dHMin + GEO.EPS_SMALL and k < 36 do
|
||||
vtDir:rotate( vtSlicing, EgtIf( bChangeSign, 10, -10))
|
||||
ptE = ptS + vtDir * dWipeLen
|
||||
@@ -340,15 +349,26 @@ end
|
||||
local function CalcShellsToolPath( vEntIds, nTpathGrpId, LayerParams, dCorrZ)
|
||||
|
||||
if not vEntIds then return end
|
||||
|
||||
-- aggiungo le curve nel toolpath
|
||||
local vIds = AddCurvesToToolPath( vEntIds, nTpathGrpId, LayerParams.nOrder, LayerParams.bInvert, LayerParams.vtSlicing, LayerParams.dLayHeight, dCorrZ)
|
||||
local nFirstCopy = EgtCopyGlob( vIds[1], nTpathGrpId)
|
||||
|
||||
-- aggiungo gli opportuni raccordi
|
||||
AddLink( vIds, nTpathGrpId, LayerParams.nLinkType, LayerParams.dLinkParam, LayerParams.dSPOffs, LayerParams.dStrand, LayerParams.vtSlicing)
|
||||
|
||||
-- offset lead point curva iniziale
|
||||
if LayerParams.dOffsetLP > - GEO.EPS_SMALL then
|
||||
EgtTrimCurveStartAtLen( vIds[1], LayerParams.dOffsetLP)
|
||||
EgtErase( nFirstCopy)
|
||||
else
|
||||
-- devi aggiungere un tratto di curva
|
||||
EgtTrimCurveStartAtLen( nFirstCopy, EgtCurveLength( nFirstCopy) - abs( LayerParams.dOffsetLP))
|
||||
EgtAddCurveCompoCurve( vIds[1], nFirstCopy, true, false)
|
||||
end
|
||||
|
||||
-- aggiungo leadin/leadout
|
||||
if LayerParams.nLeadInType ~= LEAD_TYPE.NONE then
|
||||
EgtTrimCurveStartAtLen( vIds[1], LayerParams.dOffsetLP)
|
||||
AddLeadIn( vIds[1], LayerParams, nTpathGrpId)
|
||||
end
|
||||
if LayerParams.nLeadOutType ~= LEAD_TYPE.NONE then
|
||||
@@ -360,7 +380,6 @@ local function CalcShellsToolPath( vEntIds, nTpathGrpId, LayerParams, dCorrZ)
|
||||
for i = 1, #vIds - 1 do
|
||||
local nNextId = EgtGetNext( vIds[i])
|
||||
if EgtGetInfo( nNextId, KEY_TYPE, 'i') ~= TYPE.LINK then
|
||||
-- aggiungo retrazione
|
||||
AddRetraction( vIds[i], LayerParams.vtSlicing, LayerParams.dCoastingLen, LayerParams.dWipeLen, LayerParams.dWipeDir)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user