Compare commits

...

10 Commits

Author SHA1 Message Date
SaraP 02fe05d5e1 3dPrinting 2.5d4 :
- corretto errore nel calcolo del lead out per setti.
2023-04-20 12:03:45 +02:00
SaraP 3c839716f8 3dPrinting :
- corretto errore nel collegamento setti.
2023-04-18 11:29:46 +02:00
SaraP 2fc63b0d25 3dPrinting :
- piccola correzione slicing.
2023-04-17 17:47:02 +02:00
SaraP 9c42a70c6a 3dPrinting 2.5d3 :
- migliorata gestione di setti con fori
- gestione di setti con link disegnato dall'utente dallo stesso lato del solido.
2023-04-17 17:17:59 +02:00
DarioS 922c5510c0 3dPrinting :
- in Generazione CN al salvataggio progetto si impone la nuova estensione "icrs".
2023-04-11 13:16:17 +02:00
DarioS 56ff8468f0 3dPrinting :
- aggiunto Version.lua alla compilazione.
2023-04-11 11:43:25 +02:00
SaraP 63efafde60 3dPrinting 2.5d1 :
- migliorata segnalazione errori.
2023-04-04 08:59:33 +02:00
SaraP 49c8361bc5 3dPrinting :
- nei FilledSolid il riempimento di tipo none viene realizzato con unica passata lungo il perimetro.
2023-03-22 11:52:45 +01:00
SaraP a7c7bd63ed 3dPrinting :
- migliorie nei riempimenti a zigzag per SolidFill
- gestione SolidFill con buchi.
2023-03-21 12:14:39 +01:00
Samuele Locatelli 4da4b8cf4d Merge branch 'develop' 2023-03-20 15:16:59 +01:00
8 changed files with 873 additions and 242 deletions
+1
View File
@@ -16,3 +16,4 @@ REM Compilazione 32 e 64 bit
\EgtProg\Dll32\luac54 -o bin\CalcSolids.lua CalcSolids.lua
\EgtProg\Dll32\luac54 -o bin\GcodeGenerate.lua GcodeGenerate.lua
\EgtProg\Dll32\luac54 -o bin\Slicing.lua Slicing.lua
\EgtProg\Dll32\luac54 -o bin\Version.lua Version.lua
+3
View File
@@ -109,6 +109,7 @@ KEY_START_RIB = "StartRib"
KEY_ORIGINAL_RIB = "OriginalRib"
KEY_LOOP_RIB = "LoopRib"
KEY_RIBS_USER_LINK = "RibWithUserLink"
KEY_RIBS_USER_LINK_SAME_SIDE = "RibUserLinkOnSameSide"
KEY_RIBS_USER_LINK_CCW = "RibUserLinkCCW"
KEY_RIBS_USER_LINK_ORDER = "RibUserLinkOrder"
KEY_RIBS_USER_LINK_TOT = "RibsUserLinkParts"
@@ -152,6 +153,7 @@ KEY_INVERTED_CRV = "InvertedCrv"
KEY_CLOSED_CRV = "ClosedCrv"
KEY_ASSOCIATED_SURF = "AssociatedSurf"
KEY_ASSOCIATED_CRVS = "AssociatedCrvs"
KEY_ORIGINAL_SURF = "OriginalSurf"
KEY_HAS_SOLIDS = "Solids"
KEY_BOX_MIN_Z = "PartBoxMinZ"
KEY_START_POINT = "StartPoint"
@@ -284,6 +286,7 @@ SLICE_ADV_TYPE = {
---------------------------------------------------------------------
RIBS_GRP = "Ribs"
RIBS_CRV = "Rib"
RIBS_LOOP_GRP = "RibsLoops"
SHELL_NBR_GRP = "ShellNbrRegions"
SHELL_NBR_CRV = "ShellNbrRegion"
+756 -194
View File
File diff suppressed because it is too large Load Diff
+77 -30
View File
@@ -15,6 +15,13 @@ local AMD = require( 'AddManData')
---------------------------------------------------------------------
local s_nPartId
-- costanti
local TOLER = 0.05
local MID_TOLER = 0.1
local BIG_TOLER = 2.0
local MIN_LEN = 20.0
local MIN_AREA = 25.0
---------------------------------------------------------------------
local function ComputeZSlices( dSliceStep, dZmin, dDeltaZ, dZmax)
@@ -70,6 +77,49 @@ local function ComputeMaxH( vIds, frSlicing, HMax, dSliceStep)
return GEO.INFINITO
end
--------------------------------------------------------------------
local function ReadParam( nId, sKey, sType, defVal, table)
-- verifico se info nell'oggetto specifico
local info = EgtGetInfo( nId, sKey, sType)
-- altrimenti recupero info dai parametri generali
if info == nil then info = EgtGetInfo( s_nPartId, sKey, sType) end
-- o assegno valore di default
if info == nil then info = defVal end
-- se presente, inserisco l'info nella tabella
if table then table[sKey] = info end
return info
end
--------------------------------------------------------------------
local function ExtractRibsLoops( nRibsGrp, nStmId)
local nLoopGrp = EgtGroup( s_nPartId)
EgtSetName( nLoopGrp, RIBS_LOOP_GRP)
EgtSetStatus( nLoopGrp, GDB_ST.OFF)
-- recupero tutti i setti
local vIds = EgtGetAllInGroup( nRibsGrp)
for i = 1, #vIds do
-- se trimesh
if EgtGetType( vIds[i]) == GDB_TY.SRF_MESH then
-- trim con il solido
local nCopy = EgtCopyGlob( vIds[i], nLoopGrp)
local nType = ReadParam( vIds[i], KEY_RIBS_TYPE, 'i', RIB_TYPE.INTERNAL)
EgtSurfTmCut( nCopy, nStmId, nType ~= RIB_TYPE.EXTERNAL, false)
-- estraggo i contorni
local nCrv, nCnt = EgtExtractSurfTmLoops( nCopy, nLoopGrp)
if nCrv then
-- assegno nome che permetta di ricondurli alla superficie da cui derivano
for nId = nCrv, nCrv + nCnt - 1 do
EgtSetName( nId, SURF_LOOP .. tostring( vIds[i]))
end
end
end
end
end
--------------------------------------------------------------------
local function AdjustAuxSolids( nSolidsLay)
@@ -105,21 +155,6 @@ local function AdjustAuxSolids( nSolidsLay)
EgtErase( nGrpTmp)
end
--------------------------------------------------------------------
local function ReadParam( nId, sKey, sType, defVal, table)
-- verifico se info nell'oggetto specifico
local info = EgtGetInfo( nId, sKey, sType)
-- altrimenti recupero info dai parametri generali
if info == nil then info = EgtGetInfo( s_nPartId, sKey, sType) end
-- o assegno valore di default
if info == nil then info = defVal end
-- se presente, inserisco l'info nella tabella
if table then table[sKey] = info end
return info
end
--------------------------------------------------------------------
local function GetRibParams( nId)
@@ -171,7 +206,7 @@ local function GetAuxSolidsParams( nId)
end
--------------------------------------------------------------------
local function SlicingExtraObjects( vtSlicing, nLay, nType, sNameGrp, sName, nStmId)
local function SlicingExtraObjects( vtSlicing, nLay, nType, sNameGrp, sName, vErr, nStmId)
-- recupero gli oggeti di cui fare slicing
local vIds = EgtGetAllInGroup( nLay)
@@ -203,7 +238,6 @@ local function SlicingExtraObjects( vtSlicing, nLay, nType, sNameGrp, sName, nSt
if vParams[KEY_SHELL_NBR_DIFF] == 0 then bToBeDone = false end
elseif nType == TYPE.AUX_SOLID then
vParams = GetAuxSolidsParams( vIds[i])
if vParams[KEY_AUX_SOLIDS_INFILL] == INFILL_TYPE.NONE then bToBeDone = false end
end
table.insert( tabParams, vParams)
table.insert( vToBeDone, bToBeDone)
@@ -234,7 +268,8 @@ local function SlicingExtraObjects( vtSlicing, nLay, nType, sNameGrp, sName, nSt
-- recupero quota per slicing
local dZ = EgtGetInfo( nLayId, KEY_SLICE_REAL_Z, 'd')
local dDeltaZ = EgtGetInfo( nLayId, KEY_SLICE_DELTAZ, 'd')
-- creo gruppo per le costolature
local nLayCnt = EgtGetInfo( nLayId, KEY_SLICE_NBR, 'i')
-- creo gruppo per gli oggetti
local nGrp = EgtGroup( nLayId)
EgtSetName( nGrp, sNameGrp)
EgtSetStatus( nGrp, GDB_ST.OFF)
@@ -257,6 +292,7 @@ local function SlicingExtraObjects( vtSlicing, nLay, nType, sNameGrp, sName, nSt
end
if nSrfCnt > 0 or bOpen then
EgtOutLog( 'Warning : recalc at layer '.. EgtNumToString( nLayCnt) .. ' (object)')
-- elimino vecchio risultato
for j = nNewId, nNewId + nPntCnt + nCrvCnt + nSrfCnt - 1 do
EgtErase( j)
@@ -266,18 +302,34 @@ local function SlicingExtraObjects( vtSlicing, nLay, nType, sNameGrp, sName, nSt
end
if nNewId then
-- rimuovo punti
for nId = nNewId, nNewId + nPntCnt -1 do
EgtErase( nId)
end
-- concateno le curve
local vChain = {}
for nId = nNewId + nPntCnt, nNewId + nPntCnt + nCrvCnt - 1 do
table.insert( vChain, nId)
end
local nChainId, nCnt = EgtCurveCompoByChain( nGrp, vChain, ORIG(), true, GDB_RT.LOC, BIG_TOLER)
-- rinomino le curve, correggo di DeltaZ e assegno parametri
for nId = nNewId + nPntCnt, nNewId + nPntCnt + nCrvCnt - 1 do
EgtSetName( nId, sName .. tostring( i))
EgtMove( nId, - ( dDeltaZ + dCorr) * vtSlicing)
EgtSetInfo( nId, KEY_ORIGINAL_SURF, vIds[i])
for sKey, sVal in pairs( tabParams[i]) do
EgtSetInfo( nId, sKey, sVal)
end
-- se ho ancora curve aperte, segnalo errore
if nType ~= TYPE.RIB and not EgtCurveIsClosed( nId) then
EgtOutLog( 'Error : hole in object (layer '.. EgtNumToString( nLayCnt) ..') - CalcSlices')
table.insert( vErr, nLayCnt)
end
end
-- rimuovo superfici
for nId = nNewId + nPntCnt + nCrvCnt, nNewId + nPntCnt + nCrvCnt + nSrfCnt - 1 do
EgtErase( nId)
@@ -337,7 +389,7 @@ local function SlicingNoSolid( nRibsLay, vZSlices, dDeltaZStart, dZmin, frSlicin
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + 20, 0) == 1 then return false end
-- slicing dei setti
SlicingExtraObjects( vtSlicing, nRibsLay, TYPE.RIB, RIBS_GRP, RIBS_CRV)
SlicingExtraObjects( vtSlicing, nRibsLay, TYPE.RIB, RIBS_GRP, RIBS_CRV, vErr)
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + 100, 0) == 1 then return false end
return true
@@ -345,13 +397,6 @@ end
---------------------------------------------------------------------
local function SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicing, vErr)
-- costanti
local TOLER = 0.05
local MID_TOLER = 0.1
local BIG_TOLER = 2.0
local MIN_LEN = 20.0
local MIN_AREA = 25.0
local vtSlicing = frSlicing:getVersZ()
@@ -395,7 +440,7 @@ local function SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicin
dDeltaZ = dDeltaZ + EgtIf( vtRecalc and vtRecalc:getZ() > 0, -0.01, 0.01)
-- eseguo il ricalcolo solo a quella quota
EgtPlaneSurfTmInters( ORIG() + ( dPosZ + dDeltaZ) * vtSlicing, vtSlicing, nStmId, nLayId, GDB_RT.GLOB, TOLER)
EgtOutLog( 'Warning : Recalc at Lay'.. EgtNumToString( nLayCnt))
EgtOutLog( 'Warning : recalc at layer '.. EgtNumToString( nLayCnt))
end
EgtSetInfo( nLayId, KEY_SLICE_DELTAZ, dDeltaZ)
@@ -586,6 +631,7 @@ local function SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicin
-- se vero errore lo segnalo
if bErr then
EgtOutLog( 'Error : hole in solid (layer '.. EgtNumToString( nLayCnt) ..') - CalcSlices')
table.insert( vErr, nLayCnt)
-- cambio nome al layer
EgtSetName( nLayId, '__' .. SLICE_LAYER .. EgtNumToString( nLayCnt))
@@ -617,14 +663,15 @@ local function SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicin
-- costolature
local nRibsLay = EgtGetFirstNameInGroup( s_nPartId, LAY_RIBS)
if nRibsLay then
SlicingExtraObjects( vtSlicing, nRibsLay, TYPE.RIB, RIBS_GRP, RIBS_CRV, nStmId)
ExtractRibsLoops( nRibsLay, nStmId)
SlicingExtraObjects( vtSlicing, nRibsLay, TYPE.RIB, RIBS_GRP, RIBS_CRV, vErr, nStmId)
end
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + ( #vZSlices + 1) / ( #vZSlices + 3) * 100, 0) == 1 then return false end
-- solidi per regioni con diverso numero di passate
local nShellNbrLay = EgtGetFirstNameInGroup( s_nPartId, LAY_SHELL_NBR)
if nShellNbrLay then
SlicingExtraObjects( vtSlicing, nShellNbrLay, TYPE.EXTRA_SHELL, SHELL_NBR_GRP, SHELL_NBR_CRV, nStmId)
SlicingExtraObjects( vtSlicing, nShellNbrLay, TYPE.EXTRA_SHELL, SHELL_NBR_GRP, SHELL_NBR_CRV, vErr, nStmId)
end
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + ( #vZSlices + 2) / ( #vZSlices + 3) * 100, 0) == 1 then return false end
@@ -632,7 +679,7 @@ local function SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicin
local nAuxSolidsLay = EgtGetFirstNameInGroup( s_nPartId, LAY_AUX_SOLIDS)
if nAuxSolidsLay then
AdjustAuxSolids( nAuxSolidsLay)
SlicingExtraObjects( vtSlicing, nAuxSolidsLay, TYPE.AUX_SOLID, AUX_SOLIDS_GRP, AUX_SOLIDS_CRV, nStmId)
SlicingExtraObjects( vtSlicing, nAuxSolidsLay, TYPE.AUX_SOLID, AUX_SOLIDS_GRP, AUX_SOLIDS_CRV, vErr, nStmId)
end
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + ( #vZSlices + 3) / ( #vZSlices + 3) * 100, 0) == 1 then return false end
end
+27 -15
View File
@@ -349,18 +349,25 @@ local function AddRetraction( nCrvId, vtSlicing, dCoastingLen, dWipeLen, dWipeDi
nCopyId = nil
EgtTrimCurveEndAtLen( nWipeId, dWipeLen)
else
-- se extra shell, infill a zigzag, spiral vase o rib che non termina sulla parete
local vtDir = EgtEV( nCoastingId or nCrvId, GDB_ID.ROOT)
local dAng = dWipeDir + s_nDefaultWipeAng
-- verifico se necessario cambiare il segno all'angolo
local bChangeSign = false
-- riempimento
if nType == TYPE.INFILL or nType == TYPE.AUX_SOLID then
local vtS = EgtGetInfo( nCrvId, KEY_ZIG_ZAG_DIR, 'v')
local bSameDir = AreSameVectorApprox( vtS, vtDir)
bChangeSign = ( bInverted == bSameDir)
else
-- rib
elseif nType == TYPE.RIB then
local bInvertStrandOrder = EgtGetInfo( nCrvId, KEY_RIBS_INVERT_STRAND_ORDER, 'b') or false
local bInvertDir = EgtGetInfo( nCrvId, KEY_RIBS_INVERT_DIR, 'b') or false
bChangeSign = ( bInvertDir ~= bInvertStrandOrder)
-- extra shell
elseif nType == TYPE.EXTRA_SHELL or nType == TYPE.EXTRA_OUTER_SHELL then
bChangeSign = bInverted
end
vtDir:rotate( vtSlicing, EgtIf( bChangeSign, - dAng, dAng))
local ptS = EgtEP( nCoastingId or nCrvId, GDB_ID.ROOT)
local ptE = FindWipeEndPoint( ptS, vtDir, dWipeLen, vtSlicing)
@@ -763,26 +770,31 @@ local function VerifyRibsLead( nId, nRibId, dStrand, bInVsOut, nGrpTmp)
-- recupero il lead in
local nPrev = EgtGetPrev( nRibId)
if nPrev and EgtGetName( nPrev) == LEAD_IN_CRV then
local nSrfTot = EgtSurfFrFatCurve( EgtGetParent( nLeadId), nPrev, 0.5 * dStrand, false)
if nSrfTot then
local nRes = EgtCurveWithRegionClassify( nLeadId, nSrfTot)
if nRes == GDB_CRC.IN or nRes == GDB_CRC.INTERS then
EgtErase( nSrfTot)
EgtErase( nLeadId)
return false
end
else
nSrfTot = EgtSurfFrFatCurve( EgtGetParent( nLeadId), nLeadId, 0.5 * dStrand, false)
-- il caso critico è quando hanno direzioni opposte
local vtSPrev = EgtSV( nPrev, GDB_ID.ROOT)
local vtSCurr = EgtSV( nLeadId, GDB_ID.ROOT)
if AreOppositeVectorApprox( vtSPrev, vtSCurr) then
local nSrfTot = EgtSurfFrFatCurve( EgtGetParent( nLeadId), nPrev, 0.5 * dStrand, false)
if nSrfTot then
local nRes = EgtCurveWithRegionClassify( nPrev, nSrfTot)
local nRes = EgtCurveWithRegionClassify( nLeadId, nSrfTot)
if nRes == GDB_CRC.IN or nRes == GDB_CRC.INTERS then
EgtErase( nSrfTot)
EgtErase( nLeadId)
return false
end
else
nSrfTot = EgtSurfFrFatCurve( EgtGetParent( nLeadId), nLeadId, 0.5 * dStrand, false)
if nSrfTot then
local nRes = EgtCurveWithRegionClassify( nPrev, nSrfTot)
if nRes == GDB_CRC.IN or nRes == GDB_CRC.INTERS then
EgtErase( nSrfTot)
EgtErase( nLeadId)
return false
end
end
end
EgtErase( nSrfTot)
end
EgtErase( nSrfTot)
end
end
@@ -1038,7 +1050,7 @@ local function CalcRibsToolPath( vEntIds, nRibsGrp, nTpathGrpId, LayerParams)
else
local bLoopRib = EgtGetInfo( tabRibs[i][1], KEY_LOOP_RIB, 'b') or false
for j = 1, #tabRibs[i] - 1 do
local bUserLink = EgtGetInfo( tabRibs[i][j], KEY_RIBS_USER_LINK, 'b') or false
local bUserLink = ( EgtGetInfo( tabRibs[i][j], KEY_RIBS_USER_LINK, 'b') or false) and ( EgtGetInfo( tabRibs[i][j+1], KEY_RIBS_USER_LINK, 'b') or false)
local nOrig1 = EgtGetInfo( tabRibs[i][j], KEY_ORIGINAL_RIB, 'i') or 0
local nOrig2 = EgtGetInfo( tabRibs[i][j + 1], KEY_ORIGINAL_RIB, 'i') or 0
local nSplitId1 = EgtGetInfo( tabRibs[i][j], KEY_SPLIT_ID, 'i') or 0
+2 -2
View File
@@ -1,4 +1,4 @@
-- RunGcodeGenerate.lua by Egaltech s.r.l. 2023/02/02
-- RunGcodeGenerate.lua by Egaltech s.r.l. 2023/04/11
-- Calcoli prima fase per Stampa 3d
-- Tabella per definizione modulo
@@ -131,7 +131,7 @@ function RunGcodeGenerate.Exec()
-- Salvo il progetto
local sFilePath = EgtGetCurrFilePath()
sFilePath = EgtChangePathExtension( sFilePath, 'nge')
sFilePath = EgtChangePathExtension( sFilePath, 'icrs')
EgtSetCurrFilePath( sFilePath)
EgtSaveFile()
+6
View File
@@ -66,6 +66,12 @@ local function RemoveOldSlices( nPartId)
EgtErase( vOldSliceId[i])
end
end
-- rimuovo gruppo con i loop dei setti
local nRibsLoopsGrp = EgtGetFirstNameInGroup( nPartId, RIBS_LOOP_GRP)
if nRibsLoopsGrp then
EgtErase( nRibsLoopsGrp)
end
end
---------------------------------------------------------------------
+1 -1
View File
@@ -1,4 +1,4 @@
-- Version.lua by Egaltech s.r.l. 2023/02/28
-- Gestione della versione di 3dPrinting
VERSION = '2.5c2'
VERSION = '2.5d4'