3dPrinting 3.1g1 :
- gestione di più solidi da stampare contemporaneamente nel gruppo "PrintSolid".
This commit is contained in:
+192
-201
@@ -358,26 +358,23 @@ end
|
||||
--------------------------------------------------------------------
|
||||
------------------------- INFILL -----------------------------------
|
||||
--------------------------------------------------------------------
|
||||
local function CalcInfillPaths( nLayId, nInfillGrp, LayerParams)
|
||||
local function CalcInfillPaths( nCrvGrp, nInfillGrp, LayerParams)
|
||||
|
||||
if not nInfillGrp then return end
|
||||
|
||||
-- recupero le curve di infill
|
||||
local vIds = EgtGetAllInGroup( nInfillGrp)
|
||||
if not vIds or #vIds == 0 then return end
|
||||
|
||||
-- scorro i gruppi di curve
|
||||
local vCrvGrps = EgtGetNameInGroup( nLayId, CONTOUR_GRP .. '*')
|
||||
for i = 1, #vCrvGrps do
|
||||
|
||||
-- recupero le curve di infill legate al solido del CrvGrp corrente
|
||||
local nOrigStm = EgtGetInfo( nCrvGrp, KEY_ORIGINAL_SOLID, 'i')
|
||||
local vIds = EgtGetNameInGroup( nInfillGrp, INFILL_CRV .. tostring( nOrigStm) .. '*') or {}
|
||||
if #vIds > 0 then
|
||||
|
||||
-- creo il gruppo per infill
|
||||
local nInfillPathGrp = EgtGroup( vCrvGrps[i])
|
||||
local nInfillPathGrp = EgtGroup( nCrvGrp)
|
||||
EgtSetName( nInfillPathGrp, INFILL_GRP)
|
||||
EgtSetStatus( nInfillPathGrp, GDB_ST.OFF)
|
||||
EgtSetInfo( nInfillPathGrp, KEY_FILL_TYPE, LayerParams.nInfillType)
|
||||
|
||||
-- recupero la superficie occupata dalle shell
|
||||
local nSrfBase = EgtGetFirstNameInGroup( vCrvGrps[i], TOT_SHELL_TRIM_SURF)
|
||||
local nSrfBase = EgtGetFirstNameInGroup( nCrvGrp, TOT_SHELL_TRIM_SURF)
|
||||
if not nSrfBase then
|
||||
-- se non esiste non c'è spazio per infill
|
||||
EgtOutLog( 'Warning : Infill not possibile (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
@@ -395,10 +392,10 @@ local function CalcInfillPaths( nLayId, nInfillGrp, LayerParams)
|
||||
EgtOutLog( 'Warning : Infill without correct overlap (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
end
|
||||
|
||||
for i = 1, #vIds do
|
||||
local nNewId = EgtCopyGlob( vIds[i], nInfillPathGrp)
|
||||
for j = 1, #vIds do
|
||||
local nNewId = EgtCopyGlob( vIds[j], nInfillPathGrp)
|
||||
-- eventuale inversione della curva per link
|
||||
if LayerParams.bInfillLink and i % 2 == 0 then
|
||||
if LayerParams.bInfillLink and j % 2 == 0 then
|
||||
EgtInvertCurve( nNewId)
|
||||
UpdateInvertInfo( nNewId)
|
||||
end
|
||||
@@ -641,13 +638,17 @@ local function GetZigZagDirection( nSrfId, nBorderSurf, dStrand, nGrp, frLoc, nT
|
||||
local vtDir
|
||||
|
||||
local sInfoKey = KEY_ZIG_ZAG_DIR
|
||||
-- l'info è legata all'id del solido
|
||||
if nType == TYPE.AUX_SOLID then
|
||||
-- l'info è legata all'id del solido
|
||||
local vsSolidName = EgtSplitString( sName, '_')
|
||||
local nAuxSolidGrp = EgtGetFirstNameInGroup( nSliceLayId, AUX_SOLIDS_GRP)
|
||||
local nOrigCrvId = EgtGetFirstNameInGroup( nAuxSolidGrp, vsSolidName[1])
|
||||
local sOrigSolidId = EgtGetInfo( nOrigCrvId, KEY_ORIGINAL_SURF)
|
||||
sInfoKey = sInfoKey .. '_' .. sOrigSolidId
|
||||
else
|
||||
local nCrvGrp = EgtGetParent( nGrp)
|
||||
local sOrigSolidId = EgtGetInfo( nCrvGrp, KEY_ORIGINAL_SOLID)
|
||||
sInfoKey = sInfoKey .. '_' .. sOrigSolidId
|
||||
end
|
||||
|
||||
-- controllo se info già presente sul layer per altri chunk
|
||||
@@ -703,62 +704,57 @@ local function ComputeZigZagSolidFill( nSrf, dStrand, sName, nType, nGrp, nBorde
|
||||
end
|
||||
|
||||
------------------------------------------------------------------
|
||||
local function CalcSolidFillPath( nLayId, LayerParams, nStartLay, nFillType)
|
||||
local function CalcSolidFillPath( nCrvGrp, nLayId, LayerParams, nStartLay, nFillType)
|
||||
|
||||
-- scorro i gruppi di curve
|
||||
local vCrvGrps = EgtGetNameInGroup( nLayId, CONTOUR_GRP .. '*')
|
||||
for i = 1, #vCrvGrps do
|
||||
|
||||
-- creo il gruppo per infill
|
||||
local nInfillPathGrp = EgtGroup( vCrvGrps[i])
|
||||
EgtSetName( nInfillPathGrp, INFILL_GRP)
|
||||
EgtSetStatus( nInfillPathGrp, GDB_ST.OFF)
|
||||
EgtSetInfo( nInfillPathGrp, KEY_FILL_TYPE, nFillType)
|
||||
|
||||
-- recupero la superficie occupata dalle shell
|
||||
local nSrfBase = EgtGetFirstNameInGroup( vCrvGrps[i], TOT_SHELL_TRIM_SURF)
|
||||
if not nSrfBase then
|
||||
-- se non esiste non c'è spazio per solid fill
|
||||
-- creo il gruppo per infill
|
||||
local nInfillPathGrp = EgtGroup( nCrvGrp)
|
||||
EgtSetName( nInfillPathGrp, INFILL_GRP)
|
||||
EgtSetStatus( nInfillPathGrp, GDB_ST.OFF)
|
||||
EgtSetInfo( nInfillPathGrp, KEY_FILL_TYPE, nFillType)
|
||||
|
||||
-- recupero la superficie occupata dalle shell
|
||||
local nSrfBase = EgtGetFirstNameInGroup( nCrvGrp, TOT_SHELL_TRIM_SURF)
|
||||
if not nSrfBase then
|
||||
-- se non esiste non c'è spazio per solid fill
|
||||
EgtOutLog( 'Warning : SolidFill not possibile (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
else
|
||||
-- calcolo la superficie da riempire
|
||||
local nSrfToFill, bNoOverlap = ComputeTrimSurf( nSrfBase, nInfillPathGrp, LayerParams.dInfillStrand, LayerParams.dInfillOverlap)
|
||||
if not nSrfToFill then
|
||||
-- errore
|
||||
EgtOutLog( 'Error : creation of SolidFill region failed (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
table.insert( s_vErr, ' - layer ' .. EgtNumToString( s_nCurrIdx) .. ' : creation of SolidFill region failed')
|
||||
elseif nSrfToFill == GDB_ID.NULL then
|
||||
EgtOutLog( 'Warning : SolidFill not possibile (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
else
|
||||
-- calcolo la superficie da riempire
|
||||
local nSrfToFill, bNoOverlap = ComputeTrimSurf( nSrfBase, nInfillPathGrp, LayerParams.dInfillStrand, LayerParams.dInfillOverlap)
|
||||
if not nSrfToFill then
|
||||
-- errore
|
||||
EgtOutLog( 'Error : creation of SolidFill region failed (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
table.insert( s_vErr, ' - layer ' .. EgtNumToString( s_nCurrIdx) .. ' : creation of SolidFill region failed')
|
||||
elseif nSrfToFill == GDB_ID.NULL then
|
||||
EgtOutLog( 'Warning : SolidFill not possibile (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
else
|
||||
if bNoOverlap then
|
||||
EgtOutLog( 'Warning : SolidFill without correct overlap (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
end
|
||||
|
||||
-- distanza tra passate tenendo conto dell'overlap indicato
|
||||
local dDist = ( 1 - LayerParams.dInfillStrandOverlap / 100) * LayerParams.dInfillStrand
|
||||
-- inserisco il riempimento
|
||||
if nFillType == FILL_TYPE.OFFSET then
|
||||
-- recupero le shell precedenti dal PathGrp
|
||||
local nPathGrp = EgtGetFirstNameInGroup( vCrvGrps[i], PATH_GRP)
|
||||
local nLast = EgtGetLastNameInGroup( nPathGrp, SHELL_CRV .. '*') or EgtGetLastNameInGroup( nPathGrp, EXTRA_SHELL_CRV .. '*')
|
||||
local vOldIds = EgtGetNameInGroup( nPathGrp, EgtGetName( nLast))
|
||||
if not ComputeOffsetShells( nSrfToFill, dDist, INFILL_CRV, TYPE.INFILL, nInfillPathGrp, nStartLay, vOldIds) then
|
||||
EgtOutLog( 'Error : creation of SolidFill failed (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
table.insert( s_vErr, ' - layer ' .. EgtNumToString( s_nCurrIdx) .. ' : creation of SolidFill failed')
|
||||
end
|
||||
elseif nFillType == FILL_TYPE.ZIGZAG then
|
||||
ComputeZigZagSolidFill( nSrfToFill, dDist, INFILL_CRV, TYPE.INFILL, nInfillPathGrp, nil, nLayId)
|
||||
end
|
||||
|
||||
-- avendo riempito la regione, la TotShellTrimSurf non deve esistere
|
||||
EgtErase( nSrfBase)
|
||||
if bNoOverlap then
|
||||
EgtOutLog( 'Warning : SolidFill without correct overlap (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
end
|
||||
|
||||
-- distanza tra passate tenendo conto dell'overlap indicato
|
||||
local dDist = ( 1 - LayerParams.dInfillStrandOverlap / 100) * LayerParams.dInfillStrand
|
||||
-- inserisco il riempimento
|
||||
if nFillType == FILL_TYPE.OFFSET then
|
||||
-- recupero le shell precedenti dal PathGrp
|
||||
local nPathGrp = EgtGetFirstNameInGroup( nCrvGrp, PATH_GRP)
|
||||
local nLast = EgtGetLastNameInGroup( nPathGrp, SHELL_CRV .. '*') or EgtGetLastNameInGroup( nPathGrp, EXTRA_SHELL_CRV .. '*')
|
||||
local vOldIds = EgtGetNameInGroup( nPathGrp, EgtGetName( nLast))
|
||||
if not ComputeOffsetShells( nSrfToFill, dDist, INFILL_CRV, TYPE.INFILL, nInfillPathGrp, nStartLay, vOldIds) then
|
||||
EgtOutLog( 'Error : creation of SolidFill failed (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
table.insert( s_vErr, ' - layer ' .. EgtNumToString( s_nCurrIdx) .. ' : creation of SolidFill failed')
|
||||
end
|
||||
elseif nFillType == FILL_TYPE.ZIGZAG then
|
||||
ComputeZigZagSolidFill( nSrfToFill, dDist, INFILL_CRV, TYPE.INFILL, nInfillPathGrp, nil, nLayId)
|
||||
end
|
||||
|
||||
-- avendo riempito la regione, la TotShellTrimSurf non deve esistere
|
||||
EgtErase( nSrfBase)
|
||||
end
|
||||
|
||||
-- se gruppo vuoto lo cancello
|
||||
if not EgtGetFirstInGroup( nInfillPathGrp) then
|
||||
EgtErase( nInfillPathGrp)
|
||||
end
|
||||
end
|
||||
|
||||
-- se gruppo vuoto lo cancello
|
||||
if not EgtGetFirstInGroup( nInfillPathGrp) then
|
||||
EgtErase( nInfillPathGrp)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4261,7 +4257,7 @@ local function ComputeAuxSolidsGenericInfill( nSrf, dStrand, sName, nPathGrp, nS
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
local function CalcAuxSolidsPaths( nSliceGrp, nSolidGrp, LayerParams, nStartLay)
|
||||
local function CalcAuxSolidsPaths( nCrvGrp, nSliceGrp, nSolidGrp, LayerParams, nStartLay)
|
||||
|
||||
-- recupero i solidi ausiliari dividendoli per nome
|
||||
local vSolidIds = {}
|
||||
@@ -4273,125 +4269,117 @@ local function CalcAuxSolidsPaths( nSliceGrp, nSolidGrp, LayerParams, nStartLay)
|
||||
nFirst = EgtGetNextName( vIds[#vIds], AUX_SOLIDS_CRV .. '*')
|
||||
end
|
||||
|
||||
-- scorro i gruppi di curve
|
||||
local nCrvGrp = EgtGetFirstNameInGroup( nSliceGrp, CONTOUR_GRP .. '*')
|
||||
while nCrvGrp do
|
||||
|
||||
-- creo o svuoto il gruppo per i solidi ausiliari
|
||||
local nSolidPathGrp = EgtGetFirstNameInGroup( nCrvGrp, AUX_SOLIDS_GRP)
|
||||
if not nSolidPathGrp then
|
||||
nSolidPathGrp = EgtGroup( nCrvGrp)
|
||||
EgtSetName( nSolidPathGrp, AUX_SOLIDS_GRP)
|
||||
EgtSetStatus( nSolidPathGrp, GDB_ST.OFF)
|
||||
else
|
||||
EgtEmptyGroup( nSolidPathGrp)
|
||||
end
|
||||
-- creo o svuoto il gruppo per i solidi ausiliari
|
||||
local nSolidPathGrp = EgtGetFirstNameInGroup( nCrvGrp, AUX_SOLIDS_GRP)
|
||||
if not nSolidPathGrp then
|
||||
nSolidPathGrp = EgtGroup( nCrvGrp)
|
||||
EgtSetName( nSolidPathGrp, AUX_SOLIDS_GRP)
|
||||
EgtSetStatus( nSolidPathGrp, GDB_ST.OFF)
|
||||
else
|
||||
EgtEmptyGroup( nSolidPathGrp)
|
||||
end
|
||||
|
||||
-- creo le superfici con cui fare i trim
|
||||
local nSrfBase = EgtGetFirstNameInGroup( nCrvGrp, TOT_SHELL_TRIM_SURF)
|
||||
if not nSrfBase then
|
||||
EgtOutLog( 'Warning : AuxSolids not possible (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
else
|
||||
-- creo le superfici con cui fare i trim
|
||||
local nSrfBase = EgtGetFirstNameInGroup( nCrvGrp, TOT_SHELL_TRIM_SURF)
|
||||
if not nSrfBase then
|
||||
EgtOutLog( 'Warning : AuxSolids not possible (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
else
|
||||
|
||||
for i = 1, #vSolidIds do
|
||||
-- creo la flat region corrispondente al solido ausiliario
|
||||
local sName = EgtGetName( vSolidIds[i][1])
|
||||
local dStrand = EgtGetInfo( vSolidIds[i][1], KEY_AUX_SOLIDS_STRAND, 'd')
|
||||
local dOverlap = EgtGetInfo( vSolidIds[i][1], KEY_AUX_SOLIDS_OVERLAP, 'd')
|
||||
local nOrigSurf = EgtGetInfo( vSolidIds[i][1], KEY_ORIGINAL_SURF, 'i')
|
||||
local nInfillType = EgtGetInfo( vSolidIds[i][1], KEY_AUX_SOLIDS_INFILL, 'i')
|
||||
local bInfillLink = EgtGetInfo( vSolidIds[i][1], KEY_AUX_SOLIDS_INFILL_LINK, 'b')
|
||||
local nShells = EgtGetInfo( vSolidIds[i][1], KEY_AUX_SOLIDS_SHELLS_NBR, 'i')
|
||||
if nInfillType == FILL_TYPE.OFFSET then
|
||||
-- realizzo le shells insieme al riempimento
|
||||
nShells = 0
|
||||
end
|
||||
|
||||
local nSrfId = EgtSurfFlatRegion( nSolidPathGrp, vSolidIds[i])
|
||||
if nSrfId then
|
||||
EgtSetName( nSrfId, AUX_SOLIDS_SRF)
|
||||
-- calcolo superficie con cui fare trim
|
||||
local nTrimSurf, bNoOverlap = ComputeTrimSurf( nSrfBase, nSolidPathGrp, dStrand, dOverlap)
|
||||
if not nTrimSurf then
|
||||
EgtOutLog( 'Error : creation of AuxSolid region failed (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
table.insert( s_vErr, ' - layer ' .. EgtNumToString( s_nCurrIdx) .. ' : creation of AuxSolid region failed')
|
||||
elseif nTrimSurf == GDB_ID.NULL then
|
||||
EgtOutLog( 'Warning : AuxSolids not possible (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
else
|
||||
if bNoOverlap then
|
||||
EgtOutLog( 'Warning : AuxSolids without correct overlap (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
end
|
||||
|
||||
-- trim con la superficie di offset
|
||||
EgtSurfFrIntersect( nSrfId, nTrimSurf)
|
||||
|
||||
local nFirst, nCnt = EgtExplodeSurf( nSrfId)
|
||||
for j = 0, nCnt - 1 do
|
||||
local sNewName = sName .. EgtIf( j == 0, '', '_' .. tostring( j))
|
||||
|
||||
-- calcolo shells
|
||||
if not ComputeOffsetShells( nFirst + j, dStrand, sNewName, TYPE.AUX_SOLID, nSolidPathGrp, nStartLay, nil, nShells) then
|
||||
EgtOutLog( 'Error : creation of AuxSolid shells failed (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
table.insert( s_vErr, ' - layer ' .. EgtNumToString( s_nCurrIdx) .. ' : creation of AuxSolid shells failed')
|
||||
end
|
||||
|
||||
-- calcolo la superficie per il riempimento
|
||||
local nSrfFill
|
||||
if nShells > 0 then
|
||||
local dOffs = ( nShells - dOverlap / 100) * dStrand
|
||||
nSrfFill = ComputeSurfOffset( nFirst + j, nSolidPathGrp, - dOffs)
|
||||
if not nSrfFill then
|
||||
EgtOutLog( 'Error : creation of AuxSolid infill region failed (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
table.insert( s_vErr, ' - layer ' .. EgtNumToString( s_nCurrIdx) .. ' : creation of AuxSolid infill region failed')
|
||||
elseif nSrfFill == GDB_ID.NULL then
|
||||
EgtOutLog( 'Warning : AuxSolids infill not possible (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
end
|
||||
else
|
||||
-- la superficie per il riempimento è la surf del solido
|
||||
nSrfFill = nFirst + j
|
||||
end
|
||||
|
||||
-- riempimento
|
||||
if nInfillType == FILL_TYPE.OFFSET then
|
||||
-- recupero le shells
|
||||
if not ComputeOffsetShells( nSrfFill, dStrand, sNewName, TYPE.AUX_SOLID, nSolidPathGrp, nStartLay) then
|
||||
EgtOutLog( 'Error : creation of AuxSolid offset infill failed (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
table.insert( s_vErr, ' - layer ' .. EgtNumToString( s_nCurrIdx) .. ' : creation of AuxSolid offset infill failed')
|
||||
end
|
||||
elseif nInfillType == FILL_TYPE.ZIGZAG then
|
||||
ComputeZigZagSolidFill( nSrfFill, dStrand, sNewName, TYPE.AUX_SOLID, nSolidPathGrp, EgtIf( nShells == 0, nTrimSurf, nil), nSliceGrp)
|
||||
if nShells == 0 then
|
||||
-- aggiungo eventuale passata extra
|
||||
AddExtraZigZag( nSrfFill, sNewName, dStrand, nSolidPathGrp, nTrimSurf)
|
||||
end
|
||||
elseif nInfillType ~= FILL_TYPE.NONE then
|
||||
ComputeAuxSolidsGenericInfill( nSrfFill, dStrand, sNewName, nSolidPathGrp, nStartLay, nOrigSurf, dOverlap, nSolidGrp, bInfillLink)
|
||||
end
|
||||
|
||||
-- aggiorno la superficie di trim con il solido ausiliario
|
||||
if nShells == 0 and nInfillType == FILL_TYPE.ZIGZAG then
|
||||
-- gestione speciale perchè non è detto che le passate corrispondano esattamente al solido
|
||||
UpdateTrimSurfWithAuxSolidsZigZag( nSolidPathGrp, sNewName, nSrfBase, dStrand, nFirst + j)
|
||||
else
|
||||
UpdateTrimSurfWithAuxSolidsOffset( nFirst + j, nSrfBase, dStrand, nSolidPathGrp)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
else
|
||||
for i = 1, #vSolidIds do
|
||||
-- creo la flat region corrispondente al solido ausiliario
|
||||
local sName = EgtGetName( vSolidIds[i][1])
|
||||
local dStrand = EgtGetInfo( vSolidIds[i][1], KEY_AUX_SOLIDS_STRAND, 'd')
|
||||
local dOverlap = EgtGetInfo( vSolidIds[i][1], KEY_AUX_SOLIDS_OVERLAP, 'd')
|
||||
local nOrigSurf = EgtGetInfo( vSolidIds[i][1], KEY_ORIGINAL_SURF, 'i')
|
||||
local nInfillType = EgtGetInfo( vSolidIds[i][1], KEY_AUX_SOLIDS_INFILL, 'i')
|
||||
local bInfillLink = EgtGetInfo( vSolidIds[i][1], KEY_AUX_SOLIDS_INFILL_LINK, 'b')
|
||||
local nShells = EgtGetInfo( vSolidIds[i][1], KEY_AUX_SOLIDS_SHELLS_NBR, 'i')
|
||||
if nInfillType == FILL_TYPE.OFFSET then
|
||||
-- realizzo le shells insieme al riempimento
|
||||
nShells = 0
|
||||
end
|
||||
|
||||
local nSrfId = EgtSurfFlatRegion( nSolidPathGrp, vSolidIds[i])
|
||||
if nSrfId then
|
||||
EgtSetName( nSrfId, AUX_SOLIDS_SRF)
|
||||
-- calcolo superficie con cui fare trim
|
||||
local nTrimSurf, bNoOverlap = ComputeTrimSurf( nSrfBase, nSolidPathGrp, dStrand, dOverlap)
|
||||
if not nTrimSurf then
|
||||
EgtOutLog( 'Error : creation of AuxSolid region failed (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
table.insert( s_vErr, ' - layer ' .. EgtNumToString( s_nCurrIdx) .. ' : creation of AuxSolid region failed')
|
||||
elseif nTrimSurf == GDB_ID.NULL then
|
||||
EgtOutLog( 'Warning : AuxSolids not possible (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
else
|
||||
if bNoOverlap then
|
||||
EgtOutLog( 'Warning : AuxSolids without correct overlap (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
end
|
||||
|
||||
-- trim con la superficie di offset
|
||||
EgtSurfFrIntersect( nSrfId, nTrimSurf)
|
||||
|
||||
local nFirst, nCnt = EgtExplodeSurf( nSrfId)
|
||||
for j = 0, nCnt - 1 do
|
||||
local sNewName = sName .. EgtIf( j == 0, '', '_' .. tostring( j))
|
||||
|
||||
-- calcolo shells
|
||||
if not ComputeOffsetShells( nFirst + j, dStrand, sNewName, TYPE.AUX_SOLID, nSolidPathGrp, nStartLay, nil, nShells) then
|
||||
EgtOutLog( 'Error : creation of AuxSolid shells failed (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
table.insert( s_vErr, ' - layer ' .. EgtNumToString( s_nCurrIdx) .. ' : creation of AuxSolid shells failed')
|
||||
end
|
||||
|
||||
-- calcolo la superficie per il riempimento
|
||||
local nSrfFill
|
||||
if nShells > 0 then
|
||||
local dOffs = ( nShells - dOverlap / 100) * dStrand
|
||||
nSrfFill = ComputeSurfOffset( nFirst + j, nSolidPathGrp, - dOffs)
|
||||
if not nSrfFill then
|
||||
EgtOutLog( 'Error : creation of AuxSolid infill region failed (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
table.insert( s_vErr, ' - layer ' .. EgtNumToString( s_nCurrIdx) .. ' : creation of AuxSolid infill region failed')
|
||||
elseif nSrfFill == GDB_ID.NULL then
|
||||
EgtOutLog( 'Warning : AuxSolids infill not possible (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
end
|
||||
else
|
||||
-- la superficie per il riempimento è la surf del solido
|
||||
nSrfFill = nFirst + j
|
||||
end
|
||||
|
||||
-- riempimento
|
||||
if nInfillType == FILL_TYPE.OFFSET then
|
||||
-- recupero le shells
|
||||
if not ComputeOffsetShells( nSrfFill, dStrand, sNewName, TYPE.AUX_SOLID, nSolidPathGrp, nStartLay) then
|
||||
EgtOutLog( 'Error : creation of AuxSolid offset infill failed (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
table.insert( s_vErr, ' - layer ' .. EgtNumToString( s_nCurrIdx) .. ' : creation of AuxSolid offset infill failed')
|
||||
end
|
||||
elseif nInfillType == FILL_TYPE.ZIGZAG then
|
||||
ComputeZigZagSolidFill( nSrfFill, dStrand, sNewName, TYPE.AUX_SOLID, nSolidPathGrp, EgtIf( nShells == 0, nTrimSurf, nil), nSliceGrp)
|
||||
if nShells == 0 then
|
||||
-- aggiungo eventuale passata extra
|
||||
AddExtraZigZag( nSrfFill, sNewName, dStrand, nSolidPathGrp, nTrimSurf)
|
||||
end
|
||||
elseif nInfillType ~= FILL_TYPE.NONE then
|
||||
ComputeAuxSolidsGenericInfill( nSrfFill, dStrand, sNewName, nSolidPathGrp, nStartLay, nOrigSurf, dOverlap, nSolidGrp, bInfillLink)
|
||||
end
|
||||
|
||||
-- aggiorno la superficie di trim con il solido ausiliario
|
||||
if nShells == 0 and nInfillType == FILL_TYPE.ZIGZAG then
|
||||
-- gestione speciale perchè non è detto che le passate corrispondano esattamente al solido
|
||||
UpdateTrimSurfWithAuxSolidsZigZag( nSolidPathGrp, sNewName, nSrfBase, dStrand, nFirst + j)
|
||||
else
|
||||
UpdateTrimSurfWithAuxSolidsOffset( nFirst + j, nSrfBase, dStrand, nSolidPathGrp)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
else
|
||||
EgtOutLog( 'Error : creation of AuxSolid region failed (layer '.. EgtNumToString( s_nCurrIdx) ..') - CalcPaths')
|
||||
table.insert( s_vErr, ' - layer ' .. EgtNumToString( s_nCurrIdx) .. ' : creation of AuxSolid region failed')
|
||||
end
|
||||
end
|
||||
|
||||
-- verifico se il gruppo contine qualcosa
|
||||
if not EgtGetFirstNameInGroup( nSolidPathGrp, AUX_SOLIDS_CRV .. '*') then
|
||||
EgtErase( nSolidPathGrp)
|
||||
end
|
||||
|
||||
-- passo al gruppo di contorni successivo
|
||||
nCrvGrp = EgtGetNextName( nCrvGrp, CONTOUR_GRP .. '*')
|
||||
end
|
||||
|
||||
-- verifico se il gruppo contine qualcosa
|
||||
if not EgtGetFirstNameInGroup( nSolidPathGrp, AUX_SOLIDS_CRV .. '*') then
|
||||
EgtErase( nSolidPathGrp)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4410,8 +4398,6 @@ function CalcPaths.Exec( nPartId)
|
||||
|
||||
-- recupero i parametri per calcolo dei path
|
||||
local LayerParams = GetLayerParamsForPathCalc()
|
||||
local nFirstSolidLay = EgtGetInfo( s_nPartId, KEY_FIRST_SOLID_LAY, 'i') or -1
|
||||
local nLastSolidLay = EgtGetInfo( s_nPartId, KEY_LAST_SOLID_LAY, 'i') or -1
|
||||
local nSlicingType = EgtGetInfo( s_nPartId, KEY_SLICING_TYPE, 'i')
|
||||
|
||||
-- scorro tutti i suoi layer
|
||||
@@ -4439,6 +4425,11 @@ function CalcPaths.Exec( nPartId)
|
||||
local nCrvGrpId = EgtGetFirstNameInGroup( vLayIds[nIdx], CONTOUR_GRP.."*") or GDB_ID.NULL
|
||||
while nCrvGrpId ~= GDB_ID.NULL do
|
||||
|
||||
-- recupero i layer estremi con il solido
|
||||
local nOrigStm = EgtGetInfo( nCrvGrpId, KEY_ORIGINAL_SOLID, 'i')
|
||||
local nFirstLay = EgtGetInfo( s_nPartId, KEY_FIRST_SOLID_LAY .. tostring( nOrigStm), 'i') or -1
|
||||
local nLastLay = EgtGetInfo( s_nPartId, KEY_LAST_SOLID_LAY .. tostring( nOrigStm), 'i') or -1
|
||||
|
||||
-- verifico se il path è già stato calcolato
|
||||
local nGrpId = EgtGetFirstNameInGroup( nCrvGrpId, PATH_GRP) or GDB_ID.NULL
|
||||
if nGrpId == GDB_ID.NULL then
|
||||
@@ -4546,29 +4537,29 @@ function CalcPaths.Exec( nPartId)
|
||||
ReorderExtraShells( nGrpId, nStartLay, LayerParams)
|
||||
end
|
||||
|
||||
-- gestione solidi ausiliari ( se no floor o ceil)
|
||||
if nAuxSolidsGrp and nFirstLay + LayerParams.nFloorNbr <= nIdx and nIdx <= nLastLay - LayerParams.nCeilNbr then
|
||||
CalcAuxSolidsPaths( nCrvGrpId, vLayIds[nIdx], nAuxSolidsGrp, LayerParams, nStartLay)
|
||||
end
|
||||
|
||||
-- gestione riempimenti
|
||||
if LayerParams.nShellsNbr > 0 then
|
||||
-- floor
|
||||
if nIdx < nFirstLay + LayerParams.nFloorNbr then
|
||||
CalcSolidFillPath( nCrvGrpId, vLayIds[nIdx], LayerParams, nStartLay, LayerParams.nFloorType)
|
||||
-- infill
|
||||
elseif nIdx <= nLastLay - LayerParams.nCeilNbr then
|
||||
CalcInfillPaths( nCrvGrpId, nInfillGrp, LayerParams)
|
||||
-- ceil
|
||||
else
|
||||
CalcSolidFillPath( nCrvGrpId, vLayIds[nIdx], LayerParams, nStartLay, LayerParams.nCeilType)
|
||||
end
|
||||
end
|
||||
|
||||
-- passo al gruppo di contorni successivo
|
||||
nCrvGrpId = EgtGetNextName( nCrvGrpId, CONTOUR_GRP.."*") or GDB_ID.NULL
|
||||
end
|
||||
|
||||
-- gestione solidi ausiliari ( se no floor o ceil)
|
||||
if nAuxSolidsGrp and LayerParams.nFloorNbr < nIdx and nIdx <= nLastSolidLay - LayerParams.nCeilNbr then
|
||||
CalcAuxSolidsPaths( vLayIds[nIdx], nAuxSolidsGrp, LayerParams, nStartLay)
|
||||
end
|
||||
|
||||
-- gestione riempimenti
|
||||
if LayerParams.nShellsNbr > 0 then
|
||||
-- floor
|
||||
if nIdx <= LayerParams.nFloorNbr then
|
||||
CalcSolidFillPath( vLayIds[nIdx], LayerParams, nStartLay, LayerParams.nFloorType)
|
||||
-- infill
|
||||
elseif nIdx <= nLastSolidLay - LayerParams.nCeilNbr then
|
||||
CalcInfillPaths( vLayIds[nIdx], nInfillGrp, LayerParams)
|
||||
-- ceil
|
||||
else
|
||||
CalcSolidFillPath( vLayIds[nIdx], LayerParams, nStartLay, LayerParams.nCeilType)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- gestione costolature
|
||||
if nRibsGrp then
|
||||
CalcRibsPaths( vLayIds[nIdx], nRibsGrp, LayerParams, nStartLay, bIgnoreMergedRibs)
|
||||
|
||||
Reference in New Issue
Block a user