Compare commits

...

65 Commits

Author SHA1 Message Date
luca.mazzoleni 72e653fe4b Feature/FindMirroredFeatures:
- lieve bugfix
2023-01-31 17:36:39 +01:00
luca.mazzoleni 14d2d14ba4 Feature/FindMirroredFeatures:
- aggiunta una minima distanza tra le feature specchiate al di sotto della quale la lavorazione non viene fatta in doppio
- alcuni bugfix minori
2023-01-31 15:23:44 +01:00
luca.mazzoleni f3d54fd124 Feature/FindMirroredFeatures:
- aggiunta gestione mortise L050/L051 in doppio
2023-01-31 09:20:05 +01:00
luca.mazzoleni a357faeabe Merge branch 'develop' into Feature/FindMirroredFeatures 2023-01-31 08:55:07 +01:00
luca.mazzoleni 4b531271af Improvement:
- in LongCut con lavorazione aggiuntiva di sega a catena aggiunti step parziali per la lavorazione con lama da sotto
2023-01-27 17:31:07 +01:00
luca.mazzoleni 8bde91b13c Merge remote-tracking branch 'origin/master' into develop 2023-01-27 12:13:55 +01:00
luca.mazzoleni b21cc7a85b Fix:
- in LongCut e Long2Cut, nella pulitura della faccia laterale, lead out fissato a 10 mm
2023-01-27 10:21:40 +01:00
luca.mazzoleni c40f03e8a4 Fix minore 2023-01-26 17:18:47 +01:00
DarioS 59bfbd3bbe Merge branch 'develop' of https://gitlab.steamware.net/egaltech/DataBeam 2023-01-26 17:18:42 +01:00
luca.mazzoleni 7beee74638 Bugfix minore 2023-01-26 17:13:05 +01:00
luca.mazzoleni 6eef34f1ef Fix:
- in longCut/longDoubleCut rimossa la pulitura della faccia laterale nel caso in cui la feature abbia almeno una faccia rivolta verso il basso
2023-01-26 16:30:58 +01:00
luca.mazzoleni 0738cde565 Merge remote-tracking branch 'origin/master' into develop 2023-01-26 15:03:16 +01:00
DarioS 4be2686584 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/DataBeam 2023-01-26 12:41:15 +01:00
DarioS 4bd7ad4263 DataBeam :
- corretta scelta lavorazione per macchine con due teste solo da sopra (PF e PFrl)
- modifica a LapJoint trasversale stretto, se la lavorazione non genera toolpath allora si passa a tentare con la lama
- in Split aggiunto controllo per evitare sqrt di valori negativi.
2023-01-26 12:40:55 +01:00
luca.mazzoleni 1a2675ed56 fix commenti 2023-01-26 09:38:42 +01:00
luca.mazzoleni aa8fd354d9 Improvement:
- in ProcessCut migliorata in alcuni casi la direzione di lavoro della lama, per scaricare il truciolo nella direzione ottimale
- in ProcessLapJoint leggera correzione al diametro massimo utensile per tasche 3 facce a L
2023-01-26 09:35:40 +01:00
luca.mazzoleni 89b968f0d1 Fix:
- in LapJoint piccola modifica al diametro massimo dell'utensile per tasche 3 facce a L
2023-01-25 14:43:35 +01:00
luca.mazzoleni d5fdf37c9c BugFix:
- in LapJoint -> MakeByPocket gestito caso in cui poteva essere applicata una lavorazione con percorso vuoto
2023-01-25 09:26:11 +01:00
luca.mazzoleni ab67c86657 Merge branch 'master' into develop 2023-01-23 08:53:02 +01:00
DarioS ca9fa091cc DataBeam :
- aggiunta funzione BeamLib.GetDistanceToNextPart per facilitare controllo di non rovinare parti in coda su lavorazioni longitudinali
- utilizzata in LongCut, LongDoubleCut e in LapJoint dove serve.
2023-01-22 16:12:50 +01:00
DarioS 60a00a81fa DataBeam :
- in lavorazione Tenoni modificata scelta lato di attacco per pezzo piccolo su macchine con pinza speciale (pinza 5)
- in lavorazione LapJoint (sottospecie L020) migliorato riconoscimento caso Special3faces
- estesa funzione di libreria PutStartNearestToEdge per gestire lato preferito come Y+, Y-, z*, Z-.
2023-01-21 10:02:28 +01:00
luca.mazzoleni bd870c8ac6 Fix:
- in LongCut azzerato il sovramateriale lasciato dalla eventuale lavorazione aggiuntiva di sega a catena
2023-01-20 16:20:35 +01:00
luca.mazzoleni 623fd30a6c Merge branch 'Feature/L010MillStopIfUnloadableRawPiece' into develop 2023-01-20 15:34:29 +01:00
luca.mazzoleni 4c239cf6a7 Feature/L010MillStopIfUnloadableRawPiece:
- ora la LongCut accorcia il percorso del truciolatore se il grezzo rimanente è scaricabile
2023-01-20 14:56:57 +01:00
luca.mazzoleni bc6886394e BugFix:
- in ProcessLapJoint->MakeMoreFaces->MakeBySideMill aggiunto controllo che lo step finale non superi lo spessore utensile
2023-01-19 11:15:04 +01:00
luca.mazzoleni b4369e92ff Merge branch 'Feature/T010LongCutsFinishWithChainSaw' into develop 2023-01-18 18:16:04 +01:00
luca.mazzoleni aeef0a7180 Feature/T010LongCutsFinishWithChainSaw: Fix minore 2023-01-18 18:15:49 +01:00
luca.mazzoleni 6271975662 Feature/T010LongCutsFinishWithChainSaw: Fix minore 2023-01-18 14:58:50 +01:00
luca.mazzoleni 8709ea7646 Feature/T010LongCutsFinishWithChainSaw:
- aggiunta, per longcut da T010, lavorazione aggiuntiva con sega a catena nel caso la doppia lama non sia sufficiente.
Attivabile con valore opportuno di Q05
2023-01-18 11:56:07 +01:00
luca.mazzoleni a9be5bf51e Merge remote-tracking branch 'origin/master' into develop 2023-01-17 15:43:57 +01:00
DarioS 2f329961ba DataBeam :
- correzione al Nesting 1D.
2023-01-17 11:44:36 +01:00
luca.mazzoleni 1e71fd5c9f Merge remote-tracking branch 'origin/master' into develop 2023-01-12 09:04:16 +01:00
DarioS 5d6140fac3 DataBeam :
- aggiornata lista file da ignorare.
2023-01-11 19:27:28 +01:00
DarioS 6b27b7f0f8 DataBeam :
- compilazione 32 e 64 bit unificata in bin.
2023-01-11 19:23:49 +01:00
luca.mazzoleni a1b140c15e Merge branch 'master' into develop 2023-01-11 09:20:25 +01:00
DarioS e91ee09ac9 DataBeam :
- modifiche a gestione StepJointNotch (3/4-80-X).
2023-01-11 09:12:44 +01:00
luca.mazzoleni 07e07028a4 Merge branch 'develop' 2023-01-10 18:38:18 +01:00
luca.mazzoleni 2523475a06 fix commenti 2023-01-10 16:48:15 +01:00
luca.mazzoleni 3c5faceedf BugFix:
- in BeamLib.GetFaceWithMostAdj aggiunto controllo che la feature abbia almeno una faccia aperta
2023-01-10 16:46:55 +01:00
luca.mazzoleni 6adea859ce Merge branch 'master' into develop 2023-01-10 09:14:31 +01:00
DarioS 6996c5617e DataBeam :
- piccola modifica per rendere più robusti i calcoli.
2023-01-10 08:46:19 +01:00
luca.mazzoleni 8dddb4cc35 Fix dopo merge 2023-01-09 10:34:58 +01:00
luca.mazzoleni 0c6b36ed49 Merge branch 'master' into develop 2023-01-09 10:26:47 +01:00
DarioS 10f6830cad DataBeam :
- altre piccole modifiche per rendere più robusti alcuni test.
2023-01-09 09:54:15 +01:00
DarioS ab5dfef3eb DataBeam :
- piccola correzione delle precedenti modifiche.
2023-01-07 16:14:40 +01:00
DarioS 4cb7dce121 DataBeam :
- allineamento tra master e develop
- modifiche per lavorazioni in doppio su PF1250.
2023-01-07 11:05:04 +01:00
luca.mazzoleni 0ec9661d9a Feature/FindMirroredFeatures:
- fix commenti
2022-12-28 19:26:51 +01:00
luca.mazzoleni 75a4b30d18 Merge branch 'Feature/FindMirroredFeatures' into develop 2022-12-28 19:18:48 +01:00
luca.mazzoleni b60c76e64b Feature/FindMirroredFeatures:
- piccola correzione nel riconoscimento mortase specchiate
2022-12-28 19:18:35 +01:00
luca.mazzoleni 8e037e0943 Feature/FindMirroredFeatures:
- per le forature in doppio aggiunto controllo attivazione e lunghezza seconda punta
2022-12-28 19:02:03 +01:00
luca.mazzoleni 966d3a794a Merge remote-tracking branch 'origin/develop' into Feature/FindMirroredFeatures 2022-12-27 09:45:40 +01:00
Emmanuele Sassi b9c2a2e1b9 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/DataBeam into develop 2022-12-23 17:57:59 +01:00
Emmanuele Sassi cb70e2a47d - nuovo nesting che fa piu' tentativi con diversi indici di pezzi piccoli 2022-12-23 17:57:10 +01:00
luca.mazzoleni c7b5570dd8 Feature/FindMirroredFeatures:
- aggiunto riconoscimento forature da fare in doppio, da testare
- aggiunto riconoscimento code di rondine in doppio, da testare
- in caso di riconoscimento lavorazione in doppio si scrivono le opportune note nella lavorazione
2022-12-22 19:04:52 +01:00
DarioS 4445ce4f11 DataBeam :
- modifiche a LapJoint per lavorazione fessure in X con SideMillAsSaw
- eliminato modulo sperimentale.
2022-12-22 09:57:48 +01:00
luca.mazzoleni 527bb52aba Merge remote-tracking branch 'origin/master' into Feature/FindMirroredFeatures 2022-12-22 09:11:56 +01:00
DarioS 0d5e2737e4 DataBeam :
- su Tenoni aggiunta gestione smusso, migliorata scelta tra sopra e sotto per il punto di inizio e in VerifyOrientation aggiunta trave medio alta
- su SawCut aggiunta gestione testa da sotto
- su Cut allargati i limiti di lunghezza per tagli verticali inclinati di fianco.
2022-12-21 09:42:33 +01:00
luca.mazzoleni e513a43ae9 Merge branch 'develop' into Feature/FindMirroredFeatures 2022-12-16 14:58:29 +01:00
luca.mazzoleni 8a58bf0fa6 Merge branch 'Feature/SideMillOnL20' into develop 2022-12-16 14:53:38 +01:00
luca.mazzoleni dc781d06ba Feature/SideMillOnL20:
- Per L20 implementata forzatura utilizzo fresa di lato tramite parametro Q04
2022-12-16 12:35:15 +01:00
luca.mazzoleni 18826b5302 Merge branch 'develop' into Feature/FindMirroredFeatures 2022-11-18 10:28:45 +01:00
luca.mazzoleni 07d3f5ffa8 Merge branch 'develop' into Feature/FindMirroredFeatures 2022-10-06 09:49:25 +02:00
luca.mazzoleni c7a9213a2c Merge branch 'develop' into Feature/FindMirroredFeatures 2022-10-05 10:50:54 +02:00
luca.mazzoleni d9f06eb07d Fix commenti 2022-10-04 17:14:51 +02:00
luca.mazzoleni d5f5eaa844 Merge branch 'develop' into Feature/FindMirroredFeatures 2022-10-04 17:01:13 +02:00
25 changed files with 1415 additions and 6020 deletions
+4 -7
View File
@@ -13,12 +13,9 @@
/Debug64 /Debug64
/Release64 /Release64
/ipch /ipch
/bin
/obj /obj
/.vs /.vs
/32/*.lua /bin/*.lua
/32/LuaLibs/*.lua /bin/*.ini
/32/Images/*.png /bin/LuaLibs/*.lua
/64/*.lua /bin/Images/*.png
/64/LuaLibs/*.lua
/64/Images/*.png
+18 -56
View File
@@ -7,65 +7,33 @@ variables:
NET_USERQ: 'steamw\egalware' NET_USERQ: 'steamw\egalware'
#Note compilazione LUA: #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 # helper compilazione LUA a 32 e 64 bit
.LuaCompile32: &LuaCompile32 .LuaCompile: &LuaCompile
- | - |
Set-Alias lua53 C:\Tools\Lua32\luac53 Set-Alias lua54 C:\Tools\Lua32\luac54
echo "Copia file *.ini" echo "Copia file *.ini"
$FileList = Get-ChildItem("*.ini") $FileList = Get-ChildItem("*.ini")
ForEach ($File in $FileList) { ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf $FileName = Split-Path $File -leaf
Copy-Item -Path $FileName -Destination 32\$FileName Copy-Item -Path $FileName -Destination bin\$FileName
echo "Copy-Item -Path $FileName -Destination 32\$FileName" echo "Copy-Item -Path $FileName -Destination bin\$FileName"
} }
echo "Compilazione file *.lua 32bit" echo "Compilazione file *.lua 32/64bit"
$FileList = Get-ChildItem("*.lua") $FileList = Get-ChildItem("*.lua")
ForEach ($File in $FileList) { ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf $FileName = Split-Path $File -leaf
lua53 -o 32\$FileName $FileName lua54 -o bin\$FileName $FileName
echo "lua53 -o 32\$FileName $FileName" echo "lua54 -o bin\$FileName $FileName"
} }
$FileList = Get-ChildItem("LuaLibs\*.lua") $FileList = Get-ChildItem("LuaLibs\*.lua")
ForEach ($File in $FileList) { ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf $FileName = Split-Path $File -leaf
lua53 -o 32\LuaLibs\$FileName LuaLibs\$FileName lua54 -o bin\LuaLibs\$FileName LuaLibs\$FileName
echo "lua53 -o 32\LuaLibs\$FileName LuaLibs\$FileName" echo "lua54 -o bin\LuaLibs\$FileName LuaLibs\$FileName"
} }
# Copy-Item -Path $FileName -Destination 32\$FileName
# echo "Copy-Item -Path $FileName -Destination 32\$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 "Compilazione file *.lua 64bit"
$FileList = Get-ChildItem("*.lua")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
lua53 -o 64\$FileName $FileName
echo "lua53 -o 64\$FileName $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 # helper copia SORGENTI verso cartella di rete R:\ dei SORGENTI
.CodeReplicaR: &CodeReplicaR .CodeReplicaR: &CodeReplicaR
- | - |
@@ -75,27 +43,23 @@ variables:
SLEEP 2 SLEEP 2
net use R: /delete net use R: /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 .ReplicaR: &ReplicaR
- | - |
net use R: /delete net use R: /delete
net use R: $env:NET_SHARE_R /u:$env:NET_USERQ $ZDRIVE_PASSWD net use R: $env:NET_SHARE_R /u:$env:NET_USERQ $ZDRIVE_PASSWD
ROBOCOPY /MIR 32 R:\EgtData\$env:APP_NAME\32 ROBOCOPY /MIR bin R:\EgtData\$env:APP_NAME\bin
ROBOCOPY /MIR 64 R:\EgtData\$env:APP_NAME\64 ROBOCOPY /MIR Images R:\EgtData\$env:APP_NAME\bin\Images
ROBOCOPY /MIR Images R:\EgtData\$env:APP_NAME\32\Images
ROBOCOPY /MIR Images R:\EgtData\$env:APP_NAME\64\Images
SLEEP 2 SLEEP 2
net use R: /delete net use R: /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
.ReplicaZ: &ReplicaZ .ReplicaZ: &ReplicaZ
- | - |
net use Z: /delete net use Z: /delete
net use Z: $env:NET_SHARE_Z /u:$env:NET_USERQ $ZDRIVE_PASSWD net use Z: $env:NET_SHARE_Z /u:$env:NET_USERQ $ZDRIVE_PASSWD
ROBOCOPY /MIR 32 Z:\EgtData\$env:APP_NAME\32 ROBOCOPY /MIR bin Z:\EgtData\$env:APP_NAME\bin
ROBOCOPY /MIR 64 Z:\EgtData\$env:APP_NAME\64 ROBOCOPY /MIR Images Z:\EgtData\$env:APP_NAME\bin\Images
ROBOCOPY /MIR Images Z:\EgtData\$env:APP_NAME\32\Images
ROBOCOPY /MIR Images Z:\EgtData\$env:APP_NAME\64\Images
SLEEP 2 SLEEP 2
net use Z: /delete net use Z: /delete
@@ -110,9 +74,7 @@ LuaCompile:build:
tags: tags:
- win - win
script: script:
- *LuaCompile32 - *LuaCompile
- *LuaCompile64
- *CodeReplicaR - *CodeReplicaR
- *ReplicaR - *ReplicaR
- *ReplicaZ - *ReplicaZ
View File
View File
+48 -99
View File
@@ -1,103 +1,52 @@
REM Compilazione degli script Beam Egaltech 2022.05.09 REM Compilazione degli script Beam Egaltech 2023.01.11
REM Per togliere info di debug aggiungere flag -s prima del nome del file di input REM Per togliere info di debug aggiungere flag -s prima del nome del file di input
REM Compilazione 32 bit REM Compilazione 32 e 64 bit
\EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLapJointNew.lua LuaLibs\ProcessLapJointNew.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua \EgtProg\Dll32\luac54 -o bin\BatchProcess.lua BatchProcess.lua
\EgtProg\Dll32\luac53 -o 32\BatchProcess.lua BatchProcess.lua \EgtProg\Dll32\luac54 -o bin\BatchProcessNew.lua BatchProcessNew.lua
\EgtProg\Dll32\luac53 -o 32\BatchProcessNew.lua BatchProcessNew.lua \EgtProg\Dll32\luac54 -o bin\GetBeamData.lua GetBeamData.lua
\EgtProg\Dll32\luac53 -o 32\GetBeamData.lua GetBeamData.lua \EgtProg\Dll32\luac54 -o bin\NestProcess.lua NestProcess.lua
\EgtProg\Dll32\luac53 -o 32\NestProcess.lua NestProcess.lua \EgtProg\Dll32\luac54 -o bin\Process.lua Process.lua
\EgtProg\Dll32\luac53 -o 32\Process.lua Process.lua \EgtProg\Dll32\luac54 -o bin\Rotate.lua Rotate.lua
\EgtProg\Dll32\luac53 -o 32\Rotate.lua Rotate.lua \EgtProg\Dll32\luac54 -o bin\Swap.lua Swap.lua
\EgtProg\Dll32\luac53 -o 32\Swap.lua Swap.lua
REM Compilazione 64 bit
\EgtProg\Dll64\luac53 -o 64\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLapJointNew.lua LuaLibs\ProcessLapJointNew.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua
\EgtProg\Dll64\luac53 -o 64\BatchProcess.lua BatchProcess.lua
\EgtProg\Dll64\luac53 -o 64\BatchProcessNew.lua BatchProcessNew.lua
\EgtProg\Dll64\luac53 -o 64\GetBeamData.lua GetBeamData.lua
\EgtProg\Dll64\luac53 -o 64\NestProcess.lua NestProcess.lua
\EgtProg\Dll64\luac53 -o 64\Process.lua Process.lua
\EgtProg\Dll64\luac53 -o 64\Rotate.lua Rotate.lua
\EgtProg\Dll64\luac53 -o 64\Swap.lua Swap.lua
+317 -89
View File
@@ -1,4 +1,4 @@
-- BeamExec.lua by Egaltech s.r.l. 2022/12/23 -- BeamExec.lua by Egaltech s.r.l. 2022/12/28
-- Libreria esecuzione lavorazioni per Travi -- Libreria esecuzione lavorazioni per Travi
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3. -- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
-- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato. -- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato.
@@ -38,6 +38,9 @@
-- 2022/09/28 I fori vengono sempre fatti prima delle tacche. -- 2022/09/28 I fori vengono sempre fatti prima delle tacche.
-- 2022/09/29 Aggiunta la ricerca di feature specchiate, al momento solo per DtMortise, con le relative funzioni. -- 2022/09/29 Aggiunta la ricerca di feature specchiate, al momento solo per DtMortise, con le relative funzioni.
-- 2022/12/23 Corrette rotazioni 90 deg per macchine con carico da destra. -- 2022/12/23 Corrette rotazioni 90 deg per macchine con carico da destra.
-- 2022/12/28 Implementata gestione forature e code di rondine in doppio.
-- 2023/01/31 Implementata gestione mortase in doppio.
-- 2023/01/31 Nelle lavorazioni in doppio aggiunta la minima distanza tra le feature.
-- Tabella per definizione modulo -- Tabella per definizione modulo
@@ -153,6 +156,9 @@ local function IsHeadFeature( Proc, b3Raw, dCurrOvmH)
if Drill.Identify( Proc) then if Drill.Identify( Proc) then
return Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH) return Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end end
if StJoNotch.Identify( Proc) then
return StJoNotch.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if RoundArch.Identify( Proc) then if RoundArch.Identify( Proc) then
return RoundArch.IsHeadFeature( Proc, b3Raw, dCurrOvmH) return RoundArch.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end end
@@ -218,6 +224,9 @@ local function IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
if Drill.Identify( Proc) then if Drill.Identify( Proc) then
return Drill.IsTailFeature( Proc, b3Raw, dCurrOvmT) return Drill.IsTailFeature( Proc, b3Raw, dCurrOvmT)
end end
if StJoNotch.Identify( Proc) then
return StJoNotch.IsTailFeature( Proc, b3Raw)
end
if DtMortise.Identify( Proc) then if DtMortise.Identify( Proc) then
return DtMortise.IsTailFeature( Proc, b3Raw) return DtMortise.IsTailFeature( Proc, b3Raw)
end end
@@ -954,8 +963,8 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
table.Insert ( vMachineBeforeIntersectingDrillingsId, Proc.Id) table.Insert ( vMachineBeforeIntersectingDrillingsId, Proc.Id)
end end
-- se senza geometria (già disabilitato -- se senza geometria (già disabilitato)
if Proc.Flg == 0 then if Proc.Flg == 0 and not Proc.Double then
bOk = false bOk = false
-- se intestatura -- se intestatura
elseif Hcut.Identify( Proc) then elseif Hcut.Identify( Proc) then
@@ -1371,102 +1380,313 @@ local function MoveDrillsOnTenon( vProc)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
-- Estrazione parametri P da lavorazioni di tipo DtMortise -- Controlla se la feature ProcMirror è la specchiata di Proc, per feature di tipo tasca o simile
local function GetPParametersDtMortise( Proc) local function CheckMirrorPocket( Proc, ProcMirror, b3Raw, AuxId)
local vPParameters = {
{ 'P01', 'd'}, -- recupero i dati geometrici della curva Proc
{ 'P02', 'd'}, local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
{ 'P03', 'd'}, local ptBC = EgtGP( AuxId, GDB_RT.GLOB)
{ 'P04', 'i'}, local rfDtMrt = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_RT.GLOB)
{ 'P05', 'i'}, local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt)
{ 'P06', 'd'}, local b3Proc = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD)
{ 'P07', 'd'}, -- determino l'asse della curva Proc
{ 'P09', 'd'}, local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
{ 'P10', 'd'},
{ 'P11', 'd'}, -- recupero e verifico l'entità curva ProcMirror
{ 'P12', 'd'}, local AuxIdMirror = EgtGetInfo( ProcMirror.Id, 'AUXID', 'i')
{ 'P13', 'd'}, if AuxIdMirror then AuxIdMirror = AuxIdMirror + ProcMirror.Id end
{ 'P14', 'd'}, if not AuxIdMirror or ( EgtGetType( AuxIdMirror) & GDB_FY.GEO_CURVE) == 0 then
{ 'P15', 'd'} return false
}
for i = 1, #vPParameters do
vPParameter = vPParameters[i]
vPParameter[3] = EgtGetInfo( Proc.Id, vPParameter[1], vPParameter[2])
end end
return vPParameters -- se Mortise, se curva di contorno aperta la rendo chiusa
end if Mortise.SideIdentify( ProcMirror) then
BL.ConvertToClosedCurve( ProcMirror, AuxIdMirror)
------------------------------------------------------------------------------------------------------------- end
-- Controlla se la feature ProcMirror è la specchiata di Proc, per feature di tipo DtMortise -- recupero i dati geometrici della curva ProcMirror
local function CheckMirrorDtMortise( Proc, ProcMirror, dHBeam) local vtExtrMirror = EgtCurveExtrusion( AuxIdMirror, GDB_RT.GLOB)
local ptBCMirror = EgtGP( AuxIdMirror, GDB_RT.GLOB)
local b3DtMrtMirror = EgtGetBBoxRef( ProcMirror.Id, GDB_BB.STANDARD, rfDtMrt)
local b3ProcMirror = EgtGetBBoxGlob( ProcMirror.Id, GDB_BB.STANDARD)
-- determino l'asse della curva ProcMirror
local vtAxMirror = EgtEV( AuxIdMirror, GDB_RT.GLOB) - EgtSV( AuxIdMirror, GDB_RT.GLOB)
-- verifico se le mortase sono specchiate
local bIsMirror = true local bIsMirror = true
local vPParametersProc = GetPParametersDtMortise( Proc) local vtDisplacement = ptBC - ptBCMirror
local vPParametersMirror = GetPParametersDtMortise( ProcMirror) local ptCenRaw = b3Raw:getCenter()
local nP02, nP06 = 2, 6 local dYMinDistance = EgtIf( ptBC:getY() > ptBCMirror:getY(), abs( b3ProcMirror:getMax():getY() - b3Proc:getMin():getY()), abs( b3Proc:getMax():getY() - b3ProcMirror:getMin():getY()))
-- controllo che i parametri P delle due feature, tranne P02 e P06, siano uguali local dZMinDistance = EgtIf( ptBC:getZ() > ptBCMirror:getZ(), abs( b3ProcMirror:getMax():getZ() - b3Proc:getMin():getZ()), abs( b3Proc:getMax():getZ() - b3ProcMirror:getMin():getZ()))
for i = 1, #vPParametersProc do local dMinimumDistanceMirroredFeatures = 60
local vPParameterProc = vPParametersProc[i] -- controllo che il centro delle due mortase sia allineato, che queste siano equidistanti dalla mezzeria della trave
local vPParameterMirror = vPParametersMirror[i] -- e che queste non siano troppo vicine
if vPParameterProc[1] ~= 'P02' and vPParameterProc[1] ~= 'P06'then if AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) then
bIsMirror = ( abs( vPParameterProc[3] - vPParameterMirror[3]) < 100 * GEO.EPS_SMALL) bIsMirror = abs( vtDisplacement:getX()) < 500 * GEO.EPS_SMALL and abs( vtDisplacement:getZ()) < 500 * GEO.EPS_SMALL and
if bIsMirror == false then break end ( abs( ptBC:getY() - ptCenRaw:getY()) - abs( ptBCMirror:getY() - ptCenRaw:getY())) < 500 * GEO.EPS_SMALL and
elseif vPParameterProc[1] == 'P02' then dYMinDistance - dMinimumDistanceMirroredFeatures > 10 * GEO.EPS_SMALL
nP02 = i elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
elseif vPParameterProc[1] == 'P06' then bIsMirror = abs( vtDisplacement:getX()) < 500 * GEO.EPS_SMALL and abs( vtDisplacement:getY()) < 500 * GEO.EPS_SMALL and
nP06 = i ( abs( ptBC:getZ() - ptCenRaw:getZ()) - abs( ptBCMirror:getZ() - ptCenRaw:getZ())) < 500 * GEO.EPS_SMALL and
end dZMinDistance - dMinimumDistanceMirroredFeatures > 10 * GEO.EPS_SMALL
end
-- se gli altri parametri P sono uguali, verifico che P02 e P06 siano compatibili con feature specchiate
if bIsMirror == true then
bIsMirror = ( ( vPParametersProc[nP02][3] == 0 and abs( vPParametersMirror[nP02][3] - dHBeam) < 100 * GEO.EPS_SMALL) and
( vPParametersProc[nP06][3] == 90 and vPParametersMirror[nP06][3] == -90)) or
( ( vPParametersMirror[nP02][3] == 0 and abs( vPParametersProc[nP02][3] - dHBeam) < 100 * GEO.EPS_SMALL) and
( vPParametersMirror[nP06][3] == 90 and vPParametersProc[nP06][3] == -90))
end end
-- controllo che le dimensioni dei due box siano le stesse
bIsMirror = bIsMirror and abs( b3DtMrt:getDimX() - b3DtMrtMirror:getDimX()) < 500 * GEO.EPS_SMALL and
abs( b3DtMrt:getDimY() - b3DtMrtMirror:getDimY()) < 500 * GEO.EPS_SMALL and
abs( b3DtMrt:getDimZ() - b3DtMrtMirror:getDimZ()) < 500 * GEO.EPS_SMALL
-- controllo che l'asse delle due mortase sia allineato
bIsMirror = bIsMirror and AreSameVectorApprox( vtAx, vtAxMirror)
return bIsMirror return bIsMirror
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
-- Cerca se esiste una feature specchiata di Proc e nel caso ne restituisce la posizione in vProc -- Verifica se Proc (mortasa) è lavorabile in doppio e nel caso ne imposta i dati.
local function FindMirrorFeature( vProc, Proc, sFeatureType, dHBeam) local function VerifyMortiseMirrored( Proc, vProc, b3Raw)
local nProcMirror -- recupero e verifico l'entità curva
-- se mortasa a coda di rondine local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if sFeatureType == 'DtMortise' then if AuxId then
Proc.Side = EgtGetInfo( Proc.Id, 'SIDE', 'i') AuxId = AuxId + Proc.Id
for i = 1, #vProc do end
local ProcMirror = vProc[i] if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
if DtMortise.SideIdentify(ProcMirror) then local sErr = 'Error : missing profile geometry'
ProcMirror.Side = EgtGetInfo( ProcMirror.Id, 'SIDE', 'i') EgtOutLog( sErr)
if ( Proc.Side == 1 and ProcMirror.Side == 3) or ( Proc.Side == 3 and ProcMirror.Side == 1) or return false, sErr
( Proc.Side == 2 and ProcMirror.Side == 4) or ( Proc.Side == 4 and ProcMirror.Side == 2) then end
local bIsMirror = CheckMirrorDtMortise( Proc, ProcMirror, dHBeam) -- recupero versore estrusione della curva supplementare
if bIsMirror then nProcMirror = i end local vtExtr = EgtCurveExtrusion( AuxId, GDB_ID.ROOT)
-- Se curva di contorno aperta la converto in curva chiusa
BL.ConvertToClosedCurve( Proc, AuxId)
-- recupero i dati della faccia di fondo
local frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_ID.ROOT)
-- determino larghezza della mortasa
if dL < dW then dL, dW = dW, dL end
local ptC = ORIG()
local vtN = V_NULL()
if frMor then
ptC = frMor:getOrigin()
vtN = frMor:getVersZ()
end
-- se mortasa passante esco
local bOpenBtm = not AreSameVectorApprox( vtExtr, vtN)
if bOpenBtm then
return
end
-- determino altezza della mortasa
local b3Mor = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frMor)
local dMorH = b3Mor:getDimZ()
-- elevazione del punto centrale
local _, dCenElev = BL.GetPointDirDepth( nPartId, ptC, vtN)
dMorH = max( dMorH, dCenElev or 0)
-- recupero lavorazione adatta
local sPockType = 'Mortise'
local sPocketing
if Proc.Prc ~= 53 then
sPocketing = Mortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType, false)
end
if not sPocketing then
sPockType = 'Pocket'
sPocketing = Mortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType, false)
end
if not sPocketing or not EgtMdbSetCurrMachining( sPocketing) then
return
end
-- recupero il suo utensile
if not EgtTdbSetCurrTool( EgtMdbGetCurrMachiningParam( MCH_MP.TOOL) or '') then
return
end
-- recupero eventuale utensile in doppio e suo diametro
local sToolDoubleName = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'DOUBLE', 's')
if not sToolDoubleName or not EgtTdbSetCurrTool( sToolDoubleName) or not EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) then
return
end
local dToolDoubleDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM, 'd')
-- verifico se possibile in doppio (diametro utensile e direzione feature)
if dToolDoubleDiam < dW + GEO.EPS_SMALL and ( AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) or AreSameVectorApprox( vtExtr, Z_AX())) then
for i = 1, #vProc do
local ProcMirror = vProc[i]
if Mortise.SideIdentify( ProcMirror) and ProcMirror.Id ~= Proc.Id and ProcMirror.Flg ~= 0 then
if CheckMirrorPocket( Proc, ProcMirror, b3Raw, AuxId) then
if ( not BD.DOWN_HEAD and AreSameVectorApprox( vtExtr, Y_AX())) or
( BD.DOWN_HEAD and AreOppositeVectorApprox( vtExtr, Y_AX())) then
Proc.Double = 2
Proc.MirrorId = ProcMirror.Id
Proc.MirrorCutId = ProcMirror.CutId
Proc.MirrorTaskId = ProcMirror.TaskId
ProcMirror.Flg = 0
ProcMirror.Double = 0
elseif BD.DOWN_HEAD and AreSameVectorApprox( vtExtr, Z_AX()) then
Proc.Double = 3
Proc.MirrorId = ProcMirror.Id
Proc.MirrorCutId = ProcMirror.CutId
Proc.MirrorTaskId = ProcMirror.TaskId
ProcMirror.Flg = 0
ProcMirror.Double = 0
end end
break
end end
end end
end
end end
-- se foratura (da implementare)
return nProcMirror
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
-- Cerca in vProc la presenza di feature specchiate. Se le trova scrive in Proc e nelle info l'Id della specchiata. -- Verifica se Proc (mortasa a coda di rondine) è lavorabile in doppio e nel caso ne imposta i dati.
local function SetMirroredFeatures( vProc, dHBeam) local function VerifyDtMortiseMirrored( Proc, vProc, b3Raw)
-- verifico se con tasca
local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1)
if bPocket then
return
end
-- recupero e verifico l'entità curva ausiliaria
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + Proc.Id end
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
return
end
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
-- recupero il raggio minimo della mortasa
local dMinRad = 1000
local nSt, nEnd = EgtCurveDomain( AuxId)
for i = nSt, nEnd - 1 do
local dRad = EgtCurveCompoRadius( AuxId, i)
if dRad > 0 and dRad < dMinRad then
dMinRad = dRad
end
end
-- recupero lavorazione adatta
local dMaxDiam = 2 * dMinRad
local sMilling = ML.FindMilling( 'DtMortise', nil, nil, dMaxDiam, nil, true, false, true)
if not sMilling or not EgtMdbSetCurrMachining( sMilling) then
return
end
-- recupero il suo utensile
if not EgtTdbSetCurrTool( EgtMdbGetCurrMachiningParam( MCH_MP.TOOL) or '') then
return
end
-- recupero eventuale utensile in doppio e suo diametro
local sToolDoubleName = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'DOUBLE', 's')
if not sToolDoubleName or not EgtTdbSetCurrTool( sToolDoubleName) or not EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) then
return
end
local dToolDoubleDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM, 'd')
-- verifico se possibile in doppio (diametro utensile e direzione feature)
if dToolDoubleDiam < dMaxDiam + GEO.EPS_SMALL and ( AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) or AreSameVectorApprox( vtExtr, Z_AX())) then
for i = 1, #vProc do
local ProcMirror = vProc[i]
if DtMortise.SideIdentify( ProcMirror) and ProcMirror.Id ~= Proc.Id and ProcMirror.Flg ~= 0 then
if CheckMirrorPocket( Proc, ProcMirror, b3Raw, AuxId) then
if ( not BD.DOWN_HEAD and AreSameVectorApprox( vtExtr, Y_AX())) or
( BD.DOWN_HEAD and AreOppositeVectorApprox( vtExtr, Y_AX())) then
Proc.Double = 2
Proc.MirrorId = ProcMirror.Id
Proc.MirrorCutId = ProcMirror.CutId
Proc.MirrorTaskId = ProcMirror.TaskId
ProcMirror.Flg = 0
ProcMirror.Double = 0
elseif BD.DOWN_HEAD and AreSameVectorApprox( vtExtr, Z_AX()) then
Proc.Double = 3
Proc.MirrorId = ProcMirror.Id
Proc.MirrorCutId = ProcMirror.CutId
Proc.MirrorTaskId = ProcMirror.TaskId
ProcMirror.Flg = 0
ProcMirror.Double = 0
end
break
end
end
end
end
end
-------------------------------------------------------------------------------------------------------------
-- Disabilita la foratura dall'altra parte dello stesso foro
local function DisableOtherDrilling( Proc, vProc)
local ProcMirror
for i = 1, #vProc do
if vProc[i].Id == Proc.Id and not vProc[i].Double then
ProcMirror = vProc[i]
break
end
end
if ProcMirror then
ProcMirror.Flg = 0
ProcMirror.Double = 0
end
end
-------------------------------------------------------------------------------------------------------------
-- Verifica se Proc (foratura) è lavorabile in doppio e nel caso ne restituisce la direzione di specchiatura.
local function VerifyDrillMirrored( Proc, vProc, b3Raw)
-- recupero e verifico l'entità foro
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + Proc.Id end
if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then
return
end
-- recupero direzione e dimensioni del foro
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local dDiam = 2 * EgtArcRadius( AuxId)
local dLen = abs( EgtCurveThickness( AuxId))
local dMachiningDepth = dLen / 2 + BD.DRILL_OVERLAP
-- recupero lavorazione adatta
local sDrilling, sType, dMaxDepth = ML.FindDrilling( dDiam, dMachiningDepth, true, false, true)
if not sDrilling then
sDrilling, sType, dMaxDepth = ML.FindDrilling( dDiam, 0, true, false, true)
dMachiningDepth = dMaxDepth or dMachiningDepth
end
if not sDrilling or sType ~= 'Drill' or not EgtMdbSetCurrMachining( sDrilling) then
return
end
local dDrillingStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP)
-- recupero il suo utensile
if not EgtTdbSetCurrTool( EgtMdbGetCurrMachiningParam( MCH_MP.TOOL) or '') then
return
end
-- recupero la lunghezza della parte inclinata della punta
local dToolTipLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - EgtTdbGetCurrToolParam( MCH_TP.LEN)
-- recupero eventuale utensile in doppio, suo diametro e massima lavorazione
local sToolDoubleName = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'DOUBLE', 's')
if not sToolDoubleName or not EgtTdbSetCurrTool( sToolDoubleName) or not EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) then
return
end
local dToolDoubleDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM, 'd')
local dToolDoubleMaxDepth = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
-- recupero la lunghezza della parte inclinata della punta
local dToolDoubleTipLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - EgtTdbGetCurrToolParam( MCH_TP.LEN)
-- verifico se in doppio
local dMinimumDistanceMirroredFeatures = 40
dMachiningDepth = min( dMachiningDepth, dToolDoubleMaxDepth)
if abs( Proc.Flg) == 2 and dToolDoubleDiam < dDiam + 10 * GEO.EPS_SMALL and dToolDoubleDiam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL and
(( 2 * dDrillingStep - dToolTipLength - dToolDoubleTipLength) - dMinimumDistanceMirroredFeatures) > 10 * GEO.EPS_SMALL then
if Proc.Fce ~= 0 then
if Proc.Flg == -2 then vtExtr = -vtExtr end
if ( not BD.DOWN_HEAD and AreSameVectorApprox( vtExtr, Y_AX())) or
( BD.DOWN_HEAD and AreOppositeVectorApprox( vtExtr, Y_AX())) then
Proc.Double = 2
Proc.MachDepthDouble = dMachiningDepth
DisableOtherDrilling( Proc, vProc)
elseif BD.DOWN_HEAD and AreSameVectorApprox( vtExtr, Z_AX()) then
Proc.Double = 3
Proc.MachDepthDouble = dMachiningDepth
DisableOtherDrilling( Proc, vProc)
end
end
end
end
-------------------------------------------------------------------------------------------------------------
-- Cerca in vProc la presenza di feature da lavorare in doppio. Se le trova scrive in Proc la direzione di specchiatura e l'utensile da utilizzare.
local function SetMirroredFeatures( vProc, b3Raw)
for i = 1, #vProc do for i = 1, #vProc do
local Proc = vProc[i] local Proc = vProc[i]
local sFeatureType if Proc.Flg ~= 0 then
if DtMortise.SideIdentify(Proc) then -- Proc.Double -> 0: nessuna specchiatura, 1: specchiatura X, 2: specchiatura Y, 3: specchiatura Z
sFeatureType = 'DtMortise' -- Proc.MirrorId -> Id della feature mirrorata
elseif Drill.Identify(Proc) then if DtMortise.SideIdentify( Proc) and BD.DOUBLE_HEAD_DOVETAIL then
sFeatureType = 'Drill' VerifyDtMortiseMirrored( Proc, vProc, b3Raw)
end elseif Mortise.SideIdentify( Proc) and BD.DOUBLE_HEAD_MORTISE then
if ( sFeatureType == 'DtMortise' or sFeatureType == 'Drill') and not Proc.MirrorId then VerifyMortiseMirrored( Proc, vProc, b3Raw)
local nProcMirror = FindMirrorFeature( vProc, Proc, sFeatureType, dHBeam) elseif Drill.Identify( Proc) and BD.DOUBLE_HEAD_DRILLING then
if nProcMirror then VerifyDrillMirrored( Proc, vProc, b3Raw)
Proc.MirrorId = vProc[nProcMirror].Id
vProc[nProcMirror].MirrorId = Proc.Id
EgtSetInfo( Proc.Id, 'MIRRORID', vProc[nProcMirror].Id)
EgtSetInfo( vProc[nProcMirror].Id, 'MIRRORID', Proc.Id)
end end
end end
end end
@@ -1567,9 +1787,8 @@ function BeamExec.ProcessFeatures()
SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings) SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings)
end end
-- verifica presenza di feature specchiate per eventuali lavorazioni simultanee -- verifica presenza di feature specchiate per eventuali lavorazioni simultanee
local bConcurrentDoubleHead = BD.DOUBLE_HEAD_MIRRORED_FEATURES and ( BD.TWO_EQUAL_HEADS or BD.TWO_UP_DOWN_HEADS) if BD.TWO_EQUAL_HEADS or BD.DOWN_HEAD then
if bConcurrentDoubleHead then SetMirroredFeatures( vProc, b3Raw)
SetMirroredFeatures( vProc, EgtGetRawPartBBox( nRawId):getDimZ())
end end
-- le ordino lungo X -- le ordino lungo X
OrderFeatures( vProc, b3Raw) OrderFeatures( vProc, b3Raw)
@@ -1614,6 +1833,9 @@ function BeamExec.ProcessFeatures()
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId}) table.insert( Stats, {Err=-1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
else else
table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId}) table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
if Proc.Double == 2 or Proc.Double == 3 then
table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId})
end
end end
-- se è taglio di separazione, verifico se ha già aggiunto una nuova fase oppure se è da creare -- se è taglio di separazione, verifico se ha già aggiunto una nuova fase oppure se è da creare
if nNewPhase > 0 then if nNewPhase > 0 then
@@ -1679,11 +1901,14 @@ function BeamExec.ProcessFeatures()
local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT) local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT)
if not bOk then if not bOk then
nTotErr = nTotErr + 1 nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId}) table.insert( Stats, {Err=1, Msg=sMsg, Rot=-1, CutId=Proc.CutId, TaskId=Proc.TaskId})
elseif sMsg and #sMsg > 0 then elseif sMsg and #sMsg > 0 then
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId}) table.insert( Stats, {Err=-1, Msg=sMsg, Rot=-1, CutId=Proc.CutId, TaskId=Proc.TaskId})
else else
table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId}) table.insert( Stats, {Err=0, Msg='', Rot=-1, CutId=Proc.CutId, TaskId=Proc.TaskId})
if Proc.Double == 2 or Proc.Double == 3 then
table.insert( Stats, {Err=0, Msg='', Rot=-1, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId})
end
end end
if bOk then nSideMchOk = nSideMchOk + 1 end if bOk then nSideMchOk = nSideMchOk + 1 end
-- se era taglio di separazione, aggiungo nuova fase -- se era taglio di separazione, aggiungo nuova fase
@@ -1742,6 +1967,9 @@ function BeamExec.ProcessFeatures()
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId}) table.insert( Stats, {Err=-1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
else else
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId}) table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
if Proc.Double == 2 or Proc.Double == 3 then
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.MirrorCutId, TaskId=Proc.MirrorTaskId})
end
end end
-- se era taglio di separazione, aggiungo nuova fase -- se era taglio di separazione, aggiungo nuova fase
if nNewPhase > 0 then if nNewPhase > 0 then
+75 -6
View File
@@ -1,4 +1,4 @@
-- BeamLib.lua by Egaltech s.r.l. 2022/07/12 -- BeamLib.lua by Egaltech s.r.l. 2023/01/20
-- Libreria globale per Travi -- Libreria globale per Travi
-- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto. -- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto.
-- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm. -- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm.
@@ -17,6 +17,9 @@
-- 2022/07/26 Aggiunta la funzione FindFaceBestOrientedAsAxis, precedentemente in ProcessLapJoint -- 2022/07/26 Aggiunta la funzione FindFaceBestOrientedAsAxis, precedentemente in ProcessLapJoint
-- 2022/07/26 Alla funzione FindFaceBestOrientedAsAxis aggiunta la possibilità di escludere una faccia dalla ricerca -- 2022/07/26 Alla funzione FindFaceBestOrientedAsAxis aggiunta la possibilità di escludere una faccia dalla ricerca
-- 2022/09/01 Aggiunte le funzioni GetTunnelDimension, CalcCollisionSafety, SetOpenSide, precedentemente in ProcessLapJoint. -- 2022/09/01 Aggiunte le funzioni GetTunnelDimension, CalcCollisionSafety, SetOpenSide, precedentemente in ProcessLapJoint.
-- 2023/01/10 In GetFaceWithMostAdj aggiunta verifica che la feature abbia almeno una faccia aperta.
-- 2023/01/20 Modificata PutStartNearestToEdge per gestire lato preferito come Y+, Y-, z*, Z-. Aggiunta funzione GetDistanceToNextPart.
-- 2023/01/31 Aggiunta funzione ConvertToClosedCurve, precedentemente parte di ProcessMortise.Make
-- Tabella per definizione modulo -- Tabella per definizione modulo
local BeamLib = {} local BeamLib = {}
@@ -194,7 +197,8 @@ function BeamLib.PutStartOnLonger( nCrvId)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, dMaxDist, bDown) -- nNearSide : 2=Y+, -2=Y-, 3=Z+, -3=Z-
function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, dMaxDist, nNearSide)
-- verifico che la curva sia chiusa -- verifico che la curva sia chiusa
if not EgtCurveIsClosed( nCrvId) then return false end if not EgtCurveIsClosed( nCrvId) then return false end
-- recupero il versore normale al piano di lavoro o estrusione -- recupero il versore normale al piano di lavoro o estrusione
@@ -207,7 +211,7 @@ function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, dMaxDist, bDown)
-- cerco l'estremo più vicino al box e lo imposto come inizio (se da sotto escludo Zmax e viceversa) -- cerco l'estremo più vicino al box e lo imposto come inizio (se da sotto escludo Zmax e viceversa)
local dUopt = 0 local dUopt = 0
local dDopt = GEO.INFINITO local dDopt = GEO.INFINITO
local dZopt = GEO.INFINITO local dSopt = GEO.INFINITO
local dUi, dUf = EgtCurveDomain( nCrvId) local dUi, dUf = EgtCurveDomain( nCrvId)
for dU = dUi, dUf, 0.5 do for dU = dUi, dUf, 0.5 do
local ptP = EgtUP( nCrvId, dU, GDB_ID.ROOT) local ptP = EgtUP( nCrvId, dU, GDB_ID.ROOT)
@@ -221,11 +225,20 @@ function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, dMaxDist, bDown)
dD = min( abs( vtMax:getY()) * dCoeffY, dD) dD = min( abs( vtMax:getY()) * dCoeffY, dD)
dD = min( abs( vtMin:getZ()) * dCoeffZ, dD) dD = min( abs( vtMin:getZ()) * dCoeffZ, dD)
dD = min( abs( vtMax:getZ()) * dCoeffZ, dD) dD = min( abs( vtMax:getZ()) * dCoeffZ, dD)
local dZ = abs( EgtIf( bDown, vtMin:getZ(), vtMax:getZ())) * dCoeffZ local dS
if dD < dMaxDist and dZ < dZopt + GEO.EPS_SMALL then if nNearSide == -2 then
dS = abs( vtMin:getY() * dCoeffY)
elseif nNearSide == 2 then
dS = abs( vtMax:getY() * dCoeffY)
elseif nNearSide == -3 then
dS = abs( vtMin:getZ() * dCoeffZ)
else --nNearSide == 3
dS = abs( vtMax:getZ() * dCoeffZ)
end
if dD < dMaxDist and dS < dSopt + GEO.EPS_SMALL then
dUopt = dU dUopt = dU
dDopt = dD dDopt = dD
dZopt = dZ dSopt = dS
end end
end end
end end
@@ -495,6 +508,10 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng) function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng)
-- verifica che la superficie non sia chiusa e quindi non lavorabile
if EgtSurfIsClosed( nSurfId) then
return
end
-- recupero il numero di facce -- recupero il numero di facce
local nFacCnt = EgtSurfTmFacetCount( nSurfId) local nFacCnt = EgtSurfTmFacetCount( nSurfId)
if not dCosSideAng then if not dCosSideAng then
@@ -769,6 +786,22 @@ function BeamLib.GetPhaseType( nPhase)
return ( EgtGetInfo( EgtGetPhaseDisposition( nPhase) or GDB_ID.NULL, 'TYPE') or '') return ( EgtGetInfo( EgtGetPhaseDisposition( nPhase) or GDB_ID.NULL, 'TYPE') or '')
end end
---------------------------------------------------------------------
function BeamLib.GetDistanceToNextPart( nRawId, nPhase)
-- Recupero la distanza tra la fine del pezzo e il pezzo successivo
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or BD.OVM_MID
-- se segue una parte rimanente riutilizzabile, modifico opportunamente questa distanza
if not BeamLib.IsSplittedPartPhase( nPhase) then
local nNextRawId = EgtGetNextRawPart( nRawId)
if nNextRawId and
EgtGetPartInRawPartCount( nNextRawId) <= 0 and
EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw then
dDistToNextPiece = BD.OVM_MID
end
end
return dDistToNextPiece
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function BeamLib.GetChainSawBlockedAxis( nInd) function BeamLib.GetChainSawBlockedAxis( nInd)
if BD.GetChainSawBlockedAxis then if BD.GetChainSawBlockedAxis then
@@ -1049,5 +1082,41 @@ function BeamLib.SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId, nStartPoint
return false return false
end end
-------------------------------------------------------------------------------------------------------------
function BeamLib.ConvertToClosedCurve( Proc, AuxId)
local bCurveModified = false
if not EgtCurveIsClosed( AuxId) then
local NewId, nCount = EgtExtractSurfTmFacetLoops( Proc.Id, 0, EgtGetParent( Proc.Id))
if NewId then
-- elimino eventuali loop interni (non dovrebbero comunque esserci)
for i = 1, nCount - 1 do
EgtErase( NewId + i)
end
local vtExtr = EgtCurveExtrusion( AuxId, GDB_ID.ROOT)
-- sostituisco il loop esterno alla curva originale
EgtModifyCurveExtrusion( NewId, vtExtr, GDB_ID.ROOT)
EgtRelocate( NewId, AuxId, GDB_IN.AFTER)
EgtErase( AuxId)
EgtChangeId( NewId, AuxId)
bCurveModified = true
-- sistemo i lati aperti
local vFacAdj = EgtSurfTmFacetAdjacencies( Proc.Id, 0)[1]
if vFacAdj then
local sOpen = ''
for i = 1, #vFacAdj do
if vFacAdj[i] < 0 then
sOpen = sOpen .. EgtIf( #sOpen > 0, ',', '') .. tostring( i - 1)
end
end
if #sOpen > 0 then
EgtSetInfo( AuxId, 'OPEN', sOpen)
end
end
end
end
return true, bCurveModified
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
return BeamLib return BeamLib
+3 -3
View File
@@ -1,4 +1,4 @@
-- DiceCut.lua by Egaltech s.r.l. 2022/02/18 -- DiceCut.lua by Egaltech s.r.l. 2023/01/09
-- Gestione dei piano paralleli nei tagli lunghi: equidistanziamento dei piani paralleli -- Gestione dei piano paralleli nei tagli lunghi: equidistanziamento dei piani paralleli
-- Tabella per definizione modulo -- Tabella per definizione modulo
@@ -483,9 +483,9 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
end end
else else
if vtNInner:getX() > -0.017 then if vtNInner:getX() > -0.017 then
if vtO:getX() < 0 then vtO = - vtO end if vtO:getX() < -0.001 then vtO = -vtO end
else else
if vtO:getX() > 0 then vtO = - vtO end if vtO:getX() > 0.001 then vtO = -vtO end
end end
end end
end end
+2 -2
View File
@@ -449,7 +449,7 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
-- eventuale segnalazione ingombro di testa o coda -- eventuale segnalazione ingombro di testa o coda
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ()) local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
if bUpdateIng and Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng and if bUpdateIng and Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng and
not ( abs( vtN[nBigInd]:getX()) < 0.05 and vtN[nBigInd]:getY() < 0 and Proc.Box:getDimX() > 500) then not ( abs( vtN[nBigInd]:getX()) < 0.05 and vtN[nBigInd]:getY() < 0 and Proc.Box:getDimX() > 500 and Proc.Box:getDimY() < 40) then
if Proc.Head then if Proc.Head then
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX() local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
BL.UpdateHCING( nRawId, dOffs) BL.UpdateHCING( nRawId, dOffs)
@@ -460,7 +460,7 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX() local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
local dDist = b3Solid:getMax():getX() - Proc.Box:getMax():getX() local dDist = b3Solid:getMax():getX() - Proc.Box:getMax():getX()
-- se concavo aumento la distanza (rimane una punta...) -- se concavo aumento la distanza (rimane una punta...)
if dAngT < 0 then dDist = dDist + 10 end --if dAngT < 0 then dDist = dDist + 10 end
BL.UpdateHCING( nRawId, dOffs, dDist) BL.UpdateHCING( nRawId, dOffs, dDist)
end end
end end
+20 -8
View File
@@ -4,6 +4,8 @@
-- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati -- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati
-- 2022/11/02 Modificata scelta utensile ottimizzata. Ora se c'è un utensile più grande disponibile si dà preferenza a quello. -- 2022/11/02 Modificata scelta utensile ottimizzata. Ora se c'è un utensile più grande disponibile si dà preferenza a quello.
-- 2022/11/25 Per FindMilling implementata la possibilità di escludere la testa H3 dalla ricerca utensile. -- 2022/11/25 Per FindMilling implementata la possibilità di escludere la testa H3 dalla ricerca utensile.
-- 2022/12/28 Per FindMilling e FindDrilling possibilità di escludere la testa H2 dalla ricerca utensile.
-- 2023/01/31 Per FindPocketing implementata la possibilità di escludere le teste H2 o H3 dalla ricerca utensile.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local MachiningLib = {} local MachiningLib = {}
@@ -224,7 +226,7 @@ function ReturnParams( MachiningType, MachiningName, sType, ToolParams)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, bExcludeH3) local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
if bTopHead == nil and bDownHead == nil then if bTopHead == nil and bDownHead == nil then
bTopHead = true bTopHead = true
bDownHead = false bDownHead = false
@@ -233,7 +235,17 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
elseif bDownHead == nil then elseif bDownHead == nil then
bDownHead = not bTopHead bDownHead = not bTopHead
end end
if bExcludeH2 == nil then
bExcludeH2 = false
end
if bExcludeH3 == nil then
bExcludeH3 = false
end
SetCurrMachineHeadType() SetCurrMachineHeadType()
-- verifico se non richiesta testa sopra e macchina ha solo teste sopra
if not bTopHead and MachineHeadType ~= TWO_UP_DOWN_HEADS and not BD.TURN then
return nil
end
-- verifico se testa attiva va bene -- verifico se testa attiva va bene
local sH1Mach = '' local sH1Mach = ''
local sH1Tool = '' local sH1Tool = ''
@@ -276,7 +288,7 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead,
end end
-- recupero dati utensile -- recupero dati utensile
local bToolActive, sToolName, bH2, bFixed, bH3 = SetCurrMachiningAndTool( Machining.Name) local bToolActive, sToolName, bH2, bFixed, bH3 = SetCurrMachiningAndTool( Machining.Name)
if Machining.On and sMachiningType == sType and bToolActive and ( not bH3 or bH3 == not bExcludeH3) then if Machining.On and sMachiningType == sType and bToolActive and ( not bH2 or bH2 == not bExcludeH2) and ( not bH3 or bH3 == not bExcludeH3) then
local bOk, ToolParams = VerifyTool( MachiningType, sType, Params, bH2) local bOk, ToolParams = VerifyTool( MachiningType, sType, Params, bH2)
if bOk then if bOk then
if MachineHeadUse == ONE_HEAD then if MachineHeadUse == ONE_HEAD then
@@ -367,8 +379,8 @@ function MachiningLib.FindCutting( sType, bTopHead, bDownHead)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead) function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2)
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Drill', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead) local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Drill', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2)
if not MachiningName or MachiningName == '' then if not MachiningName or MachiningName == '' then
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Pocket', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead) MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Pocket', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
end end
@@ -386,13 +398,13 @@ function MachiningLib.FindAngleDrilling( dDiam, dDepth, bTopHead, bDownHead)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead, bExcludeH3) function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH3) return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHead, bDownHead) function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
return FindMachining( MCH_MY.POCKETING, sType, { MaxDiam = dMaxDiam, Depth = dDepth, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead) return FindMachining( MCH_MY.POCKETING, sType, { MaxDiam = dMaxDiam, Depth = dDepth, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
+8 -5
View File
@@ -1,4 +1,4 @@
-- ProcessCut.lua by Egaltech s.r.l. 2022/09/30 -- ProcessCut.lua by Egaltech s.r.l. 2022/12/19
-- Gestione calcolo singoli tagli di lama per Travi -- Gestione calcolo singoli tagli di lama per Travi
-- 2021/05/18 I due tagli con testa da sotto di un cubetto sono fatti di seguito. -- 2021/05/18 I due tagli con testa da sotto di un cubetto sono fatti di seguito.
-- 2021/06/06 Correzioni per tagli con testa da sotto. -- 2021/06/06 Correzioni per tagli con testa da sotto.
@@ -17,6 +17,7 @@
-- 2022/08/25 In caso di AdvTail con taglio lungo Y la profondità di lavorazione è opportunamente diminuita. -- 2022/08/25 In caso di AdvTail con taglio lungo Y la profondità di lavorazione è opportunamente diminuita.
-- 2022/08/30 Modificata la condizione che determina l'utilizzo della testa da sotto. Ora controlla se la trave è più grande del doppio della massima larghezza del cubetto. -- 2022/08/30 Modificata la condizione che determina l'utilizzo della testa da sotto. Ora controlla se la trave è più grande del doppio della massima larghezza del cubetto.
-- 2022/09/23 Corretta la condizione per cui è richiesto l'aggiornamento del grezzo. -- 2022/09/23 Corretta la condizione per cui è richiesto l'aggiornamento del grezzo.
-- 2023/01/26 Migliorata la direzione di lavoro della lama in alcuni casi in cui il truciolo veniva scaricato dal lato errato.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessCut = {} local ProcessCut = {}
@@ -284,9 +285,9 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
-- se la faccia occupa tutta la trave in X e Z o occupa sicuramente la faccia in Z e almeno 3/4 della faccia in X e sborda in X, -- se la faccia occupa tutta la trave in X e Z o occupa sicuramente la faccia in Z e almeno 3/4 della faccia in X e sborda in X,
if ( ( abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getX() - b3Solid:getMax():getX()) < 10*GEO.EPS_SMALL) or if ( ( abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getX() - b3Solid:getMax():getX()) < 10*GEO.EPS_SMALL) or
( ( abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL or abs( Proc.Box:getMax():getX() - b3Solid:getMax():getX()) < 10*GEO.EPS_SMALL) and ( ( abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL or abs( Proc.Box:getMax():getX() - b3Solid:getMax():getX()) < 10*GEO.EPS_SMALL) and
Proc.Box:getDimX() > 0.75 * b3Solid:getDimX())) and Proc.Box:getDimX() > 0.90 * b3Solid:getDimX())) and
abs( Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getZ() - b3Solid:getMax():getZ()) < 10*GEO.EPS_SMALL then abs( Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()) < 10*GEO.EPS_SMALL and abs( Proc.Box:getMax():getZ() - b3Solid:getMax():getZ()) < 10*GEO.EPS_SMALL then
local sErr = 'Error : Impossible to machine by orientation (on side)' local sErr = 'Error : Impossible to machine by orientation (on side A)'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -304,7 +305,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
-- se la faccia termina davanti o dietro la trave e arriva in coda e non interessa la faccia inferiore, forzo il taglio a cubetti a partire dal davanti -- se la faccia termina davanti o dietro la trave e arriva in coda e non interessa la faccia inferiore, forzo il taglio a cubetti a partire dal davanti
if ( abs( Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()) < 10*GEO.EPS_SMALL or abs( Proc.Box:getMax():getZ() - b3Solid:getMax():getZ()) < 10*GEO.EPS_SMALL) and if ( abs( Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()) < 10*GEO.EPS_SMALL or abs( Proc.Box:getMax():getZ() - b3Solid:getMax():getZ()) < 10*GEO.EPS_SMALL) and
abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL then abs( Proc.Box:getMin():getX() - b3Solid:getMin():getX()) < 10*GEO.EPS_SMALL then
local sErr = 'Error : Impossible to machine by orientation (on side)' local sErr = 'Error : Impossible to machine by orientation (on side B)'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -522,8 +523,10 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
vtOrthoO = -X_AX() vtOrthoO = -X_AX()
end end
else else
if vtN:getZ() < dVzLimDwnUp or Proc.Head or Proc.Tail then if vtN:getZ() < dVzLimDwnUp or Proc.Tail or ( Proc.Head and abs( vtN:getY()) > 0.01) then
vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX()) vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX())
elseif Proc.Head then
vtOrthoO = EgtIf( vtN:getY() > -0.02, Y_AX(), -Y_AX())
else else
vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX()) vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX())
end end
+20 -10
View File
@@ -15,6 +15,7 @@
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto e punta disabilitata. -- 2022/08/18 Aggiunta gestione macchine con testa da sotto e punta disabilitata.
-- 2022/10/25 Nella funzione Split aggiunto il controllo che le facce di ingresso e uscita siano differenti (potrebbe succedere per fori molto corti). Modifica importatore in futuro. -- 2022/10/25 Nella funzione Split aggiunto il controllo che le facce di ingresso e uscita siano differenti (potrebbe succedere per fori molto corti). Modifica importatore in futuro.
-- 2022/11/23 Aggiunta la gestione dei fori con angolo < 30 gradi, per i quali si usa la testa della macchina per accorciare l'utile di lavoro. -- 2022/11/23 Aggiunta la gestione dei fori con angolo < 30 gradi, per i quali si usa la testa della macchina per accorciare l'utile di lavoro.
-- 2022/12/28 Implementata gestione forature in doppio
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessDrill = {} local ProcessDrill = {}
@@ -269,11 +270,17 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- abilitazione foratura da sotto -- abilitazione foratura da sotto
local bDrillDown = ( bDownDrill and ( Proc.Down or vtExtr:getZ() < -0.1 or vtExtr:getZ() < 0.259)) local bDrillDown = ( bDownDrill and ( Proc.Down or vtExtr:getZ() < -0.1 or vtExtr:getZ() < 0.259))
local bDrillUp = ( bDownDrill and vtExtr:getZ() > -0.421) local bDrillUp = ( bDownDrill and vtExtr:getZ() > -0.421)
local bExcludeH2 = false
if Proc.Double and Proc.Double > 0 then
bMillUp = true
bDrillDown = false
bExcludeH2 = true
end
-- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante -- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante
-- recupero la lavorazione -- recupero la lavorazione
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown) local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2)
if not sDrilling and dCheckDepth then if not sDrilling and dCheckDepth then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown) sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2)
if sDrilling then dCheckDepth = nil end if sDrilling then dCheckDepth = nil end
end end
if not sDrilling then if not sDrilling then
@@ -393,7 +400,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
local dMaxElev local dMaxElev
local sMyWarn local sMyWarn
-- se c'è un taglio precedente di testa o coda in cui il foro "entra" devo ricalcolare i dati della foratura -- se c'è un taglio precedente di testa o coda in cui il foro "entra" devo ricalcolare i dati della foratura
if (( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0)) then if ( not Proc.Double or Proc.Double == 0) and(( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0)) then
local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB) local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB)
if bIntersectionOk then if bIntersectionOk then
local dHoleToCutDistance = vDistance[1] local dHoleToCutDistance = vDistance[1]
@@ -463,6 +470,11 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto affondamento -- imposto affondamento
if Proc.Double and Proc.Double > 0 and dDepth > Proc.MachDepthDouble + 10 * GEO.EPS_SMALL then
sMyWarn = 'Warning in double head drilling : depth (' .. EgtNumToString( dDepth, 1) .. ') reduced to (' .. EgtNumToString( Proc.MachDepthDouble, 1) .. ') to match H2 max tool depth'
dDepth = Proc.MachDepthDouble
dMaxElev = Proc.MachDepthDouble
end
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- imposto il valore della distanza di sicurezza per l'attacco. Se il valore del db utensili è troppo basso lo alzo a 10. -- imposto il valore della distanza di sicurezza per l'attacco. Se il valore del db utensili è troppo basso lo alzo a 10.
local dToolDbStartPos = EgtGetMachiningParam( MCH_MP.STARTPOS) local dToolDbStartPos = EgtGetMachiningParam( MCH_MP.STARTPOS)
@@ -470,20 +482,18 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
local dStartPos = max( dMinStartPos, dToolDbStartPos) local dStartPos = max( dMinStartPos, dToolDbStartPos)
EgtSetMachiningParam( MCH_MP.STARTPOS, dStartPos) EgtSetMachiningParam( MCH_MP.STARTPOS, dStartPos)
-- Note utente con dichiarazione nessuna generazione sfridi per Vmill -- Note utente con dichiarazione nessuna generazione sfridi per Vmill
local sUserNotes = 'VMRS=0;' local sUserNotes = EgtSetVal( 'VMRS', 0) .. ';'
-- aggiungo alle note massima elevazione (coincide con affondamento) -- aggiungo alle note massima elevazione (coincide con affondamento)
if dMaxElev then if dMaxElev then
sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';' sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElev, 1))
end end
-- se foro passante, aggiungo questa qualifica alle note -- se foro passante, aggiungo questa qualifica alle note
if ( sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill') and bOpen then if ( sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill') and bOpen then
sUserNotes = sUserNotes .. 'Open=1;' sUserNotes = EgtSetValInNotes( sUserNotes, 'Open', 1)
end end
-- se lavorazione in doppio -- se lavorazione in doppio
if EgtExistsInfo( Proc.Id, 'MAIN') then if Proc.Double and Proc.Double > 0 then
sUserNotes = sUserNotes .. 'Double;' sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
elseif EgtExistsInfo( Proc.Id, 'DOU') then
sUserNotes = sUserNotes .. 'Main;'
end end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
+28 -12
View File
@@ -8,6 +8,7 @@
-- 2022/06/01 Modifiche per evitare di entrare nel legno con mortase parziali. -- 2022/06/01 Modifiche per evitare di entrare nel legno con mortase parziali.
-- 2022/08/18 Migliorato calcolo dello step. -- 2022/08/18 Migliorato calcolo dello step.
-- 2022/09/29 Aggiunto riconoscimento della sola feature laterale. -- 2022/09/29 Aggiunto riconoscimento della sola feature laterale.
-- 2022/12/28 Aggiunta gestione lavorazione in doppio.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessDtMortise = {} local ProcessDtMortise = {}
@@ -34,18 +35,18 @@ function ProcessDtMortise.Identify( Proc)
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 56)) (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 56))
end end
---------------------------------------------------------------------
-- Riconoscimento della sola feature frontale
function ProcessDtMortise.FrontIdentify( Proc)
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 56)
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Riconoscimento della sola feature laterale -- Riconoscimento della sola feature laterale
function ProcessDtMortise.SideIdentify( Proc) function ProcessDtMortise.SideIdentify( Proc)
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 55) return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 55)
end end
---------------------------------------------------------------------
-- Riconoscimento della sola feature frontale
function ProcessDtMortise.FrontIdentify( Proc)
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 56)
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Verifica se feature di coda -- Verifica se feature di coda
function ProcessDtMortise.IsTailFeature( Proc, b3Raw) function ProcessDtMortise.IsTailFeature( Proc, b3Raw)
@@ -232,10 +233,17 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
elseif bMillAngTrasm then elseif bMillAngTrasm then
sMchExt = '_AT' sMchExt = '_AT'
end end
local bExcludeH2 = false
if Proc.Double and Proc.Double > 0 then
bMillUp = true
bMillDown = false
bExcludeH2 = true
sMchExt = ''
end
-- recupero la lavorazione : prima ricerca per sola tipologia -- recupero la lavorazione : prima ricerca per sola tipologia
local sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, nil, nil, bMillUp, bMillDown) local sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, nil, nil, bMillUp, bMillDown, bExcludeH2)
if not sMilling and bMillUp then if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown) sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown, bExcludeH2)
end end
if not sMilling then if not sMilling then
local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id) local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id)
@@ -243,9 +251,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr return false, sErr
end end
-- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo -- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo
sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown) sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown, bExcludeH2)
if not sMilling and bMillUp then if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown) sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown, bExcludeH2)
sMchExt = '' sMchExt = ''
end end
if not sMilling then if not sMilling then
@@ -414,6 +422,10 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- dichiaro non si generano sfridi per VMill -- dichiaro non si generano sfridi per VMill
local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;' local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;'
-- se lavorazione in doppio
if Proc.Double and Proc.Double > 0 then
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
@@ -489,8 +501,12 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nSCC then if nSCC then
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
end end
-- dichiaro non si generano sfridi per VMill -- dichiaro massima elevazione e assenza sfridi per VMill
local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;' local sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( dMaxMat - 0.1, 1)) .. ';' .. EgtSetVal( 'VMRS', 0) .. ';'
-- se lavorazione in doppio
if Proc.Double and Proc.Double > 0 then
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
+217 -203
View File
@@ -1,4 +1,4 @@
-- ProcessLapJoint.lua by Egaltech s.r.l. 2022/12/12 -- ProcessLapJoint.lua by Egaltech s.r.l. 2022/12/21
-- Gestione calcolo mezzo-legno per Travi -- Gestione calcolo mezzo-legno per Travi
-- 2019/10/08 Agg. gestione OpenPocket. -- 2019/10/08 Agg. gestione OpenPocket.
-- 2021/01/24 Con sega a catena ora sempre impostato asse A. -- 2021/01/24 Con sega a catena ora sempre impostato asse A.
@@ -57,6 +57,10 @@
-- 2022/09/27 Aggiunta gestione SCC per svuotature con TURN (solo dopo applicazione lavorazione). -- 2022/09/27 Aggiunta gestione SCC per svuotature con TURN (solo dopo applicazione lavorazione).
-- 2022/10/20 In MakeByChainOrSaw modificato check per trovare la faccia adiacente sul lato più lungo. -- 2022/10/20 In MakeByChainOrSaw modificato check per trovare la faccia adiacente sul lato più lungo.
-- 2022/12/12 Default 1000 per BD.MIN_LEN_LAMELLO. In MachineByMill migliorata ricerca utensile e gestione inversione in funzione del lato di lavoro. -- 2022/12/12 Default 1000 per BD.MIN_LEN_LAMELLO. In MachineByMill migliorata ricerca utensile e gestione inversione in funzione del lato di lavoro.
-- 2022/12/16 Implementato parametro Q_SIDE_ROUGH_TOOL anche per L20
-- 2022/12/21 Sistemata gestione SideMillAsSaw.
-- 2023/01/19 In MakeMoreFaces -> MakeBySideMill aggiunto controllo che lo step finale non superi lo spessore utensile.
-- 2023/01/24 In MakeByPocket gestito caso il caso in cui veniva applicata una fresatura con percorso vuoto. Ora viene rimossa e la tasca viene fatta con lama.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessLapJoint = {} local ProcessLapJoint = {}
@@ -140,6 +144,7 @@ local function AssignQIdent( Proc)
Q_DEPTH_CHAMFER = 'Q01' -- d Q_DEPTH_CHAMFER = 'Q01' -- d
Q_USE_MILL = 'Q02' -- i Q_USE_MILL = 'Q02' -- i
Q_USE_ROUGH_TOOL = 'Q03' -- i Q_USE_ROUGH_TOOL = 'Q03' -- i
Q_SIDE_ROUGH_TOOL = 'Q04' -- i
Q_BORE_ON_CORNER = 'Q06' -- i Q_BORE_ON_CORNER = 'Q06' -- i
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 25 then elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 25 then
Q_BORE_ON_CORNER = 'Q01' -- i Q_BORE_ON_CORNER = 'Q01' -- i
@@ -278,7 +283,7 @@ end
local function VerifyChainSaw( Proc, dMinDim, dMaxDim) local function VerifyChainSaw( Proc, dMinDim, dMaxDim)
local bUseChainSaw = false local bUseChainSaw = false
local sMchFind = 'Sawing' local sMchFind = 'Sawing'
local sSawing = ML.FindSawing(sMchFind) local sSawing = ML.FindSawing( sMchFind)
local dMaxMat = 0 local dMaxMat = 0
local dSawCornerRad = 0 local dSawCornerRad = 0
local dSawThick = 0 local dSawThick = 0
@@ -456,6 +461,77 @@ local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
return bUseBHSideMill, bHead, bHeadDir, sMilling, dToolThick, dToolDiam return bUseBHSideMill, bHead, bHeadDir, sMilling, dToolThick, dToolDiam
end end
---------------------------------------------------------------------
local function VerifySideMillAsSaw( Proc, nAddGrpId, vtN, dDiam, dFacElev)
-- Verifico sia feature L016, L030, L032, L039
if not ( Proc.Prc == 16 or Proc.Prc == 30 or Proc.Prc == 32 or Proc.Prc == 39) then
return false
end
-- Verifico sia gola lungo X con 3 facce più eventuali terminali
local nTestId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
local bNewIsU
local nFaces = EgtSurfTmFacetCount( nTestId)
while nFaces >= 3 do
local bDeleteFace
local nInt = 0
while not bDeleteFace and nInt < nFaces do
nInt = nInt + 1
local b3Facet = EgtSurfTmGetFacetBBoxGlob( nTestId, nInt-1, GDB_BB.STANDARD)
local vtN = EgtSurfTmFacetNormVersor( nTestId, nInt-1, GDB_ID.ROOT)
-- se dimensione faccia sulla X
if b3Facet:getDimX() < 1 or abs( vtN:getX()) > 0.1 then
EgtSurfTmRemoveFacet( nTestId, nInt-1)
bDeleteFace = true
end
end
nFaces = EgtSurfTmFacetCount( nTestId)
-- se non ho cancellato una faccia faccio il test per forma ad U
if not bDeleteFace then
-- ottengo il numero di facce rimanenti
bNewIsU = ( nFaces == 3 and not TestElleShape3( nTestId, true))
-- verifico che gola allineata su X
if bNewIsU then
local vtN1 = EgtSurfTmFacetNormVersor( nTestId, 0, GDB_ID.ROOT)
bNewIsU = ( abs( vtN1:getX()) < 0.01)
end
-- esco dal ciclo
break
end
end
-- cancello la copia del percorso
EgtErase( nTestId)
-- eseguo test
if not bNewIsU then
return false
end
-- Verifico sia abbastanza lunga
if not (( Proc.TotBox and Proc.TotBox:getDimX() > ( BD.MIN_LEN_LAMELLO or 1000)) or
( not Proc.TotBox and Proc.Box:getDimX() > ( BD.MIN_LEN_LAMELLO or 1000))) then
return false
end
-- Recupero la lavorazione
local bDownHead = ( BD.DOWN_HEAD and vtN:getZ() < BD.NZ_MINA)
local sMillingOnSide = ML.FindMilling( 'SideMillAsBlade', nil, nil, nil, nil, not bDownHead, bDownHead)
if not sMillingOnSide then
return false
end
-- Recupero i dati dell'utensile
local dToolDiamOnSide = 0
local dThickMillOnSide = 0
local dMaxDepthOnSide = 0
if EgtMdbSetCurrMachining( sMillingOnSide) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiamOnSide = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiamOnSide
dThickMillOnSide = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dThickMillOnSide
dMaxDepthOnSide = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or dMaxDepthOnSide
end
end
local bSpecialMillOnSide = ( dDiam > dThickMillOnSide - 10 * GEO.EPS_SMALL and dFacElev < dMaxDepthOnSide + 10 * GEO.EPS_SMALL)
-- Restituisco i dati
return bSpecialMillOnSide, sMillingOnSide, dThickMillOnSide, dToolDiamOnSide, dMaxDepthOnSide
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function GetFaceAdj( Proc, nFacInd, dH, dV) local function GetFaceAdj( Proc, nFacInd, dH, dV)
@@ -2417,29 +2493,19 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd, local function MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
rfFac, dH, dV, dElev, bForceUseBlade, rfFac, dH, dV, dElev,
nBottomFace, nAddGrpId, b3Solid, dSawMaxDepth, sMillingOnSide, nBottomFace, nAddGrpId, b3Solid, dSawMaxDepth, sMillingOnSide,
dSawDiam, dSawThick) dSawDiam, dSawThick, bIgnoreCaps)
local bOrthoFaces
local sWarn local sWarn
-- ingombro del grezzo -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo -- ottengo la distanza tra la fine del pezzo e il pezzo successivo
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or 5. local dDistToNextPiece = BL.GetDistanceToNextPart( nRawId, nPhase)
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa -- verifico definizione faccia con il maggior numero di adiacenze
local nFacInd1, dFacElev1, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId, true) if not nFacInd then
if not nFacInd1 or nFacInd1 < 0 then local sErr = 'Error : MakeByMillAsSaw could not find reference face'
if nFacInd1 == -1 then EgtOutLog( sErr)
bOrthoFaces = nFacInd2 return false, sErr
else
local sErr = 'Error : MakeByMillAsSaw could not find reference face'
EgtOutLog( sErr)
return false, sErr
end
end
if bOrthoFaces then
-- ottengo le dimensioni del tunnel
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
end end
-- Recupero le facce adiacenti alla principale -- Recupero le facce adiacenti alla principale
local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacInd)[1] local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacInd)[1]
@@ -2456,10 +2522,15 @@ local function MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
if vAdj[i] >= 0 then if vAdj[i] >= 0 then
local _, ptP1, ptP2, _ = EgtSurfTmFacetsContact( Proc.Id, nFacInd, vAdj[i], GDB_ID.ROOT) local _, ptP1, ptP2, _ = EgtSurfTmFacetsContact( Proc.Id, nFacInd, vAdj[i], GDB_ID.ROOT)
local dLen = dist( ptP1, ptP2) local dLen = dist( ptP1, ptP2)
if dLen > dMaxLen then if abs( dLen - dMaxLen) < 5 then
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, vAdj[i], GDB_ID.ROOT)
if vtN:getY() > 0.5 or vtN:getZ() > 0.5 then
nFacAdj = vAdj[i]
dMaxLen = dLen
end
elseif dLen > dMaxLen then
nFacAdj = vAdj[i] nFacAdj = vAdj[i]
dMaxLen = dLen dMaxLen = dLen
EgtOutLog( string.format( 'Adjac=%d Len=%.3f H=%.3f V=%.3f', vAdj[i], dLen, dH, dV), 3)
end end
end end
end end
@@ -2469,16 +2540,16 @@ local function MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
return false, sErr return false, sErr
end end
-- Riordino le dimensioni per avere dH come lato lungo e dV come perpendicolare -- Riordino le dimensioni per avere dH come lato lungo e dV come perpendicolare
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacAdj, GDB_ID.ROOT) local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacAdj, GDB_ID.ROOT)
if abs( vtN * rfFac:getVersX()) > abs( vtN * rfFac:getVersY()) then if abs( vtN * rfFac:getVersX()) > abs( vtN * rfFac:getVersY()) then
dH, dV = dV, dH dH, dV = dV, dH
end end
-- Determino se estremi aperti o chiusi -- Determino se estremi aperti o chiusi
local bOpenStart = false local bOpenStart = bIgnoreCaps
local bOpenEnd = false local bOpenEnd = bIgnoreCaps
local vtNS, vtNE local vtNS, vtNE
-- se non ho la faccia di fondo ( che comporta essere una fessura) verifico se ho lati aperti -- se non ho la faccia di fondo ( che comporta essere una fessura) e non da ignorare verifico se ho lati aperti
if not nBottomFace then if not nBottomFace and not bIgnoreCaps then
local vAdj2 = EgtSurfTmFacetAdjacencies( Proc.Id, nFacAdj)[1] local vAdj2 = EgtSurfTmFacetAdjacencies( Proc.Id, nFacAdj)[1]
EgtOutLog( 'Adj2=' .. table.concat( vAdj2, ' ,'), 3) EgtOutLog( 'Adj2=' .. table.concat( vAdj2, ' ,'), 3)
for j = 1, #vAdj2 do for j = 1, #vAdj2 do
@@ -2491,7 +2562,7 @@ local function MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
bOpenStart = ( vAdj2[i] < 0) bOpenStart = ( vAdj2[i] < 0)
-- se è chiusa acquisisco vettore faccia tappo -- se è chiusa acquisisco vettore faccia tappo
if not bOpenStart and vAdj2[i] >= 0 then if not bOpenStart and vAdj2[i] >= 0 then
_, vtNS = EgtSurfTmFacetCenter( Proc.Id, vAdj2[i], GDB_ID.ROOT) vtNS = EgtSurfTmFacetNormVersor( Proc.Id, vAdj2[i], GDB_ID.ROOT)
end end
-- Se non esiste faccia adiacente a lato successivo -> fine aperto -- Se non esiste faccia adiacente a lato successivo -> fine aperto
local k = EgtIf( j < #vAdj2, j + 1, 1) local k = EgtIf( j < #vAdj2, j + 1, 1)
@@ -2501,66 +2572,65 @@ local function MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
bOpenEnd = ( vAdj2[k] < 0) bOpenEnd = ( vAdj2[k] < 0)
-- se è chiusa acquisisco vettore faccia tappo -- se è chiusa acquisisco vettore faccia tappo
if not bOpenEnd and vAdj2[k] >= 0 then if not bOpenEnd and vAdj2[k] >= 0 then
_, vtNE = EgtSurfTmFacetCenter( Proc.Id, vAdj2[k], GDB_ID.ROOT) vtNE = EgtSurfTmFacetNormVersor( Proc.Id, vAdj2[k], GDB_ID.ROOT)
end end
end end
end end
end end
-- Se possibile, lavoro con la lama -- Recupero la lavorazione di lama
if bForceUseBlade then local sCutting = sMillingOnSide
-- Recupero la lavorazione di lama -- Calcolo uso faccia
local sCutting = sMillingOnSide local nFaceUse = BL.GetNearestOrthoOpposite( rfFac:getVersZ())
-- Calcolo uso faccia local dStartDist = -1
local nFaceUse = BL.GetNearestOrthoOpposite( rfFac:getVersZ()) local dEndDist = -1
local dStartDist = -1 -- calcolo eventuali arretramenti lama
local dEndDist = -1 if not bOpenStart then
-- calcolo eventuali arretramenti lama local dRadius = dSawDiam / 2
local dCat1 = dRadius - dElev
dStartDist = sqrt( ( dRadius * dRadius) - (dCat1 * dCat1))
end
if not bOpenEnd then
if not bOpenStart then if not bOpenStart then
dEndDist = dStartDist
else
local dRadius = dSawDiam / 2 local dRadius = dSawDiam / 2
local dCat1 = dRadius - dElev local dCat1 = dRadius - dElev
dStartDist = sqrt( ( dRadius * dRadius) - (dCat1 * dCat1)) dEndDist = sqrt( ( dRadius * dRadius) - (dCat1 * dCat1))
end
if not bOpenEnd then
if not bOpenStart then
dEndDist = dStartDist
else
local dRadius = dSawDiam / 2
local dCat1 = dRadius - dElev
dEndDist = sqrt( ( dRadius * dRadius) - (dCat1 * dCat1))
end
end
-- Eseguo i tagli
local nStep = ceil( ( dV - 100 * GEO.EPS_SMALL) / dSawThick)
local dStep = 0
if nStep > 1 then
dStep = ( dV - dSawThick) / ( nStep - 1)
end
for i = 1, nStep do
local dOffs = ( i - 1) * dStep
--if vtN:getZ() < BD.NZ_MINA then dOffs = dOffs + dSawThick end
local bOk, sErr, nMchId = Fbs.MakeOne( Proc.Id, nFacAdj, sCutting, dSawDiam, nFaceUse, -0.01, 0, BD.CUT_SIC, dOffs, dStartDist, dEndDist, nil, b3Raw)
if not bOk then return bOk, sErr end
-- setto l'elevazione
local sNotes = 'MaxElev=' .. EgtNumToString( 0, 1) .. ';'
-- applico elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- tolgo eventuale step
EgtSetMachiningParam( MCH_MP.STEP, 0)
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
end
-- in base all'elevazione calcolo l'impronta della lama
local dUsedBladeLen = sqrt( ((dSawDiam / 2)*(dSawDiam / 2)) - ( ( (dSawDiam / 2) - dElev) * ( (dSawDiam / 2) - dElev)))
-- controllo direzione taglio e se il minimo della feature sborda in coda
if abs( vtN:getX()) < GEO.EPS_SMALL and abs( b3Solid:getMin():getX() - Proc.Box:getMin():getX()) < 100 * GEO.EPS_SMALL and dDistToNextPiece < dUsedBladeLen then
-- do avviso che la lama può sbordare nel pezzo successivo
sWarn = 'Warning on mill side as blade : Cut machining can damage next piece'
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
end end
end end
-- Eseguo i tagli
local nStep = ceil( ( dV - 100 * GEO.EPS_SMALL) / dSawThick)
local dStep = 0
if nStep > 1 then
dStep = ( dV - dSawThick) / ( nStep - 1)
end
local dVzLimDwnUp = -0.01
for i = 1, nStep do
local dOffs = ( i - 1) * dStep
if vtN:getZ() < dVzLimDwnUp then dOffs = dOffs + dSawThick end
local bOk, sErr, nMchId = Fbs.MakeOne( Proc.Id, nFacAdj, sCutting, dSawDiam, nFaceUse, dVzLimDwnUp, 0, BD.CUT_SIC, dOffs, dStartDist, dEndDist, nil, b3Raw)
if not bOk then return bOk, sErr end
-- setto l'elevazione
local sNotes = 'MaxElev=' .. EgtNumToString( 0, 1) .. ';'
-- applico elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- tolgo eventuale step
EgtSetMachiningParam( MCH_MP.STEP, 0)
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
end
-- in base all'elevazione calcolo l'impronta della lama
local dUsedBladeLen = sqrt( ((dSawDiam / 2)*(dSawDiam / 2)) - ( ( (dSawDiam / 2) - dElev) * ( (dSawDiam / 2) - dElev)))
-- controllo direzione taglio e se il minimo della feature sborda in coda
if abs( vtN:getX()) < GEO.EPS_SMALL and abs( b3Solid:getMin():getX() - Proc.Box:getMin():getX()) < 100 * GEO.EPS_SMALL and dDistToNextPiece < dUsedBladeLen then
-- do avviso che la lama può sbordare nel pezzo successivo
sWarn = 'Warning on mill side as blade : Cut machining can damage next piece'
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
end
return true, sWarn return true, sWarn
end end
@@ -2574,7 +2644,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
-- ingombro del grezzo -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo -- ottengo la distanza tra la fine del pezzo e il pezzo successivo
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or 5.4 local dDistToNextPiece = BL.GetDistanceToNextPart( nRawId, nPhase)
-- verifico se fessura con 3 facce o tunnel -- verifico se fessura con 3 facce o tunnel
local bOrthoFaces local bOrthoFaces
local bIs3Faces = ( Proc.Fct == 3) local bIs3Faces = ( Proc.Fct == 3)
@@ -3614,13 +3684,17 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
sNotes = sNotes .. 'VMRS=0;' sNotes = sNotes .. 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) or EgtIsMachiningEmpty() then
-- provo ad allargare leggermente la tasca -- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return -1, sErr return -1, sErr
elseif EgtIsMachiningEmpty() then
EgtRemoveOperation( nMchFId)
local sErr = 'Impossible to machine (empty toolpath)'
return -3, sErr
end end
end end
-- se posso applicare la svuotatura sul lato opposto -- se posso applicare la svuotatura sul lato opposto
@@ -3851,7 +3925,7 @@ local function ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacInd, sWarn, bM
nPrefSide = 0 nPrefSide = 0
elseif abs( vtN:getZ()) > 0.63 or abs( vtN:getY()) > 0.63 then elseif abs( vtN:getZ()) > 0.63 or abs( vtN:getY()) > 0.63 then
-- se X è negativa allora devo tenere il motore a destra -- se X è negativa allora devo tenere il motore a destra
if vtN:getX() < -(10 * GEO.EPS_SMALL) then if vtN:getX() < 0.087 then
nPrefSide = 2 nPrefSide = 2
end end
end end
@@ -3876,14 +3950,16 @@ local function ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacInd, sWarn, bM
local bInvertMach = false local bInvertMach = false
local dDepth = 0 local dDepth = 0
if bIsU then if bIsU then
if abs(vtN:getZ()) > 0.63 or abs(vtN:getY()) > 0.63 then -- prendo il vettore normale alla faccia
-- if abs(vtN:getZ()) > 0.7 or abs(vtN:getY()) > 0.7 then local vtNFc = EgtSurfTmFacetNormVersor( Proc.Id, nFacet, GDB_ID.ROOT)
-- prendo il vettore normale alla faccia if abs( vtN:getZ()) > 0.63 or abs( vtN:getY()) > 0.63 then
local _, vtNFc = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT)
-- se superficie principale parallela al piano XZ -- se superficie principale parallela al piano XZ
if nPrefSide == 0 then if nPrefSide == 0 then
-- se facce praticamente verticali || mandrino a destra
if abs( vtNFc:getZ()) < 0.1 then
nPrefSide = 2
-- se facce inclinate \\ allora mandrino a destra (per essere verso l'alto) -- se facce inclinate \\ allora mandrino a destra (per essere verso l'alto)
if vtNFc:getX() * vtNFc:getZ() > 0 then elseif vtNFc:getX() * vtNFc:getZ() > 0 then
nPrefSide = 2 nPrefSide = 2
-- altrimenti facce inclinate // quindi mandrino a sinistra (per essere ancora verso l'alto) -- altrimenti facce inclinate // quindi mandrino a sinistra (per essere ancora verso l'alto)
else else
@@ -3904,20 +3980,37 @@ local function ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacInd, sWarn, bM
end end
end end
end end
end -- eseguo inversione
-- eseguo inversione if bInvertMach then
if bInvertMach then local bToolInvert = EgtGetMachiningParam( MCH_MP.TOOLINVERT)
local bToolInvert = EgtGetMachiningParam( MCH_MP.TOOLINVERT) local nWS = EgtGetMachiningParam( MCH_MP.WORKSIDE)
local nWS = EgtGetMachiningParam( MCH_MP.WORKSIDE) local nInvWS = EgtIf( nWS == MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT)
local nInvWS = EgtIf( nWS == MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT) local nFaceUse = EgtGetMachiningParam( MCH_MP.FACEUSE)
local nFaceUse = EgtGetMachiningParam( MCH_MP.FACEUSE) local bOrtUp = ( nFaceUse >= MCH_MILL_FU.ORTUP_DOWN and nFaceUse <= MCH_MILL_FU.ORTUP_RIGHT)
local bOrtUp = ( nFaceUse >= MCH_MILL_FU.ORTUP_DOWN and nFaceUse <= MCH_MILL_FU.ORTUP_RIGHT) if not bOrtUp then
if not bOrtUp then -- assegno i parametri invertiti
-- assegno i parametri invertiti EgtSetMachiningParam( MCH_MP.WORKSIDE, nInvWS)
EgtSetMachiningParam( MCH_MP.WORKSIDE, nInvWS) EgtSetMachiningParam( MCH_MP.TOOLINVERT, not bToolInvert)
EgtSetMachiningParam( MCH_MP.TOOLINVERT, not bToolInvert) -- setto l'offset pari allo spessore lama
-- setto l'offset pari allo spessore lama EgtSetMachiningParam( MCH_MP.OFFSL, -dSawThick)
EgtSetMachiningParam( MCH_MP.OFFSL, -dSawThick) end
end
-- per diminuire scheggiature su facce davanti
if nPrefSide == 2 then
local dSpeed = EgtGetMachiningParam( MCH_MP.SPEED)
if dSpeed < 0 and vtN:getY() < -0.996 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
EgtSetMachiningParam( MCH_MP.INVERT, vtNFc:getX() > 0)
elseif dSpeed > 0 and vtN:getY() > 0.996 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, vtNFc:getX() < 0)
elseif dSpeed < 0 and vtN:getZ() > 0.996 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
EgtSetMachiningParam( MCH_MP.INVERT, vtNFc:getX() > 0)
elseif dSpeed > 0 and vtN:getZ() > 0.996 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, vtNFc:getX() < 0)
end
end end
end end
-- posizione del braccio : se primo taglio la recupero, altrimenti la imposto -- posizione del braccio : se primo taglio la recupero, altrimenti la imposto
@@ -4580,6 +4673,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
else else
dStep = 0 dStep = 0
end end
-- lo step finale non deve mai superare lo spessore utensile
dStep = min( dStep, dMaxMat)
EgtSetMachiningParam( MCH_MP.STEP, dStep) EgtSetMachiningParam( MCH_MP.STEP, dStep)
-- imposto elevazione e dichiaro non si generano sfridi per VMill -- imposto elevazione e dichiaro non si generano sfridi per VMill
local sNotes = 'MaxElev=' .. EgtNumToString( dVcalc + dStep, 2) .. ';' local sNotes = 'MaxElev=' .. EgtNumToString( dVcalc + dStep, 2) .. ';'
@@ -4656,12 +4751,11 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
-- verifico se lavorando la faccia principale rimane esclusa molta sezione trasversale complessiva della feature (da box) -- verifico se lavorando la faccia principale rimane esclusa molta sezione trasversale complessiva della feature (da box)
local rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) local rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
local bBoxF = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfFac) local bBoxF = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfFac)
if dH * dV < 0.9 * ( bBoxF:getDimX() * bBoxF:getDimY()) then if dH * dV < 0.9 * ( bBoxF:getDimX() * bBoxF:getDimY()) and nFacInd2 and dFacElev2 < 1.5 * dFacElev then
bSpecial3faces = true bSpecial3faces = true
end end
-- se riconosciuta gestione 3 facce -- se riconosciuta gestione 3 facce (limitatamente per ora alla feature 20)
-- e limitata per ora alla feature 20 if bSpecial3faces and Proc.Prc == 20 then
if bSpecial3faces and Proc.Prc == 20 and nFacInd2 then
-- se smusso non è esclusivo -- se smusso non è esclusivo
if nChamfer < 2 then if nChamfer < 2 then
-- entrambe le facce non devono essere orientate verso il basso -- entrambe le facce non devono essere orientate verso il basso
@@ -4848,7 +4942,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
end end
elseif Proc.Fct == 3 and bIsL then elseif Proc.Fct == 3 and bIsL then
-- per rifinire gli angoli premio utensile diam 25 o da BD -- per rifinire gli angoli premio utensile diam 25 o da BD
dDiam = min( ( 2 * dDiam) - 1, BD.MAXDIAM_POCK_CORNER) dDiam = min( ( 2 * dDiam) + 10 * GEO.EPS_SMALL, BD.MAXDIAM_POCK_CORNER)
else else
dDiam = 2 * dDiam dDiam = 2 * dDiam
end end
@@ -4896,101 +4990,19 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
_, sMyPocketing, dMyTMaxDepth, dMyTDiam = VerifyPocket( Proc, dDiam, dFacElev + dCollSic, dMaxTotLen, sMchFind) _, sMyPocketing, dMyTMaxDepth, dMyTDiam = VerifyPocket( Proc, dDiam, dFacElev + dCollSic, dMaxTotLen, sMchFind)
bMillDown = false bMillDown = false
end end
--local sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind .. EgtIf( bMillDown, '_H2', ''), dDiam, dFacElev + dCollSic, dMaxTotLen)
--if not sMyPocketing then
-- sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind .. EgtIf( bMillDown, '_H2', ''), dDiam, nil, dMaxTotLen)
--end
--if not sMyPocketing and bMillUp then
-- sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind, dDiam, dFacElev + dCollSic)
-- if not sMyPocketing then
-- sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind, dDiam)
-- end
-- bMillDown = false
--end
if sMyPocketing and if sMyPocketing and
( dMyTMaxDepth > dFacElev + dCollSic - 10 * GEO.EPS_SMALL or ( dMyTMaxDepth > 0.8 * dFacElev + dCollSic and not bIsU) or ( bIsL and nUseRoughTool == 0) or ( dMyTMaxDepth > dFacElev + dCollSic - 10 * GEO.EPS_SMALL or ( dMyTMaxDepth > 0.8 * dFacElev + dCollSic and not bIsU) or
( bIsL and nUseRoughTool == 0) or
( Proc.Prc == 25 and not bIsU and not bIsL)) then ( Proc.Prc == 25 and not bIsU and not bIsL)) then
sPocketing = sMyPocketing sPocketing = sMyPocketing
end end
if bMillDown then if bMillDown then
sMchFind = sMchFind ..'_H2' sMchFind = sMchFind ..'_H2'
end end
-- 2021.09.16 Richiesta di Fabio Squaratti per lavorazione "Lamello": -- Verifico se lavorazione "Lamello":
-- se ho attiva questo tipo di lavorazione (delle fresature) e una di queste feature: L016, L030, L032, L039 local bSpecialMillOnSide, sMillingOnSide, dThickMillOnSide, dToolDiamOnSide, dMaxDepthOnSide = VerifySideMillAsSaw( Proc, nAddGrpId, vtN, dDiam, dFacElev)
-- verifico se sono compatibili con questa lavorazione forma a U e larga più dell'altezza tagliente e profondità compatibile con if bSpecialMillOnSide then
local bSpecialMillOnSide sPocketing = nil
local dThickMillOnSide = 0
local sMillingOnSide
local dToolDiamOnSide = 0
local dMaxDepthOnSide = 0
if ( Proc.Prc == 16 or Proc.Prc == 30 or Proc.Prc == 32 or Proc.Prc == 39) then
-- verifico se ho una gola con 3 facce ed eventualmente delle facce terminali:
-- faccio una copia della superfice ed elimino le facce che hanno dimensione X < 1 e le facce risultanti devono essere una U
local nTestId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
if nTestId then
local bNewIsU
local bExit
local nFaces = EgtSurfTmFacetCount( nTestId)
while not bExit and nFaces >= 3 do
local bDeleteFace
local nInt = 0
while not bDeleteFace and nInt < nFaces do
nInt = nInt + 1
local b3Facet = EgtSurfTmGetFacetBBoxGlob( nTestId, nInt-1, GDB_BB.STANDARD)
local vtN = EgtSurfTmFacetNormVersor( nTestId, nInt-1, GDB_ID.ROOT)
-- se dimensione faccia sulla X
if b3Facet:getDimX() < 1 or abs( vtN:getX()) > 0.1 then
EgtSurfTmRemoveFacet( nTestId, nInt-1)
bDeleteFace = true
end
end
nFaces = EgtSurfTmFacetCount( nTestId)
-- se non ho cancellato una faccia faccio il test per forma ad U
if not bDeleteFace then
-- ottengo il numero di facce rimanenti
bNewIsU = ( nFaces == 3 and not TestElleShape3( nTestId, true))
bExit = true
end
end
-- verifico che la componente x della faccia o deve essere nulla
local vtN1 = EgtSurfTmFacetNormVersor( nTestId, 0, GDB_ID.ROOT)
if bNewIsU and abs( vtN1:getX()) > 0.01 then
bNewIsU = false
end
-- cancello la copia del percorso
EgtErase( nTestId)
if bNewIsU and
(( Proc.TotBox and Proc.TotBox:getDimX() > ( BD.MIN_LEN_LAMELLO or 1000)) or
( not Proc.TotBox and Proc.Box:getDimX() > ( BD.MIN_LEN_LAMELLO or 1000))) then
-- recupero la lavorazione
local bDownHead = BD.DOWN_HEAD and vtN:getZ() < BD.NZ_MINA
sMillingOnSide = ML.FindMilling( 'SideMillAsBlade_H2', nil, nil, nil, nil, not bDownHead, bDownHead)
if sMillingOnSide then
-- recupero i dati dell'utensile
local dToolLength = 0
local sUserNote
if EgtMdbSetCurrMachining( sMillingOnSide) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolLength = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dToolLength
dToolDiamOnSide = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiamOnSide
dThickMillOnSide = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dThickMillOnSide
dMaxDepthOnSide = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or dMaxDepthOnSide
end
end
-- 2021.09.17 Su conferma di Fabio Squaratti, se la gola è più streta dell'utensile o la profondità della gole è maggiore
-- del valore parametro SIDEDEPTH (preso dalle note utente dell'utensile) allora si prosegue come se non fosse abilitata
-- questo tipo di lavorazione SideMillAsBlade
if dDiam > dThickMillOnSide - 10 * GEO.EPS_SMALL and dFacElev < dMaxDepthOnSide + 10 * GEO.EPS_SMALL then
bSpecialMillOnSide = true
-- disabilito eventulae svuotatura
sPocketing = nil
end
end
end
end
end end
-- se feature 16 e forzata lama e forma ad U, annulla la svuotatura -- se feature 16 e forzata lama e forma ad U, annulla la svuotatura
if Proc.Prc == 16 and bForceUseBlade and Proc.Fct == 3 and bIsU then if Proc.Prc == 16 and bForceUseBlade and Proc.Fct == 3 and bIsU then
@@ -5004,7 +5016,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
local nQAntisplintResult = EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') or 0 local nQAntisplintResult = EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') or 0
-- se lavorazione fresa come lama disabilito eventuale antischeggia -- se lavorazione fresa come lama disabilito eventuale antischeggia
if bSpecialMillOnSide then nQAntisplintResult = 0 end if bSpecialMillOnSide then nQAntisplintResult = 0 end
-- se non trova una svuotatura adatta -- se non trovata una svuotatura adatta
if not sPocketing then if not sPocketing then
-- se forma a L provo con contornatura -- se forma a L provo con contornatura
if bIsL and not bSpecialMillOnSide and not bForceSideMill then if bIsL and not bSpecialMillOnSide and not bForceSideMill then
@@ -5019,9 +5031,9 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
if bSpecialMillOnSide then if bSpecialMillOnSide then
-- eseguo -- eseguo
bOk, sWarn = MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd, bOk, sWarn = MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
rfFac, dH, dV, dFacElev, bSpecialMillOnSide, rfFac, dH, dV, dFacElev,
nBottomFace, nAddGrpId, b3Solid, dMaxDepthOnSide, sMillingOnSide, nBottomFace, nAddGrpId, b3Solid, dMaxDepthOnSide, sMillingOnSide,
dToolDiamOnSide, dThickMillOnSide) dToolDiamOnSide, dThickMillOnSide, bAllWithEndCap)
if bOk then if bOk then
return true, sWarn return true, sWarn
end end
@@ -5231,7 +5243,9 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
end end
nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId, nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId,
bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown, bSetOpenBorders, bIsU, bIsL) bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown, bSetOpenBorders, bIsU, bIsL)
if nOk == -2 then if nOk == -3 then
bTryWithBlades = true
elseif nOk == -2 then
if not sMchFind then if not sMchFind then
sMchFind = sMchFindBackUp sMchFind = sMchFindBackUp
end end
@@ -5467,12 +5481,12 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero l'ingombro del grezzo di appartenenza -- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo -- ottengo la distanza tra la fine del pezzo e il pezzo successivo
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or BD.OVM_MID local dDistToNextPiece = BL.GetDistanceToNextPart( nRawId, nPhase)
-- verifico se applicare gestione speciale delle giunzioni (U diretta come asse X) -- verifico se applicare gestione speciale delle giunzioni (U diretta come asse X)
local bAddEndCap = false local bAddEndCap = false
local dAddLen = 0 local dAddLen = 0
local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc)) local bIsOpenU = ( Proc.Fct == 3 and not TestElleShape3( Proc))
if bIsU then if bIsOpenU then
local ptC0, vtN0 = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) local ptC0, vtN0 = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
local ptC1, vtN1 = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT) local ptC1, vtN1 = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
local ptC2, vtN2 = EgtSurfTmFacetCenter( Proc.Id, 2, GDB_ID.ROOT) local ptC2, vtN2 = EgtSurfTmFacetCenter( Proc.Id, 2, GDB_ID.ROOT)
@@ -5500,7 +5514,6 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
for i = 1, nPart do for i = 1, nPart do
-- eseguo divisione -- eseguo divisione
local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
EgtSetName( AddId, 'AddPart_' .. tostring( Proc.Id) .. '_' .. tostring( i))
if i > 1 or bAddEndCap then if i > 1 or bAddEndCap then
-- definizione del piano -- definizione del piano
local dAdd = EgtIf( i > 1, dAddLen, 0) local dAdd = EgtIf( i > 1, dAddLen, 0)
@@ -5539,6 +5552,7 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
local vtN = X_AX() local vtN = X_AX()
EgtCutSurfTmPlane( AddId, ptOn, vtN, true, GDB_RT.GLOB) EgtCutSurfTmPlane( AddId, ptOn, vtN, true, GDB_RT.GLOB)
end end
EgtSetName( AddId, 'AddPart_' .. tostring( Proc.Id) .. '_' .. tostring( i))
-- eseguo inserimento in modo da ordinare da X+ a X- -- eseguo inserimento in modo da ordinare da X+ a X-
table.insert( vAddId, 1, AddId) table.insert( vAddId, 1, AddId)
end end
@@ -5599,7 +5613,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local nForceUseBladeOnNotContinueFace local nForceUseBladeOnNotContinueFace
-- se ho attivo la lama e ho la feature 30, verifico i parametri Q propri della feature -- se ho attivo la lama e ho la feature 30, verifico i parametri Q propri della feature
if bUseBlade then if bUseBlade then
if Proc.Prc == 30 then if Proc.Prc == 30 or Proc.Prc == 20 then
local nBladeAntisplint = EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') or 0 local nBladeAntisplint = EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') or 0
local nUseRoughToolOnSide = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0 local nUseRoughToolOnSide = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0
nForceUseBladeOnNotContinueFace = EgtGetInfo( Proc.Id, Q_BLADE_ON_ALONG_FACE, 'i') or 0 nForceUseBladeOnNotContinueFace = EgtGetInfo( Proc.Id, Q_BLADE_ON_ALONG_FACE, 'i') or 0
File diff suppressed because it is too large Load Diff
+260 -124
View File
@@ -1,4 +1,4 @@
-- ProcessLongCut.lua by Egaltech s.r.l. 2022/11/30 -- ProcessLongCut.lua by Egaltech s.r.l. 2023/01/18
-- Gestione calcolo taglio longitudinale per Travi -- Gestione calcolo taglio longitudinale per Travi
-- 2021/02/03 Corretto FaceUse con fresa orizzontale su taglio orizzontale. -- 2021/02/03 Corretto FaceUse con fresa orizzontale su taglio orizzontale.
-- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto. -- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto.
@@ -15,6 +15,10 @@
-- 2022/11/04 Aggiunto passaggio parametro bDownHead (Testa da Sotto) nelle chiamate a MakeSideFace. -- 2022/11/04 Aggiunto passaggio parametro bDownHead (Testa da Sotto) nelle chiamate a MakeSideFace.
-- 2022/11/28 Correzioni varie per attacco, pulizia spigoli, utilizzo H3 -- 2022/11/28 Correzioni varie per attacco, pulizia spigoli, utilizzo H3
-- 2022/11/30 Modifiche su SCC per TURN. -- 2022/11/30 Modifiche su SCC per TURN.
-- 2023/01/18 Aggiunta, se richiesta, una lavorazione ulteriore con sega a catena nei casi in cui la doppia lama non sia sufficiente.
-- 2023/01/26 Rimossa la pulitura della faccia laterale nel caso in cui la feature abbia almeno una faccia rivolta verso il basso.
-- 2023/01/27 In MakeSideFace il prolungamento di uscita è ora fissato a 10 mm.
-- 2023/01/27 In caso di lavorazione aggiuntiva con fresa a catena il taglio con lama da sotto viene effettuato a step.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessLongCut = {} local ProcessLongCut = {}
@@ -54,6 +58,10 @@ end
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, bForcedLim, dDistToMachine, bUnderDir) local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, bForcedLim, dDistToMachine, bUnderDir)
if ( not BD.DOWN_HEAD or not BD.TURN) and nSide == -1 then
EgtOutLog( 'LongCut : side face finishing skipped , down head required')
return true
end
-- inserisco la lavorazione -- inserisco la lavorazione
local nM = 1 local nM = 1
local nP = 1 local nP = 1
@@ -101,8 +109,8 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, bForcedLim,
-- attacco e uscita -- attacco e uscita
EgtSetMachiningParam( MCH_MP.LIPERP, 0) EgtSetMachiningParam( MCH_MP.LIPERP, 0)
EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2 + 30) EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2 + 30)
EgtSetMachiningParam( MCH_MP.LOPERP, 0) EgtSetMachiningParam( MCH_MP.LOPERP, 2)
EgtSetMachiningParam( MCH_MP.LOTANG, dToolDiam / 2 + 30) EgtSetMachiningParam( MCH_MP.LOTANG, 10)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
@@ -337,6 +345,88 @@ local function MakeByPocketing( Proc, nPhase, nRawId, nPartId)
return true, sWarn return true, sWarn
end end
---------------------------------------------------------------------
-- lavorazione faccia laterale con sega a catena
local function MakeSideFaceByChainSaw( nSurfId, dDepth, dOffs, dSal, dEal)
-- Recupero i dati dell'utensile
local sSawing = ML.FindSawing( 'Sawing')
local dMaxMat = 0
local dSawCornerRad = 0
local dSawThick = 0
-- se non trova una lavorazione di sawing esco
if not sSawing then
local sErr = 'Error : Sawing not found in library'
EgtOutLog( sErr)
return false, sErr
else
if EgtMdbSetCurrMachining( sSawing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
dSawCornerRad = EgtTdbGetCurrToolParam( MCH_TP.CORNRAD) or dSawCornerRad
end
end
end
-- inserisco la lavorazione di sawing
local sName = 'Csaw_' .. ( EgtGetName( nSurfId) or tostring( nSurfId)) .. '_1'
local nMchFId = EgtAddMachining( sName, sSawing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sSawing
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nSurfId, 0}})
-- imposto faceuse
local nFaceUse = MCH_MILL_FU.PARAL_DOWN
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
local vtN = EgtSurfTmFacetNormVersor( nSurfId, 0, GDB_ID.ROOT)
local vtOrtho = BL.GetVersRef( nFaceUse)
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
-- imposto eventuale sovramateriale
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
-- imposto allungamento percorso iniziale e finale
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
-- imposto il lato di lavorazione
local nWorkSide = MCH_MILL_WS.RIGHT
EgtSetMachiningParam( MCH_MP.WORKSIDE, nWorkSide)
-- verifico se devo ridurre l'affondamento
if dMaxMat >= dDepth then
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
else
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat)
sWarn = 'Warning : chainsaw elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
-- eseguo
if not ML.ApplyMachining( true, false) then
if EgtGetOutstrokeInfo() then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
-- impostazione alternativa angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
if EgtIsMachiningEmpty() then
_, sWarn = EgtGetMachMgrWarning( 0)
EgtSetOperationMode( nMchFId, false)
return false, sWarn
end
--end
return true, sWarn
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCustForceUseBladeOnNCF) function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCustForceUseBladeOnNCF)
@@ -380,10 +470,10 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local bTopStart = ( Proc.Box:getMax():getZ() > b3Solid:getMax():getZ() - 20) local bTopStart = ( Proc.Box:getMax():getZ() > b3Solid:getMax():getZ() - 20)
-- Determino se parte da sotto -- Determino se parte da sotto
local bBottomStart = ( Proc.Box:getMin():getZ() < b3Solid:getMin():getZ() + 20) local bBottomStart = ( Proc.Box:getMin():getZ() < b3Solid:getMin():getZ() + 20)
-- determino se lavorazione da davanti o da dietro -- Determino se lavorazione da davanti o da dietro
local bFront = ( vtN:getY() < 0) local bFront = ( vtN:getY() < 0)
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo -- Ottengo la distanza tra la fine del pezzo e il pezzo successivo o grezzo utilizzabile e non ancora separato
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or BD.OVM_MID local dDistToNextPiece = BL.GetDistanceToNextPart( nRawId, nPhase)
local bForcedLim local bForcedLim
local sWarn local sWarn
---------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------
@@ -393,7 +483,13 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
-- fino al punto più vicino della faccia terminale (prima l'arretramento era sempre del raggio utensile). -- fino al punto più vicino della faccia terminale (prima l'arretramento era sempre del raggio utensile).
-- Questo viene fatto se Q07=1 o fresa da sotto -- Questo viene fatto se Q07=1 o fresa da sotto
---------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------
local nUseBlade = EgtIf( bCustUseBlade, 1, EgtGetInfo( Proc.Id, 'Q05', 'i') or 0) local nUseBlade = 0
if bCustUseBlade then
nUseBlade = 1
-- leggo il parametro Q05 solo se è una vera longcut L010
elseif ProcessLongCut.Identify( Proc) then
nUseBlade = EgtGetInfo( Proc.Id, 'Q05', 'i') or 0
end
local bForceUseBladeOnNotThruFace local bForceUseBladeOnNotThruFace
if nCustForceUseBladeOnNCF then if nCustForceUseBladeOnNCF then
bForceUseBladeOnNotThruFace = nCustForceUseBladeOnNCF > 2 bForceUseBladeOnNotThruFace = nCustForceUseBladeOnNCF > 2
@@ -512,9 +608,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
end end
end end
end end
local nNextRawId = EgtGetNextRawPart( nRawId) -- se la fine (a sinistra) non è limitata e ho un pezzo successivo o grezzo riutilizzabile meno distante di metà raggio, setto la fine come limitata
-- se la fine (a sinistra) non è limitata e ho un pezzo successivo meno distante di metà raggio, oppure se grezzo finale della barra di lunghezza sufficiente, setto la fine come limitata if (( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2)) and not bLimXmin then
if ((( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2)) or (nNextRawId and EgtGetPartInRawPartCount( nNextRawId) <= 0 and EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw)) and not bLimXmin then
if bForceUseBladeOnNotThruFace then if bForceUseBladeOnNotThruFace then
bForcedLim = true bForcedLim = true
bLimXmin = true bLimXmin = true
@@ -642,7 +737,14 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
nC = nCDn nC = nCDn
dC = dCDn dC = dCDn
end end
-- nei casi in cui la doppia lama non sia sufficiente, se richiesto, attivo un'ulteriore lavorazione con sega a catena
-- solo per T010
local bFinishWithChainSaw = false
if ( Proc.Prc == 10 and not ProcessLongCut.Identify( Proc)) and bLarghAsFace and abs( nSide) == 2 and ( bCanUseBlade and bCanUseUnderBlade) and Proc.Fct == 1 then
bFinishWithChainSaw = EgtIf ( ( EgtGetInfo( Proc.Id, 'Q05', 'i') or 0) == 1, true, false)
end
local nFaceUse local nFaceUse
local nFaceUse2 local nFaceUse2
-- se ho solo lama da sotto -- se ho solo lama da sotto
@@ -657,14 +759,26 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
end end
-- si percorrono i lati alto e basso della faccia -- si percorrono i lati alto e basso della faccia
-- calcolo quanto è l'affondamento del taglio -- calcolo quanto è l'affondamento del taglio
local dOffset = ( dWidth + dDimStrip) / 2 local dOffsetTopBlade = ( dWidth + dDimStrip) / 2
local dOffsetDownBlade = ( dWidth + dDimStrip) / 2
local nStepDownBlade = 1
local dStepDownBlade = dWidth - dOffsetDownBlade
-- se lama da sotto verifico se la componente Y della profondità di taglio supera la capacità della lama -- se lama da sotto verifico se la componente Y della profondità di taglio supera la capacità della lama
if ( nSide == -1 or abs(nSide) == 2) and bCanUseUnderBlade then if ( nSide == -1 or abs(nSide) == 2) and bCanUseUnderBlade and (( dWidth - dDimStrip) / 2) > dMaxDepthDn then
if (( dWidth - dDimStrip) / 2) > dMaxDepthDn then if bFinishWithChainSaw then
dOffsetTopBlade = max( dWidth - dMaxDepth + ( BD.DECR_VERT_CUT or 0), dOffsetTopBlade)
dOffsetDownBlade = max( dWidth - dMaxDepthDn, dOffsetDownBlade)
local dHCutDownBlade = dWidth - dOffsetDownBlade
local dMaxStepDownBlade = 64
nStepDownBlade = ceil( dHCutDownBlade / dMaxStepDownBlade)
dStepDownBlade = dHCutDownBlade / nStepDownBlade
else
local sErr = 'Error : side depth is bigger than underneath blade cut depth' local sErr = 'Error : side depth is bigger than underneath blade cut depth'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
else
bFinishWithChainSaw = false
end end
local nM = 0 local nM = 0
-- se abilitata la lavorazione di lama su faccia chiusa, aggiungo le eventuali lavorazioni di antischeggia -- se abilitata la lavorazione di lama su faccia chiusa, aggiungo le eventuali lavorazioni di antischeggia
@@ -729,6 +843,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
end end
end end
end end
-- inserisco tagli di lama -- inserisco tagli di lama
for i = 1, nC do for i = 1, nC do
-- Posizione braccio portatesta -- Posizione braccio portatesta
@@ -737,124 +852,145 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dLioTang = 0 local dLioTang = 0
for k = 1, 2 do for k = 1, 2 do
local dLioPerp = ( dWidth - dDimStrip) / 2 + BD.CUT_SIC ; local nStep = 1
local bAddOpposite = true if k == 2 then nStep = nStepDownBlade end
local dAddExtraPerp = 0 for Zstep = nStep, 1, -1 do
-- se faccia da sotto e angolo inferiore ai 12° o faccia di fianco e angolo inferiore a 15° (al di sotto di questo angolo local dLioPerp = ( dWidth - dDimStrip) / 2 + BD.CUT_SIC
-- l'attacco lama si comporta in modo diverso) allora calcolo il valore perpendicolare con la funzione CalcLeadInOutPerpGeom local bAddOpposite = true
if ( nSide == -1 and abs(vtN:getY()) >= 0.2079) or ( abs(nSide) == 2 and abs(vtN:getZ()) >= 0.2588) then local dAddExtraPerp = 0
bAddOpposite = false -- se faccia da sotto e angolo inferiore ai 12° o faccia di fianco e angolo inferiore a 15° (al di sotto di questo angolo
end -- l'attacco lama si comporta in modo diverso) allora calcolo il valore perpendicolare con la funzione CalcLeadInOutPerpGeom
-- faccio in modo di calcolare il valore perpendicolare solo sulla faccia da sotto nel secondo passo o sulla faccia di fianco nel primo passo if ( nSide == -1 and abs(vtN:getY()) >= 0.2079) or ( abs(nSide) == 2 and abs(vtN:getZ()) >= 0.2588) then
if nSide == 1 or ( nSide == -1 and k == 1) or ( abs(nSide) == 2 and k == 2) then bAddOpposite = false
bAddOpposite = false end
end -- faccio in modo di calcolare il valore perpendicolare solo sulla faccia da sotto nel secondo passo o sulla faccia di fianco nel primo passo
if bAddOpposite then if nSide == 1 or ( nSide == -1 and k == 1) or ( abs(nSide) == 2 and k == 2) then
-- controllo se devo aggiungere un extra all'attacco perpendicolare bAddOpposite = false
if nSide == -1 then end
if vtN:getY() > 0 then if bAddOpposite then
dAddExtraPerp = Proc.Box:getMin():getY() - b3Solid:getMin():getY() -- controllo se devo aggiungere un extra all'attacco perpendicolare
elseif vtN:getY() < 0 then if nSide == -1 then
dAddExtraPerp = b3Solid:getMax():getY() - Proc.Box:getMax():getY() if vtN:getY() > 0 then
dAddExtraPerp = Proc.Box:getMin():getY() - b3Solid:getMin():getY()
elseif vtN:getY() < 0 then
dAddExtraPerp = b3Solid:getMax():getY() - Proc.Box:getMax():getY()
end
elseif abs(nSide) == 2 then
dAddExtraPerp = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
end end
elseif abs(nSide) == 2 then dLioPerp = dLioPerp + dAddExtraPerp
dAddExtraPerp = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
end end
dLioPerp = dLioPerp + dAddExtraPerp -- inserisco le parti di lavorazione
end nM = nM + 1
-- inserisco le parti di lavorazione local sNameF
nM = nM + 1 local nMchFId
local sNameF
local nMchFId
if ( k == 1 and bCanUseBlade) or ( k == 2 and ( bCanUseBlade and not bCanUseUnderBlade)) then if ( k == 1 and bCanUseBlade) or ( k == 2 and ( bCanUseBlade and not bCanUseUnderBlade)) then
sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM) sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCutting) nMchFId = EgtAddMachining( sNameF, sCutting)
if not nMchFId then if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sCutting local sErr = 'Error adding machining ' .. sNameF .. '-' .. sCutting
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end
-- setto le variabili delle distanze dagli estremi
dEndDist = dEndDistUp
dEndAccDist = dEndAccDistUp
dStartDist = dStartDistUp
dStartAccDist = dStartAccDistUp
elseif ( k == 2 and bCanUseUnderBlade) or ( k == 1 and ( bCanUseUnderBlade and not bCanUseBlade)) then
sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCuttingDn)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sCuttingDn
EgtOutLog( sErr)
return false, sErr
end
-- setto le variabili delle distanze dagli estremi
dEndDist = dEndDistDn
dEndAccDist = dEndAccDistDn
dStartDist = dStartDistDn
dStartAccDist = dStartAccDistDn
end end
-- setto le variabili delle distanze dagli estremi -- aggiungo geometria
dEndDist = dEndDistUp EgtSetMachiningGeometry( {{ Proc.Id, 0}})
dEndAccDist = dEndAccDistUp -- limito opportunamente la lavorazione
dStartDist = dStartDistUp local dSal = EgtIf( i == nC, -dEndDist, - dEndAccDist - ( nC - i - 1) * dC)
dStartAccDist = dStartAccDistUp local dEal = EgtIf( i == 1, -dStartDist, - dStartAccDist - ( i - 2) * dC)
elseif ( k == 2 and bCanUseUnderBlade) or ( k == 1 and ( bCanUseUnderBlade and not bCanUseBlade)) then if ( not bFront and k == 1) or ( bFront and k == 2) then
sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM) dSal, dEal = dEal, dSal
nMchFId = EgtAddMachining( sNameF, sCuttingDn)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sCuttingDn
EgtOutLog( sErr)
return false, sErr
end end
-- setto le variabili delle distanze dagli estremi
dEndDist = dEndDistDn if bCanUseBlade and bCanUseUnderBlade then
dEndAccDist = dEndAccDistDn EgtSetMachiningParam( MCH_MP.INVERT, true)
dStartDist = dStartDistDn EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
dStartAccDist = dStartAccDistDn dSal, dEal = dEal, dSal
end -- imposto uso della faccia
-- aggiungo geometria EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse))
EgtSetMachiningGeometry( {{ Proc.Id, 0}}) elseif bCanUseBlade and BD.USE_LONGCUT then
-- limito opportunamente la lavorazione EgtSetMachiningParam( MCH_MP.INVERT, true)
local dSal = EgtIf( i == nC, -dEndDist, - dEndAccDist - ( nC - i - 1) * dC) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
local dEal = EgtIf( i == 1, -dStartDist, - dStartAccDist - ( i - 2) * dC) dSal, dEal = dEal, dSal
if ( not bFront and k == 1) or ( bFront and k == 2) then -- imposto uso della faccia
dSal, dEal = dEal, dSal EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse))
end elseif bCanUseUnderBlade then
if abs(nSide) ~= 2 then
if bCanUseBlade and bCanUseUnderBlade then EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, true) end
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) -- imposto uso della faccia
dSal, dEal = dEal, dSal EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2))
-- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse))
elseif bCanUseBlade and BD.USE_LONGCUT then
EgtSetMachiningParam( MCH_MP.INVERT, true)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
dSal, dEal = dEal, dSal
-- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse))
elseif bCanUseUnderBlade then
if abs(nSide) ~= 2 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
end
-- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2))
else
-- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2))
end
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
-- imposto offset radiale
EgtSetMachiningParam( MCH_MP.OFFSR, EgtIf( nSide == -1, -dOffset, dOffset))
-- imposto attacco/uscita
EgtSetMachiningParam( MCH_MP.LITANG, dLioTang)
EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp)
EgtSetMachiningParam( MCH_MP.LOTANG, dLioTang)
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp)
-- se il flag uso lama custom abilitato (indica che questo script è lanciato dal ProcessCut)
-- controllo se componente X versore è maggiore di un valore limite cambio la direzione della forcella
if bCustUseBlade and abs(vtN:getX()) > 0.009 + 5 * GEO.EPS_SMALL then
if BD.USE_LONGCUT then
nSCC = EgtIf( ( bFront and k == 1) or ( not bFront and k == 2), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else else
nSCC = EgtIf( ( not bFront and k == 1) or ( bFront and k == 2), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) -- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse, nFaceUse2))
end
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
-- imposto offset radiale
local dOffset = EgtIf( k == 1, dOffsetTopBlade, dOffsetDownBlade + dStepDownBlade * ( Zstep - 1))
EgtSetMachiningParam( MCH_MP.OFFSR, EgtIf( nSide == -1, -dOffset, dOffset))
-- imposto attacco/uscita
EgtSetMachiningParam( MCH_MP.LITANG, dLioTang)
EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp)
EgtSetMachiningParam( MCH_MP.LOTANG, dLioTang)
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp)
-- se il flag uso lama custom abilitato (indica che questo script è lanciato dal ProcessCut)
-- controllo se componente X versore è maggiore di un valore limite cambio la direzione della forcella
if bCustUseBlade and abs(vtN:getX()) > 0.009 + 5 * GEO.EPS_SMALL then
if BD.USE_LONGCUT then
nSCC = EgtIf( ( bFront and k == 1) or ( not bFront and k == 2), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else
nSCC = EgtIf( ( not bFront and k == 1) or ( bFront and k == 2), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
end
end
-- imposto posizione braccio porta testa per non ingombrare agli estremi
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end end
end
-- imposto posizione braccio porta testa per non ingombrare agli estremi
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end end
end end
end end
-- se richiesto aggiungo la lavorazione con sega a catena
if bFinishWithChainSaw then
local dChainSawOverMaterial = 0
local dChainSawDepth = dOffsetDownBlade - dDimStrip
dEndDist = dEndDistUp
dEndAccDist = dEndAccDistUp
dStartDist = dStartDistUp
dStartAccDist = dStartAccDistUp
for i = nC, 1, -1 do
local dSal = EgtIf( i == nC, -dEndDist, - dEndAccDist - ( nC - i - 1) * dC)
local dEal = EgtIf( i == 1, -dStartDist, - dStartAccDist - ( i - 2) * dC)
local bChainSawOk, sErr = MakeSideFaceByChainSaw( Proc.Id, dChainSawDepth, dChainSawOverMaterial, dSal, dEal)
if not bChainSawOk then return false, sErr end
end
end
-- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut -- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut
elseif ( nSide ~= - 1 or BD.DOWN_HEAD) and nUseMillOnSide == 0 then elseif ( nSide ~= - 1 or BD.DOWN_HEAD) and nUseMillOnSide == 0 then
-- determino la massima elevazione -- determino la massima elevazione
@@ -863,7 +999,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local bDownHead = ( nSide == - 1) local bDownHead = ( nSide == - 1)
sMchType = EgtIf( bDownHead, 'Long2Cut_H2', 'Long2Cut') sMchType = EgtIf( bDownHead, 'Long2Cut_H2', 'Long2Cut')
local bExcludeH3 = bLarghAsFace and abs( nSide) ~= 1 local bExcludeH3 = bLarghAsFace and abs( nSide) ~= 1
local sMilling = ML.FindMilling( sMchType, dElev, nil, nil, nil, not bDownHead, bDownHead, bExcludeH3) local sMilling = ML.FindMilling( sMchType, dElev, nil, nil, nil, not bDownHead, bDownHead, nil, bExcludeH3)
if not sMilling then if not sMilling then
local sErr = 'Error : milling '..sMchType..' not found in library' local sErr = 'Error : milling '..sMchType..' not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -879,7 +1015,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end end
end end
-- se la fine (a sinistra) non è limitata e ho un pezzo successivo meno distante di metà raggio. setto la fine come limitata -- se la fine (a sinistra) non è limitata e ho un pezzo successivo o grezzo riutilizzabile meno distante di metà raggio, setto la fine come limitata
if dDistToNextPiece < dToolDiam/2 and not bLimXmin then if dDistToNextPiece < dToolDiam/2 and not bLimXmin then
bForcedLim = true bForcedLim = true
bLimXmin = true bLimXmin = true
+15 -8
View File
@@ -10,6 +10,8 @@
-- 2022/05/27 Corretto ordine per casi sui lati. -- 2022/05/27 Corretto ordine per casi sui lati.
-- 2022/06/29 Corretto calcolo lunghezza attacco/uscita perpendicolare per lavorazioni di fianco. -- 2022/06/29 Corretto calcolo lunghezza attacco/uscita perpendicolare per lavorazioni di fianco.
-- 2022/11/30 Modifiche su SCC per TURN. -- 2022/11/30 Modifiche su SCC per TURN.
-- 2023/01/26 Rimossa la pulitura della faccia laterale nel caso in cui la feature abbia almeno una faccia rivolta verso il basso.
-- 2023/01/27 In MakeSideFace il prolungamento di uscita è ora fissato a 10 mm.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessLong2Cut = {} local ProcessLong2Cut = {}
@@ -118,7 +120,11 @@ function ProcessLong2Cut.GetLongFacesCount( Proc)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, nL2CSide) local function MakeSideFace( nId, nFac, nSideLimitingFace, sMilling, dToolDiam, nL2CSide, bIsAnyFaceUpsideDown)
if ( not BD.DOWN_HEAD or not BD.TURN) and bIsAnyFaceUpsideDown then
EgtOutLog( 'Long2Cut : side face finishing skipped , down head required')
return true
end
-- inserisco la lavorazione -- inserisco la lavorazione
local sNameF = 'L2C_' .. ( EgtGetName( nId) or tostring( nId)) .. '_' .. tostring( nFac) local sNameF = 'L2C_' .. ( EgtGetName( nId) or tostring( nId)) .. '_' .. tostring( nFac)
local nMchFId = EgtAddMachining( sNameF, sMilling) local nMchFId = EgtAddMachining( sNameF, sMilling)
@@ -133,15 +139,15 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, nL2CSide)
EgtSetMachiningParam( MCH_MP.INVERT, false) EgtSetMachiningParam( MCH_MP.INVERT, false)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- uso della faccia -- uso della faccia
local nFaceUse = EgtIf( nSide == 1, MCH_MILL_FU.ORTHO_RIGHT, MCH_MILL_FU.ORTHO_LEFT) local nFaceUse = EgtIf( nSideLimitingFace == 1, MCH_MILL_FU.ORTHO_RIGHT, MCH_MILL_FU.ORTHO_LEFT)
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- annullo offset radiale -- annullo offset radiale
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
-- attacco e uscita -- attacco e uscita
EgtSetMachiningParam( MCH_MP.LIPERP, 0) EgtSetMachiningParam( MCH_MP.LIPERP, 0)
EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2 + 30) EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2 + 30)
EgtSetMachiningParam( MCH_MP.LOPERP, 0) EgtSetMachiningParam( MCH_MP.LOPERP, 2)
EgtSetMachiningParam( MCH_MP.LOTANG, dToolDiam / 2 + 30) EgtSetMachiningParam( MCH_MP.LOTANG, 10)
-- se faccia di fianco e testa da sotto, aumento la sicurezza -- se faccia di fianco e testa da sotto, aumento la sicurezza
if nL2CSide == 0 and BD.DOWN_HEAD then if nL2CSide == 0 and BD.DOWN_HEAD then
EgtSetMachiningParam( MCH_MP.STARTPOS, 80) EgtSetMachiningParam( MCH_MP.STARTPOS, 80)
@@ -302,6 +308,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
elseif vtN[1]:getZ() < -0.0175 and vtN[2]:getZ() < -0.0175 then elseif vtN[1]:getZ() < -0.0175 and vtN[2]:getZ() < -0.0175 then
nSide = -1 nSide = -1
end end
local bIsAnyFaceUpsideDown = vtN[1]:getZ() < -0.0175 or vtN[2]:getZ() < -0.0175
-- angolo diedro per stabilire se taglio convesso -- angolo diedro per stabilire se taglio convesso
local bInt, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, tFaceLong[1], tFaceLong[2], GDB_ID.ROOT) local bInt, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, tFaceLong[1], tFaceLong[2], GDB_ID.ROOT)
@@ -325,7 +332,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end end
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo -- ottengo la distanza tra la fine del pezzo e il pezzo successivo
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or 5.4 local dDistToNextPiece = BL.GetDistanceToNextPart( nRawId, nPhase)
local bForcedLim local bForcedLim
local sWarn local sWarn
---------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------
@@ -375,7 +382,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1}) vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)} vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)}
else else
local bFront = ( vtN[1]:getY() < 0 or vtN[2]:getY() < 0) local bFront = ( ( vtN[1]:getY() + vtN[2]:getY()) < 0)
if bFront then if bFront then
vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 1, 2}, { 2, 1}) vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)} vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
@@ -1125,11 +1132,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end end
-- se facce principali convesse, eventuale lavorazione della faccia limitante l'inizio (a destra) -- se facce principali convesse, eventuale lavorazione della faccia limitante l'inizio (a destra)
if bConvex and j == 1 and not bStartFixed then if bConvex and j == 1 and not bStartFixed then
MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], 1, sMilling, dToolDiam, nSide) MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], 1, sMilling, dToolDiam, nSide, bIsAnyFaceUpsideDown)
end end
-- se facce principali convesse, eventuale lavorazione della faccia limitante la fine (a sinistra) -- se facce principali convesse, eventuale lavorazione della faccia limitante la fine (a sinistra)
if bConvex and j == nC and not bEndFixed then if bConvex and j == nC and not bEndFixed then
MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], -1, sMilling, dToolDiam, nSide) MakeSideFace( Proc.Id, tFaceLong[vOrd[i]], -1, sMilling, dToolDiam, nSide, bIsAnyFaceUpsideDown)
end end
end end
end end
+35 -40
View File
@@ -7,6 +7,8 @@
-- 2022/09/27 Migliorata la scelta utensile. Se c'è almeno una lavorazione 'mortise' si cerca di usare quelle, riducendo l'elevazione se necessario. -- 2022/09/27 Migliorata la scelta utensile. Se c'è almeno una lavorazione 'mortise' si cerca di usare quelle, riducendo l'elevazione se necessario.
-- Se non c'è nemmeno una lavorazione 'mortise' si passa alle pocket. -- Se non c'è nemmeno una lavorazione 'mortise' si passa alle pocket.
-- 2022/12/12 Migliorato controllo necessità CleanCorners. -- 2022/12/12 Migliorato controllo necessità CleanCorners.
-- 2023/01/31 Aggiunta gestione lavorazione in doppio.
-- 2023/01/31 Creata la funzione ConvertToClosedCurve (parte della ProcessMortise.Make) e spostata in BeamLib.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessMortise = {} local ProcessMortise = {}
@@ -36,6 +38,13 @@ function ProcessMortise.FrontIdentify( Proc)
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 51) return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 51)
end end
---------------------------------------------------------------------
-- Riconoscimento delle sole feature laterali
function ProcessMortise.SideIdentify( Proc)
return ( (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 50) or
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 53))
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Classificazione della feature: decide se la feature è in una posizione che per lavorala -- Classificazione della feature: decide se la feature è in una posizione che per lavorala
-- deve essere ribaltata o no -- deve essere ribaltata o no
@@ -234,17 +243,17 @@ local function CleanCorners( Proc, dMorH, vtN, bDoubleDir, AuxId)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function VerifyMortiseOrPocket( Proc, dDiam, dDepth, dMaxTotLen, sType, bPocketDown) function ProcessMortise.VerifyMortiseOrPocket( Proc, dDiam, dDepth, dMaxTotLen, sType, bPocketDown, bExcludeH2)
-- ricerca della svuotatura -- ricerca della svuotatura
local sPocketing local sPocketing
if dDepth then if dDepth then
sPocketing = ML.FindPocketing( sType, dDiam, dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or sPocketing = ML.FindPocketing( sType, dDiam, dDepth, dMaxTotLen, not bPocketDown, bPocketDown, bExcludeH2) or
ML.FindPocketing( sType, dDiam, 0.8 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or ML.FindPocketing( sType, dDiam, 0.8 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown, bExcludeH2) or
ML.FindPocketing( sType, dDiam, 0.6 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or ML.FindPocketing( sType, dDiam, 0.6 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown, bExcludeH2) or
ML.FindPocketing( sType, dDiam, 0.4 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or ML.FindPocketing( sType, dDiam, 0.4 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown, bExcludeH2) or
ML.FindPocketing( sType, dDiam, 0, dMaxTotLen) ML.FindPocketing( sType, dDiam, 0, dMaxTotLen, bExcludeH2)
else else
sPocketing = ML.FindPocketing( sType, dDiam, 0, dMaxTotLen) sPocketing = ML.FindPocketing( sType, dDiam, 0, dMaxTotLen, bExcludeH2)
end end
if not sPocketing then if not sPocketing then
return false return false
@@ -286,34 +295,8 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- recupero versore estrusione della curva supplementare -- recupero versore estrusione della curva supplementare
local vtExtr = EgtCurveExtrusion( AuxId, GDB_ID.ROOT) local vtExtr = EgtCurveExtrusion( AuxId, GDB_ID.ROOT)
-- Se curva di contorno aperta -- se curva di contorno aperta la rendo chiusa
if not EgtCurveIsClosed( AuxId) then BL.ConvertToClosedCurve( Proc, AuxId)
local NewId, nCount = EgtExtractSurfTmFacetLoops( Proc.Id, 0, EgtGetParent( Proc.Id))
if NewId then
-- elimino eventuali loop interni (non dovrebbero comunque esserci)
for i = 1, nCount - 1 do
EgtErase( NewId + i)
end
-- sostituisco il loop esterno alla curva originale
EgtModifyCurveExtrusion( NewId, vtExtr, GDB_ID.ROOT)
EgtRelocate( NewId, AuxId, GDB_IN.AFTER)
EgtErase( AuxId)
EgtChangeId( NewId, AuxId)
-- sistemo i lati aperti
local vFacAdj = EgtSurfTmFacetAdjacencies( Proc.Id, 0)[1]
if vFacAdj then
local sOpen = ''
for i = 1, #vFacAdj do
if vFacAdj[i] < 0 then
sOpen = sOpen .. EgtIf( #sOpen > 0, ',', '') .. tostring( i - 1)
end
end
if #sOpen > 0 then
EgtSetInfo( AuxId, 'OPEN', sOpen)
end
end
end
end
-- verifico se frontale -- verifico se frontale
local bFront = ( Proc.Prc == 51) local bFront = ( Proc.Prc == 51)
-- recupero i dati della faccia di fondo -- recupero i dati della faccia di fondo
@@ -420,18 +403,25 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
elseif bPockAngTrasm then elseif bPockAngTrasm then
sMchExt = '_AT' sMchExt = '_AT'
end end
local bExcludeH2 = false
if Proc.Double and Proc.Double > 0 then
bPockUp = false
bPockDown = false
bExcludeH2 = true
sMchExt = ''
end
local sPocketing local sPocketing
if Proc.Prc ~= 53 then if Proc.Prc ~= 53 then
sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown) sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown, bExcludeH2)
if not sPocketing and bPockUp then if not sPocketing and bPockUp then
sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt) sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, _, bExcludeH2)
end end
end end
if not sPocketing then if not sPocketing then
sPockType = 'Pocket' sPockType = 'Pocket'
sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown) sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown, bExcludeH2)
if not sPocketing and bPockUp then if not sPocketing and bPockUp then
sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt) sPocketing = ProcessMortise.VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, _, bExcludeH2)
end end
end end
if not sPocketing then if not sPocketing then
@@ -509,7 +499,12 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
-- imposto elevazione -- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMorH, 1) .. ';') local sUserNotes = 'MaxElev=' .. EgtNumToString( dMorH, 1) .. ';'
-- se lavorazione in doppio
if Proc.Double and Proc.Double > 0 then
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
+9 -4
View File
@@ -1,6 +1,7 @@
-- ProcessSawCut.lua by Egaltech s.r.l. 2022/03/07 -- ProcessSawCut.lua by Egaltech s.r.l. 2022/12/19
-- Gestione calcolo taglio di lama per Travi -- Gestione calcolo taglio di lama per Travi
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe) -- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe).
-- 2022/12/19 Aggiunta gestione testa da sotto.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessSawCut = {} local ProcessSawCut = {}
@@ -80,8 +81,12 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
end end
-- recupero flag per inizio e fine interni -- recupero flag per inizio e fine interni
local bInside = (( EgtGetInfo( Proc.Id, 'Q01', 'i') or 0) ~= 0) local bInside = (( EgtGetInfo( Proc.Id, 'Q01', 'i') or 0) ~= 0)
-- abilitazione lavorazione da sotto
local bDownHead = ( BD.DOWN_HEAD and vtDir:getZ() < -0.341)
local bTopHead = ( BD.DOWN_HEAD and ( vtDir:getZ() > -0.342 or not bDownHead))
-- recupero la lavorazione -- recupero la lavorazione
local sCutting = ML.FindCutting( 'HeadSide') local sCutting
sCutting, bDownHead = ML.FindCutting( 'HeadSide', bTopHead, bDownHead)
if not sCutting then if not sCutting then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -101,7 +106,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
end end
-- determino se lavorazione da davanti o da dietro e se da sotto -- determino se lavorazione da davanti o da dietro e se da sotto
local bFront = ( vtDir ^ vtN):getX() > 0 local bFront = ( vtDir ^ vtN):getX() > 0
local bDownUp = ( vtN:getZ() < -0.259) local bDownUp = ( not bDownHead and vtN:getZ() < -0.259)
local bFillAreaPiece local bFillAreaPiece
-- se non da sotto -- se non da sotto
if not bDownUp then if not bDownUp then
+2 -2
View File
@@ -453,9 +453,9 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
local dSawRad = dSawDiam / 2 local dSawRad = dSawDiam / 2
local dKL = dSawRad - dMaxDepth + b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN local dKL = dSawRad - dMaxDepth + b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN
if BD.C_SIMM then if BD.C_SIMM then
dAccEnd = sqrt( dSawRad * dSawRad - dKL * dKL) dAccEnd = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
else else
dAccStart = sqrt( dSawRad * dSawRad - dKL * dKL) dAccStart = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
end end
end end
-- se necessari tagli in doppio, eseguo gli opposti -- se necessari tagli in doppio, eseguo gli opposti
+21 -41
View File
@@ -24,6 +24,23 @@ function ProcessStepJointNotch.Identify( Proc)
return ( ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 80) return ( ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 80)
end end
---------------------------------------------------------------------
-- Verifica se feature di testa
function ProcessStepJointNotch.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
return false
end
---------------------------------------------------------------------
-- Verifica se feature di coda
function ProcessStepJointNotch.IsTailFeature( Proc, b3Raw)
-- recupero box del pezzo
local nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL)
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- verifico se è in coda
local dEndDist = Proc.Box:getMin():getX() - b3Solid:getMin():getX()
return ( dEndDist < BD.MAX_DIST_HTFEA)
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Classificazione della feature -- Classificazione della feature
function ProcessStepJointNotch.Classify( Proc) function ProcessStepJointNotch.Classify( Proc)
@@ -89,47 +106,10 @@ local function MachineByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Solid,
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- verifico se necessari tagli supplementari -- tagli delle facce
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd]) local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), nil, bDownHead)
--DC.PrintOrderCut( vCuts) if not bOk then
if #vCuts > 0 then return bOk, sErr
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
end
-- eseguo
for i = 1, #vCuts do
-- determino il modo di tagliare
local k, l = nBigInd, nSmaInd
if ( i % 2) == 1 then
k, l = l, k
end
local nOrthoOpposite
if bOnY then
local bFront = ( ptC[k]:getY() < ptPs:getY())
nOrthoOpposite = EgtIf( bFront, MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT)
else
local bOver = ( vtN[nBigInd]:getZ() > -0.1)
nOrthoOpposite = EgtIf( bOver, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_TOP)
end
-- lavoro la faccia
for j = 1, #vCuts[i] do
local dLocCutExtra = EgtIf( j == #vCuts[i], dCutExtra - dExtraUp, dCutExtra)
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, nOrthoOpposite, EgtIf( bDownHead, -2, nil), dLocCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
end
end
-- altrimenti, tagli diretti delle facce
else
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), nil, bDownHead)
if not bOk then
return bOk, sErr
end
end end
return true return true
end end
+60 -5
View File
@@ -1,4 +1,4 @@
-- ProcessTenon.lua by Egaltech s.r.l. 2022/12/12 -- ProcessTenon.lua by Egaltech s.r.l. 2023/01/20
-- Gestione calcolo tenone per Travi -- Gestione calcolo tenone per Travi
-- 2021/10/04 Corretto calcolo HCING per pezzi piccoli. -- 2021/10/04 Corretto calcolo HCING per pezzi piccoli.
-- 2022/02/15 Aggiornata VerifyOrientation per macchine con testa da sotto. -- 2022/02/15 Aggiornata VerifyOrientation per macchine con testa da sotto.
@@ -7,6 +7,8 @@
-- 2022/09/20 Migliorato il calcolo delle passate laterali; ora considera la reale distanza tra contorno del tenone e estremi della faccia -- 2022/09/20 Migliorato il calcolo delle passate laterali; ora considera la reale distanza tra contorno del tenone e estremi della faccia
-- 2022/11/03 Corretto uso di bH2 (da sotto solo se anche bMillDown vero). -- 2022/11/03 Corretto uso di bH2 (da sotto solo se anche bMillDown vero).
-- 2022/12/12 Su macchine con rulli pressori e pinze separate si riduce di meno l'ingombro con tenoni inclinati. -- 2022/12/12 Su macchine con rulli pressori e pinze separate si riduce di meno l'ingombro con tenoni inclinati.
-- 2022/12/20 Aggiunta gestione smusso. Migliorata scelta tra sopra e sotto per il punto di inizio. In VerifyOrientation aggiunta trave medio alta.
-- 2023/01/20 Modificata scelta lato di attacco per pezzo piccolo su macchine con pinza speciale (pinza 5).
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessTenon = {} local ProcessTenon = {}
@@ -32,8 +34,8 @@ local function VerifyOrientation( Proc, vtN, b3Raw)
end end
-- se trave molto bassa -- se trave molto bassa
if b3Raw:getDimZ() <= 120 then if b3Raw:getDimZ() <= 120 then
-- se tenone praticamente in asse, accetto fino a -45 deg -- se non testa PF e tenone praticamente in asse, accetto fino a -45 deg
if abs( vtN:getY()) < 0.04 then if not BD.C_SIMM and abs( vtN:getY()) < 0.04 then
return ( vtN:getZ() >= -0.7072) return ( vtN:getZ() >= -0.7072)
-- altrimenti accetto fino a -30deg -- altrimenti accetto fino a -30deg
else else
@@ -57,6 +59,15 @@ local function VerifyOrientation( Proc, vtN, b3Raw)
else else
return ( vtN:getZ() >= -0.174) return ( vtN:getZ() >= -0.174)
end end
-- se trave medio alta
elseif b3Raw:getDimZ() <= 400 then
-- se tenone praticamente in asse, accetto fino a -15 deg
if abs( vtN:getY()) < 0.04 then
return ( vtN:getZ() >= -0.259)
-- altrimenti, accetto fino a -5 deg
else
return ( vtN:getZ() >= -0.088)
end
-- altrimenti -- altrimenti
else else
-- accetto fino a -5deg -- accetto fino a -5deg
@@ -197,6 +208,43 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
end end
end end
-- se vero tenone e richiesto, eseguo lo smusso
if Proc.Prc ~= 52 and EgtGetInfo( Proc.Id, 'P05', 'i') == 1 then
-- profondità smusso
local dDepth = EgtGetInfo( Proc.Id, 'Q01', 'd') or 0
if dDepth > 0.1 then
local dExtra = 2
-- recupero la lavorazione
local sMilling = ML.FindMilling( 'Mark', nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then
local sErr = 'Error : milling (Mark) not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- Inserisco la lavorazione
local sName1 = 'TenC_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch1Id = EgtAddMachining( sName1, sMilling)
if not nMch1Id then
local sErr = 'Error adding machining ' .. sName1 .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- assegno affondamento e offset radiale
EgtSetMachiningParam( MCH_MP.DEPTH, -dTenH + dDepth + dExtra)
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDepth + dExtra, 1) .. ';')
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
end
end
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = 'Tenon' local sMillType = 'Tenon'
local sMilling, _, _, bH2 = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown) local sMilling, _, _, bH2 = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown)
@@ -224,10 +272,17 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- massimo numero di passate e coefficiente di sovrapposizione ta passate -- massimo numero di passate e coefficiente di sovrapposizione ta passate
local MAX_PASS = 6 local MAX_PASS = 6
local OVERLAP_COEFF = 0.7 local OVERLAP_COEFF = 0.7
-- porto inizio curva il più possibile sul bordo in alto o in basso -- porto inizio curva il più possibile sul bordo in alto, in basso o di lato a seconda delle necessità
local dMaxDist = OVERLAP_COEFF * dMillDiam * MAX_PASS local dMaxDist = OVERLAP_COEFF * dMillDiam * MAX_PASS
local nNearSide = 3
local bMyShortPart = ( bShortPart and vtN:getX() < 0 and abs( vtN:getX()) < 0.999 and abs( vtN:getY()) < 0.259) local bMyShortPart = ( bShortPart and vtN:getX() < 0 and abs( vtN:getX()) < 0.999 and abs( vtN:getY()) < 0.259)
BL.PutStartNearestToEdge( AuxId, b3Solid, dMaxDist, EgtIf( bH2 and bMillDown, not bMyShortPart, bMyShortPart)) if bH2 and bMillDown then
nNearSide = EgtIf( bMyShortPart and vtN:getZ() < -0.018, 3, -3)
else
nNearSide = EgtIf( bMyShortPart and vtN:getZ() > 0.018, -3, 3)
end
if bMyShortPart and BD.CLAMP5 then nNearSide = -2 end
BL.PutStartNearestToEdge( AuxId, b3Solid, dMaxDist, nNearSide)
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente -- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
local sWarn local sWarn
local dDepth = 0 local dDepth = 0
+253 -130
View File
@@ -1,7 +1,8 @@
-- BeamNestProcess.lua by Egaltech s.r.l. 2021/06/14 -- BeamNestProcess.lua by Egaltech s.r.l. 2023/01/15
-- Gestione nesting automatico travi -- Gestione nesting automatico travi
-- 2022/10/05 Piccole modifiche per far funzionare correttamente i compilati -- 2022/10/05 Piccole modifiche per far funzionare correttamente i compilati.
-- 2022/10/06 Corretto bug che moltiplicava i pezzi se erano presenti più grezzi della stessa sezione -- 2022/10/06 Corretto bug che moltiplicava i pezzi se erano presenti più grezzi della stessa sezione.
-- 2023/01/15 Piccole correzioni.
-- Intestazioni -- Intestazioni
require( 'EgtBase') require( 'EgtBase')
@@ -17,6 +18,9 @@ EgtEnableDebug( false)
local sLog = ' +++ BeamNestProcess : ' .. NEST.FILE .. ', ' .. NEST.MACHINE .. ', ' .. LEN["1"] local sLog = ' +++ BeamNestProcess : ' .. NEST.FILE .. ', ' .. NEST.MACHINE .. ', ' .. LEN["1"]
EgtOutLog( sLog) EgtOutLog( sLog)
-- flag per abilitare statistiche in log
local bLogStat = false
-- Cancello file di log specifico -- Cancello file di log specifico
local sLogFile = EgtChangePathExtension( NEST.FILE, '.txt') local sLogFile = EgtChangePathExtension( NEST.FILE, '.txt')
EgtEraseFile( sLogFile) EgtEraseFile( sLogFile)
@@ -87,9 +91,9 @@ local function ExecMaximumFilling( Raw, Parts)
EgtMaxFillerAddPart( i, Parts[i].Len, Parts[i].DispLen or Parts[i].Len, Parts[i].Cnt or 1) EgtMaxFillerAddPart( i, Parts[i].Len, Parts[i].DispLen or Parts[i].Len, Parts[i].Cnt or 1)
end end
-- Eseguo l'ottimizzazione -- Eseguo l'ottimizzazione
EgtStartCounter() --EgtStartCounter()
EgtMaxFillerCompute( Raw.LenToFill, Raw.StartGap, Raw.MidGap, Raw.EndGap, Raw.SortType) EgtMaxFillerCompute( Raw.LenToFill, Raw.StartGap, Raw.MidGap, Raw.EndGap, Raw.SortType)
local dTime = EgtStopCounter() --local dTime = EgtStopCounter()
-- Recupero i risultati -- Recupero i risultati
local nFilledParts, nDiffParts, dTotFillRatio = EgtMaxFillerGetResults() local nFilledParts, nDiffParts, dTotFillRatio = EgtMaxFillerGetResults()
local OneRes = {} local OneRes = {}
@@ -97,7 +101,8 @@ local function ExecMaximumFilling( Raw, Parts)
local nPartId, nCount = EgtMaxFillerGetOneResult( i) local nPartId, nCount = EgtMaxFillerGetOneResult( i)
table.insert( OneRes, { Id=nPartId, Count=nCount}) table.insert( OneRes, { Id=nPartId, Count=nCount})
end end
return { FilledParts=nFilledParts, DiffParts=nDiffParts, FillRatio=dTotFillRatio, Time=dTime, Data=OneRes} --return { FilledParts=nFilledParts, DiffParts=nDiffParts, FillRatio=dTotFillRatio, Time=dTime, Data=OneRes}
return { FilledParts=nFilledParts, DiffParts=nDiffParts, FillRatio=dTotFillRatio, Data=OneRes}
end end
-- Funzione per trovare nome MachGroup -- Funzione per trovare nome MachGroup
@@ -155,34 +160,36 @@ local nErrCnt = 0
local nWarnCnt = 0 local nWarnCnt = 0
-- Grezzi -- Grezzi
-- lista dei grezzi
local Raws = {} local Raws = {}
-- creo tabella dei grezzi -- creo tabella dei grezzi
for nIndex, nLen in pairs( LEN) do for nIndex, nLen in pairs( LEN) do
table.insert(Raws, {LenToFill = nLen, StartGap = NEST.STARTOFFSET, MidGap = NEST.OFFSET, EndGap = 0, SortType = -1}) Raws[tonumber(nIndex)] = {LenToFill = nLen, StartGap = NEST.STARTOFFSET, MidGap = NEST.OFFSET, EndGap = 0, SortType = -1}
end end
for nIndex, nQty in pairs( QTY) do for nIndex, nQty in pairs( QTY) do
Raws[tonumber(nIndex)].Count = nQty Raws[tonumber(nIndex)].Count = nQty
end end
--local nTotRaws = Raws.Count
-- Pezzi
local Parts = {}
-- cerco il grezzo con la lunghezza maggiore, epurata dello start gap -- cerco il grezzo con la lunghezza maggiore, epurata dello start gap
local maxRawLenToFillNoStartGap = 0 local maxRawLenToFillNoStartGap = 0
for RawIndex = 1, #Raws do for RawIndex = 1, #Raws do
maxRawLenToFillNoStartGap = max( maxRawLenToFillNoStartGap, Raws[RawIndex].LenToFill - Raws[RawIndex].StartGap) if Raws[RawIndex].Count > 0 then
maxRawLenToFillNoStartGap = max( maxRawLenToFillNoStartGap, Raws[RawIndex].LenToFill - Raws[RawIndex].StartGap)
end
end end
-- Pezzi
local Parts = {}
-- ciclo su pezzi per aggiungerli al nesting -- ciclo su pezzi per aggiungerli al nesting
local dTotLen = 0
for nPartId, nCount in pairs( PART) do for nPartId, nCount in pairs( PART) do
-- recupero lunghezza pezzo -- recupero lunghezza pezzo
local Len = EgtGetInfo( nPartId, "L", 'd') local Len = EgtGetInfo( nPartId, "L", 'd')
local DispLen = EgtIf( Len <= 1000, 2000, 0) --EgtIf( Len <= 2000, max( 2000, 6000 - Len), 0) local DispLen = EgtIf( Len <= 1000, 2000, 0) --EgtIf( Len <= 2000, max( 2000, 6000 - Len), 0)
-- aggiungo il pezzo solo se ci sta nel grezzo più lungo a disposizione -- aggiungo il pezzo solo se ci sta nel grezzo più lungo a disposizione
if Len < maxRawLenToFillNoStartGap then if Len < maxRawLenToFillNoStartGap then
table.insert( Parts, {Id = nPartId, Len = Len, DispLen = DispLen, Cnt = nCount}) for nCntIndex = 1 , nCount do
table.insert( Parts, {Id = nPartId, Len = Len, DispLen = DispLen, Cnt = 1})
dTotLen = dTotLen + Len
end
end end
end end
@@ -201,131 +208,247 @@ local MediumRawQty = ceil( RawQtySum / #NeededRawsForType)
if MediumRawQty > 1 then if MediumRawQty > 1 then
MediumRawQty = MediumRawQty - 1 MediumRawQty = MediumRawQty - 1
end end
-- recupero pezzi piu' corti di mille
local ShortList = {} -- lista dei risultati
local LongList = {} local ResultList = {}
for PartIndex = 1, #Parts do local BestResult = nil
if Parts[PartIndex].Len <= 1000 then local BestResultIndex = nil
table.insert( ShortList, Parts[PartIndex]) -- riordino lista pezzi per lunghezza
else table.sort( Parts, function( B1, B2) return B1.Len < B2.Len end)
table.insert( LongList, Parts[PartIndex])
local function NestSolutionByIndex( Index)
-- creo copia lista raw
local TempRaws = {}
for TempRawIndex = 1, #Raws do
table.insert(TempRaws, {LenToFill = Raws[TempRawIndex].LenToFill, StartGap = Raws[TempRawIndex].StartGap, MidGap = Raws[TempRawIndex].MidGap, EndGap = Raws[TempRawIndex].EndGap, SortType = Raws[TempRawIndex].SortType, Count = Raws[TempRawIndex].Count})
end end
end
-- numero di pezzi piccoli per barra -- recupero pezzi corti
local ShortCount = 0 local ShortList = {}
for ShortIndex = 1, #ShortList do local LongList = {}
ShortCount = ShortCount + ShortList[ShortIndex].Cnt
end for PartIndex = 1, #Parts do
local ShortForRaw = floor( ShortCount / MediumRawQty) if PartIndex <= Index then
local ExtraShortForRaw = 0 table.insert( ShortList, Parts[PartIndex])
if MediumRawQty > 0 then else
ExtraShortForRaw = fmod( ShortCount, MediumRawQty) table.insert( LongList, Parts[PartIndex])
end end
-- creo lista pezzi corti singoli Parts[PartIndex].Cnt = 1
local SingleShortList = {}
for ShortIndex = 1, #ShortList do
for ShortCount = 1, ShortList[ShortIndex].Cnt do
table.insert( SingleShortList, {Id = ShortList[ShortIndex].Id, Len = ShortList[ShortIndex].Len, DispLen = ShortList[ShortIndex].DispLen, Cnt = 1})
end end
end -- numero di pezzi piccoli per barra
-- li divido per le barre previste local ShortCount = Index
local RawsShortList = {} local ShortForRaw = floor( ShortCount / MediumRawQty)
local RawIndex = 0 local ExtraShortForRaw = 0
local ShortRawIndex = 0 if MediumRawQty > 0 then
for ShortIndex = 1, #SingleShortList do ExtraShortForRaw = fmod( ShortCount, MediumRawQty)
if ShortRawIndex > 0 then end
table.insert( RawsShortList[RawIndex], SingleShortList[ShortIndex]) -- creo lista pezzi corti singoli
ShortRawIndex = ShortRawIndex - 1 local SingleShortList = {}
else for ShortIndex = 1, #ShortList do
table.insert( RawsShortList, {SingleShortList[ShortIndex]}) for ShortCount = 1, ShortList[ShortIndex].Cnt do
RawIndex = RawIndex + 1 table.insert( SingleShortList, {Id = ShortList[ShortIndex].Id, Len = ShortList[ShortIndex].Len, DispLen = ShortList[ShortIndex].DispLen, Cnt = 1})
ShortRawIndex = ShortForRaw + EgtIf( RawIndex <= ExtraShortForRaw, 1, 0) - 1 end
end
-- li divido per le barre previste
local RawsShortList = {}
local RawIndex = 0
local ShortRawIndex = 0
for ShortIndex = 1, #SingleShortList do
if ShortRawIndex > 0 then
table.insert( RawsShortList[RawIndex], SingleShortList[ShortIndex])
ShortRawIndex = ShortRawIndex - 1
else
table.insert( RawsShortList, {SingleShortList[ShortIndex]})
RawIndex = RawIndex + 1
ShortRawIndex = ShortForRaw + EgtIf( RawIndex <= ExtraShortForRaw, 1, 0) - 1
end
end
-- Ciclo fino ad esaurimento pezzi o barre
local dTotPartInRawLen = 0
local nRawTot = 0
local dRawTotLen = 0
local dTime = 0
local nCycle = 1
local CurrResult = {}
while TotRawCount( TempRaws) > 0 and PartsToFill( Parts) > 0 do
-- creo lista con pezzi lunghi e pezzi corti di questo Cycle
local PartsToNest = {}
for PartIndex = 1, #LongList do
table.insert( PartsToNest, LongList[PartIndex])
end
for CycleIndex = 1, #RawsShortList do
if CycleIndex <= nCycle then
for PartIndex = 1, #RawsShortList[CycleIndex] do
table.insert( PartsToNest, RawsShortList[CycleIndex][PartIndex])
end
end
end
-- se non ci sono pezzi da nestare, esco
if PartsToFill( PartsToNest) <= 0 then
break
end
-- Eseguo ottimizzazione per ogni lunghezza di barra
local Results = {}
for RawIndex = 1, #TempRaws do
if TempRaws[RawIndex].Count > 0 then
Results[RawIndex] = ExecMaximumFilling( TempRaws[RawIndex], PartsToNest)
else
Results[RawIndex] = { FillRatio = 0.001, LenToFill = 1000, DiffParts = 0}
end
end
-- verifico quale e' quella con meno scarto
local nMinWasteRawIndex = GDB_ID.NULL
local dMinWaste = 100000
for ResultIndex = 1, #Results do
if Results[ResultIndex] then
local dWaste = (1 - Results[ResultIndex].FillRatio) * TempRaws[ResultIndex].LenToFill
if Results[ResultIndex].DiffParts > 0 and dWaste < dMinWaste then
dMinWaste = dWaste
nMinWasteRawIndex = ResultIndex
end
end
end
-- verifico se ci sono pezzi
if nMinWasteRawIndex > 0 and Results[nMinWasteRawIndex] and Results[nMinWasteRawIndex].DiffParts > 0 then
-- riporto barra e pezzi nel risultato corrente
local CurrBar = { BarLen = TempRaws[nMinWasteRawIndex].LenToFill, Parts = {}}
local CurrX = TempRaws[nMinWasteRawIndex].StartGap
local nInfoIndex = 1
for i = 1, Results[nMinWasteRawIndex].DiffParts do
local PartIndex = Results[nMinWasteRawIndex].Data[i].Id
local PartId = PartsToNest[PartIndex].Id
local dLen = PartsToNest[PartIndex].Len
for j = 1, Results[nMinWasteRawIndex].Data[i].Count do
-- creo pezzo copia
CurrPart = { Index = nInfoIndex, PartId = PartId, PosX = CurrX}
table.insert( CurrBar.Parts, CurrPart)
CurrX = CurrX + dLen + TempRaws[nMinWasteRawIndex].MidGap
nInfoIndex = nInfoIndex + 1
end
end
table.insert( CurrResult, CurrBar)
dTotPartInRawLen = dTotPartInRawLen + ( Results[nMinWasteRawIndex].FillRatio * TempRaws[nMinWasteRawIndex].LenToFill)
nRawTot = nRawTot + 1
dRawTotLen = dRawTotLen + TempRaws[nMinWasteRawIndex].LenToFill
-- Aggiorno per prossima iterazione
TempRaws[nMinWasteRawIndex].Count = TempRaws[nMinWasteRawIndex].Count - 1
for i = 1, Results[nMinWasteRawIndex].DiffParts do
local PartId = Results[nMinWasteRawIndex].Data[i].Id
PartsToNest[PartId].Cnt = PartsToNest[PartId].Cnt - Results[nMinWasteRawIndex].Data[i].Count
end
else
-- se non sono riuscito ad inserire alcun pezzo esco dal ciclo perche' non ci sono pezzi inseribili
break
end
nCycle = nCycle + 1
end
-- riporto risultato in lista
ResultList[Index] = dTotPartInRawLen
if not BestResult or not BestResultIndex or
( dTotPartInRawLen > ResultList[BestResultIndex] + 0.02 or ( abs( dTotPartInRawLen - ResultList[BestResultIndex]) < 0.02 and dRawTotLen < BestResult.RawTotLen - 0.02)) then
BestResult = CurrResult
BestResult.RawTotLen = dRawTotLen
BestResultIndex = Index
end end
end end
-- Ciclo fino ad esaurimento pezzi o barre local CycleCount = 0
local nRawTot = 0
local dTime = 0 local MinTime = 10 + pow( 3, ceil( log10( #Parts)) - 1)
local nCycle = 1 if bLogStat then EgtOutLog('MinTime: ' .. MinTime ) end
while TotRawCount( Raws) > 0 and PartsToFill( Parts) > 0 do local MaxTime = 30 + pow( 7, ceil( log10( #Parts)) - 1)
if bLogStat then EgtOutLog('MaxTime: ' .. MaxTime ) end
local TargetRatio = 0.98
local dTargetRatioLen = TargetRatio * dTotLen
if bLogStat then EgtOutLog('TargetRatioLen: ' .. dTargetRatioLen ) end
local CurrTime = 0
local function NestSolutionFromSP( StartingPoint, OscillationStep)
-- ciclo sulle possibilita' da un punto di origine con uno step fisso
local CurrResultIndex = StartingPoint
NestSolutionByIndex( StartingPoint)
if OscillationStep == 0 then return end
local CycleIndex = 1
local nOutOfBoundary = 0
while nOutOfBoundary ~= 3 do
CurrTime = EgtStopCounter() / 1000
if bLogStat then EgtOutLog('CurrTime: ' .. CurrTime ) end
if bLogStat then EgtOutLog('BestRatio: ' .. dTotLen / BestResult.RawTotLen ) end
-- se e' passato il tempo massimo, o e' passato il tempo minimo, ha inserito tutti i pezzi e la percentuale di utilizzo del materiale e' maggiore della soglia
if CurrTime > MaxTime or ( CurrTime > MinTime and ResultList[BestResultIndex] > dTotLen - 0.1 and ( dTotLen / BestResult.RawTotLen ) >= TargetRatio) then
if bLogStat then EgtOutLog('Brake') end
break
end
local bCurrOutOfBoundary = false
if CurrResultIndex < 0 then
bCurrOutOfBoundary = true
if nOutOfBoundary == 2 then
nOutOfBoundary = 3
else
nOutOfBoundary = 1
end
end
if CurrResultIndex > #Parts then
bCurrOutOfBoundary = true
if nOutOfBoundary == 1 then
nOutOfBoundary = 3
else
nOutOfBoundary = 2
end
end
if not bCurrOutOfBoundary and not ResultList[CurrResultIndex] then
NestSolutionByIndex( CurrResultIndex)
if bLogStat then EgtOutLog('CurrResultIndex: ' .. CurrResultIndex ) end
if bLogStat then EgtOutLog('Result: ' .. ResultList[CurrResultIndex]) end
CycleCount = CycleCount + 1
end
CurrResultIndex = StartingPoint + EgtIf( CycleIndex % 2 == 0, (CycleIndex / 2) * OscillationStep, -( ( CycleIndex + 1) / 2) * OscillationStep )
CycleIndex = CycleIndex + 1
end
end
-- creo lista pezzi con pezzi lunghi e pezzi corti di questo Cycle -- lancio calcolo
local PartsToNest = {} EgtStartCounter()
for PartIndex = 1, #LongList do local StartingResult = floor( #Parts * 0.3)
table.insert( PartsToNest, LongList[PartIndex]) if bLogStat then EgtOutLog('StartingResult: ' .. StartingResult ) end
--local Step = floor( #Parts / 10) * floor( log10( #Parts))
local nDividendo = pow( 10, floor( log10( #Parts)) - 1)
nDividendo = EgtIf( nDividendo ~= 1, nDividendo, 10)
local Step = floor( #Parts / nDividendo) * floor( log10( #Parts))
if bLogStat then EgtOutLog('Step: ' .. Step ) end
NestSolutionFromSP( StartingResult, Step)
if Step > 1 then
NestSolutionFromSP( StartingResult, 1)
end
-- creo gruppi di lavorazione per risultato
for MachGroupIndex = 1, #BestResult do
local CurrMachGroup = BestResult[ MachGroupIndex]
-- creo gruppo di lavorazione
local MachGroupName = NewMachGroupName()
nMachGroup = EgtAddMachGroup( MachGroupName)
EgtSetInfo( nMachGroup, "BARLEN", CurrMachGroup.BarLen)
EgtSetInfo( nMachGroup, "MATERIAL", NEST.MATERIAL)
EgtSetInfo( nMachGroup, "AUTONEST", 1)
-- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione
EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID)
EgtSetInfo( nMachGroup, "PATTID", nMachGroup)
-- Disegno i pezzi
for i = 1, #CurrMachGroup.Parts do
local CurrPart = CurrMachGroup.Parts[ i]
-- creo pezzo copia
local nPartDuploId = EgtDuploNew( CurrPart.PartId)
EgtSetInfo( nMachGroup, "PART" .. CurrPart.Index, nPartDuploId .. "," .. CurrPart.PosX)
end end
for CycleIndex = 1, #RawsShortList do
if CycleIndex <= nCycle then
for PartIndex = 1, #RawsShortList[CycleIndex] do
table.insert( PartsToNest, RawsShortList[CycleIndex][PartIndex])
end
end
end
-- se non ci sono pezzi da nestare, esco
if PartsToFill( PartsToNest) <= 0 then
break
end
-- Eseguo ottimizzazione per ogni lunghezza di barra
local Results = {}
for RawIndex = 1, #Raws do
if Raws[RawIndex].Count > 0 then
Results[RawIndex] = ExecMaximumFilling( Raws[RawIndex], PartsToNest)
else
Results[RawIndex] = { FillRatio = 0.001, LenToFill = 1000}
end
end
-- verifico quale e' quella con meno scarto
local nMinWasteRawIndex = GDB_ID.NULL
local dMinWaste = 100000
for ResultIndex = 1, #Results do
if Results[ResultIndex] then
local dWaste = (1 - Results[ResultIndex].FillRatio) * Raws[ResultIndex].LenToFill
if dWaste < dMinWaste then
dMinWaste = dWaste
nMinWasteRawIndex = ResultIndex
end
end
end
-- verifico se ci sono pezzi
if nMinWasteRawIndex > 0 and Results[nMinWasteRawIndex] and Results[nMinWasteRawIndex].DiffParts > 0 then
-- creo gruppo di lavorazione
local MachGroupName = NewMachGroupName()
nMachGroup = EgtAddMachGroup( MachGroupName)
EgtSetInfo( nMachGroup, "BARLEN", Raws[nMinWasteRawIndex].LenToFill)
EgtSetInfo( nMachGroup, "MATERIAL", NEST.MATERIAL)
EgtSetInfo( nMachGroup, "AUTONEST", 1)
-- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione
EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID)
EgtSetInfo( nMachGroup, "PATTID", nMachGroup)
-- Disegno i pezzi
local CurrX = Raws[nMinWasteRawIndex].StartGap
local nInfoIndex = 1
for i = 1, Results[nMinWasteRawIndex].DiffParts do
local PartIndex = Results[nMinWasteRawIndex].Data[i].Id
local PartId = PartsToNest[PartIndex].Id
local dLen = PartsToNest[PartIndex].Len
for j = 1, Results[nMinWasteRawIndex].Data[i].Count do
-- creo pezzo copia
local nPartDuploId = EgtDuploNew( PartId)
EgtSetInfo( nMachGroup, "PART" .. nInfoIndex, nPartDuploId .. "," .. CurrX)
CurrX = CurrX + dLen + Raws[nMinWasteRawIndex].MidGap
nInfoIndex = nInfoIndex + 1
end
end
nRawTot = nRawTot + 1
-- Aggiorno per prossima iterazione
Raws[nMinWasteRawIndex].Count = Raws[nMinWasteRawIndex].Count - 1
for i = 1, Results[nMinWasteRawIndex].DiffParts do
local PartId = Results[nMinWasteRawIndex].Data[i].Id
PartsToNest[PartId].Cnt = PartsToNest[PartId].Cnt - Results[nMinWasteRawIndex].Data[i].Count
end
end
nCycle = nCycle + 1
end end
-- creo grezzi per ogni gruppo di lavorazione -- creo grezzi per ogni gruppo di lavorazione
local nRawCnt = 0 local nRawCnt = 0
local nRawTot = ResultList[BestResultIndex]
_G.BEAM = {} _G.BEAM = {}
BEAM.FILE = NEST.FILE BEAM.FILE = NEST.FILE
BEAM.MACHINE = NEST.MACHINE BEAM.MACHINE = NEST.MACHINE