Compare commits

...

107 Commits

Author SHA1 Message Date
SaraP a595fcdb98 3dPrinting :
- corretto collegamento fra ribs esterni che passa sotto il solido.
2023-08-30 09:52:28 +02:00
Dario Sassi 43949d7f13 3dPrinting 2.5h1 :
- aggiunta direzione su estrusioni a 45deg in X e Y (X+/- e Y+/-).
2023-08-28 19:52:40 +02:00
SaraP 00700f3194 3dPrinting :
- lettura di HMax per slicing dai parametri
- correzione slicing filled solids.
2023-08-25 09:25:14 +02:00
SaraP 28686fe6b6 3dPrinting :
- introdotta info con numero totale di layers.
2023-08-09 17:34:16 +02:00
SaraP 4a4a7d648b 3dPrinting :
- aggiunta chiusura dei percorsi di extra shell
- aggiunto clamp sui valori di strand width.
2023-07-20 12:44:32 +02:00
SaraP 03c1768afe 3dPrinting 2.5g1 :
- aggiunto numero di passate per Filled Solids.
2023-07-03 10:23:37 +02:00
SaraP ba9470ee88 3dPrinting :
- aggiunto collegamento infill.
2023-06-30 12:52:39 +02:00
SaraP e629f1b12d 3dPrinting 2.5f2 :
- gestione strand variabili per entità.
2023-06-21 09:21:17 +02:00
SaraP 451f3a2939 3dPrinting 2.5f1 :
- correzioni infill
- aggiornamento versione.
2023-06-15 10:17:29 +02:00
SaraP bc3cf3b3a9 3dPrinting :
- corretto errore reduced shell number di area nulla.
2023-06-08 10:34:42 +02:00
SaraP 4225985a61 3dPrinting :
- aggiunta approssimazione delle curve dopo slicing ( per evitare caso di fallimento offset)
- migliorata segnalazione errori.
2023-06-06 17:11:09 +02:00
SaraP fcd61efd53 3dPrinting :
- piccole correzioni nei setti per evitare interruzione calcolo.
2023-06-01 17:31:43 +02:00
SaraP 01711d2925 3dPrinting 2.5e3 :
- infill prima versione ( lineari, griglia, zigzag, nido d'ape)
- aggiunto riempimento ad infill anche nei solidi ausiliari
- migliorie varie nella gestione dei riempimenti pieni
- migliorie nei link e in StartPointOffsetOnLayer.
2023-05-26 15:20:27 +02:00
SaraP e015136592 3dPrinting 2.5e2 ;
- corretto errore nel lead in/lead out dei setti quando terminano su altro setto
- migliorie varie per lead in, lead out e link dei setti.
2023-05-24 08:26:27 +02:00
SaraP 72d1b61c6a 3dPrinting 2.5d5 :
- corretto errore nel trim dei setti.
2023-04-28 14:38:45 +02:00
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
Samuele Locatelli 90a8b558b9 fix script netuse 2023-03-20 12:45:43 +01:00
Samuele Locatelli eca66a82bf typo 2023-03-20 12:44:41 +01:00
Samuele Locatelli 82f61af2a3 sintassi alternativa x net share 2023-03-20 12:43:48 +01:00
Samuele Locatelli 2914862a15 aggiunto escape nel path 2023-03-20 12:41:23 +01:00
Samuele Locatelli 7d026726d6 test develop compile 2023-03-20 12:30:31 +01:00
Samuele Locatelli 439d48b380 update yaml gestione interfacce di rete 2023-03-20 12:29:56 +01:00
Samuele Locatelli e45cbf1f3d Merge branch 'main' into develop 2023-03-20 12:16:10 +01:00
SaraP 046431a2a9 3dPrinting :
- corretta la gestione delle uscite per setti chiusi con link disegnato dall'utente.
2023-03-20 11:49:15 +01:00
SaraP 3745705b3d 3dPrinting :
- corretto errore nel trim dei ribs.
2023-03-16 14:54:56 +01:00
SaraP 1da71888e7 3dPrinting :
- corretto il calcolo della correzione in z per appoggiare sulla tavola/bancaletto.
2023-03-13 10:56:56 +01:00
SaraP 862216b84f 3dPrinting 2.5c2 :
- aggiunto taglio dei ribs unbounded con solido se richiesto.
2023-03-06 14:54:19 +01:00
Emmanuele Sassi 25fb2b6b37 - gestito conto separato lunghezza percorso per calcolo massa totale oggetto 2023-03-03 13:13:08 +01:00
SaraP 921b8e2ef2 3dPrinting 2.5c1 :
- aggiunto flag per decidere se limitare ribs unbounded con solido.
2023-03-01 15:04:03 +01:00
SaraP 9e1588b386 3dPrinting 2.5b3 :
- aggiunto Version.lua.
2023-02-28 08:31:08 +01:00
SaraP 3a1dcbb822 3dPrinting :
- gestita interruzione degli script.
2023-02-16 10:27:46 +01:00
SaraP 31f27d66c1 3dPrinting :
- aggiunte le diverse tipologie di ribs nell'ordinamento degli elementi di stampa.
2023-02-15 14:39:47 +01:00
SaraP df0cb0dfa3 3dPrinting :
- aggiunte le costanti per le tipologie di setti in PRINT_ELEMENT.
2023-02-14 09:42:43 +01:00
SaraP 4916da48f9 3dPrinting :
- modificato calcolo della correzione in z per appoggiare correttamente sulla tavola
- correzione quote di slicing per includere setti esterni e unbounded.
2023-02-10 10:36:20 +01:00
DarioS 26acf572fc Merge branch 'main' of https://gitlab.steamware.net/egalware/3dPrinting 2023-02-02 11:55:06 +01:00
DarioS 412d1b15b5 3dPrinting :
- in generazione CN aggiunta restituzione stringa di errore (PRINT.MSG).
2023-02-02 11:54:43 +01:00
SaraP 4e85ebda3d 3dPrinting :
- piccole migliorie nei setti.
2023-02-02 11:16:10 +01:00
DarioS b020c855e3 3dPrinting :
- correzione errore nei setti.
2023-02-02 09:21:22 +01:00
SaraP 6117583a79 3dPrinting :
- aggiunto offset lead point anche per shell interne quando non ci sono collegamenti.
2023-02-01 11:03:24 +01:00
SaraP 9f5c2523e0 3dPrinting :
- modifiche per nuova definizione di EgtCurveCurveInters.
2023-02-01 09:36:43 +01:00
SaraP ee59b4ac74 3dPrinting :
- modifiche nei setti per conservare i link disegnati dall'utente ( prima versione)
- aggiunti ingressi/uscite per setti che non iniziano/terminano su shell.
2023-01-31 15:35:08 +01:00
SaraP 303bc59ddd 3dPrinting :
- aggiunto controllo sulla direzione della normale delle superfici ottenute dallo slicing.
2023-01-27 16:14:59 +01:00
DarioS 0a08957c55 Merge branch 'main' of https://gitlab.steamware.net/egalware/3dPrinting 2023-01-26 11:04:32 +01:00
DarioS ba1c7b7657 3dPrinting :
- corretta direzione estrusione dei Link nei setti.
2023-01-26 11:03:12 +01:00
SaraP 550365322a 3dPrinting :
- aggiunto StartPointOffsetOnLayer per setti chiusi.
2023-01-12 17:43:06 +01:00
DarioS 98e69f098d 3dPrinting :
- altra correzione a compilazione su git Push.
2023-01-12 09:33:13 +01:00
DarioS 7ff7e6e2e3 3dPrinting :
- correzione a compilazione su git Push.
2023-01-12 09:31:11 +01:00
DarioS 3a8f94f027 3dPrinting :
- eliminati tutti i file non per Icarus (lua e immagini)
- eliminata cartella Images
- compilazione 32 e 64 bit unificata con direttorio destinazione bin.
2023-01-12 09:25:56 +01:00
DarioS 30677a89a4 3dPrinting :
- modifiche per compilazione lua5.4.
2023-01-11 19:50:51 +01:00
DarioS ab39b407e4 Merge branch 'main' of https://gitlab.steamware.net/egalware/3dPrinting 2023-01-11 18:32:01 +01:00
DarioS 7f6ddd699c 3dPrinting :
- nuova compilazione per lua 5.4.
2023-01-11 18:31:35 +01:00
SaraP f050f49b66 3dPrinting :
- ordinamento elementi di stampa
- oridinamento per tipologia di setti.
2023-01-10 08:54:09 +01:00
SaraP 1225625a9a 3dPrinting :
- aggiunta nuova tipologia per setti ( setti di supporto)
- correzioni per setti chiusi nel caso di intersezioni con 2 passate.
2023-01-05 15:16:45 +01:00
SaraP 89a8002205 3dPrinting :
- gestione di offset lead point con valori negativi.
2023-01-04 11:50:04 +01:00
SaraP d576203a97 3dPrinting :
- gestione setti chiusi
- correzioni varie nelle regioni con diverse passate.
2023-01-03 16:36:47 +01:00
DarioS b2cba54453 3dPrinting :
- modifiche per assegnare valori di defualt a nuovi parametri.
2022-12-28 08:49:13 +01:00
Emmanuele Sassi 96a6f32458 - aggiornamento con nuove costanti materiale 2022-12-27 16:34:44 +01:00
Emmanuele Sassi a6a98f7a11 Merge branch 'main' of https://gitlab.steamware.net/egalware/3dprinting 2022-12-27 14:48:12 +01:00
Emmanuele Sassi f9d774a7eb - migliorata gestione wait time 2022-12-27 14:48:09 +01:00
SaraP d7b5d7d16d 3dPrinting :
- corretto rilevamento dell'intersezione fra setti.
2022-12-27 12:21:30 +01:00
DarioS 5e3def88fa 3dPrinting :
- piccola correzione a AddRetraction per evitare crash.
2022-12-20 11:05:16 +01:00
SaraP ef49a211ab 3dPrinting :
- migliorie nel calcolo solidi per spiral vase.
2022-12-16 16:55:40 +01:00
SaraP a7617c2761 3dPrinting :
- corretto errore nel calcolo dei solidi per spiral vase.
2022-12-12 12:34:50 +01:00
DarioS 1f8881a4c3 3dPrinting :
- modifiche a determinazione parametri calcolo MF e SC per Ribs Unbounded.
2022-12-07 12:19:47 +01:00
SaraP 6d03a8e898 3dPrinting :
- corretto errore nelle intersezioni di setti con overlap diversi.
2022-12-06 09:36:48 +01:00
SaraP 313e837f41 3dPrinting :
- modificato ordine di default per realizzazione setti ( unbounded fatti per primi).
2022-12-06 08:43:34 +01:00
DarioS 076e2382ab 3dPrinting :
- piccole modifiche per stampa 45deg su Y e gestione movimento solido conseguente.
2022-12-05 08:22:16 +01:00
SaraP fb9ecc811d 3dPrinting :
- migliorata organizzazione calcolo toolpath.
2022-12-02 11:36:09 +01:00
SaraP 298b0a4506 3dPrinting :
- correzione calcolo toolpath in spiral vase quando sezione varia tra layer.
2022-12-01 11:31:18 +01:00
SaraP 693746d6e3 3dPrinting :
- aggiunto slicing a 45° lungo Y.
2022-11-29 10:21:14 +01:00
SaraP 8622fc8919 3dPrinting :
- migliorata intersezione setti
- aggiunto ordine di realizzazione per tipologie setti.
2022-11-24 16:09:16 +01:00
DarioS 0a78833f61 3dPrinting :
- corretto calcolo TFS quando si estrudono solo i Ribs e non il Pezzo.
2022-11-22 20:01:58 +01:00
DarioS c0230eccf7 3dPrinting :
- tolleranza di approssimazione curve di slicing portata a 0.1 (MID_TOLER).
2022-11-14 09:27:42 +01:00
SaraP 5494e92e9d 3dPrinting :
- aggiunta la possibilità di collegare solo alcuni setti ( prima versione)
- correzioni varie.
2022-11-11 09:57:04 +01:00
SaraP f834d006f6 3dPrinting :
- gestione uscite differenziate per regioni con diverse passate.
2022-11-07 10:09:12 +01:00
SaraP 4d74134671 3dPrinting :
- correzione lead out setti.
2022-11-03 11:11:23 +01:00
SaraP 549f388227 3dPrinting :
- in spiral vase corrette info dell'ultimo layer.
2022-11-03 09:30:00 +01:00
SaraP 15c6563157 3dPrinting :
- in spiral vase corretta gestione primo layer.
2022-11-02 15:46:27 +01:00
DarioS e18e57e7c2 3dPrinting :
- modifiche e migliorie per calcolo solidi con uso della nuova funzione lua EgtSurfTmRectSwept.
2022-11-02 15:19:09 +01:00
SaraP 8e75cf21da 3dPrinting :
- correzione errori nel caso di pezzo ruotato.
2022-10-28 11:50:19 +02:00
DarioS 9c438d11b6 3dPrinting :
- cambiato valore delle costanti SLICING_TYPE.DEG45 = 2 e SLICING_TYPE.HORIZONTAL = 3.
2022-10-28 11:46:56 +02:00
DarioS 781e2d5274 3dPrinting :
- piccole modifiche estetiche
- salvataggio in TFS di MF e TotalArea.
2022-10-27 22:24:37 +02:00
SaraP 213e6ac6ed 3dPrinting :
- aggiunte tipologie per ribs ( interni, esterni, illimitati)
- migliorie per ordinamento ribs.
2022-10-26 16:12:25 +02:00
Emmanuele Sassi aa750ff933 - Cambio formule per costante k passata da unitaria in aggiunta a percentuale totale 2022-10-26 12:28:36 +02:00
Emmanuele Sassi 7ced9ec2f4 - modifiche per assegnazione nome iso da programma 2022-10-24 12:58:26 +02:00
SaraP d875e31491 3dPrinting :
- slicing a 90°.
2022-10-20 17:23:48 +02:00
SaraP 217bb4f26e 3dPrinting :
- aggiunti coasting e wipe sui setti che non arrivano al bordo.
2022-10-14 10:55:20 +02:00
DarioS f05f9c11ae 3dPrinting :
- aggiustamento tolleranze per slicing.
2022-10-12 19:08:11 +02:00
SaraP 7792f22242 3dPrinting :
- spiral vase (prima versione)
- aggiunto controllo sui wipe dei setti.
2022-10-11 16:06:30 +02:00
DarioS 2288078e49 3dPrinting :
- corretta verifica necessità ricalcolo solidi.
2022-10-11 09:46:47 +02:00
Emmanuele Sassi d502770114 - Aggiunta gestione attesa su layer 2022-10-10 16:28:01 +02:00
SaraP a94474869c 3dPrinting :
- modifiche progress bar.
2022-10-03 16:08:25 +02:00
SaraP 5e65055e86 3dPrinting :
- correzioni varie.
2022-10-03 12:07:43 +02:00
DarioS 6b2c1834d2 3dPrinting :
- correzioni per Extra Shell (estrusione su link e visualizzazione toolpath).
2022-10-02 00:39:42 +02:00
SaraP 00c504c58b 3dPrinting :
- correzione errori per regioni con diverse passate.
2022-09-30 15:44:52 +02:00
DarioS 276f8de4f8 3dPrinting :
- correzione a calcolo TFS per layer con errori (nome preceduto da __).
2022-09-30 01:10:52 +02:00
DarioS d1fb754cda 3dPrinting :
- tolleranza di slicing portata a 0.5.
2022-09-29 23:03:32 +02:00
Emmanuele Sassi 6fa13da092 Merge branch 'Feature/Icarus' 2022-09-29 21:25:12 +02:00
48 changed files with 5634 additions and 3510 deletions
+4 -4
View File
@@ -13,9 +13,9 @@
/Debug64
/Release64
/ipch
/bin
/obj
/.vs
/Machinings
/Materials
/bin/*.lua
/bin/*.ini
/bin/LuaLibs/*.lua
/bin/Images/*.png
+26 -65
View File
@@ -2,96 +2,58 @@ variables:
VERS_MAIN: '1.0'
APP_NAME: '3dPrinting'
NEW_REL: ''
NET_SHARE_R: '\\10.74.82.201\EgwTech'
NET_SHARE_X: '\\10.74.82.201\EgwTech'
NET_SHARE_Z: '\\10.74.82.201\Artifacts'
NET_USERQ: 'steamw\egalware'
#Note compilazione LUA:
# lua53 -o 32\$FileName -s $FileName: -o = output, -s = NON include i debug symbols
# lua54 -o bin\$FileName -s $FileName: -o = output, -s = NON include i debug symbols
# helper compilazione LUA a 32 bit
.LuaCompile32: &LuaCompile32
# helper compilazione LUA a 32 e 64 bit
.LuaCompile: &LuaCompile
- |
Set-Alias lua53 C:\Tools\Lua32\luac53
echo "Copia file *.ini"
$FileList = Get-ChildItem("*.ini")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
Copy-Item -Path $FileName -Destination 32\$FileName
echo "Copy-Item -Path $FileName -Destination 32\$FileName"
}
echo "Copia file *.lua"
Set-Alias lua54 C:\Tools\Lua32\luac54
$FileList = Get-ChildItem("*.lua")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
Copy-Item -Path $FileName -Destination 32\$FileName
echo "Copy-Item -Path $FileName -Destination 32\$FileName"
lua54 -o bin\$FileName $FileName
echo "lua54 -o bin\$FileName $FileName"
}
$FileList = Get-ChildItem("LuaLibs\*.lua")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
lua53 -o 32\LuaLibs\$FileName LuaLibs\$FileName
echo "lua53 -o 32\LuaLibs\$FileName LuaLibs\$FileName"
lua54 -o bin\LuaLibs\$FileName LuaLibs\$FileName
echo "lua54 -o bin\LuaLibs\$FileName LuaLibs\$FileName"
}
# helper compilazione LUA a 64 bit
.LuaCompile64: &LuaCompile64
- |
Set-Alias lua53 C:\Tools\Lua64\luac53
echo "Copia file *.ini"
$FileList = Get-ChildItem("*.ini")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
Copy-Item -Path $FileName -Destination 64\$FileName
echo "Copy-Item -Path $FileName -Destination 64\$FileName"
}
echo "Copia file *.lua"
$FileList = Get-ChildItem("*.lua")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
Copy-Item -Path $FileName -Destination 64\$FileName
echo "Copy-Item -Path $FileName -Destination 64\$FileName"
}
$FileList = Get-ChildItem("LuaLibs\*.lua")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
lua53 -o 64\LuaLibs\$FileName LuaLibs\$FileName
echo "lua53 -o 64\LuaLibs\$FileName LuaLibs\$FileName"
}
# Copy-Item -Path $FileName -Destination 64\$FileName
# echo "Copy-Item -Path $FileName -Destination 64\$FileName"
# helper copia SORGENTI verso cartella di rete R:\ dei SORGENTI
.CodeReplicaR: &CodeReplicaR
- |
net use R: /delete
net use R: $env:NET_SHARE_R /u:$env:NET_USERQ $ZDRIVE_PASSWD
ROBOCOPY . R:\EgtData\$env:APP_NAME /MIR /XF .git* /XD .git
net use X: /delete
SLEEP 2
net use R: /delete
net use X: $env:NET_SHARE_X /u:$env:NET_USERQ $ZDRIVE_PASSWD
ROBOCOPY . X:\EgtData\$env:APP_NAME\ /MIR /XF .git* /XD .git
SLEEP 2
net use X: /delete
# helper copia script verso cartella di rete R:\ delle cartelle 32 e 64
# helper copia script verso cartella di rete R:\ delle cartelle bin
.ReplicaR: &ReplicaR
- |
net use R: /delete
net use R: $env:NET_SHARE_R /u:$env:NET_USERQ $ZDRIVE_PASSWD
ROBOCOPY /MIR 32 R:\EgtData\$env:APP_NAME\32
ROBOCOPY /MIR 64 R:\EgtData\$env:APP_NAME\64
ROBOCOPY /MIR Images R:\EgtData\$env:APP_NAME\32\Images
ROBOCOPY /MIR Images R:\EgtData\$env:APP_NAME\64\Images
net use X: /delete
SLEEP 2
net use R: /delete
net use X: $env:NET_SHARE_X /u:$env:NET_USERQ $ZDRIVE_PASSWD
ROBOCOPY /MIR bin X:\EgtData\$env:APP_NAME\bin
SLEEP 2
net use X: /delete
# helper copia script verso cartella di rete R:\ delle cartelle 32 e 64
# helper copia script verso cartella di rete Z:\ delle cartelle bin
.ReplicaZ: &ReplicaZ
- |
net use Z: /delete
SLEEP 2
net use Z: $env:NET_SHARE_Z /u:$env:NET_USERQ $ZDRIVE_PASSWD
ROBOCOPY /MIR 32 Z:\EgtData\$env:APP_NAME\32
ROBOCOPY /MIR 64 Z:\EgtData\$env:APP_NAME\64
ROBOCOPY /MIR Images Z:\EgtData\$env:APP_NAME\32\Images
ROBOCOPY /MIR Images Z:\EgtData\$env:APP_NAME\64\Images
ROBOCOPY /MIR bin Z:\EgtData\$env:APP_NAME\bin
SLEEP 2
net use Z: /delete
@@ -103,12 +65,11 @@ LuaCompile:build:
only:
- main
- master
- develop
tags:
- win
script:
- *LuaCompile32
- *LuaCompile64
- *LuaCompile
- *CodeReplicaR
- *ReplicaR
- *ReplicaZ
# - *ReplicaZ
View File
-16
View File
@@ -1,16 +0,0 @@
[3dPrinting]
Enable=1
BaseDir=C:\EgtData\3dPrinting
Button1=PartPositioning.lua,Images\PartPositioning.png,Disponi pezzo sulla tavola macchina
Button2=Slicing.lua,Images\Slicing.png,Calcola lo slicing, i solidi e i percorsi utensile
Button3=MachiningParamCalc.lua,Images\MachiningParamCalc.png,Calcola parametri di lavorazione (Tempo layer, F, S)
Button4=GcodeGenerate.lua,Images\GcodeGenerate.png,Genera codice CN
Button5=ShowManager.lua,Images\ShowManager.png,Gestore visualizzazione
Button6=ViewManager.lua,Images\ViewManager.png,Nascondi Visualizza strato
Button7=SliceAdvancement.lua,Images\SliceAdvancement.png,Mostra avanzamento strato
Button8=SlicePalette.lua,Images\SlicePalette.png,Gestore colori strato
Button9=MachiningParamEdit.lua,Images\MachiningParamEdit.png,Edita i parametri di stampa
Button10=MaterialParamEdit.lua,Images\MaterialParamEdit.png,Edita i parametri del materiale
ParamFile=C:\EgtData\3dPrinting\Machinings\Params.ini
ResultReadProg="C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE"
MachiningEditProg="C:\Windows\System32\notepad.exe"
View File
View File
+2 -3
View File
@@ -1,4 +1,4 @@
-- CalcMachParamFromSW.lua by Egaltech s.r.l. 2022/09/15
-- CalcMachParamFromSW.lua by Egaltech s.r.l. 2023/01/11
-- Calcolo dei parametri di stampa
-- Intestazioni
@@ -7,8 +7,7 @@ _ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Stampa 3d
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
EgtAddToPackagePath( PRINT.BASEDIR .. '\\LuaLibs\\?.lua')
-- Librerie
_G.package.loaded.RunMachParamFromSWCalc = nil
+2 -3
View File
@@ -1,4 +1,4 @@
-- CalcSolids.lua by Egaltech s.r.l. 2022/09/26
-- CalcSolids.lua by Egaltech s.r.l. 2023/01/11
-- Calcola i solidi a partire dallo slicing
-- Intestazioni
@@ -7,8 +7,7 @@ _ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Stampa 3d
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
EgtAddToPackagePath( PRINT.BASEDIR .. '\\LuaLibs\\?.lua')
-- Librerie
_G.package.loaded.RunCalcSolids = nil
+19
View File
@@ -0,0 +1,19 @@
REM Compilazione degli script 3dPrinting Egaltech 2023.01.11
REM Per togliere info di debug aggiungere flag -s prima del nome del file di input
REM Compilazione 32 e 64 bit
\EgtProg\Dll32\luac54 -o bin\LuaLibs\AddManData.lua LuaLibs\AddManData.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\CalcPaths.lua LuaLibs\CalcPaths.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\CalcSlices.lua LuaLibs\CalcSlices.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\CalcToolPath.lua LuaLibs\CalcToolPath.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\RunCalcSolids.lua LuaLibs\RunCalcSolids.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\RunGcodeGenerate.lua LuaLibs\RunGcodeGenerate.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\RunMachParamFromSWCalc.lua LuaLibs\RunMachParamFromSWCalc.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\RunSlicing.lua LuaLibs\RunSlicing.lua
\EgtProg\Dll32\luac54 -o bin\CalcMachParamFromSW.lua CalcMachParamFromSW.lua
\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
+2 -3
View File
@@ -1,4 +1,4 @@
-- GcodeGenerate.lua by Egaltech s.r.l. 2022/04/11
-- GcodeGenerate.lua by Egaltech s.r.l. 2023/01/11
-- Calcoli prima fase per Stampa 3d
-- Intestazioni
@@ -7,8 +7,7 @@ _ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Stampa 3d
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
EgtAddToPackagePath( PRINT.BASEDIR .. '\\LuaLibs\\?.lua')
-- Librerie
_G.package.loaded.RunGcodeGenerate = nil
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 809 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 913 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 919 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 467 B

+132 -20
View File
@@ -24,36 +24,39 @@ COASTING_CRV = "Coasting"
WIPE_CRV = "Wipe"
LEAD_IN_CRV = "LeadIn"
LEAD_OUT_CRV = "LeadOut"
LINK_CRV = "Link"
FRAME_PART = "FramePart"
START_GEOM = "Start"
TOT_SHELL_TRIM_SURF = "TotalShellSurfForTrim"
TRIM_SURF_LOOP = "TrimSurfLoop"
SURF_LOOP = "SurfLoop"
MIN_LEN = 0.1
MIN_AREA = 0.01
MIN_RIBS_LEN = 2
MIN_INFILL_LEN = 2
-- Parametri di lavorazione
SEC_DEFAULT = "Default"
KEY_PARAMS = "Params"
KEY_CALC_SOLIDS = "CalcSolids"
KEY_SLICING_45 = "Slicing45"
KEY_SLICING_DIR="SlicingDir"
KEY_SPIRAL_VASE = "SpiralVase"
KEY_SLICING_TYPE = "SlicingType"
KEY_SLICING_DIR = "SlicingDir"
KEY_SLICE_STEP = "StrandH"
KEY_SHELLS_NBR = "StrandCount"
KEY_STRAND = "StrandW"
KEY_INNER_STRAND = "InnerStrandW"
KEY_STRAND_OVERLAP = "StrandOverlap"
KEY_OFFSET_SLICE ="Offset"
KEY_OFFSET_SLICE = "Offset"
KEY_SP_OFFSET_ON_SLICE = "StartPointOffsetOnSlice"
KEY_PRINT_ORDER = "StrandOrder"
KEY_STRAND_ORDER = "StrandOrder"
KEY_PRINT_ORDER = "PrintOrder"
KEY_PRINT_DIRECTION = "Direction"
KEY_TYPE = "Type"
KEY_LINK_TYPE = "LinkType"
KEY_LINK_PARAM = "LinkParam"
KEY_LINK_ZUP = "LinkZup"
KEY_FLOOR_NBR = "FloorCount"
KEY_FLOOR_TYPE = "FloorType"
KEY_CEIL_NBR = "CeilCount"
KEY_CEIL_TYPE = "CeilType"
KEY_SPEED = "Speed"
KEY_FEED = "Feed"
KEY_EXT_FEED = "ExtFeed"
@@ -74,10 +77,35 @@ KEY_OFFSET_LEAD_POINT = "OffsetLeadPoint"
KEY_COASTING_LEN = "CoastingLen"
KEY_COASTING_FEED = "CoastingFeed"
KEY_WIPE_LEN = "WipeLen"
KEY_WIPE_DIR = "WipeDir"
KEY_WIPE_FEEDPU = "WipeFeedPu"
KEY_TOOL_DIAM = "ToolDiam"
KEY_TOOL_DIAM = "ToolDiam"
-- Solid Fill
KEY_FLOOR_NBR = "FloorCount"
KEY_FLOOR_TYPE = "FloorType"
KEY_CEIL_NBR = "CeilCount"
KEY_CEIL_TYPE = "CeilType"
KEY_FILL_TYPE = "FillType"
-- Infill
KEY_INFILL_STRAND = "InfillStrandW"
KEY_INFILL_TYPE = "InfillType"
KEY_INFILL_DENSITY = "InfillDensity"
KEY_INFILL_LINK = "InfillLink"
KEY_INFILL_OVERLAP = "InfillOverlap"
KEY_INFILL_GRID_OVERLAP = "InfillGridOverlap"
KEY_INFILL_DIR = "InfillDirection"
KEY_INFILL_OFFSET_X = "InfillOffsetX"
KEY_INFILL_OFFSET_Y = "InfillOffsetY"
KEY_INFILL_COASTING = "InfillCoasting"
KEY_INFILL_WIPE = "InfillWipe"
KEY_INFILL_WIPE_DIR = "InfillWipeDir"
-- Ribs
KEY_RIBS_STRAND = "RibsStrandW"
KEY_RIBS_TYPE = "RibsType"
KEY_LIMIT_UNBDD_RIBS = "LimitUnboundedRibsWithSolid"
KEY_RIBS_OVERLAP = "RibsOverlap"
KEY_RIBS_SHELLS_NBR = "RibsStrandCount"
KEY_RIBS_LINK = "RibsLink"
@@ -91,22 +119,47 @@ KEY_RIBS_LEAD_OUT_COASTING = "RibsLeadOutCoasting"
KEY_RIBS_LEAD_OUT_WIPE = "RibsLeadOutWipe"
KEY_RIBS_LEAD_OUT_WIPE_DIR = "RibsLeadOutWipeDir"
KEY_RIBS_INTERS = "RibsHaveIntersections"
KEY_SPLIT_RIB = "SplitRib"
KEY_RIBS_TWO_STRANDS = "RibsHaveAll2Strands"
KEY_RIBS_SPECIAL_CASE = "RibsSpecialCase"
KEY_SPLIT_ORDER = "SplitOrder"
KEY_SPLIT_AFTER_TRIM = "RibsSplitAfterTrim"
KEY_SPLIT_AFTER_TRIM_ORDER = "RibsSplitAfterTrimOrder"
KEY_SPLIT_AFTER_TRIM_TOT = "RibsSplitAfterTrimTot"
KEY_SPLIT_ID = "SplitId"
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"
KEY_RIBS_INVERT_STRAND_ORDER = "RibsInvertStrandOrder"
-- Regioni con diverso numero di passate
KEY_SHELL_NBR_DIFF = "ShellNbrDifference"
KEY_SHELL_NBR_COASTING = "ShellNbrCoasting"
KEY_SHELL_NBR_WIPE = "ShellNbrWipe"
KEY_SHELL_NBR_WIPE_DIR = "ShellNbrWipeDir"
KEY_EXTRA_SHELL_COASTING = "ExtraShellCoasting"
KEY_EXTRA_SHELL_WIPE = "ExtraShellWipe"
KEY_EXTRA_SHELL_WIPE_DIR = "ExtraShellWipeDir"
-- Solidi ausiliari
KEY_AUX_SOLIDS_STRAND = "AuxSolidsStrandW"
KEY_AUX_SOLIDS_SHELLS_NBR = "AuxSolidsStrandCount"
KEY_AUX_SOLIDS_OVERLAP = "AuxSolidsOverlap"
KEY_AUX_SOLIDS_INFILL = "AuxSolidsInfill"
KEY_AUX_SOLIDS_PRINT_ORDER = "AuxSolidsStrandOrder"
KEY_AUX_SOLIDS_OVERLAP = "AuxSolidsOverlap"
KEY_AUX_SOLIDS_LINK_TYPE = "AuxSolidsLinkType"
KEY_AUX_SOLIDS_SP_OFFSET = "AuxSolidsStartPointOffsetOnSlice"
KEY_AUX_SOLIDS_LINK_PARAM = "AuxSolidsLinkParam"
KEY_AUX_SOLIDS_SP_OFFSET = "AuxSolidsStartPointOffsetOnSlice"
KEY_AUX_SOLIDS_LP_OFFSET = "AuxSolidsOffsetLeadPoint"
KEY_AUX_SOLIDS_INFILL_LINK = "AuxSolidsInfillLink"
KEY_AUX_SOLIDS_DENSITY = "AuxSolidsDensity"
KEY_AUX_SOLIDS_DIR = "AuxSolidsDirection"
KEY_AUX_SOLIDS_OFFSET_X = "AuxSolidsOffsetX"
KEY_AUX_SOLIDS_OFFSET_Y = "AuxSolidsOffsetY"
KEY_AUX_SOLIDS_GRID_OVERLAP = "AuxSolidsGridOverlap"
KEY_AUX_SOLIDS_COASTING_LEN = "AuxSolidsCoastingLen"
KEY_AUX_SOLIDS_WIPE_LEN = "AuxSolidsWipeLen"
KEY_AUX_SOLIDS_WIPE_DIR = "AuxSolidsWipeDir"
@@ -119,6 +172,7 @@ KEY_SPEED_MIN = "SpeedMin"
KEY_SPEED_MAX = "SpeedMax"
-- Altre chiavi
KEY_MAX_H = "SlicingHeight"
KEY_SLICE_NBR = "SliceNbr"
KEY_SLICE_Z = "SliceZ"
KEY_SLICE_DELTAZ = "DeltaZ"
@@ -128,7 +182,27 @@ KEY_ZIG_ZAG_DIR = "ZigZagDir"
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_ORIGINAL_START_POINT = "OriginalStartPoint"
KEY_FIRST_SOLID_LAY = "FirstSolidLay"
KEY_LAST_SOLID_LAY = "LastSolidLay"
KEY_ASSOCIATED_TP_CRV = "AssociatedToolPathCrv"
KEY_ASSOCIATED_P_CRV = "AssociatedPathCrv"
KEY_INTERNAL_SRF_LOOP = "InternalSrfLoop"
KEY_PREV_CRV = "PrevCrv"
KEY_NEXT_CRVS = "NextCrvs"
KEY_CRV_STRAND = "CurveStrand"
KEY_LAYER_CNT = "LayerCnt"
SLICING_TYPE = {
VERTICAL = 1,
DEG45_X = 2,
DEG45_Y = 3,
HORIZONTAL = 4,
}
TYPE = {
OUTER_SHELL = 1,
@@ -143,9 +217,20 @@ TYPE = {
AUX_SOLID = 10,
}
PRINT_ELEMENT = {
SHELL = 1,
EXTRA_SHELL = 2,
INFILL = 3,
AUX_SOLID = 4,
RIB_UNBOUNDED = 5,
RIB_EXTERNAL = 6,
RIB_INTERNAL = 7,
RIB_SUPPORT = 8,
}
PRINT_ORDER = {
EXT_INT_INF = 1,
INF_INT_EXT = 2,
EXT_INT = 1,
INT_EXT = 2,
}
PRINT_DIRECTION = {
@@ -156,7 +241,7 @@ PRINT_DIRECTION = {
LINK_TYPE = {
NONE = 1,
LINEAR = 2,
BIARC = 3,
BIARC = 3,
}
LEAD_TYPE = {
@@ -165,10 +250,28 @@ LEAD_TYPE = {
ARC = 3,
}
INFILL_TYPE = {
NONE = 1,
OFFSET = 2,
ZIGZAG = 3,
FILL_CATEGORY = {
NONE = 0,
SOLID_FILL = 16,
INFILL = 32,
}
FILL_TYPE = {
NONE = 0,
OFFSET = 16,
ZIGZAG = 17,
LINES = 32,
GRID = 33,
ZIG_ZAG_GRID = 34,
HONEYCOMB = 35,
HONEYCOMB_GRID = 36,
}
RIB_TYPE = {
INTERNAL = 1,
EXTERNAL = 2,
UNBOUNDED = 3,
SUPPORT = 4,
}
---------------------------------------------------------------------
@@ -198,6 +301,7 @@ KEY_SLICE_ADV_MODE = 'SliceAdvMode'
KEY_SLICE_ADV_PERC = 'SliceAdvPerc'
KEY_MOVED_PART ='MovedPart'
KEY_MOVED_PART2 ='MovedPart2'
RESULT = {
OK = 1,
@@ -232,15 +336,21 @@ SLICE_ADV_TYPE = {
---------------------------------------------------------------------
RIBS_GRP = "Ribs"
RIBS_CRV = "Rib"
RIBS_LOOP_GRP = "RibsLoops"
SHELL_NBR_GRP = "ShellNbrRegions"
SHELL_NBR_CRV = "ShellNbrRegion"
SHELL_NBR_SURF = "ShellNbrSurf"
AUX_SOLIDS_GRP = "AuxSolids"
AUX_SOLIDS_INFILL_GRP = "InfillAuxSolids"
AUX_SOLIDS_CRV = "AuxSolid"
AUX_SOLIDS_INFILL_CRV = "InfillAuxSolid"
AUX_SOLIDS_SRF = "SrfAuxSolid"
INFILL_GRP = "Infill"
INFILL_CRV = "InfillCrv"
---------------------------------------------------------------------
-- parametri calcolo tempi, F ed S
LAY_TFSCALC = "TFSCalc"
@@ -255,6 +365,8 @@ KEY_FCUR = "FCur"
KEY_LENGTH = "Length"
KEY_SLICEID = "SliceId"
KEY_MASS = "PrintMass"
KEY_MF = "MF"
KEY_TOTAREA = "TotArea"
---------------------------------------------------------------------
return AddManData
-75
View File
@@ -1,75 +0,0 @@
-- CalcPaths.lua by Egaltech s.r.l. 2022/03/30
-- Calcolo percorsi di lavoro per Stampa 3d
-- Tabella per definizione modulo
local CSVManager = {}
-- Intestazioni
require( 'EgtBase')
EgtOutLog( ' CSVManager started', 1)
-- Dati
local AMD = require( 'AddManData')
---------------------------------------------------------------------
function toCSV (t)
local s = ""
for _,p in pairs(t) do
s = s .. "," .. escapeCSV(p)
end
return string.sub(s, 2) -- remove first comma
end
---------------------------------------------------------------------
function escapeCSV (s)
if string.find(s, '[,"]') then
ns = '"' .. string.gsub(s, '"', '""') .. '"'
end
return s
end
---------------------------------------------------------------------
local function fromCSV(s)
s = s .. ';' -- ending comma
local t = {} -- table to collect fields
local fieldstart = 1
repeat
-- next field is quoted? (start with `"'?)
if string.find(s, '^"', fieldstart) then
local a, c
local i = fieldstart
repeat
-- find closing quote
a, i, c = string.find(s, '"("?)', i+1)
until c ~= '"' -- quote not followed by quote?
if not i then error('unmatched "') end
local f = string.sub(s, fieldstart+1, i-1)
table.insert(t, (string.gsub(f, '""', '"')))
fieldstart = string.find(s, ';', i) + 1
else -- unquoted; find next comma
local nexti = string.find(s, ';', fieldstart)
table.insert(t, string.sub(s, fieldstart, nexti-1))
fieldstart = nexti + 1
end
until fieldstart > string.len(s)
return t
end
---------------------------------------------------------------------
function read_file( path)
local file = io.open( path, "r") -- r read mode and b binary mode
if not file then return nil end
local CSVTable = {}
for line in io.lines( path) do
CSVTable[#CSVTable + 1] = fromCSV( line)
end
file:close()
return CSVTable
end
---------------------------------------------------------------------
return CSVManager
+2504 -696
View File
File diff suppressed because it is too large Load Diff
+844 -282
View File
File diff suppressed because it is too large Load Diff
+1702 -667
View File
File diff suppressed because it is too large Load Diff
+238 -135
View File
@@ -1,4 +1,4 @@
-- RunCalcSolids.lua by Egaltech s.r.l. 2022/07/01
-- RunCalcSolids.lua by Egaltech s.r.l. 2022/11/02
-- Calcolo percorsi di lavoro per Stampa 3d
-- Tabella per definizione modulo
@@ -12,13 +12,14 @@ EgtOutLog( ' RunCalcSolids started', 1)
-- Dati
local AMD = require( 'AddManData')
--------------------------------------------------------------------
local s_dTol = 0.1
---------------------------------------------------------------------
local function GetLayerParamsForSolidCalc( nPartId)
local LayerParams = {}
LayerParams.bInvert = EgtGetInfo( nPartId, KEY_PRINT_DIRECTION, 'b')
local LayerParams = {}
LayerParams.bSpiralVase = EgtGetInfo( nPartId, KEY_SPIRAL_VASE, 'b') or false
LayerParams.dLayHeight = EgtGetInfo( nPartId, KEY_SLICE_STEP, 'd')
LayerParams.dStrand = EgtGetInfo( nPartId, KEY_STRAND, 'd')
LayerParams.nOrder = EgtGetInfo( nPartId, KEY_PRINT_ORDER, 'i')
LayerParams.vtSlicing = EgtGetInfo( nPartId, KEY_SLICING_DIR, 'v')
return LayerParams
end
@@ -28,22 +29,6 @@ local function CalcSectionParams( dStrand, dH)
local dL = dStrand
local dLm = dStrand / 10
local dHm = dH / 6
-- recupero offset
--local dOffs = EgtGetInfo( s_nPartId, KEY_OFFSET_SLICE, 'd')
dOffs = 0
if dOffs and dOffs > 0 then
-- calcolo area originale
local dArea = ( dL * dH) - ( dLm * dHm)
local dLM = ( dArea / dH) - ( dLm / 6)
if dOffs / 2 <= ( dL - dLM) then
dL = dL - dOffs / 2
dLm = dL / 10
dHm = (( dL * dH) - dArea) / dLm
else
EgtOutLog( 'Strand section not calculated on area. Too much overlap?')
end
end
local dD1 = 0.5 * dL - dLm
local dD2 = 0.5 * dL - dD1
local dD3 = dHm
@@ -63,8 +48,8 @@ local function CreateSection( ptS, vtDir, dStrand, dH, vtSlicing, nSolidGrp)
local ptF = ptC - 2 * ( dD1 + dD2) * vtDir
local ptG = ptB - 2 * ( dD1 + dD2) * vtDir
local ptH = ptA - 2 * dD1 * vtDir
local nId = EgtCurveCompoFromPoints( nSolidGrp, {ptA, ptB, ptC, ptD, ptE, ptF, ptG, ptH, ptA})
local nId = EgtCurveCompoFromPoints( nSolidGrp, {ptA, ptB, ptC, ptD, ptE, ptF, ptG, ptH, ptA}, GDB_RT.GLOB)
EgtInvertCurve( nId)
return nId
@@ -79,46 +64,134 @@ local function CreateHalfSection( ptS, vtDir, dStrand, dH, vtSlicing, nSolidGrp)
local ptC = ptB + dD4 * vtSlicing
local ptD = ptA + dH * vtSlicing
local nId = EgtCurveCompoFromPoints( nSolidGrp, { ptS - dH * vtSlicing, ptA, ptB, ptC, ptD, ptS})
local nId = EgtCurveCompoFromPoints( nSolidGrp, { ptS - dH * vtSlicing, ptA, ptB, ptC, ptD, ptS}, GDB_RT.GLOB)
return nId
end
--------------------------------------------------------------------
local function CreateSolid( nCrvId, nSolidGrp, dStrand, dH, vtSlicing)
-- punti e direzioni all'inizio e fine della curva guida
local ptS = EgtSP( nCrvId)
local vtS = EgtSV( nCrvId)
vtS:rotate( vtSlicing, 90)
local ptE = EgtEP( nCrvId)
local vtE = EgtEV( nCrvId)
vtE:rotate( vtSlicing, -90)
-- creazione del solido aperto (tubo)
local nSectId = CreateSection( ptS, vtS, dStrand, dH, vtSlicing, nSolidGrp)
local nSrfId = EgtSurfTmSwept( nSolidGrp, nSectId, nCrvId, false, 0.1)
EgtErase( nSectId)
if not nSrfId then return nil end
------------------------------------------------------------------------------
local function CreateSpiralVaseCap( nSectId, vtDir, nSolidGrp)
local vPt = {}
for i = 0, 7 do
vPt[i + 1] = EgtUP( nSectId, i, GDB_ID.ROOT)
end
local vCrvs = {}
vCrvs[1] = EgtArc2PV( nSolidGrp, vPt[1], vPt[2], vtDir, GDB_RT.GLOB)
vCrvs[2] = EgtArc2PV( nSolidGrp, vPt[8], vPt[3], vtDir, GDB_RT.GLOB)
vCrvs[3] = EgtArc2PV( nSolidGrp, vPt[7], vPt[4], vtDir, GDB_RT.GLOB)
vCrvs[4] = EgtArc2PV( nSolidGrp, vPt[6], vPt[5], vtDir, GDB_RT.GLOB)
vCrvs[5] = EgtCurveCompo( nSolidGrp, {vCrvs[1]}, false, GDB_RT.GLOB)
EgtCloseCurveCompo( vCrvs[5])
vCrvs[6] = EgtCurveCompo( nSolidGrp, {vCrvs[4]}, false, GDB_RT.GLOB)
EgtCloseCurveCompo( vCrvs[6])
local nSurf1 = EgtSurfTmRuled( nSolidGrp, vCrvs[1], vCrvs[2], GDB_RUL.ISOPAR, s_dTol)
local nSurf2 = EgtSurfTmRuled( nSolidGrp, vCrvs[2], vCrvs[3], GDB_RUL.ISOPAR, s_dTol)
local nSurf3 = EgtSurfTmRuled( nSolidGrp, vCrvs[3], vCrvs[4], GDB_RUL.ISOPAR, s_dTol)
local nSurf4 = EgtSurfTmByRegion( nSolidGrp, vCrvs[5], s_dTol)
local nSurf5 = EgtSurfTmByRegion( nSolidGrp, vCrvs[6], s_dTol)
local nCapSrf = EgtSurfTmBySewing( nSolidGrp, {nSurf1, nSurf2, nSurf3, nSurf4, nSurf5})
for i = 1, #vCrvs do
EgtErase( vCrvs[i])
end
return nCapSrf
end
-------------------------------------------------------------------------------
local function CreateSpiralVaseSolid( nCrvId, nSolidGrp, LayerParams, dStrand)
-- gruppo temporaneo per conti
local nGrpTmp = EgtGroup( nSolidGrp)
local ptS = EgtSP( nCrvId, GDB_ID.ROOT)
local vtS = EgtSV( nCrvId, GDB_ID.ROOT)
local ptE = EgtEP( nCrvId, GDB_ID.ROOT)
local vtE = EgtEV( nCrvId, GDB_ID.ROOT)
-- appiattisco la curva
local nCrvCopy = EgtCopyGlob( nCrvId, nGrpTmp)
local dDelta = ( ptE - ptS) * LayerParams.vtSlicing
EgtSpiralizeCurveAlongExtrusion( nCrvCopy, - dDelta)
EgtMergeCurvesInCurveCompo( nCrvCopy)
EgtChangeClosedCurveStartPoint( nCrvCopy, ptS, GDB_RT.GLOB)
-- calcolo la sezione iniziale
local vtDir = EgtSV( nCrvCopy, GDB_ID.ROOT)
vtDir:rotate( LayerParams.vtSlicing, 90)
local nSectId = CreateSection( ptS, vtDir, dStrand, LayerParams.dLayHeight, LayerParams.vtSlicing, nGrpTmp)
-- creo la sezione finale
local vtDir2 = EgtEV( nCrvCopy, GDB_ID.ROOT)
vtDir2:rotate( LayerParams.vtSlicing, 90)
local nSectE = CreateSection( ptE, vtDir2, dStrand, LayerParams.dLayHeight, LayerParams.vtSlicing, nGrpTmp)
-- creo il solido aperto (tubo)
local vCrvs = {}
local _, dParE = EgtCurveDomain( nSectId)
for i = 0, dParE do
local ptRef = EgtUP( nSectId, i, GDB_ID.ROOT)
local dOffs = ( ptS - ptRef) * vtDir
vCrvs[i+1] = EgtOffsetCurveAdv( nCrvCopy, dOffs)
if not vCrvs[i+1] or vCrvs[i+1] == GDB_ID.NULL then
EgtErase( nGrpTmp)
return nil
end
local dMove = ( ptRef - ptS) * LayerParams.vtSlicing
EgtMove( vCrvs[i+1], LayerParams.vtSlicing * dMove, GDB_RT.GLOB)
EgtSpiralizeCurveAlongExtrusion( vCrvs[i+1], dDelta)
-- modifico la curva per congiungerla ai caps
EgtAddCurveCompoLine( vCrvs[i+1], ptRef, false, GDB_RT.GLOB)
local ptRefEnd = EgtUP( nSectE, i, GDB_ID.ROOT)
EgtAddCurveCompoLine( vCrvs[i+1], ptRefEnd, true, GDB_RT.GLOB)
end
local vSurfs = {}
for i = 1, #vCrvs - 1 do
vSurfs[i] = EgtSurfTmRuled( nGrpTmp, vCrvs[i], vCrvs[i+1], GDB_RUL.MINDIST, s_dTol)
if not vSurfs[i] or vSurfs[i] == GDB_ID.NULL then
EgtErase( nGrpTmp)
return nil
end
end
local nSrfId = EgtSurfTmBySewing( nSolidGrp, vSurfs)
-- creazione del mezzo disco iniziale
local nSectS = CreateHalfSection( ptS, vtS, dStrand, dH, vtSlicing, nSolidGrp)
local nSrfS = EgtSurfTmByScrewing( nSolidGrp, nSectS, ptS, vtSlicing, 180, 0, false, 0.1)
EgtErase( nSectS)
if not nSrfS then return nil end
local nCap1 = CreateSpiralVaseCap( nSectId, - vtS, nSolidGrp)
-- creazione del mezzo disco finale
local nSectE = CreateHalfSection( ptE, vtE, dStrand, dH, vtSlicing, nSolidGrp)
local nSrfE = EgtSurfTmByScrewing( nSolidGrp, nSectE, ptE, vtSlicing, 180, 0, false, 0.1)
EgtErase( nSectE)
if not nSrfE then return nil end
-- unione delle tre superfici
return EgtSurfTmBySewing( nSolidGrp, { nSrfId, nSrfS, nSrfE})
local nCap2 = CreateSpiralVaseCap( nSectE, vtE, nSolidGrp)
EgtInvertSurf( nCap2)
-- cancello le curve usate per la costruzione
EgtErase( nGrpTmp)
return EgtSurfTmBySewing( nSolidGrp, { nSrfId, nCap1, nCap2})
end
----------------------------------------------------------------------
local function CreateStandardSolid( nCrvId, nSolidGrp, LayerParams, dStrand)
local dD1, dD2, dD3, dD4 = CalcSectionParams( dStrand, LayerParams.dLayHeight)
local nSrfId = EgtSurfTmRectSwept( nSolidGrp, dStrand, LayerParams.dLayHeight, dD2, dD3, nCrvId, GDB_RSCT.BEVEL, s_dTol)
return nSrfId
end
--------------------------------------------------------------------------------------
local function CreateSolid( nCrvId, nSolidGrp, LayerParams, dStrand)
if LayerParams.bSpiralVase then
return CreateSpiralVaseSolid( nCrvId, nSolidGrp, LayerParams, dStrand)
else
return CreateStandardSolid( nCrvId, nSolidGrp, LayerParams, dStrand)
end
end
---------------------------------------------------------------------
local function CreateSolidFromCurve( nCrvId, nSolidGrp, LayerParams)
local function CreateSolidFromCurve( nCrvId, nSolidGrp, LayerParams, nLayer)
local nType = EgtGetInfo( nCrvId, KEY_TYPE, 'i')
if nType == TYPE.WIPE then return true end
-- scelta del colore
local Color = EgtStdColor( 'GRAY')
local Color = EgtStdColor( 'GRAY')
if nType == TYPE.OUTER_SHELL or nType == TYPE.EXTRA_OUTER_SHELL then
Color = EgtStdColor( 'TEAL')
elseif nType == TYPE.INNER_SHELL or nType == TYPE.EXTRA_SHELL then
@@ -129,22 +202,21 @@ local function CreateSolidFromCurve( nCrvId, nSolidGrp, LayerParams)
Color = EgtStdColor( 'YELLOW')
elseif nType == TYPE.COASTING then
Color = EgtStdColor( 'BLUE')
elseif nType == TYPE.WIPE then
Color = EgtStdColor( 'LIME')
elseif nType == TYPE.RIB then
Color = EgtStdColor( 'OLIVE')
elseif nType == TYPE.AUX_SOLID then
Color = EgtStdColor( 'AQUA')
Color = EgtStdColor( 'AQUA')
end
local nCopyId = EgtCopyGlob( nCrvId, nSolidGrp)
local dStrand = EgtGetInfo( nCrvId, KEY_CRV_STRAND, 'd')
local nCopyId = EgtCopyGlob( nCrvId, nSolidGrp)
local nId = GDB_ID.NULL
local nParts = 1
local LEN_REF = 100
local bZigZagInfill = EgtGetInfo( nCopyId, KEY_ZIG_ZAG_INFILL, 'b') or false
if bZigZagInfill then
nId, nParts = EgtSplitCurveAtCorners( nCopyId, 80)
else
else
local dLen = EgtCurveLength( nCrvId)
if dLen > LEN_REF and nType ~= TYPE.LINK and nType ~= TYPE.COASTING then
nParts = EgtClamp( floor( dLen / LEN_REF), 1, 10)
@@ -155,44 +227,61 @@ local function CreateSolidFromCurve( nCrvId, nSolidGrp, LayerParams)
if nId == GDB_ID.NULL then return false end
local bOk = true
for nInd = 0, nParts - 1 do
local nGuideId = nId + nInd
local nSrfId = CreateSolid( nGuideId, nSolidGrp, LayerParams.dStrand - 2 * GEO.EPS_SMALL, LayerParams.dLayHeight, LayerParams.vtSlicing)
if not nSrfId then
-- ritento con sezione leggermente modificata
nSrfId = CreateSolid( nGuideId, nSolidGrp, LayerParams.dStrand - 100 * GEO.EPS_SMALL, LayerParams.dLayHeight, LayerParams.vtSlicing)
if not nSrfId then
nSrfId = CreateSolid( nGuideId, nSolidGrp, LayerParams.dStrand + 100 * GEO.EPS_SMALL, LayerParams.dLayHeight, LayerParams.vtSlicing)
if not nSrfId then
-- ritento spezzando la curva
local nGrp = EgtGroup( nSolidGrp, Frame3d( ORIG(), LayerParams.vtSlicing))
EgtRelocateGlob( nGuideId, nGrp)
EgtApproxCurve( nGuideId, GDB_CA.LINES, 100 * GEO.EPS_SMALL)
EgtRelocateGlob( nGuideId, nSolidGrp)
local nFirstCrv, nCrvNbr = EgtSplitCurveAtCorners( nGuideId, 30)
if nFirstCrv and nCrvNbr > 1 then
local nSrfIds = {}
for nInd2 = 0, nCrvNbr-1 do
local nSrfId2 = CreateSolid( nFirstCrv + nInd2, nSolidGrp, LayerParams.dStrand - 100 * GEO.EPS_SMALL, LayerParams.dLayHeight, LayerParams.vtSlicing)
EgtErase( nFirstCrv + nInd2)
if nSrfId2 then
table.insert( nSrfIds, nSrfId2)
end
end
if #nSrfIds == nCrvNbr then
nSrfId = EgtSurfTmBySewing( nSolidGrp, nSrfIds)
end
local nGuideId = nId + nInd
local nSrfId = CreateSolid( nGuideId, nSolidGrp, LayerParams, dStrand - 5 * GEO.EPS_SMALL)
if not nSrfId then
EgtOutLog( 'Warning : CreateSolid failed '.. '(layer '..tostring( nLayer)..', curve '..tostring( nCrvId)..')')
-- se non ultima, provo a spostare l'estremità finale
if nInd < nParts - 1 then
local nCopyId = EgtCopy( nGuideId + 1, nGuideId, GDB_IN.AFTER)
if nCopyId then
local LEN_TRIM = 10
local bOk1 = EgtTrimCurveEndAtLen( nCopyId, LEN_TRIM)
local bOk2 = EgtAddCurveCompoCurve( nGuideId, nCopyId)
local bOk3 = EgtTrimCurveStartAtLen( nGuideId + 1, LEN_TRIM)
nSrfId = CreateSolid( nGuideId, nSolidGrp, LayerParams, dStrand - 5 * GEO.EPS_SMALL)
if not nSrfId then
nSrfId = CreateSolid( nGuideId, nSolidGrp, LayerParams, dStrand - 50 * GEO.EPS_SMALL)
end
end
end
-- ritento spezzando la curva
if not nSrfId then
EgtOutLog( 'Warning : CreateSolid_2 failed')
local nGrp = EgtGroup( nSolidGrp, Frame3d( ORIG(), LayerParams.vtSlicing), GDB_RT.GLOB)
EgtRelocateGlob( nGuideId, nGrp)
EgtApproxCurve( nGuideId, GDB_CA.LINES, 100 * GEO.EPS_SMALL)
EgtRelocateGlob( nGuideId, nSolidGrp)
local nFirstCrv, nCrvNbr = EgtSplitCurveAtCorners( nGuideId, 30)
if nFirstCrv and nCrvNbr > 1 then
local nSrfIds = {}
for nInd2 = 0, nCrvNbr-1 do
local nSrfId2 = CreateSolid( nFirstCrv + nInd2, nSolidGrp, LayerParams, dStrand - 50 * GEO.EPS_SMALL)
EgtErase( nFirstCrv + nInd2)
if nSrfId2 then
table.insert( nSrfIds, nSrfId2)
end
end
if #nSrfIds == nCrvNbr then
nSrfId = EgtSurfTmBySewing( nSolidGrp, nSrfIds)
else
EgtOutLog( 'Warning : CreateSolid_3 failed')
end
else
EgtErase( nFirstCrv)
end
EgtErase( nGrp)
end
end
if nSrfId then
EgtSetColor( nSrfId, Color)
EgtSetInfo( nSrfId, KEY_TYPE, nType)
EgtSetInfo( nSrfId, KEY_SLICE_NBR, nLayer)
else
bOk = false
end
bOk = false
EgtOutLog( 'Warning : CreateSolid_Sewing failed')
end
EgtErase( nGuideId)
end
@@ -201,90 +290,99 @@ end
---------------------------------------------------------------------
function RunCalcSolids.Exec()
-- per determinare il tempo di calcolo
EgtStartCounter()
local nPartIndex = 1
local nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex) or EgtGetFirstNameInGroup( GDB_ID.ROOT, PART)
while nPartId do
if EgtGetInfo( nPartId, KEY_PART_ON_TABLE, 'b') then
-- verifico se necessario calcolare il solido
local bCalcSolid = EgtGetInfo( nPartId, KEY_CALC_SOLIDS, 'b') or false
local bHasSolids = EgtGetInfo( nPartId, KEY_HAS_SOLIDS, 'b') or false
if bCalcSolid and not bHasSolids then
if bCalcSolid then
-- recupero i suoi slice
local vLayIds = EgtGetNameInGroup( nPartId, SLICE_LAYER .. '*')
if not vLayIds then
EgtOutBox( 'No sliced part in this project!', 'Error', 'ERROR')
return
end
EgtSetInfo( nPartId, KEY_HAS_SOLIDS, 1)
local vErr = {}
-- recupero i parametri necessari al calcolo dei solidi
local LayerParams = GetLayerParamsForSolidCalc( nPartId)
for nIdx = 1, #vLayIds do
-- flag di interruzione perchè trovati solidi già ok
local bSolidsOk = false
-- indice layer (per log)
local nLayer = EgtGetInfo( vLayIds[ nIdx], KEY_SLICE_NBR, 'i')
-- scorro tutti i gruppi di contorni
local nCrvGrpId = EgtGetFirstNameInGroup( vLayIds[ nIdx], CONTOUR_GRP.."*") or GDB_ID.NULL
while nCrvGrpId ~= GDB_ID.NULL do
-- recupero il gruppo dei percorsi utensile
local nTPathGrpId = EgtGetFirstNameInGroup( nCrvGrpId, TOOLPATH_GRP) or GDB_ID.NULL
if nTPathGrpId == GDB_ID.NULL then
EgtOutBox( 'Error no tool paths', 'SolidCalc')
return
return
end
-- recupero il gruppo dei solidi
local nSolidGrpId = EgtGetFirstNameInGroup( nCrvGrpId, SOLID_GRP) or GDB_ID.NULL
if nSolidGrpId == GDB_ID.NULL then
nSolidGrpId = EgtGroup( nCrvGrpId)
EgtSetName( nSolidGrpId, SOLID_GRP)
EgtSetLevel( nSolidGrpId, GDB_LV.TEMP)
-- scorro le curve del percorso utensile
local nId = EgtGetFirstInGroup( nTPathGrpId)
while nId do
local bOk = CreateSolidFromCurve( nId, nSolidGrpId, LayerParams, nLayer)
nId = EgtGetNext( nId)
end
else
EgtEmptyGroup( nSolidGrpId)
bSolidsOk = true
break
end
-- scorro le curve del percorso utensile
local nId = EgtGetFirstInGroup( nTPathGrpId)
while nId do
local bOk = CreateSolidFromCurve( nId, nSolidGrpId, LayerParams)
if not bOk then
table.insert( vErr, nIdx)
end
nId = EgtGetNext( nId)
end
-- processo gli eventi
if ( nIdx % 20) == 0 then
EgtDraw()
if EgtProcessEvents( nIdx / #vLayIds * 100, 0) == 1 then
return
end
end
--passo al gruppo di contorni successivo
nCrvGrpId = EgtGetNextName( nCrvGrpId, CONTOUR_GRP.."*") or GDB_ID.NULL
end
EgtDraw()
if EgtProcessEvents( EgtIf( PRINT, 300, 0) + nIdx / #vLayIds * 100, 0) == 1 then
return
if bSolidsOk then
break
end
local nStep = 10
if nIdx > 400 then
nStep = 80
elseif nIdx > 200 then
nStep = 40
elseif nIdx > 100 then
nStep = 20
end
if ( nIdx % nStep) == 0 then
EgtDraw()
end
if EgtProcessEvents( EgtIf( PRINT, 400, 0) + nIdx / #vLayIds * 100, 0) == 1 then
-- se interrompo cancello i solidi realizzati
for i = 1, #vLayIds do
local vGrpId = EgtGetNameInGroup( vLayIds[i], CONTOUR_GRP .. '*') or {}
for j = 1, #vGrpId do
local nSolidId = EgtGetNameInGroup( vGrpId[j], SOLID_GRP .. '*') or GDB_ID.NULL
EgtErase( nSolidId)
end
end
-- rimuovo info della presenza solidi
EgtSetInfo( nPartId, KEY_HAS_SOLIDS, false)
EgtDraw()
return
end
end
-- eventuale segnalazione errori
-- if #vErr > 0 then
-- EgtOutBox( 'Error on layers :\n' .. table.concat( vErr, ','), 'SolidCalc')
-- end
for i = 1, #vErr do
EgtOutLog( 'Error on solid creation (layer ' .. vErr[i] .. ') - SolidCalc')
end
-- eventuale aggiornamento delle ViewInfo
local nViewId = EgtGetFirstNameInGroup( GDB_ID.ROOT, VIEWPARAMS)
if nViewId then
@@ -293,11 +391,16 @@ function RunCalcSolids.Exec()
end
end
nPartIndex = nPartIndex + 1
nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex) or EgtGetNextName( nPartId, PART)
end
EgtDraw()
-- report tempo di calcolo in log
EgtOutLog( string.format( ' CalcSolidsTime = %.2f ms', EgtStopCounter()))
end
---------------------------------------------------------------------
+31 -16
View File
@@ -1,4 +1,4 @@
-- RunGcodeGenerate.lua by Egaltech s.r.l. 2022/06/14
-- RunGcodeGenerate.lua by Egaltech s.r.l. 2023/04/11
-- Calcoli prima fase per Stampa 3d
-- Tabella per definizione modulo
@@ -24,7 +24,7 @@ end
function RunGcodeGenerate.Exec()
-- aggiorno interfaccia
EgtProcessEvents( 501, 0)
EgtProcessEvents( 601, 0)
-- Recupero il pezzo (per ora primo e unico)
local nPartIndex = 1
@@ -45,7 +45,7 @@ function RunGcodeGenerate.Exec()
local LayerParams = GetLayerParamsForGcodeGenerate( nPartId)
-- aggiorno interfaccia
EgtProcessEvents( 505, 0)
EgtProcessEvents( 605, 0)
-- Ciclo sui layer
local vEntId = {}
@@ -75,7 +75,7 @@ function RunGcodeGenerate.Exec()
end
-- aggiorno interfaccia
EgtProcessEvents( 510, 0)
EgtProcessEvents( 610, 0)
-- Imposto gruppo di lavoro
EgtSetCurrMachGroup()
@@ -97,7 +97,7 @@ function RunGcodeGenerate.Exec()
end
-- aggiorno interfaccia
EgtProcessEvents( 520, 0)
EgtProcessEvents( 620, 0)
EgtSetMachiningGeometry( vEntId)
@@ -106,36 +106,51 @@ function RunGcodeGenerate.Exec()
if not EgtApplyMachining() then
local nErr, sErr = EgtGetLastMachMgrError()
local sMsg = 'Error applying Extrusion'
local sMsg = ''
if nErr == 2803 and string.find( sErr, '(3)', 1, true) then
sMsg = sMsg .. ' (missing Feed & Speed)'
sMsg = ' Missing Feed & Speed.'
elseif nErr == 2804 then
sMsg = ' Axes Values not calculable.'
elseif nErr == 2805 then
sMsg = ' Outstroke Axes (see Log File).'
else
sMsg = ' See Log File.'
end
EgtResetCurrMachGroup()
EgtOutBox( sMsg, 'GcodeGenerate')
if PRINT and PRINT.PROGRAM == 1 then
PRINT.ERR = 1
PRINT.MSG = sMsg
else
EgtOutBox( 'Error in Machining :'..sMsg, 'GcodeGenerate')
end
return
end
-- aggiorno interfaccia
EgtProcessEvents( 550, 0)
EgtProcessEvents( 650, 0)
-- Salvo il progetto
local sFilePath = EgtGetCurrFilePath()
sFilePath = EgtChangePathExtension( sFilePath, 'nge')
sFilePath = EgtChangePathExtension( sFilePath, 'icrs')
EgtSetCurrFilePath( sFilePath)
EgtSaveFile()
-- aggiorno interfaccia
EgtProcessEvents( 580, 0)
EgtProcessEvents( 680, 0)
-- Genero il programma CN
local sInfo = 'EgtCAM5 ver.' .. EgtGetExeVersion() .. ' - ' .. sPath
local bGenOk = EgtGenerate( '', sInfo)
local sInfo = 'Icarus ver.' .. EgtGetExeVersion() .. ' - ' .. sPath
local sISOFilePath = ''
if PRINT and PRINT.PROGRAM == 1 and PRINT.ISOFILEPATH then
sISOFilePath = PRINT.ISOFILEPATH
end
local bGenOk = EgtGenerate( sISOFilePath, sInfo)
if bGenOk then
EgtEstimate('')
end
-- aggiorno interfaccia
EgtProcessEvents( 590, 0)
EgtProcessEvents( 690, 0)
EgtResetCurrMachGroup()
@@ -143,7 +158,7 @@ function RunGcodeGenerate.Exec()
if bGenOk then
PRINT.ERR = 0
else
PRINT.ERR = 999
PRINT.ERR = 2
end
else
if bGenOk then
@@ -154,7 +169,7 @@ function RunGcodeGenerate.Exec()
end
-- aggiorno interfaccia
EgtProcessEvents( 600, 0)
EgtProcessEvents( 700, 0)
end
+70 -20
View File
@@ -1,4 +1,4 @@
-- RunMachParamFromSWCalc.lua by Egaltech s.r.l. 2022/09/15
-- RunMachParamFromSWCalc.lua by Egaltech s.r.l. 2022/12/28
-- Calcolo dei parametri di stampa
-- Tabella per definizione modulo
@@ -12,9 +12,12 @@ EgtOutLog( ' RunMachParamFromSWCalc started', 1)
-- Costanti generali
local AMD = require( 'AddManData')
--local MACHINING = {}
--MACHINING.K = 103
--local MATERIAL = {}
--MATERIAL.Name = 'AKROMID® B3 ICF 40'
--MATERIAL.K = 0.1
--MATERIAL.K_EXTRUSION = 110
--MATERIAL.K_LAYERTIME = 105
--MATERIAL.C1 = 0.8742
--MATERIAL.C2 = 0.8964
--MATERIAL.Density = 1.31
@@ -31,6 +34,14 @@ local AMD = require( 'AddManData')
---------------------------------------------------------------------
function RunMachParamFromSWCalc.Exec()
-- valori default per nuovi parametri
MATERIAL.K_LAYERTIME = MATERIAL.K_LAYERTIME or 100
MATERIAL.K_EXTRUSION = MATERIAL.K_EXTRUSION or 100
if not MACHINING then
MACHINING = {}
MACHINING.K = 100
end
-- layer dei risultati
local nResultLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, LAY_TFSCALC)
if not nResultLayerId then
@@ -58,43 +69,53 @@ function RunMachParamFromSWCalc.Exec()
local dStrand = EgtGetInfo( nPartId, KEY_STRAND, 'd')
local dStrandCount = EgtGetInfo( nPartId, KEY_SHELLS_NBR, 'd')
-- recupero numero di strati per progress
local nLastLayerId = EgtGetLastNameInGroup( nPartId, SLICE_LAYER .. '*')
local nLayerQty = EgtGetInfo( nLastLayerId, KEY_SLICE_NBR, 'i')
local nLastLayerId = EgtGetLastNameInGroup( nPartId, SLICE_LAYER .. '*') or GDB_ID.NULL
local nLayerQty = EgtGetInfo( nLastLayerId, KEY_SLICE_NBR, 'i') or 0
-- ciclo sui layer
local nLayerIndex = 1
local nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex)
local nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex) or EgtGetFirstNameInGroup( nPartId, "__" .. SLICE_LAYER .. nLayerIndex)
while nLayerId do
-- rimuovo eventuale info precedente del tempo di attesa
EgtRemoveInfo( nLayerId, KEY_WAITING_TIME)
-- calcolo lunghezza totale del layer
local dTotLayerLength = 0
local dTotLayerLengthForMass = 0
local dTotLayerArea = 0
local nCrvId = EgtGetFirstNameInGroup( nLayerId, CONTOUR_GRP .. '*')
while nCrvId do
local nToolPathId = EgtGetFirstNameInGroup( nCrvId, TOOLPATH_GRP)
-- sommo lunghezze percorsi
local dTotCrvLength = 0
local dTotCrvLengthForMass = 0
nShellId = EgtGetFirstInGroup( nToolPathId)
while nShellId do
dTotCrvLength = dTotCrvLength + EgtCurveLength( nShellId)
if EgtGetName( nShellId) ~= WIPE_CRV then
dTotCrvLengthForMass = dTotCrvLengthForMass + EgtCurveLength( nShellId)
end
nShellId = EgtGetNext( nShellId)
end
dTotLayerLength = dTotLayerLength + dTotCrvLength
dTotLayerLengthForMass = dTotLayerLengthForMass + dTotCrvLengthForMass
-- recupero area
local nOuterCrvId = EgtGetFirstNameInGroup( nCrvId, OUTER_CRV)
local _, _, dTotCrvArea = EgtCurveArea( nOuterCrvId)
local dOuterLength = EgtCurveLength( nOuterCrvId)
-- recupero offset del part per aggiungerlo all'area interna
local dOffset = EgtGetInfo( nPartId, KEY_OFFSET_SLICE, 'd')
dTotCrvArea = dTotCrvArea + ( dOffset * dOuterLength)
dTotLayerArea = dTotLayerArea + dTotCrvArea
if nOuterCrvId and dStrandCount > 0.5 then
local _, _, dTotCrvArea = EgtCurveArea( nOuterCrvId)
local dOuterLength = EgtCurveLength( nOuterCrvId)
-- recupero offset del part per aggiungerlo all'area interna
local dOffset = EgtGetInfo( nPartId, KEY_OFFSET_SLICE, 'd')
dTotCrvArea = dTotCrvArea + ( dOffset * dOuterLength)
dTotLayerArea = dTotLayerArea + dTotCrvArea
end
nCrvId = EgtGetNextName( nCrvId, CONTOUR_GRP .. '*')
end
-- recupero feed del layer
local dLayerFeed = 0
local dLayerWait = 0
local nLayerResultId = EgtGetFirstNameInGroup( nResultLayerId, nLayerIndex)
if nLayerResultId then
dLayerFeed = EgtGetInfo( nLayerResultId, KEY_FCUR, 'd') or 0
dLayerWait = EgtGetInfo( nLayerResultId, KEY_WAITING_TIME, 'd') or 0
else
nLayerResultId = EgtGroup( nResultLayerId)
EgtSetName( nLayerResultId, nLayerIndex)
@@ -112,11 +133,27 @@ function RunMachParamFromSWCalc.Exec()
end
EgtSetInfo( nLayerResultId, KEY_SLICEID, nOrigLayers)
-- calcolo costante MF
local dMF = dTotLayerLength * dStrand / dTotLayerArea * 100
local dMF = 1
local dSC = 1
if dTotLayerArea > 1 then
dMF = dTotLayerLength * dStrand / dTotLayerArea * 100
dSC = dStrandCount
else
dMF = 100
local nRibsLayId = EgtGetFirstNameInGroup( nLayerId, RIBS_GRP) or GDB_ID.NULL
local nCrvId = EgtGetFirstInGroup( nRibsLayId)
while nCrvId do
if EgtGetInfo( nCrvId, KEY_RIBS_TYPE, 'i') == RIB_TYPE.UNBOUNDED then
dSC = ( EgtGetInfo( nCrvId, KEY_RIBS_SHELLS_NBR, 'd') or dSC) / 2
break
end
nCrvId = EgtGetNext( nCrvId)
end
end
-- calcolo tempi stimati del layer
local dTMin = ( dMF + MATERIAL.AMin) / MATERIAL.BMin * pow( 0.25 * dStrand, MATERIAL.KW) * pow( dSliceStep, MATERIAL.KZ) * pow( dStrandCount, MATERIAL.KN)
local dTTrg = ( dMF + MATERIAL.ATrg) / MATERIAL.BTrg * pow( 0.25 * dStrand, MATERIAL.KW) * pow( dSliceStep, MATERIAL.KZ) * pow( dStrandCount, MATERIAL.KN)
local dTMax = ( dMF + MATERIAL.AMax) / MATERIAL.BMax * pow( 0.25 * dStrand, MATERIAL.KW) * pow( dSliceStep, MATERIAL.KZ) * pow( dStrandCount, MATERIAL.KN)
local dTMin = ( MATERIAL.K_LAYERTIME / 100.0) * ( dMF + MATERIAL.AMin) / MATERIAL.BMin * pow( 0.25 * dStrand, MATERIAL.KW) * pow( dSliceStep, MATERIAL.KZ) * pow( dSC, MATERIAL.KN)
local dTTrg = ( MATERIAL.K_LAYERTIME / 100.0) * ( dMF + MATERIAL.ATrg) / MATERIAL.BTrg * pow( 0.25 * dStrand, MATERIAL.KW) * pow( dSliceStep, MATERIAL.KZ) * pow( dSC, MATERIAL.KN)
local dTMax = ( MATERIAL.K_LAYERTIME / 100.0) * ( dMF + MATERIAL.AMax) / MATERIAL.BMax * pow( 0.25 * dStrand, MATERIAL.KW) * pow( dSliceStep, MATERIAL.KZ) * pow( dSC, MATERIAL.KN)
local dFMin = dTotLayerLength / dTMax * 60
local dFTrg = dTotLayerLength / dTTrg * 60
local dFMax = dTotLayerLength / dTMin * 60
@@ -126,10 +163,11 @@ function RunMachParamFromSWCalc.Exec()
else
dLayerTime = dTotLayerLength / dLayerFeed * 60
end
dLayerWait = floor( dTMin + 0.5) - floor( dLayerTime + 0.5)
-- calcolo la portata
local Vf = dLayerFeed * ( ( dStrand - dSliceStep) * dSliceStep + pi * pow( dSliceStep / 2, 2)) / 1000
-- calcolo speed
local dSpeed = ( 1 + MATERIAL.K) * pow( Vf / MATERIAL.C1, 1 / MATERIAL.C2)
local dSpeed = ( MATERIAL.K_EXTRUSION / 100.0) * ( MACHINING.K / 100.0) * pow( Vf / MATERIAL.C1, 1 / MATERIAL.C2)
-- verifico se speed esce da minimo e massimo della macchina
local bSpeedOk = true
if dSpeed < dSMin then
@@ -141,11 +179,12 @@ function RunMachParamFromSWCalc.Exec()
dSpeed = dSMax
end
if not bSpeedOk then
dLayerFeed = ( MATERIAL.C1 * pow( ( dSpeed / ( 1 + MATERIAL.K)), MATERIAL.C2)) * 1000 / ( ( dStrand - dSliceStep) * dSliceStep + pi * pow( dSliceStep / 2, 2))
dLayerFeed = ( MATERIAL.C1 * pow( ( dSpeed / (( MATERIAL.K_EXTRUSION / 100.0) * ( MACHINING.K / 100.0))), MATERIAL.C2)) * 1000 / ( ( dStrand - dSliceStep) * dSliceStep + pi * pow( dSliceStep / 2, 2))
dLayerTime = dTotLayerLength / dLayerFeed * 60
dLayerWait = floor( dTMin + 0.5) - floor( dLayerTime + 0.5)
end
-- calcolo massa dello strato
local dLayerMass = dTotLayerLength * dSliceStep * dStrand * MATERIAL.Density * 1e-6
local dLayerMass = dTotLayerLengthForMass * dSliceStep * dStrand * MATERIAL.Density * 1e-6
if dLayerMass and dLayerMass > 0 then
dPrintMass = dPrintMass + dLayerMass
end
@@ -157,6 +196,11 @@ function RunMachParamFromSWCalc.Exec()
EgtSetInfo( nToolPathId, KEY_SPEED, dSpeed)
nCrvId = EgtGetNextName( nCrvId, CONTOUR_GRP .. '*')
end
-- scrivo info attesa
if dLayerWait > 0 then
EgtSetInfo( nLayerId, KEY_WAITING_TIME, dLayerWait)
EgtSetInfo( nLayerResultId, KEY_WAITING_TIME, dLayerWait)
end
-- scrivo valori in struttura dati
--local nLayerResultId = EgtGetFirstNameInGroup( nResultLayerId, nLayerIndex)
EgtSetInfo( nLayerResultId, KEY_TMIN, dTMin)
@@ -169,10 +213,16 @@ function RunMachParamFromSWCalc.Exec()
EgtSetInfo( nLayerResultId, KEY_FCUR, dLayerFeed)
EgtSetInfo( nLayerResultId, KEY_LENGTH, dTotLayerLength)
EgtSetInfo( nLayerResultId, KEY_SPEED, dSpeed)
EgtSetInfo( nLayerResultId, KEY_MF, dMF)
EgtSetInfo( nLayerResultId, KEY_TOTAREA, dTotLayerArea)
-- aggiorno interfaccia
EgtProcessEvents( 400 + ( nLayerIndex / nLayerQty * 100), 0)
if EgtProcessEvents( 500 + ( nLayerIndex / nLayerQty * 100), 0) == 1 then
EgtEmptyGroup( nResultLayerId)
return
end
nLayerIndex = nLayerIndex + 1
nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex)
nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex) or EgtGetFirstNameInGroup( nPartId, "__" .. SLICE_LAYER .. nLayerIndex)
end
if nMaxIndex < nLayerIndex then nMaxIndex = nLayerIndex end
nPartId = EgtGetNextPart( nPartId)
-198
View File
@@ -1,198 +0,0 @@
-- RunMachiningParamCalc.lua by Egaltech s.r.l. 2022/04/13
-- Gestione visualizzazione per Stampa 3d
-- Tabella per definizione modulo
local RunMachiningParamCalc = {}
-- Intestazioni
require( 'EgtBase')
EgtOutLog( ' RunMachiningParamCalc started', 1)
-- Costanti generali
local AMD = require( 'AddManData')
local CSV = require( 'CSVManager')
---------------------------------------------------------------------
function RunMachiningParamCalc.Exec()
-- Dati recuperati dalla macchina
local sMachIni = EgtGetCurrMachineDir() .. '\\' .. EgtGetCurrMachineName() .. '.ini'
local dCoeffX = tonumber( EgtGetStringFromIni( SEC_3DPRINTING, KEY_COEFF_X, 0, sMachIni))
local dCoeffY = tonumber( EgtGetStringFromIni( SEC_3DPRINTING, KEY_COEFF_Y, 0, sMachIni))
-- File dei risultati
local sCalcBaseDir = EgtGetStringFromIni( '3dPrinting', 'BaseDir', 'C:\\ProgramData\\Egaltech\\EgtCam5\\3dPrinting', EgtGetIniFile())
local sCurrProjectPath = EgtGetCurrFilePath()
local sResultFile = EgtChangePathExtension( sCurrProjectPath, '.csv')
local bResultFile = EgtExistsFile( sResultFile)
-- carico eventuale file dei risultati
local CSVOldResult
if bResultFile then
CSVOldResult = read_file( sResultFile)
end
-- tabella del csv del risultato
local CSVNewResult = {}
-- ciclo sui pezzi
local nPartId = EgtGetFirstPart()
while nPartId do
if not EgtGetInfo( nPartId, KEY_PART_ON_TABLE, 'b') then
nPartId = EgtGetNextPart( nPartId)
goto continue
end
-- recupero i parametri di lavorazione del pezzo
local dMachiningFeed = EgtGetInfo( nPartId, KEY_FEED, 'd')
local dSliceStep = EgtGetInfo( nPartId, KEY_SLICE_STEP, 'd')
local dStrand = EgtGetInfo( nPartId, KEY_STRAND, 'd')
local sMaterial = EgtGetInfo( nPartId, KEY_MATERIAL)
-- verifico la definizione dei parametri
if not dMachiningFeed then
EgtOutBox( 'Impossible calculating before applying a machining.', 'Error', 'ERROR')
return
end
-- calcolo intervallo tempi consentito
local sMaterialPath = sCalcBaseDir .. '\\Materials\\' .. sMaterial .. '.csv'
local MaterialCSV = read_file( sMaterialPath)
local dMinTime = 0
local dMaxTime = 0
if not MaterialCSV then
EgtOutBox( 'Material csv file not found.', 'Error', 'ERROR')
return
end
local bSectionFound = false
for nSectionIndex = 1, #MaterialCSV do
local Section = MaterialCSV[nSectionIndex]
if tonumber( Section[1]) == dStrand and tonumber( Section[2]) == dSliceStep then
dMinTime = tonumber(Section[3])
dMaxTime = tonumber(Section[4])
bSectionFound = true
break
end
end
if not bSectionFound then
EgtOutBox( 'Section not found in Material csv file.', 'Error', 'ERROR')
return
end
-- ciclo sui layer
local nLayerIndex = 1
local nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex)
while nLayerId do
local sLayerName = EgtGetName( nLayerId)
local nLayerIndex = tonumber( sLayerName:sub( #SLICE_LAYER + 1))
-- rimuovo eventuale info precedente del tempo di attesa
EgtRemoveInfo( nLayerId, KEY_WAITING_TIME)
-- calcolo lunghezza totale del layer
local dTotLayerLength = 0
local nCrvId = EgtGetFirstGroupInGroup( nLayerId)
while nCrvId do
local nToolPathId = EgtGetFirstNameInGroup( nCrvId, TOOLPATH_GRP)
-- sommo lunghezze percorsi
local dTotCrvLength = 0
nShellId = EgtGetFirstInGroup( nToolPathId)
while nShellId do
--local nType = EgtGetInfo( nShellId, KEY_TYPE, 'i')
dTotCrvLength = dTotCrvLength + EgtCurveLength( nShellId)
nShellId = EgtGetNext( nShellId)
end
dTotLayerLength = dTotLayerLength + dTotCrvLength
nCrvId = EgtGetNext( nCrvId)
end
-- recupero feed del layer
local dLayerFeed = 0
if bResultFile then
-- leggo il valore dal file
local bResultFound = false
for nResultIndex = 1, #CSVOldResult do
local OldResult = CSVOldResult[nResultIndex]
if tonumber( OldResult[1]) == nLayerIndex then
dLayerFeed = tonumber( OldResult[5])
bResultFound = true
break
end
end
if not bResultFound then
-- uso valore di default
dLayerFeed = dMachiningFeed
end
else
-- uso valore di default
dLayerFeed = dMachiningFeed
end
-- calcolo tempo stimato del layer
local dEsteemedTime = dTotLayerLength / dLayerFeed * 60
-- calcolo speed
local dSpeed = ((( dLayerFeed * dSliceStep * dStrand ) / 60) - dCoeffX) / dCoeffY
-- scrivo info feed e speed in group toolpath
nCrvId = EgtGetFirstNameInGroup( nLayerId, CONTOUR_GRP .. '*')
while nCrvId do
local nToolPathId = EgtGetFirstNameInGroup( nCrvId, TOOLPATH_GRP)
EgtSetInfo( nToolPathId, KEY_FEED, dLayerFeed)
EgtSetInfo( nToolPathId, KEY_SPEED, dSpeed)
nCrvId = EgtGetNextName( nCrvId, CONTOUR_GRP .. '*')
end
-- salvo e riporto valori calcolati in tabella per csv
local sStatus = ''
if dEsteemedTime < dMinTime then
EgtSetInfo( nLayerId, KEY_RESULT, RESULT.KO_MINUS)
EgtSetInfo( nLayerId, KEY_WAITING_TIME, dMinTime - dEsteemedTime)
sStatus = 'KO(-)'
elseif dEsteemedTime > dMinTime and dEsteemedTime < dMaxTime then
EgtSetInfo( nLayerId, KEY_RESULT, RESULT.OK)
sStatus = 'OK'
elseif dEsteemedTime > dMaxTime then
EgtSetInfo( nLayerId, KEY_RESULT, RESULT.KO_PLUS)
sStatus = 'KO(+)'
end
--table.insert( CSVOutTable, { Index = nLayerIndex, EsteemedTime = dEsteemedTime, Feed = dLayerFeed, Speed = dSpeed})
table.insert( CSVNewResult, { nLayerIndex, dTotLayerLength, dEsteemedTime, sStatus, dLayerFeed, dSpeed})
nLayerIndex = nLayerIndex + 1
nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex)
end
nPartId = EgtGetNextPart( nPartId)
::continue::
end
-- aggiorno palette
local nViewId = EgtGetFirstNameInGroup( GDB_ID.ROOT, VIEWPARAMS)
local nPaletteType = EgtGetInfo( nViewId, KEY_PALETTE, 'i')
if nPaletteType == PALETTE_TYPE.RESULTS then
local RSP = require( 'RunSlicePalette')
RSP.UpdateColors( nPaletteType)
end
-- scrivo nuovo file csv di risultato
local file = io.open( sResultFile, "w")
if file then
file:write('LayerIndex; Len; Time; Status; Feed; Speed')
file:write('\n')
for NewResultIndex = 1, #CSVNewResult do
local CSVOutLine = CSVNewResult[NewResultIndex]
local sParams = ''
for ParamIndex = 1, #CSVOutLine do
if ParamIndex > 1 then
sParams = sParams .. ";"
end
if ParamIndex == 4 then
sParams = sParams .. CSVOutLine[ParamIndex]
else
sParams = sParams .. EgtNumToString( CSVOutLine[ParamIndex], 1)
end
end
file:write(sParams)
file:write('\n')
end
file:close()
local sReadProgPath = EgtGetStringFromIni( '3dPrinting', RESULT_READ_PROG, "", EgtGetIniFile())
if not sReadProgPath or not EgtWinExec( '"'..sReadProgPath..'" "'..sResultFile..'"') then
EgtOutBox( 'Impossible opening software to show results. You can find them in ' .. sResultFile, 'Error', 'ERROR')
end
else
EgtOutBox( 'Impossible writing results file in ' .. sResultFile, 'Error', 'ERROR')
end
end
---------------------------------------------------------------------
return RunMachiningParamCalc
-57
View File
@@ -1,57 +0,0 @@
-- RunMachiningParamEdit.lua by Egaltech s.r.l. 2022/04/05
-- Gestione visualizzazione per Stampa 3d
-- Tabella per definizione modulo
local RunMachiningParamEdit = {}
-- Intestazioni
require( 'EgtBase')
EgtOutLog( ' RunMachiningParamEdit started', 1)
-- Costanti generali
local AMD = require( 'AddManData')
---------------------------------------------------------------------
function RunMachiningParamEdit.Exec()
-- recupero cartella delle lavorazioni
local sCalcBaseDir = EgtGetStringFromIni( '3dPrinting', 'BaseDir', 'C:\\ProgramData\\Egaltech\\EgtCam5\\3dPrinting', EgtGetIniFile())
local sMachiningDirPath = sCalcBaseDir .. '\\Machinings\\'
-- recupero file delle lavorazioni
--local Machinings = {}
local sMachinings = ''
local f = io.popen("dir " .. sMachiningDirPath .. " /B", "r")
for entry in f:lines() do
--Machinings[#Machinings + 1] = entry
local sDir, sFile, sExt = EgtSplitPath(entry)
if sExt == '.ini' then
if sMachinings ~= "" then
sMachinings = sMachinings .. ','
end
sMachinings = sMachinings .. sFile
end
end
-- chiedo quale file aprire
MachiningValues = EgtDialogBox( 'Machinings edit', { 'Machining', 'CB:' .. sMachinings})
if not MachiningValues or #MachiningValues < 1 then return end
-- verifico esistenza file
local sSelMachiningPath = sMachiningDirPath .. MachiningValues[1] .. '.ini'
if not EgtExistsFile( sSelMachiningPath) then
EgtOutBox( 'Machining file not found', 'Error', 'ERROR')
return
end
-- apro programma di edit
local sEditProgPath = EgtGetStringFromIni( '3dPrinting', 'MachiningEditProg', "", EgtGetIniFile())
if not sEditProgPath or not EgtWinExec( '"'..sEditProgPath..'" "'.. sSelMachiningPath..'"') then
EgtOutBox( 'Impossible opening software to show Machining. You can find it in ' .. sSelMachiningPath, 'Error', 'ERROR')
end
end
---------------------------------------------------------------------
return RunMachiningParamEdit
-56
View File
@@ -1,56 +0,0 @@
-- RunMaterialParamEdit.lua by Egaltech s.r.l. 2022/04/09
-- Gestione edit parametri materiali per Stampa 3d
-- Tabella per definizione modulo
local RunMaterialParamEdit = {}
-- Intestazioni
require( 'EgtBase')
EgtOutLog( ' RunMaterialParamEdit started', 1)
-- Costanti generali
local AMD = require( 'AddManData')
---------------------------------------------------------------------
function RunMaterialParamEdit.Exec()
-- recupero cartella dei materiali
local sCalcBaseDir = EgtGetStringFromIni( '3dPrinting', 'BaseDir', 'C:\\ProgramData\\Egaltech\\EgtCam5\\3dPrinting', EgtGetIniFile())
local sMaterialDirPath = sCalcBaseDir .. '\\Materials\\'
-- recupero elenco file dei materiali
local Files = EgtFindAllFiles( sMaterialDirPath..'*.csv')
if not Files then
EgtOutBox( 'Material files not found', 'Error', 'ERROR')
return
end
local sMaterials = ''
for i = 1, #Files do
local sDir, sFile, sExt = EgtSplitPath( Files[i])
if sMaterials ~= "" then
sMaterials = sMaterials .. ','
end
sMaterials = sMaterials .. sFile
end
-- chiedo quale file aprire
MaterialValues = EgtDialogBox( 'Materials edit', { 'Material', 'CB:' .. sMaterials})
if not MaterialValues or #MaterialValues < 1 then return end
-- verifico esistenza file
local sSelMaterialPath = sMaterialDirPath .. MaterialValues[1] .. '.csv'
if not EgtExistsFile( sSelMaterialPath) then
EgtOutBox( 'Material file not found', 'Error', 'ERROR')
return
end
-- apro programma di edit
local sEditProgPath = EgtGetStringFromIni( '3dPrinting', RESULT_READ_PROG, "", EgtGetIniFile())
if not sEditProgPath or not EgtWinExec( '"'..sEditProgPath..'" "'..sSelMaterialPath..'"') then
EgtOutBox( 'Impossible opening software to show Material. You can find them it in ' .. sSelMaterialPath, 'Error', 'ERROR')
end
end
---------------------------------------------------------------------
return RunMaterialParamEdit
-209
View File
@@ -1,209 +0,0 @@
-- RunPartPositioning.lua by Egaltech s.r.l. 2022/08/29
-- Gestione calcolo disposizione e lavorazioni per stampa 3d
-- 2022/03/21 Creazione file
-- Tabella per definizione modulo
local RunPartPositioning = {}
-- Intestazioni
require( 'EgtBase')
EgtOutLog( ' RunPartPositioning started', 1)
-- Costanti generali
local AMD = require( 'AddManData')
---------------------------------------------------------------------
function RunPartPositioning.Exec()
-- Verifico che la macchina corrente sia adatta alla stampa 3d
local sMachIni = EgtGetCurrMachineDir() .. '\\' .. EgtGetCurrMachineName() .. '.ini'
local sMachMaterial = EgtGetStringFromIni( 'General', 'Material', '', sMachIni)
if sMachMaterial ~= 'Additive' then
EgtOutBox( 'Current machine unsuitable for additive manufacturing', 'Warning', 'WARNING')
return
end
-- Recupero ultimo oggetto selezionato
local nSolidId = EgtGetLastSelectedObj()
local nLayerId = EgtGetParent( nSolidId)
local nPartId = EgtGetParent( nLayerId)
-- Verifico sia in un pezzo valido
if nPartId then
if EgtIsPart( nPartId) then
local sName = EgtGetName( nPartId)
if sName == TABLE then
EgtOutBox( 'No selected part. Please select a part before moving it on the table.', 'Warning', 'WARNING')
return
end
local sLayer = EgtGetName( nLayerId)
if sLayer == LAY_RIBS or sLayer == LAY_AUX_SOLIDS or sLayer == LAY_SHELL_NBR then
EgtOutBox( 'No selected solid. Please select a solid before moving it on the table.', 'Warning', 'WARNING')
return
end
else
EgtOutBox( 'No selected part. Please select a part before moving it on the table.', 'Warning', 'WARNING')
return
end
else
EgtOutBox( 'No selected part. Please select a part before moving it on the table.', 'Warning', 'WARNING')
return
end
-- Assegno nome pezzo e layer
if not EgtGetName( nPartId) then
local nPartIndex = 1
while EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex) do
nPartIndex = nPartIndex + 1
end
EgtSetName( nPartId, PART .. nPartIndex)
EgtSetName( nLayerId, PRINT_SOLID)
end
-- Recupero o creo layer ausiliario
local nAuxId = EgtGetFirstNameInGroup( nPartId, LAY_AUX)
if not nAuxId then
nAuxId = EgtGroup( nPartId)
EgtSetName( nAuxId, LAY_AUX)
else
EgtEmptyGroup( nAuxId)
end
-- Rimuovo eventuale gruppo di lavoro
local nMchGrpId = EgtGetMachGroupId( '3dPrint')
EgtRemoveMachGroup( nMchGrpId or GDB_ID.NULL)
-- Recupero dati tavola (creando gruppo di lavoro temporaneo)
local nQqqId = EgtAddMachGroup( 'qqq')
EgtSetTable( 'Tab')
local b3Tab = EgtGetTableArea()
dTabX = b3Tab:getDimX()
dTabY = b3Tab:getDimY()
EgtRemoveMachGroup( nQqqId or GDB_ID.NULL)
-- Richiedo posizione origine e offset pezzo
local b3Solid = EgtGetBBoxGlob( nSolidId, GDB_BB.EXACT)
local b3Part = EgtGetBBoxGlob( nPartId, GDB_BB.EXACT)
local nRefX = 1
local nRefY = 1
local dPosX = b3Tab:getDimX() / 2 - b3Solid:getDimX() / 2
local dPosY = b3Tab:getDimY() / 2 - b3Solid:getDimY() / 2
local Positions = EgtDialogBox( 'Part position on table:', { 'Reference', 'CB:Left,Center,Right'},
{ '', 'CB:Bottom,Middle,Top'},
{ 'X', EgtNumToString( EgtToUiUnits( dPosX), 1)},
{ 'Y', EgtNumToString( EgtToUiUnits( dPosY), 1)})
if not Positions then return end
dPosX = EgtFromUiUnits( tonumber( Positions[3]))
dPosY = EgtFromUiUnits( tonumber( Positions[4]))
if Positions[1] == 'Center' then
nRefX = 2
dPosX = dPosX - b3Solid:getDimX() / 2
elseif Positions[1] == 'Right' then
nRefX = 3
dPosX = dPosX - b3Solid:getDimX()
end
if Positions[2] == 'Middle' then
nRefY = 2
dPosY = dPosY - b3Solid:getDimY() / 2
elseif Positions[2] == 'Top' then
nRefY = 3
dPosY = dPosY - b3Solid:getDimY()
end
-- Creo disegno tavola
local nTabPart = EgtGetFirstNameInGroup( GDB_ID.ROOT, TABLE)
EgtErase( nTabPart)
-- Disegno tavola
nTabPart = EgtGroup( GDB_ID.ROOT)
EgtSetMode( nTabPart, GDB_MD.LOCKED)
EgtSetLevel( nTabPart, GDB_LV.SYSTEM)
EgtSetName( nTabPart, TABLE)
local nTabLayer = EgtGroup( nTabPart)
EgtSetName( nTabLayer, TABLE)
local nTabOutlineId = EgtRectangle2P( nTabLayer, Point3d( 0, 0, 0), Point3d( dTabX, dTabY, 0))
local nTabSurfId = EgtSurfFlatRegion( nTabLayer, nTabOutlineId)
EgtSetColor( nTabSurfId, 'GRAY')
EgtSetAlpha( nTabSurfId, 70)
-- Aggiungo il box del solido
local nBoxId = EgtSurfTmBBox( nAuxId, b3Solid, false, GDB_RT.GLOB)
-- Posiziono il pezzo e aggiorno il suo box
local vtMove = Point3d( dPosX, dPosY, 0) - b3Solid:getMin()
EgtMove( nPartId, vtMove)
b3Solid:move( vtMove)
b3Part:move( vtMove)
-- Creo il frame del pezzo
local ptOrig = b3Solid:getMin()
if nRefX == 2 then
ptOrig = ptOrig + b3Solid:getDimX() / 2 * X_AX()
elseif nRefX == 3 then
ptOrig = ptOrig + b3Solid:getDimX() * X_AX()
end
if nRefY == 2 then
ptOrig = ptOrig + b3Solid:getDimY() / 2 * Y_AX()
elseif nRefY == 3 then
ptOrig = ptOrig + b3Solid:getDimY() * Y_AX()
end
-- Svuoto o creo layer per il frame
local nFrameLay = EgtGetFirstNameInGroup( nPartId, LAY_FRAME)
if not nFrameLay then
nFrameLay = EgtGroup( nPartId)
EgtSetName( nFrameLay, LAY_FRAME)
else
EgtEmptyGroup( nFrameLay)
end
local frPart = Frame3d( ptOrig, Z_AX())
nFrameId = EgtFrame( nFrameLay, frPart, GDB_RT.GLOB)
if nFrameId then
EgtSetName( nFrameId, FRAME_PART)
EgtSetMode( nFrameId, GDB_MD.LOCKED)
end
-- Definisco e posiziono il grezzo sulla tavola
EgtAddMachGroup( '3dPrint')
EgtSetTable( 'Tab')
local nRawId = EgtAddRawPartWithPart( nPartId, nBoxId, 0, Color3d( 128, 128, 128, 30))
EgtMoveToCornerRawPart( nRawId, Point3d( dPosX, dPosY, 0), MCH_CR.BL)
EgtResetCurrMachGroup()
-- Recupero/creo gruppo per punti e curve di partenza
local nMachStartId = EgtGetFirstNameInGroup( nPartId, LAY_MACH_START)
if not nMachStartId then
nMachStartId = EgtGroup( nPartId)
EgtSetName( nMachStartId, LAY_MACH_START)
end
local vStartId = EgtGetNameInGroup( nLayerId, START_GEOM)
if vStartId then
for j = 1, #vStartId do
EgtRelocateGlob( vStartId[j], nMachStartId)
EgtSetColor( vStartId[j], EgtStdColor( "RED"))
end
else
-- se non ci sono punti/curve di inizio definiti e non ve ne sono nemmeno nel gruppo, creo un punto
local vOldStart = EgtGetNameInGroup( nMachStartId, START_GEOM)
if not vOldStart then
local ptStart = b3Solid:getCenter() - 0.6 * b3Solid:getDimY() * Y_AX() - 0.5 * b3Solid:getDimZ() * Z_AX()
nPtStartId = EgtPoint( nMachStartId, ptStart, GDB_RT.GLOB)
EgtSetName( nPtStartId, START_GEOM)
EgtSetColor( nPtStartId, EgtStdColor( "RED"))
end
end
-- Dichiaro pezzo posizionato
EgtSetInfo( nPartId, KEY_PART_ON_TABLE, 1)
-- Deseleziono tutto
EgtDeselectAll()
EgtSetView( SCE_VD.ISO_SW, false)
EgtZoom( SCE_ZM.ALL)
EgtOutLog( ' +++ RunPartPositioning completed')
end
---------------------------------------------------------------------
return RunPartPositioning
-138
View File
@@ -1,138 +0,0 @@
-- RunShowManager.lua by Egaltech s.r.l. 2022/09/15
-- Gestione visualizzazione per Stampa 3d
-- Tabella per definizione modulo
local RunShowManager = {}
-- Intestazioni
require( 'EgtBase')
EgtOutLog( ' RunShowManager started', 1)
-- Costanti generali
local AMD = require( 'AddManData')
-- Librerie
_G.package.loaded.RunCalcSolids = nil
local CSOLIDS = require( 'RunCalcSolids')
---------------------------------------------------------------------
local function ShowImportedSolid( nPartId, bShow)
local nSolidLayId = EgtGetFirstNameInGroup( nPartId, PRINT_SOLID)
EgtSetStatus( nSolidLayId or GDB_ID.NULL, EgtIf( bShow, GDB_ST.ON, GDB_ST.OFF))
local nRibsLayId = EgtGetFirstNameInGroup( nPartId, LAY_RIBS)
EgtSetStatus( nRibsLayId or GDB_ID.NULL, EgtIf( bShow, GDB_ST.ON, GDB_ST.OFF))
local nShellNbrLay = EgtGetFirstNameInGroup( nPartId, LAY_SHELL_NBR)
EgtSetStatus( nShellNbrLay or GDB_ID.NULL, EgtIf( bShow, GDB_ST.ON, GDB_ST.OFF))
local nAuxSolidsLay = EgtGetFirstNameInGroup( nPartId, LAY_AUX_SOLIDS)
EgtSetStatus( nAuxSolidsLay or GDB_ID.NULL, EgtIf( bShow, GDB_ST.ON, GDB_ST.OFF))
end
---------------------------------------------------------------------
function RunShowManager.Exec()
-- Verifico esistenza gruppo stato visualizzazione progetto
local nViewId = EgtGetFirstNameInGroup( GDB_ID.ROOT, VIEWPARAMS)
local bImportedSolid = false
local bOuterCrv = false
local bPath = false
local bSolid = false
local bToolPath = false
if not nViewId then
nViewId = EgtGroup( GDB_ID.ROOT)
EgtSetName( nViewId, VIEWPARAMS)
EgtSetLevel( nViewId, GDB_LV.SYSTEM)
else
bImportedSolid = EgtGetInfo( nViewId, IMPORTED_SOLID, 'b')
bOuterCrv = EgtGetInfo( nViewId, OUTER_CRV, 'b')
bPath = EgtGetInfo( nViewId, PATH_GRP, 'b')
bSolid = EgtGetInfo( nViewId, SOLID_GRP, 'b')
bToolPath = EgtGetInfo( nViewId, TOOLPATH_GRP, 'b')
end
local bCurrImportedSolid = bImportedSolid
local bCurrOuterCrv = bOuterCrv
local bCurrPath = bPath
local bCurrSolid = bSolid
local bCurrToolPath = bToolPath
if EgtGetUserLevel() == 1 then
local ViewValues = EgtDialogBox( 'Show Manager', { 'Imported Solid', 'CK:' .. EgtIf( bImportedSolid, '1', '0')},
{ 'Solid', 'CK:' .. EgtIf( bSolid, '1', '0')},
{ 'ToolPath', 'CK:' .. EgtIf( bToolPath, '1', '0')})
if not ViewValues or #ViewValues < 3 then return end
bCurrImportedSolid = ( ViewValues[1] == '1')
bCurrSolid = ( ViewValues[2] == '1')
bCurrToolPath = ( ViewValues[3] == '1')
else
local ViewValues = EgtDialogBox( 'Show Manager', { 'Imported Solid', 'CK:' .. EgtIf( bImportedSolid, '1', '0')},
{ 'OuterCrv', 'CK:' .. EgtIf( bOuterCrv, '1', '0')},
{ 'Path', 'CK:' .. EgtIf( bPath, '1', '0')},
{ 'Solid', 'CK:' .. EgtIf( bSolid, '1', '0')},
{ 'ToolPath', 'CK:' .. EgtIf( bToolPath, '1', '0')})
if not ViewValues or #ViewValues < 5 then return end
bCurrImportedSolid = ( ViewValues[1] == '1')
bCurrOuterCrv = ( ViewValues[2] == '1')
bCurrPath = ( ViewValues[3] == '1')
bCurrSolid = ( ViewValues[4] == '1')
bCurrToolPath = ( ViewValues[5] == '1')
end
-- ciclo sui pezzi
local nPartIndex = 1
local nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex)
while nPartId do
-- eventuale calcolo dei solidi
local bHasSolids = EgtGetInfo( nPartId, KEY_HAS_SOLIDS, 'b') or false
if not bHasSolids and bCurrSolid then
EgtSetInfo( nPartId, KEY_CALC_SOLIDS, true)
CSOLIDS.Exec()
end
if bImportedSolid ~= bCurrImportedSolid then
ShowImportedSolid( nPartId, bCurrImportedSolid)
end
-- ciclo sui layer per dis/attivare il resto
local nLayerIndex = 1
local nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex) or EgtGetFirstNameInGroup( nPartId, "__" .. SLICE_LAYER .. nLayerIndex)
while nLayerId do
local nCrvId = EgtGetFirstGroupInGroup( nLayerId)
while nCrvId do
if bOuterCrv ~= bCurrOuterCrv then
local nOuterCrvId = EgtGetFirstNameInGroup( nCrvId, OUTER_CRV)
EgtSetStatus( nOuterCrvId or GDB_ID.NULL, EgtIf( bCurrOuterCrv, GDB_ST.ON, GDB_ST.OFF))
end
if bPath ~= bCurrPath then
local nPathId = EgtGetFirstNameInGroup( nCrvId, PATH_GRP)
EgtSetStatus( nPathId or GDB_ID.NULL, EgtIf( bCurrPath, GDB_ST.ON, GDB_ST.OFF))
end
if bSolid ~= bCurrSolid then
local nSolidId = EgtGetFirstNameInGroup( nCrvId, SOLID_GRP)
EgtSetStatus( nSolidId or GDB_ID.NULL, EgtIf( bCurrSolid, GDB_ST.ON, GDB_ST.OFF))
end
if bToolPath ~= bCurrToolPath then
local nToolPathId = EgtGetFirstNameInGroup( nCrvId, TOOLPATH_GRP)
EgtSetStatus( nToolPathId or GDB_ID.NULL, EgtIf( bCurrToolPath, GDB_ST.ON, GDB_ST.OFF))
end
nCrvId = EgtGetNext( nCrvId)
end
nLayerIndex = nLayerIndex + 1
nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex) or EgtGetFirstNameInGroup( nPartId, "__" .. SLICE_LAYER .. nLayerIndex)
end
nPartIndex = nPartIndex + 1
nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex)
end
-- riporto impostazioni in gruppo apposito
EgtSetInfo( nViewId, IMPORTED_SOLID, bCurrImportedSolid)
EgtSetInfo( nViewId, OUTER_CRV, bCurrOuterCrv)
EgtSetInfo( nViewId, PATH_GRP, bCurrPath)
EgtSetInfo( nViewId, SOLID_GRP, bCurrSolid)
EgtSetInfo( nViewId, TOOLPATH_GRP, bCurrToolPath)
EgtDraw()
end
---------------------------------------------------------------------
return RunShowManager
-186
View File
@@ -1,186 +0,0 @@
-- RunSliceAdvancement.lua by Egaltech s.r.l. 2022/06/28
-- Gestione visualizzazione per Stampa 3d
-- Tabella per definizione modulo
local RunSliceAdvancement = {}
-- Intestazioni
require( 'EgtBase')
EgtOutLog( ' RunSliceAdvancement started', 1)
-- Costanti generali
local AMD = require( 'AddManData')
-- Librerie
_G.package.loaded.RunCalcSolids = nil
local CSOLIDS = require( 'RunCalcSolids')
---------------------------------------------------------------------
local function ManageSegmentVisibility( SegmentList, nLastActiveIndex, ToHideList)
for Index = 1, #SegmentList do
EgtSetStatus( SegmentList[Index], EgtIf( Index <= nLastActiveIndex, GDB_ST.ON, GDB_ST.OFF))
end
if ToHideList and #ToHideList > 0 then
for Index = 1, #ToHideList do
EgtSetStatus( ToHideList[Index], GDB_ST.OFF)
end
end
end
---------------------------------------------------------------------
local function CalcType( nEntId, nOldType)
local nType = EgtGetInfo( nEntId, KEY_TYPE, 'i')
if not nType or nType == TYPE.LINK or nType == TYPE.COASTING or nType == TYPE.WIPE then
nType = nOldType
end
if nType == TYPE.RIB or nType == TYPE.AUX_SOLID then
nType = TYPE.INFILL
end
if nType == TYPE.EXTRA_SHELL then
nType = TYPE.INNER_SHELL
end
return nType
end
---------------------------------------------------------------------
function RunSliceAdvancement.Exec()
-- verifico ci sia almeno uno slice
local nFirstPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. 1)
if not nFirstPartId then
EgtOutBox( 'No sliced part in this project!', 'Error', 'ERROR')
return
else
local nLayerId = EgtGetFirstNameInGroup( nFirstPartId, SLICE_LAYER .. 1) or EgtGetFirstNameInGroup( nFirstPartId, "__" .. SLICE_LAYER .. 1)
if not nLayerId then
EgtOutBox( 'No sliced part in this project!', 'Error', 'ERROR')
return
end
end
local nAdvancementType = 1 -- 1 = All, 2 = Only Outer, 3 = Only Inner, 4 = Only Infill
local nPercentage = 30
-- leggo ultimi valori
local nViewId = EgtGetFirstNameInGroup( GDB_ID.ROOT, VIEWPARAMS)
if nViewId then
nAdvancementType = EgtGetInfo( nViewId, KEY_SLICE_ADV_MODE, 'i') or SLICE_ADV_TYPE.ALL
nPercentage = EgtGetInfo( nViewId, KEY_SLICE_ADV_PERC, 'i') or 30
end
local sAdvTypeCombo = ''
if nAdvancementType == SLICE_ADV_TYPE.ALL then
sAdvTypeCombo = 'CB:*All,Only Outer,Only Inner,Only Infill'
elseif nAdvancementType == SLICE_ADV_TYPE.OUTER then
sAdvTypeCombo = 'CB:All,*Only Outer,Only Inner,Only Infill'
elseif nAdvancementType == SLICE_ADV_TYPE.INNER then
sAdvTypeCombo = 'CB:All,Only Outer,*Only Inner,Only Infill'
elseif nAdvancementType == SLICE_ADV_TYPE.INFILL then
sAdvTypeCombo = 'CB:All,Only Outer,Only Inner,*Only Infill'
end
ViewValues = EgtDialogBox( 'Slice advancement', { 'Type', sAdvTypeCombo},
{ 'Percentage (0-100)', tostring( nPercentage)})
if not ViewValues or #ViewValues < 1 then return end
if ViewValues[1] == 'All' then
nAdvancementType = SLICE_ADV_TYPE.ALL
elseif ViewValues[1] == 'Only Outer' then
nAdvancementType = SLICE_ADV_TYPE.OUTER
elseif ViewValues[1] == 'Only Inner' then
nAdvancementType = SLICE_ADV_TYPE.INNER
elseif ViewValues[1] == 'Only Infill' then
nAdvancementType = SLICE_ADV_TYPE.INFILL
end
nPercentage = tonumber( ViewValues[2])
-- ciclo sui pezzi
local nPartIndex = 1
local nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex)
while nPartId do
-- eventuale calcolo dei solidi
local bHasSolids = EgtGetInfo( nPartId, KEY_HAS_SOLIDS, 'b') or false
if not bHasSolids then
EgtSetInfo( nPartId, KEY_CALC_SOLIDS, true)
CSOLIDS.Exec()
end
local nPrintOrder = EgtGetInfo( nPartId, KEY_PRINT_ORDER, 'i')
-- ciclo sui layer per dis/attivare il resto
local nLayerIndex = 1
local nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex) or EgtGetFirstNameInGroup( nPartId, "__" .. SLICE_LAYER .. nLayerIndex)
while nLayerId do
local nCrvId = EgtGetFirstGroupInGroup( nLayerId)
while nCrvId do
local nSolidId = EgtGetFirstNameInGroup( nCrvId, SOLID_GRP)
local ShellList = { {}, {}, {}}
local nSurfId = EgtGetFirstInGroup( nSolidId)
local nOldType = TYPE.OUTER_SHELL
while nSurfId do
local nType = CalcType( nSurfId, nOldType)
nOldType = nType
table.insert( ShellList[nType], nSurfId)
nSurfId = EgtGetNext( nSurfId)
end
local nSegmentQty = 1
local SegmentList
local ToHideList
if nAdvancementType == SLICE_ADV_TYPE.ALL then
nSegmentQty = #ShellList[1] + #ShellList[2] + #ShellList[3]
if nPrintOrder == PRINT_ORDER.EXT_INT_INF then
SegmentList = ShellList[1]
for i = 1, #ShellList[2] do
SegmentList[#SegmentList + 1] = ShellList[2][i]
end
for i = 1, #ShellList[3] do
SegmentList[#SegmentList + 1] = ShellList[3][i]
end
else
SegmentList = ShellList[3]
for i = 1, #ShellList[2] do
SegmentList[#SegmentList + 1] = ShellList[2][i]
end
for i = 1, #ShellList[1] do
SegmentList[#SegmentList + 1] = ShellList[1][i]
end
end
elseif nAdvancementType == SLICE_ADV_TYPE.OUTER then
nSegmentQty = #ShellList[1]
SegmentList = ShellList[1]
ToHideList = ShellList[2]
for i = 1, #ShellList[3] do
ToHideList[#ToHideList + 1] = ShellList[3][i]
end
elseif nAdvancementType == SLICE_ADV_TYPE.INNER then
nSegmentQty = #ShellList[2]
SegmentList = ShellList[2]
ToHideList = ShellList[1]
for i = 1, #ShellList[3] do
ToHideList[#ToHideList + 1] = ShellList[3][i]
end
elseif nAdvancementType == SLICE_ADV_TYPE.INFILL then
nSegmentQty = #ShellList[3]
SegmentList = ShellList[3]
ToHideList = ShellList[1]
for i = 1, #ShellList[2] do
ToHideList[#ToHideList + 1] = ShellList[2][i]
end
end
local nLastActiveIndex = ceil( nSegmentQty * nPercentage / 100)
ManageSegmentVisibility( SegmentList, nLastActiveIndex, ToHideList)
nCrvId = EgtGetNext( nCrvId)
end
nLayerIndex = nLayerIndex + 1
nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex) or EgtGetFirstNameInGroup( nPartId, "__" .. SLICE_LAYER .. nLayerIndex)
end
nPartIndex = nPartIndex + 1
nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex)
end
-- riporto impostazioni in gruppo apposito
EgtSetInfo( nViewId, KEY_SLICE_ADV_MODE, nAdvancementType)
EgtSetInfo( nViewId, KEY_SLICE_ADV_PERC, nPercentage)
EgtDraw()
end
---------------------------------------------------------------------
return RunSliceAdvancement
-113
View File
@@ -1,113 +0,0 @@
-- RunSlicePalette.lua by Egaltech s.r.l. 2022/08/23
-- Gestione visualizzazione per Stampa 3d
-- Tabella per definizione modulo
local RunSlicePalette = {}
-- Intestazioni
require( 'EgtBase')
EgtOutLog( ' RunSlicePalette started', 1)
-- Costanti generali
local AMD = require( 'AddManData')
-- Librerie
_G.package.loaded.RunCalcSolids = nil
local CSOLIDS = require( 'RunCalcSolids')
---------------------------------------------------------------------
function RunSlicePalette.UpdateColors( nPaletteType)
-- ciclo sui pezzi
local nPartIndex = 1
local nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex)
while nPartId do
-- eventuale calcolo dei solidi
local bHasSolids = EgtGetInfo( nPartId, KEY_HAS_SOLIDS, 'b') or false
if not bHasSolids then
EgtSetInfo( nPartId, KEY_CALC_SOLIDS, true)
CSOLIDS.Exec()
end
-- ciclo sui layer per dis/attivare il resto
local nLayerIndex = 1
local nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex)
while nLayerId do
local nCrvId = EgtGetFirstGroupInGroup( nLayerId)
while nCrvId do
local nSolidId = EgtGetFirstNameInGroup( nCrvId, SOLID_GRP)
local nSurfId = EgtGetFirstInGroup( nSolidId)
local nOldType = 0
while nSurfId do
local Color = EgtStdColor( 'GRAY')
if nPaletteType == PALETTE_TYPE.IN_OUT then
local nType = EgtGetInfo( nSurfId, KEY_TYPE, 'i')
if not nType or nType < TYPE.OUTER_SHELL or nType > TYPE.AUX_SOLID then nType = nOldType end
nOldType = nType
-- scelta del colore
if nType == TYPE.OUTER_SHELL or nType == TYPE.EXTRA_OUTER_SHELL then
Color = EgtStdColor( 'TEAL')
elseif nType == TYPE.INNER_SHELL or nType == TYPE.EXTRA_SHELL then
Color = EgtStdColor( 'ORANGE')
elseif nType == TYPE.INFILL then
Color = EgtStdColor( 'YELLOW')
elseif nType == TYPE.LINK then
Color = EgtStdColor( 'GRAY')
elseif nType == TYPE.COASTING then
Color = EgtStdColor( 'BLUE')
elseif nType == TYPE.WIPE then
Color = EgtStdColor( 'LIME')
elseif nType == TYPE.RIB then
Color = EgtStdColor( 'OLIVE')
elseif nType == TYPE.AUX_SOLID then
Color = EgtStdColor( 'AQUA')
end
else
local nResult = EgtGetInfo( nLayerId, KEY_RESULT, 'i')
if nResult == RESULT.OK then
Color = EgtStdColor( 'GREEN')
elseif nResult == RESULT.KO_MINUS then
Color = EgtStdColor( 'ORANGE')
elseif nResult == RESULT.KO_PLUS then
Color = EgtStdColor( 'RED')
end
end
EgtSetColor( nSurfId, Color)
nSurfId = EgtGetNext( nSurfId)
end
nCrvId = EgtGetNext( nCrvId)
end
nLayerIndex = nLayerIndex + 1
nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex)
end
nPartIndex = nPartIndex + 1
nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex)
end
EgtDraw()
end
---------------------------------------------------------------------
function RunSlicePalette.Exec()
local nViewId = EgtGetFirstNameInGroup( GDB_ID.ROOT, VIEWPARAMS) or GDB_ID.NULL
local nOldPaletteType = EgtGetInfo( nViewId, KEY_PALETTE, 'i')
local sCombo = EgtIf( not nOldPaletteType or nOldPaletteType == 1, 'CB:*In/Out,Results', 'CB:In/Out,*Results')
ViewValues = EgtDialogBox( 'Slice Palette', { 'Type', sCombo})
if not ViewValues or #ViewValues < 1 then return end
local nPaletteType = PALETTE_TYPE.IN_OUT -- 1 = In/Out, 2 = Results
if ViewValues[1] == 'In/Out' then
nPaletteType = PALETTE_TYPE.IN_OUT
elseif ViewValues[1] == 'Results' then
nPaletteType = PALETTE_TYPE.RESULTS
end
EgtSetInfo( nViewId, KEY_PALETTE, nPaletteType)
RunSlicePalette.UpdateColors( nPaletteType)
end
---------------------------------------------------------------------
return RunSlicePalette
+52 -204
View File
@@ -26,177 +26,33 @@ _G.package.loaded.CalcToolPath = nil
local CTP = require( 'CalcToolPath')
---------------------------------------------------------------------
local function SetParamInfo( sFile, nParamsGrp, sSection, sKey, sDefaultVal)
local sVal = EgtGetStringFromIni( sSection, sKey, sDefaultVal, sFile)
EgtSetInfo( nParamsGrp, sKey, sVal)
end
---------------------------------------------------------------------
local function LoadParams( sFile, nPartId)
EgtSetInfo( nPartId, KEY_PARAMS, sFile)
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_CALC_SOLIDS, '0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SLICING_45, '0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SLICE_STEP, '1.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_STRAND, '6.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SHELLS_NBR, '3')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_STRAND_OVERLAP, '0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_OFFSET_SLICE, '0.0')
local sStrandOrder = EgtGetStringFromIni( SEC_DEFAULT, KEY_PRINT_ORDER, 'InToOut', sFile)
if sStrandOrder == 'OutToIn' then
EgtSetInfo( nPartId, KEY_PRINT_ORDER, PRINT_ORDER.EXT_INT_INF)
else -- 'InToOut'
EgtSetInfo( nPartId, KEY_PRINT_ORDER, PRINT_ORDER.INF_INT_EXT)
end
local sStrandDirection = EgtGetStringFromIni( SEC_DEFAULT, KEY_PRINT_DIRECTION, 'CCW', sFile)
if sStrandDirection == 'CW' then
EgtSetInfo( nPartId, KEY_PRINT_DIRECTION, PRINT_DIRECTION.CW)
else -- 'CCW'
EgtSetInfo( nPartId, KEY_PRINT_DIRECTION, PRINT_DIRECTION.CCW)
end
local sLinkType = EgtGetStringFromIni( SEC_DEFAULT, KEY_LINK_TYPE, 'None', sFile)
if sLinkType == 'None' then
EgtSetInfo( nPartId, KEY_LINK_TYPE, LINK_TYPE.NONE)
elseif sLinkType == 'BiArc' then
EgtSetInfo( nPartId, KEY_LINK_TYPE, LINK_TYPE.BIARC)
else -- 'Linear'
EgtSetInfo( nPartId, KEY_LINK_TYPE, LINK_TYPE.LINEAR)
end
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SP_OFFSET_ON_SLICE, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_LINK_PARAM, '0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_LINK_ZUP, '0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_FLOOR_NBR, '0')
local sFloorInfill = EgtGetStringFromIni( SEC_DEFAULT, KEY_FLOOR_TYPE, 'Offset', sFile)
if sFloorInfill == 'ZigZag' then
EgtSetInfo( nPartId, KEY_FLOOR_TYPE, INFILL_TYPE.ZIGZAG)
else
EgtSetInfo( nPartId, KEY_FLOOR_TYPE, INFILL_TYPE.OFFSET)
end
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_CEIL_NBR, '0')
local sCeilInfill = EgtGetStringFromIni( SEC_DEFAULT, KEY_CEIL_TYPE, 'Offset', sFile)
if sCeilInfill == 'ZigZag' then
EgtSetInfo( nPartId, KEY_CEIL_TYPE, INFILL_TYPE.ZIGZAG)
else
EgtSetInfo( nPartId, KEY_CEIL_TYPE, INFILL_TYPE.OFFSET)
end
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SPEED, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_FEED, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_EXT_FEED, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_INT_FEED, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_INFILL_FEED, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_LEAD_IN_FEED, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_LEAD_OUT_FEED, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SUPPORT_FEED, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_G0_FEED, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_MATERIAL, '')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_TOOL_DIAM, '0.0')
local sLeadInType = EgtGetStringFromIni( SEC_DEFAULT, KEY_LEAD_IN_TYPE, 'None', sFile)
if sLeadInType == 'Linear' then
EgtSetInfo( nPartId, KEY_LEAD_IN_TYPE, LEAD_TYPE.LINEAR)
elseif sLeadInType == 'Arc' then
EgtSetInfo( nPartId, KEY_LEAD_IN_TYPE, LEAD_TYPE.ARC)
else -- 'None'
EgtSetInfo( nPartId, KEY_LEAD_IN_TYPE, LEAD_TYPE.NONE)
end
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_LEAD_IN_TANG_DIST, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_LEAD_IN_ORTHO_DIST, '0.0')
local sLeadOutType = EgtGetStringFromIni( SEC_DEFAULT, KEY_LEAD_OUT_TYPE, 'None', sFile)
if sLeadOutType == 'Linear' then
EgtSetInfo( nPartId, KEY_LEAD_OUT_TYPE, LEAD_TYPE.LINEAR)
elseif sLeadOutType == 'Arc' then
EgtSetInfo( nPartId, KEY_LEAD_OUT_TYPE, LEAD_TYPE.ARC)
else -- 'None'
EgtSetInfo( nPartId, KEY_LEAD_OUT_TYPE, LEAD_TYPE.NONE)
end
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_LEAD_OUT_TANG_DIST, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_LEAD_OUT_ORTHO_DIST, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_OFFSET_LEAD_POINT, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_COASTING_LEN, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_COASTING_FEED, '20000.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_WIPE_LEN, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_WIPE_FEEDPU, '0.9')
-- parametri per costolature
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_OVERLAP, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_SHELLS_NBR, '0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_INVERT_DIR, '0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_INVERT_ORDER, '0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_LINK, '0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_LEAD_IN_INVERT, '0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_LEAD_IN_LEN, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_LEAD_OUT_INVERT, '0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_LEAD_OUT_LEN, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_LEAD_OUT_COASTING, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_LEAD_OUT_WIPE, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_LEAD_OUT_WIPE_DIR, '0.0')
-- parametri per regioni con diverso numero di passate
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SHELL_NBR_DIFF, '0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SHELL_NBR_COASTING, EgtGetInfo( nPartId, KEY_COASTING_LEN, 'd'))
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SHELL_NBR_WIPE, EgtGetInfo( nPartId, KEY_WIPE_LEN, 'd'))
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SHELL_NBR_WIPE_DIR, '0.0')
-- parametri per solidi ausiliari
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_AUX_SOLIDS_OVERLAP, '0')
local sAuxSolidsInfill = EgtGetStringFromIni( SEC_DEFAULT, KEY_AUX_SOLIDS_INFILL, 'None', sFile)
if sAuxSolidsInfill == 'ZigZag' then
EgtSetInfo( nPartId, KEY_AUX_SOLIDS_INFILL, INFILL_TYPE.ZIGZAG)
elseif sAuxSolidsInfill == 'Offset' then
EgtSetInfo( nPartId, KEY_AUX_SOLIDS_INFILL, INFILL_TYPE.OFFSET)
else
EgtSetInfo( nPartId, KEY_AUX_SOLIDS_INFILL, INFILL_TYPE.NONE)
end
local sAuxSolidsStrandOrder = EgtGetStringFromIni( SEC_DEFAULT, KEY_AUX_SOLIDS_PRINT_ORDER, 'InToOut', sFile)
if sAuxSolidsStrandOrder == 'OutToIn' then
EgtSetInfo( nPartId, KEY_AUX_SOLIDS_PRINT_ORDER, PRINT_ORDER.EXT_INT_INF)
else -- 'InToOut'
EgtSetInfo( nPartId, KEY_AUX_SOLIDS_PRINT_ORDER, PRINT_ORDER.INF_INT_EXT)
end
local sAuxSolidsLinkType = EgtGetStringFromIni( SEC_DEFAULT, KEY_AUX_SOLIDS_LINK_TYPE, 'None', sFile)
if sAuxSolidsLinkType == 'None' then
EgtSetInfo( nPartId, KEY_AUX_SOLIDS_LINK_TYPE, LINK_TYPE.NONE)
elseif sAuxSolidsLinkType == 'BiArc' then
EgtSetInfo( nPartId, KEY_AUX_SOLIDS_LINK_TYPE, LINK_TYPE.BIARC)
else -- 'Linear'
EgtSetInfo( nPartId, KEY_AUX_SOLIDS_LINK_TYPE, LINK_TYPE.LINEAR)
end
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_AUX_SOLIDS_LINK_PARAM, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_AUX_SOLIDS_SP_OFFSET, '0.0')
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_AUX_SOLIDS_COASTING_LEN, EgtGetInfo( nPartId, KEY_COASTING_LEN, 'd'))
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_AUX_SOLIDS_WIPE_LEN, EgtGetInfo( nPartId, KEY_WIPE_LEN, 'd'))
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_AUX_SOLIDS_WIPE_DIR, '0.0')
end
---------------------------------------------------------------------
local function RestoreSolidPosition( nPartId)
local function RestoreOriginalPosition( nPartId)
if not nPartId then return end
-- recupero vecchio movimento
local vtMove = EgtGetInfo( nPartId, KEY_MOVED_PART, 'v')
if vtMove then
vtMove = -vtMove
-- correzione solo del solido ( progetti vecchi)
local vtMove1 = EgtGetInfo( nPartId, KEY_MOVED_PART, 'v')
if vtMove1 then
vtMove1 = - vtMove1
EgtRemoveInfo( nPartId, KEY_MOVED_PART)
local SolidLayId = EgtGetFirstNameInGroup( nPartId, PRINT_SOLID)
if SolidLayId then
local EntId = EgtGetFirstInGroup( SolidLayId)
while EntId do
EgtMove( EntId, vtMove)
EgtMove( EntId, vtMove1, GDB_RT.GLOB)
EntId = EgtGetNext( EntId)
end
end
end
-- correzione dell'intero pezzo
local vtMove = EgtGetInfo( nPartId, KEY_MOVED_PART2, 'v')
if vtMove then
EgtRemoveInfo( nPartId, KEY_MOVED_PART2)
EgtMove( nPartId, - vtMove, GDB_RT.GLOB)
-- sistemo il riferimento
local nFrameId = EgtGetFirstNameInGroup( nPartId, LAY_FRAME)
EgtMove( nFrameId, vtMove, GDB_RT.GLOB)
end
end
---------------------------------------------------------------------
@@ -210,6 +66,19 @@ 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
-- rimuovo eventuali gruppi di infill (anche per aux solids)
local nInfillId = EgtGetFirstNameInGroup( nPartId, INFILL_GRP .. '*')
while nInfillId do
EgtErase( nInfillId)
nInfillId = EgtGetFirstNameInGroup( nPartId, INFILL_GRP .. '*')
end
end
---------------------------------------------------------------------
@@ -274,78 +143,56 @@ function RunSlicing.Exec()
end
local nSolidLayId = EgtGetFirstNameInGroup( nPartId, PRINT_SOLID)
local nStmId = EgtGetFirstInGroup( nSolidLayId or GDB_ID.NULL)
if not nStmId or EgtGetType( nStmId) ~= GDB_TY.SRF_MESH then
EgtOutBox( "Part without surface!", 'Warning', 'WARNING')
return
if nStmId and EgtGetType( nStmId) ~= GDB_TY.SRF_MESH then
EgtOutBox( "Part without surface!", 'Warning', 'WARNING')
return
end
local nRibsLayId = EgtGetFirstNameInGroup( nPartId, LAY_RIBS)
local nShellNbrLay = EgtGetFirstNameInGroup( nPartId, LAY_SHELL_NBR)
local nAuxSolidsLay = EgtGetFirstNameInGroup( nPartId, LAY_AUX_SOLIDS)
local nStartLayId = EgtGetFirstNameInGroup( nPartId, LAY_MACH_START)
local sParamFile
if not PRINT or PRINT.PROGRAM ~= 1 then
--Scelta del file dei parametri
local sPrevParamFile = EgtGetInfo( nPartId, KEY_PARAMS)
if not sPrevParamFile or not EgtExistsFile( sPrevParamFile) then
local sLastParamFile = EgtGetStringFromIni( '3dPrinting', 'ParamFile', '', EgtGetIniFile())
local sDir = EgtSplitPath( sLastParamFile)
sPrevParamFile = sDir..'*.ini'
end
sParamFile = EgtFileDialog( true, sPrevParamFile, 'Param Files (*.ini)|*.ini||')
if not sParamFile then
EgtOutBox( 'No param file selected', 'Warning', 'WARNING')
return
end
EgtWriteStringToIni( '3dPrinting', 'ParamFile', sParamFile, EgtGetIniFile())
end
-- Elimino eventuale precedente file dei risultati
if not PRINT or PRINT.PROGRAM ~= 1 then
local sResultFile = EgtChangePathExtension( sCurrProjectPath, '.csv')
EgtEraseFile( sResultFile)
end
-- Elimino eventuale precedente lavorazione
EgtSetCurrMachGroup()
EgtRemoveAllOperations()
EgtResetCurrMachGroup()
-- Lettura dei parametri
if not PRINT or PRINT.PROGRAM ~= 1 then
LoadParams( sParamFile, nPartId)
end
-- Lettura dati macchina
local sMachIni = EgtGetCurrMachineDir() .. '\\' .. EgtGetCurrMachineName() .. '.ini'
local HMax = tonumber( EgtGetStringFromIni( '3dPrinting', 'HMax', 500, sMachIni))
-- Eventuale ripristino posizione solido
RestoreSolidPosition( nPartId)
-- Eventuale ripristino posizione originaria
RestoreOriginalPosition( nPartId)
-- Rimozione vecchi conti
RemoveOldSlices( nPartId)
-- Rimozione vecchi TFS
RemoveOldTFS()
-- Calcolo delle fette
CSLICES.Exec( nPartId, nStmId, HMax)
local bOk = CSLICES.Exec( nPartId, nStmId)
EgtDraw()
-- Calcolo dei percorsi sul centro strand in basso
CPATHS.Exec( nPartId, nStmId)
bOk = bOk and CPATHS.Exec( nPartId)
EgtDraw()
-- Calcolo dei percorsi di lavoro
CTP.Exec( nPartId)
bOk = bOk and CTP.Exec( nPartId)
EgtDraw()
-- Calcolo dei solidi degli strand a partire dai percorsi di lavoro
local bCalcSolids = EgtGetInfo( nPartId, KEY_CALC_SOLIDS, 'b')
EgtRemoveInfo( nPartId, KEY_HAS_SOLIDS)
if bCalcSolids then
if bCalcSolids and bOk then
CSOLIDS.Exec( nPartId)
end
if not bOk then
-- eventuale ripristino posizione originaria
RestoreOriginalPosition( nPartId)
-- rimozione vecchi conti
RemoveOldSlices( nPartId)
EgtDraw()
return false
end
EgtSetStatus( nSolidLayId, GDB_ST.OFF)
EgtSetStatus( nRibsLayId or GDB_ID.NULL, GDB_ST.OFF)
@@ -356,7 +203,8 @@ function RunSlicing.Exec()
-- Aggiorno impostazioni di visibilita' per ShowManager
SetViewInfo( bCalcSolids)
return true
end
---------------------------------------------------------------------
-195
View File
@@ -1,195 +0,0 @@
-- RunViewManager.lua by Egaltech s.r.l. 2022/07/03
-- Gestione visualizzazione per Stampa 3d
-- Tabella per definizione modulo
local RunViewManager = {}
-- Intestazioni
require( 'EgtBase')
EgtOutLog( ' RunViewManager started', 1)
-- Costanti generali
local AMD = require( 'AddManData')
---------------------------------------------------------------------
local function CalcShow( nShellView, nType)
if nShellView == SHELL_VIEW_TYPE.OUTER then
return ( nType == TYPE.OUTER_SHELL or nType == TYPE.EXTRA_OUTER_SHELL)
elseif nShellView == SHELL_VIEW_TYPE.INNER then
return ( nType == TYPE.INNER_SHELL)
elseif nShellView == SHELL_VIEW_TYPE.INFILL then
return ( nType == TYPE.INFILL)
else --nShellView == SHELL_VIEW_TYPE.ALL
return true
end
end
---------------------------------------------------------------------
local function CalcType( nEntId, nOldType)
local nType = EgtGetInfo( nEntId, KEY_TYPE, 'i')
if not nType or nType == TYPE.LINK or nType == TYPE.COASTING or nType == TYPE.WIPE then
nType = nOldType
end
if nType == TYPE.RIB or nType == TYPE.AUX_SOLID then
nType = TYPE.INFILL
end
if nType == TYPE.EXTRA_SHELL then
nType = TYPE.INNER_SHELL
end
return nType
end
---------------------------------------------------------------------
function RunViewManager.Exec()
local nVisibilityMode = LAYER_VIEW_TYPE.ALL -- 1 = All, 2 = Till Selected, 3 = Only Selected, 4 = From Selected
local nShellType = SHELL_VIEW_TYPE.ALL -- 1 = All, 2 = Outer, 3 = Inner, 4 = infill
local nOldSelLayerId = GDB_ID.NULL
-- leggo ultimi valori
local nViewId = EgtGetFirstNameInGroup( GDB_ID.ROOT, VIEWPARAMS)
if nViewId then
nVisibilityMode = EgtGetInfo( nViewId, KEY_LAYER_VIEW, 'i')
nShellType = EgtGetInfo( nViewId, KEY_SHELL_VIEW, 'i')
nOldSelLayerId = EgtGetInfo( nViewId, KEY_SEL_LAYER, 'i') or GDB_ID.NULL
end
local sLayerViewCombo = ''
if nVisibilityMode == LAYER_VIEW_TYPE.TILL_SEL then
sLayerViewCombo = 'CB:All,*Till Selected,Only Selected,From Selected'
elseif nVisibilityMode == LAYER_VIEW_TYPE.ONLY_SEL then
sLayerViewCombo = 'CB:All,Till Selected,*Only Selected,From Selected'
elseif nVisibilityMode == LAYER_VIEW_TYPE.FROM_SEL then
sLayerViewCombo = 'CB:All,Till Selected,Only Selected,*From Selected'
else
sLayerViewCombo = 'CB:*All,Till Selected,Only Selected,From Selected'
end
local sShellViewCombo = ''
if nShellType == SHELL_VIEW_TYPE.OUTER then
sShellViewCombo = 'CB:All,*Outer,Inner,Infill'
elseif nShellType == SHELL_VIEW_TYPE.INNER then
sShellViewCombo = 'CB:All,Outer,*Inner,Infill'
elseif nShellType == SHELL_VIEW_TYPE.INFILL then
sShellViewCombo = 'CB:All,Outer,Inner,*Infill'
else
sShellViewCombo = 'CB:*All,Outer,Inner,Infill'
end
ViewValues = EgtDialogBox( 'Slicing visibility manager', { 'Visibility Mode', sLayerViewCombo},
{ 'Shell type', sShellViewCombo})
if not ViewValues or #ViewValues < 2 then return end
if ViewValues[1] == 'All' then
nVisibilityMode = LAYER_VIEW_TYPE.ALL
elseif ViewValues[1] == 'Till Selected' then
nVisibilityMode = LAYER_VIEW_TYPE.TILL_SEL
elseif ViewValues[1] == 'Only Selected' then
nVisibilityMode = LAYER_VIEW_TYPE.ONLY_SEL
elseif ViewValues[1] == 'From Selected' then
nVisibilityMode = LAYER_VIEW_TYPE.FROM_SEL
end
if ViewValues[2] == 'All' then
nShellType = SHELL_VIEW_TYPE.ALL
elseif ViewValues[2] == 'Outer' then
nShellType = SHELL_VIEW_TYPE.OUTER
elseif ViewValues[2] == 'Inner' then
nShellType = SHELL_VIEW_TYPE.INNER
elseif ViewValues[2] == 'Infill' then
nShellType = SHELL_VIEW_TYPE.INFILL
end
-- Recupero ultimo layer selezionato
-- verifico sia un pezzo valido
local sSelLayerName = ''
local bFound = false
local nSelLayerId = EgtGetLastSelectedObj()
while nSelLayerId do
local sSelLayerName = EgtGetName( nSelLayerId)
if sSelLayerName and ( sSelLayerName:sub(1, 5) == SLICE_LAYER or sSelLayerName:sub(3, 7) == SLICE_LAYER) then
bFound = true
break
end
nSelLayerId = EgtGetParent( nSelLayerId)
end
if not bFound then
if nOldSelLayerId and nOldSelLayerId ~= GDB_ID.NULL then
nSelLayerId = nOldSelLayerId
else
if nVisibilityMode ~= LAYER_VIEW_TYPE.ALL then
EgtOutBox( 'No selected element!', 'Warning', 'WARNING')
return
else
nSelLayerId = GDB_ID.NULL
sSelLayerName = ''
end
end
end
-- ciclo sui pezzi
local nPartIndex = 1
local nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex)
while nPartId do
-- ciclo sui layer per dis/attivare il resto
local nLayerIndex = 1
local nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex) or EgtGetFirstNameInGroup( nPartId, "__" .. SLICE_LAYER .. nLayerIndex)
while nLayerId do
if nVisibilityMode == LAYER_VIEW_TYPE.ALL then
EgtSetStatus( nLayerId, GDB_ST.ON)
elseif nVisibilityMode == LAYER_VIEW_TYPE.TILL_SEL then
EgtSetStatus( nLayerId, EgtIf( nLayerId <= nSelLayerId, GDB_ST.ON, GDB_ST.OFF))
elseif nVisibilityMode == LAYER_VIEW_TYPE.ONLY_SEL then
EgtSetStatus( nLayerId, EgtIf( nLayerId == nSelLayerId, GDB_ST.ON, GDB_ST.OFF))
elseif nVisibilityMode == LAYER_VIEW_TYPE.FROM_SEL then
EgtSetStatus( nLayerId, EgtIf( nLayerId >= nSelLayerId, GDB_ST.ON, GDB_ST.OFF))
end
local nCrvId = EgtGetFirstGroupInGroup( nLayerId)
while nCrvId do
----
local nOldType = TYPE.OUTER_SHELL
local nPathId = EgtGetFirstNameInGroup( nCrvId, PATH_GRP)
local nShellId = EgtGetFirstInGroup( nPathId)
while nShellId do
local nType = CalcType( nShellId, nOldType)
nOldType = nType
EgtSetStatus( nShellId, EgtIf( CalcShow( nShellType, nType), GDB_ST.ON, GDB_ST.OFF))
nShellId = EgtGetNext( nShellId)
end
----
nOldType = TYPE.OUTER_SHELL
local nSolidId = EgtGetFirstNameInGroup( nCrvId, SOLID_GRP)
local nSurfId = EgtGetFirstInGroup( nSolidId)
while nSurfId do
local nType = CalcType( nSurfId, nOldType)
nOldType = nType
EgtSetStatus( nSurfId, EgtIf( CalcShow( nShellType, nType), GDB_ST.ON, GDB_ST.OFF))
nSurfId = EgtGetNext( nSurfId)
end
----
nOldType = TYPE.OUTER_SHELL
local nToolPathId = EgtGetFirstNameInGroup( nCrvId, TOOLPATH_GRP)
nShellId = EgtGetFirstInGroup( nToolPathId)
while nShellId do
local nType = CalcType( nShellId, nOldType)
nOldType = nType
EgtSetStatus( nShellId, EgtIf( CalcShow( nShellType, nType), GDB_ST.ON, GDB_ST.OFF))
nShellId = EgtGetNext( nShellId)
end
nCrvId = EgtGetNext( nCrvId)
end
nLayerIndex = nLayerIndex + 1
nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex) or EgtGetFirstNameInGroup( nPartId, "__" .. SLICE_LAYER .. nLayerIndex)
end
nPartIndex = nPartIndex + 1
nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex)
end
-- riporto impostazioni in gruppo apposito
EgtSetInfo( nViewId, KEY_LAYER_VIEW, nVisibilityMode)
EgtSetInfo( nViewId, KEY_SHELL_VIEW, nShellType)
EgtSetInfo( nViewId, KEY_SEL_LAYER, nSelLayerId)
EgtDraw()
end
---------------------------------------------------------------------
return RunViewManager
-18
View File
@@ -1,18 +0,0 @@
-- MachiningParamCalc.lua by Egaltech s.r.l. 2022/04/05
-- Gestione visualizzazione per Stampa 3d
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Stampa 3d
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Librerie
_G.package.loaded.RunMachiningParamCalc = nil
local RMPC = require( 'RunMachiningParamCalc')
-- Calcolo
RMPC.Exec()
-18
View File
@@ -1,18 +0,0 @@
-- MachiningParamCalc.lua by Egaltech s.r.l. 2022/04/05
-- Gestione visualizzazione per Stampa 3d
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Stampa 3d
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Librerie
_G.package.loaded.RunMachiningParamEdit = nil
local RMPE = require( 'RunMachiningParamEdit')
-- Calcolo
RMPE.Exec()
-18
View File
@@ -1,18 +0,0 @@
-- MachiningParamCalc.lua by Egaltech s.r.l. 2022/04/09
-- Gestione edit parametri materiali per Stampa 3d
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Stampa 3d
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Librerie
_G.package.loaded.RunMaterialParamEdit = nil
local RMPE = require( 'RunMaterialParamEdit')
-- Calcolo
RMPE.Exec()
-20
View File
@@ -1,20 +0,0 @@
-- PlacePart.lua by Egaltech s.r.l. 2022/04/11
-- Gestione calcolo disposizione e lavorazioni per stampa 3d
-- 2022/03/21 Creazione file
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Stampa 3d
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Librerie
_G.package.loaded.RunPartPositioning = nil
local RPP = require( 'RunPartPositioning')
-- Calcolo
RPP.Exec()
-18
View File
@@ -1,18 +0,0 @@
-- ShowManager.lua by Egaltech s.r.l. 2022/04/05
-- Gestione visualizzazione per Stampa 3d
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Stampa 3d
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Librerie
_G.package.loaded.RunShowManager = nil
local RSM = require( 'RunShowManager')
-- Calcolo
RSM.Exec()
-18
View File
@@ -1,18 +0,0 @@
-- SliceAdvancement.lua by Egaltech s.r.l. 2022/04/05
-- Gestione visualizzazione per Stampa 3d
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Stampa 3d
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Librerie
_G.package.loaded.RunSliceAdvancement = nil
local RSA = require( 'RunSliceAdvancement')
-- Calcolo
RSA.Exec()
-18
View File
@@ -1,18 +0,0 @@
-- SlicePalette.lua by Egaltech s.r.l. 2022/04/05
-- Gestione visualizzazione per Stampa 3d
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Stampa 3d
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Librerie
_G.package.loaded.RunSlicePalette = nil
local RSP = require( 'RunSlicePalette')
-- Calcolo
RSP.Exec()
+2 -3
View File
@@ -1,4 +1,4 @@
-- Slicing.lua by Egaltech s.r.l. 2022/03/30
-- Slicing.lua by Egaltech s.r.l. 2023/01/11
-- Calcoli prima fase per Stampa 3d
-- Intestazioni
@@ -7,8 +7,7 @@ _ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Stampa 3d
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
EgtAddToPackagePath( PRINT.BASEDIR .. '\\LuaLibs\\?.lua')
-- Librerie
_G.package.loaded.RunSlicing = nil
+4
View File
@@ -0,0 +1,4 @@
-- Version.lua by Egaltech s.r.l. 2023/08/28
-- Gestione della versione di 3dPrinting
VERSION = '2.5h1'
-18
View File
@@ -1,18 +0,0 @@
-- ViewManager.lua by Egaltech s.r.l. 2022/04/05
-- Gestione visualizzazione per Stampa 3d
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Stampa 3d
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Librerie
_G.package.loaded.RunViewManager = nil
local RVM = require( 'RunViewManager')
-- Calcolo
RVM.Exec()