3dPrinting :

- ordinamento elementi di stampa
- oridinamento per tipologia di setti.
This commit is contained in:
SaraP
2023-01-10 08:54:09 +01:00
parent 1225625a9a
commit f050f49b66
5 changed files with 64 additions and 58 deletions
+19 -19
View File
@@ -21,7 +21,7 @@ local function GetLayerParamsForPathCalc()
local LayerParams = {}
LayerParams.bSpiralVase = EgtGetInfo( s_nPartId, KEY_SPIRAL_VASE, 'b') or false
LayerParams.nShellsNbr = EgtGetInfo( s_nPartId, KEY_SHELLS_NBR, 'i')
LayerParams.dStrand = EgtGetInfo( s_nPartId, KEY_STRAND, 'd')
LayerParams.dStrand = EgtGetInfo( s_nPartId, KEY_STRAND, 'd')
LayerParams.nStrandOverlap = EgtGetInfo( s_nPartId, KEY_STRAND_OVERLAP, 'i') or 0
LayerParams.dOffs = EgtGetInfo( s_nPartId, KEY_OFFSET_SLICE, 'd')
LayerParams.nFloorNbr = EgtGetInfo( s_nPartId, KEY_FLOOR_NBR, 'i') or 0
@@ -33,7 +33,7 @@ local function GetLayerParamsForPathCalc()
-- parametri costolature
LayerParams.bRibsInvertOrder = EgtGetInfo( s_nPartId, KEY_RIBS_INVERT_ORDER, 'b')
LayerParams.bRibsDoLinkFirst = EgtGetInfo( s_nPartId, KEY_RIBS_DO_LINK_FIRST, 'b') or false
LayerParams.nRibsPrintOrder = EgtGetInfo( s_nPartId, KEY_RIBS_PRINT_ORDER, 'i') or 5
LayerParams.vRibsPrintOrder = EgtGetInfo( s_nPartId, KEY_RIBS_PRINT_ORDER, 'vi') or {3, 1, 4, 2}
-- 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')
@@ -210,7 +210,7 @@ local function VerifyPath( nCrvId, dStrand, vtSlicing, nGrp)
EgtRelocateGlob( nCrvId, nGrp, GDB_IN.LAST_SON)
EgtErase( nGrpTmp)
end
-- se non è fattibile con unica passata lo cancello
-- se non è fattibile con unica passata lo cancello
if not bSingleStrand then
EgtErase( nCrvId)
return false
@@ -448,7 +448,8 @@ local function ComputeTrimSurfWithOverlapsForRibs( vIds, nSrfBase, nSrfExt, dOff
local dNewOffs = nOverlap / 100 * dStrand
local bOk, bExists, nSrfOffs = ComputeSurfOffset( nSrfBase, nGrp, dNewOffs, vtSlicing)
if bOk then
tSurfOffs[nType][nOverlap] = nSrfOffs
tSurfOffs[RIB_TYPE.INTERNAL][nOverlap] = nSrfOffs
tSurfOffs[RIB_TYPE.SUPPORT][nOverlap] = nSrfOffs
end
end
elseif nType == RIB_TYPE.EXTERNAL then
@@ -628,7 +629,7 @@ local function UpdateSplitOrder( nCrv, tInters, nOffsGrp)
end
--------------------------------------------------------------------
local function HandleRibsIntersections( nRibsGrp, LayerParams, nOffsGrp, nRibsPathGrp, bAllTwoStrands, vRibsPrintOrder)
local function HandleRibsIntersections( nRibsGrp, LayerParams, nOffsGrp, nRibsPathGrp, bAllTwoStrands, vTypeSequence)
local vRibsIds = EgtGetNameInGroup( nRibsGrp, RIBS_CRV .. '*')
-- copio gli offset delle costolature nel RibsPathGrp
@@ -694,7 +695,7 @@ local function HandleRibsIntersections( nRibsGrp, LayerParams, nOffsGrp, nRibsPa
else
-- se stessa tipologia taglio il setto già splittato più volte, altrimenti taglio il setto che viene realizzato successivamente
if ( nType1 == nType2 and nSplitOrder1 > nSplitOrder2) or
( nType1 ~= nType2 and vRibsPrintOrder[nType1] > vRibsPrintOrder[nType2]) then
( nType1 ~= nType2 and vTypeSequence[nType1] > vTypeSequence[nType2]) then
nCrv1, nCrv2 = nCrv2, nCrv1
nSplitOrder1, nSplitOrder2 = nSplitOrder2, nSplitOrder1
end
@@ -762,7 +763,7 @@ end
---------------------------------------------------------------------
-- Funzione che riordina le costolature nel caso generico
local function ReorderRibs( nGrp, bInvertOrder, bDoLinkFirst, dStrand, nMaxNbr, vTypeSequence)
local function ReorderRibs( nGrp, bInvertOrder, bDoLinkFirst, dStrand, nMaxNbr, vRibsPrintOrder)
local vIds = EgtGetNameInGroup( nGrp, RIBS_CRV .. '*')
if not vIds or #vIds == 0 then return end
@@ -776,8 +777,8 @@ local function ReorderRibs( nGrp, bInvertOrder, bDoLinkFirst, dStrand, nMaxNbr,
-- riordino ogni tipologia con shortest path
local vSplitRibs = {}
for i = 1, #vTypeSequence do
local nCurrType = vTypeSequence[i]
for i = 1, #vRibsPrintOrder do
local nCurrType = vRibsPrintOrder[i]
local tSplitOrder = {}
local nMax = -1
-- raggruppo i ribs
@@ -909,7 +910,7 @@ end
---------------------------------------------------------------------------------------------
-- Funzione che riordina le costolature nel caso di intersezioni e 2 passate
local function ReorderRibsInters2Shells( nOffsGrp, dStrand, vTypeSequence)
local function ReorderRibsInters2Shells( nOffsGrp, dStrand, vRibsPrintOrder)
local vOffs = {}
local vClosed = {}
@@ -1059,8 +1060,8 @@ local function ReorderRibsInters2Shells( nOffsGrp, dStrand, vTypeSequence)
table.insert( tRibs[nType], vCrvs[nId])
end
-- riordino per tipologia
for i = 1, #vTypeSequence do
nCurrType = vTypeSequence[i]
for i = 1, #vRibsPrintOrder do
nCurrType = vRibsPrintOrder[i]
for j = 1, #tRibs[nCurrType] do
EgtRelocateGlob( tRibs[nCurrType][j], nOffsGrp, GDB_IN.LAST_SON)
end
@@ -1100,10 +1101,9 @@ end
local function CalcRibsPaths( nSliceGrp, nRibsGrp, LayerParams, nIdx, vPtStart)
-- stabilisco ordine di realizzazione delle varie tipologie
local vTypeSequence = { 3, 1, 4, 2}
local vRibsPrintOrder = {}
for i = 1, #vTypeSequence do
vRibsPrintOrder[vTypeSequence[i]] = i
local vTypeSequence = {}
for i = 1, #LayerParams.vRibsPrintOrder do
vTypeSequence[LayerParams.vRibsPrintOrder[i]] = i
end
local vRibs = EgtGetNameInGroup( nRibsGrp, RIBS_CRV .. '*')
@@ -1159,7 +1159,7 @@ local function CalcRibsPaths( nSliceGrp, nRibsGrp, LayerParams, nIdx, vPtStart)
local tSurfOffs = ComputeTrimSurfWithOverlapsForRibs( vRibs, nSrfBase, nSrfExt, LayerParams.dOffs, LayerParams.dStrand, nRibsPathGrp, LayerParams.vtSlicing)
-- gestisco eventuali intersezioni fra costolature
local bInters = HandleRibsIntersections( nRibsGrp, LayerParams, nOffsGrp, nRibsPathGrp, bAllTwoStrands, vRibsPrintOrder)
local bInters = HandleRibsIntersections( nRibsGrp, LayerParams, nOffsGrp, nRibsPathGrp, bAllTwoStrands, vTypeSequence)
EgtSetInfo( nRibsPathGrp or GDB_ID.NULL, KEY_RIBS_INTERS, bInters)
EgtSetInfo( nRibsPathGrp or GDB_ID.NULL, KEY_RIBS_TWO_STRANDS, bAllTwoStrands)
@@ -1240,9 +1240,9 @@ local function CalcRibsPaths( nSliceGrp, nRibsGrp, LayerParams, nIdx, vPtStart)
-- riordino le costolature
if bAllTwoStrands and bInters then
-- gestione caso speciale di intersezione e 2 passate
ReorderRibsInters2Shells( nRibsPathGrp, LayerParams.dStrand, vTypeSequence)
ReorderRibsInters2Shells( nRibsPathGrp, LayerParams.dStrand, LayerParams.vRibsPrintOrder)
else
ReorderRibs( nRibsPathGrp, LayerParams.bRibsInvertOrder, LayerParams.bRibsDoLinkFirst, LayerParams.dStrand, nMaxNbr, vTypeSequence)
ReorderRibs( nRibsPathGrp, LayerParams.bRibsInvertOrder, LayerParams.bRibsDoLinkFirst, LayerParams.dStrand, nMaxNbr, LayerParams.vRibsPrintOrder)
end
if not EgtGetFirstNameInGroup( nRibsPathGrp, RIBS_CRV .. '*') then