Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| da1c2c6424 | |||
| 328ef638e8 |
+59
-42
@@ -18,7 +18,7 @@ local s_nDefaultWipeAng = -90 -- angolo = 0° per wipe significa che esce orto
|
||||
local s_dApproxTol = 0.1
|
||||
local s_dHSafeWipe = 2
|
||||
local s_nCurrIdx
|
||||
local s_dSpiralVaseTanTol = 0.001
|
||||
local s_dSpiralVaseMaxLen = 10
|
||||
local s_dSpralVaseFirstDelta = 30 -- lunghezza del tratto sul primo layer che va alzato
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -60,6 +60,10 @@ local function GetLayerParamsForToolPathCalc()
|
||||
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)
|
||||
|
||||
-- parametri da file ini del programma
|
||||
local sIniFile = EgtGetIniFile()
|
||||
LayerParams.dSpiralVaseInterpLen = EgtGetNumberFromIni( '3dPrinting', 'SpiralVaseInterpLen', 100.0, sIniFile)
|
||||
|
||||
return LayerParams
|
||||
end
|
||||
@@ -2112,40 +2116,59 @@ local function SpiralVase( vLayIds, LayerParams)
|
||||
end
|
||||
end
|
||||
else
|
||||
-- a) garantisco continuità con layer precedente
|
||||
local ptOld = EgtEP( nOldId, GDB_ID.ROOT)
|
||||
if nRealLayer == 2 then
|
||||
-- aggiusto la quota per confronto sensato
|
||||
ptOld = ptOld - 0.5 * LayerParams.dLayHeight * LayerParams.vtSlicing
|
||||
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
|
||||
-- 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)
|
||||
else
|
||||
-- distribuisco la differenza su tutta la curva
|
||||
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)
|
||||
|
||||
-- se il punto di inizio non coincide con quello finale del percorso calcolato fino ad ora, modifico la curva per avere una transizione più uniforme tra i due layers
|
||||
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
|
||||
-- approssimo con tratti lineari imponendo lunghezza massima per migliorare spiralize
|
||||
EgtApproxCurve( nGuideId, GDB_CA.SPECIAL_LINES, 0.01, s_dSpiralVaseMaxLen)
|
||||
EgtApproxCurve( nNewEntId, GDB_CA.SPECIAL_LINES, 0.01, s_dSpiralVaseMaxLen)
|
||||
-- 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)
|
||||
|
||||
-- distribuisco la differenza sulla curva
|
||||
local dLen = EgtCurveLength( nNewEntId)
|
||||
if LayerParams.dSpiralVaseInterpLen < GEO.EPS_SMALL or LayerParams.dSpiralVaseInterpLen > dLen - GEO.EPS_SMALL then
|
||||
-- la differenza deve essere distribuita su tutta la curva
|
||||
EgtSpiralizeCurveAlongGuide( nNewEntId, nGuideId)
|
||||
-- forzo il punto di inizio a coincidere con il layer precedente ( non è garantito dallo spiralize con il path a causa dell'approx
|
||||
-- con gli archi che potrebbe modificare il punto finale del tpath rispetto a quello del path associato)
|
||||
EgtModifyCurveStartPoint( nNewEntId, ptOld, GDB_RT.GLOB)
|
||||
|
||||
EgtErase( nGuideId)
|
||||
|
||||
else
|
||||
-- la differenza deve essere distribuita solo su un sottotratto di lunghezza LayerParams.dSpiralVaseAdjLen
|
||||
local dParSplit = EgtCurveParamAtLength( nNewEntId, LayerParams.dSpiralVaseInterpLen)
|
||||
local nNewEndId2 = EgtSplitCurveAtParam( nNewEntId, dParSplit)
|
||||
-- trim della curva guida
|
||||
local _, _, dParMinDist = EgtPointCurveDist( EgtEP( nNewEntId, GDB_ID.ROOT), nGuideId, GDB_RT.GLOB)
|
||||
local nGuideId2 = EgtSplitCurveAtParam( nGuideId, dParMinDist)
|
||||
EgtErase( nGuideId2)
|
||||
-- spiralize solo del primo pezzo
|
||||
EgtSpiralizeCurveAlongGuide( nNewEntId, nGuideId)
|
||||
EgtModifyCurveStartPoint( nNewEntId, ptOld, GDB_RT.GLOB)
|
||||
EgtModifyCurveEndPoint( nNewEntId, EgtSP( nNewEndId2, GDB_ID.ROOT), GDB_RT.GLOB)
|
||||
-- riassemblo la curva
|
||||
EgtAddCurveCompoCurve( nNewEntId, nNewEndId2)
|
||||
end
|
||||
|
||||
EgtErase( nGuideId)
|
||||
end
|
||||
|
||||
-- approssimo
|
||||
|
||||
-- b) approssimo
|
||||
local ptS = EgtSP( nNewEntId, GDB_ID.ROOT)
|
||||
EgtApproxCurve( nNewEntId, GDB_CA.ARCS, s_dApproxTol)
|
||||
if LayerParams.bLinearApprox then
|
||||
@@ -2155,8 +2178,7 @@ local function SpiralVase( vLayIds, LayerParams)
|
||||
EgtChangeClosedCurveStartPoint( nNewEntId, ptS, GDB_RT.GLOB)
|
||||
end
|
||||
|
||||
|
||||
-- modifica graduale dell'altezza
|
||||
-- c) 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)
|
||||
@@ -2176,33 +2198,28 @@ local function SpiralVase( vLayIds, LayerParams)
|
||||
-- il primo tratto si trova a metà altezza rispetto allo strato precedente, quindi il coefficiente moltiplicativo è due
|
||||
EgtSetInfo( vTPathsCrvs[1], KEY_FEED_COEFF, 2)
|
||||
-- nel secondo tratto l'altezza è variabile quindi devo calcolare il coefficiente per ogni sottotratto
|
||||
local ptRef = EgtEP( vEntIds[1], GDB_ID.ROOT)
|
||||
local dLenTot = EgtCurveLength( vTPathsCrvs[1]) + EgtCurveLength( vTPathsCrvs[2])
|
||||
local dLen = EgtCurveLength( vTPathsCrvs[1])
|
||||
local nFirst, nCnt = EgtExplodeCurveCompo( vTPathsCrvs[2])
|
||||
for nId = nFirst, nFirst + nCnt - 1 do
|
||||
local dZLoc
|
||||
if nSlicingType == SLICING_TYPE.VERTICAL then
|
||||
dZLoc = ( ( EgtEP( nId, GDB_ID.ROOT) - ptRef)) * LayerParams.vtSlicing
|
||||
else
|
||||
dZLoc = ( ( EgtEP( nId, GDB_ID.ROOT) - ptRef)) * LayerParams.vtSlicing - LayerParams.dLayHeight
|
||||
end
|
||||
local dFeedCoeff = LayerParams.dLayHeight / dZLoc
|
||||
-- calcolo l'altezza effettiva basandomi sulla lunghezza parziale ( viene mimato il conto fatto in EgtSpiralizeCurveAlongExtrusion)
|
||||
dLen = dLen + EgtCurveLength( nId)
|
||||
local dHEff = LayerParams.dLayHeight * dLen / dLenTot
|
||||
local dFeedCoeff = LayerParams.dLayHeight / dHEff
|
||||
EgtSetInfo( nId, KEY_FEED_COEFF, dFeedCoeff)
|
||||
end
|
||||
nOldId = nFirst + nCnt - 1
|
||||
|
||||
elseif nRealLayer == 3 then
|
||||
-- solo la prima metà si trova ad un'altezza variabile rispetto allo strato precedente
|
||||
local dLenTot = EgtCurveLength( vTPathsCrvs[1])
|
||||
local dLen = 0
|
||||
local nNewId = EgtSplitCurve( vTPathsCrvs[1], 2)
|
||||
local ptRef = EgtEP( vEntIds[1], GDB_ID.ROOT)
|
||||
local nFirst, nCnt = EgtExplodeCurveCompo( nNewId)
|
||||
for nId = nFirst, nFirst + nCnt - 1 do
|
||||
local dZLoc
|
||||
if nSlicingType == SLICING_TYPE.VERTICAL then
|
||||
dZLoc = ( EgtEP( nId, GDB_ID.ROOT) - ptRef) * LayerParams.vtSlicing + 0.5 * LayerParams.dLayHeight
|
||||
else
|
||||
dZLoc = ( EgtEP( nId, GDB_ID.ROOT) - ptRef) * LayerParams.vtSlicing - 0.5 * LayerParams.dLayHeight
|
||||
end
|
||||
|
||||
local dFeedCoeff = LayerParams.dLayHeight / dZLoc
|
||||
dLen = dLen + EgtCurveLength( nId)
|
||||
local dHeff = LayerParams.dLayHeight * ( dLen / dLenTot + 0.5)
|
||||
local dFeedCoeff = LayerParams.dLayHeight / dHeff
|
||||
EgtSetInfo( nId, KEY_FEED_COEFF, dFeedCoeff)
|
||||
end
|
||||
nOldId = nNewId + 1
|
||||
|
||||
@@ -189,8 +189,10 @@ function RunMachParamFromSWCalc.Exec()
|
||||
dLayerTime = dTotLayerLength / dLayerFeed * 60
|
||||
end
|
||||
dLayerWait = floor( dTMin + 0.5) - floor( dLayerTime + 0.5)
|
||||
-- sezione dello strand
|
||||
local dSect = max( ( dStrandMean - dSliceStep) * dSliceStep, 0) + pi * dSliceStep * dSliceStep / 4
|
||||
-- calcolo la portata
|
||||
local Vf = dLayerFeed * ( ( dStrandMean - dSliceStep) * dSliceStep + pi * pow( dSliceStep / 2, 2)) / 1000
|
||||
local Vf = dLayerFeed * dSect / 1000
|
||||
-- calcolo speed
|
||||
local dSpeed = ( MATERIAL.K_EXTRUSION / 100.0) * ( MACHINING.K / 100.0) * pow( Vf / MATERIAL.C1, 1 / MATERIAL.C2)
|
||||
-- verifico se speed esce da minimo e massimo della macchina
|
||||
@@ -205,7 +207,7 @@ function RunMachParamFromSWCalc.Exec()
|
||||
end
|
||||
if not bSpeedOk then
|
||||
if dTotLayerLength > 0.1 then
|
||||
dLayerFeed = ( MATERIAL.C1 * pow( ( dSpeed / (( MATERIAL.K_EXTRUSION / 100.0) * ( MACHINING.K / 100.0))), MATERIAL.C2)) * 1000 / ( ( dStrandMean - dSliceStep) * dSliceStep + pi * pow( dSliceStep / 2, 2))
|
||||
dLayerFeed = ( MATERIAL.C1 * pow( ( dSpeed / (( MATERIAL.K_EXTRUSION / 100.0) * ( MACHINING.K / 100.0))), MATERIAL.C2)) * 1000 / dSect
|
||||
dLayerTime = dTotLayerLength / dLayerFeed * 60
|
||||
end
|
||||
dLayerWait = floor( dTMin + 0.5) - floor( dLayerTime + 0.5)
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
-- Version.lua by Egaltech s.r.l. 2024/05/06
|
||||
-- Version.lua by Egaltech s.r.l. 2025/09/12
|
||||
-- Gestione della versione di 3dPrinting
|
||||
|
||||
VERSION = '2.7i1'
|
||||
VERSION = '2.7j1'
|
||||
Reference in New Issue
Block a user