Compare commits

...

349 Commits

Author SHA1 Message Date
luca.mazzoleni 8baf4ad2d6 Improvement/DrillingsUnder30Deg: - Aggiunta la gestione dei fori con angolo < 30 gradi, per i quali si usa la testa della macchina per accorciare l'utile di lavoro. Fast esclusa. 2022-11-23 19:28:23 +01:00
luca.mazzoleni 3e27651e4c Merge branch 'Improvement/DownHeadInFreeContour' into develop 2022-11-23 09:25:19 +01:00
luca.mazzoleni 2c5de2516d Improvement/DownHeadInFreeContour: - implementazione corretta degli smussi 2022-11-22 17:53:17 +01:00
luca.mazzoleni 07dad8f8c2 Improvement/DownHeadInFreeContour: - correzione fresatura per casi in cui si parte dalla testa sotto 2022-11-22 14:51:39 +01:00
luca.mazzoleni b48fe0da34 Improvement/DownHeadInFreeContour: - fresatura ok, da sistemare funzionamento smussi 2022-11-22 09:33:22 +01:00
luca.mazzoleni 640f77b5f5 Merge remote-tracking branch 'origin/HEAD' into develop 2022-11-22 09:02:47 +01:00
luca.mazzoleni 14afb25783 Merge commit '5bc4e6f24f2d301c22eb2f1c0cb70ce3665a51ef' into Improvement/DownHeadInFreeContour 2022-11-22 09:02:38 +01:00
DarioS 5bc4e6f24f DataBeam :
- modifica alla lavorazione tenoni per favorire in generale l'attacco da sopra.
2022-11-22 08:42:51 +01:00
luca.mazzoleni ea40658bd3 BugFix/Ticket#802: - piccolo fix per dovetail in doppio 2022-11-21 12:41:38 +01:00
luca.mazzoleni ec1a8e711d Revert "Revert "Merge branch 'Feature/FindMirroredFeatures' of https://gitlab.steamware.net/egaltech/DataBeam into develop""
This reverts commit 182639772d.
2022-11-18 10:46:50 +01:00
luca.mazzoleni a0b55b8628 -- 2022/11/10 Corrette finiture lama per BigSection con trave alta 2022-11-16 16:47:39 +01:00
luca.mazzoleni 6e0d6c7ea7 Improvement/Ticket#880: fix minori 2022-11-15 10:32:58 +01:00
luca.mazzoleni c3786e0a96 Merge branch 'develop' 2022-11-11 10:06:42 +01:00
luca.mazzoleni 07a66eb132 Merge branch 'master' into develop 2022-11-10 19:05:09 +01:00
luca.mazzoleni b3fcdcdd6b Merge branch 'Feature/BigSection' into develop 2022-11-10 19:01:09 +01:00
luca.mazzoleni 86c225305f Feature/BigSection: -in Split, corrette finiture lama per BigSection con trave alta 2022-11-10 18:59:29 +01:00
DarioS 0c5c1dcfe5 DataBeam :
- in LapJoint abilitata variabile Q Q_USE_MILL anche per L34.
2022-11-10 18:48:07 +01:00
luca.mazzoleni af8532970c Merge branch 'develop' into Feature/BigSection 2022-11-10 15:57:58 +01:00
luca.mazzoleni 6fb843e4cf Merge branch 'Improvement/Ticket#880' into develop 2022-11-10 09:27:10 +01:00
luca.mazzoleni c654bbcd19 Improvement/Ticket#880: fix minori 2022-11-09 18:13:40 +01:00
luca.mazzoleni f0ebd5c206 Improvement/Ticket#880: fix minori 2022-11-09 16:43:40 +01:00
luca.mazzoleni 0e3e6b6174 Improvement/Ticket#880: piccola modifica 2022-11-09 15:25:45 +01:00
luca.mazzoleni 6487fc3836 Improvement/Ticket#880: - Per SimpleScarf (T70) implementata forzatura utilizzo fresa di lato tramite parametro Q04. Nel caso, viene richiamata la FreeContour 2022-11-09 12:37:11 +01:00
luca.mazzoleni 59b716daa6 Merge branch 'master' into develop 2022-11-07 15:22:08 +01:00
DarioS 98fcfd9bc1 DataBeam :
- correzioni varie per H2 come testa da sopra o da sotto. (PF o PF1250).
2022-11-05 12:38:05 +01:00
luca.mazzoleni 9177fb3c4c Merge branch 'develop' 2022-11-03 10:40:31 +01:00
luca.mazzoleni 7e21b84bb9 Improvement/Ticket#855: - in MachiningLib modificata scelta utensile ottimizzata. Ora se c'è un utensile più grande disponibile si dà preferenza a quello. 2022-11-02 18:59:14 +01:00
luca.mazzoleni fb6dbebdd4 BugFix/Ticket#871: - in split e headcut corretto accorciamento percorso lama per tagli doppi verticali 2022-11-02 11:58:55 +01:00
luca.mazzoleni 111f11cf92 BugFix/DrillingsWIthSameInOutFace:
- in ProcessDrill, nel riconoscimento dei fori da splittare, aggiunta la verifica che le facce in/out del foro siano differenti
2022-10-25 17:41:58 +02:00
luca.mazzoleni 607efa3bef BugFix/Ticket#859:
- in lapjoint leggera correzione alla ricerca della direzione milgiore di lavorazione
2022-10-20 16:53:33 +02:00
luca.mazzoleni b79e180da2 Merge remote-tracking branch 'origin/HEAD' into develop 2022-10-20 11:22:23 +02:00
luca.mazzoleni 00c0db39d7 BugFix/Ticket#861:
-In lapjoint L020 ( e altre) sistemato l'attacco per fresature aggiuntive quando l'angolo tra le facce è > 90°
2022-10-20 11:22:00 +02:00
DarioS 8dc1c63b65 DataBeam :
- modifiche per TURN.
2022-10-20 10:16:43 +02:00
luca.mazzoleni 3ca4bdde77 Merge branch 'Feature/BigSection' into develop 2022-10-19 17:17:48 +02:00
luca.mazzoleni af643b1ba5 Feature/BigSection:
-modifiche e correzione bug che impedivano il funzionamento corretto di headcut e split
2022-10-19 11:43:37 +02:00
luca.mazzoleni a9061ecf51 Merge branch 'develop' into Feature/BigSection 2022-10-19 11:40:47 +02:00
luca.mazzoleni d49cb93e36 - in NestProcess corretto bug che moltiplicava i pezzi se erano presenti più grezzi della stessa sezione 2022-10-06 09:48:11 +02:00
luca.mazzoleni f620269f31 BugFix/CompiledLua:
- in NestProcess fix percorso basedir per avere il funzionamento corretto anche con script compilati
- in NestProcess piccolo fix per evitare divisione per 0
2022-10-05 10:50:38 +02:00
luca.mazzoleni 182639772d Revert "Merge branch 'Feature/FindMirroredFeatures' of https://gitlab.steamware.net/egaltech/DataBeam into develop"
This reverts commit b2a1fc823d, reversing
changes made to ba51a86239.
2022-10-04 17:02:09 +02:00
luca.mazzoleni b2a1fc823d Merge branch 'Feature/FindMirroredFeatures' of https://gitlab.steamware.net/egaltech/DataBeam into develop 2022-10-04 17:01:22 +02:00
luca.mazzoleni ba51a86239 Merge remote-tracking branch 'origin/master' into develop 2022-10-04 17:00:58 +02:00
Emmanuele Sassi 26077bcfdf Merge remote-tracking branch 'origin/master' 2022-10-04 17:00:31 +02:00
luca.mazzoleni 4dbec60558 Merge branch 'develop' into Feature/FindMirroredFeatures 2022-10-04 16:43:25 +02:00
luca.mazzoleni 3bd16304c5 Merge remote-tracking branch 'origin/master' into develop 2022-10-04 16:34:49 +02:00
Emmanuele Sassi 950f7d1992 - correzione Beam in Commento
- corretto bug nest che non usciva se pezzo piu' lungo del grezzo
2022-10-04 16:31:00 +02:00
DarioS bc8fffd075 DataBeam :
- modifiche per TURN
- sistemato controllo per cubetti su tagli.
2022-10-04 16:01:15 +02:00
luca.mazzoleni 3669787621 Feature/FindMirroredFeatures:
- in BeamExec aggiunta la ricerca delle feature specchiate per mortase a coda di rondine
2022-09-29 16:03:02 +02:00
luca.mazzoleni 0c9945a457 Merge branch 'Improvement/BetterMortiseToolSelection' into develop 2022-09-27 16:43:18 +02:00
luca.mazzoleni 8a693a38cc Improvement/BetterMortiseToolSelection:
- Sistemato spostamento geometria se fuori dal grezzo
2022-09-27 15:53:09 +02:00
luca.mazzoleni e6c173e5a1 Improvement/BetterMortiseToolSelection:
-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.
2022-09-27 11:32:26 +02:00
luca.mazzoleni bd822e9153 Merge branch 'develop' into Improvement/BetterMortiseToolSelection 2022-09-26 17:04:06 +02:00
luca.mazzoleni cf7322229d Merge branch 'BugFix/HeadSplitCutOnBigSection' into develop 2022-09-26 16:41:17 +02:00
luca.mazzoleni 706d9efa9d BugFix/HeadSplitCutOnBigSection:
- corretto anche per Split il flag Q05 non inizializzato
- ora la gestione dei tagli per BigSection è quella standard (HorizCut, double, etc.)
2022-09-26 16:15:52 +02:00
luca.mazzoleni 4fdafa34c5 Merge remote-tracking branch 'origin/HEAD' into BugFix/HeadSplitCutOnBigSection 2022-09-26 14:51:47 +02:00
DarioS 66541894ea DataBeam :
- modifica in HeadCut per flag Q05 tipo lavorazione con trave grande non inizializzato.
2022-09-26 14:11:59 +02:00
luca.mazzoleni 1198a34cd2 Corretto bug che provocava il calcolo errato della profondità di tasche laterali se maggiore del massimo materiale fresa 2022-09-26 10:12:28 +02:00
luca.mazzoleni 41412b6cca Merge remote-tracking branch 'origin/master' into develop 2022-09-26 10:10:12 +02:00
luca.mazzoleni 9588ee0def Merge remote-tracking branch 'origin/HEAD' into Improvement/BetterMortiseToolSelection 2022-09-26 08:52:03 +02:00
DarioS bef986e453 DataBeam :
- modifiche per TURN.
2022-09-26 08:21:23 +02:00
luca.mazzoleni 4ad4638582 Merge branch 'develop' into Improvement/BetterMortiseToolSelection 2022-09-23 17:41:45 +02:00
luca.mazzoleni 5b334d8fa7 Merge branch 'Improvement/Ticket#801' into develop 2022-09-23 17:41:20 +02:00
luca.mazzoleni edb0f70a27 Improvement/Ticket#801:
sistemati commenti
2022-09-23 17:41:06 +02:00
luca.mazzoleni 808f92fa36 Improvement/Ticket#801:
-ProcessCut: ora nelle lavorazioni laterali, se viene lasciato il cordolo, non si aggiorna il grezzo
-ProcessLongCut: ora la lama sotto viene attivata per facce poco più che verticali
-mancano dei dettagli da sistemare e i commenti
2022-09-23 15:35:38 +02:00
luca.mazzoleni 6407057400 piccola correzione 2022-09-22 16:25:09 +02:00
luca.mazzoleni 2f63cd84e3 BugFix/Ticket#793:
commenti
2022-09-22 16:14:07 +02:00
luca.mazzoleni 798696a5a6 BugFix/Ticket#793:
in freeContour MakeByMill aggiunto messaggio per elevazione non raggiunta
2022-09-21 18:45:41 +02:00
luca.mazzoleni 8a3b9d4706 Merge branch 'Improvement/Ticket#796' into develop 2022-09-21 15:17:53 +02:00
luca.mazzoleni 0fdc2b8d15 Improvement/Ticket#796: in BeamExec, per il birdsmouth L020 il foro viene sempre fatto prima della lavorazione 2022-09-21 14:54:29 +02:00
luca.mazzoleni 9915cd2d42 Merge branch 'BugFix/Ticket#792' into develop 2022-09-20 17:05:28 +02:00
luca.mazzoleni 432a8a9347 BugFix/Ticket#792:
in ProcessTenon migliorato calcolo numero di passate laterali (a volte lasciava materiale agli estremi della trave)
2022-09-20 15:32:20 +02:00
luca.mazzoleni cc6d21baf6 piccola modifica a GetNearestOrthoOpposite per miglior scelta direzione attacco utensile 2022-09-16 18:40:33 +02:00
Samuele Locatelli bc5d904680 Update x compilazione script LUA 2022-09-16 11:47:58 +02:00
Samuele Locatelli 58905b88ba Update e fix percorso lua compilati 2022-09-16 11:38:15 +02:00
luca.mazzoleni 68f40aed58 Merge branch 'Feature/AddPlaningL090' into develop 2022-09-15 15:50:37 +02:00
luca.mazzoleni d91c31974e Feature/AddPlaningL090:
-implementata feature L090 (Planing), gestita come LapJoint
-in LapJoint implementata, in caso di fresatura di lato con altezza tasca molto bassa, la contornatura con unica passata
-migliorato il funzionamento di AntiSplint (Mill e Saw)
2022-09-15 12:56:02 +02:00
luca.mazzoleni a217b95c35 Feature/AddPlaningL090:
aggiunta gestione feature L090 con  parametri Q per antischeggia e forzatura lavorazione di lato
2022-09-09 16:37:46 +02:00
luca.mazzoleni 05aae0b8f3 Merge branch 'Improvement/Ticket#788' into develop 2022-09-08 12:42:51 +02:00
luca.mazzoleni 629dfc1341 Improvement/Ticket#788:
In HeadCut e Split migliorato verso di lavorazione in caso di doubleCut
2022-09-08 11:29:31 +02:00
luca.mazzoleni e9cb756dc9 Revert "Merge branch 'Improvement/Ticket#788' into develop"
This reverts commit 9b888a0a59, reversing
changes made to 7762692597.
2022-09-08 09:17:16 +02:00
luca.mazzoleni 9b888a0a59 Merge branch 'Improvement/Ticket#788' into develop 2022-09-07 18:32:06 +02:00
luca.mazzoleni b141a512bb Improvement/Ticket#788:
in Split migliore scelta del lato di lavorazione in base alla posizione di default della lama
2022-09-07 18:31:51 +02:00
luca.mazzoleni d13f108dad Improvement/Ticket#788:
in HeadCut migliore scelta del lato di lavorazione in base alla posizione di default della lama
2022-09-07 14:57:19 +02:00
luca.mazzoleni 7762692597 Merge branch 'Refactoring/MoveSomeFunctionsToBeamLib' into develop 2022-09-01 16:17:51 +02:00
luca.mazzoleni 04b0650f96 Refactoring/MoveSomeFunctionsToBeamLib:
Fix commenti
2022-09-01 16:15:35 +02:00
luca.mazzoleni 8b31881abb Refactoring/MoveSomeFunctionsToBeamLib:
spostata SetOpenSide da LapJoint a BeamLib
2022-09-01 16:08:50 +02:00
luca.mazzoleni 055d8bd4d3 Refactoring/MoveSomeFunctionsToBeamLib:
piccola correzione
2022-09-01 15:52:49 +02:00
luca.mazzoleni b0e10cee87 Refactoring/MoveSomeFunctionsToBeamLib:
spostate le funzioni GetTunnelDimension e CalcCollisionSafety da LapJoint a BeamLib
2022-09-01 15:24:08 +02:00
luca.mazzoleni a9e43984a2 Merge branch 'BugFix/Ticket#787' into develop 2022-08-30 14:52:35 +02:00
luca.mazzoleni 1e93303981 BugFix/Ticket#787:
In ProcessCut 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 14:42:26 +02:00
luca.mazzoleni 7fec3d6584 in DoubleCut aggiunta la gestione del parametro CUT_VZ_MIN, da BeamData 2022-08-29 15:47:04 +02:00
luca.mazzoleni e61cc2ba08 Merge branch 'BugFix/DoubleCutCollision' into develop 2022-08-29 13:25:42 +02:00
luca.mazzoleni 516a56c8b5 BugFix/DoubleCutCollision:
update commenti
2022-08-29 13:25:07 +02:00
luca.mazzoleni 2482338a12 BugFix/DoubleCutCollision:
inDoubleCut implementata la fresatura di lato nel caso di lavorazione con lama problematica
2022-08-29 12:52:57 +02:00
luca.mazzoleni 0528ac4a31 BugFix/DoubleCutCollision:
doublecut impostata per lanciare fresatura di lato in caso di lavorazione con lama problematica; da aggiungere la fresatura di lato
2022-08-26 18:30:49 +02:00
luca.mazzoleni 4e77597b7d Merge remote-tracking branch 'origin/master' into develop 2022-08-26 12:43:34 +02:00
DarioS 058babe605 DataBeam :
- modifiche su lavorazione di Profili Concavo e Convesso per macchina Turn.
2022-08-25 17:47:50 +02:00
luca.mazzoleni a7676c7331 Merge branch 'BugFix/CutOnShortAndTallBeams' into develop 2022-08-25 16:35:02 +02:00
luca.mazzoleni f1abaeaac3 Merge branch 'master' into develop 2022-08-25 16:34:51 +02:00
luca.mazzoleni 5db6398725 BugFix/CutOnShortAndTallBeams:
migliorato il calcolo della riduzione di profondità di lavorazione
2022-08-25 16:12:32 +02:00
luca.mazzoleni a8924f4425 BugFix/CutOnShortAndTallBeams:
In ProcessCut nel caso di pezzi corti (AdvTail) con taglio lungo Y la profondità di lavorazione è opportunamente diminuita.
2022-08-25 12:32:57 +02:00
DarioS e4c5a2e06d DataBeam :
- piccoli aggiustamenti per TURN.
2022-08-25 11:42:34 +02:00
luca.mazzoleni 29ed56df16 Merge branch 'BugFix/NoDicingIfCutNotThickerThanSaw' into develop 2022-08-24 16:56:34 +02:00
luca.mazzoleni 6d64f2232d BugFix/NoDicingIfCutNotThickerThanSaw:
In ProcessCut disabilitato il dicing per tagli meno spessi della lama
2022-08-24 16:45:47 +02:00
luca.mazzoleni e0abdbbe63 Merge branch 'Feature/MarkingInFreeContour' into develop 2022-08-23 18:29:34 +02:00
luca.mazzoleni 45afa144ad Feature/MarkingInFreeContour:
In FreeContour aggiunta la gestione dell'utensile penna per P13=10
2022-08-23 18:19:44 +02:00
luca.mazzoleni dc4a0eda3e Merge remote-tracking branch 'origin/master' into develop 2022-08-23 12:00:10 +02:00
DarioS b0cdb95e48 DataBeam :
- modifiche a lavorazione FreeContour per macchine con testa da sotto.
2022-08-23 11:49:05 +02:00
luca.mazzoleni 53e8605297 Merge branch 'BugFix/BetterFaceuseOnCutOnTail' into develop 2022-08-23 10:42:53 +02:00
luca.mazzoleni 41e490dcd2 Merge branch 'develop' into BugFix/BetterFaceuseOnCutOnTail 2022-08-23 08:54:30 +02:00
luca.mazzoleni 56f66d66c3 Merge remote-tracking branch 'origin/master' into develop 2022-08-23 08:54:07 +02:00
DarioS 7497b62dee DataBeam :
- in mortase a coda di rondine migliorato calcolo step tra passate.
2022-08-18 19:38:00 +02:00
DarioS e67e397225 DataBeam :
- modiciche a taglio di testa e taglio di separazione per macchine con testa da sotto con lama disabilitata
- modiciche a forature per macchine con testa da sotto con puntaa disabilitata.
2022-08-18 15:11:21 +02:00
luca.mazzoleni a972fbd425 BugFix/BetterFaceuseOnCutOnTail
nella ProcessCut i tagli inclinati in coda ora partono dal centro (scelta faceUse migliore)
2022-08-12 17:48:12 +02:00
luca.mazzoleni d5140acc91 BugFix:
correzioni minori
2022-08-12 09:58:33 +02:00
luca.mazzoleni b197c96a34 Feature/DoubleSideChainSawLapJoint
modificati commenti
2022-08-12 09:27:06 +02:00
luca.mazzoleni f3a72a7683 Merge branch 'Feature/DoubleSideChainSawLapJoint' into develop 2022-08-11 19:05:36 +02:00
luca.mazzoleni d72560241b Feature/DoubleSideChainSawLapJoint:
In ProcessLapJoint aggiunta lavorazione tunnel splittata con sega a catena per tutte le macchine ad esclusione della Fast
2022-08-11 18:58:18 +02:00
luca.mazzoleni 0689328082 BugFix/LapJointL2FacesQ03:
in L030 corretta lavorazionedi facce a L verso Y con parametro Q03=2/3
2022-08-10 13:07:35 +02:00
luca.mazzoleni a1a6f2243a Merge branch 'BugFix/ScarfOneFaceReduceToCut' into develop 2022-08-09 11:47:21 +02:00
luca.mazzoleni 2081b15276 BugFix/ScarfOneFaceReduceToCut:
ora se il giunto Gerber ha una sola faccia viene richiamata la Process.Cut
2022-08-09 09:41:17 +02:00
luca.mazzoleni c810aea200 Merge branch 'master' into develop 2022-08-09 09:15:38 +02:00
DarioS a684b5a5db DataBeam :
- correzione in BeamExec per macchine senza BD.MAX_WIDTH2 e BD.MAX_HEIGHT2
- migliorata gestione L030 sotto con 3 facce
- migliorata gestione affondamento/elevazione lavorazioni con sega a catena.
2022-08-09 07:09:35 +02:00
DarioS a5f80f5c25 DataBeam :
- modifiche a Mortise per lato mensola asse C FAST e per direzione lavoro con mortasatrice a catena.
2022-08-03 08:38:33 +02:00
DarioS 28af706910 DataBeam :
- tolleranza su sezione portata a 0.1 mm (100 * GEO.EPS_SMALL)
- funzioni StartsWith e EndsWith sostituite da analoghe funzioni di libreria (con prefisso Egt)
- corretta gestione tagli con testa che taglia da sotto in su
- riordino forature per gestione inclinazione limite da superficie trave
- in Mortasature se non si può pulire angoli con mortasatrice warning invece di errore.
2022-08-01 17:39:49 +02:00
luca.mazzoleni 94508d51c8 Merge branch 'Feature/MortiseCornerFinishing' into develop 2022-07-29 18:50:51 +02:00
luca.mazzoleni 90513d2ca7 Feature/MortiseCornerFinishing:
aggiunto check dimensioni tasca vs utensile
corretta direzione attacco utensile per mortasa frontale
2022-07-29 18:50:39 +02:00
luca.mazzoleni acf568d8db Merge branch 'Feature/MortiseCornerFinishing' into develop 2022-07-29 10:06:51 +02:00
luca.mazzoleni eedf701fa6 Feature/MortiseCornerFinishing:
modifiche minori
2022-07-29 10:05:47 +02:00
luca.mazzoleni 6780d5e5f5 Merge branch 'Feature/AngledDrillings' into develop 2022-07-28 09:39:17 +02:00
luca.mazzoleni 72f572d27a Merge branch 'Feature/AngledDrillings' into Feature/MortiseCornerFinishing 2022-07-28 09:13:45 +02:00
luca.mazzoleni 980081deb5 Merge branch 'develop' into Feature/AngledDrillings 2022-07-28 09:02:39 +02:00
luca.mazzoleni 67bb7ad3d9 Merge remote-tracking branch 'origin/master' into develop 2022-07-27 17:57:38 +02:00
luca.mazzoleni 358dee8808 Feature/AngledDrillings:
implemento foratura tipo AngleDrill per fori molto inclinati
2022-07-27 17:54:59 +02:00
DarioS 480fa7bfb1 DataBeam :
- modifiche per taglio di separazione con sega a catena (verifica se necessario e tipologia).
2022-07-27 15:41:07 +02:00
luca.mazzoleni 30b30471fc Feature/MortiseCornerFinishing:
per mortasa implementata la finitura degli angoli con parametro P04=1, con apposito utensile
2022-07-26 16:46:50 +02:00
luca.mazzoleni 8b560421f7 Merge remote-tracking branch 'origin/master' into develop 2022-07-25 15:34:37 +02:00
DarioS 091785a31d DataBeam :
- correzione orientamento braccio in taglio con lama L013 sui fianchi.
2022-07-25 14:07:00 +02:00
luca.mazzoleni 35c08ef493 Merge remote-tracking branch 'origin/HEAD' into develop 2022-07-25 11:17:13 +02:00
DarioS 5f4ec79707 DataBeam :
- in BatchProcessNew modifica per cancellare lavorazioni con ricalcolo e barra già definita.
2022-07-25 10:40:25 +02:00
luca.mazzoleni bff6c0fb2a Merge remote-tracking branch 'origin/master' into develop 2022-07-19 11:08:48 +02:00
DarioS 4f018b29f1 DataBeam :
- piccole migliorie sui tagli di lama.
2022-07-19 10:59:25 +02:00
luca.mazzoleni cad8e84bd8 Merge branch 'BugFix/LongCutOnT10AlsoOnSide' into develop 2022-07-18 15:22:40 +02:00
luca.mazzoleni 525ac0846d BugFix/LongCutOnT10AlsoOnSide:
LongCut anche per feature sul lato per macchine tipo PF1250
2022-07-18 15:22:16 +02:00
luca.mazzoleni 3ec71014cd Merge branch 'BugFix/AvoidSawDamagingRemainingBarIfNotShort' into develop 2022-07-14 18:57:40 +02:00
luca.mazzoleni 0bbec46754 BugFix/AvoidSawDamagingRemainingBarIfNotShort
Fix implementato per LongCut
2022-07-14 12:18:41 +02:00
luca.mazzoleni 5908f1dc10 Merge remote-tracking branch 'origin/master' into develop 2022-07-14 08:50:56 +02:00
DarioS 57ec6b97ab DataBeam :
- correzione in DoubleCut per gestione testa da sotto.
2022-07-14 06:50:55 +02:00
luca.mazzoleni f19647b5a8 Merge remote-tracking branch 'origin/master' into develop 2022-07-13 12:53:50 +02:00
DarioS ea5c64e82f DataBeam :
- in ProcessDril modifica a ricalcolo MaxElev quando distanza circa 0
- in ProcessLapJoint sistemato orientamento lama
- in ProcessScarfJoint aggiunta gestione PF1250 e TURN
- in ProcessTenon migliorata scelta punto iniziale.
2022-07-13 00:36:57 +02:00
DarioS 010fe6999e Merge branch 'develop' of https://gitlab.steamware.net/egaltech/DataBeam 2022-07-12 20:09:16 +02:00
luca.mazzoleni 5c468ee01b Fix: commenti 2022-07-12 18:48:49 +02:00
luca.mazzoleni 4c34f3220a Fix: modificata distanza di sicurezza per forature, ora prende il massimo tra un valore fisso (10) e il valore del db 2022-07-12 18:37:02 +02:00
DarioS 2e626d8aa4 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/DataBeam 2022-07-12 16:49:04 +02:00
luca.mazzoleni a9c0b94bbe Merge branch 'BugFix/WrongBladeCutOnL20' into develop 2022-07-12 14:26:55 +02:00
luca.mazzoleni b0136afb88 Merge branch 'develop' into BugFix/WrongBladeCutOnL20 2022-07-12 14:26:24 +02:00
luca.mazzoleni e3078fce7e Merge remote-tracking branch 'origin/master' into develop 2022-07-12 14:25:45 +02:00
luca.mazzoleni 48ed6098ff Merge remote-tracking branch 'origin/master' into BugFix/WrongBladeCutOnL20 2022-07-12 14:25:10 +02:00
DarioS f38ad29d64 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/DataBeam 2022-07-12 13:19:31 +02:00
DarioS c2edbddc77 DataBeam :
- modifiche a Cut e DoubleCut per migliorare classificazione tagli.
2022-07-12 12:46:34 +02:00
luca.mazzoleni 7d61e355ef BugFix/WrongBladeCutOnL20: corretto commento 2022-07-12 12:04:35 +02:00
luca.mazzoleni 7448e73544 BugFix/WrongBladeCutOnL20: in ProcessLapJoint, MakeByChainOrSaw aggiunto check pe feature L20 usata in modo improprio e, nel caso, si passa a una lavorazione tasca. 2022-07-12 11:30:33 +02:00
luca.mazzoleni 00941e8eb4 Merge remote-tracking branch 'origin/master' into develop 2022-07-12 08:56:16 +02:00
DarioS db37f2c1b0 DataBeam :
- in DoubleCut migliorata Classify per fattibilià e necessità di rotazione
- altre piccole modifiche accessorie.
2022-07-11 17:27:13 +02:00
luca.mazzoleni 8bfbfb5f99 Merge branch 'Feature/DrillingsOnHeadOrTailCut' into develop 2022-07-08 16:51:42 +02:00
luca.mazzoleni 626aefe5a0 Merge branch 'Feature/LapjointStepOnF1' into develop 2022-07-08 16:49:21 +02:00
luca.mazzoleni bf2e6424c9 Feature/LapJointStepOnF1: aggiunta gestione parametro Q03=3. Si comporta come Q03=2 ma esclude le feature con facce di lavoro rivolte verso l'alto (+/- 10°) 2022-07-08 16:46:45 +02:00
luca.mazzoleni 1ee1fdde57 Merge branch 'develop' into Feature/LapjointStepOnF1 2022-07-08 15:15:13 +02:00
luca.mazzoleni e22bc6bd19 Feature/DrillingsOnHeadOrTailCut: in SetDrillingsToMachineAfterHeadOrTailCut (BeamExec) corretto di nuovo check intersezione fori 2022-07-08 15:01:26 +02:00
luca.mazzoleni 518b7ffe61 Merge branch 'master' into develop 2022-07-07 12:33:59 +02:00
luca.mazzoleni ac4f32e516 Feature/DrillingsOnHeadOrTailCut: ora le forature prolungate arrivano fino alla massima profondità possibile (limite dLen - 10) in caso di split 2022-07-07 12:32:56 +02:00
luca.mazzoleni 33cd018a90 in SetDrillingsToMachineAfterHeadOrTailCut (BeamExec) corretto check intersezione fori 2022-07-06 19:12:24 +02:00
DarioS 9d88198b18 Merge branch 'master' of https://gitlab.steamware.net/egaltech/DataBeam 2022-07-06 17:24:20 +02:00
DarioS aa382ea7b1 DataBeam :
- Modifiche per sega a catena di testa e relativa MaxElev.
2022-07-06 17:23:53 +02:00
luca.mazzoleni 4b9c4af1b5 Correzione per forature su feature di testa o coda: ora riconosce correttamente anche le forature aperte con versore opposto 2022-07-06 15:11:32 +02:00
luca.mazzoleni ccb363f6f1 Per forature su feature di testa o coda corretta l'assegnazione di head o tail ( funzione SetDrillingsToMachineAfterHeadOrTailCut in BeamExec) 2022-07-06 12:01:40 +02:00
luca.mazzoleni 071389a858 Revert "modifica default per costante attivazione"
This reverts commit 75833d5f1c.
2022-07-06 09:25:05 +02:00
luca.mazzoleni 75833d5f1c modifica default per costante attivazione 2022-07-06 09:20:52 +02:00
luca.mazzoleni b7f4569cf0 Merge branch 'develop' into Feature/DrillingsOnHeadOrTailCut 2022-07-06 08:53:26 +02:00
luca.mazzoleni 574d7ca4cd Merge branch 'master' into develop 2022-07-06 08:52:45 +02:00
Emmanuele Sassi 6882139c95 Merge branch 'master' of https://gitlab.steamware.net/egaltech/DataBeam 2022-07-05 19:39:01 +02:00
Emmanuele Sassi 47972c9e62 - Implementazione gestione quantita' limitata di grezzi da utilizzare 2022-07-05 19:38:55 +02:00
luca.mazzoleni b83f427a55 piccola modifica per bypassare il check precedente che azzera MaxDepth 2022-07-05 18:40:16 +02:00
luca.mazzoleni 9e3aadd2a6 gestione corretta di MaxElev in tutti i casi 2022-07-05 17:07:27 +02:00
luca.mazzoleni 466c4b47e3 Merge branch 'develop' 2022-07-05 09:28:55 +02:00
luca.mazzoleni 415aecfa7d DataBeam: corretto commento 2022-07-05 09:28:36 +02:00
luca.mazzoleni e56d0a75f7 Merge branch 'develop' 2022-07-05 08:48:33 +02:00
luca.mazzoleni 7b7573cf29 Merge branch 'master' into develop 2022-07-05 08:40:09 +02:00
luca.mazzoleni 7be2911191 Merge branch 'master' into Feature/DrillingsOnHeadOrTailCut 2022-07-05 08:37:57 +02:00
DarioS 89aacd06ea DataBeam :
- in LapJoint aumentata tolleranza per calcolo passate lama e sega a catena.
2022-07-04 20:39:03 +02:00
luca.mazzoleni 57dba9b76c modifiche ulteriori al calcolo dell'affondamento 2022-07-04 18:03:40 +02:00
DarioS 1350cd03af DataBeam :
- in ProcessLapJoint modifiche per lavorazioni con Sega a Catena (soprattutto elevazione da MaxElev).
2022-07-04 16:52:47 +02:00
luca.mazzoleni 007453337a correzione ulteriore 2022-07-04 15:47:02 +02:00
luca.mazzoleni 0054646e78 corretta gestione affondamento in caso di utensile troppo corto, per abbinarsi con MaxElev 2022-07-04 12:25:37 +02:00
luca.mazzoleni df4ea54347 Merge branch 'develop' into Feature/DrillingsOnHeadOrTailCut 2022-07-04 08:50:12 +02:00
luca.mazzoleni 21bc34ae1a Merge remote-tracking branch 'origin/master' into develop 2022-07-04 08:48:19 +02:00
DarioS 34bbe79222 DataBeam :
- modifiche a GetNzLimDownUp per macchina FAST.
2022-07-04 07:24:40 +02:00
luca.mazzoleni 83196da193 inserito parametro IMPROVE_HEAD_TAIL_DRILLINGS per attivare o disattivare questa feature. Di default è attiva 2022-07-01 18:39:38 +02:00
luca.mazzoleni f30a44fb63 gestiti ulteriori casi per allungamento foro 2022-07-01 14:59:39 +02:00
luca.mazzoleni d5709be6b0 miglioramento e correzione gestione MaxElev per affondamento foro 2022-07-01 09:10:37 +02:00
luca.mazzoleni 2ae06e9abf implemento gestione MaxElev per affondamento foro 2022-06-30 16:55:02 +02:00
luca.mazzoleni 7dd6cf81eb Merge branch 'develop' into Feature/DrillingsOnHeadOrTailCut 2022-06-29 18:33:27 +02:00
luca.mazzoleni e882e70c0c DataBeam: - correzione commenti 2022-06-29 18:25:02 +02:00
luca.mazzoleni c722186118 DataBeam: - correzione commenti 2022-06-29 18:23:55 +02:00
luca.mazzoleni 661c398fb8 DataBeam: - correzione ordine funzioni in BeamExec 2022-06-29 18:19:00 +02:00
luca.mazzoleni d2103b9db6 Merge branch 'Feature/LapjointStepOnF1' into develop 2022-06-29 17:51:53 +02:00
luca.mazzoleni ec5583366e Revert "Revert "DataBeam:""
This reverts commit 59051cbf06.
2022-06-29 17:49:45 +02:00
luca.mazzoleni 59051cbf06 Revert "DataBeam:"
This reverts commit a5cf7e0783.
2022-06-29 17:46:05 +02:00
luca.mazzoleni a5cf7e0783 DataBeam: 2022-06-29 17:45:55 +02:00
luca.mazzoleni 82f201edda Merge remote-tracking branch 'origin/HEAD' into Feature/LapjointStepOnF1 2022-06-29 17:45:10 +02:00
DarioS 8decc393e6 DataBeam :
- in LongDoubleCut corretto calcolo lunghezza attacco/uscita perpendicolare per lavorazioni di fianco
- in Cut modificata determinazione taglio bFromBottom in MakeFromTop
- in FacesBySaw.MakeTwo modificato controllo facce dirette verso il basso.
2022-06-29 16:13:00 +02:00
DarioS 86053c9dd8 DataBeam :
- in GetBeamData forzata rilettura di BeamData della macchina corrente.
2022-06-28 11:14:58 +02:00
luca.mazzoleni 530c6310ce Merge branch 'develop' into Feature/LapjointStepOnF1 2022-06-27 17:54:50 +02:00
luca.mazzoleni 80d37ef897 DataBeam: -bugfix: piccola correzione a LapJoint 2022-06-27 17:48:11 +02:00
luca.mazzoleni 1286cfd77f DataBeam: -bugfix: nella feature L30 con Q03=2 e parete di fondo funziona correttamente la pulitura contorno (Q01=1) 2022-06-27 10:36:49 +02:00
luca.mazzoleni a36768b77e Merge remote-tracking branch 'origin/master' into develop 2022-06-27 09:20:13 +02:00
DarioS cc22dbf589 DataBeam :
- piccoli aggiustamenti e affinamenti.
2022-06-27 08:38:21 +02:00
luca.mazzoleni 84f2d30869 DataBeam: - inseriti valori di default per parametri da BeamData OVM_BLADE_HBEAM e OVM_CHAIN_HBEAM 2022-06-24 19:17:03 +02:00
luca.mazzoleni 338d9932a6 Merge branch 'master' into develop 2022-06-24 18:15:58 +02:00
luca.mazzoleni 04aed7f175 DataBeam: - primo implemento modifiche per forature in testa o coda per considerare materiale eventualmente già rimosso da lavorazioni precedenti 2022-06-24 18:14:59 +02:00
luca.mazzoleni abd4e6da69 DataBeam: - piccola correzione nel riconoscimento forature di testa 2022-06-23 16:13:38 +02:00
luca.mazzoleni bc78b20e9d Merge branch 'Feature/LapjointStepOnF1' 2022-06-22 09:45:36 +02:00
luca.mazzoleni 9e3ef01579 Merge branch 'Feature/BigSection' 2022-06-22 09:16:20 +02:00
luca.mazzoleni 966ac06e4e DataBeam: - sistemazione commenti in ProcessLapJoint 2022-06-21 09:47:12 +02:00
luca.mazzoleni 9e2a9ebc7a DataBeam: - per lavorazioni con fresatura di lato per L30 (Q03=2) aggiunte feature non passanti. Modificate funzioni MakeByPockets, Classify. 2022-06-21 09:33:19 +02:00
luca.mazzoleni 282fe97978 Merge branch 'master' into Feature/LapjointStepOnF1 2022-06-16 18:32:14 +02:00
luca.mazzoleni afb57f7e92 DataBeam: -Implemento lavorazioni con fresatura di lato per L30 (al momento solo passanti) se parametro Q03=2. Modificate funzioni Make, MakeByPockets, Classify. 2022-06-16 18:25:02 +02:00
DarioS a7c7afc568 DataBeam :
- piccola correzione a tagli con lama per facce solo approssimativamente verticali
- correzione in LapJoint per lavorazione di sega a catena fatta di fianco quando la preferenziale era di testa o coda.
2022-06-16 10:38:56 +02:00
luca.mazzoleni 2b425e1175 - corrette chiamate a GetChainSawBlockedAxis e GetChainSawInitAngs per includere ProcessLapJoint 2022-06-14 10:25:09 +02:00
luca.mazzoleni ce0614c88f - corretto end mancante dopo merge 2022-06-14 09:46:41 +02:00
luca.mazzoleni d23e352f12 Merge branch 'master' into Feature/BigSection 2022-06-14 09:29:28 +02:00
DarioS 3de8904a90 DataBeam :
- correzione in DoubleCut per caso con singola faccia e richiamo Cut non aggiornato.
2022-06-13 19:29:36 +02:00
DarioS e97cce6528 DataBeam :
- modifiche in LapJoint per feature lunga con due facce non equivalenti a taglio long. doppio o singolo con faccia terminale
2022-06-13 10:32:56 +02:00
DarioS 4a2c107761 DataBeam :
- migliorato calcolo punto inizio lavorazione tenone
- migliorato scelta direzione approccio taglio con lama
- migliorata gestione geometria addizionale in gruppo apposito.
2022-06-13 08:08:18 +02:00
luca.mazzoleni e7b14958ee Merge remote-tracking branch 'origin/master' into Feature/BigSection 2022-06-10 18:09:45 +02:00
luca.mazzoleni b29074cbb1 - implemento split e relative finiture per travi con sezioni grandi
- split con sega a catena
- distinzione finitura con lama o truciolatore in base al parametro Q05
- finiture evitate in presenza di feature che tagliano tutta la sezione
- gestione sovramateriale grezzo
2022-06-10 17:50:22 +02:00
DarioS bde704ec3a DataBeam :
- correzione a NestProcess.
2022-06-10 17:12:48 +02:00
DarioS 6756018c7a Merge branch 'master' of https://gitlab.steamware.net/egaltech/DataBeam 2022-06-08 12:01:11 +02:00
DarioS 953c01fe20 DataBeam :
- modifiche alle lavorazioni per gestione macchina TURN
- in tagli con lama aggiunta possibilità di ritorno all'inizio con macchina TURN.
2022-06-08 11:58:59 +02:00
Marco Salvi 2506cefcbf Update .gitlab-ci.yml 2022-06-07 14:02:15 +00:00
Marco Salvi aa4f0781cb Update percorso Artifacts su Truenas 2022-06-07 13:51:39 +00:00
Marco Salvi 09395eed78 Update percorso Artifacts su truenas 2022-06-07 13:36:51 +00:00
DarioS 721ffb4074 DataBeam :
- in mortase a coda di rondine fatte modifiche per evitare di entrare direttamente nel legno quando sono parziali.
2022-06-06 08:07:02 +02:00
DarioS 7b1075bc12 DataBeam :
- aggiornato Compile.bat per nuovi sorgenti.
2022-05-29 16:37:14 +02:00
DarioS f7beede72e DataBeam :
- aggiunto modulo FaceByPocket per lavorazione per svuotatura di una faccia da sorgenti in tenone
- aggiunta possibilità di svuotatura per piano sgrossatura profili su macchine PF e pezzi alti
- aggiunto modulo GetBeamData.
2022-05-29 16:31:41 +02:00
DarioS b921e1345d DataBeam :
- migliorie in LapJoint per U passanti da testa a coda e divise in parti
- correzioni e migliorie in LongDoubleCut per casi con facce ortogonali tra loro e allineate con i piani XY e XZ.
2022-05-27 11:50:41 +02:00
DarioS b5e486d3ca DataBeam :
- sui profili aggiunta lavorazione con fresa da sotto per macchine con testa da sotto (riportata modifica ES in nuova gestione).
2022-05-25 16:25:05 +02:00
DarioS a983e51718 DataBeam :
- migliorate funzioni GetNearestOrthoOpposite e GetNearestParalOpposite per casi limite.
2022-05-25 12:39:31 +02:00
DarioS e7a7f7b88b DataBeam :
- modifica lunghezza pezzi corti per feature di coda da anticipare prima del taglio.
2022-05-25 08:03:14 +02:00
DarioS 213c211131 DataBeam :
- in LapJoint miglioramenti vari per BH, compreso controlli per lavorazione da sotto
- in LapJoint corretta assegnazione elevazione quando si scambia la faccia principale tra due
- in LongDoubleCut piccole modifiche e migliorie.
2022-05-24 08:41:27 +02:00
DarioS 1b86003ed8 DataBeam :
- migliorata scelta punto di attacco lavorazione tenoni (meglio gestita testa sopra/sotto)
- corretta scelta lavorazione tenoni per macchine con testa da sotto
- corretta scelta lavorazione BH per feature BH (ora si tiene conto anche dell'affondamento).
2022-05-20 15:52:56 +02:00
DarioS c9b0f1e90d Merge branch 'master' of https://gitlab.steamware.net/egaltech/DataBeam 2022-05-16 07:56:16 +02:00
DarioS f9439199ae DataBeam :
- modifiche per macchina Turn.
2022-05-16 07:55:26 +02:00
Samuele Locatelli 41edfb318d Merge branch 'develop' 2022-05-10 08:21:15 +02:00
Samuele Locatelli a5608878b4 Typo commento 2022-05-10 08:21:08 +02:00
Samuele Locatelli cd7b05db04 Merge branch 'master' into develop 2022-05-10 08:14:14 +02:00
Samuele Locatelli f138de03cc Revisione processo: compilazione x TUTTO 2022-05-10 08:13:58 +02:00
Samuele Locatelli 2fc196ef38 Merge branch 'master' into develop 2022-05-10 08:01:19 +02:00
DarioS b51487f5af DataBeam :
- modifiche per ottimizzazione con più teste
- modifiche per compilazione.
2022-05-09 20:42:45 +02:00
DarioS 6e0c482dab DataBeam :
- nell'ordinamento quando si confrontano i box delle feature aggiunta verifica preliminare della loro validità
- ulteriore limitazione a GetNzLimDownUp per FAST
- migliorato calcolo larghezza DtMortise
- in ProcessLapJoint corretta classificazione due facce sotto e modificati criteri assegnazione due facce alla coda.
2022-05-06 17:03:30 +02:00
DarioS 14423b39f9 DataBeam :
- in ProcessLapJoint lavorazione BH forzata sempre OneWay.
2022-04-29 08:04:21 +02:00
DarioS 5d23b2fde2 DataBeam :
- in generazione CN aggiunta info se programma a 64bit.
2022-04-28 10:23:30 +02:00
DarioS 3c7c2f9c1d DataBeam :
- in ProcesslapJoint feature L025 sempre con fresa se di forma canonica.
2022-04-27 00:06:44 +02:00
DarioS 2859796429 Merge branch 'master' of https://gitlab.steamware.net/egaltech/DataBeam 2022-04-22 10:14:17 +02:00
DarioS e0e9b7b089 DataBeam :
- modifiche per gestire macchina Turn (BD.TURN)
- corretto riconoscimento fori di coda.
2022-04-22 10:13:45 +02:00
gitlab 2fc1e70589 spostato cartella Artifacts su Qnap 2022-04-20 10:18:03 +00:00
DarioS d6485ddc0d DataBeam :
- prime modifiche per TURN in tagli con lama
- allargata inclinazione verso il basso permessa sui tenoni.
2022-04-19 11:31:42 +02:00
DarioS 8b2883632e Merge branch 'master' of https://gitlab.steamware.net/egaltech/DataBeam 2022-04-13 16:00:09 +02:00
DarioS ceb52fbe22 DataBeam :
- in LapJoint eliminati parametri Q non utilizzati di 3/4-020-X.
2022-04-13 15:58:28 +02:00
Samuele Locatelli 243bedb098 Merge tag 'AddDeployToR' into develop
Fix deploy su R dei sorgenti
2022-04-12 11:27:09 +02:00
Samuele Locatelli 5e823d7304 Merge branch 'release/AddDeployToR' 2022-04-12 11:27:01 +02:00
Samuele Locatelli 7428125021 fix deploy da main/master 2022-04-12 11:26:40 +02:00
Samuele Locatelli 7f5e7916cf Esclusione folder .git 2022-04-12 11:24:09 +02:00
Samuele Locatelli a7cb99abe5 Cambio sintassi origine 2022-04-12 11:23:01 +02:00
Samuele Locatelli 3bcfc81eec Fix selezione FROM 2022-04-12 11:21:42 +02:00
Samuele Locatelli a67c7286ea typo exclude 2022-04-12 11:20:05 +02:00
Samuele Locatelli c46618569e Modifica script ci/cd x replica su R dei sorgenti 2022-04-12 11:18:51 +02:00
DarioS 1c0e6744e5 DataBeam :
- a FacesBySaw.MakeTwo aggiunta gestione speciale cubetti con fresa da sotto.
2022-04-12 10:38:08 +02:00
Samuele Locatelli a4efcf5e40 Merge tag 'ParametrizedName' into develop
Parametrizzato nome app x script compilazione comune a tutit i progetti
beam-wall
2022-04-05 15:32:54 +02:00
Samuele Locatelli 1dbf017077 Merge branch 'release/ParametrizedName' 2022-04-05 15:32:24 +02:00
Samuele Locatelli a2fbfea274 Cambio script CI/CD (parametrizzato nome app) 2022-04-05 15:31:57 +02:00
Samuele Locatelli 328a786dc6 Merge branch 'develop' 2022-04-05 15:04:44 +02:00
Samuele Locatelli cd34a33f7f update yaml script 2022-04-05 15:03:40 +02:00
Samuele Locatelli 8f997b8e0c Eliminazione eseguibile lua locale x compilazione (messo su c:\toosl) 2022-04-05 15:03:34 +02:00
DarioS 43a4ac9c9e DataBeam :
- corretta GetNzLimDownUp per FAST.
2022-04-05 11:56:35 +02:00
DarioS 3fb1acd83e DataBeam :
- corretto riconoscimento normali del box quando raggio esattamente su spigolo
- corretta assegnazione fori molto inclinati fianco/coda a coda
- aggiunta gestione antischeggia con Q06 anche su 3/4-033-X.
2022-04-04 07:37:05 +02:00
Samuele Locatelli 78d711ef57 Merge tag 'AddReplicaToNAS' into develop
Aggiunt ulteriore replica verso NAS dei LUA compilati
2022-04-01 10:26:45 +02:00
Samuele Locatelli a6b9c14e93 Merge branch 'release/AddReplicaToNAS' 2022-04-01 10:26:31 +02:00
Samuele Locatelli 71e762074e Anche replica Z in main 2022-04-01 10:20:30 +02:00
Samuele Locatelli a769c2e831 Fix path x img 64 2022-04-01 10:19:55 +02:00
Samuele Locatelli 1a88765500 Aggiunto step x branch NON main 2022-04-01 10:17:40 +02:00
Samuele Locatelli 0da52d2a5a Aggiunta replica script in area NAS 2022-04-01 10:12:27 +02:00
Samuele Locatelli a2fac0a0f9 Merge remote-tracking branch 'origin/master' into develop 2022-04-01 10:12:12 +02:00
DarioS 8b9df6f21c Merge branch 'master' of https://gitlab.steamware.net/egaltech/DataBeam 2022-03-26 14:15:36 +01:00
DarioS 3fd2034df4 DataBeam :
- modificato angolo limite da sotto per tagli con FAST
- piccola sistemazione logica in Cut
- correzioni fori testa-lato molto inclinati.
2022-03-26 14:15:09 +01:00
Samuele Locatelli aa2f68f33f Merge branch 'master' into develop 2022-03-25 15:19:13 +01:00
Samuele Locatelli 2a5b8d6733 Invio yaml SOLO x rami main/master 2022-03-25 15:18:58 +01:00
Samuele Locatelli 3648f66f0f Merge branch 'develop' 2022-03-25 15:18:04 +01:00
Samuele Locatelli 6b8f2189d9 test passwd da var gitlab 2022-03-25 15:11:51 +01:00
Samuele Locatelli 1a5ae76ddc fix elenco file da copiare/compilare... 2022-03-25 15:10:57 +01:00
Samuele Locatelli 64ddd69c22 cambio: user da parametro 2022-03-25 15:09:09 +01:00
Samuele Locatelli 0cb75dabaf Messo copia x script esterni e compilazione LuaLibs 2022-03-25 15:07:01 +01:00
Samuele Locatelli 2d1ebc8bba rimesso copia in rete script 2022-03-25 14:55:18 +01:00
Samuele Locatelli dbabf9d832 ancora test x compilare 2022-03-25 14:51:07 +01:00
Samuele Locatelli 8d4c9601c9 cambio priorità script 2022-03-25 14:49:04 +01:00
Samuele Locatelli e978191188 rimesso mount R_Drive 2022-03-25 14:46:41 +01:00
Samuele Locatelli 72f5f96452 update con copia immagini + separazione script 2022-03-25 14:45:30 +01:00
Samuele Locatelli 9d37b63066 fix gesitone debug 2022-03-25 12:31:56 +01:00
Samuele Locatelli 3c73aa3ab0 update con sleep 3s prima di disconnettere disco 2022-03-25 12:09:58 +01:00
Samuele Locatelli e68145e9b2 Fix inclusione lualibs scripts 2022-03-25 12:07:10 +01:00
Samuele Locatelli 6d7740f1ab fix sintassi robocopy 2022-03-25 12:04:52 +01:00
Samuele Locatelli fc1187a61b chiamata net use in chiaro 2022-03-25 12:00:28 +01:00
Samuele Locatelli 815a11dc42 test passwd 04 2022-03-25 11:58:54 +01:00
Samuele Locatelli 65cae0324c Ancora fix 64 bit 2022-03-25 11:56:37 +01:00
Samuele Locatelli ea3bc521d8 fix compilazione script 64 bit 2022-03-25 11:56:12 +01:00
Samuele Locatelli c082f3e159 Update conf passowrd via variable 2022-03-25 11:48:39 +01:00
Samuele Locatelli 1b2b72a1dc fix conf username 2022-03-25 11:43:44 +01:00
Samuele Locatelli bb09bdde04 update path x replica robocopy 2022-03-25 11:39:45 +01:00
Samuele Locatelli 292c70bf36 Update x deploy su drive r:\ 2022-03-25 11:34:01 +01:00
Samuele Locatelli 4e98fd7ed5 Fix cartelle LuaLibs x subscript 2022-03-25 10:50:20 +01:00
Samuele Locatelli d752c175f4 update script compilazione 2022-03-25 10:44:22 +01:00
Samuele Locatelli dc4a89f66e cmabio yaml x dir locale 2022-03-25 10:42:22 +01:00
Samuele Locatelli 594b1e20a2 aggiunto segnaposti x folder 32/64 2022-03-25 10:40:47 +01:00
Samuele Locatelli ca5596dce3 bozza yaml 32 bit 2022-03-25 10:35:55 +01:00
DarioS 3defd5663f DataBeam :
- correzione a DtMortise per antischeggia quando sono molto corte.
2022-03-24 09:01:21 +01:00
DarioS 482cd50e0b DataBeam :
- migliorie a gestione fessure con tre facce da lavorare con sega a catena.
2022-03-23 08:55:36 +01:00
DarioS cf78978476 DataBeam :
- TyroleanDovetail ammessa anche da sotto se con 2 facce, di estremità e corta
- migliorato riconoscimento Blockhaus di estremità parziali.
2022-03-22 08:20:19 +01:00
DarioS bc053e3506 DataBeam :
- piccola miglioria a modifica precedente Q10 per lama.
2022-03-21 10:42:37 +01:00
DarioS d04dbcbb01 DataBeam :
- modifiche a lavorazione con Sega a Catena per evitare problemi con macchina FAST.
2022-03-21 00:20:52 +01:00
DarioS 9eb2a8a6d7 DataBeam :
- in Long2Cut tolta da scelta milling tipo Long2CutDown controllo max diametro fresa.
2022-03-20 20:00:30 +01:00
DarioS ff19c75eba DataBeam :
- in LapJoint aggiunta gestione antischeggia con lama/fresa in lavorazione BlockHaus con fresa.
2022-03-20 19:21:43 +01:00
DarioS 5a2e494459 DataBeam :
- correzioni a LapJoint per Blockhaus
- modifiche a LapJoint per angoli limite con due facce
- modifiche a tagli con lama per angoli lama da sotto.
2022-03-20 18:59:52 +01:00
DarioS ebda8e3d29 DataBeam :
- in LongCut razionalizzata gestione casi con fresa di fianco e aggiunta gestione Long2Cut anche con testa sotto
- in SawCut consentito angolo negativo fino a 30 deg.
2022-03-08 09:22:12 +01:00
DarioS ed73898f86 DataBeam :
- in ordinamento feature per lavorazione i tagli longitudinali vengono messi dopo le altre lavorazioni lunghe
- in LapJoint migliorata gestione lama su testa sotto.
2022-03-03 10:56:13 +01:00
DarioS 003b14f02e DataBeam :
- aggiunto controllo attrezzaggio prima di simulazione.
2022-02-26 18:13:44 +01:00
DarioS 444c719010 DataBeam :
- piccola miglioria.
2022-02-23 18:09:26 +01:00
DarioS f67b99082d DataBeam :
- migliorata ottimizzazione travi in barre.
2022-02-23 11:29:41 +01:00
DarioS fdd959cf85 DataBeam :
- piccole correzioni varie.
2022-02-21 07:03:00 +01:00
DarioS 6f2b3b9ce6 DataBeam :
- aggiunto messaggio di errore se pezzo più piccolo del grezzo
- migliorata gestione tasche con almeno un lato aperto tramite svuotature a zigzag ottimizzate quando applicabili
- abilitata lavorazione tenoni orientati verso il basso su macchine con testa da sotto.
2022-02-15 12:14:56 +01:00
DarioS f7ff7a68ab DataBeam :
- in DtTenon aggiunto nuovo step di altezza trave per consentire lavorazione con faccia diretta verso il basso
- in LapJoint introdotto uso svuotature ZigZag ottimizzate.
2022-02-14 17:57:23 +01:00
DarioS 1584e4422b DataBeam :
- corretto ordinamento feature per taglio di coda anticipato da lasciare appena prima del taglio di split.
2022-02-09 12:37:22 +01:00
DarioS 14e940341c DataBeam :
- in ProcessCut si torna alla vecchia versione per scegliere se fare i cubetti (è più sicura).
2022-02-09 11:54:22 +01:00
DarioS 76070ebb26 DataBeam :
- modificato BatchNew per gestione errori come Wall
- modifica a tagli per decisione se fare cubetti.
2022-02-09 09:39:53 +01:00
DarioS 003fef5a6d DataBeam :
- in Process Cut aumentato angolo da sotto con FAST
- in Process LapJoint corretto caso con due facce che non è un LongDoubleCut ma che veniva identificato come tale
- in Process LongDoubleCut migliorato controllo lunghezze di lavorazione con fresa quando divisa in due parti.
2022-02-08 18:38:12 +01:00
DarioS 91dce236c6 DataBeam :
- correzione su tagli di coda spostati prima della separazione.
2022-02-06 18:21:04 +01:00
DarioS 9b77fbdb3e DataBeam :
- piccola modifica (mancava uno spazio).
2022-02-06 11:00:02 +01:00
DarioS bf5acdfa9b Merge branch 'master' of https://gitlab.steamware.net/egaltech/DataBeam 2022-02-02 11:23:58 +01:00
DarioS 19b803044f DataBeam :
- in travi con scarico a caduta migliorata gestione di taglio parziale obliquo
- in travi con scarico a caduta aggiunta gestione in anticipo di profili qunado fatti con solo smusso.
2022-02-02 11:22:25 +01:00
luca.bacis 916408491e - inclusione file ProcessLapJointNew con modifiche di Luca Bacis 2022-01-28 16:48:05 +01:00
DarioS 969f144d5c DataBeam :
- in travi con scarico a caduta aggiunta possibilità di taglio parziale obliquo in coda (prima versione).
2022-01-28 15:12:03 +01:00
52 changed files with 11477 additions and 3112 deletions
+6
View File
@@ -16,3 +16,9 @@
/bin
/obj
/.vs
/32/*.lua
/32/LuaLibs/*.lua
/32/Images/*.png
/64/*.lua
/64/LuaLibs/*.lua
/64/Images/*.png
+118
View File
@@ -0,0 +1,118 @@
variables:
VERS_MAIN: '1.0'
APP_NAME: 'Beam'
NEW_REL: ''
NET_SHARE_R: '\\10.74.82.201\EgwTech'
NET_SHARE_Z: '\\10.74.82.201\Artifacts'
NET_USERQ: 'steamw\egalware'
#Note compilazione LUA:
# lua53 -o 32\$FileName -s $FileName: -o = output, -s = NON include i debug symbols
# helper compilazione LUA a 32 bit
.LuaCompile32: &LuaCompile32
- |
Set-Alias lua53 C:\Tools\Lua32\luac53
echo "Copia file *.ini"
$FileList = Get-ChildItem("*.ini")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
Copy-Item -Path $FileName -Destination 32\$FileName
echo "Copy-Item -Path $FileName -Destination 32\$FileName"
}
echo "Compilazione file *.lua 32bit"
$FileList = Get-ChildItem("*.lua")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
lua53 -o 32\$FileName $FileName
echo "lua53 -o 32\$FileName $FileName"
}
$FileList = Get-ChildItem("LuaLibs\*.lua")
ForEach ($File in $FileList) {
$FileName = Split-Path $File -leaf
lua53 -o 32\LuaLibs\$FileName LuaLibs\$FileName
echo "lua53 -o 32\LuaLibs\$FileName LuaLibs\$FileName"
}
# 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
.CodeReplicaR: &CodeReplicaR
- |
net use R: /delete
net use R: $env:NET_SHARE_R /u:$env:NET_USERQ $ZDRIVE_PASSWD
ROBOCOPY . R:\EgtData\$env:APP_NAME /MIR /XF .git* /XD .git
SLEEP 2
net use R: /delete
# helper copia script verso cartella di rete R:\ delle cartelle 32 e 64
.ReplicaR: &ReplicaR
- |
net use R: /delete
net use R: $env:NET_SHARE_R /u:$env:NET_USERQ $ZDRIVE_PASSWD
ROBOCOPY /MIR 32 R:\EgtData\$env:APP_NAME\32
ROBOCOPY /MIR 64 R:\EgtData\$env:APP_NAME\64
ROBOCOPY /MIR Images R:\EgtData\$env:APP_NAME\32\Images
ROBOCOPY /MIR Images R:\EgtData\$env:APP_NAME\64\Images
SLEEP 2
net use R: /delete
# helper copia script verso cartella di rete R:\ delle cartelle 32 e 64
.ReplicaZ: &ReplicaZ
- |
net use Z: /delete
net use Z: $env:NET_SHARE_Z /u:$env:NET_USERQ $ZDRIVE_PASSWD
ROBOCOPY /MIR 32 Z:\EgtData\$env:APP_NAME\32
ROBOCOPY /MIR 64 Z:\EgtData\$env:APP_NAME\64
ROBOCOPY /MIR Images Z:\EgtData\$env:APP_NAME\32\Images
ROBOCOPY /MIR Images Z:\EgtData\$env:APP_NAME\64\Images
SLEEP 2
net use Z: /delete
stages:
- build
LuaCompile:build:
stage: build
only:
- main
- master
tags:
- win
script:
- *LuaCompile32
- *LuaCompile64
- *CodeReplicaR
- *ReplicaR
- *ReplicaZ
View File
View File
View File
View File
+21 -6
View File
@@ -1,4 +1,4 @@
-- BatchProcess.lua by Egaltech s.r.l. 2021/08/04
-- BatchProcess.lua by Egaltech s.r.l. 2022/04/28
-- Gestione calcolo batch disposizione e lavorazioni per Travi
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
-- 2019/07/16 Aggiunta gestione modalità oltre 10 per impostazione macchina e uscita.
@@ -22,6 +22,7 @@
-- 2021/02/25 Aggiunta gestione tipo scarico (standard, lav. incomplete, a caduta).
-- 2021/06/16 Se disponibile si aggiunge la versione dell'eseguibile alle info del programma CN.
-- 2021/08/04 Direzione vista simulazione da BD.SIMUL_VIEW_DIR se esiste.
-- 2022/04/28 In info generazione aggiunta indicazione se 64bit.
-- Intestazioni
require( 'EgtBase')
@@ -41,7 +42,7 @@ if BEAM.FLAG == 0 then
elseif BEAM.FLAG == 1 then
sFlag = 'MODIFY'
elseif BEAM.FLAG == 2 then
sFlag = 'SIMULATE'
sFlag = 'SIMULATE'
elseif BEAM.FLAG == 3 then
sFlag = 'CHECK'
elseif BEAM.FLAG == 4 then
@@ -116,8 +117,7 @@ local function UpdateAuxData( sAuxFile)
end
-- Imposto direttorio libreria specializzata per Travi
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua')
-- Impostazione della macchina corrente
EgtResetCurrMachGroup()
@@ -469,6 +469,20 @@ end
-- *** Eseguo simulazione con verifica collisione in cieco ***
if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.FLAG == 4 then
EgtOutLog( ' +++ Simulating with collision check >>>')
-- verifico setup
local bSetUpOk, SetUpErrors = EgtVerifyCurrSetup()
if not bSetUpOk then
local sToolsList = ""
for ToolIndex = 1, #SetUpErrors do
sToolsList = sToolsList .. SetUpErrors[ToolIndex]
if ToolIndex ~= #SetUpErrors then
sToolsList = sToolsList .. ", "
end
end
WriteErrToLogFile( 19, 'Error in setup: tool/s ' .. sToolsList .. ' not found', 0, 0, 0)
return
end
-- lancio simulazione
local bSimOk, nErr, sErr = EgtSimulate()
if not bSimOk then
if nErr == MCH_SHE.INIT then
@@ -507,10 +521,11 @@ end
-- *** Genero programma CN *** ( se richiesto)
if BEAM.FLAG == 0 or BEAM.FLAG == 4 then
EgtOutLog( ' +++ Generating NC part program >>>')
local sInfo = 'EgtCAM5 - '
local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '')
if EgtGetExeVersion then
sInfo = 'EgtCAM5 ver.' .. EgtGetExeVersion() .. ' - '
sInfo = sInfo .. ' ver.' .. EgtGetExeVersion()
end
sInfo = sInfo .. ' - '
if not EgtGenerate( '', sInfo .. sNgeFile) then
BEAM.ERR = 20
local _, sName, _ = EgtSplitPath( BEAM.FILE)
+72 -49
View File
@@ -1,4 +1,4 @@
-- BatchProcessNew.lua by Egaltech s.r.l. 2022/01/07
-- BatchProcessNew.lua by Egaltech s.r.l. 2022/08/01
-- Gestione calcolo batch disposizione e lavorazioni per Travi
-- 2021/01/07 Per nuova interfaccia Egt.
-- 2021/01/15 CREATE_BAR ora FLAG = 6 (prima 5).
@@ -8,6 +8,10 @@
-- 2021/06/16 Se disponibile si aggiunge la versione dell'eseguibile alle info del programma CN.
-- 2021/08/04 Direzione vista simulazione da BD.SIMUL_VIEW_DIR se esiste.
-- 2022/01/07 Per CUTID/TASKID senza ToProcess si verificano anche eventuali Duplo.
-- 2022/02/09 Aggiornato come Wall per gestione errori e verifica attrezzaggio utensili.
-- 2022/04/28 In info generazione aggiunta indicazione se 64bit.
-- 2022/07/24 Modifica per cancellare lavorazioni con ricalcolo e barra già definita.
-- 2022/08/01 Tolleranza su sezione portata a 0.1 mm (100 * GEO.EPS_SMALL).
-- Intestazioni
require( 'EgtBase')
@@ -27,7 +31,7 @@ if BEAM.FLAG == 0 then
elseif BEAM.FLAG == 1 then
sFlag = 'MODIFY'
elseif BEAM.FLAG == 2 then
sFlag = 'SIMULATE'
sFlag = 'SIMULATE'
elseif BEAM.FLAG == 3 then
sFlag = 'CHECK'
elseif BEAM.FLAG == 4 then
@@ -110,8 +114,7 @@ local function ResetMachGroup( vBeam)
end
-- Imposto direttorio libreria specializzata per Travi
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua')
-- Se necessario, impostazione della macchina corrente
local sMachine = BEAM.MACHINE
@@ -193,7 +196,7 @@ if bToProcess then
return
end
-- Faccio copia del file originale
EgtCopyFile( BEAM.FILE, sDir..sTitle..'.ori'..sExt)
EgtCopyFile( BEAM.FILE, sOriFile)
-- Aggiorno eventuali dati ausiliari
--UpdateAuxData( sBtmFile)
@@ -286,11 +289,10 @@ if bToProcess then
table.insert( vBeam, { Id = nPartId, PosX = dPosX, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))})
end
if #vBeam == 0 then
--BEAM.ERR = 14
--BEAM.MSG = 'Error : no beams in the project'
--WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
--return
EgtOutLog( 'Travi non trovate', 1)
BEAM.ERR = 14
BEAM.MSG = 'Error : no beams in the project'
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
return
else
local sOut = ''
for i = 1, #vBeam do
@@ -333,8 +335,8 @@ if bToProcess then
for i = 2, #vBeam do
local dDimW = vBeam[i].Box:getDimY()
local dDimH = vBeam[i].Box:getDimZ()
if ( abs( dDimW - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimH - dRawH) > 10 * GEO.EPS_SMALL) and
( abs( dDimH - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimW - dRawH) > 10 * GEO.EPS_SMALL) then
if ( abs( dDimW - dRawW) > 100 * GEO.EPS_SMALL or abs( dDimH - dRawH) > 100 * GEO.EPS_SMALL) and
( abs( dDimH - dRawW) > 100 * GEO.EPS_SMALL or abs( dDimW - dRawH) > 100 * GEO.EPS_SMALL) then
table.insert( vBeamErr, i)
end
end
@@ -423,17 +425,20 @@ if bToProcess then
-- box del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
-- creo o pulisco gruppo geometrie aggiuntive
-- se nel grezzo c'è un pezzo
if nPartId then
-- creo o pulisco gruppo geometrie aggiuntive
BL.CreateOrEmptyAddGroup( nPartId)
-- aggiungo faccia per taglio iniziale al pezzo
BL.AddPartStartFace( nPartId, b3Solid)
-- aggiungo faccia per taglio finale al pezzo
BL.AddPartEndFace( nPartId, b3Solid)
end
-- aggiungo faccia per taglio iniziale al pezzo
BL.AddPartStartFace( nPartId, b3Solid)
-- aggiungo faccia per taglio finale al pezzo
BL.AddPartEndFace( nPartId, b3Solid)
-- passo al successivo grezzo
nRawId = EgtGetNextRawPart( nRawId)
end
-- elimino le lavorazioni
EgtRemoveAllOperations()
end
-- Se richiesta solo barra, esco
@@ -455,13 +460,16 @@ if bToProcess then
-- Abilito Vmill
EgtSetInfo( EgtGetCurrMachGroup(), 'Vm', '1')
-- Aggiorno Setup utensili
EgtImportSetup()
-- Lavoro le features
local bPfOk, Stats = BE.ProcessFeatures()
local sOutput = ''
for i = 1, #Stats do
local sMsg = Stats[i].Msg
sMsg = string.gsub( sMsg, '\n', ' ', 10)
sMsg = string.gsub( sMsg, '\r', ' ', 10)
sMsg = string.gsub( sMsg or '', '\n', ' ', 10)
sMsg = string.gsub( sMsg or '', '\r', ' ', 10)
if Stats[i].Err == 0 then
BEAM.ERR = 0
BEAM.MSG = '---'
@@ -519,33 +527,33 @@ else
-- Carico il progetto già fatto
EgtOpenFile( sNgeFile)
-- Dichiaro nessun errore
local nPartId = EgtGetFirstPart()
while nPartId do
local vDup = EgtDuploList( nPartId)
if not vDup or #vDup == 0 then
vDup = { nPartId}
end
for i = 1, #vDup do
local nCutId = EgtGetInfo( vDup[i], 'CUTID', 'i')
if nCutId then
local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( vDup[i], 'Processings') or GDB_ID.NULL)
while nProcId do
local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC')
local nTaskId = EgtGetInfo( nProcId, 'TASKID', 'i')
if bIsFea and nTaskId then
BEAM.ERR = 0
BEAM.MSG = '---'
BEAM.ROT = 0
BEAM.CUTID = nCutId
BEAM.TASKID = nTaskId
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
end
nProcId = EgtGetNext( nProcId)
end
end
end
nPartId = EgtGetNextPart( nPartId)
end
--local nPartId = EgtGetFirstPart()
--while nPartId do
-- local vDup = EgtDuploList( nPartId)
-- if not vDup or #vDup == 0 then
-- vDup = { nPartId}
-- end
-- for i = 1, #vDup do
-- local nCutId = EgtGetInfo( vDup[i], 'CUTID', 'i')
-- if nCutId then
-- local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( vDup[i], 'Processings') or GDB_ID.NULL)
-- while nProcId do
-- local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC')
-- local nTaskId = EgtGetInfo( nProcId, 'TASKID', 'i')
-- if bIsFea and nTaskId then
-- BEAM.ERR = 0
-- BEAM.MSG = '---'
-- BEAM.ROT = 0
-- BEAM.CUTID = nCutId
-- BEAM.TASKID = nTaskId
-- WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
-- end
-- nProcId = EgtGetNext( nProcId)
-- end
-- end
-- end
-- nPartId = EgtGetNextPart( nPartId)
--end
-- Aggiorno eventuali dati ausiliari
--UpdateAuxData( sBtmFile)
-- Passo in modalità lavora
@@ -565,6 +573,20 @@ end
-- *** Eseguo simulazione con verifica collisione in cieco ***
if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.FLAG == 4 then
EgtOutLog( ' +++ Simulating with collision check >>>')
-- verifico setup
local bSetUpOk, SetUpErrors = EgtVerifyCurrSetup()
if not bSetUpOk then
local sToolsList = ""
for ToolIndex = 1, #SetUpErrors do
sToolsList = sToolsList .. SetUpErrors[ToolIndex]
if ToolIndex ~= #SetUpErrors then
sToolsList = sToolsList .. ", "
end
end
WriteErrToLogFile( 19, 'Error in setup: tool/s ' .. sToolsList .. ' not found', 0, 0, 0)
return
end
-- lancio simulazione
local bSimOk, nErr, sErr = EgtSimulate()
if not bSimOk then
if nErr == MCH_SHE.INIT then
@@ -603,10 +625,11 @@ end
-- *** Genero programma CN *** ( se richiesto)
if BEAM.FLAG == 0 or BEAM.FLAG == 4 then
EgtOutLog( ' +++ Generating NC part program >>>')
local sInfo = 'EgtCAM5 - '
local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '')
if EgtGetExeVersion then
sInfo = 'EgtCAM5 ver.' .. EgtGetExeVersion() .. ' - '
sInfo = sInfo .. ' ver.' .. EgtGetExeVersion()
end
sInfo = sInfo .. ' - '
if not EgtGenerate( '', sInfo .. sNgeFile) then
BEAM.ERR = 20
local _, sName, _ = EgtSplitPath( BEAM.FILE)
@@ -631,7 +654,7 @@ local Ttot = EgtGetInfo( EgtGetCurrMachGroup(), 'Ttot', 'd')
local sTime = 'Total Time = ' .. EgtNumToString( Ttot, 1)
EgtOutLog( sTime)
-- Imposto la vista ISO 3d, se richiesto
-- Se modifica o simula, imposto la vista ISO 3d opportuna
if BEAM.FLAG == 1 or BEAM.FLAG == 2 then
local vView = { SCE_VD.ISO_NW, SCE_VD.ISO_SW, SCE_VD.ISO_NE, SCE_VD.ISO_SE}
local nV = min( max( BD.SIMUL_VIEW_DIR or 2, 1), 4)
+103
View File
@@ -0,0 +1,103 @@
REM Compilazione degli script Beam Egaltech 2022.05.09
REM Per togliere info di debug aggiungere flag -s prima del nome del file di input
REM Compilazione 32 bit
\EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLapJointNew.lua LuaLibs\ProcessLapJointNew.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua
\EgtProg\Dll32\luac53 -o 32\BatchProcess.lua BatchProcess.lua
\EgtProg\Dll32\luac53 -o 32\BatchProcessNew.lua BatchProcessNew.lua
\EgtProg\Dll32\luac53 -o 32\GetBeamData.lua GetBeamData.lua
\EgtProg\Dll32\luac53 -o 32\NestProcess.lua NestProcess.lua
\EgtProg\Dll32\luac53 -o 32\Process.lua Process.lua
\EgtProg\Dll32\luac53 -o 32\Rotate.lua Rotate.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
+44
View File
@@ -0,0 +1,44 @@
-- GetWallData.lua by Egaltech s.r.l. 2022/06/28
-- Recupero dati da file WallData.lua di macchina
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Per test
--GWD = {}
--GWD.MACHINE = 'Essetre-90480019_MW'
local sLog = 'GetBeamData : ' .. GWD.MACHINE
EgtOutLog( sLog)
-- Imposto direttorio libreria specializzata per Travi
EgtAddToPackagePath( GWD.BASEDIR .. '\\LuaLibs\\?.lua')
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi
local sMachDir = EgtGetCurrMachineDir()
if not EgtExistsFile( sMachDir .. '\\Beam\\BeamData.lua') then
GWD.ERR = 12
GWD.MSG = 'Error not configured for beam machine : ' .. GWD.MACHINE
WriteErrToLogFile( GWD.ERR, GWD.MSG)
PostErrView( GWD.ERR, GWD.MSG)
return
end
-- Elimino direttori altre macchine e imposto direttorio macchina corrente per ricerca librerie
EgtRemoveBaseMachineDirFromPackagePath()
EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua')
-- Carico i dati globali
_G.package.loaded.BeamData = nil
local BD = require( 'BeamData')
-- Assegno valori di interesse
GWD.SIMUL_VIEW_DIR = BD.SIMUL_VIEW_DIR
GWD.OVM_MID = BD.OVM_MID
-- Tutto ok
GWD.ERR = 0
EgtOutLog( ' +++ GetBeamData completed')
+617 -194
View File
File diff suppressed because it is too large Load Diff
+380 -39
View File
@@ -1,4 +1,4 @@
-- BeamLib.lua by Egaltech s.r.l. 2022/01/11
-- BeamLib.lua by Egaltech s.r.l. 2022/07/12
-- Libreria globale per Travi
-- 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.
@@ -9,6 +9,14 @@
-- 2021/07/15 Aggiunta GetFaceElevationFromPointDir.
-- 2021/09/12 Aggiustamenti in GetNearestParalOpposite e GetNearestOrthoOpposite.
-- 2022/01/11 In GetNearest*Opposite ridotto vantaggio XY rispetto a Z da 1 -> 0.9 a 1 -> 0.99.
-- 2022/04/05 Modifiche a GetNzLimDownUp per FAST.
-- 2022/05/03 Ulteriore limitazione a GetNzLimDownUp per FAST.
-- 2022/05/18 Correzioni e migliorie a PutStartNearestToEdge.
-- 2022/06/25 Rese globali le funzioni GetChainSawBlockedAxis e GetChainSawInitAngs prima in ProcessLapJpoint.
-- 2022/07/12 A GetFaceHvRefDim aggiunta possibilità di confronto e limitazione dimensioni con grezzo/pezzo (conta solo la sezione).
-- 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/09/01 Aggiunte le funzioni GetTunnelDimension, CalcCollisionSafety, SetOpenSide, precedentemente in ProcessLapJoint.
-- Tabella per definizione modulo
local BeamLib = {}
@@ -186,40 +194,42 @@ function BeamLib.PutStartOnLonger( nCrvId)
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, bDown)
function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, dMaxDist, bDown)
-- verifico che la curva sia chiusa
if not EgtCurveIsClosed( nCrvId) then return false end
-- recupero il versore normale al piano di lavoro o estrusione
local vtN = EgtCurveExtrusion( nCrvId, GDB_ID.ROOT)
-- coefficienti per riportare la distanza nel piano di lavoro
local dCoeffX = 1 / ( sqrt( 1 - vtN:getX() * vtN:getX()))
local dCoeffY = 1 / ( sqrt( 1 - vtN:getY() * vtN:getY()))
local dCoeffZ = 1 / ( sqrt( 1 - vtN:getZ() * vtN:getZ()))
local dCoeffY = 0
if abs( vtN:getY()) < 0.999 then dCoeffY= 1 / ( sqrt( 1 - vtN:getY() * vtN:getY())) end
local dCoeffZ = 0
if abs( vtN:getZ()) < 0.999 then dCoeffZ = 1 / ( sqrt( 1 - vtN:getZ() * vtN:getZ())) end
-- cerco l'estremo più vicino al box e lo imposto come inizio (se da sotto escludo Zmax e viceversa)
local dUopt = 0
local dDopt = GEO.INFINITO
local dZopt = GEO.INFINITO
local dUi, dUf = EgtCurveDomain( nCrvId)
for dU = dUi, dUf, 0.5 do
local ptP = EgtUP( nCrvId, dU, GDB_ID.ROOT)
if ptP then
local vtDp = EgtUV( nCrvId, dU, -1, GDB_ID.ROOT)
local vtDs = EgtUV( nCrvId, dU, 1, GDB_ID.ROOT)
local bTg = ( vtDp and vtDs and vtDp * vtDs > 0.96)
if ptP and bTg then
local vtMin = ptP - b3Raw:getMin()
local vtMax = ptP - b3Raw:getMax()
local dD = abs( vtMin:getX()) * dCoeffX
dD = min( abs( vtMax:getX()) * dCoeffX, dD)
dD = min( abs( vtMin:getY()) * dCoeffY, dD)
local dD = abs( vtMin:getY()) * dCoeffY
dD = min( abs( vtMax:getY()) * dCoeffY, dD)
if bDown then
dD = min( abs( vtMin:getZ()) * dCoeffZ, dD)
else
dD = min( abs( vtMax:getZ()) * dCoeffZ, dD)
end
if dD < dDopt + GEO.EPS_SMALL then
dDopt = dD
dD = min( abs( vtMin:getZ()) * dCoeffZ, dD)
dD = min( abs( vtMax:getZ()) * dCoeffZ, dD)
local dZ = abs( EgtIf( bDown, vtMin:getZ(), vtMax:getZ())) * dCoeffZ
if dD < dMaxDist and dZ < dZopt + GEO.EPS_SMALL then
dUopt = dU
dDopt = dD
dZopt = dZ
end
end
end
if abs( dUopt - dUi) > GEO.EPS_ZERO then
if abs( dUopt - dUi) > GEO.EPS_ZERO and abs( dUopt - dUf) > GEO.EPS_ZERO then
EgtChangeClosedCurveStart( nCrvId, dUopt)
end
return true
@@ -264,8 +274,8 @@ function BeamLib.GetNearestParalOpposite( vtRef, vtNorm)
vtMyRef:normalize()
end
-- se prevalente una componente orizzontale (con piccolissimo vantaggio)
if abs( vtMyRef:getX()) > 0.99 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.99 * abs( vtMyRef:getZ()) then
if abs( vtMyRef:getX()) > abs( vtMyRef:getY()) - GEO.EPS_SMALL then
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.95 * abs( vtMyRef:getZ()) then
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getY()) then
if vtMyRef:getX() > -GEO.EPS_SMALL then
return MCH_MILL_FU.PARAL_LEFT
else
@@ -298,9 +308,9 @@ function BeamLib.GetNearestOrthoOpposite( vtRef, vtNorm)
vtMyRef:normalize()
end
-- se prevalente una componente orizzontale (con piccolissimo vantaggio)
if abs( vtMyRef:getX()) > 0.99 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.99 * abs( vtMyRef:getZ()) then
-- se prevale la componente destra/sinistra (con piccolo vantaggio)
if abs( vtMyRef:getX()) > 0.9 * abs( vtMyRef:getY()) then
if abs( vtMyRef:getX()) > 0.91 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.91 * abs( vtMyRef:getZ()) then
-- se prevale la componente destra/sinistra
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getY()) then
if vtMyRef:getX() > -GEO.EPS_SMALL then
return MCH_MILL_FU.ORTHO_LEFT
else
@@ -362,17 +372,17 @@ end
---------------------------------------------------------------------
function BeamLib.GetVersRef( nOrthoOpposite)
if nOrthoOpposite == MCH_MILL_FU.ORTHO_LEFT then
if nOrthoOpposite == MCH_MILL_FU.ORTHO_LEFT or nOrthoOpposite == MCH_MILL_FU.ORTUP_LEFT or nOrthoOpposite == MCH_MILL_FU.PARAL_LEFT then
return X_AX()
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_RIGHT then
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_RIGHT or nOrthoOpposite == MCH_MILL_FU.ORTUP_RIGHT or nOrthoOpposite == MCH_MILL_FU.PARAL_RIGHT then
return -X_AX()
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_FRONT then
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_FRONT or nOrthoOpposite == MCH_MILL_FU.ORTUP_FRONT or nOrthoOpposite == MCH_MILL_FU.PARAL_FRONT then
return Y_AX()
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_BACK then
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_BACK or nOrthoOpposite == MCH_MILL_FU.ORTUP_BACK or nOrthoOpposite == MCH_MILL_FU.PARAL_BACK then
return -Y_AX()
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_DOWN then
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_DOWN or nOrthoOpposite == MCH_MILL_FU.ORTUP_DOWN or nOrthoOpposite == MCH_MILL_FU.PARAL_DOWN then
return Z_AX()
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_TOP then
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_TOP or nOrthoOpposite == MCH_MILL_FU.ORTUP_TOP or nOrthoOpposite == MCH_MILL_FU.PARAL_TOP then
return -Z_AX()
end
return nil
@@ -403,7 +413,7 @@ function BeamLib.GetBoxFaceNorm( b3Box, ptP, vtV)
local dNzDotV = vtNz * vtV
if dNxDotV > dNyDotV and dNxDotV > dNzDotV then
return vtNx
elseif dNyDotV > dNzDotV and dNyDotV > dNxDotV then
elseif dNyDotV > dNzDotV then
return vtNy
else
return vtNz
@@ -644,7 +654,7 @@ function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng)
end
---------------------------------------------------------------------
function BeamLib.GetFaceHvRefDim( nSurfId, nFacet)
function BeamLib.GetFaceHvRefDim( nSurfId, nFacet, b3Raw)
-- recupero centro e normale della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
if not ptC or not vtN then return end
@@ -655,8 +665,21 @@ function BeamLib.GetFaceHvRefDim( nSurfId, nFacet)
end
-- determino l'ingombro in questo riferimento
local b3HV = EgtSurfTmGetFacetBBoxRef( nSurfId, nFacet, GDB_BB.STANDARD, frHV)
local dDimH = b3HV:getDimX()
local dDimV = b3HV:getDimY()
-- se definito grezzo (o solido), applico eventuali limiti
if b3Raw then
local dCoeffY = abs( frHV:getVersX():getY())
if dCoeffY > GEO.EPS_SMALL then
dDimH = min( dDimH, b3Raw:getDimY() / dCoeffY)
end
local dCoeffZ = abs( frHV:getVersY():getZ())
if dCoeffZ > GEO.EPS_SMALL then
dDimV = min( dDimV, b3Raw:getDimZ() / dCoeffZ)
end
end
-- restituisco i valori calcolati
return frHV, b3HV:getDimX(), b3HV:getDimY()
return frHV, dDimH, dDimV
end
-------------------------------------------------------------------------------------------------------------
@@ -679,15 +702,53 @@ function BeamLib.UpdateTCING( nRawId, dTCI)
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.GetNzLimDownUp( b3Raw, bFromTop)
if not BD.C_SIMM then
if bFromTop then
return EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM, -0.609, -0.383)
else
return EgtIf( b3Raw:getDimZ() < 200, -0.5, -0.258)
end
else
function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho)
if BD.C_SIMM then
return -0.484
elseif BD.TURN then
return -2
else
if vtOrtho and vtOrtho:getZ() > 0.35 then
-- N_HorAng < 15° or N_HorAng > 55°
if vtN and ( abs( vtN:getY()) < 0.259 or abs( vtN:getY()) > 0.819) then
return -0.708
-- N_HorAng > 50°
elseif vtN and abs( vtN:getY()) > 0.766 then
return -0.383
else
return EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM, -0.609, -0.383)
end
else
-- N_HorAng > 60°
if vtN and ( abs( vtN:getY()) > 0.866) then
return -0.708
else
if b3Raw:getDimZ() < 120 then
return -0.708
elseif b3Raw:getDimZ() < 200 then
-- N_HorAng < 15° or N_HorAng > 55°
if vtN and ( abs( vtN:getY()) < 0.259 or abs( vtN:getY()) > 0.819) then
return -0.5
else
return -0.383
end
elseif b3Raw:getDimZ() < BD.MIN_DIM_HBEAM then
-- N_HorAng < 10°
if vtN and ( abs( vtN:getY()) < 0.174) then
return -0.5
else
return -0.24
end
else
-- N_HorAng < 10°
if vtN and ( abs( vtN:getY()) < 0.174) then
return -0.383
else
return -0.174
end
end
end
end
end
end
@@ -708,5 +769,285 @@ function BeamLib.GetPhaseType( nPhase)
return ( EgtGetInfo( EgtGetPhaseDisposition( nPhase) or GDB_ID.NULL, 'TYPE') or '')
end
---------------------------------------------------------------------
function BeamLib.GetChainSawBlockedAxis( nInd)
if BD.GetChainSawBlockedAxis then
return BD.GetChainSawBlockedAxis( nInd)
else
if nInd == 1 then
return EgtIf( BD.C_SIMM, 'A=90', 'A=90')
else
return EgtIf( BD.C_SIMM, 'A=0', 'A=0')
end
end
end
---------------------------------------------------------------------
function BeamLib.GetChainSawInitAngs( vtN, vtO, nInd)
if BD.GetChainSawInitAngs then
return BD.GetChainSawInitAngs( vtN, vtO, nInd)
else
if BD.C_SIMM then
return EgtIf( vtN:getY() > 0, 'C=180', 'C=-180')
else
if nInd == 1 then
return ''
else
return EgtIf( vtN:getY() > 0, 'C=180', 'C=-180')
end
end
end
end
---------------------------------------------------------------------
-- Trova l'Ind (0 based) della faccia meglio orientata come l'asse vtAx. Restituisce anche vtN e ptC della faccia stessa. La faccia di indice (0 based) fctExclude non viene considerata nella ricerca.
function BeamLib.FindFaceBestOrientedAsAxis( Proc, vtAx, fctExclude)
local nFaceIndMax = 0
local dMaxComp = 0
fctExclude = fctExclude or -1
for i = 1, Proc.Fct do
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT)
local dComp = abs( vtN * vtAx)
if dComp > dMaxComp and i ~= fctExclude + 1 then
nFaceIndMax = i -1
dMaxComp = dComp
end
end
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFaceIndMax, GDB_ID.ROOT)
return nFaceIndMax, ptC, vtN
end
---------------------------------------------------------------------
function BeamLib.GetTunnelDimension( Proc, nPartId)
-- sono necessarie almeno due facce
if Proc.Fct < 2 then return 0, 0, 0 end
-- recupero l'ingombro della trave
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- recupero centro e normale delle facce
local ptC = {}
local vtN = {}
for i = 1, Proc.Fct do
ptC[i], vtN[i] = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT)
end
-- calcolo l'orientamento del tunnel
local vtOrtho
local bAdj = EgtSurfTmFacetsContact( Proc.Id, 0, 1)
if bAdj then
vtOrtho = vtN[1] ^ vtN[2]
else
if Proc.Fct >= 3 then
vtOrtho = vtN[1] ^ vtN[3]
else
return 0, 0, 0
end
end
-- ottengo il boundingBox e prendo le dimensioni lungo la direzione (Z locale) che rappresenta la profondità della fessura
local frFc = Frame3d( ptC[1], vtOrtho) ;
local b3BoxLoc = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frFc)
local dDepth = b3BoxLoc:getDimZ()
-- recupero gruppo per geometria addizionale
local nAddGrpId = BeamLib.GetAddGroup( nPartId)
if not nAddGrpId then
EgtOutLog( 'Error : missing AddGroup')
return 0, 0, 0
end
-- centro del bounding box locale
local ptCen = b3BoxLoc:getCenter()
ptCen:toGlob( frFc)
-- creo superficie intermedia
local nSurfInt = EgtSurfTmPlaneInBBox( nAddGrpId, ptCen, vtOrtho, b3Solid, GDB_ID.ROOT)
if not nSurfInt then return 0, 0, 0 end
-- ritaglio la superficie con le facce della fessura
for i = 1, Proc.Fct do
EgtCutSurfTmPlane( nSurfInt, ptC[i], -vtN[i], false, GDB_ID.ROOT)
end
local frSurfInt, dDimMax, dDimMin = EgtSurfTmFacetMinAreaRectangle( nSurfInt, 0, GDB_ID.ROOT)
-- cerco la faccia con larghezza pari a dimensione massima della fessura
local nLongIdFace = 0
for i = 1, Proc.Fct do
if abs( vtN[i] * frSurfInt:getVersX()) < 0.5 then
nLongIdFace = i - 1
break
end
end
return dDimMin, dDimMax, dDepth, vtOrtho, nLongIdFace, nSurfInt
end
---------------------------------------------------------------------
function BeamLib.CalcCollisionSafety( vtDir)
local dCollSic = 10 * BD.COLL_SIC
if abs( vtDir:getX()) > 0.999 or abs( vtDir:getY()) > 0.999 or abs( vtDir:getZ()) > 0.999 then
dCollSic = 0
elseif abs( vtDir:getX()) > 0.996 or abs( vtDir:getY()) > 0.996 or abs( vtDir:getZ()) > 0.996 then
dCollSic = 1 * BD.COLL_SIC
elseif abs( vtDir:getX()) > 0.89 or abs( vtDir:getY()) > 0.89 or abs( vtDir:getZ()) > 0.89 then
dCollSic = 2.5 * BD.COLL_SIC
elseif abs( vtDir:getX()) > 0.86 or abs( vtDir:getY()) > 0.86 or abs( vtDir:getZ()) > 0.86 then
dCollSic = 4 * BD.COLL_SIC
elseif abs( vtDir:getX()) > 0.707 or abs( vtDir:getY()) > 0.707 or abs( vtDir:getZ()) > 0.707 then
dCollSic = 5.5 * BD.COLL_SIC
end
return dCollSic
end
---------------------------------------------------------------------
function BeamLib.SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId, nStartPoint)
-- fondo tra loro le curve compatibili
EgtMergeCurvesInCurveCompo( nPathInt)
local nStartIdEnt, nNumEnt = EgtCurveDomain( nPathInt)
local pLastPIni, pLastPEnd
-- faccio una copia della curva e la esplodo
if nStartIdEnt then
-- prendo i punti
for i = 1, nNumEnt do
local pPini = EgtUP( nPathInt, (i-1), GDB_RT.GLOB)
local pPend = EgtUP( nPathInt, EgtIf( i == nNumEnt, 0, i), GDB_RT.GLOB)
-- Se normale lungo la Z considero il box in X e Y
if abs(vtOrtho:getZ()) > 0.999 then
-- se corrisponde a X
if ( abs( pPini:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
-- altrimenti se corrisponde a Y
elseif ( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
end
-- altrimenti se normale lungo la Y considero il box in X e Z
elseif abs(vtOrtho:getZ()) < 0.001 and abs(vtOrtho:getY()) > 0.999 then
-- se corrisponde a X
if ( abs( pPini:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
-- altrimenti se corrisponde a Z
elseif ( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
end
-- caso che non dovrebbe mai capitare ma gestito per completezza
-- altrimenti se normale lungo la X considero il box in Y e Z
elseif abs(vtOrtho:getZ()) < 0.001 and abs(vtOrtho:getX()) > 0.999 then
-- se corrisponde a Y
if ( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
-- altrimenti se corrisponde a Z
elseif ( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
end
-- se asse Z orizzontale verifico se si avvicina piú a Y
elseif abs(vtOrtho:getZ()) < 0.001 then
if abs(vtOrtho:getY()) > 0.75 then
-- se corrisponde a Z
if ( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
end
end
-- se asse Y a 0 (fresa ne davanti ne dietro) verifico se si avvicina piú a Z+
elseif abs(vtOrtho:getY()) < 0.001 then
if abs(vtOrtho:getZ()) > 0.75 then
-- se corrisponde a Y
if ( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
end
end
end
end
-- se devo cambiare il punto di partenza
if nStartPoint then
if pLastPIni and pLastPEnd then
-- calcolo il punto medio con gli ultimi punti utilizzati
local ptPs = ( pLastPIni + pLastPEnd) / 2
EgtChangeClosedCurveStartPoint( nPathInt, ptPs, GDB_RT.GLOB)
-- se devo eliminare la parte open
if nStartPoint == 2 then
EgtRemoveCurveCompoCurve( nPathInt, true)
EgtRemoveCurveCompoCurve( nPathInt, false)
return true
end
end
end
end
return false
end
-------------------------------------------------------------------------------------------------------------
return BeamLib
+17 -4
View File
@@ -1,4 +1,4 @@
-- DiceCut.lua by Egaltech s.r.l. 2021/09/10
-- DiceCut.lua by Egaltech s.r.l. 2022/02/18
-- Gestione dei piano paralleli nei tagli lunghi: equidistanziamento dei piani paralleli
-- Tabella per definizione modulo
@@ -377,12 +377,13 @@ end
-- ptCBond*: il punto centrale della superfice limitante (se non esistono altre superfici può essere omesso)
-- vtNBond*: il versore normale della superfice limitante (se non esistono altre superfici può essere omesso)
-- dOrthoMaxDim : massima profondità taglio se faccia singola perpendicolare facce laterali trave
-- dCustMaxDimDice: dimensione massima customizzata, sostituisce il parametro BD.MAX_DIM_DICE
-- dCustMaxDimDice: dimensione massima customizzata, sostituisce il parametro BD.MAX_DIM_DICE (se negativa qualunque, se positiva deve stare nel MAX)
-- bDownHead : taglio con testa da sotto
----------------------------------------------------------------------------------------------------------------------------------------------------
function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPlanes, ptCBond, vtNBond, dOrthoMaxDim, dCustMaxDimDice, bDownHead)
local dMaxDimDice = EgtIf( dCustMaxDimDice and dCustMaxDimDice < BD.MAX_DIM_DICE, dCustMaxDimDice, BD.MAX_DIM_DICE)
local dMaxDimDice = BD.MAX_DIM_DICE
if dCustMaxDimDice and dCustMaxDimDice < BD.MAX_DIM_DICE then dMaxDimDice = abs( dCustMaxDimDice) end
local dTolerance = 0 -- distanza di sicurezza per i tagli ortogonali
local OffsetP = dMaxDimDice -- distanza tra i piani paralleli
local StepP = 100 -- numero massimo di piani paralleli da generare
@@ -474,7 +475,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
if vtNInner:getZ() > -0.0175 or vtNInner:getZ() < dNzLimDwnUp or abs( vtNInner:getY()) > 0.8 then
vtO:rotate( vtNInner, 90)
-- se diretto troppo ortogonalmente all'asse trave e taglio non da sotto, lo ruoto ulteriormente
if abs( vtO:getY()) > 3 * abs( vtO:getX()) and vtNInner:getZ() > dNzLimDwnUp then
if ( abs( vtO:getY()) > 3 * abs( vtO:getX()) or BBoxRawPart:getDimZ() > 620) and vtNInner:getZ() > dNzLimDwnUp then
vtO:rotate( vtNInner, 90)
-- se faccia principale verso il basso (almeno -3deg), lo inverto per iniziare da sopra
if vtNInner:getZ() < -0.05 then
@@ -496,6 +497,12 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
if bDownHead and vtO:getZ() > 0.05 then
vtO = -vtO
end
-- per macchina TURN
if BD.TURN then
if vtO:getY() > 0.707 then
vtO = -vtO
end
end
-- calcolo le dimensioni dell'offset e dove posizionare la prima faccia:
-- CopyPlane: 0 => crea la prima faccia direttamente sul punto passato
-- CopyPlane: 1 => crea la prima faccia e tutte le altre con l'offset passato
@@ -550,6 +557,12 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
-- Se esiste la superficie limitante (nFacet == 2) verifica se il taglio più esterno è superfluo e quindi viene eliminato
if not bGetOrtoPlanes then
VerifyFirstOrthoCut( UltimateTable, originalOffsetP, BBoxRawPart, dNzLimDwnUp)
-- se rimangono due sole facce, devono coincidere con le originali e quindi sono superflue
if #UltimateTable == 2 and #UltimateTable[1] == 1 and #UltimateTable[2] == 1 then
EgtErase( UltimateTable[1][1])
EgtErase( UltimateTable[2][1])
UltimateTable = {}
end
end
return UltimateTable
+101
View File
@@ -0,0 +1,101 @@
-- FaceByPocket.lua by Egaltech s.r.l. 2022/05/82
-- Gestione svuotatura di feature con una faccia
-- Tabella per definizione modulo
local FaceByPocket = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
EgtOutLog( ' FaceByPocket started', 1)
-- Dati
local BD = require( 'BeamData')
local ML = require( 'MachiningLib')
---------------------------------------------------------------------
local function ApplyPocket( Proc, nSurfId, nFacet, sPocketing, nInd, dMaxElev, vtN)
-- inserisco la lavorazione di svuotatura
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. nInd
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nSurfId, nFacet}})
-- imposto uso faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
if dMaxElev > 0.1 then
-- imposto elevazione
local sNotes = 'MaxElev=' .. EgtNumToString( dMaxElev, 2) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
end
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM and not BD.TURN then
nSCC = EgtIf( vtN:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
return true
end
---------------------------------------------------------------------
function FaceByPocket.Make( Proc, nSurfId, nFacet, sPocketing, nPartId, b3Solid)
local bOk = true
local sErr
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dStep = 30
local dMaxDepth = 100
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
dStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or dStep
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- dati della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
local dElev = BL.GetFaceElevation( nSurfId, nFacet, nPartId)
-- determino numero e valore degli step di lavorazione
local nSurfStep = ceil( dElev / dMaxDepth)
local dSurfStep = dElev / nSurfStep
-- copio superfice al passo superfice e vi applico la lavorazione
for i = nSurfStep, 2, -1 do
local ptOn = ptC + ( dSurfStep * ( i - 1)) * vtN
local nAddIdTmp = EgtSurfTmPlaneInBBox( nAddGrpId, ptOn, vtN, b3Solid, GDB_RT.GLOB)
if nAddIdTmp then
EgtSetName( nAddIdTmp, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( nAddIdTmp, 'TASKID', Proc.TaskId)
-- aggiungo lavorazione
bOk, sErr = ApplyPocket( Proc, nAddIdTmp, 0, sPocketing, i, dSurfStep, vtN)
if not bOk then
return false, sErr
end
end
end
-- faccio ultima superfice
bOk, sErr = ApplyPocket( Proc, nSurfId, nFacet, sPocketing, 1, EgtIf( nSurfStep > 1, dSurfStep, 0), vtN)
if not bOk then
return false, sErr
end
return true
end
return FaceByPocket
+204 -98
View File
@@ -1,4 +1,4 @@
-- FacesBySaw.lua by Egaltech s.r.l. 2021/11/26
-- FacesBySaw.lua by Egaltech s.r.l. 2022/09/24
-- Gestione taglio con lama di feature con una o due facce
-- 2021/01/06 Cambiato limite per attacco Tg con lama e CalcLeadInOutGeom rinominata in CalcLeadInOutPerpGeom.
-- 2021/02/03 In taglio lama si accettano anche due lati con deviazione minore di 20deg.
@@ -10,6 +10,9 @@
-- 2021/08/03 In MakeOneFaceBySaw mgliorata gestione tagli con normale verso il basso e da sopra.
-- 2021/08/31 DS Aggiunta gestione nessun limite direzione da sotto per testa da sotto.
-- 2021/11/26 DS Spostate qui MakeOneFaceBySaw (ora MakeOne), CalcLeadInOutPerpGeom e CalcLeadInOutTangGeom.
-- 2022/04/12 DS Aggiunta gestione speciale cubetti con fresa da sotto.
-- 2022/06/29 DS In MakeTwo modificato controllo facce dirette verso il basso.
-- 2022/09/08 In MakeOne aggiunto argomento bForceInvert per poter forzare l'inversione del percorso.
-- Tabella per definizione modulo
local FacesBySaw = {}
@@ -26,7 +29,7 @@ local BD = require( 'BeamData')
local ML = require( 'MachiningLib')
---------------------------------------------------------------------
function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw)
function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert)
-- dati della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
-- risolvo parametro ambiguo
@@ -39,6 +42,8 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
nOrthoOpposite = Par5
vtOrthO = BL.GetVersRef( Par5)
end
-- verifico se testa da sotto
local bDownHead = ( dVzLimDwnUp and dVzLimDwnUp < - 1.5)
-- linea o bilinea di lavorazione (qui uso nOrthoOpposite per ripetere esattamente il calcolo del Mach)
local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, BL.GetVersRef( nOrthoOpposite), GDB_ID.ROOT)
if not dLen or dLen < 1.1 or not dWidth or dWidth < 1.1 then
@@ -47,7 +52,10 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
return true, ''
end
vtV1 = - vtV1
local bInvert = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL)
local bInvert = bForceInvert
if bInvert == nil then
bInvert = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL)
end
if bInvert then
ptP1, ptP2 = ptP2, ptP1
vtV1, vtV2 = vtV2, vtV1
@@ -83,8 +91,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
end
end
-- verifico se lavorazione con lama sotto e testa sopra
local bFromTop = ( nOrthoOpposite == MCH_MILL_FU.ORTHO_DOWN)
if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, bFromTop) end
if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN, vtOrthO) end
local bDownUp = ( vtN:getZ() < dVzLimDwnUp)
local nFaceUse = nOrthoOpposite
if bDownUp then nFaceUse = BL.GetOrtupOpposite( nOrthoOpposite) end
@@ -119,7 +126,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
local ptP1act = ptP1 + vtN * dCutOffset
local ptP2act = ptP2 + vtN * dCutOffset
-- attacco perpendicolare
local dLiTang, dLiPerp, dLoTang, dLoPerp = FacesBySaw.CalcLeadInOutPerpGeom( ptP1act, ptP2act, vtV1, vtV2, vtN, dSawDiam/2, vtRef, dCutExtra, b3Box)
local dLiTang, dLiPerp, dLoTang, dLoPerp, vtLio = FacesBySaw.CalcLeadInOutPerpGeom( ptP1act, ptP2act, vtV1, vtV2, vtN, dSawDiam/2, vtRef, dCutExtra, b3Box)
local dLenLi = sqrt( dLiTang * dLiTang + dLiPerp * dLiPerp)
local dLenLo = sqrt( dLoTang * dLoTang + dLoPerp * dLoPerp)
-- attacco tangente
@@ -127,30 +134,54 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
local dLenLi2 = abs( dLi2Tang)
local dLenLo2 = abs( dLo2Tang)
-- scelgo l'attacco più conveniente (se non taglio praticamente longitudinale)
local bTurnTang
local Ktp = 1.1
if BD.KIOTP then Ktp = BD.KIOTP end
if ( not bDownUp or abs( vtTg:getY()) > 0.5) and abs( vtTg:getX()) < 0.9848 and
( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5)) or
if ( not bDownUp or abs( vtTg:getY()) > 0.5) and
( not bDownHead or abs( vtTg:getZ()) < 0.51) and
abs( vtTg:getX()) < 0.9848 and
( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5) and not bDownHead) or
( abs( vtTg:getZ()) < 0.51 and b3Box:getDimZ() > 300 and BD.C_SIMM and BD.MAX_HEIGHT > 450) or
( Ktp * dLenLi2 < dLenLi and Ktp * dLenLo2 < dLenLo) or Ktp * ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) then
dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp
if BD.TURN then
bTurnTang = true
dLoTang = -( dLiTang + dAllStart - dAccStart + dAllEnd - dAccEnd + dLen)
dLoPerp = BD.COLL_SIC
end
end
-- posizione braccio
EgtOutLog( 'vtN=' .. tostring( vtN) .. ' vtRef=' .. tostring( vtRef) .. ' vtOut=' .. tostring( vtOut) .. ' vtAux=' .. tostring( vtAux), 3)
local nSCC = MCH_SCC.NONE
--if not BD.C_SIMM or vtRef:getZ() < 0.866 or abs( vtTg:getZ()) > 0.02 then
if not BD.TURN then
if abs( vtAux:getX()) > abs( vtAux:getY()) - GEO.EPS_SMALL then
nSCC = EgtIf( ( vtAux:getX() > -GEO.EPS_SMALL), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
else
nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
end
--end
-- per macchine PF se possibile preferisco tenere la testa più davanti
--if BD.C_SIMM and abs( vtTg:getZ()) < 0.01 and abs( vtTg:getX()) < 0.5 then
-- if nSCC == MCH_SCC.ADIR_YP then
-- nSCC = MCH_SCC.ADIR_YM
-- end
--end
else
if bTurnTang then
local vtTest = EgtIf( bInvert, vtTg, -vtTg)
if abs( vtTest:getY()) > abs( vtTest:getZ()) then
nSCC = EgtIf( vtTest:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else
nSCC = EgtIf( vtTest:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
end
else
local vtTest = vtOut -- vtLio
if abs( vtN:getY()) < 0.174 and abs( vtN:getZ()) < 0.174 then
if abs( vtTest:getY()) > abs( vtTest:getZ()) then
nSCC = EgtIf( vtTest:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else
nSCC = EgtIf( vtTest:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
end
elseif abs( vtN:getZ()) < 0.174 then
nSCC = EgtIf( vtTest:getZ() > -0.017, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
else
nSCC = EgtIf( vtTest:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
end
end
end
-- inserisco la lavorazione di taglio
local sName = 'Cut_' .. ( EgtGetName( nSurfId) or tostring( nSurfId)) .. '_' .. tostring( nFacet + 1)
local nMchFId = EgtAddMachining( sName, sCutting)
@@ -176,6 +207,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
-- imposto attacco/uscita
EgtSetMachiningParam( MCH_MP.LITANG, dLiTang)
EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp)
if bTurnTang then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end
EgtSetMachiningParam( MCH_MP.LOTANG, dLoTang)
EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp)
-- imposto allungamenti iniziale e finale
@@ -184,7 +216,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
-- eventuali note
if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -217,15 +249,6 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
local vtN = {}
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
-- verifico non siano orientate verso il basso
local bFaceOk = {}
bFaceOk[1] = ( vtN[1]:getZ() >= BD.NZ_MINB)
bFaceOk[2] = ( vtN[2]:getZ() >= BD.NZ_MINB)
if not bDownHead and not bFaceOk[1] and not bFaceOk[2] then
local sErr = 'Error : TwoFacesBySaw from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- recupero dati su giunzione tra facce
local bTouch, ptT1, ptT2, dAngT = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
if not bTouch then
@@ -233,44 +256,64 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
EgtOutLog( sErr)
return false, sErr
end
local ptM = ( ptT1 + ptT2) / 2
local vtTg = ptT2 - ptT1 ;
local bConvex = ( dAngT > 0)
-- verifico non siano orientate troppo verso il basso e molto sbandate (oltre 10 deg)
local bFaceOk = {}
bFaceOk[1] = ( vtN[1]:getZ() >= BD.NZ_MINB or abs( vtN[1]:getY()) < 0.174)
bFaceOk[2] = ( vtN[2]:getZ() >= BD.NZ_MINB or abs( vtN[2]:getY()) < 0.174)
if not bDownHead and not bFaceOk[1] and not bFaceOk[2] then
local sErr = 'Error : TwoFacesBySaw from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- calcolo direzione di lavoro
local vtRef = {}
local vtTg = ptT2 - ptT1 ;
vtRef[1] = vtN[1] ^ vtTg
if vtRef[1] * vtN[2] < 0 then vtRef[1] = - vtRef[1] end
vtRef[1]:normalize()
if abs( vtRef[1]:getZ()) < 0.577 and abs( abs( vtRef[1]:getX()) - abs( vtRef[1]:getY())) < 0.1 then
vtRef[1] = ptC[1] - ptM
vtRef[1]:normalize()
end
vtRef[2] = vtN[2] ^ vtTg
if vtRef[2] * vtN[1] < 0 then vtRef[2] = - vtRef[2] end
vtRef[2]:normalize()
if abs( vtRef[2]:getZ()) < 0.577 and abs( abs( vtRef[2]:getX()) - abs( vtRef[2]:getY())) < 0.1 then
vtRef[2] = ptC[2] - ptM
vtRef[2]:normalize()
end
-- determino quale faccia è più grande
local ptPs = ( ptT1 + ptT2) / 2
local dSqDim1 = ( ptC[1] - ptPs):sqlen()
local dSqDim2 = ( ptC[2] - ptPs):sqlen()
local dSqDim1 = ( ptC[1] - ptM):sqlen()
local dSqDim2 = ( ptC[2] - ptM):sqlen()
local nBigInd = EgtIf( dSqDim1 > dSqDim2 - 1., 1, 2)
local nSmaInd = 3 - nBigInd
local nUpInd = EgtIf( vtN[1]:getZ() > vtN[2]:getZ() - GEO.EPS_SMALL, 1, 2)
local nOtInd = 3 - nUpInd
-- metto in relazione la scelta facce con il confronto del versore Z con la scelta in base alla grandezza faccia
-- se la faccia più grande è messa secondaria e il suo versore Z non è negativo
if nOtInd == nBigInd and vtN[nBigInd]:getZ() > -5 * GEO.EPS_SMALL and vtN[nSmaInd]:getZ() < 0.866 then
nOtInd = nSmaInd
-- se la faccia più grande è messa secondaria e il suo versore Z non è troppo negativo
if nOtInd == nBigInd and vtN[nBigInd]:getZ() > -0.5 and vtN[nSmaInd]:getZ() < 0.966 then
nUpInd = nBigInd
nOtInd = nSmaInd
end
-- recupero la lavorazione
local sCutting = ML.FindCutting( sCutType)
local sCutting = ML.FindCutting( sCutType, nil, bDownHead)
if not sCutting then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dSawDiam = 400
local dSawThick = 5
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- calcolo extra taglio
@@ -283,45 +326,113 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
if bDownHead then
dNzLimDwnUp = - 2
end
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- verifico se necessari tagli supplementari
local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nUpInd], vtN[nUpInd], false, ptC[nOtInd], vtN[nOtInd])
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nUpInd], vtN[nUpInd], false, ptC[nOtInd], vtN[nOtInd])
--DC.PrintOrderCut( vCuts)
if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome
-- sistemo posizione nel DB, nome e info
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
end
-- eseguo
for i = 1, #vCuts do
-- assegno il modo di tagliare
local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nOtInd], vtRef[nUpInd])
-- lavoro la faccia
for j = 1, #vCuts[i] do
-- se FAST, pezzo alto e ultimo taglio verticale -> allungo uscita per consentire eventuale rotazione B sul posto
local dAccEnd = 0
if not BD.C_SIMM and BD.MAX_HEIGHT_ROT_B_ABOVE and b3Raw:getDimZ() > BD.MAX_HEIGHT_ROT_B_ABOVE and vtOrthO:getZ() > 0.866 and j == #vCuts[i] then
dAccEnd = - ( dSawDiam / 2 + BD.CUT_SIC)
-- con testa da sopra
if not bDownHead or BD.TURN then
-- eseguo
for i = 1, #vCuts do
-- assegno il modo di tagliare
local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nOtInd], vtRef[nUpInd])
-- lavoro la faccia
for j = 1, #vCuts[i] do
-- se FAST, pezzo alto e ultimo taglio verticale -> allungo uscita per consentire eventuale rotazione B sul posto
local dAccEnd = 0
if not BD.C_SIMM and BD.MAX_HEIGHT_ROT_B_ABOVE and b3Raw:getDimZ() > BD.MAX_HEIGHT_ROT_B_ABOVE and vtOrthO:getZ() > 0.866 and j == #vCuts[i] then
dAccEnd = - ( dSawDiam / 2 + BD.CUT_SIC)
end
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, dNzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, dAccEnd, nil, b3Raw)
if not bOk then
return bOk, sErr
end
end
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, dNzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, dAccEnd, nil, b3Raw)
if not bOk then
return bOk, sErr
end
-- altrimenti con testa da sotto
else
-- eseguo (facendo di seguito i due tagli di ogni singolo cubetto)
for i = 1, #vCuts, 2 do
-- determino il modo di tagliare dei perpendicolari
local vtOrthoO_1 = Vector3d( vtN[nUpInd])
-- determino il modo di tagliare dei paralleli
local vtOrthoO_2
local bNoPerpCuts_2 = false
local vtO
if #vCuts[i] > 0 then
vtO = EgtSurfTmFacetNormVersor( vCuts[i][1], 0, GDB_ID.ROOT)
elseif vCuts[i+2] and #vCuts[i+2] > 0 then
-- lunghezza faccia nell'eventuale direzione ortogonale
local asseX = EgtSurfTmFacetNormVersor( vCuts[i+2][1], 0, GDB_ID.ROOT)
local asseY = asseX ^ vtN[nUpInd]
local Frame = Frame3d( ptC, ptC + asseX, ptC + asseY)
local b3Fac = EgtGetBBoxRef( vCuts[i+1][1], GDB_BB.STANDARD, Frame)
-- se lunghezza inferiore al limite, accetto la direzione
if b3Fac:getDimX() < dMaxDepth - BD.CUT_EXTRA then
vtO = asseX
else
bNoPerpCuts_2 = true
end
else
bNoPerpCuts_2 = true
end
if vtO then
vtOrthoO_2 = Vector3d( vtO)
else
if bHorizCut then
vtOrthoO_2 = -Z_AX()
elseif vtN:getY() > -0.02 then
if not Proc.Head then
vtOrthoO_2 = -Y_AX()
else
vtOrthoO_2 = Y_AX()
end
else
vtOrthoO_2 = -Y_AX()
end
end
-- lavoro le coppie di facce del singolo cubetto
for j = 1, max( #vCuts[i], #vCuts[i+1]) do
-- extra taglio per perpendicolari
local dExtraCut_1 = -0.1
-- extra taglio per paralleli
local dExtraCut_2 = -0.1
-- se non ci sono tagli ortogonali devo affondare
if bNoPerpCuts_2 then
dExtraCut_2 = BD.CUT_EXTRA
end
-- taglio perpendicolare (limite Vz Down Up messo a -2 per non farlo mai intervenire)
if vCuts[i][j] then
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO_1, -2, dExtraCut_1, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
end
-- taglio parallelo (limite Vz Down Up messo a -2 per non farlo mai intervenire)
if vCuts[i+1][j] then
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i+1][j], 0, sCutting, dSawDiam, vtOrthoO_2, -2, dExtraCut_2, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
end
end
end
end
else
nUpInd = EgtIf( vtN[1]:getZ() > vtN[2]:getZ() - GEO.EPS_SMALL, 1, 2)
nOtInd = 3 - nUpInd
-- se prima faccia lavorata è da sotto scambio le facce
if vtN[nOtInd]:getZ() < -0.5 then
nUpInd, nOtInd = nOtInd, nUpInd
@@ -368,29 +479,24 @@ function FacesBySaw.CalcLeadInOutPerpGeom( ptP1, ptP2, vtV1, vtV2, vtN, dRad, vt
local vtX = vtTg ^ vtN
local frFace = Frame3d( ptP1, vtX, vtTg, vtN)
EgtOutLog( 'Vref=' .. tostring( vtRef) .. ' V1=' .. tostring( vtV1) .. ' V2=' .. tostring( vtV2), 3)
-- Versori di attacco e uscita
-- Versore di attacco e uscita
local dCos1 = vtV1 * vtRef
local dCos2 = vtV2 * vtRef
local vtLi, vtLo
local vtLio
if abs( dCos1 - dCos2) < 0.001 then
if abs( vtV1:getZ()) < abs( vtV2:getZ()) then
vtLi = vtV1
vtLo = vtV1
vtLio = vtV1
else
vtLi = vtV2
vtLo = vtV2
vtLio = vtV2
end
elseif dCos1 > dCos2 then
vtLi = vtV1
vtLo = vtV1
vtLio = vtV1
else
vtLi = vtV2
vtLo = vtV2
vtLio = vtV2
end
local bRight = ( vtX * vtLi > 0)
-- Versori di attacco e uscita nel riferimento intrinseco al taglio
local vtLiL = Vector3d( vtLi) ; vtLiL:toLoc( frFace)
local vtLoL = Vector3d( vtLo) ; vtLoL:toLoc( frFace)
local bRight = ( vtX * vtLio > 0)
-- Versore di attacco e uscita nel riferimento intrinseco al taglio
local vtLioL = Vector3d( vtLio) ; vtLioL:toLoc( frFace)
-- Spostamento punti per effetto dell'extra o della deficienza di taglio
ptP1 = ptP1 + vtX * ( EgtIf( bRight, - dCutExtra, dCutExtra))
ptP2 = ptP2 + vtX * ( EgtIf( bRight, - dCutExtra, dCutExtra))
@@ -400,30 +506,30 @@ function FacesBySaw.CalcLeadInOutPerpGeom( ptP1, ptP2, vtV1, vtV2, vtN, dRad, vt
-- Attacco
local dLiTang = 10000
local dLiPerp = 10000
local bLiOk, _, vLiPar = EgtLineBoxInters( ptP1, vtLi, b3MyBox)
local bLiOk, _, vLiPar = EgtLineBoxInters( ptP1, vtLio, b3MyBox)
if bLiOk and #vLiPar > 0 then
-- con la prima faccia di uscita
local dLen = vLiPar[#vLiPar]
local ptInt = ptP1 + vtLi * dLen
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtLi)
local ptInt = ptP1 + vtLio * dLen
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtLio)
EgtOutLog( 'LiFaceNorm=' .. tostring( vtFN), 3)
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - abs( vtX * vtFN)) / ( vtLi * vtFN)
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - abs( vtX * vtFN)) / ( vtLio * vtFN)
local dLiLen = dLen + dAddLen
EgtOutLog( 'LeadIn Dist=' .. EgtNumToString( dLiLen), 3)
dLiTang = - dLiLen * vtLiL:getY()
dLiPerp = EgtIf( bRight, dLiLen, - dLiLen) * vtLiL:getX()
dLiTang = - dLiLen * vtLioL:getY()
dLiPerp = EgtIf( bRight, dLiLen, - dLiLen) * vtLioL:getX()
-- verifico se miglioro calcolando con faccia successiva
local b3Mod = BBox3d( b3MyBox) ; b3Mod:Add( ptInt + 1000 * vtFN)
local bLiOk2, _, vLiPar2 = EgtLineBoxInters( ptP1, vtLi, b3Mod)
local bLiOk2, _, vLiPar2 = EgtLineBoxInters( ptP1, vtLio, b3Mod)
if bLiOk2 and #vLiPar2 > 0 then
local dLen2 = vLiPar2[#vLiPar2]
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP1 + vtLi * dLen2, vtLi)
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP1 + vtLio * dLen2, vtLio)
EgtOutLog( 'LiFaceNorm2=' .. tostring( vtFN2), 3)
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - abs( vtX * vtFN2)) / ( vtLi * vtFN2)
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - abs( vtX * vtFN2)) / ( vtLio * vtFN2)
local dLiLen2 = dLen2 + dAddLen2
EgtOutLog( 'LeadIn Dist2=' .. EgtNumToString( dLiLen2), 3)
local dLiTang2 = - dLiLen2 * vtLiL:getY()
local dLiPerp2 = EgtIf( bRight, dLiLen2, - dLiLen2) * vtLiL:getX()
local dLiTang2 = - dLiLen2 * vtLioL:getY()
local dLiPerp2 = EgtIf( bRight, dLiLen2, - dLiLen2) * vtLioL:getX()
if dLiLen2 < dLiLen then
dLiTang = dLiTang2
dLiPerp = dLiPerp2
@@ -433,37 +539,37 @@ function FacesBySaw.CalcLeadInOutPerpGeom( ptP1, ptP2, vtV1, vtV2, vtN, dRad, vt
-- Lunghezza di uscita
local dLoTang = 10000
local dLoPerp = 10000
local bLoOk, _, vLoPar = EgtLineBoxInters( ptP2, vtLo, b3MyBox)
local bLoOk, _, vLoPar = EgtLineBoxInters( ptP2, vtLio, b3MyBox)
if bLoOk and #vLoPar > 0 then
-- con la prima faccia di uscita
local dLen = vLoPar[#vLoPar]
local ptInt = ptP2 + vtLo * dLen
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtLo)
local ptInt = ptP2 + vtLio * dLen
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtLio)
EgtOutLog( 'LoFaceNorm=' .. tostring( vtFN), 3)
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - abs( vtX * vtFN)) / ( vtLo * vtFN)
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - abs( vtX * vtFN)) / ( vtLio * vtFN)
local dLoLen = dLen + dAddLen
EgtOutLog( 'LeadOut Dist=' .. EgtNumToString( dLoLen), 3)
dLoTang = dLoLen * vtLoL:getY()
dLoPerp = EgtIf( bRight, dLoLen, - dLoLen) * vtLoL:getX()
dLoTang = dLoLen * vtLioL:getY()
dLoPerp = EgtIf( bRight, dLoLen, - dLoLen) * vtLioL:getX()
-- verifico se miglioro calcolando con faccia successiva
local b3Mod = BBox3d( b3MyBox) ; b3Mod:Add( ptInt + 1000 * vtFN)
local bLoOk2, _, vLoPar2 = EgtLineBoxInters( ptP2, vtLo, b3Mod)
local bLoOk2, _, vLoPar2 = EgtLineBoxInters( ptP2, vtLio, b3Mod)
if bLoOk2 and #vLoPar2 > 0 then
local dLen2 = vLoPar2[#vLoPar2]
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP2 + vtLo * dLen2, vtLo)
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP2 + vtLio * dLen2, vtLio)
EgtOutLog( 'LoFaceNorm2=' .. tostring( vtFN2), 3)
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - abs( vtX * vtFN2)) / ( vtLo * vtFN2)
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - abs( vtX * vtFN2)) / ( vtLio * vtFN2)
local dLoLen2 = dLen2 + dAddLen2
EgtOutLog( 'LeadOut Dist2=' .. EgtNumToString( dLoLen2), 3)
local dLoTang2 = dLoLen2 * vtLoL:getY()
local dLoPerp2 = EgtIf( bRight, dLoLen2, - dLoLen2) * vtLoL:getX()
local dLoTang2 = dLoLen2 * vtLioL:getY()
local dLoPerp2 = EgtIf( bRight, dLoLen2, - dLoLen2) * vtLioL:getX()
if dLoLen2 < dLoLen then
dLoTang = dLoTang2
dLoPerp = dLoPerp2
end
end
end
return dLiTang, dLiPerp, dLoTang, dLoPerp
return dLiTang, dLiPerp, dLoTang, dLoPerp, vtLio
end
---------------------------------------------------------------------
@@ -543,4 +649,4 @@ function FacesBySaw.CalcLeadInOutTangGeom( ptP1, ptP2, vtN, dRad, vtRef, dCutExt
return dLiTang, dLiPerp, dLoTang, dLoPerp
end
return FacesBySaw
return FacesBySaw
+361 -82
View File
@@ -1,5 +1,8 @@
-- MachiningLib.lua by Egaltech s.r.l. 2021/04/14
-- MachiningLib.lua by Egaltech s.r.l. 2022/05/07
-- Libreria ricerca lavorazioni per Travi
-- 2022/05/07 ES Profonde modifiche per scelta ottimale lavorazioni in macchine con più teste.
-- 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.
-- Tabella per definizione modulo
local MachiningLib = {}
@@ -17,6 +20,83 @@ local Pocketings = require( 'PocketingData')
local Sawings = require( 'SawingData')
local Drillings = require( 'DrillData')
-- tipo di teste macchina
local ONE_HEAD = 1 -- una testa (Fast, One, Turn1T)
local TWO_EQUAL_HEADS = 2 -- due teste uguali (PF, Turn)
local TWO_UP_DOWN_HEADS = 3 -- due teste una sopra l'altra sotto (PF1250)
local MachineHeadType = 0
-- testa correntementa attiva, e utensili correnti per ogni testa
local nActiveHead = 0
local H1_TOOL = ''
local H2_TOOL = ''
-- testa e utensile della lavorazione restituita ma non ancora confermata
local nNextMachHead = 0
local H1_NEXT_TOOL = ''
local H2_NEXT_TOOL = ''
-- teste con utensili fissi
local vFixedHeads = {}
---------------------------------------------------------------------
-- funzione che imposta il tipo di macchina corrente
local function SetCurrMachineHeadType()
-- se già inizializzato, esco
if MachineHeadType and MachineHeadType >= 1 and MachineHeadType <= 3 then return end
-- altrimenti, lo imposto
if BD.DOWN_HEAD then
MachineHeadType = TWO_UP_DOWN_HEADS
elseif BD.TWO_EQUAL_HEADS then
MachineHeadType = TWO_EQUAL_HEADS
else
MachineHeadType = ONE_HEAD
end
-- imposto eventuali teste con utensili fissi
if BD.C_SIMM then
vFixedHeads = { [31] = true}
elseif BD.TURN then
vFixedHeads = { [12] = true, [22] = true}
else -- FAST
vFixedHeads = { [2] = true}
end
end
---------------------------------------------------------------------
-- funzione che conferma e rende attivi testa e utensile ipotizzati
local function ConfirmNextMachining()
-- se non definita testa successiva, esco
if not nNextMachHead or nNextMachHead < 1 or nNextMachHead > 2 then return end
-- altrimenti, la confermo come attiva
nActiveHead = nNextMachHead
if nNextMachHead == 1 then
H1_TOOL = H1_NEXT_TOOL
elseif nNextMachHead == 2 then
H2_TOOL = H2_NEXT_TOOL
end
-- reset prossima testa
nNextMachHead = 0
H1_NEXT_TOOL = ''
H2_NEXT_TOOL = ''
end
---------------------------------------------------------------------
-- funzione che traccia testa e utensile ipotizzati
local function SetNextMachining( sToolName, nHead, bFixed)
if nHead < 1 or nHead > 2 then return end
if bFixed then
nNextMachHead = 0
H1_NEXT_TOOL = ''
H2_NEXT_TOOL = ''
end
nNextMachHead = nHead
if nHead == 1 then
H1_NEXT_TOOL = sToolName
elseif nHead == 2 then
H2_NEXT_TOOL = sToolName
end
end
---------------------------------------------------------------------
local function SetCurrMachiningAndTool( sMachName)
if not EgtMdbSetCurrMachining( sMachName) then return false end
@@ -24,106 +104,305 @@ local function SetCurrMachiningAndTool( sMachName)
local sTool = EgtTdbGetToolFromUUID( sTuuid)
if not sTool then return false end
if not EgtTdbSetCurrTool( sTool) then return false end
return EgtTdbGetCurrToolParam( MCH_TP.ACTIVE)
local bActive = EgtTdbGetCurrToolParam( MCH_TP.ACTIVE)
local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
local nHead = tonumber( sHead:sub( 2, #sHead))
local bH2 = ( nHead >= 21 and nHead <= 29)
local bFixed = ( vFixedHeads[nHead])
return bActive, sTool, bH2, bFixed
end
---------------------------------------------------------------------
function MachiningLib.FindCutting( sType)
for i = 1, #Cuttings do
local Cutting = Cuttings[i]
if Cutting.On and Cutting.Type == sType and SetCurrMachiningAndTool( Cutting.Name) then
return Cutting.Name
end
function VerifyDrill( dDiam, dDepth, bH2)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dDiamTh = EgtTdbGetCurrToolThDiam()
local dLenTh = 72
if EgtTdbGetCurrToolThLength then dLenTh = EgtTdbGetCurrToolThLength() end
local dFreeLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) - dLenTh - EgtMdbGetGeneralParam( MCH_GP.MAXDEPTHSAFE)
if dTDiam < dDiam + 10 * GEO.EPS_SMALL and
dTDiam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL and
( not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL) then
return true, { TMaxMat = dTMaxMat, MaxToolLength = dMaxToolLength, ToolDiam = dToolDiam, DiamTh = dDiamTh, FreeLen = dFreeLen, H2 = bH2}
end
end
---------------------------------------------------------------------
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen)
for i = 1, #Millings do
local Milling = Millings[i]
if Milling.On and Milling.Type == sType and SetCurrMachiningAndTool( Milling.Name) then
local sTuuid = EgtGetMachiningParam( MCH_MP.TUUID)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
if ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
( not sTuuidMstr or sTuuidMstr == sTuuid) and
( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then
return Milling.Name, dTMaxDepth, dTDiam
function VerifyDrillPocket( dDiam, dDepth, bH2)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dDiamTh = EgtTdbGetCurrToolThDiam()
local dFreeLen = dTMaxDepth
if dTDiam < dDiam - 10 * GEO.EPS_SMALL and
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) then
return true, { TMaxDepth = dTMaxDepth, MaxToolLength = dMaxToolLength, ToolDiam = dToolDiam, DiamTh = dDiamTh, FreeLen = dFreeLen, H2 = bH2}
end
end
---------------------------------------------------------------------
function VerifyMill( dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2)
local sTuuid = EgtGetMachiningParam( MCH_MP.TUUID)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
if ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
( not sTuuidMstr or sTuuidMstr == sTuuid) and
( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then
return true, { TMaxDepth = dTMaxDepth, TDiam = dTDiam, H2 = bH2}
end
end
---------------------------------------------------------------------
function VerifyPocket( dMaxDiam, dDepth, dMaxTotLen, bH2)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then
return true, { TDiam = dTDiam, TMaxDepth = dTMaxDepth, H2 = bH2}
end
end
---------------------------------------------------------------------
function VerifyTool( MachiningType, sType, Params, bH2)
if MachiningType == MCH_MY.DRILLING then
if EgtStartsWith( sType, 'Drill') or EgtStartsWith( sType, 'AngleDrill') then
return VerifyDrill( Params.Diam, Params.Depth, bH2)
elseif EgtStartsWith( sType, 'Pocket') then
return VerifyDrillPocket( Params.Diam, Params.Depth, bH2)
end
elseif MachiningType == MCH_MY.SAWING then
return true, { H2 = bH2}
elseif MachiningType == MCH_MY.MILLING then
return VerifyMill( Params.Depth, Params.TuuidMstr, Params.MaxDiam, Params.MaxTotLen, bH2)
elseif MachiningType == MCH_MY.POCKETING then
return VerifyPocket( Params.MaxDiam, Params.Depth, Params.MaxTotLen, bH2)
elseif MachiningType == MCH_MY.MORTISING then
return true, { H2 = bH2}
else
return false
end
end
---------------------------------------------------------------------
function GetMachinings( MachiningType)
if MachiningType == MCH_MY.DRILLING then
return Drillings
elseif MachiningType == MCH_MY.SAWING then
return Cuttings
elseif MachiningType == MCH_MY.MILLING then
return Millings
elseif MachiningType == MCH_MY.POCKETING then
return Pocketings
elseif MachiningType == MCH_MY.MORTISING then
return Sawings
end
end
---------------------------------------------------------------------
function ReturnParams( MachiningType, MachiningName, sType, ToolParams)
if MachiningType == MCH_MY.DRILLING then
local _, sOrigType = EgtEndsWith( sType, '_H2')
return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'AngleDrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen
elseif MachiningType == MCH_MY.SAWING then
return MachiningName, ToolParams.H2
elseif MachiningType == MCH_MY.MILLING then
return MachiningName, ToolParams.TMaxDepth, ToolParams.TDiam, ToolParams.H2
elseif MachiningType == MCH_MY.POCKETING then
return MachiningName, ToolParams.TDiam, ToolParams.TMaxDepth, ToolParams.H2
elseif MachiningType == MCH_MY.MORTISING then
return MachiningName
end
end
---------------------------------------------------------------------
local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead)
if bTopHead == nil and bDownHead == nil then
bTopHead = true
bDownHead = false
elseif bTopHead == nil then
bTopHead = not bDownHead
elseif bDownHead == nil then
bDownHead = not bTopHead
end
SetCurrMachineHeadType()
-- verifico se testa attiva va bene
local sH1Mach = ''
local sH1Tool = ''
local sH1Param
local sH2Mach = ''
local sH2Tool = ''
local sH2Param
-- ricerca sulle forature, dal diametro maggiore al minore
local Machinings = GetMachinings( MachiningType)
local ForStart = 1
local ForEnd = #Machinings
local ForStep = 1
if MachiningType == MCH_MY.DRILLING then
ForStart = #Machinings
ForEnd = 1
ForStep = -1
end
if ( BEAM and BEAM.BW) or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then
_, sType = EgtEndsWith( sType, '_H2')
elseif ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bDownHead then
if not EgtEndsWith( sType, '_H2') then
sType = sType .. '_H2'
end
end
local MachineHeadUse = MachineHeadType
if not BEAM or not BEAM.BW then
MachineHeadUse = ONE_HEAD
end
if BEAM and BEAM.BW and MachineHeadUse == TWO_UP_DOWN_HEADS and bTopHead and bDownHead then
-- se posso usare entrambe le teste, la gestisco come una macchina a due teste da sopra
MachineHeadUse = TWO_EQUAL_HEADS
end
-- variabile che definisce quando un utensile ha un diametro sostanzialmente più grande di un altro
local dBiggerToolTolerance = 1.25
for i = ForStart, ForEnd, ForStep do
local Machining = Machinings[i]
local sMachiningType = Machining.Type
if BEAM and BEAM.BW then
_, sMachiningType = EgtEndsWith( Machining.Type, '_H2')
end
-- recupero dati utensile
local bToolActive, sToolName, bH2, bFixed = SetCurrMachiningAndTool( Machining.Name)
if Machining.On and sMachiningType == sType and bToolActive then
local bOk, ToolParams = VerifyTool( MachiningType, sType, Params, bH2)
if bOk then
if MachineHeadUse == ONE_HEAD then
SetNextMachining( sToolName, 1, bFixed)
return ReturnParams(MachiningType, Machining.Name, Machining.Type, ToolParams)
elseif MachineHeadUse == TWO_EQUAL_HEADS then
-- se nessuna testa attiva, prendo la prima lavorazione disponibile
if nActiveHead == 0 then
SetNextMachining( sToolName, EgtIf( bH2, 2, 1), bFixed)
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
-- verifico se posso usare lo stesso utensile della testa attiva
elseif ( nActiveHead == 1 and not bH2 and sToolName == H1_TOOL) or ( nActiveHead == 2 and bH2 and sToolName == H2_TOOL) then
-- se l'utensile sulla testa attiva è molto più piccolo rispetto a quelli salvati non lo scelgo
if ( not sH1Param or not sH1Param.TDiam or sH1Param.TDiam < dBiggerToolTolerance * ToolParams.TDiam) and ( not sH2Param or not sH2Param.TDiam or sH2Param.TDiam < 1.25 * ToolParams.TDiam) then
SetNextMachining( sToolName, nActiveHead, bFixed)
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
end
end
-- segno le lavorazioni disponibili per entrambe le teste
if bH2 then
if not sH2Mach or sH2Mach == '' then
sH2Mach = Machining.Name
sH2Tool = sToolName
sH2Param = ToolParams
end
else
if not sH1Mach or sH1Mach == '' then
sH1Mach = Machining.Name
sH1Tool = sToolName
sH1Param = ToolParams
end
end
elseif MachineHeadUse == TWO_UP_DOWN_HEADS then
if bTopHead and not bH2 then
SetNextMachining( sToolName, 1, bFixed)
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
elseif bDownHead and bH2 then
SetNextMachining( sToolName, 2, bFixed)
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
end
end
end
end
end
end
---------------------------------------------------------------------
function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen)
for i = 1, #Pocketings do
local Pocketing = Pocketings[i]
if Pocketing.On and Pocketing.Type == sType and SetCurrMachiningAndTool( Pocketing.Name) then
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then
return Pocketing.Name, dTDiam, dTMaxDepth
if MachineHeadUse == TWO_EQUAL_HEADS then
-- se uno dei due utensili è molto più grande dell'altro scelgo quello senza fare altre analisi
if sH1Mach ~= "" and sH1Param.TDiam and sH2Mach ~= "" and sH2Param.TDiam then
if sH1Param.TDiam > dBiggerToolTolerance * sH2Param.TDiam then
SetNextMachining( sH1Tool, 1, bFixed)
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
elseif sH2Param.TDiam > dBiggerToolTolerance * sH1Param.TDiam then
SetNextMachining( sH2Tool, 2, bFixed)
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
end
end
-- verifico se cambiare testa o cambiare utensile su quella corrente
if nActiveHead == 1 then
if sH2Mach ~= "" then
SetNextMachining( sH2Tool, 2, bFixed)
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
--return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen
elseif sH1Mach ~= "" then
SetNextMachining( sH1Tool, 1, bFixed)
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
--return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen
end
elseif nActiveHead == 2 then
if sH1Mach ~= "" then
SetNextMachining( sH1Tool, 1, bFixed)
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
--return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen
elseif sH2Mach ~= "" then
SetNextMachining( sH2Tool, 2, bFixed)
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
--return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen
end
end
end
local bH2, sOrigType = EgtEndsWith( sType, '_H2')
if ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bH2 and bTopHead then
return FindMachining( MachiningType, sOrigType, Params, true, false)
end
end
---------------------------------------------------------------------
function MachiningLib.FindCutting( sType, bTopHead, bDownHead)
return FindMachining( MCH_MY.SAWING, sType, nil, bTopHead, bDownHead)
end
---------------------------------------------------------------------
function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead)
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Drill', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
if not MachiningName or MachiningName == '' then
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Pocket', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
end
if MachiningName and MachiningName ~= '' then
return MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5
end
end
---------------------------------------------------------------------
function MachiningLib.FindAngleDrilling( dDiam, dDepth, bTopHead, bDownHead)
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'AngleDrill', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
if MachiningName and MachiningName ~= '' then
return MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5
end
end
---------------------------------------------------------------------
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead)
return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead)
end
---------------------------------------------------------------------
function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHead, bDownHead)
return FindMachining( MCH_MY.POCKETING, sType, { MaxDiam = dMaxDiam, Depth = dDepth, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead)
end
---------------------------------------------------------------------
function MachiningLib.FindSawing( sType)
for i = 1, #Sawings do
local Sawing = Sawings[i]
if Sawing.On and Sawing.Type == sType and SetCurrMachiningAndTool( Sawing.Name) then
return Sawing.Name
end
end
return FindMachining( MCH_MY.MORTISING, sType)
end
---------------------------------------------------------------------
function MachiningLib.FindDrilling( dDiam, dDepth, bDown)
-- ricerca sulle forature, dal diametro maggiore al minore
local sDrType = 'Drill' .. EgtIf( bDown, '_H2', '')
for i = #Drillings, 1, -1 do
local Drilling = Drillings[i]
if Drilling.On and Drilling.Type == sDrType and SetCurrMachiningAndTool( Drilling.Name) then
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dDiamTh = EgtTdbGetCurrToolThDiam()
local dLenTh = 72
if EgtTdbGetCurrToolThLength then dLenTh = EgtTdbGetCurrToolThLength() end
local dFreeLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) - dLenTh - EgtMdbGetGeneralParam( MCH_GP.MAXDEPTHSAFE)
if dTDiam < dDiam + 10 * GEO.EPS_SMALL and dTDiam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL then
if not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL then
return Drilling.Name, Drilling.Type, dTMaxMat, dMaxToolLength, dToolDiam, dDiamTh, dFreeLen
end
end
end
end
-- ricerca sulle svuotature, dal diametro maggiore al minore
local sPkType = 'Pocket' .. EgtIf( bDown, '_H2', '')
for i = #Drillings, 1, -1 do
local Drilling = Drillings[i]
if Drilling.On and Drilling.Type == sPkType and SetCurrMachiningAndTool( Drilling.Name) then
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dDiamTh = EgtTdbGetCurrToolThDiam()
local dFreeLen = dTMaxDepth
if dTDiam < dDiam - 10 * GEO.EPS_SMALL then
if not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL then
return Drilling.Name, Drilling.Type, dTMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dFreeLen
end
end
end
end
-------------------------------------------------------------------------------------------------------------
function MachiningLib.ApplyMachining( bRecalc, bApplyPost)
local bResult = EgtApplyMachining( bRecalc, bApplyPost)
if bResult then ConfirmNextMachining() end
return bResult
end
-------------------------------------------------------------------------------------------------------------
+10 -7
View File
@@ -1,5 +1,6 @@
-- ProcessBlockHausFront.lua by Egaltech s.r.l. 2020/08/03
-- Gestione calcolo giunzione block house in testa
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessBlockHausFront = {}
@@ -43,7 +44,10 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
if not dOvmTail then
dOvmTail = BD.OVM_MID
end
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -125,7 +129,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -141,7 +145,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
@@ -166,15 +170,14 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
elseif vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
end
if #vCuts > 0 then
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
@@ -233,7 +236,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
+2 -2
View File
@@ -75,7 +75,7 @@ function ProcessChamfer.Make( Proc, nPhase, nRawId, nPartId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -178,7 +178,7 @@ function ProcessChamfer.Make( Proc, nPhase, nRawId, nPartId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, 0}})
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
+190 -125
View File
@@ -1,4 +1,4 @@
-- ProcessCut.lua by Egaltech s.r.l. 2022/01/26
-- ProcessCut.lua by Egaltech s.r.l. 2022/09/30
-- 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/06/06 Correzioni per tagli con testa da sotto.
@@ -6,6 +6,17 @@
-- 2021/09/19 Tagli da sotto non sbiechi favorita posizione da sopra di testa.
-- 2021/10/06 Piccola correzione a tagli di cubetti con testa da sotto.
-- 2022/01/26 Taglio da sotto orizzontale deve avere direzione di riferimento ortogonale -Z.
-- 2022/02/02 Modifiche per tagli di coda spostati prima come lavorazione su pezzi a caduta.
-- 2022/02/06 Correzioni per tagli di coda spostati prima.
-- 2022/05/31 Alcune modifiche per utilizzare la ProcessCut.Make in ProcessSplit e ProcessHeadCut, per le 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/06/28 Modificata determinazione taglio bFromBottom in MakeFromTop.
-- 2022/07/18 Se Q04=1, aggiunto LongCut anche dal lato per macchine tipo PF1250.
-- 2022/08/12 I tagli di lama inclinati in coda ora partono dal centro e non dall'esterno.
-- 2022/08/24 Disabilitato il dicing per i tagli meno spessi della lama.
-- 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/09/23 Corretta la condizione per cui è richiesto l'aggiornamento del grezzo.
-- Tabella per definizione modulo
local ProcessCut = {}
@@ -32,26 +43,28 @@ end
---------------------------------------------------------------------
-- Classificazione della feature
function ProcessCut.Classify( Proc, b3Raw)
-- se PF con testa da sotto, ammessa qualunque orientazione
if BD.C_SIMM and BD.DOWN_HEAD then
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
return true
end
-- recupero i dati del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
if vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1 or ( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) then
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0)
if DimH > BD.MAX_DIM_DICE then
-- calcolo le massime estensioni lineari orizzontale e verticale della faccia
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
-- confronto queste estensioni con la massima dimensione del DiceCut (impossibile lavorare se entrambe maggiori)
if DimH > BD.MAX_DIM_DICE and DimV > BD.MAX_DIM_DICE then
return true, true
end
end
-- verifico se c'è un taglio da sotto e se è nei limiti
-- se è un taglio da sotto, lo verifico
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bDownCut then
-- calcolo l'ingombro orizzontale della faccia
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0)
-- confronto anche qua la distanza maggiore della faccia con la massima distanza del DiceCut
-- e se il rapporto supera il 2 (implica che genera 3 tagli) dichiaro impossibile la lavorazione
if DimH and BD.MAX_DIM_DICE and abs( BD.MAX_DIM_DICE) > 20 * GEO.EPS_SMALL and abs( DimH / BD.MAX_DIM_DICE) > 2 then
-- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli)
if DimH > 2 * BD.MAX_DIM_DICE then
return true, true
end
end
@@ -156,7 +169,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -179,7 +192,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -192,7 +205,7 @@ end
local function UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
-- eventuale segnalazione ingombro di testa o coda (se non chiamata da altre feature)
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
if ProcessCut.Identify( Proc) and Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
if Proc.Head then
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
if vtN:getZ() > 0.5 then
@@ -219,33 +232,39 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione con testa da sopra
local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
b3Raw = b3Raw or EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- limiti di taglio (se molto di lato e inclinati sono permessi fino a -45deg)
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw)
if not BD.C_SIMM and abs( vtN:getX()) < 0.5 then dNzLimDwnUp = -0.707 end
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bFromBottom == nil then
bFromBottom = ( vtN:getZ() > 0.25 and ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtN:getX() < 0))
bFromBottom = ( vtN:getZ() > 0.25 and b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and vtN:getX() < 0 and abs( vtN:getY()) < 0.259)
end
-- verifico se da considerare taglio lungo ( non da sotto, inclinato non più di 30deg, largo come la trave e abbastanza lungo)
local bLongCut = ( not bDownCut and vtN:getZ() > 0.865 and
Proc.Box:getDimY() > b3Solid:getDimY() - 10 * GEO.EPS_SMALL and
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > 600.000))
-- verifico se da considerare taglio lungo dal lato, solo per macchine tipo PF1250, inclinato non più di 30deg
local bLongCutFromSide = ( not bDownCut and ( BD.C_SIMM and BD.DOWN_HEAD and ( abs(vtN:getY()) > 0.865) and
Proc.Box:getDimZ() > b3Solid:getDimZ() - 10 * GEO.EPS_SMALL) and
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > 600.000))
-- se taglio lungo e Q04 = 1 allora lancio il processo dell'L10
if bLongCut and EgtGetInfo( Proc.Id, 'Q04', 'i') == 1 then
return LongCut.Make( Proc, nPhase, nRawId, nPartId, true)
local bNoDicing = EgtGetInfo( Proc.Id, 'Q04', 'i') == 1
if bNoDicing then
if bLongCut then
local bOk, sErr = LongCut.Make( Proc, nPhase, nRawId, nPartId, true)
return bOk, sErr, bNoDicing
elseif bLongCutFromSide then
local bOk, sErr = LongCut.Make( Proc, nPhase, nRawId, nPartId, false, 2)
return bOk, sErr, bNoDicing
end
-- se non passa dal LongCut rimetto a false perchè ha fatto un taglio standard
bNoDicing = false
end
-- se pezzo ancora attaccato alla trave, per non rovinare quello successivo
local bFillAreaPiece
@@ -293,7 +312,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end
end
-- se vero taglio, eventuale inserimento smussi
if Proc.Prc == 10 then
if ProcessCut.Identify( Proc) then
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOkc then return bOkc, sErrC end
end
@@ -311,13 +330,21 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- determino la direzione di taglio preferenziale
local _, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0)
local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA and not bDownCut)
local frFac, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA and not bDownCut) or
( dCutV < 0.8 * dMaxVertDepth - BD.CUT_EXTRA and b3Solid:getDimZ() < 0.8 * dMaxVertDepth - BD.CUT_EXTRA)
local bVertCutOk = ( dCutH < dMaxDepth - BD.CUT_EXTRA)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- verifico se necessari tagli supplementari
EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3)
local vCuts = {}
if dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC then
if not Proc.AdvTail and ( dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then
local ptExtra, vtExtra
local bAutoCalcSurf = true
if bFillAreaPiece or bFillTail then
@@ -326,10 +353,41 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
vtExtra = X_AX()
bAutoCalcSurf = false
end
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
-- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate
if ( bFillTail or bCustDiceCut) and #vCuts == 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
-- verifico elevazione max del materiale tagliato
local dMaxElev
if vtN:getX() > 0 then
if bForced then
dMaxElev = b3Raw:getMax():getX() - Proc.Box:getMin():getX()
else
dMaxElev = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
end
else
if bForced then
dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX()
else
dMaxElev = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
end
end
-- per macchina TURN aggiusto massima dimensione cubetto
local dNewDiceDim
if BD.TURN then
local dDimRef = GEO.INFINITO
if abs( vtN:getZ()) < 0.003 then
dDimRef = b3Raw:getDimZ()
elseif abs( vtN:getY()) < 0.003 then
dDimRef = b3Raw:getDimY()
end
if dDimRef + BD.CUT_EXTRA < dMaxDepth then
dNewDiceDim = - ( dMaxDepth - BD.CUT_EXTRA)
end
end
-- se il taglio è più spesso della lama abilito il dicing, altrimenti no
if dMaxElev > dSawThick then
vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, dNewDiceDim)
-- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate
if ( bFillTail or bCustDiceCut) and #vCuts == 0 then
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
end
end
end
-- se il ProcessCut viene lanciato dal ProcessSawCut e non ci sono tagli a cubetti, esco
@@ -338,18 +396,10 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end
--DC.PrintOrderCut( vCuts)
if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome
local bOrthInv = false
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
if ( i % 2) == 1 then
@@ -393,14 +443,12 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
else
if bHorizCut then
vtOrthoO = Z_AX()
elseif vtN:getY() > -0.02 then
if not Proc.Head then
vtOrthoO = -Y_AX()
else
vtOrthoO = Y_AX()
end
else
vtOrthoO = -Y_AX()
if vtN:getZ() < dNzLimDwnUp then
vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX())
else
vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX())
end
end
end
end
@@ -415,12 +463,10 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
local dVzLimDwnUp = dNzLimDwnUp
if j ~= 1 then
vtNewOrthoO = -vtOrthoO
if not BD.C_SIMM and abs( vtN:getY()) > 0.05 then dVzLimDwnUp = -0.707 end
if not BD.C_SIMM and not BD.TURN and abs( vtN:getY()) > 0.05 then dVzLimDwnUp = -0.708 end
end
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtNewOrthoO, dVzLimDwnUp, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
if not bOk then return bOk, sErr end
end
-- tutti gli altri casi vengono saltati
-- caso generale
@@ -441,47 +487,56 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end
end
local dVzLimDwnUp = dNzLimDwnUp
if not BD.C_SIMM and vtN:getZ() > 0.707 then dVzLimDwnUp = -0.708 end
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
if not BD.C_SIMM and not BD.TURN and vtN:getZ() > 0.707 then dVzLimDwnUp = -0.708 end
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw)
if not bOk then return bOk, sErr end
end
end
end
-- altrimenti tagli diretti della faccia
else
-- impostazioni
local dVzLimDwnUp = dNzLimDwnUp
local dCutExtra = BD.CUT_EXTRA
if Proc.AdvTail then
if bHorizCut then dVzLimDwnUp = -0.01 end
dCutExtra = -BD.ADVANCE_TAIL_OFFS
end
-- lavoro la faccia
local vtOrthoO
if bFromBottom and dCutV < dMaxVertDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then
vtOrthoO = -Z_AX()
elseif bHorizCut and ( not bVertCutOk or b3Solid:getDimX() > BD.LEN_SHORT_PART or vtN:getX() > 0) then
elseif bHorizCut and ( not bVertCutOk or b3Solid:getDimX() > BD.LEN_SHORT_PART or Proc.AdvTail or vtN:getX() > 0 or ( abs( vtN:getY()) < 0.1 and vtN:getZ() <= 0)) then
vtOrthoO = Z_AX()
elseif b3Solid:getDimX() < BD.LEN_SHORT_PART and abs( vtN:getY()) > 0.259 and vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
elseif b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and abs( vtN:getY()) > 0.259 and
vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
if Proc.Head then
vtOrthoO = X_AX()
else
vtOrthoO = -X_AX()
end
elseif vtN:getZ() < dNzLimDwnUp and abs( vtN:getY()) > 0.259 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
elseif vtN:getZ() < dVzLimDwnUp and abs( vtN:getY()) > 0.259 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
if Proc.Head then
vtOrthoO = X_AX()
else
vtOrthoO = -X_AX()
end
elseif Proc.Head then
vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX())
else
vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX())
if vtN:getZ() < dVzLimDwnUp or Proc.Head or Proc.Tail then
vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX())
else
vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX())
end
-- se è una lavorazione da anticipare diminuisco la profondità del taglio per evitare collisioni con l'albero della lama
if Proc.AdvTail then
local _, dH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
dCutExtra = min( -BD.ADVANCE_TAIL_OFFS, -dH + dMaxDepth)
end
end
-- taglio
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, dNzLimDwnUp, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sErr end
end
-- Aggiornamento ingombro
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
return true
end
@@ -491,17 +546,11 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- se vero taglio, eventuale inserimento smussi
if Proc.Prc == 10 then
if ProcessCut.Identify( Proc) then
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOkc then return bOkc, sErrC end
end
@@ -519,12 +568,19 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
end
local dMaxVertDepth = dMaxDepth
-- determino la direzione di taglio preferenziale
local _, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0)
local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA)
local frFac, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA) or Proc.AdvTail
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- verifico se necessari tagli supplementari
EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3)
local vCuts = {}
if dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC then
if not Proc.AdvTail and ( dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then
local ptExtra, vtExtra
local bAutoCalcSurf = true
if bFillAreaPiece or bFillTail then
@@ -533,22 +589,14 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
vtExtra = X_AX()
bAutoCalcSurf = false
end
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, nil ,true)
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, nil ,true)
end
--DC.PrintOrderCut( vCuts)
if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome
local bOrthInv = false
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
if ( i % 2) == 1 then
@@ -627,9 +675,7 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- taglio parallelo (limite Vz Down Up messo a -2 per non farlo mai intervenire)
if vCuts[i+1][j] then
local bOk, sErr = Fbs.MakeOne( vCuts[i+1][j], 0, sCutting, dSawDiam, vtOrthoO_2, -2, dExtraCut_2, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
if not bOk then return bOk, sErr end
end
end
end
@@ -637,9 +683,9 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
else
-- lavoro la faccia
local vtOrthoO
if bHorizCut and ( b3Solid:getDimX() > BD.LEN_SHORT_PART or vtN:getX() > 0) then
if bHorizCut and ( b3Solid:getDimX() > BD.LEN_SHORT_PART or Proc.AdvTail or vtN:getX() > 0) then
vtOrthoO = -Z_AX()
elseif b3Solid:getDimX() < BD.LEN_SHORT_PART and abs( vtN:getY()) > 0.259 and vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
elseif b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and abs( vtN:getY()) > 0.259 and vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
if Proc.Head then
vtOrthoO = X_AX()
else
@@ -665,63 +711,82 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
end
end
-- taglio (limite Vz Down Up messo a -2 per non farlo mai intervenire)
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, -2, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
local dCutExtra = BD.CUT_EXTRA
if Proc.AdvTail then
dCutExtra = min( -BD.ADVANCE_TAIL_OFFS, dMaxVertDepth - dCutV)
end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, -2, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sErr end
end
-- Aggiornamento ingombro
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
return true
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
b3Raw = b3Raw or EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
-- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- se taglio di testa
if Proc.Head then
-- se coincide con il taglio di separazione precedente, non va fatto
if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
return true
if not bForced then
if Proc.Head then
-- se coincide con il taglio di separazione precedente, non va fatto
if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
return true
end
-- altrimenti taglio di coda
else
-- se coincide con taglio di separazione, non va fatto
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
return true
end
end
-- altrimenti taglio di coda
else
-- se coincide con taglio di separazione, non va fatto
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
-- se coincide con un taglio frontale non va fatto
if Proc.CutFront then
return true
end
end
-- se coincide con un taglio frontale non va fatto
if Proc.CutFront then
return true
end
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg e sbandato oltre 1deg oppure sezione larga o pezzo corto)
local bTopHead = ( BD.DOWN_HEAD and vtN:getZ() > -0.342)
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg e sbandato oltre 1deg oppure sezione più larga di 2 cubetti o pezzo corto)
local bDownHead = ( BD.DOWN_HEAD and vtN:getZ() < -0.341 and
( abs( vtN:getY()) > 0.017 or b3Raw:getDimY() > 2 * ( BD.MAX_DIM_HTCUT - BD.CUT_EXTRA_MIN) or b3Raw:getDimX() < BD.LEN_SHORT_PART))
( abs( vtN:getY()) > 0.017 or b3Raw:getDimY() > 2 * ( BD.MAX_DIM_DICE - BD.CUT_EXTRA_MIN) or b3Raw:getDimX() < BD.LEN_SHORT_PART))
local bDownTurn = ( BD.TURN and vtN:getZ() < -0.017)
local bTopHead = ( BD.DOWN_HEAD and ( vtN:getZ() > -0.342 or not bDownHead))
-- recupero la lavorazione
local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide')
local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', ''))
if not sCutting and bTopHead then
sCutting = ML.FindCutting( sCutType)
bDownHead = false
end
local sCutting
sCutting, bDownHead = ML.FindCutting( sCutType, bTopHead, bDownHead)
if not sCutting then
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
return false, sErr
end
local bNoDicing = false
-- se taglio con testa da sopra
if not bDownHead then
return MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
if not bDownHead and not bDownTurn then
local bOk, sErr, bNoDicing2 = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
bNoDicing = bNoDicing2
if not bOk then return false, sErr end
-- altrimenti taglio con testa da sotto
else
return MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
local bOk, sErr = MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
if not bOk then return false, sErr end
end
-- Aggiornamento ingombro (se vero taglio o richiesto)
-- Se lascio il cordolo (bNoDicing) non aggiorno il grezzo perchè lo scarto rimane attaccato
if ( ProcessCut.Identify( Proc) or bUpdateIng) and not bNoDicing then
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
end
return true
end
---------------------------------------------------------------------
+1 -1
View File
@@ -69,7 +69,7 @@ function ProcessDecor.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
+359 -82
View File
@@ -1,5 +1,6 @@
-- ProcessDoubleCut.lua by Egaltech s.r.l. 2021/11/25
-- ProcessDoubleCut.lua by Egaltech s.r.l. 2022/07/11
-- Gestione calcolo doppi tagli di lama per Travi
-- 2022/08/29 Implementata la fresatura dal lato per tagli problematici per PF1250
-- Tabella per definizione modulo
local ProcessDoubleCut = {}
@@ -28,54 +29,70 @@ end
function ProcessDoubleCut.Classify( Proc, b3Raw)
--se una faccia, uso la classificazione dei tagli singoli
if Proc.Fct == 1 then return Cut.Classify( Proc, b3Raw) end
-- se PF con testa da sotto, ammessa qualunque orientazione
if BD.C_SIMM and BD.DOWN_HEAD then
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
return true
end
-- limite per facce da sotto
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw)
-- verifico se convesso
-- determino se convesso o concavo
local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
local bConvex = ( not bAdj or ( dAng > 0))
-- se convesso
if bConvex then
-- recupero i dati di ogni singola faccia
for i = 1, 2 do
local nFac = i - 1
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFac, GDB_ID.ROOT)
if ( vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1) or ( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) then
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, nFac)
if DimH > BD.MAX_DIM_DICE then
-- calcolo la massima estensione orizzontale lineare della faccia
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, nFac, b3Raw)
-- confronto questa estensione con la massima dimensione del DiceCut (impossibile lavorare se maggiore)
if DimH > BD.MAX_DIM_DICE and DimV > BD.MAX_DIM_DICE then
return true, true
end
end
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bDownCut then
-- calcolo l'ingombro orizzontale della faccia
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, nFac)
-- confronto anche qua la distanza maggiore della faccia con la massima distanza del DiceCut
-- e se il rapporto supera il 2 (implica che genera 3 tagli) dichiaro impossibile la lavorazione
if DimH and BD.MAX_DIM_DICE and abs( BD.MAX_DIM_DICE) > 20 * GEO.EPS_SMALL and abs( DimH / BD.MAX_DIM_DICE) > 2 then
-- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli)
if DimH > 2 * BD.MAX_DIM_DICE then
return true, true
end
end
end
return true, false
end
-- altrimenti concavo, verifico le normali delle facce per tagli da sotto
for i = 1, 2 do
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, i-1, GDB_ID.ROOT)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bDownCut then
-- dimensione della faccia perpendicolare alla linea di intersezione tra le facce
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, 2-i, GDB_ID.ROOT)
local vtX = vtN2 ^ vtN
local frRef = Frame3d( ptC, ptC + 100 * vtX, ptC + 100 * vtN2)
local b3Ref = EgtSurfTmGetFacetBBoxRef( Proc.Id, i-1, GDB_BB.STANDARD, frRef)
if b3Ref:getDimY() > BD.MAX_DIM_DICE then
return true, true
else
local ptC = {}
local vtN = {}
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
local vtX = vtN[1] ^ vtN[2] ; vtX:normalize()
local vtY = { vtX ^ vtN[1], - vtX ^ vtN[2]}
for i = 1, 2 do
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN[i], vtY[i])
local bDownCut = ( vtN[i]:getZ() <= dNzLimDwnUp)
if bDownCut then
-- dimensione della faccia perpendicolarmente alla linea di intersezione tra le facce
local frRef = Frame3d( ptC[i], ptC[i] + 100 * vtX, ptC[i] + 100 * vtY[i])
local b3Ref = EgtSurfTmGetFacetBBoxRef( Proc.Id, i-1, GDB_BB.STANDARD, frRef)
-- dimensione dell'altra faccia perpendicolarmente alla linea di intersezione tra le facce
local frRef2 = Frame3d( ptC[3-i], ptC[3-i] + 100 * vtX, ptC[3-i] + 100 * vtY[3-1])
local b3Ref2 = EgtSurfTmGetFacetBBoxRef( Proc.Id, 2-i, GDB_BB.STANDARD, frRef2)
-- se faccia grande
if b3Ref:getDimY() > BD.MAX_DIM_DICE then
-- se altra faccia piccola
if b3Ref2:getDimY() < BD.MAX_DIM_DICE then
return true, true
else
return false
end
end
end
end
return true, false
end
return true, false
end
---------------------------------------------------------------------
@@ -119,7 +136,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sErr)
return false, sErr
end
local sMillingDw = ML.FindMilling( 'Mark_H2')
local sMillingDw = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
if bVert and not sMillingDw then
local sErr = 'Error : milling (Mark_H2) not found in library'
EgtOutLog( sErr)
@@ -141,7 +158,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -164,7 +181,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -172,11 +189,298 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
return true
end
---------------------------------------------------------------------
local function VerifyPocket( Proc, dDiam, dDepth, dMaxTotLen, sMchFindMaster, bPocketDown)
-- tipo di svuotatura
local sMchFind = EgtIf( sMchFindMaster and #sMchFindMaster > 0, sMchFindMaster, 'Pocket')
-- ricerca della svuotatura
local sPocketing
if dDepth then
sPocketing = ML.FindPocketing( sMchFind, dDiam, dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
ML.FindPocketing( sMchFind, dDiam, 0.8 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
ML.FindPocketing( sMchFind, dDiam, 0.6 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
ML.FindPocketing( sMchFind, dDiam, 0.4 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen)
else
sPocketing = ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen)
end
if not sPocketing then
return false
end
-- recupero i dati dell'utensile
local bUsePocketing = false
local dMaxDepth = 0
local dToolDiam = 0
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
bUsePocketing = true
end
return bUsePocketing, sPocketing, dMaxDepth, dToolDiam
end
---------------------------------------------------------------------
local function SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId)
-- fondo tra loro le curve compatibili
EgtMergeCurvesInCurveCompo( nPathInt)
local nStartIdEnt, nNumEnt = EgtCurveDomain( nPathInt)
local pLastPIni, pLastPEnd
-- faccio una copia della curva e la esplodo
if nStartIdEnt then
-- ciclo i lati della curva e controllo per ognuno se giace in uno dei piani limite del pezzo: se sì allora il lato è aperto
for i = 1, nNumEnt do
local pPini = EgtUP( nPathInt, (i-1), GDB_RT.GLOB)
local pPend = EgtUP( nPathInt, EgtIf( i == nNumEnt, 0, i), GDB_RT.GLOB)
if ( abs( pPini:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
-- scrivo nelle proprietà della curva quali sono i lati aperti
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
-- se ci sono già altri lati aperti
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
-- se è l'unico
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
end
end
end
return false
end
---------------------------------------------------------------------
local function MakeBySidePocket( Proc, nPhase, nRawId, nPartId, nAddGrpId, b3Solid)
local nFirstMachId
local sWarn
local sMchFind = 'OpenPocket'
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt
local bBadMach = false
-- ottengo le dimensioni del tunnel
dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
-- posso utilizzare utensile con diametro doppio della dimensione minima
dDimMin = min( 2 * dDimMin, BD.MAXDIAM_POCK_CORNER)
local nPathInt
-- verifico se è presente la testa da sotto e se è necessario usarla
bMillDown = ( BD.DOWN_HEAD == true and abs( vtOrtho:getZ()) >= 0.707)
-- cerco l'utensile di svuotatura per la testa sopra
local bMakePocket, sPocketing, dMaxDepth, dDiamTool = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind)
local bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn
-- cerco anche l'utensile per la testa sotto, nel caso servisse
if bMillDown then
bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind, true)
-- se è negativo inverto il versore e la faccia
if vtOrtho:getZ() < 0 then
vtOrtho = -vtOrtho
EgtInvertSurf( nSurfInt)
end
end
if bMakePocket then
-- gestione svuotatura da un solo lato o anche dal lato opposto (se non verticale)
-- estraggo il contorno dalla superfice per evitare i problemi con la svuotatura
-- e assegno l'estrusione
nPathInt = EgtExtractSurfTmLoops( nSurfInt, nAddGrpId)
EgtModifyCurveExtrusion( nPathInt, vtOrtho, GDB_RT.GLOB)
SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId)
-- variabili per parametri lavorazione
local dMachDepth
local dElev = 0
local bDoubleSide
local bOneShot
local bComplete = true
-- imposto altezza aggiuntiva di elevazione
local dCollSic = BL.CalcCollisionSafety( vtOrtho)
-- se possibile svuotare completamente da una sola parte
if dMaxDepth > ( dDepth + BD.CUT_EXTRA + dCollSic) then
dMachDepth = ( dDepth / 2) + BD.CUT_EXTRA
dElev = dDepth + BD.CUT_EXTRA
bOneShot = true
else
-- se direzione verso la verticale setto max affondamento possibile ed
-- emetto messaggio di warning perché non lavorabile interamente
if abs( vtOrtho:getZ()) >= 0.707 and not BD.DOWN_HEAD then
dMachDepth = dMaxDepth - ( dDepth / 2) - dCollSic
dElev = dMaxDepth
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
bComplete = false
-- altrimenti setto il flag per fare la svuotatura da due parti
else
-- se l'altezza utensile riesce a lavorare completamente da due parti
if dMaxDepth > ( dDepth / 2) + dCollSic + BD.CUT_EXTRA_MIN then
dMachDepth = BD.CUT_EXTRA_MIN
dElev = ( dDepth / 2) + BD.CUT_EXTRA_MIN
-- altrimenti non si riesce in due passate, limito la profondità e setto l'elevazione
else
dMachDepth = dMaxDepth - ( dDepth / 2) - dCollSic
dElev = dMaxDepth
-- se molto inclinato rispetto alla normale della faccia di riferimento, lavorazione non idonea per probabili collisioni
local vtRef = Y_AX()
if abs( vtOrtho:getX()) > abs( vtOrtho:getY()) and abs( vtOrtho:getX()) > abs( vtOrtho:getZ()) then
vtRef = X_AX()
elseif abs( vtOrtho:getZ()) > abs( vtOrtho:getX()) and abs( vtOrtho:getZ()) > abs( vtOrtho:getY()) then
vtRef = Z_AX()
end
if abs( vtOrtho * vtRef) < 0.5 then
bBadMach = true
end
end
bDoubleSide = true
end
end
-- inserisco la lavorazione di svuotatura
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
EgtOutLog( sErr)
return -1, sErr
end
-- prendo l'id della prima lavorazione inserita
if not nFirstMachId then
nFirstMachId = nMchFId
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nPathInt, -1}})
-- verifico se devo invertire direzione utensile (in caso di direzione verso la verticale)
local bInvertMach
if vtOrtho:getZ() < BD.NZ_MINA and abs(vtOrtho:getZ()) >= 0.707 and not BD.DOWN_HEAD then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
bInvertMach = true
-- altrimenti se da fare in una sola volta e direzionato verso Y+ lo inverto per lavorarlo davanti
elseif not bDoubleSide and vtOrtho:getY() > GEO.EPS_SMALL and not ( -(vtOrtho:getZ()) < BD.NZ_MINA) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
bInvertMach = true
end
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
if AreSameOrOppositeVectorApprox( vtOrtho, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtOrtho:getX()) < 0.1 then
nSCC = EgtIf( BL.IsPartFinalPhase( nPhase), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
elseif vtOrtho:getY() < GEO.EPS_SMALL then
nSCC = EgtIf( bInvertMach, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else
nSCC = EgtIf( bInvertMach, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
end
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
-- inverto il percorso di lavorazione per lavorare sinistro
EgtSetMachiningParam( MCH_MP.INVERT, true)
-- imposto affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
-- imposto elevazione e dichiaro non si generano sfridi per VMill
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
sNotes = sNotes .. 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo
if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return -1, sErr
end
end
-- se posso applicare la svuotatura sul lato opposto
if bDoubleSide then
-- se ho la lavorazione da sotto ricalcolo in base a questa lavorazione
if bMakePocketDn then
-- sPocketing = sPocketingDn
-- dMaxDepth = dMaxDepthDn
-- dDiamTool = dDiamToolDn
-- se l'altezza utensile riesce a lavorare completamente da due parti
if dMaxDepthDn > ( dDepth / 2) + dCollSic + BD.CUT_EXTRA_MIN then
dMachDepth = BD.CUT_EXTRA_MIN
dElev = ( dDepth / 2) + BD.CUT_EXTRA_MIN
-- altrimenti non si riesce in due passate, limito la profondità e setto l'elevazione
else
dMachDepth = dMaxDepthDn - ( dDepth / 2) - dCollSic
dElev = dMaxDepthDn
bComplete = false
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
else
-- se anche lavorando dal lato opposto non riesco a svuotare completamente la fessura
-- setto i parametri affondamento ed emetto warning
if dMaxDepth < ( dDepth / 2) + BD.CUT_EXTRA + dCollSic then
dMachDepth = dMaxDepth - (dDepth / 2) - dCollSic
dElev = dMaxDepth
bComplete = false
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
end
-- inserisco la lavorazione di svuotatura
local sName = 'PockOppo_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, EgtIf( bMakePocketDn, sPocketingDn, sPocketing))
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. EgtIf( bMakePocketDn, sPocketingDn, sPocketing)
EgtOutLog( sErr)
return -1, sErr
end
-- prendo l'id della prima lavorazione inserita
if not nFirstMachId then
nFirstMachId = nMchFId
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nPathInt, -1}})
-- imposto direzione utensile opposta
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
if AreSameVectorApprox( vtOrtho, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtOrtho:getX()) < 0.1 then
nSCC = EgtIf( BL.IsPartFinalPhase( nPhase), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
elseif vtOrtho:getY() < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_YP
else
nSCC = MCH_SCC.ADIR_YM
end
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
-- inverto il percorso di lavorazione per lavorare sinistro
EgtSetMachiningParam( MCH_MP.INVERT, true)
-- imposo affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
-- imposto elevazione e dichiaro non si generano sfridi per VMill
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
sNotes = sNotes .. 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo
if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return -1, sErr
end
end
end
return 1, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId
end
return 0, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId, bOrthoFaces
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- se singola faccia, passo a quella lavorazione
if Proc.Fct == 1 then return Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end
if Proc.Fct == 1 then return Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true) end
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -235,9 +539,9 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD)
-- applico lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = 10, Box = b3Add, Fct = 1, Flg = Proc.Flg,
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Add, Fct = 1, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true)
if not bOk then return bOk, sErr end
end
-- creo piano di taglio coincidente con la seconda faccia e lo lavoro
@@ -247,70 +551,43 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD)
-- applico lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = 10, Box = b3Add, Fct = 1, Flg = Proc.Flg,
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Add, Fct = 1, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true)
if not bOk then return bOk, sErr end
end
-- altrimenti concavo
else
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -30deg)
local bTopHead = ( BD.DOWN_HEAD and vtNm:getZ() > -0.5)
local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < -0.5)
-- recupero la lavorazione
-- eseguo
local sCutType = EgtIf( bHead, 'HeadSide', 'TailSide')
local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', ''))
if not sCutting and bTopHead then
sCutting = ML.FindCutting( sCutType)
bDownHead = false
end
if not sCutting then
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dSawDiam = 400
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < BD.NZ_MINB)
-- per tutte le macchine tranne la Fast, controllo se ci sono tagli troppo inclinati e troppo profondi per la lama
-- in tal caso richiamo la lavorazione con fresa dal lato
if BD.C_SIMM and not bDownHead then
local sCutting = ML.FindCutting( sCutType, nil, bDownHead)
if not sCutting then
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
return false, sErr
end
end
-- verifico se necessari tagli supplementari
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
--DC.PrintOrderCut( vCuts)
if #vCuts > 0 then
-- aggiorno nome e info
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)
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- eseguo
for i = 1, #vCuts do
-- determino il modo di tagliare
local vtOrthOpp = vtN[nBigInd]
local vtNorm = vtN[nSmaInd]
if ( i % 2) ~= 1 then vtOrthOpp, vtNorm = vtNorm, vtOrthOpp end
-- lavoro la faccia
for j = 1, #vCuts[i] do
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthOpp, EgtIf( bDownHead, -2, nil), 0, 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, sCutType .. EgtIf( bDownHead, '_H2', ''), false, bDownHead)
if not bOk then
local _, _, dDimV1 = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
local _, _, dDimV2 = BL.GetFaceHvRefDim( Proc.Id, 1, b3Raw)
local bFace1TooLongForBlade, bFace2TooLongForBlade = ( dDimV1 >= dMaxDepth), ( dDimV2 >= dMaxDepth)
local dFace1Ang, dFace2Ang = vtN[1]:getZ(), vtN[2]:getZ()
if bFace1TooLongForBlade and dFace1Ang < ( BD.CUT_VZ_MIN or -0.484) or bFace2TooLongForBlade and dFace2Ang < ( BD.CUT_VZ_MIN or -0.484) then
local bOk, sErr = MakeBySidePocket( Proc, nPhase, nRawId, nPartId, nAddGrpId, b3Solid)
return bOk, sErr
end
end
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, false, bDownHead)
if not bOk then return bOk, sErr end
-- segnalazione ingombro di testa o coda
if Proc.Head then
-- intersezioni con linee a metà altezza appena dentro dal davanti e dal dietro
+16 -13
View File
@@ -1,5 +1,6 @@
-- ProcessDovetail.lua by Egaltech s.r.l. 2021/02/04
-- Gestione calcolo giunzione coda di rondine
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessDovetail = {}
@@ -226,7 +227,7 @@ local function AddFaceToSurf( Proc, nPartId, b3Solid)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -592,7 +593,7 @@ local function MachChainFacesByBlade( Proc, nCFaceSide, nCFaceInt1, nCFaceInt2,
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 50)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 50)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -656,7 +657,7 @@ local function MakeByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3So
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -836,7 +837,7 @@ local function MakeMillCut( Proc, i, j, k, sMilling,
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -1221,7 +1222,7 @@ local function Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
local nSCC = MCH_SCC.ADIR_YP
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -1380,7 +1381,7 @@ local function Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
end
---------------------------------------------------------------------
local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid)
local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, dOvmTail)
-- recupero la geometria ausiliaria
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
@@ -1389,7 +1390,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
-- recupero il centro e la normale della faccia ausiliaria
local ptC, vtN = EgtSurfTmFacetCenter( AuxId, 0, GDB_ID.ROOT)
if not vtN then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' wrong Normal of AuxSurface'
local sErr = 'Error : wrong Normal of AuxSurface'
EgtOutLog( sErr)
return false, sErr
end
@@ -1398,7 +1399,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
-- recupero la lavorazione per la geometria ausiliaria
local sCutting = ML.FindCutting( 'HeadSide')
if not sCutting then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
return false, sErr
end
@@ -1415,7 +1416,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -1427,7 +1428,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
return true
end
-- verifico se coincide con taglio di coda
if not bHead and AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
return true
end
-- inserisco la lavorazione
@@ -1710,7 +1711,9 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- in base al tipo di feature attribuisco il significato dei parametri Q
@@ -1735,7 +1738,7 @@ function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- se ha due facce ( allora è di testa o coda)
if Proc.Fct == 2 then
-- eventuale taglio di testa o coda
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid)
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, dOvmTail)
if not bAuxOk then return bAuxOk, sAuxErr end
-- lavorazione della feature
local bOk, sErr = Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, bForceUseRough)
@@ -1743,7 +1746,7 @@ function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- se ha 3 facce ed è di testa o coda
elseif Proc.Fct == 3 and ( Proc.Head or Proc.Tail) then
-- eventuale taglio di testa o coda
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid)
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, dOvmTail)
if not bAuxOk then return bAuxOk, sAuxErr end
-- lavorazione della feature
if bForceUseRough then
+162 -101
View File
@@ -1,9 +1,20 @@
-- ProcessDrill.lua by Egaltech s.r.l. 2021/10/29
-- ProcessDrill.lua by Egaltech s.r.l. 2022/08/18
-- Gestione calcolo forature per Travi
-- 2021/04/14 DS Corretta gestione Invert con testa da sotto. Migliorato calcolo ingombro portautensile.
-- 2021/05/03 DS Su macchina con testa da sotto aggiunta possibilità di fare fori verticali metà sopra e l'altra sotto.
-- 2021/09/19 DS Si premia il più possibile ricerca punta con adeguato affondamento.
-- 2021/10/29 DS MaxElev anche su fori con svuotatura.
-- 2022/03/26 DS Correzioni per fori testa-fianco nel piano.
-- 2022/03/29 DS Corretta assegnazione fori molto inclinati fianco/coda a coda.
-- 2022/04/21 DS Corretto riconoscimento fori di coda.
-- 2022/06/22 Nel riconoscimento fori di coda si utilizza ora il reale sovramateriale di coda (dOvmTail) invece di BD.OVM_MID.
-- 2022/07/01 Aggiunta gestione allungamento percorsi fori in caso di materiale già rimosso da lavorazioni precedenti
-- 2022/07/07 Aggiunta la gestione delle forature migliorate in presenza di feature testa/coda che tagliano tutta la sezione; gli Id delle feature sono nelle proprietà MachineAfterHeadCutId e MachineAfterTailCutId.
-- 2022/07/12 Aggiunto un valore minimo (10) per la distanza di sicurezza.
-- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati
-- 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/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.
-- Tabella per definizione modulo
local ProcessDrill = {}
@@ -52,9 +63,11 @@ end
---------------------------------------------------------------------
-- Verifica se feature di coda
function ProcessDrill.IsTailFeature( Proc, b3Raw)
function ProcessDrill.IsTailFeature( Proc, b3Raw, dOvmTail)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- verifico se è in coda
if Proc.Box:getMin():getX() > b3Raw:getMin():getX() + BD.OVM_MID + BD.MAX_DIST_HTFEA then
if Proc.Box:getMin():getX() > b3Raw:getMin():getX() + dOvmTail + BD.MAX_DIST_HTFEA then
return false
end
-- recupero e verifico l'entità foro
@@ -65,8 +78,8 @@ function ProcessDrill.IsTailFeature( Proc, b3Raw)
end
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
-- se entrata principale
if Proc.Flg == 2 or ( Proc.Flg == 1 and vtExtr:getZ() >= BD.DRILL_VZ_MIN) then
local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0
local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0
if ( Proc.Flg == 2 or ( Proc.Flg == 1 and vtExtr:getZ() >= BD.DRILL_VZ_MIN)) and ( nFcs == 5 or nFcs == 6 or abs( vtExtr:getX()) < BD.DRILL_VX_MAX) then
return ( ( nFcs == 5 or nFcs == 6) and vtExtr:getX() < -0.5)
-- altrimenti entrata opposta
else
@@ -107,7 +120,7 @@ function ProcessDrill.Split( Proc, b3Raw)
local dDiam = 2 * EgtArcRadius( AuxId)
local dLen = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local bOpen = ( Proc.Fce ~= 0)
local bOpen = ( Proc.Fce ~= 0) and ( Proc.Fce ~= Proc.Fcs)
-- recupero flag abilitazione split (0=auto,1=no)
local bTrySplit = ( EgtGetInfo( Proc.Id, 'Q02', 'i') ~= 1)
if not bTrySplit then
@@ -117,7 +130,7 @@ function ProcessDrill.Split( Proc, b3Raw)
local bHoriz = ( abs( vtExtr:getZ()) < abs( BD.DRILL_VZ_MIN) and
( abs( vtExtr:getY()) * b3Raw:getDimZ() > abs( vtExtr:getZ()) * b3Raw:getDimY() or Proc.Fce == 5 or Proc.Fce == 6))
local bSlant = ( abs( vtExtr:getX()) > BD.DRILL_VX_MAX)
return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD) and not bSlant)
return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD or BD.TURN) and not bSlant)
end
---------------------------------------------------------------------
@@ -146,22 +159,56 @@ function ProcessDrill.Classify( Proc, b3Raw)
return false, false, false
end
local bOpen = ( Proc.Fce ~= 0)
local bFaceDown = ( ptCen:getZ() < b3Raw:getMin():getZ() + 2 and (( not Proc.Head and not Proc.Tail) or (( BD.ROT90 or BD.DOWN_HEAD) and ( Proc.Flg == 2 or Proc.Flg == -2))))
local bFaceDown = ( ptCen:getZ() < b3Raw:getMin():getZ() + 2 and (( not Proc.Head and not Proc.Tail) or (( BD.ROT90 or BD.DOWN_HEAD or BD.TURN) and ( Proc.Flg == 2 or Proc.Flg == -2))))
-- verifico se il foro è sotto e quindi va spostato o sopra o sul fianco
if (( vtExtr:getZ() < BD.DRILL_VZ_MIN or bFaceDown) and ( not bOpen or Proc.Flg ~= 1)) then
if not bOpen then
return true, true, false
else
return true, not ( BD.ROT90 or BD.DOWN_HEAD), ( BD.ROT90 or BD.DOWN_HEAD)
return true, not ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN), ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN)
end
else
return true, false, false
end
end
---------------------------------------------------------------------
-- Funzione per riconoscimento faccia inizio foro e dati correlati
-- Indice faccia :1=Front, 2=Bottom, 3=Back, 4=Top, 5=Left, 6=Right
local function GetHoleStartData( ptCen, vtExtr, b3Solid)
-- Facce della trave
local vFaces = { { Dist = -b3Solid:getMin():getY(), Norm = -Y_AX()},
{ Dist = -b3Solid:getMin():getZ(), Norm = -Z_AX()},
{ Dist = b3Solid:getMax():getY(), Norm = Y_AX()},
{ Dist = b3Solid:getMax():getZ(), Norm = Z_AX()},
{ Dist = -b3Solid:getMin():getX(), Norm = -X_AX()},
{ Dist = b3Solid:getMax():getX(), Norm = X_AX()}}
-- Ricerca della faccia di inizio
local nFac = 0
local dCosMin = 0.0871
for i = 1, 6 do
if ( ptCen - ORIG()) * vFaces[i].Norm - vFaces[i].Dist > -2 then
local dCos = vtExtr * vFaces[i].Norm
if dCos > dCosMin then
nFac = i
dCosMin = dCos
if dCos > 0.7072 then break end
end
end
end
-- Coseno angolo dalla faccia
local CosB = 0
if nFac ~= 0 then
CosB = sqrt( 1 - sqr( vtExtr * vFaces[nFac].Norm))
end
return nFac, CosB, vFaces
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- default per costanti
BD.DRILL_VX_MAX_ANGLEDRILL = ( BD.DRILL_VX_MAX_ANGLEDRILL or 0.928)
-- ingombro del pezzo
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
@@ -180,19 +227,34 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- recupero i dati del foro
local dDiam = 2 * EgtArcRadius( AuxId)
local dLen = abs( EgtCurveThickness( AuxId))
local ptCen = EgtCP( AuxId, GDB_RT.GLOB)
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
if Proc.Flg == -2 then vtExtr = - vtExtr end
if Proc.Flg == -2 then
ptCen = ptCen - vtExtr * dLen
vtExtr = - vtExtr
end
local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0)
-- verifico possibilità di foratura da sotto
local bDownDrill = ( BD.DOWN_HEAD and ML.FindDrilling( dDiam, nil, false, true))
-- verifico che il foro non sia fattibile solo da sotto
local bToInvert = ( vtExtr:getZ() < BD.DRILL_VZ_MIN) and not BD.DOWN_HEAD
local bToInvert = ( vtExtr:getZ() < BD.DRILL_VZ_MIN and not bDownDrill)
if bToInvert and ( not bOpen or Proc.Flg ~= 1) then
local sErr = 'Error : drilling from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- se il foro è cieco all'inizio, lo inverto
if Proc.Fcs == 0 then bToInvert = true end
if bToInvert then vtExtr = - vtExtr end
-- se non già richiesta inversione e invertibile
if not bToInvert and Proc.Flg == 1 and ( -vtExtr:getZ() >= BD.DRILL_VZ_MIN or bDownDrill) then
-- se il foro è cieco o troppo inclinato all'inizio, lo inverto
local _, CosB, _ = GetHoleStartData( ptCen, vtExtr, b3Solid)
if Proc.Fcs == 0 or ( CosB > BD.DRILL_VX_MAX and bOpen) then
bToInvert = true
end
end
if bToInvert then
ptCen = ptCen - vtExtr * dLen
vtExtr = - vtExtr
end
-- se foro è splittato ed è la parte opposta, inverto
if Proc.Flg == -2 then bToInvert = true end
-- profondità geometrica del foro
@@ -205,20 +267,13 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
local dCheckDepth2 = dDepth2
local nErrorCode = 0
-- abilitazione foratura da sotto
local bDrillDown = ( BD.DOWN_HEAD and ( Proc.Down or vtExtr:getZ() < -0.1 or vtExtr:getZ() < 0.259))
local bDrillUp = ( BD.DOWN_HEAD and 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)
-- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante
-- recupero la lavorazione
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillDown)
if not sDrilling and bDrillUp then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth)
end
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown)
if not sDrilling and dCheckDepth then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillDown)
if sDrilling then dCheckDepth = nil end
end
if not sDrilling and bDrillUp and dCheckDepth then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0)
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown)
if sDrilling then dCheckDepth = nil end
end
if not sDrilling then
@@ -232,10 +287,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
nErrorCode = 2
-- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto)
else
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillDown)
if not sDrilling and bDrillUp then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0)
end
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown)
if not sDrilling then
nErrorCode = 1
elseif dMaxToolLength > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then
@@ -247,16 +299,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- recupero la lavorazione
local sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2
if dDepth2 > dDepth + BD.DRILL_OVERLAP then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2, bDrillDown)
if not sDrilling2 and bDrillUp then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2)
end
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2, bDrillUp, bDrillDown)
if not sDrilling2 and dCheckDepth2 then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillDown)
if sDrilling2 then dCheckDepth2 = nil end
end
if not sDrilling2 and bDrillUp and dCheckDepth2 then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0)
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown)
if sDrilling2 then dCheckDepth2 = nil end
end
if not sDrilling2 then
@@ -270,10 +315,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
nErrorCode = 2
-- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto)
else
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillDown)
if not sDrilling2 and bDrillUp then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0)
end
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown)
if not sDrilling2 then
nErrorCode = 1
elseif dMaxToolLength2 > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then
@@ -288,6 +330,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
local bCommonCompare = BD.MAX_TOOL_LEN_BACK_HOR_MACH and bOpen and abs(vtExtr:getX()) < 0.5 and abs(vtExtr:getZ()) < 0.5
if nErrorCode == 0 and not bToInvert and bCommonCompare and vtExtr:getY() > 0.866 and Proc.Flg == 1 and dMaxToolLength > BD.MAX_TOOL_LEN_BACK_HOR_MACH then
bToInvert = true
ptCen = ptCen - vtExtr * dLen
vtExtr = - vtExtr
---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -306,8 +349,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
dToolFreeLen = dToolFreeLen2
dDepth = dDepth2
if vtExtr:getY() > 0 then
bToInvert = true
vtExtr = - vtExtr
bToInvert = true
ptCen = ptCen - vtExtr * dLen
vtExtr = - vtExtr
end
-- se sono al secondo mezzo foro con utensile che supera la lunghezza di riferimento non lo eseguo
elseif nErrorCode == 0 and bCommonCompare and abs(vtExtr:getY()) > 0.866 and Proc.Flg == -2 and dMaxToolLength2 > BD.MAX_TOOL_LEN_BACK_HOR_MACH then
@@ -322,52 +366,68 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
EgtOutLog( sErr)
return false, sErr
end
local dSubL1 = 0
local dSubL2 = 0
local dSubL3 = 0
local dDeltaRad = ( Proc.Diam - dToolDiam) / 2
-- se foro non su testa o coda e inclinato, limito il massimo affondamento
local bInMid = false
local bInvertFcse = ( bToInvert and Proc.Flg ~= -2)
if ( not bInvertFcse and Proc.Fcs ~= 5 and Proc.Fcs ~= 6) or ( bInvertFcse and Proc.Fce ~= 5 and Proc.Fce ~= 6) then
bInMid = true
local CosB = abs( vtExtr:getX())
if CosB < BD.DRILL_VX_MAX then
local TgA = CosB / sqrt( 1 - CosB * CosB)
dSubL1 = ( dDiamTh / 2 + dDeltaRad + 2) * TgA
else
dMaxDepth = 0
-- Determino la faccia di inizio del foro e dati correlati
local nFac, CosB, vFaces = GetHoleStartData( ptCen, vtExtr, b3Solid)
-- Calcolo acciorciamento affondamento utile per evitare collisione portautensile con faccia
local TgA = CosB / sqrt( 1 - CosB * CosB)
local dSubL = ( dDiamTh / 2 + ( Proc.Diam - dToolDiam) / 2 + 2) * TgA
-- Per fori molto inclinati ( < 30 gradi) si usa la testa della macchina per l'accorciamento. Fast esclusa
if BD.C_SIMM and CosB > 0.866 then
dSubL = ( 190 / 2 + ( Proc.Diam - dToolDiam) / 2 + 2) * TgA - 96
end
local dMaxDepthOri = dMaxDepth
dMaxDepth = min( dMaxDepth, max( dToolFreeLen - dSubL, 0))
-- Verifico inclinazione foro nei limiti
local bTryDrill = EgtIf( dMaxDepth > 0, ( CosB < BD.DRILL_VX_MAX), false)
if ( CosB > 0.8 * BD.DRILL_VX_MAX and CosB < BD.DRILL_VX_MAX_ANGLEDRILL) then
-- cerco le forature speciali AngleDrill
local sDrilling3, sType3, dMaxDepth3 = ML.FindAngleDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown)
if sDrilling3 then
sDrilling = sDrilling3
sType = sType3
dMaxDepth = dMaxDepth3
bTryDrill = true
end
end
-- se foro davanti o dietro e inclinato, limito il massimo affondamento
if dMaxDepth > 0 and abs( vtExtr:getY()) > abs( vtExtr:getZ()) then
local CosB = abs( vtExtr:getZ())
if bInMid then
CosB = sqrt( vtExtr:getZ() * vtExtr:getZ() + vtExtr:getX() * vtExtr:getX())
end
if CosB < BD.DRILL_VX_MAX then
local TgA = CosB / sqrt( 1 - CosB * CosB)
dSubL2 = ( dDiamTh / 2 + dDeltaRad + 2) * TgA
else
dMaxDepth = 0
-- aggiusto affondamento e MaxElev
local dMaxElev
local sMyWarn
-- 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
local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB)
if bIntersectionOk then
local dHoleToCutDistance = vDistance[1]
-- se il taglio accorcia realmente il foro
if dHoleToCutDistance > 10 * GEO.EPS_SMALL and dHoleToCutDistance < dLen then
dMaxDepth = dMaxDepthOri
dMaxElev = dLen - dHoleToCutDistance
bTryDrill = true
local dToolAddLength = dLen - dMaxElev
-- se l'utensile è comunque troppo corto lavoro il massimo possibile
if dDepth - dToolAddLength > dMaxDepth + 10 * GEO.EPS_SMALL then
sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth - dToolAddLength, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
dDepth = dLen
else
-- se è un foro splittato cerco comunque di arrivare alla massima profondità possibile, evitando di sfondare dall'altro lato.
if Proc.Flg == 2 or Proc.Flg == -2 then
dDepth = dLen - 10
end
-- se non lavoro la massima lunghezza disponibile devo correggere MaxElev
dMaxElev = dMaxElev - dLen + dDepth
end
end
end
end
-- se foro sopra o sotto e inclinato, limito il massimo affondamento
if dMaxDepth > 0 and abs( vtExtr:getZ()) > abs( vtExtr:getY()) then
local CosB = abs( vtExtr:getY())
if bInMid then
CosB = sqrt( vtExtr:getY() * vtExtr:getY() + vtExtr:getX() * vtExtr:getX())
end
if CosB < BD.DRILL_VX_MAX then
local TgA = CosB / sqrt( 1 - CosB * CosB)
dSubL3 = ( dDiamTh / 2 + dDeltaRad + 2) * TgA
else
dMaxDepth = 0
end
end
local dSubL = max( dSubL1, dSubL2, dSubL3)
if dMaxDepth > 0 then
dMaxDepth = min( dMaxDepth, dToolFreeLen - dSubL)
-- se foro da saltare per eccessiva inclinazione
if not bTryDrill then
sMyWarn = 'Warning in drill : too slant hole'
dDepth = 0
return true, sMyWarn
-- se non ridotto e affondamento richiesto supera il consentito
elseif not dMaxElev and dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then
sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
dDepth = dMaxDepth
dMaxElev = dMaxDepth
end
-- inserisco la lavorazione
local sName = 'Drill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -380,14 +440,14 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- eventuale inversione
if sType == 'Drill' or sType == 'Drill_H2' then
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then
EgtSetMachiningParam( MCH_MP.INVERT, bToInvert)
else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert)
end
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
if not BD.C_SIMM and not BD.TURN then
nSCC = MCH_SCC.ADIR_YM
if AreSameVectorApprox( vtExtr, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM
@@ -402,20 +462,21 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
nSCC = MCH_SCC.NONE
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- aggiusto l'affondamento
local sMyWarn
if dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then
sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
dDepth = dMaxDepth
EgtOutLog( sMyWarn)
end
-- imposto affondamento
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.
local dToolDbStartPos = EgtGetMachiningParam( MCH_MP.STARTPOS)
local dMinStartPos = 10
local dStartPos = max( dMinStartPos, dToolDbStartPos)
EgtSetMachiningParam( MCH_MP.STARTPOS, dStartPos)
-- Note utente con dichiarazione nessuna generazione sfridi per Vmill
local sUserNotes = 'VMRS=0;'
-- aggiungo alle note massima elevazione (coincide con affondamento)
sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dDepth, 1) .. ';'
if dMaxElev then
sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';'
end
-- se foro passante, aggiungo questa qualifica alle note
if ( sType == 'Drill' or sType == 'Drill_H2') and bOpen then
if ( sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill') and bOpen then
sUserNotes = sUserNotes .. 'Open=1;'
end
-- se lavorazione in doppio
@@ -426,14 +487,14 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
local bOk = EgtApplyMachining( true, false)
if not bOk and BD.DOWN_HEAD then
if sType == 'Drill' or sType == 'Drill_H2' then
local bOk = ML.ApplyMachining( true, false)
if not bOk and bDownDrill then
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then
EgtSetMachiningParam( MCH_MP.INVERT, true)
else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
end
bOk = EgtApplyMachining( true, false)
bOk = ML.ApplyMachining( true, false)
end
if not bOk then
local _, sErr = EgtGetLastMachMgrError()
+87 -22
View File
@@ -1,10 +1,13 @@
-- ProcessDtMortise.lua by Egaltech s.r.l. 2021/12/01
-- ProcessDtMortise.lua by Egaltech s.r.l. 2022/08/18
-- Gestione calcolo mortase a coda di rondine per Travi
-- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa.
-- 2021/04/08 Miglioria scelta lavorazione in presenza di testa da sotto.
-- 2021/06/28 Aggiunta gestione attacco e uscita con pocket.
-- 2021/07/20 Aggiunta gestione rinvio angolare su FAST.
-- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda).
-- 2022/06/01 Modifiche per evitare di entrare nel legno con mortase parziali.
-- 2022/08/18 Migliorato calcolo dello step.
-- 2022/09/29 Aggiunto riconoscimento della sola feature laterale.
-- Tabella per definizione modulo
local ProcessDtMortise = {}
@@ -37,6 +40,12 @@ function ProcessDtMortise.FrontIdentify( Proc)
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 56)
end
---------------------------------------------------------------------
-- Riconoscimento della sola feature laterale
function ProcessDtMortise.SideIdentify( Proc)
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 55)
end
---------------------------------------------------------------------
-- Verifica se feature di coda
function ProcessDtMortise.IsTailFeature( Proc, b3Raw)
@@ -59,6 +68,10 @@ end
---------------------------------------------------------------------
-- Classificazione della feature
function ProcessDtMortise.Classify( Proc)
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
return true
end
-- recupero i dati della curva di contorno della faccia di fondo
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if not AuxId then return false end
@@ -91,8 +104,9 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol
local NewAuxId = EgtCopyGlob( AuxId, nAddGrpId)
if not NewAuxId then return end
-- ne allungo gli estremi
EgtExtendCurveStartByLen( NewAuxId, 100)
EgtExtendCurveEndByLen( NewAuxId, 100)
EgtAddCurveCompoLineTg( NewAuxId, 100, false)
EgtAddCurveCompoLineTg( NewAuxId, 100, true)
EgtMergeCurvesInCurveCompo( NewAuxId)
-- eseguo traslazione e offset per portarla sul top
local vtMove = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) * ( dAltMort - 10 * GEO.EPS_SMALL)
EgtMove( NewAuxId, vtMove, GDB_RT.GLOB)
@@ -118,6 +132,21 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol
return NewAuxId
end
---------------------------------------------------------------------
-- verifica che il box includa il punto in XY
function EnclosesPoint( b3Box, ptP)
if b3Box[2][1] < ptP[1] - GEO.EPS_SMALL or b3Box[1][1] > ptP[1] + GEO.EPS_SMALL then
return false
end
if b3Box[2][2] < ptP[2] - GEO.EPS_SMALL or b3Box[1][2] > ptP[2] + GEO.EPS_SMALL then
return false
end
if b3Box[2][3] < ptP[3] - GEO.EPS_SMALL or b3Box[1][3] > ptP[3] + GEO.EPS_SMALL then
return false
end
return true
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
@@ -141,15 +170,18 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local ptBC = EgtGP( AuxId, GDB_RT.GLOB)
-- verifico che la mortasa non sia orientata verso il basso (-5 deg) o che ci sia una testa da sotto o un rinvio angolare
local bFaceDown = ( vtExtr:getZ() < -0.1)
if bFaceDown and not BD.DOWN_HEAD and not BD.ANG_TRASM then
if bFaceDown and not BD.DOWN_HEAD and not BD.TURN and not BD.ANG_TRASM then
local sErr = 'Machining from bottom impossible : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
-- determino l'altezza della mortasa (0=faccia di fondo)
local rfDtMrt = Frame3d( ptBC, vtExtr)
local rfDtMrt, dLenMrt, dWidthMrt = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_RT.GLOB)
local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt)
local dAltMort = b3DtMrt:getDimZ()
-- ne determino l'asse (valido se non pocket)
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
vtAx:normalize()
-- verifico se di tipo pocket
local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1)
if bPocket then bMakeAntiSplitPath = false end
@@ -201,9 +233,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
sMchExt = '_AT'
end
-- recupero la lavorazione : prima ricerca per sola tipologia
local sMilling = ML.FindMilling( sMillType..sMchExt)
local sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType)
sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
end
if not sMilling then
local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id)
@@ -211,9 +243,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr
end
-- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo
sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad)
sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown)
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad)
sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown)
sMchExt = ''
end
if not sMilling then
@@ -260,14 +292,14 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
-- recupero la lavorazione
local sPocketing
sPocketing = ML.FindPocketing( 'Mortise'..sMchExt, dToolDiam)
sPocketing = ML.FindPocketing( 'Mortise'..sMchExt, dToolDiam, nil, nil, bMillUp, bMillDown)
if not sPocketing and bMillUp then
sPocketing = ML.FindPocketing( 'Mortise', dToolDiam)
sPocketing = ML.FindPocketing( 'Mortise', dToolDiam, nil, nil, bMillUp, bMillDown)
end
if not sPocketing then
sPocketing = ML.FindPocketing( 'Pocket'..sMchExt, dToolDiam)
sPocketing = ML.FindPocketing( 'Pocket'..sMchExt, dToolDiam, nil, nil, bMillUp, bMillDown)
if not sPocketing and bMillUp then
sPocketing = ML.FindPocketing( 'Pocket', dToolDiam)
sPocketing = ML.FindPocketing( 'Pocket', dToolDiam, nil, nil, bMillUp, bMillDown)
end
end
if not sPocketing then
@@ -289,18 +321,27 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
-- eventuale calcolo SCC
local nSCC
if BD.TURN and not bPocket then
if abs( vtAx:getY()) > abs( vtAx:getZ()) then
nSCC = EgtIf( vtAx:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else
nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
end
end
-- se parametro interno abilitato e il percorso non è chiuso, aggiungo percorso e lavorazione antischeggia
if bMakeAntiSplitPath and not EgtCurveIsClosed( AuxId) then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -345,7 +386,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
nId1 = EgtArc2PV( nAddGrpId, ptStart, ptEnd, vtTg, GDB_RT.GLOB)
end
if not nId1 then
local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id)
local sErr = 'Wrong geometry : Error on DtMortise '
EgtOutLog( sErr)
return false, sErr
end
@@ -367,11 +408,15 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- sistemo il lato e la direzione di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true))
-- se necessario, imposto SCC
if nSCC then
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
end
-- dichiaro non si generano sfridi per VMill
local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -389,13 +434,12 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
-- verifico se necessarie più passate (distanza all'imbocco ortogonale all'asse)
local vtDiff = EgtEP( AuxId, GDB_RT.GLOB) - EgtSP( AuxId, GDB_RT.GLOB)
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
vtAx:normalize()
local vtOrtDiff = vtDiff - vtDiff * vtAx * vtAx
local dDist = vtOrtDiff:len()
local dDist = min( vtOrtDiff:len(), dWidthMrt)
-- calcolo le passate
local nPass = ceil( dDist / ( 1.9 * dToolDiam))
local dStep = ( dDist - 0.95 * dToolDiam) / ( 2 * nPass)
local dStep = 0
if nPass > 1 then dStep = max( ( dDist - 2 * dToolDiam) / ( 2 * nPass - 2), 0.25 * dToolDiam) end
for i = nPass, 1, -1 do
-- inserisco la lavorazione di contornatura
local sNameF = 'DtMt_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nPass)
@@ -423,12 +467,33 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2)
EgtSetMachiningParam( MCH_MP.LIPERP, 5)
EgtSetMachiningParam( MCH_MP.LIELEV, 0)
-- altrimenti verifico se sono bilanciati ingresso e uscita, per evitare inizio o fine nel legno
else
local ptS = EgtSP( AuxId, GDB_ID.ROOT)
local ptE = EgtEP( AuxId, GDB_ID.ROOT)
local dDistS = abs( ( ptS - rfDtMrt:getOrigin()) * rfDtMrt:getVersX())
local dDistE = abs( ( ptE - rfDtMrt:getOrigin()) * rfDtMrt:getVersX())
local dIni, dFin = EgtCurveDomain( AuxId)
local nCrvCnt = dFin - dIni - 1
if abs( dDistS - dDistE) > 20 then
local b3Test = BBox3d( b3Solid)
b3Test:expand( -5)
if dDistS < dDistE and EnclosesPoint( b3Test, ptS) and EgtCurveCompoAngCenter( AuxId, 0) == 0 then
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dDistE - dDistS)
elseif dDistE < dDistS and EnclosesPoint( b3Test, ptE) and EgtCurveCompoAngCenter( AuxId, nCrvCnt) == 0 then
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dDistS - dDistE)
end
end
end
-- se necessario, imposto SCC
if nSCC then
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
end
-- dichiaro non si generano sfridi per VMill
local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
+34 -18
View File
@@ -1,6 +1,7 @@
-- ProcessTenon.lua by Egaltech s.r.l. 2021/12/22
-- ProcessTenon.lua by Egaltech s.r.l. 2022/06/07
-- Gestione calcolo tenone a coda di rondine per Travi
-- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa.
-- 2022/04/14 Aumentati un poco i limiti di orientamento verso il basso per FAST e PF.
-- Tabella per definizione modulo
local ProcessDtTenon = {}
@@ -19,32 +20,41 @@ local ML = require( 'MachiningLib')
---------------------------------------------------------------------
local function VerifyOrientation( Proc, vtN, b3Raw)
-- se PF con testa da sotto, ammessa qualunque orientazione
if BD.C_SIMM and BD.DOWN_HEAD then
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
return true
end
-- se trave molto bassa
if b3Raw:getDimZ() <= 120 then
if b3Raw:getDimZ() < 121 then
-- se tenone praticamente in asse, accetto fino a -45 deg
if abs( vtN:getY()) < 0.04 then
if abs( vtN:getY()) < 0.088 then
return ( vtN:getZ() >= -0.7072)
-- altrimenti accetto fino a -30deg
else
return ( vtN:getZ() >= -0.51)
end
-- se trave bassa
elseif b3Raw:getDimZ() <= 200 then
elseif b3Raw:getDimZ() < 201 then
-- se tenone praticamente in asse, accetto fino a -30 deg
if abs( vtN:getY()) < 0.04 then
if abs( vtN:getY()) < 0.088 then
return ( vtN:getZ() >= -0.51)
-- altrimenti accetto fino a -20deg
-- altrimenti accetto fino a -21deg
else
return ( vtN:getZ() >= -0.343)
return ( vtN:getZ() >= -0.359)
end
-- se trave medio-bassa
elseif b3Raw:getDimZ() < 281 then
-- se tenone praticamente in asse, accetto fino a -25 deg
if abs( vtN:getY()) < 0.088 then
return ( vtN:getZ() >= -0.422)
-- altrimenti, accetto fino a -15 deg
else
return ( vtN:getZ() >= -0.259)
end
-- se trave media
elseif b3Raw:getDimZ() <= 350 then
elseif b3Raw:getDimZ() < 351 then
-- se tenone praticamente in asse, accetto fino a -22 deg
if abs( vtN:getY()) < 0.04 then
if abs( vtN:getY()) < 0.088 then
return ( vtN:getZ() >= -0.375)
-- altrimenti, accetto fino a -10 deg
else
@@ -102,7 +112,7 @@ local function ApplyPocket( Proc, sPocketing, nStep, dSurfStep, nIdSurf, vtExtr)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -150,6 +160,9 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
-- porto inizio curva a Zmax
BL.PutStartOnTop( AuxId)
-- ne determino l'asse
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
vtAx:normalize()
-- se tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa
if not AreSameOrOppositeVectorApprox( vtN, X_AX()) or
( Proc.Box:getMax():getX() < b3Raw:getMax():getX() - dOvmHead - 100 * GEO.EPS_SMALL and
@@ -222,10 +235,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
-- recupero la lavorazione
local sMillType = 'DtTenon'
local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''))
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType)
end
local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
@@ -295,7 +305,13 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
if BD.TURN then
if abs( vtAx:getY()) > abs( vtAx:getZ()) then
nSCC = EgtIf( vtAx:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else
nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
end
elseif not BD.C_SIMM then
nSCC = MCH_SCC.ADIR_YM
if abs( vtExtr:getY()) > 0.088 then
nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
@@ -303,7 +319,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchRId, false)
return false, sErr
+193 -30
View File
@@ -1,5 +1,10 @@
-- ProcessFreeContour.lua by Egaltech s.r.l. 2021/10/07
-- ProcessFreeContour.lua by Egaltech s.r.l. 2022/11/03
-- Gestione calcolo profilo libero per Travi
-- 2022/08/23 Aggiunta la funzione MakeByMark per la gestione del caso P13=10
-- 2022/09/21 In MakeByMill aggiunto messaggio per elevazione non raggiunta.
-- 2022/11/03 In MakeByMill migliorata gestione lavorazione con fresa su testa da sotto.
-- 2022/11/09 Aggiunta la gestione della chiamata della FreeContour da parte della SimpleScarf.
-- Tabella per definizione modulo
local ProcessFreeContour = {}
@@ -116,7 +121,7 @@ function ProcessFreeContour.Classify( Proc, b3Raw)
end
---------------------------------------------------------------------
local function VerifyChamfer( Proc, AuxId, nRawId, bMakeVertCham)
local function VerifyChamfer( Proc, AuxId, nRawId, bMakeVertCham, bDownHead)
local nChamfer = 0
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
@@ -156,7 +161,11 @@ local function VerifyChamfer( Proc, AuxId, nRawId, bMakeVertCham)
-- recupero la lavorazione
local sMilling
if nChamfer > 0 then
sMilling = ML.FindMilling( 'Mark')
if bDownHead then
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
else
sMilling = ML.FindMilling( 'Mark')
end
if not sMilling then
local sErr = 'Error : Mark not found in library'
EgtOutLog( sErr)
@@ -233,19 +242,22 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
local dDepth = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local b3Aux = EgtGetBBoxGlob( AuxId, GDB_BB.STANDARD)
local bToolInv = ( vtExtr:getZ() < -0.1)
local bDown = ( b3Aux:getMin():getZ() < b3Raw:getMin():getZ() + 5)
-- verifico se in testa o coda
local bHead = Proc.Head
-- verifico i parametri Q per profondità smusso e per eseguirlo in esclusiva
local nChamfer, dDepthCham, sChamfer = VerifyChamfer( Proc, AuxId, nRawId, true)
-- recupero la lavorazione
local sMilling = ML.FindMilling( 'FreeContour')
-- recupero la lavorazione
local bTopHead = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.1)
local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
local sMilling, _, _, bH2 = ML.FindMilling( 'FreeContour', nil, nil, nil, nil, bTopHead, bDownHead)
if not sMilling then
local sErr = 'Error : FreeContour not found in library'
EgtOutLog( sErr)
return false, sErr
end
bDownHead = ( bDownHead and bH2)
local bToolInv = ( not bDownHead and vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
-- recupero i dati dell'utensile
local dToolDiam = 10
local dMaxDepth = 0
@@ -294,24 +306,29 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
local dOriDepth = dDepth
local nDouble = 1
local bCanDouble = ( abs( vtExtr:getY()) > abs( vtExtr:getZ()) and bCross)
local bCanDouble = ( abs( vtExtr:getY()) > abs( vtExtr:getZ()) and bCross) or ( BD.DOWN_HEAD and bCross)
local dDimStrip = BD.DIM_STRIP
if dDimStrip < 0 then
dDimStrip = EgtGetInfo( Proc.Id, Q_DIM_STRIP, 'd') or 0
end
local bStripOnSide = false
if bCross then
if dDimStrip > 10 * GEO.EPS_SMALL and ( nStep > 1 or ( bDown and b3Aux:getDimX() > 0.5 * b3Raw:getDimX())) then
-- se chiamata da SimpleScarf il codolo è sempre attivo
if dDimStrip > 10 * GEO.EPS_SMALL and ( nStep > 1 or ( bDown and b3Aux:getDimX() > 0.5 * b3Raw:getDimX()) or Proc.Prc == 70) then
-- devo lasciare un codolo
dDepth = dDepth - dDimStrip
local dExtraCham = EgtIf( nChamfer > 0, 2, 0)
dDepth = EgtIf( Proc.Prc == 70, dDepth - dDimStrip - dDepthCham - dExtraCham, dDepth - dDimStrip)
bStripOnSide = true
else
-- devo affondare un poco oltre
dDepth = dDepth + BD.CUT_EXTRA
end
end
local bIsDepthReduced = false
-- se parametro beamdata forza codolo in centro e lavorazione orizzontale e se larghezza trave è sufficientemente larga
if BD.DIM_TO_CENTER_STRIP and BD.DIM_TO_CENTER_STRIP > 10 * GEO.EPS_SMALL and nStep > 1 and
-- se chiamata da SimpleScarf il codolo è sempre attivo
local dDepthWork = dDepth
if BD.DIM_TO_CENTER_STRIP and BD.DIM_TO_CENTER_STRIP > 10 * GEO.EPS_SMALL and ( nStep > 1 or Proc.Prc == 70) and
bCanDouble and b3Raw:getDimY() > BD.DIM_TO_CENTER_STRIP - 0.1 then
nDouble = 2
dDepth = min( ( b3Raw:getDimY() - dDimStrip) * 0.5, dMaxDepth)
@@ -320,12 +337,23 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
if dDepth > dMaxDepth then
if bCanDouble then
nDouble = 2
dDepth = min( 0.5 * dDepth, dMaxDepth)
dDepthWork = 0.5 * dDepth
dDepth = min( dDepthWork, dMaxDepth)
if dDepth < dDepthWork - 10 * GEO.EPS_SMALL then
bIsDepthReduced = true
end
else
dDepth = dMaxDepth
bIsDepthReduced = true
end
end
end
local sWarn = ''
-- se ho ridotto l'altezza emetto warning
if bIsDepthReduced then
sWarn = 'Warning in process ' .. tostring( Proc.Id) .. ' (Free Contour) : depth (' .. EgtNumToString( dDepthWork, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
end
-- se utensile orizzontale verso Y+, non in doppio e codolo da lasciare, devo invertire per lavorare sempre da Y-
if vtExtr:getY() > 0.707 and nDouble == 1 and bStripOnSide then
bToolInv = true
@@ -336,14 +364,33 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
local dEndAddSpec = 0
if Proc.Grp ~= 0 then dEndAddSpec = CalcSpecialAdd( AuxId, false, dToolDiam) end
-- se devo inserire il chamfer
if nChamfer > 0 and Proc.Grp ~= 0 and dOriDepth > dDepthCham then
if nChamfer > 0 and Proc.Grp ~= 0 and dOriDepth > dDepthCham and Proc.Prc ~= 70 then
local bDoubleCham = false
local dExtra = 2
local sChamferDown, sChamferUp
if nDouble > 1 and bCanDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
_, _, sChamferDown = VerifyChamfer( Proc, AuxId, nRawId, true, true)
if not sChamferDown then
sWarn = 'Warning : chamfer from bottom not found in library'
EgtOutLog( sWarn)
end
end
_, _, sChamferUp = VerifyChamfer( Proc, AuxId, nRawId, true, false)
if not sChamferUp then
sWarn = 'Warning : milling not found in library'
EgtOutLog( sWarn)
end
end
end
-- eseguo
for i = 1, nStep do
-- inserisco la lavorazione
local sNameCh = 'Cham_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sNameCh, sChamfer)
local sChamferSide1 = EgtIf( bDownHead, sChamferDown, sChamfer)
local nMchId = EgtAddMachining( sNameCh, sChamferSide1)
if not nMchId then
local sErr = 'Error adding machining ' .. sNameCh .. '-' .. sChamfer
EgtOutLog( sErr)
@@ -352,15 +399,12 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- se lavorazione da sopra o da sotto
if nSide ~= 0 then
bDoubleCham = true
end
if Proc.Grp == 3 then
if not bToolInv then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
EgtSetMachiningParam( MCH_MP.INVERT, true)
else
if vtExtr:getZ() < 0 then
if not bDownHead and vtExtr:getZ() < 0 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, true)
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
@@ -375,7 +419,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
EgtSetMachiningParam( MCH_MP.INVERT, true)
else
if vtExtr:getZ() < 0 then
if not bDownHead and vtExtr:getZ() < 0 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
EgtSetMachiningParam( MCH_MP.INVERT, true)
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
@@ -384,6 +428,11 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
end
end
if nSide == 0 then
bDoubleCham = BD.DOWN_HEAD
else
bDoubleCham = true
end
-- assegno affondamento e offset radiale
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthCham + dExtra)
EgtSetMachiningParam( MCH_MP.OFFSR, dExtra)
@@ -418,17 +467,24 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
-- se lavorazione da due parti, aggiungo la seconda
if bDoubleCham then
-- inserisco la lavorazione
local sName = 'ChamB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sChamfer)
local sChamferSide2
if EgtEndsWith( sChamferSide1, 'H2') then
sChamferSide2 = sChamferUp
elseif nSide == 0 then
sChamferSide2 = sChamferDown
else
sChamferSide2 = sChamfer
end
nMchId = EgtAddMachining( sName, sChamferSide2)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sChamfer
EgtOutLog( sErr)
@@ -479,7 +535,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -489,6 +545,26 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
-- verifico se devo fare sgrossatura più finitura
local dOffsetPar = EgtGetInfo( Proc.Id, Q_OVERMAT_FOR_FINISH, 'i') or 0
local sMillingDown, sMillingUp
if nDouble > 1 and bCanDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'FreeContour_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
sWarn = 'Warning : milling from bottom not found in library'
EgtOutLog( sWarn)
end
end
if EgtEndsWith( sMilling, '_H2') then
sMillingUp = ML.FindMilling( 'FreeContour', nil, nil, nil, nil, true, false)
if not sMillingUp then
sWarn = 'Warning : milling not found in library'
EgtOutLog( sWarn)
end
end
end
end
-- eseguo
for i = 1, nStep do
for j = 1, nDouble do
@@ -513,7 +589,11 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
else
-- inserisco la lavorazione
sName = 'Free_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
nMchId = EgtAddMachining( sName, sMilling)
if EgtEndsWith( sMilling, '_H2') then
nMchId = EgtAddMachining( sName, EgtIf( j == 2 and nSide == 0, sMillingUp, sMilling))
else
nMchId = EgtAddMachining( sName, EgtIf( j == 2 and nSide == 0, sMillingDown, sMilling))
end
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
@@ -549,9 +629,9 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
if Proc.Grp == 0 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.CENTER)
elseif ( Proc.Grp == 3 and not bToolInv) or ( Proc.Grp == 4 and bToolInv) then
elseif ( Proc.Grp == 3 and not bToolInv) or ( Proc.Grp == 4 and bToolInv) or ( Proc.Grp == 1 and bToolInv) or ( Proc.Grp == 2 and bToolInv) then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
elseif ( Proc.Grp == 3 and bToolInv) or ( Proc.Grp == 4 and not bToolInv) then
elseif ( Proc.Grp == 3 and bToolInv) or ( Proc.Grp == 4 and not bToolInv) or ( Proc.Grp == 1 and not bToolInv) or ( Proc.Grp == 2 and not bToolInv) then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
end
-- posizione braccio porta testa
@@ -581,7 +661,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.OFFSR, dDepthCham)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -600,7 +680,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, 0)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
@@ -620,7 +700,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
BL.UpdateTCING( nRawId, dOffs)
end
end
return true
return true, sWarn
end
---------------------------------------------------------------------
@@ -680,7 +760,7 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';')
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -688,9 +768,84 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
return true
end
---------------------------------------------------------------------
local function MakeByMark( Proc, nRawId, b3Raw, nPartId)
-- ingombro del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
-- recupero e verifico l'entità curva
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
if AuxId then AuxId = AuxId + Proc.Id end
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
local sErr = 'Error : missing profile geometry'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati della curva e del profilo
local dDepth = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local bToolInv = ( vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
-- verifico che la marcatura non sia orientata verso il basso (-5 deg)
if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mark from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- abilitazione lavorazione da sotto
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
-- recupero la lavorazione
local sMillType = 'Text'
--local sMchExt = EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione
local sName = 'FreeMark_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
EgtSetInfo( nMchId, 'Part', Proc.PartId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- se estrusione da sotto, inverto direzione fresa
if bToolInv then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
end
-- posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_ZP
if AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
return true
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- riassegno Q nel caso la funzione sia richiamata da un'altra make
if Proc.Prc == 70 then
Q_DEPTH_CHAMFER = 'Q01'
Q_DIM_STRIP = 'Q02'
end
-- recupero la tipologia
local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1)
-- se svuotatura
@@ -698,7 +853,15 @@ function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
return MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- altrimenti contornatura
else
return MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero il tipo di lavorazione
local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0
-- se marcatura
if nCntType == 10 then
return MakeByMark( Proc, nRawId, b3Raw, nPartId)
-- se fresatura
else
return MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
end
end
+15 -13
View File
@@ -1,5 +1,6 @@
-- ProcessFrenchRidgeLap.lua by Egaltech s.r.l. 2020/02/11
-- Gestione calcolo giunzione francese
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessFrenchRidgeLap = {}
@@ -38,7 +39,9 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -117,25 +120,24 @@ function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local dFinalExtraTrim = 0.1
local dMiddleExtraTrim = 0.3
local dNullExtraTrim = 0
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
elseif vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
end
if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
@@ -192,7 +194,7 @@ function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
@@ -212,7 +214,7 @@ function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
+81 -22
View File
@@ -1,5 +1,11 @@
-- ProcessSplit.lua by Egaltech s.r.l. 2022/01/25
-- ProcessSplit.lua by Egaltech s.r.l. 2022/09/26
-- Gestione calcolo tagli di testa per Travi
-- 2022/05/31 Aggiunta gestione sezioni alte e larghe con taglio di tipo diceCut.
-- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita.
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
-- 2022/09/08 Migliorato verso di lavorazione in caso di DoubleCut
-- 2022/11/02 Corretti accorciamenti per DoubleCut
-- 2022/11/10 Corrette finiture lama per BigSection con trave alta
-- Tabella per definizione modulo
local ProcessHeadCut = {}
@@ -8,6 +14,8 @@ local ProcessHeadCut = {}
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw')
local Cut = require( 'ProcessCut')
local Pocket = require( 'FaceByPocket')
EgtOutLog( ' ProcessHeadCut started', 1)
@@ -109,7 +117,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -132,7 +140,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -161,18 +169,36 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
-- recupero i dati dell'utensile
local dSawDiam = 400
local dMaxDepth = 50
local dSawThick = 2
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
dSawThick = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick
end
end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- recupero la eventuale lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'HeadSide_H2', false, true)
-- recupero i dati della eventuale seconda lama
local dSawDiam2 = 0
local dMaxDepth2 = 0
local dSawThick2 = 0
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
dSawThick2 = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick2
end
end
-- caratteristiche taglio
local bHorizCut = ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM)
local bDoubleHorizCut = ( BD.DOWN_HEAD and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bHorizCut = ( ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
-- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
@@ -183,6 +209,46 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
-- determino se più tagli con offset
local nCuts = max( ceil( dOvmHead / ( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP)), 1)
local dOffsL = dOvmHead / nCuts
-- se taglio per sezioni alte e larghe
if bBigSectionCut then
if dOvmHead > 0 then
local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0
-- se finitura con lama
if nQ05 == 1 or nQ05 == 0 then
local dSawThickCheck = dSawThick
if dSawThick2 > 0 and bDoubleHorizCut then
dSawThickCheck = min( dSawThick, dSawThick2)
end
local dMaxElev = 0
if vtN:getX() > 0 then
dMaxElev = b3Raw:getMax():getX() - Proc.Box:getMin():getX()
else
dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX()
end
-- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard
if dMaxElev > dSawThickCheck then
local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT)
return bOk, sErr
end
-- se finitura con truciolatore
elseif nQ05 == 2 then
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
local sPocketing = ML.FindPocketing( 'OpenPocket', nil, 0)
if not sPocketing then
local sErr = 'Error : pocketing not found in library'
EgtOutLog( sErr)
return false, sErr
end
local bOk, sErr = Pocket.Make( Proc, Proc.Id, 0, sPocketing, nPartId, b3Solid)
return bOk, sErr
end
end
end
-- se tagli standard
if not bDoubleHorizCut then
-- flag di lavorazione faccia
@@ -205,9 +271,11 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
end
-- se necessari tagli in doppio, eseguo gli opposti
if bDoubleCut then
-- gli accorciamenti vanno invertiti per il taglio opposto
local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw)
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStartDoubleCut, dAccEndDoubleCut, '', b3Raw, true)
if not bOk then return false, sErr end
end
end
@@ -219,27 +287,16 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
end
-- altrimenti necessari tagli da sopra e sotto con testa opportuna
else
-- recupero la lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'HeadSide_H2')
-- verifico esistenza della lavorazione con lama da sotto
if not sCutting2 then
local sErr = 'Error : cutting H2 not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati della seconda lama
local dSawDiam2 = 400
local dMaxDepth2 = 50
if EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
end
end
-- verifico che le due lame riescano a lavorare la sezione
local dDimZ = b3Raw:getDimZ()
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
if dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0 then
if ( dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0) and not bBigSectionCut then
local sErr = 'Error : section too big for head cut'
EgtOutLog( sErr)
return false, sErr
@@ -248,16 +305,18 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
local dAccStart = 0
local dVzLimDwnUp
if BD.TURN then dVzLimDwnUp = -2 end
-- eseguo i tagli da sotto necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, nil, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
if not bOk then return false, sErr end
end
-- eseguo i tagli da sopra necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
if not bOk then return false, sErr end
end
end
+1001 -761
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+187 -399
View File
@@ -1,4 +1,4 @@
-- ProcessLongCut.lua by Egaltech s.r.l. 2021/11/08
-- ProcessLongCut.lua by Egaltech s.r.l. 2022/11/04
-- Gestione calcolo taglio longitudinale per Travi
-- 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.
@@ -9,6 +9,10 @@
-- 2021/10/29 Aggiunta opzione tipo lavorazione 'LongCut'.
-- 2021/11/04 Migliorata gestione sicurezza aggiuntiva in fresate di fianco (distinzione tra larga come tutta la faccia o meno).
-- 2021/11/08 Se con lama e flag BD.USE_LONGCUT si lavora in direzione contraria allo standard.
-- 2022/03/07 Razionalizzata gestione casi con fresa di fianco. Aggiunta gestione Long2Cut anche con testa sotto.
-- 2022/07/14 Aggiunta limitazione lavorazione a sinistra anche se il grezzo successivo non ha lavorazioni (finale barra) ma è abbastanza lungo da poter essere riutilizzato (BD.MinRaw).
-- 2022/09/23 Modificato l'angolo per l'abilitazione della lama da sotto: ora interviene anche per facce verticali.
-- 2022/11/04 Aggiunto passaggio parametro bDownHead (Testa da Sotto) nelle chiamate a MakeSideFace.
-- Tabella per definizione modulo
local ProcessLongCut = {}
@@ -98,7 +102,7 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, bForcedLim,
EgtSetMachiningParam( MCH_MP.LOPERP, 0)
EgtSetMachiningParam( MCH_MP.LOTANG, dToolDiam / 2 + 30)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -113,7 +117,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDe
if sMasterCutting and #sMasterCutting > 0 then
sCutting = sMasterCutting
else
sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bMillDown, '_H2', ''))
sCutting = ML.FindCutting( 'HeadSide', not bMillDown, bMillDown)
end
if not sCutting then
local sErr = 'Error : HeadSide (cutting) not found in library'
@@ -260,7 +264,7 @@ local function ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacet, nFacInd, s
EgtSetMachiningParam( MCH_MP.SCC, nPrevSCC)
end
-- rieseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nIdMach, false)
return false, false, sErr
@@ -319,10 +323,10 @@ local function MakeByPocketing( Proc, nPhase, nRawId, nPartId)
sNotes = sNotes .. 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -354,34 +358,37 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
bLimXmax = true
end
end
-- Verifico lato di lavorazione (limite di lato a 45deg per pinze che schiacciano)
-- 14.07.2021 su richieste di alcuni clienti, se taglio di lato (assegnazione +/- 2) fare lo stesso con la lama lasciando il cordone centrale
-- Verifico lato di lavorazione (limite di lato a 45deg per FAST e 36deg per PF)
local nSide = 1
if vtN:getZ() < - 0.5 then
nSide = -1
elseif vtN:getY() < -0.7072 then
elseif vtN:getY() < - EgtIf( BD.C_SIMM, 0.588, 0.7072) then
nSide = -2
elseif vtN:getY() > 0.7072 then
elseif vtN:getY() > EgtIf( BD.C_SIMM, 0.588, 0.7072) then
nSide = 2
end
-- Verifico se largo come faccia
local bLarghAsFace = false
if nSide == 1 or nSide == -1 then
bLarghAsFace = ( Proc.Box:getDimY() > b3Solid:getDimY() - 10)
bLarghAsFace = ( Proc.Box:getDimY() > b3Solid:getDimY() - 20)
else
bLarghAsFace = ( Proc.Box:getDimZ() > b3Solid:getDimZ() - 10)
bLarghAsFace = ( Proc.Box:getDimZ() > b3Solid:getDimZ() - 20)
end
-- Determino se parte da sopra
local bTopStart = ( Proc.Box:getMax():getZ() > b3Solid:getMax():getZ() - 20)
-- Determino se parte da sotto
local bBottomStart = ( Proc.Box:getMin():getZ() < b3Solid:getMin():getZ() + 20)
-- determino se lavorazione da davanti o da dietro
local bFront = ( vtN:getY() < 0)
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or 5.4
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or BD.OVM_MID
local bForcedLim
local sWarn
----------------------------------------------------------------------------------------------------------------------------------------
-- 2020/09/15 Fabio Squaratti: se sono attivi entrambe i Q05 (lavorare con lama) e Q07 (lavorare con fresa di fianco anche da sopra)
-- allora vince il Q7, cioè si utilizza la fresa di fianco ( per i tagli da sopra)
-- 2020/09/17 Fabio Squaratti: se lavorazione con fresa di fianco e se ci sono delle facce laterali, l'utensile deve arrivare
-- fino al punto più vicino della faccia laterale (prima l'arretramento era sempre del rggio utensile).
-- 2020/09/17 Fabio Squaratti: se lavorazione con fresa di fianco e se ci sono delle facce terminali, l'utensile deve arrivare
-- 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
----------------------------------------------------------------------------------------------------------------------------------------
local nUseBlade = EgtIf( bCustUseBlade, 1, EgtGetInfo( Proc.Id, 'Q05', 'i') or 0)
@@ -431,8 +438,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
if ( nSide == -1 or abs(nSide) == 2) and vtN:getZ() <= -0.5 then
bCanUseUnderBlade = true
end
-- se faccia da sotto o di lato ma con versore Z negativo abilito la lavorazione con lame mixate
if ( nSide == -1 or abs(nSide) == 2) and vtN:getZ() <= -0.0175 then
-- se faccia da sotto o di lato ma con versore Z sotto l'orizzontale abilito la lavorazione con lame mixate
if ( nSide == -1 or abs(nSide) == 2) and vtN:getZ() <= 0.0175 then
bCanUseUnderBlade = true
end
-- se faccia da sopra o di lato ma con versore Z negativo verifico che abbia un angolo compatibile (28deg) per non avere extracorsa
@@ -469,7 +476,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dMaxDepthDn = 0
-- recupero la lavorazione
if bCanUseUnderBlade then
sCuttingDn = ML.FindCutting( 'HeadSide_H2')
sCuttingDn = ML.FindCutting( 'HeadSide_H2', false, true)
if not sCuttingDn then
local sErr = 'Error : sawing HeadSide_H2 not found in library'
EgtOutLog( sErr)
@@ -503,8 +510,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
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
if ( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2) and not bLimXmin then
local nNextRawId = EgtGetNextRawPart( nRawId)
-- 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)) or (nNextRawId and EgtGetPartInRawPartCount( nNextRawId) <= 0 and EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw)) and not bLimXmin then
if bForceUseBladeOnNotThruFace then
bForcedLim = true
bLimXmin = true
@@ -664,12 +672,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
-- determino la massima elevazione
local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
-- recupero la lavorazione
local sMilling
if bCanUseUnderBlade then
sMilling = ML.FindMilling( 'Long2Cut_H2', dElev)
else
sMilling = ML.FindMilling( 'Long2Cut', dElev)
end
local sMilling = ML.FindMilling( 'Long2Cut_H2', dElev, nil, nil, nil, not bCanUseUnderBlade, bCanUseUnderBlade)
if not sMilling then
local sErr = 'Error : milling Long2Cut (_H2) not found in library'
EgtOutLog( sErr)
@@ -756,31 +759,6 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
dAddExtraPerp = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
end
dLioPerp = dLioPerp + dAddExtraPerp
-------------------------------------------------------------------------------------------------------
-- disabilito questo calcolo dell'attacco perpendicolare perchè in alcune condizioni genera extra corsa
-------------------------------------------------------------------------------------------------------
--[[
-- parametri di attacco/uscita
local nOrthoOpposite = nFaceUse2
local b3Box = BBox3d( b3Raw)
b3Box:expand( BD.CUT_SIC)
-- linea o bilinea di lavorazione (qui uso nOrthoOpposite per ripetere esattamente il calcolo del Mach)
local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth2 = EgtSurfTmFacetOppositeSide( Proc.Id, 0, BL.GetVersRef( nOrthoOpposite), GDB_ID.ROOT)
vtV1 = - vtV1
local bInvert = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL)
if bInvert then
ptP1, ptP2 = ptP2, ptP1
vtV1, vtV2 = vtV2, vtV1
end
local vtTg = ptP2 - ptP1 ; vtTg:normalize()
-- Versore di riferimento
local vtRef = Vector3d( vtTg)
local dCutExtra = 0
vtRef:rotate( vtN, EgtIf( bInvert, -90, 90))
local ptP1act = ptP1
local ptP2act = ptP2
_, dLioPerp, _, _ = Fbs.CalcLeadInOutPerpGeom( ptP1act, ptP2act, vtV1, vtV2, vtN, dToolDiam/2, vtRef, dCutExtra, b3Box)
]]--
end
-- inserisco le parti di lavorazione
nM = nM + 1
@@ -822,16 +800,6 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
if ( not bFront and k == 1) or ( bFront and k == 2) then
dSal, dEal = dEal, dSal
end
-- se faccia da sotto inverto direzione utensile e profondità
-- if nSide == -1 then
-- if k == 1 and abs( vtN:getY()) > 0.01 and abs( vtN:getY()) <= 0.866 and abs( vtN:getY()) > 0.707 then
-- -- imposto lato di correzione
-- EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- else
-- EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
-- EgtSetMachiningParam( MCH_MP.DEPTH, dThick)
-- end
-- end
if bCanUseBlade and bCanUseUnderBlade then
EgtSetMachiningParam( MCH_MP.INVERT, true)
@@ -877,21 +845,24 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
-- imposto posizione braccio porta testa per non ingombrare agli estremi
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
end
-- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut
elseif nSide ~= - 1 and nUseMillOnSide == 0 then
elseif ( nSide ~= - 1 or BD.DOWN_HEAD) and nUseMillOnSide == 0 then
-- determino la massima elevazione
local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
-- recupero la lavorazione
local sMilling = ML.FindMilling( 'Long2Cut', dElev)
local bDownHead = ( nSide == - 1)
sMchType = EgtIf( bDownHead, 'Long2Cut_H2', 'Long2Cut')
local sMilling = ML.FindMilling( sMchType, dElev, nil, nil, nil, not bDownHead, bDownHead)
if not sMilling then
local sErr = 'Error : milling Long2Cut not found in library'
local sErr = 'Error : milling '..sMchType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
@@ -1043,7 +1014,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dDepth = min( 0, dMaxDepth - dElev )
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -1055,12 +1026,12 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
for j = 1, Proc.Fct - 1 do
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
if vtIni * vtN > 0 and nCountMilHead < 2 then
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam)
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam, nil, nil, bDownHead)
nCountMilHead = nCountMilHead + 1
end
end
if bForcedLim and nCountMilHead < 1 then
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim)
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim, nil, bDownHead)
nCountMilHead = nCountMilHead + 1
end
end
@@ -1072,18 +1043,18 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
for j = 1, Proc.Fct - 1 do
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, j, GDB_ID.ROOT)
if vtFin * vtN > 0 and nCountMilHead < 2 then
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam)
MakeSideFace( Proc.Id, j, nSide, sMilling, dToolDiam, nil, nil, bDownHead)
nCountMilHead = nCountMilHead + 1
end
end
if bForcedLim and nCountMilHead < 2 then
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim)
MakeSideFace( Proc.Id, 0, nSide, sMilling, dToolDiam, bForcedLim, nil, bDownHead)
nCountMilHead = nCountMilHead + 1
end
end
-- altrimenti è da sotto ( lavorazione Long2CutDown) o abilitata lavorazione con fresa di fianco ( lavorazione Long2CutSide)
-- altrimenti è con fresa di fianco (Long2CutSide) o da sotto (Long2CutDown)
else
-- da Analisi con Fabio Squaratti 15/09/2020
-- variabile che indica se ripassare sul raggio rimasto dalla lavorazione di fianco
local bRemoveToolRadius
-- se nExtendMach = 0 la lavorazione rimane arretrata dalla fine della faccia del raggio utensile
@@ -1091,12 +1062,12 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
-- se nExtendMach = 2 la lavorazione viene estesa ma arretra per non segnare il pezzo successivo (se non ha facce limite)
local nExtendMach
-- recupero la lavorazione
local sMilling
local sMillingDn
local sPrefix
local sPrefixDn
local sMchType, sMchTypeDn
local sMilling, sMillingDn
local sPrefix, sPrefixDn
if nSide ~= - 1 then
sMilling = ML.FindMilling( 'Long2CutSide')
sMchType = 'Long2CutSide'
sMilling = ML.FindMilling( sMchType)
sPrefix = 'L2CS_'
nExtendMach = nUseMillOnSide
if nUseMillOnSide == 2 then
@@ -1104,30 +1075,33 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
end
-- se testa da sotto
if nSide ~= 1 and BD.DOWN_HEAD then
sMillingDn = ML.FindMilling( 'Long2CutSide_H2')
sMchTypeDn = 'Long2CutSide_H2'
sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true)
sPrefixDn = 'L2CSH2_'
end
-- lavorazione da sotto
else
sMilling = ML.FindMilling( 'Long2CutDown')
else
sMchType = 'Long2CutDown'
sMilling = ML.FindMilling( sMchType)
sPrefix = 'L2CD_'
nExtendMach = 1
if nUseMillOnSide ~= 1 then
nExtendMach = 2 -- arretro il minimo indispensabile per non segnare il pezzo successivo (se non ha facce limite)
nExtendMach = 2 -- arretro il minimo indispensabile per non segnare il pezzo successivo (se non ha facce limite)
end
-- se testa da sotto
if BD.DOWN_HEAD then
sMillingDn = ML.FindMilling( 'Long2CutDown_H2')
sMchTypeDn = 'Long2CutDown_H2'
sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true)
sPrefixDn = 'L2CDH2_'
end
end
if not sMilling then
local sErr = 'Error : milling Long2CutSide or Long2CutDown not found in library'
if not sMilling and ( nSide == 1 or not BD.DOWN_HEAD) then
local sErr = 'Error : milling '..sMchType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
if nSide ~= 1 and BD.DOWN_HEAD and not sMillingDn then
local sErr = 'Error : milling Long2CutSide_H2 or Long2CutDown_H2 not found in library'
if not sMilling and not sMillingDn then
local sErr = 'Error : milling '..sMchType..' and '..sMchTypeDn..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
@@ -1137,9 +1111,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dMaxDepth = 0
local dThDiam = 0
local dThLen = 0
local dExtraForSafety = EgtIf( BD.DOWN_HEAD, 8.5, 6.5) -- corrisponde al doppio valore di sicurezza dell'mlpe + 0.5
-- local dExtraForSafetyDn = 8.5 -- 8.5 -- corrisponde al doppio valore di sicurezza dell'mlpe + 0.5
if EgtMdbSetCurrMachining( sMilling) then
if sMilling and EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
@@ -1155,7 +1127,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dMaxDepthDn = 0
local dThDiamDn = 0
local dThLenDn = 0
if nSide ~= 1 and BD.DOWN_HEAD and EgtMdbSetCurrMachining( sMillingDn) then
if sMillingDn and EgtMdbSetCurrMachining( sMillingDn) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiamDn = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiamDn
@@ -1165,19 +1137,17 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
dThLenDn = EgtTdbGetCurrToolThLength() or dThLenDn
end
end
local dDistToEnd = dToolDiam / 2
-- distanza dalle eventuali facce estreme
local dDistToEnd = dToolDiam / 2
local dDistToEndDn = dToolDiamDn / 2
-- calcolo l'elevazione della faccia principale
local dFacElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
-- se fresa di fianco o da sotto calcolo quanto l'utensile può andare vicino al limite se l'elevazione della faccia è minore del raggio utensile
if nUseMillOnSide <= 1 or nSide == -1 then
if dFacElev < dDistToEnd then
dDistToEnd = sqrt( ( ( dToolDiam / 2) * ( dToolDiam / 2)) - ( ( dToolDiam / 2 - dFacElev) * (dToolDiam / 2 - dFacElev)))
end
if dFacElev < dDistToEndDn then
dDistToEndDn = sqrt( ( ( dToolDiamDn / 2) * ( dToolDiamDn / 2)) - ( ( dToolDiamDn / 2 - dFacElev) * (dToolDiamDn / 2 - dFacElev)))
end
-- se fresa di fianco o da sotto calcolo quanto l'utensile può andare vicino all'estremo con l'elevazione della faccia minore del raggio utensile
if ( nUseMillOnSide <= 1 or nSide == -1) and dFacElev < dToolDiam / 2 then
dDistToEnd = sqrt( dFacElev * ( dToolDiam - dFacElev))
end
if nUseMillOnSide <= 1 and dFacElev < dToolDiamDn / 2 then
dDistToEndDn = sqrt( dFacElev * ( dToolDiamDn - dFacElev))
end
-- se la fine è già limitata allora setto per arretrare del raggio utensile
if bLimXmin then
@@ -1252,123 +1222,134 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
dEndAccDist = 0
end
end
-- verifico se posso farlo da due parti opposte o da solo una parte
local dCollSic
local dCollSicMin
local dCollSicDn
local dCollSicMinDn
local dDepth
local dDepthDn
local dDepth2
local dDepth2Dn
local nPass = 1
local dNz = EgtIf( abs(nSide) == 1, vtN:getY(), vtN:getZ())
local dNzMin = EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getY(), vtN:getZ())
-- se faccia da sopra e angolo 45° o faccia da sotto e angolo 40° (con singola testa ) o faccia non da sopra e testa da sotto
-- permette di eseguire due lavorazioni opposte
if ( nSide == 1 and abs(vtN:getY()) <= 0.7072) or ( nSide == -1 and not BD.DOWN_HEAD and abs(vtN:getY()) < 0.6428) or ( nSide ~= 1 and BD.DOWN_HEAD) then
-- verifico massimo affondamento (tengo conto dell'inclinazione utensile e della pinza con estremità conica)
-- 08/09/2020 tolti i 3mm ( per la ghiera smussata) perchè nella verifica collisione vine creato un cilindro non smussato che rileva la collisione
local dSicOnRad
local dSicOnLegth
if ( abs(nSide) == 1 and abs(vtN:getZ()) >= abs(vtN:getY())) or ( abs(nSide) == 2 and abs(vtN:getY()) >= abs(vtN:getZ())) then
dSicOnRad = ( dThDiam + dExtraForSafety - dToolDiam) / 2
dSicOnLegth = 0
else
dSicOnRad = ( dThDiam - dToolDiam) / 2
dSicOnLegth = dExtraForSafety / 2
-- verifico se posso farlo da una sola parte o se necessario da due parti
local dMaxDepthZ = dMaxDepth
local dMaxDepthDnZ = dMaxDepthDn
local CosA = abs( vtN:getZ())
if CosA >= 0.05 then
local SinA = sqrt( 1 - CosA * CosA)
local dRad = dThDiam / 2 - dToolDiam / 2 + BD.COLL_SIC
dMaxDepthZ = dMaxDepthZ - ( dRad * CosA / SinA)
if sMillingDn then
local dRadDn = dThDiamDn / 2 - dToolDiamDn / 2
dMaxDepthDnZ = dMaxDepthDnZ - ( dRadDn * CosA / SinA)
end
dCollSicMin = max( BD.COLL_SIC, ( dThDiam - dToolDiam) / 2 * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin))
if bLarghAsFace then
dCollSic = max( BD.COLL_SIC, dSicOnRad * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin) + dSicOnLegth)
else
dCollSic = max( BD.COLL_SIC, dSicOnRad * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, abs( EgtIf( abs(nSide) == 1, vtN:getZ(), vtN:getY()) / dNz)) + dSicOnLegth)
end
local dMaxDepthY = dMaxDepth
local dMaxDepthDnY = dMaxDepthDn
local SinA = abs( vtN:getZ())
if SinA >= 0.05 then
local CosA = sqrt( 1 - SinA * SinA)
local dRad = dThDiam / 2 - dToolDiam / 2 + BD.COLL_SIC
dMaxDepthY = dMaxDepthY - ( dRad * CosA / SinA)
if sMillingDn then
local dRadDn = dThDiamDn / 2 - dToolDiamDn / 2
dMaxDepthDnY = dMaxDepthDnY - ( dRadDn * CosA / SinA)
end
if nSide ~= 1 and BD.DOWN_HEAD then
local dSicOnRadDn
local dSicOnLegthDn
if ( abs(nSide) == 1 and abs(vtN:getZ()) >= abs(vtN:getY())) or ( abs(nSide) == 2 and abs(vtN:getY()) >= abs(vtN:getZ())) then
dSicOnRadDn = ( dThDiamDn + dExtraForSafety - dToolDiamDn) / 2
dSicOnLegthDn = 0
end
local nPass = 0
local vdMaxD = { 0, 0}
local vnHead = { 0, 0}
-- con testa da sopra
if nSide == 1 or ( sMilling and abs( nSide) == 2 and ( bTopStart or abs( vtN:getY()) < 0.866)) or not sMillingDn then
vnHead = { 1, 1}
-- se faccia sopra
if nSide == 1 then
vdMaxD[1] = EgtIf( bLarghAsFace, dMaxDepthY, dMaxDepthZ)
if dWidth + dAgg <= vdMaxD[1] then
nPass = 1
else
dSicOnRadDn = ( dThDiamDn - dToolDiamDn) / 2
dSicOnLegthDn = dExtraForSafety / 2
nPass = 2
dAgg = BD.CUT_EXTRA_MIN
vdMaxD[2] = dMaxDepthY
end
dCollSicMinDn = max( BD.COLL_SIC, ( dThDiamDn - dToolDiamDn) / 2 * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin))
if bLarghAsFace then
dCollSicDn = max( BD.COLL_SIC, dSicOnRadDn * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin) + dSicOnLegthDn)
-- se altrimenti faccia sotto
elseif nSide == -1 then
if dWidth + dAgg <= dMaxDepthY or abs( vtN:getY()) > EgtIf( BD.C_SIMM, 0.588, 0.7072) then
nPass = 1
vdMaxD[1] = dMaxDepthY
else
dCollSicDn = max( BD.COLL_SIC, dSicOnRadDn * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, abs( EgtIf( abs(nSide) == 1, vtN:getZ(), vtN:getY()) / dNz)) + dSicOnLegthDn)
end
if dWidth + dAgg > dMaxDepth - dCollSic then
nPass = 2
dAgg = 1
if ( 0.5 * dWidth) + dAgg > dMaxDepth - dCollSic then
sWarn = 'Warning in LongCut : depth is bigger than max tool depth'
end
end
if nPass == 1 and dWidth + dAgg > dMaxDepthDn - dCollSicDn then
nPass = 2
dAgg = 1
if ( 0.5 * dWidth) + dAgg > dMaxDepthDn - dCollSicDn then
sWarn = 'Warning in LongCut_2 : depth is bigger than max tool depth'
vdMaxD[1] = dMaxDepthY
local dDelta = b3Solid:getDimY() - Proc.Box:getDimY()
if bLarghAsFace then
vdMaxD[2] = min( dMaxDepthY, dMaxDepth - dDelta * abs( vtN:getZ()) - BD.COLL_SIC)
else
vdMaxD[2] = min( dMaxDepthZ, dToolLength - 5 - dDelta / abs( vtN:getZ()) - BD.COLL_SIC)
end
if vdMaxD[2] < 0 then nPass = 1 end
if nPass == 2 then dAgg = BD.CUT_EXTRA_MIN end
end
-- altrimenti faccia di fianco
else
if dWidth + dAgg > dMaxDepth - dCollSic then
nPass = 2
dAgg = 1
if ( 0.5 * dWidth) + dAgg > dMaxDepth - dCollSic then
sWarn = 'Warning in LongCut : depth is bigger than max tool depth'
end
nPass = 1
local dDelta = b3Solid:getMax():getZ() - Proc.Box:getMax():getZ()
if abs( vtN:getY()) < 0.866 then
vdMaxD[1] = dMaxDepthY
elseif bTopStart then
vdMaxD[1] = min( dMaxDepthZ, dMaxDepth - dDelta * abs( vtN:getY()) - BD.COLL_SIC)
else
vdMaxD[1] = min( dMaxDepthY, dToolLength - 5 - dDelta * abs( vtN:getY()) - BD.COLL_SIC)
end
if vdMaxD[1] < 0 then nPass = 0 end
end
-- eventuale errore per lavorazione saltata
if nPass == 0 then
local sErr = 'Error in '..sMchType..' : impossible machining'
EgtOutLog( sErr)
return false, sErr
end
-- eventuale avviso per lavorazione incompleta
if dWidth + nPass * dAgg > vdMaxD[1] + vdMaxD[2] then
sWarn = 'Warning in '..sMchType..' : depth is bigger than max tool depth'
end
-- con testa da sotto
else
-- verifico massimo affondamento (tengo conto dell'inclinazione utensile e della pinza con estremità conica)
-- 08/09/2020 tolti i 3mm ( per la ghiera smussata) perchè nella verifica collisione vine creato un cilindro non smussato che rileva la collisione
local dSicOnRad
local dSicOnLegth
if ( abs(nSide) == 1 and abs(vtN:getZ()) >= abs(vtN:getY())) or ( abs(nSide) == 2 and abs(vtN:getY()) >= abs(vtN:getZ())) then
dSicOnRad = ( dThDiam + dExtraForSafety - dToolDiam) / 2
dSicOnLegth = 0
vnHead = { 2, 2}
-- se faccia sotto
if nSide == -1 then
vdMaxD[1] = EgtIf( bLarghAsFace, dMaxDepthDnY, dMaxDepthDnZ)
if dWidth + dAgg <= vdMaxD[1] then
nPass = 1
else
nPass = 2
dAgg = BD.CUT_EXTRA_MIN
vdMaxD[2] = dMaxDepthDnY
end
-- altrimenti faccia di fianco
else
dSicOnRad = ( dThDiam - dToolDiam) / 2
dSicOnLegth = dExtraForSafety / 2
nPass = 1
local dDelta = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
if bBottomStart then
vdMaxD[1] = min( dMaxDepthDnZ, dMaxDepthDn - dDelta * abs( vtN:getY()) - BD.COLL_SIC)
else
vdMaxD[1] = min( dMaxDepthDnY, dToolLengthDn - 5 - dDelta * abs( vtN:getY()) - BD.COLL_SIC)
end
if vdMaxD[1] < 0 then nPass = 0 end
end
dCollSicMin = max( BD.COLL_SIC, ( dThDiam - dToolDiam) / 2 * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin))
-- dCollSic = max( BD.COLL_SIC, dSicOnRad * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, abs( EgtIf( abs(nSide) == 1, vtN:getY(), vtN:getZ()) / dNz)) + dSicOnLegth)
dCollSic = max( BD.COLL_SIC, dSicOnRad * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin) + dSicOnLegth)
if dWidth + dAgg > dMaxDepth - dCollSic then
sWarn = 'Warning in LongCut : depth is bigger than max tool depth'
end
end
-- profondità prima passata
dDepth = min( dMaxDepth - dCollSicMin, dWidth + dAgg)
-- profondità seconda passata
dDepth2 = dWidth + dAgg - dDepth
if not BD.DOWN_HEAD then
if nPass == 2 and dDepth2 < dAgg then
dDepth = min( dMaxDepth - dCollSicMin, dWidth + dAgg) / 2
dDepth2 = dWidth + dAgg - dDepth
end
end
if nSide ~= 1 and BD.DOWN_HEAD then
dDepthDn = min( dMaxDepthDn - dCollSicMinDn, dWidth + dAgg)
dDepth2Dn = dWidth + dAgg - EgtIf( abs(nSide) == 2, dDepth, dDepthDn)
if nPass == 2 and dDepth2Dn < dAgg then
dDepthDn = min( dMaxDepthDn - dCollSicMinDn, dWidth + dAgg) / 2
dDepth2Dn = dWidth + dAgg - EgtIf( abs(nSide) == 2, dDepth, dDepthDn)
-- eventuale errore per lavorazione saltata
if nPass == 0 then
local sErr = 'Error in '..sMchType..' : impossible machining'
EgtOutLog( sErr)
return false, sErr
end
-- eventuale avviso per lavorazione incompleta
if dWidth + nPass * dAgg > vdMaxD[1] + vdMaxD[2] then
sWarn = 'Warning in '..sMchType..' : depth is bigger than max tool depth'
end
end
-- profondità passate
local vdDepth = {}
vdDepth[1] = min( dWidth + dAgg, vdMaxD[1])
vdDepth[2] = min( dWidth + dAgg - vdDepth[1], vdMaxD[2])
-- ciclo sulle parti
local nM = 0
local bMakeMillHeadEnd
local bMakeMillHeadStart
local dLioPerp1 = dFacElev + BD.COLL_SIC
-- local dLioPerp2 = dWidth + BD.COLL_SIC
local dLioPerp2 = dWidth * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, sqrt( 1 - dNz * dNz) / abs( dNz)) + BD.COLL_SIC
local dLioPerp2 = dWidth * EgtIf( abs( vtN:getZ()) < GEO.EPS_SMALL, 1, sqrt( 1 - vtN:getZ() * vtN:getZ()) / abs( vtN:getZ())) + BD.COLL_SIC
-- valore sovrapposizione tra passate
local dOverLapExtend = 2
local dOverLapExtend = 2 * BD.CUT_EXTRA_MIN
for j = 1, nC do
-- Limitazioni della lavorazione
local nPos = EgtIf( bFront, j, nC - j + 1)
@@ -1376,11 +1357,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dEal = EgtIf( nPos == nC, -dStartDist, -dStartAccDist - ( nC - nPos - 1) * dC + dOverLapExtend)
-- Posizione braccio portatesta
local nSCC
local dExtraElev_1st = 0
local dExtraElevDn_1st = 0
for k = 1, nPass do
-- if EgtIf( k == 1, bFront, not bFront) then
if bFront then
nSCC = EgtIf( ( BD.C_SIMM or j == 1 or j == nC - 1), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
else
@@ -1388,31 +1365,19 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
end
-- inserisco le parti di lavorazione
nM = nM + 1
local sNameF
local nMchFId
if BD.DOWN_HEAD and k == 2 and nSide ~= 1 then
sNameF = sPrefixDn .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sMillingDn)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMillingDn
EgtOutLog( sErr)
return false, sErr
end
else
sNameF = sPrefix .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
local sNameF = EgtIf( vnHead[k] ~= 2, sPrefix, sPrefixDn) .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
local nMchFId = EgtAddMachining( sNameF, EgtIf( vnHead[k] ~= 2, sMilling, sMillingDn))
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMillingDn
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, 0}})
-- imposto posizione braccio porta testa per non ingombrare agli estremi
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto uso faccia
local nUseFace = MCH_MILL_FU.PARAL_DOWN
local nUseFace = EgtIf( vnHead[k] ~= 2, MCH_MILL_FU.PARAL_DOWN, MCH_MILL_FU.PARAL_TOP)
if AreSameOrOppositeVectorApprox( vtN, Z_AX()) then nUseFace = MCH_MILL_FU.PARAL_BACK end
EgtSetMachiningParam( MCH_MP.FACEUSE, nUseFace)
-- imposto lato di lavoro e inversione
@@ -1429,194 +1394,17 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
-- assegno affondamento
local dExtraElev = 0
local dExtraElevDn = 0
if not BD.DOWN_HEAD then
-- se prima lavorazione non da sotto o seconda lavorazione da sotto e componente Y <= 60° e > 0
if ( ( k == 1 and nSide ~= -1) or ( k == 2 and nSide == -1)) and abs(vtN:getY()) <= 0.866 and abs(vtN:getY()) > GEO.EPS_SMALL then
-- verifico se può collidere in base alle dimensione del portapezzo
local dDistToolTh = (dToolLength - EgtIf( k == 1, dDepth, ( dDepth2 + dExtraElev_1st)) - dThLen) / abs(vtN:getZ())
local dDistRadTh = dDistToolTh * abs(vtN:getY())
local dDistSurf = EgtIf( bFront, b3Solid:getMax():getY() - Proc.Box:getMax():getY(), Proc.Box:getMin():getY() - b3Solid:getMin():getY())
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurf > dDistToolTh and dDistRadTh < (( dThDiam - dToolDiam) / 2) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getY()) > abs(vtN:getZ()) then
dExtraElev = ((( dThDiam - dToolDiam) / 2) - dDistRadTh) * abs(vtN:getZ()) / abs(vtN:getY()) + ( 0.5 * dExtraForSafety) / abs(vtN:getY())
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElev = ((( dThDiam + dExtraForSafety - dToolDiam) / 2) - dDistRadTh) * abs(vtN:getZ()) / abs(vtN:getY())
end
elseif abs(dDistSurf) > GEO.EPS_SMALL then
if nSide ~= -1 then
dDistSurf = b3Solid:getMax():getZ() - Proc.Box:getMax():getZ()
else
dDistSurf = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
end
if dDistSurf * abs(vtN:getZ()) > (( dThDiam + dToolDiam) * 0.5) then
dExtraElev = dDistSurf * abs(vtN:getY())
end
end
-- altrimenti prima lavorazione di fianco con componente Z negativa
elseif k == 1 and abs(nSide) == 2 and vtN:getZ() > -0.866 and vtN:getZ() < - GEO.EPS_SMALL then
-- verifico se può collidere in base alle dimensione del portapezzo
local dDistToolTh = (dToolLength - dDepth - dThLen) / abs(vtN:getY())
local dDistRadTh = dDistToolTh * abs(vtN:getZ())
local dDistSurf = b3Solid:getMax():getZ() - Proc.Box:getMax():getZ()
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurf > dDistToolTh and dDistRadTh < (( dThDiam - dToolDiam) / 2) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getY()) > abs(vtN:getZ()) then
dExtraElev = ((( dThDiam - dToolDiam) / 2) - dDistRadTh) * abs(vtN:getY()) / abs(vtN:getZ()) + ( 0.5 * dExtraForSafety) / abs(vtN:getZ())
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElev = ((( dThDiam + dExtraForSafety - dToolDiam) / 2) - dDistRadTh) * abs(vtN:getY()) / abs(vtN:getZ())
end
elseif abs( dDistSurf) < GEO.EPS_SMALL then
if bFront then
dDistSurf = Proc.Box:getMin():getY() - b3Solid:getMin():getY()
else
dDistSurf = b3Solid:getMax():getY() - Proc.Box:getMax():getY()
end
if dDistSurf * abs(vtN:getY()) > (( dThDiam + dToolDiam) * 0.5) then
dExtraElev = dDistSurf * abs(vtN:getZ())
end
end
end
-- altrimenti con testa da sotto
else
-- se prima lavorazione non da sotto e componente y <= 60° e > 0
if ( k == 1 and nSide ~= -1) and abs(vtN:getY()) <= 0.866 and abs(vtN:getY()) > GEO.EPS_SMALL then
-- verifico se può collidere in base alle dimensione del portapezzo
local dDistToolTh = (dToolLength - dDepth - dThLen) / abs(vtN:getZ())
local dDistRadTh = dDistToolTh * abs(vtN:getY())
local dDistSurf = EgtIf( bFront, b3Solid:getMax():getY() - Proc.Box:getMax():getY(), Proc.Box:getMin():getY() - b3Solid:getMin():getY())
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurf > dDistToolTh and dDistRadTh < (( dThDiam - dToolDiam) * 0.5) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getZ()) > abs(vtN:getY()) then
dExtraElev = ((( dThDiam - dToolDiam) * 0.5) - dDistRadTh) * abs(vtN:getZ()) / abs(vtN:getY()) + ( 0.5 * dExtraForSafety) / abs(vtN:getY())
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElev = ((( dThDiam + dExtraForSafety - dToolDiam) * 0.5) - dDistRadTh) * abs(vtN:getZ()) / abs(vtN:getY())
end
elseif abs(dDistSurf) < GEO.EPS_SMALL then
dDistSurf = b3Solid:getMax():getZ() - Proc.Box:getMax():getZ()
if dDistSurf * vtN:getZ() > (( dThDiam + dToolDiam) * 0.5) then
dExtraElev = dDistSurf * abs(vtN:getY())
end
end
-- se seconda lavorazione sopra e componente Z > 0
elseif k == 2 and nSide == 1 and vtN:getZ() > GEO.EPS_SMALL then
local dDistToolTh = (dToolLength - ( dDepth2 + dExtraElev_1st) - dThLen) / abs(vtN:getY())
local dDistRadTh = dDistToolTh * abs(vtN:getZ())
local dDistSurf = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurf > dDistToolTh and dDistRadTh < (( dThDiam - dToolDiam) * 0.5) then
-- premio extra sicurezza su lunghezza utensile
if abs(vtN:getZ()) > abs(vtN:getY()) then
dExtraElev = ((( dThDiam - dToolDiam) * 0.5) - dDistRadTh) * abs(vtN:getY()) / abs(vtN:getZ()) + ( 0.5 * dExtraForSafety) / vtN:getZ()
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElev = ((( dThDiam + dExtraForSafety - dToolDiam) * 0.5) - dDistRadTh) * abs(vtN:getY()) / abs(vtN:getZ())
end
end
-- se prima lavorazione di fianco e componente Z > 0
elseif k == 1 and abs(nSide) == 2 and vtN:getZ() < GEO.EPS_SMALL then
local dDistToolTh = (dToolLength - dDepth - dThLen) / abs(vtN:getY())
local dDistRadTh = dDistToolTh * abs(vtN:getZ())
local dDistSurf = b3Solid:getMax():getZ() - Proc.Box:getMax():getZ()
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurf > dDistToolTh and dDistRadTh < (( dThDiam - dToolDiam) * 0.5) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getY()) > abs(vtN:getZ()) then
dExtraElev = (dDistSurf - dDistToolTh + ( 0.5 * dExtraForSafety)) / abs(vtN:getY())
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElev = (( dThDiam - dToolDiam) * 0.5) * abs(vtN:getY()) / abs(vtN:getZ()) - (dToolLength - dDepth - dThLen) + ( 0.5 * dExtraForSafety) / abs(vtN:getZ())
end
elseif abs(dDistSurf) < GEO.EPS_SMALL then
if bFront then
dDistSurf = Proc.Box:getMin():getY() - b3Solid:getMin():getY()
else
dDistSurf = b3Solid:getMax():getY() - Proc.Box:getMax():getY()
end
if dDistSurf * abs(vtN:getY()) > (( dThDiam + dToolDiam) * 0.5) then
dExtraElev = dDistSurf * abs(vtN:getZ())
end
end
-- se seconda lavorazione di fianco e componente Z > 0
elseif k == 2 and abs(nSide) == 2 and vtN:getZ() > GEO.EPS_SMALL then
local dDistToolThDn = (dToolLengthDn - ( dDepth2Dn + dExtraElevDn_1st) - dThLenDn) / abs(vtN:getY())
local dDistRadThDn = dDistToolThDn * abs(vtN:getZ())
local dDistSurfDn = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurfDn > dDistToolThDn and dDistRadThDn < (( dThDiamDn - dToolDiamDn) * 0.5) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getY()) > abs(vtN:getZ()) then
dExtraElevDn = ((( dThDiamDn - dToolDiamDn) * 0.5) - dDistRadThDn) * abs(vtN:getY()) / abs(vtN:getZ()) + ( 0.5 * dExtraForSafety) / vtN:getZ()
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElevDn = ((( dThDiamDn + dExtraForSafety - dToolDiamDn) * 0.5) - dDistRadThDn) * abs(vtN:getY()) / abs(vtN:getZ())
end
elseif abs(dDistSurfDn) < GEO.EPS_SMALL then
if bFront then
dDistSurfDn = Proc.Box:getMin():getY() - b3Solid:getMin():getY()
else
dDistSurfDn = b3Solid:getMax():getY() - Proc.Box:getMax():getY()
end
if dDistSurfDn * abs(vtN:getY()) > (( dThDiamDn + dToolDiamDn) * 0.5) then
dExtraElevDn = dDistSurfDn * abs(vtN:getZ())
end
end
-- se seconda lavorazione da sotto a componente Y < 60° e Y > 0
elseif ( k == 2 and nSide == -1) and abs(vtN:getY()) <= 0.866 and abs(vtN:getY()) > GEO.EPS_SMALL then
-- verifico se può collidere in base alle dimensione del portapezzo
local dDistToolThDn = (dToolLengthDn - ( dDepth2Dn + dExtraElevDn_1st) - dThLenDn) / abs(vtN:getY())
local dDistRadThDn = dDistToolThDn * abs(vtN:getZ())
local dDistSurfDn = EgtIf( bFront, b3Solid:getMax():getY() - Proc.Box:getMax():getY(), Proc.Box:getMin():getY() - b3Solid:getMin():getY())
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurfDn > dDistToolThDn and dDistRadThDn < (( dThDiamDn - dToolDiamDn) * 0.5) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getZ()) > abs(vtN:getY()) then
dExtraElevDn = ((( dThDiamDn - dToolDiamDn) * 0.5) - dDistRadThDn) * abs(vtN:getY()) / abs(vtN:getZ()) + ( 0.5 * dExtraForSafety) / abs(vtN:getY())
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElevDn = ((( dThDiamDn + dExtraForSafety - dToolDiamDn) * 0.5) - dDistRadThDn) * abs(vtN:getY()) / abs(vtN:getZ())
end
elseif abs(dDistSurfDn) < GEO.EPS_SMALL then
dDistSurfDn = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
if dDistSurfDn * abs(vtN:getZ()) > (( dThDiamDn + dToolDiamDn) * 0.5) then
dExtraElevDn = dDistSurfDn * abs(vtN:getY())
end
end
end
end
if BD.DOWN_HEAD and k == 2 and nSide ~= 1 then
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth2Dn - dExtraElevDn)
dExtraElevDn_1st = dExtraElevDn
if dExtraElevDn > 0 and sWarn and #sWarn < 1 then
sWarn = 'Warning in LongCut_2 : depth is bigger than max tool depth'
end
else
EgtSetMachiningParam( MCH_MP.DEPTH, EgtIf( k == 1, dDepth, dDepth2) - dExtraElev)
dExtraElev_1st = dExtraElev
if dExtraElev > 0 and sWarn and #sWarn < 1 then
sWarn = 'Warning in LongCut : depth is bigger than max tool depth'
end
end
-- assegbo attacco perpendicolare
EgtSetMachiningParam( MCH_MP.DEPTH, vdDepth[k])
-- assegno attacco perpendicolare
EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp1)
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp1)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
-- se feature orientata su faccia da sotto provo a cambiare l'attacco
if nSide == -1 then
EgtSetMachiningParam( MCH_MP.LIPERP, min( dLioPerp1, dLioPerp2))
EgtSetMachiningParam( MCH_MP.LOPERP, min( dLioPerp1, dLioPerp2))
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
-- esco se non sono nella seconda lavorazione o non nella faccia da sotto
+156 -163
View File
@@ -1,9 +1,14 @@
-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2021/11/08
-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2022/06/29
-- Gestione calcolo doppio taglio longitudinale per Travi
-- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto.
-- 2021/06/29 Corretta gestione caso equivalente a due smussi.
-- 2021/10/29 Aggiunta opzione tipo lavorazione 'LongCut'.
-- 2021/11/08 Se con lama e flag BD.USE_LONGCUT si lavora in direzione contraria allo standard.
-- 2022/02/08 Sistemate lunghezze fresature quando due sole.
-- 2022/02/15 Sistemati commenti.
-- 2022/03/20 Tolta da scelta milling tipo Long2CutDown controllo max diametro fresa.
-- 2022/05/27 Corretto ordine per casi sui lati.
-- 2022/06/29 Corretto calcolo lunghezza attacco/uscita perpendicolare per lavorazioni di fianco.
-- Tabella per definizione modulo
local ProcessLong2Cut = {}
@@ -141,7 +146,7 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, nL2CSide)
EgtSetMachiningParam( MCH_MP.STARTPOS, 80)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -152,8 +157,9 @@ end
-- Applicazione della lavorazione
local function MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, nFacInd, dFacElev)
-- cerco la svuotatura opportuna
local sPockType = EgtIf( nSide ~=1 and BD.DOWN_HEAD, 'OpenPocket_H2', 'OpenPocket')
local sPocketing = ML.FindPocketing( sPockType, Proc.Box:getDimX())
local bDownHead = nSide ~=1 and BD.DOWN_HEAD
local sPockType = EgtIf( bDownHead, 'OpenPocket_H2', 'OpenPocket')
local sPocketing = ML.FindPocketing( sPockType, Proc.Box:getDimX(), nil, nil, not bDownHead, bDownHead)
if not sPocketing then
local sErr = 'Error : OpenPocket not found in library'
EgtOutLog( sErr)
@@ -194,10 +200,10 @@ local function MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, nFacInd, d
sNotes = sNotes .. 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -250,7 +256,7 @@ local function CalcBladeUse( bUseBlade, bDown_Head, nSide, vtN1, vtN2, bConvex,
end
end
else
if ( vtN1 and vtN1:getZ() >= EgtIf( dCustomAngle, dCustomAngle, -0.5)) or ( vtN2 and vtN2:getZ() >= -0.5) then
if ( vtN1 and vtN1:getZ() >= EgtIf( dCustomAngle, dCustomAngle, -0.5)) and ( not vtN2 or vtN2:getZ() >= -0.5) then
bCanUseBlade = true
end
end
@@ -290,9 +296,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- verifico posizione (+1=sopra, -1=sotto, 0=sui lati)
local nSide = 0
if vtN[1]:getZ() > -10 * GEO.EPS_SMALL and vtN[2]:getZ() > -10 * GEO.EPS_SMALL then
if vtN[1]:getZ() > 0.0175 and vtN[2]:getZ() > 0.0175 then
nSide = 1
elseif vtN[1]:getZ() < 10 * GEO.EPS_SMALL and vtN[2]:getZ() < 10 * GEO.EPS_SMALL then
elseif vtN[1]:getZ() < -0.0175 and vtN[2]:getZ() < -0.0175 then
nSide = -1
end
@@ -301,39 +307,21 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local bConvex
local bOrtho
local ptM
local ptRef = ( ptC[1] + ptC[2]) / 2
if bInt then
bConvex = ( dAng >= 0)
bOrtho = ( abs( dAng + 90) < 1)
ptM = ( ptP1 + ptP2) / 2
else
bConvex = true
ptM = ptRef
local vtM1 = ptC[1] - ptM ; vtM1:normalize()
local vtM2 = ptC[2] - ptM ; vtM2:normalize()
bConvex = ( vtM1 * vtN[1] > 0 and vtM2 * vtN[2] > 0)
bOrtho = false
dAng = acos( vtN[1] * vtN[2])
ptM = ( ptC[1] + ptC[2]) / 2
-- se facce contrapposte e quindi concavo, angolo sempre negativo
if not bConvex and dAng > 0 then dAng = -dAng end
end
local ptRef = ( ptC[1] + ptC[2]) / 2
-- analisi del taglio
local vOrd = {}
local vFaceUse = {}
if nSide == 1 or ( nSide == -1 and BD.DOWN_HEAD) then
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
elseif nSide == -1 then
vOrd = EgtIf( ptC[1]:getY() < ptM:getY(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)}
else
local bFront = ( vtN[1]:getY() < 0)
if bFront then
vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
else
vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 2, 1}, { 1, 2})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
end
end
local vWidth = {}
_, _, vWidth[1] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[1])
_, _, vWidth[2] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[2])
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or 5.4
@@ -365,23 +353,41 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- verifico se posso usare lame
local bCanUseBlade, bCanUseUnderBlade = CalcBladeUse( bUseBlade, BD.DOWN_HEAD, nSide, vtN[1], vtN[2], bConvex)
-- introduco messaggi di errore in caso sia settata la lama ma impossibile utilizzarla
-- se si toglie questa parte il processo continua utilizzandi però la fresa ma per il vincolo del parametro Q non è possibile
-- se si toglie questa parte il processo continua utilizzando però la fresa ma per il vincolo del parametro Q non è possibile
if bUseBlade and not BD.DOWN_HEAD and not bCanUseBlade then
local sErr = 'Error, impossible use blade on too negative face'
EgtOutLog( sErr)
return false, sErr
-- elseif bUseBlade and not bCanUseBlade then
-- local sErr = 'Error, impossible use blade'
-- EgtOutLog( sErr)
-- return false, sErr
elseif bUseBlade and BD.DOWN_HEAD and not bCanUseBlade and not bCanUseUnderBlade then
local sErr = 'Error, impossible use blade'
EgtOutLog( sErr)
return false, sErr
end
-- analisi del taglio
local vOrd = {}
local vFaceUse = {}
if nSide == 1 or ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)) then
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
elseif nSide == -1 then
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)}
else
local bFront = ( vtN[1]:getY() < 0 or vtN[2]:getY() < 0)
if bFront then
vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
else
vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 2, 1}, { 1, 2})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
end
end
local vWidth = {}
_, _, vWidth[1] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[1])
_, _, vWidth[2] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[2])
-- Se senza facce limitanti, da sopra o ( da tutte i lati con testa da sotto) e taglio di lama e lunghezza facce maggiore del parametro lunghezza minima
-- if nFaceLimit == 0 and ( nSide == 1 or ( abs(nSide) >= 0 and BD.DOWN_HEAD)) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then
if nFaceLimit == 0 and ( bCanUseUnderBlade or bCanUseBlade) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then
local sCutting
@@ -394,7 +400,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local dMaxDepthDn = 0
-- recupero la lavorazione
if bCanUseUnderBlade then
sCuttingDn = ML.FindCutting( 'HeadSide_H2')
sCuttingDn = ML.FindCutting( 'HeadSide_H2', false, true)
if not sCuttingDn then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing underneath not found in library'
EgtOutLog( sErr)
@@ -503,8 +509,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dC = dCDn
end
-- disabilitato la selezione del codolo, prende sempre quello più piccolo. Non cancellare quello disabiliato in caso di ripristino
-- local dDimStrip = EgtIf( nSide ~= 0, BD.DIM_STRIP_SMALL, BD.DIM_STRIP)
-- uso codolo piccolo
local dDimStrip = BD.DIM_STRIP_SMALL * EgtIf( nSide == -1, -1, 1)
local nM = 0
-- se convesso lavoro ogni faccia in due metà lasciando attaccata la parte centrale
@@ -572,7 +577,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local nMchFId
local sCuttingName
local bMachDown
-- if ( k == 1 and bCanUseBlade) or ( k == 2 and ( bCanUseBlade and not bCanUseUnderBlade)) then
if bCanUseBlade and not bCanUseUnderBlade then
sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCutting)
@@ -580,7 +584,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistUp
dStartAccDist = dStartAccDistUp
-- elseif ( k == 2 and bCanUseUnderBlade) or ( k == 1 and ( bCanUseUnderBlade and not bCanUseBlade)) then
elseif bCanUseUnderBlade and not bCanUseBlade then
sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCuttingDn)
@@ -677,15 +680,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dSal, dEal = dEal, dSal
end
if bCanUseBlade and bCanUseUnderBlade then
-- if bCanUseBlade and nSide == -1 then
-- EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- else
-- EgtSetMachiningParam( MCH_MP.INVERT, true)
-- EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- dSal, dEal = dEal, dSal
-- end
-- -- imposto uso della faccia
-- EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse))
if bCanUseBlade and nSide == -1 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- imposto uso della faccia
@@ -729,7 +723,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- imposto posizione braccio porta testa per non ingombrare agli estremi
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -768,7 +762,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- se faccia da sotto e Z centro faccia è minore del centro altra faccia, segno il limite angolare da passare
-- dovrebbe essere il limite angolare della testa 1 in sottosquadra
if nSide == -1 and not BD.DOWN_HEAD then
if ptC[vOrd[j]]:getZ() < ptC[vOrd[OthFace]]:getZ() then
if ptC[vOrd[j]]:getZ() < ptC[vOrd[OthFace]]:getZ() - 1. then
dSinLimit = -0.0157
else
dSinLimit = -0.5
@@ -858,7 +852,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- determino e imposto l'utilizzo della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[j]])
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -866,8 +860,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end
end
end
-- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut
elseif ( ( nSide ~= -1 or BD.DOWN_HEAD) or ( nSide == -1 and BD.DOWN_HEAD)) and nUseMillOnSide == 0 then
elseif ( nSide ~= -1 or BD.DOWN_HEAD or BD.TURN) and nUseMillOnSide == 0 then
-- determino la massima elevazione
local dElev = 0
local dFacElev1 = BL.GetFaceElevation( Proc.Id, tFaceLong[1], nPartId)
@@ -881,11 +876,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end
-- recupero la lavorazione
local sMilling
if nSide == -1 and BD.DOWN_HEAD then
sMilling = ML.FindMilling( 'Long2Cut_H2', dElev)
else
sMilling = ML.FindMilling( 'Long2Cut', dElev)
end
local bDownHead = ( nSide == -1 and BD.DOWN_HEAD)
sMilling = ML.FindMilling( 'Long2Cut', dElev, nil, nil, nil, not bDownHead, bDownHead)
if not sMilling then
local sErr = 'Error : Long2Cut not found in library'
@@ -908,10 +900,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- se la fine (a sinistra) non è limitata e ho un pezzo successivo più distante da metà raggio. setto la fine come limitata
if dDistToNextPiece < dToolDiam/2 and nFaceLimit < 2 then
-- se ho un pezzo successivo più distante di metà raggio : setto la fine come limitata
if dDistToNextPiece < dToolDiam/2 then
bForcedLim = true
nFaceLimit = nFaceLimit + 2
nFaceLimit = nFaceLimit | 2
end
-- se chiuso e corto, applico svuotatura con fresa opportuna
if nFaceLimit == 3 and Proc.Box:getDimX() < 2 * dToolDiam then
@@ -947,10 +939,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local nIncStep = 2
if bStartFixed and bEndFixed then
dC = ( dLen - dStartAccDist - dEndAccDist) / nC
-- se distanza rimanente è < della metà del minimo della distanza estremi allora aggiungo un passo in più
-- se distanza rimanente è < della metà del minimo della distanza estremi allora aggiungo un solo passo in più
local dMinDist = EgtIf( min( dStartAccDist, dEndAccDist) / 2 > 300 , 300, min( dStartAccDist, dEndAccDist) / 2)
if dC < dMinDist then
dC = dLen / ( nC + 2)
dC = dLen / ( nC + 1)
dStartAccDist = dC
dEndAccDist = dC
nIncStep = 1
@@ -1032,6 +1024,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end
end
end
if nIni == 2 then
dStartDist, dEndDist = dEndDist, dStartDist
dStartAccDist, dEndAccDist = dEndAccDist, dStartAccDist
end
-- ciclo sulle parti
local nM = 0
for j = 1, nC do
@@ -1040,7 +1036,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- valore sovrapposizione tra passate con fresa di fianco
local dOverLapExtend = 2
-- Verifico se da fare di fianco perchè normale troppo verso il basso (minore di -30deg)
local bSide = ( vtN[vOrd[i]]:getZ() < dLimitAngle and not ( nSide == -1 and BD.DOWN_HEAD))
local bSide = ( vtN[vOrd[i]]:getZ() < dLimitAngle and not ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)))
-- Limitazioni della lavorazione
local nPos = EgtIf( i == 1, j, nC - j + 1)
local dSal = EgtIf( nPos == 1, - EgtIf( i == nIni, dStartDist, dEndDist), - EgtIf( i == nIni, dStartAccDist, dEndAccDist) - ( nPos - 2) * dC + EgtIf( bSide, dOverLapExtend, 0))
@@ -1048,7 +1044,17 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- Posizione braccio portatesta
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
nSCC = EgtIf( ( j == 1 or j == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if not BD.TURN then
nSCC = EgtIf( ( j == 1 or j == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
else
if nSide == 1 then
nSCC = EgtIf( vtN[vOrd[i]]:getY() < -0.5, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
elseif nSide == -1 then
nSCC = EgtIf( vtN[vOrd[i]]:getY() < 0, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
else
nSCC = MCH_SCC.ADIR_ZP
end
end
end
if bSide and not bConvex then
dSal, dEal = dEal, dSal
@@ -1110,7 +1116,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
EgtSetMachiningParam( MCH_MP.STARTPOS, 80)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -1126,7 +1132,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end
end
end
-- altrimenti è sotto : lavorazione Long2CutDown
-- altrimenti lavorazione di fianco : Long2CutSide o Long2CutDown
else
-- da Analisi con Fabio Squaratti 15/09/2020
-- variabile che indica se ripassare sul raggio rimasto dalla lavorazione di fianco
@@ -1136,26 +1143,27 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- se nExtendMach = 2 la lavorazione viene estesa ma arretra per non segnare il pezzo successivo (se non ha facce limite)
local nExtendMach
-- recupero la lavorazione
local sMilling
local sMillingDn
local sPrefix
local sPrefixDn
local sMchType, sMchTypeDn
local sMilling, sMillingDn
local sPrefix, sPrefixDn
if nSide ~= - 1 then
sMilling = ML.FindMilling( 'Long2CutSide')
sMchType = 'Long2CutSide'
sMilling = ML.FindMilling( sMchType)
sPrefix = 'L2CS_'
nExtendMach = nUseMillOnSide
if nUseMillOnSide == 2 then
bRemoveToolRadius = true
-- nExtendMach = 0 -- arretro la lavorazione del raggio utensile (se non ha facce limite)
end
-- se testa da sotto
if nSide ~= 1 and BD.DOWN_HEAD then
sMillingDn = ML.FindMilling( 'Long2CutSide_H2')
sMchTypeDn = 'Long2CutSide_H2'
sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true)
sPrefixDn = 'L2CSH2_'
end
-- lavorazione da sotto
else
sMilling = ML.FindMilling( 'Long2CutDown', nil, nil, EgtIf( nUseMillOnSide > 0, 150, 50))
else
sMchType = 'Long2CutDown'
sMilling = ML.FindMilling( sMchType)
sPrefix = 'L2CD_'
nExtendMach = 1
if nUseMillOnSide ~= 1 then
@@ -1163,17 +1171,18 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end
-- se testa da sotto
if BD.DOWN_HEAD then
sMillingDn = ML.FindMilling( 'Long2CutDown_H2')
sMchTypeDn = 'Long2CutDown_H2'
sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true)
sPrefixDn = 'L2CDH2_'
end
end
if not sMilling then
local sErr = 'Error : Long2CutSide or Long2CutDown not found in library'
if not sMilling and ( nSide == 1 or not BD.DOWN_HEAD) then
local sErr = 'Error : milling '..sMchType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
if nSide ~= 1 and BD.DOWN_HEAD and not sMillingDn then
local sErr = 'Error : Long2CutSide_H2 or Long2CutDown_H2 not found in library'
if not sMilling and not sMillingDn then
local sErr = 'Error : milling '..sMchType..' and '..sMchTypeDn..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
@@ -1263,20 +1272,43 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local nC = ceil( ( dLen - dStartAccDist - dEndAccDist) / BD.LONGCUT_MAXLEN)
local dC = 0
if nC > 0 then
local nIncStep = 2
if bStartFixed and bEndFixed then
dC = ( dLen - dStartAccDist - dEndAccDist) / nC
-- se distanza rimanente è < della metà del minimo della distanza estremi allora aggiungo un solo passo in più
local dMinDist = EgtIf( min( dStartAccDist, dEndAccDist) / 2 > 300 , 300, min( dStartAccDist, dEndAccDist) / 2)
if dC < dMinDist then
dC = dLen / ( nC + 1)
dStartAccDist = dC
dEndAccDist = dC
nIncStep = 1
elseif dC < min( dStartAccDist, dEndAccDist) then
dC = dLen / ( nC + 2)
dStartAccDist = dC
dEndAccDist = dC
end
elseif bStartFixed then
dC = ( dLen - dStartAccDist) / ( nC + 1)
dEndAccDist = dC
if dC < dStartAccDist then
dC = dLen / ( nC + 2)
dStartAccDist = dC
dEndAccDist = dC
end
elseif bEndFixed then
dC = ( dLen - dEndAccDist) / ( nC + 1)
dStartAccDist = dC
if dC < dEndAccDist then
dC = dLen / ( nC + 2)
dStartAccDist = dC
dEndAccDist = dC
end
else
dC = dLen / ( nC + 2)
dStartAccDist = dC
dEndAccDist = dC
end
nC = nC + 2
nC = nC + nIncStep
else
if dLen > min( dStartAccDist, dEndAccDist) then
nC = 2
@@ -1377,7 +1409,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
if BD.DOWN_HEAD and nSide ~= 1 then
local ptC3 = EgtSurfTmFacetCenter( Proc.Id, tFaceLong[vOrd[i]], GDB_ID.ROOT)
local ptDir = ptC3 - ptM ; ptDir:normalize()
-- se concave e dal versore Z della faccia (> -20°) o convesso e versore Z ( > -30°) decido se eseguire la lavoraione con la testa d a sopra o da sotto
-- se concave e dal versore Z della faccia (> -20°) o convesso e versore Z ( > -30°) decido se eseguire la lavoraione con la testa da sopra o da sotto
if ( not bConvex and vtN[vOrd[i]]:getZ() > -0.9397 and ptDir:getZ() > 0) or
( bConvex and vtN[vOrd[i]]:getZ() > -0.866 and ptDir:getZ() > 0) then
sNameF = sPrefix .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
@@ -1417,64 +1449,41 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- se fresa di fianco e non da sotto
if nUseMillOnSide > 0 and nSide ~= -1 then
-- se faccia da sopra o di fianco
if nSide >= 0 then
if bConvex then
local vFaceUse2
-- se da sopra
if nSide == 1 then
if vtN[vOrd[i]]:getZ() > 0.866 then
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 1, 2)], vtN[EgtIf(vOrd[i] == 1, 2, 1)])
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
-- EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_TOP)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
else
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
end
-- altrimenti è di fianco
if bConvex then
local vFaceUse2
-- se da sopra
if nSide == 1 then
if vtN[vOrd[i]]:getZ() > 0.866 then
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 1, 2)], vtN[EgtIf(vOrd[i] == 1, 2, 1)])
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
else
if vtN[vOrd[i]]:getY() > 0.866 then
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_TOP)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
else
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
end
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
end
-- se concavo
-- altrimenti è di fianco
else
local vFaceUse2
-- se da sopra
if nSide == 1 then
-- vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)])
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)], vtN[EgtIf(vOrd[i] == 1, 1, 2)])
-- altrimenti è di fianco
if vtN[vOrd[i]]:getY() > 0.866 then
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_TOP)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
else
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)])
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
end
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
end
-- questa parte non viene mai eseguita
-- se faccia da sotto
-- else
-- if bConvex then
-- EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
-- if vtN[vOrd[i]]:getZ() >= 0 then
-- EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
-- EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
-- end
-- else
-- -- lascio lo stesso le lavorazioni anche se viene intercettato l'errore
-- local vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)])
-- EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
-- if vtN[vOrd[i]]:getZ() < 0 then
-- EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
-- EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
-- end
-- end
-- se concavo
else
local vFaceUse2
-- se da sopra
if nSide == 1 then
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)], vtN[EgtIf(vOrd[i] == 1, 1, 2)])
-- altrimenti è di fianco
else
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)])
end
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
end
else
-- se con fresa di fianco
@@ -1492,7 +1501,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end
else
-- lascio lo stesso le lavorazioni anche se viene intercettato l'errore
-- local vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)])
local vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)], vtN[EgtIf(vOrd[i] == 1, 1, 2)])
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
if vtN[vOrd[i]]:getZ() < 0 then
@@ -1518,14 +1526,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- local dNz = EgtIf( abs(vtN[vOrd[i]]:getY()) >= abs(vtN[vOrd[i]]:getZ()), vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ())
local dNz = EgtIf( abs(nSide) == 1, vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ())
local dNzMin = EgtIf( abs(vtN[vOrd[i]]:getY()) >= abs(vtN[vOrd[i]]:getZ()), vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ())
local dLioPerp1, dLioPerp2
-- nel caso concavo, devo impostare la lunghezza di attacco ortogonale
if not bConvex then
dLioPerp1 = EgtIf( i == 1, dFacElev1, dFacElev2)
-- dLioPerp1 = vWidth[vOrd[i]] * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, sqrt( 1 - dNz * dNz) / abs( dNz)) + BD.COLL_SIC
dLioPerp2 = vWidth[ EgtIf( vOrd[i] == 1, 2,1)] + BD.COLL_SIC
EgtSetMachiningParam( MCH_MP.LIPERP, max( dLioPerp1, dLioPerp2))
EgtSetMachiningParam( MCH_MP.LOPERP, max( dLioPerp1, dLioPerp2))
local dLioPerp = EgtIf( i == 1, dFacElev1, dFacElev2) + BD.COLL_SIC
EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp)
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp)
end
-- verifico massimo affondamento (tengo conto dell'inclinazione utensile e della pinza con estremità conica)
-- 08/09/2020 tolti i 3mm ( per la ghiera smussata) perchè nella verifica collisione vine creato un cilindro non smussato che rileva la collisione
@@ -1553,23 +1558,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dDepth2 = vWidth[vOrd[i]] + dAgg - dDepth
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth - dExtraElev)
end
-- EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- eseguo
if not EgtApplyMachining( true, false) then
-- se feature orientata su faccia da sotto e concave provo a cambiare l'attacco
if nSide == -1 and not bConvex then
EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp1)
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp1)
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
else
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
-- se facce principali convesse, eventuale lavorazione della faccia limitante l'inizio (a destra)
if bConvex and j == 1 and not bStartFixed and bRemoveToolRadius then
+6 -9
View File
@@ -1,4 +1,4 @@
-- ProcessMark.lua by Egaltech s.r.l. 2021/05/03
-- ProcessMark.lua by Egaltech s.r.l. 2022/06/07
-- Gestione calcolo marcatura per Travi
-- 2020/05/28 Tipo di lavorazione passato da Mark a Text.
-- 2021/05/03 Aggiunta gestione testa da sotto.
@@ -60,7 +60,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
return false, sErr
end
-- verifico che la marcatura non sia orientata verso il basso (-5 deg)
if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD then
if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mark from bottom impossible'
EgtOutLog( sErr)
return false, sErr
@@ -70,11 +70,8 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
-- recupero la lavorazione
local sMillType = 'Text'
local sMchExt = EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sMillType..sMchExt)
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType)
end
--local sMchExt = EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr)
@@ -97,7 +94,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -121,7 +118,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchF2Id, false)
return false, sErr
+220 -18
View File
@@ -2,6 +2,10 @@
-- Gestione calcolo mortase per Travi
-- 2021/07/20 Aggiunta gestione rinvio angolare su FAST.
-- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda).
-- 2022/07/26 Aggiunta gestione del parametro P04=1 per la pulizia degli angoli con mortasatrice (sega a catena) specifica
-- 2022/07/29 Nella pulitura angoli aggiunto il check dimensioni tasca vs utensile. Corretta direzione utensile per mortasa frontale.
-- 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.
-- Tabella per definizione modulo
local ProcessMortise = {}
@@ -79,6 +83,184 @@ function ProcessMortise.GetCutPlane( Proc)
end
---------------------------------------------------------------------
-- Aggiunge la lavorazione di pulizia angoli
local function AddCleanCornersMachining( nProcId, sMortising, nWorkFaceInd, vtN, dDepth)
-- aggiungo la lavorazione
local sName = 'Mort_' .. ( EgtGetName( nProcId) or tostring( nProcId)) .. '_CleanCorners1'
local nMchFId = EgtAddMachining( sName, sMortising)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMortising
EgtOutLog( sErr)
return false, sErr
end
-- imposto geometria
EgtSetMachiningGeometry( {{ nProcId, nWorkFaceInd}})
-- imposto lato di lavoro e inversione
local vtFaceN = EgtSurfTmFacetNormVersor( nProcId, nWorkFaceInd, GDB_ID.ROOT)
local bInvert = ( vtFaceN:getZ() < -GEO.EPS_SMALL or vtFaceN:getY() > GEO.EPS_SMALL)
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bInvert, MCH_MORTISE_WS.LEFT, MCH_MORTISE_WS.RIGHT))
EgtSetMachiningParam( MCH_MP.INVERT, bInvert)
-- se richiesto, imposto affondamento
if dDepth then
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
end
-- imposto uso del lato faccia
local nFaceUse = BL.GetNearestParalOpposite( vtN)
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- applico il parametro plunge, che setta la lavorazione per affondare solamente, senza lavorare tutto il contorno; 1: solo lato iniziale, 2: solo lato finale, 3: entrambi
sNotes = 'Plunge=3;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- imposto angolo 3° asse rot
local vtOrtho = BL.GetVersRef( nFaceUse)
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
-- calcolo la lavorazione
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
return true, sWarn
end
---------------------------------------------------------------------
-- Pulizia angoli nel caso sia settato il parametro P04=1
local function CleanCorners( Proc, dMorH, vtN, bDoubleDir, AuxId)
-- verifico se è attiva la pulizia e se l'orientamento della feature è adeguato
local bCleanCorners = ( EgtGetInfo( Proc.Id, 'P04', 'i') == 1 and
( AreSameOrOppositeVectorApprox( vtN, X_AX()) or
AreSameOrOppositeVectorApprox( vtN, Y_AX()) or
AreSameOrOppositeVectorApprox( vtN, Z_AX())))
if not bCleanCorners then
EgtOutLog( 'Warning: mortising not aligned with XYZ axes, corner cleaning skipped')
return
end
-- cerco la lavorazione adatta
local sMortisingCleanCorners = ML.FindSawing( 'Mortising')
if not sMortisingCleanCorners then
EgtOutLog( 'Warning: mortising tool not found, corner cleaning skipped')
return
end
-- recupero i dati dell'utensile
local dSawWidth = 50
local dSawThick = 12
local dMaxDepth = 200
if EgtMdbSetCurrMachining( sMortisingCleanCorners) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawWidth = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawWidth
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- se l'utensile non arriva in fondo, riduco l'affondamento
local sWarn
local dDepth
local bUseDoubleDir
if bDoubleDir then
if ( 2 * dMorH + dSawWidth / 2) > dMaxDepth + 10 * GEO.EPS_SMALL then
bUseDoubleDir = true
if ( dMorH + dSawWidth / 2) > dMaxDepth + 10 * GEO.EPS_SMALL then
dDepth = dMaxDepth
sWarn = 'Warning in corner cleaning with mortise: elevation (' .. EgtNumToString( dMorH + dSawWidth / 2, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
else
dDepth = dMorH + dSawWidth / 2
end
else
dDepth = 2 * dMorH + dSawWidth / 2
end
else
if dMorH > dMaxDepth + 10 * GEO.EPS_SMALL then
dDepth = dMaxDepth
sWarn = 'Warning in corner cleaning with mortise: elevation (' .. EgtNumToString( dMorH, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
end
end
-- verifico se la tasca ha dimensioni sufficienti per l'utensile
local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.05)
local frMor, dMortiseWidth, dMortiseThick = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT)
if abs( frMor:getVersX() * X_AX()) < abs( frMor:getVersY() * X_AX()) then
dMortiseWidth, dMortiseThick = dMortiseThick, dMortiseWidth
end
EgtErase( nFlat)
if dSawWidth >= dMortiseWidth + 10 * GEO.EPS_SMALL or dSawThick >= dMortiseThick + 10 * GEO.EPS_SMALL then
sWarn = 'warning in corner cleaning with mortise: pocket too small'
EgtOutLog( sWarn)
return true, sWarn
end
-- cerco le due facce migliori da lavorare
local nWorkFaceInd, nWorkFaceInd2
if AreSameOrOppositeVectorApprox( vtN, X_AX()) then
nWorkFaceInd, _, _ = BL.FindFaceBestOrientedAsAxis( Proc, vtN ^ Y_AX())
nWorkFaceInd2, _, _ = BL.FindFaceBestOrientedAsAxis( Proc, vtN ^ Y_AX(), nWorkFaceInd)
else
nWorkFaceInd, _, _ = BL.FindFaceBestOrientedAsAxis( Proc, vtN ^ X_AX())
nWorkFaceInd2, _, _ = BL.FindFaceBestOrientedAsAxis( Proc, vtN ^ X_AX(), nWorkFaceInd)
end
-- lavoro la prima faccia
local bOk1, sErr = AddCleanCornersMachining( Proc.Id, sMortisingCleanCorners, nWorkFaceInd, vtN, dDepth)
-- lavoro la seconda faccia
local bOk2, sErr2 = AddCleanCornersMachining( Proc.Id, sMortisingCleanCorners, nWorkFaceInd2, vtN, dDepth)
if sErr2 then sErr = ( sErr or '') .. EgtIf( sErr, '\n', '') .. sErr2 end
-- se richiesto di lavorare dall'altra parte
if bUseDoubleDir then
local bOk3, sErr3 = AddCleanCornersMachining( Proc.Id, sMortisingCleanCorners, nWorkFaceInd, -vtN, dDepth)
if sErr3 then sErr = ( sErr or '') .. EgtIf( sErr, '\n', '') .. sErr3 end
local bOk4, sErr4 = AddCleanCornersMachining( Proc.Id, sMortisingCleanCorners, nWorkFaceInd2, -vtN, dDepth)
if sErr4 then sErr = ( sErr or '') .. EgtIf( sErr, '\n', '') .. sErr4 end
end
if not bOk1 or not bOk2 or not bOk3 or not bOk4 then
return false, sErr
end
return true, sWarn
end
---------------------------------------------------------------------
local function VerifyMortiseOrPocket( Proc, dDiam, dDepth, dMaxTotLen, sType, bPocketDown)
-- ricerca della svuotatura
local sPocketing
if dDepth then
sPocketing = ML.FindPocketing( sType, dDiam, dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
ML.FindPocketing( sType, dDiam, 0.8 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
ML.FindPocketing( sType, dDiam, 0.6 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
ML.FindPocketing( sType, dDiam, 0.4 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
ML.FindPocketing( sType, dDiam, 0, dMaxTotLen)
else
sPocketing = ML.FindPocketing( sType, dDiam, 0, dMaxTotLen)
end
if not sPocketing then
return false
end
-- recupero i dati dell'utensile
local dMaxDepth = 0
local dToolDiam = 0
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
return sPocketing, dMaxDepth, dToolDiam
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- ingombro del pezzo
@@ -157,9 +339,11 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local dMove = bxMin:getZ()-bxMax:getZ()
-- se il percorso ausiliario è esterno al grezzo, lo riavvicino
if abs( dMove) > GEO.EPS_SMALL then
AuxId = EgtCopyGlob( AuxId, BL.GetAddGroup(nPartId))
EgtMove( AuxId, Vector3d(0,0,-dMove))
EgtMove( nFlat, Vector3d(0,0,-dMove))
AuxId = EgtCopyGlob( AuxId, BL.GetAddGroup( nPartId))
local vtMove = Vector3d(0,0,dMove)
vtMove:toGlob(frMor)
EgtMove( AuxId, vtMove, GDB_RT.GLOB)
EgtMove( nFlat, vtMove, GDB_RT.GLOB)
frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT)
ptC = frMor:getOrigin()
vtN = frMor:getVersZ()
@@ -172,8 +356,8 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
-- Se mortasa chiusa
if not bOpenBtm then
-- verifico che la mortasa non sia orientata verso il basso (limite -5 deg) o che ci sia una testa da sotto o un rinvio angolare
if vtN:getZ() < -0.1 and not BD.DOWN_HEAD and not BD.ANG_TRASM then
-- verifico che la mortasa non sia orientata verso il basso (limite -5 deg) o che ci sia una testa da sotto o un rinvio angolare o macchina Turn
if vtN:getZ() < -0.1 and not BD.DOWN_HEAD and not BD.ANG_TRASM and not BD.TURN then
local sErr = 'Error : Mortise from bottom impossible'
EgtOutLog( sErr)
return false, sErr
@@ -198,7 +382,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -236,16 +420,16 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
local sPocketing
if Proc.Prc ~= 53 then
sPocketing = ML.FindPocketing( sPockType..sMchExt, dW)
sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown)
if not sPocketing and bPockUp then
sPocketing = ML.FindPocketing( sPockType, dW)
sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt)
end
end
if not sPocketing then
sPockType = 'Pocket'
sPocketing = ML.FindPocketing( sPockType..sMchExt, dW)
sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt, bPockDown)
if not sPocketing and bPockUp then
sPocketing = ML.FindPocketing( sPockType, dW)
sPocketing = VerifyMortiseOrPocket( Proc, dW, dMorH, nil, sPockType..sMchExt)
end
end
if not sPocketing then
@@ -286,8 +470,12 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local nSCC = MCH_SCC.NONE
if bPockAngTrasm then
nSCC = MCH_SCC.ADIR_NEAR
elseif not BD.C_SIMM then
if vtN:getY() < GEO.EPS_SMALL then
elseif not BD.C_SIMM then
if abs( vtN:getX()) < GEO.EPS_SMALL and abs( vtN:getY()) < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtN:getX()) < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_XP
elseif vtN:getY() < GEO.EPS_SMALL then
nSCC = EgtIf( bRevertSide, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else
nSCC = EgtIf( bRevertSide, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
@@ -321,7 +509,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMorH, 1) .. ';')
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -346,11 +534,19 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- sistemo la direzione di lavoro
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
-- imposto posizione braccio porta testa
if vtN:getY() < GEO.EPS_SMALL then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
if abs( vtN:getX()) < GEO.EPS_SMALL and abs( vtN:getY()) < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtN:getX()) < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_XP
elseif vtN:getY() < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_YP
else
nSCC = MCH_SCC.ADIR_YM
end
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- se altezza mortasa differente da altezza massima lavorabile
if abs( dMorH - dMaxDepth) > GEO.EPS_SMALL then
nDepthMin = -dMorH
@@ -362,12 +558,18 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (-nDepthMin+BD.CUT_EXTRA), 1) .. ';')
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
-- verifico se necessaria la pulizia degli angoli ( tenone ad angoli non raggiati) e applico nel caso
local _, sWarn2 = CleanCorners( Proc, dMorH, vtN, bOpenBtm and not bForceOneSide, AuxId)
if sWarn2 then
if not sWarn then sWarn = '' end
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
end
return true, sWarn
end
+172 -111
View File
@@ -1,10 +1,14 @@
-- ProcessProfCamb.lua by Egaltech s.r.l. 2022/01/26
-- ProcessProfCamb.lua by Egaltech s.r.l. 2022/11/03
-- Gestione calcolo profilo caudato per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
-- 2021/10/12 Estesa gestione di testa da sotto, se presente.
-- 2021/10/12 Portato a 30deg l'angolo limite per fare l'antischeggia.
-- 2022/01/26 Migliorato controllo lavorazione con fresa su testa da sotto.
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- 2022/11/03 Correzione per riconoscimento testa da sotto su fresatura.
-- Tabella per definizione modulo
local ProcessProfCamb = {}
@@ -13,6 +17,7 @@ local ProcessProfCamb = {}
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfCamb started', 1)
@@ -62,6 +67,12 @@ function ProcessProfCamb.Classify( Proc, b3Raw)
end
end
---------------------------------------------------------------------
-- Verifico se richiesto il solo smusso
function ProcessProfCamb.OnlyChamfer( Proc)
return (( EgtGetInfo( Proc.Id, sDepthChamferMill, 'd') or 0) > 0.1 and EgtGetInfo( Proc.Id, sPreemptiveChamfer, 'i') == 1)
end
---------------------------------------------------------------------
local function GetSawCutData( AuxId, vtNF)
-- comincio con la normale a 45deg
@@ -128,7 +139,7 @@ local function ModifySideAndInvert( Proc, bHead, bForceInvert, nCutLengthMach)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, nCutLengthMach)
end
-- riapplico la lavorazione
EgtApplyMachining( true, false)
ML.ApplyMachining( true, false)
end
end
end
@@ -140,12 +151,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0 then
if dDepth > 0.1 then
nChamfer = 1
end
-- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if dDepth > 0 then
if nChamfer == 1 then
nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco
else
@@ -174,19 +185,15 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
-- recupero la lavorazione
local sMilling, sMilling2
if nChamfer > 0 then
if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP then
sMilling = ML.FindMilling( 'Mark_H2')
if not sMilling then sMilling = ML.FindMilling( 'Mark') end
else
sMilling = ML.FindMilling( 'Mark')
end
local bDownHead = BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, true, bDownHead)
if not sMilling then
local sErr = 'Error : chamfer not found in library'
EgtOutLog( sErr)
return -1, 0, sErr
end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then
sMilling2 = ML.FindMilling( 'Mark_H2')
sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr)
@@ -201,6 +208,7 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -272,33 +280,50 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bMakeAs = true
end
end
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
-- se smusso non è esclusivo, aggiungo sgrossatura
if nChamfer < 2 then
-- aggiungo taglio di lama di sgrossatura e lo lavoro
-- aggiungo piano di sgrossatura e lo lavoro
local ptStart, vtNP = GetSawCutData( AuxId, vtNF)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico la lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then return bOk, sErr end
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
-- recupero la lavorazione
local sPockType = 'OpenPocket'
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false)
if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- eseguo le svuotature necessarie
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then
return false, sErr
end
-- altrimenti applico taglio di lama
else
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then
return false, sErr
end
end
end
-- leggo anticipatamente i parametri utensile fresa per dare un valore opportuno all'elevazione della lama
-- recupero la lavorazione di fresatura
local sMillType = 'Prof'
sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''))
if not sMilling and bMillDown then
sMilling = ML.FindMilling( sMillType)
bMillDown = false
end
local bH2
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bMillDown)
if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr)
return false, sErr
end
bMillDown = ( bMillDown and bH2)
-- Recupero i dati dell'utensile
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
@@ -312,7 +337,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if ( nSide ~= -1 or bMillDown) and nLastFacet and EgtGetInfo( Proc.Id, sEnableExtraBladeUpperFace, 'i') == 1 then
-- recupero la lavorazione
local sCutType = 'HeadSide'
local sCutting = ML.FindCutting( sCutType .. EgtIf( bMillDown, '_H2', ''))
local sCutting = ML.FindCutting( sCutType, not bMillDown, bMillDown)
-- se richiesto taglio con lama da sotto e non trovato non posso utilizzare quello da sopra
if not sCutting then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing not found in library'
@@ -383,7 +408,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -430,7 +455,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -444,9 +469,124 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se il chamfer non è esclusivo continuo con le altre lavorazioni
if nChamfer < 2 then
-- verifico se necessario lavorare in doppio
local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
-- inserisco la lavorazione
-- se lavorazione da due parti, aggiungo la seconda
local sMillingDown
if bDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
sWarn = 'Warning : milling from bottom not found in library'
EgtOutLog( sWarn)
bDouble = false
end
else
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
bDouble = false
end
end
end
-- se orizzontale o trovata lavorazione per doppio verticale
if bDouble then
-- inserisco la lavorazione
local sName
if bMakeAs then
sName = 'ProfB_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
else
sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
end
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- se lavorazione da sopra e da sotto
if ( nSide == 0) then
if vtExtr:getZ() > 0.1 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
-- altrimenti lavorazione davanti e dietro
else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
bFinish = true
end
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione
ModifySideAndInvert( Proc, bHead)
end
-- se devo fare l'antischeggia in testa
if bMakeAs then
local sNewName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
-- copio lavorazione per ingresso antischeggia (la copia è la lavorazione finale)
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
-- rendo corrente la precedente, la inverto e modifico il parametri di uscita
EgtSetCurrMachining( nMchId)
local dCrvLen = EgtCurveLength( AuxId)
if dCrvLen > abs(dMakeAntiSplintOnHead) then
ModifySideAndInvert( Proc, bHead, true, ( abs(dMakeAntiSplintOnHead) - dCrvLen))
end
-- rendo corrente la copia (cioè la lavorazione completa)
EgtSetCurrMachining( nMch2Id)
nMchId = nMch2Id
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- inserisco la prima lavorazione
local sName
if bMakeAs then
sName = 'Prof_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -509,7 +649,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -547,92 +687,13 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
-- se lavorazione da due parti, aggiungo la seconda
if bDouble then
-- inserisco la lavorazione
local sName
if bMakeAs then
sName = 'ProfB_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
else
sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
end
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- sempre lavorazione da sopra o da sotto
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione
ModifySideAndInvert( Proc, bHead)
end
-- se devo fare l'antischeggia in testa
if bMakeAs then
local sNewName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
-- copio lavorazione per ingresso antischeggia (la copia è la lavorazione finale)
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
-- rendo corrente la precedente, la inverto e modifico il parametri di uscita
EgtSetCurrMachining( nMchId)
local dCrvLen = EgtCurveLength( AuxId)
if dCrvLen > abs(dMakeAntiSplintOnHead) then
ModifySideAndInvert( Proc, bHead, true, ( abs(dMakeAntiSplintOnHead) - dCrvLen))
end
-- rendo corrente la copia (cioè la lavorazione completa)
EgtSetCurrMachining( nMch2Id)
nMchId = nMch2Id
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- se non da sotto e parametro Q abilitato, inserisco lavorazione finitura angolo
if ( nSide ~= -1 or bMillDown) and EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') == 1 then
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -663,7 +724,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false)
return false, sErr
@@ -685,7 +746,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
end
end
return true
return true, sWarn
end
---------------------------------------------------------------------
+164 -92
View File
@@ -1,7 +1,10 @@
-- ProcessProfConcave.lua by Egaltech s.r.l. 2021/06/28
-- ProcessProfConcave.lua by Egaltech s.r.l. 2022/05/28
-- Gestione calcolo profilo concavo per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- Tabella per definizione modulo
local ProcessProfConcave = {}
@@ -9,6 +12,7 @@ local ProcessProfConcave = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfConcave started', 1)
@@ -55,6 +59,12 @@ function ProcessProfConcave.Classify( Proc, b3Raw)
end
end
---------------------------------------------------------------------
-- Verifico se richiesto il solo smusso
function ProcessProfConcave.OnlyChamfer( Proc)
return (( EgtGetInfo( Proc.Id, sDepthChamferMill, 'd') or 0) > 0.1 and EgtGetInfo( Proc.Id, sPreemptiveChamfer, 'i') == 1)
end
---------------------------------------------------------------------
local function GetSawCutData( AuxId, vtN)
-- comincio con la normale a 45deg
@@ -82,8 +92,8 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
-- confronto il punto iniziale e finale della lavorazione con il box della feature
-- e se è vicino alla parte esterna della trave inverto la lavorazione
ptSP = EgtGetMachiningStartPoint()
ptEp = EgtGetMachiningEndPoint()
local ptSP = EgtGetMachiningStartPoint()
local ptEp = EgtGetMachiningEndPoint()
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
if nMachMode == 1 and ptSP and ptEp then
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
@@ -116,7 +126,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
end
-- riapplico la lavorazione
EgtApplyMachining( true, false)
ML.ApplyMachining( true, false)
end
end
@@ -127,12 +137,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0 then
if dDepth > 0.1 then
nChamfer = 1
end
-- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if dDepth > 0 then
if nChamfer == 1 then
nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco
else
@@ -164,7 +174,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
sMilling = ML.FindMilling( 'Mark')
if not sMilling then
if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then
sMilling = ML.FindMilling( 'Mark_H2')
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
end
if not sMilling then
local sErr = 'Error : chamfer not found in library'
@@ -173,7 +183,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
end
end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then
sMilling2 = ML.FindMilling( 'Mark_H2')
sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr)
@@ -188,6 +198,7 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -249,19 +260,38 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 0 then
return false, sChamfer
end
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
-- se smusso non è esclusivo, aggiungo sgrossatura
if nChamfer < 2 then
-- aggiungo taglio di lama di sgrossatura e lo lavoro
-- aggiungo piano di sgrossatura e lo lavoro
local ptStart, vtNP = GetSawCutData( AuxId, vtN)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico la lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then return bOk, sErr end
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
-- recupero la lavorazione
local sPockType = 'OpenPocket'
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false)
if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- eseguo le svuotature necessarie
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then
return false, sErr
end
-- altrimenti applico taglio di lama
else
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then
return false, sErr
end
end
end
end
-- se devo inserire il chamfer
@@ -321,7 +351,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -371,7 +401,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -404,9 +434,111 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
end
-- verifico se necessario lavorare in doppio
local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
-- inserisco la lavorazione
-- se lavorazione da due parti, aggiungo la seconda
local sMillingDown
if bDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
sWarn = 'Warning : milling from bottom not found in library'
EgtOutLog( sWarn)
bDouble = false
end
elseif not BD.TURN then
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
bDouble = false
end
end
end
-- se orizzontale o trovata lavorazione per doppio verticale
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- se lavorazione da sopra e da sotto
if ( nSide == 0) then
if vtExtr:getZ() > 0.1 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = true
end
-- altrimenti lavorazione davanti e dietro
else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = true
end
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
bFinish = true
end
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- inserisco la prima lavorazione
local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
@@ -458,9 +590,10 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
end
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local ptSP, ptEp
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
@@ -470,7 +603,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -484,7 +617,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if bFinish then
-- inserisco la lavorazione
local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
@@ -494,80 +627,17 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
-- se lavorazione da due parti, aggiungo la seconda
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- sempre lavorazione da sopra o da sotto
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and
( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD or BD.TURN))) then
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchVId = EgtAddMachining( sName, sMilling)
if not nMchVId then
@@ -593,8 +663,9 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false)
return false, sErr
@@ -603,7 +674,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and
( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD or BD.TURN))) then
sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchV2Id = EgtAddMachining( sName, sMilling)
if not nMchV2Id then
@@ -626,8 +697,9 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchV2Id, false)
return false, sErr
@@ -649,7 +721,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
end
end
return true
return true, sWarn
end
---------------------------------------------------------------------
+165 -92
View File
@@ -1,7 +1,10 @@
-- ProcessProfConvex.lua by Egaltech s.r.l. 2021/06/28
-- ProcessProfConvex.lua by Egaltech s.r.l. 2022/05/28
-- Gestione calcolo profilo convesso per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- Tabella per definizione modulo
local ProcessProfConvex = {}
@@ -9,6 +12,7 @@ local ProcessProfConvex = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfConvex started', 1)
@@ -55,6 +59,12 @@ function ProcessProfConvex.Classify( Proc, b3Raw)
end
end
---------------------------------------------------------------------
-- Verifico se richiesto il solo smusso
function ProcessProfConvex.OnlyChamfer( Proc)
return (( EgtGetInfo( Proc.Id, sDepthChamferMill, 'd') or 0) > 0.1 and EgtGetInfo( Proc.Id, sPreemptiveChamfer, 'i') == 1)
end
---------------------------------------------------------------------
local function GetSawCutData( AuxId, vtN)
-- comincio con la normale a 45deg
@@ -82,8 +92,8 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
-- confronto il punto iniziale e finale della lavorazione con il box della feature
-- e se è vicino alla parte esterna della trave inverto la lavorazione
ptSP = EgtGetMachiningStartPoint()
ptEp = EgtGetMachiningEndPoint()
local ptSP = EgtGetMachiningStartPoint()
local ptEp = EgtGetMachiningEndPoint()
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
if nMachMode == 1 and ptSP and ptEp then
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
@@ -116,7 +126,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
end
-- riapplico la lavorazione
EgtApplyMachining( true, false)
ML.ApplyMachining( true, false)
end
end
@@ -127,12 +137,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0 then
if dDepth > 0.1 then
nChamfer = 1
end
-- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if dDepth > 0 then
if nChamfer == 1 then
nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco
else
@@ -164,7 +174,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
sMilling = ML.FindMilling( 'Mark')
if not sMilling then
if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then
sMilling = ML.FindMilling( 'Mark_H2')
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
end
if not sMilling then
local sErr = 'Error : chamfer not found in library'
@@ -173,7 +183,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
end
end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then
sMilling2 = ML.FindMilling( 'Mark_H2')
sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr)
@@ -188,6 +198,7 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -249,19 +260,38 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 0 then
return false, sChamfer
end
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
-- se smusso non è esclusivo, aggiungo sgrossatura
if nChamfer < 2 then
-- aggiungo taglio di lama di sgrossatura e lo lavoro
-- aggiungo piano di sgrossatura e lo lavoro
local ptStart, vtNP = GetSawCutData( AuxId, vtN)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico la lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then return bOk, sErr end
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
-- recupero la lavorazione
local sPockType = 'OpenPocket'
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false)
if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- eseguo le svuotature necessarie
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then
return false, sErr
end
-- altrimenti applico taglio di lama
else
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then
return false, sErr
end
end
end
end
-- se devo inserire il chamfer
@@ -321,7 +351,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -371,7 +401,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -404,9 +434,111 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
end
-- verifico se necessario lavorare in doppio
local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
-- inserisco la lavorazione
-- se lavorazione da due parti, aggiungo la seconda
local sMillingDown
if bDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
sWarn = 'Warning : milling from bottom not found in library'
EgtOutLog( sWarn)
bDouble = false
end
elseif not BD.TURN then
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
bDouble = false
end
end
end
-- se orizzontale o trovata lavorazione per doppio verticale
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- se lavorazione da sopra e da sotto
if ( nSide == 0) then
if vtExtr:getZ() > 0.1 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = true
end
-- altrimenti lavorazione davanti e dietro
else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = true
end
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
bFinish = true
end
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- inserisco la prima lavorazione
local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
@@ -458,9 +590,10 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
end
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local ptSP, ptEp
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
@@ -470,7 +603,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -494,80 +627,17 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
-- se lavorazione da due parti, aggiungo la seconda
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- sempre lavorazione da sopra o da sotto
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and
( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD or BD.TURN))) then
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchVId = EgtAddMachining( sName, sMilling)
if not nMchVId then
@@ -593,8 +663,9 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false)
return false, sErr
@@ -603,7 +674,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and
( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD or BD.TURN))) then
sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchV2Id = EgtAddMachining( sName, sMilling)
if not nMchV2Id then
@@ -626,8 +697,9 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchV2Id, false)
return false, sErr
@@ -635,12 +707,13 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
end
-- aggiorno ingombro testa o coda per presa
if nSide ~= 1 then
if nSide ~= 1 then -- se feature di fianco o da sotto
if bHead then
BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dCurrOvmH - Proc.Box:getMin():getX())
else
BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Solid:getMin():getX())
end
-- altrimenti feature da sopra
else
if bHead then
BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dCurrOvmH - Proc.Box:getMax():getX())
@@ -648,7 +721,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
end
end
return true
return true, sWarn
end
---------------------------------------------------------------------
+150 -83
View File
@@ -1,7 +1,10 @@
-- ProcessProfFront.lua by Egaltech s.r.l. 2021/06/28
-- ProcessProfFront.lua by Egaltech s.r.l. 2022/05/28
-- Gestione calcolo profilo frontale per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- Tabella per definizione modulo
local ProcessProfFront = {}
@@ -9,6 +12,7 @@ local ProcessProfFront = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfFront started', 1)
@@ -55,6 +59,12 @@ function ProcessProfFront.Classify( Proc, b3Raw)
end
end
---------------------------------------------------------------------
-- Verifico se richiesto il solo smusso
function ProcessProfFront.OnlyChamfer( Proc)
return (( EgtGetInfo( Proc.Id, sDepthChamferMill, 'd') or 0) > 0.1 and EgtGetInfo( Proc.Id, sPreemptiveChamfer, 'i') == 1)
end
---------------------------------------------------------------------
local function GetSawCutData( AuxId, vtN)
local vtNP = Vector3d( vtN)
@@ -87,7 +97,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam)
local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode)
-- riapplico la lavorazione
EgtApplyMachining( true, false)
ML.ApplyMachining( true, false)
end
end
end
@@ -99,12 +109,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0 then
if dDepth > 0.1 then
nChamfer = 1
end
-- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if dDepth > 0 then
if nChamfer == 1 then
nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco
else
@@ -136,7 +146,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
sMilling = ML.FindMilling( 'Mark')
if not sMilling then
if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then
sMilling = ML.FindMilling( 'Mark_H2')
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
end
if not sMilling then
local sErr = 'Error : chamfer not found in library'
@@ -145,7 +155,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
end
end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then
sMilling2 = ML.FindMilling( 'Mark_H2')
sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr)
@@ -160,6 +170,7 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -220,19 +231,38 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 0 then
return false, sChamfer
end
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
-- se smusso non è esclusivo, aggiungo sgrossatura
if nChamfer < 2 then
-- aggiungo taglio di lama di sgrossatura e lo lavoro
-- aggiungo piano di sgrossatura e lo lavoro
local ptStart, vtNP = GetSawCutData( AuxId, vtN)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico la lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then return bOk, sErr end
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
-- recupero la lavorazione
local sPockType = 'OpenPocket'
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false)
if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- eseguo le svuotature necessarie
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then
return false, sErr
end
-- altrimenti applico taglio di lama
else
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then
return false, sErr
end
end
end
end
-- se devo inserire il chamfer
@@ -282,7 +312,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -330,7 +360,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -363,8 +393,104 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
end
-- verifico se necessario lavorare in doppio
local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
-- se lavorazione da due parti, aggiungo la seconda
local sMillingDown
if bDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
sWarn = 'Warning : milling from bottom not found in library'
EgtOutLog( sWarn)
bDouble = false
end
else
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
bDouble = false
end
end
end
-- se orizzontale o trovata lavorazione per doppio verticale
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- se lavorazione da sopra e da sotto
if ( nSide == 0) then
if vtExtr:getZ() > 0.1 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
-- altrimenti lavorazione davanti e dietro
else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
bFinish = true
end
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- inserisco la lavorazione
local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
@@ -413,7 +539,6 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local ptSP, ptEp
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
@@ -423,7 +548,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -447,77 +572,17 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
-- se lavorazione da due parti, aggiungo la seconda
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- sempre lavorazione da sopra o da sotto
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and
( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then
-- se non da sotto, inserisco lavorazione finitura angolo
--if nSide ~= -1 then
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -540,7 +605,9 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
-- imposto tipo uso faccia
local nFaceUse = MCH_MILL_FU.PARAL_DOWN
if nSide ~= 1 then
if nSide == -1 then
nFaceUse = EgtIf( vtN:getX() > 0.1, MCH_MILL_FU.PARAL_LEFT, MCH_MILL_FU.PARAL_RIGHT)
elseif nSide ~= 1 then
nFaceUse = EgtIf( vtN:getY() > 0.1, MCH_MILL_FU.PARAL_FRONT, MCH_MILL_FU.PARAL_BACK)
end
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
@@ -551,7 +618,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false)
return false, sErr
@@ -580,7 +647,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Solid:getMin():getX())
-- end
--end
return true
return true, sWarn
end
---------------------------------------------------------------------
+154 -98
View File
@@ -1,8 +1,11 @@
-- ProcessProfHead.lua by Egaltech s.r.l. 2021/10/12
-- ProcessProfHead.lua by Egaltech s.r.l. 2022/05/28
-- Gestione calcolo profilo di testa per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa sotto.
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
-- 2021/10/12 Estesa gestione di testa da sotto, se presente.
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- Tabella per definizione modulo
local ProcessProfHead = {}
@@ -10,6 +13,7 @@ local ProcessProfHead = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfHead started', 1)
@@ -56,6 +60,12 @@ function ProcessProfHead.Classify( Proc, b3Raw)
end
end
---------------------------------------------------------------------
-- Verifico se richiesto il solo smusso
function ProcessProfHead.OnlyChamfer( Proc)
return (( EgtGetInfo( Proc.Id, sDepthChamferMill, 'd') or 0) > 0.1 and EgtGetInfo( Proc.Id, sPreemptiveChamfer, 'i') == 1)
end
---------------------------------------------------------------------
local function GetSawCutData( AuxId, vtN)
-- assegno la normale
@@ -75,8 +85,8 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
-- confronto il punto iniziale e finale della lavorazione con il box della feature
-- e se è vicino alla parte esterna della trave inverto la lavorazione
ptSP = EgtGetMachiningStartPoint()
ptEp = EgtGetMachiningEndPoint()
local ptSP = EgtGetMachiningStartPoint()
local ptEp = EgtGetMachiningEndPoint()
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
if nMachMode == 1 and ptSP and ptEp then
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
@@ -109,7 +119,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
end
-- riapplico la lavorazione
EgtApplyMachining( true, false)
ML.ApplyMachining( true, false)
end
end
@@ -120,12 +130,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0 then
if dDepth > 0.1 then
nChamfer = 1
end
-- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if dDepth > 0 then
if nChamfer == 1 then
nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco
else
@@ -154,19 +164,15 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
-- recupero la lavorazione
local sMilling, sMilling2
if nChamfer > 0 then
if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP then
sMilling = ML.FindMilling( 'Mark_H2')
if not sMilling then sMilling = ML.FindMilling( 'Mark') end
else
sMilling = ML.FindMilling( 'Mark')
end
local bDownHead = BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, true, bDownHead)
if not sMilling then
local sErr = 'Error : chamfer not found in library'
EgtOutLog( sErr)
return -1, 0, sErr
end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then
sMilling2 = ML.FindMilling( 'Mark_H2')
sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr)
@@ -256,19 +262,38 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 0 then
return false, sChamfer
end
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
-- se smusso non è esclusivo, aggiungo sgrossatura
if nChamfer < 2 then
-- aggiungo taglio di lama di sgrossatura e lo lavoro
-- aggiungo piano di sgrossatura e lo lavoro
local ptStart, vtNP = GetSawCutData( AuxId, vtN)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico la lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then return bOk, sErr end
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
-- recupero la lavorazione
local sPockType = 'OpenPocket'
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false)
if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- eseguo le svuotature necessarie
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then
return false, sErr
end
-- altrimenti applico taglio di lama
else
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then
return false, sErr
end
end
end
end
-- se devo inserire il chamfer
@@ -328,7 +353,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -380,7 +405,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -396,10 +421,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 2 then
-- recupero la lavorazione
local sMillType = 'Prof'
local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''))
if not sMilling then
sMilling = ML.FindMilling( sMillType)
end
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bMillDown)
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
@@ -418,9 +440,108 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
end
-- verifico se necessario lavorare in doppio
local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
-- inserisco la lavorazione
-- se lavorazione da due parti, aggiungo la seconda
local sMillingDown
if bDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
sWarn = 'Warning : milling from bottom not found in library'
EgtOutLog( sWarn)
bDouble = false
end
else
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
bDouble = false
end
end
end
-- se orizzontale o trovata lavorazione per doppio verticale
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- se lavorazione da sopra e da sotto
if ( nSide == 0) then
if vtExtr:getZ() > 0.1 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
-- altrimenti lavorazione davanti e dietro
else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
bFinish = true
end
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni,
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- inserisco la prima lavorazione
local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
@@ -474,7 +595,6 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local ptSP, ptEp
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
@@ -484,7 +604,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -509,77 +629,13 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
-- se lavorazione da due parti, aggiungo la seconda
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- sempre lavorazione da sopra o da sotto
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni,
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and #vAngs > 0 then
@@ -618,7 +674,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchV2Id, false)
return false, sErr
@@ -658,7 +714,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false)
return false, sErr
@@ -681,7 +737,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
end
end
return true
return true, sWarn
end
---------------------------------------------------------------------
+9 -10
View File
@@ -97,7 +97,7 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- determino se da lavorare con testa da sotto
local bDownHead = ( BD.DOWN_HEAD and vtN[vFaceOrd[3]]:getZ() < -0.1)
-- recupero la lavorazione
local sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bDownHead, '_H2', ''))
local sCutting = ML.FindCutting( 'HeadSide', not bDownHead, bDownHead)
if not sCutting then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
EgtOutLog( sErr)
@@ -137,23 +137,22 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOk then return bOk, sErr end
end
end
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
end
if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
+1 -1
View File
@@ -230,7 +230,7 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
+11 -5
View File
@@ -1,5 +1,6 @@
-- ProcessSawCut.lua by Egaltech s.r.l. 2021/01/15
-- ProcessSawCut.lua by Egaltech s.r.l. 2022/03/07
-- 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)
-- Tabella per definizione modulo
local ProcessSawCut = {}
@@ -31,12 +32,14 @@ function ProcessSawCut.Classify( Proc, b3Raw)
if not AuxId then return false end
AuxId = AuxId + Proc.Id
local vtDir = EgtSV( AuxId, GDB_ID.ROOT)
return true, ( vtDir:getZ() <= - 0.088)
return true, ( vtDir:getZ() <= - 0.5)
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -71,7 +74,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- altrimenti taglio di coda
else
-- se coincide con taglio di separazione, non va fatto
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
return true
end
end
@@ -181,6 +184,9 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
for i = 1, nC do
-- Posizione braccio portatesta
local nSCC = EgtIf( ( BD.C_SIMM or i == 1 or i == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if abs( vtDir:getY()) > 0.5 then
nSCC = EgtIf( vtDir:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
end
-- ciclo sulle passate
local dOffset = dWidth - dDepth ;
local dLioTang = 0
@@ -219,7 +225,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
+59 -30
View File
@@ -1,6 +1,8 @@
-- ProcessScarfJoint.lua by Egaltech s.r.l. 2021/06/28
-- ProcessScarfJoint.lua by Egaltech s.r.l. 2022/09/30
-- Gestione calcolo giunto Gerber per Travi
-- 2021/06/28 Aggiunto extra-taglio alle lamate orizzontali.
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- 2022/07/12 Aggiunta gestione PF1250 e TURN.
-- Tabella per definizione modulo
local ProcessScarfJoint = {}
@@ -26,6 +28,10 @@ end
---------------------------------------------------------------------
-- Classificazione della feature
function ProcessScarfJoint.Classify( Proc)
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
return true
end
-- verifico le normali delle facce
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
for i = 1, nFacetCnt do
@@ -92,7 +98,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -115,7 +121,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -126,10 +132,10 @@ end
---------------------------------------------------------------------
local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim)
local vCuts = {}
local bOk = true
local sErr = ''
local vCuts = {}
if nGoodFace1 and nGoodFace4 and nGoodFace1 > 0 and nGoodFace4 > 0 then
-- lavoro solo la faccia inclinata perché la faccia tappo completa la lavoro successivamente
-- questo evita di lavorare due volte la faccia tappo
@@ -138,6 +144,8 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[4]], vtN[vFaceOrd[4]], true, nil, nil, nil, dNewDiceDim)
end
local dVzLimDwnUp = EgtIf( vtRef:getZ() < -0.017, -2, nil)
if #vCuts > 0 then
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
@@ -165,7 +173,11 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
if vtO then
vtOrthoO = Vector3d( vtO)
else
vtOrthoO = Y_AX()
if vtN[vFaceOrd[4]]:getZ() < 0.1 then
vtOrthoO = Z_AX()
else
vtOrthoO = Y_AX()
end
end
end
end
@@ -173,7 +185,7 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
local dExtraCut = EgtIf( i % 2 == 1, 0, BD.CUT_EXTRA)
-- lavoro la faccia
for j = 1, #vCuts[i] do
bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, nil, dExtraCut, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sErr end
end
end
@@ -181,14 +193,14 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
if vFaceOrd[1] ~= 0 then
-- inserisco la lavorazione
local vtOrthoO = Vector3d( vtRef)
bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sErr end
end
-- lavoro la faccia opposta (definita dal parametro P11)
if vFaceOrd[3] ~= 0 then
-- inserisco la lavorazione
local vtOrthoO = Vector3d( vtRef)
local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sErr end
end
end
@@ -198,7 +210,9 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -287,8 +301,12 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOkc then return bOkc, sErrC end
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg)
local bDownHead = ( BD.DOWN_HEAD and vtRef:getZ() < -0.01)
local bTopHead = ( BD.DOWN_HEAD and ( vtRef:getZ() > -0.01 or not bDownHead))
-- recupero la lavorazione
local sCutting = ML.FindCutting( 'HeadSide')
local sCutting = ML.FindCutting( 'HeadSide', bTopHead, bDownHead)
if not sCutting then
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
@@ -296,10 +314,12 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
-- recupero i dati dell'utensile
local dSawDiam = 400
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
@@ -332,7 +352,6 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sErr)
return false, sErr
end
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
nGoodFace1 = EgtSurfTmFacetCount( nFace1)
nGoodFace4 = EgtSurfTmFacetCount( nFace4)
@@ -342,21 +361,27 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
nGoodFace1 = EgtSurfTmFacetCount( nFace1)
end
local bOkd, sErrD, vCuts = ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw)
-- per macchina TURN aggiusto massima dimensione cubetto
local dNewDiceDim
if BD.TURN and nGoodFace4 and nGoodFace4 > 0 then
local dDimRef = EgtIf( abs( vtN[vFaceOrd[4]]:getZ()) < 0.1, b3Raw:getDimZ(), b3Raw:getDimY())
if dDimRef + BD.CUT_EXTRA < dMaxDepth then
dNewDiceDim = - ( dMaxDepth - BD.CUT_EXTRA)
end
end
local bOkd, sErrD, vCuts = ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim)
if not bOkd then return bOkd, sErrD end
if #vCuts == 0 then
-- se ho la faccia intermedia, per prima cosa verifico se ho intersezione con la faccia tappo
if nGoodFace4 ~= 0 then
-- taglio sulla faccia interna
if vFaceOrd[1] ~= 0 then
-- inserisco la lavorazione
local vtOrthoO = Vector3d( vtRef)
bOkd, sErrD = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOkd then return bOkd, sErrD end
end
-- se non ho intersezione con la faccia tappo posso fare il taglio sul fianco
if not nGoodFace1 or nGoodFace1 == 0 then
-- inserisco la lavorazione
local vtRef2 = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, Z_AX(), EgtIf( bHead, Y_AX(), -Y_AX()))
bOkd, sErrD = Fbs.MakeOne( nFace4, nGoodFace4 - 1, sCutting, dSawDiam, vtRef2, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOkd then return bOkd, sErrD end
-- lavoro la faccia opposta (definita dal parametro P11)
if vFaceOrd[3] ~= 0 then
-- inserisco la lavorazione
@@ -364,16 +389,20 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bOkd, sErrD = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOkd then return bOkd, sErrD end
end
-- inserisco la lavorazione
local vtRef2 = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, Z_AX(), EgtIf( bHead, Y_AX(), -Y_AX()))
bOkd, sErrD = Fbs.MakeOne( nFace4, nGoodFace4 - 1, sCutting, dSawDiam, vtRef2, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOkd then return bOkd, sErrD end
else -- altrimenti se ho intersezione forzo il DiceCut ad essere eseguito con distanze più piccole
-- altrimenti se ho intersezione forzo il DiceCut ad essere eseguito con distanze più piccole
else
-- definisco la nuova dimensione massima del dice cut
local dNewDiceDim = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, b3Raw:getDimZ(), b3Raw:getDimY())
bOkd, sErrD = ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim)
if not bOkd then return bOkd, sErrD end
end
-- taglio sulla faccia interna
if vFaceOrd[1] ~= 0 then
-- inserisco la lavorazione
local vtOrthoO = Vector3d( vtRef)
bOkd, sErrD = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOkd then return bOkd, sErrD end
end
else
-- taglio sulla faccia interna
if vFaceOrd[1] ~= 0 then
@@ -401,7 +430,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[5]], - X_AX()) and abs( ptC[vFaceOrd[5]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[5]], - X_AX()) and abs( ptC[vFaceOrd[5]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
@@ -438,9 +467,9 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero la lavorazione. considerando l dimensione del lato e l'affondamento
local sPocketing
if dDistFaces then
sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax, dDistFaces)
sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax, dDistFaces, nil, bTopHead, bDownHead)
else
sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax)
sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax, nil, nil, bTopHead, bDownHead)
end
if not sPocketing then
@@ -473,7 +502,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDistFaces, 1) .. ';')
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -486,20 +515,20 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if abs( vtRef:getZ()) > 0.1 then
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
if b3Fac1 then dHCI = b3Raw:getMax():getX() - dOvmHead - b3Fac1:getMin():getX() end
dHCI = 0.75 * dHCI
else
dHCI = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
end
dHCI = 0.75 * dHCI
BL.UpdateHCING( nRawId, dHCI)
elseif Proc.Tail then
local dTCI = 0
if abs( vtRef:getZ()) > 0.1 then
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
if b3Fac1 then dTCI = b3Fac1:getMax():getX() - b3Solid:getMin():getX() end
dTCI = 0.75 * dTCI
else
dTCI = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
end
dTCI = 0.75 * dTCI
BL.UpdateTCING( nRawId, dTCI)
end
+120 -104
View File
@@ -1,5 +1,8 @@
-- ProcessSimpleScarf.lua by Egaltech s.r.l. 2020/06/04
-- Gestione calcolo giunto Gerber per Travi
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- 2022/08/09 Ora se la feature ha meno di due facce viene richiamata la normale Cut.
-- 2022/11/09 Aggiunta gestione parametro Q04 per forzare utilizzo fresa di lato e lavorare come FreeContour.
-- Tabella per definizione modulo
local ProcessSimpleScarf = {}
@@ -9,6 +12,8 @@ require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw')
local DC = require( 'DiceCut')
local Cut = require( 'ProcessCut')
local FreeContour = require( 'ProcessFreeContour')
EgtOutLog( ' ProcessSimpleScarf started', 1)
@@ -25,11 +30,13 @@ end
---------------------------------------------------------------------
-- Classificazione della feature
function ProcessSimpleScarf.Classify( Proc)
-- se forzato utilizzo fresa non ruoto la trave
local bForceSideMill = ( EgtGetInfo( Proc.Id, 'Q04', 'd') or 0) > 0
-- verifico le normali delle facce
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
for i = 1, nFacetCnt do
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i-1, GDB_ID.ROOT)
if vtN:getZ() < - 0.5 and Proc.Box:getDimX() / abs( vtN:getZ()) > BD.MAX_DIM_DICE then
if vtN:getZ() < - 0.5 and Proc.Box:getDimX() / abs( vtN:getZ()) > BD.MAX_DIM_DICE and not bForceSideMill then
return true, true
end
end
@@ -91,7 +98,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -114,7 +121,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -124,7 +131,9 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -135,12 +144,11 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sErr)
return false, sErr
end
-- verifico che ci siano almeno due facce (altrimenti non è da lavorare)
-- se ci sono meno di due facce si riduce a una normale Cut
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
if nFacetCnt < 2 then
local sErr = 'Error : number of faces not enough'
EgtOutLog( sErr)
return false, sErr
local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, nil, nil, nil, dOvmTail)
return bOk, sErr
end
-- dati delle facce
local ptC = {}
@@ -184,48 +192,48 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- inserimento smussi
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOkc then return bOkc, sErrC end
-- recupero la lavorazione
local sCutting = ML.FindCutting( 'HeadSide')
if not sCutting then
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dSawDiam = 400
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
-- se forzato utilizzo fresa richiamo la freecontour
local bForceSideMill = EgtGetInfo( Proc.Id, 'Q04', 'd') == 1 or
( EgtGetInfo( Proc.Id, 'Q04', 'd') == 2 and abs( vtN[vFaceOrd[3]]:getY()) < 0.1) or
( EgtGetInfo( Proc.Id, 'Q04', 'd') == 3 and abs( vtN[vFaceOrd[3]]:getY()) < 0.1 and vtN[vFaceOrd[3]]:getZ() < 0.1)
if bForceSideMill then
bOk, sErr = FreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOk then return bOk, sErr end
else
-- recupero la lavorazione
local sCutting = ML.FindCutting( 'HeadSide')
if not sCutting then
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
return false, sErr
end
end
-- taglio sulla faccia esterna
if vFaceOrd[1] ~= 0 then
-- in generale va fatto
local bCut = true
-- se di testa e coincide con inizio grezzo, non va fatto
if bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
bCut = false
-- recupero i dati dell'utensile
local dSawDiam = 400
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
end
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
bCut = false
-- taglio sulla faccia esterna
if vFaceOrd[1] ~= 0 then
-- in generale va fatto
local bCut = true
-- se di testa e coincide con inizio grezzo, non va fatto
if bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
if bCut then
local vtOrthoO = Vector3d( vtRef)
local bOk, sNameOrErr = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sNameOrErr end
end
end
-- se va fatto, inserisco la lavorazione
if bCut then
local vtOrthoO = Vector3d( vtRef)
local bOk, sNameOrErr = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sNameOrErr end
end
end
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
elseif vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
end
if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
@@ -233,69 +241,77 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
elseif vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
end
-- calcolo secondo riferimento per testa o coda
local vtRef2 = EgtIf( bHead, X_AX(), -X_AX())
-- eseguo
for i = 1, #vCuts do
local vtOrthoO
if i % 2 == 1 then
vtOrthoO = Vector3d( vtRef)
else
if #vCuts[i-1] > 0 then
vtOrthoO = Vector3d( EgtIf( vtRef2, vtRef2, vtRef))
else
local vtO
for j = 1, #vCuts[i-1] do
_, vtO = EgtSurfTmFacetCenter( vCuts[i-1][j], 0, GDB_ID.ROOT)
break
end
if vtO then
vtOrthoO = Vector3d( vtO)
else
vtOrthoO = Y_AX()
end
if #vCuts > 0 then
-- 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
-- lavoro la faccia
for j = 1, #vCuts[i] do
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
end
end
else
-- taglio sulla faccia interna
local bIntCut = false
if vFaceOrd[2] ~= 0 then
-- inserisco la lavorazione
local nOrthoOpposite = BL.GetNearestOrthoOpposite( vtRef)
local bOk, sNameOrErr = Fbs.MakeOne( Proc.Id, vFaceOrd[2] - 1, sCutting, dSawDiam, nOrthoOpposite, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sNameOrErr end
if #sNameOrErr > 0 then bIntCut = true end
end
-- taglio sulla faccia intermedia
if vFaceOrd[3] ~= 0 then
-- calcolo secondo testa o coda
-- calcolo secondo riferimento per testa o coda
local vtRef2 = EgtIf( bHead, X_AX(), -X_AX())
-- se non ho il taglio sulla faccia interna
if not bIntCut then
local frHV, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, vFaceOrd[3] - 1)
if DimV > DimH then
vtRef2 = Vector3d( frHV:getVersX())
-- eseguo
for i = 1, #vCuts do
local vtOrthoO
if i % 2 == 1 then
vtOrthoO = Vector3d( vtRef)
else
if #vCuts[i-1] > 0 then
vtOrthoO = Vector3d( EgtIf( vtRef2, vtRef2, vtRef))
else
local vtO
for j = 1, #vCuts[i-1] do
_, vtO = EgtSurfTmFacetCenter( vCuts[i-1][j], 0, GDB_ID.ROOT)
break
end
if vtO then
vtOrthoO = Vector3d( vtO)
else
vtOrthoO = Y_AX()
end
end
end
-- lavoro la faccia
for j = 1, #vCuts[i] do
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
end
end
-- inserisco la lavorazione
local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtRef2, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sErr end
else
-- taglio sulla faccia interna
local bIntCut = false
if vFaceOrd[2] ~= 0 then
-- inserisco la lavorazione
local nOrthoOpposite = BL.GetNearestOrthoOpposite( vtRef)
local bOk, sNameOrErr = Fbs.MakeOne( Proc.Id, vFaceOrd[2] - 1, sCutting, dSawDiam, nOrthoOpposite, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sNameOrErr end
if #sNameOrErr > 0 then bIntCut = true end
end
-- taglio sulla faccia intermedia
if vFaceOrd[3] ~= 0 then
-- calcolo secondo testa o coda
local vtRef2 = EgtIf( bHead, X_AX(), -X_AX())
-- se non ho il taglio sulla faccia interna
if not bIntCut then
local frHV, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, vFaceOrd[3] - 1)
if DimV > DimH then
vtRef2 = Vector3d( frHV:getVersX())
end
end
-- inserisco la lavorazione
local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtRef2, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sErr end
end
end
end
-- aggiornamento ingombro di testa o coda
+260 -24
View File
@@ -1,5 +1,12 @@
-- ProcessSplit.lua by Egaltech s.r.l. 2022/01/25
-- ProcessSplit.lua by Egaltech s.r.l. 2022/08/18
-- Gestione calcolo tagli di separazione per Travi
-- 2022/05/31 Aggiunta gestione sezioni alte e larghe con taglio con sega a catena seguito da rifinitura con lama (aggiunta funzione MakeSplitByChainSaw); gestione eventuale creazione nuova fase dall'interno della Make.
-- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita.
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
-- 2022/09/08 Migliorato verso di lavorazione in caso di DoubleCut
-- 2022/11/02 Corretti accorciamenti per DoubleCut
-- 2022/11/10 Corrette finiture lama per BigSection con trave alta
-- 2022/11/16 Correzioni per travi larghe
-- Tabella per definizione modulo
local ProcessSplit = {}
@@ -8,6 +15,8 @@ local ProcessSplit = {}
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw')
local Cut = require( 'ProcessCut')
local Pocket = require( 'FaceByPocket')
EgtOutLog( ' ProcessSplit started', 1)
@@ -109,7 +118,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -132,7 +141,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -140,9 +149,97 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
return true, nil
end
---------------------------------------------------------------------
-- lavorazione con sega a catena per sezioni alte e larghe
local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs)
-- 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, 'MNF'
else
-- recupero i dati dell'utensile
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
sName = EgtGetOperationName( nMchFId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nSurfId, 0}})
-- imposto uso del lato faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
local _, vtN = EgtSurfTmFacetCenter( nSurfId, 0, GDB_ID.ROOT)
local vtOrtho = BL.GetVersRef( nFaceUse)
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
-- imposto offset radiale per mantenere il materiale in coda per la finitura
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
-- imposto allungamento percorso iniziale e finale a zero
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 0)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0)
-- faccio in modo che l'attacco della lama sia dal lato opposto rispetto al corpo macchina
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
if dMaxMat >= dDepth then
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning
else
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat)
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
-- eventuali note
if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) 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, sName, nMchFId
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dOvmTail)
-- impostazione default a variabili aggiunte
if not BD.OVM_CHAIN_HBEAM then BD.OVM_CHAIN_HBEAM = 8 end
if not BD.C_SIMM_ENC then BD.C_SIMM_ENC = 180 end
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- inserimento smussi
@@ -161,18 +258,36 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
-- recupero i dati dell'utensile
local dSawDiam = 400
local dMaxDepth = 50
local dSawThick = 2
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
dSawThick = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick
end
end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- recupero la eventuale lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true)
-- recupero i dati della eventuale seconda lama
local dSawDiam2 = 0
local dMaxDepth2 = 0
local dSawThick2 = 0
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
dSawThick2 = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick2
end
end
-- caratteristiche taglio
local bHorizCut = ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM)
local bDoubleHorizCut = ( BD.DOWN_HEAD and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bHorizCut = ( ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and ( b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA))
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
-- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
@@ -195,6 +310,133 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
b3Raw:Add( b3NextRaw)
end
end
-- se taglio per pezzi alti e larghi
local nNewPhase = 0
if bBigSectionCut then
local bFinishingNeeded = false
if bSplit then
-- recupero lunghezza massima di lavoro della sega a catena
local sSawing = ML.FindSawing( 'Sawing')
local dMaxMat = 0
local dTlen = 0
if EgtMdbSetCurrMachining( sSawing or '') then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
dTLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dTLen
end
end
-- assegno offset in lunghezza
local dOffs = 0
if dOvmTail > BD.OVM_CHAIN_HBEAM then
dOffs = dOvmTail - BD.OVM_CHAIN_HBEAM
bFinishingNeeded = true
end
-- se pezzo non troppo alto, taglio singolo da sopra
if b3Raw:getDimZ() < dMaxMat - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL then
local cutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN
sNotesSplit = 'Split;'
bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, cutDepth, sNotesSplit, dOffs)
if not bOk then return bOk, sErr, nNewPhase end
-- se pezzo non troppo largo, taglio singolo da davanti
elseif b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dMaxMat, dTLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
local cutDepth = b3Raw:getDimY() + BD.CUT_EXTRA_MIN
sNotesSplit = 'Split;'
bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, cutDepth, sNotesSplit, dOffs)
if not bOk then return bOk, sErr, nNewPhase end
-- altrimenti tagli dai due fianchi (dietro e davanti)
else
local cutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN
-- se la sega a catena non può completare lo split esco
if cutDepth >= min( dMaxMat, dTLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
sErr = 'Error : section too big for splitting'
EgtOutLog( sErr)
return false, sErr, -1
end
local sNotesSplit = 'Presplit;'
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_BACK, cutDepth, sNotesSplit, dOffs)
if not bOk then return bOk, sErr, nNewPhase end
sNotesSplit = 'Split;'
bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, cutDepth, sNotesSplit, dOffs)
if not bOk then return bOk, sErr, nNewPhase end
end
-- se necessaria finitura, creo nuova fase
if bFinishingNeeded then
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
nNewPhase = EgtGetCurrPhase()
nDispId = EgtGetPhaseDisposition( nNewPhase)
if sDownOrSideOrStd == 'down' then
EgtRotateRawPart( nRawId, X_AX(), 180)
EgtSetInfo( nDispId, 'TYPE', 'MID2')
EgtSetInfo( nDispId, 'ROT', -2)
elseif sDownOrSideOrStd == 'side' then
if bPreMove then EgtMoveRawPart( nRawId, vtMove) end
EgtRotateRawPart( nRawId, X_AX(), EgtIf( BD.RIGHT_LOAD, -90, 90))
if not bPreMove then EgtMoveRawPart( nRawId, vtMove) end
EgtSetInfo( nDispId, 'TYPE', 'MID2')
EgtSetInfo( nDispId, 'ROT', -1)
else
EgtSetInfo( nDispId, 'TYPE', 'END')
end
EgtSetInfo( nDispId, 'ORD', nOrd)
-- se grezzo successivo senza pezzi e finale, va tolto
local nNextRawId = EgtGetNextRawPart( nRawId)
if nNextRawId and EgtGetPartInRawPartCount( nNextRawId) == 0 and EgtGetRawPartBBox( nNextRawId):getDimX() < BD.MinRaw then
EgtRemoveRawPartFromCurrPhase( nNextRawId)
end
end
end
-- se è necessaria la finitura
if bFinishingNeeded or not bSplit then
local sNotes, sNotesFinal
-- se non c'è separazione va aggiunta la nota Cut per l'ultimo taglio e Precut per i tagli precedenti
if not bSplit then
sNotes = 'Precut;'
sNotesFinal = 'Cut;'
end
local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0
-- se finitura con lama
if nQ05 == 1 or nQ05 == 0 or not bSplit then
local dSawThickCheck = dSawThick
if dSawThick2 > 0 and bDoubleHorizCut then
dSawThickCheck = min( dSawThick, dSawThick2)
end
local dMaxElev = 0
if vtN:getX() > 0 then
dMaxElev = b3Raw:getMax():getX() - Proc.Box:getMin():getX()
else
dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX()
end
-- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard
if bSplit or dMaxElev > dSawThickCheck then
local bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dLenEndRaw, nil, false, true, b3Raw, sNotes, dCurrOvmT)
if sNotesFinal then
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal)
end
return bOk, sErr, nNewPhase
end
-- se finitura con truciolatore
elseif nQ05 == 2 then
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
local sPocketing = ML.FindPocketing( 'OpenPocket', nil, 0)
if not sPocketing then
local sErr = 'Error : pocketing not found in library'
EgtOutLog( sErr)
return false, sErr
end
local bOk, sErr = Pocket.Make( Proc, Proc.Id, 0, sPocketing, nPartId, b3Solid)
if sNotesFinal then
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal)
end
return bOk, sErr, nNewPhase
end
end
end
-- se tagli standard
if not bDoubleHorizCut then
-- calcolo extra taglio ed accorciamento
@@ -215,10 +457,12 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
end
-- se necessari tagli in doppio, eseguo gli opposti
if bDoubleCut then
-- gli accorciamenti vanno invertiti per il taglio opposto
local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL
local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw)
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStartDoubleCut, dAccEndDoubleCut, sNotes, b3Raw, true)
if not bOk then return false, sErr end
end
end
@@ -236,27 +480,16 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
end
-- altrimenti necessari tagli da sopra e sotto con testa opportuna
else
-- recupero la lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'TailSide_H2')
-- verifico esistenza della lavorazione con lama da sotto
if not sCutting2 then
local sErr = 'Error : cutting H2 not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati della seconda lama
local dSawDiam2 = 400
local dMaxDepth2 = 50
if EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
end
end
-- verifico che le due lame riescano a lavorare la sezione
local dDimZ = b3Raw:getDimZ()
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
if dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0 then
if ( dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0) and not bBigSectionCut then
local sErr = 'Error : section too big for tail cut'
EgtOutLog( sErr)
return false, sErr
@@ -265,11 +498,14 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
local dAccStart = 0
-- limiti da sotto
local dVzLimDwnUp
if BD.TURN then dVzLimDwnUp = -2 end
-- eseguo i tagli da sotto necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL
local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, nil, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw)
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw)
if not bOk then return false, sErr end
end
-- eseguo i tagli da sopra necessari
@@ -281,11 +517,11 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
else
sNotes = EgtIf( i == 1, 'Cut;', 'Precut;')
end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw)
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw)
if not bOk then return false, sErr end
end
end
return true
return true, nil, nNewPhase
end
---------------------------------------------------------------------
+17 -27
View File
@@ -1,5 +1,6 @@
-- ProcessStepJoint.lua by Egaltech s.r.l. 2022/01/26
-- ProcessStepJoint.lua by Egaltech s.r.l. 2022/11/03
-- Gestione calcolo giunto a gradino per Travi
-- 2022/11/03 Correzione per riconoscimento testa da sotto su fresatura.
-- Tabella per definizione modulo
local ProcessStepJoint = {}
@@ -83,16 +84,14 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero la lavorazione
local sMillType = 'Mark'
local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1)
local sMilling = ML.FindMilling( sMillType .. EgtIf( bDownHead, '_H2', ''))
if not sMilling and bDownHead then
sMilling = ML.FindMilling( sMillType)
bDownHead = false
end
local sMilling, bH2
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead)
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
return false, sErr
end
bDownHead = ( bDownHead and bH2)
-- Inserisco la lavorazione del lato standard
local sName1 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch1Id = EgtAddMachining( sName1, sMilling)
@@ -109,7 +108,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -132,7 +131,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -191,15 +190,15 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- se convesso, lo tratto come due tagli singoli
if bConvex then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- lavoro per prima la faccia più diretta in alto
local vOrd = { 1, 2}
if vtN[2]:getZ() > vtN[1]:getZ() then
@@ -247,20 +246,12 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
end
-- verifico se necessari tagli supplementari
local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
--DC.PrintOrderCut( vCuts)
if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
@@ -383,7 +374,6 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- Taglio la faccia 2
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
@@ -391,6 +381,7 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sErr)
return false, sErr
end
-- Taglio la faccia 2
-- creo piano di taglio coincidente con la faccia 2 e lo lavoro
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptC[3], vtN[3], b3Solid, GDB_RT.GLOB)
if AddId then
@@ -409,13 +400,12 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
end
-- verifico se necessari tagli supplementari
local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
--DC.PrintOrderCut( vCuts)
if #vCuts > 0 then
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
+22 -34
View File
@@ -1,5 +1,6 @@
-- ProcessStepJointNotch.lua by Egaltech s.r.l. 2022/01/25
-- ProcessStepJointNotch.lua by Egaltech s.r.l. 2022/11/03
-- Gestione calcolo tacca a gradino per Travi
-- 2022/11/03 Correzione per riconoscimento testa da sotto su fresatura.
-- Tabella per definizione modulo
local ProcessStepJointNotch = {}
@@ -57,11 +58,8 @@ local function MachineByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Solid,
local bDownHead = ( BD.DOWN_HEAD and vtN[nBigInd]:getZ() < -0.5)
-- recupero la lavorazione
local sCutType = 'HeadSide'
local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', ''))
if not sCutting and bTopHead then
sCutting = ML.FindCutting( sCutType)
bDownHead = false
end
local sCutting
sCutting, bDownHead = ML.FindCutting( sCutType, bTopHead, bDownHead)
if not sCutting then
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
@@ -84,21 +82,20 @@ local function MachineByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Solid,
if dAng < -90.5 and dAng > -179.5 then
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
end
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- verifico se necessari tagli supplementari
local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
--DC.PrintOrderCut( vCuts)
if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
@@ -162,11 +159,7 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
local bTopHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() > -0.1)
local bDownHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() < 0.1)
-- recupero la lavorazione
local sPocketing = ML.FindPocketing( sMchFind.. EgtIf( bDownHead, '_H2', ''), dDiamTool, dElev + dCollSic)
if not sPocketing and bTopHead then
sPocketing = ML.FindPocketing( sMchFind, dDiamTool, dElev + dCollSic)
bDownHead = false
end
local sPocketing, _, _, bDownHead = ML.FindPocketing( sMchFind.. EgtIf( bDownHead, '_H2', ''), dDiamTool, dElev + dCollSic, nil, bTopHead, bDownHead)
if not sPocketing then
local sErr = 'Error : pocketing not found in library'
EgtOutLog( sErr)
@@ -202,10 +195,10 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
-- imposto elevazione
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -271,10 +264,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN,
-- scelta lavorazione
local sMilling
local sTypeMill = EgtIf( nUseRoughTool > 0, 'Long2Cut', 'LongSmallCut')
sMilling = ML.FindMilling( sTypeMill .. EgtIf( bDownHead, '_H2', ''), nil, sTuuidMstr)
if not sMilling and bTopHead then
sMilling = ML.FindMilling( sTypeMill, nil, sTuuidMstr)
end
sMilling = ML.FindMilling( sTypeMill, nil, sTuuidMstr, nil, nil, bTopHead, bDownHead)
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
@@ -319,7 +309,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN,
EgtSetMachiningParam( MCH_MP.LIPERP, 20)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.AS_LI)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -534,16 +524,14 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero la lavorazione
local sMillType = 'Mark'
local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1)
local sMilling = ML.FindMilling( sMillType .. EgtIf( bDownHead, '_H2', ''))
if not sMilling and bDownHead then
sMilling = ML.FindMilling( sMillType)
bDownHead = false
end
local sMilling, bH2
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead)
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
return false, sErr
end
bDownHead = ( bDownHead and bH2)
if bExeNormal then
-- Inserisco la lavorazione del lato standard
local sName1 = 'SJN_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -561,7 +549,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -586,7 +574,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
+61 -87
View File
@@ -1,6 +1,11 @@
-- ProcessTenon.lua by Egaltech s.r.l. 2021/10/04
-- ProcessTenon.lua by Egaltech s.r.l. 2022/11/03
-- Gestione calcolo tenone per Travi
-- 2021/10/04 Corretto calcolo HCING per pezzi piccoli.
-- 2022/02/15 Aggiornata VerifyOrientation per macchine con testa da sotto.
-- 2022/05/18 Migliorata gestione attacco.
-- 2022/05/28 Spostato calcolo svuotatura in modulo di libreria.
-- 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).
-- Tabella per definizione modulo
local ProcessTenon = {}
@@ -8,6 +13,7 @@ local ProcessTenon = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessTenon started', 1)
@@ -19,6 +25,10 @@ local ML = require( 'MachiningLib')
---------------------------------------------------------------------
local function VerifyOrientation( Proc, vtN, b3Raw)
-- se PF con testa da sotto, ammessa qualunque orientazione
if BD.C_SIMM and BD.DOWN_HEAD then
return true
end
-- se trave molto bassa
if b3Raw:getDimZ() <= 120 then
-- se tenone praticamente in asse, accetto fino a -45 deg
@@ -73,41 +83,6 @@ function ProcessTenon.Classify( Proc, b3Raw)
return true, bDown
end
---------------------------------------------------------------------
local function ApplyPocket( Proc, sPocketing, nStep, dSurfStep, nIdSurf, vtExtr)
-- inserisco la lavorazione di svuotatura
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. nStep
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nIdSurf, -1}})
-- imposto uso faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
if dSurfStep > 0 then
-- imposto elevazione
local sNotes = 'MaxElev=' .. EgtNumToString( dSurfStep, 2) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
end
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
return true
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
@@ -147,16 +122,35 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local vtN = vtExtr
local ptC = ptBC + vtN * dTenH
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
-- determino larghezza massima di svuotatura
local b3Aux = EgtGetBBoxRef( AuxId, GDB_BB.STANDARD, frTen)
local dPockX = max( b3Ten:getMax():getX() - b3Aux:getMax():getX(), b3Aux:getMin():getX() - b3Ten:getMin():getX())
local dPockY = max( b3Ten:getMax():getY() - b3Aux:getMax():getY(), b3Aux:getMin():getY() - b3Ten:getMin():getY())
local dPockL = sqrt( dPockX * dPockX + dPockY * dPockY)
-- determino larghezza svuotatura per calcolare il numero di passate laterali
-- ricavo i contorni della faccia principale
local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( Proc.Id, 0, EgtGetParent( Proc.Id))
local dPockL = 0
-- ricavo la massima distanza tra gli estremi della faccia e la curva del tenone
if nLoopId then
local dUmin, dUmax = EgtCurveDomain( nLoopId)
for dU = dUmin, dUmax do
local ptP = EgtUP( nLoopId, dU, GDB_ID.ROOT)
local ptNear = EgtNP( AuxId, ptP, GDB_ID.ROOT)
local dDist = dist( ptP, ptNear)
if dDist > dPockL then
dPockL = dDist
end
end
-- cancello i contorni dopo averli analizzati
for i = 1, nLoopCnt do
EgtErase( nLoopId + i - 1)
end
else
-- se il metodo sopra non funziona uso il metodo semplice (distanza tra gli angoli retti della curva tenone e faccia principale)
local b3Aux = EgtGetBBoxRef( AuxId, GDB_BB.STANDARD, frTen)
local dPockX = max( b3Ten:getMax():getX() - b3Aux:getMax():getX(), b3Aux:getMin():getX() - b3Ten:getMin():getX())
local dPockY = max( b3Ten:getMax():getY() - b3Aux:getMax():getY(), b3Aux:getMin():getY() - b3Ten:getMin():getY())
dPockL = sqrt( dPockX * dPockX + dPockY * dPockY)
end
-- abilitazione lavorazione da sotto
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
-- porto inizio curva il più possibile sul bordo
BL.PutStartNearestToEdge( AuxId, b3Solid, bMillDown and not bShortPart)
-- se vero tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa
if Proc.Prc ~= 52 and
( not AreSameOrOppositeVectorApprox( vtN, X_AX()) or
@@ -176,43 +170,16 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- se pezzo piccolo, in coda, con piano inclinato verso il basso e macchina con testa da sotto applico svuotatura
if bShortPart and vtExtr:getX() < 0 and vtExtr:getZ() < -0.09 and BD.DOWN_HEAD then
-- recupero la lavorazione
local sPockType = EgtIf( bMillDown, 'OpenPocket_H2', 'OpenPocket')
local sPocketing = ML.FindPocketing( sPockType)
local dMaxDepth = 100
local dStep = 30
local nSurfStep
-- acquisisco i dati necessari dall'utensile
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
dStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or dStep
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- acquisisco elevazione
local dElev = BL.GetFaceElevation( AddId, 0, nPartId)
nSurfStep = ceil( dElev / dMaxDepth)
dSurfStep = dElev / nSurfStep
local bOk = true
local sErr
-- copio superfice al passo superfice e ci applico la lavorazione
for i = nSurfStep, 2, -1 do
local nAddIdTmp = EgtSurfTmPlaneInBBox( nAddGrpId, ptC+((dSurfStep*(i-1))*vtN), vtN, b3Solid, GDB_RT.GLOB)
if nAddIdTmp then
EgtSetName( nAddIdTmp, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( nAddIdTmp, 'TASKID', Proc.TaskId)
-- aggiungo lavorazione
bOk, sErr = ApplyPocket( Proc, sPocketing, i, (dSurfStep + 0), nAddIdTmp, vtExtr)
if not bOk then
break
end
end
end
if not bOk then
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, not bMillDown, bMillDown)
if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- faccio ultima superfice
bOk, sErr = ApplyPocket( Proc, sPocketing, 1, EgtIf( nSurfStep > 1, ( dSurfStep + 0), 0), AddId, vtExtr)
-- eseguo le svuotature necessarie
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then
return false, sErr
end
@@ -223,16 +190,17 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bFromBottom = ( bShortPart and vtExtr:getZ() > 0.25)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom)
if not bOk then return bOk, sErr end
if not bOk then
return false, sErr
end
end
end
end
-- recupero la lavorazione
local sMillType = 'Tenon'
local sCurrType = sMillType .. EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sCurrType, dTenH) or ML.FindMilling( sCurrType)
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType, dTenH) or ML.FindMilling( sMillType)
local sMilling, _, _, bH2 = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
end
if not sMilling then
local sErr = 'Error : milling not found in library'
@@ -252,6 +220,13 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCW = ( dSpeed >= 0)
end
end
-- massimo numero di passate e coefficiente di sovrapposizione ta passate
local MAX_PASS = 6
local OVERLAP_COEFF = 0.7
-- porto inizio curva il più possibile sul bordo in alto o in basso
local dMaxDist = OVERLAP_COEFF * dMillDiam * MAX_PASS
local bMyShortPart = ( bShortPart and vtN:getX() < 0 and abs( vtN:getX()) < 0.999 and abs( vtN:getY()) < 0.259)
BL.PutStartNearestToEdge( AuxId, b3Solid, dMaxDist, ( bH2 and bMillDown) ~= bMyShortPart)
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
local sWarn
local dDepth = 0
@@ -262,9 +237,8 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
end
-- determino il numero di passate concentriche (max 6)
local MAX_PASS = 6
local nPass = min( ceil( dPockL / ( 0.7 * dMillDiam)), MAX_PASS)
local dStep = min( dPockL, 0.7 * dMillDiam * MAX_PASS) / nPass
local nPass = min( ceil( dPockL / ( OVERLAP_COEFF * dMillDiam)), MAX_PASS)
local dStep = min( dPockL, OVERLAP_COEFF * dMillDiam * MAX_PASS) / nPass
for i = nPass, 1, -1 do
-- inserisco la passata finale della lavorazione
local sNameF = 'TenF_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -293,7 +267,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
if not BD.C_SIMM and not BD.TURN then
nSCC = MCH_SCC.ADIR_YM
if abs( vtExtr:getY()) > 0.088 then
nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
@@ -301,7 +275,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
+4 -7
View File
@@ -46,7 +46,7 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId)
return false, sErr
end
-- verifico che il testo non sia orientato verso il basso (-5 deg)
if vtN:getZ() < - 0.1 and not BD.DOWN_HEAD then
if vtN:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Text from bottom impossible'
EgtOutLog( sErr)
return false, sErr
@@ -56,11 +56,8 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId)
local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.174)
-- recupero la lavorazione
local sMillType = 'Text'
local sMchExt = EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sMillType..sMchExt)
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType)
end
--local sMchExt = EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr)
@@ -83,7 +80,7 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
+20 -13
View File
@@ -1,5 +1,6 @@
-- ProcessTyroleanDovetail.lua by Egaltech s.r.l. 2020/10/14
-- ProcessTyroleanDovetail.lua by Egaltech s.r.l. 2022/03/21
-- Gestione calcolo giunzione tirolese
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessTyroleanDovetail = {}
@@ -116,7 +117,12 @@ function ProcessTyroleanDovetail.Classify( Proc, b3Raw)
-- considerazioni: al momento non è possibile sapere se ci sono due rastremature o una quindi se è rivolta verso il basso
-- viene dato errore, altrimenti si potrebbe imporre la rotazione di 180 (ovviamente con una sola rastrematura rivolta verso il basso)
if abs(vtN:getZ()) > abs(vtN:getX()) and abs(vtN:getZ()) > abs(vtN:getY()) and vtN:getZ() < -0.5 then
return false
-- se con due facce e corto è fattibile
if nFacetCnt < 3 and Proc.Box:getDimX() <= BD.GetMaxLenRidgeLapFromBottom( b3Raw:getDimZ()) then
return true
else
return false
end
end
end
end
@@ -136,7 +142,7 @@ local function EvaluateQParam( Proc, sDephtCham)
end
---------------------------------------------------------------------
local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt)
local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt, dOvmTail)
-- dati delle facce
local ptC = {}
@@ -203,7 +209,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -219,7 +225,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
@@ -251,15 +257,14 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
elseif vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
end
if #vCuts > 0 then
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
@@ -318,7 +323,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
@@ -452,7 +457,7 @@ local function MakeMillCut( Proc, i, j, k, sMilling, nFacInd, TabNAD, rfFac, dOf
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -472,7 +477,7 @@ local function MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -667,7 +672,9 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessTyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessTyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- in base al tipo di feature attribuisco il significato dei parametri Q
@@ -689,7 +696,7 @@ function ProcessTyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
-- se ho due facce allora è di testa
if nFacetCnt == 2 then
local bOk, sErr = MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt)
local bOk, sErr = MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt, dOvmTail)
if not bOk then return bOk, sErr end
else
local bOk, sErr = MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt)
+157 -34
View File
@@ -1,5 +1,7 @@
-- BeamNestProcess.lua by Egaltech s.r.l. 2021/06/14
-- Gestione nesting automatico pareti
-- Gestione nesting automatico travi
-- 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
-- Intestazioni
require( 'EgtBase')
@@ -114,9 +116,24 @@ local function NewMachGroupName()
return nMaxMachGroup + 1
end
local function TotRawCount(Raws)
local nTotRaws = 0
for RawIndex = 1, #Raws do
nTotRaws = nTotRaws + Raws[RawIndex].Count
end
return nTotRaws
end
local function TotPartLen(Parts)
local nTotPartLen = 0
for PartIndex = 1, #Parts do
nTotPartLen = nTotPartLen + ( Parts[PartIndex].Len * Parts[PartIndex].Cnt)
end
return nTotPartLen
end
-- Imposto direttorio libreria specializzata per Travi
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
EgtAddToPackagePath( NEST.BASEDIR .. '\\LuaLibs\\?.lua')
-- Imposto la macchina corrente e verifico sia abilitata per la lavorazione delle Travi
EgtSetCurrMachine( NEST.MACHINE)
@@ -133,73 +150,178 @@ end
EgtRemoveBaseMachineDirFromPackagePath()
EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua')
---- Carico le librerie
--_G.package.loaded.WallExec = nil
--local WE = require( 'BeamExec')
--_G.package.loaded.WallLib = nil
--local WL = require( 'BeamLib')
--_G.package.loaded.WProcessLapJoint = nil
--local LapJoint = require( 'WProcessLapJoint')
-- Inizializzo contatori errori e avvisi
local nErrCnt = 0
local nWarnCnt = 0
-- Grezzi
local Raws = { LenToFill = LEN["1"], StartGap = NEST.STARTOFFSET, MidGap = NEST.OFFSET, EndGap = 0, SortType = -1, Count = QTY["1"]}
local nTotRaws = Raws.Count
-- lista dei grezzi
local Raws = {}
-- creo tabella dei grezzi
for nIndex, nLen in pairs( LEN) do
table.insert(Raws, {LenToFill = nLen, StartGap = NEST.STARTOFFSET, MidGap = NEST.OFFSET, EndGap = 0, SortType = -1})
end
for nIndex, nQty in pairs( QTY) do
Raws[tonumber(nIndex)].Count = nQty
end
--local nTotRaws = Raws.Count
-- Pezzi
local Parts = {}
-- cerco il grezzo con la lunghezza maggiore, epurata dello start gap
local maxRawLenToFillNoStartGap = 0
for RawIndex = 1, #Raws do
maxRawLenToFillNoStartGap = max( maxRawLenToFillNoStartGap, Raws[RawIndex].LenToFill - Raws[RawIndex].StartGap)
end
-- ciclo su pezzi per aggiungerli al nesting
for nPartId, nCount in pairs( PART) do
-- recupero lunghezza pezzo
local Len = EgtGetInfo( nPartId, "L", 'd')
local DispLen = EgtIf( Len < 1000, 2000, 0)
table.insert( Parts, {Id = nPartId, Len = Len, DispLen = DispLen, Cnt = nCount})
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
if Len < maxRawLenToFillNoStartGap then
table.insert( Parts, {Id = nPartId, Len = Len, DispLen = DispLen, Cnt = nCount})
end
end
-- lunghezza totale pezzi
local dTotPartLen = TotPartLen( Parts)
-- calcolo media delle barre necessarie
local NeededRawsForType = {}
for RawIndex = 1, #Raws do
NeededRawsForType[RawIndex] = min( ceil( dTotPartLen / Raws[RawIndex].LenToFill), Raws[RawIndex].Count)
end
local RawQtySum = 0
for NeededRawIndex = 1, #NeededRawsForType do
RawQtySum = RawQtySum + NeededRawsForType[NeededRawIndex]
end
local MediumRawQty = ceil( RawQtySum / #NeededRawsForType)
if MediumRawQty > 1 then
MediumRawQty = MediumRawQty - 1
end
-- recupero pezzi piu' corti di mille
local ShortList = {}
local LongList = {}
for PartIndex = 1, #Parts do
if Parts[PartIndex].Len <= 1000 then
table.insert( ShortList, Parts[PartIndex])
else
table.insert( LongList, Parts[PartIndex])
end
end
-- numero di pezzi piccoli per barra
local ShortCount = 0
for ShortIndex = 1, #ShortList do
ShortCount = ShortCount + ShortList[ShortIndex].Cnt
end
local ShortForRaw = floor( ShortCount / MediumRawQty)
local ExtraShortForRaw = 0
if MediumRawQty > 0 then
ExtraShortForRaw = fmod( ShortCount, MediumRawQty)
end
-- creo lista pezzi corti singoli
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
-- 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 nRawTot = 0
local dTime = 0
while Raws.Count > 0 and PartsToFill( Parts) > 0 do
-- Eseguo ottimizzazione per una barra e visualizzo il risultato
local Res = ExecMaximumFilling( Raws, Parts)
local nCycle = 1
while TotRawCount( Raws) > 0 and PartsToFill( Parts) > 0 do
-- creo lista pezzi 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, #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 Res.DiffParts > 0 then
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.LenToFill)
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.StartGap
local CurrX = Raws[nMinWasteRawIndex].StartGap
local nInfoIndex = 1
for i = 1, Res.DiffParts do
local PartIndex = Res.Data[i].Id
local PartId = Parts[PartIndex].Id
local dLen = Parts[PartIndex].Len
for j = 1, Res.Data[i].Count do
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.MidGap
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
-- Aggiorno per prossima iterazione
Raws.Count = Raws.Count - 1
for i = 1, Res.DiffParts do
local PartId = Res.Data[i].Id
Parts[PartId].Cnt = Parts[PartId].Cnt - Res.Data[i].Count
end
nCycle = nCycle + 1
end
-- creo grezzi per ogni gruppo di lavorazione
@@ -208,6 +330,7 @@ _G.BEAM = {}
BEAM.FILE = NEST.FILE
BEAM.MACHINE = NEST.MACHINE
BEAM.FLAG = 6 -- CREATE_PANEL
BEAM.BASEDIR = NEST.BASEDIR
nMachGroup = EgtGetFirstMachGroup()
while nMachGroup do
local nNextMachGroup = EgtGetNextMachGroup( nMachGroup)
@@ -215,7 +338,7 @@ while nMachGroup do
if EgtGetInfo( nMachGroup, "AUTONEST",'i') == 1 then
EgtRemoveInfo( nMachGroup, "AUTONEST")
EgtSetInfo( nMachGroup, "UPDATEUI", 1)
local bOk, sErr = pcall( dofile, EgtGetSourceDir() .. "BatchProcessNew.lua")
local bOk, sErr = pcall( dofile, BEAM.BASEDIR .. "\\BatchProcessNew.lua")
if not bOk then
EgtOutLog( 'Error in BatchProcessNew.lua call (' .. ( sErr or '') ..')')
end
+1 -2
View File
@@ -11,8 +11,7 @@ _ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Travi
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua')
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi
local sMachDir = EgtGetCurrMachineDir()