3dPrinting :

- correzioni a calcolo TFS per layer vuoti (tipicamente primi e ultimi con estrusione a 45 gradi).
This commit is contained in:
Dario Sassi
2024-01-31 09:08:18 +01:00
parent e37a2f8e85
commit e4c696c498
+11 -51
View File
@@ -1,4 +1,4 @@
-- RunMachParamFromSWCalc.lua by Egaltech s.r.l. 2022/12/28
-- RunMachParamFromSWCalc.lua by Egaltech s.r.l. 2024/01/30
-- Calcolo dei parametri di stampa
-- Tabella per definizione modulo
@@ -126,44 +126,6 @@ function RunMachParamFromSWCalc.Exec()
end
nCrvId = EgtGetNextName( nCrvId, CONTOUR_GRP .. '*')
end
-- -- rimuovo eventuale info precedente del tempo di attesa
-- EgtRemoveInfo( nLayerId, KEY_WAITING_TIME)
-- -- calcolo lunghezza totale del layer
-- local dTotLayerLength = 0
-- local dTotLayerLengthForMass = 0
-- local dTotLayerArea = 0
-- local nCrvId = EgtGetFirstNameInGroup( nLayerId, CONTOUR_GRP .. '*')
-- while nCrvId do
-- local nToolPathId = EgtGetFirstNameInGroup( nCrvId, TOOLPATH_GRP)
-- -- sommo lunghezze percorsi
-- local dTotCrvLength = 0
-- local dTotCrvLengthForMass = 0
-- local nShellId = EgtGetFirstInGroup( nToolPathId)
-- while nShellId do
-- dTotCrvLength = dTotCrvLength + EgtCurveLength( nShellId)
-- if EgtGetName( nShellId) ~= WIPE_CRV then
-- dTotCrvLengthForMass = dTotCrvLengthForMass + EgtCurveLength( nShellId)
-- end
-- nShellId = EgtGetNext( nShellId)
-- end
-- dTotLayerLength = dTotLayerLength + dTotCrvLength
-- dTotLayerLengthForMass = dTotLayerLengthForMass + dTotCrvLengthForMass
-- -- recupero area
-- local nOuterCrvId = EgtGetFirstNameInGroup( nCrvId, OUTER_CRV)
-- if nOuterCrvId and dStrandCount > 0.5 then
-- local _, _, dTotCrvArea = EgtCurveArea( nOuterCrvId)
-- local dOuterLength = EgtCurveLength( nOuterCrvId)
-- -- recupero offset del part per aggiungerlo all'area interna
-- local dOffset = EgtGetInfo( nPartId, KEY_OFFSET_SLICE, 'd')
-- dTotCrvArea = dTotCrvArea + ( dOffset * dOuterLength)
-- dTotLayerArea = dTotLayerArea + dTotCrvArea
-- end
-- nCrvId = EgtGetNextName( nCrvId, CONTOUR_GRP .. '*')
-- end
-- recupero feed del layer
local dLayerFeed = 0
local dLayerWait = 0
@@ -192,12 +154,11 @@ function RunMachParamFromSWCalc.Exec()
for nMeanIndex = 1, #LengthCrvList do
dStrandMean = dStrandMean + LengthCrvList[nMeanIndex].Width * LengthCrvList[nMeanIndex].Length
end
dStrandMean = dStrandMean / dTotLayerLength
dStrandMean = dStrandMean / EgtIf( dTotLayerLength > 0.1, dTotLayerLength, 1)
-- calcolo costante MF
local dMF = 1
local dSC = 1
if dTotLayerArea > 1 then
-- dMF = dTotLayerLength * dStrand / dTotLayerArea * 100
dMF = dTotLayerLength * dStrandMean / dTotLayerArea * 100
dSC = dStrandCount
else
@@ -216,9 +177,9 @@ function RunMachParamFromSWCalc.Exec()
local dTMin = ( MATERIAL.K_LAYERTIME / 100.0) * ( dMF + MATERIAL.AMin) / MATERIAL.BMin * pow( 0.25 * dStrandMean, MATERIAL.KW) * pow( dSliceStep, MATERIAL.KZ) * pow( dSC, MATERIAL.KN)
local dTTrg = ( MATERIAL.K_LAYERTIME / 100.0) * ( dMF + MATERIAL.ATrg) / MATERIAL.BTrg * pow( 0.25 * dStrandMean, MATERIAL.KW) * pow( dSliceStep, MATERIAL.KZ) * pow( dSC, MATERIAL.KN)
local dTMax = ( MATERIAL.K_LAYERTIME / 100.0) * ( dMF + MATERIAL.AMax) / MATERIAL.BMax * pow( 0.25 * dStrandMean, MATERIAL.KW) * pow( dSliceStep, MATERIAL.KZ) * pow( dSC, MATERIAL.KN)
local dFMin = dTotLayerLength / dTMax * 60
local dFTrg = dTotLayerLength / dTTrg * 60
local dFMax = dTotLayerLength / dTMin * 60
local dFMin = dTotLayerLength / EgtIf( dTMax > 0.1, dTMax, 1) * 60
local dFTrg = dTotLayerLength / EgtIf( dTTrg > 0.1, dTTrg, 1) * 60
local dFMax = dTotLayerLength / EgtIf( dTMin > 0.1, dTMin, 1) * 60
local dLayerTime = dTTrg
if dLayerFeed == 0 then
dLayerFeed = dFTrg
@@ -241,8 +202,10 @@ function RunMachParamFromSWCalc.Exec()
dSpeed = dSMax
end
if not bSpeedOk 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))
dLayerTime = dTotLayerLength / dLayerFeed * 60
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))
dLayerTime = dTotLayerLength / dLayerFeed * 60
end
dLayerWait = floor( dTMin + 0.5) - floor( dLayerTime + 0.5)
end
-- calcolo massa dello strato
@@ -276,15 +239,11 @@ function RunMachParamFromSWCalc.Exec()
EgtSetInfo( nLayerResultId, KEY_WAITING_TIME, dLayerWait)
end
-- scrivo valori in struttura dati
--local nLayerResultId = EgtGetFirstNameInGroup( nResultLayerId, nLayerIndex)
EgtSetInfo( nLayerResultId, KEY_TMIN, dTMin)
EgtSetInfo( nLayerResultId, KEY_TTRG, dTTrg)
EgtSetInfo( nLayerResultId, KEY_TMAX, dTMax)
EgtSetInfo( nLayerResultId, KEY_FTRG, dFTrg)
EgtSetInfo( nLayerResultId, KEY_FMAX, dFeedMax)
-- EgtSetInfo( nLayerResultId, KEY_FMIN, dFMin)
-- EgtSetInfo( nLayerResultId, KEY_FTRG, dFTrg)
-- EgtSetInfo( nLayerResultId, KEY_FMAX, dFMax)
EgtSetInfo( nLayerResultId, KEY_TCUR, dLayerTime)
EgtSetInfo( nLayerResultId, KEY_FCUR, dLayerFeed)
EgtSetInfo( nLayerResultId, KEY_LENGTH, dTotLayerLength)
@@ -296,11 +255,12 @@ function RunMachParamFromSWCalc.Exec()
EgtEmptyGroup( nResultLayerId)
return
end
-- passo al layer successivo
nLayerIndex = nLayerIndex + 1
nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex) or EgtGetFirstNameInGroup( nPartId, "__" .. SLICE_LAYER .. nLayerIndex)
end
if nMaxIndex < nLayerIndex then nMaxIndex = nLayerIndex end
-- passo al pezzo successivo
nPartId = EgtGetNextPart( nPartId)
::continue::
end