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
+18 -7
View File
@@ -24,6 +24,7 @@ local function GetLayerParamsForPathCalc()
LayerParams.dOffs = EgtGetInfo( s_nPartId, KEY_OFFSET_SLICE, 'd')
LayerParams.nFloorNbr = EgtGetInfo( s_nPartId, KEY_FLOOR_NBR, 'i')
LayerParams.vtSlicing = EgtGetInfo( s_nPartId, KEY_SLICING_DIR, 'v')
LayerParams.bPrintInvert = ( EgtGetInfo( s_nPartId, KEY_PRINT_DIRECTION, 'i') == PRINT_DIRECTION.CW)
-- parametri costolature
LayerParams.bRibsInvertOrder = EgtGetInfo( s_nPartId, KEY_RIBS_INVERT_ORDER, 'b')
return LayerParams
@@ -716,7 +717,7 @@ local function CreateShellNbrSurfaces( nGrp, nShellsNbr)
end
-- costruisco la surf
local nSrfId, nCnt = EgtSurfFlatRegion( nSrfGrp, vCrvIds)
for nIdSrf = nSrfId + 1, nSrfId + nCnt - 2 do
for nIdSrf = nSrfId + 1, nSrfId + nCnt - 1 do
EgtSurfFrAdd( nSrfId, nIdSrf)
end
EgtSetName( nSrfId, SHELL_NBR_SURF .. tostring( nDiff))
@@ -783,11 +784,19 @@ local function UpdateTotalShellSurf( nSrf, nCrv, dStrand, nGrpId)
end
---------------------------------------------------------------------
local function ReorderExtraShells( nPathGrp, dStrand, vPtStart)
local function ReorderExtraShells( nPathGrp, dStrand, vPtStart, bPrintInvert)
local vIds = EgtGetNameInGroup( nPathGrp, EXTRA_SHELL_CRV .. '*')
if not vIds then return end
if not vIds then return end
-- eventuale inversione di tutte le curve
if bPrintInvert then
for i = 1, #vIds do
EgtInvertCurve( vIds[i])
EgtSetInfo( vIds[i], KEY_INVERTED_CURVE, 1)
end
end
-- cerco di creare percorsi
local k = 0 -- indice da utilizzare per i nomi
while #vIds > 0 do
@@ -796,12 +805,14 @@ local function ReorderExtraShells( nPathGrp, dStrand, vPtStart)
nCurrCrv = vIds[1]
table.remove( vIds, 1)
EgtSetName( nCurrCrv, EXTRA_SHELL_CRV .. tostring(k))
local ptSCurr = EgtSP( nCurrCrv)
local ptECurr = EgtEP( nCurrCrv)
local nCnt = 0
-- se curva è chiusa
if EgtCurveIsClosed( nCurrCrv) then
ModifyStartPoint( nCurrCrv, vPtStart)
EgtSetInfo( nCurrCrv, KEY_CLOSED_EXTRA_SHELL, 1)
-- setto a nil per ripartire subito con curva successiva
nCurrCrv = nil
end
@@ -829,12 +840,12 @@ local function ReorderExtraShells( nPathGrp, dStrand, vPtStart)
if dist( ptE, ptECurr) < 1.5 * dStrand then
-- congiungo end-end
EgtInvertCurve( vIds[j])
EgtSetInfo( vIds[j], KEY_INVERTED_CURVE, 1)
EgtSetInfo( vIds[j], KEY_INVERTED_CURVE, EgtIf( bPrintInvert, 0, 1))
bLink = true
elseif nCnt == 0 and dist( ptS, ptSCurr) < 1.5 * dStrand then
-- congiungo start-start
EgtInvertCurve( nCurrCrv)
EgtSetInfo( nCurrCrv, KEY_INVERTED_CURVE, 1)
EgtSetInfo( nCurrCrv, KEY_INVERTED_CURVE, EgtIf( bPrintInvert, 0, 1))
bLink = true
end
@@ -956,7 +967,7 @@ local function CalcExtraShellsPath( nMaxShellNbrDiff, nShellNbrGrp, nCrvGrpId, d
for j = nCrvT + 1, nTrimCrv + nTrimCnt - 1 do
EgtErase( j)
end
ReorderExtraShells( nGrpId, LayerParams.dStrand, vPtStart)
ReorderExtraShells( nGrpId, LayerParams.dStrand, vPtStart, LayerParams.bPrintInvert)
return
end
else
@@ -972,7 +983,7 @@ local function CalcExtraShellsPath( nMaxShellNbrDiff, nShellNbrGrp, nCrvGrpId, d
end
-- riordino le curve appena create e se possibile creo percorsi chiusi
ReorderExtraShells( nGrpId, LayerParams.dStrand, vPtStart)
ReorderExtraShells( nGrpId, LayerParams.dStrand, vPtStart, LayerParams.bPrintInvert)
end