3dPrinting 2.7f1 :
- aggiunta possibilità da file ini della macchina di forzare approssimazione lineare dei percorsi con tolleranza a scelta.
This commit is contained in:
@@ -55,6 +55,11 @@ local function GetLayerParamsForToolPathCalc()
|
||||
LayerParams.dInfillCoasting = EgtGetInfo( s_nPartId, KEY_INFILL_COASTING, 'd') or 0
|
||||
LayerParams.dInfillWipe = EgtGetInfo( s_nPartId, KEY_INFILL_WIPE, 'd') or 0
|
||||
LayerParams.dInfillWipeDir = EgtGetInfo( s_nPartId, KEY_INFILL_WIPE_DIR, 'd') or 0
|
||||
|
||||
-- parametri dal file macchina per eventuale approssimazione lineare dei percorsi
|
||||
local sMachIni = EgtGetCurrMachineDir() .. '\\' .. EgtGetCurrMachineName() .. '.ini'
|
||||
LayerParams.bLinearApprox = ( EgtGetNumberFromIni( SEC_3DPRINTING, KEY_LINEAR_APPROX, 0, sMachIni) == 1)
|
||||
LayerParams.dLinearApproxTol = EgtGetNumberFromIni( SEC_3DPRINTING, KEY_LINEAR_TOL, 0.1, sMachIni)
|
||||
|
||||
return LayerParams
|
||||
end
|
||||
@@ -346,6 +351,8 @@ local function AddLeadIn( nCrvId, LayerParams, nGrpId)
|
||||
local dStrand = EgtGetInfo( nCrvId, KEY_CRV_STRAND, 'd')
|
||||
EgtSetInfo( nLeadInCrv, KEY_CRV_STRAND, dStrand)
|
||||
end
|
||||
|
||||
return nLeadInCrv
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
@@ -1990,6 +1997,9 @@ local function AddSpiralVaseLeadOut( nOldId, LayerParams)
|
||||
EgtTrimCurveEndAtLen( nOldId, EgtCurveLength( nOldId) - LayerParams.dOffsetLP)
|
||||
local nLeadOut = AddLeadOut( nOldId, LayerParams, EgtGetParent( nOldId))
|
||||
if nLeadOut then
|
||||
if LayerParams.bLinearApprox then
|
||||
EgtApproxCurve( nLeadOut, GDB_CA.LINES, LayerParams.dLinearApproxTol)
|
||||
end
|
||||
local dDelta = LayerParams.dLayHeight / EgtCurveLength( nOldId) * EgtCurveLength( nLeadOut)
|
||||
EgtSpiralizeCurveAlongExtrusion( nLeadOut, dDelta)
|
||||
end
|
||||
@@ -2090,10 +2100,18 @@ local function SpiralVase( vLayIds, LayerParams)
|
||||
local nNewPart = EgtSplitCurveAtParam( nNewEntId, dTrimPar)
|
||||
EgtSpiralizeCurveAlongExtrusion( nNewPart, 0.5 * LayerParams.dLayHeight)
|
||||
|
||||
if LayerParams.bLinearApprox then
|
||||
EgtApproxCurve( nNewEntId, GDB_CA.LINES, LayerParams.dLinearApproxTol)
|
||||
EgtApproxCurve( nNewPart, GDB_CA.LINES, LayerParams.dLinearApproxTol)
|
||||
end
|
||||
|
||||
-- eventuale lead in
|
||||
if LayerParams.nLeadInType ~= LEAD_TYPE.NONE then
|
||||
EgtTrimCurveStartAtLen( nNewEntId, LayerParams.dOffsetLP)
|
||||
AddLeadIn( nNewEntId, LayerParams, nTpathGrpId)
|
||||
local nLeadInCrv = AddLeadIn( nNewEntId, LayerParams, nTpathGrpId)
|
||||
if nLeadInCrv and LayerParams.bLinearApprox then
|
||||
EgtApproxCurve( nLeadInCrv, GDB_CA.LINES, LayerParams.dLinearApproxTol)
|
||||
end
|
||||
end
|
||||
else
|
||||
local ptOld = EgtEP( nOldId, GDB_ID.ROOT)
|
||||
@@ -2103,7 +2121,7 @@ local function SpiralVase( vLayIds, LayerParams)
|
||||
end
|
||||
local ptNew = EgtSP( nNewEntId, GDB_ID.ROOT)
|
||||
-- modifico la curva per avere una transizione più uniforme tra i due layers
|
||||
if EgtCurveCompoRadius( nNewEntId, 0) == -1 and dist( ptOld, ptNew) / EgtCurveCompoLength( nNewEntId, 0) < s_dSpiralVaseTanTol then
|
||||
if EgtCurveCompoRadius( nNewEntId, 0) == -1 and dist( ptOld, ptNew) / EgtCurveCompoLength( nNewEntId, 0) < s_dSpiralVaseTanTol then
|
||||
-- se i punti sono abbastanza vicini e la curva inizia con un tratto lineare sufficientemente lungo allora distribuisco la differenza tra i
|
||||
-- due layer solo sul primo tratto
|
||||
EgtModifyCurveStartPoint( nNewEntId, ptOld, GDB_RT.GLOB)
|
||||
@@ -2132,11 +2150,15 @@ local function SpiralVase( vLayIds, LayerParams)
|
||||
-- approssimo
|
||||
local ptS = EgtSP( nNewEntId, GDB_ID.ROOT)
|
||||
EgtApproxCurve( nNewEntId, GDB_CA.ARCS, s_dApproxTol)
|
||||
if LayerParams.bLinearApprox then
|
||||
EgtApproxCurve( nNewEntId, GDB_CA.LINES, LayerParams.dLinearApproxTol)
|
||||
end
|
||||
if EgtCurveIsClosed( nNewEntId) then
|
||||
EgtChangeClosedCurveStartPoint( nNewEntId, ptS, GDB_RT.GLOB)
|
||||
end
|
||||
|
||||
-- modifica graduale del'altezza
|
||||
|
||||
-- modifica graduale dell'altezza
|
||||
if nRealLayer == 2 then
|
||||
-- se seconda passata la prima metà deve essere a quota costante 0.5 * dLayHeight, la seconda metà deve salire gradualmente di 0.5 * dLayHeight
|
||||
EgtMove( nNewEntId, 0.5 * LayerParams.dLayHeight * LayerParams.vtSlicing, GDB_RT.GLOB)
|
||||
@@ -2321,6 +2343,15 @@ function CalcToolPath.Exec( nPartId)
|
||||
nLayCnt = nIdx
|
||||
end
|
||||
|
||||
-- eventuale approssimazione delle curve
|
||||
if LayerParams.bLinearApprox then
|
||||
local nCrvId = EgtGetFirstInGroup( nTpathGrpId)
|
||||
while nCrvId do
|
||||
EgtApproxCurve( nCrvId, GDB_CA.LINES, LayerParams.dLinearApproxTol)
|
||||
nCrvId = EgtGetNext( nCrvId)
|
||||
end
|
||||
end
|
||||
|
||||
-- passo al gruppo di contorni successivo
|
||||
nCrvGrpId = EgtGetNextName( nCrvGrpId, CONTOUR_GRP.."*")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user