3dPrinting :

- aggiunti parametri coasting e wipe nelle regioni con diverso numero di passate.
This commit is contained in:
SaraP
2022-08-26 10:38:51 +02:00
parent b5d1157ef1
commit 4a211ef9c3
4 changed files with 61 additions and 24 deletions
+35 -17
View File
@@ -39,8 +39,12 @@ local function GetLayerParamsForToolPathCalc()
LayerParams.dTDiam = EgtGetInfo( s_nPartId, KEY_TOOL_DIAM, 'd')
-- Parametri costolature
LayerParams.bRibsLink = EgtGetInfo( s_nPartId, KEY_RIBS_LINK, 'b')
-- Parametri regioni con diverse passate
LayerParams.dShellNbrCoasting = EgtGetInfo( s_nPartId, KEY_SHELL_NBR_COASTING, 'd')
LayerParams.dShellNbrWipe = EgtGetInfo( s_nPartId, KEY_SHELL_NBR_WIPE, 'd')
LayerParams.dShellNbrWipeDir = EgtGetInfo( s_nPartId, KEY_SHELL_NBR_WIPE_DIR, 'd')
return LayerParams
return LayerParams
end
--------------------------------------------------------------------
@@ -175,7 +179,16 @@ local function AddLeadOut( nCrvId, LayerParams, nGrpId)
end
--------------------------------------------------------------------
local function AddRetraction( nCrvId, dCoastingLen, dWipeLen, vtSlicing)
local function AddRetraction( nCrvId, LayerParams, dCoastingLen, dWipeLen)
-- recupero i parametri per retrazione
local nType = EgtGetInfo( nCrvId, KEY_TYPE, 'i')
local bClosedExtraShell = EgtGetInfo( nCrvId, KEY_CLOSED_EXTRA_SHELL, 'b') or false
local dWipeDir = EgtIf( nType == TYPE.EXTRA_SHELL, LayerParams.dShellNbrWipeDir, 0)
if nType == TYPE.EXTRA_SHELL and not bClosedExtraShell then
dWipeLen = LayerParams.dShellNbrWipe
dCoastingLen = LayerParams.dShellNbrCoasting
end
-- curva ausiliaria per generare correttamente wipe
local nCopyId = EgtCopyGlob( nCrvId, nCrvId, GDB_IN.AFTER)
@@ -206,21 +219,21 @@ local function AddRetraction( nCrvId, dCoastingLen, dWipeLen, vtSlicing)
if dWipeLen > GEO.EPS_SMALL then
-- se shell
local nWipeId
local nType = EgtGetInfo( nCrvId, KEY_TYPE, 'i')
if nType == TYPE.OUTER_SHELL or nType == TYPE.INNER_SHELL then
-- se shell
local nWipeId
if nType == TYPE.OUTER_SHELL or nType == TYPE.INNER_SHELL or bClosedExtraShell then
-- se shell o extra shell chiusa
nWipeId = EgtCopyGlob( nCopyId, nCoastingId or nCrvId, GDB_IN.AFTER)
EgtTrimCurveEndAtLen( nWipeId, dWipeLen)
else
-- se extra shell
local bInverted = EgtGetInfo( nCrvId, KEY_INVERTED_CURVE, 'b') or false
local vtDir = EgtEV( nCoastingId or nCrvId)
vtDir:rotate( vtSlicing, EgtIf( bInverted, 90, -90))
local dAng = dWipeDir - 90
vtDir:rotate( LayerParams.vtSlicing, EgtIf( bInverted, - dAng, dAng))
local ptS = EgtEP( nCoastingId or nCrvId)
local ptE = ptS + vtDir * dWipeLen
nWipeId = EgtCurveCompoFromPoints( EgtGetParent( nCrvId), {ptS, ptE})
EgtRelocateGlob( nWipeId, nCoastingId or nCrvId, GDB_IN.AFTER)
EgtRelocateGlob( nWipeId, nCoastingId or nCrvId, GDB_IN.AFTER)
end
EgtSetName( nWipeId, WIPE_CRV)
@@ -236,18 +249,18 @@ end
local function AddRetractionOnLastCrv( nCrvId, nTpathGrpId, LayerParams)
if LayerParams.nLeadOutType == LEAD_TYPE.NONE then
AddRetraction( nCrvId, LayerParams.dCoastingLen, LayerParams.dWipeLen, LayerParams.vtSlicing)
AddRetraction( nCrvId, LayerParams, LayerParams.dCoastingLen, LayerParams.dWipeLen)
else
local nLeadOutId = EgtGetLastInGroup( nTpathGrpId)
local dLen = EgtCurveLength( nLeadOutId)
if dLen > LayerParams.dCoastingLen - 500 * GEO.EPS_SMALL then
-- coinvolge solo la curva di lead out
local dNewCoastingLen = EgtIf( abs( LayerParams.dCoastingLen - dLen) < 500 * GEO.EPS_SMALL, dLen, LayerParams.dCoastingLen) -- verifico se interamente coinvolta
AddRetraction( nLeadOutId, dNewCoastingLen, 0.0, LayerParams.vtSlicing)
AddRetraction( nLeadOutId, LayerParams, dNewCoastingLen, 0.0)
else
-- coinvolge parte dell'ultima shell crv
local dNewCoastingLen = LayerParams.dCoastingLen - dLen
local nCoastingId = AddRetraction( nCrvId, dNewCoastingLen, 0.0, LayerParams.vtSlicing)
local nCoastingId = AddRetraction( nCrvId, LayerParams, dNewCoastingLen, 0.0)
EgtAddCurveCompoCurve( nCoastingId, nLeadOutId)
end
end
@@ -482,7 +495,7 @@ local function AddRibsLeadOut( nCrv, nTPathGrp, nLoopsGrp, vtSlicing)
-- verifico se la curva ha lunghezza sufficiente
local dLen = EgtCurveLength( nCrvRef)
local bSkip = ( dLen - dRibsLOLen - dRibsLOCoasting < - GEO.EPS_SMALL)
local vtE = EgtSV( nCrvRef)
local vtE = EgtEV( nCrv)
-- primo tratto ( segue offset con flusso aperto)
if dRibsLOLen > GEO.EPS_SMALL and not bSkip then
@@ -513,8 +526,8 @@ local function AddRibsLeadOut( nCrv, nTPathGrp, nLoopsGrp, vtSlicing)
-- terzo tratto ( diretto verso esterno con ugello chiuso)
if dRibsLOWipe > GEO.EPS_SMALL then
local dAng = EgtIf( bInvert, 90, - 90) + dRibsLOWipeAng
vtE:rotate( vtSlicing, dAng)
local dAng = dRibsLOWipeAng - 90
vtE:rotate( vtSlicing, EgtIf( bInvert, - dAng, dAng))
local ptFinal = ptE + vtE * dRibsLOWipe
nWipe = EgtCurveCompoFromPoints( nTPathGrp, { ptE, ptFinal})
EgtRelocateGlob( nWipe, nCoasting or nCrvLO or nCrv, GDB_IN.AFTER)
@@ -734,7 +747,8 @@ function CalcToolPath.Exec( nPartId)
-- mi sposto dell'altezza layer
EgtMove( nNewEntId, LayerParams.dLayHeight * LayerParams.vtSlicing, GDB_RT.GLOB)
-- eventuale inversione
if EgtCurveIsClosed( nNewEntId) and LayerParams.bInvert then
local nType = EgtGetInfo( nNewEntId, KEY_TYPE, 'i')
if nType ~= TYPE.EXTRA_SHELL and LayerParams.bInvert then
EgtInvertCurve( nNewEntId)
end
EgtModifyCurveExtrusion( nNewEntId, LayerParams.vtSlicing, GDB_RT.GLOB)
@@ -744,6 +758,10 @@ function CalcToolPath.Exec( nPartId)
-- aggiungo gli opportuni raccordi sulle shell complete
local vIds = EgtGetNameInGroup( nTpathGrpId, SHELL_CRV .. '*')
local vIdsExtra = EgtGetNameInGroup( nTpathGrpId, EXTRA_SHELL_CRV .. '*') or {}
for i = 1, #vIdsExtra do
table.insert( vIds, vIdsExtra[i])
end
AddLink( vIds, nTpathGrpId, LayerParams.nLinkType, LayerParams.dLinkParam, LayerParams.dSPOffs, LayerParams.dStrand, LayerParams.vtSlicing)
-- aggiungo gli opportuni raccondi sulle shell con numero diverso di passate
@@ -789,9 +807,9 @@ function CalcToolPath.Exec( nPartId)
-- aggiungo retrazione
if nId == nFirstId then
local dWipeLen = EgtIf( LayerParams.nLeadInType == LEAD_TYPE.NONE, LayerParams.dWipeLen, 0)
AddRetraction( nId, LayerParams.dCoastingLen, dWipeLen, LayerParams.vtSlicing)
AddRetraction( nId, LayerParams, LayerParams.dCoastingLen, dWipeLen)
else
AddRetraction( nId, LayerParams.dCoastingLen, LayerParams.dWipeLen, LayerParams.vtSlicing)
AddRetraction( nId, LayerParams, LayerParams.dCoastingLen, LayerParams.dWipeLen)
end
end
end